linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report
@ 2022-04-06 21:33 Luiz Augusto von Dentz
  2022-04-06 21:33 ` [PATCH BlueZ 2/3] btdev: Add support for sending LE BIG Info Adv Reports Luiz Augusto von Dentz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-04-06 21:33 UTC (permalink / raw)
  To: linux-bluetooth

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

This adds support for LE BIG Info Advertising Report.
---
 monitor/bt.h     | 17 +++++++++++++++++
 monitor/packet.c | 23 +++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/monitor/bt.h b/monitor/bt.h
index 704c70fba..e9f72de36 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -3653,6 +3653,23 @@ struct bt_hci_evt_le_req_peer_sca_complete {
 	uint8_t  sca;
 } __attribute__ ((packed));
 
+#define BT_HCI_EVT_LE_BIG_INFO_ADV_REPORT	0x22
+struct bt_hci_evt_le_big_info_adv_report {
+	uint16_t sync_handle;
+	uint8_t  num_bis;
+	uint8_t  nse;
+	uint16_t iso_interval;
+	uint8_t  bn;
+	uint8_t  pto;
+	uint8_t  irc;
+	uint16_t max_pdu;
+	uint8_t  sdu_interval[3];
+	uint16_t max_sdu;
+	uint8_t  phy;
+	uint8_t  framing;
+	uint8_t  encryption;
+} __attribute__ ((packed));
+
 #define BT_HCI_ERR_SUCCESS			0x00
 #define BT_HCI_ERR_UNKNOWN_COMMAND		0x01
 #define BT_HCI_ERR_UNKNOWN_CONN_ID		0x02
diff --git a/monitor/packet.c b/monitor/packet.c
index b7431b57d..775b4276e 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -10886,6 +10886,25 @@ static void le_req_sca_complete_evt(const void *data, uint8_t size)
 	print_sca(evt->sca);
 }
 
+static void le_big_info_evt(const void *data, uint8_t size)
+{
+	const struct bt_hci_evt_le_big_info_adv_report *evt = data;
+
+	print_field("Sync Handle: 0x%4.4x", evt->sync_handle);
+	print_field("Number BIS: %u", evt->num_bis);
+	print_field("NSE: %u", evt->nse);
+	print_slot_125("ISO Interval", evt->iso_interval);
+	print_field("BN: %u", evt->bn);
+	print_field("PTO: %u", evt->bn);
+	print_field("IRC: %u", evt->irc);
+	print_field("Maximum PDU: %u", evt->max_pdu);
+	print_usec_interval("SDU Interval", evt->sdu_interval);
+	print_field("Maximum SDU: %u", evt->max_sdu);
+	print_le_phy("PHY", evt->phy);
+	print_framing(evt->framing);
+	print_field("Encryption: 0x%02x", evt->encryption);
+}
+
 struct subevent_data {
 	uint8_t subevent;
 	const char *str;
@@ -11004,6 +11023,10 @@ static const struct subevent_data le_meta_event_table[] = {
 				le_req_sca_complete_evt,
 				sizeof(
 				struct bt_hci_evt_le_req_peer_sca_complete)},
+	{ BT_HCI_EVT_LE_BIG_INFO_ADV_REPORT,
+		"LE Broadcast Isochronous Group Info Advertising Report",
+		le_big_info_evt,
+		sizeof(struct bt_hci_evt_le_big_info_adv_report) },
 	{ }
 };
 
-- 
2.35.1


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

* [PATCH BlueZ 2/3] btdev: Add support for sending LE BIG Info Adv Reports
  2022-04-06 21:33 [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report Luiz Augusto von Dentz
@ 2022-04-06 21:33 ` Luiz Augusto von Dentz
  2022-04-06 21:33 ` [PATCH BlueZ 3/3] btdev: Fix BIG Create Sync Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-04-06 21:33 UTC (permalink / raw)
  To: linux-bluetooth

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

This adds support for sending LE BIG Info Adv Reports if LE Create BIG
has been called.
---
 emulator/btdev.c | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 6f44103a7..71dbea4be 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -1139,7 +1139,8 @@ static struct btdev_conn *conn_add_bis(struct btdev *dev, uint16_t handle,
 	return conn;
 }
 
-static struct btdev_conn *find_bis_index(struct btdev *remote, uint8_t index)
+static struct btdev_conn *find_bis_index(const struct btdev *remote,
+							uint8_t index)
 {
 	struct btdev_conn *conn;
 	const struct queue_entry *entry;
@@ -5105,6 +5106,40 @@ static int cmd_set_pa_data(struct btdev *dev, const void *data,
 	return 0;
 }
 
+static void send_biginfo(struct btdev *dev, const struct btdev *remote)
+{
+	struct bt_hci_evt_le_big_info_adv_report ev;
+	const struct btdev_conn *conn;
+	struct bt_hci_bis *bis;
+
+	conn = find_bis_index(remote, 0);
+	if (!conn)
+		return;
+
+	bis = conn->data;
+
+	memset(&ev, 0, sizeof(ev));
+	ev.sync_handle = cpu_to_le16(dev->le_pa_sync_handle);
+	ev.num_bis = 1;
+
+	while (find_bis_index(remote, ev.num_bis))
+		ev.num_bis++;
+
+	ev.nse = 0x01;
+	ev.iso_interval = bis->latency / 1.25;
+	ev.bn = 0x01;
+	ev.pto = 0x00;
+	ev.irc = 0x01;
+	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.framing = bis->framing;
+	ev.encryption = bis->encryption;
+
+	le_meta_event(dev, BT_HCI_EVT_LE_BIG_INFO_ADV_REPORT, &ev, sizeof(ev));
+}
+
 static void send_pa(struct btdev *dev, const struct btdev *remote,
 						uint8_t offset)
 {
@@ -5135,7 +5170,10 @@ static void send_pa(struct btdev *dev, const struct btdev *remote,
 	if (pdu.ev.data_status == 0x01) {
 		offset += pdu.ev.data_len;
 		send_pa(dev, remote, offset);
+		return;
 	}
+
+	send_biginfo(dev, remote);
 }
 
 static void le_pa_sync_estabilished(struct btdev *dev, struct btdev *remote,
-- 
2.35.1


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

* [PATCH BlueZ 3/3] btdev: Fix BIG Create Sync
  2022-04-06 21:33 [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report Luiz Augusto von Dentz
  2022-04-06 21:33 ` [PATCH BlueZ 2/3] btdev: Add support for sending LE BIG Info Adv Reports Luiz Augusto von Dentz
