diff options
author | John W. Linville <linville@tuxdriver.com> | 2014-07-11 15:52:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-07-11 15:52:57 -0400 |
commit | 95d01a669bd35d0e8eb28dd8a946876c00a9a61a (patch) | |
tree | e8169b32120729111321efc53cb4315d9c0e21e7 /include/net | |
parent | 5e6438db34d522ee1c78b5d4c1c35a4a3bbd5054 (diff) | |
parent | ca424b2022410b6c2cd0bc0f9a0438ed0b75f95f (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 18 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 135 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 134 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 36 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 99 |
5 files changed, 353 insertions, 69 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 904777c1cd24..373000de610d 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -260,15 +260,15 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); | |||
260 | 260 | ||
261 | /* Skb helpers */ | 261 | /* Skb helpers */ |
262 | struct l2cap_ctrl { | 262 | struct l2cap_ctrl { |
263 | unsigned int sframe:1, | 263 | __u8 sframe:1, |
264 | poll:1, | 264 | poll:1, |
265 | final:1, | 265 | final:1, |
266 | fcs:1, | 266 | fcs:1, |
267 | sar:2, | 267 | sar:2, |
268 | super:2; | 268 | super:2; |
269 | __u16 reqseq; | 269 | __u16 reqseq; |
270 | __u16 txseq; | 270 | __u16 txseq; |
271 | __u8 retries; | 271 | __u8 retries; |
272 | }; | 272 | }; |
273 | 273 | ||
274 | struct hci_dev; | 274 | struct hci_dev; |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 16587dcd6a91..a01236e2df13 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -81,10 +81,54 @@ | |||
81 | 81 | ||
82 | /* HCI device quirks */ | 82 | /* HCI device quirks */ |
83 | enum { | 83 | enum { |
84 | /* When this quirk is set, the HCI Reset command is send when | ||
85 | * closing the transport instead of when opening it. | ||
86 | * | ||
87 | * This quirk must be set before hci_register_dev is called. | ||
88 | */ | ||
84 | HCI_QUIRK_RESET_ON_CLOSE, | 89 | HCI_QUIRK_RESET_ON_CLOSE, |
90 | |||
91 | /* When this quirk is set, the device is turned into a raw-only | ||
92 | * device and it will stay in unconfigured state. | ||
93 | * | ||
94 | * This quirk must be set before hci_register_dev is called. | ||
95 | */ | ||
85 | HCI_QUIRK_RAW_DEVICE, | 96 | HCI_QUIRK_RAW_DEVICE, |
97 | |||
98 | /* When this quirk is set, the buffer sizes reported by | ||
99 | * HCI Read Buffer Size command are corrected if invalid. | ||
100 | * | ||
101 | * This quirk must be set before hci_register_dev is called. | ||
102 | */ | ||
86 | HCI_QUIRK_FIXUP_BUFFER_SIZE, | 103 | HCI_QUIRK_FIXUP_BUFFER_SIZE, |
104 | |||
105 | /* When this quirk is set, then no stored link key handling | ||
106 | * is performed. This is mainly due to the fact that the | ||
107 | * HCI Delete Stored Link Key command is advertised, but | ||
108 | * not supported. | ||
109 | * | ||
110 | * This quirk must be set before hci_register_dev is called. | ||
111 | */ | ||
87 | HCI_QUIRK_BROKEN_STORED_LINK_KEY, | 112 | HCI_QUIRK_BROKEN_STORED_LINK_KEY, |
113 | |||
114 | /* When this quirk is set, an external configuration step | ||
115 | * is required and will be indicated with the controller | ||
116 | * configuation. | ||
117 | * | ||
118 | * This quirk can be set before hci_register_dev is called or | ||
119 | * during the hdev->setup vendor callback. | ||
120 | */ | ||
121 | HCI_QUIRK_EXTERNAL_CONFIG, | ||
122 | |||
123 | /* When this quirk is set, the public Bluetooth address | ||
124 | * initially reported by HCI Read BD Address command | ||
125 | * is considered invalid. Controller configuration is | ||
126 | * required before this device can be used. | ||
127 | * | ||
128 | * This quirk can be set before hci_register_dev is called or | ||
129 | * during the hdev->setup vendor callback. | ||
130 | */ | ||
131 | HCI_QUIRK_INVALID_BDADDR, | ||
88 | }; | 132 | }; |
89 | 133 | ||
90 | /* HCI device flags */ | 134 | /* HCI device flags */ |
@@ -104,24 +148,34 @@ enum { | |||
104 | HCI_RESET, | 148 | HCI_RESET, |
105 | }; | 149 | }; |
106 | 150 | ||
151 | /* BR/EDR and/or LE controller flags: the flags defined here should represent | ||
152 | * states configured via debugfs for debugging and testing purposes only. | ||
153 | */ | ||
154 | enum { | ||
155 | HCI_DUT_MODE, | ||
156 | HCI_FORCE_SC, | ||
157 | HCI_FORCE_STATIC_ADDR, | ||
158 | }; | ||
159 | |||
107 | /* | 160 | /* |
108 | * BR/EDR and/or LE controller flags: the flags defined here should represent | 161 | * BR/EDR and/or LE controller flags: the flags defined here should represent |
109 | * states from the controller. | 162 | * states from the controller. |
110 | */ | 163 | */ |
111 | enum { | 164 | enum { |
112 | HCI_SETUP, | 165 | HCI_SETUP, |
166 | HCI_CONFIG, | ||
113 | HCI_AUTO_OFF, | 167 | HCI_AUTO_OFF, |
114 | HCI_RFKILLED, | 168 | HCI_RFKILLED, |
115 | HCI_MGMT, | 169 | HCI_MGMT, |
116 | HCI_PAIRABLE, | 170 | HCI_PAIRABLE, |
117 | HCI_SERVICE_CACHE, | 171 | HCI_SERVICE_CACHE, |
118 | HCI_DEBUG_KEYS, | 172 | HCI_KEEP_DEBUG_KEYS, |
119 | HCI_DUT_MODE, | 173 | HCI_USE_DEBUG_KEYS, |
120 | HCI_FORCE_SC, | ||
121 | HCI_FORCE_STATIC_ADDR, | ||
122 | HCI_UNREGISTER, | 174 | HCI_UNREGISTER, |
175 | HCI_UNCONFIGURED, | ||
123 | HCI_USER_CHANNEL, | 176 | HCI_USER_CHANNEL, |
124 | 177 | HCI_EXT_CONFIGURED, | |
178 | HCI_LE_ADV, | ||
125 | HCI_LE_SCAN, | 179 | HCI_LE_SCAN, |
126 | HCI_SSP_ENABLED, | 180 | HCI_SSP_ENABLED, |
127 | HCI_SC_ENABLED, | 181 | HCI_SC_ENABLED, |
@@ -139,7 +193,6 @@ enum { | |||
139 | HCI_PERIODIC_INQ, | 193 | HCI_PERIODIC_INQ, |
140 | HCI_FAST_CONNECTABLE, | 194 | HCI_FAST_CONNECTABLE, |
141 | HCI_BREDR_ENABLED, | 195 | HCI_BREDR_ENABLED, |
142 | HCI_6LOWPAN_ENABLED, | ||
143 | HCI_LE_SCAN_INTERRUPTED, | 196 | HCI_LE_SCAN_INTERRUPTED, |
144 | }; | 197 | }; |
145 | 198 | ||
@@ -147,7 +200,7 @@ enum { | |||
147 | * or the HCI device is closed. | 200 | * or the HCI device is closed. |
148 | */ | 201 | */ |
149 | #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ | 202 | #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ |
150 | BIT(HCI_FAST_CONNECTABLE)) | 203 | BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV)) |
151 | 204 | ||
152 | /* HCI ioctl defines */ | 205 | /* HCI ioctl defines */ |
153 | #define HCIDEVUP _IOW('H', 201, int) | 206 | #define HCIDEVUP _IOW('H', 201, int) |
@@ -185,6 +238,7 @@ enum { | |||
185 | #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ | 238 | #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ |
186 | #define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ | 239 | #define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ |
187 | #define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ | 240 | #define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ |
241 | #define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ | ||
188 | 242 | ||
189 | /* HCI data types */ | 243 | /* HCI data types */ |
190 | #define HCI_COMMAND_PKT 0x01 | 244 | #define HCI_COMMAND_PKT 0x01 |
@@ -301,6 +355,10 @@ enum { | |||
301 | #define LMP_HOST_LE_BREDR 0x04 | 355 | #define LMP_HOST_LE_BREDR 0x04 |
302 | #define LMP_HOST_SC 0x08 | 356 | #define LMP_HOST_SC 0x08 |
303 | 357 | ||
358 | /* LE features */ | ||
359 | #define HCI_LE_CONN_PARAM_REQ_PROC 0x02 | ||
360 | #define HCI_LE_PING 0x10 | ||
361 | |||
304 | /* Connection modes */ | 362 | /* Connection modes */ |
305 | #define HCI_CM_ACTIVE 0x0000 | 363 | #define HCI_CM_ACTIVE 0x0000 |
306 | #define HCI_CM_HOLD 0x0001 | 364 | #define HCI_CM_HOLD 0x0001 |
@@ -347,17 +405,9 @@ enum { | |||
347 | #define HCI_LK_CHANGED_COMBINATION 0x06 | 405 | #define HCI_LK_CHANGED_COMBINATION 0x06 |
348 | #define HCI_LK_UNAUTH_COMBINATION_P256 0x07 | 406 | #define HCI_LK_UNAUTH_COMBINATION_P256 0x07 |
349 | #define HCI_LK_AUTH_COMBINATION_P256 0x08 | 407 | #define HCI_LK_AUTH_COMBINATION_P256 0x08 |
350 | /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ | ||
351 | #define HCI_SMP_STK 0x80 | ||
352 | #define HCI_SMP_STK_SLAVE 0x81 | ||
353 | #define HCI_SMP_LTK 0x82 | ||
354 | #define HCI_SMP_LTK_SLAVE 0x83 | ||
355 | |||
356 | /* Long Term Key types */ | ||
357 | #define HCI_LTK_UNAUTH 0x00 | ||
358 | #define HCI_LTK_AUTH 0x01 | ||
359 | 408 | ||
360 | /* ---- HCI Error Codes ---- */ | 409 | /* ---- HCI Error Codes ---- */ |
410 | #define HCI_ERROR_UNKNOWN_CONN_ID 0x02 | ||
361 | #define HCI_ERROR_AUTH_FAILURE 0x05 | 411 | #define HCI_ERROR_AUTH_FAILURE 0x05 |
362 | #define HCI_ERROR_MEMORY_EXCEEDED 0x07 | 412 | #define HCI_ERROR_MEMORY_EXCEEDED 0x07 |
363 | #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 | 413 | #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 |
@@ -367,6 +417,7 @@ enum { | |||
367 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 | 417 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 |
368 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 | 418 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 |
369 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 | 419 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 |
420 | #define HCI_ERROR_INVALID_LL_PARAMS 0x1E | ||
370 | #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c | 421 | #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c |
371 | 422 | ||
372 | /* Flow control modes */ | 423 | /* Flow control modes */ |
@@ -536,6 +587,11 @@ struct hci_cp_read_remote_version { | |||
536 | __le16 handle; | 587 | __le16 handle; |
537 | } __packed; | 588 | } __packed; |
538 | 589 | ||
590 | #define HCI_OP_READ_CLOCK_OFFSET 0x041f | ||
591 | struct hci_cp_read_clock_offset { | ||
592 | __le16 handle; | ||
593 | } __packed; | ||
594 | |||
539 | #define HCI_OP_SETUP_SYNC_CONN 0x0428 | 595 | #define HCI_OP_SETUP_SYNC_CONN 0x0428 |
540 | struct hci_cp_setup_sync_conn { | 596 | struct hci_cp_setup_sync_conn { |
541 | __le16 handle; | 597 | __le16 handle; |
@@ -1085,6 +1141,18 @@ struct hci_rp_read_rssi { | |||
1085 | __s8 rssi; | 1141 | __s8 rssi; |
1086 | } __packed; | 1142 | } __packed; |
1087 | 1143 | ||
1144 | #define HCI_OP_READ_CLOCK 0x1407 | ||
1145 | struct hci_cp_read_clock { | ||
1146 | __le16 handle; | ||
1147 | __u8 which; | ||
1148 | } __packed; | ||
1149 | struct hci_rp_read_clock { | ||
1150 | __u8 status; | ||
1151 | __le16 handle; | ||
1152 | __le32 clock; | ||
1153 | __le16 accuracy; | ||
1154 | } __packed; | ||
1155 | |||
1088 | #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 | 1156 | #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 |
1089 | struct hci_rp_read_local_amp_info { | 1157 | struct hci_rp_read_local_amp_info { |
1090 | __u8 status; | 1158 | __u8 status; |
@@ -1291,6 +1359,23 @@ struct hci_rp_le_read_supported_states { | |||
1291 | __u8 le_states[8]; | 1359 | __u8 le_states[8]; |
1292 | } __packed; | 1360 | } __packed; |
1293 | 1361 | ||
1362 | #define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020 | ||
1363 | struct hci_cp_le_conn_param_req_reply { | ||
1364 | __le16 handle; | ||
1365 | __le16 interval_min; | ||
1366 | __le16 interval_max; | ||
1367 | __le16 latency; | ||
1368 | __le16 timeout; | ||
1369 | __le16 min_ce_len; | ||
1370 | __le16 max_ce_len; | ||
1371 | } __packed; | ||
1372 | |||
1373 | #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021 | ||
1374 | struct hci_cp_le_conn_param_req_neg_reply { | ||
1375 | __le16 handle; | ||
1376 | __u8 reason; | ||
1377 | } __packed; | ||
1378 | |||
1294 | /* ---- HCI Events ---- */ | 1379 | /* ---- HCI Events ---- */ |
1295 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 1380 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
1296 | 1381 | ||
@@ -1670,6 +1755,15 @@ struct hci_ev_le_conn_complete { | |||
1670 | __u8 clk_accurancy; | 1755 | __u8 clk_accurancy; |
1671 | } __packed; | 1756 | } __packed; |
1672 | 1757 | ||
1758 | #define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03 | ||
1759 | struct hci_ev_le_conn_update_complete { | ||
1760 | __u8 status; | ||
1761 | __le16 handle; | ||
1762 | __le16 interval; | ||
1763 | __le16 latency; | ||
1764 | __le16 supervision_timeout; | ||
1765 | } __packed; | ||
1766 | |||
1673 | #define HCI_EV_LE_LTK_REQ 0x05 | 1767 | #define HCI_EV_LE_LTK_REQ 0x05 |
1674 | struct hci_ev_le_ltk_req { | 1768 | struct hci_ev_le_ltk_req { |
1675 | __le16 handle; | 1769 | __le16 handle; |
@@ -1677,6 +1771,15 @@ struct hci_ev_le_ltk_req { | |||
1677 | __le16 ediv; | 1771 | __le16 ediv; |
1678 | } __packed; | 1772 | } __packed; |
1679 | 1773 | ||
1774 | #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06 | ||
1775 | struct hci_ev_le_remote_conn_param_req { | ||
1776 | __le16 handle; | ||
1777 | __le16 interval_min; | ||
1778 | __le16 interval_max; | ||
1779 | __le16 latency; | ||
1780 | __le16 timeout; | ||
1781 | } __packed; | ||
1782 | |||
1680 | /* Advertising report event types */ | 1783 | /* Advertising report event types */ |
1681 | #define LE_ADV_IND 0x00 | 1784 | #define LE_ADV_IND 0x00 |
1682 | #define LE_ADV_DIRECT_IND 0x01 | 1785 | #define LE_ADV_DIRECT_IND 0x01 |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b386bf17e6c2..e69c2b08c0c6 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -71,6 +71,7 @@ struct discovery_state { | |||
71 | bdaddr_t last_adv_addr; | 71 | bdaddr_t last_adv_addr; |
72 | u8 last_adv_addr_type; | 72 | u8 last_adv_addr_type; |
73 | s8 last_adv_rssi; | 73 | s8 last_adv_rssi; |
74 | u32 last_adv_flags; | ||
74 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; | 75 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; |
75 | u8 last_adv_data_len; | 76 | u8 last_adv_data_len; |
76 | }; | 77 | }; |
@@ -170,6 +171,8 @@ struct hci_dev { | |||
170 | __u8 bus; | 171 | __u8 bus; |
171 | __u8 dev_type; | 172 | __u8 dev_type; |
172 | bdaddr_t bdaddr; | 173 | bdaddr_t bdaddr; |
174 | bdaddr_t setup_addr; | ||
175 | bdaddr_t public_addr; | ||
173 | bdaddr_t random_addr; | 176 | bdaddr_t random_addr; |
174 | bdaddr_t static_addr; | 177 | bdaddr_t static_addr; |
175 | __u8 adv_addr_type; | 178 | __u8 adv_addr_type; |
@@ -203,10 +206,13 @@ struct hci_dev { | |||
203 | __u16 le_scan_window; | 206 | __u16 le_scan_window; |
204 | __u16 le_conn_min_interval; | 207 | __u16 le_conn_min_interval; |
205 | __u16 le_conn_max_interval; | 208 | __u16 le_conn_max_interval; |
209 | __u16 le_conn_latency; | ||
210 | __u16 le_supv_timeout; | ||
206 | __u16 discov_interleaved_timeout; | 211 | __u16 discov_interleaved_timeout; |
207 | __u16 conn_info_min_age; | 212 | __u16 conn_info_min_age; |
208 | __u16 conn_info_max_age; | 213 | __u16 conn_info_max_age; |
209 | __u8 ssp_debug_mode; | 214 | __u8 ssp_debug_mode; |
215 | __u32 clock; | ||
210 | 216 | ||
211 | __u16 devid_source; | 217 | __u16 devid_source; |
212 | __u16 devid_vendor; | 218 | __u16 devid_vendor; |
@@ -273,7 +279,7 @@ struct hci_dev { | |||
273 | 279 | ||
274 | struct delayed_work service_cache; | 280 | struct delayed_work service_cache; |
275 | 281 | ||
276 | struct timer_list cmd_timer; | 282 | struct delayed_work cmd_timer; |
277 | 283 | ||
278 | struct work_struct rx_work; | 284 | struct work_struct rx_work; |
279 | struct work_struct cmd_work; | 285 | struct work_struct cmd_work; |
@@ -299,6 +305,7 @@ struct hci_dev { | |||
299 | 305 | ||
300 | struct list_head mgmt_pending; | 306 | struct list_head mgmt_pending; |
301 | struct list_head blacklist; | 307 | struct list_head blacklist; |
308 | struct list_head whitelist; | ||
302 | struct list_head uuids; | 309 | struct list_head uuids; |
303 | struct list_head link_keys; | 310 | struct list_head link_keys; |
304 | struct list_head long_term_keys; | 311 | struct list_head long_term_keys; |
@@ -307,6 +314,7 @@ struct hci_dev { | |||
307 | struct list_head le_white_list; | 314 | struct list_head le_white_list; |
308 | struct list_head le_conn_params; | 315 | struct list_head le_conn_params; |
309 | struct list_head pend_le_conns; | 316 | struct list_head pend_le_conns; |
317 | struct list_head pend_le_reports; | ||
310 | 318 | ||
311 | struct hci_dev_stats stat; | 319 | struct hci_dev_stats stat; |
312 | 320 | ||
@@ -318,6 +326,7 @@ struct hci_dev { | |||
318 | 326 | ||
319 | struct rfkill *rfkill; | 327 | struct rfkill *rfkill; |
320 | 328 | ||
329 | unsigned long dbg_flags; | ||
321 | unsigned long dev_flags; | 330 | unsigned long dev_flags; |
322 | 331 | ||
323 | struct delayed_work le_scan_disable; | 332 | struct delayed_work le_scan_disable; |
@@ -339,6 +348,7 @@ struct hci_dev { | |||
339 | int (*setup)(struct hci_dev *hdev); | 348 | int (*setup)(struct hci_dev *hdev); |
340 | int (*send)(struct hci_dev *hdev, struct sk_buff *skb); | 349 | int (*send)(struct hci_dev *hdev, struct sk_buff *skb); |
341 | void (*notify)(struct hci_dev *hdev, unsigned int evt); | 350 | void (*notify)(struct hci_dev *hdev, unsigned int evt); |
351 | int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr); | ||
342 | }; | 352 | }; |
343 | 353 | ||
344 | #define HCI_PHY_HANDLE(handle) (handle & 0xff) | 354 | #define HCI_PHY_HANDLE(handle) (handle & 0xff) |
@@ -366,7 +376,6 @@ struct hci_conn { | |||
366 | __u8 features[HCI_MAX_PAGES][8]; | 376 | __u8 features[HCI_MAX_PAGES][8]; |
367 | __u16 pkt_type; | 377 | __u16 pkt_type; |
368 | __u16 link_policy; | 378 | __u16 link_policy; |
369 | __u32 link_mode; | ||
370 | __u8 key_type; | 379 | __u8 key_type; |
371 | __u8 auth_type; | 380 | __u8 auth_type; |
372 | __u8 sec_level; | 381 | __u8 sec_level; |
@@ -377,20 +386,26 @@ struct hci_conn { | |||
377 | __u32 passkey_notify; | 386 | __u32 passkey_notify; |
378 | __u8 passkey_entered; | 387 | __u8 passkey_entered; |
379 | __u16 disc_timeout; | 388 | __u16 disc_timeout; |
389 | __u16 conn_timeout; | ||
380 | __u16 setting; | 390 | __u16 setting; |
381 | __u16 le_conn_min_interval; | 391 | __u16 le_conn_min_interval; |
382 | __u16 le_conn_max_interval; | 392 | __u16 le_conn_max_interval; |
393 | __u16 le_conn_interval; | ||
394 | __u16 le_conn_latency; | ||
395 | __u16 le_supv_timeout; | ||
383 | __s8 rssi; | 396 | __s8 rssi; |
384 | __s8 tx_power; | 397 | __s8 tx_power; |
385 | __s8 max_tx_power; | 398 | __s8 max_tx_power; |
386 | unsigned long flags; | 399 | unsigned long flags; |
387 | 400 | ||
401 | __u32 clock; | ||
402 | __u16 clock_accuracy; | ||
403 | |||
388 | unsigned long conn_info_timestamp; | 404 | unsigned long conn_info_timestamp; |
389 | 405 | ||
390 | __u8 remote_cap; | 406 | __u8 remote_cap; |
391 | __u8 remote_auth; | 407 | __u8 remote_auth; |
392 | __u8 remote_id; | 408 | __u8 remote_id; |
393 | bool flush_key; | ||
394 | 409 | ||
395 | unsigned int sent; | 410 | unsigned int sent; |
396 | 411 | ||
@@ -407,7 +422,6 @@ struct hci_conn { | |||
407 | struct hci_dev *hdev; | 422 | struct hci_dev *hdev; |
408 | void *l2cap_data; | 423 | void *l2cap_data; |
409 | void *sco_data; | 424 | void *sco_data; |
410 | void *smp_conn; | ||
411 | struct amp_mgr *amp_mgr; | 425 | struct amp_mgr *amp_mgr; |
412 | 426 | ||
413 | struct hci_conn *link; | 427 | struct hci_conn *link; |
@@ -428,15 +442,19 @@ struct hci_chan { | |||
428 | 442 | ||
429 | struct hci_conn_params { | 443 | struct hci_conn_params { |
430 | struct list_head list; | 444 | struct list_head list; |
445 | struct list_head action; | ||
431 | 446 | ||
432 | bdaddr_t addr; | 447 | bdaddr_t addr; |
433 | u8 addr_type; | 448 | u8 addr_type; |
434 | 449 | ||
435 | u16 conn_min_interval; | 450 | u16 conn_min_interval; |
436 | u16 conn_max_interval; | 451 | u16 conn_max_interval; |
452 | u16 conn_latency; | ||
453 | u16 supervision_timeout; | ||
437 | 454 | ||
438 | enum { | 455 | enum { |
439 | HCI_AUTO_CONN_DISABLED, | 456 | HCI_AUTO_CONN_DISABLED, |
457 | HCI_AUTO_CONN_REPORT, | ||
440 | HCI_AUTO_CONN_ALWAYS, | 458 | HCI_AUTO_CONN_ALWAYS, |
441 | HCI_AUTO_CONN_LINK_LOSS, | 459 | HCI_AUTO_CONN_LINK_LOSS, |
442 | } auto_connect; | 460 | } auto_connect; |
@@ -501,8 +519,8 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, | |||
501 | int state); | 519 | int state); |
502 | void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, | 520 | void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, |
503 | struct inquiry_entry *ie); | 521 | struct inquiry_entry *ie); |
504 | bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | 522 | u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, |
505 | bool name_known, bool *ssp); | 523 | bool name_known); |
506 | void hci_inquiry_cache_flush(struct hci_dev *hdev); | 524 | void hci_inquiry_cache_flush(struct hci_dev *hdev); |
507 | 525 | ||
508 | /* ----- HCI Connections ----- */ | 526 | /* ----- HCI Connections ----- */ |
@@ -520,7 +538,13 @@ enum { | |||
520 | HCI_CONN_AES_CCM, | 538 | HCI_CONN_AES_CCM, |
521 | HCI_CONN_POWER_SAVE, | 539 | HCI_CONN_POWER_SAVE, |
522 | HCI_CONN_REMOTE_OOB, | 540 | HCI_CONN_REMOTE_OOB, |
523 | HCI_CONN_6LOWPAN, | 541 | HCI_CONN_FLUSH_KEY, |
542 | HCI_CONN_MASTER, | ||
543 | HCI_CONN_ENCRYPT, | ||
544 | HCI_CONN_AUTH, | ||
545 | HCI_CONN_SECURE, | ||
546 | HCI_CONN_FIPS, | ||
547 | HCI_CONN_STK_ENCRYPT, | ||
524 | }; | 548 | }; |
525 | 549 | ||
526 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | 550 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) |
@@ -681,7 +705,8 @@ void hci_chan_list_flush(struct hci_conn *conn); | |||
681 | struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); | 705 | struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); |
682 | 706 | ||
683 | struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | 707 | struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, |
684 | u8 dst_type, u8 sec_level, u8 auth_type); | 708 | u8 dst_type, u8 sec_level, u16 conn_timeout, |
709 | bool master); | ||
685 | struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, | 710 | struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, |
686 | u8 sec_level, u8 auth_type); | 711 | u8 sec_level, u8 auth_type); |
687 | struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, | 712 | struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, |
@@ -825,30 +850,25 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg); | |||
825 | int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); | 850 | int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); |
826 | int hci_inquiry(void __user *arg); | 851 | int hci_inquiry(void __user *arg); |
827 | 852 | ||
828 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, | 853 | struct bdaddr_list *hci_bdaddr_list_lookup(struct list_head *list, |
829 | bdaddr_t *bdaddr, u8 type); | 854 | bdaddr_t *bdaddr, u8 type); |
830 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | 855 | int hci_bdaddr_list_add(struct list_head *list, bdaddr_t *bdaddr, u8 type); |
831 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | 856 | int hci_bdaddr_list_del(struct list_head *list, bdaddr_t *bdaddr, u8 type); |
832 | 857 | void hci_bdaddr_list_clear(struct list_head *list); | |
833 | struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev, | ||
834 | bdaddr_t *bdaddr, u8 type); | ||
835 | void hci_white_list_clear(struct hci_dev *hdev); | ||
836 | int hci_white_list_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
837 | int hci_white_list_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
838 | 858 | ||
839 | struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, | 859 | struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, |
840 | bdaddr_t *addr, u8 addr_type); | 860 | bdaddr_t *addr, u8 addr_type); |
841 | int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, | 861 | struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev, |
842 | u8 auto_connect, u16 conn_min_interval, | 862 | bdaddr_t *addr, u8 addr_type); |
843 | u16 conn_max_interval); | 863 | int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, |
864 | u8 auto_connect); | ||
844 | void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); | 865 | void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); |
845 | void hci_conn_params_clear(struct hci_dev *hdev); | 866 | void hci_conn_params_clear_all(struct hci_dev *hdev); |
867 | void hci_conn_params_clear_disabled(struct hci_dev *hdev); | ||
846 | 868 | ||
847 | struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev, | 869 | struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list, |
848 | bdaddr_t *addr, u8 addr_type); | 870 | bdaddr_t *addr, |
849 | void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); | 871 | u8 addr_type); |
850 | void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); | ||
851 | void hci_pend_le_conns_clear(struct hci_dev *hdev); | ||
852 | 872 | ||
853 | void hci_update_background_scan(struct hci_dev *hdev); | 873 | void hci_update_background_scan(struct hci_dev *hdev); |
854 | 874 | ||
@@ -856,8 +876,9 @@ void hci_uuids_clear(struct hci_dev *hdev); | |||
856 | 876 | ||
857 | void hci_link_keys_clear(struct hci_dev *hdev); | 877 | void hci_link_keys_clear(struct hci_dev *hdev); |
858 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 878 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
859 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 879 | struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, |
860 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 880 | bdaddr_t *bdaddr, u8 *val, u8 type, |
881 | u8 pin_len, bool *persistent); | ||
861 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand, | 882 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand, |
862 | bool master); | 883 | bool master); |
863 | struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, | 884 | struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, |
@@ -1021,7 +1042,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
1021 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) | 1042 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) |
1022 | return; | 1043 | return; |
1023 | 1044 | ||
1024 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 1045 | encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00; |
1025 | l2cap_security_cfm(conn, status, encrypt); | 1046 | l2cap_security_cfm(conn, status, encrypt); |
1026 | 1047 | ||
1027 | if (conn->security_cfm_cb) | 1048 | if (conn->security_cfm_cb) |
@@ -1062,7 +1083,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) | |||
1062 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) | 1083 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) |
1063 | return; | 1084 | return; |
1064 | 1085 | ||
1065 | encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; | 1086 | encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00; |
1066 | 1087 | ||
1067 | read_lock(&hci_cb_list_lock); | 1088 | read_lock(&hci_cb_list_lock); |
1068 | list_for_each_entry(cb, &hci_cb_list, list) { | 1089 | list_for_each_entry(cb, &hci_cb_list, list) { |
@@ -1147,7 +1168,7 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | |||
1147 | 1168 | ||
1148 | static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) | 1169 | static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) |
1149 | { | 1170 | { |
1150 | if (addr_type != 0x01) | 1171 | if (addr_type != ADDR_LE_DEV_RANDOM) |
1151 | return false; | 1172 | return false; |
1152 | 1173 | ||
1153 | if ((bdaddr->b[5] & 0xc0) == 0x40) | 1174 | if ((bdaddr->b[5] & 0xc0) == 0x40) |
@@ -1156,6 +1177,18 @@ static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) | |||
1156 | return false; | 1177 | return false; |
1157 | } | 1178 | } |
1158 | 1179 | ||
1180 | static inline bool hci_is_identity_address(bdaddr_t *addr, u8 addr_type) | ||
1181 | { | ||
1182 | if (addr_type == ADDR_LE_DEV_PUBLIC) | ||
1183 | return true; | ||
1184 | |||
1185 | /* Check for Random Static address type */ | ||
1186 | if ((addr->b[5] & 0xc0) == 0xc0) | ||
1187 | return true; | ||
1188 | |||
1189 | return false; | ||
1190 | } | ||
1191 | |||
1159 | static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, | 1192 | static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, |
1160 | bdaddr_t *bdaddr, u8 addr_type) | 1193 | bdaddr_t *bdaddr, u8 addr_type) |
1161 | { | 1194 | { |
@@ -1165,6 +1198,27 @@ static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, | |||
1165 | return hci_find_irk_by_rpa(hdev, bdaddr); | 1198 | return hci_find_irk_by_rpa(hdev, bdaddr); |
1166 | } | 1199 | } |
1167 | 1200 | ||
1201 | static inline int hci_check_conn_params(u16 min, u16 max, u16 latency, | ||
1202 | u16 to_multiplier) | ||
1203 | { | ||
1204 | u16 max_latency; | ||
1205 | |||
1206 | if (min > max || min < 6 || max > 3200) | ||
1207 | return -EINVAL; | ||
1208 | |||
1209 | if (to_multiplier < 10 || to_multiplier > 3200) | ||
1210 | return -EINVAL; | ||
1211 | |||
1212 | if (max >= to_multiplier * 8) | ||
1213 | return -EINVAL; | ||
1214 | |||
1215 | max_latency = (to_multiplier * 8 / max) - 1; | ||
1216 | if (latency > 499 || latency > max_latency) | ||
1217 | return -EINVAL; | ||
1218 | |||
1219 | return 0; | ||
1220 | } | ||
1221 | |||
1168 | int hci_register_cb(struct hci_cb *hcb); | 1222 | int hci_register_cb(struct hci_cb *hcb); |
1169 | int hci_unregister_cb(struct hci_cb *hcb); | 1223 | int hci_unregister_cb(struct hci_cb *hcb); |
1170 | 1224 | ||
@@ -1227,6 +1281,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); | |||
1227 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 | 1281 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 |
1228 | 1282 | ||
1229 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 1283 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
1284 | int mgmt_new_settings(struct hci_dev *hdev); | ||
1230 | void mgmt_index_added(struct hci_dev *hdev); | 1285 | void mgmt_index_added(struct hci_dev *hdev); |
1231 | void mgmt_index_removed(struct hci_dev *hdev); | 1286 | void mgmt_index_removed(struct hci_dev *hdev); |
1232 | void mgmt_set_powered_failed(struct hci_dev *hdev, int err); | 1287 | void mgmt_set_powered_failed(struct hci_dev *hdev, int err); |
@@ -1234,7 +1289,6 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered); | |||
1234 | void mgmt_discoverable_timeout(struct hci_dev *hdev); | 1289 | void mgmt_discoverable_timeout(struct hci_dev *hdev); |
1235 | void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); | 1290 | void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); |
1236 | void mgmt_connectable(struct hci_dev *hdev, u8 connectable); | 1291 | void mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
1237 | void mgmt_advertising(struct hci_dev *hdev, u8 advertising); | ||
1238 | void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); | 1292 | void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
1239 | void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 1293 | void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
1240 | bool persistent); | 1294 | bool persistent); |
@@ -1281,18 +1335,18 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, | |||
1281 | u8 *randomizer192, u8 *hash256, | 1335 | u8 *randomizer192, u8 *hash256, |
1282 | u8 *randomizer256, u8 status); | 1336 | u8 *randomizer256, u8 status); |
1283 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1337 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1284 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, | 1338 | u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, |
1285 | u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp, | 1339 | u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); |
1286 | u8 scan_rsp_len); | ||
1287 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1340 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1288 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); | 1341 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); |
1289 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1342 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
1290 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
1291 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
1292 | void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); | 1343 | void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); |
1293 | void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); | 1344 | void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); |
1294 | void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, | 1345 | void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, |
1295 | bool persistent); | 1346 | bool persistent); |
1347 | void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
1348 | u8 bdaddr_type, u8 store_hint, u16 min_interval, | ||
1349 | u16 max_interval, u16 latency, u16 timeout); | ||
1296 | void mgmt_reenable_advertising(struct hci_dev *hdev); | 1350 | void mgmt_reenable_advertising(struct hci_dev *hdev); |
1297 | void mgmt_smp_complete(struct hci_conn *conn, bool complete); | 1351 | void mgmt_smp_complete(struct hci_conn *conn, bool complete); |
1298 | 1352 | ||
@@ -1324,8 +1378,8 @@ struct hci_sec_filter { | |||
1324 | #define hci_req_lock(d) mutex_lock(&d->req_lock) | 1378 | #define hci_req_lock(d) mutex_lock(&d->req_lock) |
1325 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) | 1379 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) |
1326 | 1380 | ||
1327 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | 1381 | u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency, |
1328 | u16 latency, u16 to_multiplier); | 1382 | u16 to_multiplier); |
1329 | void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, | 1383 | void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, |
1330 | __u8 ltk[16]); | 1384 | __u8 ltk[16]); |
1331 | 1385 | ||
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 4abdcb220e3a..e0c6a9abdb62 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -137,7 +137,6 @@ struct l2cap_conninfo { | |||
137 | #define L2CAP_FC_L2CAP 0x02 | 137 | #define L2CAP_FC_L2CAP 0x02 |
138 | #define L2CAP_FC_CONNLESS 0x04 | 138 | #define L2CAP_FC_CONNLESS 0x04 |
139 | #define L2CAP_FC_A2MP 0x08 | 139 | #define L2CAP_FC_A2MP 0x08 |
140 | #define L2CAP_FC_6LOWPAN 0x3e /* reserved and temporary value */ | ||
141 | 140 | ||
142 | /* L2CAP Control Field bit masks */ | 141 | /* L2CAP Control Field bit masks */ |
143 | #define L2CAP_CTRL_SAR 0xC000 | 142 | #define L2CAP_CTRL_SAR 0xC000 |
@@ -579,7 +578,7 @@ struct l2cap_chan { | |||
579 | struct list_head global_l; | 578 | struct list_head global_l; |
580 | 579 | ||
581 | void *data; | 580 | void *data; |
582 | struct l2cap_ops *ops; | 581 | const struct l2cap_ops *ops; |
583 | struct mutex lock; | 582 | struct mutex lock; |
584 | }; | 583 | }; |
585 | 584 | ||
@@ -600,7 +599,12 @@ struct l2cap_ops { | |||
600 | void (*set_shutdown) (struct l2cap_chan *chan); | 599 | void (*set_shutdown) (struct l2cap_chan *chan); |
601 | long (*get_sndtimeo) (struct l2cap_chan *chan); | 600 | long (*get_sndtimeo) (struct l2cap_chan *chan); |
602 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, | 601 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, |
602 | unsigned long hdr_len, | ||
603 | unsigned long len, int nb); | 603 | unsigned long len, int nb); |
604 | int (*memcpy_fromiovec) (struct l2cap_chan *chan, | ||
605 | unsigned char *kdata, | ||
606 | struct iovec *iov, | ||
607 | int len); | ||
604 | }; | 608 | }; |
605 | 609 | ||
606 | struct l2cap_conn { | 610 | struct l2cap_conn { |
@@ -856,6 +860,31 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan) | |||
856 | return 0; | 860 | return 0; |
857 | } | 861 | } |
858 | 862 | ||
863 | static inline int l2cap_chan_no_memcpy_fromiovec(struct l2cap_chan *chan, | ||
864 | unsigned char *kdata, | ||
865 | struct iovec *iov, | ||
866 | int len) | ||
867 | { | ||
868 | /* Following is safe since for compiler definitions of kvec and | ||
869 | * iovec are identical, yielding the same in-core layout and alignment | ||
870 | */ | ||
871 | struct kvec *vec = (struct kvec *)iov; | ||
872 | |||
873 | while (len > 0) { | ||
874 | if (vec->iov_len) { | ||
875 | int copy = min_t(unsigned int, len, vec->iov_len); | ||
876 | memcpy(kdata, vec->iov_base, copy); | ||
877 | len -= copy; | ||
878 | kdata += copy; | ||
879 | vec->iov_base += copy; | ||
880 | vec->iov_len -= copy; | ||
881 | } | ||
882 | vec++; | ||
883 | } | ||
884 | |||
885 | return 0; | ||
886 | } | ||
887 | |||
859 | extern bool disable_ertm; | 888 | extern bool disable_ertm; |
860 | 889 | ||
861 | int l2cap_init_sockets(void); | 890 | int l2cap_init_sockets(void); |
@@ -872,8 +901,7 @@ struct l2cap_chan *l2cap_chan_create(void); | |||
872 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); | 901 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); |
873 | int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, | 902 | int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, |
874 | bdaddr_t *dst, u8 dst_type); | 903 | bdaddr_t *dst, u8 dst_type); |
875 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, | 904 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); |
876 | u32 priority); | ||
877 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); | 905 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); |
878 | int l2cap_chan_check_security(struct l2cap_chan *chan); | 906 | int l2cap_chan_check_security(struct l2cap_chan *chan); |
879 | void l2cap_chan_set_defaults(struct l2cap_chan *chan); | 907 | void l2cap_chan_set_defaults(struct l2cap_chan *chan); |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index bcffc9ae0c89..623d5203c592 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -97,6 +97,7 @@ struct mgmt_rp_read_index_list { | |||
97 | #define MGMT_SETTING_SECURE_CONN 0x00000800 | 97 | #define MGMT_SETTING_SECURE_CONN 0x00000800 |
98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 | 98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 |
99 | #define MGMT_SETTING_PRIVACY 0x00002000 | 99 | #define MGMT_SETTING_PRIVACY 0x00002000 |
100 | #define MGMT_SETTING_CONFIGURATION 0x00004000 | ||
100 | 101 | ||
101 | #define MGMT_OP_READ_INFO 0x0004 | 102 | #define MGMT_OP_READ_INFO 0x0004 |
102 | #define MGMT_READ_INFO_SIZE 0 | 103 | #define MGMT_READ_INFO_SIZE 0 |
@@ -424,6 +425,76 @@ struct mgmt_rp_get_conn_info { | |||
424 | __s8 max_tx_power; | 425 | __s8 max_tx_power; |
425 | } __packed; | 426 | } __packed; |
426 | 427 | ||
428 | #define MGMT_OP_GET_CLOCK_INFO 0x0032 | ||
429 | struct mgmt_cp_get_clock_info { | ||
430 | struct mgmt_addr_info addr; | ||
431 | } __packed; | ||
432 | #define MGMT_GET_CLOCK_INFO_SIZE MGMT_ADDR_INFO_SIZE | ||
433 | struct mgmt_rp_get_clock_info { | ||
434 | struct mgmt_addr_info addr; | ||
435 | __le32 local_clock; | ||
436 | __le32 piconet_clock; | ||
437 | __le16 accuracy; | ||
438 | } __packed; | ||
439 | |||
440 | #define MGMT_OP_ADD_DEVICE 0x0033 | ||
441 | struct mgmt_cp_add_device { | ||
442 | struct mgmt_addr_info addr; | ||
443 | __u8 action; | ||
444 | } __packed; | ||
445 | #define MGMT_ADD_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) | ||
446 | |||
447 | #define MGMT_OP_REMOVE_DEVICE 0x0034 | ||
448 | struct mgmt_cp_remove_device { | ||
449 | struct mgmt_addr_info addr; | ||
450 | } __packed; | ||
451 | #define MGMT_REMOVE_DEVICE_SIZE MGMT_ADDR_INFO_SIZE | ||
452 | |||
453 | struct mgmt_conn_param { | ||
454 | struct mgmt_addr_info addr; | ||
455 | __le16 min_interval; | ||
456 | __le16 max_interval; | ||
457 | __le16 latency; | ||
458 | __le16 timeout; | ||
459 | } __packed; | ||
460 | |||
461 | #define MGMT_OP_LOAD_CONN_PARAM 0x0035 | ||
462 | struct mgmt_cp_load_conn_param { | ||
463 | __le16 param_count; | ||
464 | struct mgmt_conn_param params[0]; | ||
465 | } __packed; | ||
466 | #define MGMT_LOAD_CONN_PARAM_SIZE 2 | ||
467 | |||
468 | #define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036 | ||
469 | #define MGMT_READ_UNCONF_INDEX_LIST_SIZE 0 | ||
470 | struct mgmt_rp_read_unconf_index_list { | ||
471 | __le16 num_controllers; | ||
472 | __le16 index[0]; | ||
473 | } __packed; | ||
474 | |||
475 | #define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001 | ||
476 | #define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002 | ||
477 | |||
478 | #define MGMT_OP_READ_CONFIG_INFO 0x0037 | ||
479 | #define MGMT_READ_CONFIG_INFO_SIZE 0 | ||
480 | struct mgmt_rp_read_config_info { | ||
481 | __le16 manufacturer; | ||
482 | __le32 supported_options; | ||
483 | __le32 missing_options; | ||
484 | } __packed; | ||
485 | |||
486 | #define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038 | ||
487 | struct mgmt_cp_set_external_config { | ||
488 | __u8 config; | ||
489 | } __packed; | ||
490 | #define MGMT_SET_EXTERNAL_CONFIG_SIZE 1 | ||
491 | |||
492 | #define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039 | ||
493 | struct mgmt_cp_set_public_address { | ||
494 | bdaddr_t bdaddr; | ||
495 | } __packed; | ||
496 | #define MGMT_SET_PUBLIC_ADDRESS_SIZE 6 | ||
497 | |||
427 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 498 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
428 | struct mgmt_ev_cmd_complete { | 499 | struct mgmt_ev_cmd_complete { |
429 | __le16 opcode; | 500 | __le16 opcode; |
@@ -522,6 +593,7 @@ struct mgmt_ev_auth_failed { | |||
522 | 593 | ||
523 | #define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 | 594 | #define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 |
524 | #define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 | 595 | #define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 |
596 | #define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04 | ||
525 | 597 | ||
526 | #define MGMT_EV_DEVICE_FOUND 0x0012 | 598 | #define MGMT_EV_DEVICE_FOUND 0x0012 |
527 | struct mgmt_ev_device_found { | 599 | struct mgmt_ev_device_found { |
@@ -578,3 +650,30 @@ struct mgmt_ev_new_csrk { | |||
578 | __u8 store_hint; | 650 | __u8 store_hint; |
579 | struct mgmt_csrk_info key; | 651 | struct mgmt_csrk_info key; |
580 | } __packed; | 652 | } __packed; |
653 | |||
654 | #define MGMT_EV_DEVICE_ADDED 0x001a | ||
655 | struct mgmt_ev_device_added { | ||
656 | struct mgmt_addr_info addr; | ||
657 | __u8 action; | ||
658 | } __packed; | ||
659 | |||
660 | #define MGMT_EV_DEVICE_REMOVED 0x001b | ||
661 | struct mgmt_ev_device_removed { | ||
662 | struct mgmt_addr_info addr; | ||
663 | } __packed; | ||
664 | |||
665 | #define MGMT_EV_NEW_CONN_PARAM 0x001c | ||
666 | struct mgmt_ev_new_conn_param { | ||
667 | struct mgmt_addr_info addr; | ||
668 | __u8 store_hint; | ||
669 | __le16 min_interval; | ||
670 | __le16 max_interval; | ||
671 | __le16 latency; | ||
672 | __le16 timeout; | ||
673 | } __packed; | ||
674 | |||
675 | #define MGMT_EV_UNCONF_INDEX_ADDED 0x001d | ||
676 | |||
677 | #define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e | ||
678 | |||
679 | #define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f | ||