diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-07-11 14:58:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-11 14:58:22 -0400 |
commit | 4b42c542afbc119c4012324ea80e0c5a89afea4f (patch) | |
tree | a67a788c7ba06cb40219b49505f84594dabc6f82 /include/net | |
parent | d8598981146241064993e371cea8333f59553cb6 (diff) | |
parent | e2fd318e3a9208245ee1041f6d413c8593fba29d (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6
Conflicts:
net/bluetooth/l2cap_core.c
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 12 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 18 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 29 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 25 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 2 | ||||
-rw-r--r-- | include/net/bluetooth/smp.h | 1 |
6 files changed, 75 insertions, 12 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 7bccaf921cab..e727555d4ee9 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -56,6 +56,7 @@ | |||
56 | #define BT_SECURITY 4 | 56 | #define BT_SECURITY 4 |
57 | struct bt_security { | 57 | struct bt_security { |
58 | __u8 level; | 58 | __u8 level; |
59 | __u8 key_size; | ||
59 | }; | 60 | }; |
60 | #define BT_SECURITY_SDP 0 | 61 | #define BT_SECURITY_SDP 0 |
61 | #define BT_SECURITY_LOW 1 | 62 | #define BT_SECURITY_LOW 1 |
@@ -76,9 +77,12 @@ struct bt_power { | |||
76 | #define BT_POWER_FORCE_ACTIVE_OFF 0 | 77 | #define BT_POWER_FORCE_ACTIVE_OFF 0 |
77 | #define BT_POWER_FORCE_ACTIVE_ON 1 | 78 | #define BT_POWER_FORCE_ACTIVE_ON 1 |
78 | 79 | ||
79 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) | 80 | __attribute__((format (printf, 2, 3))) |
80 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) | 81 | int bt_printk(const char *level, const char *fmt, ...); |
81 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) | 82 | |
83 | #define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) | ||
84 | #define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) | ||
85 | #define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) | ||
82 | 86 | ||
83 | /* Connection and socket states */ | 87 | /* Connection and socket states */ |
84 | enum { | 88 | enum { |
@@ -204,7 +208,7 @@ out: | |||
204 | return NULL; | 208 | return NULL; |
205 | } | 209 | } |
206 | 210 | ||
207 | int bt_err(__u16 code); | 211 | int bt_to_errno(__u16 code); |
208 | 212 | ||
209 | extern int hci_sock_init(void); | 213 | extern int hci_sock_init(void); |
210 | extern void hci_sock_cleanup(void); | 214 | extern void hci_sock_cleanup(void); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 65345cd215be..be30aabe7b88 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -211,11 +211,16 @@ enum { | |||
211 | #define LMP_EDR_3S_ESCO 0x80 | 211 | #define LMP_EDR_3S_ESCO 0x80 |
212 | 212 | ||
213 | #define LMP_EXT_INQ 0x01 | 213 | #define LMP_EXT_INQ 0x01 |
214 | #define LMP_SIMUL_LE_BR 0x02 | ||
214 | #define LMP_SIMPLE_PAIR 0x08 | 215 | #define LMP_SIMPLE_PAIR 0x08 |
215 | #define LMP_NO_FLUSH 0x40 | 216 | #define LMP_NO_FLUSH 0x40 |
216 | 217 | ||
217 | #define LMP_LSTO 0x01 | 218 | #define LMP_LSTO 0x01 |
218 | #define LMP_INQ_TX_PWR 0x02 | 219 | #define LMP_INQ_TX_PWR 0x02 |
220 | #define LMP_EXTFEATURES 0x80 | ||
221 | |||
222 | /* Extended LMP features */ | ||
223 | #define LMP_HOST_LE 0x02 | ||
219 | 224 | ||
220 | /* Connection modes */ | 225 | /* Connection modes */ |
221 | #define HCI_CM_ACTIVE 0x0000 | 226 | #define HCI_CM_ACTIVE 0x0000 |
@@ -254,6 +259,10 @@ enum { | |||
254 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | 259 | #define HCI_LK_UNAUTH_COMBINATION 0x04 |
255 | #define HCI_LK_AUTH_COMBINATION 0x05 | 260 | #define HCI_LK_AUTH_COMBINATION 0x05 |
256 | #define HCI_LK_CHANGED_COMBINATION 0x06 | 261 | #define HCI_LK_CHANGED_COMBINATION 0x06 |
262 | /* The spec doesn't define types for SMP keys */ | ||
263 | #define HCI_LK_SMP_LTK 0x81 | ||
264 | #define HCI_LK_SMP_IRK 0x82 | ||
265 | #define HCI_LK_SMP_CSRK 0x83 | ||
257 | 266 | ||
258 | /* ----- HCI Commands ---- */ | 267 | /* ----- HCI Commands ---- */ |
259 | #define HCI_OP_NOP 0x0000 | 268 | #define HCI_OP_NOP 0x0000 |
@@ -653,6 +662,12 @@ struct hci_rp_read_local_oob_data { | |||
653 | 662 | ||
654 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | 663 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 |
655 | 664 | ||
665 | #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d | ||
666 | struct hci_cp_write_le_host_supported { | ||
667 | __u8 le; | ||
668 | __u8 simul; | ||
669 | } __packed; | ||
670 | |||
656 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 671 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
657 | struct hci_rp_read_local_version { | 672 | struct hci_rp_read_local_version { |
658 | __u8 status; | 673 | __u8 status; |
@@ -676,6 +691,9 @@ struct hci_rp_read_local_features { | |||
676 | } __packed; | 691 | } __packed; |
677 | 692 | ||
678 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 | 693 | #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 |
694 | struct hci_cp_read_local_ext_features { | ||
695 | __u8 page; | ||
696 | } __packed; | ||
679 | struct hci_rp_read_local_ext_features { | 697 | struct hci_rp_read_local_ext_features { |
680 | __u8 status; | 698 | __u8 status; |
681 | __u8 page; | 699 | __u8 page; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 26233d4d371c..c41e275917c7 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -74,12 +74,28 @@ struct bt_uuid { | |||
74 | u8 svc_hint; | 74 | u8 svc_hint; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | struct key_master_id { | ||
78 | __le16 ediv; | ||
79 | u8 rand[8]; | ||
80 | } __packed; | ||
81 | |||
82 | struct link_key_data { | ||
83 | bdaddr_t bdaddr; | ||
84 | u8 type; | ||
85 | u8 val[16]; | ||
86 | u8 pin_len; | ||
87 | u8 dlen; | ||
88 | u8 data[0]; | ||
89 | } __packed; | ||
90 | |||
77 | struct link_key { | 91 | struct link_key { |
78 | struct list_head list; | 92 | struct list_head list; |
79 | bdaddr_t bdaddr; | 93 | bdaddr_t bdaddr; |
80 | u8 type; | 94 | u8 type; |
81 | u8 val[16]; | 95 | u8 val[16]; |
82 | u8 pin_len; | 96 | u8 pin_len; |
97 | u8 dlen; | ||
98 | u8 data[0]; | ||
83 | }; | 99 | }; |
84 | 100 | ||
85 | struct oob_data { | 101 | struct oob_data { |
@@ -113,6 +129,7 @@ struct hci_dev { | |||
113 | __u8 major_class; | 129 | __u8 major_class; |
114 | __u8 minor_class; | 130 | __u8 minor_class; |
115 | __u8 features[8]; | 131 | __u8 features[8]; |
132 | __u8 extfeatures[8]; | ||
116 | __u8 commands[64]; | 133 | __u8 commands[64]; |
117 | __u8 ssp_mode; | 134 | __u8 ssp_mode; |
118 | __u8 hci_ver; | 135 | __u8 hci_ver; |
@@ -223,7 +240,6 @@ struct hci_conn { | |||
223 | struct list_head list; | 240 | struct list_head list; |
224 | 241 | ||
225 | atomic_t refcnt; | 242 | atomic_t refcnt; |
226 | spinlock_t lock; | ||
227 | 243 | ||
228 | bdaddr_t dst; | 244 | bdaddr_t dst; |
229 | __u8 dst_type; | 245 | __u8 dst_type; |
@@ -245,11 +261,11 @@ struct hci_conn { | |||
245 | __u8 sec_level; | 261 | __u8 sec_level; |
246 | __u8 pending_sec_level; | 262 | __u8 pending_sec_level; |
247 | __u8 pin_length; | 263 | __u8 pin_length; |
264 | __u8 enc_key_size; | ||
248 | __u8 io_capability; | 265 | __u8 io_capability; |
249 | __u8 power_save; | 266 | __u8 power_save; |
250 | __u16 disc_timeout; | 267 | __u16 disc_timeout; |
251 | unsigned long pend; | 268 | unsigned long pend; |
252 | __u8 ltk[16]; | ||
253 | 269 | ||
254 | __u8 remote_cap; | 270 | __u8 remote_cap; |
255 | __u8 remote_oob; | 271 | __u8 remote_oob; |
@@ -272,7 +288,6 @@ struct hci_conn { | |||
272 | struct hci_dev *hdev; | 288 | struct hci_dev *hdev; |
273 | void *l2cap_data; | 289 | void *l2cap_data; |
274 | void *sco_data; | 290 | void *sco_data; |
275 | void *priv; | ||
276 | 291 | ||
277 | struct hci_conn *link; | 292 | struct hci_conn *link; |
278 | 293 | ||
@@ -538,6 +553,11 @@ int hci_link_keys_clear(struct hci_dev *hdev); | |||
538 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 553 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
539 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 554 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, |
540 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 555 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
556 | struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | ||
557 | struct link_key *hci_find_link_key_type(struct hci_dev *hdev, | ||
558 | bdaddr_t *bdaddr, u8 type); | ||
559 | int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | ||
560 | u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); | ||
541 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 561 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
542 | 562 | ||
543 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | 563 | int hci_remote_oob_data_clear(struct hci_dev *hdev); |
@@ -579,6 +599,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
579 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | 599 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) |
580 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | 600 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) |
581 | 601 | ||
602 | /* ----- Extended LMP capabilities ----- */ | ||
603 | #define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE) | ||
604 | |||
582 | /* ----- HCI protocols ----- */ | 605 | /* ----- HCI protocols ----- */ |
583 | struct hci_proto { | 606 | struct hci_proto { |
584 | char *name; | 607 | char *name; |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 9c18e555b6ed..4f34ad25e75c 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -37,7 +37,6 @@ | |||
37 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ | 37 | #define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ |
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 | ||
41 | #define L2CAP_LE_DEFAULT_MTU 23 | 40 | #define L2CAP_LE_DEFAULT_MTU 23 |
42 | 41 | ||
43 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 42 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
@@ -130,6 +129,12 @@ struct l2cap_conninfo { | |||
130 | #define L2CAP_SDU_END 0x8000 | 129 | #define L2CAP_SDU_END 0x8000 |
131 | #define L2CAP_SDU_CONTINUE 0xC000 | 130 | #define L2CAP_SDU_CONTINUE 0xC000 |
132 | 131 | ||
132 | /* L2CAP Command rej. reasons */ | ||
133 | #define L2CAP_REJ_NOT_UNDERSTOOD 0x0000 | ||
134 | #define L2CAP_REJ_MTU_EXCEEDED 0x0001 | ||
135 | #define L2CAP_REJ_INVALID_CID 0x0002 | ||
136 | |||
137 | |||
133 | /* L2CAP structures */ | 138 | /* L2CAP structures */ |
134 | struct l2cap_hdr { | 139 | struct l2cap_hdr { |
135 | __le16 len; | 140 | __le16 len; |
@@ -144,8 +149,19 @@ struct l2cap_cmd_hdr { | |||
144 | } __packed; | 149 | } __packed; |
145 | #define L2CAP_CMD_HDR_SIZE 4 | 150 | #define L2CAP_CMD_HDR_SIZE 4 |
146 | 151 | ||
147 | struct l2cap_cmd_rej { | 152 | struct l2cap_cmd_rej_unk { |
153 | __le16 reason; | ||
154 | } __packed; | ||
155 | |||
156 | struct l2cap_cmd_rej_mtu { | ||
148 | __le16 reason; | 157 | __le16 reason; |
158 | __le16 max_mtu; | ||
159 | } __packed; | ||
160 | |||
161 | struct l2cap_cmd_rej_cid { | ||
162 | __le16 reason; | ||
163 | __le16 scid; | ||
164 | __le16 dcid; | ||
149 | } __packed; | 165 | } __packed; |
150 | 166 | ||
151 | struct l2cap_conn_req { | 167 | struct l2cap_conn_req { |
@@ -352,8 +368,6 @@ struct l2cap_chan { | |||
352 | struct sk_buff *tx_send_head; | 368 | struct sk_buff *tx_send_head; |
353 | struct sk_buff_head tx_q; | 369 | struct sk_buff_head tx_q; |
354 | struct sk_buff_head srej_q; | 370 | struct sk_buff_head srej_q; |
355 | struct sk_buff_head busy_q; | ||
356 | struct work_struct busy_work; | ||
357 | struct list_head srej_l; | 371 | struct list_head srej_l; |
358 | 372 | ||
359 | struct list_head list; | 373 | struct list_head list; |
@@ -422,6 +436,7 @@ struct l2cap_conn { | |||
422 | struct l2cap_pinfo { | 436 | struct l2cap_pinfo { |
423 | struct bt_sock bt; | 437 | struct bt_sock bt; |
424 | struct l2cap_chan *chan; | 438 | struct l2cap_chan *chan; |
439 | struct sk_buff *rx_busy_skb; | ||
425 | }; | 440 | }; |
426 | 441 | ||
427 | enum { | 442 | enum { |
@@ -449,7 +464,6 @@ enum { | |||
449 | CONN_REJ_ACT, | 464 | CONN_REJ_ACT, |
450 | CONN_SEND_FBIT, | 465 | CONN_SEND_FBIT, |
451 | CONN_RNR_SENT, | 466 | CONN_RNR_SENT, |
452 | CONN_SAR_RETRY, | ||
453 | }; | 467 | }; |
454 | 468 | ||
455 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 469 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
@@ -498,5 +512,6 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason); | |||
498 | void l2cap_chan_destroy(struct l2cap_chan *chan); | 512 | void l2cap_chan_destroy(struct l2cap_chan *chan); |
499 | int l2cap_chan_connect(struct l2cap_chan *chan); | 513 | int l2cap_chan_connect(struct l2cap_chan *chan); |
500 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | 514 | int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); |
515 | void l2cap_chan_busy(struct l2cap_chan *chan, int busy); | ||
501 | 516 | ||
502 | #endif /* __L2CAP_H */ | 517 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 45bea25d737f..5428fd32ccec 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -101,6 +101,8 @@ struct mgmt_key_info { | |||
101 | u8 type; | 101 | u8 type; |
102 | u8 val[16]; | 102 | u8 val[16]; |
103 | u8 pin_len; | 103 | u8 pin_len; |
104 | u8 dlen; | ||
105 | u8 data[0]; | ||
104 | } __packed; | 106 | } __packed; |
105 | 107 | ||
106 | #define MGMT_OP_LOAD_KEYS 0x000D | 108 | #define MGMT_OP_LOAD_KEYS 0x000D |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index 4fb7d198a876..46c457612300 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
@@ -118,5 +118,6 @@ struct smp_cmd_security_req { | |||
118 | /* SMP Commands */ | 118 | /* SMP Commands */ |
119 | int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); | 119 | int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); |
120 | int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); | 120 | int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); |
121 | int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); | ||
121 | 122 | ||
122 | #endif /* __SMP_H */ | 123 | #endif /* __SMP_H */ |