Skip to contentSkip to conversation

Bluetooth: hci_sync: Add hci_le_create_conn_sync

PATCH New Luiz Augusto von Dentz 2 participants 3 messages Dec 8, 2021

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_sync: Add hci_le_create_conn_sync

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

This adds hci_le_create_conn_sync and make hci_le_connect use it instead of queueing multiple commands which may conflict with the likes of hci_update_passive_scan which uses hci_cmd_sync_queue.

---
 include/net/bluetooth/hci_core.h |   1 +
 include/net/bluetooth/hci_sync.h |   4 +
 net/bluetooth/hci_conn.c         | 300 ++-----------------------------
 net/bluetooth/hci_sync.c         | 295 ++++++++++++++++++++++++++++++
 4 files changed, 315 insertions(+), 285 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
index 4d69dcfebd63..c41ad7847d9d 100644
@@ -646,6 +646,7 @@ struct hci_conn {
 	__u8		init_addr_type;
 	bdaddr_t	resp_addr;
 	__u8		resp_addr_type;
+	bdaddr_t	direct_rpa;
 	__u8		adv_instance;
 	__u16		handle;
 	__u16		state;
include/net/bluetooth/hci_sync.h +4 -0
index f4034bf8f1ce..0d2a75d88e7c 100644
@@ -101,3 +101,7 @@ int hci_stop_discovery_sync(struct hci_dev *hdev);
 
 int hci_suspend_sync(struct hci_dev *hdev);
 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);
net/bluetooth/hci_conn.c +15 -285

344 lines not on this page · raw message

net/bluetooth/hci_sync.c +295 -0

298 lines not on this page · raw message

Signature · 1 line
2.33.1
#1 lore raw
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 next-20211207]
[cannot apply to bluetooth/master v5.16-rc4]
[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/0day-ci/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-hci_sync-Add-hci_le_create_conn_sync/20211208-100714
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: hexagon-randconfig-r041-20211207 (https://download.01.org/0day-ci/archive/20211208/202112081400.zv8bsipk-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)

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/0day-ci/linux/commit/edb4c612dda2cb67f35cfe5a1c3bd0b38918aa80
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-hci_sync-Add-hci_le_create_conn_sync/20211208-100714 git checkout edb4c612dda2cb67f35cfe5a1c3bd0b38918aa80
# save the config file to linux build tree
mkdir build_dir
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/hci_sync.c:5120:5: warning: no previous prototype for function 'hci_le_ext_create_conn_sync' [-Wmissing-prototypes]
   int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,
       ^

net/bluetooth/hci_sync.c:5120:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,
^
static
1 warning generated.

vim +/hci_le_ext_create_conn_sync +5120 net/bluetooth/hci_sync.c

5119

> 5120	int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,

5121 u8 own_addr_type)
5122 {
5123 struct hci_cp_le_ext_create_conn *cp;
5124 struct hci_cp_le_ext_conn_param *p;
5125 u8 data[sizeof(*cp) + sizeof(*p) * 3];
5126 u32 plen;
5127
5128 cp = (void *) data;
5129 p = (void *) cp->data;
5130
5131 memset(cp, 0, sizeof(*cp));
5132
5133 bacpy(&cp->peer_addr, &conn->dst);
5134 cp->peer_addr_type = conn->dst_type;
5135 cp->own_addr_type = own_addr_type;
5136
5137 plen = sizeof(*cp);
5138
5139 if (scan_1m(hdev)) {
5140 cp->phys |= LE_SCAN_PHY_1M;
5141 set_ext_conn_params(conn, p);
5142
5143 p++;
5144 plen += sizeof(*p);
5145 }
5146
5147 if (scan_2m(hdev)) {
5148 cp->phys |= LE_SCAN_PHY_2M;
5149 set_ext_conn_params(conn, p);
5150
5151 p++;
5152 plen += sizeof(*p);
5153 }
5154
5155 if (scan_coded(hdev)) {
5156 cp->phys |= LE_SCAN_PHY_CODED;
5157 set_ext_conn_params(conn, p);
5158
5159 plen += sizeof(*p);
5160 }
5161
5162 return __hci_cmd_sync_status(hdev, HCI_OP_LE_EXT_CREATE_CONN,
5163 plen, data, HCI_CMD_TIMEOUT);
5164 }
5165

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw
In reply to Luiz Augusto von Dentz
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 next-20211207]
[cannot apply to bluetooth/master v5.16-rc4]
[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/0day-ci/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-hci_sync-Add-hci_le_create_conn_sync/20211208-100714
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: arc-buildonly-randconfig-r002-20211207 (https://download.01.org/0day-ci/archive/20211208/202112081458.7Shk6qTD-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.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/0day-ci/linux/commit/edb4c612dda2cb67f35cfe5a1c3bd0b38918aa80
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-hci_sync-Add-hci_le_create_conn_sync/20211208-100714 git checkout edb4c612dda2cb67f35cfe5a1c3bd0b38918aa80
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc 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_sync.c:5120:5: warning: no previous prototype for 'hci_le_ext_create_conn_sync' [-Wmissing-prototypes]

5120 | int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/hci_le_ext_create_conn_sync +5120 net/bluetooth/hci_sync.c

5119

> 5120	int hci_le_ext_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn,

5121 u8 own_addr_type)
5122 {
5123 struct hci_cp_le_ext_create_conn *cp;
5124 struct hci_cp_le_ext_conn_param *p;
5125 u8 data[sizeof(*cp) + sizeof(*p) * 3];
5126 u32 plen;
5127
5128 cp = (void *) data;
5129 p = (void *) cp->data;
5130
5131 memset(cp, 0, sizeof(*cp));
5132
5133 bacpy(&cp->peer_addr, &conn->dst);
5134 cp->peer_addr_type = conn->dst_type;
5135 cp->own_addr_type = own_addr_type;
5136
5137 plen = sizeof(*cp);
5138
5139 if (scan_1m(hdev)) {
5140 cp->phys |= LE_SCAN_PHY_1M;
5141 set_ext_conn_params(conn, p);
5142
5143 p++;
5144 plen += sizeof(*p);
5145 }
5146
5147 if (scan_2m(hdev)) {
5148 cp->phys |= LE_SCAN_PHY_2M;
5149 set_ext_conn_params(conn, p);
5150
5151 p++;
5152 plen += sizeof(*p);
5153 }
5154
5155 if (scan_coded(hdev)) {
5156 cp->phys |= LE_SCAN_PHY_CODED;
5157 set_ext_conn_params(conn, p);
5158
5159 plen += sizeof(*p);
5160 }
5161
5162 return __hci_cmd_sync_status(hdev, HCI_OP_LE_EXT_CREATE_CONN,
5163 plen, data, HCI_CMD_TIMEOUT);
5164 }
5165

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org