|
@@ -2924,6 +2924,81 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
|
|
|
return mgmt_device_unblocked(hdev, bdaddr, type);
|
|
|
}
|
|
|
|
|
|
+/* This function requires the caller holds hdev->lock */
|
|
|
+struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
|
|
|
+ bdaddr_t *addr, u8 addr_type)
|
|
|
+{
|
|
|
+ struct hci_conn_params *params;
|
|
|
+
|
|
|
+ list_for_each_entry(params, &hdev->le_conn_params, list) {
|
|
|
+ if (bacmp(¶ms->addr, addr) == 0 &&
|
|
|
+ params->addr_type == addr_type) {
|
|
|
+ return params;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+/* This function requires the caller holds hdev->lock */
|
|
|
+void hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
|
|
|
+ u16 conn_min_interval, u16 conn_max_interval)
|
|
|
+{
|
|
|
+ struct hci_conn_params *params;
|
|
|
+
|
|
|
+ params = hci_conn_params_lookup(hdev, addr, addr_type);
|
|
|
+ if (params) {
|
|
|
+ params->conn_min_interval = conn_min_interval;
|
|
|
+ params->conn_max_interval = conn_max_interval;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ params = kzalloc(sizeof(*params), GFP_KERNEL);
|
|
|
+ if (!params) {
|
|
|
+ BT_ERR("Out of memory");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ bacpy(¶ms->addr, addr);
|
|
|
+ params->addr_type = addr_type;
|
|
|
+ params->conn_min_interval = conn_min_interval;
|
|
|
+ params->conn_max_interval = conn_max_interval;
|
|
|
+
|
|
|
+ list_add(¶ms->list, &hdev->le_conn_params);
|
|
|
+
|
|
|
+ BT_DBG("addr %pMR (type %u) conn_min_interval 0x%.4x "
|
|
|
+ "conn_max_interval 0x%.4x", addr, addr_type, conn_min_interval,
|
|
|
+ conn_max_interval);
|
|
|
+}
|
|
|
+
|
|
|
+/* This function requires the caller holds hdev->lock */
|
|
|
+void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
|
|
|
+{
|
|
|
+ struct hci_conn_params *params;
|
|
|
+
|
|
|
+ params = hci_conn_params_lookup(hdev, addr, addr_type);
|
|
|
+ if (!params)
|
|
|
+ return;
|
|
|
+
|
|
|
+ list_del(¶ms->list);
|
|
|
+ kfree(params);
|
|
|
+
|
|
|
+ BT_DBG("addr %pMR (type %u)", addr, addr_type);
|
|
|
+}
|
|
|
+
|
|
|
+/* This function requires the caller holds hdev->lock */
|
|
|
+void hci_conn_params_clear(struct hci_dev *hdev)
|
|
|
+{
|
|
|
+ struct hci_conn_params *params, *tmp;
|
|
|
+
|
|
|
+ list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) {
|
|
|
+ list_del(¶ms->list);
|
|
|
+ kfree(params);
|
|
|
+ }
|
|
|
+
|
|
|
+ BT_DBG("All LE connection parameters were removed");
|
|
|
+}
|
|
|
+
|
|
|
static void inquiry_complete(struct hci_dev *hdev, u8 status)
|
|
|
{
|
|
|
if (status) {
|
|
@@ -3034,6 +3109,7 @@ struct hci_dev *hci_alloc_dev(void)
|
|
|
INIT_LIST_HEAD(&hdev->link_keys);
|
|
|
INIT_LIST_HEAD(&hdev->long_term_keys);
|
|
|
INIT_LIST_HEAD(&hdev->remote_oob_data);
|
|
|
+ INIT_LIST_HEAD(&hdev->le_conn_params);
|
|
|
INIT_LIST_HEAD(&hdev->conn_hash.list);
|
|
|
|
|
|
INIT_WORK(&hdev->rx_work, hci_rx_work);
|
|
@@ -3219,6 +3295,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
|
|
|
hci_link_keys_clear(hdev);
|
|
|
hci_smp_ltks_clear(hdev);
|
|
|
hci_remote_oob_data_clear(hdev);
|
|
|
+ hci_conn_params_clear(hdev);
|
|
|
hci_dev_unlock(hdev);
|
|
|
|
|
|
hci_dev_put(hdev);
|