Commit 49c50922 authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: Fix LE reconnection logic

We can't use hci_explicit_connect_lookup() since that would only cover
explicit connections, leaving normal reconnections completely
untouched. Not using it in turn means leaving out entries in
pend_le_reports.

To fix this and simplify the logic move conn params from the reports
list to the pend_le_conns list for the duration of an explicit
connect. Once the connect is complete move the params back to the
pend_le_reports list. This also means that the explicit connect lookup
function only needs to look into the pend_le_conns list.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent b958f9a3
...@@ -1000,8 +1000,8 @@ static int hci_explicit_conn_params_set(struct hci_request *req, ...@@ -1000,8 +1000,8 @@ static int hci_explicit_conn_params_set(struct hci_request *req,
/* If we created new params, or existing params were marked as disabled, /* If we created new params, or existing params were marked as disabled,
* mark them to be used just once to connect. * mark them to be used just once to connect.
*/ */
if (params->auto_connect == HCI_AUTO_CONN_DISABLED) { if (params->auto_connect == HCI_AUTO_CONN_DISABLED ||
params->auto_connect = HCI_AUTO_CONN_EXPLICIT; params->auto_connect == HCI_AUTO_CONN_REPORT) {
list_del_init(&params->action); list_del_init(&params->action);
list_add(&params->action, &hdev->pend_le_conns); list_add(&params->action, &hdev->pend_le_conns);
} }
......
...@@ -2861,13 +2861,6 @@ struct hci_conn_params *hci_explicit_connect_lookup(struct hci_dev *hdev, ...@@ -2861,13 +2861,6 @@ struct hci_conn_params *hci_explicit_connect_lookup(struct hci_dev *hdev,
return param; return param;
} }
list_for_each_entry(param, &hdev->pend_le_reports, action) {
if (bacmp(&param->addr, addr) == 0 &&
param->addr_type == addr_type &&
param->explicit_connect)
return param;
}
return NULL; return NULL;
} }
......
...@@ -4653,8 +4653,8 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev, ...@@ -4653,8 +4653,8 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
/* If we're not connectable only connect devices that we have in /* If we're not connectable only connect devices that we have in
* our pend_le_conns list. * our pend_le_conns list.
*/ */
params = hci_explicit_connect_lookup(hdev, addr, addr_type); params = hci_pend_le_action_lookup(&hdev->pend_le_conns, addr,
addr_type);
if (!params) if (!params)
return NULL; return NULL;
......
...@@ -6117,6 +6117,9 @@ static int hci_conn_params_set(struct hci_request *req, bdaddr_t *addr, ...@@ -6117,6 +6117,9 @@ static int hci_conn_params_set(struct hci_request *req, bdaddr_t *addr,
__hci_update_background_scan(req); __hci_update_background_scan(req);
break; break;
case HCI_AUTO_CONN_REPORT: case HCI_AUTO_CONN_REPORT:
if (params->explicit_connect)
list_add(&params->action, &hdev->pend_le_conns);
else
list_add(&params->action, &hdev->pend_le_reports); list_add(&params->action, &hdev->pend_le_reports);
__hci_update_background_scan(req); __hci_update_background_scan(req);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment