Message ID | 20200312100754.3445-2-sathish.narasimman@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Marcel Holtmann |
Headers | show |
Series | LE LL Priavcy support enabled | expand |
Hi Sathish, > This patch help to delte the resolving list stored in the BT > Controller w.r.t BD_ADDR. > > Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com> > --- > include/net/bluetooth/hci.h | 1 + > include/net/bluetooth/hci_core.h | 2 ++ > net/bluetooth/hci_request.c | 33 ++++++++++++++++++++++++++++++++ > 3 files changed, 36 insertions(+) > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > index 5f60e135aeb6..352bc43940ff 100644 > --- a/include/net/bluetooth/hci.h > +++ b/include/net/bluetooth/hci.h > @@ -457,6 +457,7 @@ enum { > #define HCI_LE_DATA_LEN_EXT 0x20 > #define HCI_LE_PHY_2M 0x01 > #define HCI_LE_PHY_CODED 0x08 > +#define HCI_LE_LL_PRIVACY 0x40 > #define HCI_LE_EXT_ADV 0x10 > #define HCI_LE_EXT_SCAN_POLICY 0x80 > #define HCI_LE_PHY_2M 0x01 > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > index d4e28773d378..5f04ef88da35 100644 > --- a/include/net/bluetooth/hci_core.h > +++ b/include/net/bluetooth/hci_core.h > @@ -1657,6 +1657,8 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, > > void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, > u8 *bdaddr_type); > +void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, > + bdaddr_t *bdaddr); > > #define SCO_AIRMODE_MASK 0x0003 > #define SCO_AIRMODE_CVSD 0x0000 > diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c > index bf83179ab9d1..f4bbd3b79210 100644 > --- a/net/bluetooth/hci_request.c > +++ b/net/bluetooth/hci_request.c > @@ -885,6 +885,39 @@ static void hci_req_start_scan(struct hci_request *req, u8 type, u16 interval, > } > } > > +void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr) > +{ > + struct hci_cp_le_del_from_resolv_list cp; > + struct hci_request req; > + struct bdaddr_list_with_irk *irk; > + > + BT_DBG(""); > + > + /* Nothing to be done if LL privacy is not supported */ > + if ( !(hdev->le_features[0] & HCI_LE_LL_PRIVACY) ) > + return; > + > + if ( !hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION) && > + ( hci_dev_test_flag(hdev, HCI_LE_ADV) || > + hci_dev_test_flag(hdev, HCI_LE_SCAN) || > + hci_lookup_le_connect(hdev) ) ) > + return; please don’t invent your own coding style. Follow the netdev convention. Regards Marcel
Hi Marcel On Wed, Mar 18, 2020 at 4:12 PM Marcel Holtmann <marcel@holtmann.org> wrote: > > Hi Sathish, > > > This patch help to delte the resolving list stored in the BT > > Controller w.r.t BD_ADDR. > > > > Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com> > > --- > > include/net/bluetooth/hci.h | 1 + > > include/net/bluetooth/hci_core.h | 2 ++ > > net/bluetooth/hci_request.c | 33 ++++++++++++++++++++++++++++++++ > > 3 files changed, 36 insertions(+) > > > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > > index 5f60e135aeb6..352bc43940ff 100644 > > --- a/include/net/bluetooth/hci.h > > +++ b/include/net/bluetooth/hci.h > > @@ -457,6 +457,7 @@ enum { > > #define HCI_LE_DATA_LEN_EXT 0x20 > > #define HCI_LE_PHY_2M 0x01 > > #define HCI_LE_PHY_CODED 0x08 > > +#define HCI_LE_LL_PRIVACY 0x40 > > #define HCI_LE_EXT_ADV 0x10 > > #define HCI_LE_EXT_SCAN_POLICY 0x80 > > #define HCI_LE_PHY_2M 0x01 > > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > > index d4e28773d378..5f04ef88da35 100644 > > --- a/include/net/bluetooth/hci_core.h > > +++ b/include/net/bluetooth/hci_core.h > > @@ -1657,6 +1657,8 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, > > > > void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, > > u8 *bdaddr_type); > > +void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, > > + bdaddr_t *bdaddr); > > > > #define SCO_AIRMODE_MASK 0x0003 > > #define SCO_AIRMODE_CVSD 0x0000 > > diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c > > index bf83179ab9d1..f4bbd3b79210 100644 > > --- a/net/bluetooth/hci_request.c > > +++ b/net/bluetooth/hci_request.c > > @@ -885,6 +885,39 @@ static void hci_req_start_scan(struct hci_request *req, u8 type, u16 interval, > > } > > } > > > > +void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr) > > +{ > > + struct hci_cp_le_del_from_resolv_list cp; > > + struct hci_request req; > > + struct bdaddr_list_with_irk *irk; > > + > > + BT_DBG(""); > > + > > + /* Nothing to be done if LL privacy is not supported */ > > + if ( !(hdev->le_features[0] & HCI_LE_LL_PRIVACY) ) > > + return; > > + > > + if ( !hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION) && > > + ( hci_dev_test_flag(hdev, HCI_LE_ADV) || > > + hci_dev_test_flag(hdev, HCI_LE_SCAN) || > > + hci_lookup_le_connect(hdev) ) ) > > + return; > > please don’t invent your own coding style. Follow the netdev convention. Sure will correct the coding style in next version of the patch > > Regards > > Marcel >
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 5f60e135aeb6..352bc43940ff 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -457,6 +457,7 @@ enum { #define HCI_LE_DATA_LEN_EXT 0x20 #define HCI_LE_PHY_2M 0x01 #define HCI_LE_PHY_CODED 0x08 +#define HCI_LE_LL_PRIVACY 0x40 #define HCI_LE_EXT_ADV 0x10 #define HCI_LE_EXT_SCAN_POLICY 0x80 #define HCI_LE_PHY_2M 0x01 diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d4e28773d378..5f04ef88da35 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1657,6 +1657,8 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *bdaddr_type); +void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, + bdaddr_t *bdaddr); #define SCO_AIRMODE_MASK 0x0003 #define SCO_AIRMODE_CVSD 0x0000 diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index bf83179ab9d1..f4bbd3b79210 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -885,6 +885,39 @@ static void hci_req_start_scan(struct hci_request *req, u8 type, u16 interval, } } +void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr) +{ + struct hci_cp_le_del_from_resolv_list cp; + struct hci_request req; + struct bdaddr_list_with_irk *irk; + + BT_DBG(""); + + /* Nothing to be done if LL privacy is not supported */ + if ( !(hdev->le_features[0] & HCI_LE_LL_PRIVACY) ) + return; + + if ( !hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION) && + ( hci_dev_test_flag(hdev, HCI_LE_ADV) || + hci_dev_test_flag(hdev, HCI_LE_SCAN) || + hci_lookup_le_connect(hdev) ) ) + return; + + /* If the device is not present in resolving list + * no need to send HCI command. + */ + irk = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list, bdaddr, addr_type); + if (!irk) + return; + + hci_req_init(&req, hdev); + cp.bdaddr_type = addr_type; + bacpy(&cp.bdaddr, bdaddr); + + hci_req_add(&req, HCI_OP_LE_DEL_FROM_RESOLV_LIST, sizeof(cp), &cp); + hci_req_run(&req, NULL); +} + void hci_req_add_le_passive_scan(struct hci_request *req) { struct hci_dev *hdev = req->hdev;
This patch help to delte the resolving list stored in the BT Controller w.r.t BD_ADDR. Signed-off-by: Sathish Narsimman <sathish.narasimman@intel.com> --- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/hci_core.h | 2 ++ net/bluetooth/hci_request.c | 33 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+)