Skip to contentSkip to conversation

Add Mesh functionality to net/bluetooth

PATCH Superseded Brian Gix 3 participants 7 messages May 9, 2022 – May 10, 2022

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

v2 cover Add Mesh functionality to net/bluetooth

Housekeeping and implementation

v2: Add checking for Packet Ownership when querying Tx queue state
Add cleanup of Tx queue when MGMT socket closes

Brian Gix (2):
Bluetooth: Implement support for Mesh
Bluetooth: Add experimental wrapper for MGMT based mesh

 include/net/bluetooth/bluetooth.h |   1 +
 include/net/bluetooth/hci.h       |   4 +
 include/net/bluetooth/hci_core.h  |  18 +-
 include/net/bluetooth/hci_sync.h  |   3 +
 include/net/bluetooth/mgmt.h      |  51 +++
 net/bluetooth/hci_conn.c          |   2 +-
 net/bluetooth/hci_core.c          |   1 +
 net/bluetooth/hci_event.c         |  61 ++--
 net/bluetooth/hci_request.c       | 115 +++++--
 net/bluetooth/hci_sock.c          |   1 +
 net/bluetooth/hci_sync.c          | 104 ++++--
 net/bluetooth/mgmt.c              | 551 +++++++++++++++++++++++++++++-
 net/bluetooth/mgmt_util.c         |  69 ++++
 net/bluetooth/mgmt_util.h         |  17 +
 14 files changed, 915 insertions(+), 83 deletions(-)
Signature · 1 line
2.35.1
author
#1 lore raw

PATCH v2 1/2 Bluetooth: Implement support for Mesh

The patch adds state bits, storage and HCI command chains for sending and recieving Bluetooth Mesh advertising packets, and delivery to requesting user space processes. It specifically creates 4 new MGMT commands and 2 new MGMT events:

MGMT_OP_SET_MESH_RECEIVER - Sets passive scan parameters and a list of AD Types which will trigger Mesh Packet Received events

MGMT_OP_MESH_READ_FEATURES - Returns information on how many outbound Mesh packets can be simultaneously queued, and what the currently queued handles are.

MGMT_OP_MESH_SEND - Command to queue a specific outbound Mesh packet, with the number of times it should be sent, and the BD Addr to use.

MGMT_OP_MESH_SEND_CANCEL - Command to cancel a prior outbound message request.

MGMT_EV_MESH_DEVICE_FOUND - Event to deliver entire received Mesh Advertisement packet, along with timing information.

MGMT_EV_MESH_PACKET_CMPLT - Event to indicate that an outbound packet is no longer queued for delivery.

---
 include/net/bluetooth/bluetooth.h |   1 +
 include/net/bluetooth/hci.h       |   3 +
 include/net/bluetooth/hci_core.h  |  18 +-
 include/net/bluetooth/hci_sync.h  |   3 +
 include/net/bluetooth/mgmt.h      |  51 ++++
 net/bluetooth/hci_conn.c          |   2 +-
 net/bluetooth/hci_core.c          |   1 +
 net/bluetooth/hci_event.c         |  61 ++--
 net/bluetooth/hci_request.c       | 115 ++++++--
 net/bluetooth/hci_sock.c          |   1 +
 net/bluetooth/hci_sync.c          | 104 +++++--
 net/bluetooth/mgmt.c              | 451 +++++++++++++++++++++++++++++-
 net/bluetooth/mgmt_util.c         |  69 +++++
 net/bluetooth/mgmt_util.h         |  17 ++
 14 files changed, 818 insertions(+), 79 deletions(-)
include/net/bluetooth/bluetooth.h +1 -0
index 6b48d9e2aab9..506b7bacc656 100644
@@ -560,6 +560,7 @@ static inline void sco_exit(void)
 
 int mgmt_init(void);
 void mgmt_exit(void);
+void mgmt_cleanup(struct sock *sk);
 
 void bt_sock_reclassify_lock(struct sock *sk, int proto);
 
