aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-02-18 16:49:17 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-18 16:49:17 -0500
commitf4f314bf6fd39d85065c3fcda27bd594163abcf0 (patch)
tree2b88d345b2563e51c196b038ff5f74b94c77b2e0
parentc269a20393500e84e8cbae23ca6d65e1107433c4 (diff)
parent8ffd878419839638d1aea102455b575da39c1a62 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6
-rw-r--r--drivers/bluetooth/ath3k.c279
-rw-r--r--drivers/bluetooth/btusb.c13
-rw-r--r--drivers/bluetooth/hci_ldisc.c1
-rw-r--r--include/net/bluetooth/bluetooth.h28
-rw-r--r--include/net/bluetooth/hci.h65
-rw-r--r--include/net/bluetooth/hci_core.h92
-rw-r--r--include/net/bluetooth/l2cap.h23
-rw-r--r--include/net/bluetooth/smp.h76
-rw-r--r--net/bluetooth/Kconfig10
-rw-r--r--net/bluetooth/Makefile5
-rw-r--r--net/bluetooth/af_bluetooth.c34
-rw-r--r--net/bluetooth/bnep/core.c2
-rw-r--r--net/bluetooth/bnep/sock.c1
-rw-r--r--net/bluetooth/cmtp/core.c2
-rw-r--r--net/bluetooth/hci_conn.c77
-rw-r--r--net/bluetooth/hci_core.c115
-rw-r--r--net/bluetooth/hci_event.c165
-rw-r--r--net/bluetooth/hci_sysfs.c6
-rw-r--r--net/bluetooth/hidp/core.c2
-rw-r--r--net/bluetooth/l2cap_core.c355
-rw-r--r--net/bluetooth/l2cap_sock.c60
-rw-r--r--net/bluetooth/mgmt.c2
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/sco.c17
24 files changed, 1196 insertions, 236 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 41dadacd3d15..e6acaba1e45c 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -31,6 +31,30 @@
31 31
32#define VERSION "1.0" 32#define VERSION "1.0"
33 33
34#define ATH3K_DNLOAD 0x01
35#define ATH3K_GETSTATE 0x05
36#define ATH3K_SET_NORMAL_MODE 0x07
37#define ATH3K_GETVERSION 0x09
38#define USB_REG_SWITCH_VID_PID 0x0a
39
40#define ATH3K_MODE_MASK 0x3F
41#define ATH3K_NORMAL_MODE 0x0E
42
43#define ATH3K_PATCH_UPDATE 0x80
44#define ATH3K_SYSCFG_UPDATE 0x40
45
46#define ATH3K_XTAL_FREQ_26M 0x00
47#define ATH3K_XTAL_FREQ_40M 0x01
48#define ATH3K_XTAL_FREQ_19P2 0x02
49#define ATH3K_NAME_LEN 0xFF
50
51struct ath3k_version {
52 unsigned int rom_version;
53 unsigned int build_version;
54 unsigned int ram_version;
55 unsigned char ref_clock;
56 unsigned char reserved[0x07];
57};
34 58
35static struct usb_device_id ath3k_table[] = { 59static struct usb_device_id ath3k_table[] = {
36 /* Atheros AR3011 */ 60 /* Atheros AR3011 */
@@ -41,13 +65,29 @@ static struct usb_device_id ath3k_table[] = {
41 65
42 /* Atheros AR9285 Malbec with sflash firmware */ 66 /* Atheros AR9285 Malbec with sflash firmware */
43 { USB_DEVICE(0x03F0, 0x311D) }, 67 { USB_DEVICE(0x03F0, 0x311D) },
68
69 /* Atheros AR3012 with sflash firmware*/
70 { USB_DEVICE(0x0CF3, 0x3004) },
71
44 { } /* Terminating entry */ 72 { } /* Terminating entry */
45}; 73};
46 74
47MODULE_DEVICE_TABLE(usb, ath3k_table); 75MODULE_DEVICE_TABLE(usb, ath3k_table);
48 76
77#define BTUSB_ATH3012 0x80
78/* This table is to load patch and sysconfig files
79 * for AR3012 */
80static struct usb_device_id ath3k_blist_tbl[] = {
81
82 /* Atheros AR3012 with sflash firmware*/
83 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
84
85 { } /* Terminating entry */
86};
87
49#define USB_REQ_DFU_DNLOAD 1 88#define USB_REQ_DFU_DNLOAD 1
50#define BULK_SIZE 4096 89#define BULK_SIZE 4096
90#define FW_HDR_SIZE 20
51 91
52static int ath3k_load_firmware(struct usb_device *udev, 92static int ath3k_load_firmware(struct usb_device *udev,
53 const struct firmware *firmware) 93 const struct firmware *firmware)
@@ -103,6 +143,215 @@ error:
103 return err; 143 return err;
104} 144}
105 145
146static int ath3k_get_state(struct usb_device *udev, unsigned char *state)
147{
148 int pipe = 0;
149
150 pipe = usb_rcvctrlpipe(udev, 0);
151 return usb_control_msg(udev, pipe, ATH3K_GETSTATE,
152 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
153 state, 0x01, USB_CTRL_SET_TIMEOUT);
154}
155
156static int ath3k_get_version(struct usb_device *udev,
157 struct ath3k_version *version)
158{
159 int pipe = 0;
160
161 pipe = usb_rcvctrlpipe(udev, 0);
162 return usb_control_msg(udev, pipe, ATH3K_GETVERSION,
163 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version,
164 sizeof(struct ath3k_version),
165 USB_CTRL_SET_TIMEOUT);
166}
167
168static int ath3k_load_fwfile(struct usb_device *udev,
169 const struct firmware *firmware)
170{
171 u8 *send_buf;
172 int err, pipe, len, size, count, sent = 0;
173 int ret;
174
175 count = firmware->size;
176
177 send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
178 if (!send_buf) {
179 BT_ERR("Can't allocate memory chunk for firmware");
180 return -ENOMEM;
181 }
182
183 size = min_t(uint, count, FW_HDR_SIZE);
184 memcpy(send_buf, firmware->data, size);
185
186 pipe = usb_sndctrlpipe(udev, 0);
187 ret = usb_control_msg(udev, pipe, ATH3K_DNLOAD,
188 USB_TYPE_VENDOR, 0, 0, send_buf,
189 size, USB_CTRL_SET_TIMEOUT);
190 if (ret < 0) {
191 BT_ERR("Can't change to loading configuration err");
192 kfree(send_buf);
193 return ret;
194 }
195
196 sent += size;
197 count -= size;
198
199 while (count) {
200 size = min_t(uint, count, BULK_SIZE);
201 pipe = usb_sndbulkpipe(udev, 0x02);
202
203 memcpy(send_buf, firmware->data + sent, size);
204
205 err = usb_bulk_msg(udev, pipe, send_buf, size,
206 &len, 3000);
207 if (err || (len != size)) {
208 BT_ERR("Error in firmware loading err = %d,"
209 "len = %d, size = %d", err, len, size);
210 kfree(send_buf);
211 return err;
212 }
213 sent += size;
214 count -= size;
215 }
216
217 kfree(send_buf);
218 return 0;
219}
220
221static int ath3k_switch_pid(struct usb_device *udev)
222{
223 int pipe = 0;
224
225 pipe = usb_sndctrlpipe(udev, 0);
226 return usb_control_msg(udev, pipe, USB_REG_SWITCH_VID_PID,
227 USB_TYPE_VENDOR, 0, 0,
228 NULL, 0, USB_CTRL_SET_TIMEOUT);
229}
230
231static int ath3k_set_normal_mode(struct usb_device *udev)
232{
233 unsigned char fw_state;
234 int pipe = 0, ret;
235
236 ret = ath3k_get_state(udev, &fw_state);
237 if (ret < 0) {
238 BT_ERR("Can't get state to change to normal mode err");
239 return ret;
240 }
241
242 if ((fw_state & ATH3K_MODE_MASK) == ATH3K_NORMAL_MODE) {
243 BT_DBG("firmware was already in normal mode");
244 return 0;
245 }
246
247 pipe = usb_sndctrlpipe(udev, 0);
248 return usb_control_msg(udev, pipe, ATH3K_SET_NORMAL_MODE,
249 USB_TYPE_VENDOR, 0, 0,
250 NULL, 0, USB_CTRL_SET_TIMEOUT);
251}
252
253static int ath3k_load_patch(struct usb_device *udev)
254{
255 unsigned char fw_state;
256 char filename[ATH3K_NAME_LEN] = {0};
257 const struct firmware *firmware;
258 struct ath3k_version fw_version, pt_version;
259 int ret;
260
261 ret = ath3k_get_state(udev, &fw_state);
262 if (ret < 0) {
263 BT_ERR("Can't get state to change to load ram patch err");
264 return ret;
265 }
266
267 if (fw_state & ATH3K_PATCH_UPDATE) {
268 BT_DBG("Patch was already downloaded");
269 return 0;
270 }
271
272 ret = ath3k_get_version(udev, &fw_version);
273 if (ret < 0) {
274 BT_ERR("Can't get version to change to load ram patch err");
275 return ret;
276 }
277
278 snprintf(filename, ATH3K_NAME_LEN, "ar3k/AthrBT_0x%08x.dfu",
279 fw_version.rom_version);
280
281 ret = request_firmware(&firmware, filename, &udev->dev);
282 if (ret < 0) {
283 BT_ERR("Patch file not found %s", filename);
284 return ret;
285 }
286
287 pt_version.rom_version = *(int *)(firmware->data + firmware->size - 8);
288 pt_version.build_version = *(int *)
289 (firmware->data + firmware->size - 4);
290
291 if ((pt_version.rom_version != fw_version.rom_version) ||
292 (pt_version.build_version <= fw_version.build_version)) {
293 BT_ERR("Patch file version did not match with firmware");
294 release_firmware(firmware);
295 return -EINVAL;
296 }
297
298 ret = ath3k_load_fwfile(udev, firmware);
299 release_firmware(firmware);
300
301 return ret;
302}
303
304static int ath3k_load_syscfg(struct usb_device *udev)
305{
306 unsigned char fw_state;
307 char filename[ATH3K_NAME_LEN] = {0};
308 const struct firmware *firmware;
309 struct ath3k_version fw_version;
310 int clk_value, ret;
311
312 ret = ath3k_get_state(udev, &fw_state);
313 if (ret < 0) {
314 BT_ERR("Can't get state to change to load configration err");
315 return -EBUSY;
316 }
317
318 ret = ath3k_get_version(udev, &fw_version);
319 if (ret < 0) {
320 BT_ERR("Can't get version to change to load ram patch err");
321 return ret;
322 }
323
324 switch (fw_version.ref_clock) {
325
326 case ATH3K_XTAL_FREQ_26M:
327 clk_value = 26;
328 break;
329 case ATH3K_XTAL_FREQ_40M:
330 clk_value = 40;
331 break;
332 case ATH3K_XTAL_FREQ_19P2:
333 clk_value = 19;
334 break;
335 default:
336 clk_value = 0;
337 break;
338 }
339
340 snprintf(filename, ATH3K_NAME_LEN, "ar3k/ramps_0x%08x_%d%s",
341 fw_version.rom_version, clk_value, ".dfu");
342
343 ret = request_firmware(&firmware, filename, &udev->dev);
344 if (ret < 0) {
345 BT_ERR("Configuration file not found %s", filename);
346 return ret;
347 }
348
349 ret = ath3k_load_fwfile(udev, firmware);
350 release_firmware(firmware);
351
352 return ret;
353}
354
106static int ath3k_probe(struct usb_interface *intf, 355static int ath3k_probe(struct usb_interface *intf,
107 const struct usb_device_id *id) 356 const struct usb_device_id *id)
108{ 357{
@@ -115,7 +364,37 @@ static int ath3k_probe(struct usb_interface *intf,
115 if (intf->cur_altsetting->desc.bInterfaceNumber != 0) 364 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
116 return -ENODEV; 365 return -ENODEV;
117 366
367 /* match device ID in ath3k blacklist table */
368 if (!id->driver_info) {
369 const struct usb_device_id *match;
370 match = usb_match_id(intf, ath3k_blist_tbl);
371 if (match)
372 id = match;
373 }
374
375 /* load patch and sysconfig files for AR3012 */
376 if (id->driver_info & BTUSB_ATH3012) {
377 ret = ath3k_load_patch(udev);
378 if (ret < 0) {
379 BT_ERR("Loading patch file failed");
380 return ret;
381 }
382 ret = ath3k_load_syscfg(udev);
383 if (ret < 0) {
384 BT_ERR("Loading sysconfig file failed");
385 return ret;
386 }
387 ret = ath3k_set_normal_mode(udev);
388 if (ret < 0) {
389 BT_ERR("Set normal mode failed");
390 return ret;
391 }
392 ath3k_switch_pid(udev);
393 return 0;
394 }
395
118 if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { 396 if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
397 BT_ERR("Error loading firmware");
119 return -EIO; 398 return -EIO;
120 } 399 }
121 400
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4cefa91e6c34..89b9e51eec1f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -105,6 +105,9 @@ static struct usb_device_id blacklist_table[] = {
105 /* Atheros AR9285 Malbec with sflash firmware */ 105 /* Atheros AR9285 Malbec with sflash firmware */
106 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, 106 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
107 107
108 /* Atheros 3012 with sflash firmware */
109 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_IGNORE },
110
108 /* Broadcom BCM2035 */ 111 /* Broadcom BCM2035 */
109 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, 112 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
110 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, 113 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU },
@@ -711,15 +714,11 @@ static int btusb_send_frame(struct sk_buff *skb)
711 pipe = usb_sndisocpipe(data->udev, 714 pipe = usb_sndisocpipe(data->udev,
712 data->isoc_tx_ep->bEndpointAddress); 715 data->isoc_tx_ep->bEndpointAddress);
713 716
714 urb->dev = data->udev; 717 usb_fill_int_urb(urb, data->udev, pipe,
715 urb->pipe = pipe; 718 skb->data, skb->len, btusb_isoc_tx_complete,
716 urb->context = skb; 719 skb, data->isoc_tx_ep->bInterval);
717 urb->complete = btusb_isoc_tx_complete;
718 urb->interval = data->isoc_tx_ep->bInterval;
719 720
720 urb->transfer_flags = URB_ISO_ASAP; 721 urb->transfer_flags = URB_ISO_ASAP;
721 urb->transfer_buffer = skb->data;
722 urb->transfer_buffer_length = skb->len;
723 722
724 __fill_isoc_descriptor(urb, skb->len, 723 __fill_isoc_descriptor(urb, skb->len,
725 le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize)); 724 le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 3c6cabcb7d84..48ad2a7ab080 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -398,6 +398,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
398 hdev->flush = hci_uart_flush; 398 hdev->flush = hci_uart_flush;
399 hdev->send = hci_uart_send_frame; 399 hdev->send = hci_uart_send_frame;
400 hdev->destruct = hci_uart_destruct; 400 hdev->destruct = hci_uart_destruct;
401 hdev->parent = hu->tty->dev;
401 402
402 hdev->owner = THIS_MODULE; 403 hdev->owner = THIS_MODULE;
403 404
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ed7d775337e0..43750439c521 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -205,4 +205,32 @@ extern void bt_sysfs_cleanup(void);
205 205
206extern struct dentry *bt_debugfs; 206extern struct dentry *bt_debugfs;
207 207
208#ifdef CONFIG_BT_L2CAP
209int l2cap_init(void);
210void l2cap_exit(void);
211#else
212static inline int l2cap_init(void)
213{
214 return 0;
215}
216
217static inline void l2cap_exit(void)
218{
219}
220#endif
221
222#ifdef CONFIG_BT_SCO
223int sco_init(void);
224void sco_exit(void);
225#else
226static inline int sco_init(void)
227{
228 return 0;
229}
230
231static inline void sco_exit(void)
232{
233}
234#endif
235
208#endif /* __BLUETOOTH_H */ 236#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 4bee030e4b52..a5f8c4684a32 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -119,6 +119,7 @@ enum {
119#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 119#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
120#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 120#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
121#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 121#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
122#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
122 123
123/* HCI data types */ 124/* HCI data types */
124#define HCI_COMMAND_PKT 0x01 125#define HCI_COMMAND_PKT 0x01
@@ -168,6 +169,8 @@ enum {
168#define SCO_LINK 0x00 169#define SCO_LINK 0x00
169#define ACL_LINK 0x01 170#define ACL_LINK 0x01
170#define ESCO_LINK 0x02 171#define ESCO_LINK 0x02
172/* Low Energy links do not have defined link type. Use invented one */
173#define LE_LINK 0x80
171 174
172/* LMP features */ 175/* LMP features */
173#define LMP_3SLOT 0x01 176#define LMP_3SLOT 0x01
@@ -242,6 +245,8 @@ enum {
242#define HCI_AT_GENERAL_BONDING_MITM 0x05 245#define HCI_AT_GENERAL_BONDING_MITM 0x05
243 246
244/* ----- HCI Commands ---- */ 247/* ----- HCI Commands ---- */
248#define HCI_OP_NOP 0x0000
249
245#define HCI_OP_INQUIRY 0x0401 250#define HCI_OP_INQUIRY 0x0401
246struct hci_cp_inquiry { 251struct hci_cp_inquiry {
247 __u8 lap[3]; 252 __u8 lap[3];
@@ -642,6 +647,47 @@ struct hci_rp_read_bd_addr {
642 bdaddr_t bdaddr; 647 bdaddr_t bdaddr;
643} __packed; 648} __packed;
644 649
650#define HCI_OP_LE_SET_EVENT_MASK 0x2001
651struct hci_cp_le_set_event_mask {
652 __u8 mask[8];
653} __packed;
654
655#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
656struct hci_rp_le_read_buffer_size {
657 __u8 status;
658 __le16 le_mtu;
659 __u8 le_max_pkt;
660} __packed;
661
662#define HCI_OP_LE_CREATE_CONN 0x200d
663struct hci_cp_le_create_conn {
664 __le16 scan_interval;
665 __le16 scan_window;
666 __u8 filter_policy;
667 __u8 peer_addr_type;
668 bdaddr_t peer_addr;
669 __u8 own_address_type;
670 __le16 conn_interval_min;
671 __le16 conn_interval_max;
672 __le16 conn_latency;
673 __le16 supervision_timeout;
674 __le16 min_ce_len;
675 __le16 max_ce_len;
676} __packed;
677
678#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
679
680#define HCI_OP_LE_CONN_UPDATE 0x2013
681struct hci_cp_le_conn_update {
682 __le16 handle;
683 __le16 conn_interval_min;
684 __le16 conn_interval_max;
685 __le16 conn_latency;
686 __le16 supervision_timeout;
687 __le16 min_ce_len;
688 __le16 max_ce_len;
689} __packed;
690
645/* ---- HCI Events ---- */ 691/* ---- HCI Events ---- */
646#define HCI_EV_INQUIRY_COMPLETE 0x01 692#define HCI_EV_INQUIRY_COMPLETE 0x01
647 693
@@ -902,6 +948,25 @@ struct hci_ev_remote_host_features {
902 __u8 features[8]; 948 __u8 features[8];
903} __packed; 949} __packed;
904 950
951#define HCI_EV_LE_META 0x3e
952struct hci_ev_le_meta {
953 __u8 subevent;
954} __packed;
955
956/* Low energy meta events */
957#define HCI_EV_LE_CONN_COMPLETE 0x01
958struct hci_ev_le_conn_complete {
959 __u8 status;
960 __le16 handle;
961 __u8 role;
962 __u8 bdaddr_type;
963 bdaddr_t bdaddr;
964 __le16 interval;
965 __le16 latency;
966 __le16 supervision_timeout;
967 __u8 clk_accurancy;
968} __packed;
969
905/* Internal events generated by Bluetooth stack */ 970/* Internal events generated by Bluetooth stack */
906#define HCI_EV_STACK_INTERNAL 0xfd 971#define HCI_EV_STACK_INTERNAL 0xfd
907struct hci_ev_stack_internal { 972struct hci_ev_stack_internal {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6163bff6fa91..d5d8454236bf 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -60,6 +60,7 @@ struct hci_conn_hash {
60 spinlock_t lock; 60 spinlock_t lock;
61 unsigned int acl_num; 61 unsigned int acl_num;
62 unsigned int sco_num; 62 unsigned int sco_num;
63 unsigned int le_num;
63}; 64};
64 65
65struct bdaddr_list { 66struct bdaddr_list {
@@ -122,15 +123,18 @@ struct hci_dev {
122 atomic_t cmd_cnt; 123 atomic_t cmd_cnt;
123 unsigned int acl_cnt; 124 unsigned int acl_cnt;
124 unsigned int sco_cnt; 125 unsigned int sco_cnt;
126 unsigned int le_cnt;
125 127
126 unsigned int acl_mtu; 128 unsigned int acl_mtu;
127 unsigned int sco_mtu; 129 unsigned int sco_mtu;
130 unsigned int le_mtu;
128 unsigned int acl_pkts; 131 unsigned int acl_pkts;
129 unsigned int sco_pkts; 132 unsigned int sco_pkts;
133 unsigned int le_pkts;
130 134
131 unsigned long cmd_last_tx;
132 unsigned long acl_last_tx; 135 unsigned long acl_last_tx;
133 unsigned long sco_last_tx; 136 unsigned long sco_last_tx;
137 unsigned long le_last_tx;
134 138
135 struct workqueue_struct *workqueue; 139 struct workqueue_struct *workqueue;
136 140
@@ -138,6 +142,7 @@ struct hci_dev {
138 struct work_struct power_off; 142 struct work_struct power_off;
139 struct timer_list off_timer; 143 struct timer_list off_timer;
140 144
145 struct timer_list cmd_timer;
141 struct tasklet_struct cmd_task; 146 struct tasklet_struct cmd_task;
142 struct tasklet_struct rx_task; 147 struct tasklet_struct rx_task;
143 struct tasklet_struct tx_task; 148 struct tasklet_struct tx_task;
@@ -194,37 +199,37 @@ struct hci_dev {
194struct hci_conn { 199struct hci_conn {
195 struct list_head list; 200 struct list_head list;
196 201
197 atomic_t refcnt; 202 atomic_t refcnt;
198 spinlock_t lock; 203 spinlock_t lock;
199 204
200 bdaddr_t dst; 205 bdaddr_t dst;
201 __u16 handle; 206 __u16 handle;
202 __u16 state; 207 __u16 state;
203 __u8 mode; 208 __u8 mode;
204 __u8 type; 209 __u8 type;
205 __u8 out; 210 __u8 out;
206 __u8 attempt; 211 __u8 attempt;
207 __u8 dev_class[3]; 212 __u8 dev_class[3];
208 __u8 features[8]; 213 __u8 features[8];
209 __u8 ssp_mode; 214 __u8 ssp_mode;
210 __u16 interval; 215 __u16 interval;
211 __u16 pkt_type; 216 __u16 pkt_type;
212 __u16 link_policy; 217 __u16 link_policy;
213 __u32 link_mode; 218 __u32 link_mode;
214 __u8 auth_type; 219 __u8 auth_type;
215 __u8 sec_level; 220 __u8 sec_level;
216 __u8 pending_sec_level; 221 __u8 pending_sec_level;
217 __u8 pin_length; 222 __u8 pin_length;
218 __u8 io_capability; 223 __u8 io_capability;
219 __u8 power_save; 224 __u8 power_save;
220 __u16 disc_timeout; 225 __u16 disc_timeout;
221 unsigned long pend; 226 unsigned long pend;
222 227
223 __u8 remote_cap; 228 __u8 remote_cap;
224 __u8 remote_oob; 229 __u8 remote_oob;
225 __u8 remote_auth; 230 __u8 remote_auth;
226 231
227 unsigned int sent; 232 unsigned int sent;
228 233
229 struct sk_buff_head data_q; 234 struct sk_buff_head data_q;
230 235
@@ -309,24 +314,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
309{ 314{
310 struct hci_conn_hash *h = &hdev->conn_hash; 315 struct hci_conn_hash *h = &hdev->conn_hash;
311 list_add(&c->list, &h->list); 316 list_add(&c->list, &h->list);
312 if (c->type == ACL_LINK) 317 switch (c->type) {
318 case ACL_LINK:
313 h->acl_num++; 319 h->acl_num++;
314 else 320 break;
321 case LE_LINK:
322 h->le_num++;
323 break;
324 case SCO_LINK:
325 case ESCO_LINK:
315 h->sco_num++; 326 h->sco_num++;
327 break;
328 }
316} 329}
317 330
318static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) 331static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
319{ 332{
320 struct hci_conn_hash *h = &hdev->conn_hash; 333 struct hci_conn_hash *h = &hdev->conn_hash;
321 list_del(&c->list); 334 list_del(&c->list);
322 if (c->type == ACL_LINK) 335 switch (c->type) {
336 case ACL_LINK:
323 h->acl_num--; 337 h->acl_num--;
324 else 338 break;
339 case LE_LINK:
340 h->le_num--;
341 break;
342 case SCO_LINK:
343 case ESCO_LINK:
325 h->sco_num--; 344 h->sco_num--;
345 break;
346 }
326} 347}
327 348
328static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 349static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
329 __u16 handle) 350 __u16 handle)
330{ 351{
331 struct hci_conn_hash *h = &hdev->conn_hash; 352 struct hci_conn_hash *h = &hdev->conn_hash;
332 struct list_head *p; 353 struct list_head *p;
@@ -341,7 +362,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
341} 362}
342 363
343static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, 364static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
344 __u8 type, bdaddr_t *ba) 365 __u8 type, bdaddr_t *ba)
345{ 366{
346 struct hci_conn_hash *h = &hdev->conn_hash; 367 struct hci_conn_hash *h = &hdev->conn_hash;
347 struct list_head *p; 368 struct list_head *p;
@@ -356,7 +377,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
356} 377}
357 378
358static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, 379static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
359 __u8 type, __u16 state) 380 __u8 type, __u16 state)
360{ 381{
361 struct hci_conn_hash *h = &hdev->conn_hash; 382 struct hci_conn_hash *h = &hdev->conn_hash;
362 struct list_head *p; 383 struct list_head *p;
@@ -504,6 +525,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
504#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 525#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
505#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 526#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
506#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 527#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
528#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
507 529
508/* ----- HCI protocols ----- */ 530/* ----- HCI protocols ----- */
509struct hci_proto { 531struct hci_proto {
@@ -755,4 +777,6 @@ struct hci_sec_filter {
755 777
756void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); 778void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
757 779
780void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
781 u16 latency, u16 to_multiplier);
758#endif /* __HCI_CORE_H */ 782#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 75ef0b2948f9..4f4bff1eaed6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -38,6 +38,7 @@
38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
39#define L2CAP_DEFAULT_ACK_TO 200 39#define L2CAP_DEFAULT_ACK_TO 200
40#define L2CAP_LOCAL_BUSY_TRIES 12 40#define L2CAP_LOCAL_BUSY_TRIES 12
41#define L2CAP_LE_DEFAULT_MTU 23
41 42
42#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 43#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
43#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 44#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -88,6 +89,8 @@ struct l2cap_conninfo {
88#define L2CAP_ECHO_RSP 0x09 89#define L2CAP_ECHO_RSP 0x09
89#define L2CAP_INFO_REQ 0x0a 90#define L2CAP_INFO_REQ 0x0a
90#define L2CAP_INFO_RSP 0x0b 91#define L2CAP_INFO_RSP 0x0b
92#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
93#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
91 94
92/* L2CAP feature mask */ 95/* L2CAP feature mask */
93#define L2CAP_FEAT_FLOWCTL 0x00000001 96#define L2CAP_FEAT_FLOWCTL 0x00000001
@@ -160,6 +163,9 @@ struct l2cap_conn_rsp {
160/* channel indentifier */ 163/* channel indentifier */
161#define L2CAP_CID_SIGNALING 0x0001 164#define L2CAP_CID_SIGNALING 0x0001
162#define L2CAP_CID_CONN_LESS 0x0002 165#define L2CAP_CID_CONN_LESS 0x0002
166#define L2CAP_CID_LE_DATA 0x0004
167#define L2CAP_CID_LE_SIGNALING 0x0005
168#define L2CAP_CID_SMP 0x0006
163#define L2CAP_CID_DYN_START 0x0040 169#define L2CAP_CID_DYN_START 0x0040
164#define L2CAP_CID_DYN_END 0xffff 170#define L2CAP_CID_DYN_END 0xffff
165 171
@@ -255,6 +261,21 @@ struct l2cap_info_rsp {
255#define L2CAP_IR_SUCCESS 0x0000 261#define L2CAP_IR_SUCCESS 0x0000
256#define L2CAP_IR_NOTSUPP 0x0001 262#define L2CAP_IR_NOTSUPP 0x0001
257 263
264struct l2cap_conn_param_update_req {
265 __le16 min;
266 __le16 max;
267 __le16 latency;
268 __le16 to_multiplier;
269} __packed;
270
271struct l2cap_conn_param_update_rsp {
272 __le16 result;
273} __packed;
274
275/* Connection Parameters result */
276#define L2CAP_CONN_PARAM_ACCEPTED 0x0000
277#define L2CAP_CONN_PARAM_REJECTED 0x0001
278
258/* ----- L2CAP connections ----- */ 279/* ----- L2CAP connections ----- */
259struct l2cap_chan_list { 280struct l2cap_chan_list {
260 struct sock *head; 281 struct sock *head;
@@ -455,6 +476,4 @@ void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err);
455void l2cap_chan_del(struct sock *sk, int err); 476void l2cap_chan_del(struct sock *sk, int err);
456int l2cap_do_connect(struct sock *sk); 477int l2cap_do_connect(struct sock *sk);
457 478
458void l2cap_load(void);
459
460#endif /* __L2CAP_H */ 479#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
new file mode 100644
index 000000000000..8f2edbf979dc
--- /dev/null
+++ b/include/net/bluetooth/smp.h
@@ -0,0 +1,76 @@
1#ifndef __SMP_H
2#define __SMP_H
3
4struct smp_command_hdr {
5 __u8 code;
6} __packed;
7
8#define SMP_CMD_PAIRING_REQ 0x01
9#define SMP_CMD_PAIRING_RSP 0x02
10struct smp_cmd_pairing {
11 __u8 io_capability;
12 __u8 oob_flag;
13 __u8 auth_req;
14 __u8 max_key_size;
15 __u8 init_key_dist;
16 __u8 resp_key_dist;
17} __packed;
18
19#define SMP_CMD_PAIRING_CONFIRM 0x03
20struct smp_cmd_pairing_confirm {
21 __u8 confirm_val[16];
22} __packed;
23
24#define SMP_CMD_PAIRING_RANDOM 0x04
25struct smp_cmd_pairing_random {
26 __u8 rand_val[16];
27} __packed;
28
29#define SMP_CMD_PAIRING_FAIL 0x05
30struct smp_cmd_pairing_fail {
31 __u8 reason;
32} __packed;
33
34#define SMP_CMD_ENCRYPT_INFO 0x06
35struct smp_cmd_encrypt_info {
36 __u8 ltk[16];
37} __packed;
38
39#define SMP_CMD_MASTER_IDENT 0x07
40struct smp_cmd_master_ident {
41 __u16 ediv;
42 __u8 rand[8];
43} __packed;
44
45#define SMP_CMD_IDENT_INFO 0x08
46struct smp_cmd_ident_info {
47 __u8 irk[16];
48} __packed;
49
50#define SMP_CMD_IDENT_ADDR_INFO 0x09
51struct smp_cmd_ident_addr_info {
52 __u8 addr_type;
53 bdaddr_t bdaddr;
54} __packed;
55
56#define SMP_CMD_SIGN_INFO 0x0a
57struct smp_cmd_sign_info {
58 __u8 csrk[16];
59} __packed;
60
61#define SMP_CMD_SECURITY_REQ 0x0b
62struct smp_cmd_security_req {
63 __u8 auth_req;
64} __packed;
65
66#define SMP_PASSKEY_ENTRY_FAILED 0x01
67#define SMP_OOB_NOT_AVAIL 0x02
68#define SMP_AUTH_REQUIREMENTS 0x03
69#define SMP_CONFIRM_FAILED 0x04
70#define SMP_PAIRING_NOTSUPP 0x05
71#define SMP_ENC_KEY_SIZE 0x06
72#define SMP_CMD_NOTSUPP 0x07
73#define SMP_UNSPECIFIED 0x08
74#define SMP_REPEATED_ATTEMPTS 0x09
75
76#endif /* __SMP_H */
diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
index e45eae66eaf3..c6f9c2fb4891 100644
--- a/net/bluetooth/Kconfig
+++ b/net/bluetooth/Kconfig
@@ -32,7 +32,7 @@ menuconfig BT
32 more information, see <http://www.bluez.org/>. 32 more information, see <http://www.bluez.org/>.
33 33
34config BT_L2CAP 34config BT_L2CAP
35 tristate "L2CAP protocol support" 35 bool "L2CAP protocol support"
36 depends on BT 36 depends on BT
37 select CRC16 37 select CRC16
38 help 38 help
@@ -40,19 +40,13 @@ config BT_L2CAP
40 connection oriented and connection-less data transport. L2CAP 40 connection oriented and connection-less data transport. L2CAP
41 support is required for most Bluetooth applications. 41 support is required for most Bluetooth applications.
42 42
43 Say Y here to compile L2CAP support into the kernel or say M to
44 compile it as module (l2cap).
45
46config BT_SCO 43config BT_SCO
47 tristate "SCO links support" 44 bool "SCO links support"
48 depends on BT 45 depends on BT
49 help 46 help
50 SCO link provides voice transport over Bluetooth. SCO support is 47 SCO link provides voice transport over Bluetooth. SCO support is
51 required for voice applications like Headset and Audio. 48 required for voice applications like Headset and Audio.
52 49
53 Say Y here to compile SCO support into the kernel or say M to
54 compile it as module (sco).
55
56source "net/bluetooth/rfcomm/Kconfig" 50source "net/bluetooth/rfcomm/Kconfig"
57 51
58source "net/bluetooth/bnep/Kconfig" 52source "net/bluetooth/bnep/Kconfig"
diff --git a/net/bluetooth/Makefile b/net/bluetooth/Makefile
index 339b42932b33..f04fe9a9d634 100644
--- a/net/bluetooth/Makefile
+++ b/net/bluetooth/Makefile
@@ -3,12 +3,11 @@
3# 3#
4 4
5obj-$(CONFIG_BT) += bluetooth.o 5obj-$(CONFIG_BT) += bluetooth.o
6obj-$(CONFIG_BT_L2CAP) += l2cap.o
7obj-$(CONFIG_BT_SCO) += sco.o
8obj-$(CONFIG_BT_RFCOMM) += rfcomm/ 6obj-$(CONFIG_BT_RFCOMM) += rfcomm/
9obj-$(CONFIG_BT_BNEP) += bnep/ 7obj-$(CONFIG_BT_BNEP) += bnep/
10obj-$(CONFIG_BT_CMTP) += cmtp/ 8obj-$(CONFIG_BT_CMTP) += cmtp/
11obj-$(CONFIG_BT_HIDP) += hidp/ 9obj-$(CONFIG_BT_HIDP) += hidp/
12 10
13bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o hci_sock.o hci_sysfs.o lib.o 11bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o hci_sock.o hci_sysfs.o lib.o
14l2cap-y := l2cap_core.o l2cap_sock.o 12bluetooth-$(CONFIG_BT_L2CAP) += l2cap_core.o l2cap_sock.o
13bluetooth-$(CONFIG_BT_SCO) += sco.o
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 2abfe2f30453..88af9eb9aa48 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -40,7 +40,7 @@
40 40
41#include <net/bluetooth/bluetooth.h> 41#include <net/bluetooth/bluetooth.h>
42 42
43#define VERSION "2.15" 43#define VERSION "2.16"
44 44
45/* Bluetooth sockets */ 45/* Bluetooth sockets */
46#define BT_MAX_PROTO 8 46#define BT_MAX_PROTO 8
@@ -397,7 +397,7 @@ static inline unsigned int bt_accept_poll(struct sock *parent)
397 return 0; 397 return 0;
398} 398}
399 399
400unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait) 400unsigned int bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait)
401{ 401{
402 struct sock *sk = sock->sk; 402 struct sock *sk = sock->sk;
403 unsigned int mask = 0; 403 unsigned int mask = 0;
@@ -545,13 +545,41 @@ static int __init bt_init(void)
545 545
546 BT_INFO("HCI device and connection manager initialized"); 546 BT_INFO("HCI device and connection manager initialized");
547 547
548 hci_sock_init(); 548 err = hci_sock_init();
549 if (err < 0)
550 goto error;
551
552 err = l2cap_init();
553 if (err < 0) {
554 hci_sock_cleanup();
555 goto sock_err;
556 }
557
558 err = sco_init();
559 if (err < 0) {
560 l2cap_exit();
561 goto sock_err;
562 }
549 563
550 return 0; 564 return 0;
565
566sock_err:
567 hci_sock_cleanup();
568
569error:
570 sock_unregister(PF_BLUETOOTH);
571 bt_sysfs_cleanup();
572
573 return err;
551} 574}
552 575
553static void __exit bt_exit(void) 576static void __exit bt_exit(void)
554{ 577{
578
579 sco_exit();
580
581 l2cap_exit();
582
555 hci_sock_cleanup(); 583 hci_sock_cleanup();
556 584
557 sock_unregister(PF_BLUETOOTH); 585 sock_unregister(PF_BLUETOOTH);
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 5868597534e5..03d4d1245d58 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -708,8 +708,6 @@ static int __init bnep_init(void)
708{ 708{
709 char flt[50] = ""; 709 char flt[50] = "";
710 710
711 l2cap_load();
712
713#ifdef CONFIG_BT_BNEP_PROTO_FILTER 711#ifdef CONFIG_BT_BNEP_PROTO_FILTER
714 strcat(flt, "protocol "); 712 strcat(flt, "protocol ");
715#endif 713#endif
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index 2862f53b66b1..d935da71ab3b 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -88,6 +88,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
88 sockfd_put(nsock); 88 sockfd_put(nsock);
89 return -EBADFD; 89 return -EBADFD;
90 } 90 }
91 ca.device[sizeof(ca.device)-1] = 0;
91 92
92 err = bnep_add_connection(&ca, nsock); 93 err = bnep_add_connection(&ca, nsock);
93 if (!err) { 94 if (!err) {
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index 2cee71a714c4..964ea9126f9f 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -469,8 +469,6 @@ int cmtp_get_conninfo(struct cmtp_conninfo *ci)
469 469
470static int __init cmtp_init(void) 470static int __init cmtp_init(void)
471{ 471{
472 l2cap_load();
473
474 BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); 472 BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION);
475 473
476 cmtp_init_sockets(); 474 cmtp_init_sockets();
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 42dc39f25b72..a050a6984901 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -45,6 +45,33 @@
45#include <net/bluetooth/bluetooth.h> 45#include <net/bluetooth/bluetooth.h>
46#include <net/bluetooth/hci_core.h> 46#include <net/bluetooth/hci_core.h>
47 47
48static void hci_le_connect(struct hci_conn *conn)
49{
50 struct hci_dev *hdev = conn->hdev;
51 struct hci_cp_le_create_conn cp;
52
53 conn->state = BT_CONNECT;
54 conn->out = 1;
55 conn->link_mode |= HCI_LM_MASTER;
56
57 memset(&cp, 0, sizeof(cp));
58 cp.scan_interval = cpu_to_le16(0x0004);
59 cp.scan_window = cpu_to_le16(0x0004);
60 bacpy(&cp.peer_addr, &conn->dst);
61 cp.conn_interval_min = cpu_to_le16(0x0008);
62 cp.conn_interval_max = cpu_to_le16(0x0100);
63 cp.supervision_timeout = cpu_to_le16(0x0064);
64 cp.min_ce_len = cpu_to_le16(0x0001);
65 cp.max_ce_len = cpu_to_le16(0x0001);
66
67 hci_send_cmd(hdev, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp);
68}
69
70static void hci_le_connect_cancel(struct hci_conn *conn)
71{
72 hci_send_cmd(conn->hdev, HCI_OP_LE_CREATE_CONN_CANCEL, 0, NULL);
73}
74
48void hci_acl_connect(struct hci_conn *conn) 75void hci_acl_connect(struct hci_conn *conn)
49{ 76{
50 struct hci_dev *hdev = conn->hdev; 77 struct hci_dev *hdev = conn->hdev;
@@ -156,6 +183,26 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle)
156 hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); 183 hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp);
157} 184}
158 185
186void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
187 u16 latency, u16 to_multiplier)
188{
189 struct hci_cp_le_conn_update cp;
190 struct hci_dev *hdev = conn->hdev;
191
192 memset(&cp, 0, sizeof(cp));
193
194 cp.handle = cpu_to_le16(conn->handle);
195 cp.conn_interval_min = cpu_to_le16(min);
196 cp.conn_interval_max = cpu_to_le16(max);
197 cp.conn_latency = cpu_to_le16(latency);
198 cp.supervision_timeout = cpu_to_le16(to_multiplier);
199 cp.min_ce_len = cpu_to_le16(0x0001);
200 cp.max_ce_len = cpu_to_le16(0x0001);
201
202 hci_send_cmd(hdev, HCI_OP_LE_CONN_UPDATE, sizeof(cp), &cp);
203}
204EXPORT_SYMBOL(hci_le_conn_update);
205
159/* Device _must_ be locked */ 206/* Device _must_ be locked */
160void hci_sco_setup(struct hci_conn *conn, __u8 status) 207void hci_sco_setup(struct hci_conn *conn, __u8 status)
161{ 208{
@@ -193,8 +240,12 @@ static void hci_conn_timeout(unsigned long arg)
193 switch (conn->state) { 240 switch (conn->state) {
194 case BT_CONNECT: 241 case BT_CONNECT:
195 case BT_CONNECT2: 242 case BT_CONNECT2:
196 if (conn->type == ACL_LINK && conn->out) 243 if (conn->out) {
197 hci_acl_connect_cancel(conn); 244 if (conn->type == ACL_LINK)
245 hci_acl_connect_cancel(conn);
246 else if (conn->type == LE_LINK)
247 hci_le_connect_cancel(conn);
248 }
198 break; 249 break;
199 case BT_CONFIG: 250 case BT_CONFIG:
200 case BT_CONNECTED: 251 case BT_CONNECTED:
@@ -296,6 +347,11 @@ int hci_conn_del(struct hci_conn *conn)
296 347
297 /* Unacked frames */ 348 /* Unacked frames */
298 hdev->acl_cnt += conn->sent; 349 hdev->acl_cnt += conn->sent;
350 } else if (conn->type == LE_LINK) {
351 if (hdev->le_pkts)
352 hdev->le_cnt += conn->sent;
353 else
354 hdev->acl_cnt += conn->sent;
299 } else { 355 } else {
300 struct hci_conn *acl = conn->link; 356 struct hci_conn *acl = conn->link;
301 if (acl) { 357 if (acl) {
@@ -361,15 +417,30 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
361} 417}
362EXPORT_SYMBOL(hci_get_route); 418EXPORT_SYMBOL(hci_get_route);
363 419
364/* Create SCO or ACL connection. 420/* Create SCO, ACL or LE connection.
365 * Device _must_ be locked */ 421 * Device _must_ be locked */
366struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type) 422struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type)
367{ 423{
368 struct hci_conn *acl; 424 struct hci_conn *acl;
369 struct hci_conn *sco; 425 struct hci_conn *sco;
426 struct hci_conn *le;
370 427
371 BT_DBG("%s dst %s", hdev->name, batostr(dst)); 428 BT_DBG("%s dst %s", hdev->name, batostr(dst));
372 429
430 if (type == LE_LINK) {
431 le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
432 if (!le)
433 le = hci_conn_add(hdev, LE_LINK, dst);
434 if (!le)
435 return NULL;
436 if (le->state == BT_OPEN)
437 hci_le_connect(le);
438
439 hci_conn_hold(le);
440
441 return le;
442 }
443
373 acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); 444 acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
374 if (!acl) { 445 if (!acl) {
375 acl = hci_conn_add(hdev, ACL_LINK, dst); 446 acl = hci_conn_add(hdev, ACL_LINK, dst);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2f003224d2ea..b372fb8bcdcf 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -41,6 +41,7 @@
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/notifier.h> 42#include <linux/notifier.h>
43#include <linux/rfkill.h> 43#include <linux/rfkill.h>
44#include <linux/timer.h>
44#include <net/sock.h> 45#include <net/sock.h>
45 46
46#include <asm/system.h> 47#include <asm/system.h>
@@ -123,7 +124,7 @@ static void hci_req_cancel(struct hci_dev *hdev, int err)
123 124
124/* Execute request and wait for completion. */ 125/* Execute request and wait for completion. */
125static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt), 126static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt),
126 unsigned long opt, __u32 timeout) 127 unsigned long opt, __u32 timeout)
127{ 128{
128 DECLARE_WAITQUEUE(wait, current); 129 DECLARE_WAITQUEUE(wait, current);
129 int err = 0; 130 int err = 0;
@@ -165,7 +166,7 @@ static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev,
165} 166}
166 167
167static inline int hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt), 168static inline int hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt),
168 unsigned long opt, __u32 timeout) 169 unsigned long opt, __u32 timeout)
169{ 170{
170 int ret; 171 int ret;
171 172
@@ -263,6 +264,14 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
263 hci_send_cmd(hdev, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); 264 hci_send_cmd(hdev, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp);
264} 265}
265 266
267static void hci_le_init_req(struct hci_dev *hdev, unsigned long opt)
268{
269 BT_DBG("%s", hdev->name);
270
271 /* Read LE buffer size */
272 hci_send_cmd(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL);
273}
274
266static void hci_scan_req(struct hci_dev *hdev, unsigned long opt) 275static void hci_scan_req(struct hci_dev *hdev, unsigned long opt)
267{ 276{
268 __u8 scan = opt; 277 __u8 scan = opt;
@@ -456,7 +465,7 @@ int hci_inquiry(void __user *arg)
456 /* cache_dump can't sleep. Therefore we allocate temp buffer and then 465 /* cache_dump can't sleep. Therefore we allocate temp buffer and then
457 * copy it to the user space. 466 * copy it to the user space.
458 */ 467 */
459 buf = kmalloc(sizeof(struct inquiry_info) *max_rsp, GFP_KERNEL); 468 buf = kmalloc(sizeof(struct inquiry_info) * max_rsp, GFP_KERNEL);
460 if (!buf) { 469 if (!buf) {
461 err = -ENOMEM; 470 err = -ENOMEM;
462 goto done; 471 goto done;
@@ -525,10 +534,13 @@ int hci_dev_open(__u16 dev)
525 set_bit(HCI_INIT, &hdev->flags); 534 set_bit(HCI_INIT, &hdev->flags);
526 hdev->init_last_cmd = 0; 535 hdev->init_last_cmd = 0;
527 536
528 //__hci_request(hdev, hci_reset_req, 0, HZ);
529 ret = __hci_request(hdev, hci_init_req, 0, 537 ret = __hci_request(hdev, hci_init_req, 0,
530 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 538 msecs_to_jiffies(HCI_INIT_TIMEOUT));
531 539
540 if (lmp_le_capable(hdev))
541 ret = __hci_request(hdev, hci_le_init_req, 0,
542 msecs_to_jiffies(HCI_INIT_TIMEOUT));
543
532 clear_bit(HCI_INIT, &hdev->flags); 544 clear_bit(HCI_INIT, &hdev->flags);
533 } 545 }
534 546
@@ -611,6 +623,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
611 623
612 /* Drop last sent command */ 624 /* Drop last sent command */
613 if (hdev->sent_cmd) { 625 if (hdev->sent_cmd) {
626 del_timer_sync(&hdev->cmd_timer);
614 kfree_skb(hdev->sent_cmd); 627 kfree_skb(hdev->sent_cmd);
615 hdev->sent_cmd = NULL; 628 hdev->sent_cmd = NULL;
616 } 629 }
@@ -671,7 +684,7 @@ int hci_dev_reset(__u16 dev)
671 hdev->flush(hdev); 684 hdev->flush(hdev);
672 685
673 atomic_set(&hdev->cmd_cnt, 1); 686 atomic_set(&hdev->cmd_cnt, 1);
674 hdev->acl_cnt = 0; hdev->sco_cnt = 0; 687 hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0;
675 688
676 if (!test_bit(HCI_RAW, &hdev->flags)) 689 if (!test_bit(HCI_RAW, &hdev->flags))
677 ret = __hci_request(hdev, hci_reset_req, 0, 690 ret = __hci_request(hdev, hci_reset_req, 0,
@@ -1054,6 +1067,16 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
1054 return 0; 1067 return 0;
1055} 1068}
1056 1069
1070/* HCI command timer function */
1071static void hci_cmd_timer(unsigned long arg)
1072{
1073 struct hci_dev *hdev = (void *) arg;
1074
1075 BT_ERR("%s command tx timeout", hdev->name);
1076 atomic_set(&hdev->cmd_cnt, 1);
1077 tasklet_schedule(&hdev->cmd_task);
1078}
1079
1057/* Register HCI device */ 1080/* Register HCI device */
1058int hci_register_dev(struct hci_dev *hdev) 1081int hci_register_dev(struct hci_dev *hdev)
1059{ 1082{
@@ -1100,6 +1123,8 @@ int hci_register_dev(struct hci_dev *hdev)
1100 skb_queue_head_init(&hdev->cmd_q); 1123 skb_queue_head_init(&hdev->cmd_q);
1101 skb_queue_head_init(&hdev->raw_q); 1124 skb_queue_head_init(&hdev->raw_q);
1102 1125
1126 setup_timer(&hdev->cmd_timer, hci_cmd_timer, (unsigned long) hdev);
1127
1103 for (i = 0; i < NUM_REASSEMBLY; i++) 1128 for (i = 0; i < NUM_REASSEMBLY; i++)
1104 hdev->reassembly[i] = NULL; 1129 hdev->reassembly[i] = NULL;
1105 1130
@@ -1187,6 +1212,8 @@ int hci_unregister_dev(struct hci_dev *hdev)
1187 1212
1188 hci_unregister_sysfs(hdev); 1213 hci_unregister_sysfs(hdev);
1189 1214
1215 hci_del_off_timer(hdev);
1216
1190 destroy_workqueue(hdev->workqueue); 1217 destroy_workqueue(hdev->workqueue);
1191 1218
1192 hci_dev_lock_bh(hdev); 1219 hci_dev_lock_bh(hdev);
@@ -1672,8 +1699,25 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
1672 } 1699 }
1673 1700
1674 if (conn) { 1701 if (conn) {
1675 int cnt = (type == ACL_LINK ? hdev->acl_cnt : hdev->sco_cnt); 1702 int cnt, q;
1676 int q = cnt / num; 1703
1704 switch (conn->type) {
1705 case ACL_LINK:
1706 cnt = hdev->acl_cnt;
1707 break;
1708 case SCO_LINK:
1709 case ESCO_LINK:
1710 cnt = hdev->sco_cnt;
1711 break;
1712 case LE_LINK:
1713 cnt = hdev->le_mtu ? hdev->le_cnt : hdev->acl_cnt;
1714 break;
1715 default:
1716 cnt = 0;
1717 BT_ERR("Unknown link type");
1718 }
1719
1720 q = cnt / num;
1677 *quote = q ? q : 1; 1721 *quote = q ? q : 1;
1678 } else 1722 } else
1679 *quote = 0; 1723 *quote = 0;
@@ -1682,19 +1726,19 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
1682 return conn; 1726 return conn;
1683} 1727}
1684 1728
1685static inline void hci_acl_tx_to(struct hci_dev *hdev) 1729static inline void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
1686{ 1730{
1687 struct hci_conn_hash *h = &hdev->conn_hash; 1731 struct hci_conn_hash *h = &hdev->conn_hash;
1688 struct list_head *p; 1732 struct list_head *p;
1689 struct hci_conn *c; 1733 struct hci_conn *c;
1690 1734
1691 BT_ERR("%s ACL tx timeout", hdev->name); 1735 BT_ERR("%s link tx timeout", hdev->name);
1692 1736
1693 /* Kill stalled connections */ 1737 /* Kill stalled connections */
1694 list_for_each(p, &h->list) { 1738 list_for_each(p, &h->list) {
1695 c = list_entry(p, struct hci_conn, list); 1739 c = list_entry(p, struct hci_conn, list);
1696 if (c->type == ACL_LINK && c->sent) { 1740 if (c->type == type && c->sent) {
1697 BT_ERR("%s killing stalled ACL connection %s", 1741 BT_ERR("%s killing stalled connection %s",
1698 hdev->name, batostr(&c->dst)); 1742 hdev->name, batostr(&c->dst));
1699 hci_acl_disconn(c, 0x13); 1743 hci_acl_disconn(c, 0x13);
1700 } 1744 }
@@ -1713,7 +1757,7 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
1713 /* ACL tx timeout must be longer than maximum 1757 /* ACL tx timeout must be longer than maximum
1714 * link supervision timeout (40.9 seconds) */ 1758 * link supervision timeout (40.9 seconds) */
1715 if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45)) 1759 if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45))
1716 hci_acl_tx_to(hdev); 1760 hci_link_tx_to(hdev, ACL_LINK);
1717 } 1761 }
1718 1762
1719 while (hdev->acl_cnt && (conn = hci_low_sent(hdev, ACL_LINK, &quote))) { 1763 while (hdev->acl_cnt && (conn = hci_low_sent(hdev, ACL_LINK, &quote))) {
@@ -1772,6 +1816,40 @@ static inline void hci_sched_esco(struct hci_dev *hdev)
1772 } 1816 }
1773} 1817}
1774 1818
1819static inline void hci_sched_le(struct hci_dev *hdev)
1820{
1821 struct hci_conn *conn;
1822 struct sk_buff *skb;
1823 int quote, cnt;
1824
1825 BT_DBG("%s", hdev->name);
1826
1827 if (!test_bit(HCI_RAW, &hdev->flags)) {
1828 /* LE tx timeout must be longer than maximum
1829 * link supervision timeout (40.9 seconds) */
1830 if (!hdev->le_cnt && hdev->le_pkts &&
1831 time_after(jiffies, hdev->le_last_tx + HZ * 45))
1832 hci_link_tx_to(hdev, LE_LINK);
1833 }
1834
1835 cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt;
1836 while (cnt && (conn = hci_low_sent(hdev, LE_LINK, &quote))) {
1837 while (quote-- && (skb = skb_dequeue(&conn->data_q))) {
1838 BT_DBG("skb %p len %d", skb, skb->len);
1839
1840 hci_send_frame(skb);
1841 hdev->le_last_tx = jiffies;
1842
1843 cnt--;
1844 conn->sent++;
1845 }
1846 }
1847 if (hdev->le_pkts)
1848 hdev->le_cnt = cnt;
1849 else
1850 hdev->acl_cnt = cnt;
1851}
1852
1775static void hci_tx_task(unsigned long arg) 1853static void hci_tx_task(unsigned long arg)
1776{ 1854{
1777 struct hci_dev *hdev = (struct hci_dev *) arg; 1855 struct hci_dev *hdev = (struct hci_dev *) arg;
@@ -1779,7 +1857,8 @@ static void hci_tx_task(unsigned long arg)
1779 1857
1780 read_lock(&hci_task_lock); 1858 read_lock(&hci_task_lock);
1781 1859
1782 BT_DBG("%s acl %d sco %d", hdev->name, hdev->acl_cnt, hdev->sco_cnt); 1860 BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt,
1861 hdev->sco_cnt, hdev->le_cnt);
1783 1862
1784 /* Schedule queues and send stuff to HCI driver */ 1863 /* Schedule queues and send stuff to HCI driver */
1785 1864
@@ -1789,6 +1868,8 @@ static void hci_tx_task(unsigned long arg)
1789 1868
1790 hci_sched_esco(hdev); 1869 hci_sched_esco(hdev);
1791 1870
1871 hci_sched_le(hdev);
1872
1792 /* Send next queued raw (unknown type) packet */ 1873 /* Send next queued raw (unknown type) packet */
1793 while ((skb = skb_dequeue(&hdev->raw_q))) 1874 while ((skb = skb_dequeue(&hdev->raw_q)))
1794 hci_send_frame(skb); 1875 hci_send_frame(skb);
@@ -1936,11 +2017,6 @@ static void hci_cmd_task(unsigned long arg)
1936 2017
1937 BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt)); 2018 BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt));
1938 2019
1939 if (!atomic_read(&hdev->cmd_cnt) && time_after(jiffies, hdev->cmd_last_tx + HZ)) {
1940 BT_ERR("%s command tx timeout", hdev->name);
1941 atomic_set(&hdev->cmd_cnt, 1);
1942 }
1943
1944 /* Send queued commands */ 2020 /* Send queued commands */
1945 if (atomic_read(&hdev->cmd_cnt)) { 2021 if (atomic_read(&hdev->cmd_cnt)) {
1946 skb = skb_dequeue(&hdev->cmd_q); 2022 skb = skb_dequeue(&hdev->cmd_q);
@@ -1953,7 +2029,8 @@ static void hci_cmd_task(unsigned long arg)
1953 if (hdev->sent_cmd) { 2029 if (hdev->sent_cmd) {
1954 atomic_dec(&hdev->cmd_cnt); 2030 atomic_dec(&hdev->cmd_cnt);
1955 hci_send_frame(skb); 2031 hci_send_frame(skb);
1956 hdev->cmd_last_tx = jiffies; 2032 mod_timer(&hdev->cmd_timer,
2033 jiffies + msecs_to_jiffies(HCI_CMD_TIMEOUT));
1957 } else { 2034 } else {
1958 skb_queue_head(&hdev->cmd_q, skb); 2035 skb_queue_head(&hdev->cmd_q, skb);
1959 tasklet_schedule(&hdev->cmd_task); 2036 tasklet_schedule(&hdev->cmd_task);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index cee46cbe7aeb..98b5764e4315 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -776,6 +776,25 @@ static void hci_cc_pin_code_neg_reply(struct hci_dev *hdev, struct sk_buff *skb)
776 mgmt_pin_code_neg_reply_complete(hdev->id, &rp->bdaddr, 776 mgmt_pin_code_neg_reply_complete(hdev->id, &rp->bdaddr,
777 rp->status); 777 rp->status);
778} 778}
779static void hci_cc_le_read_buffer_size(struct hci_dev *hdev,
780 struct sk_buff *skb)
781{
782 struct hci_rp_le_read_buffer_size *rp = (void *) skb->data;
783
784 BT_DBG("%s status 0x%x", hdev->name, rp->status);
785
786 if (rp->status)
787 return;
788
789 hdev->le_mtu = __le16_to_cpu(rp->le_mtu);
790 hdev->le_pkts = rp->le_max_pkt;
791
792 hdev->le_cnt = hdev->le_pkts;
793
794 BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts);
795
796 hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status);
797}
779 798
780static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) 799static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
781{ 800{
@@ -919,7 +938,7 @@ static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status)
919} 938}
920 939
921static int hci_outgoing_auth_needed(struct hci_dev *hdev, 940static int hci_outgoing_auth_needed(struct hci_dev *hdev,
922 struct hci_conn *conn) 941 struct hci_conn *conn)
923{ 942{
924 if (conn->state != BT_CONFIG || !conn->out) 943 if (conn->state != BT_CONFIG || !conn->out)
925 return 0; 944 return 0;
@@ -1107,6 +1126,43 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status)
1107 hci_dev_unlock(hdev); 1126 hci_dev_unlock(hdev);
1108} 1127}
1109 1128
1129static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status)
1130{
1131 struct hci_cp_le_create_conn *cp;
1132 struct hci_conn *conn;
1133
1134 BT_DBG("%s status 0x%x", hdev->name, status);
1135
1136 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_CREATE_CONN);
1137 if (!cp)
1138 return;
1139
1140 hci_dev_lock(hdev);
1141
1142 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->peer_addr);
1143
1144 BT_DBG("%s bdaddr %s conn %p", hdev->name, batostr(&cp->peer_addr),
1145 conn);
1146
1147 if (status) {
1148 if (conn && conn->state == BT_CONNECT) {
1149 conn->state = BT_CLOSED;
1150 hci_proto_connect_cfm(conn, status);
1151 hci_conn_del(conn);
1152 }
1153 } else {
1154 if (!conn) {
1155 conn = hci_conn_add(hdev, LE_LINK, &cp->peer_addr);
1156 if (conn)
1157 conn->out = 1;
1158 else
1159 BT_ERR("No memory for new connection");
1160 }
1161 }
1162
1163 hci_dev_unlock(hdev);
1164}
1165
1110static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 1166static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1111{ 1167{
1112 __u8 status = *((__u8 *) skb->data); 1168 __u8 status = *((__u8 *) skb->data);
@@ -1237,7 +1293,8 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
1237 1293
1238 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); 1294 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type);
1239 1295
1240 if ((mask & HCI_LM_ACCEPT) && !hci_blacklist_lookup(hdev, &ev->bdaddr)) { 1296 if ((mask & HCI_LM_ACCEPT) &&
1297 !hci_blacklist_lookup(hdev, &ev->bdaddr)) {
1241 /* Connection accepted */ 1298 /* Connection accepted */
1242 struct inquiry_entry *ie; 1299 struct inquiry_entry *ie;
1243 struct hci_conn *conn; 1300 struct hci_conn *conn;
@@ -1667,11 +1724,18 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
1667 hci_cc_pin_code_neg_reply(hdev, skb); 1724 hci_cc_pin_code_neg_reply(hdev, skb);
1668 break; 1725 break;
1669 1726
1727 case HCI_OP_LE_READ_BUFFER_SIZE:
1728 hci_cc_le_read_buffer_size(hdev, skb);
1729 break;
1730
1670 default: 1731 default:
1671 BT_DBG("%s opcode 0x%x", hdev->name, opcode); 1732 BT_DBG("%s opcode 0x%x", hdev->name, opcode);
1672 break; 1733 break;
1673 } 1734 }
1674 1735
1736 if (ev->opcode != HCI_OP_NOP)
1737 del_timer(&hdev->cmd_timer);
1738
1675 if (ev->ncmd) { 1739 if (ev->ncmd) {
1676 atomic_set(&hdev->cmd_cnt, 1); 1740 atomic_set(&hdev->cmd_cnt, 1);
1677 if (!skb_queue_empty(&hdev->cmd_q)) 1741 if (!skb_queue_empty(&hdev->cmd_q))
@@ -1738,11 +1802,18 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
1738 mgmt_disconnect_failed(hdev->id); 1802 mgmt_disconnect_failed(hdev->id);
1739 break; 1803 break;
1740 1804
1805 case HCI_OP_LE_CREATE_CONN:
1806 hci_cs_le_create_conn(hdev, ev->status);
1807 break;
1808
1741 default: 1809 default:
1742 BT_DBG("%s opcode 0x%x", hdev->name, opcode); 1810 BT_DBG("%s opcode 0x%x", hdev->name, opcode);
1743 break; 1811 break;
1744 } 1812 }
1745 1813
1814 if (ev->opcode != HCI_OP_NOP)
1815 del_timer(&hdev->cmd_timer);
1816
1746 if (ev->ncmd) { 1817 if (ev->ncmd) {
1747 atomic_set(&hdev->cmd_cnt, 1); 1818 atomic_set(&hdev->cmd_cnt, 1);
1748 if (!skb_queue_empty(&hdev->cmd_q)) 1819 if (!skb_queue_empty(&hdev->cmd_q))
@@ -1808,6 +1879,16 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
1808 hdev->acl_cnt += count; 1879 hdev->acl_cnt += count;
1809 if (hdev->acl_cnt > hdev->acl_pkts) 1880 if (hdev->acl_cnt > hdev->acl_pkts)
1810 hdev->acl_cnt = hdev->acl_pkts; 1881 hdev->acl_cnt = hdev->acl_pkts;
1882 } else if (conn->type == LE_LINK) {
1883 if (hdev->le_pkts) {
1884 hdev->le_cnt += count;
1885 if (hdev->le_cnt > hdev->le_pkts)
1886 hdev->le_cnt = hdev->le_pkts;
1887 } else {
1888 hdev->acl_cnt += count;
1889 if (hdev->acl_cnt > hdev->acl_pkts)
1890 hdev->acl_cnt = hdev->acl_pkts;
1891 }
1811 } else { 1892 } else {
1812 hdev->sco_cnt += count; 1893 hdev->sco_cnt += count;
1813 if (hdev->sco_cnt > hdev->sco_pkts) 1894 if (hdev->sco_cnt > hdev->sco_pkts)
@@ -2021,7 +2102,8 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
2021 hci_dev_lock(hdev); 2102 hci_dev_lock(hdev);
2022 2103
2023 if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) { 2104 if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) {
2024 struct inquiry_info_with_rssi_and_pscan_mode *info = (void *) (skb->data + 1); 2105 struct inquiry_info_with_rssi_and_pscan_mode *info;
2106 info = (void *) (skb->data + 1);
2025 2107
2026 for (; num_rsp; num_rsp--) { 2108 for (; num_rsp; num_rsp--) {
2027 bacpy(&data.bdaddr, &info->bdaddr); 2109 bacpy(&data.bdaddr, &info->bdaddr);
@@ -2162,17 +2244,8 @@ static inline void hci_sync_conn_changed_evt(struct hci_dev *hdev, struct sk_buf
2162static inline void hci_sniff_subrate_evt(struct hci_dev *hdev, struct sk_buff *skb) 2244static inline void hci_sniff_subrate_evt(struct hci_dev *hdev, struct sk_buff *skb)
2163{ 2245{
2164 struct hci_ev_sniff_subrate *ev = (void *) skb->data; 2246 struct hci_ev_sniff_subrate *ev = (void *) skb->data;
2165 struct hci_conn *conn;
2166 2247
2167 BT_DBG("%s status %d", hdev->name, ev->status); 2248 BT_DBG("%s status %d", hdev->name, ev->status);
2168
2169 hci_dev_lock(hdev);
2170
2171 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
2172 if (conn) {
2173 }
2174
2175 hci_dev_unlock(hdev);
2176} 2249}
2177 2250
2178static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) 2251static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
@@ -2190,12 +2263,12 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
2190 2263
2191 for (; num_rsp; num_rsp--) { 2264 for (; num_rsp; num_rsp--) {
2192 bacpy(&data.bdaddr, &info->bdaddr); 2265 bacpy(&data.bdaddr, &info->bdaddr);
2193 data.pscan_rep_mode = info->pscan_rep_mode; 2266 data.pscan_rep_mode = info->pscan_rep_mode;
2194 data.pscan_period_mode = info->pscan_period_mode; 2267 data.pscan_period_mode = info->pscan_period_mode;
2195 data.pscan_mode = 0x00; 2268 data.pscan_mode = 0x00;
2196 memcpy(data.dev_class, info->dev_class, 3); 2269 memcpy(data.dev_class, info->dev_class, 3);
2197 data.clock_offset = info->clock_offset; 2270 data.clock_offset = info->clock_offset;
2198 data.rssi = info->rssi; 2271 data.rssi = info->rssi;
2199 data.ssp_mode = 0x01; 2272 data.ssp_mode = 0x01;
2200 info++; 2273 info++;
2201 hci_inquiry_cache_update(hdev, &data); 2274 hci_inquiry_cache_update(hdev, &data);
@@ -2321,6 +2394,60 @@ static inline void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_
2321 hci_dev_unlock(hdev); 2394 hci_dev_unlock(hdev);
2322} 2395}
2323 2396
2397static inline void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2398{
2399 struct hci_ev_le_conn_complete *ev = (void *) skb->data;
2400 struct hci_conn *conn;
2401
2402 BT_DBG("%s status %d", hdev->name, ev->status);
2403
2404 hci_dev_lock(hdev);
2405
2406 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &ev->bdaddr);
2407 if (!conn) {
2408 conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr);
2409 if (!conn) {
2410 BT_ERR("No memory for new connection");
2411 hci_dev_unlock(hdev);
2412 return;
2413 }
2414 }
2415
2416 if (ev->status) {
2417 hci_proto_connect_cfm(conn, ev->status);
2418 conn->state = BT_CLOSED;
2419 hci_conn_del(conn);
2420 goto unlock;
2421 }
2422
2423 conn->handle = __le16_to_cpu(ev->handle);
2424 conn->state = BT_CONNECTED;
2425
2426 hci_conn_hold_device(conn);
2427 hci_conn_add_sysfs(conn);
2428
2429 hci_proto_connect_cfm(conn, ev->status);
2430
2431unlock:
2432 hci_dev_unlock(hdev);
2433}
2434
2435static inline void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb)
2436{
2437 struct hci_ev_le_meta *le_ev = (void *) skb->data;
2438
2439 skb_pull(skb, sizeof(*le_ev));
2440
2441 switch (le_ev->subevent) {
2442 case HCI_EV_LE_CONN_COMPLETE:
2443 hci_le_conn_complete_evt(hdev, skb);
2444 break;
2445
2446 default:
2447 break;
2448 }
2449}
2450
2324void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) 2451void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
2325{ 2452{
2326 struct hci_event_hdr *hdr = (void *) skb->data; 2453 struct hci_event_hdr *hdr = (void *) skb->data;
@@ -2461,6 +2588,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
2461 hci_remote_host_features_evt(hdev, skb); 2588 hci_remote_host_features_evt(hdev, skb);
2462 break; 2589 break;
2463 2590
2591 case HCI_EV_LE_META:
2592 hci_le_meta_evt(hdev, skb);
2593 break;
2594
2464 default: 2595 default:
2465 BT_DBG("%s event 0x%x", hdev->name, event); 2596 BT_DBG("%s event 0x%x", hdev->name, event);
2466 break; 2597 break;
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 23471dd9ee2f..3c838a65a75a 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -11,7 +11,7 @@
11 11
12static struct class *bt_class; 12static struct class *bt_class;
13 13
14struct dentry *bt_debugfs = NULL; 14struct dentry *bt_debugfs;
15EXPORT_SYMBOL_GPL(bt_debugfs); 15EXPORT_SYMBOL_GPL(bt_debugfs);
16 16
17static inline char *link_typetostr(int type) 17static inline char *link_typetostr(int type)
@@ -51,8 +51,8 @@ static ssize_t show_link_features(struct device *dev, struct device_attribute *a
51 conn->features[6], conn->features[7]); 51 conn->features[6], conn->features[7]);
52} 52}
53 53
54#define LINK_ATTR(_name,_mode,_show,_store) \ 54#define LINK_ATTR(_name, _mode, _show, _store) \
55struct device_attribute link_attr_##_name = __ATTR(_name,_mode,_show,_store) 55struct device_attribute link_attr_##_name = __ATTR(_name, _mode, _show, _store)
56 56
57static LINK_ATTR(type, S_IRUGO, show_link_type, NULL); 57static LINK_ATTR(type, S_IRUGO, show_link_type, NULL);
58static LINK_ATTR(address, S_IRUGO, show_link_address, NULL); 58static LINK_ATTR(address, S_IRUGO, show_link_address, NULL);
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index e0de92952f32..2429ca2d7b06 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -1019,8 +1019,6 @@ static int __init hidp_init(void)
1019{ 1019{
1020 int ret; 1020 int ret;
1021 1021
1022 l2cap_load();
1023
1024 BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION); 1022 BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION);
1025 1023
1026 ret = hid_register_driver(&hidp_driver); 1024 ret = hid_register_driver(&hidp_driver);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index ba7f9da68998..efcef0dc1259 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -55,8 +55,6 @@
55#include <net/bluetooth/hci_core.h> 55#include <net/bluetooth/hci_core.h>
56#include <net/bluetooth/l2cap.h> 56#include <net/bluetooth/l2cap.h>
57 57
58#define VERSION "2.15"
59
60int disable_ertm; 58int disable_ertm;
61 59
62static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; 60static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
@@ -183,8 +181,16 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so
183 l2cap_pi(sk)->conn = conn; 181 l2cap_pi(sk)->conn = conn;
184 182
185 if (sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM) { 183 if (sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM) {
186 /* Alloc CID for connection-oriented socket */ 184 if (conn->hcon->type == LE_LINK) {
187 l2cap_pi(sk)->scid = l2cap_alloc_cid(l); 185 /* LE connection */
186 l2cap_pi(sk)->omtu = L2CAP_LE_DEFAULT_MTU;
187 l2cap_pi(sk)->scid = L2CAP_CID_LE_DATA;
188 l2cap_pi(sk)->dcid = L2CAP_CID_LE_DATA;
189 } else {
190 /* Alloc CID for connection-oriented socket */
191 l2cap_pi(sk)->scid = l2cap_alloc_cid(l);
192 l2cap_pi(sk)->omtu = L2CAP_DEFAULT_MTU;
193 }
188 } else if (sk->sk_type == SOCK_DGRAM) { 194 } else if (sk->sk_type == SOCK_DGRAM) {
189 /* Connectionless socket */ 195 /* Connectionless socket */
190 l2cap_pi(sk)->scid = L2CAP_CID_CONN_LESS; 196 l2cap_pi(sk)->scid = L2CAP_CID_CONN_LESS;
@@ -583,6 +589,82 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
583 } 589 }
584} 590}
585 591
592/* Find socket with cid and source bdaddr.
593 * Returns closest match, locked.
594 */
595static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src)
596{
597 struct sock *s, *sk = NULL, *sk1 = NULL;
598 struct hlist_node *node;
599
600 read_lock(&l2cap_sk_list.lock);
601
602 sk_for_each(sk, node, &l2cap_sk_list.head) {
603 if (state && sk->sk_state != state)
604 continue;
605
606 if (l2cap_pi(sk)->scid == cid) {
607 /* Exact match. */
608 if (!bacmp(&bt_sk(sk)->src, src))
609 break;
610
611 /* Closest match */
612 if (!bacmp(&bt_sk(sk)->src, BDADDR_ANY))
613 sk1 = sk;
614 }
615 }
616 s = node ? sk : sk1;
617 if (s)
618 bh_lock_sock(s);
619 read_unlock(&l2cap_sk_list.lock);
620
621 return s;
622}
623
624static void l2cap_le_conn_ready(struct l2cap_conn *conn)
625{
626 struct l2cap_chan_list *list = &conn->chan_list;
627 struct sock *parent, *uninitialized_var(sk);
628
629 BT_DBG("");
630
631 /* Check if we have socket listening on cid */
632 parent = l2cap_get_sock_by_scid(BT_LISTEN, L2CAP_CID_LE_DATA,
633 conn->src);
634 if (!parent)
635 return;
636
637 /* Check for backlog size */
638 if (sk_acceptq_is_full(parent)) {
639 BT_DBG("backlog full %d", parent->sk_ack_backlog);
640 goto clean;
641 }
642
643 sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, GFP_ATOMIC);
644 if (!sk)
645 goto clean;
646
647 write_lock_bh(&list->lock);
648
649 hci_conn_hold(conn->hcon);
650
651 l2cap_sock_init(sk, parent);
652 bacpy(&bt_sk(sk)->src, conn->src);
653 bacpy(&bt_sk(sk)->dst, conn->dst);
654
655 __l2cap_chan_add(conn, sk, parent);
656
657 l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
658
659 sk->sk_state = BT_CONNECTED;
660 parent->sk_data_ready(parent, 0);
661
662 write_unlock_bh(&list->lock);
663
664clean:
665 bh_unlock_sock(parent);
666}
667
586static void l2cap_conn_ready(struct l2cap_conn *conn) 668static void l2cap_conn_ready(struct l2cap_conn *conn)
587{ 669{
588 struct l2cap_chan_list *l = &conn->chan_list; 670 struct l2cap_chan_list *l = &conn->chan_list;
@@ -590,11 +672,20 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
590 672
591 BT_DBG("conn %p", conn); 673 BT_DBG("conn %p", conn);
592 674
675 if (!conn->hcon->out && conn->hcon->type == LE_LINK)
676 l2cap_le_conn_ready(conn);
677
593 read_lock(&l->lock); 678 read_lock(&l->lock);
594 679
595 for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { 680 for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) {
596 bh_lock_sock(sk); 681 bh_lock_sock(sk);
597 682
683 if (conn->hcon->type == LE_LINK) {
684 l2cap_sock_clear_timer(sk);
685 sk->sk_state = BT_CONNECTED;
686 sk->sk_state_change(sk);
687 }
688
598 if (sk->sk_type != SOCK_SEQPACKET && 689 if (sk->sk_type != SOCK_SEQPACKET &&
599 sk->sk_type != SOCK_STREAM) { 690 sk->sk_type != SOCK_STREAM) {
600 l2cap_sock_clear_timer(sk); 691 l2cap_sock_clear_timer(sk);
@@ -653,7 +744,11 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
653 744
654 BT_DBG("hcon %p conn %p", hcon, conn); 745 BT_DBG("hcon %p conn %p", hcon, conn);
655 746
656 conn->mtu = hcon->hdev->acl_mtu; 747 if (hcon->hdev->le_mtu && hcon->type == LE_LINK)
748 conn->mtu = hcon->hdev->le_mtu;
749 else
750 conn->mtu = hcon->hdev->acl_mtu;
751
657 conn->src = &hcon->hdev->bdaddr; 752 conn->src = &hcon->hdev->bdaddr;
658 conn->dst = &hcon->dst; 753 conn->dst = &hcon->dst;
659 754
@@ -662,7 +757,8 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
662 spin_lock_init(&conn->lock); 757 spin_lock_init(&conn->lock);
663 rwlock_init(&conn->chan_list.lock); 758 rwlock_init(&conn->chan_list.lock);
664 759
665 setup_timer(&conn->info_timer, l2cap_info_timeout, 760 if (hcon->type != LE_LINK)
761 setup_timer(&conn->info_timer, l2cap_info_timeout,
666 (unsigned long) conn); 762 (unsigned long) conn);
667 763
668 conn->disc_reason = 0x13; 764 conn->disc_reason = 0x13;
@@ -760,8 +856,13 @@ int l2cap_do_connect(struct sock *sk)
760 856
761 auth_type = l2cap_get_auth_type(sk); 857 auth_type = l2cap_get_auth_type(sk);
762 858
763 hcon = hci_connect(hdev, ACL_LINK, dst, 859 if (l2cap_pi(sk)->dcid == L2CAP_CID_LE_DATA)
860 hcon = hci_connect(hdev, LE_LINK, dst,
764 l2cap_pi(sk)->sec_level, auth_type); 861 l2cap_pi(sk)->sec_level, auth_type);
862 else
863 hcon = hci_connect(hdev, ACL_LINK, dst,
864 l2cap_pi(sk)->sec_level, auth_type);
865
765 if (!hcon) 866 if (!hcon)
766 goto done; 867 goto done;
767 868
@@ -1327,7 +1428,11 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
1327 1428
1328 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); 1429 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
1329 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); 1430 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen);
1330 lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING); 1431
1432 if (conn->hcon->type == LE_LINK)
1433 lh->cid = cpu_to_le16(L2CAP_CID_LE_SIGNALING);
1434 else
1435 lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING);
1331 1436
1332 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); 1437 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE);
1333 cmd->code = code; 1438 cmd->code = code;
@@ -1566,10 +1671,6 @@ done:
1566 break; 1671 break;
1567 } 1672 }
1568 1673
1569 /* FIXME: Need actual value of the flush timeout */
1570 //if (flush_to != L2CAP_DEFAULT_FLUSH_TO)
1571 // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to);
1572
1573 req->dcid = cpu_to_le16(pi->dcid); 1674 req->dcid = cpu_to_le16(pi->dcid);
1574 req->flags = cpu_to_le16(0); 1675 req->flags = cpu_to_le16(0);
1575 1676
@@ -2396,12 +2497,153 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
2396 return 0; 2497 return 0;
2397} 2498}
2398 2499
2399static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb) 2500static inline int l2cap_check_conn_param(u16 min, u16 max, u16 latency,
2501 u16 to_multiplier)
2502{
2503 u16 max_latency;
2504
2505 if (min > max || min < 6 || max > 3200)
2506 return -EINVAL;
2507
2508 if (to_multiplier < 10 || to_multiplier > 3200)
2509 return -EINVAL;
2510
2511 if (max >= to_multiplier * 8)
2512 return -EINVAL;
2513
2514 max_latency = (to_multiplier * 8 / max) - 1;
2515 if (latency > 499 || latency > max_latency)
2516 return -EINVAL;
2517
2518 return 0;
2519}
2520
2521static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
2522 struct l2cap_cmd_hdr *cmd, u8 *data)
2523{
2524 struct hci_conn *hcon = conn->hcon;
2525 struct l2cap_conn_param_update_req *req;
2526 struct l2cap_conn_param_update_rsp rsp;
2527 u16 min, max, latency, to_multiplier, cmd_len;
2528 int err;
2529
2530 if (!(hcon->link_mode & HCI_LM_MASTER))
2531 return -EINVAL;
2532
2533 cmd_len = __le16_to_cpu(cmd->len);
2534 if (cmd_len != sizeof(struct l2cap_conn_param_update_req))
2535 return -EPROTO;
2536
2537 req = (struct l2cap_conn_param_update_req *) data;
2538 min = __le16_to_cpu(req->min);
2539 max = __le16_to_cpu(req->max);
2540 latency = __le16_to_cpu(req->latency);
2541 to_multiplier = __le16_to_cpu(req->to_multiplier);
2542
2543 BT_DBG("min 0x%4.4x max 0x%4.4x latency: 0x%4.4x Timeout: 0x%4.4x",
2544 min, max, latency, to_multiplier);
2545
2546 memset(&rsp, 0, sizeof(rsp));
2547
2548 err = l2cap_check_conn_param(min, max, latency, to_multiplier);
2549 if (err)
2550 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
2551 else
2552 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_ACCEPTED);
2553
2554 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_PARAM_UPDATE_RSP,
2555 sizeof(rsp), &rsp);
2556
2557 if (!err)
2558 hci_le_conn_update(hcon, min, max, latency, to_multiplier);
2559
2560 return 0;
2561}
2562
2563static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
2564 struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
2565{
2566 int err = 0;
2567
2568 switch (cmd->code) {
2569 case L2CAP_COMMAND_REJ:
2570 l2cap_command_rej(conn, cmd, data);
2571 break;
2572
2573 case L2CAP_CONN_REQ:
2574 err = l2cap_connect_req(conn, cmd, data);
2575 break;
2576
2577 case L2CAP_CONN_RSP:
2578 err = l2cap_connect_rsp(conn, cmd, data);
2579 break;
2580
2581 case L2CAP_CONF_REQ:
2582 err = l2cap_config_req(conn, cmd, cmd_len, data);
2583 break;
2584
2585 case L2CAP_CONF_RSP:
2586 err = l2cap_config_rsp(conn, cmd, data);
2587 break;
2588
2589 case L2CAP_DISCONN_REQ:
2590 err = l2cap_disconnect_req(conn, cmd, data);
2591 break;
2592
2593 case L2CAP_DISCONN_RSP:
2594 err = l2cap_disconnect_rsp(conn, cmd, data);
2595 break;
2596
2597 case L2CAP_ECHO_REQ:
2598 l2cap_send_cmd(conn, cmd->ident, L2CAP_ECHO_RSP, cmd_len, data);
2599 break;
2600
2601 case L2CAP_ECHO_RSP:
2602 break;
2603
2604 case L2CAP_INFO_REQ:
2605 err = l2cap_information_req(conn, cmd, data);
2606 break;
2607
2608 case L2CAP_INFO_RSP:
2609 err = l2cap_information_rsp(conn, cmd, data);
2610 break;
2611
2612 default:
2613 BT_ERR("Unknown BR/EDR signaling command 0x%2.2x", cmd->code);
2614 err = -EINVAL;
2615 break;
2616 }
2617
2618 return err;
2619}
2620
2621static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn,
2622 struct l2cap_cmd_hdr *cmd, u8 *data)
2623{
2624 switch (cmd->code) {
2625 case L2CAP_COMMAND_REJ:
2626 return 0;
2627
2628 case L2CAP_CONN_PARAM_UPDATE_REQ:
2629 return l2cap_conn_param_update_req(conn, cmd, data);
2630
2631 case L2CAP_CONN_PARAM_UPDATE_RSP:
2632 return 0;
2633
2634 default:
2635 BT_ERR("Unknown LE signaling command 0x%2.2x", cmd->code);
2636 return -EINVAL;
2637 }
2638}
2639
2640static inline void l2cap_sig_channel(struct l2cap_conn *conn,
2641 struct sk_buff *skb)
2400{ 2642{
2401 u8 *data = skb->data; 2643 u8 *data = skb->data;
2402 int len = skb->len; 2644 int len = skb->len;
2403 struct l2cap_cmd_hdr cmd; 2645 struct l2cap_cmd_hdr cmd;
2404 int err = 0; 2646 int err;
2405 2647
2406 l2cap_raw_recv(conn, skb); 2648 l2cap_raw_recv(conn, skb);
2407 2649
@@ -2420,55 +2662,10 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
2420 break; 2662 break;
2421 } 2663 }
2422 2664
2423 switch (cmd.code) { 2665 if (conn->hcon->type == LE_LINK)
2424 case L2CAP_COMMAND_REJ: 2666 err = l2cap_le_sig_cmd(conn, &cmd, data);
2425 l2cap_command_rej(conn, &cmd, data); 2667 else
2426 break; 2668 err = l2cap_bredr_sig_cmd(conn, &cmd, cmd_len, data);
2427
2428 case L2CAP_CONN_REQ:
2429 err = l2cap_connect_req(conn, &cmd, data);
2430 break;
2431
2432 case L2CAP_CONN_RSP:
2433 err = l2cap_connect_rsp(conn, &cmd, data);
2434 break;
2435
2436 case L2CAP_CONF_REQ:
2437 err = l2cap_config_req(conn, &cmd, cmd_len, data);
2438 break;
2439
2440 case L2CAP_CONF_RSP:
2441 err = l2cap_config_rsp(conn, &cmd, data);
2442 break;
2443
2444 case L2CAP_DISCONN_REQ:
2445 err = l2cap_disconnect_req(conn, &cmd, data);
2446 break;
2447
2448 case L2CAP_DISCONN_RSP:
2449 err = l2cap_disconnect_rsp(conn, &cmd, data);
2450 break;
2451
2452 case L2CAP_ECHO_REQ:
2453 l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd_len, data);
2454 break;
2455
2456 case L2CAP_ECHO_RSP:
2457 break;
2458
2459 case L2CAP_INFO_REQ:
2460 err = l2cap_information_req(conn, &cmd, data);
2461 break;
2462
2463 case L2CAP_INFO_RSP:
2464 err = l2cap_information_rsp(conn, &cmd, data);
2465 break;
2466
2467 default:
2468 BT_ERR("Unknown signaling command 0x%2.2x", cmd.code);
2469 err = -EINVAL;
2470 break;
2471 }
2472 2669
2473 if (err) { 2670 if (err) {
2474 struct l2cap_cmd_rej rej; 2671 struct l2cap_cmd_rej rej;
@@ -3465,6 +3662,7 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
3465 BT_DBG("len %d, cid 0x%4.4x", len, cid); 3662 BT_DBG("len %d, cid 0x%4.4x", len, cid);
3466 3663
3467 switch (cid) { 3664 switch (cid) {
3665 case L2CAP_CID_LE_SIGNALING:
3468 case L2CAP_CID_SIGNALING: 3666 case L2CAP_CID_SIGNALING:
3469 l2cap_sig_channel(conn, skb); 3667 l2cap_sig_channel(conn, skb);
3470 break; 3668 break;
@@ -3522,7 +3720,7 @@ static int l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
3522 3720
3523 BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); 3721 BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
3524 3722
3525 if (hcon->type != ACL_LINK) 3723 if (!(hcon->type == ACL_LINK || hcon->type == LE_LINK))
3526 return -EINVAL; 3724 return -EINVAL;
3527 3725
3528 if (!status) { 3726 if (!status) {
@@ -3551,7 +3749,7 @@ static int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason)
3551{ 3749{
3552 BT_DBG("hcon %p reason %d", hcon, reason); 3750 BT_DBG("hcon %p reason %d", hcon, reason);
3553 3751
3554 if (hcon->type != ACL_LINK) 3752 if (!(hcon->type == ACL_LINK || hcon->type == LE_LINK))
3555 return -EINVAL; 3753 return -EINVAL;
3556 3754
3557 l2cap_conn_del(hcon, bt_err(reason)); 3755 l2cap_conn_del(hcon, bt_err(reason));
@@ -3768,12 +3966,13 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
3768 sk_for_each(sk, node, &l2cap_sk_list.head) { 3966 sk_for_each(sk, node, &l2cap_sk_list.head) {
3769 struct l2cap_pinfo *pi = l2cap_pi(sk); 3967 struct l2cap_pinfo *pi = l2cap_pi(sk);
3770 3968
3771 seq_printf(f, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", 3969 seq_printf(f, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d %d\n",
3772 batostr(&bt_sk(sk)->src), 3970 batostr(&bt_sk(sk)->src),
3773 batostr(&bt_sk(sk)->dst), 3971 batostr(&bt_sk(sk)->dst),
3774 sk->sk_state, __le16_to_cpu(pi->psm), 3972 sk->sk_state, __le16_to_cpu(pi->psm),
3775 pi->scid, pi->dcid, 3973 pi->scid, pi->dcid,
3776 pi->imtu, pi->omtu, pi->sec_level); 3974 pi->imtu, pi->omtu, pi->sec_level,
3975 pi->mode);
3777 } 3976 }
3778 3977
3779 read_unlock_bh(&l2cap_sk_list.lock); 3978 read_unlock_bh(&l2cap_sk_list.lock);
@@ -3806,7 +4005,7 @@ static struct hci_proto l2cap_hci_proto = {
3806 .recv_acldata = l2cap_recv_acldata 4005 .recv_acldata = l2cap_recv_acldata
3807}; 4006};
3808 4007
3809static int __init l2cap_init(void) 4008int __init l2cap_init(void)
3810{ 4009{
3811 int err; 4010 int err;
3812 4011
@@ -3834,7 +4033,6 @@ static int __init l2cap_init(void)
3834 BT_ERR("Failed to create L2CAP debug file"); 4033 BT_ERR("Failed to create L2CAP debug file");
3835 } 4034 }
3836 4035
3837 BT_INFO("L2CAP ver %s", VERSION);
3838 BT_INFO("L2CAP socket layer initialized"); 4036 BT_INFO("L2CAP socket layer initialized");
3839 4037
3840 return 0; 4038 return 0;
@@ -3845,7 +4043,7 @@ error:
3845 return err; 4043 return err;
3846} 4044}
3847 4045
3848static void __exit l2cap_exit(void) 4046void l2cap_exit(void)
3849{ 4047{
3850 debugfs_remove(l2cap_debugfs); 4048 debugfs_remove(l2cap_debugfs);
3851 4049
@@ -3858,22 +4056,5 @@ static void __exit l2cap_exit(void)
3858 l2cap_cleanup_sockets(); 4056 l2cap_cleanup_sockets();
3859} 4057}
3860 4058
3861void l2cap_load(void)
3862{
3863 /* Dummy function to trigger automatic L2CAP module loading by
3864 * other modules that use L2CAP sockets but don't use any other
3865 * symbols from it. */
3866}
3867EXPORT_SYMBOL(l2cap_load);
3868
3869module_init(l2cap_init);
3870module_exit(l2cap_exit);
3871
3872module_param(disable_ertm, bool, 0644); 4059module_param(disable_ertm, bool, 0644);
3873MODULE_PARM_DESC(disable_ertm, "Disable enhanced retransmission mode"); 4060MODULE_PARM_DESC(disable_ertm, "Disable enhanced retransmission mode");
3874
3875MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
3876MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION);
3877MODULE_VERSION(VERSION);
3878MODULE_LICENSE("GPL");
3879MODULE_ALIAS("bt-proto-0");
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index adf41692daf3..fc85e7ae33c7 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -103,7 +103,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
103 len = min_t(unsigned int, sizeof(la), alen); 103 len = min_t(unsigned int, sizeof(la), alen);
104 memcpy(&la, addr, len); 104 memcpy(&la, addr, len);
105 105
106 if (la.l2_cid) 106 if (la.l2_cid && la.l2_psm)
107 return -EINVAL; 107 return -EINVAL;
108 108
109 lock_sock(sk); 109 lock_sock(sk);
@@ -145,6 +145,9 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
145 l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; 145 l2cap_pi(sk)->sec_level = BT_SECURITY_SDP;
146 } 146 }
147 147
148 if (la.l2_cid)
149 l2cap_pi(sk)->scid = la.l2_cid;
150
148 write_unlock_bh(&l2cap_sk_list.lock); 151 write_unlock_bh(&l2cap_sk_list.lock);
149 152
150done: 153done:
@@ -168,13 +171,13 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
168 len = min_t(unsigned int, sizeof(la), alen); 171 len = min_t(unsigned int, sizeof(la), alen);
169 memcpy(&la, addr, len); 172 memcpy(&la, addr, len);
170 173
171 if (la.l2_cid) 174 if (la.l2_cid && la.l2_psm)
172 return -EINVAL; 175 return -EINVAL;
173 176
174 lock_sock(sk); 177 lock_sock(sk);
175 178
176 if ((sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM) 179 if ((sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM)
177 && !la.l2_psm) { 180 && !(la.l2_psm || la.l2_cid)) {
178 err = -EINVAL; 181 err = -EINVAL;
179 goto done; 182 goto done;
180 } 183 }
@@ -216,7 +219,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
216 219
217 /* PSM must be odd and lsb of upper byte must be 0 */ 220 /* PSM must be odd and lsb of upper byte must be 0 */
218 if ((__le16_to_cpu(la.l2_psm) & 0x0101) != 0x0001 && 221 if ((__le16_to_cpu(la.l2_psm) & 0x0101) != 0x0001 &&
219 sk->sk_type != SOCK_RAW) { 222 sk->sk_type != SOCK_RAW && !la.l2_cid) {
220 err = -EINVAL; 223 err = -EINVAL;
221 goto done; 224 goto done;
222 } 225 }
@@ -224,6 +227,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
224 /* Set destination address and psm */ 227 /* Set destination address and psm */
225 bacpy(&bt_sk(sk)->dst, &la.l2_bdaddr); 228 bacpy(&bt_sk(sk)->dst, &la.l2_bdaddr);
226 l2cap_pi(sk)->psm = la.l2_psm; 229 l2cap_pi(sk)->psm = la.l2_psm;
230 l2cap_pi(sk)->dcid = la.l2_cid;
227 231
228 err = l2cap_do_connect(sk); 232 err = l2cap_do_connect(sk);
229 if (err) 233 if (err)
@@ -265,7 +269,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
265 goto done; 269 goto done;
266 } 270 }
267 271
268 if (!l2cap_pi(sk)->psm) { 272 if (!l2cap_pi(sk)->psm && !l2cap_pi(sk)->dcid) {
269 bdaddr_t *src = &bt_sk(sk)->src; 273 bdaddr_t *src = &bt_sk(sk)->src;
270 u16 psm; 274 u16 psm;
271 275
@@ -392,6 +396,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
392 396
393 switch (optname) { 397 switch (optname) {
394 case L2CAP_OPTIONS: 398 case L2CAP_OPTIONS:
399 memset(&opts, 0, sizeof(opts));
395 opts.imtu = l2cap_pi(sk)->imtu; 400 opts.imtu = l2cap_pi(sk)->imtu;
396 opts.omtu = l2cap_pi(sk)->omtu; 401 opts.omtu = l2cap_pi(sk)->omtu;
397 opts.flush_to = l2cap_pi(sk)->flush_to; 402 opts.flush_to = l2cap_pi(sk)->flush_to;
@@ -880,6 +885,8 @@ static void l2cap_sock_cleanup_listen(struct sock *parent)
880 885
881void __l2cap_sock_close(struct sock *sk, int reason) 886void __l2cap_sock_close(struct sock *sk, int reason)
882{ 887{
888 struct l2cap_conn *conn = l2cap_pi(sk)->conn;
889
883 BT_DBG("sk %p state %d socket %p", sk, sk->sk_state, sk->sk_socket); 890 BT_DBG("sk %p state %d socket %p", sk, sk->sk_state, sk->sk_socket);
884 891
885 switch (sk->sk_state) { 892 switch (sk->sk_state) {
@@ -889,10 +896,9 @@ void __l2cap_sock_close(struct sock *sk, int reason)
889 896
890 case BT_CONNECTED: 897 case BT_CONNECTED:
891 case BT_CONFIG: 898 case BT_CONFIG:
892 if (sk->sk_type == SOCK_SEQPACKET || 899 if ((sk->sk_type == SOCK_SEQPACKET ||
893 sk->sk_type == SOCK_STREAM) { 900 sk->sk_type == SOCK_STREAM) &&
894 struct l2cap_conn *conn = l2cap_pi(sk)->conn; 901 conn->hcon->type == ACL_LINK) {
895
896 l2cap_sock_set_timer(sk, sk->sk_sndtimeo); 902 l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
897 l2cap_send_disconn_req(conn, sk, reason); 903 l2cap_send_disconn_req(conn, sk, reason);
898 } else 904 } else
@@ -900,9 +906,9 @@ void __l2cap_sock_close(struct sock *sk, int reason)
900 break; 906 break;
901 907
902 case BT_CONNECT2: 908 case BT_CONNECT2:
903 if (sk->sk_type == SOCK_SEQPACKET || 909 if ((sk->sk_type == SOCK_SEQPACKET ||
904 sk->sk_type == SOCK_STREAM) { 910 sk->sk_type == SOCK_STREAM) &&
905 struct l2cap_conn *conn = l2cap_pi(sk)->conn; 911 conn->hcon->type == ACL_LINK) {
906 struct l2cap_conn_rsp rsp; 912 struct l2cap_conn_rsp rsp;
907 __u16 result; 913 __u16 result;
908 914
@@ -1121,30 +1127,30 @@ static const struct net_proto_family l2cap_sock_family_ops = {
1121 1127
1122int __init l2cap_init_sockets(void) 1128int __init l2cap_init_sockets(void)
1123{ 1129{
1124 int err; 1130 int err;
1125 1131
1126 err = proto_register(&l2cap_proto, 0); 1132 err = proto_register(&l2cap_proto, 0);
1127 if (err < 0) 1133 if (err < 0)
1128 return err; 1134 return err;
1129 1135
1130 err = bt_sock_register(BTPROTO_L2CAP, &l2cap_sock_family_ops); 1136 err = bt_sock_register(BTPROTO_L2CAP, &l2cap_sock_family_ops);
1131 if (err < 0) 1137 if (err < 0)
1132 goto error; 1138 goto error;
1133 1139
1134 BT_INFO("L2CAP socket layer initialized"); 1140 BT_INFO("L2CAP socket layer initialized");
1135 1141
1136 return 0; 1142 return 0;
1137 1143
1138error: 1144error:
1139 BT_ERR("L2CAP socket registration failed"); 1145 BT_ERR("L2CAP socket registration failed");
1140 proto_unregister(&l2cap_proto); 1146 proto_unregister(&l2cap_proto);
1141 return err; 1147 return err;
1142} 1148}
1143 1149
1144void l2cap_cleanup_sockets(void) 1150void l2cap_cleanup_sockets(void)
1145{ 1151{
1146 if (bt_sock_unregister(BTPROTO_L2CAP) < 0) 1152 if (bt_sock_unregister(BTPROTO_L2CAP) < 0)
1147 BT_ERR("L2CAP socket unregistration failed"); 1153 BT_ERR("L2CAP socket unregistration failed");
1148 1154
1149 proto_unregister(&l2cap_proto); 1155 proto_unregister(&l2cap_proto);
1150} 1156}
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index b2bda83050a4..f5ef7a3374c7 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -22,7 +22,7 @@
22 22
23/* Bluetooth HCI Management interface */ 23/* Bluetooth HCI Management interface */
24 24
25#include <asm/uaccess.h> 25#include <linux/uaccess.h>
26#include <asm/unaligned.h> 26#include <asm/unaligned.h>
27 27
28#include <net/bluetooth/bluetooth.h> 28#include <net/bluetooth/bluetooth.h>
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 6b83776534fb..c9973932456f 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2154,8 +2154,6 @@ static int __init rfcomm_init(void)
2154{ 2154{
2155 int err; 2155 int err;
2156 2156
2157 l2cap_load();
2158
2159 hci_register_cb(&rfcomm_cb); 2157 hci_register_cb(&rfcomm_cb);
2160 2158
2161 rfcomm_thread = kthread_run(rfcomm_run, NULL, "krfcommd"); 2159 rfcomm_thread = kthread_run(rfcomm_run, NULL, "krfcommd");
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 960c6d1637da..c9348ddda877 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -50,8 +50,6 @@
50#include <net/bluetooth/hci_core.h> 50#include <net/bluetooth/hci_core.h>
51#include <net/bluetooth/sco.h> 51#include <net/bluetooth/sco.h>
52 52
53#define VERSION "0.6"
54
55static int disable_esco; 53static int disable_esco;
56 54
57static const struct proto_ops sco_sock_ops; 55static const struct proto_ops sco_sock_ops;
@@ -703,6 +701,7 @@ static int sco_sock_getsockopt_old(struct socket *sock, int optname, char __user
703 break; 701 break;
704 } 702 }
705 703
704 memset(&cinfo, 0, sizeof(cinfo));
706 cinfo.hci_handle = sco_pi(sk)->conn->hcon->handle; 705 cinfo.hci_handle = sco_pi(sk)->conn->hcon->handle;
707 memcpy(cinfo.dev_class, sco_pi(sk)->conn->hcon->dev_class, 3); 706 memcpy(cinfo.dev_class, sco_pi(sk)->conn->hcon->dev_class, 3);
708 707
@@ -1023,7 +1022,7 @@ static struct hci_proto sco_hci_proto = {
1023 .recv_scodata = sco_recv_scodata 1022 .recv_scodata = sco_recv_scodata
1024}; 1023};
1025 1024
1026static int __init sco_init(void) 1025int __init sco_init(void)
1027{ 1026{
1028 int err; 1027 int err;
1029 1028
@@ -1051,7 +1050,6 @@ static int __init sco_init(void)
1051 BT_ERR("Failed to create SCO debug file"); 1050 BT_ERR("Failed to create SCO debug file");
1052 } 1051 }
1053 1052
1054 BT_INFO("SCO (Voice Link) ver %s", VERSION);
1055 BT_INFO("SCO socket layer initialized"); 1053 BT_INFO("SCO socket layer initialized");
1056 1054
1057 return 0; 1055 return 0;
@@ -1061,7 +1059,7 @@ error:
1061 return err; 1059 return err;
1062} 1060}
1063 1061
1064static void __exit sco_exit(void) 1062void __exit sco_exit(void)
1065{ 1063{
1066 debugfs_remove(sco_debugfs); 1064 debugfs_remove(sco_debugfs);
1067 1065
@@ -1074,14 +1072,5 @@ static void __exit sco_exit(void)
1074 proto_unregister(&sco_proto); 1072 proto_unregister(&sco_proto);
1075} 1073}
1076 1074
1077module_init(sco_init);
1078module_exit(sco_exit);
1079
1080module_param(disable_esco, bool, 0644); 1075module_param(disable_esco, bool, 0644);
1081MODULE_PARM_DESC(disable_esco, "Disable eSCO connection creation"); 1076MODULE_PARM_DESC(disable_esco, "Disable eSCO connection creation");
1082
1083MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
1084MODULE_DESCRIPTION("Bluetooth SCO ver " VERSION);
1085MODULE_VERSION(VERSION);
1086MODULE_LICENSE("GPL");
1087MODULE_ALIAS("bt-proto-2");