linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS
@ 2025-12-22 19:35 Luiz Augusto von Dentz
  2025-12-22 19:35 ` [PATCH BlueZ v1 2/3] emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-12-22 19:35 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The fields of BT_HCI_CMD_LE_SET_CIG_PARAMS are bitfields rather than
values, so this changes the fields to phy's' and fixes the parsing to
print it as bitfield rather than value.
---
 emulator/btdev.c  |  4 ++--
 emulator/bthost.c |  4 ++--
 monitor/bt.h      | 12 ++++++------
 monitor/ll.c      |  8 ++++----
 monitor/packet.c  | 18 +++++++++---------
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index be43623e8bfb..f66fe4c78d03 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -6977,8 +6977,8 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
 		memset(evt.cig_sync_delay, 0, sizeof(evt.cig_sync_delay));
 		memset(evt.cis_sync_delay, 0, sizeof(evt.cis_sync_delay));
 
-		evt.c_phy = le_cig->cis[cis_idx].c_phy;
-		evt.p_phy = le_cig->cis[cis_idx].p_phy;
+		evt.c_phy = le_cig->cis[cis_idx].c_phys;
+		evt.p_phy = le_cig->cis[cis_idx].p_phys;
 		evt.nse = 0x01;
 		evt.c_bn = 0x01;
 		evt.p_bn = 0x01;
diff --git a/emulator/bthost.c b/emulator/bthost.c
index 935b4ba60fb2..c9eba77cff7b 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -3886,9 +3886,9 @@ void bthost_set_cig_params(struct bthost *bthost, uint8_t cig_id,
 	cp->cis[0].cis_id = cis_id;
 	cp->cis[0].c_sdu = qos->ucast.in.sdu;
 	cp->cis[0].p_sdu = qos->ucast.out.sdu;
-	cp->cis[0].c_phy = qos->ucast.in.phy ? qos->ucast.in.phy :
+	cp->cis[0].c_phys = qos->ucast.in.phy ? qos->ucast.in.phy :
 							qos->ucast.out.phy;
-	cp->cis[0].p_phy = qos->ucast.out.phy ? qos->ucast.out.phy :
+	cp->cis[0].p_phys = qos->ucast.out.phy ? qos->ucast.out.phy :
 							qos->ucast.in.phy;
 	cp->cis[0].c_rtn = qos->ucast.in.rtn;
 	cp->cis[0].p_rtn = qos->ucast.out.rtn;
diff --git a/monitor/bt.h b/monitor/bt.h
index 1c753b694883..0a1508ea28a9 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -197,8 +197,8 @@ struct bt_ll_clock_acc {
 struct bt_ll_cis_req {
 	uint8_t  cig;
 	uint8_t  cis;
-	uint8_t  c_phy;
-	uint8_t  p_phy;
+	uint8_t  c_phys;
+	uint8_t  p_phys;
 	uint16_t c_sdu;
 	uint16_t p_sdu;
 	uint8_t  c_interval[3];
@@ -2720,8 +2720,8 @@ struct bt_hci_cis_params {
 	uint8_t  cis_id;
 	uint16_t c_sdu;
 	uint16_t p_sdu;
-	uint8_t  c_phy;
-	uint8_t  p_phy;
+	uint8_t  c_phys;
+	uint8_t  p_phys;
 	uint8_t  c_rtn;
 	uint8_t  p_rtn;
 } __attribute__ ((packed));
@@ -2755,8 +2755,8 @@ struct bt_hci_cis_params_test {
 	uint16_t p_sdu;
 	uint16_t c_pdu;
 	uint16_t p_pdu;
-	uint8_t  c_phy;
-	uint8_t  p_phy;
+	uint8_t  c_phys;
+	uint8_t  p_phys;
 	uint8_t  c_bn;
 	uint8_t  p_bn;
 } __attribute__ ((packed));
diff --git a/monitor/ll.c b/monitor/ll.c
index 4d65d183f958..6c0f67b5dcae 100644
--- a/monitor/ll.c
+++ b/monitor/ll.c
@@ -656,16 +656,16 @@ static void cis_req(const void *data, uint8_t size)
 
 	print_field("CIG ID: 0x%2.2x", cmd->cig);
 	print_field("CIS ID: 0x%2.2x", cmd->cis);
-	print_field("Central to Peripheral PHY: 0x%2.2x", cmd->c_phy);
+	print_field("Central to Peripheral PHYs: 0x%2.2x", cmd->c_phys);
 
-	mask = print_bitfield(2, cmd->c_phy, le_phys);
+	mask = print_bitfield(2, cmd->c_phys, le_phys);
 	if (mask)
 		print_text(COLOR_UNKNOWN_OPTIONS_BIT, "  Reserved"
 							" (0x%2.2x)", mask);
 
-	print_field("Peripheral To Central PHY: 0x%2.2x", cmd->p_phy);
+	print_field("Peripheral To Central PHYs: 0x%2.2x", cmd->p_phys);
 
-	mask = print_bitfield(2, cmd->p_phy, le_phys);
+	mask = print_bitfield(2, cmd->p_phys, le_phys);
 	if (mask)
 		print_text(COLOR_UNKNOWN_OPTIONS_BIT, "  Reserved"
 							" (0x%2.2x)", mask);
diff --git a/monitor/packet.c b/monitor/packet.c
index 8ac2d52243cb..4544c90c2d81 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7768,7 +7768,7 @@ static const struct bitfield_data le_phys[] = {
 	{ }
 };
 
-static void print_le_phy_bitfield(const char *label, uint8_t phys)
+static void print_le_phys(const char *label, uint8_t phys)
 {
 	uint8_t mask;
 
@@ -7798,8 +7798,8 @@ static void print_le_phys_preference(uint8_t all_phys, uint8_t tx_phys,
 		print_text(COLOR_UNKNOWN_OPTIONS_BIT, "  Reserved"
 							" (0x%2.2x)", mask);
 
-	print_le_phy_bitfield("TX PHYs preference", tx_phys);
-	print_le_phy_bitfield("RX PHYs preference", rx_phys);
+	print_le_phys("TX PHYs preference", tx_phys);
+	print_le_phys("RX PHYs preference", rx_phys);
 }
 
 static void le_set_default_phy_cmd(uint16_t index, const void *data,
@@ -8853,8 +8853,8 @@ static void print_cis_params(const void *data, int i)
 						le16_to_cpu(cis->c_sdu));
 	print_field("Peripheral to Central Maximum SDU Size: %u",
 						le16_to_cpu(cis->p_sdu));
-	print_le_phy("Central to Peripheral PHY", cis->c_phy);
-	print_le_phy("Peripheral to Central PHY", cis->p_phy);
+	print_le_phys("Central to Peripheral PHYs", cis->c_phys);
+	print_le_phys("Peripheral to Central PHYs", cis->p_phys);
 	print_field("Central to Peripheral Retransmission attempts: 0x%2.2x",
 							cis->c_rtn);
 	print_field("Peripheral to Central Retransmission attempts: 0x%2.2x",
@@ -8900,8 +8900,8 @@ static void print_cis_params_test(const void *data, int i)
 						le16_to_cpu(cis->c_pdu));
 	print_field("Peripheral to Central Maximum PDU: 0x%4.4x",
 						le16_to_cpu(cis->p_pdu));
-	print_le_phy("Central to Peripheral PHY", cis->c_phy);
-	print_le_phy("Peripheral to Central PHY", cis->p_phy);
+	print_le_phys("Central to Peripheral PHYs", cis->c_phys);
+	print_le_phys("Peripheral to Central PHYs", cis->p_phys);
 	print_field("Central to Peripheral Burst Number: 0x%2.2x", cis->c_bn);
 	print_field("Peripheral to Central Burst Number: 0x%2.2x", cis->p_bn);
 }
@@ -9764,7 +9764,7 @@ static void le_fsu_cmd(uint16_t index, const void *data, uint8_t size)
 	print_field("Frame Space max: %d us (0x%4.4x)",
 				le16_to_cpu(cmd->frame_space_max),
 				le16_to_cpu(cmd->frame_space_max));
-	print_le_phy_bitfield("PHYs", cmd->phys);
+	print_le_phys("PHYs", cmd->phys);
 	print_fsu_types(cmd->types);
 }
 
@@ -13325,7 +13325,7 @@ static void le_fsu_evt(struct timeval *tv, uint16_t index,
 	print_field("Frame Space: %u us (0x%4.4x)",
 				le16_to_cpu(evt->frame_space),
 				le16_to_cpu(evt->frame_space));
-	print_le_phy_bitfield("PHYs", evt->phys);
+	print_le_phys("PHYs", evt->phys);
 	print_fsu_types(evt->types);
 }
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ v1 2/3] emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values
  2025-12-22 19:35 [PATCH BlueZ v1 1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS Luiz Augusto von Dentz
@ 2025-12-22 19:35 ` Luiz Augusto von Dentz
  2025-12-22 19:35 ` [PATCH BlueZ v1 3/3] monitor: Fix parsing of BT_HCI_BIT_LE_CREATE_BIG Luiz Augusto von Dentz
  2025-12-22 20:31 ` [BlueZ,v1,1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-12-22 19:35 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs are bitfield so they need to be
converted to values when emitting BT_HCI_EVT_LE_CIS_ESTABLISHED.
---
 emulator/btdev.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index f66fe4c78d03..6db723ce8797 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -6955,6 +6955,23 @@ static uint32_t le_cis_latecy(uint8_t ft, uint8_t iso_interval,
 	return latency >= interval ? latency : interval;
 }
 
+static uint8_t bits_to_phy(uint8_t bits)
+{
+	uint8_t phy = 0x00;
+
+	/* Convert PHY bits to PHY values on a ascending order. */
+	if (bits & BIT(0))
+		phy = 0x01; /* LE 1M */
+
+	if (bits & BIT(1))
+		phy = 0x02; /* LE 2M */
+
+	if (bits & BIT(2))
+		phy = 0x03; /* LE Coded */
+
+	return phy;
+}
+
 static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
 						uint8_t status)
 {
@@ -6977,8 +6994,8 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
 		memset(evt.cig_sync_delay, 0, sizeof(evt.cig_sync_delay));
 		memset(evt.cis_sync_delay, 0, sizeof(evt.cis_sync_delay));
 
-		evt.c_phy = le_cig->cis[cis_idx].c_phys;
-		evt.p_phy = le_cig->cis[cis_idx].p_phys;
+		evt.c_phy = bits_to_phy(le_cig->cis[cis_idx].c_phys);
+		evt.p_phy = bits_to_phy(le_cig->cis[cis_idx].p_phys);
 		evt.nse = 0x01;
 		evt.c_bn = 0x01;
 		evt.p_bn = 0x01;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ v1 3/3] monitor: Fix parsing of BT_HCI_BIT_LE_CREATE_BIG
  2025-12-22 19:35 [PATCH BlueZ v1 1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS Luiz Augusto von Dentz
  2025-12-22 19:35 ` [PATCH BlueZ v1 2/3] emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values Luiz Augusto von Dentz
@ 2025-12-22 19:35 ` Luiz Augusto von Dentz
  2025-12-22 20:31 ` [BlueZ,v1,1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-12-22 19:35 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The PHY field of BT_HCI_BIT_LE_CREATE_BIG are bitfields rather than
a value, so this changes the fields to phy's' and fixes the parsing to
print it as bitfield rather than value and also make the emulator to
use bits_to_phy to convert when emitting the likes of
BT_HCI_EVT_LE_BIG_COMPLETE.
---
 emulator/btdev.c  | 38 +++++++++++++++++++-------------------
 emulator/bthost.c |  2 +-
 monitor/bt.h      |  4 ++--
 monitor/packet.c  |  4 ++--
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 6db723ce8797..d3a9c6735ff1 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -5778,6 +5778,23 @@ static int cmd_set_pa_data(struct btdev *dev, const void *data,
 	return 0;
 }
 
+static uint8_t bits_to_phy(uint8_t bits)
+{
+	uint8_t phy = 0x00;
+
+	/* Convert PHY bits to PHY values on a ascending order. */
+	if (bits & BIT(0))
+		phy = 0x01; /* LE 1M */
+
+	if (bits & BIT(1))
+		phy = 0x02; /* LE 2M */
+
+	if (bits & BIT(2))
+		phy = 0x03; /* LE Coded */
+
+	return phy;
+}
+
 static void send_biginfo(struct btdev *dev, const struct btdev *remote,
 							uint16_t sync_handle)
 {
@@ -5806,7 +5823,7 @@ static void send_biginfo(struct btdev *dev, const struct btdev *remote,
 	ev.max_pdu = bis->sdu;
 	memcpy(ev.sdu_interval, bis->sdu_interval, sizeof(ev.sdu_interval));
 	ev.max_sdu = bis->sdu;
-	ev.phy = bis->phy;
+	ev.phy = bits_to_phy(bis->phys);
 	ev.framing = bis->framing;
 	ev.encryption = bis->encryption;
 
@@ -6955,23 +6972,6 @@ static uint32_t le_cis_latecy(uint8_t ft, uint8_t iso_interval,
 	return latency >= interval ? latency : interval;
 }
 
-static uint8_t bits_to_phy(uint8_t bits)
-{
-	uint8_t phy = 0x00;
-
-	/* Convert PHY bits to PHY values on a ascending order. */
-	if (bits & BIT(0))
-		phy = 0x01; /* LE 1M */
-
-	if (bits & BIT(1))
-		phy = 0x02; /* LE 2M */
-
-	if (bits & BIT(2))
-		phy = 0x03; /* LE Coded */
-
-	return phy;
-}
-
 static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
 						uint8_t status)
 {
@@ -7255,7 +7255,7 @@ static int cmd_create_big_complete(struct btdev *dev, const void *data,
 	}
 
 	evt.handle = cmd->handle;
-	evt.phy = bis->phy;
+	evt.phy = bits_to_phy(bis->phys);
 	evt.max_pdu = bis->sdu;
 	memcpy(evt.sync_delay, bis->sdu_interval, 3);
 	memcpy(evt.latency, bis->sdu_interval, 3);
diff --git a/emulator/bthost.c b/emulator/bthost.c
index c9eba77cff7b..fe6ad4145673 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -3831,7 +3831,7 @@ void bthost_create_big(struct bthost *bthost, uint8_t num_bis,
 	cp.bis.sdu = 40;
 	cp.bis.latency = cpu_to_le16(10);
 	cp.bis.rtn = 0x02;
-	cp.bis.phy = 0x02;
+	cp.bis.phys = BIT(2);
 	cp.bis.encryption = enc;
 	memcpy(cp.bis.bcode, bcode, sizeof(cp.bis.bcode));
 	send_command(bthost, BT_HCI_CMD_LE_CREATE_BIG, &cp, sizeof(cp));
diff --git a/monitor/bt.h b/monitor/bt.h
index 0a1508ea28a9..147b76537e97 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2818,7 +2818,7 @@ struct bt_hci_bis {
 	uint16_t sdu;
 	uint16_t latency;
 	uint8_t  rtn;
-	uint8_t  phy;
+	uint8_t  phys;
 	uint8_t  packing;
 	uint8_t  framing;
 	uint8_t  encryption;
@@ -2840,7 +2840,7 @@ struct bt_hci_bis_test {
 	uint8_t  nse;
 	uint16_t sdu;
 	uint16_t  pdu;
-	uint8_t  phy;
+	uint8_t  phys;
 	uint8_t  packing;
 	uint8_t  framing;
 	uint8_t  bn;
diff --git a/monitor/packet.c b/monitor/packet.c
index 4544c90c2d81..807d32e9b447 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -9025,7 +9025,7 @@ static void print_bis(const struct bt_hci_bis *bis)
 	print_field("Maximum Latency: %u ms (0x%4.4x)",
 			le16_to_cpu(bis->latency), le16_to_cpu(bis->latency));
 	print_field("RTN: 0x%2.2x", bis->rtn);
-	print_le_phy("PHY", bis->phy);
+	print_le_phys("PHYs", bis->phys);
 	print_packing(bis->packing);
 	print_framing(bis->framing);
 	print_field("Encryption: 0x%2.2x", bis->encryption);
@@ -9055,7 +9055,7 @@ static void print_bis_test(const void *data, int i)
 	print_field("Maximum PDU: %u", bis->pdu);
 	print_packing(bis->packing);
 	print_framing(bis->framing);
-	print_le_phy("PHY", bis->phy);
+	print_le_phys("PHYs", bis->phys);
 	print_field("Burst Number: %u", bis->bn);
 	print_field("Immediate Repetition Count: %u", bis->irc);
 	print_field("Pre Transmission Offset: 0x%2.2x", bis->pto);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,v1,1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS
  2025-12-22 19:35 [PATCH BlueZ v1 1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS Luiz Augusto von Dentz
  2025-12-22 19:35 ` [PATCH BlueZ v1 2/3] emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values Luiz Augusto von Dentz
  2025-12-22 19:35 ` [PATCH BlueZ v1 3/3] monitor: Fix parsing of BT_HCI_BIT_LE_CREATE_BIG Luiz Augusto von Dentz
@ 2025-12-22 20:31 ` bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-12-22 20:31 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 2746 bytes --]

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=1035801