@ 2022-04-06 21:33 ` Luiz Augusto von Dentz
  2022-04-06 23:30 ` [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report patchwork-bot+bluetooth
  2022-04-07  0:35 ` [BlueZ,1/3] " bluez.test.bot
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-04-06 21:33 UTC (permalink / raw)
  To: linux-bluetooth

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

This fixes status return to BIG Create Sync command.
---
 emulator/btdev.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 71dbea4be..20d2ed34c 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -6070,15 +6070,19 @@ static int cmd_big_create_sync(struct btdev *dev, const void *data, uint8_t len)
 	/* If the Sync_Handle does not exist, the Controller shall return the
 	 * error code Unknown Advertising Identifier (0x42).
 	 */
-	if (dev->le_pa_sync_handle != le16_to_cpu(cmd->sync_handle))
+	if (dev->le_pa_sync_handle != le16_to_cpu(cmd->sync_handle)) {
 		status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID;
+		goto done;
+	}
 
 	/* If the Host sends this command with a BIG_Handle that is already
 	 * allocated, the Controller shall return the error code Command
 	 * Disallowed (0x0C).
 	 */
-	if (dev->big_handle == cmd->handle)
+	if (dev->big_handle == cmd->handle) {
 		status = BT_HCI_ERR_COMMAND_DISALLOWED;
+		goto done;
+	}
 
 	/* If the Num_BIS parameter is greater than the total number of BISes
 	 * in the BIG, the Controller shall return the error code Unsupported
@@ -6087,12 +6091,10 @@ static int cmd_big_create_sync(struct btdev *dev, const void *data, uint8_t len)
 	if (cmd->num_bis != len - sizeof(*cmd))
 		status = BT_HCI_ERR_UNSUPPORTED_FEATURE;
 
-	if (status)
-		return status;
-
+done:
 	cmd_status(dev, status, BT_HCI_CMD_LE_BIG_CREATE_SYNC);
 
-	return status;
+	return 0;
 }
 
 static int cmd_big_create_sync_complete(struct btdev *dev, const void *data,
@@ -6140,7 +6142,7 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data,
 	pdu.ev.pto = 0x00;
 	pdu.ev.irc = 0x01;
 	pdu.ev.max_pdu = bis->sdu;
-	pdu.ev.interval = bis->latency;
+	pdu.ev.interval = bis->latency / 1.25;
 	pdu.ev.num_bis = cmd->num_bis;
 
 	le_meta_event(dev, BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED, &pdu,
@@ -6873,6 +6875,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)
 	btdev->iso_mtu = 251;
 	btdev->iso_max_pkt = 1;
 	btdev->le_cig.params.cig_id = 0xff;
+	btdev->big_handle = 0xff;
 
 	btdev->country_code = 0x00;
 
-- 
2.35.1


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

* Re: [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report
  2022-04-06 21:33 [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report Luiz Augusto von Dentz
  2022-04-06 21:33 ` [PATCH BlueZ 2/3] btdev: Add support for sending LE BIG Info Adv Reports Luiz Augusto von Dentz
  2022-04-06 21:33 ` [PATCH BlueZ 3/3] btdev: Fix BIG Create Sync Luiz Augusto von Dentz
@ 2022-04-06 23:30 ` patchwork-bot+bluetooth
  2022-04-07  0:35 ` [BlueZ,1/3] " bluez.test.bot
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-04-06 23:30 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed,  6 Apr 2022 14:33:53 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This adds support for LE BIG Info Advertising Report.
> ---
>  monitor/bt.h     | 17 +++++++++++++++++
>  monitor/packet.c | 23 +++++++++++++++++++++++
>  2 files changed, 40 insertions(+)

Here is the summary with links:
  - [BlueZ,1/3] monitor: Add support for LE BIG Info Adverting Report
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0533085d22ba
  - [BlueZ,2/3] btdev: Add support for sending LE BIG Info Adv Reports
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=10948891336d
  - [BlueZ,3/3] btdev: Fix BIG Create Sync
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d1871fc93522

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* RE: [BlueZ,1/3] monitor: Add support for LE BIG Info Adverting Report
  2022-04-06 21:33 [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2022-04-06 23:30 ` [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report patchwork-bot+bluetooth
@ 2022-04-07  0:35 ` bluez.test.bot
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-04-07  0:35 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1937 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=629731

---Test result---

Test Summary:
CheckPatch                    FAIL      4.33 seconds
GitLint                       PASS      2.89 seconds
Prep - Setup ELL              PASS      42.45 seconds
Build - Prep                  PASS      0.68 seconds
Build - Configure             PASS      8.47 seconds
Build - Make                  PASS      1384.46 seconds
Make Check                    PASS      11.53 seconds
Make Check w/Valgrind         PASS      440.77 seconds
Make Distcheck                PASS      228.57 seconds
Build w/ext ELL - Configure   PASS      8.77 seconds
Build w/ext ELL - Make        PASS      1367.66 seconds
Incremental Build with patchesPASS      4171.28 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,1/3] monitor: Add support for LE BIG Info Adverting Report
WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed))
#110: FILE: monitor/bt.h:3671:
+} __attribute__ ((packed));

/github/workspace/src/12804115.patch total: 0 errors, 1 warnings, 58 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12804115.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2022-04-07  0:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 21:33 [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report Luiz Augusto von Dentz
2022-04-06 21:33 ` [PATCH BlueZ 2/3] btdev: Add support for sending LE BIG Info Adv Reports Luiz Augusto von Dentz
2022-04-06 21:33 ` [PATCH BlueZ 3/3] btdev: Fix BIG Create Sync Luiz Augusto von Dentz
2022-04-06 23:30 ` [PATCH BlueZ 1/3] monitor: Add support for LE BIG Info Adverting Report patchwork-bot+bluetooth
2022-04-07  0:35 ` [BlueZ,1/3] " 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).