aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-05-22 15:18:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-22 15:18:06 -0400
commita0d0d1685f9763ab26a394df3ab84026b39a06a7 (patch)
tree4165dc6fd3266977ab4b3fa3b379c47597f97d88 /include/net
parent31a67102f4762df5544bc2dfb34a931233d2a5b2 (diff)
parent05f8f25276ea8c7d41b3649890d6eaf179e67a81 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/bluetooth.h32
-rw-r--r--include/net/bluetooth/hci.h8
-rw-r--r--include/net/bluetooth/hci_core.h67
-rw-r--r--include/net/bluetooth/l2cap.h93
-rw-r--r--include/net/bluetooth/mgmt.h9
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--include/net/mac80211.h12
-rw-r--r--include/net/nfc/hci.h6
-rw-r--r--include/net/nfc/nfc.h19
-rw-r--r--include/net/nfc/shdlc.h2
11 files changed, 184 insertions, 72 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index a65910bda381..961669b648fd 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -163,6 +163,11 @@ typedef struct {
163 __u8 b[6]; 163 __u8 b[6];
164} __packed bdaddr_t; 164} __packed bdaddr_t;
165 165
166/* BD Address type */
167#define BDADDR_BREDR 0x00
168#define BDADDR_LE_PUBLIC 0x01
169#define BDADDR_LE_RANDOM 0x02
170
166#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) 171#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
167#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) 172#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
168 173
@@ -178,7 +183,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
178 183
179void baswap(bdaddr_t *dst, bdaddr_t *src); 184void baswap(bdaddr_t *dst, bdaddr_t *src);
180char *batostr(bdaddr_t *ba); 185char *batostr(bdaddr_t *ba);
181bdaddr_t *strtoba(char *str);
182 186
183/* Common socket structures and functions */ 187/* Common socket structures and functions */
184 188
@@ -190,8 +194,12 @@ struct bt_sock {
190 bdaddr_t dst; 194 bdaddr_t dst;
191 struct list_head accept_q; 195 struct list_head accept_q;
192 struct sock *parent; 196 struct sock *parent;
193 u32 defer_setup; 197 unsigned long flags;
194 bool suspended; 198};
199
200enum {
201 BT_SK_DEFER_SETUP,
202 BT_SK_SUSPEND,
195}; 203};
196 204
197struct bt_sock_list { 205struct bt_sock_list {
@@ -216,14 +224,24 @@ void bt_accept_unlink(struct sock *sk);
216struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); 224struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
217 225
218/* Skb helpers */ 226/* Skb helpers */
227struct l2cap_ctrl {
228 unsigned int sframe : 1,
229 poll : 1,
230 final : 1,
231 fcs : 1,
232 sar : 2,
233 super : 2;
234 __u16 reqseq;
235 __u16 txseq;
236 __u8 retries;
237};
238
219struct bt_skb_cb { 239struct bt_skb_cb {
220 __u8 pkt_type; 240 __u8 pkt_type;
221 __u8 incoming; 241 __u8 incoming;
222 __u16 expect; 242 __u16 expect;
223 __u16 tx_seq;
224 __u8 retries;
225 __u8 sar;
226 __u8 force_active; 243 __u8 force_active;
244 struct l2cap_ctrl control;
227}; 245};
228#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 246#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
229 247
@@ -243,12 +261,10 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
243{ 261{
244 struct sk_buff *skb; 262 struct sk_buff *skb;
245 263
246 release_sock(sk);
247 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { 264 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) {
248 skb_reserve(skb, BT_SKB_RESERVE); 265 skb_reserve(skb, BT_SKB_RESERVE);
249 bt_cb(skb)->incoming = 0; 266 bt_cb(skb)->incoming = 0;
250 } 267 }
251 lock_sock(sk);
252 268
253 if (!skb && *err) 269 if (!skb && *err)
254 return NULL; 270 return NULL;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index d47e523c9d83..66a7b579e31c 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -102,6 +102,7 @@ enum {
102 HCI_DISCOVERABLE, 102 HCI_DISCOVERABLE,
103 HCI_LINK_SECURITY, 103 HCI_LINK_SECURITY,
104 HCI_PENDING_CLASS, 104 HCI_PENDING_CLASS,
105 HCI_PERIODIC_INQ,
105}; 106};
106 107
107/* HCI ioctl defines */ 108/* HCI ioctl defines */
@@ -324,6 +325,8 @@ struct hci_cp_inquiry {
324 325
325#define HCI_OP_INQUIRY_CANCEL 0x0402 326#define HCI_OP_INQUIRY_CANCEL 0x0402
326 327
328#define HCI_OP_PERIODIC_INQ 0x0403
329
327#define HCI_OP_EXIT_PERIODIC_INQ 0x0404 330#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
328 331
329#define HCI_OP_CREATE_CONN 0x0405 332#define HCI_OP_CREATE_CONN 0x0405
@@ -717,6 +720,10 @@ struct hci_rp_read_local_oob_data {
717} __packed; 720} __packed;
718 721
719#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 722#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
723struct hci_rp_read_inq_rsp_tx_power {
724 __u8 status;
725 __s8 tx_power;
726} __packed;
720 727
721#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 728#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
722struct hci_rp_read_flow_control_mode { 729struct hci_rp_read_flow_control_mode {
@@ -1431,6 +1438,5 @@ struct hci_inquiry_req {
1431#define IREQ_CACHE_FLUSH 0x0001 1438#define IREQ_CACHE_FLUSH 0x0001
1432 1439
1433extern bool enable_hs; 1440extern bool enable_hs;
1434extern bool enable_le;
1435 1441
1436#endif /* __HCI_H */ 1442#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index db1c5df45224..9fc7728f94e4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -155,9 +155,14 @@ struct hci_dev {
155 __u16 hci_rev; 155 __u16 hci_rev;
156 __u8 lmp_ver; 156 __u8 lmp_ver;
157 __u16 manufacturer; 157 __u16 manufacturer;
158 __le16 lmp_subver; 158 __u16 lmp_subver;
159 __u16 voice_setting; 159 __u16 voice_setting;
160 __u8 io_capability; 160 __u8 io_capability;
161 __s8 inq_tx_power;
162 __u16 devid_source;
163 __u16 devid_vendor;
164 __u16 devid_product;
165 __u16 devid_version;
161 166
162 __u16 pkt_type; 167 __u16 pkt_type;
163 __u16 esco_type; 168 __u16 esco_type;
@@ -250,9 +255,6 @@ struct hci_dev {
250 255
251 struct list_head remote_oob_data; 256 struct list_head remote_oob_data;
252 257
253 struct list_head adv_entries;
254 struct delayed_work adv_work;
255
256 struct hci_dev_stats stat; 258 struct hci_dev_stats stat;
257 259
258 struct sk_buff_head driver_init; 260 struct sk_buff_head driver_init;
@@ -263,7 +265,6 @@ struct hci_dev {
263 265
264 struct dentry *debugfs; 266 struct dentry *debugfs;
265 267
266 struct device *parent;
267 struct device dev; 268 struct device dev;
268 269
269 struct rfkill *rfkill; 270 struct rfkill *rfkill;
@@ -571,7 +572,7 @@ int hci_chan_del(struct hci_chan *chan);
571void hci_chan_list_flush(struct hci_conn *conn); 572void hci_chan_list_flush(struct hci_conn *conn);
572 573
573struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 574struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
574 __u8 sec_level, __u8 auth_type); 575 __u8 dst_type, __u8 sec_level, __u8 auth_type);
575int hci_conn_check_link_mode(struct hci_conn *conn); 576int hci_conn_check_link_mode(struct hci_conn *conn);
576int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); 577int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
577int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); 578int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
@@ -673,8 +674,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
673 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 674 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
674struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 675struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]);
675int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, 676int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
676 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv, 677 int new_key, u8 authenticated, u8 tk[16], u8 enc_size,
677 u8 rand[8]); 678 __le16 ediv, u8 rand[8]);
678struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 679struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
679 u8 addr_type); 680 u8 addr_type);
680int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); 681int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr);
@@ -688,14 +689,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
688 u8 *randomizer); 689 u8 *randomizer);
689int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 690int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
690 691
691#define ADV_CLEAR_TIMEOUT (3*60*HZ) /* Three minutes */
692int hci_adv_entries_clear(struct hci_dev *hdev);
693struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr);
694int hci_add_adv_entry(struct hci_dev *hdev,
695 struct hci_ev_le_advertising_info *ev);
696
697void hci_del_off_timer(struct hci_dev *hdev);
698
699void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 692void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
700 693
701int hci_recv_frame(struct sk_buff *skb); 694int hci_recv_frame(struct sk_buff *skb);
@@ -709,7 +702,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn);
709void hci_conn_add_sysfs(struct hci_conn *conn); 702void hci_conn_add_sysfs(struct hci_conn *conn);
710void hci_conn_del_sysfs(struct hci_conn *conn); 703void hci_conn_del_sysfs(struct hci_conn *conn);
711 704
712#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) 705#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
713 706
714/* ----- LMP capabilities ----- */ 707/* ----- LMP capabilities ----- */
715#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) 708#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
@@ -933,6 +926,23 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
933 return false; 926 return false;
934} 927}
935 928
929static inline size_t eir_get_length(u8 *eir, size_t eir_len)
930{
931 size_t parsed = 0;
932
933 while (parsed < eir_len) {
934 u8 field_len = eir[0];
935
936 if (field_len == 0)
937 return parsed;
938
939 parsed += field_len + 1;
940 eir += field_len + 1;
941 }
942
943 return eir_len;
944}
945
936static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, 946static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
937 u8 data_len) 947 u8 data_len)
938{ 948{
@@ -961,17 +971,12 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
961void hci_sock_dev_event(struct hci_dev *hdev, int event); 971void hci_sock_dev_event(struct hci_dev *hdev, int event);
962 972
963/* Management interface */ 973/* Management interface */
964#define MGMT_ADDR_BREDR 0x00 974#define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR))
965#define MGMT_ADDR_LE_PUBLIC 0x01 975#define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \
966#define MGMT_ADDR_LE_RANDOM 0x02 976 BIT(BDADDR_LE_RANDOM))
967#define MGMT_ADDR_INVALID 0xff 977#define DISCOV_TYPE_INTERLEAVED (BIT(BDADDR_BREDR) | \
968 978 BIT(BDADDR_LE_PUBLIC) | \
969#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR)) 979 BIT(BDADDR_LE_RANDOM))
970#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
971 BIT(MGMT_ADDR_LE_RANDOM))
972#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
973 BIT(MGMT_ADDR_LE_PUBLIC) | \
974 BIT(MGMT_ADDR_LE_RANDOM))
975 980
976int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 981int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
977int mgmt_index_added(struct hci_dev *hdev); 982int mgmt_index_added(struct hci_dev *hdev);
@@ -1067,12 +1072,12 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1067 u16 latency, u16 to_multiplier); 1072 u16 latency, u16 to_multiplier);
1068void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1073void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1069 __u8 ltk[16]); 1074 __u8 ltk[16]);
1070void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]);
1071void hci_le_ltk_neg_reply(struct hci_conn *conn);
1072
1073int hci_do_inquiry(struct hci_dev *hdev, u8 length); 1075int hci_do_inquiry(struct hci_dev *hdev, u8 length);
1074int hci_cancel_inquiry(struct hci_dev *hdev); 1076int hci_cancel_inquiry(struct hci_dev *hdev);
1075int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, 1077int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1076 int timeout); 1078 int timeout);
1079int hci_cancel_le_scan(struct hci_dev *hdev);
1080
1081u8 bdaddr_to_le(u8 bdaddr_type);
1077 1082
1078#endif /* __HCI_CORE_H */ 1083#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 9b242c6bf55b..1c7d1cd5e679 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -44,6 +44,7 @@
44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF 44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF 46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
47#define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */
47 48
48#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) 49#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
49#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) 50#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
@@ -57,6 +58,7 @@ struct sockaddr_l2 {
57 __le16 l2_psm; 58 __le16 l2_psm;
58 bdaddr_t l2_bdaddr; 59 bdaddr_t l2_bdaddr;
59 __le16 l2_cid; 60 __le16 l2_cid;
61 __u8 l2_bdaddr_type;
60}; 62};
61 63
62/* L2CAP socket options */ 64/* L2CAP socket options */
@@ -139,6 +141,8 @@ struct l2cap_conninfo {
139 141
140#define L2CAP_CTRL_TXSEQ_SHIFT 1 142#define L2CAP_CTRL_TXSEQ_SHIFT 1
141#define L2CAP_CTRL_SUPER_SHIFT 2 143#define L2CAP_CTRL_SUPER_SHIFT 2
144#define L2CAP_CTRL_POLL_SHIFT 4
145#define L2CAP_CTRL_FINAL_SHIFT 7
142#define L2CAP_CTRL_REQSEQ_SHIFT 8 146#define L2CAP_CTRL_REQSEQ_SHIFT 8
143#define L2CAP_CTRL_SAR_SHIFT 14 147#define L2CAP_CTRL_SAR_SHIFT 14
144 148
@@ -152,9 +156,11 @@ struct l2cap_conninfo {
152#define L2CAP_EXT_CTRL_FINAL 0x00000002 156#define L2CAP_EXT_CTRL_FINAL 0x00000002
153#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */ 157#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */
154 158
159#define L2CAP_EXT_CTRL_FINAL_SHIFT 1
155#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2 160#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
156#define L2CAP_EXT_CTRL_SAR_SHIFT 16 161#define L2CAP_EXT_CTRL_SAR_SHIFT 16
157#define L2CAP_EXT_CTRL_SUPER_SHIFT 16 162#define L2CAP_EXT_CTRL_SUPER_SHIFT 16
163#define L2CAP_EXT_CTRL_POLL_SHIFT 18
158#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 164#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
159 165
160/* L2CAP Supervisory Function */ 166/* L2CAP Supervisory Function */
@@ -186,6 +192,8 @@ struct l2cap_hdr {
186#define L2CAP_FCS_SIZE 2 192#define L2CAP_FCS_SIZE 2
187#define L2CAP_SDULEN_SIZE 2 193#define L2CAP_SDULEN_SIZE 2
188#define L2CAP_PSMLEN_SIZE 2 194#define L2CAP_PSMLEN_SIZE 2
195#define L2CAP_ENH_CTRL_SIZE 2
196#define L2CAP_EXT_CTRL_SIZE 4
189 197
190struct l2cap_cmd_hdr { 198struct l2cap_cmd_hdr {
191 __u8 code; 199 __u8 code;
@@ -401,6 +409,16 @@ struct l2cap_conn_param_update_rsp {
401#define L2CAP_CONN_PARAM_REJECTED 0x0001 409#define L2CAP_CONN_PARAM_REJECTED 0x0001
402 410
403/* ----- L2CAP channels and connections ----- */ 411/* ----- L2CAP channels and connections ----- */
412struct l2cap_seq_list {
413 __u16 head;
414 __u16 tail;
415 __u16 mask;
416 __u16 *list;
417};
418
419#define L2CAP_SEQ_LIST_CLEAR 0xFFFF
420#define L2CAP_SEQ_LIST_TAIL 0x8000
421
404struct srej_list { 422struct srej_list {
405 __u16 tx_seq; 423 __u16 tx_seq;
406 struct list_head list; 424 struct list_head list;
@@ -446,6 +464,9 @@ struct l2cap_chan {
446 __u16 monitor_timeout; 464 __u16 monitor_timeout;
447 __u16 mps; 465 __u16 mps;
448 466
467 __u8 tx_state;
468 __u8 rx_state;
469
449 unsigned long conf_state; 470 unsigned long conf_state;
450 unsigned long conn_state; 471 unsigned long conn_state;
451 unsigned long flags; 472 unsigned long flags;
@@ -456,9 +477,11 @@ struct l2cap_chan {
456 __u16 buffer_seq; 477 __u16 buffer_seq;
457 __u16 buffer_seq_srej; 478 __u16 buffer_seq_srej;
458 __u16 srej_save_reqseq; 479 __u16 srej_save_reqseq;
480 __u16 last_acked_seq;
459 __u16 frames_sent; 481 __u16 frames_sent;
460 __u16 unacked_frames; 482 __u16 unacked_frames;
461 __u8 retry_count; 483 __u8 retry_count;
484 __u16 srej_queue_next;
462 __u8 num_acked; 485 __u8 num_acked;
463 __u16 sdu_len; 486 __u16 sdu_len;
464 struct sk_buff *sdu; 487 struct sk_buff *sdu;
@@ -490,6 +513,8 @@ struct l2cap_chan {
490 struct sk_buff *tx_send_head; 513 struct sk_buff *tx_send_head;
491 struct sk_buff_head tx_q; 514 struct sk_buff_head tx_q;
492 struct sk_buff_head srej_q; 515 struct sk_buff_head srej_q;
516 struct l2cap_seq_list srej_list;
517 struct l2cap_seq_list retrans_list;
493 struct list_head srej_l; 518 struct list_head srej_l;
494 519
495 struct list_head list; 520 struct list_head list;
@@ -508,8 +533,7 @@ struct l2cap_ops {
508 void (*close) (void *data); 533 void (*close) (void *data);
509 void (*state_change) (void *data, int state); 534 void (*state_change) (void *data, int state);
510 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 535 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
511 unsigned long len, int nb, int *err); 536 unsigned long len, int nb);
512
513}; 537};
514 538
515struct l2cap_conn { 539struct l2cap_conn {
@@ -600,6 +624,44 @@ enum {
600 FLAG_EFS_ENABLE, 624 FLAG_EFS_ENABLE,
601}; 625};
602 626
627enum {
628 L2CAP_TX_STATE_XMIT,
629 L2CAP_TX_STATE_WAIT_F,
630};
631
632enum {
633 L2CAP_RX_STATE_RECV,
634 L2CAP_RX_STATE_SREJ_SENT,
635};
636
637enum {
638 L2CAP_TXSEQ_EXPECTED,
639 L2CAP_TXSEQ_EXPECTED_SREJ,
640 L2CAP_TXSEQ_UNEXPECTED,
641 L2CAP_TXSEQ_UNEXPECTED_SREJ,
642 L2CAP_TXSEQ_DUPLICATE,
643 L2CAP_TXSEQ_DUPLICATE_SREJ,
644 L2CAP_TXSEQ_INVALID,
645 L2CAP_TXSEQ_INVALID_IGNORE,
646};
647
648enum {
649 L2CAP_EV_DATA_REQUEST,
650 L2CAP_EV_LOCAL_BUSY_DETECTED,
651 L2CAP_EV_LOCAL_BUSY_CLEAR,
652 L2CAP_EV_RECV_REQSEQ_AND_FBIT,
653 L2CAP_EV_RECV_FBIT,
654 L2CAP_EV_RETRANS_TO,
655 L2CAP_EV_MONITOR_TO,
656 L2CAP_EV_EXPLICIT_POLL,
657 L2CAP_EV_RECV_IFRAME,
658 L2CAP_EV_RECV_RR,
659 L2CAP_EV_RECV_REJ,
660 L2CAP_EV_RECV_RNR,
661 L2CAP_EV_RECV_SREJ,
662 L2CAP_EV_RECV_FRAME,
663};
664
603static inline void l2cap_chan_hold(struct l2cap_chan *c) 665static inline void l2cap_chan_hold(struct l2cap_chan *c)
604{ 666{
605 atomic_inc(&c->refcnt); 667 atomic_inc(&c->refcnt);
@@ -622,21 +684,26 @@ static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
622} 684}
623 685
624static inline void l2cap_set_timer(struct l2cap_chan *chan, 686static inline void l2cap_set_timer(struct l2cap_chan *chan,
625 struct delayed_work *work, long timeout) 687 struct delayed_work *work, long timeout)
626{ 688{
627 BT_DBG("chan %p state %s timeout %ld", chan, 689 BT_DBG("chan %p state %s timeout %ld", chan,
628 state_to_string(chan->state), timeout); 690 state_to_string(chan->state), timeout);
629 691
692 /* If delayed work cancelled do not hold(chan)
693 since it is already done with previous set_timer */
630 if (!cancel_delayed_work(work)) 694 if (!cancel_delayed_work(work))
631 l2cap_chan_hold(chan); 695 l2cap_chan_hold(chan);
696
632 schedule_delayed_work(work, timeout); 697 schedule_delayed_work(work, timeout);
633} 698}
634 699
635static inline bool l2cap_clear_timer(struct l2cap_chan *chan, 700static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
636 struct delayed_work *work) 701 struct delayed_work *work)
637{ 702{
638 bool ret; 703 bool ret;
639 704
705 /* put(chan) if delayed work cancelled otherwise it
706 is done in delayed work function */
640 ret = cancel_delayed_work(work); 707 ret = cancel_delayed_work(work);
641 if (ret) 708 if (ret)
642 l2cap_chan_put(chan); 709 l2cap_chan_put(chan);
@@ -658,13 +725,10 @@ static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
658 725
659static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 726static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
660{ 727{
661 int offset; 728 if (seq1 >= seq2)
662 729 return seq1 - seq2;
663 offset = (seq1 - seq2) % (chan->tx_win_max + 1); 730 else
664 if (offset < 0) 731 return chan->tx_win_max + 1 - seq2 + seq1;
665 offset += (chan->tx_win_max + 1);
666
667 return offset;
668} 732}
669 733
670static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq) 734static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
@@ -852,14 +916,15 @@ int __l2cap_wait_ack(struct sock *sk);
852int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 916int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
853int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 917int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
854 918
855struct l2cap_chan *l2cap_chan_create(struct sock *sk); 919struct l2cap_chan *l2cap_chan_create(void);
856void l2cap_chan_close(struct l2cap_chan *chan, int reason); 920void l2cap_chan_close(struct l2cap_chan *chan, int reason);
857void l2cap_chan_destroy(struct l2cap_chan *chan); 921void l2cap_chan_destroy(struct l2cap_chan *chan);
858int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 922int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
859 bdaddr_t *dst); 923 bdaddr_t *dst, u8 dst_type);
860int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 924int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
861 u32 priority); 925 u32 priority);
862void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 926void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
863int l2cap_chan_check_security(struct l2cap_chan *chan); 927int l2cap_chan_check_security(struct l2cap_chan *chan);
928void l2cap_chan_set_defaults(struct l2cap_chan *chan);
864 929
865#endif /* __L2CAP_H */ 930#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ebfd91fc20f8..23fd0546fccb 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -341,6 +341,15 @@ struct mgmt_cp_unblock_device {
341} __packed; 341} __packed;
342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE 342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
343 343
344#define MGMT_OP_SET_DEVICE_ID 0x0028
345struct mgmt_cp_set_device_id {
346 __le16 source;
347 __le16 vendor;
348 __le16 product;
349 __le16 version;
350} __packed;
351#define MGMT_SET_DEVICE_ID_SIZE 8
352
344#define MGMT_EV_CMD_COMPLETE 0x0001 353#define MGMT_EV_CMD_COMPLETE 0x0001
345struct mgmt_ev_cmd_complete { 354struct mgmt_ev_cmd_complete {
346 __le16 opcode; 355 __le16 opcode;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 7b3acdd29134..ca356a734920 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -77,7 +77,7 @@ struct smp_cmd_encrypt_info {
77 77
78#define SMP_CMD_MASTER_IDENT 0x07 78#define SMP_CMD_MASTER_IDENT 0x07
79struct smp_cmd_master_ident { 79struct smp_cmd_master_ident {
80 __u16 ediv; 80 __le16 ediv;
81 __u8 rand[8]; 81 __u8 rand[8];
82} __packed; 82} __packed;
83 83
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index adb2320bccdf..0289d4ce7070 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3365,9 +3365,9 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3365 * @chan: main channel 3365 * @chan: main channel
3366 * @channel_type: HT mode 3366 * @channel_type: HT mode
3367 */ 3367 */
3368int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, 3368bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3369 struct ieee80211_channel *chan, 3369 struct ieee80211_channel *chan,
3370 enum nl80211_channel_type channel_type); 3370 enum nl80211_channel_type channel_type);
3371 3371
3372/* 3372/*
3373 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 3373 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4d6e6c6818d0..1937c7d98304 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -667,6 +667,9 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
667 * @RX_FLAG_SHORT_GI: Short guard interval was used 667 * @RX_FLAG_SHORT_GI: Short guard interval was used
668 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 668 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
669 * Valid only for data frames (mainly A-MPDU) 669 * Valid only for data frames (mainly A-MPDU)
670 * @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if
671 * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT
672 * to hw.radiotap_mcs_details to advertise that fact
670 */ 673 */
671enum mac80211_rx_flags { 674enum mac80211_rx_flags {
672 RX_FLAG_MMIC_ERROR = 1<<0, 675 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -681,6 +684,7 @@ enum mac80211_rx_flags {
681 RX_FLAG_40MHZ = 1<<10, 684 RX_FLAG_40MHZ = 1<<10,
682 RX_FLAG_SHORT_GI = 1<<11, 685 RX_FLAG_SHORT_GI = 1<<11,
683 RX_FLAG_NO_SIGNAL_VAL = 1<<12, 686 RX_FLAG_NO_SIGNAL_VAL = 1<<12,
687 RX_FLAG_HT_GF = 1<<13,
684}; 688};
685 689
686/** 690/**
@@ -939,7 +943,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
939 * CCMP key if it requires CCMP encryption of management frames (MFP) to 943 * CCMP key if it requires CCMP encryption of management frames (MFP) to
940 * be done in software. 944 * be done in software.
941 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver 945 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
942 * for a CCMP key if space should be prepared for the IV, but the IV 946 * if space should be prepared for the IV, but the IV
943 * itself should not be generated. Do not set together with 947 * itself should not be generated. Do not set together with
944 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. 948 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.
945 */ 949 */
@@ -1288,6 +1292,11 @@ enum ieee80211_hw_flags {
1288 * 1292 *
1289 * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX 1293 * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
1290 * (if %IEEE80211_HW_QUEUE_CONTROL is set) 1294 * (if %IEEE80211_HW_QUEUE_CONTROL is set)
1295 *
1296 * @radiotap_mcs_details: lists which MCS information can the HW
1297 * reports, by default it is set to _MCS, _GI and _BW but doesn't
1298 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
1299 * adding _BW is supported today.
1291 */ 1300 */
1292struct ieee80211_hw { 1301struct ieee80211_hw {
1293 struct ieee80211_conf conf; 1302 struct ieee80211_conf conf;
@@ -1309,6 +1318,7 @@ struct ieee80211_hw {
1309 u8 max_rx_aggregation_subframes; 1318 u8 max_rx_aggregation_subframes;
1310 u8 max_tx_aggregation_subframes; 1319 u8 max_tx_aggregation_subframes;
1311 u8 offchannel_tx_hw_queue; 1320 u8 offchannel_tx_hw_queue;
1321 u8 radiotap_mcs_details;
1312}; 1322};
1313 1323
1314/** 1324/**
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index aca65a5a9d0d..4467c9460857 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -39,6 +39,8 @@ struct nfc_hci_ops {
39 int (*data_exchange) (struct nfc_hci_dev *hdev, 39 int (*data_exchange) (struct nfc_hci_dev *hdev,
40 struct nfc_target *target, 40 struct nfc_target *target,
41 struct sk_buff *skb, struct sk_buff **res_skb); 41 struct sk_buff *skb, struct sk_buff **res_skb);
42 int (*check_presence)(struct nfc_hci_dev *hdev,
43 struct nfc_target *target);
42}; 44};
43 45
44#define NFC_HCI_MAX_CUSTOM_GATES 15 46#define NFC_HCI_MAX_CUSTOM_GATES 15
@@ -82,10 +84,6 @@ struct nfc_hci_dev {
82 84
83 u8 gate2pipe[NFC_HCI_MAX_GATES]; 85 u8 gate2pipe[NFC_HCI_MAX_GATES];
84 86
85 bool poll_started;
86 struct nfc_target *targets;
87 int target_count;
88
89 u8 sw_romlib; 87 u8 sw_romlib;
90 u8 sw_patch; 88 u8 sw_patch;
91 u8 sw_flashlib_major; 89 u8 sw_flashlib_major;
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 9a2505a5b8de..b7ca4a2a1d72 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -48,26 +48,28 @@ struct nfc_dev;
48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
49 int err); 49 int err);
50 50
51struct nfc_target;
52
51struct nfc_ops { 53struct nfc_ops {
52 int (*dev_up)(struct nfc_dev *dev); 54 int (*dev_up)(struct nfc_dev *dev);
53 int (*dev_down)(struct nfc_dev *dev); 55 int (*dev_down)(struct nfc_dev *dev);
54 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 56 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
55 void (*stop_poll)(struct nfc_dev *dev); 57 void (*stop_poll)(struct nfc_dev *dev);
56 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode, 58 int (*dep_link_up)(struct nfc_dev *dev, struct nfc_target *target,
57 u8 *gb, size_t gb_len); 59 u8 comm_mode, u8 *gb, size_t gb_len);
58 int (*dep_link_down)(struct nfc_dev *dev); 60 int (*dep_link_down)(struct nfc_dev *dev);
59 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 61 int (*activate_target)(struct nfc_dev *dev, struct nfc_target *target,
60 u32 protocol); 62 u32 protocol);
61 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 63 void (*deactivate_target)(struct nfc_dev *dev,
62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 64 struct nfc_target *target);
65 int (*data_exchange)(struct nfc_dev *dev, struct nfc_target *target,
63 struct sk_buff *skb, data_exchange_cb_t cb, 66 struct sk_buff *skb, data_exchange_cb_t cb,
64 void *cb_context); 67 void *cb_context);
65 int (*check_presence)(struct nfc_dev *dev, u32 target_idx); 68 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
66}; 69};
67 70
68#define NFC_TARGET_IDX_ANY -1 71#define NFC_TARGET_IDX_ANY -1
69#define NFC_MAX_GT_LEN 48 72#define NFC_MAX_GT_LEN 48
70#define NFC_TARGET_IDX_NONE 0xffffffff
71 73
72struct nfc_target { 74struct nfc_target {
73 u32 idx; 75 u32 idx;
@@ -95,11 +97,10 @@ struct nfc_dev {
95 struct nfc_target *targets; 97 struct nfc_target *targets;
96 int n_targets; 98 int n_targets;
97 int targets_generation; 99 int targets_generation;
98 spinlock_t targets_lock;
99 struct device dev; 100 struct device dev;
100 bool dev_up; 101 bool dev_up;
101 bool polling; 102 bool polling;
102 u32 activated_target_idx; 103 struct nfc_target *active_target;
103 bool dep_link_up; 104 bool dep_link_up;
104 u32 dep_rf_mode; 105 u32 dep_rf_mode;
105 struct nfc_genl_data genl_data; 106 struct nfc_genl_data genl_data;
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h
index 1071987d0408..ab06afd462da 100644
--- a/include/net/nfc/shdlc.h
+++ b/include/net/nfc/shdlc.h
@@ -35,6 +35,8 @@ struct nfc_shdlc_ops {
35 int (*data_exchange) (struct nfc_shdlc *shdlc, 35 int (*data_exchange) (struct nfc_shdlc *shdlc,
36 struct nfc_target *target, 36 struct nfc_target *target,
37 struct sk_buff *skb, struct sk_buff **res_skb); 37 struct sk_buff *skb, struct sk_buff **res_skb);
38 int (*check_presence)(struct nfc_shdlc *shdlc,
39 struct nfc_target *target);
38}; 40};
39 41
40enum shdlc_state { 42enum shdlc_state {