| .. | .. |
|---|
| 25 | 25 | #ifndef __HCI_CORE_H |
|---|
| 26 | 26 | #define __HCI_CORE_H |
|---|
| 27 | 27 | |
|---|
| 28 | +#include <linux/idr.h> |
|---|
| 28 | 29 | #include <linux/leds.h> |
|---|
| 29 | 30 | #include <linux/rculist.h> |
|---|
| 31 | +#include <linux/android_kabi.h> |
|---|
| 30 | 32 | |
|---|
| 31 | 33 | #include <net/bluetooth/hci.h> |
|---|
| 32 | 34 | #include <net/bluetooth/hci_sock.h> |
|---|
| 33 | 35 | |
|---|
| 34 | 36 | /* HCI priority */ |
|---|
| 35 | 37 | #define HCI_PRIO_MAX 7 |
|---|
| 38 | + |
|---|
| 39 | +/* HCI maximum id value */ |
|---|
| 40 | +#define HCI_MAX_ID 10000 |
|---|
| 36 | 41 | |
|---|
| 37 | 42 | /* HCI Core structures */ |
|---|
| 38 | 43 | struct inquiry_data { |
|---|
| .. | .. |
|---|
| 88 | 93 | unsigned long scan_duration; |
|---|
| 89 | 94 | }; |
|---|
| 90 | 95 | |
|---|
| 96 | +#define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ |
|---|
| 97 | + |
|---|
| 98 | +enum suspend_tasks { |
|---|
| 99 | + SUSPEND_PAUSE_DISCOVERY, |
|---|
| 100 | + SUSPEND_UNPAUSE_DISCOVERY, |
|---|
| 101 | + |
|---|
| 102 | + SUSPEND_PAUSE_ADVERTISING, |
|---|
| 103 | + SUSPEND_UNPAUSE_ADVERTISING, |
|---|
| 104 | + |
|---|
| 105 | + SUSPEND_SCAN_DISABLE, |
|---|
| 106 | + SUSPEND_SCAN_ENABLE, |
|---|
| 107 | + SUSPEND_DISCONNECTING, |
|---|
| 108 | + |
|---|
| 109 | + SUSPEND_POWERING_DOWN, |
|---|
| 110 | + |
|---|
| 111 | + SUSPEND_PREPARE_NOTIFIER, |
|---|
| 112 | + __SUSPEND_NUM_TASKS |
|---|
| 113 | +}; |
|---|
| 114 | + |
|---|
| 115 | +enum suspended_state { |
|---|
| 116 | + BT_RUNNING = 0, |
|---|
| 117 | + BT_SUSPEND_DISCONNECT, |
|---|
| 118 | + BT_SUSPEND_CONFIGURE_WAKE, |
|---|
| 119 | +}; |
|---|
| 120 | + |
|---|
| 91 | 121 | struct hci_conn_hash { |
|---|
| 92 | 122 | struct list_head list; |
|---|
| 93 | 123 | unsigned int acl_num; |
|---|
| .. | .. |
|---|
| 103 | 133 | u8 bdaddr_type; |
|---|
| 104 | 134 | }; |
|---|
| 105 | 135 | |
|---|
| 136 | +struct bdaddr_list_with_irk { |
|---|
| 137 | + struct list_head list; |
|---|
| 138 | + bdaddr_t bdaddr; |
|---|
| 139 | + u8 bdaddr_type; |
|---|
| 140 | + u8 peer_irk[16]; |
|---|
| 141 | + u8 local_irk[16]; |
|---|
| 142 | +}; |
|---|
| 143 | + |
|---|
| 144 | +struct bdaddr_list_with_flags { |
|---|
| 145 | + struct list_head list; |
|---|
| 146 | + bdaddr_t bdaddr; |
|---|
| 147 | + u8 bdaddr_type; |
|---|
| 148 | + u32 current_flags; |
|---|
| 149 | +}; |
|---|
| 150 | + |
|---|
| 151 | +enum hci_conn_flags { |
|---|
| 152 | + HCI_CONN_FLAG_REMOTE_WAKEUP, |
|---|
| 153 | + HCI_CONN_FLAG_MAX |
|---|
| 154 | +}; |
|---|
| 155 | + |
|---|
| 156 | +#define hci_conn_test_flag(nr, flags) ((flags) & (1U << nr)) |
|---|
| 157 | + |
|---|
| 158 | +/* Make sure number of flags doesn't exceed sizeof(current_flags) */ |
|---|
| 159 | +static_assert(HCI_CONN_FLAG_MAX < 32); |
|---|
| 160 | + |
|---|
| 106 | 161 | struct bt_uuid { |
|---|
| 107 | 162 | struct list_head list; |
|---|
| 108 | 163 | u8 uuid[16]; |
|---|
| 109 | 164 | u8 size; |
|---|
| 110 | 165 | u8 svc_hint; |
|---|
| 166 | +}; |
|---|
| 167 | + |
|---|
| 168 | +struct blocked_key { |
|---|
| 169 | + struct list_head list; |
|---|
| 170 | + struct rcu_head rcu; |
|---|
| 171 | + u8 type; |
|---|
| 172 | + u8 val[16]; |
|---|
| 111 | 173 | }; |
|---|
| 112 | 174 | |
|---|
| 113 | 175 | struct smp_csrk { |
|---|
| .. | .. |
|---|
| 180 | 242 | #define HCI_MAX_ADV_INSTANCES 5 |
|---|
| 181 | 243 | #define HCI_DEFAULT_ADV_DURATION 2 |
|---|
| 182 | 244 | |
|---|
| 245 | +struct adv_pattern { |
|---|
| 246 | + struct list_head list; |
|---|
| 247 | + __u8 ad_type; |
|---|
| 248 | + __u8 offset; |
|---|
| 249 | + __u8 length; |
|---|
| 250 | + __u8 value[HCI_MAX_AD_LENGTH]; |
|---|
| 251 | +}; |
|---|
| 252 | + |
|---|
| 253 | +struct adv_monitor { |
|---|
| 254 | + struct list_head patterns; |
|---|
| 255 | + bool active; |
|---|
| 256 | + __u16 handle; |
|---|
| 257 | +}; |
|---|
| 258 | + |
|---|
| 259 | +#define HCI_MIN_ADV_MONITOR_HANDLE 1 |
|---|
| 260 | +#define HCI_MAX_ADV_MONITOR_NUM_HANDLES 32 |
|---|
| 261 | +#define HCI_MAX_ADV_MONITOR_NUM_PATTERNS 16 |
|---|
| 262 | + |
|---|
| 183 | 263 | #define HCI_MAX_SHORT_NAME_LENGTH 10 |
|---|
| 184 | 264 | |
|---|
| 185 | 265 | /* Min encryption key size to match with SMP */ |
|---|
| .. | .. |
|---|
| 191 | 271 | /* Default min/max age of connection information (1s/3s) */ |
|---|
| 192 | 272 | #define DEFAULT_CONN_INFO_MIN_AGE 1000 |
|---|
| 193 | 273 | #define DEFAULT_CONN_INFO_MAX_AGE 3000 |
|---|
| 274 | +/* Default authenticated payload timeout 30s */ |
|---|
| 275 | +#define DEFAULT_AUTH_PAYLOAD_TIMEOUT 0x0bb8 |
|---|
| 194 | 276 | |
|---|
| 195 | 277 | struct amp_assoc { |
|---|
| 196 | 278 | __u16 len; |
|---|
| .. | .. |
|---|
| 243 | 325 | __u8 stored_num_keys; |
|---|
| 244 | 326 | __u8 io_capability; |
|---|
| 245 | 327 | __s8 inq_tx_power; |
|---|
| 328 | + __u8 err_data_reporting; |
|---|
| 246 | 329 | __u16 page_scan_interval; |
|---|
| 247 | 330 | __u16 page_scan_window; |
|---|
| 248 | 331 | __u8 page_scan_type; |
|---|
| .. | .. |
|---|
| 252 | 335 | __u8 le_scan_type; |
|---|
| 253 | 336 | __u16 le_scan_interval; |
|---|
| 254 | 337 | __u16 le_scan_window; |
|---|
| 338 | + __u16 le_scan_int_suspend; |
|---|
| 339 | + __u16 le_scan_window_suspend; |
|---|
| 340 | + __u16 le_scan_int_discovery; |
|---|
| 341 | + __u16 le_scan_window_discovery; |
|---|
| 342 | + __u16 le_scan_int_adv_monitor; |
|---|
| 343 | + __u16 le_scan_window_adv_monitor; |
|---|
| 344 | + __u16 le_scan_int_connect; |
|---|
| 345 | + __u16 le_scan_window_connect; |
|---|
| 255 | 346 | __u16 le_conn_min_interval; |
|---|
| 256 | 347 | __u16 le_conn_max_interval; |
|---|
| 257 | 348 | __u16 le_conn_latency; |
|---|
| .. | .. |
|---|
| 267 | 358 | __u16 discov_interleaved_timeout; |
|---|
| 268 | 359 | __u16 conn_info_min_age; |
|---|
| 269 | 360 | __u16 conn_info_max_age; |
|---|
| 361 | + __u16 auth_payload_timeout; |
|---|
| 362 | + __u8 min_enc_key_size; |
|---|
| 363 | + __u8 max_enc_key_size; |
|---|
| 364 | + __u8 pairing_opts; |
|---|
| 270 | 365 | __u8 ssp_debug_mode; |
|---|
| 271 | 366 | __u8 hw_error_code; |
|---|
| 272 | 367 | __u32 clock; |
|---|
| .. | .. |
|---|
| 275 | 370 | __u16 devid_vendor; |
|---|
| 276 | 371 | __u16 devid_product; |
|---|
| 277 | 372 | __u16 devid_version; |
|---|
| 373 | + |
|---|
| 374 | + __u8 def_page_scan_type; |
|---|
| 375 | + __u16 def_page_scan_int; |
|---|
| 376 | + __u16 def_page_scan_window; |
|---|
| 377 | + __u8 def_inq_scan_type; |
|---|
| 378 | + __u16 def_inq_scan_int; |
|---|
| 379 | + __u16 def_inq_scan_window; |
|---|
| 380 | + __u16 def_br_lsto; |
|---|
| 381 | + __u16 def_page_timeout; |
|---|
| 382 | + __u16 def_multi_adv_rotation_duration; |
|---|
| 383 | + __u16 def_le_autoconnect_timeout; |
|---|
| 278 | 384 | |
|---|
| 279 | 385 | __u16 pkt_type; |
|---|
| 280 | 386 | __u16 esco_type; |
|---|
| .. | .. |
|---|
| 370 | 476 | void *smp_bredr_data; |
|---|
| 371 | 477 | |
|---|
| 372 | 478 | struct discovery_state discovery; |
|---|
| 479 | + |
|---|
| 480 | + int discovery_old_state; |
|---|
| 481 | + bool discovery_paused; |
|---|
| 482 | + int advertising_old_state; |
|---|
| 483 | + bool advertising_paused; |
|---|
| 484 | + |
|---|
| 485 | + struct notifier_block suspend_notifier; |
|---|
| 486 | + struct work_struct suspend_prepare; |
|---|
| 487 | + enum suspended_state suspend_state_next; |
|---|
| 488 | + enum suspended_state suspend_state; |
|---|
| 489 | + bool scanning_paused; |
|---|
| 490 | + bool suspended; |
|---|
| 491 | + u8 wake_reason; |
|---|
| 492 | + bdaddr_t wake_addr; |
|---|
| 493 | + u8 wake_addr_type; |
|---|
| 494 | + |
|---|
| 495 | + wait_queue_head_t suspend_wait_q; |
|---|
| 496 | + DECLARE_BITMAP(suspend_tasks, __SUSPEND_NUM_TASKS); |
|---|
| 497 | + |
|---|
| 373 | 498 | struct hci_conn_hash conn_hash; |
|---|
| 374 | 499 | |
|---|
| 375 | 500 | struct list_head mgmt_pending; |
|---|
| .. | .. |
|---|
| 385 | 510 | struct list_head le_conn_params; |
|---|
| 386 | 511 | struct list_head pend_le_conns; |
|---|
| 387 | 512 | struct list_head pend_le_reports; |
|---|
| 513 | + struct list_head blocked_keys; |
|---|
| 388 | 514 | |
|---|
| 389 | 515 | struct hci_dev_stats stat; |
|---|
| 390 | 516 | |
|---|
| .. | .. |
|---|
| 412 | 538 | __u16 adv_instance_timeout; |
|---|
| 413 | 539 | struct delayed_work adv_instance_expire; |
|---|
| 414 | 540 | |
|---|
| 541 | + struct idr adv_monitors_idr; |
|---|
| 542 | + unsigned int adv_monitors_cnt; |
|---|
| 543 | + |
|---|
| 415 | 544 | __u8 irk[16]; |
|---|
| 416 | 545 | __u32 rpa_timeout; |
|---|
| 417 | 546 | struct delayed_work rpa_expired; |
|---|
| .. | .. |
|---|
| 419 | 548 | |
|---|
| 420 | 549 | #if IS_ENABLED(CONFIG_BT_LEDS) |
|---|
| 421 | 550 | struct led_trigger *power_led; |
|---|
| 551 | +#endif |
|---|
| 552 | + |
|---|
| 553 | +#if IS_ENABLED(CONFIG_BT_MSFTEXT) |
|---|
| 554 | + __u16 msft_opcode; |
|---|
| 555 | + void *msft_data; |
|---|
| 422 | 556 | #endif |
|---|
| 423 | 557 | |
|---|
| 424 | 558 | int (*open)(struct hci_dev *hdev); |
|---|
| .. | .. |
|---|
| 432 | 566 | int (*post_init)(struct hci_dev *hdev); |
|---|
| 433 | 567 | int (*set_diag)(struct hci_dev *hdev, bool enable); |
|---|
| 434 | 568 | int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr); |
|---|
| 569 | + void (*cmd_timeout)(struct hci_dev *hdev); |
|---|
| 570 | + bool (*prevent_wake)(struct hci_dev *hdev); |
|---|
| 571 | + |
|---|
| 572 | + ANDROID_KABI_RESERVE(1); |
|---|
| 573 | + ANDROID_KABI_RESERVE(2); |
|---|
| 574 | + ANDROID_KABI_RESERVE(3); |
|---|
| 575 | + ANDROID_KABI_RESERVE(4); |
|---|
| 435 | 576 | }; |
|---|
| 436 | 577 | |
|---|
| 437 | 578 | #define HCI_PHY_HANDLE(handle) (handle & 0xff) |
|---|
| 579 | + |
|---|
| 580 | +enum conn_reasons { |
|---|
| 581 | + CONN_REASON_PAIR_DEVICE, |
|---|
| 582 | + CONN_REASON_L2CAP_CHAN, |
|---|
| 583 | + CONN_REASON_SCO_CONNECT, |
|---|
| 584 | +}; |
|---|
| 438 | 585 | |
|---|
| 439 | 586 | struct hci_conn { |
|---|
| 440 | 587 | struct list_head list; |
|---|
| .. | .. |
|---|
| 472 | 619 | __u16 disc_timeout; |
|---|
| 473 | 620 | __u16 conn_timeout; |
|---|
| 474 | 621 | __u16 setting; |
|---|
| 622 | + __u16 auth_payload_timeout; |
|---|
| 475 | 623 | __u16 le_conn_min_interval; |
|---|
| 476 | 624 | __u16 le_conn_max_interval; |
|---|
| 477 | 625 | __u16 le_conn_interval; |
|---|
| .. | .. |
|---|
| 479 | 627 | __u16 le_supv_timeout; |
|---|
| 480 | 628 | __u8 le_adv_data[HCI_MAX_AD_LENGTH]; |
|---|
| 481 | 629 | __u8 le_adv_data_len; |
|---|
| 630 | + __u8 le_tx_phy; |
|---|
| 631 | + __u8 le_rx_phy; |
|---|
| 482 | 632 | __s8 rssi; |
|---|
| 483 | 633 | __s8 tx_power; |
|---|
| 484 | 634 | __s8 max_tx_power; |
|---|
| 485 | 635 | unsigned long flags; |
|---|
| 636 | + |
|---|
| 637 | + enum conn_reasons conn_reason; |
|---|
| 486 | 638 | |
|---|
| 487 | 639 | __u32 clock; |
|---|
| 488 | 640 | __u16 clock_accuracy; |
|---|
| .. | .. |
|---|
| 517 | 669 | void (*connect_cfm_cb) (struct hci_conn *conn, u8 status); |
|---|
| 518 | 670 | void (*security_cfm_cb) (struct hci_conn *conn, u8 status); |
|---|
| 519 | 671 | void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason); |
|---|
| 672 | + |
|---|
| 673 | + ANDROID_KABI_RESERVE(1); |
|---|
| 674 | + ANDROID_KABI_RESERVE(2); |
|---|
| 675 | + ANDROID_KABI_RESERVE(3); |
|---|
| 676 | + ANDROID_KABI_RESERVE(4); |
|---|
| 520 | 677 | }; |
|---|
| 521 | 678 | |
|---|
| 522 | 679 | struct hci_chan { |
|---|
| .. | .. |
|---|
| 527 | 684 | unsigned int sent; |
|---|
| 528 | 685 | __u8 state; |
|---|
| 529 | 686 | bool amp; |
|---|
| 687 | + |
|---|
| 688 | + ANDROID_KABI_RESERVE(1); |
|---|
| 530 | 689 | }; |
|---|
| 531 | 690 | |
|---|
| 532 | 691 | struct hci_conn_params { |
|---|
| .. | .. |
|---|
| 552 | 711 | |
|---|
| 553 | 712 | struct hci_conn *conn; |
|---|
| 554 | 713 | bool explicit_connect; |
|---|
| 714 | + u32 current_flags; |
|---|
| 715 | + |
|---|
| 716 | + ANDROID_KABI_RESERVE(1); |
|---|
| 555 | 717 | }; |
|---|
| 556 | 718 | |
|---|
| 557 | 719 | extern struct list_head hci_dev_list; |
|---|
| .. | .. |
|---|
| 571 | 733 | do { \ |
|---|
| 572 | 734 | hci_dev_clear_flag(hdev, HCI_LE_SCAN); \ |
|---|
| 573 | 735 | hci_dev_clear_flag(hdev, HCI_LE_ADV); \ |
|---|
| 736 | + hci_dev_clear_flag(hdev, HCI_LL_RPA_RESOLUTION);\ |
|---|
| 574 | 737 | hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); \ |
|---|
| 575 | 738 | } while (0) |
|---|
| 576 | 739 | |
|---|
| .. | .. |
|---|
| 908 | 1071 | |
|---|
| 909 | 1072 | struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst, |
|---|
| 910 | 1073 | u8 dst_type, u8 sec_level, |
|---|
| 911 | | - u16 conn_timeout); |
|---|
| 1074 | + u16 conn_timeout, |
|---|
| 1075 | + enum conn_reasons conn_reason); |
|---|
| 912 | 1076 | struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, |
|---|
| 913 | 1077 | u8 dst_type, u8 sec_level, u16 conn_timeout, |
|---|
| 914 | 1078 | u8 role, bdaddr_t *direct_rpa); |
|---|
| 915 | 1079 | struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, |
|---|
| 916 | | - u8 sec_level, u8 auth_type); |
|---|
| 1080 | + u8 sec_level, u8 auth_type, |
|---|
| 1081 | + enum conn_reasons conn_reason); |
|---|
| 917 | 1082 | struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, |
|---|
| 918 | 1083 | __u16 setting); |
|---|
| 919 | 1084 | int hci_conn_check_link_mode(struct hci_conn *conn); |
|---|
| .. | .. |
|---|
| 1050 | 1215 | int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb); |
|---|
| 1051 | 1216 | __printf(2, 3) void hci_set_hw_info(struct hci_dev *hdev, const char *fmt, ...); |
|---|
| 1052 | 1217 | __printf(2, 3) void hci_set_fw_info(struct hci_dev *hdev, const char *fmt, ...); |
|---|
| 1218 | + |
|---|
| 1219 | +static inline void hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode) |
|---|
| 1220 | +{ |
|---|
| 1221 | +#if IS_ENABLED(CONFIG_BT_MSFTEXT) |
|---|
| 1222 | + hdev->msft_opcode = opcode; |
|---|
| 1223 | +#endif |
|---|
| 1224 | +} |
|---|
| 1225 | + |
|---|
| 1053 | 1226 | int hci_dev_open(__u16 dev); |
|---|
| 1054 | 1227 | int hci_dev_close(__u16 dev); |
|---|
| 1055 | 1228 | int hci_dev_do_close(struct hci_dev *hdev); |
|---|
| .. | .. |
|---|
| 1065 | 1238 | |
|---|
| 1066 | 1239 | struct bdaddr_list *hci_bdaddr_list_lookup(struct list_head *list, |
|---|
| 1067 | 1240 | bdaddr_t *bdaddr, u8 type); |
|---|
| 1241 | +struct bdaddr_list_with_irk *hci_bdaddr_list_lookup_with_irk( |
|---|
| 1242 | + struct list_head *list, bdaddr_t *bdaddr, |
|---|
| 1243 | + u8 type); |
|---|
| 1244 | +struct bdaddr_list_with_flags * |
|---|
| 1245 | +hci_bdaddr_list_lookup_with_flags(struct list_head *list, bdaddr_t *bdaddr, |
|---|
| 1246 | + u8 type); |
|---|
| 1068 | 1247 | int hci_bdaddr_list_add(struct list_head *list, bdaddr_t *bdaddr, u8 type); |
|---|
| 1248 | +int hci_bdaddr_list_add_with_irk(struct list_head *list, bdaddr_t *bdaddr, |
|---|
| 1249 | + u8 type, u8 *peer_irk, u8 *local_irk); |
|---|
| 1250 | +int hci_bdaddr_list_add_with_flags(struct list_head *list, bdaddr_t *bdaddr, |
|---|
| 1251 | + u8 type, u32 flags); |
|---|
| 1069 | 1252 | int hci_bdaddr_list_del(struct list_head *list, bdaddr_t *bdaddr, u8 type); |
|---|
| 1253 | +int hci_bdaddr_list_del_with_irk(struct list_head *list, bdaddr_t *bdaddr, |
|---|
| 1254 | + u8 type); |
|---|
| 1255 | +int hci_bdaddr_list_del_with_flags(struct list_head *list, bdaddr_t *bdaddr, |
|---|
| 1256 | + u8 type); |
|---|
| 1070 | 1257 | void hci_bdaddr_list_clear(struct list_head *list); |
|---|
| 1071 | 1258 | |
|---|
| 1072 | 1259 | struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, |
|---|
| .. | .. |
|---|
| 1102 | 1289 | struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, |
|---|
| 1103 | 1290 | u8 addr_type, u8 val[16], bdaddr_t *rpa); |
|---|
| 1104 | 1291 | void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type); |
|---|
| 1292 | +bool hci_is_blocked_key(struct hci_dev *hdev, u8 type, u8 val[16]); |
|---|
| 1293 | +void hci_blocked_keys_clear(struct hci_dev *hdev); |
|---|
| 1105 | 1294 | void hci_smp_irks_clear(struct hci_dev *hdev); |
|---|
| 1106 | 1295 | |
|---|
| 1107 | 1296 | bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
|---|
| .. | .. |
|---|
| 1124 | 1313 | u16 timeout, u16 duration); |
|---|
| 1125 | 1314 | int hci_remove_adv_instance(struct hci_dev *hdev, u8 instance); |
|---|
| 1126 | 1315 | void hci_adv_instances_set_rpa_expired(struct hci_dev *hdev, bool rpa_expired); |
|---|
| 1316 | + |
|---|
| 1317 | +void hci_adv_monitors_clear(struct hci_dev *hdev); |
|---|
| 1318 | +void hci_free_adv_monitor(struct adv_monitor *monitor); |
|---|
| 1319 | +int hci_add_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor); |
|---|
| 1320 | +int hci_remove_adv_monitor(struct hci_dev *hdev, u16 handle); |
|---|
| 1321 | +bool hci_is_adv_monitoring(struct hci_dev *hdev); |
|---|
| 1127 | 1322 | |
|---|
| 1128 | 1323 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
|---|
| 1129 | 1324 | |
|---|
| .. | .. |
|---|
| 1187 | 1382 | #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \ |
|---|
| 1188 | 1383 | ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED)) |
|---|
| 1189 | 1384 | |
|---|
| 1385 | +/* Use LL Privacy based address resolution if supported */ |
|---|
| 1386 | +#define use_ll_privacy(dev) ((dev)->le_features[0] & HCI_LE_LL_PRIVACY) |
|---|
| 1387 | + |
|---|
| 1190 | 1388 | /* Use ext scanning if set ext scan param and ext scan enable is supported */ |
|---|
| 1191 | 1389 | #define use_ext_scan(dev) (((dev)->commands[37] & 0x20) && \ |
|---|
| 1192 | 1390 | ((dev)->commands[37] & 0x40)) |
|---|
| .. | .. |
|---|
| 1236 | 1434 | __u8 encrypt); |
|---|
| 1237 | 1435 | void (*key_change_cfm) (struct hci_conn *conn, __u8 status); |
|---|
| 1238 | 1436 | void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); |
|---|
| 1437 | + |
|---|
| 1438 | + ANDROID_KABI_RESERVE(1); |
|---|
| 1239 | 1439 | }; |
|---|
| 1240 | 1440 | |
|---|
| 1241 | 1441 | static inline void hci_connect_cfm(struct hci_conn *conn, __u8 status) |
|---|
| .. | .. |
|---|
| 1464 | 1664 | struct sk_buff *hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
|---|
| 1465 | 1665 | const void *param, u32 timeout); |
|---|
| 1466 | 1666 | |
|---|
| 1667 | +u32 hci_conn_get_phy(struct hci_conn *conn); |
|---|
| 1668 | + |
|---|
| 1467 | 1669 | /* ----- HCI Sockets ----- */ |
|---|
| 1468 | 1670 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); |
|---|
| 1469 | 1671 | void hci_send_to_channel(unsigned short channel, struct sk_buff *skb, |
|---|
| .. | .. |
|---|
| 1479 | 1681 | #define HCI_MGMT_NO_HDEV BIT(1) |
|---|
| 1480 | 1682 | #define HCI_MGMT_UNTRUSTED BIT(2) |
|---|
| 1481 | 1683 | #define HCI_MGMT_UNCONFIGURED BIT(3) |
|---|
| 1684 | +#define HCI_MGMT_HDEV_OPTIONAL BIT(4) |
|---|
| 1482 | 1685 | |
|---|
| 1483 | 1686 | struct hci_mgmt_handler { |
|---|
| 1484 | 1687 | int (*func) (struct sock *sk, struct hci_dev *hdev, void *data, |
|---|
| .. | .. |
|---|
| 1493 | 1696 | size_t handler_count; |
|---|
| 1494 | 1697 | const struct hci_mgmt_handler *handlers; |
|---|
| 1495 | 1698 | void (*hdev_init) (struct sock *sk, struct hci_dev *hdev); |
|---|
| 1699 | + |
|---|
| 1700 | + ANDROID_KABI_RESERVE(1); |
|---|
| 1496 | 1701 | }; |
|---|
| 1497 | 1702 | |
|---|
| 1498 | 1703 | int hci_mgmt_chan_register(struct hci_mgmt_chan *c); |
|---|
| .. | .. |
|---|
| 1516 | 1721 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 |
|---|
| 1517 | 1722 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 |
|---|
| 1518 | 1723 | #define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ |
|---|
| 1724 | +#define DISCOV_LE_FAST_ADV_INT_MIN 100 /* msec */ |
|---|
| 1725 | +#define DISCOV_LE_FAST_ADV_INT_MAX 150 /* msec */ |
|---|
| 1519 | 1726 | |
|---|
| 1520 | 1727 | void mgmt_fill_version_info(void *ver); |
|---|
| 1521 | 1728 | int mgmt_new_settings(struct hci_dev *hdev); |
|---|
| .. | .. |
|---|
| 1570 | 1777 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
|---|
| 1571 | 1778 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); |
|---|
| 1572 | 1779 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
|---|
| 1780 | +void mgmt_suspending(struct hci_dev *hdev, u8 state); |
|---|
| 1781 | +void mgmt_resuming(struct hci_dev *hdev, u8 reason, bdaddr_t *bdaddr, |
|---|
| 1782 | + u8 addr_type); |
|---|
| 1573 | 1783 | bool mgmt_powering_down(struct hci_dev *hdev); |
|---|
| 1574 | 1784 | void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); |
|---|
| 1575 | 1785 | void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk, bool persistent); |
|---|