---Test result---

Test Summary:
CheckPatch                    PENDING   0.30 seconds
GitLint                       PENDING   0.31 seconds
BuildEll                      PASS      19.97 seconds
BluezMake                     PASS      627.66 seconds
MakeCheck                     PASS      22.09 seconds
MakeDistcheck                 PASS      239.58 seconds
CheckValgrind                 PASS      299.14 seconds
CheckSmatch                   WARNING   350.46 seconds
bluezmakeextell               PASS      182.47 seconds
IncrementalBuild              PENDING   0.30 seconds
ScanBuild                     PASS      1031.97 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:470:29: warning: Variable length array is used.emulator/bthost.c:700:28: warning: Variable length array is used.emulator/bthost.c:701:32: warning: Variable length array is used.emulator/bthost.c:918:28: warning: Variable length array is used.emulator/bthost.c:952:28: warning: Variable length array is used.emulator/bthost.c:953:32: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1933:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structuresemulator/btdev.c:470:29: warning: Variable length array is used.emulator/btdev.c:470:29: warning: Variable length array is used.emulator/bthost.c:700:28: warning: Variable length array is used.emulator/bthost.c:701:32: warning: Variable length array is used.emulator/bthost.c:918:28: warning: Variable length array is used.emulator/bthost.c:952:28: warning: Variable length array is used.emulator/bthost.c:953:32: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1933:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-22 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 19:35 [PATCH BlueZ v1 1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS Luiz Augusto von Dentz
2025-12-22 19:35 ` [PATCH BlueZ v1 2/3] emulator: Fix using BT_HCI_CMD_LE_SET_CIG_PARAMS PHYs as values Luiz Augusto von Dentz
2025-12-22 19:35 ` [PATCH BlueZ v1 3/3] monitor: Fix parsing of BT_HCI_BIT_LE_CREATE_BIG Luiz Augusto von Dentz
2025-12-22 20:31 ` [BlueZ,v1,1/3] monitor: Fix parsing of BT_HCI_CMD_LE_SET_CIG_PARAMS bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).