All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 BlueZ 0/4] Connection Update improvements
@ 2017-04-13 12:21 Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function Felipe F. Tonello
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Felipe F. Tonello @ 2017-04-13 12:21 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: linux-kernel, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz

These changes implements compliant Bluetooth support for any possible way to
update a connection parameter. Missing functionality is required to be
implemented in user-space, which this patchset allows it.

Changes from v4:
 * Handle Slave Connection Interval Range AD in kernel instead of
   user-space
 * Removed new MGMT command, it is unnecessary since it was only supposed
   to be used for the Slave Connection Interval Range support, which now
   has been implemented in the kernel.

Changes from v3:
 * Remove role check in refactored function
 * Added handler for Connection Parameter Update Response
 * Use Update Request when updating the connection parameters in slave
 * Fix MGMT command name to ADD instead of UPDATE

Changes from v2:
 * Added new MGMT command
 * Roll back to first socket option implementation, details are on the
   patch iself.

Changes from v1:
 * Use simpler user-space API
 * Added refactor function

Felipe F. Tonello (4):
  Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function
  Bluetooth: L2CAP: Add handler for Connection Parameter Update Response
  Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option
  Bluetooth: Handle Slave Connection Interval Range AD

 include/net/bluetooth/bluetooth.h |   8 +++
 include/net/bluetooth/l2cap.h     |   5 ++
 net/bluetooth/l2cap_core.c        |  78 +++++++++++++++++++++++----
 net/bluetooth/l2cap_sock.c        | 110 ++++++++++++++++++++++++++++++++++++++
 net/bluetooth/mgmt.c              |  53 ++++++++++++++++++
 5 files changed, 243 insertions(+), 11 deletions(-)

-- 
2.12.2

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

* [PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function
  2017-04-13 12:21 [PATCH v5 BlueZ 0/4] Connection Update improvements Felipe F. Tonello
@ 2017-04-13 12:22 ` Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 2/4] Bluetooth: L2CAP: Add handler for Connection Parameter Update Response Felipe F. Tonello
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Felipe F. Tonello @ 2017-04-13 12:22 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: linux-kernel, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz

This signaling command is useful for any connection parameter change
procedure, thus it is important to allow access to it from outside this
translation unit.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 include/net/bluetooth/l2cap.h |  3 +++
 net/bluetooth/l2cap_core.c    | 31 ++++++++++++++++++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 0697fd413087..803a7f4d93a7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -948,4 +948,7 @@ void l2cap_conn_put(struct l2cap_conn *conn);
 int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
 void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user);
 
+void l2cap_le_conn_update_req(struct l2cap_conn *conn, u8 min_interval,
+		u8 max_interval, u8 latency, u8 supv_timeout);
+
 #endif /* __L2CAP_H */
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index f88ac99528ce..585d15ce0a33 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1483,6 +1483,21 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
 	mutex_unlock(&conn->chan_lock);
 }
 
+/* This command shall only be send if the connection role is SLAVE */
+void l2cap_le_conn_update_req(struct l2cap_conn *conn, u8 min_interval,
+			      u8 max_interval, u8 latency, u8 supv_timeout)
+{
+	struct l2cap_conn_param_update_req req;
+
+	req.min = cpu_to_le16(min_interval);
+	req.max = cpu_to_le16(max_interval);
+	req.latency = cpu_to_le16(latency);
+	req.to_multiplier = cpu_to_le16(supv_timeout);
+
+	l2cap_send_cmd(conn, l2cap_get_ident(conn),
+		       L2CAP_CONN_PARAM_UPDATE_REQ, sizeof(req), &req);
+}
+
 static void l2cap_le_conn_ready(struct l2cap_conn *conn)
 {
 	struct hci_conn *hcon = conn->hcon;
@@ -1503,17 +1518,11 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
 	 */
 	if (hcon->role == HCI_ROLE_SLAVE &&
 	    (hcon->le_conn_interval < hcon->le_conn_min_interval ||
-	     hcon->le_conn_interval > hcon->le_conn_max_interval)) {
-		struct l2cap_conn_param_update_req req;
-
-		req.min = cpu_to_le16(hcon->le_conn_min_interval);
-		req.max = cpu_to_le16(hcon->le_conn_max_interval);
-		req.latency = cpu_to_le16(hcon->le_conn_latency);
-		req.to_multiplier = cpu_to_le16(hcon->le_supv_timeout);
-
-		l2cap_send_cmd(conn, l2cap_get_ident(conn),
-			       L2CAP_CONN_PARAM_UPDATE_REQ, sizeof(req), &req);
-	}
+	     hcon->le_conn_interval > hcon->le_conn_max_interval))
+		l2cap_le_conn_update_req(conn, hcon->le_conn_min_interval,
+					 hcon->le_conn_max_interval,
+					 hcon->le_conn_latency,
+					 hcon->le_supv_timeout);
 }
 
 static void l2cap_conn_ready(struct l2cap_conn *conn)
-- 
2.12.2

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

* [PATCH v5 BlueZ 2/4] Bluetooth: L2CAP: Add handler for Connection Parameter Update Response
  2017-04-13 12:21 [PATCH v5 BlueZ 0/4] Connection Update improvements Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function Felipe F. Tonello
@ 2017-04-13 12:22 ` Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 3/4] Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD Felipe F. Tonello
  3 siblings, 0 replies; 9+ messages in thread