include/net/bluetooth/hci.h +3 -0
index 62a9bb022aed..5d70beb54cab 100644
@@ -362,6 +362,9 @@ enum {
 	HCI_OFFLOAD_CODECS_ENABLED,
 	HCI_LE_SIMULTANEOUS_ROLES,
 
+	HCI_MESH,
+	HCI_MESH_SENDING,
+
 	__HCI_NUM_FLAGS,
 };
 
include/net/bluetooth/hci_core.h +16 -2
index 64d3a63759a8..ff931fb78f82 100644
@@ -357,6 +357,8 @@ struct hci_dev {
 	__u8		le_resolv_list_size;
 	__u8		le_num_of_adv_sets;
 	__u8		le_states[8];
+	__u8		mesh_ad_types[16];
+	__u8		mesh_send_ref;
 	__u8		commands[64];
 	__u8		hci_ver;
 	__u16		hci_rev;
@@ -544,6 +546,7 @@ struct hci_dev {
 
 	struct hci_conn_hash	conn_hash;
 
+	struct list_head	mesh_pending;
 	struct list_head	mgmt_pending;
 	struct list_head	reject_list;
 	struct list_head	accept_list;
@@ -595,6 +598,8 @@ struct hci_dev {
 	struct delayed_work	rpa_expired;
 	bdaddr_t		rpa;
 
+	struct delayed_work	mesh_send_done;
+
 	enum {
 		INTERLEAVE_SCAN_NONE,
 		INTERLEAVE_SCAN_NO_FILTER,
@@ -1501,7 +1506,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 
 /* Use ext scanning if set ext scan param and ext scan enable is supported */
 #define use_ext_scan(dev) (((dev)->commands[37] & 0x20) && \
-			   ((dev)->commands[37] & 0x40))
+			   ((dev)->commands[37] & 0x40) && \
+			   !hci_dev_test_flag(dev, HCI_MESH))
+
 /* Use ext create connection if command is supported */
 #define use_ext_conn(dev) ((dev)->commands[37] & 0x80)
 
@@ -1516,6 +1523,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 #define use_enhanced_conn_complete(dev) (ll_privacy_capable(dev) || \
 					 ext_adv_capable(dev))
 
+/* Use ext advertising if supported and not running Mesh */
+#define use_ext_adv(dev) (ext_adv_capable(dev) && \
+			  !hci_dev_test_flag(dev, HCI_MESH))
+
 /* ----- HCI protocols ----- */
 #define HCI_PROTO_DEFER             0x01
 
@@ -1797,6 +1808,8 @@ void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c);
 #define DISCOV_LE_RESTART_DELAY		msecs_to_jiffies(200)	/* msec */
 #define DISCOV_LE_FAST_ADV_INT_MIN	0x00A0	/* 100 msec */
 #define DISCOV_LE_FAST_ADV_INT_MAX	0x00F0	/* 150 msec */
+#define DISCOV_LE_ADV_MESH_MIN		0x00A0  /* 100 msec */
+#define DISCOV_LE_ADV_MESH_MAX		0x00A0  /* 100 msec */
 
 #define NAME_RESOLVE_DURATION		msecs_to_jiffies(10240)	/* 10.24 sec */
 
@@ -1848,7 +1861,8 @@ void mgmt_start_discovery_complete(struct hci_dev *hdev, u8 status);
 void mgmt_stop_discovery_complete(struct hci_dev *hdev, u8 status);
 void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 		       u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
-		       u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
+		       u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len,
+		       u32 instant);
 void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 		      u8 addr_type, s8 rssi, u8 *name, u8 name_len);
 void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
include/net/bluetooth/hci_sync.h +3 -0
index 2492e3b46a8f..b86a3bcf0814 100644
@@ -85,6 +85,9 @@ int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,
 struct sk_buff *hci_read_local_oob_data_sync(struct hci_dev *hdev, bool ext,
 					     struct sock *sk);
 
