Skip to contentSkip to conversation

Bluetooth: eir: Add helpers for managing service data

PATCH Superseded Luiz Augusto von Dentz 3 participants 13 messages May 5, 2022 – May 6, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/8 Bluetooth: eir: Add helpers for managing service data

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

This adds helpers for accessing and appending service data (0x16) ad type.

---
 include/net/bluetooth/hci.h |  1 +
 net/bluetooth/eir.c         | 31 +++++++++++++++++++++++++++++++
 net/bluetooth/eir.h         |  4 ++++
 3 files changed, 36 insertions(+)
include/net/bluetooth/hci.h +1 -0
index 62a9bb022aed..fe7935be7dc4 100644
@@ -625,6 +625,7 @@ enum {
 #define EIR_SSP_RAND_R192	0x0F /* Simple Pairing Randomizer R-192 */
 #define EIR_DEVICE_ID		0x10 /* device ID */
 #define EIR_APPEARANCE		0x19 /* Device appearance */
+#define EIR_SERVICE_DATA	0x16 /* Service Data */
 #define EIR_LE_BDADDR		0x1B /* LE Bluetooth device address */
 #define EIR_LE_ROLE		0x1C /* LE role */
 #define EIR_SSP_HASH_C256	0x1D /* Simple Pairing Hash C-256 */
net/bluetooth/eir.c +31 -0
index 7e930f77ecab..7d77fb00c2bf 100644
@@ -55,6 +55,19 @@ u8 eir_append_appearance(struct hci_dev *hdev, u8 *ptr, u8 ad_len)
 	return eir_append_le16(ptr, ad_len, EIR_APPEARANCE, hdev->appearance);
 }
 
+u8 eir_append_service_data(u8 *eir, u16 eir_len, u16 uuid, u8 *data,
+			   u8 data_len)
+{
+	eir[eir_len++] = sizeof(u8) + sizeof(uuid) + data_len;
+	eir[eir_len++] = EIR_SERVICE_DATA;
+	put_unaligned_le16(uuid, &eir[eir_len]);
+	eir_len += sizeof(uuid);
+	memcpy(&eir[eir_len], data, data_len);
+	eir_len += data_len;
+
+	return eir_len;
+}
+
 static u8 *create_uuid16_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len)
 {
 	u8 *ptr = data, *uuids_start = NULL;
@@ -333,3 +346,21 @@ u8 eir_create_scan_rsp(struct hci_dev *hdev, u8 instance, u8 *ptr)
 
 	return scan_rsp_len;
 }
+
+void *eir_get_service_data(u8 *eir, size_t eir_len, u16 uuid, size_t *len)
+{
+	while ((eir = eir_get_data(eir, eir_len, EIR_SERVICE_DATA, len))) {
+		u16 value = get_unaligned_le16(eir);
+
+		if (uuid == value) {
+			if (len)
+				*len -= 2;
+			return &eir[2];
+		}
+
+		eir += *len;
+		eir_len -= *len;
+	}
+
+	return NULL;
+}
net/bluetooth/eir.h +4 -0
index 43f1945bffc5..62f2374078f2 100644
@@ -14,6 +14,8 @@ u8 eir_create_scan_rsp(struct hci_dev *hdev, u8 instance, u8 *ptr);
 
 u8 eir_append_local_name(struct hci_dev *hdev, u8 *eir, u8 ad_len);
 u8 eir_append_appearance(struct hci_dev *hdev, u8 *ptr, u8 ad_len);
+u8 eir_append_service_data(u8 *eir, u16 eir_len, u16 uuid, u8 *data,
+			   u8 data_len);
 
 static inline u16 eir_precalc_len(u8 data_len)
 {
@@ -92,3 +94,5 @@ static inline void *eir_get_data(u8 *eir, size_t eir_len, u8 type,
 
 	return NULL;
 }
+
+void *eir_get_service_data(u8 *eir, size_t eir_len, u16 uuid, size_t *len);
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/8 Bluetooth: hci_core: Introduce hci_recv_event_data

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

This introduces hci_recv_event_data to make it simpler to access the contents of last received event rather than having to pass its contents to the likes of *_ind/*_cfm callbacks.

---
 include/net/bluetooth/hci_core.h |  2 ++
 net/bluetooth/hci_core.c         | 32 ++++++++++++++++++++++++++++++++
 net/bluetooth/hci_event.c        |  3 +++
 3 files changed, 37 insertions(+)
include/net/bluetooth/hci_core.h +2 -0
index 64d3a63759a8..8838aa2cd594 100644
@@ -516,6 +516,7 @@ struct hci_dev {
 	struct sk_buff_head	cmd_q;
 
 	struct sk_buff		*sent_cmd;
+	struct sk_buff		*recv_event;
 
 	struct mutex		req_lock;
 	wait_queue_head_t	req_wait_q;
@@ -1739,6 +1740,7 @@ void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
 void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
 
 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
+void *hci_recv_event_data(struct hci_dev *hdev, __u8 event);
 
 u32 hci_conn_get_phy(struct hci_conn *conn);
 
net/bluetooth/hci_core.c +32 -0
index ad4f4ab0afca..12266f95a3c1 100644
@@ -2738,6 +2738,7 @@ void hci_release_dev(struct hci_dev *hdev)
 
 	ida_simple_remove(&hci_index_ida, hdev->id);
 	kfree_skb(hdev->sent_cmd);
+	kfree_skb(hdev->recv_event);
 	kfree(hdev);
 }
 EXPORT_SYMBOL(hci_release_dev);
@@ -3022,6 +3023,37 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode)
 	return hdev->sent_cmd->data + HCI_COMMAND_HDR_SIZE;
 }
 
+/* Get data from last received event */
+void *hci_recv_event_data(struct hci_dev *hdev, __u8 event)
+{
+	struct hci_event_hdr *hdr;
+	int offset;
+
+	if (!hdev->recv_event)
+		return NULL;
+
+	hdr = (void *) hdev->recv_event->data;
+	offset = sizeof(*hdr);
+
+	if (hdr->evt != event) {
+		/* In case of LE metaevent check the subevent match */
+		if (hdr->evt == HCI_EV_LE_META) {
+			struct hci_ev_le_meta *ev;
+
+			ev = (void *) hdev->recv_event->data + offset;
+			offset += sizeof(*ev);
+			if (ev->subevent == event)
+				goto found;
+		}
+		return NULL;
+	}
+
+found:
+	bt_dev_dbg(hdev, "event 0x%2.2x", event);
+
+	return hdev->recv_event->data + offset;
+}
+
 /* Send ACL data */
 static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags)
 {
net/bluetooth/hci_event.c +3 -0
index 0270e597c285..8b39b9d31879 100644
@@ -6933,6 +6933,9 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
 		goto done;
 	}
 
