Commit 4aa42119 authored by Jonas Dreßler's avatar Jonas Dreßler Committed by Luiz Augusto von Dentz

Bluetooth: Remove pending ACL connection attempts

With the last commit we moved to using the hci_sync queue for "Create
Connection" requests, removing the need for retrying the paging after
finished/failed "Create Connection" requests and after the end of
inquiries.

hci_conn_check_pending() was used to trigger this retry, we can remove it
now.

Note that we can also remove the special handling for COMMAND_DISALLOWED
errors in the completion handler of "Create Connection", because "Create
Connection" requests are now always serialized.

This is somewhat reverting commit 4c67bc74 ("[Bluetooth] Support
concurrent connect requests").

With this, the BT_CONNECT2 state of ACL hci_conn objects should now be
back to meaning only one thing: That we received a "Connection Request"
from another device (see hci_conn_request_evt), but the response to that
is going to be deferred.
Signed-off-by: default avatarJonas Dreßler <verdre@v0yd.nl>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 45340097
...@@ -1480,7 +1480,6 @@ struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type, ...@@ -1480,7 +1480,6 @@ struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type,
bdaddr_t *dst, u8 role); bdaddr_t *dst, u8 role);
void hci_conn_del(struct hci_conn *conn); void hci_conn_del(struct hci_conn *conn);
void hci_conn_hash_flush(struct hci_dev *hdev); void hci_conn_hash_flush(struct hci_dev *hdev);
void hci_conn_check_pending(struct hci_dev *hdev);
struct hci_chan *hci_chan_create(struct hci_conn *conn); struct hci_chan *hci_chan_create(struct hci_conn *conn);
void hci_chan_del(struct hci_chan *chan); void hci_chan_del(struct hci_chan *chan);
......
...@@ -2592,22 +2592,6 @@ void hci_conn_hash_flush(struct hci_dev *hdev) ...@@ -2592,22 +2592,6 @@ void hci_conn_hash_flush(struct hci_dev *hdev)
} }
} }
/* Check pending connect attempts */
void hci_conn_check_pending(struct hci_dev *hdev)
{
struct hci_conn *conn;
BT_DBG("hdev %s", hdev->name);
hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2);
if (conn)
hci_acl_create_connection_sync(hdev, conn);
hci_dev_unlock(hdev);
}
static u32 get_link_mode(struct hci_conn *conn) static u32 get_link_mode(struct hci_conn *conn)
{ {
u32 link_mode = 0; u32 link_mode = 0;
......
...@@ -118,8 +118,6 @@ static u8 hci_cc_inquiry_cancel(struct hci_dev *hdev, void *data, ...@@ -118,8 +118,6 @@ static u8 hci_cc_inquiry_cancel(struct hci_dev *hdev, void *data,
hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
hci_conn_check_pending(hdev);
return rp->status; return rp->status;
} }
...@@ -150,8 +148,6 @@ static u8 hci_cc_exit_periodic_inq(struct hci_dev *hdev, void *data, ...@@ -150,8 +148,6 @@ static u8 hci_cc_exit_periodic_inq(struct hci_dev *hdev, void *data,
hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ);
hci_conn_check_pending(hdev);
return rp->status; return rp->status;
} }
...@@ -2312,10 +2308,8 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) ...@@ -2312,10 +2308,8 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
{ {
bt_dev_dbg(hdev, "status 0x%2.2x", status); bt_dev_dbg(hdev, "status 0x%2.2x", status);
if (status) { if (status)
hci_conn_check_pending(hdev);
return; return;
}
if (hci_sent_cmd_data(hdev, HCI_OP_INQUIRY)) if (hci_sent_cmd_data(hdev, HCI_OP_INQUIRY))
set_bit(HCI_INQUIRY, &hdev->flags); set_bit(HCI_INQUIRY, &hdev->flags);
...@@ -2340,12 +2334,9 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) ...@@ -2340,12 +2334,9 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
if (status) { if (status) {
if (conn && conn->state == BT_CONNECT) { if (conn && conn->state == BT_CONNECT) {
if (status != HCI_ERROR_COMMAND_DISALLOWED || conn->attempt > 2) {
conn->state = BT_CLOSED; conn->state = BT_CLOSED;
hci_connect_cfm(conn, status); hci_connect_cfm(conn, status);
hci_conn_del(conn); hci_conn_del(conn);
} else
conn->state = BT_CONNECT2;
} }
} else { } else {
if (!conn) { if (!conn) {
...@@ -3035,8 +3026,6 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, void *data, ...@@ -3035,8 +3026,6 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, void *data,
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
hci_conn_check_pending(hdev);
if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
return; return;
...@@ -3258,8 +3247,6 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data, ...@@ -3258,8 +3247,6 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data,
unlock: unlock:
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
hci_conn_check_pending(hdev);
} }
static void hci_reject_conn(struct hci_dev *hdev, bdaddr_t *bdaddr) static void hci_reject_conn(struct hci_dev *hdev, bdaddr_t *bdaddr)
......
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