+int hci_mesh_send_sync(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type,
+							u8 *data, u8 len);
+
 int hci_reset_sync(struct hci_dev *hdev);
 int hci_dev_open_sync(struct hci_dev *hdev);
 int hci_dev_close_sync(struct hci_dev *hdev);
include/net/bluetooth/mgmt.h +51 -0

60 lines not on this page · raw message

net/bluetooth/hci_conn.c +1 -1
index 882a7df13005..7ca498112685 100644
@@ -638,7 +638,7 @@ static void hci_conn_auto_accept(struct work_struct *work)
 
 static void le_disable_advertising(struct hci_dev *hdev)
 {
-	if (ext_adv_capable(hdev)) {
+	if (use_ext_adv(hdev)) {
 		struct hci_cp_le_set_ext_adv_enable cp;
 
 		cp.enable = 0x00;
net/bluetooth/hci_core.c +1 -0
index ad4f4ab0afca..d90f1f501b38 100644
@@ -2487,6 +2487,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
 	mutex_init(&hdev->lock);
 	mutex_init(&hdev->req_lock);
 
+	INIT_LIST_HEAD(&hdev->mesh_pending);
 	INIT_LIST_HEAD(&hdev->mgmt_pending);
 	INIT_LIST_HEAD(&hdev->reject_list);
 	INIT_LIST_HEAD(&hdev->accept_list);
net/bluetooth/hci_event.c +38 -23

195 lines not on this page · raw message

net/bluetooth/hci_request.c +90 -25

252 lines not on this page · raw message

net/bluetooth/hci_sock.c +1 -0
index 189e3115c8c6..5e7e85bcb949 100644
@@ -2056,6 +2056,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname,
 
 static void hci_sock_destruct(struct sock *sk)
 {
+	mgmt_cleanup(sk);
 	skb_queue_purge(&sk->sk_receive_queue);
 	skb_queue_purge(&sk->sk_write_queue);
 }
net/bluetooth/hci_sync.c +84 -20

239 lines not on this page · raw message

net/bluetooth/mgmt.c +443 -8

537 lines not on this page · raw message

net/bluetooth/mgmt_util.c +69 -0

72 lines not on this page · raw message

net/bluetooth/mgmt_util.h +17 -0
index 98e40395a383..4f42350f0478 100644
@@ -20,6 +20,15 @@
    SOFTWARE IS DISCLAIMED.
 */
 
+struct mgmt_mesh_tx {
+	struct list_head list;
+	int index;
+	size_t param_len;
+	struct sock *sk;
+	u8 handle;
+	u8 param[sizeof(struct mgmt_cp_mesh_send) + 29];
+};
+
 struct mgmt_pending_cmd {
 	struct list_head list;
 	u16 opcode;
@@ -59,3 +68,11 @@ struct mgmt_pending_cmd *mgmt_pending_new(struct sock *sk, u16 opcode,
 					  void *data, u16 len);
 void mgmt_pending_free(struct mgmt_pending_cmd *cmd);
 void mgmt_pending_remove(struct mgmt_pending_cmd *cmd);
+void mgmt_mesh_foreach(struct hci_dev *hdev,
+			  void (*cb)(struct mgmt_mesh_tx *mesh_tx, void *data),
+			  void *data, struct sock *sk);
+struct mgmt_mesh_tx *mgmt_mesh_find(struct hci_dev *hdev, u8 handle);
+struct mgmt_mesh_tx *mgmt_mesh_next(struct hci_dev *hdev, struct sock *sk);
+struct mgmt_mesh_tx *mgmt_mesh_add(struct sock *sk, struct hci_dev *hdev,
+				   void *data, u16 len);
+void mgmt_mesh_remove(struct mgmt_mesh_tx *mesh_tx);
Signature · 1 line
2.35.1
#2 lore raw

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

---Test result---

Test Summary:

CheckPatch                    FAIL      7.73 seconds
GitLint                       PASS      2.24 seconds
SubjectPrefix                 PASS      1.96 seconds
BuildKernel                   PASS      42.28 seconds
BuildKernel32                 PASS      37.92 seconds
Incremental Build with patchesPASS      88.64 seconds
TestRunner: Setup             PASS      631.56 seconds
TestRunner: l2cap-tester      PASS      21.33 seconds
TestRunner: bnep-tester       PASS      7.82 seconds
TestRunner: mgmt-tester       FAIL      127.66 seconds
TestRunner: rfcomm-tester     PASS      11.98 seconds
TestRunner: sco-tester        PASS      11.91 seconds
TestRunner: smp-tester        PASS      11.82 seconds
TestRunner: userchan-tester   PASS      8.21 seconds

Details
##############################
Test: CheckPatch - FAIL - 7.73 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v2,1/2] Bluetooth: Implement support for Mesh\WARNING:TYPO_SPELLING: 'recieving' may be misspelled - perhaps 'receiving'? #67:
and recieving Bluetooth Mesh advertising packets, and delivery to

    ^^^^^^^^^

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #701: FILE: net/bluetooth/hci_request.c:2122:
+ if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) ||
+ hci_dev_test_flag(hdev, HCI_MESH))

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #761: FILE: net/bluetooth/hci_request.c:2338:
+ * with no filtering */

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #780: FILE: net/bluetooth/hci_request.c:2402:
+ hci_req_sync(hdev, mesh_scan, DISCOV_LE_SCAN_INT,
+ HCI_CMD_TIMEOUT, status);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #784: FILE: net/bluetooth/hci_request.c:2406:
+ hci_req_sync(hdev, active_scan,
+ hdev->le_scan_int_discovery,

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #865: FILE: net/bluetooth/hci_sync.c:1146:
+int hci_mesh_send_sync(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type,
+ u8 *data, u8 len)

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #888: FILE: net/bluetooth/hci_sync.c:1169:
+ __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_ADV_PARAM,
+ sizeof(cp_param), &cp_param,

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #892: FILE: net/bluetooth/hci_sync.c:1173:
+ err = __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_ADV_DATA,
+ sizeof(cp_data), &cp_data, HCI_CMD_TIMEOUT);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1114: FILE: net/bluetooth/mgmt.c:1033:
+static void mesh_send_complete(struct hci_dev *hdev,
+ struct mgmt_mesh_tx *mesh_tx, bool silent)

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1120: FILE: net/bluetooth/mgmt.c:1039:
+ mgmt_event(MGMT_EV_MESH_PACKET_CMPLT, hdev, &handle,
+ sizeof(handle), NULL);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1149: FILE: net/bluetooth/mgmt.c:1068:
+ err = hci_cmd_sync_queue(hdev, mesh_send_sync, mesh_tx,
+ mesh_send_start_complete);

CHECK:LINE_SPACING: Please don't use multiple blank lines #1185: FILE: net/bluetooth/mgmt.c:2096:

+

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1211: FILE: net/bluetooth/mgmt.c:2141:
+ mgmt_pending_foreach(MGMT_OP_SET_MESH_RECEIVER, hdev,
+ cmd_status_rsp, &status);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1222: FILE: net/bluetooth/mgmt.c:2152:
+ mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER, 0,
+ &slots, 1);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1271: FILE: net/bluetooth/mgmt.c:2201:
+ err = hci_cmd_sync_queue(hdev, set_mesh_sync, cmd,
+ set_mesh_complete);

