Skip to content

Commit 4aa4211

Browse files
jonas2515Vudentz
authored andcommitted
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 4c67bc7 ("[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: Jonas Dreßler <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 4534009 commit 4aa4211

File tree

3 files changed

+4
-34
lines changed

3 files changed

+4
-34
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,6 @@ struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type,
14801480
bdaddr_t *dst, u8 role);
14811481
void hci_conn_del(struct hci_conn *conn);
14821482
void hci_conn_hash_flush(struct hci_dev *hdev);
1483-
void hci_conn_check_pending(struct hci_dev *hdev);
14841483

14851484
struct hci_chan *hci_chan_create(struct hci_conn *conn);
14861485
void hci_chan_del(struct hci_chan *chan);

net/bluetooth/hci_conn.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,22 +2592,6 @@ void hci_conn_hash_flush(struct hci_dev *hdev)
25922592
}
25932593
}
25942594

2595-
/* Check pending connect attempts */
2596-
void hci_conn_check_pending(struct hci_dev *hdev)
2597-
{
2598-
struct hci_conn *conn;
2599-
2600-
BT_DBG("hdev %s", hdev->name);
2601-
2602-
hci_dev_lock(hdev);
2603-
2604-
conn = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2);
2605-
if (conn)
2606-
hci_acl_create_connection_sync(hdev, conn);
2607-
2608-
hci_dev_unlock(hdev);
2609-
}
2610-
26112595
static u32 get_link_mode(struct hci_conn *conn)
26122596
{
26132597
u32 link_mode = 0;

net/bluetooth/hci_event.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ static u8 hci_cc_inquiry_cancel(struct hci_dev *hdev, void *data,
118118
hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
119119
hci_dev_unlock(hdev);
120120

121-
hci_conn_check_pending(hdev);
122-
123121
return rp->status;
124122
}
125123

@@ -150,8 +148,6 @@ static u8 hci_cc_exit_periodic_inq(struct hci_dev *hdev, void *data,
150148

151149
hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ);
152150

153-
hci_conn_check_pending(hdev);
154-
155151
return rp->status;
156152
}
157153

@@ -2312,10 +2308,8 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
23122308
{
23132309
bt_dev_dbg(hdev, "status 0x%2.2x", status);
23142310

2315-
if (status) {
2316-
hci_conn_check_pending(hdev);
2311+
if (status)
23172312
return;
2318-
}
23192313

23202314
if (hci_sent_cmd_data(hdev, HCI_OP_INQUIRY))
23212315
set_bit(HCI_INQUIRY, &hdev->flags);
@@ -2340,12 +2334,9 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
23402334

23412335
if (status) {
23422336
if (conn && conn->state == BT_CONNECT) {
2343-
if (status != HCI_ERROR_COMMAND_DISALLOWED || conn->attempt > 2) {
2344-
conn->state = BT_CLOSED;
2345-
hci_connect_cfm(conn, status);
2346-
hci_conn_del(conn);
2347-
} else
2348-
conn->state = BT_CONNECT2;
2337+
conn->state = BT_CLOSED;
2338+
hci_connect_cfm(conn, status);
2339+
hci_conn_del(conn);
23492340
}
23502341
} else {
23512342
if (!conn) {
@@ -3035,8 +3026,6 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, void *data,
30353026

30363027
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
30373028

3038-
hci_conn_check_pending(hdev);
3039-
30403029
if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
30413030
return;
30423031

@@ -3258,8 +3247,6 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data,
32583247

32593248
unlock:
32603249
hci_dev_unlock(hdev);
3261-
3262-
hci_conn_check_pending(hdev);
32633250
}
32643251

32653252
static void hci_reject_conn(struct hci_dev *hdev, bdaddr_t *bdaddr)

0 commit comments

Comments
 (0)