Message ID | 20211201194952.1537811-1-luiz.dentz@gmail.com |
---|---|
State | New |
Headers | show |
Series | [v4,1/4] Bluetooth: MGMT: Use hci_dev_test_and_{set,clear}_flag | expand |
Hi Luiz, > This adds support for Set Privacy Mode when updating the resolving list > when HCI_CONN_FLAG_DEVICE_PRIVACY so the controller shall use Device > Mode for devices programmed in the resolving list, Device Mode is > actually required when the remote device are not able to use RPA as > otherwise the default mode is Network Privacy Mode in which only > allows RPAs thus the controller would filter out advertisement using > identity addresses for which there is an IRK. > > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > --- > include/net/bluetooth/hci.h | 10 +++++++ > include/net/bluetooth/hci_core.h | 1 + > net/bluetooth/hci_event.c | 29 ++++++++++++++++++ > net/bluetooth/hci_sync.c | 51 ++++++++++++++++++++++++++++---- > 4 files changed, 85 insertions(+), 6 deletions(-) this patch doesn’t apply to bluetooth-next tree. Regards Marcel
Hi Luiz, > This reworks hci_conn_params flags to use bitmap_* helpers and add > support for setting the supported flags in hdev->conn_flags so it can > easily be accessed. > > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > --- > include/net/bluetooth/hci_core.h | 24 ++++++++++++------------ > net/bluetooth/hci_core.c | 8 +++++++- > net/bluetooth/hci_request.c | 4 ++-- > net/bluetooth/hci_sync.c | 7 +++---- > net/bluetooth/mgmt.c | 30 ++++++++++++++++++++---------- > 5 files changed, 44 insertions(+), 29 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel
Hi Luiz, > This make use of hci_dev_test_and_{set,clear}_flag instead of doing 2 > operations in a row. > > Fixes: cbbdfa6f33198 ("Bluetooth: Enable controller RPA resolution using Experimental feature") > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > --- > v2: Fix marking Device Privacy Flag even when adapter is not capable of > handling Set Privacy Mode. > v3: Add patch for using hci_dev_test_and_{set,clear}_flag and split > changes reworking how HCI_CONN_FLAG_REMOTE_WAKEUP is set and make use of > bitmap to store the supported flags. > v4: Add Fixes to 1/4, address comments of 2/4 removing changes to > hci_dev_*_flags and moving privacy_mode_capable to 3/4 which makes use of it. > > net/bluetooth/mgmt.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index bf989ae03f9f..ff6d7c9333be 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -4041,10 +4041,10 @@ static int set_zero_key_func(struct sock *sk, struct hci_dev *hdev, #endif if (hdev && use_ll_privacy(hdev) && !hdev_is_powered(hdev)) { - bool changed = hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - - hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + bool changed; + changed = hci_dev_test_and_clear_flag(hdev, + HCI_ENABLE_LL_PRIVACY); if (changed) exp_ll_privacy_feature_changed(false, hdev, sk); } @@ -4139,15 +4139,15 @@ static int set_rpa_resolution_func(struct sock *sk, struct hci_dev *hdev, val = !!cp->param[0]; if (val) { - changed = !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - hci_dev_set_flag(hdev, HCI_ENABLE_LL_PRIVACY); + changed = !hci_dev_test_and_set_flag(hdev, + HCI_ENABLE_LL_PRIVACY); hci_dev_clear_flag(hdev, HCI_ADVERTISING); /* Enable LL privacy + supported settings changed */ flags = BIT(0) | BIT(1); } else { - changed = hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + changed = hci_dev_test_and_clear_flag(hdev, + HCI_ENABLE_LL_PRIVACY); /* Disable LL privacy + supported settings changed */ flags = BIT(1);