diff options
| author | David S. Miller <davem@davemloft.net> | 2015-03-14 14:29:45 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-03-14 14:29:45 -0400 |
| commit | 5f1764ddfeb038decfe2b2fda030d0bed43fa36a (patch) | |
| tree | a42d36330758ccce3becb22b96c8c748b89a837a /include | |
| parent | 2801be4a0ea4cd0965f9c12ff813a91892a8e157 (diff) | |
| parent | b6d595e3f74fe0dd9edc0d5bf30cd6e6fe29f023 (diff) | |
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says:
====================
Here's another set of Bluetooth & ieee802154 patches intended for 4.1:
- Added support for QCA ROME chipset family in the btusb driver
- at86rf230 driver fixes & cleanups
- ieee802154 cleanups
- Refactoring of Bluetooth mgmt API to allow new users
- New setting for static Bluetooth address exposed to user space
- Refactoring of hci_dev flags to remove limit of 32
- Remove unnecessary fast-connectable setting usage restrictions
- Fix behavior to be consistent when trying to pair already paired device
- Service discovery corner-case fixes
Please let me know if there are any issues pulling. Thanks.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/ieee802154.h | 2 | ||||
| -rw-r--r-- | include/net/bluetooth/bluetooth.h | 3 | ||||
| -rw-r--r-- | include/net/bluetooth/hci.h | 22 | ||||
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 59 | ||||
| -rw-r--r-- | include/net/bluetooth/mgmt.h | 2 |
5 files changed, 64 insertions, 24 deletions
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h index 40b0ab953937..8872ca103d06 100644 --- a/include/linux/ieee802154.h +++ b/include/linux/ieee802154.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #define IEEE802154_MTU 127 | 30 | #define IEEE802154_MTU 127 |
| 31 | #define IEEE802154_ACK_PSDU_LEN 5 | 31 | #define IEEE802154_ACK_PSDU_LEN 5 |
| 32 | #define IEEE802154_MIN_PSDU_LEN 9 | 32 | #define IEEE802154_MIN_PSDU_LEN 9 |
| 33 | #define IEEE802154_FCS_LEN 2 | ||
| 33 | 34 | ||
| 34 | #define IEEE802154_PAN_ID_BROADCAST 0xffff | 35 | #define IEEE802154_PAN_ID_BROADCAST 0xffff |
| 35 | #define IEEE802154_ADDR_SHORT_BROADCAST 0xffff | 36 | #define IEEE802154_ADDR_SHORT_BROADCAST 0xffff |
| @@ -39,6 +40,7 @@ | |||
| 39 | 40 | ||
| 40 | #define IEEE802154_LIFS_PERIOD 40 | 41 | #define IEEE802154_LIFS_PERIOD 40 |
| 41 | #define IEEE802154_SIFS_PERIOD 12 | 42 | #define IEEE802154_SIFS_PERIOD 12 |
| 43 | #define IEEE802154_MAX_SIFS_FRAME_SIZE 18 | ||
| 42 | 44 | ||
| 43 | #define IEEE802154_MAX_CHANNEL 26 | 45 | #define IEEE802154_MAX_CHANNEL 26 |
| 44 | #define IEEE802154_MAX_PAGE 31 | 46 | #define IEEE802154_MAX_PAGE 31 |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 6bb97df16d2d..e598ca096ec9 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -354,6 +354,9 @@ void l2cap_exit(void); | |||
| 354 | int sco_init(void); | 354 | int sco_init(void); |
| 355 | void sco_exit(void); | 355 | void sco_exit(void); |
| 356 | 356 | ||
| 357 | int mgmt_init(void); | ||
| 358 | void mgmt_exit(void); | ||
| 359 | |||
| 357 | void bt_sock_reclassify_lock(struct sock *sk, int proto); | 360 | void bt_sock_reclassify_lock(struct sock *sk, int proto); |
| 358 | 361 | ||
| 359 | #endif /* __BLUETOOTH_H */ | 362 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 8e54f825153c..d942fedbaedd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -179,15 +179,6 @@ enum { | |||
| 179 | HCI_RESET, | 179 | HCI_RESET, |
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | /* BR/EDR and/or LE controller flags: the flags defined here should represent | ||
| 183 | * states configured via debugfs for debugging and testing purposes only. | ||
| 184 | */ | ||
| 185 | enum { | ||
| 186 | HCI_DUT_MODE, | ||
| 187 | HCI_FORCE_BREDR_SMP, | ||
| 188 | HCI_FORCE_STATIC_ADDR, | ||
| 189 | }; | ||
| 190 | |||
| 191 | /* | 182 | /* |
| 192 | * BR/EDR and/or LE controller flags: the flags defined here should represent | 183 | * BR/EDR and/or LE controller flags: the flags defined here should represent |
| 193 | * states from the controller. | 184 | * states from the controller. |
| @@ -217,6 +208,7 @@ enum { | |||
| 217 | HCI_HS_ENABLED, | 208 | HCI_HS_ENABLED, |
| 218 | HCI_LE_ENABLED, | 209 | HCI_LE_ENABLED, |
| 219 | HCI_ADVERTISING, | 210 | HCI_ADVERTISING, |
| 211 | HCI_ADVERTISING_CONNECTABLE, | ||
| 220 | HCI_CONNECTABLE, | 212 | HCI_CONNECTABLE, |
| 221 | HCI_DISCOVERABLE, | 213 | HCI_DISCOVERABLE, |
| 222 | HCI_LIMITED_DISCOVERABLE, | 214 | HCI_LIMITED_DISCOVERABLE, |
| @@ -225,13 +217,13 @@ enum { | |||
| 225 | HCI_FAST_CONNECTABLE, | 217 | HCI_FAST_CONNECTABLE, |
| 226 | HCI_BREDR_ENABLED, | 218 | HCI_BREDR_ENABLED, |
| 227 | HCI_LE_SCAN_INTERRUPTED, | 219 | HCI_LE_SCAN_INTERRUPTED, |
| 228 | }; | ||
| 229 | 220 | ||
| 230 | /* A mask for the flags that are supposed to remain when a reset happens | 221 | HCI_DUT_MODE, |
| 231 | * or the HCI device is closed. | 222 | HCI_FORCE_BREDR_SMP, |
| 232 | */ | 223 | HCI_FORCE_STATIC_ADDR, |
| 233 | #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ | 224 | |
| 234 | BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV)) | 225 | __HCI_NUM_FLAGS, |
| 226 | }; | ||
| 235 | 227 | ||
| 236 | /* HCI timeouts */ | 228 | /* HCI timeouts */ |
| 237 | #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ | 229 | #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index acec9140c3f9..6afbf5b014a1 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -76,6 +76,7 @@ struct discovery_state { | |||
| 76 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; | 76 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; |
| 77 | u8 last_adv_data_len; | 77 | u8 last_adv_data_len; |
| 78 | bool report_invalid_rssi; | 78 | bool report_invalid_rssi; |
| 79 | bool result_filtering; | ||
| 79 | s8 rssi; | 80 | s8 rssi; |
| 80 | u16 uuid_count; | 81 | u16 uuid_count; |
| 81 | u8 (*uuids)[16]; | 82 | u8 (*uuids)[16]; |
| @@ -352,8 +353,7 @@ struct hci_dev { | |||
| 352 | 353 | ||
| 353 | struct rfkill *rfkill; | 354 | struct rfkill *rfkill; |
| 354 | 355 | ||
| 355 | unsigned long dbg_flags; | 356 | DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS); |
| 356 | unsigned long dev_flags; | ||
| 357 | 357 | ||
| 358 | struct delayed_work le_scan_disable; | 358 | struct delayed_work le_scan_disable; |
| 359 | struct delayed_work le_scan_restart; | 359 | struct delayed_work le_scan_restart; |
| @@ -501,6 +501,21 @@ extern struct list_head hci_cb_list; | |||
| 501 | extern rwlock_t hci_dev_list_lock; | 501 | extern rwlock_t hci_dev_list_lock; |
| 502 | extern struct mutex hci_cb_list_lock; | 502 | extern struct mutex hci_cb_list_lock; |
| 503 | 503 | ||
| 504 | #define hci_dev_set_flag(hdev, nr) set_bit((nr), (hdev)->dev_flags) | ||
| 505 | #define hci_dev_clear_flag(hdev, nr) clear_bit((nr), (hdev)->dev_flags) | ||
| 506 | #define hci_dev_change_flag(hdev, nr) change_bit((nr), (hdev)->dev_flags) | ||
| 507 | #define hci_dev_test_flag(hdev, nr) test_bit((nr), (hdev)->dev_flags) | ||
| 508 | #define hci_dev_test_and_set_flag(hdev, nr) test_and_set_bit((nr), (hdev)->dev_flags) | ||
| 509 | #define hci_dev_test_and_clear_flag(hdev, nr) test_and_clear_bit((nr), (hdev)->dev_flags) | ||
| 510 | #define hci_dev_test_and_change_flag(hdev, nr) test_and_change_bit((nr), (hdev)->dev_flags) | ||
| 511 | |||
| 512 | #define hci_dev_clear_volatile_flags(hdev) \ | ||
| 513 | do { \ | ||
| 514 | hci_dev_clear_flag(hdev, HCI_LE_SCAN); \ | ||
| 515 | hci_dev_clear_flag(hdev, HCI_LE_ADV); \ | ||
| 516 | hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); \ | ||
| 517 | } while (0) | ||
| 518 | |||
| 504 | /* ----- HCI interface to upper protocols ----- */ | 519 | /* ----- HCI interface to upper protocols ----- */ |
| 505 | int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); | 520 | int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); |
| 506 | int l2cap_disconn_ind(struct hci_conn *hcon); | 521 | int l2cap_disconn_ind(struct hci_conn *hcon); |
| @@ -525,6 +540,7 @@ static inline void discovery_init(struct hci_dev *hdev) | |||
| 525 | 540 | ||
| 526 | static inline void hci_discovery_filter_clear(struct hci_dev *hdev) | 541 | static inline void hci_discovery_filter_clear(struct hci_dev *hdev) |
| 527 | { | 542 | { |
| 543 | hdev->discovery.result_filtering = false; | ||
| 528 | hdev->discovery.report_invalid_rssi = true; | 544 | hdev->discovery.report_invalid_rssi = true; |
| 529 | hdev->discovery.rssi = HCI_RSSI_INVALID; | 545 | hdev->discovery.rssi = HCI_RSSI_INVALID; |
| 530 | hdev->discovery.uuid_count = 0; | 546 | hdev->discovery.uuid_count = 0; |
| @@ -596,14 +612,14 @@ enum { | |||
| 596 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | 612 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) |
| 597 | { | 613 | { |
| 598 | struct hci_dev *hdev = conn->hdev; | 614 | struct hci_dev *hdev = conn->hdev; |
| 599 | return test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && | 615 | return hci_dev_test_flag(hdev, HCI_SSP_ENABLED) && |
| 600 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); | 616 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); |
| 601 | } | 617 | } |
| 602 | 618 | ||
| 603 | static inline bool hci_conn_sc_enabled(struct hci_conn *conn) | 619 | static inline bool hci_conn_sc_enabled(struct hci_conn *conn) |
| 604 | { | 620 | { |
| 605 | struct hci_dev *hdev = conn->hdev; | 621 | struct hci_dev *hdev = conn->hdev; |
| 606 | return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && | 622 | return hci_dev_test_flag(hdev, HCI_SC_ENABLED) && |
| 607 | test_bit(HCI_CONN_SC_ENABLED, &conn->flags); | 623 | test_bit(HCI_CONN_SC_ENABLED, &conn->flags); |
| 608 | } | 624 | } |
| 609 | 625 | ||
| @@ -965,6 +981,8 @@ struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, | |||
| 965 | void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type); | 981 | void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type); |
| 966 | void hci_smp_irks_clear(struct hci_dev *hdev); | 982 | void hci_smp_irks_clear(struct hci_dev *hdev); |
| 967 | 983 | ||
| 984 | bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
| 985 | |||
| 968 | void hci_remote_oob_data_clear(struct hci_dev *hdev); | 986 | void hci_remote_oob_data_clear(struct hci_dev *hdev); |
| 969 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, | 987 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, |
| 970 | bdaddr_t *bdaddr, u8 bdaddr_type); | 988 | bdaddr_t *bdaddr, u8 bdaddr_type); |
| @@ -1021,10 +1039,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
| 1021 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) | 1039 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) |
| 1022 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) | 1040 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) |
| 1023 | 1041 | ||
| 1024 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ | 1042 | #define hdev_is_powered(dev) (test_bit(HCI_UP, &(dev)->flags) && \ |
| 1025 | !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | 1043 | !hci_dev_test_flag(dev, HCI_AUTO_OFF)) |
| 1026 | #define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \ | 1044 | #define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \ |
| 1027 | test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) | 1045 | hci_dev_test_flag(dev, HCI_SC_ENABLED)) |
| 1028 | 1046 | ||
| 1029 | /* ----- HCI protocols ----- */ | 1047 | /* ----- HCI protocols ----- */ |
| 1030 | #define HCI_PROTO_DEFER 0x01 | 1048 | #define HCI_PROTO_DEFER 0x01 |
| @@ -1271,6 +1289,27 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); | |||
| 1271 | 1289 | ||
| 1272 | void hci_sock_dev_event(struct hci_dev *hdev, int event); | 1290 | void hci_sock_dev_event(struct hci_dev *hdev, int event); |
| 1273 | 1291 | ||
| 1292 | #define HCI_MGMT_VAR_LEN (1 << 0) | ||
| 1293 | #define HCI_MGMT_NO_HDEV (1 << 1) | ||
| 1294 | #define HCI_MGMT_UNCONFIGURED (1 << 2) | ||
| 1295 | |||
| 1296 | struct hci_mgmt_handler { | ||
| 1297 | int (*func) (struct sock *sk, struct hci_dev *hdev, void *data, | ||
| 1298 | u16 data_len); | ||
| 1299 | size_t data_len; | ||
| 1300 | unsigned long flags; | ||
| 1301 | }; | ||
| 1302 | |||
| 1303 | struct hci_mgmt_chan { | ||
| 1304 | struct list_head list; | ||
| 1305 | unsigned short channel; | ||
| 1306 | size_t handler_count; | ||
| 1307 | const struct hci_mgmt_handler *handlers; | ||
| 1308 | }; | ||
| 1309 | |||
| 1310 | int hci_mgmt_chan_register(struct hci_mgmt_chan *c); | ||
| 1311 | void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c); | ||
| 1312 | |||
| 1274 | /* Management interface */ | 1313 | /* Management interface */ |
| 1275 | #define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR)) | 1314 | #define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR)) |
| 1276 | #define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \ | 1315 | #define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \ |
| @@ -1290,7 +1329,9 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); | |||
| 1290 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 | 1329 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 |
| 1291 | #define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ | 1330 | #define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ |
| 1292 | 1331 | ||
| 1293 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 1332 | int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk, |
| 1333 | struct msghdr *msg, size_t msglen); | ||
| 1334 | |||
| 1294 | int mgmt_new_settings(struct hci_dev *hdev); | 1335 | int mgmt_new_settings(struct hci_dev *hdev); |
| 1295 | void mgmt_index_added(struct hci_dev *hdev); | 1336 | void mgmt_index_added(struct hci_dev *hdev); |
| 1296 | void mgmt_index_removed(struct hci_dev *hdev); | 1337 | void mgmt_index_removed(struct hci_dev *hdev); |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index fe8eef00e9ca..5bf6af9cee78 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #define MGMT_STATUS_CANCELLED 0x10 | 43 | #define MGMT_STATUS_CANCELLED 0x10 |
| 44 | #define MGMT_STATUS_INVALID_INDEX 0x11 | 44 | #define MGMT_STATUS_INVALID_INDEX 0x11 |
| 45 | #define MGMT_STATUS_RFKILLED 0x12 | 45 | #define MGMT_STATUS_RFKILLED 0x12 |
| 46 | #define MGMT_STATUS_ALREADY_PAIRED 0x13 | ||
| 46 | 47 | ||
| 47 | struct mgmt_hdr { | 48 | struct mgmt_hdr { |
| 48 | __le16 opcode; | 49 | __le16 opcode; |
| @@ -98,6 +99,7 @@ struct mgmt_rp_read_index_list { | |||
| 98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 | 99 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 |
| 99 | #define MGMT_SETTING_PRIVACY 0x00002000 | 100 | #define MGMT_SETTING_PRIVACY 0x00002000 |
| 100 | #define MGMT_SETTING_CONFIGURATION 0x00004000 | 101 | #define MGMT_SETTING_CONFIGURATION 0x00004000 |
| 102 | #define MGMT_SETTING_STATIC_ADDRESS 0x00008000 | ||
| 101 | 103 | ||
| 102 | #define MGMT_OP_READ_INFO 0x0004 | 104 | #define MGMT_OP_READ_INFO 0x0004 |
| 103 | #define MGMT_READ_INFO_SIZE 0 | 105 | #define MGMT_READ_INFO_SIZE 0 |
