aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 14:54:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 14:54:29 -0400
commit28f3d717618156c0dcd2f497d791b578a7931d87 (patch)
tree37b11581b51929b5473541e53bd242b3e1a9f666 /include
parent654443e20dfc0617231f28a07c96a979ee1a0239 (diff)
parent1ca7ee30630e1022dbcf1b51be20580815ffab73 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull more networking updates from David Miller: "Ok, everything from here on out will be bug fixes." 1) One final sync of wireless and bluetooth stuff from John Linville. These changes have all been in his tree for more than a week, and therefore have had the necessary -next exposure. John was just away on a trip and didn't have a change to send the pull request until a day or two ago. 2) Put back some defines in user exposed header file areas that were removed during the tokenring purge. From Stephen Hemminger and Paul Gortmaker. 3) A bug fix for UDP hash table allocation got lost in the pile due to one of those "you got it.. no I've got it.." situations. :-) From Tim Bird. 4) SKB coalescing in TCP needs to have stricter checks, otherwise we'll try to coalesce overlapping frags and crash. Fix from Eric Dumazet. 5) RCU routing table lookups can race with free_fib_info(), causing crashes when we deref the device pointers in the route. Fix by releasing the net device in the RCU callback. From Yanmin Zhang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (293 commits) tcp: take care of overlaps in tcp_try_coalesce() ipv4: fix the rcu race between free_fib_info and ip_route_output_slow mm: add a low limit to alloc_large_system_hash ipx: restore token ring define to include/linux/ipx.h if: restore token ring ARP type to header xen: do not disable netfront in dom0 phy/micrel: Fix ID of KSZ9021 mISDN: Add X-Tensions USB ISDN TA XC-525 gianfar:don't add FCB length to hard_header_len Bluetooth: Report proper error number in disconnection Bluetooth: Create flags for bt_sk() Bluetooth: report the right security level in getsockopt Bluetooth: Lock the L2CAP channel when sending Bluetooth: Restore locking semantics when looking up L2CAP channels Bluetooth: Fix a redundant and problematic incoming MTU check Bluetooth: Add support for Foxconn/Hon Hai AR5BBU22 0489:E03C Bluetooth: Fix EIR data generation for mgmt_device_found Bluetooth: Fix Inquiry with RSSI event mask Bluetooth: improve readability of l2cap_seq_list code Bluetooth: Fix skb length calculation ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/bcma/bcma.h7
-rw-r--r--include/linux/bcma/bcma_driver_pci.h11
-rw-r--r--include/linux/bootmem.h3
-rw-r--r--include/linux/if_arp.h2
-rw-r--r--include/linux/ipx.h2
-rw-r--r--include/linux/micrel_phy.h2
-rw-r--r--include/linux/nfc/pn544.h7
-rw-r--r--include/linux/nl80211.h8
-rw-r--r--include/linux/ssb/ssb.h1
-rw-r--r--include/linux/ssb/ssb_regs.h61
-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
22 files changed, 277 insertions, 84 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 74af192ef7ae..4cd59b95858f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -270,6 +270,7 @@ header-y += netfilter_ipv4.h
270header-y += netfilter_ipv6.h 270header-y += netfilter_ipv6.h
271header-y += netlink.h 271header-y += netlink.h
272header-y += netrom.h 272header-y += netrom.h
273header-y += nfc.h
273header-y += nfs.h 274header-y += nfs.h
274header-y += nfs2.h 275header-y += nfs2.h
275header-y += nfs3.h 276header-y += nfs3.h
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 98bb2901d7b7..8deaf6d050c3 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -26,6 +26,11 @@ struct bcma_chipinfo {
26 u8 pkg; 26 u8 pkg;
27}; 27};
28 28
29struct bcma_boardinfo {
30 u16 vendor;
31 u16 type;
32};
33
29enum bcma_clkmode { 34enum bcma_clkmode {
30 BCMA_CLKMODE_FAST, 35 BCMA_CLKMODE_FAST,
31 BCMA_CLKMODE_DYNAMIC, 36 BCMA_CLKMODE_DYNAMIC,
@@ -199,6 +204,8 @@ struct bcma_bus {
199 204
200 struct bcma_chipinfo chipinfo; 205 struct bcma_chipinfo chipinfo;
201 206
207 struct bcma_boardinfo boardinfo;
208
202 struct bcma_device *mapped_core; 209 struct bcma_device *mapped_core;
203 struct list_head cores; 210 struct list_head cores;
204 u8 nr_cores; 211 u8 nr_cores;
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 46c71e27d31f..41da581e1612 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -87,6 +87,13 @@ struct pci_dev;
87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ 87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
88#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */ 88#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
89#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */ 89#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
90#define BCMA_CORE_PCI_SPROM_PI_OFFSET 0 /* first word */
91#define BCMA_CORE_PCI_SPROM_PI_MASK 0xf000 /* bit 15:12 */
92#define BCMA_CORE_PCI_SPROM_PI_SHIFT 12 /* bit 15:12 */
93#define BCMA_CORE_PCI_SPROM_MISC_CONFIG 5 /* word 5 */
94#define BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST 0x8000 /* bit 15 */
95#define BCMA_CORE_PCI_SPROM_CLKREQ_OFFSET_REV5 20 /* word 20 for srom rev <= 5 */
96#define BCMA_CORE_PCI_SPROM_CLKREQ_ENB 0x0800 /* bit 11 */
90 97
91/* SBtoPCIx */ 98/* SBtoPCIx */
92#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000 99#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
@@ -133,6 +140,7 @@ struct pci_dev;
133#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */ 140#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
134#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */ 141#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
135#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */ 142#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
143#define BCMA_CORE_PCI_ASPMTIMER_EXTEND 0x01000000 /* > rev7: enable extend ASPM timer */
136#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */ 144#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
137#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */ 145#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
138#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */ 146#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
@@ -201,12 +209,15 @@ struct bcma_drv_pci {
201}; 209};
202 210
203/* Register access */ 211/* Register access */
212#define pcicore_read16(pc, offset) bcma_read16((pc)->core, offset)
204#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) 213#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
205#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
206 216
207extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); 217extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
208extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
209 struct bcma_device *core, bool enable); 219 struct bcma_device *core, bool enable);
220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
210 221
211extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 222extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
212extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 223extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 66d3e954eb6c..1a0cd270bb7a 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -154,7 +154,8 @@ extern void *alloc_large_system_hash(const char *tablename,
154 int flags, 154 int flags,
155 unsigned int *_hash_shift, 155 unsigned int *_hash_shift,
156 unsigned int *_hash_mask, 156 unsigned int *_hash_mask,
157 unsigned long limit); 157 unsigned long low_limit,
158 unsigned long high_limit);
158 159
159#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 160#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
160#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min 161#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 26cb3c2c5c71..f0e69c6e8208 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -82,7 +82,7 @@
82#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ 82#define ARPHRD_FCPL 786 /* Fibrechannel public loop */
83#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ 83#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */
84 /* 787->799 reserved for fibrechannel media types */ 84 /* 787->799 reserved for fibrechannel media types */
85/* 800 used to be used for token ring */ 85#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */
86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ 86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
diff --git a/include/linux/ipx.h b/include/linux/ipx.h
index 8f0243982eb6..3d48014cdd71 100644
--- a/include/linux/ipx.h
+++ b/include/linux/ipx.h
@@ -38,7 +38,7 @@ struct ipx_interface_definition {
38#define IPX_FRAME_8022 2 38#define IPX_FRAME_8022 2
39#define IPX_FRAME_ETHERII 3 39#define IPX_FRAME_ETHERII 3
40#define IPX_FRAME_8023 4 40#define IPX_FRAME_8023 4
41/* obsolete token ring was 5 */ 41#define IPX_FRAME_TR_8022 5 /* obsolete */
42 unsigned char ipx_special; 42 unsigned char ipx_special;
43#define IPX_SPECIAL_NONE 0 43#define IPX_SPECIAL_NONE 0
44#define IPX_PRIMARY 1 44#define IPX_PRIMARY 1
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index dd8da342a991..61f0905bdc48 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -3,7 +3,7 @@
3 3
4#define MICREL_PHY_ID_MASK 0x00fffff0 4#define MICREL_PHY_ID_MASK 0x00fffff0
5 5
6#define PHY_ID_KSZ9021 0x00221611 6#define PHY_ID_KSZ9021 0x00221610
7#define PHY_ID_KS8737 0x00221720 7#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510 8#define PHY_ID_KS8041 0x00221510
9#define PHY_ID_KS8051 0x00221550 9#define PHY_ID_KS8051 0x00221550
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
index 7ab8521f2347..9890bbaf4328 100644
--- a/include/linux/nfc/pn544.h
+++ b/include/linux/nfc/pn544.h
@@ -84,6 +84,12 @@ struct pn544_fw_packet {
84}; 84};
85 85
86#ifdef __KERNEL__ 86#ifdef __KERNEL__
87enum {
88 NFC_GPIO_ENABLE,
89 NFC_GPIO_FW_RESET,
90 NFC_GPIO_IRQ
91};
92
87/* board config */ 93/* board config */
88struct pn544_nfc_platform_data { 94struct pn544_nfc_platform_data {
89 int (*request_resources) (struct i2c_client *client); 95 int (*request_resources) (struct i2c_client *client);
@@ -91,6 +97,7 @@ struct pn544_nfc_platform_data {
91 void (*enable) (int fw); 97 void (*enable) (int fw);
92 int (*test) (void); 98 int (*test) (void);
93 void (*disable) (void); 99 void (*disable) (void);
100 int (*get_gpio)(int type);
94}; 101};
95#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
96 103
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 2540e86d99ab..a6959f72745e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1594,6 +1594,8 @@ enum nl80211_sta_flags {
1594 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 1594 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
1595}; 1595};
1596 1596
1597#define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
1598
1597/** 1599/**
1598 * struct nl80211_sta_flag_update - station flags mask/set 1600 * struct nl80211_sta_flag_update - station flags mask/set
1599 * @mask: mask of station flags to set 1601 * @mask: mask of station flags to set
@@ -1994,9 +1996,9 @@ enum nl80211_reg_rule_flags {
1994 * enum nl80211_dfs_regions - regulatory DFS regions 1996 * enum nl80211_dfs_regions - regulatory DFS regions
1995 * 1997 *
1996 * @NL80211_DFS_UNSET: Country has no DFS master region specified 1998 * @NL80211_DFS_UNSET: Country has no DFS master region specified
1997 * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC 1999 * @NL80211_DFS_FCC: Country follows DFS master rules from FCC
1998 * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI 2000 * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI
1999 * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec 2001 * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec
2000 */ 2002 */
2001enum nl80211_dfs_regions { 2003enum nl80211_dfs_regions {
2002 NL80211_DFS_UNSET = 0, 2004 NL80211_DFS_UNSET = 0,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index d27683180025..bc14bd738ade 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -188,7 +188,6 @@ struct ssb_sprom {
188struct ssb_boardinfo { 188struct ssb_boardinfo {
189 u16 vendor; 189 u16 vendor;
190 u16 type; 190 u16 type;
191 u8 rev;
192}; 191};
193 192
194 193
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 40b1ef8595ee..a0525019e1d1 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -228,6 +228,7 @@
228#define SSB_SPROM1_AGAIN_BG_SHIFT 0 228#define SSB_SPROM1_AGAIN_BG_SHIFT 0
229#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ 229#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
230#define SSB_SPROM1_AGAIN_A_SHIFT 8 230#define SSB_SPROM1_AGAIN_A_SHIFT 8
231#define SSB_SPROM1_CCODE 0x0076
231 232
232/* SPROM Revision 2 (inherits from rev 1) */ 233/* SPROM Revision 2 (inherits from rev 1) */
233#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */ 234#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
@@ -267,6 +268,7 @@
267#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 268#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
268 269
269/* SPROM Revision 4 */ 270/* SPROM Revision 4 */
271#define SSB_SPROM4_BOARDREV 0x0042 /* Board revision */
270#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ 272#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
271#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ 273#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
272#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */ 274#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */
@@ -389,6 +391,11 @@
389#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ 391#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
390#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ 392#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
391#define SSB_SPROM8_GPIOB_P3_SHIFT 8 393#define SSB_SPROM8_GPIOB_P3_SHIFT 8
394#define SSB_SPROM8_LEDDC 0x009A
395#define SSB_SPROM8_LEDDC_ON 0xFF00 /* oncount */
396#define SSB_SPROM8_LEDDC_ON_SHIFT 8
397#define SSB_SPROM8_LEDDC_OFF 0x00FF /* offcount */
398#define SSB_SPROM8_LEDDC_OFF_SHIFT 0
392#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/ 399#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
393#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ 400#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
394#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 401#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
@@ -404,6 +411,13 @@
404#define SSB_SPROM8_AGAIN2_SHIFT 0 411#define SSB_SPROM8_AGAIN2_SHIFT 0
405#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ 412#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
406#define SSB_SPROM8_AGAIN3_SHIFT 8 413#define SSB_SPROM8_AGAIN3_SHIFT 8
414#define SSB_SPROM8_TXRXC 0x00A2
415#define SSB_SPROM8_TXRXC_TXCHAIN 0x000f
416#define SSB_SPROM8_TXRXC_TXCHAIN_SHIFT 0
417#define SSB_SPROM8_TXRXC_RXCHAIN 0x00f0
418#define SSB_SPROM8_TXRXC_RXCHAIN_SHIFT 4
419#define SSB_SPROM8_TXRXC_SWITCH 0xff00
420#define SSB_SPROM8_TXRXC_SWITCH_SHIFT 8
407#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */ 421#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
408#define SSB_SPROM8_RSSISMF2G 0x000F 422#define SSB_SPROM8_RSSISMF2G 0x000F
409#define SSB_SPROM8_RSSISMC2G 0x00F0 423#define SSB_SPROM8_RSSISMC2G 0x00F0
@@ -430,6 +444,7 @@
430#define SSB_SPROM8_TRI5GH_SHIFT 8 444#define SSB_SPROM8_TRI5GH_SHIFT 8
431#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */ 445#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 446#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
447#define SSB_SPROM8_RXPO2G_SHIFT 0
433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 448#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
434#define SSB_SPROM8_RXPO5G_SHIFT 8 449#define SSB_SPROM8_RXPO5G_SHIFT 8
435#define SSB_SPROM8_FEM2G 0x00AE 450#define SSB_SPROM8_FEM2G 0x00AE
@@ -445,10 +460,38 @@
445#define SSB_SROM8_FEM_ANTSWLUT 0xF800 460#define SSB_SROM8_FEM_ANTSWLUT 0xF800
446#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11 461#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
447#define SSB_SPROM8_THERMAL 0x00B2 462#define SSB_SPROM8_THERMAL 0x00B2
448#define SSB_SPROM8_MPWR_RAWTS 0x00B4 463#define SSB_SPROM8_THERMAL_OFFSET 0x00ff
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 464#define SSB_SPROM8_THERMAL_OFFSET_SHIFT 0
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 465#define SSB_SPROM8_THERMAL_TRESH 0xff00
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA 466#define SSB_SPROM8_THERMAL_TRESH_SHIFT 8
467/* Temp sense related entries */
468#define SSB_SPROM8_RAWTS 0x00B4
469#define SSB_SPROM8_RAWTS_RAWTEMP 0x01ff
470#define SSB_SPROM8_RAWTS_RAWTEMP_SHIFT 0
471#define SSB_SPROM8_RAWTS_MEASPOWER 0xfe00
472#define SSB_SPROM8_RAWTS_MEASPOWER_SHIFT 9
473#define SSB_SPROM8_OPT_CORRX 0x00B6
474#define SSB_SPROM8_OPT_CORRX_TEMP_SLOPE 0x00ff
475#define SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT 0
476#define SSB_SPROM8_OPT_CORRX_TEMPCORRX 0xfc00
477#define SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT 10
478#define SSB_SPROM8_OPT_CORRX_TEMP_OPTION 0x0300
479#define SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT 8
480/* FOC: freiquency offset correction, HWIQ: H/W IOCAL enable, IQSWP: IQ CAL swap disable */
481#define SSB_SPROM8_HWIQ_IQSWP 0x00B8
482#define SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR 0x000f
483#define SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT 0
484#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP 0x0010
485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4
486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020
487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5
488#define SSB_SPROM8_TEMPDELTA 0x00BA
489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff
490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0
491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00
492#define SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT 8
493#define SSB_SPROM8_TEMPDELTA_HYSTERESIS 0xf000
494#define SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT 12
452 495
453/* There are 4 blocks with power info sharing the same layout */ 496/* There are 4 blocks with power info sharing the same layout */
454#define SSB_SROM8_PWR_INFO_CORE0 0x00C0 497#define SSB_SROM8_PWR_INFO_CORE0 0x00C0
@@ -513,6 +556,16 @@
513#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */ 556#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
514#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */ 557#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
515 558
559#define SSB_SPROM8_2G_MCSPO 0x0152
560#define SSB_SPROM8_5G_MCSPO 0x0162
561#define SSB_SPROM8_5GL_MCSPO 0x0172
562#define SSB_SPROM8_5GH_MCSPO 0x0182
563
564#define SSB_SPROM8_CDDPO 0x0192
565#define SSB_SPROM8_STBCPO 0x0194
566#define SSB_SPROM8_BW40PO 0x0196
567#define SSB_SPROM8_BWDUPPO 0x0198
568
516/* Values for boardflags_lo read from SPROM */ 569/* Values for boardflags_lo read from SPROM */
517#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */ 570#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */
518#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */ 571#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */
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 {