Bluetooth: Fix bogus check for re-auth no supported with non-ssp
[platform/kernel/linux-starfive.git] / include / net / bluetooth / hci_core.h
index c33348b..b83cfcf 100644 (file)
@@ -189,6 +189,7 @@ struct blocked_key {
 struct smp_csrk {
        bdaddr_t bdaddr;
        u8 bdaddr_type;
+       u8 link_type;
        u8 type;
        u8 val[16];
 };
@@ -198,6 +199,7 @@ struct smp_ltk {
        struct rcu_head rcu;
        bdaddr_t bdaddr;
        u8 bdaddr_type;
+       u8 link_type;
        u8 authenticated;
        u8 type;
        u8 enc_size;
@@ -212,6 +214,7 @@ struct smp_irk {
        bdaddr_t rpa;
        bdaddr_t bdaddr;
        u8 addr_type;
+       u8 link_type;
        u8 val[16];
 };
 
@@ -219,6 +222,8 @@ struct link_key {
        struct list_head list;
        struct rcu_head rcu;
        bdaddr_t bdaddr;
+       u8 bdaddr_type;
+       u8 link_type;
        u8 type;
        u8 val[HCI_LINK_KEY_SIZE];
        u8 pin_len;
@@ -350,6 +355,8 @@ struct hci_dev {
        struct list_head list;
        struct mutex    lock;
 
+       struct ida      unset_handle_ida;
+
        const char      *name;
        unsigned long   flags;
        __u16           id;
@@ -950,7 +957,6 @@ void hci_inquiry_cache_flush(struct hci_dev *hdev);
 /* ----- HCI Connections ----- */
 enum {
        HCI_CONN_AUTH_PEND,
-       HCI_CONN_REAUTH_PEND,
        HCI_CONN_ENCRYPT_PEND,
        HCI_CONN_RSWITCH_PEND,
        HCI_CONN_MODE_CHANGE_PEND,
@@ -1225,11 +1231,11 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev,
                        continue;
 
                /* Match CIG ID if set */
-               if (cig != BT_ISO_QOS_CIG_UNSET && cig != c->iso_qos.ucast.cig)
+               if (cig != c->iso_qos.ucast.cig)
                        continue;
 
                /* Match CIS ID if set */
-               if (id != BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis)
+               if (id != c->iso_qos.ucast.cis)
                        continue;
 
                /* Match destination address if set */
@@ -1314,7 +1320,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_big_any_dst(struct hci_dev *
 }
 
 static inline struct hci_conn *
-hci_conn_hash_lookup_pa_sync(struct hci_dev *hdev, __u8 big)
+hci_conn_hash_lookup_pa_sync_big_handle(struct hci_dev *hdev, __u8 big)
 {
        struct hci_conn_hash *h = &hdev->conn_hash;
        struct hci_conn  *c;
@@ -1336,6 +1342,29 @@ hci_conn_hash_lookup_pa_sync(struct hci_dev *hdev, __u8 big)
        return NULL;
 }
 
+static inline struct hci_conn *
+hci_conn_hash_lookup_pa_sync_handle(struct hci_dev *hdev, __u16 sync_handle)
+{
+       struct hci_conn_hash *h = &hdev->conn_hash;
+       struct hci_conn  *c;
+
+       rcu_read_lock();
+
+       list_for_each_entry_rcu(c, &h->list, list) {
+               if (c->type != ISO_LINK ||
+                       !test_bit(HCI_CONN_PA_SYNC, &c->flags))
+                       continue;
+
+               if (c->sync_handle == sync_handle) {
+                       rcu_read_unlock();
+                       return c;
+               }
+       }
+       rcu_read_unlock();
+
+       return NULL;
+}
+
 static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
                                                        __u8 type, __u16 state)
 {
@@ -1426,7 +1455,9 @@ int hci_le_create_cis_pending(struct hci_dev *hdev);
 int hci_conn_check_create_cis(struct hci_conn *conn);
 
 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
-                             u8 role);
+                             u8 role, u16 handle);
+struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type,
+                                   bdaddr_t *dst, u8 role);
 void hci_conn_del(struct hci_conn *conn);
 void hci_conn_hash_flush(struct hci_dev *hdev);
 void hci_conn_check_pending(struct hci_dev *hdev);