Bluetooth: GAP: Dont allow role switch when there is another ACL
The scatternet scenarios are difficult to be handled in SOC. This
change not to allow role switch during outgoing ACL connections
will avoid scatternet scenarios.
CRs-fixed: 392836
Change-Id: I5769b71879ea951755e115424fb2b5b504e95784
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index f57fab7..0ade089 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -206,6 +206,13 @@
}
EXPORT_SYMBOL(hci_le_remove_dev_white_list);
+static inline bool is_role_switch_possible(struct hci_dev *hdev)
+{
+ if (hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECTED))
+ return false;
+ return true;
+}
+
void hci_acl_connect(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
@@ -241,7 +248,8 @@
}
cp.pkt_type = cpu_to_le16(conn->pkt_type);
- if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER))
+ if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER)
+ && is_role_switch_possible(hdev))
cp.role_switch = 0x01;
else
cp.role_switch = 0x00;