From: Felipe F. Tonello @ 2017-04-13 12:22 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: linux-kernel, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz

In case of connected hosts that doesn't support the Connection
Parameters Request Link Layer Control Procedure, we should support this
event response from a slave device.

The slave device will answer based on a previous request done by the
master (BlueZ in this case) and update current connection parameters
accordingly. If the request was rejected, we don't do anything.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 include/net/bluetooth/l2cap.h |  2 ++
 net/bluetooth/l2cap_core.c    | 47 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 803a7f4d93a7..eb7ecd5df9a3 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -654,6 +654,8 @@ struct l2cap_conn {
 	struct mutex		chan_lock;
 	struct kref		ref;
 	struct list_head	users;
+
+	struct l2cap_conn_param_update_req conn_param_req;
 };
 
 struct l2cap_user {
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 585d15ce0a33..1e8539c59cfd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1489,6 +1489,14 @@ void l2cap_le_conn_update_req(struct l2cap_conn *conn, u8 min_interval,
 {
 	struct l2cap_conn_param_update_req req;
 
+	/* set temporary parameters in case of a successful
+	 * response from the peer device
+	 */
+	conn->conn_param_req.min = min_interval;
+	conn->conn_param_req.max = max_interval;
+	conn->conn_param_req.latency = latency;
+	conn->conn_param_req.to_multiplier = supv_timeout;
+
 	req.min = cpu_to_le16(min_interval);
 	req.max = cpu_to_le16(max_interval);
 	req.latency = cpu_to_le16(latency);
@@ -5261,6 +5269,44 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
 	return 0;
 }
 
+static inline int l2cap_conn_param_update_rsp(struct l2cap_conn *conn,
+					      struct l2cap_cmd_hdr *cmd,
+					      u16 cmd_len, u8 *data)
+{
+	struct hci_conn *hcon = conn->hcon;
+	struct l2cap_conn_param_update_rsp *rsp;
+	u8 result;
+
+	if (hcon->role != HCI_ROLE_SLAVE)
+		return -EINVAL;
+
+	if (cmd_len != sizeof(struct l2cap_conn_param_update_rsp))
+		return -EPROTO;
+
+	rsp = (struct l2cap_conn_param_update_rsp *)data;
+	result = le16_to_cpu(rsp->result);
+
+	BT_DBG("result 0x%4.4x", result);
+
+	if (result == 0) {
+		u8 store_hint;
+
+		store_hint =
+			hci_le_conn_update(hcon,
+					   conn->conn_param_req.min,
+					   conn->conn_param_req.max,
+					   conn->conn_param_req.latency,
+					   conn->conn_param_req.to_multiplier);
+		mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type,
+				    store_hint, conn->conn_param_req.min,
+				    conn->conn_param_req.max,
+				    conn->conn_param_req.latency,
+				    conn->conn_param_req.to_multiplier);
+	}
+
+	return 0;
+}
+
 static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
 				struct l2cap_cmd_hdr *cmd, u16 cmd_len,
 				u8 *data)
@@ -5641,6 +5687,7 @@ static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn,
 		break;
 
 	case L2CAP_CONN_PARAM_UPDATE_RSP:
+		err = l2cap_conn_param_update_rsp(conn, cmd, cmd_len, data);
 		break;
 
 	case L2CAP_LE_CONN_RSP:
-- 
2.12.2

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

* [PATCH v5 BlueZ 3/4] Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option
  2017-04-13 12:21 [PATCH v5 BlueZ 0/4] Connection Update improvements Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 2/4] Bluetooth: L2CAP: Add handler for Connection Parameter Update Response Felipe F. Tonello
