31 #define HCI_PRIO_MAX 7
125 #define HCI_MAX_SHORT_NAME_LENGTH 10
127 #define NUM_REASSEMBLY 4
368 #define INQUIRY_CACHE_AGE_MAX (HZ*30)
369 #define INQUIRY_ENTRY_AGE_MAX (HZ*60)
371 static inline void discovery_init(
struct hci_dev *hdev)
373 hdev->
discovery.state = DISCOVERY_STOPPED;
375 INIT_LIST_HEAD(&hdev->
discovery.unknown);
376 INIT_LIST_HEAD(&hdev->
discovery.resolve);
383 static inline int inquiry_cache_empty(
struct hci_dev *hdev)
388 static inline long inquiry_cache_age(
struct hci_dev *hdev)
409 bool name_known,
bool *
ssp);
426 static inline bool hci_conn_ssp_enabled(
struct hci_conn *conn)
433 static inline void hci_conn_hash_add(
struct hci_dev *hdev,
struct hci_conn *
c)
451 static inline void hci_conn_hash_del(
struct hci_dev *hdev,
struct hci_conn *c)
455 list_del_rcu(&c->
list);
472 static inline unsigned int hci_conn_num(
struct hci_dev *hdev,
__u8 type)
488 static inline struct hci_conn *hci_conn_hash_lookup_handle(
struct hci_dev *hdev,
496 list_for_each_entry_rcu(c, &h->
list,
list) {
497 if (c->
handle == handle) {
507 static inline struct hci_conn *hci_conn_hash_lookup_ba(
struct hci_dev *hdev,
508 __u8 type, bdaddr_t *ba)
515 list_for_each_entry_rcu(c, &h->
list,
list) {
516 if (c->
type == type && !bacmp(&c->
dst, ba)) {
527 static inline struct hci_conn *hci_conn_hash_lookup_state(
struct hci_dev *hdev,
535 list_for_each_entry_rcu(c, &h->
list,
list) {
536 if (c->
type == type && c->
state == state) {
573 static inline void hci_conn_hold(
struct hci_conn *conn)
581 static inline void hci_conn_put(
struct hci_conn *conn)
606 static inline void hci_dev_put(
struct hci_dev *
d)
623 #define hci_dev_lock(d) mutex_lock(&d->lock)
624 #define hci_dev_unlock(d) mutex_unlock(&d->lock)
626 #define to_hci_dev(d) container_of(d, struct hci_dev, dev)
627 #define to_hci_conn(c) container_of(c, struct hci_conn, dev)
629 static inline void *hci_get_drvdata(
struct hci_dev *hdev)
634 static inline void hci_set_drvdata(
struct hci_dev *hdev,
void *
data)
640 static inline uint8_t __hci_num_ctrl(
void)
715 #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
718 #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
719 #define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT)
720 #define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF)
721 #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
722 #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
723 #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
724 #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
725 #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
726 #define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR))
729 #define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE)
732 static inline int hci_proto_connect_ind(
struct hci_dev *hdev, bdaddr_t *
bdaddr,
744 BT_ERR(
"unknown link type %d", type);
751 switch (conn->
type) {
771 static inline int hci_proto_disconn_ind(
struct hci_conn *conn)
781 switch (conn->
type) {
801 static inline void hci_proto_auth_cfm(
struct hci_conn *conn,
__u8 status)
818 static inline void hci_proto_encrypt_cfm(
struct hci_conn *conn,
__u8 status,
842 static inline void hci_auth_cfm(
struct hci_conn *conn,
__u8 status)
847 hci_proto_auth_cfm(conn, status);
863 static inline void hci_encrypt_cfm(
struct hci_conn *conn,
__u8 status,
874 hci_proto_encrypt_cfm(conn, status, encrypt);
885 static inline void hci_key_change_cfm(
struct hci_conn *conn,
__u8 status)
898 static inline void hci_role_switch_cfm(
struct hci_conn *conn,
__u8 status,
919 while (parsed < data_len - 1) {
920 u8 field_len = data[0];
925 parsed += field_len + 1;
927 if (parsed > data_len)
933 data += field_len + 1;
939 static inline size_t eir_get_length(
u8 *eir,
size_t eir_len)
943 while (parsed < eir_len) {
944 u8 field_len = eir[0];
949 parsed += field_len + 1;
950 eir += field_len + 1;
956 static inline u16 eir_append_data(
u8 *eir,
u16 eir_len,
u8 type,
u8 *data,
959 eir[eir_len++] =
sizeof(
type) + data_len;
960 eir[eir_len++] =
type;
961 memcpy(&eir[eir_len], data, data_len);
984 #define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR))
985 #define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \
986 BIT(BDADDR_LE_RANDOM))
987 #define DISCOV_TYPE_INTERLEAVED (BIT(BDADDR_BREDR) | \
988 BIT(BDADDR_LE_PUBLIC) | \
989 BIT(BDADDR_LE_RANDOM))
1004 u8 link_type,
u8 addr_type,
u8 reason);
1006 u8 link_type,
u8 addr_type,
u8 status);
1008 u8 addr_type,
u8 status);
1018 u8 link_type,
u8 addr_type,
u8 status);
1020 u8 link_type,
u8 addr_type,
u8 status);
1022 u8 link_type,
u8 addr_type);
1024 u8 link_type,
u8 addr_type,
u8 status);
1026 u8 link_type,
u8 addr_type,
u8 status);
1028 u8 link_type,
u8 addr_type,
u32 passkey,
1031 u8 addr_type,
u8 status);
1038 u8 *randomizer,
u8 status);
1055 #define hci_pi(sk) ((struct hci_pinfo *) sk)
1066 #define HCI_SFLT_MAX_OGF 5
1075 #define HCI_REQ_DONE 0
1076 #define HCI_REQ_PEND 1
1077 #define HCI_REQ_CANCELED 2
1079 #define hci_req_lock(d) mutex_lock(&d->req_lock)
1080 #define hci_req_unlock(d) mutex_unlock(&d->req_lock)