+	kfree_skb(hdev->recv_event);
+	hdev->recv_event = skb_clone(skb, GFP_KERNEL);
+
 	event = hdr->evt;
 	if (!event) {
 		bt_dev_warn(hdev, "Received unexpected HCI Event 0x%2.2x",
Signature · 1 line
2.35.1
author maintainer
#2 lore raw

PATCH 3/8 Bluetooth: Add initial implementation of CIS connections

In reply to Luiz Augusto von Dentz

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

This adds the initial implementation of CIS connections and introduces the ISO packets/links.

== Central: Set CIG Parameters, create a CIS and Setup Data Path ==

Quoted 1 line

tools/isotest -s <address>

< HCI Command: LE Extended Create... (0x08|0x0043) plen 26
...

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 31

      LE Enhanced Connection Complete (0x0a)
      ...

< HCI Command: LE Create Connected... (0x08|0x0064) plen 5
...

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Create Connected Isochronous Stream (0x08|0x0064) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 29

      LE Connected Isochronous Stream Established (0x19)
      ...

< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 6

      LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
        Status: Success (0x00)
        Handle: 257

< HCI Command: LE Setup Isochronou.. (0x08|0x006e) plen 13
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 6

      LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
        Status: Success (0x00)
        Handle: 257

== Peripheral: Accept CIS and Setup Data Path ==

Quoted 1 line

tools/isotest -d

HCI Event: LE Meta Event (0x3e) plen 7

      LE Connected Isochronous Stream Request (0x1a)

...
< HCI Command: LE Accept Co.. (0x08|0x0066) plen 2
...

Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 29

      LE Connected Isochronous Stream Established (0x19)

...
< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 6

      LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
        Status: Success (0x00)
        Handle: 257

< HCI Command: LE Setup Is.. (0x08|0x006e) plen 13
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 6

      LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1
        Status: Success (0x00)
        Handle: 257
---
 include/net/bluetooth/bluetooth.h |  33 ++-
 include/net/bluetooth/hci.h       |  28 +-
 include/net/bluetooth/hci_core.h  | 107 +++++++-
 include/net/bluetooth/hci_sock.h  |   2 +
 include/net/bluetooth/hci_sync.h  |   3 +
 net/bluetooth/Kconfig             |   1 +
 net/bluetooth/af_bluetooth.c      |   4 +-
 net/bluetooth/hci_conn.c          | 430 ++++++++++++++++++++++++++++++
 net/bluetooth/hci_core.c          | 225 ++++++++++++----
 net/bluetooth/hci_event.c         | 309 ++++++++++++++++++++-
 net/bluetooth/hci_sync.c          |  49 +++-
 11 files changed, 1135 insertions(+), 56 deletions(-)
include/net/bluetooth/bluetooth.h +32 -1
index 6b48d9e2aab9..e69555e422e4 100644
@@ -55,6 +55,8 @@
 #define BTPROTO_CMTP	5
 #define BTPROTO_HIDP	6
 #define BTPROTO_AVDTP	7
+#define BTPROTO_ISO	8
+#define BTPROTO_LAST	BTPROTO_ISO
 
 #define SOL_HCI		0
 #define SOL_L2CAP	6
@@ -149,10 +151,39 @@ struct bt_voice {
 #define BT_MODE_LE_FLOWCTL	0x03
 #define BT_MODE_EXT_FLOWCTL	0x04
 
-#define BT_PKT_STATUS          16
+#define BT_PKT_STATUS           16
 
 #define BT_SCM_PKT_STATUS	0x03
 
+#define BT_ISO_QOS		17
+
+#define BT_ISO_QOS_CIG_UNSET	0xff
+#define BT_ISO_QOS_CIS_UNSET	0xff
+
+struct bt_iso_io_qos {
+	__u32 interval;
+	__u16 latency;
+	__u16 sdu;
+	__u8  phy;
+	__u8  rtn;
+};
+
+struct bt_iso_qos {
+	__u8  cig;
+	__u8  cis;
+	__u8  sca;
+	__u8  packing;
+	__u8  framing;
+	struct bt_iso_io_qos in;
+	struct bt_iso_io_qos out;
+};
+
+#define BT_ISO_PHY_1M		0x01
+#define BT_ISO_PHY_2M		0x02
+#define BT_ISO_PHY_CODED	0x04
+#define BT_ISO_PHY_ANY		(BT_ISO_PHY_1M | BT_ISO_PHY_2M | \
+				 BT_ISO_PHY_CODED)
+
 #define BT_CODEC	19
 
 struct	bt_codec_caps {
include/net/bluetooth/hci.h +26 -2
index fe7935be7dc4..aeb601524d24 100644
@@ -1998,7 +1998,7 @@ struct hci_rp_le_read_iso_tx_sync {
 struct hci_cis_params {
 	__u8    cis_id;
 	__le16  c_sdu;
-	__le16  p_pdu;
+	__le16  p_sdu;
 	__u8    c_phy;
 	__u8    p_phy;
 	__u8    c_rtn;
@@ -2009,7 +2009,7 @@ struct hci_cp_le_set_cig_params {
 	__u8    cig_id;
 	__u8    c_interval[3];
 	__u8    p_interval[3];
-	__u8    wc_sca;
+	__u8    sca;
 	__u8    packing;
 	__u8    framing;
 	__le16  c_latency;
@@ -2052,6 +2052,30 @@ struct hci_cp_le_reject_cis {
 	__u8    reason;
 } __packed;
 
+#define HCI_OP_LE_SETUP_ISO_PATH		0x206e
+struct hci_cp_le_setup_iso_path {
+	__le16  handle;
+	__u8    direction;
+	__u8    path;
+	__u8    codec;
+	__le16  codec_cid;
+	__le16  codec_vid;
+	__u8    delay[3];
+	__u8    codec_cfg_len;
+	__u8    codec_cfg[0];
+} __attribute__ ((packed));
+
+struct hci_rp_le_setup_iso_path {
+	__u8    status;
+	__le16  handle;
+} __attribute__ ((packed));
+
+#define HCI_OP_LE_SET_HOST_FEATURE		0x2074
+struct hci_cp_le_set_host_feature {
+	__u8     bit_number;
+	__u8     bit_value;
+} __packed;
+
 /* ---- HCI Events ---- */
 struct hci_ev_status {
 	__u8    status;
include/net/bluetooth/hci_core.h +106 -1

216 lines not on this page · raw message

include/net/bluetooth/hci_sock.h +2 -0
index 9949870f7d78..0520e21ab698 100644
@@ -124,6 +124,8 @@ struct hci_dev_info {
 	__u16 acl_pkts;
 	__u16 sco_mtu;
 	__u16 sco_pkts;
+	__u16 iso_mtu;
+	__u16 iso_pkts;
 
 	struct hci_dev_stats stat;
 };
include/net/bluetooth/hci_sync.h +3 -0
index 2492e3b46a8f..a32678c69135 100644
@@ -106,3 +106,6 @@ int hci_resume_sync(struct hci_dev *hdev);
 struct hci_conn;
 
 int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn);
+
+int hci_le_remove_cig_sync(struct hci_dev *hdev, u8 handle);
+int hci_le_remove_cig(struct hci_dev *hdev, u8 handle);
net/bluetooth/Kconfig +1 -0
index e0ab4cd7afc3..ae3bdc6dfc92 100644
@@ -29,6 +29,7 @@ menuconfig BT
 		SCO audio links
 		L2CAP (Logical Link Control and Adaptation Protocol)
 		SMP (Security Manager Protocol) on LE (Low Energy) links
+		ISO isochronous links
 	     HCI Device drivers (Interface to the hardware)
 	     RFCOMM Module (RFCOMM Protocol)  
 	     BNEP Module (Bluetooth Network Encapsulation Protocol)
net/bluetooth/af_bluetooth.c +3 -1
index b506409bb498..28bd8196eec2 100644
@@ -38,7 +38,7 @@
 #include "selftest.h"
 
 /* Bluetooth sockets */
-#define BT_MAX_PROTO	8
+#define BT_MAX_PROTO	BTPROTO_LAST + 1
 static const struct net_proto_family *bt_proto[BT_MAX_PROTO];
 static DEFINE_RWLOCK(bt_proto_lock);
 
@@ -52,6 +52,7 @@ static const char *const bt_key_strings[BT_MAX_PROTO] = {
 	"sk_lock-AF_BLUETOOTH-BTPROTO_CMTP",
 	"sk_lock-AF_BLUETOOTH-BTPROTO_HIDP",
 	"sk_lock-AF_BLUETOOTH-BTPROTO_AVDTP",
+	"sk_lock-AF_BLUETOOTH-BTPROTO_ISO",
 };
 
 static struct lock_class_key bt_slock_key[BT_MAX_PROTO];
@@ -64,6 +65,7 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = {
 	"slock-AF_BLUETOOTH-BTPROTO_CMTP",
 	"slock-AF_BLUETOOTH-BTPROTO_HIDP",
 	"slock-AF_BLUETOOTH-BTPROTO_AVDTP",
+	"slock-AF_BLUETOOTH-BTPROTO_ISO",
 };
 
 void bt_sock_reclassify_lock(struct sock *sk, int proto)
net/bluetooth/hci_conn.c +430 -0

448 lines not on this page · raw message

net/bluetooth/hci_core.c +178 -47

287 lines not on this page · raw message

net/bluetooth/hci_event.c +306 -3

361 lines not on this page · raw message

net/bluetooth/hci_sync.c +48 -1

88 lines not on this page · raw message

Signature · 1 line
2.35.1
#3 lore raw

Re: [PATCH 3/8] Bluetooth: Add initial implementation of CIS connections

I love your patch! Perhaps something to improve:

Hi Luiz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on v5.18-rc5 next-20220505]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: sparc-randconfig-s032-20220505 (https://download.01.org/0day-ci/archive/20220506/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 11.3.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/intel-lab-lkp/linux/commit/aec184428c78dfd0b7d66190234e7fb4b92c9330
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828
git checkout aec184428c78dfd0b7d66190234e7fb4b92c9330
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc SHELL=/bin/bash net/bluetooth/

If you fix the issue, kindly add following tag as appropriate

sparse warnings: (new ones prefixed by >>)

>> net/bluetooth/hci_conn.c:1250:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] c_sdu @@     got unsigned short [usertype] sdu @@
   net/bluetooth/hci_conn.c:1250:21: sparse:     expected restricted __le16 [usertype] c_sdu
   net/bluetooth/hci_conn.c:1250:21: sparse:     got unsigned short [usertype] sdu
>> net/bluetooth/hci_conn.c:1251:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] p_sdu @@     got unsigned short [usertype] sdu @@

net/bluetooth/hci_conn.c:1251:21: sparse: expected restricted __le16 [usertype] p_sdu
net/bluetooth/hci_conn.c:1251:21: sparse: got unsigned short [usertype] sdu
--
net/bluetooth/hci_event.c:337:15: sparse: sparse: restricted __le16 degrades to integer

>> net/bluetooth/hci_event.c:3788:26: sparse: sparse: cast to restricted __le16
>> net/bluetooth/hci_event.c:3788:26: sparse: sparse: cast to restricted __le16
>> net/bluetooth/hci_event.c:3788:26: sparse: sparse: cast to restricted __le16
>> net/bluetooth/hci_event.c:3788:26: sparse: sparse: cast to restricted __le16
   net/bluetooth/hci_event.c:3790:26: sparse: sparse: cast to restricted __le16
   net/bluetooth/hci_event.c:3790:26: sparse: sparse: cast to restricted __le16
   net/bluetooth/hci_event.c:3790:26: sparse: sparse: cast to restricted __le16
   net/bluetooth/hci_event.c:3790:26: sparse: sparse: cast to restricted __le16
   net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
   include/net/bluetooth/hci.h:2518:47: sparse: sparse: array of flexible structures
   include/net/bluetooth/hci.h:2604:43: sparse: sparse: array of flexible structures
>> net/bluetooth/hci_event.c:6685:38: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] sdu @@     got restricted __le16 [usertype] c_mtu @@
   net/bluetooth/hci_event.c:6685:38: sparse:     expected unsigned short [usertype] sdu
   net/bluetooth/hci_event.c:6685:38: sparse:     got restricted __le16 [usertype] c_mtu
>> net/bluetooth/hci_event.c:6686:39: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] sdu @@     got restricted __le16 [usertype] p_mtu @@

net/bluetooth/hci_event.c:6686:39: sparse: expected unsigned short [usertype] sdu
net/bluetooth/hci_event.c:6686:39: sparse: got restricted __le16 [usertype] p_mtu

vim +1250 net/bluetooth/hci_conn.c

1244
1245 static void cis_add(struct iso_list_data *d, struct bt_iso_qos *qos)
1246 {
1247 struct hci_cis_params *cis = &d->pdu.cis[d->pdu.cp.num_cis];
1248
1249 cis->cis_id = qos->cis;

> 1250		cis->c_sdu  = qos->out.sdu;
> 1251		cis->p_sdu  = qos->in.sdu;
  1252		cis->c_phy  = qos->out.phy;
  1253		cis->p_phy  = qos->in.phy;
  1254		cis->c_rtn  = qos->out.rtn;
  1255		cis->p_rtn  = qos->in.rtn;

1256
1257 d->pdu.cp.num_cis++;
1258 }
1259

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
author maintainer
#4 lore raw

PATCH 4/8 Bluetooth: Add BTPROTO_ISO socket type

In reply to Luiz Augusto von Dentz

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

This introduces a new socket type BTPROTO_ISO which can be enabled with use of ISO Socket experiemental UUID, it can used to initiate/accept connections and transfer packets between userspace and kernel similarly to how BTPROTO_SCO works:

Central -> uses connect with address set to destination bdaddr:

Quoted 1 line

tools/isotest -s 00:AA:01:00:00:00

Peripheral -> uses listen:

Quoted 1 line

tools/isotest -d

---
 include/net/bluetooth/bluetooth.h |   21 +
 include/net/bluetooth/hci_core.h  |   18 +-
 include/net/bluetooth/iso.h       |   36 +
 net/bluetooth/Makefile            |    1 +
 net/bluetooth/af_bluetooth.c      |    2 +
 net/bluetooth/hci_core.c          |    7 +-
 net/bluetooth/hci_event.c         |    4 +-
 net/bluetooth/iso.c               | 1471 +++++++++++++++++++++++++++++
 net/bluetooth/mgmt.c              |   70 +-
 9 files changed, 1623 insertions(+), 7 deletions(-)
 create mode 100644 include/net/bluetooth/iso.h
 create mode 100644 net/bluetooth/iso.c
include/net/bluetooth/bluetooth.h +21 -0
index e69555e422e4..0acf20a1ad6c 100644
@@ -589,6 +589,27 @@ static inline void sco_exit(void)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_BT_LE)
+int iso_init(void);
+int iso_exit(void);
+bool iso_enabled(void);
+#else
+static inline int iso_init(void)
+{
+	return 0;
+}
+
+static inline int iso_exit(void)
+{
+	return 0;
+}
+
+static inline bool iso_enabled(void)
+{
+	return false;
+}
+#endif
+
 int mgmt_init(void);
 void mgmt_exit(void);
 
include/net/bluetooth/hci_core.h +16 -2
index d2a29d9dad5a..4aebd1015100 100644
@@ -834,6 +834,21 @@ static inline void sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_BT_LE)
+int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
+void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+#else
+static inline int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
+				  __u8 *flags)
+{
+	return 0;
+}
+static inline void iso_recv(struct hci_conn *hcon, struct sk_buff *skb,
+			    u16 flags)
+{
+}
+#endif
+
 /* ----- Inquiry cache ----- */
 #define INQUIRY_CACHE_AGE_MAX   (HZ*30)   /* 30 seconds */
 #define INQUIRY_ENTRY_AGE_MAX   (HZ*60)   /* 60 seconds */
@@ -1632,8 +1647,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
 		return sco_connect_ind(hdev, bdaddr, flags);
 
 	case ISO_LINK:
-		/* TODO: Handle connection indication */
-		return -EINVAL;
+		return iso_connect_ind(hdev, bdaddr, flags);
 
 	default:
 		BT_ERR("unknown link type %d", type);
include/net/bluetooth/iso.h new file +36 -0
new file mode 100644
index 000000000000..a4fed59dea8f
@@ -0,0 +1,36 @@
+/*
+   BlueZ - Bluetooth protocol stack for Linux
+   Copyright (C) 2020 Intel Corporation
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation;
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+   SOFTWARE IS DISCLAIMED.
+*/
+
+#ifndef __ISO_H
+#define __ISO_H
+
+/* ISO defaults */
+#define ISO_DEFAULT_MTU		251
+
+/* ISO socket address */
+struct sockaddr_iso {
+	sa_family_t	iso_family;
+	bdaddr_t	iso_bdaddr;
+	__u8		iso_bdaddr_type;
+};
+
+#endif /* __ISO_H */
net/bluetooth/Makefile +1 -0
index a52bba8500e1..0e7b7db42750 100644
@@ -18,6 +18,7 @@ bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
 	eir.o hci_sync.o
 
 bluetooth-$(CONFIG_BT_BREDR) += sco.o
+bluetooth-$(CONFIG_BT_LE) += iso.o
 bluetooth-$(CONFIG_BT_HS) += a2mp.o amp.o
 bluetooth-$(CONFIG_BT_LEDS) += leds.o
 bluetooth-$(CONFIG_BT_MSFTEXT) += msft.o
net/bluetooth/af_bluetooth.c +2 -0
index 28bd8196eec2..7208114a2c00 100644
@@ -780,6 +780,8 @@ static void __exit bt_exit(void)
 {
 	mgmt_exit();
 
+	iso_exit();
+
 	sco_exit();
 
 	l2cap_exit();
net/bluetooth/hci_core.c +5 -2
index f533c7b88518..be37f84a97c6 100644
@@ -3822,8 +3822,11 @@ static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	hci_dev_unlock(hdev);
 
-	/* TODO: Send to upper protocol */
-	if (!conn) {
+	if (conn) {
+		/* Send to upper protocol */
+		iso_recv(conn, skb, flags);
+		return;
+	} else {
 		bt_dev_err(hdev, "ISO packet for unknown connection handle %d",
 			   handle);
 	}
net/bluetooth/hci_event.c +2 -2
index 0d9a98790c8b..23699b025774 100644
@@ -3827,8 +3827,8 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data,
 
 		conn->handle = __le16_to_cpu(rp->handle[i++]);
 
-		BT_DBG("%p handle 0x%4.4x link %p state %u", conn, conn->handle,
-		       conn->link, conn->link->state);
+		bt_dev_dbg(hdev, "%p handle 0x%4.4x link %p state %u", conn,
+			   conn->handle, conn->link, conn->link->state);
 
 		/* Create CIS if LE is already connected */
 		if (conn->link->state == BT_CONNECTED)
net/bluetooth/iso.c new file +1471 -0

1,471 lines not on this page · raw message

net/bluetooth/mgmt.c +69 -1

97 lines not on this page · raw message

Signature · 1 line
2.35.1
#5 lore raw

Re: [PATCH 4/8] Bluetooth: Add BTPROTO_ISO socket type

I love your patch! Perhaps something to improve:

Hi Luiz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on bluetooth/master v5.18-rc5 next-20220505] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: hexagon-randconfig-r025-20220505 (https://download.01.org/0day-ci/archive/20220506/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/9ab3ba7464f8b680ac64a72e2a75f663c922bcef
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828 git checkout 9ab3ba7464f8b680ac64a72e2a75f663c922bcef
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/bluetooth/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> net/bluetooth/mgmt.c:4432:6: warning: variable 'changed' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (!err)
               ^~~~
   net/bluetooth/mgmt.c:4444:6: note: uninitialized use occurs here
           if (changed)
               ^~~~~~~
   net/bluetooth/mgmt.c:4432:2: note: remove the 'if' if its condition is always true
           if (!err)
           ^~~~~~~~~
   net/bluetooth/mgmt.c:4405:19: note: initialize the variable 'changed' to silence this warning
           bool val, changed;
                            ^
                             = 0
   1 warning generated.
--
>> net/bluetooth/iso.c:777:11: warning: variable 'sent' set but not used [-Wunused-but-set-variable]
           int err, sent = 0;
                    ^

1 warning generated.

vim +4432 net/bluetooth/mgmt.c

4398
4399 #ifdef CONFIG_BT_LE
4400 static int set_iso_socket_func(struct sock *sk, struct hci_dev *hdev,
4401 struct mgmt_cp_set_exp_feature *cp, u16 data_len)
4402 {
4403 struct mgmt_rp_set_exp_feature rp;
4404
4405 bool val, changed;
4406 int err;
4407
4408 /* Command requires to use the non-controller index */
4409 if (hdev)
4410 return mgmt_cmd_status(sk, hdev->id,
4411 MGMT_OP_SET_EXP_FEATURE,
4412 MGMT_STATUS_INVALID_INDEX);
4413
4414 /* Parameters are limited to a single octet */
4415 if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1)
4416 return mgmt_cmd_status(sk, MGMT_INDEX_NONE,
4417 MGMT_OP_SET_EXP_FEATURE,
4418 MGMT_STATUS_INVALID_PARAMS);
4419
4420 /* Only boolean on/off is supported */
4421 if (cp->param[0] != 0x00 && cp->param[0] != 0x01)
4422 return mgmt_cmd_status(sk, MGMT_INDEX_NONE,
4423 MGMT_OP_SET_EXP_FEATURE,
4424 MGMT_STATUS_INVALID_PARAMS);
4425
4426 val = cp->param[0] ? true : false;
4427 if (val)
4428 err = iso_init();
4429 else
4430 err = iso_exit();
4431

> 4432		if (!err)

4433 changed = true;
4434
4435 memcpy(rp.uuid, iso_socket_uuid, 16);
4436 rp.flags = cpu_to_le32(val ? BIT(0) : 0);
4437
4438 hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS);
4439
4440 err = mgmt_cmd_complete(sk, MGMT_INDEX_NONE,
4441 MGMT_OP_SET_EXP_FEATURE, 0,
4442 &rp, sizeof(rp));
4443
4444 if (changed)
4445 exp_feature_changed(hdev, iso_socket_uuid, val, sk);
4446
4447 return err;
4448 }
4449 #endif
4450

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
author maintainer
#6 lore raw

PATCH 5/8 Bluetooth: Add initial implementation of BIS connections

In reply to Luiz Augusto von Dentz

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

This adds initial support for BIS/BIG which includes:

== Broadcaster role: Setup a periodic advertising and create a BIG ==

Quoted 1 line

tools/isotest -s 00:00:00:00:00:00

isotest[63]: Connected [00:00:00:00:00:00]
isotest[63]: QoS BIG 0x00 BIS 0x00 Packing 0x00 Framing 0x00] isotest[63]: Output QoS [Interval 10000 us Latency 10 ms SDU 40 PHY 0x02 RTN 2]
isotest[63]: Sending ...
isotest[63]: Number of packets: 1
isotest[63]: Socket jitter buffer: 80 buffer
< HCI Command: LE Set Perio.. (0x08|0x003e) plen 7
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Periodic Advertising Parameters (0x08|0x003e) ncmd 1
        Status: Success (0x00)

< HCI Command: LE Set Perio.. (0x08|0x003f) plen 7
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Periodic Advertising Data (0x08|0x003f) ncmd 1
        Status: Success (0x00)

< HCI Command: LE Set Perio.. (0x08|0x0040) plen 2
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Periodic Advertising Enable (0x08|0x0040) ncmd 1
        Status: Success (0x00)

< HCI Command: LE Create B.. (0x08|0x0068) plen 31
...

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Create Broadcast Isochronous Group (0x08|0x0068) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 21

      LE Broadcast Isochronous Group Complete (0x1b)
      ...

== Broadcast Receiver role: Create a PA Sync and BIG Sync ==

Quoted 1 line

tools/isotest -i hci1 -d 00:AA:01:00:00:00

isotest[66]: Waiting for connection 00:AA:01:00:00:00... < HCI Command: LE Periodic Advert.. (0x08|0x0044) plen 14
...

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Periodic Advertising Create Sync (0x08|0x0044) ncmd 1
        Status: Success (0x00)

< HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
        Status: Success (0x00)

< HCI Command: LE Set Extended Sca.. (0x08|0x0042) plen 6
...

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Extended Scan Enable (0x08|0x0042) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 29

      LE Extended Advertising Report (0x0d)
      ...
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 16

      LE Periodic Advertising Sync Established (0x0e)
      ...

< HCI Command: LE Broadcast Isoch.. (0x08|0x006b) plen 25
...

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Broadcast Isochronous Group Create Sync (0x08|0x006b) ncmd 1
        Status: Success (0x00)
Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 17

      LE Broadcast Isochronous Group Sync Estabilished (0x1d)
      ...
---
 include/net/bluetooth/bluetooth.h |  18 +-
 include/net/bluetooth/hci.h       | 162 ++++++++-
 include/net/bluetooth/hci_core.h  |  89 ++++-
 include/net/bluetooth/hci_sync.h  |  12 +-
 net/bluetooth/eir.c               |  21 ++
 net/bluetooth/eir.h               |   1 +
 net/bluetooth/hci_conn.c          | 562 +++++++++++++++++++++++++++---
 net/bluetooth/hci_core.c          |  89 +++--
 net/bluetooth/hci_event.c         | 219 +++++++++++-
 net/bluetooth/hci_request.c       |  40 ++-
 net/bluetooth/hci_request.h       |   9 +
 net/bluetooth/hci_sync.c          | 250 ++++++++++++-
 net/bluetooth/mgmt.c              |  15 +-
 13 files changed, 1352 insertions(+), 135 deletions(-)
include/net/bluetooth/bluetooth.h +15 -3
index 0acf20a1ad6c..50fe81712511 100644
@@ -160,6 +160,9 @@ struct bt_voice {
 #define BT_ISO_QOS_CIG_UNSET	0xff
 #define BT_ISO_QOS_CIS_UNSET	0xff
 
+#define BT_ISO_QOS_BIG_UNSET	0xff
+#define BT_ISO_QOS_BIS_UNSET	0xff
+
 struct bt_iso_io_qos {
 	__u32 interval;
 	__u16 latency;
@@ -169,9 +172,18 @@ struct bt_iso_io_qos {
 };
 
 struct bt_iso_qos {
-	__u8  cig;
-	__u8  cis;
-	__u8  sca;
+	union {
+		__u8  cig;
+		__u8  big;
+	};
+	union {
+		__u8  cis;
+		__u8  bis;
+	};
+	union {
+		__u8  sca;
+		__u8  sync_interval;
+	};
 	__u8  packing;
 	__u8  framing;
 	struct bt_iso_io_qos in;
include/net/bluetooth/hci.h +155 -7

219 lines not on this page · raw message

include/net/bluetooth/hci_core.h +80 -9

167 lines not on this page · raw message

include/net/bluetooth/hci_sync.h +11 -1
index a32678c69135..bf45133ee82c 100644
@@ -65,6 +65,10 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance);
 int hci_enable_advertising_sync(struct hci_dev *hdev);
 int hci_enable_advertising(struct hci_dev *hdev);
 
+int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 data_len,
+			   u8 *data, u32 flags, u16 min_interval,
+			   u16 max_interval, u16 sync_interval);
+
 int hci_remove_advertising_sync(struct hci_dev *hdev, struct sock *sk,
 				u8 instance, bool force);
 int hci_disable_advertising_sync(struct hci_dev *hdev);
@@ -82,6 +86,7 @@ int hci_update_scan_sync(struct hci_dev *hdev);
 int hci_write_le_host_supported_sync(struct hci_dev *hdev, u8 le, u8 simul);
 int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,
 				     struct sock *sk);
+int hci_remove_ext_adv_instance(struct hci_dev *hdev, u8 instance);
 struct sk_buff *hci_read_local_oob_data_sync(struct hci_dev *hdev, bool ext,
 					     struct sock *sk);
 
@@ -108,4 +113,9 @@ struct hci_conn;
 int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn);
 
 int hci_le_remove_cig_sync(struct hci_dev *hdev, u8 handle);
-int hci_le_remove_cig(struct hci_dev *hdev, u8 handle);
+
+int hci_le_terminate_big_sync(struct hci_dev *hdev, u8 handle, u8 reason);
+
+int hci_le_big_terminate_sync(struct hci_dev *hdev, u8 handle);
+
+int hci_le_pa_terminate_sync(struct hci_dev *hdev, u16 handle);
net/bluetooth/eir.c +21 -0
index 7d77fb00c2bf..478b9feca3c1 100644
@@ -225,6 +225,27 @@ void eir_create(struct hci_dev *hdev, u8 *data)
 	ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
 }
 
+u8 eir_create_per_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
+{
+	struct adv_info *adv = NULL;
+	u8 ad_len = 0;
+
+	/* Return 0 when the current instance identifier is invalid. */
+	if (instance) {
+		adv = hci_find_adv_instance(hdev, instance);
+		if (!adv)
+			return 0;
+	}
+
+	if (adv) {
+		memcpy(ptr, adv->per_adv_data, adv->per_adv_data_len);
+		ad_len += adv->per_adv_data_len;
+		ptr += adv->per_adv_data_len;
+	}
+
+	return ad_len;
+}
+
 u8 eir_create_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
 {
 	struct adv_info *adv = NULL;
net/bluetooth/eir.h +1 -0
index 62f2374078f2..0df19f2f4af9 100644
@@ -11,6 +11,7 @@ void eir_create(struct hci_dev *hdev, u8 *data);
 
 u8 eir_create_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr);
 u8 eir_create_scan_rsp(struct hci_dev *hdev, u8 instance, u8 *ptr);
+u8 eir_create_per_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr);
 
 u8 eir_append_local_name(struct hci_dev *hdev, u8 *eir, u8 ad_len);
 u8 eir_append_appearance(struct hci_dev *hdev, u8 *ptr, u8 ad_len);
net/bluetooth/hci_conn.c +508 -54

629 lines not on this page · raw message

net/bluetooth/hci_core.c +54 -35

117 lines not on this page · raw message

net/bluetooth/hci_event.c +218 -1

267 lines not on this page · raw message

net/bluetooth/hci_request.c +23 -17
index f4afe482e300..b6b9335ba9ea 100644
@@ -825,10 +825,9 @@ static bool adv_cur_instance_is_scannable(struct hci_dev *hdev)
 
 void __hci_req_disable_advertising(struct hci_request *req)
 {
-	if (ext_adv_capable(req->hdev)) {
+	if (ext_adv_capable(req->hdev))
 		__hci_req_disable_ext_adv_instance(req, 0x00);
-
-	} else {
+	else {
 		u8 enable = 0x00;
 
 		hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable);
@@ -1338,15 +1337,15 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)
 	bdaddr_t random_addr;
 	u8 own_addr_type;
 	int err;
-	struct adv_info *adv_instance;
-	bool secondary_adv;
+	struct adv_info *adv;
+	bool secondary_adv, require_privacy;
 
 	if (instance > 0) {
-		adv_instance = hci_find_adv_instance(hdev, instance);
-		if (!adv_instance)
+		adv = hci_find_adv_instance(hdev, instance);
+		if (!adv)
 			return -EINVAL;
 	} else {
-		adv_instance = NULL;
+		adv = NULL;
 	}
 
 	flags = hci_adv_instance_flags(hdev, instance);
@@ -1364,18 +1363,24 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)
 	 * advertising is used. In that case it is fine to use a
 	 * non-resolvable private address.
 	 */
-	err = hci_get_random_address(hdev, !connectable,
-				     adv_use_rpa(hdev, flags), adv_instance,
+	require_privacy = !connectable;
+
+	/* Don't require privacy for periodic adv? */
+	if (adv && adv->periodic)
+		require_privacy = false;
+
+	err = hci_get_random_address(hdev, require_privacy,
+				     adv_use_rpa(hdev, flags), adv,
 				     &own_addr_type, &random_addr);
 	if (err < 0)
 		return err;
 
 	memset(&cp, 0, sizeof(cp));
 
-	if (adv_instance) {
-		hci_cpu_to_le24(adv_instance->min_interval, cp.min_interval);
-		hci_cpu_to_le24(adv_instance->max_interval, cp.max_interval);
-		cp.tx_power = adv_instance->tx_power;
+	if (adv) {
+		hci_cpu_to_le24(adv->min_interval, cp.min_interval);
+		hci_cpu_to_le24(adv->max_interval, cp.max_interval);
+		cp.tx_power = adv->tx_power;
 	} else {
 		hci_cpu_to_le24(hdev->le_adv_min_interval, cp.min_interval);
 		hci_cpu_to_le24(hdev->le_adv_max_interval, cp.max_interval);
@@ -1396,7 +1401,8 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)
 		else
 			cp.evt_properties = cpu_to_le16(LE_LEGACY_ADV_SCAN_IND);
 	} else {
-		if (secondary_adv)
+		/* Secondary and periodic cannot use legacy PDUs */
+		if (secondary_adv || (adv && adv->periodic))
 			cp.evt_properties = cpu_to_le16(LE_EXT_ADV_NON_CONN_IND);
 		else
 			cp.evt_properties = cpu_to_le16(LE_LEGACY_NONCONN_IND);
@@ -1426,8 +1432,8 @@ int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance)
 		struct hci_cp_le_set_adv_set_rand_addr cp;
 
 		/* Check if random address need to be updated */
-		if (adv_instance) {
-			if (!bacmp(&random_addr, &adv_instance->random_addr))
+		if (adv) {
+			if (!bacmp(&random_addr, &adv->random_addr))
 				return 0;
 		} else {
 			if (!bacmp(&random_addr, &hdev->random_addr))
net/bluetooth/hci_request.h +9 -0
index 7f8df258e295..2c47dac3bf83 100644
@@ -85,6 +85,9 @@ void __hci_req_enable_advertising(struct hci_request *req);
 void __hci_req_disable_advertising(struct hci_request *req);
 void __hci_req_update_adv_data(struct hci_request *req, u8 instance);
 int hci_req_update_adv_data(struct hci_dev *hdev, u8 instance);
+int hci_req_start_per_adv(struct hci_dev *hdev, u8 instance, u32 flags,
+			  u16 min_interval, u16 max_interval,
+			  u16 sync_interval);
 void __hci_req_update_scan_rsp_data(struct hci_request *req, u8 instance);
 
 int __hci_req_schedule_adv_instance(struct hci_request *req, u8 instance,
@@ -94,8 +97,14 @@ void hci_req_clear_adv_instance(struct hci_dev *hdev, struct sock *sk,
 				bool force);
 
 int __hci_req_setup_ext_adv_instance(struct hci_request *req, u8 instance);
+int __hci_req_setup_per_adv_instance(struct hci_request *req, u8 instance,
+				     u16 min_interval, u16 max_interval);
 int __hci_req_start_ext_adv(struct hci_request *req, u8 instance);
+int __hci_req_start_per_adv(struct hci_request *req, u8 instance, u32 flags,
+			    u16 min_interval, u16 max_interval,
+			    u16 sync_interval);
 int __hci_req_enable_ext_advertising(struct hci_request *req, u8 instance);
+int __hci_req_enable_per_advertising(struct hci_request *req, u8 instance);
 int __hci_req_disable_ext_adv_instance(struct hci_request *req, u8 instance);
 int __hci_req_remove_ext_adv_instance(struct hci_request *req, u8 instance);
 void __hci_req_clear_ext_adv_sets(struct hci_request *req);
net/bluetooth/hci_sync.c +249 -1

277 lines not on this page · raw message

net/bluetooth/mgmt.c +8 -7
index bf653e615630..716c9a8e4493 100644
@@ -8149,7 +8149,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,
 	u16 timeout, duration;
 	unsigned int prev_instance_cnt;
 	u8 schedule_instance = 0;
-	struct adv_info *next_instance;
+	struct adv_info *adv, *next_instance;
 	int err;
 	struct mgmt_pending_cmd *cmd;
 
@@ -8200,7 +8200,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,
 
 	prev_instance_cnt = hdev->adv_instance_cnt;
 
-	err = hci_add_adv_instance(hdev, cp->instance, flags,
+	adv = hci_add_adv_instance(hdev, cp->instance, flags,
 				   cp->adv_data_len, cp->data,
 				   cp->scan_rsp_len,
 				   cp->data + cp->adv_data_len,
@@ -8208,7 +8208,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,
 				   HCI_ADV_TX_POWER_NO_PREFERENCE,
 				   hdev->le_adv_min_interval,
 				   hdev->le_adv_max_interval);
-	if (err < 0) {
+	if (IS_ERR(adv)) {
 		err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING,
 				      MGMT_STATUS_FAILED);
 		goto unlock;
@@ -8339,6 +8339,7 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,
 	struct mgmt_cp_add_ext_adv_params *cp = data;
 	struct mgmt_rp_add_ext_adv_params rp;
 	struct mgmt_pending_cmd *cmd = NULL;
+	struct adv_info *adv;
 	u32 flags, min_interval, max_interval;
 	u16 timeout, duration;
 	u8 status;
@@ -8408,11 +8409,11 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,
 		   HCI_ADV_TX_POWER_NO_PREFERENCE;
 
 	/* Create advertising instance with no advertising or response data */
-	err = hci_add_adv_instance(hdev, cp->instance, flags,
-				   0, NULL, 0, NULL, timeout, duration,
-				   tx_power, min_interval, max_interval);
+	adv = hci_add_adv_instance(hdev, cp->instance, flags, 0, NULL, 0, NULL,
+				   timeout, duration, tx_power, min_interval,
+				   max_interval);
 
-	if (err < 0) {
+	if (IS_ERR(adv)) {
 		err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_EXT_ADV_PARAMS,
 				      MGMT_STATUS_FAILED);
 		goto unlock;
Signature · 1 line
2.35.1
#7 lore raw

Re: [PATCH 5/8] Bluetooth: Add initial implementation of BIS connections

I love your patch! Perhaps something to improve:

Hi Luiz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on bluetooth/master v5.18-rc5 next-20220505] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: riscv-randconfig-r042-20220505 (https://download.01.org/0day-ci/archive/20220506/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 11.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d69aaead9db3307f674a711d3db70e884b31d381
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828 git checkout d69aaead9db3307f674a711d3db70e884b31d381
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash net/bluetooth/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> net/bluetooth/hci_conn.c:1361:18: warning: no previous prototype for 'hci_add_bis' [-Wmissing-prototypes]
    1361 | struct hci_conn *hci_add_bis(struct hci_dev *hdev, bdaddr_t *dst,
         |                  ^~~~~~~~~~~
>> net/bluetooth/hci_conn.c:1874:18: warning: no previous prototype for 'hci_bind_bis' [-Wmissing-prototypes]
    1874 | struct hci_conn *hci_bind_bis(struct hci_conn *conn, struct bt_iso_qos *qos)
         |                  ^~~~~~~~~~~~
--
>> net/bluetooth/hci_sync.c:1056:5: warning: no previous prototype for 'hci_adv_bcast_annoucement' [-Wmissing-prototypes]

1056 | int hci_adv_bcast_annoucement(struct hci_dev *hdev, struct adv_info *adv)
| ^~~~~~~~~~~~~~~~~~~~~~~~~

vim +/hci_add_bis +1361 net/bluetooth/hci_conn.c

1359
1360 /* This function requires the caller holds hdev->lock */

> 1361	struct hci_conn *hci_add_bis(struct hci_dev *hdev, bdaddr_t *dst,

1362 struct bt_iso_qos *qos)
1363 {
1364 struct hci_conn *conn;
1365 struct iso_list_data data;
1366 int err;
1367
1368 /* Let's make sure that le is enabled.*/
1369 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) {
1370 if (lmp_le_capable(hdev))
1371 return ERR_PTR(-ECONNREFUSED);
1372 return ERR_PTR(-EOPNOTSUPP);
1373 }
1374
1375 err = qos_set_big(hdev, qos);
1376 if (err)
1377 return ERR_PTR(err);
1378
1379 err = qos_set_bis(hdev, qos);
1380 if (err)
1381 return ERR_PTR(err);
1382
1383 data.big = qos->big;
1384 data.bis = qos->bis;
1385 data.count = 0;
1386
1387 /* Check if there is already a matching BIG/BIS */
1388 hci_conn_hash_list_state(hdev, bis_list, ISO_LINK, BT_BOUND, &data);
1389 if (data.count)
1390 return ERR_PTR(-EADDRINUSE);
1391
1392 conn = hci_conn_hash_lookup_bis(hdev, dst, qos->big, qos->bis);
1393 if (conn)
1394 return ERR_PTR(-EADDRINUSE);
1395
1396 conn = hci_conn_add(hdev, ISO_LINK, dst, HCI_ROLE_MASTER);
1397 if (!conn)
1398 return ERR_PTR(-ENOMEM);
1399
1400 set_bit(HCI_CONN_PER_ADV, &conn->flags);
1401 conn->state = BT_CONNECT;
1402
1403 hci_conn_hold(conn);
1404 return conn;
1405 }
1406

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
author maintainer
#8 lore raw

PATCH 6/8 Bluetooth: ISO: Add broadcast support

In reply to Luiz Augusto von Dentz

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

This adds broadcast support for BTPROTO_ISO by extending the sockaddr_iso with a new struct sockaddr_iso_bc where the socket user can set the broadcast address when receiving, the SID and the BIS indexes it wants to synchronize.

Whe using BTPROTO_ISO for broadcast the roles are:

Broadcaster -> uses connect with address set to BDADDR_ANY:

Quoted 1 line

tools/isotest -s 00:00:00:00:00:00

Broadcast Receiver -> uses listen with address set to broadcaster:

Quoted 1 line

tools/isotest -d 00:AA:01:00:00:00

---
 include/net/bluetooth/bluetooth.h |   2 +
 include/net/bluetooth/iso.h       |  11 +
 net/bluetooth/iso.c               | 382 +++++++++++++++++++++++++++---
 3 files changed, 363 insertions(+), 32 deletions(-)
include/net/bluetooth/bluetooth.h +2 -0
index 50fe81712511..fd3a9a00569b 100644
@@ -220,6 +220,8 @@ struct bt_codecs {
 #define BT_CODEC_TRANSPARENT	0x03
 #define BT_CODEC_MSBC		0x05
 
+#define BT_ISO_BASE		20
+
 __printf(1, 2)
 void bt_info(const char *fmt, ...);
 __printf(1, 2)
include/net/bluetooth/iso.h +11 -0
index a4fed59dea8f..fa7e83995fb7 100644
@@ -25,12 +25,23 @@
 
 /* ISO defaults */
 #define ISO_DEFAULT_MTU		251
+#define ISO_MAX_NUM_BIS		0x1f
+
+/* ISO socket broadcast address */
+struct sockaddr_iso_bc {
+	bdaddr_t	bc_bdaddr;
+	__u8		bc_bdaddr_type;
+	__u8		bc_sid;
+	__u8		bc_num_bis;
+	__u8		bc_bis[ISO_MAX_NUM_BIS];
+};
 
 /* ISO socket address */
 struct sockaddr_iso {
 	sa_family_t	iso_family;
 	bdaddr_t	iso_bdaddr;
 	__u8		iso_bdaddr_type;
+	struct sockaddr_iso_bc iso_bc[];
 };
 
 #endif /* __ISO_H */
net/bluetooth/iso.c +350 -32

526 lines not on this page · raw message

Signature · 1 line
2.35.1
#9 lore raw

Re: [PATCH 6/8] Bluetooth: ISO: Add broadcast support

I love your patch! Perhaps something to improve:

Hi Luiz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on bluetooth/master v5.18-rc5 next-20220505] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-a013 (https://download.01.org/0day-ci/archive/20220506/[email protected]/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/c9952abdb0e8adbeadc722ce26b2ee5a64244860
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-eir-Add-helpers-for-managing-service-data/20220506-070828
        git checkout c9952abdb0e8adbeadc722ce26b2ee5a64244860
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/bluetooth/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

net/bluetooth/iso.c: In function 'iso_sock_getsockopt':

>> net/bluetooth/iso.c:1214:13: warning: variable 'base' set but not used [-Wunused-but-set-variable]
    1214 |         u8 *base;
         |             ^~~~

vim +/base +1214 net/bluetooth/iso.c

1206
1207 static int iso_sock_getsockopt(struct socket *sock, int level, int optname,
1208 char __user *optval, int __user *optlen)
1209 {
1210 struct sock *sk = sock->sk;
1211 int len, err = 0;
1212 struct bt_iso_qos qos;
1213 u8 base_len;

> 1214		u8 *base;

1215
1216 BT_DBG("sk %p", sk);
1217
1218 if (get_user(len, optlen))
1219 return -EFAULT;
1220
1221 lock_sock(sk);
1222
1223 switch (optname) {
1224
1225 case BT_DEFER_SETUP:
1226 if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
1227 err = -EINVAL;
1228 break;
1229 }
1230
1231 if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags),
1232 (u32 __user *)optval))
1233 err = -EFAULT;
1234
1235 break;
1236
1237 case BT_ISO_QOS:
1238 if (sk->sk_state == BT_CONNECTED)
1239 qos = iso_pi(sk)->conn->hcon->iso_qos;
1240 else
1241 qos = iso_pi(sk)->qos;
1242
1243 len = min_t(unsigned int, len, sizeof(qos));
1244 if (copy_to_user(optval, (char *)&qos, len))
1245 err = -EFAULT;
1246
1247 break;
1248
1249 case BT_ISO_BASE:
1250 if (sk->sk_state == BT_CONNECTED) {
1251 base_len = iso_pi(sk)->conn->hcon->le_per_adv_data_len;
1252 base = iso_pi(sk)->conn->hcon->le_per_adv_data;
1253 } else {
1254 base_len = iso_pi(sk)->base_len;
1255 base = iso_pi(sk)->base;
1256 }
1257
1258 len = min_t(unsigned int, len, base_len);
1259 if (copy_to_user(optval, (char *)&qos, len))
1260 err = -EFAULT;
1261
1262 break;
1263
1264 default:
1265 err = -ENOPROTOOPT;
1266 break;
1267 }
1268
1269 release_sock(sk);
1270 return err;
1271 }
1272

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
author maintainer
#10 lore raw

PATCH 7/8 Bluetooth: btusb: Add support for ISO packets

In reply to Luiz Augusto von Dentz

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

This enabled btusb driver to properly transmit ISO packets.

---
 drivers/bluetooth/btusb.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/bluetooth/btusb.c +14 -0
index e25fcd49db70..a1ee0b20bdf6 100644
@@ -1762,6 +1762,13 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 
 		hdev->stat.sco_tx++;
 		return submit_tx_urb(hdev, urb);
+
+	case HCI_ISODATA_PKT:
+		urb = alloc_bulk_urb(hdev, skb);
+		if (IS_ERR(urb))
+			return PTR_ERR(urb);
+
+		return submit_or_queue_tx_urb(hdev, urb);
 	}
 
 	return -EILSEQ;
@@ -2255,6 +2262,13 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
 
 		hdev->stat.sco_tx++;
 		return submit_tx_urb(hdev, urb);
+
+	case HCI_ISODATA_PKT:
+		urb = alloc_bulk_urb(hdev, skb);
+		if (IS_ERR(urb))
+			return PTR_ERR(urb);
+
+		return submit_or_queue_tx_urb(hdev, urb);
 	}
 
 	return -EILSEQ;
Signature · 1 line
2.35.1
author maintainer
#11 lore raw

PATCH 8/8 Bluetooth: btusb: Detect if an ACL packet is in fact an ISO packet

In reply to Luiz Augusto von Dentz

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

Fix up the packet type if ISO packets are sent over the bulk endpoint.

Note: This is a stopgap since the Bluetooth specification currently doesn't define any endpoint to transport ISO packets.

---
 drivers/bluetooth/btusb.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/bluetooth/btusb.c +10 -0
index a1ee0b20bdf6..0120cd7cc197 100644
@@ -893,11 +893,21 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
 		hci_skb_expect(skb) -= len;
 
 		if (skb->len == HCI_ACL_HDR_SIZE) {
+			__u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle);
 			__le16 dlen = hci_acl_hdr(skb)->dlen;
+			__u8 type;
 
 			/* Complete ACL header */
 			hci_skb_expect(skb) = __le16_to_cpu(dlen);
 
+			/* Detect if ISO packet has been sent over bulk */
+			if (hci_conn_num(data->hdev, ISO_LINK)) {
+				type = hci_conn_lookup_type(data->hdev,
+							    hci_handle(handle));
+				if (type == ISO_LINK)
+					hci_skb_pkt_type(skb) = HCI_ISODATA_PKT;
+			}
+
 			if (skb_tailroom(skb) < hci_skb_expect(skb)) {
 				kfree_skb(skb);
 				skb = NULL;
Signature · 1 line
2.35.1
#12 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=638909

---Test result---

Test Summary:

CheckPatch                    FAIL      22.41 seconds
GitLint                       PASS      8.48 seconds
SubjectPrefix                 PASS      7.15 seconds
BuildKernel                   PASS      41.27 seconds
BuildKernel32                 PASS      37.28 seconds
Incremental Build with patchesPASS      250.41 seconds
TestRunner: Setup             PASS      601.80 seconds
TestRunner: l2cap-tester      PASS      20.58 seconds
TestRunner: bnep-tester       PASS      7.72 seconds
TestRunner: mgmt-tester       FAIL      122.10 seconds
TestRunner: rfcomm-tester     PASS      11.74 seconds
TestRunner: sco-tester        PASS      11.63 seconds
TestRunner: smp-tester        PASS      11.49 seconds
TestRunner: userchan-tester   PASS      8.12 seconds

Details
##############################
Test: CheckPatch - FAIL - 22.41 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[2/8] Bluetooth: hci_core: Introduce hci_recv_event_data\CHECK:SPACING: No space is necessary after a cast #138: FILE: net/bluetooth/hci_core.c:3035:
+ hdr = (void *) hdev->recv_event->data;

CHECK:SPACING: No space is necessary after a cast
#146: FILE: net/bluetooth/hci_core.c:3043:
+ ev = (void *) hdev->recv_event->data + offset;

total: 0 errors, 0 warnings, 2 checks, 67 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/12840314.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

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

[3/8] Bluetooth: Add initial implementation of CIS connections\WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #249: FILE: include/net/bluetooth/hci.h:2066:
+} __attribute__ ((packed));

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #254: FILE: include/net/bluetooth/hci.h:2071:
+} __attribute__ ((packed));

ERROR:CODE_INDENT: code indent should use tabs where possible #298: FILE: include/net/bluetooth/hci_core.h:655:
+ CONN_REASON_ISO_CONNECT,$

WARNING:LEADING_SPACE: please, no spaces at the start of a line #298: FILE: include/net/bluetooth/hci_core.h:655:
+ CONN_REASON_ISO_CONNECT,$

WARNING:SPACING: Unnecessary space before function pointer arguments #323: FILE: include/net/bluetooth/hci_core.h:749:
+ void (*cleanup) (struct hci_conn *conn);

ERROR:CODE_INDENT: code indent should use tabs where possible #370: FILE: include/net/bluetooth/hci_core.h:1103:
+^I^I^I^I^I^I bdaddr_t *ba,$

ERROR:CODE_INDENT: code indent should use tabs where possible #371: FILE: include/net/bluetooth/hci_core.h:1104:
+^I^I^I^I^I^I __u8 ba_type)$

WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 23) #379: FILE: include/net/bluetooth/hci_core.h:1112:
+ if (c->type != ISO_LINK)
+ continue;

WARNING:TABSTOP: Statements should start on a tabstop #380: FILE: include/net/bluetooth/hci_core.h:1113:
+ continue;

ERROR:CODE_INDENT: code indent should use tabs where possible #394: FILE: include/net/bluetooth/hci_core.h:1127:
+^I^I^I^I^I^I __u8 handle)$

WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 23) #402: FILE: include/net/bluetooth/hci_core.h:1135:
+ if (c->type != ISO_LINK)
+ continue;

WARNING:TABSTOP: Statements should start on a tabstop #403: FILE: include/net/bluetooth/hci_core.h:1136:
+ continue;

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #547: FILE: net/bluetooth/af_bluetooth.c:41:
+#define BT_MAX_PROTO BTPROTO_LAST + 1

WARNING:BRACES: braces {} are not necessary for single statement blocks #769: FILE: net/bluetooth/hci_conn.c:1411:
+ if (!cis) {
+ return ERR_PTR(-ENOMEM);
+ }

WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #908: FILE: net/bluetooth/hci_conn.c:1550:
+ return -EINVAL;
+ else

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #970: FILE: net/bluetooth/hci_conn.c:1612:
+ le = hci_connect_le_scan(hdev, dst, dst_type,
+ BT_SECURITY_LOW,

ERROR:CODE_INDENT: code indent should use tabs where possible #972: FILE: net/bluetooth/hci_conn.c:1614:
+ CONN_REASON_ISO_CONNECT);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line #972: FILE: net/bluetooth/hci_conn.c:1614:
+ CONN_REASON_ISO_CONNECT);$

CHECK:SPACING: No space is necessary after a cast
#1280: FILE: net/bluetooth/hci_core.c:3808:
+ struct hci_iso_hdr *hdr = (void *) skb->data;

ERROR:TRAILING_STATEMENTS: trailing statements should be on next line (or did you mean 'else if'?) #1525: FILE: net/bluetooth/hci_event.c:4344:
+ } if (hdev->le_pkts) {

ERROR:SPACING: space required after that ',' (ctx:VxV) #1625: FILE: net/bluetooth/hci_event.c:6737:
+ bt_dev_dbg(hdev,"acl_handle 0x%4.4x cis_handle 0x%4.4x cig_id 0x%2.2x "
^

WARNING:SPLIT_STRING: quoted string split across lines #1626: FILE: net/bluetooth/hci_event.c:6738:
+ bt_dev_dbg(hdev,"acl_handle 0x%4.4x cis_handle 0x%4.4x cig_id 0x%2.2x "
+ "cis_id 0x%2.2x", acl_handle, cis_handle, ev->cig_id,

CHECK:LINE_SPACING: Please don't use multiple blank lines #1690: FILE: net/bluetooth/hci_event.c:6888:

+

total: 8 errors, 12 warnings, 3 checks, 1537 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.

NOTE: Whitespace errors detected.
You may wish to use scripts/cleanpatch or scripts/cleanfile

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

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

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

[4/8] Bluetooth: Add BTPROTO_ISO socket type\WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #177:
new file mode 100644

WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #182: FILE: include/net/bluetooth/iso.h:1:
+/*

WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines #183: FILE: include/net/bluetooth/iso.h:2:
+/*
+ BlueZ - Bluetooth protocol stack for Linux

WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #257: FILE: net/bluetooth/hci_core.c:3829:
+ return;
+ } else {

WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #282: FILE: net/bluetooth/iso.c:1:
+/*

WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines #283: FILE: net/bluetooth/iso.c:2:
+/*
+ BlueZ - Bluetooth protocol stack for Linux

CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment #325: FILE: net/bluetooth/iso.c:44:
+ spinlock_t lock;

CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'c' may be better as '(c)' to avoid precedence issues #335: FILE: net/bluetooth/iso.c:54:
+#define iso_conn_lock(c) spin_lock(&c->lock);

WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #335: FILE: net/bluetooth/iso.c:54:
+#define iso_conn_lock(c) spin_lock(&c->lock);

CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'c' may be better as '(c)' to avoid precedence issues #336: FILE: net/bluetooth/iso.c:55:
+#define iso_conn_unlock(c) spin_unlock(&c->lock);

WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #336: FILE: net/bluetooth/iso.c:55:
+#define iso_conn_unlock(c) spin_unlock(&c->lock);

CHECK:SPACING: No space is necessary after a cast
#342: FILE: net/bluetooth/iso.c:61:
+#define iso_pi(sk) ((struct iso_pinfo *) sk)

CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*conn)...) over kzalloc(sizeof(struct iso_conn)...) #410: FILE: net/bluetooth/iso.c:129:
+ conn = kzalloc(sizeof(struct iso_conn), GFP_KERNEL);

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #427: FILE: net/bluetooth/iso.c:146:
+ * Must be called on the locked socket. */

CHECK:LINE_SPACING: Please don't use multiple blank lines #516: FILE: net/bluetooth/iso.c:235:
+
+

CHECK:BRACES: braces {} should be used on all arms of this statement #735: FILE: net/bluetooth/iso.c:454:
+ if (iso_pi(sk)->conn->hcon) {
[...]
+ } else
[...]

CHECK:BRACES: Unbalanced braces around else statement #742: FILE: net/bluetooth/iso.c:461:
+ } else

CHECK:SPACING: No space is necessary after a cast
#858: FILE: net/bluetooth/iso.c:577:
+ struct sockaddr_iso *sa = (struct sockaddr_iso *) addr;

CHECK:SPACING: No space is necessary after a cast
#899: FILE: net/bluetooth/iso.c:618:
+ struct sockaddr_iso *sa = (struct sockaddr_iso *) addr;

CHECK:SPACING: No space is necessary after a cast
#1034: FILE: net/bluetooth/iso.c:753:
+ struct sockaddr_iso *sa = (struct sockaddr_iso *) addr;

CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #1212: FILE: net/bluetooth/iso.c:931:
+ switch (optname) {
+

CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #1281: FILE: net/bluetooth/iso.c:1000:
+ switch (optname) {
+

CHECK:BRACES: braces {} should be used on all arms of this statement #1492: FILE: net/bluetooth/iso.c:1211:
+ if (!status) {
[...]
+ } else
[...]

CHECK:BRACES: Unbalanced braces around else statement #1498: FILE: net/bluetooth/iso.c:1217:
+ } else

CHECK:SPACING: No space is necessary after a cast
#1545: FILE: net/bluetooth/iso.c:1264:
+ hdr = (void *) skb->data + 4;

CHECK:SPACING: No space is necessary after a cast
#1548: FILE: net/bluetooth/iso.c:1267:
+ hdr = (void *) skb->data;

WARNING:LINE_SPACING: Missing a blank line after declarations #1622: FILE: net/bluetooth/iso.c:1341:
+ struct sk_buff *rx_skb = conn->rx_skb;
+ conn->rx_skb = NULL;

total: 0 errors, 10 warnings, 17 checks, 1699 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/12840317.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

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

[5/8] Bluetooth: Add initial implementation of BIS connections\ERROR:CODE_INDENT: code indent should use tabs where possible #501: FILE: include/net/bluetooth/hci_core.h:1064:
+^I^I^I^I^I^I bdaddr_t *ba,$

WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 23) #539: FILE: include/net/bluetooth/hci_core.h:1205:
+ if (bacmp(&c->dst, BDADDR_ANY) || c->type != ISO_LINK)
+ continue;

WARNING:TABSTOP: Statements should start on a tabstop #540: FILE: include/net/bluetooth/hci_core.h:1206:
+ continue;

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #847: FILE: net/bluetooth/hci_conn.c:814:
+ * */

CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #1167: FILE: net/bluetooth/hci_conn.c:1876:
+{
+

ERROR:SPACING: spaces required around that '=' (ctx:WxV) #1181: FILE: net/bluetooth/hci_conn.c:1890:
+ u16 interval, sync_interval =0;
^

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #1485: FILE: net/bluetooth/hci_event.c:3909:
+ * Using Advertising handle get the connection state and update*/

CHECK:BRACES: Unbalanced braces around else statement #1755: FILE: net/bluetooth/hci_request.c:830:
+ else {

WARNING:TYPO_SPELLING: 'Annoucement' may be misspelled - perhaps 'Announcement'? #1963: FILE: net/bluetooth/hci_sync.c:1062:
+ * advertising so it cannot used for the likes of Broadcast Annoucement
^^^^^^^^^^^

WARNING:TYPO_SPELLING: 'Annoucement' may be misspelled - perhaps 'Announcement'? #1969: FILE: net/bluetooth/hci_sync.c:1068:
+ /* Check if PA data doesn't contains a Basic Audio Annoucement then
^^^^^^^^^^^

WARNING:TYPO_SPELLING: 'Annoucement' may be misspelled - perhaps 'Announcement'? #1976: FILE: net/bluetooth/hci_sync.c:1075:
+ /* Check if advertising data already has a Broadcast Annoucement since
^^^^^^^^^^^

total: 2 errors, 7 warnings, 2 checks, 1917 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.

NOTE: Whitespace errors detected.
You may wish to use scripts/cleanpatch or scripts/cleanfile

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

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

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

[6/8] Bluetooth: ISO: Add broadcast support\WARNING:TYPO_SPELLING: 'Whe' may be misspelled - perhaps 'When'? #87:
Whe using BTPROTO_ISO for broadcast the roles are:
^^^

WARNING:REPEATED_WORD: Possible repeated word: 'match' #291: FILE: net/bluetooth/iso.c:479:
+ * match func - pass NULL to ignore/not match
+ * match func data - pass -1 to ignore/not match

CHECK:SPACING: No space is necessary after a cast
#322: FILE: net/bluetooth/iso.c:690:
+ struct sockaddr_iso *sa = (struct sockaddr_iso *) addr;

CHECK:LINE_SPACING: Please don't use multiple blank lines #546: FILE: net/bluetooth/iso.c:1346:

+

ERROR:ASSIGN_IN_IF: do not use assignment in if condition #650: FILE: net/bluetooth/iso.c:1474:
+ } else if ((ev2 = hci_recv_event_data(hdev,

total: 1 errors, 2 warnings, 2 checks, 557 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/12840319.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

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

##############################
Test: TestRunner: mgmt-tester - FAIL - 122.10 seconds Run test-runner with mgmt-tester
Total: 493, Passed: 491 (99.6%), Failed: 2, Not Run: 0

Failed Test Cases

Read Exp Feature - Success                           Failed       0.128 seconds
Read Exp Feature - Success (Index None)              Failed       0.124 seconds

---
Regards,
Linux Bluetooth