aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/can/Kbuild1
-rw-r--r--include/linux/can/dev.h70
-rw-r--r--include/linux/can/netlink.h113
-rw-r--r--include/linux/can/platform/sja1000.h32
-rw-r--r--include/linux/etherdevice.h27
-rw-r--r--include/linux/ethtool.h15
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/ieee80211.h51
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/mdio.h347
-rw-r--r--include/linux/mii.h34
-rw-r--r--include/linux/mmc/sdio_ids.h2
-rw-r--r--include/linux/netdevice.h119
-rw-r--r--include/linux/nl80211.h178
-rw-r--r--include/linux/of.h3
-rw-r--r--include/linux/of_mdio.h22
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/phy.h6
-rw-r--r--include/linux/rfkill.h14
-rw-r--r--include/linux/skbuff.h8
-rw-r--r--include/linux/smsc911x.h10
-rw-r--r--include/linux/snmp.h10
-rw-r--r--include/linux/socket.h7
-rw-r--r--include/linux/spi/wl12xx.h31
-rw-r--r--include/linux/tcp.h4
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/net/cfg80211.h950
-rw-r--r--include/net/fib_rules.h1
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/ipv6.h15
-rw-r--r--include/net/iucv/af_iucv.h9
-rw-r--r--include/net/mac80211.h218
-rw-r--r--include/net/regulatory.h101
-rw-r--r--include/net/snmp.h19
-rw-r--r--include/net/tcp.h59
-rw-r--r--include/net/wireless.h472
-rw-r--r--include/scsi/libfcoe.h2
39 files changed, 2147 insertions, 825 deletions
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
index eff898aac02b..8cb05aae661c 100644
--- a/include/linux/can/Kbuild
+++ b/include/linux/can/Kbuild
@@ -1,3 +1,4 @@
1header-y += raw.h 1header-y += raw.h
2header-y += bcm.h 2header-y += bcm.h
3header-y += error.h 3header-y += error.h
4header-y += netlink.h
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
new file mode 100644
index 000000000000..4a37a56f6cdd
--- /dev/null
+++ b/include/linux/can/dev.h
@@ -0,0 +1,70 @@
1/*
2 * linux/can/dev.h
3 *
4 * Definitions for the CAN network device driver interface
5 *
6 * Copyright (C) 2006 Andrey Volkov <avolkov@varma-el.com>
7 * Varma Electronics Oy
8 *
9 * Copyright (C) 2008 Wolfgang Grandegger <wg@grandegger.com>
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 */
13
14#ifndef CAN_DEV_H
15#define CAN_DEV_H
16
17#include <linux/can/netlink.h>
18#include <linux/can/error.h>
19
20/*
21 * CAN mode
22 */
23enum can_mode {
24 CAN_MODE_STOP = 0,
25 CAN_MODE_START,
26 CAN_MODE_SLEEP
27};
28
29/*
30 * CAN common private data
31 */
32#define CAN_ECHO_SKB_MAX 4
33
34struct can_priv {
35 struct can_device_stats can_stats;
36
37 struct can_bittiming bittiming;
38 struct can_bittiming_const *bittiming_const;
39 struct can_clock clock;
40
41 enum can_state state;
42 u32 ctrlmode;
43
44 int restart_ms;
45 struct timer_list restart_timer;
46
47 struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX];
48
49 int (*do_set_bittiming)(struct net_device *dev);
50 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
51 int (*do_get_state)(const struct net_device *dev,
52 enum can_state *state);
53};
54
55struct net_device *alloc_candev(int sizeof_priv);
56void free_candev(struct net_device *dev);
57
58int open_candev(struct net_device *dev);
59void close_candev(struct net_device *dev);
60
61int register_candev(struct net_device *dev);
62void unregister_candev(struct net_device *dev);
63
64int can_restart_now(struct net_device *dev);
65void can_bus_off(struct net_device *dev);
66
67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
68void can_get_echo_skb(struct net_device *dev, int idx);
69
70#endif /* CAN_DEV_H */
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
new file mode 100644
index 000000000000..9ecbb7871c0e
--- /dev/null
+++ b/include/linux/can/netlink.h
@@ -0,0 +1,113 @@
1/*
2 * linux/can/netlink.h
3 *
4 * Definitions for the CAN netlink interface
5 *
6 * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
7 *
8 * Send feedback to <socketcan-users@lists.berlios.de>
9 *
10 */
11
12#ifndef CAN_NETLINK_H
13#define CAN_NETLINK_H
14
15#include <linux/types.h>
16
17/*
18 * CAN bit-timing parameters
19 *
20 * For futher information, please read chapter "8 BIT TIMING
21 * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
22 * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
23 */
24struct can_bittiming {
25 __u32 bitrate; /* Bit-rate in bits/second */
26 __u32 sample_point; /* Sample point in one-tenth of a percent */
27 __u32 tq; /* Time quanta (TQ) in nanoseconds */
28 __u32 prop_seg; /* Propagation segment in TQs */
29 __u32 phase_seg1; /* Phase buffer segment 1 in TQs */
30 __u32 phase_seg2; /* Phase buffer segment 2 in TQs */
31 __u32 sjw; /* Synchronisation jump width in TQs */
32 __u32 brp; /* Bit-rate prescaler */
33};
34
35/*
36 * CAN harware-dependent bit-timing constant
37 *
38 * Used for calculating and checking bit-timing parameters
39 */
40struct can_bittiming_const {
41 char name[16]; /* Name of the CAN controller hardware */
42 __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
43 __u32 tseg1_max;
44 __u32 tseg2_min; /* Time segement 2 = phase_seg2 */
45 __u32 tseg2_max;
46 __u32 sjw_max; /* Synchronisation jump width */
47 __u32 brp_min; /* Bit-rate prescaler */
48 __u32 brp_max;
49 __u32 brp_inc;
50};
51
52/*
53 * CAN clock parameters
54 */
55struct can_clock {
56 __u32 freq; /* CAN system clock frequency in Hz */
57};
58
59/*
60 * CAN operational and error states
61 */
62enum can_state {
63 CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
64 CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
65 CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
66 CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
67 CAN_STATE_STOPPED, /* Device is stopped */
68 CAN_STATE_SLEEPING, /* Device is sleeping */
69 CAN_STATE_MAX
70};
71
72/*
73 * CAN controller mode
74 */
75struct can_ctrlmode {
76 __u32 mask;
77 __u32 flags;
78};
79
80#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
81#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
82#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
83
84/*
85 * CAN device statistics
86 */
87struct can_device_stats {
88 __u32 bus_error; /* Bus errors */
89 __u32 error_warning; /* Changes to error warning state */
90 __u32 error_passive; /* Changes to error passive state */
91 __u32 bus_off; /* Changes to bus off state */
92 __u32 arbitration_lost; /* Arbitration lost errors */
93 __u32 restarts; /* CAN controller re-starts */
94};
95
96/*
97 * CAN netlink interface
98 */
99enum {
100 IFLA_CAN_UNSPEC,
101 IFLA_CAN_BITTIMING,
102 IFLA_CAN_BITTIMING_CONST,
103 IFLA_CAN_CLOCK,
104 IFLA_CAN_STATE,
105 IFLA_CAN_CTRLMODE,
106 IFLA_CAN_RESTART_MS,
107 IFLA_CAN_RESTART,
108 __IFLA_CAN_MAX
109};
110
111#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
112
113#endif /* CAN_NETLINK_H */
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
new file mode 100644
index 000000000000..37966e630ff5
--- /dev/null
+++ b/include/linux/can/platform/sja1000.h
@@ -0,0 +1,32 @@
1#ifndef _CAN_PLATFORM_SJA1000_H_
2#define _CAN_PLATFORM_SJA1000_H_
3
4/* clock divider register */
5#define CDR_CLKOUT_MASK 0x07
6#define CDR_CLK_OFF 0x08 /* Clock off (CLKOUT pin) */
7#define CDR_RXINPEN 0x20 /* TX1 output is RX irq output */
8#define CDR_CBP 0x40 /* CAN input comparator bypass */
9#define CDR_PELICAN 0x80 /* PeliCAN mode */
10
11/* output control register */
12#define OCR_MODE_BIPHASE 0x00
13#define OCR_MODE_TEST 0x01
14#define OCR_MODE_NORMAL 0x02
15#define OCR_MODE_CLOCK 0x03
16#define OCR_TX0_INVERT 0x04
17#define OCR_TX0_PULLDOWN 0x08
18#define OCR_TX0_PULLUP 0x10
19#define OCR_TX0_PUSHPULL 0x18
20#define OCR_TX1_INVERT 0x20
21#define OCR_TX1_PULLDOWN 0x40
22#define OCR_TX1_PULLUP 0x80
23#define OCR_TX1_PUSHPULL 0xc0
24
25struct sja1000_platform_data {
26 u32 clock; /* CAN bus oscillator frequency in Hz */
27
28 u8 ocr; /* output control register */
29 u8 cdr; /* clock divider register */
30};
31
32#endif /* !_CAN_PLATFORM_SJA1000_H_ */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index a1f17abba7dc..3d7a6687d247 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -182,6 +182,33 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
182 return compare_ether_addr(addr1, addr2); 182 return compare_ether_addr(addr1, addr2);
183#endif 183#endif
184} 184}
185
186/**
187 * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
188 * @dev: Pointer to a device structure
189 * @addr: Pointer to a six-byte array containing the Ethernet address
190 *
191 * Compare passed address with all addresses of the device. Return true if the
192 * address if one of the device addresses.
193 *
194 * Note that this function calls compare_ether_addr_64bits() so take care of
195 * the right padding.
196 */
197static inline bool is_etherdev_addr(const struct net_device *dev,
198 const u8 addr[6 + 2])
199{
200 struct netdev_hw_addr *ha;
201 int res = 1;
202
203 rcu_read_lock();
204 for_each_dev_addr(dev, ha) {
205 res = compare_ether_addr_64bits(addr, ha->addr);
206 if (!res)
207 break;
208 }
209 rcu_read_unlock();
210 return !res;
211}
185#endif /* __KERNEL__ */ 212#endif /* __KERNEL__ */
186 213
187/** 214/**
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 131b127b70f8..380b04272bf1 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -26,11 +26,13 @@ struct ethtool_cmd {
26 __u8 phy_address; 26 __u8 phy_address;
27 __u8 transceiver; /* Which transceiver to use */ 27 __u8 transceiver; /* Which transceiver to use */
28 __u8 autoneg; /* Enable or disable autonegotiation */ 28 __u8 autoneg; /* Enable or disable autonegotiation */
29 __u8 mdio_support;
29 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 30 __u32 maxtxpkt; /* Tx pkts before generating tx int */
30 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 31 __u32 maxrxpkt; /* Rx pkts before generating rx int */
31 __u16 speed_hi; 32 __u16 speed_hi;
32 __u16 reserved2; 33 __u16 reserved2;
33 __u32 reserved[3]; 34 __u32 lp_advertising; /* Features the link partner advertises */
35 __u32 reserved[2];
34}; 36};
35 37
36static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 38static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
@@ -563,6 +565,11 @@ struct ethtool_ops {
563#define SUPPORTED_Pause (1 << 13) 565#define SUPPORTED_Pause (1 << 13)
564#define SUPPORTED_Asym_Pause (1 << 14) 566#define SUPPORTED_Asym_Pause (1 << 14)
565#define SUPPORTED_2500baseX_Full (1 << 15) 567#define SUPPORTED_2500baseX_Full (1 << 15)
568#define SUPPORTED_Backplane (1 << 16)
569#define SUPPORTED_1000baseKX_Full (1 << 17)
570#define SUPPORTED_10000baseKX4_Full (1 << 18)
571#define SUPPORTED_10000baseKR_Full (1 << 19)
572#define SUPPORTED_10000baseR_FEC (1 << 20)
566 573
567/* Indicates what features are advertised by the interface. */ 574/* Indicates what features are advertised by the interface. */
568#define ADVERTISED_10baseT_Half (1 << 0) 575#define ADVERTISED_10baseT_Half (1 << 0)
@@ -581,6 +588,11 @@ struct ethtool_ops {
581#define ADVERTISED_Pause (1 << 13) 588#define ADVERTISED_Pause (1 << 13)
582#define ADVERTISED_Asym_Pause (1 << 14) 589#define ADVERTISED_Asym_Pause (1 << 14)
583#define ADVERTISED_2500baseX_Full (1 << 15) 590#define ADVERTISED_2500baseX_Full (1 << 15)
591#define ADVERTISED_Backplane (1 << 16)
592#define ADVERTISED_1000baseKX_Full (1 << 17)
593#define ADVERTISED_10000baseKX4_Full (1 << 18)
594#define ADVERTISED_10000baseKR_Full (1 << 19)
595#define ADVERTISED_10000baseR_FEC (1 << 20)
584 596
585/* The following are all involved in forcing a particular link 597/* The following are all involved in forcing a particular link
586 * mode for the device for setting things. When getting the 598 * mode for the device for setting things. When getting the
@@ -605,6 +617,7 @@ struct ethtool_ops {
605#define PORT_MII 0x02 617#define PORT_MII 0x02
606#define PORT_FIBRE 0x03 618#define PORT_FIBRE 0x03
607#define PORT_BNC 0x04 619#define PORT_BNC 0x04
620#define PORT_OTHER 0xff
608 621
609/* Which transceiver to use. */ 622/* Which transceiver to use. */
610#define XCVR_INTERNAL 0x00 623#define XCVR_INTERNAL 0x00
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 8300cab30f9a..51b793466ff3 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -17,6 +17,7 @@
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/of_mdio.h>
20#include <asm/types.h> 21#include <asm/types.h>
21 22
22#define FS_ENET_NAME "fs_enet" 23#define FS_ENET_NAME "fs_enet"
@@ -130,10 +131,7 @@ struct fs_platform_info {
130 131
131 u32 device_flags; 132 u32 device_flags;
132 133
133 int phy_addr; /* the phy address (-1 no phy) */ 134 struct device_node *phy_node;
134 char bus_id[16];
135 int phy_irq; /* the phy irq (if it exists) */
136
137 const struct fs_mii_bus_info *bus_info; 135 const struct fs_mii_bus_info *bus_info;
138 136
139 int rx_ring, tx_ring; /* number of buffers on rx */ 137 int rx_ring, tx_ring; /* number of buffers on rx */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 4b501b48ce86..05c29c01174c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -540,10 +540,10 @@ struct ieee80211_tim_ie {
540 u8 dtim_period; 540 u8 dtim_period;
541 u8 bitmap_ctrl; 541 u8 bitmap_ctrl;
542 /* variable size: 1 - 251 bytes */ 542 /* variable size: 1 - 251 bytes */
543 u8 virtual_map[0]; 543 u8 virtual_map[1];
544} __attribute__ ((packed)); 544} __attribute__ ((packed));
545 545
546#define WLAN_SA_QUERY_TR_ID_LEN 16 546#define WLAN_SA_QUERY_TR_ID_LEN 2
547 547
548struct ieee80211_mgmt { 548struct ieee80211_mgmt {
549 __le16 frame_control; 549 __le16 frame_control;
@@ -1068,8 +1068,12 @@ enum ieee80211_category {
1068 WLAN_CATEGORY_DLS = 2, 1068 WLAN_CATEGORY_DLS = 2,
1069 WLAN_CATEGORY_BACK = 3, 1069 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4, 1070 WLAN_CATEGORY_PUBLIC = 4,
1071 WLAN_CATEGORY_HT = 7,
1071 WLAN_CATEGORY_SA_QUERY = 8, 1072 WLAN_CATEGORY_SA_QUERY = 8,
1073 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1072 WLAN_CATEGORY_WMM = 17, 1074 WLAN_CATEGORY_WMM = 17,
1075 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1076 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1073}; 1077};
1074 1078
1075/* SPECTRUM_MGMT action code */ 1079/* SPECTRUM_MGMT action code */
@@ -1261,7 +1265,9 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1261 if (ieee80211_has_protected(hdr->frame_control)) 1265 if (ieee80211_has_protected(hdr->frame_control))
1262 return true; 1266 return true;
1263 category = ((u8 *) hdr) + 24; 1267 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC; 1268 return *category != WLAN_CATEGORY_PUBLIC &&
1269 *category != WLAN_CATEGORY_HT &&
1270 *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
1265 } 1271 }
1266 1272
1267 return false; 1273 return false;
@@ -1383,4 +1389,43 @@ static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1383 return -1; 1389 return -1;
1384} 1390}
1385 1391
1392/**
1393 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
1394 * @tu: the TUs
1395 */
1396static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
1397{
1398 return 1024 * tu;
1399}
1400
1401/**
1402 * ieee80211_check_tim - check if AID bit is set in TIM
1403 * @tim: the TIM IE
1404 * @tim_len: length of the TIM IE
1405 * @aid: the AID to look for
1406 */
1407static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
1408 u8 tim_len, u16 aid)
1409{
1410 u8 mask;
1411 u8 index, indexn1, indexn2;
1412
1413 if (unlikely(!tim || tim_len < sizeof(*tim)))
1414 return false;
1415
1416 aid &= 0x3fff;
1417 index = aid / 8;
1418 mask = 1 << (aid & 7);
1419
1420 indexn1 = tim->bitmap_ctrl & 0xfe;
1421 indexn2 = tim_len + indexn1 - 4;
1422
1423 if (index < indexn1 || index > indexn2)
1424 return false;
1425
1426 index -= indexn1;
1427
1428 return !!(tim->virtual_map[index] & mask);
1429}
1430
1386#endif /* LINUX_IEEE80211_H */ 1431#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 049d6c9428db..915ba5789f0e 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -55,6 +55,7 @@
55#define IFF_NO_PI 0x1000 55#define IFF_NO_PI 0x1000
56#define IFF_ONE_QUEUE 0x2000 56#define IFF_ONE_QUEUE 0x2000
57#define IFF_VNET_HDR 0x4000 57#define IFF_VNET_HDR 0x4000
58#define IFF_TUN_EXCL 0x8000
58 59
59/* Features for GSO (TUNSETOFFLOAD). */ 60/* Features for GSO (TUNSETOFFLOAD). */
60#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ 61#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index e1ff5b14310e..7ff9af1d0f05 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -118,8 +118,7 @@ extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, 118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
119 unsigned int vlan_tci, struct sk_buff *skb); 119 unsigned int vlan_tci, struct sk_buff *skb);
120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, 120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci, 121 unsigned int vlan_tci);
122 struct napi_gro_fraginfo *info);
123 122
124#else 123#else
125static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 124static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@@ -154,8 +153,7 @@ static inline int vlan_gro_receive(struct napi_struct *napi,
154} 153}
155 154
156static inline int vlan_gro_frags(struct napi_struct *napi, 155static inline int vlan_gro_frags(struct napi_struct *napi,
157 struct vlan_group *grp, unsigned int vlan_tci, 156 struct vlan_group *grp, unsigned int vlan_tci)
158 struct napi_gro_fraginfo *info)
159{ 157{
160 return NET_RX_DROP; 158 return NET_RX_DROP;
161} 159}
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
new file mode 100644
index 000000000000..56851646529a
--- /dev/null
+++ b/include/linux/mdio.h
@@ -0,0 +1,347 @@
1/*
2 * linux/mdio.h: definitions for MDIO (clause 45) transceivers
3 * Copyright 2006-2009 Solarflare Communications Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9
10#ifndef __LINUX_MDIO_H__
11#define __LINUX_MDIO_H__
12
13#include <linux/mii.h>
14
15/* MDIO Manageable Devices (MMDs). */
16#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/
17 * Physical Medium Dependent */
18#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */
19#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */
20#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */
21#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */
22#define MDIO_MMD_TC 6 /* Transmission Convergence */
23#define MDIO_MMD_AN 7 /* Auto-Negotiation */
24#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */
25#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */
26#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */
27
28/* Generic MDIO registers. */
29#define MDIO_CTRL1 MII_BMCR
30#define MDIO_STAT1 MII_BMSR
31#define MDIO_DEVID1 MII_PHYSID1
32#define MDIO_DEVID2 MII_PHYSID2
33#define MDIO_SPEED 4 /* Speed ability */
34#define MDIO_DEVS1 5 /* Devices in package */
35#define MDIO_DEVS2 6
36#define MDIO_CTRL2 7 /* 10G control 2 */
37#define MDIO_STAT2 8 /* 10G status 2 */
38#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */
39#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */
40#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */
41#define MDIO_PKGID1 14 /* Package identifier */
42#define MDIO_PKGID2 15
43#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */
44#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */
45#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */
46
47/* Media-dependent registers. */
48#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */
49#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A.
50 * Lanes B-D are numbered 134-136. */
51#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */
52#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */
53#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */
54#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
55#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
56#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
57
58/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
59#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
60#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */
61#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */
62#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */
63#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */
64#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */
65
66/* Control register 1. */
67/* Enable extended speed selection */
68#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
69/* All speed selection bits */
70#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
71#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX
72#define MDIO_CTRL1_LPOWER BMCR_PDOWN
73#define MDIO_CTRL1_RESET BMCR_RESET
74#define MDIO_PMA_CTRL1_LOOPBACK 0x0001
75#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000
76#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100
77#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK
78#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK
79#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART
80#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE
81#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */
82
83/* 10 Gb/s */
84#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
85/* 10PASS-TS/2BASE-TL */
86#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
87
88/* Status register 1. */
89#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
90#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
91#define MDIO_STAT1_FAULT 0x0080 /* Fault */
92#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
93#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
94#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
95#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE
96#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */
97#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */
98
99/* Speed register. */
100#define MDIO_SPEED_10G 0x0001 /* 10G capable */
101#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */
102#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */
103#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */
104#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */
105#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */
106#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */
107
108/* Device present registers. */
109#define MDIO_DEVS_PRESENT(devad) (1 << (devad))
110#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
111#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
112#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
113#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
114#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
115#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
116#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
117#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
118
119/* Control register 2. */
120#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */
121#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */
122#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */
123#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */
124#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */
125#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */
126#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */
127#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */
128#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */
129#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */
130#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */
131#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */
132#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */
133#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */
134#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */
135#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */
136#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */
137#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */
138#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */
139#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */
140#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */
141#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */
142
143/* Status register 2. */
144#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */
145#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */
146#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */
147#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */
148#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */
149#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */
150#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */
151#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */
152#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */
153#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */
154#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */
155#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */
156#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */
157#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */
158#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
159#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
160#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */
161#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */
162#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */
163#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
164#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
165
166/* Transmit disable register. */
167#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */
168#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */
169#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */
170#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */
171#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */
172
173/* Receive signal detect register. */
174#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */
175#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */
176#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */
177#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */
178#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */
179
180/* Extended abilities register. */
181#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */
182#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */
183#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */
184#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */
185#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */
186#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */
187#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */
188#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */
189#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */
190
191/* PHY XGXS lane state register. */
192#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
193#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
194#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
195#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008
196#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000
197
198/* PMA 10GBASE-T TX power register. */
199#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */
200
201/* PMA 10GBASE-T SNR registers. */
202/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
203#define MDIO_PMA_10GBT_SNR_BIAS 0x8000
204#define MDIO_PMA_10GBT_SNR_MAX 127
205
206/* PMA 10GBASE-R FEC ability register. */
207#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */
208#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */
209
210/* PCS 10GBASE-R/-T status register 1. */
211#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */
212
213/* PCS 10GBASE-R/-T status register 2. */
214#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
215#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
216
217/* AN 10GBASE-T control register. */
218#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */
219
220/* AN 10GBASE-T status register. */
221#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */
222#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */
223#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */
224#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */
225#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */
226#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
227#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
228
229/* LASI RX_ALARM control/status registers. */
230#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
231#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
232#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */
233#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */
234#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */
235
236/* LASI TX_ALARM control/status registers. */
237#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */
238#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */
239#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */
240#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */
241#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */
242#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */
243
244/* LASI control/status registers. */
245#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */
246#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */
247#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */
248
249/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
250
251#define MDIO_PHY_ID_C45 0x8000
252#define MDIO_PHY_ID_PRTAD 0x03e0
253#define MDIO_PHY_ID_DEVAD 0x001f
254#define MDIO_PHY_ID_C45_MASK \
255 (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
256
257static inline __u16 mdio_phy_id_c45(int prtad, int devad)
258{
259 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
260}
261
262static inline bool mdio_phy_id_is_c45(int phy_id)
263{
264 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
265}
266
267static inline __u16 mdio_phy_id_prtad(int phy_id)
268{
269 return (phy_id & MDIO_PHY_ID_PRTAD) >> 5;
270}
271
272static inline __u16 mdio_phy_id_devad(int phy_id)
273{
274 return phy_id & MDIO_PHY_ID_DEVAD;
275}
276
277#define MDIO_SUPPORTS_C22 1
278#define MDIO_SUPPORTS_C45 2
279
280#ifdef __KERNEL__
281
282/**
283 * struct mdio_if_info - Ethernet controller MDIO interface
284 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown)
285 * @mmds: Mask of MMDs expected to be present in the PHY. This must be
286 * non-zero unless @prtad = %MDIO_PRTAD_NONE.
287 * @mode_support: MDIO modes supported. If %MDIO_SUPPORTS_C22 is set then
288 * MII register access will be passed through with @devad =
289 * %MDIO_DEVAD_NONE. If %MDIO_EMULATE_C22 is set then access to
290 * commonly used clause 22 registers will be translated into
291 * clause 45 registers.
292 * @dev: Net device structure
293 * @mdio_read: Register read function; returns value or negative error code
294 * @mdio_write: Register write function; returns 0 or negative error code
295 */
296struct mdio_if_info {
297 int prtad;
298 u32 __bitwise mmds;
299 unsigned mode_support;
300
301 struct net_device *dev;
302 int (*mdio_read)(struct net_device *dev, int prtad, int devad,
303 u16 addr);
304 int (*mdio_write)(struct net_device *dev, int prtad, int devad,
305 u16 addr, u16 val);
306};
307
308#define MDIO_PRTAD_NONE (-1)
309#define MDIO_DEVAD_NONE (-1)
310#define MDIO_EMULATE_C22 4
311
312struct ethtool_cmd;
313struct ethtool_pauseparam;
314extern int mdio45_probe(struct mdio_if_info *mdio, int prtad);
315extern int mdio_set_flag(const struct mdio_if_info *mdio,
316 int prtad, int devad, u16 addr, int mask,
317 bool sense);
318extern int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmds);
319extern int mdio45_nway_restart(const struct mdio_if_info *mdio);
320extern void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
321 struct ethtool_cmd *ecmd,
322 u32 npage_adv, u32 npage_lpa);
323extern void
324mdio45_ethtool_spauseparam_an(const struct mdio_if_info *mdio,
325 const struct ethtool_pauseparam *ecmd);
326
327/**
328 * mdio45_ethtool_gset - get settings for ETHTOOL_GSET
329 * @mdio: MDIO interface
330 * @ecmd: Ethtool request structure
331 *
332 * Since the CSRs for auto-negotiation using next pages are not fully
333 * standardised, this function does not attempt to decode them. Use
334 * mdio45_ethtool_gset_npage() to specify advertisement bits from next
335 * pages.
336 */
337static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio,
338 struct ethtool_cmd *ecmd)
339{
340 mdio45_ethtool_gset_npage(mdio, ecmd, 0, 0);
341}
342
343extern int mdio_mii_ioctl(const struct mdio_if_info *mdio,
344 struct mii_ioctl_data *mii_data, int cmd);
345
346#endif /* __KERNEL__ */
347#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/mii.h b/include/linux/mii.h
index ad748588faf1..359fba880274 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -240,6 +240,22 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
240} 240}
241 241
242/** 242/**
243 * mii_advertise_flowctrl - get flow control advertisement flags
244 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
245 */
246static inline u16 mii_advertise_flowctrl(int cap)
247{
248 u16 adv = 0;
249
250 if (cap & FLOW_CTRL_RX)
251 adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
252 if (cap & FLOW_CTRL_TX)
253 adv ^= ADVERTISE_PAUSE_ASYM;
254
255 return adv;
256}
257
258/**
243 * mii_resolve_flowctrl_fdx 259 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register 260 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register 261 * @rmtadv: value of MII LPA register
@@ -250,18 +266,12 @@ static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{ 266{
251 u8 cap = 0; 267 u8 cap = 0;
252 268
253 if (lcladv & ADVERTISE_PAUSE_CAP) { 269 if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) { 270 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
255 if (rmtadv & LPA_PAUSE_CAP) 271 } else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) {
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX; 272 if (lcladv & ADVERTISE_PAUSE_CAP)
257 else if (rmtadv & LPA_PAUSE_ASYM) 273 cap = FLOW_CTRL_RX;
258 cap = FLOW_CTRL_RX; 274 else if (rmtadv & ADVERTISE_PAUSE_CAP)
259 } else {
260 if (rmtadv & LPA_PAUSE_CAP)
261 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
262 }
263 } else if (lcladv & ADVERTISE_PAUSE_ASYM) {
264 if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
265 cap = FLOW_CTRL_TX; 275 cap = FLOW_CTRL_TX;
266 } 276 }
267 277
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index ea1bf5ba092f..c7211ab6dd4b 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -25,5 +25,7 @@
25 25
26#define SDIO_VENDOR_ID_MARVELL 0x02df 26#define SDIO_VENDOR_ID_MARVELL 0x02df
27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
28#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
29#define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105
28 30
29#endif 31#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a96a1a406e9..f8574e76b743 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -39,9 +39,11 @@
39 39
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/percpu.h> 41#include <linux/percpu.h>
42#include <linux/rculist.h>
42#include <linux/dmaengine.h> 43#include <linux/dmaengine.h>
43#include <linux/workqueue.h> 44#include <linux/workqueue.h>
44 45
46#include <linux/ethtool.h>
45#include <net/net_namespace.h> 47#include <net/net_namespace.h>
46#include <net/dsa.h> 48#include <net/dsa.h>
47#ifdef CONFIG_DCB 49#ifdef CONFIG_DCB
@@ -49,7 +51,6 @@
49#endif 51#endif
50 52
51struct vlan_group; 53struct vlan_group;
52struct ethtool_ops;
53struct netpoll_info; 54struct netpoll_info;
54/* 802.11 specific */ 55/* 802.11 specific */
55struct wireless_dev; 56struct wireless_dev;
@@ -210,6 +211,16 @@ struct dev_addr_list
210#define dmi_users da_users 211#define dmi_users da_users
211#define dmi_gusers da_gusers 212#define dmi_gusers da_gusers
212 213
214struct netdev_hw_addr {
215 struct list_head list;
216 unsigned char addr[MAX_ADDR_LEN];
217 unsigned char type;
218#define NETDEV_HW_ADDR_T_LAN 1
219#define NETDEV_HW_ADDR_T_SAN 2
220#define NETDEV_HW_ADDR_T_SLAVE 3
221 struct rcu_head rcu_head;
222};
223
213struct hh_cache 224struct hh_cache
214{ 225{
215 struct hh_cache *hh_next; /* Next entry */ 226 struct hh_cache *hh_next; /* Next entry */
@@ -447,12 +458,25 @@ enum netdev_queue_state_t
447}; 458};
448 459
449struct netdev_queue { 460struct netdev_queue {
461/*
462 * read mostly part
463 */
450 struct net_device *dev; 464 struct net_device *dev;
451 struct Qdisc *qdisc; 465 struct Qdisc *qdisc;
452 unsigned long state; 466 unsigned long state;
453 spinlock_t _xmit_lock;
454 int xmit_lock_owner;
455 struct Qdisc *qdisc_sleeping; 467 struct Qdisc *qdisc_sleeping;
468/*
469 * write mostly part
470 */
471 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
472 int xmit_lock_owner;
473 /*
474 * please use this field instead of dev->trans_start
475 */
476 unsigned long trans_start;
477 unsigned long tx_bytes;
478 unsigned long tx_packets;
479 unsigned long tx_dropped;
456} ____cacheline_aligned_in_smp; 480} ____cacheline_aligned_in_smp;
457 481
458 482
@@ -670,7 +694,9 @@ struct net_device
670#define NETIF_F_GRO 16384 /* Generic receive offload */ 694#define NETIF_F_GRO 16384 /* Generic receive offload */
671#define NETIF_F_LRO 32768 /* large receive offload */ 695#define NETIF_F_LRO 32768 /* large receive offload */
672 696
697/* the GSO_MASK reserves bits 16 through 23 */
673#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ 698#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
699#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
674 700
675 /* Segmentation offload features */ 701 /* Segmentation offload features */
676#define NETIF_F_GSO_SHIFT 16 702#define NETIF_F_GSO_SHIFT 16
@@ -776,8 +802,11 @@ struct net_device
776 */ 802 */
777 unsigned long last_rx; /* Time of last Rx */ 803 unsigned long last_rx; /* Time of last Rx */
778 /* Interface address info used in eth_type_trans() */ 804 /* Interface address info used in eth_type_trans() */
779 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 805 unsigned char *dev_addr; /* hw address, (before bcast
780 because most packets are unicast) */ 806 because most packets are
807 unicast) */
808
809 struct list_head dev_addr_list; /* list of device hw addresses */
781 810
782 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 811 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
783 812
@@ -797,6 +826,11 @@ struct net_device
797 * One part is mostly used on xmit path (device) 826 * One part is mostly used on xmit path (device)
798 */ 827 */
799 /* These may be needed for future network-power-down code. */ 828 /* These may be needed for future network-power-down code. */
829
830 /*
831 * trans_start here is expensive for high speed devices on SMP,
832 * please use netdev_queue->trans_start instead.
833 */
800 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 834 unsigned long trans_start; /* Time (in jiffies) of last Tx */
801 835
802 int watchdog_timeo; /* used by dev_watchdog() */ 836 int watchdog_timeo; /* used by dev_watchdog() */
@@ -1047,14 +1081,6 @@ struct packet_type {
1047 struct list_head list; 1081 struct list_head list;
1048}; 1082};
1049 1083
1050struct napi_gro_fraginfo {
1051 skb_frag_t frags[MAX_SKB_FRAGS];
1052 unsigned int nr_frags;
1053 unsigned int ip_summed;
1054 unsigned int len;
1055 __wsum csum;
1056};
1057
1058#include <linux/interrupt.h> 1084#include <linux/interrupt.h>
1059#include <linux/notifier.h> 1085#include <linux/notifier.h>
1060 1086
@@ -1145,11 +1171,18 @@ static inline void skb_gro_reset_offset(struct sk_buff *skb)
1145 1171
1146static inline void *skb_gro_mac_header(struct sk_buff *skb) 1172static inline void *skb_gro_mac_header(struct sk_buff *skb)
1147{ 1173{
1148 return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : 1174 return skb_headlen(skb) ? skb_mac_header(skb) :
1149 page_address(skb_shinfo(skb)->frags[0].page) + 1175 page_address(skb_shinfo(skb)->frags[0].page) +
1150 skb_shinfo(skb)->frags[0].page_offset; 1176 skb_shinfo(skb)->frags[0].page_offset;
1151} 1177}
1152 1178
1179static inline void *skb_gro_network_header(struct sk_buff *skb)
1180{
1181 return skb_headlen(skb) ? skb_network_header(skb) :
1182 page_address(skb_shinfo(skb)->frags[0].page) +
1183 skb_shinfo(skb)->frags[0].page_offset + skb_network_offset(skb);
1184}
1185
1153static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1186static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1154 unsigned short type, 1187 unsigned short type,
1155 const void *daddr, const void *saddr, 1188 const void *daddr, const void *saddr,
@@ -1442,12 +1475,18 @@ extern int napi_gro_receive(struct napi_struct *napi,
1442 struct sk_buff *skb); 1475 struct sk_buff *skb);
1443extern void napi_reuse_skb(struct napi_struct *napi, 1476extern void napi_reuse_skb(struct napi_struct *napi,
1444 struct sk_buff *skb); 1477 struct sk_buff *skb);
1445extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1478extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
1446 struct napi_gro_fraginfo *info);
1447extern int napi_frags_finish(struct napi_struct *napi, 1479extern int napi_frags_finish(struct napi_struct *napi,
1448 struct sk_buff *skb, int ret); 1480 struct sk_buff *skb, int ret);
1449extern int napi_gro_frags(struct napi_struct *napi, 1481extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
1450 struct napi_gro_fraginfo *info); 1482extern int napi_gro_frags(struct napi_struct *napi);
1483
1484static inline void napi_free_frags(struct napi_struct *napi)
1485{
1486 kfree_skb(napi->skb);
1487 napi->skb = NULL;
1488}
1489
1451extern void netif_nit_deliver(struct sk_buff *skb); 1490extern void netif_nit_deliver(struct sk_buff *skb);
1452extern int dev_valid_name(const char *name); 1491extern int dev_valid_name(const char *name);
1453extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1492extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1514,6 +1553,8 @@ static inline int netif_carrier_ok(const struct net_device *dev)
1514 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 1553 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
1515} 1554}
1516 1555
1556extern unsigned long dev_trans_start(struct net_device *dev);
1557
1517extern void __netdev_watchdog_up(struct net_device *dev); 1558extern void __netdev_watchdog_up(struct net_device *dev);
1518 1559
1519extern void netif_carrier_on(struct net_device *dev); 1560extern void netif_carrier_on(struct net_device *dev);
@@ -1778,6 +1819,13 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
1778 spin_unlock_bh(&dev->addr_list_lock); 1819 spin_unlock_bh(&dev->addr_list_lock);
1779} 1820}
1780 1821
1822/*
1823 * dev_addr_list walker. Should be used only for read access. Call with
1824 * rcu_read_lock held.
1825 */
1826#define for_each_dev_addr(dev, ha) \
1827 list_for_each_entry_rcu(ha, &dev->dev_addr_list, list)
1828
1781/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 1829/* These functions live elsewhere (drivers/net/net_init.c, but related) */
1782 1830
1783extern void ether_setup(struct net_device *dev); 1831extern void ether_setup(struct net_device *dev);
@@ -1790,6 +1838,19 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1790 alloc_netdev_mq(sizeof_priv, name, setup, 1) 1838 alloc_netdev_mq(sizeof_priv, name, setup, 1)
1791extern int register_netdev(struct net_device *dev); 1839extern int register_netdev(struct net_device *dev);
1792extern void unregister_netdev(struct net_device *dev); 1840extern void unregister_netdev(struct net_device *dev);
1841
1842/* Functions used for device addresses handling */
1843extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1844 unsigned char addr_type);
1845extern int dev_addr_del(struct net_device *dev, unsigned char *addr,
1846 unsigned char addr_type);
1847extern int dev_addr_add_multiple(struct net_device *to_dev,
1848 struct net_device *from_dev,
1849 unsigned char addr_type);
1850extern int dev_addr_del_multiple(struct net_device *to_dev,
1851 struct net_device *from_dev,
1852 unsigned char addr_type);
1853
1793/* Functions used for secondary unicast and multicast support */ 1854/* Functions used for secondary unicast and multicast support */
1794extern void dev_set_rx_mode(struct net_device *dev); 1855extern void dev_set_rx_mode(struct net_device *dev);
1795extern void __dev_set_rx_mode(struct net_device *dev); 1856extern void __dev_set_rx_mode(struct net_device *dev);
@@ -1908,6 +1969,28 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1908} 1969}
1909 1970
1910extern struct pernet_operations __net_initdata loopback_net_ops; 1971extern struct pernet_operations __net_initdata loopback_net_ops;
1972
1973static inline int dev_ethtool_get_settings(struct net_device *dev,
1974 struct ethtool_cmd *cmd)
1975{
1976 if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
1977 return -EOPNOTSUPP;
1978 return dev->ethtool_ops->get_settings(dev, cmd);
1979}
1980
1981static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
1982{
1983 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
1984 return 0;
1985 return dev->ethtool_ops->get_rx_csum(dev);
1986}
1987
1988static inline u32 dev_ethtool_get_flags(struct net_device *dev)
1989{
1990 if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
1991 return 0;
1992 return dev->ethtool_ops->get_flags(dev);
1993}
1911#endif /* __KERNEL__ */ 1994#endif /* __KERNEL__ */
1912 1995
1913#endif /* _LINUX_DEV_H */ 1996#endif /* _LINUX_DEV_H */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index cbe8ce3bf486..dbea93b694e5 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -7,7 +7,7 @@
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net> 7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> 8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de> 9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com> 10 * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 * 13 *
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#include <linux/types.h>
29
28/** 30/**
29 * DOC: Station handling 31 * DOC: Station handling
30 * 32 *
@@ -46,8 +48,10 @@
46 * to get a list of all present wiphys. 48 * to get a list of all present wiphys.
47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or 49 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, 50 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or 51 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
50 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. 52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 55 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 56 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
53 * %NL80211_ATTR_WIPHY_NAME. 57 * %NL80211_ATTR_WIPHY_NAME.
@@ -75,8 +79,8 @@
75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, 79 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
76 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. 80 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 81 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
78 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER 82 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
79 * attributes. 83 * and %NL80211_ATTR_KEY_SEQ attributes.
80 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 84 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
81 * or %NL80211_ATTR_MAC. 85 * or %NL80211_ATTR_MAC.
82 * 86 *
@@ -166,6 +170,22 @@
166 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is 170 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
167 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on 171 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
168 * to (%NL80211_ATTR_REG_ALPHA2). 172 * to (%NL80211_ATTR_REG_ALPHA2).
173 * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon
174 * has been found while world roaming thus enabling active scan or
175 * any mode of operation that initiates TX (beacons) on a channel
176 * where we would not have been able to do either before. As an example
177 * if you are world roaming (regulatory domain set to world or if your
178 * driver is using a custom world roaming regulatory domain) and while
179 * doing a passive scan on the 5 GHz band you find an AP there (if not
180 * on a DFS channel) you will now be able to actively scan for that AP
181 * or use AP mode on your card on that same channel. Note that this will
182 * never be used for channels 1-11 on the 2 GHz band as they are always
183 * enabled world wide. This beacon hint is only sent if your device had
184 * either disabled active scanning or beaconing on a channel. We send to
185 * userspace the wiphy on which we removed a restriction from
186 * (%NL80211_ATTR_WIPHY) and the channel on which this occurred
187 * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER)
188 * the beacon hint was processed.
169 * 189 *
170 * @NL80211_CMD_AUTHENTICATE: authentication request and notification. 190 * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
171 * This command is used both as a command (request to authenticate) and 191 * This command is used both as a command (request to authenticate) and
@@ -185,8 +205,12 @@
185 * frame, i.e., it was for the local STA and was received in correct 205 * frame, i.e., it was for the local STA and was received in correct
186 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the 206 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
187 * MLME SAP interface (kernel providing MLME, userspace SME). The 207 * MLME SAP interface (kernel providing MLME, userspace SME). The
188 * included NL80211_ATTR_FRAME attribute contains the management frame 208 * included %NL80211_ATTR_FRAME attribute contains the management frame
189 * (including both the header and frame body, but not FCS). 209 * (including both the header and frame body, but not FCS). This event is
210 * also used to indicate if the authentication attempt timed out. In that
211 * case the %NL80211_ATTR_FRAME attribute is replaced with a
212 * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
213 * pending authentication timed out).
190 * @NL80211_CMD_ASSOCIATE: association request and notification; like 214 * @NL80211_CMD_ASSOCIATE: association request and notification; like
191 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation 215 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
192 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, 216 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
@@ -199,6 +223,25 @@
199 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to 223 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
200 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). 224 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
201 * 225 *
226 * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael
227 * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the
228 * event includes %NL80211_ATTR_MAC to describe the source MAC address of
229 * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key
230 * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and
231 * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
232 * event matches with MLME-MICHAELMICFAILURE.indication() primitive
233 *
234 * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
235 * FREQ attribute (for the initial frequency if no peer can be found)
236 * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
237 * should be fixed rather than automatically determined. Can only be
238 * executed on a network interface that is UP, and fixed BSSID/FREQ
239 * may be rejected. Another optional parameter is the beacon interval,
240 * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
241 * given defaults to 100 TU (102.4ms).
242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
243 * determined by the network interface.
244 *
202 * @NL80211_CMD_MAX: highest used command number 245 * @NL80211_CMD_MAX: highest used command number
203 * @__NL80211_CMD_AFTER_LAST: internal use 246 * @__NL80211_CMD_AFTER_LAST: internal use
204 */ 247 */
@@ -260,6 +303,13 @@ enum nl80211_commands {
260 NL80211_CMD_DEAUTHENTICATE, 303 NL80211_CMD_DEAUTHENTICATE,
261 NL80211_CMD_DISASSOCIATE, 304 NL80211_CMD_DISASSOCIATE,
262 305
306 NL80211_CMD_MICHAEL_MIC_FAILURE,
307
308 NL80211_CMD_REG_BEACON_HINT,
309
310 NL80211_CMD_JOIN_IBSS,
311 NL80211_CMD_LEAVE_IBSS,
312
263 /* add new commands above here */ 313 /* add new commands above here */
264 314
265 /* used to define NL80211_CMD_MAX below */ 315 /* used to define NL80211_CMD_MAX below */
@@ -278,6 +328,7 @@ enum nl80211_commands {
278#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE 328#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
279#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE 329#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
280#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 330#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
331#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
281 332
282/** 333/**
283 * enum nl80211_attrs - nl80211 netlink attributes 334 * enum nl80211_attrs - nl80211 netlink attributes
@@ -296,6 +347,18 @@ enum nl80211_commands {
296 * NL80211_CHAN_HT20 = HT20 only 347 * NL80211_CHAN_HT20 = HT20 only
297 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel 348 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
298 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel 349 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
350 * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is
351 * less than or equal to the RTS threshold; allowed range: 1..255;
352 * dot11ShortRetryLimit; u8
353 * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is
354 * greater than the RTS threshold; allowed range: 1..255;
355 * dot11ShortLongLimit; u8
356 * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum
357 * length in octets for frames; allowed range: 256..8000, disable
358 * fragmentation with (u32)-1; dot11FragmentationThreshold; u32
359 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
360 * larger than or equal to this use RTS/CTS handshake); allowed range:
361 * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32
299 * 362 *
300 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 363 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
301 * @NL80211_ATTR_IFNAME: network interface name 364 * @NL80211_ATTR_IFNAME: network interface name
@@ -319,7 +382,7 @@ enum nl80211_commands {
319 * 382 *
320 * @NL80211_ATTR_STA_AID: Association ID for the station (u16) 383 * @NL80211_ATTR_STA_AID: Association ID for the station (u16)
321 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of 384 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
322 * &enum nl80211_sta_flags. 385 * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2)
323 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by 386 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
324 * IEEE 802.11 7.3.1.6 (u16). 387 * IEEE 802.11 7.3.1.6 (u16).
325 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported 388 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
@@ -380,6 +443,8 @@ enum nl80211_commands {
380 * 443 *
381 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with 444 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
382 * a single scan request, a wiphy attribute. 445 * a single scan request, a wiphy attribute.
446 * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
447 * that can be added to a scan request
383 * 448 *
384 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 449 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
385 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 450 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
@@ -408,6 +473,44 @@ enum nl80211_commands {
408 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and 473 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
409 * %NL80211_CMD_DISASSOCIATE, u16 474 * %NL80211_CMD_DISASSOCIATE, u16
410 * 475 *
476 * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as
477 * a u32
478 *
479 * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change
480 * due to considerations from a beacon hint. This attribute reflects
481 * the state of the channel _before_ the beacon hint processing. This
482 * attributes consists of a nested attribute containing
483 * NL80211_FREQUENCY_ATTR_*
484 * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change
485 * due to considerations from a beacon hint. This attribute reflects
486 * the state of the channel _after_ the beacon hint processing. This
487 * attributes consists of a nested attribute containing
488 * NL80211_FREQUENCY_ATTR_*
489 *
490 * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
491 * cipher suites
492 *
493 * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
494 * for other networks on different channels
495 *
496 * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this
497 * is used, e.g., with %NL80211_CMD_AUTHENTICATE event
498 *
499 * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
500 * used for the association (&enum nl80211_mfp, represented as a u32);
501 * this attribute can be used
502 * with %NL80211_CMD_ASSOCIATE request
503 *
504 * @NL80211_ATTR_STA_FLAGS2: Attribute containing a
505 * &struct nl80211_sta_flag_update.
506 *
507 * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls
508 * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in
509 * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE
510 * request, the driver will assume that the port is unauthorized until
511 * authorized by user space. Otherwise, port is marked authorized by
512 * default in station mode.
513 *
411 * @NL80211_ATTR_MAX: highest attribute number currently defined 514 * @NL80211_ATTR_MAX: highest attribute number currently defined
412 * @__NL80211_ATTR_AFTER_LAST: internal use 515 * @__NL80211_ATTR_AFTER_LAST: internal use
413 */ 516 */
@@ -492,6 +595,30 @@ enum nl80211_attrs {
492 NL80211_ATTR_AUTH_TYPE, 595 NL80211_ATTR_AUTH_TYPE,
493 NL80211_ATTR_REASON_CODE, 596 NL80211_ATTR_REASON_CODE,
494 597
598 NL80211_ATTR_KEY_TYPE,
599
600 NL80211_ATTR_MAX_SCAN_IE_LEN,
601 NL80211_ATTR_CIPHER_SUITES,
602
603 NL80211_ATTR_FREQ_BEFORE,
604 NL80211_ATTR_FREQ_AFTER,
605
606 NL80211_ATTR_FREQ_FIXED,
607
608
609 NL80211_ATTR_WIPHY_RETRY_SHORT,
610 NL80211_ATTR_WIPHY_RETRY_LONG,
611 NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
612 NL80211_ATTR_WIPHY_RTS_THRESHOLD,
613
614 NL80211_ATTR_TIMED_OUT,
615
616 NL80211_ATTR_USE_MFP,
617
618 NL80211_ATTR_STA_FLAGS2,
619
620 NL80211_ATTR_CONTROL_PORT,
621
495 /* add attributes here, update the policy in nl80211.c */ 622 /* add attributes here, update the policy in nl80211.c */
496 623
497 __NL80211_ATTR_AFTER_LAST, 624 __NL80211_ATTR_AFTER_LAST,
@@ -581,6 +708,18 @@ enum nl80211_sta_flags {
581}; 708};
582 709
583/** 710/**
711 * struct nl80211_sta_flag_update - station flags mask/set
712 * @mask: mask of station flags to set
713 * @set: which values to set them to
714 *
715 * Both mask and set contain bits as per &enum nl80211_sta_flags.
716 */
717struct nl80211_sta_flag_update {
718 __u32 mask;
719 __u32 set;
720} __attribute__((packed));
721
722/**
584 * enum nl80211_rate_info - bitrate information 723 * enum nl80211_rate_info - bitrate information
585 * 724 *
586 * These attribute types are used with %NL80211_STA_INFO_TXRATE 725 * These attribute types are used with %NL80211_STA_INFO_TXRATE
@@ -1062,4 +1201,27 @@ enum nl80211_auth_type {
1062 NL80211_AUTHTYPE_FT, 1201 NL80211_AUTHTYPE_FT,
1063 NL80211_AUTHTYPE_NETWORK_EAP, 1202 NL80211_AUTHTYPE_NETWORK_EAP,
1064}; 1203};
1204
1205/**
1206 * enum nl80211_key_type - Key Type
1207 * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
1208 * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
1209 * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
1210 */
1211enum nl80211_key_type {
1212 NL80211_KEYTYPE_GROUP,
1213 NL80211_KEYTYPE_PAIRWISE,
1214 NL80211_KEYTYPE_PEERKEY,
1215};
1216
1217/**
1218 * enum nl80211_mfp - Management frame protection state
1219 * @NL80211_MFP_NO: Management frame protection not used
1220 * @NL80211_MFP_REQUIRED: Management frame protection required
1221 */
1222enum nl80211_mfp {
1223 NL80211_MFP_NO,
1224 NL80211_MFP_REQUIRED,
1225};
1226
1065#endif /* __LINUX_NL80211_H */ 1227#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 6a7efa242f5e..7be2d1043c16 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -77,6 +77,9 @@ extern int of_n_size_cells(struct device_node *np);
77extern const struct of_device_id *of_match_node( 77extern const struct of_device_id *of_match_node(
78 const struct of_device_id *matches, const struct device_node *node); 78 const struct of_device_id *matches, const struct device_node *node);
79extern int of_modalias_node(struct device_node *node, char *modalias, int len); 79extern int of_modalias_node(struct device_node *node, char *modalias, int len);
80extern struct device_node *of_parse_phandle(struct device_node *np,
81 const char *phandle_name,
82 int index);
80extern int of_parse_phandles_with_args(struct device_node *np, 83extern int of_parse_phandles_with_args(struct device_node *np,
81 const char *list_name, const char *cells_name, int index, 84 const char *list_name, const char *cells_name, int index,
82 struct device_node **out_node, const void **out_args); 85 struct device_node **out_node, const void **out_args);
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
new file mode 100644
index 000000000000..c9663c690303
--- /dev/null
+++ b/include/linux/of_mdio.h
@@ -0,0 +1,22 @@
1/*
2 * OF helpers for the MDIO (Ethernet PHY) API
3 *
4 * Copyright (c) 2009 Secret Lab Technologies, Ltd.
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_OF_MDIO_H
10#define __LINUX_OF_MDIO_H
11
12#include <linux/phy.h>
13#include <linux/of.h>
14
15extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
16extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
17extern struct phy_device *of_phy_connect(struct net_device *dev,
18 struct device_node *phy_np,
19 void (*hndlr)(struct net_device *),
20 u32 flags, phy_interface_t iface);
21
22#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 06ba90c211a5..3038ac25491f 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2313,6 +2313,8 @@
2313 2313
2314#define PCI_VENDOR_ID_QMI 0x1a32 2314#define PCI_VENDOR_ID_QMI 0x1a32
2315 2315
2316#define PCI_VENDOR_ID_AZWAVE 0x1a3b
2317
2316#define PCI_VENDOR_ID_TEKRAM 0x1de1 2318#define PCI_VENDOR_ID_TEKRAM 0x1de1
2317#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2319#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2318 2320
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 97e40cb6b588..c216e4e503b3 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -444,10 +444,16 @@ static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
444 444
445int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 445int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
446struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 446struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
447int phy_device_register(struct phy_device *phy);
447int phy_clear_interrupt(struct phy_device *phydev); 448int phy_clear_interrupt(struct phy_device *phydev);
448int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 449int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
450int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
451 u32 flags, phy_interface_t interface);
449struct phy_device * phy_attach(struct net_device *dev, 452struct phy_device * phy_attach(struct net_device *dev,
450 const char *bus_id, u32 flags, phy_interface_t interface); 453 const char *bus_id, u32 flags, phy_interface_t interface);
454int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
455 void (*handler)(struct net_device *), u32 flags,
456 phy_interface_t interface);
451struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 457struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
452 void (*handler)(struct net_device *), u32 flags, 458 void (*handler)(struct net_device *), u32 flags,
453 phy_interface_t interface); 459 phy_interface_t interface);
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 164332cbb77c..de18ef227e00 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -52,23 +52,12 @@ enum rfkill_state {
52 RFKILL_STATE_MAX, /* marker for last valid state */ 52 RFKILL_STATE_MAX, /* marker for last valid state */
53}; 53};
54 54
55/*
56 * These are DEPRECATED, drivers using them should be verified to
57 * comply with the rfkill usage guidelines in Documentation/rfkill.txt
58 * and then converted to use the new names for rfkill_state
59 */
60#define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED
61#define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED
62
63/** 55/**
64 * struct rfkill - rfkill control structure. 56 * struct rfkill - rfkill control structure.
65 * @name: Name of the switch. 57 * @name: Name of the switch.
66 * @type: Radio type which the button controls, the value stored 58 * @type: Radio type which the button controls, the value stored
67 * here should be a value from enum rfkill_type. 59 * here should be a value from enum rfkill_type.
68 * @state: State of the switch, "UNBLOCKED" means radio can operate. 60 * @state: State of the switch, "UNBLOCKED" means radio can operate.
69 * @user_claim_unsupported: Whether the hardware supports exclusive
70 * RF-kill control by userspace. Set this before registering.
71 * @user_claim: Set when the switch is controlled exlusively by userspace.
72 * @mutex: Guards switch state transitions. It serializes callbacks 61 * @mutex: Guards switch state transitions. It serializes callbacks
73 * and also protects the state. 62 * and also protects the state.
74 * @data: Pointer to the RF button drivers private data which will be 63 * @data: Pointer to the RF button drivers private data which will be
@@ -91,9 +80,6 @@ struct rfkill {
91 const char *name; 80 const char *name;
92 enum rfkill_type type; 81 enum rfkill_type type;
93 82
94 bool user_claim_unsupported;
95 bool user_claim;
96
97 /* the mutex serializes callbacks and also protects 83 /* the mutex serializes callbacks and also protects
98 * the state */ 84 * the state */
99 struct mutex mutex; 85 struct mutex mutex;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5fd389162f01..1b5c3d298f43 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1715,8 +1715,14 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1715 struct iovec *iov); 1715 struct iovec *iov);
1716extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 1716extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
1717 int offset, 1717 int offset,
1718 struct iovec *from, 1718 const struct iovec *from,
1719 int from_offset,
1719 int len); 1720 int len);
1721extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1722 int offset,
1723 const struct iovec *to,
1724 int to_offset,
1725 int size);
1720extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1726extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1721extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1727extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1722 unsigned int flags); 1728 unsigned int flags);
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index b32725075d71..5241e4fb4eca 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -47,4 +47,14 @@ struct smsc911x_platform_config {
47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) 47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3))
48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4)) 48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4))
49 49
50/*
51 * SMSC911X_SWAP_FIFO:
52 * Enables software byte swap for fifo data. Should only be used as a
53 * "last resort" in the case of big endian mode on boards with incorrectly
54 * routed data bus to older devices such as LAN9118. Newer devices such as
55 * LAN9221 can handle this in hardware, there are registers to control
56 * this swapping but the driver doesn't currently use them.
57 */
58#define SMSC911X_SWAP_FIFO (BIT(5))
59
50#endif /* __LINUX_SMSC911X_H__ */ 60#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index aee3f1e1d1ce..0f953fe40413 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -18,7 +18,7 @@
18enum 18enum
19{ 19{
20 IPSTATS_MIB_NUM = 0, 20 IPSTATS_MIB_NUM = 0,
21 IPSTATS_MIB_INRECEIVES, /* InReceives */ 21 IPSTATS_MIB_INPKTS, /* InReceives */
22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ 22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */
23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ 23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */
24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ 24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */
@@ -28,7 +28,7 @@ enum
28 IPSTATS_MIB_INDISCARDS, /* InDiscards */ 28 IPSTATS_MIB_INDISCARDS, /* InDiscards */
29 IPSTATS_MIB_INDELIVERS, /* InDelivers */ 29 IPSTATS_MIB_INDELIVERS, /* InDelivers */
30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ 30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
31 IPSTATS_MIB_OUTREQUESTS, /* OutRequests */ 31 IPSTATS_MIB_OUTPKTS, /* OutRequests */
32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ 32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */
33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ 33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */
34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ 34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */
@@ -42,6 +42,12 @@ enum
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ 43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ 44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
45 IPSTATS_MIB_INOCTETS, /* InOctets */
46 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
47 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */
48 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
49 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
50 IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */
45 __IPSTATS_MIB_MAX 51 __IPSTATS_MIB_MAX
46}; 52};
47 53
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 421afb4d29b0..d2310cb45d2f 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -303,14 +303,15 @@ struct ucred {
303#define SOL_BLUETOOTH 274 303#define SOL_BLUETOOTH 274
304#define SOL_PNPIPE 275 304#define SOL_PNPIPE 275
305#define SOL_RDS 276 305#define SOL_RDS 276
306#define SOL_IUCV 277
306 307
307/* IPX options */ 308/* IPX options */
308#define IPX_TYPE 1 309#define IPX_TYPE 1
309 310
310#ifdef __KERNEL__ 311#ifdef __KERNEL__
311extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 312extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
312extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, 313extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
313 int offset, int len); 314 int offset, int len);
314extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 315extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
315 struct iovec *iov, 316 struct iovec *iov,
316 int offset, 317 int offset,
@@ -318,6 +319,8 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
318 319
319extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); 320extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode);
320extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 321extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
322extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
323 int offset, int len);
321extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen); 324extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen);
322extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); 325extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr);
323extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 326extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
new file mode 100644
index 000000000000..11430cab2aad
--- /dev/null
+++ b/include/linux/spi/wl12xx.h
@@ -0,0 +1,31 @@
1/*
2 * This file is part of wl12xx
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 *
6 * Contact: Kalle Valo <kalle.valo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef _LINUX_SPI_WL12XX_H
25#define _LINUX_SPI_WL12XX_H
26
27struct wl12xx_platform_data {
28 void (*set_power)(bool enable);
29};
30
31#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 9d5078bd23a3..8afac76cd748 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -377,7 +377,7 @@ struct tcp_sock {
377 unsigned int keepalive_time; /* time before keep alive takes place */ 377 unsigned int keepalive_time; /* time before keep alive takes place */
378 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 378 unsigned int keepalive_intvl; /* time interval between keep alive probes */
379 379
380 unsigned long last_synq_overflow; 380 int linger2;
381 381
382/* Receiver side RTT estimation */ 382/* Receiver side RTT estimation */
383 struct { 383 struct {
@@ -406,8 +406,6 @@ struct tcp_sock {
406/* TCP MD5 Signagure Option information */ 406/* TCP MD5 Signagure Option information */
407 struct tcp_md5sig_info *md5sig_info; 407 struct tcp_md5sig_info *md5sig_info;
408#endif 408#endif
409
410 int linger2;
411}; 409};
412 410
413static inline struct tcp_sock *tcp_sk(const struct sock *sk) 411static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 36fabb95c7d3..5d44059f6d63 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -183,6 +183,7 @@ extern void usbnet_tx_timeout (struct net_device *net);
183extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 183extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
184 184
185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
186extern int usbnet_get_ethernet_addr(struct usbnet *, int);
186extern void usbnet_defer_kevent (struct usbnet *, int); 187extern void usbnet_defer_kevent (struct usbnet *, int);
187extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 188extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
188extern void usbnet_unlink_rx_urbs(struct usbnet *); 189extern void usbnet_unlink_rx_urbs(struct usbnet *);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5389afdc1297..9e17a83d3432 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1,71 +1,217 @@
1#ifndef __NET_CFG80211_H 1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H 2#define __NET_CFG80211_H
3/*
4 * 802.11 device and configuration interface
5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
3 12
13#include <linux/netdevice.h>
14#include <linux/debugfs.h>
15#include <linux/list.h>
4#include <linux/netlink.h> 16#include <linux/netlink.h>
5#include <linux/skbuff.h> 17#include <linux/skbuff.h>
6#include <linux/nl80211.h> 18#include <linux/nl80211.h>
7#include <linux/if_ether.h> 19#include <linux/if_ether.h>
8#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
9#include <linux/wireless.h> 21#include <net/regulatory.h>
10#include <net/iw_handler.h> 22
11#include <net/genetlink.h>
12/* remove once we remove the wext stuff */ 23/* remove once we remove the wext stuff */
13#include <net/iw_handler.h> 24#include <net/iw_handler.h>
25#include <linux/wireless.h>
26
14 27
15/* 28/*
16 * 802.11 configuration in-kernel interface 29 * wireless hardware capability structures
30 */
31
32/**
33 * enum ieee80211_band - supported frequency bands
34 *
35 * The bands are assigned this way because the supported
36 * bitrates differ in these bands.
17 * 37 *
18 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
19 */ 40 */
41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ,
44
45 /* keep last */
46 IEEE80211_NUM_BANDS
47};
20 48
21/** 49/**
22 * struct vif_params - describes virtual interface parameters 50 * enum ieee80211_channel_flags - channel flags
23 * @mesh_id: mesh ID to use 51 *
24 * @mesh_id_len: length of the mesh ID 52 * Channel flags set by the regulatory control code.
53 *
54 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
55 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
56 * on this channel.
57 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
58 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
59 * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
60 * is not permitted.
61 * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
62 * is not permitted.
25 */ 63 */
26struct vif_params { 64enum ieee80211_channel_flags {
27 u8 *mesh_id; 65 IEEE80211_CHAN_DISABLED = 1<<0,
28 int mesh_id_len; 66 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
67 IEEE80211_CHAN_NO_IBSS = 1<<2,
68 IEEE80211_CHAN_RADAR = 1<<3,
69 IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4,
70 IEEE80211_CHAN_NO_FAT_BELOW = 1<<5,
29}; 71};
30 72
31/* Radiotap header iteration 73/**
32 * implemented in net/wireless/radiotap.c 74 * struct ieee80211_channel - channel definition
33 * docs in Documentation/networking/radiotap-headers.txt 75 *
76 * This structure describes a single channel for use
77 * with cfg80211.
78 *
79 * @center_freq: center frequency in MHz
80 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
81 * @hw_value: hardware-specific value for the channel
82 * @flags: channel flags from &enum ieee80211_channel_flags.
83 * @orig_flags: channel flags at registration time, used by regulatory
84 * code to support devices with additional restrictions
85 * @band: band this channel belongs to.
86 * @max_antenna_gain: maximum antenna gain in dBi
87 * @max_power: maximum transmission power (in dBm)
88 * @beacon_found: helper to regulatory code to indicate when a beacon
89 * has been found on this channel. Use regulatory_hint_found_beacon()
90 * to enable this, this is is useful only on 5 GHz band.
91 * @orig_mag: internal use
92 * @orig_mpwr: internal use
34 */ 93 */
94struct ieee80211_channel {
95 enum ieee80211_band band;
96 u16 center_freq;
97 u8 max_bandwidth;
98 u16 hw_value;
99 u32 flags;
100 int max_antenna_gain;
101 int max_power;
102 bool beacon_found;
103 u32 orig_flags;
104 int orig_mag, orig_mpwr;
105};
106
35/** 107/**
36 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 108 * enum ieee80211_rate_flags - rate flags
37 * @rtheader: pointer to the radiotap header we are walking through 109 *
38 * @max_length: length of radiotap header in cpu byte ordering 110 * Hardware/specification flags for rates. These are structured
39 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 111 * in a way that allows using the same bitrate structure for
40 * @this_arg: pointer to current radiotap arg 112 * different bands/PHY modes.
41 * @arg_index: internal next argument index 113 *
42 * @arg: internal next argument pointer 114 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
43 * @next_bitmap: internal pointer to next present u32 115 * preamble on this bitrate; only relevant in 2.4GHz band and
44 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 116 * with CCK rates.
117 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
118 * when used with 802.11a (on the 5 GHz band); filled by the
119 * core code when registering the wiphy.
120 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
121 * when used with 802.11b (on the 2.4 GHz band); filled by the
122 * core code when registering the wiphy.
123 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
124 * when used with 802.11g (on the 2.4 GHz band); filled by the
125 * core code when registering the wiphy.
126 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
45 */ 127 */
128enum ieee80211_rate_flags {
129 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
130 IEEE80211_RATE_MANDATORY_A = 1<<1,
131 IEEE80211_RATE_MANDATORY_B = 1<<2,
132 IEEE80211_RATE_MANDATORY_G = 1<<3,
133 IEEE80211_RATE_ERP_G = 1<<4,
134};
46 135
47struct ieee80211_radiotap_iterator { 136/**
48 struct ieee80211_radiotap_header *rtheader; 137 * struct ieee80211_rate - bitrate definition
49 int max_length; 138 *
50 int this_arg_index; 139 * This structure describes a bitrate that an 802.11 PHY can
51 u8 *this_arg; 140 * operate with. The two values @hw_value and @hw_value_short
141 * are only for driver use when pointers to this structure are
142 * passed around.
143 *
144 * @flags: rate-specific flags
145 * @bitrate: bitrate in units of 100 Kbps
146 * @hw_value: driver/hardware value for this rate
147 * @hw_value_short: driver/hardware value for this rate when
148 * short preamble is used
149 */
150struct ieee80211_rate {
151 u32 flags;
152 u16 bitrate;
153 u16 hw_value, hw_value_short;
154};
52 155
53 int arg_index; 156/**
54 u8 *arg; 157 * struct ieee80211_sta_ht_cap - STA's HT capabilities
55 __le32 *next_bitmap; 158 *
56 u32 bitmap_shifter; 159 * This structure describes most essential parameters needed
160 * to describe 802.11n HT capabilities for an STA.
161 *
162 * @ht_supported: is HT supported by the STA
163 * @cap: HT capabilities map as described in 802.11n spec
164 * @ampdu_factor: Maximum A-MPDU length factor
165 * @ampdu_density: Minimum A-MPDU spacing
166 * @mcs: Supported MCS rates
167 */
168struct ieee80211_sta_ht_cap {
169 u16 cap; /* use IEEE80211_HT_CAP_ */
170 bool ht_supported;
171 u8 ampdu_factor;
172 u8 ampdu_density;
173 struct ieee80211_mcs_info mcs;
57}; 174};
58 175
59extern int ieee80211_radiotap_iterator_init( 176/**
60 struct ieee80211_radiotap_iterator *iterator, 177 * struct ieee80211_supported_band - frequency band definition
61 struct ieee80211_radiotap_header *radiotap_header, 178 *
62 int max_length); 179 * This structure describes a frequency band a wiphy
180 * is able to operate in.
181 *
182 * @channels: Array of channels the hardware can operate in
183 * in this band.
184 * @band: the band this structure represents
185 * @n_channels: Number of channels in @channels
186 * @bitrates: Array of bitrates the hardware can operate with
187 * in this band. Must be sorted to give a valid "supported
188 * rates" IE, i.e. CCK rates first, then OFDM.
189 * @n_bitrates: Number of bitrates in @bitrates
190 */
191struct ieee80211_supported_band {
192 struct ieee80211_channel *channels;
193 struct ieee80211_rate *bitrates;
194 enum ieee80211_band band;
195 int n_channels;
196 int n_bitrates;
197 struct ieee80211_sta_ht_cap ht_cap;
198};
63 199
64extern int ieee80211_radiotap_iterator_next( 200/*
65 struct ieee80211_radiotap_iterator *iterator); 201 * Wireless hardware/device configuration structures and methods
202 */
66 203
204/**
205 * struct vif_params - describes virtual interface parameters
206 * @mesh_id: mesh ID to use
207 * @mesh_id_len: length of the mesh ID
208 */
209struct vif_params {
210 u8 *mesh_id;
211 int mesh_id_len;
212};
67 213
68 /** 214/**
69 * struct key_params - key information 215 * struct key_params - key information
70 * 216 *
71 * Information about a key 217 * Information about a key
@@ -106,27 +252,6 @@ struct beacon_parameters {
106}; 252};
107 253
108/** 254/**
109 * enum station_flags - station flags
110 *
111 * Station capability flags. Note that these must be the bits
112 * according to the nl80211 flags.
113 *
114 * @STATION_FLAG_CHANGED: station flags were changed
115 * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
116 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
117 * with short preambles
118 * @STATION_FLAG_WME: station is WME/QoS capable
119 * @STATION_FLAG_MFP: station uses management frame protection
120 */
121enum station_flags {
122 STATION_FLAG_CHANGED = 1<<0,
123 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
124 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
125 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
127};
128
129/**
130 * enum plink_action - actions to perform in mesh peers 255 * enum plink_action - actions to perform in mesh peers
131 * 256 *
132 * @PLINK_ACTION_INVALID: action 0 is reserved 257 * @PLINK_ACTION_INVALID: action 0 is reserved
@@ -148,14 +273,17 @@ enum plink_actions {
148 * @supported_rates: supported rates in IEEE 802.11 format 273 * @supported_rates: supported rates in IEEE 802.11 format
149 * (or NULL for no change) 274 * (or NULL for no change)
150 * @supported_rates_len: number of supported rates 275 * @supported_rates_len: number of supported rates
151 * @station_flags: station flags (see &enum station_flags) 276 * @sta_flags_mask: station flags that changed
277 * (bitmask of BIT(NL80211_STA_FLAG_...))
278 * @sta_flags_set: station flags values
279 * (bitmask of BIT(NL80211_STA_FLAG_...))
152 * @listen_interval: listen interval or -1 for no change 280 * @listen_interval: listen interval or -1 for no change
153 * @aid: AID or zero for no change 281 * @aid: AID or zero for no change
154 */ 282 */
155struct station_parameters { 283struct station_parameters {
156 u8 *supported_rates; 284 u8 *supported_rates;
157 struct net_device *vlan; 285 struct net_device *vlan;
158 u32 station_flags; 286 u32 sta_flags_mask, sta_flags_set;
159 int listen_interval; 287 int listen_interval;
160 u16 aid; 288 u16 aid;
161 u8 supported_rates_len; 289 u8 supported_rates_len;
@@ -348,92 +476,6 @@ struct bss_parameters {
348 u8 basic_rates_len; 476 u8 basic_rates_len;
349}; 477};
350 478
351/**
352 * enum environment_cap - Environment parsed from country IE
353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
354 * outdoor operation.
355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
357 */
358enum environment_cap {
359 ENVIRON_ANY,
360 ENVIRON_INDOOR,
361 ENVIRON_OUTDOOR,
362};
363
364/**
365 * struct regulatory_request - used to keep track of regulatory requests
366 *
367 * @wiphy_idx: this is set if this request's initiator is
368 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
369 * can be used by the wireless core to deal with conflicts
370 * and potentially inform users of which devices specifically
371 * cased the conflicts.
372 * @initiator: indicates who sent this request, could be any of
373 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
374 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
375 * regulatory domain. We have a few special codes:
376 * 00 - World regulatory domain
377 * 99 - built by driver but a specific alpha2 cannot be determined
378 * 98 - result of an intersection between two regulatory domains
379 * @intersect: indicates whether the wireless core should intersect
380 * the requested regulatory domain with the presently set regulatory
381 * domain.
382 * @country_ie_checksum: checksum of the last processed and accepted
383 * country IE
384 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
385 * indoor, or if it doesn't matter
386 * @list: used to insert into the reg_requests_list linked list
387 */
388struct regulatory_request {
389 int wiphy_idx;
390 enum nl80211_reg_initiator initiator;
391 char alpha2[2];
392 bool intersect;
393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
395 struct list_head list;
396};
397
398struct ieee80211_freq_range {
399 u32 start_freq_khz;
400 u32 end_freq_khz;
401 u32 max_bandwidth_khz;
402};
403
404struct ieee80211_power_rule {
405 u32 max_antenna_gain;
406 u32 max_eirp;
407};
408
409struct ieee80211_reg_rule {
410 struct ieee80211_freq_range freq_range;
411 struct ieee80211_power_rule power_rule;
412 u32 flags;
413};
414
415struct ieee80211_regdomain {
416 u32 n_reg_rules;
417 char alpha2[2];
418 struct ieee80211_reg_rule reg_rules[];
419};
420
421#define MHZ_TO_KHZ(freq) ((freq) * 1000)
422#define KHZ_TO_MHZ(freq) ((freq) / 1000)
423#define DBI_TO_MBI(gain) ((gain) * 100)
424#define MBI_TO_DBI(gain) ((gain) / 100)
425#define DBM_TO_MBM(gain) ((gain) * 100)
426#define MBM_TO_DBM(gain) ((gain) / 100)
427
428#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
429 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
430 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
431 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
432 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
433 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
434 .flags = reg_flags, \
435 }
436
437struct mesh_config { 479struct mesh_config {
438 /* Timeouts in ms */ 480 /* Timeouts in ms */
439 /* Mesh plink management parameters */ 481 /* Mesh plink management parameters */
@@ -504,7 +546,7 @@ struct cfg80211_scan_request {
504 int n_ssids; 546 int n_ssids;
505 struct ieee80211_channel **channels; 547 struct ieee80211_channel **channels;
506 u32 n_channels; 548 u32 n_channels;
507 u8 *ie; 549 const u8 *ie;
508 size_t ie_len; 550 size_t ie_len;
509 551
510 /* internal */ 552 /* internal */
@@ -612,6 +654,11 @@ struct cfg80211_auth_request {
612 * @ssid_len: Length of ssid in octets 654 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 655 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets 656 * @ie_len: Length of ie buffer in octets
657 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
658 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
659 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
660 * required to assume that the port is unauthorized until authorized by
661 * user space. Otherwise, port is marked authorized by default.
615 */ 662 */
616struct cfg80211_assoc_request { 663struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan; 664 struct ieee80211_channel *chan;
@@ -620,6 +667,8 @@ struct cfg80211_assoc_request {
620 size_t ssid_len; 667 size_t ssid_len;
621 const u8 *ie; 668 const u8 *ie;
622 size_t ie_len; 669 size_t ie_len;
670 bool use_mfp;
671 bool control_port;
623}; 672};
624 673
625/** 674/**
@@ -659,6 +708,47 @@ struct cfg80211_disassoc_request {
659}; 708};
660 709
661/** 710/**
711 * struct cfg80211_ibss_params - IBSS parameters
712 *
713 * This structure defines the IBSS parameters for the join_ibss()
714 * method.
715 *
716 * @ssid: The SSID, will always be non-null.
717 * @ssid_len: The length of the SSID, will always be non-zero.
718 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
719 * search for IBSSs with a different BSSID.
720 * @channel: The channel to use if no IBSS can be found to join.
721 * @channel_fixed: The channel should be fixed -- do not search for
722 * IBSSs to join on other channels.
723 * @ie: information element(s) to include in the beacon
724 * @ie_len: length of that
725 * @beacon_interval: beacon interval to use
726 */
727struct cfg80211_ibss_params {
728 u8 *ssid;
729 u8 *bssid;
730 struct ieee80211_channel *channel;
731 u8 *ie;
732 u8 ssid_len, ie_len;
733 u16 beacon_interval;
734 bool channel_fixed;
735};
736
737/**
738 * enum wiphy_params_flags - set_wiphy_params bitfield values
739 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
740 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
741 * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
742 * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
743 */
744enum wiphy_params_flags {
745 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
746 WIPHY_PARAM_RETRY_LONG = 1 << 1,
747 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
748 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
749};
750
751/**
662 * struct cfg80211_ops - backend description for wireless configuration 752 * struct cfg80211_ops - backend description for wireless configuration
663 * 753 *
664 * This struct is registered by fullmac card drivers and/or wireless stacks 754 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -733,6 +823,16 @@ struct cfg80211_disassoc_request {
733 * @assoc: Request to (re)associate with the specified peer 823 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer 824 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer 825 * @disassoc: Request to disassociate from the specified peer
826 *
827 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
828 * cfg80211_ibss_joined(), also call that function when changing BSSID due
829 * to a merge.
830 * @leave_ibss: Leave the IBSS.
831 *
832 * @set_wiphy_params: Notify that wiphy parameters have changed;
833 * @changed bitfield (see &enum wiphy_params_flags) describes which values
834 * have changed. The actual parameter values are available in
835 * struct wiphy. If returning an error, no value should be changed.
736 */ 836 */
737struct cfg80211_ops { 837struct cfg80211_ops {
738 int (*suspend)(struct wiphy *wiphy); 838 int (*suspend)(struct wiphy *wiphy);
@@ -747,13 +847,13 @@ struct cfg80211_ops {
747 struct vif_params *params); 847 struct vif_params *params);
748 848
749 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 849 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
750 u8 key_index, u8 *mac_addr, 850 u8 key_index, const u8 *mac_addr,
751 struct key_params *params); 851 struct key_params *params);
752 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 852 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
753 u8 key_index, u8 *mac_addr, void *cookie, 853 u8 key_index, const u8 *mac_addr, void *cookie,
754 void (*callback)(void *cookie, struct key_params*)); 854 void (*callback)(void *cookie, struct key_params*));
755 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 855 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
756 u8 key_index, u8 *mac_addr); 856 u8 key_index, const u8 *mac_addr);
757 int (*set_default_key)(struct wiphy *wiphy, 857 int (*set_default_key)(struct wiphy *wiphy,
758 struct net_device *netdev, 858 struct net_device *netdev,
759 u8 key_index); 859 u8 key_index);
@@ -818,9 +918,417 @@ struct cfg80211_ops {
818 struct cfg80211_deauth_request *req); 918 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 919 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req); 920 struct cfg80211_disassoc_request *req);
921
922 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
923 struct cfg80211_ibss_params *params);
924 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
925
926 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
821}; 927};
822 928
823/* temporary wext handlers */ 929/*
930 * wireless hardware and networking interfaces structures
931 * and registration/helper functions
932 */
933
934/**
935 * struct wiphy - wireless hardware description
936 * @idx: the wiphy index assigned to this item
937 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
938 * @custom_regulatory: tells us the driver for this device
939 * has its own custom regulatory domain and cannot identify the
940 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
941 * we will disregard the first regulatory hint (when the
942 * initiator is %REGDOM_SET_BY_CORE).
943 * @strict_regulatory: tells us the driver for this device will ignore
944 * regulatory domain settings until it gets its own regulatory domain
945 * via its regulatory_hint(). After its gets its own regulatory domain
946 * it will only allow further regulatory domain settings to further
947 * enhance compliance. For example if channel 13 and 14 are disabled
948 * by this regulatory domain no user regulatory domain can enable these
949 * channels at a later time. This can be used for devices which do not
950 * have calibration information gauranteed for frequencies or settings
951 * outside of its regulatory domain.
952 * @reg_notifier: the driver's regulatory notification callback
953 * @regd: the driver's regulatory domain, if one was requested via
954 * the regulatory_hint() API. This can be used by the driver
955 * on the reg_notifier() if it chooses to ignore future
956 * regulatory domain changes caused by other drivers.
957 * @signal_type: signal type reported in &struct cfg80211_bss.
958 * @cipher_suites: supported cipher suites
959 * @n_cipher_suites: number of supported cipher suites
960 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
961 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
962 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
963 * -1 = fragmentation disabled, only odd values >= 256 used
964 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
965 */
966struct wiphy {
967 /* assign these fields before you register the wiphy */
968
969 /* permanent MAC address */
970 u8 perm_addr[ETH_ALEN];
971
972 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
973 u16 interface_modes;
974
975 bool custom_regulatory;
976 bool strict_regulatory;
977
978 enum cfg80211_signal_type signal_type;
979
980 int bss_priv_size;
981 u8 max_scan_ssids;
982 u16 max_scan_ie_len;
983
984 int n_cipher_suites;
985 const u32 *cipher_suites;
986
987 u8 retry_short;
988 u8 retry_long;
989 u32 frag_threshold;
990 u32 rts_threshold;
991
992 /* If multiple wiphys are registered and you're handed e.g.
993 * a regular netdev with assigned ieee80211_ptr, you won't
994 * know whether it points to a wiphy your driver has registered
995 * or not. Assign this to something global to your driver to
996 * help determine whether you own this wiphy or not. */
997 void *privid;
998
999 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
1000
1001 /* Lets us get back the wiphy on the callback */
1002 int (*reg_notifier)(struct wiphy *wiphy,
1003 struct regulatory_request *request);
1004
1005 /* fields below are read-only, assigned by cfg80211 */
1006
1007 const struct ieee80211_regdomain *regd;
1008
1009 /* the item in /sys/class/ieee80211/ points to this,
1010 * you need use set_wiphy_dev() (see below) */
1011 struct device dev;
1012
1013 /* dir in debugfs: ieee80211/<wiphyname> */
1014 struct dentry *debugfsdir;
1015
1016 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1017};
1018
1019/**
1020 * wiphy_priv - return priv from wiphy
1021 *
1022 * @wiphy: the wiphy whose priv pointer to return
1023 */
1024static inline void *wiphy_priv(struct wiphy *wiphy)
1025{
1026 BUG_ON(!wiphy);
1027 return &wiphy->priv;
1028}
1029
1030/**
1031 * set_wiphy_dev - set device pointer for wiphy
1032 *
1033 * @wiphy: The wiphy whose device to bind
1034 * @dev: The device to parent it to
1035 */
1036static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1037{
1038 wiphy->dev.parent = dev;
1039}
1040
1041/**
1042 * wiphy_dev - get wiphy dev pointer
1043 *
1044 * @wiphy: The wiphy whose device struct to look up
1045 */
1046static inline struct device *wiphy_dev(struct wiphy *wiphy)
1047{
1048 return wiphy->dev.parent;
1049}
1050
1051/**
1052 * wiphy_name - get wiphy name
1053 *
1054 * @wiphy: The wiphy whose name to return
1055 */
1056static inline const char *wiphy_name(struct wiphy *wiphy)
1057{
1058 return dev_name(&wiphy->dev);
1059}
1060
1061/**
1062 * wiphy_new - create a new wiphy for use with cfg80211
1063 *
1064 * @ops: The configuration operations for this device
1065 * @sizeof_priv: The size of the private area to allocate
1066 *
1067 * Create a new wiphy and associate the given operations with it.
1068 * @sizeof_priv bytes are allocated for private use.
1069 *
1070 * The returned pointer must be assigned to each netdev's
1071 * ieee80211_ptr for proper operation.
1072 */
1073struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
1074
1075/**
1076 * wiphy_register - register a wiphy with cfg80211
1077 *
1078 * @wiphy: The wiphy to register.
1079 *
1080 * Returns a non-negative wiphy index or a negative error code.
1081 */
1082extern int wiphy_register(struct wiphy *wiphy);
1083
1084/**
1085 * wiphy_unregister - deregister a wiphy from cfg80211
1086 *
1087 * @wiphy: The wiphy to unregister.
1088 *
1089 * After this call, no more requests can be made with this priv
1090 * pointer, but the call may sleep to wait for an outstanding
1091 * request that is being handled.
1092 */
1093extern void wiphy_unregister(struct wiphy *wiphy);
1094
1095/**
1096 * wiphy_free - free wiphy
1097 *
1098 * @wiphy: The wiphy to free
1099 */
1100extern void wiphy_free(struct wiphy *wiphy);
1101
1102/**
1103 * struct wireless_dev - wireless per-netdev state
1104 *
1105 * This structure must be allocated by the driver/stack
1106 * that uses the ieee80211_ptr field in struct net_device
1107 * (this is intentional so it can be allocated along with
1108 * the netdev.)
1109 *
1110 * @wiphy: pointer to hardware description
1111 * @iftype: interface type
1112 * @list: (private) Used to collect the interfaces
1113 * @netdev: (private) Used to reference back to the netdev
1114 * @current_bss: (private) Used by the internal configuration code
1115 * @bssid: (private) Used by the internal configuration code
1116 * @ssid: (private) Used by the internal configuration code
1117 * @ssid_len: (private) Used by the internal configuration code
1118 * @wext: (private) Used by the internal wireless extensions compat code
1119 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1120 */
1121struct wireless_dev {
1122 struct wiphy *wiphy;
1123 enum nl80211_iftype iftype;
1124
1125 /* private to the generic wireless code */
1126 struct list_head list;
1127 struct net_device *netdev;
1128
1129 /* currently used for IBSS - might be rearranged in the future */
1130 struct cfg80211_bss *current_bss;
1131 u8 bssid[ETH_ALEN];
1132 u8 ssid[IEEE80211_MAX_SSID_LEN];
1133 u8 ssid_len;
1134
1135#ifdef CONFIG_WIRELESS_EXT
1136 /* wext data */
1137 struct {
1138 struct cfg80211_ibss_params ibss;
1139 u8 bssid[ETH_ALEN];
1140 s8 default_key, default_mgmt_key;
1141 } wext;
1142#endif
1143};
1144
1145/**
1146 * wdev_priv - return wiphy priv from wireless_dev
1147 *
1148 * @wdev: The wireless device whose wiphy's priv pointer to return
1149 */
1150static inline void *wdev_priv(struct wireless_dev *wdev)
1151{
1152 BUG_ON(!wdev);
1153 return wiphy_priv(wdev->wiphy);
1154}
1155
1156/*
1157 * Utility functions
1158 */
1159
1160/**
1161 * ieee80211_channel_to_frequency - convert channel number to frequency
1162 */
1163extern int ieee80211_channel_to_frequency(int chan);
1164
1165/**
1166 * ieee80211_frequency_to_channel - convert frequency to channel number
1167 */
1168extern int ieee80211_frequency_to_channel(int freq);
1169
1170/*
1171 * Name indirection necessary because the ieee80211 code also has
1172 * a function named "ieee80211_get_channel", so if you include
1173 * cfg80211's header file you get cfg80211's version, if you try
1174 * to include both header files you'll (rightfully!) get a symbol
1175 * clash.
1176 */
1177extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1178 int freq);
1179/**
1180 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1181 */
1182static inline struct ieee80211_channel *
1183ieee80211_get_channel(struct wiphy *wiphy, int freq)
1184{
1185 return __ieee80211_get_channel(wiphy, freq);
1186}
1187
1188/**
1189 * ieee80211_get_response_rate - get basic rate for a given rate
1190 *
1191 * @sband: the band to look for rates in
1192 * @basic_rates: bitmap of basic rates
1193 * @bitrate: the bitrate for which to find the basic rate
1194 *
1195 * This function returns the basic rate corresponding to a given
1196 * bitrate, that is the next lower bitrate contained in the basic
1197 * rate map, which is, for this function, given as a bitmap of
1198 * indices of rates in the band's bitrate table.
1199 */
1200struct ieee80211_rate *
1201ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1202 u32 basic_rates, int bitrate);
1203
1204/*
1205 * Radiotap parsing functions -- for controlled injection support
1206 *
1207 * Implemented in net/wireless/radiotap.c
1208 * Documentation in Documentation/networking/radiotap-headers.txt
1209 */
1210
1211/**
1212 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1213 * @rtheader: pointer to the radiotap header we are walking through
1214 * @max_length: length of radiotap header in cpu byte ordering
1215 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
1216 * @this_arg: pointer to current radiotap arg
1217 * @arg_index: internal next argument index
1218 * @arg: internal next argument pointer
1219 * @next_bitmap: internal pointer to next present u32
1220 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1221 */
1222
1223struct ieee80211_radiotap_iterator {
1224 struct ieee80211_radiotap_header *rtheader;
1225 int max_length;
1226 int this_arg_index;
1227 u8 *this_arg;
1228
1229 int arg_index;
1230 u8 *arg;
1231 __le32 *next_bitmap;
1232 u32 bitmap_shifter;
1233};
1234
1235extern int ieee80211_radiotap_iterator_init(
1236 struct ieee80211_radiotap_iterator *iterator,
1237 struct ieee80211_radiotap_header *radiotap_header,
1238 int max_length);
1239
1240extern int ieee80211_radiotap_iterator_next(
1241 struct ieee80211_radiotap_iterator *iterator);
1242
1243/*
1244 * Regulatory helper functions for wiphys
1245 */
1246
1247/**
1248 * regulatory_hint - driver hint to the wireless core a regulatory domain
1249 * @wiphy: the wireless device giving the hint (used only for reporting
1250 * conflicts)
1251 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
1252 * should be in. If @rd is set this should be NULL. Note that if you
1253 * set this to NULL you should still set rd->alpha2 to some accepted
1254 * alpha2.
1255 *
1256 * Wireless drivers can use this function to hint to the wireless core
1257 * what it believes should be the current regulatory domain by
1258 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
1259 * domain should be in or by providing a completely build regulatory domain.
1260 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
1261 * for a regulatory domain structure for the respective country.
1262 *
1263 * The wiphy must have been registered to cfg80211 prior to this call.
1264 * For cfg80211 drivers this means you must first use wiphy_register(),
1265 * for mac80211 drivers you must first use ieee80211_register_hw().
1266 *
1267 * Drivers should check the return value, its possible you can get
1268 * an -ENOMEM.
1269 */
1270extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1271
1272/**
1273 * regulatory_hint_11d - hints a country IE as a regulatory domain
1274 * @wiphy: the wireless device giving the hint (used only for reporting
1275 * conflicts)
1276 * @country_ie: pointer to the country IE
1277 * @country_ie_len: length of the country IE
1278 *
1279 * We will intersect the rd with the what CRDA tells us should apply
1280 * for the alpha2 this country IE belongs to, this prevents APs from
1281 * sending us incorrect or outdated information against a country.
1282 */
1283extern void regulatory_hint_11d(struct wiphy *wiphy,
1284 u8 *country_ie,
1285 u8 country_ie_len);
1286/**
1287 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1288 * @wiphy: the wireless device we want to process the regulatory domain on
1289 * @regd: the custom regulatory domain to use for this wiphy
1290 *
1291 * Drivers can sometimes have custom regulatory domains which do not apply
1292 * to a specific country. Drivers can use this to apply such custom regulatory
1293 * domains. This routine must be called prior to wiphy registration. The
1294 * custom regulatory domain will be trusted completely and as such previous
1295 * default channel settings will be disregarded. If no rule is found for a
1296 * channel on the regulatory domain the channel will be disabled.
1297 */
1298extern void wiphy_apply_custom_regulatory(
1299 struct wiphy *wiphy,
1300 const struct ieee80211_regdomain *regd);
1301
1302/**
1303 * freq_reg_info - get regulatory information for the given frequency
1304 * @wiphy: the wiphy for which we want to process this rule for
1305 * @center_freq: Frequency in KHz for which we want regulatory information for
1306 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
1307 * you can set this to 0. If this frequency is allowed we then set
1308 * this value to the maximum allowed bandwidth.
1309 * @reg_rule: the regulatory rule which we have for this frequency
1310 *
1311 * Use this function to get the regulatory rule for a specific frequency on
1312 * a given wireless device. If the device has a specific regulatory domain
1313 * it wants to follow we respect that unless a country IE has been received
1314 * and processed already.
1315 *
1316 * Returns 0 if it was able to find a valid regulatory rule which does
1317 * apply to the given center_freq otherwise it returns non-zero. It will
1318 * also return -ERANGE if we determine the given center_freq does not even have
1319 * a regulatory rule for a frequency range in the center_freq's band. See
1320 * freq_in_rule_band() for our current definition of a band -- this is purely
1321 * subjective and right now its 802.11 specific.
1322 */
1323extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
1324 const struct ieee80211_reg_rule **reg_rule);
1325
1326/*
1327 * Temporary wext handlers & helper functions
1328 *
1329 * In the future cfg80211 will simply assign the entire wext handler
1330 * structure to netdevs it manages, but we're not there yet.
1331 */
824int cfg80211_wext_giwname(struct net_device *dev, 1332int cfg80211_wext_giwname(struct net_device *dev,
825 struct iw_request_info *info, 1333 struct iw_request_info *info,
826 char *name, char *extra); 1334 char *name, char *extra);
@@ -834,9 +1342,66 @@ int cfg80211_wext_siwscan(struct net_device *dev,
834int cfg80211_wext_giwscan(struct net_device *dev, 1342int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info, 1343 struct iw_request_info *info,
836 struct iw_point *data, char *extra); 1344 struct iw_point *data, char *extra);
1345int cfg80211_wext_siwmlme(struct net_device *dev,
1346 struct iw_request_info *info,
1347 struct iw_point *data, char *extra);
837int cfg80211_wext_giwrange(struct net_device *dev, 1348int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info, 1349 struct iw_request_info *info,
839 struct iw_point *data, char *extra); 1350 struct iw_point *data, char *extra);
1351int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
1352 struct iw_request_info *info,
1353 struct iw_freq *freq, char *extra);
1354int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
1355 struct iw_request_info *info,
1356 struct iw_freq *freq, char *extra);
1357int cfg80211_ibss_wext_siwessid(struct net_device *dev,
1358 struct iw_request_info *info,
1359 struct iw_point *data, char *ssid);
1360int cfg80211_ibss_wext_giwessid(struct net_device *dev,
1361 struct iw_request_info *info,
1362 struct iw_point *data, char *ssid);
1363int cfg80211_ibss_wext_siwap(struct net_device *dev,
1364 struct iw_request_info *info,
1365 struct sockaddr *ap_addr, char *extra);
1366int cfg80211_ibss_wext_giwap(struct net_device *dev,
1367 struct iw_request_info *info,
1368 struct sockaddr *ap_addr, char *extra);
1369
1370struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
1371 struct iw_freq *freq);
1372
1373int cfg80211_wext_siwrts(struct net_device *dev,
1374 struct iw_request_info *info,
1375 struct iw_param *rts, char *extra);
1376int cfg80211_wext_giwrts(struct net_device *dev,
1377 struct iw_request_info *info,
1378 struct iw_param *rts, char *extra);
1379int cfg80211_wext_siwfrag(struct net_device *dev,
1380 struct iw_request_info *info,
1381 struct iw_param *frag, char *extra);
1382int cfg80211_wext_giwfrag(struct net_device *dev,
1383 struct iw_request_info *info,
1384 struct iw_param *frag, char *extra);
1385int cfg80211_wext_siwretry(struct net_device *dev,
1386 struct iw_request_info *info,
1387 struct iw_param *retry, char *extra);
1388int cfg80211_wext_giwretry(struct net_device *dev,
1389 struct iw_request_info *info,
1390 struct iw_param *retry, char *extra);
1391int cfg80211_wext_siwencodeext(struct net_device *dev,
1392 struct iw_request_info *info,
1393 struct iw_point *erq, char *extra);
1394int cfg80211_wext_siwencode(struct net_device *dev,
1395 struct iw_request_info *info,
1396 struct iw_point *erq, char *keybuf);
1397int cfg80211_wext_giwencode(struct net_device *dev,
1398 struct iw_request_info *info,
1399 struct iw_point *erq, char *keybuf);
1400
1401/*
1402 * callbacks for asynchronous cfg80211 methods, notification
1403 * functions and BSS handling helpers
1404 */
840 1405
841/** 1406/**
842 * cfg80211_scan_done - notify that scan finished 1407 * cfg80211_scan_done - notify that scan finished
@@ -864,6 +1429,14 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
864 struct ieee80211_mgmt *mgmt, size_t len, 1429 struct ieee80211_mgmt *mgmt, size_t len,
865 s32 signal, gfp_t gfp); 1430 s32 signal, gfp_t gfp);
866 1431
1432struct cfg80211_bss*
1433cfg80211_inform_bss(struct wiphy *wiphy,
1434 struct ieee80211_channel *channel,
1435 const u8 *bssid,
1436 u64 timestamp, u16 capability, u16 beacon_interval,
1437 const u8 *ie, size_t ielen,
1438 s32 signal, gfp_t gfp);
1439
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 1440struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel, 1441 struct ieee80211_channel *channel,
869 const u8 *bssid, 1442 const u8 *bssid,
@@ -883,6 +1456,7 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
883 const u8 *meshid, size_t meshidlen, 1456 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg); 1457 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss); 1458void cfg80211_put_bss(struct cfg80211_bss *bss);
1459
886/** 1460/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures 1461 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy 1462 * @wiphy: the wiphy
@@ -902,44 +1476,62 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
902 * @len: length of the frame data 1476 * @len: length of the frame data
903 * 1477 *
904 * This function is called whenever an authentication has been processed in 1478 * This function is called whenever an authentication has been processed in
905 * station mode. 1479 * station mode. The driver is required to call either this function or
1480 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1481 * call.
906 */ 1482 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1483void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908 1484
909/** 1485/**
1486 * cfg80211_send_auth_timeout - notification of timed out authentication
1487 * @dev: network device
1488 * @addr: The MAC address of the device with which the authentication timed out
1489 */
1490void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1491
1492/**
910 * cfg80211_send_rx_assoc - notification of processed association 1493 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device 1494 * @dev: network device
912 * @buf: (re)association response frame (header + body) 1495 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data 1496 * @len: length of the frame data
914 * 1497 *
915 * This function is called whenever a (re)association response has been 1498 * This function is called whenever a (re)association response has been
916 * processed in station mode. 1499 * processed in station mode. The driver is required to call either this
1500 * function or cfg80211_send_assoc_timeout() to indicate the result of
1501 * cfg80211_ops::assoc() call.
917 */ 1502 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1503void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919 1504
920/** 1505/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication 1506 * cfg80211_send_assoc_timeout - notification of timed out association
1507 * @dev: network device
1508 * @addr: The MAC address of the device with which the association timed out
1509 */
1510void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1511
1512/**
1513 * cfg80211_send_deauth - notification of processed deauthentication
922 * @dev: network device 1514 * @dev: network device
923 * @buf: deauthentication frame (header + body) 1515 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data 1516 * @len: length of the frame data
925 * 1517 *
926 * This function is called whenever deauthentication has been processed in 1518 * This function is called whenever deauthentication has been processed in
927 * station mode. 1519 * station mode. This includes both received deauthentication frames and
1520 * locally generated ones.
928 */ 1521 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf, 1522void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
930 size_t len);
931 1523
932/** 1524/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation 1525 * cfg80211_send_disassoc - notification of processed disassociation
934 * @dev: network device 1526 * @dev: network device
935 * @buf: disassociation response frame (header + body) 1527 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data 1528 * @len: length of the frame data
937 * 1529 *
938 * This function is called whenever disassociation has been processed in 1530 * This function is called whenever disassociation has been processed in
939 * station mode. 1531 * station mode. This includes both received disassociation frames and locally
1532 * generated ones.
940 */ 1533 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf, 1534void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
942 size_t len);
943 1535
944/** 1536/**
945 * cfg80211_hold_bss - exclude bss from expiration 1537 * cfg80211_hold_bss - exclude bss from expiration
@@ -958,4 +1550,36 @@ void cfg80211_hold_bss(struct cfg80211_bss *bss);
958 */ 1550 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1551void cfg80211_unhold_bss(struct cfg80211_bss *bss);
960 1552
1553/**
1554 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
1555 * @dev: network device
1556 * @addr: The source MAC address of the frame
1557 * @key_type: The key type that the received frame used
1558 * @key_id: Key identifier (0..3)
1559 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1560 *
1561 * This function is called whenever the local MAC detects a MIC failure in a
1562 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
1563 * primitive.
1564 */
1565void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1566 enum nl80211_key_type key_type, int key_id,
1567 const u8 *tsc);
1568
1569/**
1570 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
1571 *
1572 * @dev: network device
1573 * @bssid: the BSSID of the IBSS joined
1574 * @gfp: allocation flags
1575 *
1576 * This function notifies cfg80211 that the device joined an IBSS or
1577 * switched to a different BSSID. Before this function can be called,
1578 * either a beacon has to have been received from the IBSS, or one of
1579 * the cfg80211_inform_bss{,_frame} functions must have been called
1580 * with the locally generated beacon -- this guarantees that there is
1581 * always a scan result for this IBSS. cfg80211 will handle the rest.
1582 */
1583void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
1584
961#endif /* __NET_CFG80211_H */ 1585#endif /* __NET_CFG80211_H */
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c2bb5cae6515..b9b63395d002 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -48,7 +48,6 @@ struct fib_rules_ops
48 struct flowi *, int); 48 struct flowi *, int);
49 int (*configure)(struct fib_rule *, 49 int (*configure)(struct fib_rule *,
50 struct sk_buff *, 50 struct sk_buff *,
51 struct nlmsghdr *,
52 struct fib_rule_hdr *, 51 struct fib_rule_hdr *,
53 struct nlattr **); 52 struct nlattr **);
54 int (*compare)(struct fib_rule *, 53 int (*compare)(struct fib_rule *,
diff --git a/include/net/ip.h b/include/net/ip.h
index 4ac7577f98d0..72c36926c26d 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -168,7 +168,10 @@ struct ipv4_config
168extern struct ipv4_config ipv4_config; 168extern struct ipv4_config ipv4_config;
169#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) 169#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field)
170#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) 170#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field)
171#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val)
171#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) 172#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val)
173#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val)
174#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val)
172#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 175#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
173#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 176#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
174#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 177#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 8b12667f7a2b..ef91fe924ba4 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -124,14 +124,12 @@ struct fib_result_nl {
124#ifdef CONFIG_IP_ROUTE_MULTIPATH 124#ifdef CONFIG_IP_ROUTE_MULTIPATH
125 125
126#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) 126#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel])
127#define FIB_RES_RESET(res) ((res).nh_sel = 0)
128 127
129#define FIB_TABLE_HASHSZ 2 128#define FIB_TABLE_HASHSZ 2
130 129
131#else /* CONFIG_IP_ROUTE_MULTIPATH */ 130#else /* CONFIG_IP_ROUTE_MULTIPATH */
132 131
133#define FIB_RES_NH(res) ((res).fi->fib_nh[0]) 132#define FIB_RES_NH(res) ((res).fi->fib_nh[0])
134#define FIB_RES_RESET(res)
135 133
136#define FIB_TABLE_HASHSZ 256 134#define FIB_TABLE_HASHSZ 256
137 135
@@ -145,7 +143,6 @@ struct fib_result_nl {
145struct fib_table { 143struct fib_table {
146 struct hlist_node tb_hlist; 144 struct hlist_node tb_hlist;
147 u32 tb_id; 145 u32 tb_id;
148 unsigned tb_stamp;
149 int tb_default; 146 int tb_default;
150 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); 147 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
151 int (*tb_insert)(struct fib_table *, struct fib_config *); 148 int (*tb_insert)(struct fib_table *, struct fib_config *);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index c1f16fc49ade..f27fd83d67d8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -126,15 +126,28 @@ extern struct ctl_path net_ipv6_ctl_path[];
126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ 126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\
127}) 127})
128 128
129#define _DEVUPD(net, statname, modifier, idev, field, val) \
130({ \
131 struct inet6_dev *_idev = (idev); \
132 if (likely(_idev != NULL)) \
133 SNMP_UPD_PO_STATS##modifier((_idev)->stats.statname, field, (val)); \
134 SNMP_UPD_PO_STATS##modifier((net)->mib.statname##_statistics, field, (val));\
135})
136
129/* MIBs */ 137/* MIBs */
130 138
131#define IP6_INC_STATS(net, idev,field) \ 139#define IP6_INC_STATS(net, idev,field) \
132 _DEVINC(net, ipv6, , idev, field) 140 _DEVINC(net, ipv6, , idev, field)
133#define IP6_INC_STATS_BH(net, idev,field) \ 141#define IP6_INC_STATS_BH(net, idev,field) \
134 _DEVINC(net, ipv6, _BH, idev, field) 142 _DEVINC(net, ipv6, _BH, idev, field)
143#define IP6_ADD_STATS(net, idev,field,val) \
144 _DEVADD(net, ipv6, , idev, field, val)
135#define IP6_ADD_STATS_BH(net, idev,field,val) \ 145#define IP6_ADD_STATS_BH(net, idev,field,val) \
136 _DEVADD(net, ipv6, _BH, idev, field, val) 146 _DEVADD(net, ipv6, _BH, idev, field, val)
137 147#define IP6_UPD_PO_STATS(net, idev,field,val) \
148 _DEVUPD(net, ipv6, , idev, field, val)
149#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
150 _DEVUPD(net, ipv6, _BH, idev, field, val)
138#define ICMP6_INC_STATS(net, idev, field) \ 151#define ICMP6_INC_STATS(net, idev, field) \
139 _DEVINC(net, icmpv6, , idev, field) 152 _DEVINC(net, icmpv6, , idev, field)
140#define ICMP6_INC_STATS_BH(net, idev, field) \ 153#define ICMP6_INC_STATS_BH(net, idev, field) \
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 85f80eadfa35..21ee49ffcbaf 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -73,8 +73,17 @@ struct iucv_sock {
73 struct sk_buff_head backlog_skb_q; 73 struct sk_buff_head backlog_skb_q;
74 struct sock_msg_q message_q; 74 struct sock_msg_q message_q;
75 unsigned int send_tag; 75 unsigned int send_tag;
76 u8 flags;
77 u16 msglimit;
76}; 78};
77 79
80/* iucv socket options (SOL_IUCV) */
81#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
82#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
83
84/* iucv related control messages (scm) */
85#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
86
78struct iucv_sock_list { 87struct iucv_sock_list {
79 struct hlist_head head; 88 struct hlist_head head;
80 rwlock_t lock; 89 rwlock_t lock;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3b83a80e3fe0..d10ed1776fcd 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -19,7 +19,6 @@
19#include <linux/wireless.h> 19#include <linux/wireless.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/ieee80211.h> 21#include <linux/ieee80211.h>
22#include <net/wireless.h>
23#include <net/cfg80211.h> 22#include <net/cfg80211.h>
24 23
25/** 24/**
@@ -74,22 +73,6 @@
74 */ 73 */
75 74
76/** 75/**
77 * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
78 *
79 * This structure describes most essential parameters needed
80 * to describe 802.11n HT characteristics in a BSS.
81 *
82 * @primary_channel: channel number of primery channel
83 * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width)
84 * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection)
85 */
86struct ieee80211_ht_bss_info {
87 u8 primary_channel;
88 u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */
89 u8 bss_op_mode; /* use IEEE80211_HT_IE_ */
90};
91
92/**
93 * enum ieee80211_max_queues - maximum number of queues 76 * enum ieee80211_max_queues - maximum number of queues
94 * 77 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -150,6 +133,13 @@ struct ieee80211_low_level_stats {
150 * @BSS_CHANGED_ERP_SLOT: slot timing changed 133 * @BSS_CHANGED_ERP_SLOT: slot timing changed
151 * @BSS_CHANGED_HT: 802.11n parameters changed 134 * @BSS_CHANGED_HT: 802.11n parameters changed
152 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed 135 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
136 * @BSS_CHANGED_BEACON_INT: Beacon interval changed
137 * @BSS_CHANGED_BSSID: BSSID changed, for whatever
138 * reason (IBSS and managed mode)
139 * @BSS_CHANGED_BEACON: Beacon data changed, retrieve
140 * new beacon (beaconing modes)
141 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
142 * enabled/disabled (beaconing modes)
153 */ 143 */
154enum ieee80211_bss_change { 144enum ieee80211_bss_change {
155 BSS_CHANGED_ASSOC = 1<<0, 145 BSS_CHANGED_ASSOC = 1<<0,
@@ -158,14 +148,10 @@ enum ieee80211_bss_change {
158 BSS_CHANGED_ERP_SLOT = 1<<3, 148 BSS_CHANGED_ERP_SLOT = 1<<3,
159 BSS_CHANGED_HT = 1<<4, 149 BSS_CHANGED_HT = 1<<4,
160 BSS_CHANGED_BASIC_RATES = 1<<5, 150 BSS_CHANGED_BASIC_RATES = 1<<5,
161}; 151 BSS_CHANGED_BEACON_INT = 1<<6,
162 152 BSS_CHANGED_BSSID = 1<<7,
163/** 153 BSS_CHANGED_BEACON = 1<<8,
164 * struct ieee80211_bss_ht_conf - BSS's changing HT configuration 154 BSS_CHANGED_BEACON_ENABLED = 1<<9,
165 * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info)
166 */
167struct ieee80211_bss_ht_conf {
168 u16 operation_mode;
169}; 155};
170 156
171/** 157/**
@@ -191,8 +177,13 @@ struct ieee80211_bss_ht_conf {
191 * @basic_rates: bitmap of basic rates, each bit stands for an 177 * @basic_rates: bitmap of basic rates, each bit stands for an
192 * index into the rate table configured by the driver in 178 * index into the rate table configured by the driver in
193 * the current band. 179 * the current band.
180 * @bssid: The BSSID for this BSS
181 * @enable_beacon: whether beaconing should be enabled or not
182 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
183 * This field is only valid when the channel type is one of the HT types.
194 */ 184 */
195struct ieee80211_bss_conf { 185struct ieee80211_bss_conf {
186 const u8 *bssid;
196 /* association related data */ 187 /* association related data */
197 bool assoc; 188 bool assoc;
198 u16 aid; 189 u16 aid;
@@ -200,12 +191,13 @@ struct ieee80211_bss_conf {
200 bool use_cts_prot; 191 bool use_cts_prot;
201 bool use_short_preamble; 192 bool use_short_preamble;
202 bool use_short_slot; 193 bool use_short_slot;
194 bool enable_beacon;
203 u8 dtim_period; 195 u8 dtim_period;
204 u16 beacon_int; 196 u16 beacon_int;
205 u16 assoc_capability; 197 u16 assoc_capability;
206 u64 timestamp; 198 u64 timestamp;
207 u32 basic_rates; 199 u32 basic_rates;
208 struct ieee80211_bss_ht_conf ht; 200 u16 ht_operation_mode;
209}; 201};
210 202
211/** 203/**
@@ -518,11 +510,17 @@ struct ieee80211_rx_status {
518 * Flags to define PHY configuration options 510 * Flags to define PHY configuration options
519 * 511 *
520 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 512 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
521 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 513 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
514 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
515 * the driver should be prepared to handle configuration requests but
516 * may turn the device off as much as possible. Typically, this flag will
517 * be set when an interface is set UP but not associated or scanning, but
518 * it can also be unset in that case when monitor interfaces are active.
522 */ 519 */
523enum ieee80211_conf_flags { 520enum ieee80211_conf_flags {
524 IEEE80211_CONF_RADIOTAP = (1<<0), 521 IEEE80211_CONF_RADIOTAP = (1<<0),
525 IEEE80211_CONF_PS = (1<<1), 522 IEEE80211_CONF_PS = (1<<1),
523 IEEE80211_CONF_IDLE = (1<<2),
526}; 524};
527 525
528 526
@@ -530,40 +528,60 @@ enum ieee80211_conf_flags {
530 * enum ieee80211_conf_changed - denotes which configuration changed 528 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 529 *
532 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed 530 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed
533 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed 531 * @_IEEE80211_CONF_CHANGE_BEACON_INTERVAL: DEPRECATED
534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 532 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 533 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 534 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 535 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 536 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 537 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
538 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
541 */ 539 */
542enum ieee80211_conf_changed { 540enum ieee80211_conf_changed {
543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 541 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
544 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1), 542 _IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
547 IEEE80211_CONF_CHANGE_PS = BIT(4), 545 IEEE80211_CONF_CHANGE_PS = BIT(4),
548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5), 546 IEEE80211_CONF_CHANGE_POWER = BIT(5),
549 IEEE80211_CONF_CHANGE_POWER = BIT(6), 547 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7), 548 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8), 549 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
552}; 550};
553 551
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_BEACON_INTERVAL(void)
554{
555 return _IEEE80211_CONF_CHANGE_BEACON_INTERVAL;
556}
557#define IEEE80211_CONF_CHANGE_BEACON_INTERVAL \
558 __IEEE80211_CONF_CHANGE_BEACON_INTERVAL()
559
554/** 560/**
555 * struct ieee80211_conf - configuration of the device 561 * struct ieee80211_conf - configuration of the device
556 * 562 *
557 * This struct indicates how the driver shall configure the hardware. 563 * This struct indicates how the driver shall configure the hardware.
558 * 564 *
565 * @flags: configuration flags defined above
566 *
559 * @radio_enabled: when zero, driver is required to switch off the radio. 567 * @radio_enabled: when zero, driver is required to switch off the radio.
560 * @beacon_int: beacon interval (TODO make interface config) 568 * @beacon_int: beacon interval (TODO make interface config)
569 *
561 * @listen_interval: listen interval in units of beacon interval 570 * @listen_interval: listen interval in units of beacon interval
562 * @flags: configuration flags defined above 571 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this
573 * value will be only achievable between DTIM frames, the hardware
574 * needs to check for the multicast traffic bit in DTIM beacons.
575 * This variable is valid only when the CONF_PS flag is set.
576 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
577 * powersave documentation below. This variable is valid only when
578 * the CONF_PS flag is set.
579 *
563 * @power_level: requested transmit power (in dBm) 580 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms) 581 *
565 * @channel: the channel to tune to 582 * @channel: the channel to tune to
566 * @channel_type: the channel (HT) type 583 * @channel_type: the channel (HT) type
584 *
567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 585 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 586 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
569 * but actually means the number of transmissions not the number of retries 587 * but actually means the number of transmissions not the number of retries
@@ -575,6 +593,7 @@ struct ieee80211_conf {
575 int beacon_int; 593 int beacon_int;
576 u32 flags; 594 u32 flags;
577 int power_level, dynamic_ps_timeout; 595 int power_level, dynamic_ps_timeout;
596 int max_sleep_period;
578 597
579 u16 listen_interval; 598 u16 listen_interval;
580 bool radio_enabled; 599 bool radio_enabled;
@@ -640,37 +659,6 @@ struct ieee80211_if_init_conf {
640}; 659};
641 660
642/** 661/**
643 * enum ieee80211_if_conf_change - interface config change flags
644 *
645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
649 */
650enum ieee80211_if_conf_change {
651 IEEE80211_IFCC_BSSID = BIT(0),
652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
654};
655
656/**
657 * struct ieee80211_if_conf - configuration of an interface
658 *
659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
660 * @bssid: BSSID of the network we are associated to/creating.
661 * @enable_beacon: Indicates whether beacons can be sent.
662 * This is valid only for AP/IBSS/MESH modes.
663 *
664 * This structure is passed to the config_interface() callback of
665 * &struct ieee80211_hw.
666 */
667struct ieee80211_if_conf {
668 u32 changed;
669 const u8 *bssid;
670 bool enable_beacon;
671};
672
673/**
674 * enum ieee80211_key_alg - key algorithm 662 * enum ieee80211_key_alg - key algorithm
675 * @ALG_WEP: WEP40 or WEP104 663 * @ALG_WEP: WEP40 or WEP104
676 * @ALG_TKIP: TKIP 664 * @ALG_TKIP: TKIP
@@ -1109,11 +1097,9 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1109 * need software support for parsing the TIM bitmap. This is also supported 1097 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and 1098 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 1099 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will 1100 * required to pass up beacons. The hardware is still required to handle
1113 * wake up the hardware when multicast traffic is announced in the beacon. 1101 * waking up for multicast traffic; if it cannot the driver must handle that
1114 * 1102 * as best as it can, mac80211 is too slow.
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 * 1103 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which 1104 * Dynamic powersave mode is an extension to normal powersave mode in which
1119 * the hardware stays awake for a user-specified period of time after sending 1105 * the hardware stays awake for a user-specified period of time after sending
@@ -1134,11 +1120,53 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1134 * way the host will only receive beacons where some relevant information 1120 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed. 1121 * (for example ERP protection or WMM settings) have changed.
1136 * 1122 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag. 1123 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER
1138 * The driver needs to enable beacon filter support whenever power save is 1124 * hardware capability. The driver needs to enable beacon filter support
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled, 1125 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1140 * the stack will not check for beacon miss at all and the driver needs to 1126 * power save is enabled, the stack will not check for beacon loss and the
1141 * notify about complete loss of beacons with ieee80211_beacon_loss(). 1127 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
1128 *
1129 * The time (or number of beacons missed) until the firmware notifies the
1130 * driver of a beacon loss event (which in turn causes the driver to call
1131 * ieee80211_beacon_loss()) should be configurable and will be controlled
1132 * by mac80211 and the roaming algorithm in the future.
1133 *
1134 * Since there may be constantly changing information elements that nothing
1135 * in the software stack cares about, we will, in the future, have mac80211
1136 * tell the driver which information elements are interesting in the sense
1137 * that we want to see changes in them. This will include
1138 * - a list of information element IDs
1139 * - a list of OUIs for the vendor information element
1140 *
1141 * Ideally, the hardware would filter out any beacons without changes in the
1142 * requested elements, but if it cannot support that it may, at the expense
1143 * of some efficiency, filter out only a subset. For example, if the device
1144 * doesn't support checking for OUIs it should pass up all changes in all
1145 * vendor information elements.
1146 *
1147 * Note that change, for the sake of simplification, also includes information
1148 * elements appearing or disappearing from the beacon.
1149 *
1150 * Some hardware supports an "ignore list" instead, just make sure nothing
1151 * that was requested is on the ignore list, and include commonly changing
1152 * information element IDs in the ignore list, for example 11 (BSS load) and
1153 * the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
1154 * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
1155 * it could also include some currently unused IDs.
1156 *
1157 *
1158 * In addition to these capabilities, hardware should support notifying the
1159 * host of changes in the beacon RSSI. This is relevant to implement roaming
1160 * when no traffic is flowing (when traffic is flowing we see the RSSI of
1161 * the received data packets). This can consist in notifying the host when
1162 * the RSSI changes significantly or when it drops below or rises above
1163 * configurable thresholds. In the future these thresholds will also be
1164 * configured by mac80211 (which gets them from userspace) to implement
1165 * them as the roaming algorithm requires.
1166 *
1167 * If the hardware cannot implement this, the driver should ask it to
1168 * periodically pass beacon frames to the host so that software can do the
1169 * signal strength threshold checking.
1142 */ 1170 */
1143 1171
1144/** 1172/**
@@ -1298,10 +1326,6 @@ enum ieee80211_ampdu_mlme_action {
1298 * This function should never fail but returns a negative error code 1326 * This function should never fail but returns a negative error code
1299 * if it does. 1327 * if it does.
1300 * 1328 *
1301 * @config_interface: Handler for configuration requests related to interfaces
1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1304 *
1305 * @bss_info_changed: Handler for configuration requests related to BSS 1329 * @bss_info_changed: Handler for configuration requests related to BSS
1306 * parameters that may vary during BSS's lifespan, and may affect low 1330 * parameters that may vary during BSS's lifespan, and may affect low
1307 * level driver (e.g. assoc/disassoc status, erp parameters). 1331 * level driver (e.g. assoc/disassoc status, erp parameters).
@@ -1330,11 +1354,14 @@ enum ieee80211_ampdu_mlme_action {
1330 * the scan state machine in stack. The scan must honour the channel 1354 * the scan state machine in stack. The scan must honour the channel
1331 * configuration done by the regulatory agent in the wiphy's 1355 * configuration done by the regulatory agent in the wiphy's
1332 * registered bands. The hardware (or the driver) needs to make sure 1356 * registered bands. The hardware (or the driver) needs to make sure
1333 * that power save is disabled. When the scan finishes, 1357 * that power save is disabled.
1334 * ieee80211_scan_completed() must be called; note that it also must 1358 * The @req ie/ie_len members are rewritten by mac80211 to contain the
1335 * be called when the scan cannot finish because the hardware is 1359 * entire IEs after the SSID, so that drivers need not look at these
1336 * turned off! Anything else is a bug! Returns a negative error code 1360 * at all but just send them after the SSID -- mac80211 includes the
1337 * which will be seen in userspace. 1361 * (extended) supported rates and HT information (where applicable).
1362 * When the scan finishes, ieee80211_scan_completed() must be called;
1363 * note that it also must be called when the scan cannot finish due to
1364 * any error unless this callback returned a negative error code.
1338 * 1365 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan 1366 * @sw_scan_start: Notifier function that is called just before a software scan
1340 * is started. Can be NULL, if the driver doesn't need this notification. 1367 * is started. Can be NULL, if the driver doesn't need this notification.
@@ -1400,9 +1427,6 @@ struct ieee80211_ops {
1400 void (*remove_interface)(struct ieee80211_hw *hw, 1427 void (*remove_interface)(struct ieee80211_hw *hw,
1401 struct ieee80211_if_init_conf *conf); 1428 struct ieee80211_if_init_conf *conf);
1402 int (*config)(struct ieee80211_hw *hw, u32 changed); 1429 int (*config)(struct ieee80211_hw *hw, u32 changed);
1403 int (*config_interface)(struct ieee80211_hw *hw,
1404 struct ieee80211_vif *vif,
1405 struct ieee80211_if_conf *conf);
1406 void (*bss_info_changed)(struct ieee80211_hw *hw, 1430 void (*bss_info_changed)(struct ieee80211_hw *hw,
1407 struct ieee80211_vif *vif, 1431 struct ieee80211_vif *vif,
1408 struct ieee80211_bss_conf *info, 1432 struct ieee80211_bss_conf *info,
@@ -1572,6 +1596,20 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw);
1572 */ 1596 */
1573void ieee80211_free_hw(struct ieee80211_hw *hw); 1597void ieee80211_free_hw(struct ieee80211_hw *hw);
1574 1598
1599/**
1600 * ieee80211_restart_hw - restart hardware completely
1601 *
1602 * Call this function when the hardware was restarted for some reason
1603 * (hardware error, ...) and the driver is unable to restore its state
1604 * by itself. mac80211 assumes that at this point the driver/hardware
1605 * is completely uninitialised and stopped, it starts the process by
1606 * calling the ->start() operation. The driver will need to reset all
1607 * internal state that it has prior to calling this function.
1608 *
1609 * @hw: the hardware to restart
1610 */
1611void ieee80211_restart_hw(struct ieee80211_hw *hw);
1612
1575/* trick to avoid symbol clashes with the ieee80211 subsystem */ 1613/* trick to avoid symbol clashes with the ieee80211 subsystem */
1576void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1614void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1577 struct ieee80211_rx_status *status); 1615 struct ieee80211_rx_status *status);
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
new file mode 100644
index 000000000000..47995b81c5d7
--- /dev/null
+++ b/include/net/regulatory.h
@@ -0,0 +1,101 @@
1#ifndef __NET_REGULATORY_H
2#define __NET_REGULATORY_H
3/*
4 * regulatory support structures
5 *
6 * Copyright 2008-2009 Luis R. Rodriguez <lrodriguez@atheros.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13
14/**
15 * enum environment_cap - Environment parsed from country IE
16 * @ENVIRON_ANY: indicates country IE applies to both indoor and
17 * outdoor operation.
18 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
19 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
20 */
21enum environment_cap {
22 ENVIRON_ANY,
23 ENVIRON_INDOOR,
24 ENVIRON_OUTDOOR,
25};
26
27/**
28 * struct regulatory_request - used to keep track of regulatory requests
29 *
30 * @wiphy_idx: this is set if this request's initiator is
31 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
32 * can be used by the wireless core to deal with conflicts
33 * and potentially inform users of which devices specifically
34 * cased the conflicts.
35 * @initiator: indicates who sent this request, could be any of
36 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
37 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
38 * regulatory domain. We have a few special codes:
39 * 00 - World regulatory domain
40 * 99 - built by driver but a specific alpha2 cannot be determined
41 * 98 - result of an intersection between two regulatory domains
42 * @intersect: indicates whether the wireless core should intersect
43 * the requested regulatory domain with the presently set regulatory
44 * domain.
45 * @country_ie_checksum: checksum of the last processed and accepted
46 * country IE
47 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
48 * indoor, or if it doesn't matter
49 * @list: used to insert into the reg_requests_list linked list
50 */
51struct regulatory_request {
52 int wiphy_idx;
53 enum nl80211_reg_initiator initiator;
54 char alpha2[2];
55 bool intersect;
56 u32 country_ie_checksum;
57 enum environment_cap country_ie_env;
58 struct list_head list;
59};
60
61struct ieee80211_freq_range {
62 u32 start_freq_khz;
63 u32 end_freq_khz;
64 u32 max_bandwidth_khz;
65};
66
67struct ieee80211_power_rule {
68 u32 max_antenna_gain;
69 u32 max_eirp;
70};
71
72struct ieee80211_reg_rule {
73 struct ieee80211_freq_range freq_range;
74 struct ieee80211_power_rule power_rule;
75 u32 flags;
76};
77
78struct ieee80211_regdomain {
79 u32 n_reg_rules;
80 char alpha2[2];
81 struct ieee80211_reg_rule reg_rules[];
82};
83
84#define MHZ_TO_KHZ(freq) ((freq) * 1000)
85#define KHZ_TO_MHZ(freq) ((freq) / 1000)
86#define DBI_TO_MBI(gain) ((gain) * 100)
87#define MBI_TO_DBI(gain) ((gain) / 100)
88#define DBM_TO_MBM(gain) ((gain) * 100)
89#define MBM_TO_DBM(gain) ((gain) / 100)
90
91#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
92{ \
93 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
94 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
95 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
96 .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\
97 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
98 .flags = reg_flags, \
99}
100
101#endif
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 57c93628695f..8c842e06bec8 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -153,6 +153,11 @@ struct linux_xfrm_mib {
153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ 153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \
154 put_cpu(); \ 154 put_cpu(); \
155 } while (0) 155 } while (0)
156#define SNMP_ADD_STATS(mib, field, addend) \
157 do { \
158 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \
159 put_cpu(); \
160 } while (0)
156#define SNMP_ADD_STATS_BH(mib, field, addend) \ 161#define SNMP_ADD_STATS_BH(mib, field, addend) \
157 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) 162 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
158#define SNMP_ADD_STATS_USER(mib, field, addend) \ 163#define SNMP_ADD_STATS_USER(mib, field, addend) \
@@ -160,5 +165,17 @@ struct linux_xfrm_mib {
160 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ 165 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \
161 put_cpu(); \ 166 put_cpu(); \
162 } while (0) 167 } while (0)
163 168#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
169 do { \
170 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\
171 ptr->mibs[basefield##PKTS]++; \
172 ptr->mibs[basefield##OCTETS] += addend;\
173 put_cpu(); \
174 } while (0)
175#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
176 do { \
177 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\
178 ptr->mibs[basefield##PKTS]++; \
179 ptr->mibs[basefield##OCTETS] += addend;\
180 } while (0)
164#endif 181#endif
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 646dbe3962ea..19f4150f4d4d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -266,6 +266,19 @@ static inline int tcp_too_many_orphans(struct sock *sk, int num)
266 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); 266 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]);
267} 267}
268 268
269/* syncookies: remember time of last synqueue overflow */
270static inline void tcp_synq_overflow(struct sock *sk)
271{
272 tcp_sk(sk)->rx_opt.ts_recent_stamp = jiffies;
273}
274
275/* syncookies: no recent synqueue overflow on this listening socket? */
276static inline int tcp_synq_no_recent_overflow(const struct sock *sk)
277{
278 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
279 return time_after(jiffies, last_overflow + TCP_TIMEOUT_INIT);
280}
281
269extern struct proto tcp_prot; 282extern struct proto tcp_prot;
270 283
271#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field) 284#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field)
@@ -889,30 +902,32 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
889{ 902{
890 struct tcp_sock *tp = tcp_sk(sk); 903 struct tcp_sock *tp = tcp_sk(sk);
891 904
892 if (!sysctl_tcp_low_latency && tp->ucopy.task) { 905 if (sysctl_tcp_low_latency || !tp->ucopy.task)
893 __skb_queue_tail(&tp->ucopy.prequeue, skb); 906 return 0;
894 tp->ucopy.memory += skb->truesize; 907
895 if (tp->ucopy.memory > sk->sk_rcvbuf) { 908 __skb_queue_tail(&tp->ucopy.prequeue, skb);
896 struct sk_buff *skb1; 909 tp->ucopy.memory += skb->truesize;
897 910 if (tp->ucopy.memory > sk->sk_rcvbuf) {
898 BUG_ON(sock_owned_by_user(sk)); 911 struct sk_buff *skb1;
899 912
900 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { 913 BUG_ON(sock_owned_by_user(sk));
901 sk_backlog_rcv(sk, skb1); 914
902 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); 915 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
903 } 916 sk_backlog_rcv(sk, skb1);
904 917 NET_INC_STATS_BH(sock_net(sk),
905 tp->ucopy.memory = 0; 918 LINUX_MIB_TCPPREQUEUEDROPPED);
906 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
907 wake_up_interruptible(sk->sk_sleep);
908 if (!inet_csk_ack_scheduled(sk))
909 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
910 (3 * tcp_rto_min(sk)) / 4,
911 TCP_RTO_MAX);
912 } 919 }
913 return 1; 920
921 tp->ucopy.memory = 0;
922 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
923 wake_up_interruptible_poll(sk->sk_sleep,
924 POLLIN | POLLRDNORM | POLLRDBAND);
925 if (!inet_csk_ack_scheduled(sk))
926 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
927 (3 * tcp_rto_min(sk)) / 4,
928 TCP_RTO_MAX);
914 } 929 }
915 return 0; 930 return 1;
916} 931}
917 932
918 933
diff --git a/include/net/wireless.h b/include/net/wireless.h
deleted file mode 100644
index 64a76208580c..000000000000
--- a/include/net/wireless.h
+++ /dev/null
@@ -1,472 +0,0 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <linux/ieee80211.h>
14#include <net/cfg80211.h>
15
16/**
17 * enum ieee80211_band - supported frequency bands
18 *
19 * The bands are assigned this way because the supported
20 * bitrates differ in these bands.
21 *
22 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
23 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
24 */
25enum ieee80211_band {
26 IEEE80211_BAND_2GHZ,
27 IEEE80211_BAND_5GHZ,
28
29 /* keep last */
30 IEEE80211_NUM_BANDS
31};
32
33/**
34 * enum ieee80211_channel_flags - channel flags
35 *
36 * Channel flags set by the regulatory control code.
37 *
38 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
39 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
40 * on this channel.
41 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
42 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
43 * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
44 * is not permitted.
45 * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
46 * is not permitted.
47 */
48enum ieee80211_channel_flags {
49 IEEE80211_CHAN_DISABLED = 1<<0,
50 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
51 IEEE80211_CHAN_NO_IBSS = 1<<2,
52 IEEE80211_CHAN_RADAR = 1<<3,
53 IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4,
54 IEEE80211_CHAN_NO_FAT_BELOW = 1<<5,
55};
56
57/**
58 * struct ieee80211_channel - channel definition
59 *
60 * This structure describes a single channel for use
61 * with cfg80211.
62 *
63 * @center_freq: center frequency in MHz
64 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
65 * @hw_value: hardware-specific value for the channel
66 * @flags: channel flags from &enum ieee80211_channel_flags.
67 * @orig_flags: channel flags at registration time, used by regulatory
68 * code to support devices with additional restrictions
69 * @band: band this channel belongs to.
70 * @max_antenna_gain: maximum antenna gain in dBi
71 * @max_power: maximum transmission power (in dBm)
72 * @beacon_found: helper to regulatory code to indicate when a beacon
73 * has been found on this channel. Use regulatory_hint_found_beacon()
74 * to enable this, this is is useful only on 5 GHz band.
75 * @orig_mag: internal use
76 * @orig_mpwr: internal use
77 */
78struct ieee80211_channel {
79 enum ieee80211_band band;
80 u16 center_freq;
81 u8 max_bandwidth;
82 u16 hw_value;
83 u32 flags;
84 int max_antenna_gain;
85 int max_power;
86 bool beacon_found;
87 u32 orig_flags;
88 int orig_mag, orig_mpwr;
89};
90
91/**
92 * enum ieee80211_rate_flags - rate flags
93 *
94 * Hardware/specification flags for rates. These are structured
95 * in a way that allows using the same bitrate structure for
96 * different bands/PHY modes.
97 *
98 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
99 * preamble on this bitrate; only relevant in 2.4GHz band and
100 * with CCK rates.
101 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
102 * when used with 802.11a (on the 5 GHz band); filled by the
103 * core code when registering the wiphy.
104 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
105 * when used with 802.11b (on the 2.4 GHz band); filled by the
106 * core code when registering the wiphy.
107 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
108 * when used with 802.11g (on the 2.4 GHz band); filled by the
109 * core code when registering the wiphy.
110 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
111 */
112enum ieee80211_rate_flags {
113 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
114 IEEE80211_RATE_MANDATORY_A = 1<<1,
115 IEEE80211_RATE_MANDATORY_B = 1<<2,
116 IEEE80211_RATE_MANDATORY_G = 1<<3,
117 IEEE80211_RATE_ERP_G = 1<<4,
118};
119
120/**
121 * struct ieee80211_rate - bitrate definition
122 *
123 * This structure describes a bitrate that an 802.11 PHY can
124 * operate with. The two values @hw_value and @hw_value_short
125 * are only for driver use when pointers to this structure are
126 * passed around.
127 *
128 * @flags: rate-specific flags
129 * @bitrate: bitrate in units of 100 Kbps
130 * @hw_value: driver/hardware value for this rate
131 * @hw_value_short: driver/hardware value for this rate when
132 * short preamble is used
133 */
134struct ieee80211_rate {
135 u32 flags;
136 u16 bitrate;
137 u16 hw_value, hw_value_short;
138};
139
140/**
141 * struct ieee80211_sta_ht_cap - STA's HT capabilities
142 *
143 * This structure describes most essential parameters needed
144 * to describe 802.11n HT capabilities for an STA.
145 *
146 * @ht_supported: is HT supported by the STA
147 * @cap: HT capabilities map as described in 802.11n spec
148 * @ampdu_factor: Maximum A-MPDU length factor
149 * @ampdu_density: Minimum A-MPDU spacing
150 * @mcs: Supported MCS rates
151 */
152struct ieee80211_sta_ht_cap {
153 u16 cap; /* use IEEE80211_HT_CAP_ */
154 bool ht_supported;
155 u8 ampdu_factor;
156 u8 ampdu_density;
157 struct ieee80211_mcs_info mcs;
158};
159
160/**
161 * struct ieee80211_supported_band - frequency band definition
162 *
163 * This structure describes a frequency band a wiphy
164 * is able to operate in.
165 *
166 * @channels: Array of channels the hardware can operate in
167 * in this band.
168 * @band: the band this structure represents
169 * @n_channels: Number of channels in @channels
170 * @bitrates: Array of bitrates the hardware can operate with
171 * in this band. Must be sorted to give a valid "supported
172 * rates" IE, i.e. CCK rates first, then OFDM.
173 * @n_bitrates: Number of bitrates in @bitrates
174 */
175struct ieee80211_supported_band {
176 struct ieee80211_channel *channels;
177 struct ieee80211_rate *bitrates;
178 enum ieee80211_band band;
179 int n_channels;
180 int n_bitrates;
181 struct ieee80211_sta_ht_cap ht_cap;
182};
183
184/**
185 * struct wiphy - wireless hardware description
186 * @idx: the wiphy index assigned to this item
187 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
188 * @custom_regulatory: tells us the driver for this device
189 * has its own custom regulatory domain and cannot identify the
190 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
191 * we will disregard the first regulatory hint (when the
192 * initiator is %REGDOM_SET_BY_CORE).
193 * @strict_regulatory: tells us the driver for this device will ignore
194 * regulatory domain settings until it gets its own regulatory domain
195 * via its regulatory_hint(). After its gets its own regulatory domain
196 * it will only allow further regulatory domain settings to further
197 * enhance compliance. For example if channel 13 and 14 are disabled
198 * by this regulatory domain no user regulatory domain can enable these
199 * channels at a later time. This can be used for devices which do not
200 * have calibration information gauranteed for frequencies or settings
201 * outside of its regulatory domain.
202 * @reg_notifier: the driver's regulatory notification callback
203 * @regd: the driver's regulatory domain, if one was requested via
204 * the regulatory_hint() API. This can be used by the driver
205 * on the reg_notifier() if it chooses to ignore future
206 * regulatory domain changes caused by other drivers.
207 * @signal_type: signal type reported in &struct cfg80211_bss.
208 */
209struct wiphy {
210 /* assign these fields before you register the wiphy */
211
212 /* permanent MAC address */
213 u8 perm_addr[ETH_ALEN];
214
215 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
216 u16 interface_modes;
217
218 bool custom_regulatory;
219 bool strict_regulatory;
220
221 enum cfg80211_signal_type signal_type;
222
223 int bss_priv_size;
224 u8 max_scan_ssids;
225
226 /* If multiple wiphys are registered and you're handed e.g.
227 * a regular netdev with assigned ieee80211_ptr, you won't
228 * know whether it points to a wiphy your driver has registered
229 * or not. Assign this to something global to your driver to
230 * help determine whether you own this wiphy or not. */
231 void *privid;
232
233 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
234
235 /* Lets us get back the wiphy on the callback */
236 int (*reg_notifier)(struct wiphy *wiphy,
237 struct regulatory_request *request);
238
239 /* fields below are read-only, assigned by cfg80211 */
240
241 const struct ieee80211_regdomain *regd;
242
243 /* the item in /sys/class/ieee80211/ points to this,
244 * you need use set_wiphy_dev() (see below) */
245 struct device dev;
246
247 /* dir in debugfs: ieee80211/<wiphyname> */
248 struct dentry *debugfsdir;
249
250 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
251};
252
253/** struct wireless_dev - wireless per-netdev state
254 *
255 * This structure must be allocated by the driver/stack
256 * that uses the ieee80211_ptr field in struct net_device
257 * (this is intentional so it can be allocated along with
258 * the netdev.)
259 *
260 * @wiphy: pointer to hardware description
261 * @iftype: interface type
262 */
263struct wireless_dev {
264 struct wiphy *wiphy;
265 enum nl80211_iftype iftype;
266
267 /* private to the generic wireless code */
268 struct list_head list;
269 struct net_device *netdev;
270};
271
272/**
273 * wiphy_priv - return priv from wiphy
274 */
275static inline void *wiphy_priv(struct wiphy *wiphy)
276{
277 BUG_ON(!wiphy);
278 return &wiphy->priv;
279}
280
281/**
282 * set_wiphy_dev - set device pointer for wiphy
283 */
284static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
285{
286 wiphy->dev.parent = dev;
287}
288
289/**
290 * wiphy_dev - get wiphy dev pointer
291 */
292static inline struct device *wiphy_dev(struct wiphy *wiphy)
293{
294 return wiphy->dev.parent;
295}
296
297/**
298 * wiphy_name - get wiphy name
299 */
300static inline const char *wiphy_name(struct wiphy *wiphy)
301{
302 return dev_name(&wiphy->dev);
303}
304
305/**
306 * wdev_priv - return wiphy priv from wireless_dev
307 */
308static inline void *wdev_priv(struct wireless_dev *wdev)
309{
310 BUG_ON(!wdev);
311 return wiphy_priv(wdev->wiphy);
312}
313
314/**
315 * wiphy_new - create a new wiphy for use with cfg80211
316 *
317 * create a new wiphy and associate the given operations with it.
318 * @sizeof_priv bytes are allocated for private use.
319 *
320 * the returned pointer must be assigned to each netdev's
321 * ieee80211_ptr for proper operation.
322 */
323struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
324
325/**
326 * wiphy_register - register a wiphy with cfg80211
327 *
328 * register the given wiphy
329 *
330 * Returns a non-negative wiphy index or a negative error code.
331 */
332extern int wiphy_register(struct wiphy *wiphy);
333
334/**
335 * wiphy_unregister - deregister a wiphy from cfg80211
336 *
337 * unregister a device with the given priv pointer.
338 * After this call, no more requests can be made with this priv
339 * pointer, but the call may sleep to wait for an outstanding
340 * request that is being handled.
341 */
342extern void wiphy_unregister(struct wiphy *wiphy);
343
344/**
345 * wiphy_free - free wiphy
346 */
347extern void wiphy_free(struct wiphy *wiphy);
348
349/**
350 * ieee80211_channel_to_frequency - convert channel number to frequency
351 */
352extern int ieee80211_channel_to_frequency(int chan);
353
354/**
355 * ieee80211_frequency_to_channel - convert frequency to channel number
356 */
357extern int ieee80211_frequency_to_channel(int freq);
358
359/*
360 * Name indirection necessary because the ieee80211 code also has
361 * a function named "ieee80211_get_channel", so if you include
362 * cfg80211's header file you get cfg80211's version, if you try
363 * to include both header files you'll (rightfully!) get a symbol
364 * clash.
365 */
366extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
367 int freq);
368/**
369 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
370 */
371static inline struct ieee80211_channel *
372ieee80211_get_channel(struct wiphy *wiphy, int freq)
373{
374 return __ieee80211_get_channel(wiphy, freq);
375}
376
377/**
378 * ieee80211_get_response_rate - get basic rate for a given rate
379 *
380 * @sband: the band to look for rates in
381 * @basic_rates: bitmap of basic rates
382 * @bitrate: the bitrate for which to find the basic rate
383 *
384 * This function returns the basic rate corresponding to a given
385 * bitrate, that is the next lower bitrate contained in the basic
386 * rate map, which is, for this function, given as a bitmap of
387 * indices of rates in the band's bitrate table.
388 */
389struct ieee80211_rate *
390ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
391 u32 basic_rates, int bitrate);
392
393/**
394 * regulatory_hint - driver hint to the wireless core a regulatory domain
395 * @wiphy: the wireless device giving the hint (used only for reporting
396 * conflicts)
397 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
398 * should be in. If @rd is set this should be NULL. Note that if you
399 * set this to NULL you should still set rd->alpha2 to some accepted
400 * alpha2.
401 *
402 * Wireless drivers can use this function to hint to the wireless core
403 * what it believes should be the current regulatory domain by
404 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
405 * domain should be in or by providing a completely build regulatory domain.
406 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
407 * for a regulatory domain structure for the respective country.
408 *
409 * The wiphy must have been registered to cfg80211 prior to this call.
410 * For cfg80211 drivers this means you must first use wiphy_register(),
411 * for mac80211 drivers you must first use ieee80211_register_hw().
412 *
413 * Drivers should check the return value, its possible you can get
414 * an -ENOMEM.
415 */
416extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
417
418/**
419 * regulatory_hint_11d - hints a country IE as a regulatory domain
420 * @wiphy: the wireless device giving the hint (used only for reporting
421 * conflicts)
422 * @country_ie: pointer to the country IE
423 * @country_ie_len: length of the country IE
424 *
425 * We will intersect the rd with the what CRDA tells us should apply
426 * for the alpha2 this country IE belongs to, this prevents APs from
427 * sending us incorrect or outdated information against a country.
428 */
429extern void regulatory_hint_11d(struct wiphy *wiphy,
430 u8 *country_ie,
431 u8 country_ie_len);
432/**
433 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
434 * @wiphy: the wireless device we want to process the regulatory domain on
435 * @regd: the custom regulatory domain to use for this wiphy
436 *
437 * Drivers can sometimes have custom regulatory domains which do not apply
438 * to a specific country. Drivers can use this to apply such custom regulatory
439 * domains. This routine must be called prior to wiphy registration. The
440 * custom regulatory domain will be trusted completely and as such previous
441 * default channel settings will be disregarded. If no rule is found for a
442 * channel on the regulatory domain the channel will be disabled.
443 */
444extern void wiphy_apply_custom_regulatory(
445 struct wiphy *wiphy,
446 const struct ieee80211_regdomain *regd);
447
448/**
449 * freq_reg_info - get regulatory information for the given frequency
450 * @wiphy: the wiphy for which we want to process this rule for
451 * @center_freq: Frequency in KHz for which we want regulatory information for
452 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
453 * you can set this to 0. If this frequency is allowed we then set
454 * this value to the maximum allowed bandwidth.
455 * @reg_rule: the regulatory rule which we have for this frequency
456 *
457 * Use this function to get the regulatory rule for a specific frequency on
458 * a given wireless device. If the device has a specific regulatory domain
459 * it wants to follow we respect that unless a country IE has been received
460 * and processed already.
461 *
462 * Returns 0 if it was able to find a valid regulatory rule which does
463 * apply to the given center_freq otherwise it returns non-zero. It will
464 * also return -ERANGE if we determine the given center_freq does not even have
465 * a regulatory rule for a frequency range in the center_freq's band. See
466 * freq_in_rule_band() for our current definition of a band -- this is purely
467 * subjective and right now its 802.11 specific.
468 */
469extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
470 const struct ieee80211_reg_rule **reg_rule);
471
472#endif /* __NET_WIRELESS_H */
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 666cc131732e..b2410605b740 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -73,6 +73,7 @@ enum fip_state {
73 * @link: current link status for libfc. 73 * @link: current link status for libfc.
74 * @last_link: last link state reported to libfc. 74 * @last_link: last link state reported to libfc.
75 * @map_dest: use the FC_MAP mode for destination MAC addresses. 75 * @map_dest: use the FC_MAP mode for destination MAC addresses.
76 * @spma: supports SPMA server-provided MACs mode
76 * @dest_addr: MAC address of the selected FC forwarder. 77 * @dest_addr: MAC address of the selected FC forwarder.
77 * @ctl_src_addr: the native MAC address of our local port. 78 * @ctl_src_addr: the native MAC address of our local port.
78 * @data_src_addr: the assigned MAC address for the local port after FLOGI. 79 * @data_src_addr: the assigned MAC address for the local port after FLOGI.
@@ -104,6 +105,7 @@ struct fcoe_ctlr {
104 u8 link; 105 u8 link;
105 u8 last_link; 106 u8 last_link;
106 u8 map_dest; 107 u8 map_dest;
108 u8 spma;
107 u8 dest_addr[ETH_ALEN]; 109 u8 dest_addr[ETH_ALEN];
108 u8 ctl_src_addr[ETH_ALEN]; 110 u8 ctl_src_addr[ETH_ALEN];
109 u8 data_src_addr[ETH_ALEN]; 111 u8 data_src_addr[ETH_ALEN];