CHECK:LINE_SPACING: Please don't use multiple blank lines #1273: FILE: net/bluetooth/mgmt.c:2203:
+
+

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1276: FILE: net/bluetooth/mgmt.c:2206:
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER,
+ MGMT_STATUS_FAILED);

CHECK:SPACING: No space is necessary after a cast
#1289: FILE: net/bluetooth/mgmt.c:2219:
+ struct mgmt_cp_mesh_send *send = (void *) mesh_tx->param;

CHECK:SPACING: No space is necessary after a cast
#1310: FILE: net/bluetooth/mgmt.c:2240:
+ struct mgmt_cp_mesh_send *send = (void *) mesh_tx->param;

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1331: FILE: net/bluetooth/mgmt.c:2261:
+static int mesh_features(struct sock *sk, struct hci_dev *hdev,
+ void *data, u16 len)

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1350: FILE: net/bluetooth/mgmt.c:2280:
+ mgmt_cmd_complete(sk, hdev->id, MGMT_OP_MESH_READ_FEATURES, 0, &rp,
+ rp.used_handles + sizeof(rp) - MESH_HANDLES_MAX);

CHECK:SPACING: No space is necessary after a cast
#1359: FILE: net/bluetooth/mgmt.c:2289:
+ struct mgmt_cp_mesh_send_cancel *cancel = (void *) cmd->param;

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1377: FILE: net/bluetooth/mgmt.c:2307:
+ mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_MESH_SEND_CANCEL,
+ 0, NULL, 0);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1384: FILE: net/bluetooth/mgmt.c:2314:
+static int mesh_send_cancel(struct sock *sk, struct hci_dev *hdev,
+ void *data, u16 len)

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1421: FILE: net/bluetooth/mgmt.c:2351:
+ if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED) ||
+ len <= MGMT_MESH_SEND_SIZE ||

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1435: FILE: net/bluetooth/mgmt.c:2365:
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_MESH_SEND,
+ MGMT_STATUS_BUSY);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1446: FILE: net/bluetooth/mgmt.c:2376:
+ err = hci_cmd_sync_queue(hdev, mesh_send_sync, mesh_tx,
+ mesh_send_start_complete);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1451: FILE: net/bluetooth/mgmt.c:2381:
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_MESH_SEND,
+ MGMT_STATUS_FAILED);

CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'hdev->adv_tx_power != HCI_TX_POWER_INVALID' #1503: FILE: net/bluetooth/mgmt.c:8166:
+ if ((hdev->adv_tx_power != HCI_TX_POWER_INVALID) || use_ext_adv(hdev))

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1531: FILE: net/bluetooth/mgmt.c:10071:
+static void mesh_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr,
+ u8 addr_type, s8 rssi, u32 flags, u8 *eir, u16 eir_len,

CHECK:LINE_SPACING: Please don't use multiple blank lines #1568: FILE: net/bluetooth/mgmt.c:10108:
+
+

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1608: FILE: net/bluetooth/mgmt.c:10147:
+ mesh_device_found(hdev, bdaddr, addr_type, rssi, flags,
+ eir, eir_len, scan_rsp, scan_rsp_len, instant);

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1646: FILE: net/bluetooth/mgmt_util.c:319:
+void mgmt_mesh_foreach(struct hci_dev *hdev,
+ void (*cb)(struct mgmt_mesh_tx *mesh_tx, void *data),

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1738: FILE: net/bluetooth/mgmt_util.h:72:
+void mgmt_mesh_foreach(struct hci_dev *hdev,
+ void (*cb)(struct mgmt_mesh_tx *mesh_tx, void *data),

total: 0 errors, 2 warnings, 32 checks, 1488 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/12844125.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.

[v2,2/2] Bluetooth: Add experimental wrapper for MGMT based mesh\CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #122: FILE: net/bluetooth/mgmt.c:2180:
+ if (!lmp_le_capable(hdev) ||
+ !hci_dev_test_flag(hdev, HCI_MESH_EXPERIMENTAL))

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #132: FILE: net/bluetooth/mgmt.c:2260:
+ if (!lmp_le_capable(hdev) ||
+ !hci_dev_test_flag(hdev, HCI_MESH_EXPERIMENTAL))

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #141: FILE: net/bluetooth/mgmt.c:2315:
+ if (!lmp_le_capable(hdev) ||
+ !hci_dev_test_flag(hdev, HCI_MESH_EXPERIMENTAL))

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #153: FILE: net/bluetooth/mgmt.c:2351:
+ if (!lmp_le_capable(hdev) ||
+ !hci_dev_test_flag(hdev, HCI_MESH_EXPERIMENTAL))

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #218: FILE: net/bluetooth/mgmt.c:4372:
+ status = mgmt_cmd_complete(sk, hdev ? hdev->id : MGMT_INDEX_NONE,
MGMT_OP_READ_EXP_FEATURES_INFO,

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #231: FILE: net/bluetooth/mgmt.c:4504:
+static int set_mgmt_mesh_func(struct sock *sk, struct hci_dev *hdev,
+ struct mgmt_cp_set_exp_feature *cp,

CHECK:BRACES: Unbalanced braces around else statement #267: FILE: net/bluetooth/mgmt.c:4540:
+ else {

CHECK:LINE_SPACING: Please don't use multiple blank lines #273: FILE: net/bluetooth/mgmt.c:4546:
+
+

total: 0 errors, 0 warnings, 8 checks, 204 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/12844124.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 - 127.66 seconds Run test-runner with mgmt-tester
Total: 493, Passed: 492 (99.8%), Failed: 1, Not Run: 0

Failed Test Cases
Read Exp Feature - Success Failed 0.148 seconds

---
Regards,
Linux Bluetooth

#3 lore raw

Re: [PATCH v2 1/2] Bluetooth: Implement support for Mesh

In reply to Brian Gix
Thank you for the patch! Perhaps something to improve:

Hi Brian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master v5.18-rc6 next-20220509] [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/Brian-Gix/Add-Mesh-functionality-to-net-bluetooth/20220510-060608
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: arc-randconfig-s031-20220509 (https://download.01.org/0day-ci/archive/20220510/[email protected]/config)
compiler: arc-elf-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/ec86301e787dba99c6afd77e40a4b5af142ef944
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Brian-Gix/Add-Mesh-functionality-to-net-bluetooth/20220510-060608
git checkout ec86301e787dba99c6afd77e40a4b5af142ef944
# 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=arc SHELL=/bin/bash net/bluetooth/

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

sparse warnings: (new ones prefixed by >>)
net/bluetooth/mgmt.c:4102:29: sparse: sparse: restricted __le16 degrades to integer net/bluetooth/mgmt.c:4841:9: sparse: sparse: cast to restricted __le32

>> net/bluetooth/mgmt.c:10121:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] instant @@     got unsigned int [usertype] instant @@

net/bluetooth/mgmt.c:10121:21: sparse: expected restricted __le64 [usertype] instant
net/bluetooth/mgmt.c:10121:21: sparse: got unsigned int [usertype] instant

vim +10121 net/bluetooth/mgmt.c

10069
10070 static void mesh_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr,
10071 u8 addr_type, s8 rssi, u32 flags, u8 *eir, u16 eir_len,
10072 u8 *scan_rsp, u8 scan_rsp_len, u32 instant)
10073 {
10074 struct sk_buff *skb;
10075 struct mgmt_ev_mesh_device_found *ev;
10076 int i, j;
10077
10078 if (!hdev->mesh_ad_types[0])
10079 goto accepted;
10080
10081 /* Scan for requested AD types */
10082 if (eir_len > 0) {
10083 for (i = 0; i + 1 < eir_len; i += eir[i] + 1) {
10084 for (j = 0; j < sizeof(hdev->mesh_ad_types); j++) {
10085 if (!hdev->mesh_ad_types[j])
10086 break;
10087
10088 if (hdev->mesh_ad_types[j] == eir[i + 1])
10089 goto accepted;
10090 }
10091 }
10092 }
10093
10094 if (scan_rsp_len > 0) {
10095 for (i = 0; i + 1 < scan_rsp_len; i += scan_rsp[i] + 1) {
10096 for (j = 0; j < sizeof(hdev->mesh_ad_types); j++) {
10097 if (!hdev->mesh_ad_types[j])
10098 break;
10099
10100 if (hdev->mesh_ad_types[j] == scan_rsp[i + 1])
10101 goto accepted;
10102 }
10103 }
10104 }
10105
10106 return;
10107
10108
10109 accepted:
10110 skb = mgmt_alloc_skb(hdev, MGMT_EV_MESH_DEVICE_FOUND,
10111 sizeof(*ev) + eir_len + scan_rsp_len);
10112 if (!skb)
10113 return;
10114
10115 ev = skb_put(skb, sizeof(*ev));
10116
10117 bacpy(&ev->addr.bdaddr, bdaddr);
10118 ev->addr.type = link_to_bdaddr(LE_LINK, addr_type);
10119 ev->rssi = rssi;
10120 ev->flags = cpu_to_le32(flags);
10121 ev->instant = instant;
10122
10123 if (eir_len > 0)
10124 /* Copy EIR or advertising data into event */
10125 skb_put_data(skb, eir, eir_len);
10126
10127 if (scan_rsp_len > 0)
10128 /* Append scan response data to event */
10129 skb_put_data(skb, scan_rsp, scan_rsp_len);
10130
10131 ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len);
10132
10133 mgmt_event_skb(skb, NULL);
10134 }
10135

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

Re: [PATCH v2 1/2] Bluetooth: Implement support for Mesh

In reply to Brian Gix
Thank you for the patch! Perhaps something to improve:

Hi Brian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master v5.18-rc6 next-20220509] [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/Brian-Gix/Add-Mesh-functionality-to-net-bluetooth/20220510-060608
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: arc-randconfig-s031-20220509 (https://download.01.org/0day-ci/archive/20220510/[email protected]/config)
compiler: arc-elf-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/ec86301e787dba99c6afd77e40a4b5af142ef944
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Brian-Gix/Add-Mesh-functionality-to-net-bluetooth/20220510-060608
git checkout ec86301e787dba99c6afd77e40a4b5af142ef944
# 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=arc SHELL=/bin/bash net/bluetooth/

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

sparse warnings: (new ones prefixed by >>)
net/bluetooth/mgmt.c:4102:29: sparse: sparse: restricted __le16 degrades to integer net/bluetooth/mgmt.c:4841:9: sparse: sparse: cast to restricted __le32

>> net/bluetooth/mgmt.c:10121:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] instant @@     got unsigned int [usertype] instant @@

net/bluetooth/mgmt.c:10121:21: sparse: expected restricted __le64 [usertype] instant
net/bluetooth/mgmt.c:10121:21: sparse: got unsigned int [usertype] instant

vim +10121 net/bluetooth/mgmt.c

10069
10070 static void mesh_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr,
10071 u8 addr_type, s8 rssi, u32 flags, u8 *eir, u16 eir_len,
10072 u8 *scan_rsp, u8 scan_rsp_len, u32 instant)
10073 {
10074 struct sk_buff *skb;
10075 struct mgmt_ev_mesh_device_found *ev;
10076 int i, j;
10077
10078 if (!hdev->mesh_ad_types[0])
10079 goto accepted;
10080
10081 /* Scan for requested AD types */
10082 if (eir_len > 0) {
10083 for (i = 0; i + 1 < eir_len; i += eir[i] + 1) {
10084 for (j = 0; j < sizeof(hdev->mesh_ad_types); j++) {
10085 if (!hdev->mesh_ad_types[j])
10086 break;
10087
10088 if (hdev->mesh_ad_types[j] == eir[i + 1])
10089 goto accepted;
10090 }
10091 }
10092 }
10093
10094 if (scan_rsp_len > 0) {
10095 for (i = 0; i + 1 < scan_rsp_len; i += scan_rsp[i] + 1) {
10096 for (j = 0; j < sizeof(hdev->mesh_ad_types); j++) {
10097 if (!hdev->mesh_ad_types[j])
10098 break;
10099
10100 if (hdev->mesh_ad_types[j] == scan_rsp[i + 1])
10101 goto accepted;
10102 }
10103 }
10104 }
10105
10106 return;
10107
10108
10109 accepted:
10110 skb = mgmt_alloc_skb(hdev, MGMT_EV_MESH_DEVICE_FOUND,
10111 sizeof(*ev) + eir_len + scan_rsp_len);
10112 if (!skb)
10113 return;
10114
10115 ev = skb_put(skb, sizeof(*ev));
10116
10117 bacpy(&ev->addr.bdaddr, bdaddr);
10118 ev->addr.type = link_to_bdaddr(LE_LINK, addr_type);
10119 ev->rssi = rssi;
10120 ev->flags = cpu_to_le32(flags);
10121 ev->instant = instant;
10122
10123 if (eir_len > 0)
10124 /* Copy EIR or advertising data into event */
10125 skb_put_data(skb, eir, eir_len);
10126
10127 if (scan_rsp_len > 0)
10128 /* Append scan response data to event */
10129 skb_put_data(skb, scan_rsp, scan_rsp_len);
10130
10131 ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len);
10132
10133 mgmt_event_skb(skb, NULL);
10134 }
10135

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

PATCH v2 2/2 Bluetooth: Add experimental wrapper for MGMT based mesh

In reply to Brian Gix

This introduces a "Mesh UUID" and an Experimental Feature bit to the hdev mask, and depending all underlying Mesh functionality on it.

---
 include/net/bluetooth/hci.h |   1 +
 net/bluetooth/mgmt.c        | 120 +++++++++++++++++++++++++++++++-----
 2 files changed, 107 insertions(+), 14 deletions(-)
include/net/bluetooth/hci.h +1 -0
index 5d70beb54cab..e18c8d104f79 100644
@@ -362,6 +362,7 @@ enum {
 	HCI_OFFLOAD_CODECS_ENABLED,
 	HCI_LE_SIMULTANEOUS_ROLES,
 
+	HCI_MESH_EXPERIMENTAL,
 	HCI_MESH,
 	HCI_MESH_SENDING,
 
net/bluetooth/mgmt.c +106 -14

197 lines not on this page · raw message

Signature · 1 line
2.35.1
#6 lore raw

Re: [PATCH v2 2/2] Bluetooth: Add experimental wrapper for MGMT based mesh

Thank you for the patch! Perhaps something to improve:

Hi Brian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master v5.18-rc6 next-20220509] [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/Brian-Gix/Add-Mesh-functionality-to-net-bluetooth/20220510-060608
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: arc-randconfig-s031-20220509 (https://download.01.org/0day-ci/archive/20220510/[email protected]/config)
compiler: arc-elf-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/885a42ec302cf25607003d07fec0f13cbeb61d35
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Brian-Gix/Add-Mesh-functionality-to-net-bluetooth/20220510-060608
git checkout 885a42ec302cf25607003d07fec0f13cbeb61d35
# 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=arc SHELL=/bin/bash net/bluetooth/

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

sparse warnings: (new ones prefixed by >>)

>> net/bluetooth/mgmt.c:2145:71: sparse: sparse: Using plain integer as NULL pointer

net/bluetooth/mgmt.c:4107:29: sparse: sparse: restricted __le16 degrades to integer net/bluetooth/mgmt.c:4933:9: sparse: sparse: cast to restricted __le32
net/bluetooth/mgmt.c:10213:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le64 [usertype] instant @@ got unsigned int [usertype] instant @@
net/bluetooth/mgmt.c:10213:21: sparse: expected restricted __le64 [usertype] instant
net/bluetooth/mgmt.c:10213:21: sparse: got unsigned int [usertype] instant

vim +2145 net/bluetooth/mgmt.c

2131
2132 static void set_mesh_complete(struct hci_dev *hdev, void *data, int err)
2133 {
2134 struct mgmt_pending_cmd *cmd = data;
2135 u8 status = mgmt_status(err);
2136 struct sock *sk = cmd->sk;
2137
2138 if (status) {
2139 mgmt_pending_foreach(MGMT_OP_SET_MESH_RECEIVER, hdev,
2140 cmd_status_rsp, &status);
2141 return;
2142 }
2143
2144 mgmt_pending_remove(cmd);

> 2145		mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER, 0, 0, 0);

2146 }
2147

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp