@@ -129,7 +129,9 @@ struct hci_conn_hash {
129129 struct list_head list ;
130130 unsigned int acl_num ;
131131 unsigned int sco_num ;
132- unsigned int iso_num ;
132+ unsigned int cis_num ;
133+ unsigned int bis_num ;
134+ unsigned int pa_num ;
133135 unsigned int le_num ;
134136 unsigned int le_num_peripheral ;
135137};
@@ -1014,9 +1016,13 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
10141016 h -> sco_num ++ ;
10151017 break ;
10161018 case CIS_LINK :
1019+ h -> cis_num ++ ;
1020+ break ;
10171021 case BIS_LINK :
1022+ h -> bis_num ++ ;
1023+ break ;
10181024 case PA_LINK :
1019- h -> iso_num ++ ;
1025+ h -> pa_num ++ ;
10201026 break ;
10211027 }
10221028}
@@ -1042,9 +1048,13 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
10421048 h -> sco_num -- ;
10431049 break ;
10441050 case CIS_LINK :
1051+ h -> cis_num -- ;
1052+ break ;
10451053 case BIS_LINK :
1054+ h -> bis_num -- ;
1055+ break ;
10461056 case PA_LINK :
1047- h -> iso_num -- ;
1057+ h -> pa_num -- ;
10481058 break ;
10491059 }
10501060}
@@ -1061,9 +1071,11 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
10611071 case ESCO_LINK :
10621072 return h -> sco_num ;
10631073 case CIS_LINK :
1074+ return h -> cis_num ;
10641075 case BIS_LINK :
1076+ return h -> bis_num ;
10651077 case PA_LINK :
1066- return h -> iso_num ;
1078+ return h -> pa_num ;
10671079 default :
10681080 return 0 ;
10691081 }
@@ -1073,7 +1085,15 @@ static inline unsigned int hci_conn_count(struct hci_dev *hdev)
10731085{
10741086 struct hci_conn_hash * c = & hdev -> conn_hash ;
10751087
1076- return c -> acl_num + c -> sco_num + c -> le_num + c -> iso_num ;
1088+ return c -> acl_num + c -> sco_num + c -> le_num + c -> cis_num + c -> bis_num +
1089+ c -> pa_num ;
1090+ }
1091+
1092+ static inline unsigned int hci_iso_count (struct hci_dev * hdev )
1093+ {
1094+ struct hci_conn_hash * c = & hdev -> conn_hash ;
1095+
1096+ return c -> cis_num + c -> bis_num ;
10771097}
10781098
10791099static inline bool hci_conn_valid (struct hci_dev * hdev , struct hci_conn * conn )
@@ -1915,6 +1935,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
19151935 !hci_dev_test_flag(dev, HCI_RPA_EXPIRED))
19161936#define adv_rpa_valid (adv ) (bacmp(&adv->random_addr, BDADDR_ANY) && \
19171937 !adv->rpa_expired)
1938+ #define le_enabled (dev ) (lmp_le_capable(dev) && \
1939+ hci_dev_test_flag(dev, HCI_LE_ENABLED))
19181940
19191941#define scan_1m (dev ) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_1M) || \
19201942 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_1M))
@@ -1932,6 +1954,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
19321954 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))
19331955
19341956#define ll_privacy_capable (dev ) ((dev)->le_features[0] & HCI_LE_LL_PRIVACY)
1957+ #define ll_privacy_enabled (dev ) (le_enabled(dev) && ll_privacy_capable(dev))
19351958
19361959#define privacy_mode_capable (dev ) (ll_privacy_capable(dev) && \
19371960 ((dev)->commands[39] & 0x04))
@@ -1981,14 +2004,23 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
19812004
19822005/* CIS Master/Slave and BIS support */
19832006#define iso_capable (dev ) (cis_capable(dev) || bis_capable(dev))
2007+ #define iso_enabled (dev ) (le_enabled(dev) && iso_capable(dev))
19842008#define cis_capable (dev ) \
19852009 (cis_central_capable(dev) || cis_peripheral_capable(dev))
2010+ #define cis_enabled (dev ) (le_enabled(dev) && cis_capable(dev))
19862011#define cis_central_capable (dev ) \
19872012 ((dev)->le_features[3] & HCI_LE_CIS_CENTRAL)
2013+ #define cis_central_enabled (dev ) \
2014+ (le_enabled(dev) && cis_central_capable(dev))
19882015#define cis_peripheral_capable (dev ) \
19892016 ((dev)->le_features[3] & HCI_LE_CIS_PERIPHERAL)
2017+ #define cis_peripheral_enabled (dev ) \
2018+ (le_enabled(dev) && cis_peripheral_capable(dev))
19902019#define bis_capable (dev ) ((dev)->le_features[3] & HCI_LE_ISO_BROADCASTER)
1991- #define sync_recv_capable (dev ) ((dev)->le_features[3] & HCI_LE_ISO_SYNC_RECEIVER)
2020+ #define bis_enabled (dev ) (le_enabled(dev) && bis_capable(dev))
2021+ #define sync_recv_capable (dev ) \
2022+ ((dev)->le_features[3] & HCI_LE_ISO_SYNC_RECEIVER)
2023+ #define sync_recv_enabled (dev ) (le_enabled(dev) && sync_recv_capable(dev))
19922024
19932025#define mws_transport_config_capable (dev ) (((dev)->commands[30] & 0x08) && \
19942026 (!hci_test_quirk((dev), HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG)))
0 commit comments