Skip to contentSkip to conversation

bthost: Add qos support to bthost_set_cig_params

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages Aug 5, 2022 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 bthost: Add qos support to bthost_set_cig_params

From: Luiz Augusto von Dentz <[email protected]>

This enables setting QoS other then the mandatory 16_2_1.

---
 emulator/bthost.c | 26 +++++++++++++++-----------
 emulator/bthost.h |  4 +++-
 2 files changed, 18 insertions(+), 12 deletions(-)
emulator/bthost.c +15 -11
index 75fa625b1..f067d39a0 100644
@@ -3131,25 +3131,29 @@ bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr)
 }
 
 void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id,
-						uint8_t cis_id)
+				uint8_t cis_id, const struct bt_iso_qos *qos)
 {
 	struct bt_hci_cmd_le_set_cig_params *cp;
 
 	cp = malloc(sizeof(*cp) + sizeof(*cp->cis));
 	memset(cp, 0, sizeof(*cp) + sizeof(*cp->cis));
 	cp->cig_id = cig_id;
-	put_le24(10000, cp->c_interval);
-	put_le24(10000, cp->p_interval);
-	cp->c_latency = cpu_to_le16(10);
-	cp->p_latency = cpu_to_le16(10);
+	put_le24(qos->in.interval ? qos->in.interval : qos->out.interval,
+							cp->c_interval);
+	put_le24(qos->out.interval ? qos->out.interval : qos->in.interval,
+							cp->p_interval);
+	cp->c_latency = cpu_to_le16(qos->in.latency ? qos->in.latency :
+							qos->out.latency);
+	cp->p_latency = cpu_to_le16(qos->out.latency ? qos->out.latency :
+							qos->in.latency);
 	cp->num_cis = 0x01;
 	cp->cis[0].cis_id = cis_id;
-	cp->cis[0].c_sdu = 40;
-	cp->cis[0].p_sdu = 40;
-	cp->cis[0].c_phy = 0x02;
-	cp->cis[0].p_phy = 0x02;
-	cp->cis[0].c_rtn = 2;
-	cp->cis[0].p_rtn = 2;
+	cp->cis[0].c_sdu = qos->in.sdu;
+	cp->cis[0].p_sdu = qos->out.sdu;
+	cp->cis[0].c_phy = qos->in.phy ? qos->in.phy : qos->out.phy;
+	cp->cis[0].p_phy = qos->out.phy ? qos->out.phy : qos->in.phy;
+	cp->cis[0].c_rtn = qos->in.rtn;
+	cp->cis[0].p_rtn = qos->out.rtn;
 
 	send_command(bthost, BT_HCI_CMD_LE_SET_CIG_PARAMS, cp,
 				sizeof(*cp) + sizeof(*cp->cis));
emulator/bthost.h +3 -1
index fd177ac29..3d7a124f0 100644
@@ -12,6 +12,8 @@
 #include <stdint.h>
 #include <sys/uio.h>
 
+#include "lib/bluetooth.h"
+
 typedef void (*bthost_send_func) (const struct iovec *iov, int iovlen,
 							void *user_data);
 
@@ -101,7 +103,7 @@ void bthost_create_big(struct bthost *bthost, uint8_t num_bis);
 bool bthost_search_ext_adv_addr(struct bthost *bthost, const uint8_t *addr);
 
 void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id,
-						uint8_t cis_id);
+				uint8_t cis_id, const struct bt_iso_qos *qos);
 void bthost_create_cis(struct bthost *bthost, uint16_t cis_handle,
 						uint16_t acl_handle);
 
Signature · 1 line
2.37.1
author maintainer
#1 lore raw

PATCH 2/2 iso-tester: Add ISO 48_2_1 Defer Receive - Success

From: Luiz Augusto von Dentz <[email protected]>

This adds a test to check if different QoS are properly handled when acting as peripheral.

---
 tools/iso-tester.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