@ 2017-04-13 12:22 ` Felipe F. Tonello
  2017-04-13 12:22 ` [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD Felipe F. Tonello
  3 siblings, 0 replies; 9+ messages in thread
From: Felipe F. Tonello @ 2017-04-13 12:22 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: linux-kernel, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz

There is a need for certain LE profiles (MIDI for example) to change the
current connection's parameters. In order to do that, this patch
introduces a new BT_LE_CONN_PARAM socket option for SOL_BLUETOOTH
protocol which allow user-space l2cap sockets to update the current
connection.

It necessary to expose all the connection parameters to user-space
because user-space are exposed to those values anyway, via PPCP
characteristic or particular profile specification.

If ROLE is SLAVE, then it will send a L2CAP_CONN_PARAM_UPDATE_REQ
signaling command to the MASTER, triggering proper LE parameter update
procedure. The connection parameters update will only occur upon a
successful L2CAP_CONN_PARAM_UPDATE_RSP sent by the MASTER.

If ROLE is MASTER, then immediately update the connection parameters.

Once the connection parameters are effective, a MGMT_EV_NEW_CONN_PARAM
event with the store_hint set is sent to user-space so an application
can store the connection parameters for persistence reasons.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 include/net/bluetooth/bluetooth.h |   8 +++
 net/bluetooth/l2cap_sock.c        | 110 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+)

diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 01487192f628..ce5b3abd3b27 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -122,6 +122,14 @@ struct bt_voice {
 #define BT_SNDMTU		12
 #define BT_RCVMTU		13
 
+#define BT_LE_CONN_PARAM	14
+struct bt_le_conn_param {
+	__u16 min_interval;
+	__u16 max_interval;
+	__u16 latency;
+	__u16 supervision_timeout;
+};
+
 __printf(1, 2)
 void bt_info(const char *fmt, ...);
 __printf(1, 2)
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 507b80d59dec..1e096bd9ddde 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -515,6 +515,47 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
 	lock_sock(sk);
 
 	switch (optname) {
+	case BT_LE_CONN_PARAM: {
+		struct bt_le_conn_param conn_param;
+		struct hci_conn_params *params;
+		struct hci_conn *hcon;
+		struct hci_dev *hdev;
+
+		if (!chan->conn) {
+			err = -ENOTCONN;
+			break;
+		}
+
+		hcon = chan->conn->hcon;
+		hdev = hcon->hdev;
+		hci_dev_lock(hdev);
+
+		params = hci_conn_params_lookup(hdev, &hcon->dst,
+						hcon->dst_type);
+
+		memset(&conn_param, 0, sizeof(conn_param));
+
+		if (params) {
+			conn_param.min_interval = params->conn_min_interval;
+			conn_param.max_interval = params->conn_max_interval;
+			conn_param.latency = params->conn_latency;
+			conn_param.supervision_timeout =
+				params->supervision_timeout;
+		} else {
+			conn_param.min_interval = hdev->le_conn_min_interval;
+			conn_param.max_interval = hdev->le_conn_max_interval;
+			conn_param.latency = hdev->le_conn_latency;
+			conn_param.supervision_timeout = hdev->le_supv_timeout;
+		}
+
+		hci_dev_unlock(hdev);
+
+		len = min_t(unsigned int, len, sizeof(conn_param));
+		if (copy_to_user(optval, (char *)&conn_param, len))
+			err = -EFAULT;
+
+		break;
+	}
 	case BT_SECURITY:
 		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
 		    chan->chan_type != L2CAP_CHAN_FIXED &&
@@ -762,6 +803,75 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
 	lock_sock(sk);
 
 	switch (optname) {
+	case BT_LE_CONN_PARAM: {
+		struct bt_le_conn_param conn_param;
+		struct hci_conn_params *hci_param;
+		struct hci_conn *hcon;
+		struct hci_dev *hdev;
+
+		len = min_t(unsigned int, sizeof(conn_param), optlen);
+		if (copy_from_user((char *)&conn_param, optval, len)) {
+			err = -EFAULT;
+			break;
+		}
+
+		if (!chan->conn) {
+			err = -ENOTCONN;
+			break;
+		}
+
+		err = hci_check_conn_params(conn_param.min_interval,
+					    conn_param.max_interval,
+					    conn_param.latency,
+					    conn_param.supervision_timeout);
+		if (err < 0) {
+			BT_ERR("Ignoring invalid connection parameters");
+			break;
+		}
+
+		hcon = chan->conn->hcon;
+		hdev = hcon->hdev;
+
+		hci_dev_lock(hdev);
+
+		/* we add new param in case it doesn't exist */
+		hci_param = hci_conn_params_add(hdev, &hcon->dst,
+						hcon->dst_type);
+		if (!hci_param) {
+			err = -ENOMEM;
+			BT_ERR("Failed to add connection parameters");
+			hci_dev_unlock(hcon->hdev);
+			break;
+		}
+
+		hci_dev_unlock(hdev);
+
+		/* Send a L2CAP connection parameters update request, if
+		 * the host role is slave.
+		 */
+		if (hcon->role == HCI_ROLE_SLAVE) {
+			l2cap_le_conn_update_req(chan->conn,
+						 conn_param.min_interval,
+						 conn_param.max_interval,
+						 conn_param.latency,
+						 conn_param.supervision_timeout);
+		} else {
+			/* this function also updates the hci_param value */
+			hci_le_conn_update(hcon, conn_param.min_interval,
+					   conn_param.max_interval,
+					   conn_param.latency,
+					   conn_param.supervision_timeout);
+
+			/* don't set the `store' hint */
+			mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type,
+					    false, conn_param.min_interval,
+					    conn_param.max_interval,
+					    conn_param.latency,
+					    conn_param.supervision_timeout);
+		}
+		break;
+	}
+
 	case BT_SECURITY:
 		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
 		    chan->chan_type != L2CAP_CHAN_FIXED &&
-- 
2.12.2

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

* [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD
  2017-04-13 12:21 [PATCH v5 BlueZ 0/4] Connection Update improvements Felipe F. Tonello
                   ` (2 preceding siblings ...)
  2017-04-13 12:22 ` [PATCH v5 BlueZ 3/4] Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option Felipe F. Tonello
@ 2017-04-13 12:22 ` Felipe F. Tonello
  2017-04-13 18:24   ` Vinicius Costa Gomes
                     ` (2 more replies)
  3 siblings, 3 replies; 9+ messages in thread
From: Felipe F. Tonello @ 2017-04-13 12:22 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: linux-kernel, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz

The Slave Connection Interval Range data type contains the Peripheral's
preferred connection interval range, for all logical connections.

It is useful to parse it in the Kernel so there is no multiple calls to
MGMT interface to update the device connection parameters and subsequent
connection command call to this device will use proper connection
parameters. This saves context-switches and eliminates user-space to
update the connection parameters each time a device is found or
bluetoothd is restarted and so on. Also, there is no need for the
user-space to know care about it because if the slave device wishes to
persist with these parameters, it should use the L2CAP connection
parameters upade request upon a completed connection.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 net/bluetooth/mgmt.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1fba2a03f8ae..ea5d6c85f173 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7442,6 +7442,46 @@ static bool is_filter_match(struct hci_dev *hdev, s8 rssi, u8 *eir,
 	return true;
 }
 
+static bool has_eir_slave_conn_int(const u8 *eir_data, u8 eir_len,
+				   u16 *min_conn, u16 *max_conn)
+{
+	u16 len = 0;
+	const u8 EIR_SLAVE_CONN_INT = 0x12; /* Slave Connection Interval Range */
+
+	while (len < eir_len - 1) {
+		u8 field_len = eir_data[0];
+		const u8 *data;
+		u8 data_len;
+
+		/* Check for the end of EIR */
+		if (field_len == 0)
+			break;
+
+		len += field_len + 1;
+
+		/* Do not continue EIR Data parsing if got
+		 * incorrect length
+		 */
+		if (len > eir_len)
+			break;
+
+		data = &eir_data[2];
+		data_len = field_len - 1;
+
+		if (eir_data[1] == EIR_SLAVE_CONN_INT) {
+			if (data_len < 4)
+				break;
+			*min_conn = le16_to_cpu(&data[0]);
+			*max_conn = le16_to_cpu(&data[2]);
+			return true;
+		}
+
+		eir_data += field_len + 1;
+	}
+
+	return false;
+}
+
 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)
@@ -7449,6 +7489,7 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 	char buf[512];
 	struct mgmt_ev_device_found *ev = (void *)buf;
 	size_t ev_size;
+	struct hci_conn *hcon;
 
 	/* Don't send events for a non-kernel initiated discovery. With
 	 * LE one exception is if we have pend_le_reports > 0 in which
@@ -7521,6 +7562,18 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 	ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len);
 	ev_size = sizeof(*ev) + eir_len + scan_rsp_len;
 
+	/* Search for Slave Connection Interval AD */
+	hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);
+	if (hcon) {
+		u16 min_conn_int, max_conn_int;
+
+		if (has_eir_slave_conn_int(ev->eir, ev->eir_len,
+					   &min_conn_int, &max_conn_int)) {
+			hcon->le_conn_min_interval = min_conn_int;
+			hcon->le_conn_max_interval = max_conn_int;
+		}
+	}
+
 	mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL);
 }
 
-- 
2.12.2

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

* Re: [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD
  2017-04-13 12:22 ` [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD Felipe F. Tonello
@ 2017-04-13 18:24   ` Vinicius Costa Gomes
  2017-04-13 18:40     ` Luiz Augusto von Dentz
  2017-04-13 20:01   ` kbuild test robot
  2017-04-13 22:04   ` kbuild test robot
  2 siblings, 1 reply; 9+ messages in thread
From: Vinicius Costa Gomes @ 2017-04-13 18:24 UTC (permalink / raw)
  To: Felipe F. Tonello, linux-bluetooth
  Cc: linux-kernel, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz

Hi Felipe,

"Felipe F. Tonello" <eu@felipetonello.com> writes:

> The Slave Connection Interval Range data type contains the Peripheral's
> preferred connection interval range, for all logical connections.
>
> It is useful to parse it in the Kernel so there is no multiple calls to
> MGMT interface to update the device connection parameters and subsequent
> connection command call to this device will use proper connection
> parameters. This saves context-switches and eliminates user-space to
> update the connection parameters each time a device is found or
> bluetoothd is restarted and so on. Also, there is no need for the
> user-space to know care about it because if the slave device wishes to
> persist with these parameters, it should use the L2CAP connection
> parameters upade request upon a completed connection.

nitpick: upade -> update

>
> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
> ---
>  net/bluetooth/mgmt.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 1fba2a03f8ae..ea5d6c85f173 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -7442,6 +7442,46 @@ static bool is_filter_match(struct hci_dev *hdev, s8 rssi, u8 *eir,
>  	return true;
>  }
>
> +static bool has_eir_slave_conn_int(const u8 *eir_data, u8 eir_len,
> +				   u16 *min_conn, u16 *max_conn)
> +{
> +	u16 len = 0;
> +	const u8 EIR_SLAVE_CONN_INT = 0x12; /* Slave Connection Interval Range */
> +
> +	while (len < eir_len - 1) {
> +		u8 field_len = eir_data[0];
> +		const u8 *data;
> +		u8 data_len;
> +
> +		/* Check for the end of EIR */
> +		if (field_len == 0)
> +			break;
> +
> +		len += field_len + 1;
> +
> +		/* Do not continue EIR Data parsing if got
> +		 * incorrect length
> +		 */
> +		if (len > eir_len)
> +			break;
> +
> +		data = &eir_data[2];
> +		data_len = field_len - 1;
> +
> +		if (eir_data[1] == EIR_SLAVE_CONN_INT) {
> +			if (data_len < 4)
> +				break;
> +			*min_conn = le16_to_cpu(&data[0]);
> +			*max_conn = le16_to_cpu(&data[2]);
> +			return true;
> +		}
> +
> +		eir_data += field_len + 1;
> +	}
> +
> +	return false;
> +}
> +
>  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)
> @@ -7449,6 +7489,7 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
>  	char buf[512];
>  	struct mgmt_ev_device_found *ev = (void *)buf;
>  	size_t ev_size;
> +	struct hci_conn *hcon;
>
>  	/* Don't send events for a non-kernel initiated discovery. With
>  	 * LE one exception is if we have pend_le_reports > 0 in which
> @@ -7521,6 +7562,18 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
>  	ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len);
>  	ev_size = sizeof(*ev) + eir_len + scan_rsp_len;
>
> +	/* Search for Slave Connection Interval AD */
> +	hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);
> +	if (hcon) {
> +		u16 min_conn_int, max_conn_int;
> +
> +		if (has_eir_slave_conn_int(ev->eir, ev->eir_len,
> +					   &min_conn_int, &max_conn_int)) {
> +			hcon->le_conn_min_interval = min_conn_int;
> +			hcon->le_conn_max_interval = max_conn_int;
> +		}
> +	}
> +

It's been some time that I looked at this code, so I could be missing
something, but I got the feeling that this part would make more sense if
it was at process_adv_report(), there's even the check for a pending
connection, so no need to redo that here.

Apart from this, the series looks good.


>  	mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL);
>  }
>
> --
> 2.12.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Cheers,
--
Vinicius

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

