From: Marcel Holtmann <marcel@holtmann.org>
To: Yu Liu <yudiliu@google.com>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
CrosBT Upstreaming <chromeos-bluetooth-upstreaming@chromium.org>,
Miao-chen Chou <mcchou@chromium.org>,
Alain Michaud <alainm@chromium.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v1] Bluetooth: Return whether a connection is outbound
Date: Fri, 9 Apr 2021 16:14:09 +0200 [thread overview]
Message-ID: <4E147FE8-F1B6-4EE9-9D7F-FE5656EAB2BE@holtmann.org> (raw)
In-Reply-To: <20210402105437.v1.1.Id5ee0a2edda8f0902498aaeb1b6c78d062579b75@changeid>
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
next prev parent reply other threads:[~2021-04-09 14:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 17:54 [PATCH v1] Bluetooth: Return whether a connection is outbound Yu Liu
2021-04-09 14:14 ` Marcel Holtmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-03-23 18:55 Yu Liu
2021-03-23 19:27 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E147FE8-F1B6-4EE9-9D7F-FE5656EAB2BE@holtmann.org \
--to=marcel@holtmann.org \
--cc=alainm@chromium.org \
--cc=chromeos-bluetooth-upstreaming@chromium.org \
--cc=davem@davemloft.net \
--cc=johan.hedberg@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=mcchou@chromium.org \
--cc=netdev@vger.kernel.org \
--cc=yudiliu@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).