summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Jain <anuj01.jain@samsung.com>2024-05-10 15:21:46 +0530
committerJaehoon Chung <jh80.chung@samsung.com>2024-11-12 13:03:19 +0900
commit4f71040f57a3c51fb4177fee74a4b16d43e9fa68 (patch)
tree751817fd8cca3ef1ed4fb71785becd437f4c1156
parente2795a9c0c8e8cde42faa85b67a1bfdea0adb7e5 (diff)
downloadlinux-rpi-4f71040f57a3c51fb4177fee74a4b16d43e9fa68.tar.gz
linux-rpi-4f71040f57a3c51fb4177fee74a4b16d43e9fa68.tar.bz2
linux-rpi-4f71040f57a3c51fb4177fee74a4b16d43e9fa68.zip
Revert "Bluetooth: Store advertising handle so it can be re-enabled"
This reverts commit 7087c4f69487f017722df7d299ef9b7709996b79. Patch revert is needed as it is the cause for GATT Server TCT fail. Change-Id: Id40e2a5dca326cb9996bcf768b638560c553373d Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_event.c39
2 files changed, 14 insertions, 26 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 35b7e396db67..eab65caeba5d 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -682,7 +682,6 @@ struct hci_conn {
__u8 init_addr_type;
bdaddr_t resp_addr;
__u8 resp_addr_type;
- __u8 adv_instance;
__u16 handle;
__u16 sync_handle;
__u16 state;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 335ae892d9d4..ed922381f73a 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2913,13 +2913,12 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)
goto unlock;
if (status) {
+ u8 type = conn->type;
mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
conn->dst_type, status);
- if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) {
- hdev->cur_adv_instance = conn->adv_instance;
+ if (type == LE_LINK)
hci_enable_advertising(hdev);
- }
/* Inform sockets conn is gone before we delete it */
hci_disconn_cfm(conn, HCI_ERROR_UNSPECIFIED);
@@ -3566,6 +3565,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,
struct hci_conn_params *params;
struct hci_conn *conn;
bool mgmt_connected;
+ u8 type;
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
@@ -3619,8 +3619,10 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,
break;
}
}
+ type = conn->type;
hci_disconn_cfm(conn, ev->reason);
+ hci_conn_del(conn);
/* Re-enable advertising if necessary, since it might
* have been disabled by the connection. From the
@@ -3632,12 +3634,10 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,
* or until a connection is created or until the Advertising
* is timed out due to Directed Advertising."
*/
- if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) {
- hdev->cur_adv_instance = conn->adv_instance;
+
+ if (type == LE_LINK)
hci_enable_advertising(hdev);
- }
- hci_conn_del(conn);
#ifdef TIZEN_BT
if (conn->type == ACL_LINK && !hci_conn_num(hdev, ACL_LINK)) {
@@ -5988,13 +5988,6 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status,
conn->sec_level = BT_SECURITY_LOW;
conn->state = BT_CONFIG;
- /* Store current advertising instance as connection advertising instance
- * when sotfware rotation is in use so it can be re-enabled when
- * disconnected.
- */
- if (!ext_adv_capable(hdev))
- conn->adv_instance = hdev->cur_adv_instance;
-
conn->le_conn_interval = interval;
conn->le_conn_latency = latency;
conn->le_supv_timeout = supervision_timeout;
@@ -6075,7 +6068,7 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data,
{
struct hci_evt_le_ext_adv_set_term *ev = data;
struct hci_conn *conn;
- struct adv_info *adv, *n;
+ struct adv_info *n;
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
@@ -6093,9 +6086,10 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data,
hci_dev_lock(hdev);
- adv = hci_find_adv_instance(hdev, ev->handle);
if (ev->status) {
+ struct adv_info *adv;
+ adv = hci_find_adv_instance(hdev, ev->handle);
if (!adv)
goto unlock;
@@ -6113,15 +6107,9 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data,
goto unlock;
}
- if (adv)
- adv->enabled = false;
-
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle));
if (conn) {
- /* Store handle in the connection so the correct advertising
- * instance can be re-enabled when disconnected.
- */
- conn->adv_instance = ev->handle;
+ struct adv_info *adv_instance;
if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM ||
bacmp(&conn->resp_addr, BDADDR_ANY))
@@ -6132,8 +6120,9 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, void *data,
goto unlock;
}
- if (adv)
- bacpy(&conn->resp_addr, &adv->random_addr);
+ adv_instance = hci_find_adv_instance(hdev, ev->handle);
+ if (adv_instance)
+ bacpy(&conn->resp_addr, &adv_instance->random_addr);
}
unlock: