aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-11-17 13:11:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-17 13:11:43 -0500
commite11c259f745889b55bc5596ca78271f2f5cf08d2 (patch)
tree5025f0bf9093e84d0643beb9097249c176dbbea7 /include
parent8d26784cf0d04c1238e906efdd5de76439cb0a1e (diff)
parentb4487c2d0edaf1332d7a9f11b5661044955ef5e2 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: include/net/bluetooth/bluetooth.h
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/socket.h3
-rw-r--r--include/linux/errqueue.h3
-rw-r--r--include/linux/ieee80211.h6
-rw-r--r--include/linux/nl80211.h111
-rw-r--r--include/linux/skbuff.h19
-rw-r--r--include/net/bluetooth/bluetooth.h29
-rw-r--r--include/net/bluetooth/hci.h22
-rw-r--r--include/net/bluetooth/hci_core.h136
-rw-r--r--include/net/bluetooth/l2cap.h416
-rw-r--r--include/net/bluetooth/mgmt.h47
-rw-r--r--include/net/cfg80211.h112
-rw-r--r--include/net/ieee80211_radiotap.h8
-rw-r--r--include/net/mac80211.h35
-rw-r--r--include/net/nfc/nci.h109
-rw-r--r--include/net/nfc/nci_core.h13
-rw-r--r--include/net/sock.h6
16 files changed, 887 insertions, 188 deletions
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index 9a6115e7cf63..49c1704173e7 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -64,4 +64,7 @@
64#define SO_DOMAIN 39 64#define SO_DOMAIN 39
65 65
66#define SO_RXQ_OVFL 40 66#define SO_RXQ_OVFL 40
67
68#define SO_WIFI_STATUS 41
69#define SCM_WIFI_STATUS SO_WIFI_STATUS
67#endif /* __ASM_GENERIC_SOCKET_H */ 70#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 034072cea853..c9f522bd17e4 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -17,7 +17,8 @@ struct sock_extended_err {
17#define SO_EE_ORIGIN_LOCAL 1 17#define SO_EE_ORIGIN_LOCAL 1
18#define SO_EE_ORIGIN_ICMP 2 18#define SO_EE_ORIGIN_ICMP 2
19#define SO_EE_ORIGIN_ICMP6 3 19#define SO_EE_ORIGIN_ICMP6 3
20#define SO_EE_ORIGIN_TIMESTAMPING 4 20#define SO_EE_ORIGIN_TXSTATUS 4
21#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
21 22
22#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
23 24
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48363c3c40f8..66cedf6eb5c2 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -128,6 +128,7 @@
128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020 128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040 129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060 130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
131#define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
131/* A-MSDU 802.11n */ 132/* A-MSDU 802.11n */
132#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080 133#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
133/* Mesh Control 802.11s */ 134/* Mesh Control 802.11s */
@@ -770,6 +771,9 @@ struct ieee80211_mgmt {
770 } u; 771 } u;
771} __attribute__ ((packed)); 772} __attribute__ ((packed));
772 773
774/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
775#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
776
773/* mgmt header + 1 byte category code */ 777/* mgmt header + 1 byte category code */
774#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 778#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
775 779
@@ -1552,6 +1556,8 @@ enum ieee80211_sa_query_action {
1552#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1556#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1553#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 1557#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1554 1558
1559#define WLAN_CIPHER_SUITE_SMS4 0x00147201
1560
1555/* AKM suite selectors */ 1561/* AKM suite selectors */
1556#define WLAN_AKM_SUITE_8021X 0x000FAC01 1562#define WLAN_AKM_SUITE_8021X 0x000FAC01
1557#define WLAN_AKM_SUITE_PSK 0x000FAC02 1563#define WLAN_AKM_SUITE_PSK 0x000FAC02
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8049bf77d799..f9261c253735 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -509,6 +509,35 @@
509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). 509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. 510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
511 * 511 *
512 * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
513 * (or GO) interface (i.e. hostapd) to ask for unexpected frames to
514 * implement sending deauth to stations that send unexpected class 3
515 * frames. Also used as the event sent by the kernel when such a frame
516 * is received.
517 * For the event, the %NL80211_ATTR_MAC attribute carries the TA and
518 * other attributes like the interface index are present.
519 * If used as the command it must have an interface index and you can
520 * only unsubscribe from the event by closing the socket. Subscription
521 * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
522 *
523 * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
524 * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
525 * and wasn't already in a 4-addr VLAN. The event will be sent similarly
526 * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
527 *
528 * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface
529 * by sending a null data frame to it and reporting when the frame is
530 * acknowleged. This is used to allow timing out inactive clients. Uses
531 * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a
532 * direct reply with an %NL80211_ATTR_COOKIE that is later used to match
533 * up the event with the request. The event includes the same data and
534 * has %NL80211_ATTR_ACK set if the frame was ACKed.
535 *
536 * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
537 * other BSSes when any interfaces are in AP mode. This helps implement
538 * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
539 * messages. Note that per PHY only one application may register.
540 *
512 * @NL80211_CMD_MAX: highest used command number 541 * @NL80211_CMD_MAX: highest used command number
513 * @__NL80211_CMD_AFTER_LAST: internal use 542 * @__NL80211_CMD_AFTER_LAST: internal use
514 */ 543 */
@@ -638,6 +667,14 @@ enum nl80211_commands {
638 NL80211_CMD_TDLS_OPER, 667 NL80211_CMD_TDLS_OPER,
639 NL80211_CMD_TDLS_MGMT, 668 NL80211_CMD_TDLS_MGMT,
640 669
670 NL80211_CMD_UNEXPECTED_FRAME,
671
672 NL80211_CMD_PROBE_CLIENT,
673
674 NL80211_CMD_REGISTER_BEACONS,
675
676 NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
677
641 /* add new commands above here */ 678 /* add new commands above here */
642 679
643 /* used to define NL80211_CMD_MAX below */ 680 /* used to define NL80211_CMD_MAX below */
@@ -658,6 +695,8 @@ enum nl80211_commands {
658#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 695#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
659#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT 696#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
660 697
698#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
699
661/* source-level API compatibility */ 700/* source-level API compatibility */
662#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG 701#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
663#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG 702#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
@@ -1109,6 +1148,28 @@ enum nl80211_commands {
1109 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be 1148 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
1110 * used for asking the driver to perform a TDLS operation. 1149 * used for asking the driver to perform a TDLS operation.
1111 * 1150 *
1151 * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices
1152 * that have AP support to indicate that they have the AP SME integrated
1153 * with support for the features listed in this attribute, see
1154 * &enum nl80211_ap_sme_features.
1155 *
1156 * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
1157 * the driver to not wait for an acknowledgement. Note that due to this,
1158 * it will also not give a status callback nor return a cookie. This is
1159 * mostly useful for probe responses to save airtime.
1160 *
1161 * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from
1162 * &enum nl80211_feature_flags and is advertised in wiphy information.
1163 * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe
1164 *
1165 * requests while operating in AP-mode.
1166 * This attribute holds a bitmap of the supported protocols for
1167 * offloading (see &enum nl80211_probe_resp_offload_support_attr).
1168 *
1169 * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire
1170 * probe-response frame. The DA field in the 802.11 header is zero-ed out,
1171 * to be filled by the FW.
1172 *
1112 * @NL80211_ATTR_MAX: highest attribute number currently defined 1173 * @NL80211_ATTR_MAX: highest attribute number currently defined
1113 * @__NL80211_ATTR_AFTER_LAST: internal use 1174 * @__NL80211_ATTR_AFTER_LAST: internal use
1114 */ 1175 */
@@ -1337,6 +1398,16 @@ enum nl80211_attrs {
1337 NL80211_ATTR_TDLS_SUPPORT, 1398 NL80211_ATTR_TDLS_SUPPORT,
1338 NL80211_ATTR_TDLS_EXTERNAL_SETUP, 1399 NL80211_ATTR_TDLS_EXTERNAL_SETUP,
1339 1400
1401 NL80211_ATTR_DEVICE_AP_SME,
1402
1403 NL80211_ATTR_DONT_WAIT_FOR_ACK,
1404
1405 NL80211_ATTR_FEATURE_FLAGS,
1406
1407 NL80211_ATTR_PROBE_RESP_OFFLOAD,
1408
1409 NL80211_ATTR_PROBE_RESP,
1410
1340 /* add attributes here, update the policy in nl80211.c */ 1411 /* add attributes here, update the policy in nl80211.c */
1341 1412
1342 __NL80211_ATTR_AFTER_LAST, 1413 __NL80211_ATTR_AFTER_LAST,
@@ -1371,6 +1442,7 @@ enum nl80211_attrs {
1371#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES 1442#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
1372#define NL80211_ATTR_KEY NL80211_ATTR_KEY 1443#define NL80211_ATTR_KEY NL80211_ATTR_KEY
1373#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS 1444#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
1445#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
1374 1446
1375#define NL80211_MAX_SUPP_RATES 32 1447#define NL80211_MAX_SUPP_RATES 32
1376#define NL80211_MAX_SUPP_REG_RULES 32 1448#define NL80211_MAX_SUPP_REG_RULES 32
@@ -2650,4 +2722,43 @@ enum nl80211_tdls_operation {
2650 NL80211_TDLS_DISABLE_LINK, 2722 NL80211_TDLS_DISABLE_LINK,
2651}; 2723};
2652 2724
2725/*
2726 * enum nl80211_ap_sme_features - device-integrated AP features
2727 * Reserved for future use, no bits are defined in
2728 * NL80211_ATTR_DEVICE_AP_SME yet.
2729enum nl80211_ap_sme_features {
2730};
2731 */
2732
2733/**
2734 * enum nl80211_feature_flags - device/driver features
2735 * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back
2736 * TX status to the socket error queue when requested with the
2737 * socket option.
2738 */
2739enum nl80211_feature_flags {
2740 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
2741};
2742
2743/**
2744 * enum nl80211_probe_resp_offload_support_attr - optional supported
2745 * protocols for probe-response offloading by the driver/FW.
2746 * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.
2747 * Each enum value represents a bit in the bitmap of supported
2748 * protocols. Typically a subset of probe-requests belonging to a
2749 * supported protocol will be excluded from offload and uploaded
2750 * to the host.
2751 *
2752 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1
2753 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2
2754 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P
2755 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u
2756 */
2757enum nl80211_probe_resp_offload_support_attr {
2758 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0,
2759 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1,
2760 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2,
2761 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,
2762};
2763
2653#endif /* __LINUX_NL80211_H */ 2764#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b93117389cfe..09b7ea566d66 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -218,6 +218,9 @@ enum {
218 218
219 /* device driver supports TX zero-copy buffers */ 219 /* device driver supports TX zero-copy buffers */
220 SKBTX_DEV_ZEROCOPY = 1 << 4, 220 SKBTX_DEV_ZEROCOPY = 1 << 4,
221
222 /* generate wifi status information (where possible) */
223 SKBTX_WIFI_STATUS = 1 << 5,
221}; 224};
222 225
223/* 226/*
@@ -352,6 +355,8 @@ typedef unsigned char *sk_buff_data_t;
352 * @ooo_okay: allow the mapping of a socket to a queue to be changed 355 * @ooo_okay: allow the mapping of a socket to a queue to be changed
353 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 356 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport
354 * ports. 357 * ports.
358 * @wifi_acked_valid: wifi_acked was set
359 * @wifi_acked: whether frame was acked on wifi or not
355 * @dma_cookie: a cookie to one of several possible DMA operations 360 * @dma_cookie: a cookie to one of several possible DMA operations
356 * done by skb DMA functions 361 * done by skb DMA functions
357 * @secmark: security marking 362 * @secmark: security marking
@@ -445,10 +450,11 @@ struct sk_buff {
445#endif 450#endif
446 __u8 ooo_okay:1; 451 __u8 ooo_okay:1;
447 __u8 l4_rxhash:1; 452 __u8 l4_rxhash:1;
453 __u8 wifi_acked_valid:1;
454 __u8 wifi_acked:1;
455 /* 10/12 bit hole (depending on ndisc_nodetype presence) */
448 kmemcheck_bitfield_end(flags2); 456 kmemcheck_bitfield_end(flags2);
449 457
450 /* 0/13 bit hole */
451
452#ifdef CONFIG_NET_DMA 458#ifdef CONFIG_NET_DMA
453 dma_cookie_t dma_cookie; 459 dma_cookie_t dma_cookie;
454#endif 460#endif
@@ -2265,6 +2271,15 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2265 sw_tx_timestamp(skb); 2271 sw_tx_timestamp(skb);
2266} 2272}
2267 2273
2274/**
2275 * skb_complete_wifi_ack - deliver skb with wifi status
2276 *
2277 * @skb: the original outgoing packet
2278 * @acked: ack status
2279 *
2280 */
2281void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2282
2268extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2283extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2269extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2284extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
2270 2285
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index e86af08293a8..835f3b229b84 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -77,6 +77,33 @@ struct bt_power {
77#define BT_POWER_FORCE_ACTIVE_OFF 0 77#define BT_POWER_FORCE_ACTIVE_OFF 0
78#define BT_POWER_FORCE_ACTIVE_ON 1 78#define BT_POWER_FORCE_ACTIVE_ON 1
79 79
80#define BT_CHANNEL_POLICY 10
81
82/* BR/EDR only (default policy)
83 * AMP controllers cannot be used.
84 * Channel move requests from the remote device are denied.
85 * If the L2CAP channel is currently using AMP, move the channel to BR/EDR.
86 */
87#define BT_CHANNEL_POLICY_BREDR_ONLY 0
88
89/* BR/EDR Preferred
90 * Allow use of AMP controllers.
91 * If the L2CAP channel is currently on AMP, move it to BR/EDR.
92 * Channel move requests from the remote device are allowed.
93 */
94#define BT_CHANNEL_POLICY_BREDR_PREFERRED 1
95
96/* AMP Preferred
97 * Allow use of AMP controllers
98 * If the L2CAP channel is currently on BR/EDR and AMP controller
99 * resources are available, initiate a channel move to AMP.
100 * Channel move requests from the remote device are allowed.
101 * If the L2CAP socket has not been connected yet, try to create
102 * and configure the channel directly on an AMP controller rather
103 * than BR/EDR.
104 */
105#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
106
80__printf(2, 3) 107__printf(2, 3)
81int bt_printk(const char *level, const char *fmt, ...); 108int bt_printk(const char *level, const char *fmt, ...);
82 109
@@ -158,7 +185,7 @@ struct bt_skb_cb {
158 __u8 pkt_type; 185 __u8 pkt_type;
159 __u8 incoming; 186 __u8 incoming;
160 __u16 expect; 187 __u16 expect;
161 __u8 tx_seq; 188 __u16 tx_seq;
162 __u8 retries; 189 __u8 retries;
163 __u8 sar; 190 __u8 sar;
164 unsigned short channel; 191 unsigned short channel;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index aaf79af72432..139ce2aa6eee 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -264,6 +264,13 @@ enum {
264#define HCI_LK_SMP_IRK 0x82 264#define HCI_LK_SMP_IRK 0x82
265#define HCI_LK_SMP_CSRK 0x83 265#define HCI_LK_SMP_CSRK 0x83
266 266
267/* ---- HCI Error Codes ---- */
268#define HCI_ERROR_AUTH_FAILURE 0x05
269#define HCI_ERROR_REJ_BAD_ADDR 0x0f
270#define HCI_ERROR_REMOTE_USER_TERM 0x13
271#define HCI_ERROR_LOCAL_HOST_TERM 0x16
272#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
273
267/* ----- HCI Commands ---- */ 274/* ----- HCI Commands ---- */
268#define HCI_OP_NOP 0x0000 275#define HCI_OP_NOP 0x0000
269 276
@@ -726,6 +733,21 @@ struct hci_cp_write_page_scan_activity {
726 #define PAGE_SCAN_TYPE_STANDARD 0x00 733 #define PAGE_SCAN_TYPE_STANDARD 0x00
727 #define PAGE_SCAN_TYPE_INTERLACED 0x01 734 #define PAGE_SCAN_TYPE_INTERLACED 0x01
728 735
736#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
737struct hci_rp_read_local_amp_info {
738 __u8 status;
739 __u8 amp_status;
740 __le32 total_bw;
741 __le32 max_bw;
742 __le32 min_latency;
743 __le32 max_pdu;
744 __u8 amp_type;
745 __le16 pal_cap;
746 __le16 max_assoc_size;
747 __le32 max_flush_to;
748 __le32 be_flush_to;
749} __packed;
750
729#define HCI_OP_LE_SET_EVENT_MASK 0x2001 751#define HCI_OP_LE_SET_EVENT_MASK 0x2001
730struct hci_cp_le_set_event_mask { 752struct hci_cp_le_set_event_mask {
731 __u8 mask[8]; 753 __u8 mask[8];
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 3779ea362257..f333e7682607 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -32,6 +32,9 @@
32#define HCI_PROTO_L2CAP 0 32#define HCI_PROTO_L2CAP 0
33#define HCI_PROTO_SCO 1 33#define HCI_PROTO_SCO 1
34 34
35/* HCI priority */
36#define HCI_PRIO_MAX 7
37
35/* HCI Core structures */ 38/* HCI Core structures */
36struct inquiry_data { 39struct inquiry_data {
37 bdaddr_t bdaddr; 40 bdaddr_t bdaddr;
@@ -64,6 +67,12 @@ struct hci_conn_hash {
64 unsigned int le_num; 67 unsigned int le_num;
65}; 68};
66 69
70struct hci_chan_hash {
71 struct list_head list;
72 spinlock_t lock;
73 unsigned int num;
74};
75
67struct bdaddr_list { 76struct bdaddr_list {
68 struct list_head list; 77 struct list_head list;
69 bdaddr_t bdaddr; 78 bdaddr_t bdaddr;
@@ -150,6 +159,17 @@ struct hci_dev {
150 __u16 sniff_min_interval; 159 __u16 sniff_min_interval;
151 __u16 sniff_max_interval; 160 __u16 sniff_max_interval;
152 161
162 __u8 amp_status;
163 __u32 amp_total_bw;
164 __u32 amp_max_bw;
165 __u32 amp_min_latency;
166 __u32 amp_max_pdu;
167 __u8 amp_type;
168 __u16 amp_pal_cap;
169 __u16 amp_assoc_size;
170 __u32 amp_max_flush_to;
171 __u32 amp_be_flush_to;
172
153 unsigned int auto_accept_delay; 173 unsigned int auto_accept_delay;
154 174
155 unsigned long quirks; 175 unsigned long quirks;
@@ -173,8 +193,10 @@ struct hci_dev {
173 struct workqueue_struct *workqueue; 193 struct workqueue_struct *workqueue;
174 194
175 struct work_struct power_on; 195 struct work_struct power_on;
176 struct work_struct power_off; 196 struct delayed_work power_off;
177 struct timer_list off_timer; 197
198 __u16 discov_timeout;
199 struct delayed_work discov_off;
178 200
179 struct timer_list cmd_timer; 201 struct timer_list cmd_timer;
180 struct tasklet_struct cmd_task; 202 struct tasklet_struct cmd_task;
@@ -195,6 +217,8 @@ struct hci_dev {
195 217
196 __u16 init_last_cmd; 218 __u16 init_last_cmd;
197 219
220 struct list_head mgmt_pending;
221
198 struct inquiry_cache inq_cache; 222 struct inquiry_cache inq_cache;
199 struct hci_conn_hash conn_hash; 223 struct hci_conn_hash conn_hash;
200 struct list_head blacklist; 224 struct list_head blacklist;
@@ -273,6 +297,7 @@ struct hci_conn {
273 unsigned int sent; 297 unsigned int sent;
274 298
275 struct sk_buff_head data_q; 299 struct sk_buff_head data_q;
300 struct hci_chan_hash chan_hash;
276 301
277 struct timer_list disc_timer; 302 struct timer_list disc_timer;
278 struct timer_list idle_timer; 303 struct timer_list idle_timer;
@@ -295,6 +320,14 @@ struct hci_conn {
295 void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason); 320 void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason);
296}; 321};
297 322
323struct hci_chan {
324 struct list_head list;
325
326 struct hci_conn *conn;
327 struct sk_buff_head data_q;
328 unsigned int sent;
329};
330
298extern struct hci_proto *hci_proto[]; 331extern struct hci_proto *hci_proto[];
299extern struct list_head hci_dev_list; 332extern struct list_head hci_dev_list;
300extern struct list_head hci_cb_list; 333extern struct list_head hci_cb_list;
@@ -455,6 +488,28 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
455 return NULL; 488 return NULL;
456} 489}
457 490
491static inline void hci_chan_hash_init(struct hci_conn *c)
492{
493 struct hci_chan_hash *h = &c->chan_hash;
494 INIT_LIST_HEAD(&h->list);
495 spin_lock_init(&h->lock);
496 h->num = 0;
497}
498
499static inline void hci_chan_hash_add(struct hci_conn *c, struct hci_chan *chan)
500{
501 struct hci_chan_hash *h = &c->chan_hash;
502 list_add(&chan->list, &h->list);
503 h->num++;
504}
505
506static inline void hci_chan_hash_del(struct hci_conn *c, struct hci_chan *chan)
507{
508 struct hci_chan_hash *h = &c->chan_hash;
509 list_del(&chan->list);
510 h->num--;
511}
512
458void hci_acl_connect(struct hci_conn *conn); 513void hci_acl_connect(struct hci_conn *conn);
459void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 514void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
460void hci_add_sco(struct hci_conn *conn, __u16 handle); 515void hci_add_sco(struct hci_conn *conn, __u16 handle);
@@ -466,6 +521,10 @@ int hci_conn_del(struct hci_conn *conn);
466void hci_conn_hash_flush(struct hci_dev *hdev); 521void hci_conn_hash_flush(struct hci_dev *hdev);
467void hci_conn_check_pending(struct hci_dev *hdev); 522void hci_conn_check_pending(struct hci_dev *hdev);
468 523
524struct hci_chan *hci_chan_create(struct hci_conn *conn);
525int hci_chan_del(struct hci_chan *chan);
526void hci_chan_hash_flush(struct hci_conn *conn);
527
469struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 528struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
470 __u8 sec_level, __u8 auth_type); 529 __u8 sec_level, __u8 auth_type);
471int hci_conn_check_link_mode(struct hci_conn *conn); 530int hci_conn_check_link_mode(struct hci_conn *conn);
@@ -545,7 +604,7 @@ struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
545struct hci_dev *hci_alloc_dev(void); 604struct hci_dev *hci_alloc_dev(void);
546void hci_free_dev(struct hci_dev *hdev); 605void hci_free_dev(struct hci_dev *hdev);
547int hci_register_dev(struct hci_dev *hdev); 606int hci_register_dev(struct hci_dev *hdev);
548int hci_unregister_dev(struct hci_dev *hdev); 607void hci_unregister_dev(struct hci_dev *hdev);
549int hci_suspend_dev(struct hci_dev *hdev); 608int hci_suspend_dev(struct hci_dev *hdev);
550int hci_resume_dev(struct hci_dev *hdev); 609int hci_resume_dev(struct hci_dev *hdev);
551int hci_dev_open(__u16 dev); 610int hci_dev_open(__u16 dev);
@@ -599,8 +658,9 @@ int hci_recv_frame(struct sk_buff *skb);
599int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 658int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
600int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); 659int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
601 660
602int hci_register_sysfs(struct hci_dev *hdev); 661void hci_init_sysfs(struct hci_dev *hdev);
603void hci_unregister_sysfs(struct hci_dev *hdev); 662int hci_add_sysfs(struct hci_dev *hdev);
663void hci_del_sysfs(struct hci_dev *hdev);
604void hci_conn_init_sysfs(struct hci_conn *conn); 664void hci_conn_init_sysfs(struct hci_conn *conn);
605void hci_conn_add_sysfs(struct hci_conn *conn); 665void hci_conn_add_sysfs(struct hci_conn *conn);
606void hci_conn_del_sysfs(struct hci_conn *conn); 666void hci_conn_del_sysfs(struct hci_conn *conn);
@@ -676,7 +736,7 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
676static inline int hci_proto_disconn_ind(struct hci_conn *conn) 736static inline int hci_proto_disconn_ind(struct hci_conn *conn)
677{ 737{
678 register struct hci_proto *hp; 738 register struct hci_proto *hp;
679 int reason = 0x13; 739 int reason = HCI_ERROR_REMOTE_USER_TERM;
680 740
681 hp = hci_proto[HCI_PROTO_L2CAP]; 741 hp = hci_proto[HCI_PROTO_L2CAP];
682 if (hp && hp->disconn_ind) 742 if (hp && hp->disconn_ind)
@@ -836,7 +896,7 @@ int hci_register_notifier(struct notifier_block *nb);
836int hci_unregister_notifier(struct notifier_block *nb); 896int hci_unregister_notifier(struct notifier_block *nb);
837 897
838int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 898int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
839void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 899void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
840void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 900void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
841 901
842void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 902void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
@@ -849,34 +909,41 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
849 909
850/* Management interface */ 910/* Management interface */
851int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 911int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
852int mgmt_index_added(u16 index); 912int mgmt_index_added(struct hci_dev *hdev);
853int mgmt_index_removed(u16 index); 913int mgmt_index_removed(struct hci_dev *hdev);
854int mgmt_powered(u16 index, u8 powered); 914int mgmt_powered(struct hci_dev *hdev, u8 powered);
855int mgmt_discoverable(u16 index, u8 discoverable); 915int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
856int mgmt_connectable(u16 index, u8 connectable); 916int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
857int mgmt_new_key(u16 index, struct link_key *key, u8 persistent); 917int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
858int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type); 918int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
859int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); 919 u8 persistent);
860int mgmt_disconnect_failed(u16 index); 920int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
861int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); 921int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
862int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); 922int mgmt_disconnect_failed(struct hci_dev *hdev);
863int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 923int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
864int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
865int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value,
866 u8 confirm_hint);
867int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
868int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr,
869 u8 status); 924 u8 status);
870int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); 925int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
871int mgmt_set_local_name_complete(u16 index, u8 *name, u8 status); 926int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
872int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer,
873 u8 status); 927 u8 status);
874int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, 928int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
875 u8 *eir); 929 u8 status);
876int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); 930int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
877int mgmt_discovering(u16 index, u8 discovering); 931 __le32 value, u8 confirm_hint);
878int mgmt_device_blocked(u16 index, bdaddr_t *bdaddr); 932int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
879int mgmt_device_unblocked(u16 index, bdaddr_t *bdaddr); 933 u8 status);
934int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev,
935 bdaddr_t *bdaddr, u8 status);
936int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status);
937int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
938int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
939 u8 *randomizer, u8 status);
940int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
941 u8 *dev_class, s8 rssi, u8 *eir);
942int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name);
943int mgmt_inquiry_failed(struct hci_dev *hdev, u8 status);
944int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
945int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr);
946int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr);
880 947
881/* HCI info for socket */ 948/* HCI info for socket */
882#define hci_pi(sk) ((struct hci_pinfo *) sk) 949#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -915,4 +982,7 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
915void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]); 982void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]);
916void hci_le_ltk_neg_reply(struct hci_conn *conn); 983void hci_le_ltk_neg_reply(struct hci_conn *conn);
917 984
985int hci_do_inquiry(struct hci_dev *hdev, u8 length);
986int hci_cancel_inquiry(struct hci_dev *hdev);
987
918#endif /* __HCI_CORE_H */ 988#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index ab90ae0970a6..875021ad0675 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -27,20 +27,29 @@
27#ifndef __L2CAP_H 27#ifndef __L2CAP_H
28#define __L2CAP_H 28#define __L2CAP_H
29 29
30#include <asm/unaligned.h>
31
30/* L2CAP defaults */ 32/* L2CAP defaults */
31#define L2CAP_DEFAULT_MTU 672 33#define L2CAP_DEFAULT_MTU 672
32#define L2CAP_DEFAULT_MIN_MTU 48 34#define L2CAP_DEFAULT_MIN_MTU 48
33#define L2CAP_DEFAULT_FLUSH_TO 0xffff 35#define L2CAP_DEFAULT_FLUSH_TO 0xffff
34#define L2CAP_DEFAULT_TX_WINDOW 63 36#define L2CAP_DEFAULT_TX_WINDOW 63
37#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
35#define L2CAP_DEFAULT_MAX_TX 3 38#define L2CAP_DEFAULT_MAX_TX 3
36#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ 39#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
37#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
39#define L2CAP_DEFAULT_ACK_TO 200 42#define L2CAP_DEFAULT_ACK_TO 200
40#define L2CAP_LE_DEFAULT_MTU 23 43#define L2CAP_LE_DEFAULT_MTU 23
44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
41 47
42#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 48#define L2CAP_DISC_TIMEOUT (100)
43#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 49#define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */
50#define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */
51#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
52#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
44 53
45/* L2CAP socket address */ 54/* L2CAP socket address */
46struct sockaddr_l2 { 55struct sockaddr_l2 {
@@ -88,52 +97,82 @@ struct l2cap_conninfo {
88#define L2CAP_ECHO_RSP 0x09 97#define L2CAP_ECHO_RSP 0x09
89#define L2CAP_INFO_REQ 0x0a 98#define L2CAP_INFO_REQ 0x0a
90#define L2CAP_INFO_RSP 0x0b 99#define L2CAP_INFO_RSP 0x0b
100#define L2CAP_CREATE_CHAN_REQ 0x0c
101#define L2CAP_CREATE_CHAN_RSP 0x0d
102#define L2CAP_MOVE_CHAN_REQ 0x0e
103#define L2CAP_MOVE_CHAN_RSP 0x0f
104#define L2CAP_MOVE_CHAN_CFM 0x10
105#define L2CAP_MOVE_CHAN_CFM_RSP 0x11
91#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12 106#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
92#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13 107#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
93 108
94/* L2CAP feature mask */ 109/* L2CAP extended feature mask */
95#define L2CAP_FEAT_FLOWCTL 0x00000001 110#define L2CAP_FEAT_FLOWCTL 0x00000001
96#define L2CAP_FEAT_RETRANS 0x00000002 111#define L2CAP_FEAT_RETRANS 0x00000002
112#define L2CAP_FEAT_BIDIR_QOS 0x00000004
97#define L2CAP_FEAT_ERTM 0x00000008 113#define L2CAP_FEAT_ERTM 0x00000008
98#define L2CAP_FEAT_STREAMING 0x00000010 114#define L2CAP_FEAT_STREAMING 0x00000010
99#define L2CAP_FEAT_FCS 0x00000020 115#define L2CAP_FEAT_FCS 0x00000020
116#define L2CAP_FEAT_EXT_FLOW 0x00000040
100#define L2CAP_FEAT_FIXED_CHAN 0x00000080 117#define L2CAP_FEAT_FIXED_CHAN 0x00000080
118#define L2CAP_FEAT_EXT_WINDOW 0x00000100
119#define L2CAP_FEAT_UCD 0x00000200
101 120
102/* L2CAP checksum option */ 121/* L2CAP checksum option */
103#define L2CAP_FCS_NONE 0x00 122#define L2CAP_FCS_NONE 0x00
104#define L2CAP_FCS_CRC16 0x01 123#define L2CAP_FCS_CRC16 0x01
105 124
125/* L2CAP fixed channels */
126#define L2CAP_FC_L2CAP 0x02
127#define L2CAP_FC_A2MP 0x08
128
106/* L2CAP Control Field bit masks */ 129/* L2CAP Control Field bit masks */
107#define L2CAP_CTRL_SAR 0xC000 130#define L2CAP_CTRL_SAR 0xC000
108#define L2CAP_CTRL_REQSEQ 0x3F00 131#define L2CAP_CTRL_REQSEQ 0x3F00
109#define L2CAP_CTRL_TXSEQ 0x007E 132#define L2CAP_CTRL_TXSEQ 0x007E
110#define L2CAP_CTRL_RETRANS 0x0080 133#define L2CAP_CTRL_SUPERVISE 0x000C
111#define L2CAP_CTRL_FINAL 0x0080 134
112#define L2CAP_CTRL_POLL 0x0010 135#define L2CAP_CTRL_RETRANS 0x0080
113#define L2CAP_CTRL_SUPERVISE 0x000C 136#define L2CAP_CTRL_FINAL 0x0080
114#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */ 137#define L2CAP_CTRL_POLL 0x0010
115 138#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */
116#define L2CAP_CTRL_TXSEQ_SHIFT 1 139
117#define L2CAP_CTRL_REQSEQ_SHIFT 8 140#define L2CAP_CTRL_TXSEQ_SHIFT 1
118#define L2CAP_CTRL_SAR_SHIFT 14 141#define L2CAP_CTRL_SUPER_SHIFT 2
142#define L2CAP_CTRL_REQSEQ_SHIFT 8
143#define L2CAP_CTRL_SAR_SHIFT 14
144
145/* L2CAP Extended Control Field bit mask */
146#define L2CAP_EXT_CTRL_TXSEQ 0xFFFC0000
147#define L2CAP_EXT_CTRL_SAR 0x00030000
148#define L2CAP_EXT_CTRL_SUPERVISE 0x00030000
149#define L2CAP_EXT_CTRL_REQSEQ 0x0000FFFC
150
151#define L2CAP_EXT_CTRL_POLL 0x00040000
152#define L2CAP_EXT_CTRL_FINAL 0x00000002
153#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */
154
155#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
156#define L2CAP_EXT_CTRL_SAR_SHIFT 16
157#define L2CAP_EXT_CTRL_SUPER_SHIFT 16
158#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
119 159
120/* L2CAP Supervisory Function */ 160/* L2CAP Supervisory Function */
121#define L2CAP_SUPER_RCV_READY 0x0000 161#define L2CAP_SUPER_RR 0x00
122#define L2CAP_SUPER_REJECT 0x0004 162#define L2CAP_SUPER_REJ 0x01
123#define L2CAP_SUPER_RCV_NOT_READY 0x0008 163#define L2CAP_SUPER_RNR 0x02
124#define L2CAP_SUPER_SELECT_REJECT 0x000C 164#define L2CAP_SUPER_SREJ 0x03
125 165
126/* L2CAP Segmentation and Reassembly */ 166/* L2CAP Segmentation and Reassembly */
127#define L2CAP_SDU_UNSEGMENTED 0x0000 167#define L2CAP_SAR_UNSEGMENTED 0x00
128#define L2CAP_SDU_START 0x4000 168#define L2CAP_SAR_START 0x01
129#define L2CAP_SDU_END 0x8000 169#define L2CAP_SAR_END 0x02
130#define L2CAP_SDU_CONTINUE 0xC000 170#define L2CAP_SAR_CONTINUE 0x03
131 171
132/* L2CAP Command rej. reasons */ 172/* L2CAP Command rej. reasons */
133#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000 173#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
134#define L2CAP_REJ_MTU_EXCEEDED 0x0001 174#define L2CAP_REJ_MTU_EXCEEDED 0x0001
135#define L2CAP_REJ_INVALID_CID 0x0002 175#define L2CAP_REJ_INVALID_CID 0x0002
136
137 176
138/* L2CAP structures */ 177/* L2CAP structures */
139struct l2cap_hdr { 178struct l2cap_hdr {
@@ -141,6 +180,12 @@ struct l2cap_hdr {
141 __le16 cid; 180 __le16 cid;
142} __packed; 181} __packed;
143#define L2CAP_HDR_SIZE 4 182#define L2CAP_HDR_SIZE 4
183#define L2CAP_ENH_HDR_SIZE 6
184#define L2CAP_EXT_HDR_SIZE 8
185
186#define L2CAP_FCS_SIZE 2
187#define L2CAP_SDULEN_SIZE 2
188#define L2CAP_PSMLEN_SIZE 2
144 189
145struct l2cap_cmd_hdr { 190struct l2cap_cmd_hdr {
146 __u8 code; 191 __u8 code;
@@ -185,14 +230,15 @@ struct l2cap_conn_rsp {
185#define L2CAP_CID_DYN_START 0x0040 230#define L2CAP_CID_DYN_START 0x0040
186#define L2CAP_CID_DYN_END 0xffff 231#define L2CAP_CID_DYN_END 0xffff
187 232
188/* connect result */ 233/* connect/create channel results */
189#define L2CAP_CR_SUCCESS 0x0000 234#define L2CAP_CR_SUCCESS 0x0000
190#define L2CAP_CR_PEND 0x0001 235#define L2CAP_CR_PEND 0x0001
191#define L2CAP_CR_BAD_PSM 0x0002 236#define L2CAP_CR_BAD_PSM 0x0002
192#define L2CAP_CR_SEC_BLOCK 0x0003 237#define L2CAP_CR_SEC_BLOCK 0x0003
193#define L2CAP_CR_NO_MEM 0x0004 238#define L2CAP_CR_NO_MEM 0x0004
239#define L2CAP_CR_BAD_AMP 0x0005
194 240
195/* connect status */ 241/* connect/create channel status */
196#define L2CAP_CS_NO_INFO 0x0000 242#define L2CAP_CS_NO_INFO 0x0000
197#define L2CAP_CS_AUTHEN_PEND 0x0001 243#define L2CAP_CS_AUTHEN_PEND 0x0001
198#define L2CAP_CS_AUTHOR_PEND 0x0002 244#define L2CAP_CS_AUTHOR_PEND 0x0002
@@ -214,6 +260,8 @@ struct l2cap_conf_rsp {
214#define L2CAP_CONF_UNACCEPT 0x0001 260#define L2CAP_CONF_UNACCEPT 0x0001
215#define L2CAP_CONF_REJECT 0x0002 261#define L2CAP_CONF_REJECT 0x0002
216#define L2CAP_CONF_UNKNOWN 0x0003 262#define L2CAP_CONF_UNKNOWN 0x0003
263#define L2CAP_CONF_PENDING 0x0004
264#define L2CAP_CONF_EFS_REJECT 0x0005
217 265
218struct l2cap_conf_opt { 266struct l2cap_conf_opt {
219 __u8 type; 267 __u8 type;
@@ -230,6 +278,8 @@ struct l2cap_conf_opt {
230#define L2CAP_CONF_QOS 0x03 278#define L2CAP_CONF_QOS 0x03
231#define L2CAP_CONF_RFC 0x04 279#define L2CAP_CONF_RFC 0x04
232#define L2CAP_CONF_FCS 0x05 280#define L2CAP_CONF_FCS 0x05
281#define L2CAP_CONF_EFS 0x06
282#define L2CAP_CONF_EWS 0x07
233 283
234#define L2CAP_CONF_MAX_SIZE 22 284#define L2CAP_CONF_MAX_SIZE 22
235 285
@@ -248,6 +298,21 @@ struct l2cap_conf_rfc {
248#define L2CAP_MODE_ERTM 0x03 298#define L2CAP_MODE_ERTM 0x03
249#define L2CAP_MODE_STREAMING 0x04 299#define L2CAP_MODE_STREAMING 0x04
250 300
301struct l2cap_conf_efs {
302 __u8 id;
303 __u8 stype;
304 __le16 msdu;
305 __le32 sdu_itime;
306 __le32 acc_lat;
307 __le32 flush_to;
308} __packed;
309
310#define L2CAP_SERV_NOTRAFIC 0x00
311#define L2CAP_SERV_BESTEFFORT 0x01
312#define L2CAP_SERV_GUARANTEED 0x02
313
314#define L2CAP_BESTEFFORT_ID 0x01
315
251struct l2cap_disconn_req { 316struct l2cap_disconn_req {
252 __le16 dcid; 317 __le16 dcid;
253 __le16 scid; 318 __le16 scid;
@@ -268,14 +333,57 @@ struct l2cap_info_rsp {
268 __u8 data[0]; 333 __u8 data[0];
269} __packed; 334} __packed;
270 335
336struct l2cap_create_chan_req {
337 __le16 psm;
338 __le16 scid;
339 __u8 amp_id;
340} __packed;
341
342struct l2cap_create_chan_rsp {
343 __le16 dcid;
344 __le16 scid;
345 __le16 result;
346 __le16 status;
347} __packed;
348
349struct l2cap_move_chan_req {
350 __le16 icid;
351 __u8 dest_amp_id;
352} __packed;
353
354struct l2cap_move_chan_rsp {
355 __le16 icid;
356 __le16 result;
357} __packed;
358
359#define L2CAP_MR_SUCCESS 0x0000
360#define L2CAP_MR_PEND 0x0001
361#define L2CAP_MR_BAD_ID 0x0002
362#define L2CAP_MR_SAME_ID 0x0003
363#define L2CAP_MR_NOT_SUPP 0x0004
364#define L2CAP_MR_COLLISION 0x0005
365#define L2CAP_MR_NOT_ALLOWED 0x0006
366
367struct l2cap_move_chan_cfm {
368 __le16 icid;
369 __le16 result;
370} __packed;
371
372#define L2CAP_MC_CONFIRMED 0x0000
373#define L2CAP_MC_UNCONFIRMED 0x0001
374
375struct l2cap_move_chan_cfm_rsp {
376 __le16 icid;
377} __packed;
378
271/* info type */ 379/* info type */
272#define L2CAP_IT_CL_MTU 0x0001 380#define L2CAP_IT_CL_MTU 0x0001
273#define L2CAP_IT_FEAT_MASK 0x0002 381#define L2CAP_IT_FEAT_MASK 0x0002
274#define L2CAP_IT_FIXED_CHAN 0x0003 382#define L2CAP_IT_FIXED_CHAN 0x0003
275 383
276/* info result */ 384/* info result */
277#define L2CAP_IR_SUCCESS 0x0000 385#define L2CAP_IR_SUCCESS 0x0000
278#define L2CAP_IR_NOTSUPP 0x0001 386#define L2CAP_IR_NOTSUPP 0x0001
279 387
280struct l2cap_conn_param_update_req { 388struct l2cap_conn_param_update_req {
281 __le16 min; 389 __le16 min;
@@ -294,7 +402,7 @@ struct l2cap_conn_param_update_rsp {
294 402
295/* ----- L2CAP channels and connections ----- */ 403/* ----- L2CAP channels and connections ----- */
296struct srej_list { 404struct srej_list {
297 __u8 tx_seq; 405 __u16 tx_seq;
298 struct list_head list; 406 struct list_head list;
299}; 407};
300 408
@@ -316,14 +424,11 @@ struct l2cap_chan {
316 __u16 flush_to; 424 __u16 flush_to;
317 __u8 mode; 425 __u8 mode;
318 __u8 chan_type; 426 __u8 chan_type;
427 __u8 chan_policy;
319 428
320 __le16 sport; 429 __le16 sport;
321 430
322 __u8 sec_level; 431 __u8 sec_level;
323 __u8 role_switch;
324 __u8 force_reliable;
325 __u8 flushable;
326 __u8 force_active;
327 432
328 __u8 ident; 433 __u8 ident;
329 434
@@ -334,7 +439,8 @@ struct l2cap_chan {
334 439
335 __u8 fcs; 440 __u8 fcs;
336 441
337 __u8 tx_win; 442 __u16 tx_win;
443 __u16 tx_win_max;
338 __u8 max_tx; 444 __u8 max_tx;
339 __u16 retrans_timeout; 445 __u16 retrans_timeout;
340 __u16 monitor_timeout; 446 __u16 monitor_timeout;
@@ -342,25 +448,40 @@ struct l2cap_chan {
342 448
343 unsigned long conf_state; 449 unsigned long conf_state;
344 unsigned long conn_state; 450 unsigned long conn_state;
345 451 unsigned long flags;
346 __u8 next_tx_seq; 452
347 __u8 expected_ack_seq; 453 __u16 next_tx_seq;
348 __u8 expected_tx_seq; 454 __u16 expected_ack_seq;
349 __u8 buffer_seq; 455 __u16 expected_tx_seq;
350 __u8 buffer_seq_srej; 456 __u16 buffer_seq;
351 __u8 srej_save_reqseq; 457 __u16 buffer_seq_srej;
352 __u8 frames_sent; 458 __u16 srej_save_reqseq;
353 __u8 unacked_frames; 459 __u16 frames_sent;
460 __u16 unacked_frames;
354 __u8 retry_count; 461 __u8 retry_count;
355 __u8 num_acked; 462 __u8 num_acked;
356 __u16 sdu_len; 463 __u16 sdu_len;
357 struct sk_buff *sdu; 464 struct sk_buff *sdu;
358 struct sk_buff *sdu_last_frag; 465 struct sk_buff *sdu_last_frag;
359 466
360 __u8 remote_tx_win; 467 __u16 remote_tx_win;
361 __u8 remote_max_tx; 468 __u8 remote_max_tx;
362 __u16 remote_mps; 469 __u16 remote_mps;
363 470
471 __u8 local_id;
472 __u8 local_stype;
473 __u16 local_msdu;
474 __u32 local_sdu_itime;
475 __u32 local_acc_lat;
476 __u32 local_flush_to;
477
478 __u8 remote_id;
479 __u8 remote_stype;
480 __u16 remote_msdu;
481 __u32 remote_sdu_itime;
482 __u32 remote_acc_lat;
483 __u32 remote_flush_to;
484
364 struct timer_list chan_timer; 485 struct timer_list chan_timer;
365 struct timer_list retrans_timer; 486 struct timer_list retrans_timer;
366 struct timer_list monitor_timer; 487 struct timer_list monitor_timer;
@@ -388,6 +509,7 @@ struct l2cap_ops {
388 509
389struct l2cap_conn { 510struct l2cap_conn {
390 struct hci_conn *hcon; 511 struct hci_conn *hcon;
512 struct hci_chan *hchan;
391 513
392 bdaddr_t *dst; 514 bdaddr_t *dst;
393 bdaddr_t *src; 515 bdaddr_t *src;
@@ -442,6 +564,9 @@ enum {
442 CONF_CONNECT_PEND, 564 CONF_CONNECT_PEND,
443 CONF_NO_FCS_RECV, 565 CONF_NO_FCS_RECV,
444 CONF_STATE2_DEVICE, 566 CONF_STATE2_DEVICE,
567 CONF_EWS_RECV,
568 CONF_LOC_CONF_PEND,
569 CONF_REM_CONF_PEND,
445}; 570};
446 571
447#define L2CAP_CONF_MAX_CONF_REQ 2 572#define L2CAP_CONF_MAX_CONF_REQ 2
@@ -459,6 +584,16 @@ enum {
459 CONN_RNR_SENT, 584 CONN_RNR_SENT,
460}; 585};
461 586
587/* Definitions for flags in l2cap_chan */
588enum {
589 FLAG_ROLE_SWITCH,
590 FLAG_FORCE_ACTIVE,
591 FLAG_FORCE_RELIABLE,
592 FLAG_FLUSHABLE,
593 FLAG_EXT_CTRL,
594 FLAG_EFS_ENABLE,
595};
596
462#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 597#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
463#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 598#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
464#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 599#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
@@ -471,6 +606,22 @@ enum {
471 L2CAP_DEFAULT_ACK_TO); 606 L2CAP_DEFAULT_ACK_TO);
472#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 607#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
473 608
609static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
610{
611 int offset;
612
613 offset = (seq1 - seq2) % (chan->tx_win_max + 1);
614 if (offset < 0)
615 offset += (chan->tx_win_max + 1);
616
617 return offset;
618}
619
620static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
621{
622 return (seq + 1) % (chan->tx_win_max + 1);
623}
624
474static inline int l2cap_tx_window_full(struct l2cap_chan *ch) 625static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
475{ 626{
476 int sub; 627 int sub;
@@ -483,13 +634,165 @@ static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
483 return sub == ch->remote_tx_win; 634 return sub == ch->remote_tx_win;
484} 635}
485 636
486#define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) 637static inline __u16 __get_reqseq(struct l2cap_chan *chan, __u32 ctrl)
487#define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8) 638{
488#define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE)) 639 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
489#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) 640 return (ctrl & L2CAP_EXT_CTRL_REQSEQ) >>
490#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) 641 L2CAP_EXT_CTRL_REQSEQ_SHIFT;
642 else
643 return (ctrl & L2CAP_CTRL_REQSEQ) >> L2CAP_CTRL_REQSEQ_SHIFT;
644}
645
646static inline __u32 __set_reqseq(struct l2cap_chan *chan, __u32 reqseq)
647{
648 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
649 return (reqseq << L2CAP_EXT_CTRL_REQSEQ_SHIFT) &
650 L2CAP_EXT_CTRL_REQSEQ;
651 else
652 return (reqseq << L2CAP_CTRL_REQSEQ_SHIFT) & L2CAP_CTRL_REQSEQ;
653}
654
655static inline __u16 __get_txseq(struct l2cap_chan *chan, __u32 ctrl)
656{
657 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
658 return (ctrl & L2CAP_EXT_CTRL_TXSEQ) >>
659 L2CAP_EXT_CTRL_TXSEQ_SHIFT;
660 else
661 return (ctrl & L2CAP_CTRL_TXSEQ) >> L2CAP_CTRL_TXSEQ_SHIFT;
662}
663
664static inline __u32 __set_txseq(struct l2cap_chan *chan, __u32 txseq)
665{
666 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
667 return (txseq << L2CAP_EXT_CTRL_TXSEQ_SHIFT) &
668 L2CAP_EXT_CTRL_TXSEQ;
669 else
670 return (txseq << L2CAP_CTRL_TXSEQ_SHIFT) & L2CAP_CTRL_TXSEQ;
671}
672
673static inline bool __is_sframe(struct l2cap_chan *chan, __u32 ctrl)
674{
675 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
676 return ctrl & L2CAP_EXT_CTRL_FRAME_TYPE;
677 else
678 return ctrl & L2CAP_CTRL_FRAME_TYPE;
679}
680
681static inline __u32 __set_sframe(struct l2cap_chan *chan)
682{
683 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
684 return L2CAP_EXT_CTRL_FRAME_TYPE;
685 else
686 return L2CAP_CTRL_FRAME_TYPE;
687}
688
689static inline __u8 __get_ctrl_sar(struct l2cap_chan *chan, __u32 ctrl)
690{
691 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
692 return (ctrl & L2CAP_EXT_CTRL_SAR) >> L2CAP_EXT_CTRL_SAR_SHIFT;
693 else
694 return (ctrl & L2CAP_CTRL_SAR) >> L2CAP_CTRL_SAR_SHIFT;
695}
696
697static inline __u32 __set_ctrl_sar(struct l2cap_chan *chan, __u32 sar)
698{
699 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
700 return (sar << L2CAP_EXT_CTRL_SAR_SHIFT) & L2CAP_EXT_CTRL_SAR;
701 else
702 return (sar << L2CAP_CTRL_SAR_SHIFT) & L2CAP_CTRL_SAR;
703}
704
705static inline bool __is_sar_start(struct l2cap_chan *chan, __u32 ctrl)
706{
707 return __get_ctrl_sar(chan, ctrl) == L2CAP_SAR_START;
708}
709
710static inline __u32 __get_sar_mask(struct l2cap_chan *chan)
711{
712 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
713 return L2CAP_EXT_CTRL_SAR;
714 else
715 return L2CAP_CTRL_SAR;
716}
717
718static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl)
719{
720 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
721 return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >>
722 L2CAP_EXT_CTRL_SUPER_SHIFT;
723 else
724 return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT;
725}
726
727static inline __u32 __set_ctrl_super(struct l2cap_chan *chan, __u32 super)
728{
729 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
730 return (super << L2CAP_EXT_CTRL_SUPER_SHIFT) &
731 L2CAP_EXT_CTRL_SUPERVISE;
732 else
733 return (super << L2CAP_CTRL_SUPER_SHIFT) &
734 L2CAP_CTRL_SUPERVISE;
735}
736
737static inline __u32 __set_ctrl_final(struct l2cap_chan *chan)
738{
739 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
740 return L2CAP_EXT_CTRL_FINAL;
741 else
742 return L2CAP_CTRL_FINAL;
743}
744
745static inline bool __is_ctrl_final(struct l2cap_chan *chan, __u32 ctrl)
746{
747 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
748 return ctrl & L2CAP_EXT_CTRL_FINAL;
749 else
750 return ctrl & L2CAP_CTRL_FINAL;
751}
752
753static inline __u32 __set_ctrl_poll(struct l2cap_chan *chan)
754{
755 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
756 return L2CAP_EXT_CTRL_POLL;
757 else
758 return L2CAP_CTRL_POLL;
759}
760
761static inline bool __is_ctrl_poll(struct l2cap_chan *chan, __u32 ctrl)
762{
763 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
764 return ctrl & L2CAP_EXT_CTRL_POLL;
765 else
766 return ctrl & L2CAP_CTRL_POLL;
767}
768
769static inline __u32 __get_control(struct l2cap_chan *chan, void *p)
770{
771 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
772 return get_unaligned_le32(p);
773 else
774 return get_unaligned_le16(p);
775}
776
777static inline void __put_control(struct l2cap_chan *chan, __u32 control,
778 void *p)
779{
780 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
781 return put_unaligned_le32(control, p);
782 else
783 return put_unaligned_le16(control, p);
784}
785
786static inline __u8 __ctrl_size(struct l2cap_chan *chan)
787{
788 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
789 return L2CAP_EXT_HDR_SIZE - L2CAP_HDR_SIZE;
790 else
791 return L2CAP_ENH_HDR_SIZE - L2CAP_HDR_SIZE;
792}
491 793
492extern int disable_ertm; 794extern int disable_ertm;
795extern int enable_hs;
493 796
494int l2cap_init_sockets(void); 797int l2cap_init_sockets(void);
495void l2cap_cleanup_sockets(void); 798void l2cap_cleanup_sockets(void);
@@ -504,7 +807,8 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk);
504void l2cap_chan_close(struct l2cap_chan *chan, int reason); 807void l2cap_chan_close(struct l2cap_chan *chan, int reason);
505void l2cap_chan_destroy(struct l2cap_chan *chan); 808void l2cap_chan_destroy(struct l2cap_chan *chan);
506int l2cap_chan_connect(struct l2cap_chan *chan); 809int l2cap_chan_connect(struct l2cap_chan *chan);
507int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); 810int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
811 u32 priority);
508void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 812void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
509 813
510#endif /* __L2CAP_H */ 814#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index d66da0f94f95..3e320c9cae8f 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -69,6 +69,10 @@ struct mgmt_mode {
69#define MGMT_OP_SET_POWERED 0x0005 69#define MGMT_OP_SET_POWERED 0x0005
70 70
71#define MGMT_OP_SET_DISCOVERABLE 0x0006 71#define MGMT_OP_SET_DISCOVERABLE 0x0006
72struct mgmt_cp_set_discoverable {
73 __u8 val;
74 __u16 timeout;
75} __packed;
72 76
73#define MGMT_OP_SET_CONNECTABLE 0x0007 77#define MGMT_OP_SET_CONNECTABLE 0x0007
74 78
@@ -96,24 +100,22 @@ struct mgmt_cp_set_service_cache {
96 __u8 enable; 100 __u8 enable;
97} __packed; 101} __packed;
98 102
99struct mgmt_key_info { 103struct mgmt_link_key_info {
100 bdaddr_t bdaddr; 104 bdaddr_t bdaddr;
101 u8 type; 105 u8 type;
102 u8 val[16]; 106 u8 val[16];
103 u8 pin_len; 107 u8 pin_len;
104 u8 dlen;
105 u8 data[0];
106} __packed; 108} __packed;
107 109
108#define MGMT_OP_LOAD_KEYS 0x000D 110#define MGMT_OP_LOAD_LINK_KEYS 0x000D
109struct mgmt_cp_load_keys { 111struct mgmt_cp_load_link_keys {
110 __u8 debug_keys; 112 __u8 debug_keys;
111 __le16 key_count; 113 __le16 key_count;
112 struct mgmt_key_info keys[0]; 114 struct mgmt_link_key_info keys[0];
113} __packed; 115} __packed;
114 116
115#define MGMT_OP_REMOVE_KEY 0x000E 117#define MGMT_OP_REMOVE_KEYS 0x000E
116struct mgmt_cp_remove_key { 118struct mgmt_cp_remove_keys {
117 bdaddr_t bdaddr; 119 bdaddr_t bdaddr;
118 __u8 disconnect; 120 __u8 disconnect;
119} __packed; 121} __packed;
@@ -126,10 +128,20 @@ struct mgmt_rp_disconnect {
126 bdaddr_t bdaddr; 128 bdaddr_t bdaddr;
127} __packed; 129} __packed;
128 130
131#define MGMT_ADDR_BREDR 0x00
132#define MGMT_ADDR_LE 0x01
133#define MGMT_ADDR_BREDR_LE 0x02
134#define MGMT_ADDR_INVALID 0xff
135
136struct mgmt_addr_info {
137 bdaddr_t bdaddr;
138 __u8 type;
139} __packed;
140
129#define MGMT_OP_GET_CONNECTIONS 0x0010 141#define MGMT_OP_GET_CONNECTIONS 0x0010
130struct mgmt_rp_get_connections { 142struct mgmt_rp_get_connections {
131 __le16 conn_count; 143 __le16 conn_count;
132 bdaddr_t conn[0]; 144 struct mgmt_addr_info addr[0];
133} __packed; 145} __packed;
134 146
135#define MGMT_OP_PIN_CODE_REPLY 0x0011 147#define MGMT_OP_PIN_CODE_REPLY 0x0011
@@ -245,26 +257,19 @@ struct mgmt_ev_controller_error {
245 257
246#define MGMT_EV_PAIRABLE 0x0009 258#define MGMT_EV_PAIRABLE 0x0009
247 259
248#define MGMT_EV_NEW_KEY 0x000A 260#define MGMT_EV_NEW_LINK_KEY 0x000A
249struct mgmt_ev_new_key { 261struct mgmt_ev_new_link_key {
250 __u8 store_hint; 262 __u8 store_hint;
251 struct mgmt_key_info key; 263 struct mgmt_link_key_info key;
252} __packed; 264} __packed;
253 265
254#define MGMT_EV_CONNECTED 0x000B 266#define MGMT_EV_CONNECTED 0x000B
255struct mgmt_ev_connected {
256 bdaddr_t bdaddr;
257 __u8 link_type;
258} __packed;
259 267
260#define MGMT_EV_DISCONNECTED 0x000C 268#define MGMT_EV_DISCONNECTED 0x000C
261struct mgmt_ev_disconnected {
262 bdaddr_t bdaddr;
263} __packed;
264 269
265#define MGMT_EV_CONNECT_FAILED 0x000D 270#define MGMT_EV_CONNECT_FAILED 0x000D
266struct mgmt_ev_connect_failed { 271struct mgmt_ev_connect_failed {
267 bdaddr_t bdaddr; 272 struct mgmt_addr_info addr;
268 __u8 status; 273 __u8 status;
269} __packed; 274} __packed;
270 275
@@ -294,7 +299,7 @@ struct mgmt_ev_local_name_changed {
294 299
295#define MGMT_EV_DEVICE_FOUND 0x0012 300#define MGMT_EV_DEVICE_FOUND 0x0012
296struct mgmt_ev_device_found { 301struct mgmt_ev_device_found {
297 bdaddr_t bdaddr; 302 struct mgmt_addr_info addr;
298 __u8 dev_class[3]; 303 __u8 dev_class[3];
299 __s8 rssi; 304 __s8 rssi;
300 __u8 eir[HCI_MAX_EIR_LENGTH]; 305 __u8 eir[HCI_MAX_EIR_LENGTH];
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 92cf1c2c30c9..8d7ba0961d3e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -391,6 +391,8 @@ struct cfg80211_crypto_settings {
391 * @assocresp_ies: extra information element(s) to add into (Re)Association 391 * @assocresp_ies: extra information element(s) to add into (Re)Association
392 * Response frames or %NULL 392 * Response frames or %NULL
393 * @assocresp_ies_len: length of assocresp_ies in octets 393 * @assocresp_ies_len: length of assocresp_ies in octets
394 * @probe_resp_len: length of probe response template (@probe_resp)
395 * @probe_resp: probe response template (AP mode only)
394 */ 396 */
395struct beacon_parameters { 397struct beacon_parameters {
396 u8 *head, *tail; 398 u8 *head, *tail;
@@ -408,6 +410,8 @@ struct beacon_parameters {
408 size_t proberesp_ies_len; 410 size_t proberesp_ies_len;
409 const u8 *assocresp_ies; 411 const u8 *assocresp_ies;
410 size_t assocresp_ies_len; 412 size_t assocresp_ies_len;
413 int probe_resp_len;
414 u8 *probe_resp;
411}; 415};
412 416
413/** 417/**
@@ -456,6 +460,9 @@ enum station_parameters_apply_mask {
456 * as the AC bitmap in the QoS info field 460 * as the AC bitmap in the QoS info field
457 * @max_sp: max Service Period. same format as the MAX_SP in the 461 * @max_sp: max Service Period. same format as the MAX_SP in the
458 * QoS info field (but already shifted down) 462 * QoS info field (but already shifted down)
463 * @sta_modify_mask: bitmap indicating which parameters changed
464 * (for those that don't have a natural "no change" value),
465 * see &enum station_parameters_apply_mask
459 */ 466 */
460struct station_parameters { 467struct station_parameters {
461 u8 *supported_rates; 468 u8 *supported_rates;
@@ -615,6 +622,7 @@ struct sta_bss_parameters {
615 * user space MLME/SME implementation. The information is provided for 622 * user space MLME/SME implementation. The information is provided for
616 * the cfg80211_new_sta() calls to notify user space of the IEs. 623 * the cfg80211_new_sta() calls to notify user space of the IEs.
617 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 624 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
625 * @sta_flags: station flags mask & values
618 */ 626 */
619struct station_info { 627struct station_info {
620 u32 filled; 628 u32 filled;
@@ -1338,6 +1346,9 @@ struct cfg80211_gtk_rekey_data {
1338 * doesn't verify much. Note, however, that the passed netdev may be 1346 * doesn't verify much. Note, however, that the passed netdev may be
1339 * %NULL as well if the user requested changing the channel for the 1347 * %NULL as well if the user requested changing the channel for the
1340 * device itself, or for a monitor interface. 1348 * device itself, or for a monitor interface.
1349 * @get_channel: Get the current operating channel, should return %NULL if
1350 * there's no single defined operating channel if for example the
1351 * device implements channel hopping for multi-channel virtual interfaces.
1341 * 1352 *
1342 * @scan: Request to do a scan. If returning zero, the scan request is given 1353 * @scan: Request to do a scan. If returning zero, the scan request is given
1343 * the driver, and will be valid until passed to cfg80211_scan_done(). 1354 * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1428,6 +1439,9 @@ struct cfg80211_gtk_rekey_data {
1428 * 1439 *
1429 * @tdls_mgmt: Transmit a TDLS management frame. 1440 * @tdls_mgmt: Transmit a TDLS management frame.
1430 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 1441 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
1442 *
1443 * @probe_client: probe an associated client, must return a cookie that it
1444 * later passes to cfg80211_probe_status().
1431 */ 1445 */
1432struct cfg80211_ops { 1446struct cfg80211_ops {
1433 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1447 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1581,7 +1595,7 @@ struct cfg80211_ops {
1581 enum nl80211_channel_type channel_type, 1595 enum nl80211_channel_type channel_type,
1582 bool channel_type_valid, unsigned int wait, 1596 bool channel_type_valid, unsigned int wait,
1583 const u8 *buf, size_t len, bool no_cck, 1597 const u8 *buf, size_t len, bool no_cck,
1584 u64 *cookie); 1598 bool dont_wait_for_ack, u64 *cookie);
1585 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1599 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1586 struct net_device *dev, 1600 struct net_device *dev,
1587 u64 cookie); 1601 u64 cookie);
@@ -1617,6 +1631,11 @@ struct cfg80211_ops {
1617 u16 status_code, const u8 *buf, size_t len); 1631 u16 status_code, const u8 *buf, size_t len);
1618 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 1632 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1619 u8 *peer, enum nl80211_tdls_operation oper); 1633 u8 *peer, enum nl80211_tdls_operation oper);
1634
1635 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
1636 const u8 *peer, u64 *cookie);
1637
1638 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
1620}; 1639};
1621 1640
1622/* 1641/*
@@ -1675,6 +1694,12 @@ struct cfg80211_ops {
1675 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 1694 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
1676 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 1695 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
1677 * used for asking the driver/firmware to perform a TDLS operation. 1696 * used for asking the driver/firmware to perform a TDLS operation.
1697 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
1698 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
1699 * when there are virtual interfaces in AP mode by calling
1700 * cfg80211_report_obss_beacon().
1701 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
1702 * responds to probe-requests in hardware.
1678 */ 1703 */
1679enum wiphy_flags { 1704enum wiphy_flags {
1680 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 1705 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),
@@ -1693,6 +1718,9 @@ enum wiphy_flags {
1693 WIPHY_FLAG_AP_UAPSD = BIT(14), 1718 WIPHY_FLAG_AP_UAPSD = BIT(14),
1694 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 1719 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
1695 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 1720 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
1721 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
1722 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
1723 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
1696}; 1724};
1697 1725
1698/** 1726/**
@@ -1865,6 +1893,7 @@ struct wiphy_wowlan_support {
1865 * @software_iftypes: bitmask of software interface types, these are not 1893 * @software_iftypes: bitmask of software interface types, these are not
1866 * subject to any restrictions since they are purely managed in SW. 1894 * subject to any restrictions since they are purely managed in SW.
1867 * @flags: wiphy flags, see &enum wiphy_flags 1895 * @flags: wiphy flags, see &enum wiphy_flags
1896 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
1868 * @bss_priv_size: each BSS struct has private data allocated with it, 1897 * @bss_priv_size: each BSS struct has private data allocated with it,
1869 * this variable determines its size 1898 * this variable determines its size
1870 * @max_scan_ssids: maximum number of SSIDs the device can scan for in 1899 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
@@ -1903,6 +1932,8 @@ struct wiphy_wowlan_support {
1903 * may request, if implemented. 1932 * may request, if implemented.
1904 * 1933 *
1905 * @wowlan: WoWLAN support information 1934 * @wowlan: WoWLAN support information
1935 *
1936 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
1906 */ 1937 */
1907struct wiphy { 1938struct wiphy {
1908 /* assign these fields before you register the wiphy */ 1939 /* assign these fields before you register the wiphy */
@@ -1924,7 +1955,9 @@ struct wiphy {
1924 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1955 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1925 u16 interface_modes; 1956 u16 interface_modes;
1926 1957
1927 u32 flags; 1958 u32 flags, features;
1959
1960 u32 ap_sme_capa;
1928 1961
1929 enum cfg80211_signal_type signal_type; 1962 enum cfg80211_signal_type signal_type;
1930 1963
@@ -1956,6 +1989,13 @@ struct wiphy {
1956 u32 available_antennas_tx; 1989 u32 available_antennas_tx;
1957 u32 available_antennas_rx; 1990 u32 available_antennas_rx;
1958 1991
1992 /*
1993 * Bitmap of supported protocols for probe response offloading
1994 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
1995 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
1996 */
1997 u32 probe_resp_offload;
1998
1959 /* If multiple wiphys are registered and you're handed e.g. 1999 /* If multiple wiphys are registered and you're handed e.g.
1960 * a regular netdev with assigned ieee80211_ptr, you won't 2000 * a regular netdev with assigned ieee80211_ptr, you won't
1961 * know whether it points to a wiphy your driver has registered 2001 * know whether it points to a wiphy your driver has registered
@@ -2179,6 +2219,8 @@ struct wireless_dev {
2179 2219
2180 int beacon_interval; 2220 int beacon_interval;
2181 2221
2222 u32 ap_unexpected_nlpid;
2223
2182#ifdef CONFIG_CFG80211_WEXT 2224#ifdef CONFIG_CFG80211_WEXT
2183 /* wext data */ 2225 /* wext data */
2184 struct { 2226 struct {
@@ -2632,8 +2674,10 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
2632 * 2674 *
2633 * This informs cfg80211 that BSS information was found and 2675 * This informs cfg80211 that BSS information was found and
2634 * the BSS should be updated/added. 2676 * the BSS should be updated/added.
2677 *
2678 * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
2635 */ 2679 */
2636struct cfg80211_bss* 2680struct cfg80211_bss * __must_check
2637cfg80211_inform_bss_frame(struct wiphy *wiphy, 2681cfg80211_inform_bss_frame(struct wiphy *wiphy,
2638 struct ieee80211_channel *channel, 2682 struct ieee80211_channel *channel,
2639 struct ieee80211_mgmt *mgmt, size_t len, 2683 struct ieee80211_mgmt *mgmt, size_t len,
@@ -2655,8 +2699,10 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2655 * 2699 *
2656 * This informs cfg80211 that BSS information was found and 2700 * This informs cfg80211 that BSS information was found and
2657 * the BSS should be updated/added. 2701 * the BSS should be updated/added.
2702 *
2703 * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
2658 */ 2704 */
2659struct cfg80211_bss* 2705struct cfg80211_bss * __must_check
2660cfg80211_inform_bss(struct wiphy *wiphy, 2706cfg80211_inform_bss(struct wiphy *wiphy,
2661 struct ieee80211_channel *channel, 2707 struct ieee80211_channel *channel,
2662 const u8 *bssid, 2708 const u8 *bssid,
@@ -3185,6 +3231,64 @@ void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3185void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 3231void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3186 const u8 *bssid, bool preauth, gfp_t gfp); 3232 const u8 *bssid, bool preauth, gfp_t gfp);
3187 3233
3234/**
3235 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
3236 * @dev: The device the frame matched to
3237 * @addr: the transmitter address
3238 * @gfp: context flags
3239 *
3240 * This function is used in AP mode (only!) to inform userspace that
3241 * a spurious class 3 frame was received, to be able to deauth the
3242 * sender.
3243 * Returns %true if the frame was passed to userspace (or this failed
3244 * for a reason other than not having a subscription.)
3245 */
3246bool cfg80211_rx_spurious_frame(struct net_device *dev,
3247 const u8 *addr, gfp_t gfp);
3248
3249/**
3250 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
3251 * @dev: The device the frame matched to
3252 * @addr: the transmitter address
3253 * @gfp: context flags
3254 *
3255 * This function is used in AP mode (only!) to inform userspace that
3256 * an associated station sent a 4addr frame but that wasn't expected.
3257 * It is allowed and desirable to send this event only once for each
3258 * station to avoid event flooding.
3259 * Returns %true if the frame was passed to userspace (or this failed
3260 * for a reason other than not having a subscription.)
3261 */
3262bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
3263 const u8 *addr, gfp_t gfp);
3264
3265/**
3266 * cfg80211_probe_status - notify userspace about probe status
3267 * @dev: the device the probe was sent on
3268 * @addr: the address of the peer
3269 * @cookie: the cookie filled in @probe_client previously
3270 * @acked: indicates whether probe was acked or not
3271 * @gfp: allocation flags
3272 */
3273void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3274 u64 cookie, bool acked, gfp_t gfp);
3275
3276/**
3277 * cfg80211_report_obss_beacon - report beacon from other APs
3278 * @wiphy: The wiphy that received the beacon
3279 * @frame: the frame
3280 * @len: length of the frame
3281 * @freq: frequency the frame was received on
3282 * @gfp: allocation flags
3283 *
3284 * Use this function to report to userspace when a beacon was
3285 * received. It is not useful to call this when there is no
3286 * netdev that is in AP/GO mode.
3287 */
3288void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3289 const u8 *frame, size_t len,
3290 int freq, gfp_t gfp);
3291
3188/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3292/* Logging, debugging and troubleshooting/diagnostic helpers. */
3189 3293
3190/* wiphy_printk helpers, similar to dev_printk */ 3294/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 7e2c4d483ad0..71392545d0a1 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -271,14 +271,6 @@ enum ieee80211_radiotap_type {
271#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 271#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
272 272
273 273
274/* Ugly macro to convert literal channel numbers into their mhz equivalents
275 * There are certianly some conditions that will break this (like feeding it '30')
276 * but they shouldn't arise since nothing talks on channel 30. */
277#define ieee80211chan2mhz(x) \
278 (((x) <= 14) ? \
279 (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
280 ((x) + 1000) * 5)
281
282/* helpers */ 274/* helpers */
283static inline int ieee80211_get_radiotap_len(unsigned char *data) 275static inline int ieee80211_get_radiotap_len(unsigned char *data)
284{ 276{
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 72eddd1b410b..0756049ae76d 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -166,6 +166,7 @@ struct ieee80211_low_level_stats {
166 * that it is only ever disabled for station mode. 166 * that it is only ever disabled for station mode.
167 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. 167 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
168 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 168 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)
169 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
169 */ 170 */
170enum ieee80211_bss_change { 171enum ieee80211_bss_change {
171 BSS_CHANGED_ASSOC = 1<<0, 172 BSS_CHANGED_ASSOC = 1<<0,
@@ -184,6 +185,7 @@ enum ieee80211_bss_change {
184 BSS_CHANGED_QOS = 1<<13, 185 BSS_CHANGED_QOS = 1<<13,
185 BSS_CHANGED_IDLE = 1<<14, 186 BSS_CHANGED_IDLE = 1<<14,
186 BSS_CHANGED_SSID = 1<<15, 187 BSS_CHANGED_SSID = 1<<15,
188 BSS_CHANGED_AP_PROBE_RESP = 1<<16,
187 189
188 /* when adding here, make sure to change ieee80211_reconfig */ 190 /* when adding here, make sure to change ieee80211_reconfig */
189}; 191};
@@ -518,7 +520,7 @@ struct ieee80211_tx_rate {
518 * @flags: transmit info flags, defined above 520 * @flags: transmit info flags, defined above
519 * @band: the band to transmit on (use for checking for races) 521 * @band: the band to transmit on (use for checking for races)
520 * @antenna_sel_tx: antenna to use, 0 for automatic diversity 522 * @antenna_sel_tx: antenna to use, 0 for automatic diversity
521 * @pad: padding, ignore 523 * @ack_frame_id: internal frame ID for TX status, used internally
522 * @control: union for control data 524 * @control: union for control data
523 * @status: union for status data 525 * @status: union for status data
524 * @driver_data: array of driver_data pointers 526 * @driver_data: array of driver_data pointers
@@ -535,8 +537,7 @@ struct ieee80211_tx_info {
535 537
536 u8 antenna_sel_tx; 538 u8 antenna_sel_tx;
537 539
538 /* 2 byte hole */ 540 u16 ack_frame_id;
539 u8 pad[2];
540 541
541 union { 542 union {
542 struct { 543 struct {
@@ -901,6 +902,10 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
901 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a 902 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
902 * CCMP key if it requires CCMP encryption of management frames (MFP) to 903 * CCMP key if it requires CCMP encryption of management frames (MFP) to
903 * be done in software. 904 * be done in software.
905 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
906 * for a CCMP key if space should be prepared for the IV, but the IV
907 * itself should not be generated. Do not set together with
908 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.
904 */ 909 */
905enum ieee80211_key_flags { 910enum ieee80211_key_flags {
906 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 911 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
@@ -908,6 +913,7 @@ enum ieee80211_key_flags {
908 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 913 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
909 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 914 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
910 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4, 915 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
916 IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5,
911}; 917};
912 918
913/** 919/**
@@ -1304,6 +1310,16 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1304} 1310}
1305 1311
1306/** 1312/**
1313 * ieee80211_free_txskb - free TX skb
1314 * @hw: the hardware
1315 * @skb: the skb
1316 *
1317 * Free a transmit skb. Use this funtion when some failure
1318 * to transmit happened and thus status cannot be reported.
1319 */
1320void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1321
1322/**
1307 * DOC: Hardware crypto acceleration 1323 * DOC: Hardware crypto acceleration
1308 * 1324 *
1309 * mac80211 is capable of taking advantage of many hardware 1325 * mac80211 is capable of taking advantage of many hardware
@@ -2661,6 +2677,19 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
2661} 2677}
2662 2678
2663/** 2679/**
2680 * ieee80211_proberesp_get - retrieve a Probe Response template
2681 * @hw: pointer obtained from ieee80211_alloc_hw().
2682 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2683 *
2684 * Creates a Probe Response template which can, for example, be uploaded to
2685 * hardware. The destination address should be set by the caller.
2686 *
2687 * Can only be called in AP mode.
2688 */
2689struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
2690 struct ieee80211_vif *vif);
2691
2692/**
2664 * ieee80211_pspoll_get - retrieve a PS Poll template 2693 * ieee80211_pspoll_get - retrieve a PS Poll template
2665 * @hw: pointer obtained from ieee80211_alloc_hw(). 2694 * @hw: pointer obtained from ieee80211_alloc_hw().
2666 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2695 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 39b85bc0804f..cdbe67139343 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -36,24 +36,23 @@
36/* NCI Status Codes */ 36/* NCI Status Codes */
37#define NCI_STATUS_OK 0x00 37#define NCI_STATUS_OK 0x00
38#define NCI_STATUS_REJECTED 0x01 38#define NCI_STATUS_REJECTED 0x01
39#define NCI_STATUS_MESSAGE_CORRUPTED 0x02 39#define NCI_STATUS_RF_FRAME_CORRUPTED 0x02
40#define NCI_STATUS_BUFFER_FULL 0x03 40#define NCI_STATUS_FAILED 0x03
41#define NCI_STATUS_FAILED 0x04 41#define NCI_STATUS_NOT_INITIALIZED 0x04
42#define NCI_STATUS_NOT_INITIALIZED 0x05 42#define NCI_STATUS_SYNTAX_ERROR 0x05
43#define NCI_STATUS_SYNTAX_ERROR 0x06 43#define NCI_STATUS_SEMANTIC_ERROR 0x06
44#define NCI_STATUS_SEMANTIC_ERROR 0x07 44#define NCI_STATUS_UNKNOWN_GID 0x07
45#define NCI_STATUS_UNKNOWN_GID 0x08 45#define NCI_STATUS_UNKNOWN_OID 0x08
46#define NCI_STATUS_UNKNOWN_OID 0x09 46#define NCI_STATUS_INVALID_PARAM 0x09
47#define NCI_STATUS_INVALID_PARAM 0x0a 47#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0a
48#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0b
49/* Discovery Specific Status Codes */ 48/* Discovery Specific Status Codes */
50#define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0 49#define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0
51#define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1 50#define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1
51#define NCI_STATUS_DISCOVERY_TEAR_DOWN 0xa2
52/* RF Interface Specific Status Codes */ 52/* RF Interface Specific Status Codes */
53#define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0 53#define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0
54#define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1 54#define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1
55#define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2 55#define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2
56#define NCI_STATUS_RF_LINK_LOSS_ERROR 0xb3
57/* NFCEE Interface Specific Status Codes */ 56/* NFCEE Interface Specific Status Codes */
58#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0 57#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0
59#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1 58#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1
@@ -73,6 +72,21 @@
73#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 72#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83
74#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 73#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85
75 74
75/* NCI RF Technologies */
76#define NCI_NFC_RF_TECHNOLOGY_A 0x00
77#define NCI_NFC_RF_TECHNOLOGY_B 0x01
78#define NCI_NFC_RF_TECHNOLOGY_F 0x02
79#define NCI_NFC_RF_TECHNOLOGY_15693 0x03
80
81/* NCI Bit Rates */
82#define NCI_NFC_BIT_RATE_106 0x00
83#define NCI_NFC_BIT_RATE_212 0x01
84#define NCI_NFC_BIT_RATE_424 0x02
85#define NCI_NFC_BIT_RATE_848 0x03
86#define NCI_NFC_BIT_RATE_1696 0x04
87#define NCI_NFC_BIT_RATE_3392 0x05
88#define NCI_NFC_BIT_RATE_6784 0x06
89
76/* NCI RF Protocols */ 90/* NCI RF Protocols */
77#define NCI_RF_PROTOCOL_UNKNOWN 0x00 91#define NCI_RF_PROTOCOL_UNKNOWN 0x00
78#define NCI_RF_PROTOCOL_T1T 0x01 92#define NCI_RF_PROTOCOL_T1T 0x01
@@ -82,11 +96,21 @@
82#define NCI_RF_PROTOCOL_NFC_DEP 0x05 96#define NCI_RF_PROTOCOL_NFC_DEP 0x05
83 97
84/* NCI RF Interfaces */ 98/* NCI RF Interfaces */
85#define NCI_RF_INTERFACE_RFU 0x00 99#define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00
86#define NCI_RF_INTERFACE_FRAME 0x01 100#define NCI_RF_INTERFACE_FRAME 0x01
87#define NCI_RF_INTERFACE_ISO_DEP 0x02 101#define NCI_RF_INTERFACE_ISO_DEP 0x02
88#define NCI_RF_INTERFACE_NFC_DEP 0x03 102#define NCI_RF_INTERFACE_NFC_DEP 0x03
89 103
104/* NCI Reset types */
105#define NCI_RESET_TYPE_KEEP_CONFIG 0x00
106#define NCI_RESET_TYPE_RESET_CONFIG 0x01
107
108/* NCI Static RF connection ID */
109#define NCI_STATIC_RF_CONN_ID 0x00
110
111/* NCI Data Flow Control */
112#define NCI_DATA_FLOW_CONTROL_NOT_USED 0xff
113
90/* NCI RF_DISCOVER_MAP_CMD modes */ 114/* NCI RF_DISCOVER_MAP_CMD modes */
91#define NCI_DISC_MAP_MODE_POLL 0x01 115#define NCI_DISC_MAP_MODE_POLL 0x01
92#define NCI_DISC_MAP_MODE_LISTEN 0x02 116#define NCI_DISC_MAP_MODE_LISTEN 0x02
@@ -98,8 +122,6 @@
98#define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02 122#define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02
99#define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03 123#define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03
100#define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05 124#define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05
101#define NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE 0x06
102#define NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE 0x07
103#define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09 125#define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09
104#define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80 126#define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80
105#define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81 127#define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81
@@ -111,8 +133,7 @@
111#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 133#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
112#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 134#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
113#define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02 135#define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02
114#define NCI_DEACTIVATE_TYPE_RF_LINK_LOSS 0x03 136#define NCI_DEACTIVATE_TYPE_DISCOVERY 0x03
115#define NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR 0x04
116 137
117/* Message Type (MT) */ 138/* Message Type (MT) */
118#define NCI_MT_DATA_PKT 0x00 139#define NCI_MT_DATA_PKT 0x00
@@ -169,18 +190,11 @@ struct nci_data_hdr {
169/* ----- NCI Commands ---- */ 190/* ----- NCI Commands ---- */
170/* ------------------------ */ 191/* ------------------------ */
171#define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00) 192#define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00)
172 193struct nci_core_reset_cmd {
173#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) 194 __u8 reset_type;
174
175#define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02)
176
177#define NCI_OP_CORE_CONN_CREATE_CMD nci_opcode_pack(NCI_GID_CORE, 0x04)
178struct nci_core_conn_create_cmd {
179 __u8 target_handle;
180 __u8 num_target_specific_params;
181} __packed; 195} __packed;
182 196
183#define NCI_OP_CORE_CONN_CLOSE_CMD nci_opcode_pack(NCI_GID_CORE, 0x06) 197#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01)
184 198
185#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 199#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
186struct disc_map_config { 200struct disc_map_config {
@@ -218,6 +232,7 @@ struct nci_rf_deactivate_cmd {
218struct nci_core_reset_rsp { 232struct nci_core_reset_rsp {
219 __u8 status; 233 __u8 status;
220 __u8 nci_ver; 234 __u8 nci_ver;
235 __u8 config_status;
221} __packed; 236} __packed;
222 237
223#define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01) 238#define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01)
@@ -232,24 +247,14 @@ struct nci_core_init_rsp_1 {
232struct nci_core_init_rsp_2 { 247struct nci_core_init_rsp_2 {
233 __u8 max_logical_connections; 248 __u8 max_logical_connections;
234 __le16 max_routing_table_size; 249 __le16 max_routing_table_size;
235 __u8 max_control_packet_payload_length; 250 __u8 max_ctrl_pkt_payload_len;
236 __le16 rf_sending_buffer_size; 251 __le16 max_size_for_large_params;
237 __le16 rf_receiving_buffer_size; 252 __u8 max_data_pkt_payload_size;
238 __le16 manufacturer_id;
239} __packed;
240
241#define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02)
242
243#define NCI_OP_CORE_CONN_CREATE_RSP nci_opcode_pack(NCI_GID_CORE, 0x04)
244struct nci_core_conn_create_rsp {
245 __u8 status;
246 __u8 max_pkt_payload_size;
247 __u8 initial_num_credits; 253 __u8 initial_num_credits;
248 __u8 conn_id; 254 __u8 manufact_id;
255 __le32 manufact_specific_info;
249} __packed; 256} __packed;
250 257
251#define NCI_OP_CORE_CONN_CLOSE_RSP nci_opcode_pack(NCI_GID_CORE, 0x06)
252
253#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 258#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
254 259
255#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 260#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
@@ -270,12 +275,7 @@ struct nci_core_conn_credit_ntf {
270 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 275 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
271} __packed; 276} __packed;
272 277
273#define NCI_OP_RF_FIELD_INFO_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 278#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
274struct nci_rf_field_info_ntf {
275 __u8 rf_field_status;
276} __packed;
277
278#define NCI_OP_RF_ACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
279struct rf_tech_specific_params_nfca_poll { 279struct rf_tech_specific_params_nfca_poll {
280 __u16 sens_res; 280 __u16 sens_res;
281 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 281 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
@@ -289,17 +289,20 @@ struct activation_params_nfca_poll_iso_dep {
289 __u8 rats_res[20]; 289 __u8 rats_res[20];
290}; 290};
291 291
292struct nci_rf_activate_ntf { 292struct nci_rf_intf_activated_ntf {
293 __u8 target_handle; 293 __u8 rf_discovery_id;
294 __u8 rf_interface_type;
294 __u8 rf_protocol; 295 __u8 rf_protocol;
295 __u8 rf_tech_and_mode; 296 __u8 activation_rf_tech_and_mode;
296 __u8 rf_tech_specific_params_len; 297 __u8 rf_tech_specific_params_len;
297 298
298 union { 299 union {
299 struct rf_tech_specific_params_nfca_poll nfca_poll; 300 struct rf_tech_specific_params_nfca_poll nfca_poll;
300 } rf_tech_specific_params; 301 } rf_tech_specific_params;
301 302
302 __u8 rf_interface_type; 303 __u8 data_exch_rf_tech_and_mode;
304 __u8 data_exch_tx_bit_rate;
305 __u8 data_exch_rx_bit_rate;
303 __u8 activation_params_len; 306 __u8 activation_params_len;
304 307
305 union { 308 union {
@@ -309,5 +312,9 @@ struct nci_rf_activate_ntf {
309} __packed; 312} __packed;
310 313
311#define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 314#define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
315struct nci_rf_deactivate_ntf {
316 __u8 type;
317 __u8 reason;
318} __packed;
312 319
313#endif /* __NCI_H */ 320#endif /* __NCI_H */
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index b8b4bbd7e0fc..c92b69d7e0c2 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -109,15 +109,12 @@ struct nci_dev {
109 [NCI_MAX_SUPPORTED_RF_INTERFACES]; 109 [NCI_MAX_SUPPORTED_RF_INTERFACES];
110 __u8 max_logical_connections; 110 __u8 max_logical_connections;
111 __u16 max_routing_table_size; 111 __u16 max_routing_table_size;
112 __u8 max_control_packet_payload_length; 112 __u8 max_ctrl_pkt_payload_len;
113 __u16 rf_sending_buffer_size; 113 __u16 max_size_for_large_params;
114 __u16 rf_receiving_buffer_size; 114 __u8 max_data_pkt_payload_size;
115 __u16 manufacturer_id;
116
117 /* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
118 __u8 max_pkt_payload_size;
119 __u8 initial_num_credits; 115 __u8 initial_num_credits;
120 __u8 conn_id; 116 __u8 manufact_id;
117 __u32 manufact_specific_info;
121 118
122 /* stored during nci_data_exchange */ 119 /* stored during nci_data_exchange */
123 data_exchange_cb_t data_exchange_cb; 120 data_exchange_cb_t data_exchange_cb;
diff --git a/include/net/sock.h b/include/net/sock.h
index 1331008ad885..1c28f394d8ec 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -563,6 +563,7 @@ enum sock_flags {
563 SOCK_FASYNC, /* fasync() active */ 563 SOCK_FASYNC, /* fasync() active */
564 SOCK_RXQ_OVFL, 564 SOCK_RXQ_OVFL,
565 SOCK_ZEROCOPY, /* buffers from userspace */ 565 SOCK_ZEROCOPY, /* buffers from userspace */
566 SOCK_WIFI_STATUS, /* push wifi status to userspace */
566}; 567};
567 568
568static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 569static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -1714,6 +1715,8 @@ static inline int sock_intr_errno(long timeo)
1714 1715
1715extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 1716extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
1716 struct sk_buff *skb); 1717 struct sk_buff *skb);
1718extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
1719 struct sk_buff *skb);
1717 1720
1718static __inline__ void 1721static __inline__ void
1719sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1722sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -1741,6 +1744,9 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1741 __sock_recv_timestamp(msg, sk, skb); 1744 __sock_recv_timestamp(msg, sk, skb);
1742 else 1745 else
1743 sk->sk_stamp = kt; 1746 sk->sk_stamp = kt;
1747
1748 if (sock_flag(sk, SOCK_WIFI_STATUS) && skb->wifi_acked_valid)
1749 __sock_recv_wifi_status(msg, sk, skb);
1744} 1750}
1745 1751
1746extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 1752extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,