* Re: [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD
  2017-04-13 18:24   ` Vinicius Costa Gomes
@ 2017-04-13 18:40     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2017-04-13 18:40 UTC (permalink / raw)
  To: Vinicius Costa Gomes
  Cc: Felipe F. Tonello, linux-bluetooth, Linux Kernel Mailing List,
	Marcel Holtmann, Johan Hedberg

Hi,

On Thu, Apr 13, 2017 at 9:24 PM, Vinicius Costa Gomes
<vinicius.gomes@intel.com> wrote:
> Hi Felipe,
>
> "Felipe F. Tonello" <eu@felipetonello.com> writes:
>
>> The Slave Connection Interval Range data type contains the Peripheral's
>> preferred connection interval range, for all logical connections.
>>
>> It is useful to parse it in the Kernel so there is no multiple calls to
>> MGMT interface to update the device connection parameters and subsequent
>> connection command call to this device will use proper connection
>> parameters. This saves context-switches and eliminates user-space to
>> update the connection parameters each time a device is found or
>> bluetoothd is restarted and so on. Also, there is no need for the
>> user-space to know care about it because if the slave device wishes to
>> persist with these parameters, it should use the L2CAP connection
>> parameters upade request upon a completed connection.
>
> nitpick: upade -> update
>
>>
>> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
>> ---
>>  net/bluetooth/mgmt.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 53 insertions(+)
>>
>> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
>> index 1fba2a03f8ae..ea5d6c85f173 100644
>> --- a/net/bluetooth/mgmt.c
>> +++ b/net/bluetooth/mgmt.c
>> @@ -7442,6 +7442,46 @@ static bool is_filter_match(struct hci_dev *hdev, s8 rssi, u8 *eir,
>>       return true;
>>  }
>>
>> +static bool has_eir_slave_conn_int(const u8 *eir_data, u8 eir_len,
>> +                                u16 *min_conn, u16 *max_conn)
>> +{
>> +     u16 len = 0;
>> +     const u8 EIR_SLAVE_CONN_INT = 0x12; /* Slave Connection Interval Range */
>> +
>> +     while (len < eir_len - 1) {
>> +             u8 field_len = eir_data[0];
>> +             const u8 *data;
>> +             u8 data_len;
>> +
>> +             /* Check for the end of EIR */
>> +             if (field_len == 0)
>> +                     break;
>> +
>> +             len += field_len + 1;
>> +
>> +             /* Do not continue EIR Data parsing if got
>> +              * incorrect length
>> +              */
>> +             if (len > eir_len)
>> +                     break;
>> +
>> +             data = &eir_data[2];
>> +             data_len = field_len - 1;
>> +
>> +             if (eir_data[1] == EIR_SLAVE_CONN_INT) {
>> +                     if (data_len < 4)
>> +                             break;
>> +                     *min_conn = le16_to_cpu(&data[0]);
>> +                     *max_conn = le16_to_cpu(&data[2]);
>> +                     return true;
>> +             }
>> +
>> +             eir_data += field_len + 1;
>> +     }
>> +
>> +     return false;
>> +}
>> +
>>  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)
>> @@ -7449,6 +7489,7 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
>>       char buf[512];
>>       struct mgmt_ev_device_found *ev = (void *)buf;
>>       size_t ev_size;
>> +     struct hci_conn *hcon;
>>
>>       /* Don't send events for a non-kernel initiated discovery. With
>>        * LE one exception is if we have pend_le_reports > 0 in which
>> @@ -7521,6 +7562,18 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
>>       ev->eir_len = cpu_to_le16(eir_len + scan_rsp_len);
>>       ev_size = sizeof(*ev) + eir_len + scan_rsp_len;
>>
>> +     /* Search for Slave Connection Interval AD */
>> +     hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);
>> +     if (hcon) {
>> +             u16 min_conn_int, max_conn_int;
>> +
>> +             if (has_eir_slave_conn_int(ev->eir, ev->eir_len,
>> +                                        &min_conn_int, &max_conn_int)) {
>> +                     hcon->le_conn_min_interval = min_conn_int;
>> +                     hcon->le_conn_max_interval = max_conn_int;
>> +             }
>> +     }
>> +
>
> It's been some time that I looked at this code, so I could be missing
> something, but I got the feeling that this part would make more sense if
> it was at process_adv_report(), there's even the check for a pending
> connection, so no need to redo that here.

Actually I would use the AD only in case the device is marked for
auto-connect or there is a connection pending, so the parameters are
only used for the connection alone and are not persisted.

> Apart from this, the series looks good.
>
>
>>       mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL);
>>  }
>>
>> --
>> 2.12.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> Cheers,
> --
> Vinicius



-- 
Luiz Augusto von Dentz

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

* Re: [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD
  2017-04-13 12:22 ` [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD Felipe F. Tonello
  2017-04-13 18:24   ` Vinicius Costa Gomes
@ 2017-04-13 20:01   ` kbuild test robot
  2017-04-13 22:04   ` kbuild test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2017-04-13 20:01 UTC (permalink / raw)
  To: Felipe F. Tonello
  Cc: kbuild-all, linux-bluetooth, linux-kernel, Marcel Holtmann,
	Johan Hedberg, Luiz Augusto von Dentz

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

Hi Felipe,

[auto build test WARNING on bluetooth/master]
[also build test WARNING on v4.11-rc6 next-20170413]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Felipe-F-Tonello/Connection-Update-improvements/20170414-030326
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: x86_64-randconfig-x011-201715 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/little_endian.h:4:0,
                    from arch/x86/include/uapi/asm/byteorder.h:4,
                    from include/asm-generic/bitops/le.h:5,
                    from arch/x86/include/asm/bitops.h:517,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from net/bluetooth/mgmt.c:27:
   net/bluetooth/mgmt.c: In function 'has_eir_slave_conn_int':
>> include/uapi/linux/byteorder/little_endian.h:35:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^~~~~~~~~~~~~
>> net/bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^~~~~~~~~~~
>> include/uapi/linux/byteorder/little_endian.h:35:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^~~~~~~~~~~~~
   net/bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^~~~~~~~~~~
--
   In file included from include/linux/byteorder/little_endian.h:4:0,
                    from arch/x86/include/uapi/asm/byteorder.h:4,
                    from include/asm-generic/bitops/le.h:5,
                    from arch/x86/include/asm/bitops.h:517,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from net//bluetooth/mgmt.c:27:
   net//bluetooth/mgmt.c: In function 'has_eir_slave_conn_int':
>> include/uapi/linux/byteorder/little_endian.h:35:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^~~~~~~~~~~~~
   net//bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^~~~~~~~~~~
>> include/uapi/linux/byteorder/little_endian.h:35:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^~~~~~~~~~~~~
   net//bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^~~~~~~~~~~

vim +/le16_to_cpu +7474 net/bluetooth/mgmt.c

  7458				break;
  7459	
  7460			len += field_len + 1;
  7461	
  7462			/* Do not continue EIR Data parsing if got
  7463			 * incorrect length
  7464			 */
  7465			if (len > eir_len)
  7466				break;
  7467	
  7468			data = &eir_data[2];
  7469			data_len = field_len - 1;
  7470	
  7471			if (eir_data[1] == EIR_SLAVE_CONN_INT) {
  7472				if (data_len < 4)
  7473					break;
> 7474				*min_conn = le16_to_cpu(&data[0]);
  7475				*max_conn = le16_to_cpu(&data[2]);
  7476				return true;
  7477			}
  7478	
  7479			eir_data += field_len + 1;
  7480		}
  7481	
  7482		return false;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33493 bytes --]

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

* Re: [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD
  2017-04-13 12:22 ` [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD Felipe F. Tonello
  2017-04-13 18:24   ` Vinicius Costa Gomes
  2017-04-13 20:01   ` kbuild test robot
@ 2017-04-13 22:04   ` kbuild test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2017-04-13 22:04 UTC (permalink / raw)
  To: Felipe F. Tonello
  Cc: kbuild-all, linux-bluetooth, linux-kernel, Marcel Holtmann,
	Johan Hedberg, Luiz Augusto von Dentz

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

Hi Felipe,

[auto build test WARNING on bluetooth/master]
[also build test WARNING on v4.11-rc6 next-20170413]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Felipe-F-Tonello/Connection-Update-improvements/20170414-030326
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from include/linux/swab.h:4:0,
                    from include/uapi/linux/byteorder/big_endian.h:12,
                    from include/linux/byteorder/big_endian.h:4,
                    from arch/xtensa/include/uapi/asm/byteorder.h:7,
                    from arch/xtensa/include/asm/bitops.h:23,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from net/bluetooth/mgmt.c:27:
   net/bluetooth/mgmt.c: In function 'has_eir_slave_conn_int':
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:103:32: note: in definition of macro '__swab16'
     (__builtin_constant_p((__u16)(x)) ? \
                                   ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:13:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:14:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0xff00U) >> 8)))
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:105:12: note: in definition of macro '__swab16'
     __fswab16(x))
               ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:103:32: note: in definition of macro '__swab16'
     (__builtin_constant_p((__u16)(x)) ? \
                                   ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:13:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:14:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0xff00U) >> 8)))
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:105:12: note: in definition of macro '__swab16'
     __fswab16(x))
               ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net/bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
--
   In file included from include/linux/swab.h:4:0,
                    from include/uapi/linux/byteorder/big_endian.h:12,
                    from include/linux/byteorder/big_endian.h:4,
                    from arch/xtensa/include/uapi/asm/byteorder.h:7,
                    from arch/xtensa/include/asm/bitops.h:23,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from net//bluetooth/mgmt.c:27:
   net//bluetooth/mgmt.c: In function 'has_eir_slave_conn_int':
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:103:32: note: in definition of macro '__swab16'
     (__builtin_constant_p((__u16)(x)) ? \
                                   ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:13:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:14:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0xff00U) >> 8)))
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:105:12: note: in definition of macro '__swab16'
     __fswab16(x))
               ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7474:16: note: in expansion of macro 'le16_to_cpu'
       *min_conn = le16_to_cpu(&data[0]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:103:32: note: in definition of macro '__swab16'
     (__builtin_constant_p((__u16)(x)) ? \
                                   ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:13:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:14:12: note: in definition of macro '___constant_swab16'
     (((__u16)(x) & (__u16)0xff00U) >> 8)))
               ^
   include/uapi/linux/byteorder/big_endian.h:35:26: note: in expansion of macro '__swab16'
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                             ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^
>> include/uapi/linux/byteorder/big_endian.h:35:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                     ^
   include/uapi/linux/swab.h:105:12: note: in definition of macro '__swab16'
     __fswab16(x))
               ^
   include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__le16_to_cpu'
    #define le16_to_cpu __le16_to_cpu
                        ^
   net//bluetooth/mgmt.c:7475:16: note: in expansion of macro 'le16_to_cpu'
       *max_conn = le16_to_cpu(&data[2]);
                   ^

vim +35 include/uapi/linux/byteorder/big_endian.h

5921e6f8 David Howells  2012-10-13  19  #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
5921e6f8 David Howells  2012-10-13  20  #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
5921e6f8 David Howells  2012-10-13  21  #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
5921e6f8 David Howells  2012-10-13  22  #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
5921e6f8 David Howells  2012-10-13  23  #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
5921e6f8 David Howells  2012-10-13  24  #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8 David Howells  2012-10-13  25  #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8 David Howells  2012-10-13  26  #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8 David Howells  2012-10-13  27  #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8 David Howells  2012-10-13  28  #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8 David Howells  2012-10-13  29  #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8 David Howells  2012-10-13  30  #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
5921e6f8 David Howells  2012-10-13  31  #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
5921e6f8 David Howells  2012-10-13  32  #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
5921e6f8 David Howells  2012-10-13  33  #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
5921e6f8 David Howells  2012-10-13  34  #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
5921e6f8 David Howells  2012-10-13 @35  #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
5921e6f8 David Howells  2012-10-13  36  #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8 David Howells  2012-10-13  37  #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8 David Howells  2012-10-13  38  #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8 David Howells  2012-10-13  39  #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8 David Howells  2012-10-13  40  #define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8 David Howells  2012-10-13  41  #define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8 David Howells  2012-10-13  42  
bc27fb68 Denys Vlasenko 2016-03-17  43  static __always_inline __le64 __cpu_to_le64p(const __u64 *p)

:::::: The code at line 35 was first introduced by commit
:::::: 5921e6f8809b1616932ca4afd40fe449faa8fd88 UAPI: (Scripted) Disintegrate include/linux/byteorder

:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: David Howells <dhowells@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49076 bytes --]

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

end of thread, other threads:[~2017-04-13 22:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 12:21 [PATCH v5 BlueZ 0/4] Connection Update improvements Felipe F. Tonello
2017-04-13 12:22 ` [PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function Felipe F. Tonello
2017-04-13 12:22 ` [PATCH v5 BlueZ 2/4] Bluetooth: L2CAP: Add handler for Connection Parameter Update Response Felipe F. Tonello
2017-04-13 12:22 ` [PATCH v5 BlueZ 3/4] Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option Felipe F. Tonello
2017-04-13 12:22 ` [PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD Felipe F. Tonello
2017-04-13 18:24   ` Vinicius Costa Gomes
2017-04-13 18:40     ` Luiz Augusto von Dentz
2017-04-13 20:01   ` kbuild test robot
2017-04-13 22:04   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.