tools/iso-tester.c +20 -2
index 56c17b78b..df46bc953 100644
@@ -541,6 +541,12 @@ static const struct iovec send_16_2_1 = {
 	.iov_len = sizeof(data_16_2_1),
 };
 
+static const uint8_t data_48_2_1[100] = { [0 ... 99] = 0xff };
+static const struct iovec send_48_2_1 = {
+	.iov_base = (void *)data_48_2_1,
+	.iov_len = sizeof(data_48_2_1),
+};
+
 static const struct iso_client_data connect_16_2_1_send = {
 	.qos = QOS_16_2_1,
 	.expect_err = 0,
@@ -582,6 +588,14 @@ static const struct iso_client_data listen_16_2_1_defer_recv = {
 	.defer = true,
 };
 
+static const struct iso_client_data listen_48_2_1_defer_recv = {
+	.qos = QOS_48_2_1,
+	.expect_err = 0,
+	.recv = &send_48_2_1,
+	.server = true,
+	.defer = true,
+};
+
 static const struct iso_client_data listen_16_2_1_defer_reject = {
 	.qos = QOS_16_2_1,
 	.expect_err = -1,
@@ -973,7 +987,7 @@ static bool check_io_qos(const struct bt_iso_io_qos *io1,
 		return false;
 	}
 
-	if (io1->sdu != io2->sdu) {
+	if (io1->sdu && io2->sdu && io1->sdu != io2->sdu) {
 		tester_warn("Unexpected IO SDU: %u != %u", io1->sdu, io2->sdu);
 		return false;
 	}
@@ -1450,7 +1464,7 @@ static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func)
 		client = hciemu_get_client(data->hciemu, 0);
 		host = hciemu_client_host(client);
 
-		bthost_set_cig_params(host, 0x01, 0x01);
+		bthost_set_cig_params(host, 0x01, 0x01, &isodata->qos);
 		bthost_create_cis(host, 257, data->acl_handle);
 	}
 }
@@ -1701,6 +1715,10 @@ int main(int argc, char *argv[])
 	test_iso("ISO Defer Receive - Success", &listen_16_2_1_defer_recv,
 						setup_powered, test_listen);
 
+	test_iso("ISO 48_2_1 Defer Receive - Success",
+						&listen_48_2_1_defer_recv,
+						setup_powered, test_listen);
+
 	test_iso("ISO Defer Reject - Success", &listen_16_2_1_defer_reject,
 						setup_powered, test_listen);
 
Signature · 1 line
2.37.1
#2 lore raw
In reply to Luiz Augusto von Dentz

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=665769

---Test result---

Test Summary:

CheckPatch                    PASS      1.58 seconds
GitLint                       PASS      1.07 seconds
Prep - Setup ELL              PASS      26.60 seconds
Build - Prep                  PASS      0.58 seconds
Build - Configure             PASS      8.21 seconds
Build - Make                  PASS      755.02 seconds
Make Check                    PASS      11.68 seconds
Make Check w/Valgrind         PASS      283.39 seconds
Make Distcheck                PASS      233.84 seconds
Build w/ext ELL - Configure   PASS      8.23 seconds
Build w/ext ELL - Make        PASS      81.38 seconds
Incremental Build w/ patches  FAIL      21.97 seconds
Scan Build                    PASS      489.14 seconds

Details
##############################
Test: Incremental Build w/ patches - FAIL
Desc: Incremental build per patch in the series
Output:
tools/iso-tester.c: In function ‘setup_listen’:
tools/iso-tester.c:1453:3: error: too few arguments to function ‘bthost_set_cig_params’

 1453 |   bthost_set_cig_params(host, 0x01, 0x01);
      |   ^~~~~~~~~~~~~~~~~~~~~
In file included from tools/iso-tester.c:27:
./emulator/bthost.h:105:6: note: declared here
  105 | void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id,
      |      ^~~~~~~~~~~~~~~~~~~~~

make[1]: *** [Makefile:7345: tools/iso-tester.o] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4355: all] Error 2

---
Regards,
Linux Bluetooth