All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: Return whether a connection is outbound
@ 2021-03-23 18:55 Yu Liu
  2021-03-23 19:21 ` [v1] " bluez.test.bot
  2021-03-23 19:27 ` [PATCH v1] " Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Yu Liu @ 2021-03-23 18:55 UTC (permalink / raw)
  To: linux-bluetooth, marcel, chromeos-bluetooth-upstreaming
  Cc: Yu Liu, Miao-chen Chou, Alain Michaud, David S. Miller,
	Jakub Kicinski, Johan Hedberg, Luiz Augusto von Dentz,
	linux-kernel, netdev

When an MGMT_EV_DEVICE_CONNECTED event is reported back to the user
space we will set the flags to tell if the established connection is
outbound or not. This is useful for the user space to log better metrics
and error messages.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Alain Michaud <alainm@chromium.org>

Signed-off-by: Yu Liu <yudiliu@google.com>
---

Changes in v1:
- Initial change

 include/net/bluetooth/mgmt.h | 2 ++
 net/bluetooth/mgmt.c         | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index a7cffb069565..d66bc6938b58 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -885,6 +885,8 @@ struct mgmt_ev_new_long_term_key {
 	struct mgmt_ltk_info key;
 } __packed;
 
+#define MGMT_DEV_CONN_DIRECTION_OUT	0x01
+
 #define MGMT_EV_DEVICE_CONNECTED	0x000B
 struct mgmt_ev_device_connected {
 	struct mgmt_addr_info addr;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 90334ac4a135..fc0ff6dc7ebf 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8772,6 +8772,11 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
 	bacpy(&ev->addr.bdaddr, &conn->dst);
 	ev->addr.type = link_to_bdaddr(conn->type, conn->dst_type);
 
+	if (conn->out)
+		flags |= MGMT_DEV_CONN_DIRECTION_OUT;
+	else
+		flags &= ~MGMT_DEV_CONN_DIRECTION_OUT;
+
 	ev->flags = __cpu_to_le32(flags);
 
 	/* We must ensure that the EIR Data fields are ordered and
-- 
2.31.0.291.g576ba9dcdaf-goog


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

* RE: [v1] Bluetooth: Return whether a connection is outbound
  2021-03-23 18:55 [PATCH v1] Bluetooth: Return whether a connection is outbound Yu Liu
@ 2021-03-23 19:21 ` bluez.test.bot
  2021-03-23 19:27 ` [PATCH v1] " Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2021-03-23 19:21 UTC (permalink / raw)
  To: linux-bluetooth, yudiliu

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

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=454127

---Test result---

##############################
Test: CheckPatch - PASS


##############################
Test: CheckGitLint - PASS


##############################
Test: CheckBuildK - PASS


##############################
Test: CheckTestRunner: Setup - PASS


##############################
Test: CheckTestRunner: l2cap-tester - PASS
Total: 40, Passed: 34 (85.0%), Failed: 0, Not Run: 6

##############################
Test: CheckTestRunner: bnep-tester - PASS
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: mgmt-tester - PASS
Total: 416, Passed: 402 (96.6%), Failed: 0, Not Run: 14

##############################
Test: CheckTestRunner: rfcomm-tester - PASS
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: sco-tester - PASS
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: smp-tester - PASS
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: CheckTestRunner: userchan-tester - PASS
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 43342 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3533 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 546678 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11653 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9887 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11799 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5430 bytes --]

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

* Re: [PATCH v1] Bluetooth: Return whether a connection is outbound
  2021-03-23 18:55 [PATCH v1] Bluetooth: Return whether a connection is outbound Yu Liu
  2021-03-23 19:21 ` [v1] " bluez.test.bot
@ 2021-03-23 19:27 ` Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2021-03-23 19:27 UTC (permalink / raw)
  To: Yu Liu
  Cc: linux-bluetooth, CrosBT Upstreaming, Miao-chen Chou,
	Alain Michaud, David S. Miller, Jakub Kicinski, Johan Hedberg,
	Luiz Augusto von Dentz, LKML, netdev

Hi Yu,

> When an MGMT_EV_DEVICE_CONNECTED event is reported back to the user
> space we will set the flags to tell if the established connection is
> outbound or not. This is useful for the user space to log better metrics
> and error messages.
> 
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> 
> Signed-off-by: Yu Liu <yudiliu@google.com>
> ---
> 
> Changes in v1:
> - Initial change

please send a patch to describe the API change in doc/mgmt-api.txt first.

Regards

Marcel


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

* Re: [PATCH v1] Bluetooth: Return whether a connection is outbound
  2021-04-02 17:54 Yu Liu
@ 2021-04-09 14:14 ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2021-04-09 14:14 UTC (permalink / raw)
  To: Yu Liu
  Cc: linux-bluetooth, CrosBT Upstreaming, Miao-chen Chou,
	Alain Michaud, David S. Miller, Jakub Kicinski, Johan Hedberg,
	Luiz Augusto von Dentz, linux-kernel, netdev

Hi Yu,

> When an MGMT_EV_DEVICE_CONNECTED event is reported back to the user
> space we will set the flags to tell if the established connection is
> outbound or not. This is useful for the user space to log better metrics
> and error messages.
> 
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> Signed-off-by: Yu Liu <yudiliu@google.com>
> ---
> 
> Changes in v1:
> - Initial change
> 
> include/net/bluetooth/mgmt.h | 2 ++
> net/bluetooth/mgmt.c         | 5 +++++
> 2 files changed, 7 insertions(+)
> 
> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> index a7cffb069565..7cc724386b00 100644
> --- a/include/net/bluetooth/mgmt.h
> +++ b/include/net/bluetooth/mgmt.h
> @@ -885,6 +885,8 @@ struct mgmt_ev_new_long_term_key {
> 	struct mgmt_ltk_info key;
> } __packed;
> 
> +#define MGMT_DEV_CONN_INITIATED_CONNECTION 0x08
> +

I would just add this to MGMT_DEV_FOUND_INITIATED_CONN 0x08. And yes, I realize that this is a bit weird, but then all values are in one place.

> #define MGMT_EV_DEVICE_CONNECTED	0x000B
> struct mgmt_ev_device_connected {
> 	struct mgmt_addr_info addr;
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 09e099c419f2..77213e67e8e4 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -8774,6 +8774,11 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
> 	bacpy(&ev->addr.bdaddr, &conn->dst);
> 	ev->addr.type = link_to_bdaddr(conn->type, conn->dst_type);

So the prototype of mgmt_device_connected needs to be changed to remove the flags parameter. It is not used at all.

> 
> +	if (conn->out)
> +		flags |= MGMT_DEV_CONN_INITIATED_CONNECTION;
> +	else
> +		flags &= ~MGMT_DEV_CONN_INITIATED_CONNECTION;
> +

And then this should be just this:

	if (conn->out)
		flags |= MGMT_DEV_CONN_INITIATED_CONNECTION;

> 	ev->flags = __cpu_to_le32(flags);
> 
> 	/* We must ensure that the EIR Data fields are ordered and

Regards

Marcel


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

* [PATCH v1] Bluetooth: Return whether a connection is outbound
@ 2021-04-02 17:54 Yu Liu
  2021-04-09 14:14 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Yu Liu @ 2021-04-02 17:54 UTC (permalink / raw)
  To: linux-bluetooth, marcel, chromeos-bluetooth-upstreaming
  Cc: Yu Liu, Miao-chen Chou, Alain Michaud, David S. Miller,
	Jakub Kicinski, Johan Hedberg, Luiz Augusto von Dentz,
	linux-kernel, netdev

When an MGMT_EV_DEVICE_CONNECTED event is reported back to the user
space we will set the flags to tell if the established connection is
outbound or not. This is useful for the user space to log better metrics
and error messages.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Yu Liu <yudiliu@google.com>
---

Changes in v1:
- Initial change

 include/net/bluetooth/mgmt.h | 2 ++
 net/bluetooth/mgmt.c         | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index a7cffb069565..7cc724386b00 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -885,6 +885,8 @@ struct mgmt_ev_new_long_term_key {
 	struct mgmt_ltk_info key;
 } __packed;
 
+#define MGMT_DEV_CONN_INITIATED_CONNECTION 0x08
+
 #define MGMT_EV_DEVICE_CONNECTED	0x000B
 struct mgmt_ev_device_connected {
 	struct mgmt_addr_info addr;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 09e099c419f2..77213e67e8e4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8774,6 +8774,11 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
 	bacpy(&ev->addr.bdaddr, &conn->dst);
 	ev->addr.type = link_to_bdaddr(conn->type, conn->dst_type);
 
+	if (conn->out)
+		flags |= MGMT_DEV_CONN_INITIATED_CONNECTION;
+	else
+		flags &= ~MGMT_DEV_CONN_INITIATED_CONNECTION;
+
 	ev->flags = __cpu_to_le32(flags);
 
 	/* We must ensure that the EIR Data fields are ordered and
-- 
2.31.0.208.g409f899ff0-goog


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

end of thread, other threads:[~2021-04-09 14:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 18:55 [PATCH v1] Bluetooth: Return whether a connection is outbound Yu Liu
2021-03-23 19:21 ` [v1] " bluez.test.bot
2021-03-23 19:27 ` [PATCH v1] " Marcel Holtmann
2021-04-02 17:54 Yu Liu
2021-04-09 14:14 ` Marcel Holtmann

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.