aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/atm.h17
-rw-r--r--include/linux/atmdev.h15
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/dcbnl.h340
-rw-r--r--include/linux/dccp.h42
-rw-r--r--include/linux/etherdevice.h46
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/fddidevice.h1
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/fsl_devices.h18
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/hippidevice.h4
-rw-r--r--include/linux/ieee80211.h212
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_arp.h3
-rw-r--r--include/linux/in.h4
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/list_nulls.h94
-rw-r--r--include/linux/mdio-gpio.h25
-rw-r--r--include/linux/mii.h33
-rw-r--r--include/linux/mroute6.h26
-rw-r--r--include/linux/netdevice.h400
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h2
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nl80211.h223
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/pkt_cls.h14
-rw-r--r--include/linux/pkt_sched.h16
-rw-r--r--include/linux/rculist_nulls.h110
-rw-r--r--include/linux/rfkill.h8
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/skbuff.h54
-rw-r--r--include/linux/smsc911x.h47
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h8
-rw-r--r--include/linux/virtio_net.h9
-rw-r--r--include/linux/xfrm.h14
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--include/net/cfg80211.h142
-rw-r--r--include/net/checksum.h2
-rw-r--r--include/net/dcbnl.h53
-rw-r--r--include/net/dn.h8
-rw-r--r--include/net/dn_fib.h6
-rw-r--r--include/net/dst.h39
-rw-r--r--include/net/flow.h9
-rw-r--r--include/net/gen_stats.h3
-rw-r--r--include/net/ieee80211.h148
-rw-r--r--include/net/ieee80211_radiotap.h15
-rw-r--r--include/net/inet_hashtables.h85
-rw-r--r--include/net/inet_timewait_sock.h10
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ip_vs.h17
-rw-r--r--include/net/lib80211.h (renamed from include/net/ieee80211_crypt.h)75
-rw-r--r--include/net/mac80211.h446
-rw-r--r--include/net/ndisc.h14
-rw-r--r--include/net/neighbour.h15
-rw-r--r--include/net/net_namespace.h22
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h57
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h5
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h2
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h12
-rw-r--r--include/net/netfilter/nfnetlink_log.h14
-rw-r--r--include/net/netlink.h24
-rw-r--r--include/net/netns/ipv4.h2
-rw-r--r--include/net/netns/ipv6.h12
-rw-r--r--include/net/netns/mib.h3
-rw-r--r--include/net/netns/x_tables.h5
-rw-r--r--include/net/netns/xfrm.h56
-rw-r--r--include/net/phonet/pep.h2
-rw-r--r--include/net/phonet/phonet.h2
-rw-r--r--include/net/phonet/pn_dev.h2
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/sch_generic.h38
-rw-r--r--include/net/sctp/sctp.h9
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/sock.h86
-rw-r--r--include/net/syncppp.h102
-rw-r--r--include/net/tcp.h20
-rw-r--r--include/net/udp.h25
-rw-r--r--include/net/udplite.h2
-rw-r--r--include/net/wireless.h90
-rw-r--r--include/net/xfrm.h110
90 files changed, 2651 insertions, 998 deletions
diff --git a/include/linux/atm.h b/include/linux/atm.h
index c791ddd96939..d3b292174aeb 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -231,10 +231,21 @@ static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
231 */ 231 */
232 232
233struct atmif_sioc { 233struct atmif_sioc {
234 int number; 234 int number;
235 int length; 235 int length;
236 void __user *arg; 236 void __user *arg;
237}; 237};
238 238
239#ifdef __KERNEL__
240#ifdef CONFIG_COMPAT
241#include <linux/compat.h>
242struct compat_atmif_sioc {
243 int number;
244 int length;
245 compat_uptr_t arg;
246};
247#endif
248#endif
249
239typedef unsigned short atm_backend_t; 250typedef unsigned short atm_backend_t;
240#endif 251#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index a3d07c29d16c..086e5c362d3a 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -100,6 +100,10 @@ struct atm_dev_stats {
100 /* use backend to make new if */ 100 /* use backend to make new if */
101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) 101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102 /* add party to p2mp call */ 102 /* add party to p2mp call */
103#ifdef CONFIG_COMPAT
104/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106#endif
103#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) 107#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
104 /* drop party from p2mp call */ 108 /* drop party from p2mp call */
105 109
@@ -224,6 +228,13 @@ struct atm_cirange {
224extern struct proc_dir_entry *atm_proc_root; 228extern struct proc_dir_entry *atm_proc_root;
225#endif 229#endif
226 230
231#ifdef CONFIG_COMPAT
232#include <linux/compat.h>
233struct compat_atm_iobuf {
234 int length;
235 compat_uptr_t buffer;
236};
237#endif
227 238
228struct k_atm_aal_stats { 239struct k_atm_aal_stats {
229#define __HANDLE_ITEM(i) atomic_t i 240#define __HANDLE_ITEM(i) atomic_t i
@@ -379,6 +390,10 @@ struct atmdev_ops { /* only send is required */
379 int (*open)(struct atm_vcc *vcc); 390 int (*open)(struct atm_vcc *vcc);
380 void (*close)(struct atm_vcc *vcc); 391 void (*close)(struct atm_vcc *vcc);
381 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); 392 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
393#ifdef CONFIG_COMPAT
394 int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
395 void __user *arg);
396#endif
382 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
383 void __user *optval,int optlen); 398 void __user *optval,int optlen);
384 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 9c22396e8b50..9c8d31bacf46 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -54,3 +54,9 @@ SUBSYS(freezer)
54#endif 54#endif
55 55
56/* */ 56/* */
57
58#ifdef CONFIG_NET_CLS_CGROUP
59SUBSYS(net_cls)
60#endif
61
62/* */
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
new file mode 100644
index 000000000000..b0ef274e0031
--- /dev/null
+++ b/include/linux/dcbnl.h
@@ -0,0 +1,340 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __LINUX_DCBNL_H__
21#define __LINUX_DCBNL_H__
22
23#define DCB_PROTO_VERSION 1
24
25struct dcbmsg {
26 unsigned char dcb_family;
27 __u8 cmd;
28 __u16 dcb_pad;
29};
30
31/**
32 * enum dcbnl_commands - supported DCB commands
33 *
34 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
35 * @DCB_CMD_GSTATE: request the state of DCB in the device
36 * @DCB_CMD_SSTATE: set the state of DCB in the device
37 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
38 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
39 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
40 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
41 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
42 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
43 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
44 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
45 * device. Only useful when using bonding.
46 * @DCB_CMD_GCAP: request the DCB capabilities of the device
47 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
48 * @DCB_CMD_SNUMTCS: set the number of traffic classes
49 * @DCB_CMD_GBCN: set backward congestion notification configuration
50 * @DCB_CMD_SBCN: get backward congestion notification configration.
51 */
52enum dcbnl_commands {
53 DCB_CMD_UNDEFINED,
54
55 DCB_CMD_GSTATE,
56 DCB_CMD_SSTATE,
57
58 DCB_CMD_PGTX_GCFG,
59 DCB_CMD_PGTX_SCFG,
60 DCB_CMD_PGRX_GCFG,
61 DCB_CMD_PGRX_SCFG,
62
63 DCB_CMD_PFC_GCFG,
64 DCB_CMD_PFC_SCFG,
65
66 DCB_CMD_SET_ALL,
67
68 DCB_CMD_GPERM_HWADDR,
69
70 DCB_CMD_GCAP,
71
72 DCB_CMD_GNUMTCS,
73 DCB_CMD_SNUMTCS,
74
75 DCB_CMD_PFC_GSTATE,
76 DCB_CMD_PFC_SSTATE,
77
78 DCB_CMD_BCN_GCFG,
79 DCB_CMD_BCN_SCFG,
80
81 __DCB_CMD_ENUM_MAX,
82 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
83};
84
85/**
86 * enum dcbnl_attrs - DCB top-level netlink attributes
87 *
88 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
89 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
90 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
91 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
92 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
93 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
94 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
95 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
96 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
97 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
98 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
99 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
100 */
101enum dcbnl_attrs {
102 DCB_ATTR_UNDEFINED,
103
104 DCB_ATTR_IFNAME,
105 DCB_ATTR_STATE,
106 DCB_ATTR_PFC_STATE,
107 DCB_ATTR_PFC_CFG,
108 DCB_ATTR_NUM_TC,
109 DCB_ATTR_PG_CFG,
110 DCB_ATTR_SET_ALL,
111 DCB_ATTR_PERM_HWADDR,
112 DCB_ATTR_CAP,
113 DCB_ATTR_NUMTCS,
114 DCB_ATTR_BCN,
115
116 __DCB_ATTR_ENUM_MAX,
117 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
118};
119
120/**
121 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
122 *
123 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
124 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
125 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
126 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
127 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
128 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
129 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
130 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
131 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
132 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
133 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
134 *
135 */
136enum dcbnl_pfc_up_attrs {
137 DCB_PFC_UP_ATTR_UNDEFINED,
138
139 DCB_PFC_UP_ATTR_0,
140 DCB_PFC_UP_ATTR_1,
141 DCB_PFC_UP_ATTR_2,
142 DCB_PFC_UP_ATTR_3,
143 DCB_PFC_UP_ATTR_4,
144 DCB_PFC_UP_ATTR_5,
145 DCB_PFC_UP_ATTR_6,
146 DCB_PFC_UP_ATTR_7,
147 DCB_PFC_UP_ATTR_ALL,
148
149 __DCB_PFC_UP_ATTR_ENUM_MAX,
150 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
151};
152
153/**
154 * enum dcbnl_pg_attrs - DCB Priority Group attributes
155 *
156 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
157 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
158 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
159 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
160 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
161 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
162 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
163 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
164 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
165 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
166 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
167 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
168 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
169 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
170 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
171 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
172 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
173 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
174 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
175 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
176 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
177 *
178 */
179enum dcbnl_pg_attrs {
180 DCB_PG_ATTR_UNDEFINED,
181
182 DCB_PG_ATTR_TC_0,
183 DCB_PG_ATTR_TC_1,
184 DCB_PG_ATTR_TC_2,
185 DCB_PG_ATTR_TC_3,
186 DCB_PG_ATTR_TC_4,
187 DCB_PG_ATTR_TC_5,
188 DCB_PG_ATTR_TC_6,
189 DCB_PG_ATTR_TC_7,
190 DCB_PG_ATTR_TC_MAX,
191 DCB_PG_ATTR_TC_ALL,
192
193 DCB_PG_ATTR_BW_ID_0,
194 DCB_PG_ATTR_BW_ID_1,
195 DCB_PG_ATTR_BW_ID_2,
196 DCB_PG_ATTR_BW_ID_3,
197 DCB_PG_ATTR_BW_ID_4,
198 DCB_PG_ATTR_BW_ID_5,
199 DCB_PG_ATTR_BW_ID_6,
200 DCB_PG_ATTR_BW_ID_7,
201 DCB_PG_ATTR_BW_ID_MAX,
202 DCB_PG_ATTR_BW_ID_ALL,
203
204 __DCB_PG_ATTR_ENUM_MAX,
205 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
206};
207
208/**
209 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
210 *
211 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
212 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
213 * Valid values are: 0-7
214 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
215 * Some devices may not support changing the
216 * user priority map of a TC.
217 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
218 * 0 - none
219 * 1 - group strict
220 * 2 - link strict
221 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
222 * not configured to use link strict priority,
223 * this is the percentage of bandwidth of the
224 * priority group this traffic class belongs to
225 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
226 *
227 */
228enum dcbnl_tc_attrs {
229 DCB_TC_ATTR_PARAM_UNDEFINED,
230
231 DCB_TC_ATTR_PARAM_PGID,
232 DCB_TC_ATTR_PARAM_UP_MAPPING,
233 DCB_TC_ATTR_PARAM_STRICT_PRIO,
234 DCB_TC_ATTR_PARAM_BW_PCT,
235 DCB_TC_ATTR_PARAM_ALL,
236
237 __DCB_TC_ATTR_PARAM_ENUM_MAX,
238 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
239};
240
241/**
242 * enum dcbnl_cap_attrs - DCB Capability attributes
243 *
244 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
245 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
246 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
247 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
248 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
249 * traffic class mapping
250 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
251 * number of traffic classes the device
252 * can be configured to use for Priority Groups
253 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
254 * number of traffic classes the device can be
255 * configured to use for Priority Flow Control
256 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
257 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
258 * Notification
259 */
260enum dcbnl_cap_attrs {
261 DCB_CAP_ATTR_UNDEFINED,
262 DCB_CAP_ATTR_ALL,
263 DCB_CAP_ATTR_PG,
264 DCB_CAP_ATTR_PFC,
265 DCB_CAP_ATTR_UP2TC,
266 DCB_CAP_ATTR_PG_TCS,
267 DCB_CAP_ATTR_PFC_TCS,
268 DCB_CAP_ATTR_GSP,
269 DCB_CAP_ATTR_BCN,
270
271 __DCB_CAP_ATTR_ENUM_MAX,
272 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
273};
274
275/**
276 * enum dcbnl_numtcs_attrs - number of traffic classes
277 *
278 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
279 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
280 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
281 * priority groups
282 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
283 * support priority flow control
284 */
285enum dcbnl_numtcs_attrs {
286 DCB_NUMTCS_ATTR_UNDEFINED,
287 DCB_NUMTCS_ATTR_ALL,
288 DCB_NUMTCS_ATTR_PG,
289 DCB_NUMTCS_ATTR_PFC,
290
291 __DCB_NUMTCS_ATTR_ENUM_MAX,
292 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
293};
294
295enum dcbnl_bcn_attrs{
296 DCB_BCN_ATTR_UNDEFINED = 0,
297
298 DCB_BCN_ATTR_RP_0,
299 DCB_BCN_ATTR_RP_1,
300 DCB_BCN_ATTR_RP_2,
301 DCB_BCN_ATTR_RP_3,
302 DCB_BCN_ATTR_RP_4,
303 DCB_BCN_ATTR_RP_5,
304 DCB_BCN_ATTR_RP_6,
305 DCB_BCN_ATTR_RP_7,
306 DCB_BCN_ATTR_RP_ALL,
307
308 DCB_BCN_ATTR_BCNA_0,
309 DCB_BCN_ATTR_BCNA_1,
310 DCB_BCN_ATTR_ALPHA,
311 DCB_BCN_ATTR_BETA,
312 DCB_BCN_ATTR_GD,
313 DCB_BCN_ATTR_GI,
314 DCB_BCN_ATTR_TMAX,
315 DCB_BCN_ATTR_TD,
316 DCB_BCN_ATTR_RMIN,
317 DCB_BCN_ATTR_W,
318 DCB_BCN_ATTR_RD,
319 DCB_BCN_ATTR_RU,
320 DCB_BCN_ATTR_WRTT,
321 DCB_BCN_ATTR_RI,
322 DCB_BCN_ATTR_C,
323 DCB_BCN_ATTR_ALL,
324
325 __DCB_BCN_ATTR_ENUM_MAX,
326 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
327};
328
329/**
330 * enum dcb_general_attr_values - general DCB attribute values
331 *
332 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
333 *
334 */
335enum dcb_general_attr_values {
336 DCB_ATTR_VALUE_UNDEFINED = 0xff
337};
338
339
340#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 6080449fbec9..61734e27abb7 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -168,6 +168,8 @@ enum {
168 DCCPO_MIN_CCID_SPECIFIC = 128, 168 DCCPO_MIN_CCID_SPECIFIC = 128,
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
172#define DCCP_SINGLE_OPT_MAXLEN 253
171 173
172/* DCCP CCIDS */ 174/* DCCP CCIDS */
173enum { 175enum {
@@ -176,29 +178,23 @@ enum {
176}; 178};
177 179
178/* DCCP features (RFC 4340 section 6.4) */ 180/* DCCP features (RFC 4340 section 6.4) */
179enum { 181enum dccp_feature_numbers {
180 DCCPF_RESERVED = 0, 182 DCCPF_RESERVED = 0,
181 DCCPF_CCID = 1, 183 DCCPF_CCID = 1,
182 DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */ 184 DCCPF_SHORT_SEQNOS = 2,
183 DCCPF_SEQUENCE_WINDOW = 3, 185 DCCPF_SEQUENCE_WINDOW = 3,
184 DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */ 186 DCCPF_ECN_INCAPABLE = 4,
185 DCCPF_ACK_RATIO = 5, 187 DCCPF_ACK_RATIO = 5,
186 DCCPF_SEND_ACK_VECTOR = 6, 188 DCCPF_SEND_ACK_VECTOR = 6,
187 DCCPF_SEND_NDP_COUNT = 7, 189 DCCPF_SEND_NDP_COUNT = 7,
188 DCCPF_MIN_CSUM_COVER = 8, 190 DCCPF_MIN_CSUM_COVER = 8,
189 DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */ 191 DCCPF_DATA_CHECKSUM = 9,
190 /* 10-127 reserved */ 192 /* 10-127 reserved */
191 DCCPF_MIN_CCID_SPECIFIC = 128, 193 DCCPF_MIN_CCID_SPECIFIC = 128,
194 DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
192 DCCPF_MAX_CCID_SPECIFIC = 255, 195 DCCPF_MAX_CCID_SPECIFIC = 255,
193}; 196};
194 197
195/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
196struct dccp_so_feat {
197 __u8 dccpsf_feat;
198 __u8 __user *dccpsf_val;
199 __u8 dccpsf_len;
200};
201
202/* DCCP socket options */ 198/* DCCP socket options */
203#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ 199#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
204#define DCCP_SOCKOPT_SERVICE 2 200#define DCCP_SOCKOPT_SERVICE 2
@@ -208,6 +204,10 @@ struct dccp_so_feat {
208#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 204#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
209#define DCCP_SOCKOPT_SEND_CSCOV 10 205#define DCCP_SOCKOPT_SEND_CSCOV 10
210#define DCCP_SOCKOPT_RECV_CSCOV 11 206#define DCCP_SOCKOPT_RECV_CSCOV 11
207#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
208#define DCCP_SOCKOPT_CCID 13
209#define DCCP_SOCKOPT_TX_CCID 14
210#define DCCP_SOCKOPT_RX_CCID 15
211#define DCCP_SOCKOPT_CCID_RX_INFO 128 211#define DCCP_SOCKOPT_CCID_RX_INFO 128
212#define DCCP_SOCKOPT_CCID_TX_INFO 192 212#define DCCP_SOCKOPT_CCID_TX_INFO 192
213 213
@@ -360,7 +360,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361#define DCCPF_INITIAL_ACK_RATIO 2 361#define DCCPF_INITIAL_ACK_RATIO 2
362#define DCCPF_INITIAL_CCID DCCPC_CCID2 362#define DCCPF_INITIAL_CCID DCCPC_CCID2
363#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
364/* FIXME: for now we're default to 1 but it should really be 0 */ 363/* FIXME: for now we're default to 1 but it should really be 0 */
365#define DCCPF_INITIAL_SEND_NDP_COUNT 1 364#define DCCPF_INITIAL_SEND_NDP_COUNT 1
366 365
@@ -370,20 +369,11 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
370 * Will be used to pass the state from dccp_request_sock to dccp_sock. 369 * Will be used to pass the state from dccp_request_sock to dccp_sock.
371 * 370 *
372 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2) 371 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
373 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
374 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
375 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
376 * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3)
377 * @dccpms_pending - List of features being negotiated 372 * @dccpms_pending - List of features being negotiated
378 * @dccpms_conf - 373 * @dccpms_conf -
379 */ 374 */
380struct dccp_minisock { 375struct dccp_minisock {
381 __u64 dccpms_sequence_window; 376 __u64 dccpms_sequence_window;
382 __u8 dccpms_rx_ccid;
383 __u8 dccpms_tx_ccid;
384 __u8 dccpms_send_ack_vector;
385 __u8 dccpms_send_ndp_count;
386 __u8 dccpms_ack_ratio;
387 struct list_head dccpms_pending; 377 struct list_head dccpms_pending;
388 struct list_head dccpms_conf; 378 struct list_head dccpms_conf;
389}; 379};
@@ -411,6 +401,7 @@ extern void dccp_minisock_init(struct dccp_minisock *dmsk);
411 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) 401 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
412 * @dreq_isr: initial sequence number received on the Request 402 * @dreq_isr: initial sequence number received on the Request
413 * @dreq_service: service code present on the Request (there is just one) 403 * @dreq_service: service code present on the Request (there is just one)
404 * @dreq_featneg: feature negotiation options for this connection
414 * The following two fields are analogous to the ones in dccp_sock: 405 * The following two fields are analogous to the ones in dccp_sock:
415 * @dreq_timestamp_echo: last received timestamp to echo (13.1) 406 * @dreq_timestamp_echo: last received timestamp to echo (13.1)
416 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo 407 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
@@ -420,6 +411,7 @@ struct dccp_request_sock {
420 __u64 dreq_iss; 411 __u64 dreq_iss;
421 __u64 dreq_isr; 412 __u64 dreq_isr;
422 __be32 dreq_service; 413 __be32 dreq_service;
414 struct list_head dreq_featneg;
423 __u32 dreq_timestamp_echo; 415 __u32 dreq_timestamp_echo;
424 __u32 dreq_timestamp_time; 416 __u32 dreq_timestamp_time;
425}; 417};
@@ -493,10 +485,12 @@ struct dccp_ackvec;
493 * @dccps_r_ack_ratio - feature-remote Ack Ratio 485 * @dccps_r_ack_ratio - feature-remote Ack Ratio
494 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 486 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
495 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 487 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
488 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
496 * @dccps_ndp_count - number of Non Data Packets since last data packet 489 * @dccps_ndp_count - number of Non Data Packets since last data packet
497 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 490 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
498 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) 491 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
499 * @dccps_minisock - associated minisock (accessed via dccp_msk) 492 * @dccps_minisock - associated minisock (accessed via dccp_msk)
493 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
500 * @dccps_hc_rx_ackvec - rx half connection ack vector 494 * @dccps_hc_rx_ackvec - rx half connection ack vector
501 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 495 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
502 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) 496 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
@@ -529,11 +523,13 @@ struct dccp_sock {
529 __u32 dccps_timestamp_time; 523 __u32 dccps_timestamp_time;
530 __u16 dccps_l_ack_ratio; 524 __u16 dccps_l_ack_ratio;
531 __u16 dccps_r_ack_ratio; 525 __u16 dccps_r_ack_ratio;
532 __u16 dccps_pcslen; 526 __u8 dccps_pcslen:4;
533 __u16 dccps_pcrlen; 527 __u8 dccps_pcrlen:4;
528 __u8 dccps_send_ndp_count:1;
534 __u64 dccps_ndp_count:48; 529 __u64 dccps_ndp_count:48;
535 unsigned long dccps_rate_last; 530 unsigned long dccps_rate_last;
536 struct dccp_minisock dccps_minisock; 531 struct dccp_minisock dccps_minisock;
532 struct list_head dccps_featneg;
537 struct dccp_ackvec *dccps_hc_rx_ackvec; 533 struct dccp_ackvec *dccps_hc_rx_ackvec;
538 struct ccid *dccps_hc_rx_ccid; 534 struct ccid *dccps_hc_rx_ccid;
539 struct ccid *dccps_hc_tx_ccid; 535 struct ccid *dccps_hc_tx_ccid;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 25d62e6e3290..1cb0f0b90926 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -27,6 +27,7 @@
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/netdevice.h> 28#include <linux/netdevice.h>
29#include <linux/random.h> 29#include <linux/random.h>
30#include <asm/unaligned.h>
30 31
31#ifdef __KERNEL__ 32#ifdef __KERNEL__
32extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
@@ -41,6 +42,10 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh, 42extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev, 43 const struct net_device *dev,
43 const unsigned char *haddr); 44 const unsigned char *haddr);
45extern int eth_mac_addr(struct net_device *dev, void *p);
46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
47extern int eth_validate_addr(struct net_device *dev);
48
44 49
45 50
46extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 51extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
@@ -136,6 +141,47 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
136 BUILD_BUG_ON(ETH_ALEN != 6); 141 BUILD_BUG_ON(ETH_ALEN != 6);
137 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 142 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
138} 143}
144
145static inline unsigned long zap_last_2bytes(unsigned long value)
146{
147#ifdef __BIG_ENDIAN
148 return value >> 16;
149#else
150 return value << 16;
151#endif
152}
153
154/**
155 * compare_ether_addr_64bits - Compare two Ethernet addresses
156 * @addr1: Pointer to an array of 8 bytes
157 * @addr2: Pointer to an other array of 8 bytes
158 *
159 * Compare two ethernet addresses, returns 0 if equal.
160 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional
161 * branches, and possibly long word memory accesses on CPU allowing cheap
162 * unaligned memory reads.
163 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2}
164 *
165 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits.
166 */
167
168static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
169 const u8 addr2[6+2])
170{
171#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
172 unsigned long fold = ((*(unsigned long *)addr1) ^
173 (*(unsigned long *)addr2));
174
175 if (sizeof(fold) == 8)
176 return zap_last_2bytes(fold) != 0;
177
178 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
179 (*(unsigned long *)(addr2 + 4)));
180 return fold != 0;
181#else
182 return compare_ether_addr(addr1, addr2);
183#endif
184}
139#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
140 186
141#endif /* _LINUX_ETHERDEVICE_H */ 187#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b4b038b89ee6..27c67a542235 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -467,6 +467,8 @@ struct ethtool_ops {
467 467
468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
470#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
471#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
470 472
471/* compatibility with older code */ 473/* compatibility with older code */
472#define SPARC_ETH_GSET ETHTOOL_GSET 474#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index e61e42dfd317..155bafd9e886 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -27,6 +27,7 @@
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern __be16 fddi_type_trans(struct sk_buff *skb, 28extern __be16 fddi_type_trans(struct sk_buff *skb,
29 struct net_device *dev); 29 struct net_device *dev);
30extern int fddi_change_mtu(struct net_device *dev, int new_mtu);
30extern struct net_device *alloc_fddidev(int sizeof_priv); 31extern struct net_device *alloc_fddidev(int sizeof_priv);
31#endif 32#endif
32 33
diff --git a/include/linux/filter.h b/include/linux/filter.h
index b6ea9aa9e853..1354aaf6abbe 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -122,7 +122,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
122#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
123#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
124#define SKF_AD_NLATTR 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16 125#define SKF_AD_NLATTR_NEST 16
126#define SKF_AD_MAX 20
126#define SKF_NET_OFF (-0x100000) 127#define SKF_NET_OFF (-0x100000)
127#define SKF_LL_OFF (-0x200000) 128#define SKF_LL_OFF (-0x200000)
128 129
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 708bab58d8d0..d9051d717d27 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -47,12 +47,7 @@
47struct gianfar_platform_data { 47struct gianfar_platform_data {
48 /* device specific information */ 48 /* device specific information */
49 u32 device_flags; 49 u32 device_flags;
50 /* board specific information */ 50 char bus_id[BUS_ID_SIZE];
51 u32 board_flags;
52 int mdio_bus; /* Bus controlled by us */
53 char bus_id[MII_BUS_ID_SIZE]; /* Bus PHY is on */
54 u32 phy_id;
55 u8 mac_addr[6];
56 phy_interface_t interface; 51 phy_interface_t interface;
57}; 52};
58 53
@@ -61,17 +56,6 @@ struct gianfar_mdio_data {
61 int irq[32]; 56 int irq[32];
62}; 57};
63 58
64/* Flags related to gianfar device features */
65#define FSL_GIANFAR_DEV_HAS_GIGABIT 0x00000001
66#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002
67#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004
68#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008
69#define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010
70#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
71#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
72#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
73#define FSL_GIANFAR_DEV_HAS_MAGIC_PACKET 0x00000100
74
75/* Flags in gianfar_platform_data */ 59/* Flags in gianfar_platform_data */
76#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ 60#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
77#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */ 61#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index c59769693bee..fd47a151665e 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,7 +43,7 @@ struct hdlc_proto {
43}; 43};
44 44
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by netdev_priv(dev) */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
49 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
@@ -80,7 +80,7 @@ struct net_device *alloc_hdlcdev(void *priv);
80 80
81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev) 81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
82{ 82{
83 return dev->priv; 83 return netdev_priv(dev);
84} 84}
85 85
86static __inline__ void debug_frame(const struct sk_buff *skb) 86static __inline__ void debug_frame(const struct sk_buff *skb)
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index bab303dafd6e..f148e4908410 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -32,7 +32,9 @@ struct hippi_cb {
32}; 32};
33 33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); 34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
35 35extern int hippi_change_mtu(struct net_device *dev, int new_mtu);
36extern int hippi_mac_addr(struct net_device *dev, void *p);
37extern int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p);
36extern struct net_device *alloc_hippi_dev(int sizeof_priv); 38extern struct net_device *alloc_hippi_dev(int sizeof_priv);
37#endif 39#endif
38 40
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc36641..c4e6ca1a6306 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -12,8 +12,8 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#ifndef IEEE80211_H 15#ifndef LINUX_IEEE80211_H
16#define IEEE80211_H 16#define LINUX_IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
@@ -97,7 +97,10 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100
100#define IEEE80211_MAX_MESH_ID_LEN 32 101#define IEEE80211_MAX_MESH_ID_LEN 32
102#define IEEE80211_MESH_CONFIG_LEN 19
103
101#define IEEE80211_QOS_CTL_LEN 2 104#define IEEE80211_QOS_CTL_LEN 2
102#define IEEE80211_QOS_CTL_TID_MASK 0x000F 105#define IEEE80211_QOS_CTL_TID_MASK 0x000F
103#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 106#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -666,6 +669,13 @@ struct ieee80211_cts {
666 u8 ra[6]; 669 u8 ra[6];
667} __attribute__ ((packed)); 670} __attribute__ ((packed));
668 671
672struct ieee80211_pspoll {
673 __le16 frame_control;
674 __le16 aid;
675 u8 bssid[6];
676 u8 ta[6];
677} __attribute__ ((packed));
678
669/** 679/**
670 * struct ieee80211_bar - HT Block Ack Request 680 * struct ieee80211_bar - HT Block Ack Request
671 * 681 *
@@ -685,28 +695,88 @@ struct ieee80211_bar {
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 695#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 696#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687 697
698
699#define IEEE80211_HT_MCS_MASK_LEN 10
700
701/**
702 * struct ieee80211_mcs_info - MCS information
703 * @rx_mask: RX mask
704 * @rx_highest: highest supported RX rate
705 * @tx_params: TX parameters
706 */
707struct ieee80211_mcs_info {
708 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
709 __le16 rx_highest;
710 u8 tx_params;
711 u8 reserved[3];
712} __attribute__((packed));
713
714/* 802.11n HT capability MSC set */
715#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
716#define IEEE80211_HT_MCS_TX_DEFINED 0x01
717#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
718/* value 0 == 1 stream etc */
719#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
720#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
721#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
722#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
723
724/*
725 * 802.11n D5.0 20.3.5 / 20.6 says:
726 * - indices 0 to 7 and 32 are single spatial stream
727 * - 8 to 31 are multiple spatial streams using equal modulation
728 * [8..15 for two streams, 16..23 for three and 24..31 for four]
729 * - remainder are multiple spatial streams using unequal modulation
730 */
731#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
732#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
733 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
734
688/** 735/**
689 * struct ieee80211_ht_cap - HT capabilities 736 * struct ieee80211_ht_cap - HT capabilities
690 * 737 *
691 * This structure refers to "HT capabilities element" as 738 * This structure is the "HT capabilities element" as
692 * described in 802.11n draft section 7.3.2.52 739 * described in 802.11n D5.0 7.3.2.57
693 */ 740 */
694struct ieee80211_ht_cap { 741struct ieee80211_ht_cap {
695 __le16 cap_info; 742 __le16 cap_info;
696 u8 ampdu_params_info; 743 u8 ampdu_params_info;
697 u8 supp_mcs_set[16]; 744
745 /* 16 bytes MCS information */
746 struct ieee80211_mcs_info mcs;
747
698 __le16 extended_ht_cap_info; 748 __le16 extended_ht_cap_info;
699 __le32 tx_BF_cap_info; 749 __le32 tx_BF_cap_info;
700 u8 antenna_selection_info; 750 u8 antenna_selection_info;
701} __attribute__ ((packed)); 751} __attribute__ ((packed));
702 752
753/* 802.11n HT capabilities masks (for cap_info) */
754#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
755#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
756#define IEEE80211_HT_CAP_SM_PS 0x000C
757#define IEEE80211_HT_CAP_GRN_FLD 0x0010
758#define IEEE80211_HT_CAP_SGI_20 0x0020
759#define IEEE80211_HT_CAP_SGI_40 0x0040
760#define IEEE80211_HT_CAP_TX_STBC 0x0080
761#define IEEE80211_HT_CAP_RX_STBC 0x0300
762#define IEEE80211_HT_CAP_DELAY_BA 0x0400
763#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
764#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
765#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
766#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
767#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
768
769/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
770#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
771#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
772
703/** 773/**
704 * struct ieee80211_ht_cap - HT additional information 774 * struct ieee80211_ht_info - HT information
705 * 775 *
706 * This structure refers to "HT information element" as 776 * This structure is the "HT information element" as
707 * described in 802.11n draft section 7.3.2.53 777 * described in 802.11n D5.0 7.3.2.58
708 */ 778 */
709struct ieee80211_ht_addt_info { 779struct ieee80211_ht_info {
710 u8 control_chan; 780 u8 control_chan;
711 u8 ht_param; 781 u8 ht_param;
712 __le16 operation_mode; 782 __le16 operation_mode;
@@ -714,36 +784,33 @@ struct ieee80211_ht_addt_info {
714 u8 basic_set[16]; 784 u8 basic_set[16];
715} __attribute__ ((packed)); 785} __attribute__ ((packed));
716 786
717/* 802.11n HT capabilities masks */ 787/* for ht_param */
718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 788#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
719#define IEEE80211_HT_CAP_SM_PS 0x000C 789#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
720#define IEEE80211_HT_CAP_GRN_FLD 0x0010 790#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
721#define IEEE80211_HT_CAP_SGI_20 0x0020 791#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
722#define IEEE80211_HT_CAP_SGI_40 0x0040 792#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
723#define IEEE80211_HT_CAP_DELAY_BA 0x0400 793#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 794#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 795#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
726/* 802.11n HT capability AMPDU settings */ 796
727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 797/* for operation_mode */
728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 798#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
729/* 802.11n HT capability MSC set */ 799#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
730#define IEEE80211_SUPP_MCS_SET_UEQM 4 800#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
731#define IEEE80211_HT_CAP_MAX_STREAMS 4 801#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
732#define IEEE80211_SUPP_MCS_SET_LEN 10 802#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
733/* maximum streams the spec allows */ 803#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
734#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 804#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
735#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 805
736#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C 806/* for stbc_param */
737#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 807#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
738/* 802.11n HT IE masks */ 808#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
739#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 809#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
740#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 810#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
741#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 811#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
742#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 812#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
743#define IEEE80211_HT_IE_CHA_WIDTH 0x04 813
744#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
747 814
748/* block-ack parameters */ 815/* block-ack parameters */
749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 816#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -769,7 +836,6 @@ struct ieee80211_ht_addt_info {
769/* Authentication algorithms */ 836/* Authentication algorithms */
770#define WLAN_AUTH_OPEN 0 837#define WLAN_AUTH_OPEN 0
771#define WLAN_AUTH_SHARED_KEY 1 838#define WLAN_AUTH_SHARED_KEY 1
772#define WLAN_AUTH_FAST_BSS_TRANSITION 2
773#define WLAN_AUTH_LEAP 128 839#define WLAN_AUTH_LEAP 128
774 840
775#define WLAN_AUTH_CHALLENGE_LEN 128 841#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -949,7 +1015,7 @@ enum ieee80211_eid {
949 WLAN_EID_EXT_SUPP_RATES = 50, 1015 WLAN_EID_EXT_SUPP_RATES = 50,
950 /* 802.11n */ 1016 /* 802.11n */
951 WLAN_EID_HT_CAPABILITY = 45, 1017 WLAN_EID_HT_CAPABILITY = 45,
952 WLAN_EID_HT_EXTRA_INFO = 61, 1018 WLAN_EID_HT_INFORMATION = 61,
953 /* 802.11i */ 1019 /* 802.11i */
954 WLAN_EID_RSN = 48, 1020 WLAN_EID_RSN = 48,
955 WLAN_EID_WPA = 221, 1021 WLAN_EID_WPA = 221,
@@ -976,6 +1042,68 @@ enum ieee80211_spectrum_mgmt_actioncode {
976 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1042 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
977}; 1043};
978 1044
1045/*
1046 * IEEE 802.11-2007 7.3.2.9 Country information element
1047 *
1048 * Minimum length is 8 octets, ie len must be evenly
1049 * divisible by 2
1050 */
1051
1052/* Although the spec says 8 I'm seeing 6 in practice */
1053#define IEEE80211_COUNTRY_IE_MIN_LEN 6
1054
1055/*
1056 * For regulatory extension stuff see IEEE 802.11-2007
1057 * Annex I (page 1141) and Annex J (page 1147). Also
1058 * review 7.3.2.9.
1059 *
1060 * When dot11RegulatoryClassesRequired is true and the
1061 * first_channel/reg_extension_id is >= 201 then the IE
1062 * compromises of the 'ext' struct represented below:
1063 *
1064 * - Regulatory extension ID - when generating IE this just needs
1065 * to be monotonically increasing for each triplet passed in
1066 * the IE
1067 * - Regulatory class - index into set of rules
1068 * - Coverage class - index into air propagation time (Table 7-27),
1069 * in microseconds, you can compute the air propagation time from
1070 * the index by multiplying by 3, so index 10 yields a propagation
1071 * of 10 us. Valid values are 0-31, values 32-255 are not defined
1072 * yet. A value of 0 inicates air propagation of <= 1 us.
1073 *
1074 * See also Table I.2 for Emission limit sets and table
1075 * I.3 for Behavior limit sets. Table J.1 indicates how to map
1076 * a reg_class to an emission limit set and behavior limit set.
1077 */
1078#define IEEE80211_COUNTRY_EXTENSION_ID 201
1079
1080/*
1081 * Channels numbers in the IE must be monotonically increasing
1082 * if dot11RegulatoryClassesRequired is not true.
1083 *
1084 * If dot11RegulatoryClassesRequired is true consecutive
1085 * subband triplets following a regulatory triplet shall
1086 * have monotonically increasing first_channel number fields.
1087 *
1088 * Channel numbers shall not overlap.
1089 *
1090 * Note that max_power is signed.
1091 */
1092struct ieee80211_country_ie_triplet {
1093 union {
1094 struct {
1095 u8 first_channel;
1096 u8 num_channels;
1097 s8 max_power;
1098 } __attribute__ ((packed)) chans;
1099 struct {
1100 u8 reg_extension_id;
1101 u8 reg_class;
1102 u8 coverage_class;
1103 } __attribute__ ((packed)) ext;
1104 };
1105} __attribute__ ((packed));
1106
979/* BACK action code */ 1107/* BACK action code */
980enum ieee80211_back_actioncode { 1108enum ieee80211_back_actioncode {
981 WLAN_ACTION_ADDBA_REQ = 0, 1109 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1057,4 +1185,4 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1057 return hdr->addr1; 1185 return hdr->addr1;
1058} 1186}
1059 1187
1060#endif /* IEEE80211_H */ 1188#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 65246846c844..2a6e29620a96 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -65,6 +65,7 @@
65#define IFF_BONDING 0x20 /* bonding master or slave */ 65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
68 69
69#define IF_GET_IFACE 0x0001 /* for querying only */ 70#define IF_GET_IFACE 0x0001 /* for querying only */
70#define IF_GET_PROTO 0x0002 71#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 4d3401812e6c..5ff89809a581 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,6 +87,9 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89 89
90#define ARPHRD_PHONET 820 /* PhoNet media type */
91#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
92
90#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 93#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
91#define ARPHRD_NONE 0xFFFE /* zero header length */ 94#define ARPHRD_NONE 0xFFFE /* zero header length */
92 95
diff --git a/include/linux/in.h b/include/linux/in.h
index db458beef19d..d60122a3a088 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -80,6 +80,10 @@ struct in_addr {
80/* BSD compatibility */ 80/* BSD compatibility */
81#define IP_RECVRETOPTS IP_RETOPTS 81#define IP_RECVRETOPTS IP_RETOPTS
82 82
83/* TProxy original addresses */
84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86
83/* IP_MTU_DISCOVER values */ 87/* IP_MTU_DISCOVER values */
84#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 88#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
85#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 89#define IP_PMTUDISC_WANT 1 /* Use per route hints */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 641e026eee8f..0b816cae533e 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -278,6 +278,7 @@ struct ipv6_pinfo {
278 struct in6_addr saddr; 278 struct in6_addr saddr;
279 struct in6_addr rcv_saddr; 279 struct in6_addr rcv_saddr;
280 struct in6_addr daddr; 280 struct in6_addr daddr;
281 struct in6_pktinfo sticky_pktinfo;
281 struct in6_addr *daddr_cache; 282 struct in6_addr *daddr_cache;
282#ifdef CONFIG_IPV6_SUBTREES 283#ifdef CONFIG_IPV6_SUBTREES
283 struct in6_addr *saddr_cache; 284 struct in6_addr *saddr_cache;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index dc7e0d0a6474..6002ae76785c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -361,18 +361,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
361 ((unsigned char *)&addr)[3] 361 ((unsigned char *)&addr)[3]
362#define NIPQUAD_FMT "%u.%u.%u.%u" 362#define NIPQUAD_FMT "%u.%u.%u.%u"
363 363
364#define NIP6(addr) \
365 ntohs((addr).s6_addr16[0]), \
366 ntohs((addr).s6_addr16[1]), \
367 ntohs((addr).s6_addr16[2]), \
368 ntohs((addr).s6_addr16[3]), \
369 ntohs((addr).s6_addr16[4]), \
370 ntohs((addr).s6_addr16[5]), \
371 ntohs((addr).s6_addr16[6]), \
372 ntohs((addr).s6_addr16[7])
373#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
374#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
375
376#if defined(__LITTLE_ENDIAN) 364#if defined(__LITTLE_ENDIAN)
377#define HIPQUAD(addr) \ 365#define HIPQUAD(addr) \
378 ((unsigned char *)&addr)[3], \ 366 ((unsigned char *)&addr)[3], \
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
new file mode 100644
index 000000000000..93150ecf3ea4
--- /dev/null
+++ b/include/linux/list_nulls.h
@@ -0,0 +1,94 @@
1#ifndef _LINUX_LIST_NULLS_H
2#define _LINUX_LIST_NULLS_H
3
4/*
5 * Special version of lists, where end of list is not a NULL pointer,
6 * but a 'nulls' marker, which can have many different values.
7 * (up to 2^31 different values guaranteed on all platforms)
8 *
9 * In the standard hlist, termination of a list is the NULL pointer.
10 * In this special 'nulls' variant, we use the fact that objects stored in
11 * a list are aligned on a word (4 or 8 bytes alignment).
12 * We therefore use the last significant bit of 'ptr' :
13 * Set to 1 : This is a 'nulls' end-of-list marker (ptr >> 1)
14 * Set to 0 : This is a pointer to some object (ptr)
15 */
16
17struct hlist_nulls_head {
18 struct hlist_nulls_node *first;
19};
20
21struct hlist_nulls_node {
22 struct hlist_nulls_node *next, **pprev;
23};
24#define INIT_HLIST_NULLS_HEAD(ptr, nulls) \
25 ((ptr)->first = (struct hlist_nulls_node *) (1UL | (((long)nulls) << 1)))
26
27#define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member)
28/**
29 * ptr_is_a_nulls - Test if a ptr is a nulls
30 * @ptr: ptr to be tested
31 *
32 */
33static inline int is_a_nulls(const struct hlist_nulls_node *ptr)
34{
35 return ((unsigned long)ptr & 1);
36}
37
38/**
39 * get_nulls_value - Get the 'nulls' value of the end of chain
40 * @ptr: end of chain
41 *
42 * Should be called only if is_a_nulls(ptr);
43 */
44static inline unsigned long get_nulls_value(const struct hlist_nulls_node *ptr)
45{
46 return ((unsigned long)ptr) >> 1;
47}
48
49static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h)
50{
51 return !h->pprev;
52}
53
54static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
55{
56 return is_a_nulls(h->first);
57}
58
59static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
60{
61 struct hlist_nulls_node *next = n->next;
62 struct hlist_nulls_node **pprev = n->pprev;
63 *pprev = next;
64 if (!is_a_nulls(next))
65 next->pprev = pprev;
66}
67
68/**
69 * hlist_nulls_for_each_entry - iterate over list of given type
70 * @tpos: the type * to use as a loop cursor.
71 * @pos: the &struct hlist_node to use as a loop cursor.
72 * @head: the head for your list.
73 * @member: the name of the hlist_node within the struct.
74 *
75 */
76#define hlist_nulls_for_each_entry(tpos, pos, head, member) \
77 for (pos = (head)->first; \
78 (!is_a_nulls(pos)) && \
79 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
80 pos = pos->next)
81
82/**
83 * hlist_nulls_for_each_entry_from - iterate over a hlist continuing from current point
84 * @tpos: the type * to use as a loop cursor.
85 * @pos: the &struct hlist_node to use as a loop cursor.
86 * @member: the name of the hlist_node within the struct.
87 *
88 */
89#define hlist_nulls_for_each_entry_from(tpos, pos, member) \
90 for (; (!is_a_nulls(pos)) && \
91 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
92 pos = pos->next)
93
94#endif
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
new file mode 100644
index 000000000000..e9d3fdfe41d7
--- /dev/null
+++ b/include/linux/mdio-gpio.h
@@ -0,0 +1,25 @@
1/*
2 * MDIO-GPIO bus platform data structures
3 *
4 * Copyright (C) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MDIO_GPIO_H
12#define __LINUX_MDIO_GPIO_H
13
14#include <linux/mdio-bitbang.h>
15
16struct mdio_gpio_platform_data {
17 /* GPIO numbers for bus pins */
18 unsigned int mdc;
19 unsigned int mdio;
20
21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR];
23};
24
25#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 151b7e0182c7..ad748588faf1 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -135,6 +135,10 @@
135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ 135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ 136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
137 137
138/* Flow control flags */
139#define FLOW_CTRL_TX 0x01
140#define FLOW_CTRL_RX 0x02
141
138/* This structure is used in all SIOCxMIIxxx ioctl calls */ 142/* This structure is used in all SIOCxMIIxxx ioctl calls */
139struct mii_ioctl_data { 143struct mii_ioctl_data {
140 __u16 phy_id; 144 __u16 phy_id;
@@ -235,5 +239,34 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
235 return 0; 239 return 0;
236} 240}
237 241
242/**
243 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register
246 *
247 * Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3
248 */
249static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{
251 u8 cap = 0;
252
253 if (lcladv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) {
255 if (rmtadv & LPA_PAUSE_CAP)
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
257 else if (rmtadv & LPA_PAUSE_ASYM)
258 cap = FLOW_CTRL_RX;
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;
266 }
267
268 return cap;
269}
270
238#endif /* __KERNEL__ */ 271#endif /* __KERNEL__ */
239#endif /* __LINUX_MII_H__ */ 272#endif /* __LINUX_MII_H__ */
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6f4c180179e2..5375faca1f72 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -117,6 +117,7 @@ struct sioc_mif_req6
117 117
118#include <linux/pim.h> 118#include <linux/pim.h>
119#include <linux/skbuff.h> /* for struct sk_buff_head */ 119#include <linux/skbuff.h> /* for struct sk_buff_head */
120#include <net/net_namespace.h>
120 121
121#ifdef CONFIG_IPV6_MROUTE 122#ifdef CONFIG_IPV6_MROUTE
122static inline int ip6_mroute_opt(int opt) 123static inline int ip6_mroute_opt(int opt)
@@ -187,6 +188,9 @@ struct mif_device
187struct mfc6_cache 188struct mfc6_cache
188{ 189{
189 struct mfc6_cache *next; /* Next entry on cache line */ 190 struct mfc6_cache *next; /* Next entry on cache line */
191#ifdef CONFIG_NET_NS
192 struct net *mfc6_net;
193#endif
190 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 194 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
191 struct in6_addr mf6c_origin; /* Source of packet */ 195 struct in6_addr mf6c_origin; /* Source of packet */
192 mifi_t mf6c_parent; /* Source interface */ 196 mifi_t mf6c_parent; /* Source interface */
@@ -209,6 +213,18 @@ struct mfc6_cache
209 } mfc_un; 213 } mfc_un;
210}; 214};
211 215
216static inline
217struct net *mfc6_net(const struct mfc6_cache *mfc)
218{
219 return read_pnet(&mfc->mfc6_net);
220}
221
222static inline
223void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
224{
225 write_pnet(&mfc->mfc6_net, hold_net(net));
226}
227
212#define MFC_STATIC 1 228#define MFC_STATIC 1
213#define MFC_NOTIFY 2 229#define MFC_NOTIFY 2
214 230
@@ -229,13 +245,17 @@ struct mfc6_cache
229 245
230#ifdef __KERNEL__ 246#ifdef __KERNEL__
231struct rtmsg; 247struct rtmsg;
232extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 248extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
249 struct rtmsg *rtm, int nowait);
233 250
234#ifdef CONFIG_IPV6_MROUTE 251#ifdef CONFIG_IPV6_MROUTE
235extern struct sock *mroute6_socket; 252static inline struct sock *mroute6_socket(struct net *net)
253{
254 return net->ipv6.mroute6_sk;
255}
236extern int ip6mr_sk_done(struct sock *sk); 256extern int ip6mr_sk_done(struct sock *sk);
237#else 257#else
238#define mroute6_socket NULL 258static inline struct sock *mroute6_socket(struct net *net) { return NULL; }
239static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 259static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
240#endif 260#endif
241#endif 261#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e26f54952892..41e1224651cf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,9 @@
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h> 45#include <net/dsa.h>
46#ifdef CONFIG_DCB
47#include <net/dcbnl.h>
48#endif
46 49
47struct vlan_group; 50struct vlan_group;
48struct ethtool_ops; 51struct ethtool_ops;
@@ -311,8 +314,9 @@ struct napi_struct {
311 spinlock_t poll_lock; 314 spinlock_t poll_lock;
312 int poll_owner; 315 int poll_owner;
313 struct net_device *dev; 316 struct net_device *dev;
314 struct list_head dev_list;
315#endif 317#endif
318 struct list_head dev_list;
319 struct sk_buff *gro_list;
316}; 320};
317 321
318enum 322enum
@@ -373,22 +377,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
373 * 377 *
374 * Mark NAPI processing as complete. 378 * Mark NAPI processing as complete.
375 */ 379 */
376static inline void __napi_complete(struct napi_struct *n) 380extern void __napi_complete(struct napi_struct *n);
377{ 381extern void napi_complete(struct napi_struct *n);
378 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
379 list_del(&n->poll_list);
380 smp_mb__before_clear_bit();
381 clear_bit(NAPI_STATE_SCHED, &n->state);
382}
383
384static inline void napi_complete(struct napi_struct *n)
385{
386 unsigned long flags;
387
388 local_irq_save(flags);
389 __napi_complete(n);
390 local_irq_restore(flags);
391}
392 382
393/** 383/**
394 * napi_disable - prevent NAPI from scheduling 384 * napi_disable - prevent NAPI from scheduling
@@ -452,6 +442,147 @@ struct netdev_queue {
452 struct Qdisc *qdisc_sleeping; 442 struct Qdisc *qdisc_sleeping;
453} ____cacheline_aligned_in_smp; 443} ____cacheline_aligned_in_smp;
454 444
445
446/*
447 * This structure defines the management hooks for network devices.
448 * The following hooks can be defined; unless noted otherwise, they are
449 * optional and can be filled with a null pointer.
450 *
451 * int (*ndo_init)(struct net_device *dev);
452 * This function is called once when network device is registered.
453 * The network device can use this to any late stage initializaton
454 * or semantic validattion. It can fail with an error code which will
455 * be propogated back to register_netdev
456 *
457 * void (*ndo_uninit)(struct net_device *dev);
458 * This function is called when device is unregistered or when registration
459 * fails. It is not called if init fails.
460 *
461 * int (*ndo_open)(struct net_device *dev);
462 * This function is called when network device transistions to the up
463 * state.
464 *
465 * int (*ndo_stop)(struct net_device *dev);
466 * This function is called when network device transistions to the down
467 * state.
468 *
469 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
470 * Called when a packet needs to be transmitted.
471 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
472 * Required can not be NULL.
473 *
474 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
475 * Called to decide which queue to when device supports multiple
476 * transmit queues.
477 *
478 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
479 * This function is called to allow device receiver to make
480 * changes to configuration when multicast or promiscious is enabled.
481 *
482 * void (*ndo_set_rx_mode)(struct net_device *dev);
483 * This function is called device changes address list filtering.
484 *
485 * void (*ndo_set_multicast_list)(struct net_device *dev);
486 * This function is called when the multicast address list changes.
487 *
488 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
489 * This function is called when the Media Access Control address
490 * needs to be changed. If not this interface is not defined, the
491 * mac address can not be changed.
492 *
493 * int (*ndo_validate_addr)(struct net_device *dev);
494 * Test if Media Access Control address is valid for the device.
495 *
496 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
497 * Called when a user request an ioctl which can't be handled by
498 * the generic interface code. If not defined ioctl's return
499 * not supported error code.
500 *
501 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
502 * Used to set network devices bus interface parameters. This interface
503 * is retained for legacy reason, new devices should use the bus
504 * interface (PCI) for low level management.
505 *
506 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
507 * Called when a user wants to change the Maximum Transfer Unit
508 * of a device. If not defined, any request to change MTU will
509 * will return an error.
510 *
511 * void (*ndo_tx_timeout)(struct net_device *dev);
512 * Callback uses when the transmitter has not made any progress
513 * for dev->watchdog ticks.
514 *
515 * struct net_device_stats* (*get_stats)(struct net_device *dev);
516 * Called when a user wants to get the network device usage
517 * statistics. If not defined, the counters in dev->stats will
518 * be used.
519 *
520 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
521 * If device support VLAN receive accleration
522 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
523 * when vlan groups for the device changes. Note: grp is NULL
524 * if no vlan's groups are being used.
525 *
526 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
527 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
528 * this function is called when a VLAN id is registered.
529 *
530 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
531 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
532 * this function is called when a VLAN id is unregistered.
533 *
534 * void (*ndo_poll_controller)(struct net_device *dev);
535 */
536#define HAVE_NET_DEVICE_OPS
537struct net_device_ops {
538 int (*ndo_init)(struct net_device *dev);
539 void (*ndo_uninit)(struct net_device *dev);
540 int (*ndo_open)(struct net_device *dev);
541 int (*ndo_stop)(struct net_device *dev);
542 int (*ndo_start_xmit) (struct sk_buff *skb,
543 struct net_device *dev);
544 u16 (*ndo_select_queue)(struct net_device *dev,
545 struct sk_buff *skb);
546#define HAVE_CHANGE_RX_FLAGS
547 void (*ndo_change_rx_flags)(struct net_device *dev,
548 int flags);
549#define HAVE_SET_RX_MODE
550 void (*ndo_set_rx_mode)(struct net_device *dev);
551#define HAVE_MULTICAST
552 void (*ndo_set_multicast_list)(struct net_device *dev);
553#define HAVE_SET_MAC_ADDR
554 int (*ndo_set_mac_address)(struct net_device *dev,
555 void *addr);
556#define HAVE_VALIDATE_ADDR
557 int (*ndo_validate_addr)(struct net_device *dev);
558#define HAVE_PRIVATE_IOCTL
559 int (*ndo_do_ioctl)(struct net_device *dev,
560 struct ifreq *ifr, int cmd);
561#define HAVE_SET_CONFIG
562 int (*ndo_set_config)(struct net_device *dev,
563 struct ifmap *map);
564#define HAVE_CHANGE_MTU
565 int (*ndo_change_mtu)(struct net_device *dev,
566 int new_mtu);
567 int (*ndo_neigh_setup)(struct net_device *dev,
568 struct neigh_parms *);
569#define HAVE_TX_TIMEOUT
570 void (*ndo_tx_timeout) (struct net_device *dev);
571
572 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
573
574 void (*ndo_vlan_rx_register)(struct net_device *dev,
575 struct vlan_group *grp);
576 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
577 unsigned short vid);
578 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
579 unsigned short vid);
580#ifdef CONFIG_NET_POLL_CONTROLLER
581#define HAVE_NETDEV_POLL
582 void (*ndo_poll_controller)(struct net_device *dev);
583#endif
584};
585
455/* 586/*
456 * The DEVICE structure. 587 * The DEVICE structure.
457 * Actually, this whole structure is a big mistake. It mixes I/O 588 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -496,14 +627,7 @@ struct net_device
496 unsigned long state; 627 unsigned long state;
497 628
498 struct list_head dev_list; 629 struct list_head dev_list;
499#ifdef CONFIG_NETPOLL
500 struct list_head napi_list; 630 struct list_head napi_list;
501#endif
502
503 /* The device initialization function. Called only once. */
504 int (*init)(struct net_device *dev);
505
506 /* ------- Fields preinitialized in Space.c finish here ------- */
507 631
508 /* Net device features */ 632 /* Net device features */
509 unsigned long features; 633 unsigned long features;
@@ -522,6 +646,7 @@ struct net_device
522#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 646#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
523 /* do not use LLTX in new drivers */ 647 /* do not use LLTX in new drivers */
524#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 648#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
649#define NETIF_F_GRO 16384 /* Generic receive offload */
525#define NETIF_F_LRO 32768 /* large receive offload */ 650#define NETIF_F_LRO 32768 /* large receive offload */
526 651
527 /* Segmentation offload features */ 652 /* Segmentation offload features */
@@ -547,15 +672,13 @@ struct net_device
547 * for all in netdev_increment_features. 672 * for all in netdev_increment_features.
548 */ 673 */
549#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 674#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
550 NETIF_F_SG | NETIF_F_HIGHDMA | \ 675 NETIF_F_SG | NETIF_F_HIGHDMA | \
551 NETIF_F_FRAGLIST) 676 NETIF_F_FRAGLIST)
552 677
553 /* Interface index. Unique device identifier */ 678 /* Interface index. Unique device identifier */
554 int ifindex; 679 int ifindex;
555 int iflink; 680 int iflink;
556 681
557
558 struct net_device_stats* (*get_stats)(struct net_device *dev);
559 struct net_device_stats stats; 682 struct net_device_stats stats;
560 683
561#ifdef CONFIG_WIRELESS_EXT 684#ifdef CONFIG_WIRELESS_EXT
@@ -565,18 +688,13 @@ struct net_device
565 /* Instance data managed by the core of Wireless Extensions. */ 688 /* Instance data managed by the core of Wireless Extensions. */
566 struct iw_public_data * wireless_data; 689 struct iw_public_data * wireless_data;
567#endif 690#endif
691 /* Management operations */
692 const struct net_device_ops *netdev_ops;
568 const struct ethtool_ops *ethtool_ops; 693 const struct ethtool_ops *ethtool_ops;
569 694
570 /* Hardware header description */ 695 /* Hardware header description */
571 const struct header_ops *header_ops; 696 const struct header_ops *header_ops;
572 697
573 /*
574 * This marks the end of the "visible" part of the structure. All
575 * fields hereafter are internal to the system, and may change at
576 * will (read: may be cleaned up at will).
577 */
578
579
580 unsigned int flags; /* interface flags (a la BSD) */ 698 unsigned int flags; /* interface flags (a la BSD) */
581 unsigned short gflags; 699 unsigned short gflags;
582 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 700 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
@@ -635,7 +753,7 @@ struct net_device
635 unsigned long last_rx; /* Time of last Rx */ 753 unsigned long last_rx; /* Time of last Rx */
636 /* Interface address info used in eth_type_trans() */ 754 /* Interface address info used in eth_type_trans() */
637 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 755 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
638 because most packets are unicast) */ 756 because most packets are unicast) */
639 757
640 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 758 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
641 759
@@ -654,18 +772,12 @@ struct net_device
654/* 772/*
655 * One part is mostly used on xmit path (device) 773 * One part is mostly used on xmit path (device)
656 */ 774 */
657 void *priv; /* pointer to private data */
658 int (*hard_start_xmit) (struct sk_buff *skb,
659 struct net_device *dev);
660 /* These may be needed for future network-power-down code. */ 775 /* These may be needed for future network-power-down code. */
661 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 776 unsigned long trans_start; /* Time (in jiffies) of last Tx */
662 777
663 int watchdog_timeo; /* used by dev_watchdog() */ 778 int watchdog_timeo; /* used by dev_watchdog() */
664 struct timer_list watchdog_timer; 779 struct timer_list watchdog_timer;
665 780
666/*
667 * refcnt is a very hot point, so align it on SMP
668 */
669 /* Number of references to this device */ 781 /* Number of references to this device */
670 atomic_t refcnt ____cacheline_aligned_in_smp; 782 atomic_t refcnt ____cacheline_aligned_in_smp;
671 783
@@ -684,56 +796,12 @@ struct net_device
684 NETREG_RELEASED, /* called free_netdev */ 796 NETREG_RELEASED, /* called free_netdev */
685 } reg_state; 797 } reg_state;
686 798
687 /* Called after device is detached from network. */ 799 /* Called from unregister, can be used to call free_netdev */
688 void (*uninit)(struct net_device *dev); 800 void (*destructor)(struct net_device *dev);
689 /* Called after last user reference disappears. */
690 void (*destructor)(struct net_device *dev);
691
692 /* Pointers to interface service routines. */
693 int (*open)(struct net_device *dev);
694 int (*stop)(struct net_device *dev);
695#define HAVE_NETDEV_POLL
696#define HAVE_CHANGE_RX_FLAGS
697 void (*change_rx_flags)(struct net_device *dev,
698 int flags);
699#define HAVE_SET_RX_MODE
700 void (*set_rx_mode)(struct net_device *dev);
701#define HAVE_MULTICAST
702 void (*set_multicast_list)(struct net_device *dev);
703#define HAVE_SET_MAC_ADDR
704 int (*set_mac_address)(struct net_device *dev,
705 void *addr);
706#define HAVE_VALIDATE_ADDR
707 int (*validate_addr)(struct net_device *dev);
708#define HAVE_PRIVATE_IOCTL
709 int (*do_ioctl)(struct net_device *dev,
710 struct ifreq *ifr, int cmd);
711#define HAVE_SET_CONFIG
712 int (*set_config)(struct net_device *dev,
713 struct ifmap *map);
714#define HAVE_CHANGE_MTU
715 int (*change_mtu)(struct net_device *dev, int new_mtu);
716
717#define HAVE_TX_TIMEOUT
718 void (*tx_timeout) (struct net_device *dev);
719
720 void (*vlan_rx_register)(struct net_device *dev,
721 struct vlan_group *grp);
722 void (*vlan_rx_add_vid)(struct net_device *dev,
723 unsigned short vid);
724 void (*vlan_rx_kill_vid)(struct net_device *dev,
725 unsigned short vid);
726 801
727 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
728#ifdef CONFIG_NETPOLL 802#ifdef CONFIG_NETPOLL
729 struct netpoll_info *npinfo; 803 struct netpoll_info *npinfo;
730#endif 804#endif
731#ifdef CONFIG_NET_POLL_CONTROLLER
732 void (*poll_controller)(struct net_device *dev);
733#endif
734
735 u16 (*select_queue)(struct net_device *dev,
736 struct sk_buff *skb);
737 805
738#ifdef CONFIG_NET_NS 806#ifdef CONFIG_NET_NS
739 /* Network namespace this network device is inside */ 807 /* Network namespace this network device is inside */
@@ -764,6 +832,49 @@ struct net_device
764 /* for setting kernel sock attribute on TCP connection setup */ 832 /* for setting kernel sock attribute on TCP connection setup */
765#define GSO_MAX_SIZE 65536 833#define GSO_MAX_SIZE 65536
766 unsigned int gso_max_size; 834 unsigned int gso_max_size;
835
836#ifdef CONFIG_DCB
837 /* Data Center Bridging netlink ops */
838 struct dcbnl_rtnl_ops *dcbnl_ops;
839#endif
840
841#ifdef CONFIG_COMPAT_NET_DEV_OPS
842 struct {
843 int (*init)(struct net_device *dev);
844 void (*uninit)(struct net_device *dev);
845 int (*open)(struct net_device *dev);
846 int (*stop)(struct net_device *dev);
847 int (*hard_start_xmit) (struct sk_buff *skb,
848 struct net_device *dev);
849 u16 (*select_queue)(struct net_device *dev,
850 struct sk_buff *skb);
851 void (*change_rx_flags)(struct net_device *dev,
852 int flags);
853 void (*set_rx_mode)(struct net_device *dev);
854 void (*set_multicast_list)(struct net_device *dev);
855 int (*set_mac_address)(struct net_device *dev,
856 void *addr);
857 int (*validate_addr)(struct net_device *dev);
858 int (*do_ioctl)(struct net_device *dev,
859 struct ifreq *ifr, int cmd);
860 int (*set_config)(struct net_device *dev,
861 struct ifmap *map);
862 int (*change_mtu)(struct net_device *dev, int new_mtu);
863 int (*neigh_setup)(struct net_device *dev,
864 struct neigh_parms *);
865 void (*tx_timeout) (struct net_device *dev);
866 struct net_device_stats* (*get_stats)(struct net_device *dev);
867 void (*vlan_rx_register)(struct net_device *dev,
868 struct vlan_group *grp);
869 void (*vlan_rx_add_vid)(struct net_device *dev,
870 unsigned short vid);
871 void (*vlan_rx_kill_vid)(struct net_device *dev,
872 unsigned short vid);
873#ifdef CONFIG_NET_POLL_CONTROLLER
874 void (*poll_controller)(struct net_device *dev);
875#endif
876 };
877#endif
767}; 878};
768#define to_net_dev(d) container_of(d, struct net_device, dev) 879#define to_net_dev(d) container_of(d, struct net_device, dev)
769 880
@@ -859,22 +970,8 @@ static inline void *netdev_priv(const struct net_device *dev)
859 * netif_napi_add() must be used to initialize a napi context prior to calling 970 * netif_napi_add() must be used to initialize a napi context prior to calling
860 * *any* of the other napi related functions. 971 * *any* of the other napi related functions.
861 */ 972 */
862static inline void netif_napi_add(struct net_device *dev, 973void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
863 struct napi_struct *napi, 974 int (*poll)(struct napi_struct *, int), int weight);
864 int (*poll)(struct napi_struct *, int),
865 int weight)
866{
867 INIT_LIST_HEAD(&napi->poll_list);
868 napi->poll = poll;
869 napi->weight = weight;
870#ifdef CONFIG_NETPOLL
871 napi->dev = dev;
872 list_add(&napi->dev_list, &dev->napi_list);
873 spin_lock_init(&napi->poll_lock);
874 napi->poll_owner = -1;
875#endif
876 set_bit(NAPI_STATE_SCHED, &napi->state);
877}
878 975
879/** 976/**
880 * netif_napi_del - remove a napi context 977 * netif_napi_del - remove a napi context
@@ -882,12 +979,20 @@ static inline void netif_napi_add(struct net_device *dev,
882 * 979 *
883 * netif_napi_del() removes a napi context from the network device napi list 980 * netif_napi_del() removes a napi context from the network device napi list
884 */ 981 */
885static inline void netif_napi_del(struct napi_struct *napi) 982void netif_napi_del(struct napi_struct *napi);
886{ 983
887#ifdef CONFIG_NETPOLL 984struct napi_gro_cb {
888 list_del(&napi->dev_list); 985 /* This is non-zero if the packet may be of the same flow. */
889#endif 986 int same_flow;
890} 987
988 /* This is non-zero if the packet cannot be merged with the new skb. */
989 int flush;
990
991 /* Number of segments aggregated. */
992 int count;
993};
994
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
891 996
892struct packet_type { 997struct packet_type {
893 __be16 type; /* This is really htons(ether_type). */ 998 __be16 type; /* This is really htons(ether_type). */
@@ -899,6 +1004,9 @@ struct packet_type {
899 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1004 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
900 int features); 1005 int features);
901 int (*gso_send_check)(struct sk_buff *skb); 1006 int (*gso_send_check)(struct sk_buff *skb);
1007 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1008 struct sk_buff *skb);
1009 int (*gro_complete)(struct sk_buff *skb);
902 void *af_packet_priv; 1010 void *af_packet_priv;
903 struct list_head list; 1011 struct list_head list;
904}; 1012};
@@ -1252,6 +1360,9 @@ extern int netif_rx(struct sk_buff *skb);
1252extern int netif_rx_ni(struct sk_buff *skb); 1360extern int netif_rx_ni(struct sk_buff *skb);
1253#define HAVE_NETIF_RECEIVE_SKB 1 1361#define HAVE_NETIF_RECEIVE_SKB 1
1254extern int netif_receive_skb(struct sk_buff *skb); 1362extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi);
1364extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb);
1255extern void netif_nit_deliver(struct sk_buff *skb); 1366extern void netif_nit_deliver(struct sk_buff *skb);
1256extern int dev_valid_name(const char *name); 1367extern int dev_valid_name(const char *name);
1257extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1444,8 +1555,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1444} 1555}
1445 1556
1446/* Test if receive needs to be scheduled but only if up */ 1557/* Test if receive needs to be scheduled but only if up */
1447static inline int netif_rx_schedule_prep(struct net_device *dev, 1558static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1448 struct napi_struct *napi)
1449{ 1559{
1450 return napi_schedule_prep(napi); 1560 return napi_schedule_prep(napi);
1451} 1561}
@@ -1453,27 +1563,24 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1453/* Add interface to tail of rx poll list. This assumes that _prep has 1563/* Add interface to tail of rx poll list. This assumes that _prep has
1454 * already been called and returned 1. 1564 * already been called and returned 1.
1455 */ 1565 */
1456static inline void __netif_rx_schedule(struct net_device *dev, 1566static inline void __netif_rx_schedule(struct napi_struct *napi)
1457 struct napi_struct *napi)
1458{ 1567{
1459 __napi_schedule(napi); 1568 __napi_schedule(napi);
1460} 1569}
1461 1570
1462/* Try to reschedule poll. Called by irq handler. */ 1571/* Try to reschedule poll. Called by irq handler. */
1463 1572
1464static inline void netif_rx_schedule(struct net_device *dev, 1573static inline void netif_rx_schedule(struct napi_struct *napi)
1465 struct napi_struct *napi)
1466{ 1574{
1467 if (netif_rx_schedule_prep(dev, napi)) 1575 if (netif_rx_schedule_prep(napi))
1468 __netif_rx_schedule(dev, napi); 1576 __netif_rx_schedule(napi);
1469} 1577}
1470 1578
1471/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 1579/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1472static inline int netif_rx_reschedule(struct net_device *dev, 1580static inline int netif_rx_reschedule(struct napi_struct *napi)
1473 struct napi_struct *napi)
1474{ 1581{
1475 if (napi_schedule_prep(napi)) { 1582 if (napi_schedule_prep(napi)) {
1476 __netif_rx_schedule(dev, napi); 1583 __netif_rx_schedule(napi);
1477 return 1; 1584 return 1;
1478 } 1585 }
1479 return 0; 1586 return 0;
@@ -1482,8 +1589,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
1482/* same as netif_rx_complete, except that local_irq_save(flags) 1589/* same as netif_rx_complete, except that local_irq_save(flags)
1483 * has already been issued 1590 * has already been issued
1484 */ 1591 */
1485static inline void __netif_rx_complete(struct net_device *dev, 1592static inline void __netif_rx_complete(struct napi_struct *napi)
1486 struct napi_struct *napi)
1487{ 1593{
1488 __napi_complete(napi); 1594 __napi_complete(napi);
1489} 1595}
@@ -1493,20 +1599,9 @@ static inline void __netif_rx_complete(struct net_device *dev,
1493 * it completes the work. The device cannot be out of poll list at this 1599 * it completes the work. The device cannot be out of poll list at this
1494 * moment, it is BUG(). 1600 * moment, it is BUG().
1495 */ 1601 */
1496static inline void netif_rx_complete(struct net_device *dev, 1602static inline void netif_rx_complete(struct napi_struct *napi)
1497 struct napi_struct *napi)
1498{ 1603{
1499 unsigned long flags; 1604 napi_complete(napi);
1500
1501 /*
1502 * don't let napi dequeue from the cpu poll list
1503 * just in case its running on a different cpu
1504 */
1505 if (unlikely(test_bit(NAPI_STATE_NPSVC, &napi->state)))
1506 return;
1507 local_irq_save(flags);
1508 __netif_rx_complete(dev, napi);
1509 local_irq_restore(flags);
1510} 1605}
1511 1606
1512static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1607static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1683,6 +1778,8 @@ extern void netdev_features_change(struct net_device *dev);
1683/* Load a device via the kmod */ 1778/* Load a device via the kmod */
1684extern void dev_load(struct net *net, const char *name); 1779extern void dev_load(struct net *net, const char *name);
1685extern void dev_mcast_init(void); 1780extern void dev_mcast_init(void);
1781extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1782
1686extern int netdev_max_backlog; 1783extern int netdev_max_backlog;
1687extern int weight_p; 1784extern int weight_p;
1688extern int netdev_set_master(struct net_device *dev, struct net_device *master); 1785extern int netdev_set_master(struct net_device *dev, struct net_device *master);
@@ -1731,6 +1828,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1731{ 1828{
1732 return skb_is_gso(skb) && 1829 return skb_is_gso(skb) &&
1733 (!skb_gso_ok(skb, dev->features) || 1830 (!skb_gso_ok(skb, dev->features) ||
1831 (skb_shinfo(skb)->frag_list &&
1832 !(dev->features & NETIF_F_FRAGLIST)) ||
1734 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1833 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1735} 1834}
1736 1835
@@ -1749,26 +1848,31 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1749 struct net_device *dev = skb->dev; 1848 struct net_device *dev = skb->dev;
1750 struct net_device *master = dev->master; 1849 struct net_device *master = dev->master;
1751 1850
1752 if (master && 1851 if (master) {
1753 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1852 if (master->priv_flags & IFF_MASTER_ARPMON)
1754 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1853 dev->last_rx = jiffies;
1755 skb->protocol == __constant_htons(ETH_P_ARP))
1756 return 0;
1757 1854
1758 if (master->priv_flags & IFF_MASTER_ALB) { 1855 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1759 if (skb->pkt_type != PACKET_BROADCAST && 1856 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1760 skb->pkt_type != PACKET_MULTICAST) 1857 skb->protocol == __constant_htons(ETH_P_ARP))
1761 return 0; 1858 return 0;
1762 }
1763 if (master->priv_flags & IFF_MASTER_8023AD &&
1764 skb->protocol == __constant_htons(ETH_P_SLOW))
1765 return 0;
1766 1859
1767 return 1; 1860 if (master->priv_flags & IFF_MASTER_ALB) {
1861 if (skb->pkt_type != PACKET_BROADCAST &&
1862 skb->pkt_type != PACKET_MULTICAST)
1863 return 0;
1864 }
1865 if (master->priv_flags & IFF_MASTER_8023AD &&
1866 skb->protocol == __constant_htons(ETH_P_SLOW))
1867 return 0;
1868
1869 return 1;
1870 }
1768 } 1871 }
1769 return 0; 1872 return 0;
1770} 1873}
1771 1874
1875extern struct pernet_operations __net_initdata loopback_net_ops;
1772#endif /* __KERNEL__ */ 1876#endif /* __KERNEL__ */
1773 1877
1774#endif /* _LINUX_DEV_H */ 1878#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index d45e29cd1cfb..e40ddb94b1af 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -300,7 +300,8 @@ struct ebt_table
300 300
301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
302 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
303extern int ebt_register_table(struct ebt_table *table); 303extern struct ebt_table *ebt_register_table(struct net *net,
304 struct ebt_table *table);
304extern void ebt_unregister_table(struct ebt_table *table); 305extern void ebt_unregister_table(struct ebt_table *table);
305extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
306 const struct net_device *in, const struct net_device *out, 307 const struct net_device *in, const struct net_device *out,
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
index b9478a255301..1037fb2cd206 100644
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_POLICY_H 1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H 2#define _IPT_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ipt_policy_flags */ 8/* ipt_policy_flags */
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
index 6bab3163d2fb..b1c449d7ec89 100644
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_POLICY_H 1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H 2#define _IP6T_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ip6t_policy_flags */ 8/* ip6t_policy_flags */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 9ff1b54908f3..51b09a1f46c3 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -242,7 +242,8 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
242 nlh->nlmsg_flags = flags; 242 nlh->nlmsg_flags = flags;
243 nlh->nlmsg_pid = pid; 243 nlh->nlmsg_pid = pid;
244 nlh->nlmsg_seq = seq; 244 nlh->nlmsg_seq = seq;
245 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); 245 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
246 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
246 return nlh; 247 return nlh;
247} 248}
248 249
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e3d79593fb3a..e38d3c9dccda 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -94,11 +94,6 @@ static inline void netpoll_poll_unlock(void *have)
94 rcu_read_unlock(); 94 rcu_read_unlock();
95} 95}
96 96
97static inline void netpoll_netdev_init(struct net_device *dev)
98{
99 INIT_LIST_HEAD(&dev->napi_list);
100}
101
102#else 97#else
103static inline int netpoll_rx(struct sk_buff *skb) 98static inline int netpoll_rx(struct sk_buff *skb)
104{ 99{
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9bad65400fba..e86ed59f9ad5 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -3,7 +3,26 @@
3/* 3/*
4 * 802.11 netlink interface public header 4 * 802.11 netlink interface public header
5 * 5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 *
14 * Permission to use, copy, modify, and/or distribute this software for any
15 * purpose with or without fee is hereby granted, provided that the above
16 * copyright notice and this permission notice appear in all copies.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
19 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
21 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
23 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
24 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 *
7 */ 26 */
8 27
9/** 28/**
@@ -25,8 +44,10 @@
25 * 44 *
26 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request 45 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
27 * to get a list of all present wiphys. 46 * to get a list of all present wiphys.
28 * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and 47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
29 * %NL80211_ATTR_WIPHY_NAME. 48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
50 * %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET.
30 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
31 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
32 * %NL80211_ATTR_WIPHY_NAME. 53 * %NL80211_ATTR_WIPHY_NAME.
@@ -106,6 +127,12 @@
106 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will 127 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
107 * store this as a valid request and then query userspace for it. 128 * store this as a valid request and then query userspace for it.
108 * 129 *
130 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
131 * interface identified by %NL80211_ATTR_IFINDEX
132 *
133 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
134 * interface identified by %NL80211_ATTR_IFINDEX
135 *
109 * @NL80211_CMD_MAX: highest used command number 136 * @NL80211_CMD_MAX: highest used command number
110 * @__NL80211_CMD_AFTER_LAST: internal use 137 * @__NL80211_CMD_AFTER_LAST: internal use
111 */ 138 */
@@ -148,6 +175,9 @@ enum nl80211_commands {
148 NL80211_CMD_SET_REG, 175 NL80211_CMD_SET_REG,
149 NL80211_CMD_REQ_SET_REG, 176 NL80211_CMD_REQ_SET_REG,
150 177
178 NL80211_CMD_GET_MESH_PARAMS,
179 NL80211_CMD_SET_MESH_PARAMS,
180
151 /* add new commands above here */ 181 /* add new commands above here */
152 182
153 /* used to define NL80211_CMD_MAX below */ 183 /* used to define NL80211_CMD_MAX below */
@@ -169,6 +199,15 @@ enum nl80211_commands {
169 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. 199 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
170 * /sys/class/ieee80211/<phyname>/index 200 * /sys/class/ieee80211/<phyname>/index
171 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) 201 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
202 * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
203 * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz
204 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
205 * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included):
206 * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including
207 * this attribute)
208 * NL80211_CHAN_HT20 = HT20 only
209 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
210 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
172 * 211 *
173 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 212 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
174 * @NL80211_ATTR_IFNAME: network interface name 213 * @NL80211_ATTR_IFNAME: network interface name
@@ -234,6 +273,9 @@ enum nl80211_commands {
234 * (u8, 0 or 1) 273 * (u8, 0 or 1)
235 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled 274 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
236 * (u8, 0 or 1) 275 * (u8, 0 or 1)
276 * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
277 * rates in format defined by IEEE 802.11 7.3.2.2 but without the length
278 * restriction (at most %NL80211_MAX_SUPP_RATES).
237 * 279 *
238 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from 280 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
239 * association request when used with NL80211_CMD_NEW_STATION) 281 * association request when used with NL80211_CMD_NEW_STATION)
@@ -296,6 +338,14 @@ enum nl80211_attrs {
296 NL80211_ATTR_REG_ALPHA2, 338 NL80211_ATTR_REG_ALPHA2,
297 NL80211_ATTR_REG_RULES, 339 NL80211_ATTR_REG_RULES,
298 340
341 NL80211_ATTR_MESH_PARAMS,
342
343 NL80211_ATTR_BSS_BASIC_RATES,
344
345 NL80211_ATTR_WIPHY_TXQ_PARAMS,
346 NL80211_ATTR_WIPHY_FREQ,
347 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
348
299 /* add attributes here, update the policy in nl80211.c */ 349 /* add attributes here, update the policy in nl80211.c */
300 350
301 __NL80211_ATTR_AFTER_LAST, 351 __NL80211_ATTR_AFTER_LAST,
@@ -307,6 +357,10 @@ enum nl80211_attrs {
307 * here 357 * here
308 */ 358 */
309#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 359#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
360#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
361#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
362#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
363#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET
310 364
311#define NL80211_MAX_SUPP_RATES 32 365#define NL80211_MAX_SUPP_RATES 32
312#define NL80211_MAX_SUPP_REG_RULES 32 366#define NL80211_MAX_SUPP_REG_RULES 32
@@ -371,6 +425,32 @@ enum nl80211_sta_flags {
371}; 425};
372 426
373/** 427/**
428 * enum nl80211_rate_info - bitrate information
429 *
430 * These attribute types are used with %NL80211_STA_INFO_TXRATE
431 * when getting information about the bitrate of a station.
432 *
433 * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
434 * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
435 * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
436 * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
437 * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
438 * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
439 * @__NL80211_RATE_INFO_AFTER_LAST: internal use
440 */
441enum nl80211_rate_info {
442 __NL80211_RATE_INFO_INVALID,
443 NL80211_RATE_INFO_BITRATE,
444 NL80211_RATE_INFO_MCS,
445 NL80211_RATE_INFO_40_MHZ_WIDTH,
446 NL80211_RATE_INFO_SHORT_GI,
447
448 /* keep last */
449 __NL80211_RATE_INFO_AFTER_LAST,
450 NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1
451};
452
453/**
374 * enum nl80211_sta_info - station information 454 * enum nl80211_sta_info - station information
375 * 455 *
376 * These attribute types are used with %NL80211_ATTR_STA_INFO 456 * These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -382,6 +462,9 @@ enum nl80211_sta_flags {
382 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 462 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
383 * @__NL80211_STA_INFO_AFTER_LAST: internal 463 * @__NL80211_STA_INFO_AFTER_LAST: internal
384 * @NL80211_STA_INFO_MAX: highest possible station info attribute 464 * @NL80211_STA_INFO_MAX: highest possible station info attribute
465 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
466 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
467 * containing info as possible, see &enum nl80211_sta_info_txrate.
385 */ 468 */
386enum nl80211_sta_info { 469enum nl80211_sta_info {
387 __NL80211_STA_INFO_INVALID, 470 __NL80211_STA_INFO_INVALID,
@@ -391,6 +474,8 @@ enum nl80211_sta_info {
391 NL80211_STA_INFO_LLID, 474 NL80211_STA_INFO_LLID,
392 NL80211_STA_INFO_PLID, 475 NL80211_STA_INFO_PLID,
393 NL80211_STA_INFO_PLINK_STATE, 476 NL80211_STA_INFO_PLINK_STATE,
477 NL80211_STA_INFO_SIGNAL,
478 NL80211_STA_INFO_TX_BITRATE,
394 479
395 /* keep last */ 480 /* keep last */
396 __NL80211_STA_INFO_AFTER_LAST, 481 __NL80211_STA_INFO_AFTER_LAST,
@@ -452,17 +537,29 @@ enum nl80211_mpath_info {
452 * an array of nested frequency attributes 537 * an array of nested frequency attributes
453 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, 538 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
454 * an array of nested bitrate attributes 539 * an array of nested bitrate attributes
540 * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as
541 * defined in 802.11n
542 * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
543 * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
544 * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
455 */ 545 */
456enum nl80211_band_attr { 546enum nl80211_band_attr {
457 __NL80211_BAND_ATTR_INVALID, 547 __NL80211_BAND_ATTR_INVALID,
458 NL80211_BAND_ATTR_FREQS, 548 NL80211_BAND_ATTR_FREQS,
459 NL80211_BAND_ATTR_RATES, 549 NL80211_BAND_ATTR_RATES,
460 550
551 NL80211_BAND_ATTR_HT_MCS_SET,
552 NL80211_BAND_ATTR_HT_CAPA,
553 NL80211_BAND_ATTR_HT_AMPDU_FACTOR,
554 NL80211_BAND_ATTR_HT_AMPDU_DENSITY,
555
461 /* keep last */ 556 /* keep last */
462 __NL80211_BAND_ATTR_AFTER_LAST, 557 __NL80211_BAND_ATTR_AFTER_LAST,
463 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 558 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
464}; 559};
465 560
561#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
562
466/** 563/**
467 * enum nl80211_frequency_attr - frequency attributes 564 * enum nl80211_frequency_attr - frequency attributes
468 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz 565 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -474,6 +571,8 @@ enum nl80211_band_attr {
474 * on this channel in current regulatory domain. 571 * on this channel in current regulatory domain.
475 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory 572 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
476 * on this channel in current regulatory domain. 573 * on this channel in current regulatory domain.
574 * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
575 * (100 * dBm).
477 */ 576 */
478enum nl80211_frequency_attr { 577enum nl80211_frequency_attr {
479 __NL80211_FREQUENCY_ATTR_INVALID, 578 __NL80211_FREQUENCY_ATTR_INVALID,
@@ -482,12 +581,15 @@ enum nl80211_frequency_attr {
482 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, 581 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
483 NL80211_FREQUENCY_ATTR_NO_IBSS, 582 NL80211_FREQUENCY_ATTR_NO_IBSS,
484 NL80211_FREQUENCY_ATTR_RADAR, 583 NL80211_FREQUENCY_ATTR_RADAR,
584 NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
485 585
486 /* keep last */ 586 /* keep last */
487 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 587 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
488 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 588 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
489}; 589};
490 590
591#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
592
491/** 593/**
492 * enum nl80211_bitrate_attr - bitrate attributes 594 * enum nl80211_bitrate_attr - bitrate attributes
493 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps 595 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
@@ -594,4 +696,119 @@ enum nl80211_mntr_flags {
594 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 696 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
595}; 697};
596 698
699/**
700 * enum nl80211_meshconf_params - mesh configuration parameters
701 *
702 * Mesh configuration parameters
703 *
704 * @__NL80211_MESHCONF_INVALID: internal use
705 *
706 * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
707 * millisecond units, used by the Peer Link Open message
708 *
709 * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
710 * millisecond units, used by the peer link management to close a peer link
711 *
712 * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
713 * millisecond units
714 *
715 * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed
716 * on this mesh interface
717 *
718 * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link
719 * open retries that can be sent to establish a new peer link instance in a
720 * mesh
721 *
722 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
723 * point.
724 *
725 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
726 * open peer links when we detect compatible mesh peers.
727 *
728 * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
729 * containing a PREQ that an MP can send to a particular destination (path
730 * target)
731 *
732 * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths
733 * (in milliseconds)
734 *
735 * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait
736 * until giving up on a path discovery (in milliseconds)
737 *
738 * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh
739 * points receiving a PREQ shall consider the forwarding information from the
740 * root to be valid. (TU = time unit)
741 *
742 * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in
743 * TUs) during which an MP can send only one action frame containing a PREQ
744 * reference element
745 *
746 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
747 * that it takes for an HWMP information element to propagate across the mesh
748 *
749 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
750 *
751 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
752 */
753enum nl80211_meshconf_params {
754 __NL80211_MESHCONF_INVALID,
755 NL80211_MESHCONF_RETRY_TIMEOUT,
756 NL80211_MESHCONF_CONFIRM_TIMEOUT,
757 NL80211_MESHCONF_HOLDING_TIMEOUT,
758 NL80211_MESHCONF_MAX_PEER_LINKS,
759 NL80211_MESHCONF_MAX_RETRIES,
760 NL80211_MESHCONF_TTL,
761 NL80211_MESHCONF_AUTO_OPEN_PLINKS,
762 NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
763 NL80211_MESHCONF_PATH_REFRESH_TIME,
764 NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT,
765 NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
766 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
767 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
768
769 /* keep last */
770 __NL80211_MESHCONF_ATTR_AFTER_LAST,
771 NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
772};
773
774/**
775 * enum nl80211_txq_attr - TX queue parameter attributes
776 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
777 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
778 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
779 * disabled
780 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
781 * 2^n-1 in the range 1..32767]
782 * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
783 * 2^n-1 in the range 1..32767]
784 * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]
785 * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
786 * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number
787 */
788enum nl80211_txq_attr {
789 __NL80211_TXQ_ATTR_INVALID,
790 NL80211_TXQ_ATTR_QUEUE,
791 NL80211_TXQ_ATTR_TXOP,
792 NL80211_TXQ_ATTR_CWMIN,
793 NL80211_TXQ_ATTR_CWMAX,
794 NL80211_TXQ_ATTR_AIFS,
795
796 /* keep last */
797 __NL80211_TXQ_ATTR_AFTER_LAST,
798 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
799};
800
801enum nl80211_txq_q {
802 NL80211_TXQ_Q_VO,
803 NL80211_TXQ_Q_VI,
804 NL80211_TXQ_Q_BE,
805 NL80211_TXQ_Q_BK
806};
807
808enum nl80211_channel_type {
809 NL80211_CHAN_NO_HT,
810 NL80211_CHAN_HT20,
811 NL80211_CHAN_HT40MINUS,
812 NL80211_CHAN_HT40PLUS
813};
597#endif /* __LINUX_NL80211_H */ 814#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 77c4ed60b982..d7e54d98869f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -467,6 +467,8 @@ int genphy_restart_aneg(struct phy_device *phydev);
467int genphy_config_aneg(struct phy_device *phydev); 467int genphy_config_aneg(struct phy_device *phydev);
468int genphy_update_link(struct phy_device *phydev); 468int genphy_update_link(struct phy_device *phydev);
469int genphy_read_status(struct phy_device *phydev); 469int genphy_read_status(struct phy_device *phydev);
470int genphy_suspend(struct phy_device *phydev);
471int genphy_resume(struct phy_device *phydev);
470void phy_driver_unregister(struct phy_driver *drv); 472void phy_driver_unregister(struct phy_driver *drv);
471int phy_driver_register(struct phy_driver *new_driver); 473int phy_driver_register(struct phy_driver *new_driver);
472void phy_prepare_link(struct phy_device *phydev, 474void phy_prepare_link(struct phy_device *phydev,
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 7cf7824df778..e6aa8482ad7a 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -394,6 +394,20 @@ enum
394 394
395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) 395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
396 396
397
398/* Cgroup classifier */
399
400enum
401{
402 TCA_CGROUP_UNSPEC,
403 TCA_CGROUP_ACT,
404 TCA_CGROUP_POLICE,
405 TCA_CGROUP_EMATCHES,
406 __TCA_CGROUP_MAX,
407};
408
409#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
410
397/* Extended Matches */ 411/* Extended Matches */
398 412
399struct tcf_ematch_tree_hdr 413struct tcf_ematch_tree_hdr
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 5d921fa91a5b..e3f133adba78 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -500,4 +500,20 @@ struct tc_netem_corrupt
500 500
501#define NETEM_DIST_SCALE 8192 501#define NETEM_DIST_SCALE 8192
502 502
503/* DRR */
504
505enum
506{
507 TCA_DRR_UNSPEC,
508 TCA_DRR_QUANTUM,
509 __TCA_DRR_MAX
510};
511
512#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
513
514struct tc_drr_stats
515{
516 u32 deficit;
517};
518
503#endif 519#endif
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
new file mode 100644
index 000000000000..f9ddd03961a8
--- /dev/null
+++ b/include/linux/rculist_nulls.h
@@ -0,0 +1,110 @@
1#ifndef _LINUX_RCULIST_NULLS_H
2#define _LINUX_RCULIST_NULLS_H
3
4#ifdef __KERNEL__
5
6/*
7 * RCU-protected list version
8 */
9#include <linux/list_nulls.h>
10#include <linux/rcupdate.h>
11
12/**
13 * hlist_nulls_del_init_rcu - deletes entry from hash list with re-initialization
14 * @n: the element to delete from the hash list.
15 *
16 * Note: hlist_nulls_unhashed() on the node return true after this. It is
17 * useful for RCU based read lockfree traversal if the writer side
18 * must know if the list entry is still hashed or already unhashed.
19 *
20 * In particular, it means that we can not poison the forward pointers
21 * that may still be used for walking the hash list and we can only
22 * zero the pprev pointer so list_unhashed() will return true after
23 * this.
24 *
25 * The caller must take whatever precautions are necessary (such as
26 * holding appropriate locks) to avoid racing with another
27 * list-mutation primitive, such as hlist_nulls_add_head_rcu() or
28 * hlist_nulls_del_rcu(), running on this same list. However, it is
29 * perfectly legal to run concurrently with the _rcu list-traversal
30 * primitives, such as hlist_nulls_for_each_entry_rcu().
31 */
32static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)
33{
34 if (!hlist_nulls_unhashed(n)) {
35 __hlist_nulls_del(n);
36 n->pprev = NULL;
37 }
38}
39
40/**
41 * hlist_nulls_del_rcu - deletes entry from hash list without re-initialization
42 * @n: the element to delete from the hash list.
43 *
44 * Note: hlist_nulls_unhashed() on entry does not return true after this,
45 * the entry is in an undefined state. It is useful for RCU based
46 * lockfree traversal.
47 *
48 * In particular, it means that we can not poison the forward
49 * pointers that may still be used for walking the hash list.
50 *
51 * The caller must take whatever precautions are necessary
52 * (such as holding appropriate locks) to avoid racing
53 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
54 * or hlist_nulls_del_rcu(), running on this same list.
55 * However, it is perfectly legal to run concurrently with
56 * the _rcu list-traversal primitives, such as
57 * hlist_nulls_for_each_entry().
58 */
59static inline void hlist_nulls_del_rcu(struct hlist_nulls_node *n)
60{
61 __hlist_nulls_del(n);
62 n->pprev = LIST_POISON2;
63}
64
65/**
66 * hlist_nulls_add_head_rcu
67 * @n: the element to add to the hash list.
68 * @h: the list to add to.
69 *
70 * Description:
71 * Adds the specified element to the specified hlist_nulls,
72 * while permitting racing traversals.
73 *
74 * The caller must take whatever precautions are necessary
75 * (such as holding appropriate locks) to avoid racing
76 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
77 * or hlist_nulls_del_rcu(), running on this same list.
78 * However, it is perfectly legal to run concurrently with
79 * the _rcu list-traversal primitives, such as
80 * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency
81 * problems on Alpha CPUs. Regardless of the type of CPU, the
82 * list-traversal primitive must be guarded by rcu_read_lock().
83 */
84static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
85 struct hlist_nulls_head *h)
86{
87 struct hlist_nulls_node *first = h->first;
88
89 n->next = first;
90 n->pprev = &h->first;
91 rcu_assign_pointer(h->first, n);
92 if (!is_a_nulls(first))
93 first->pprev = &n->next;
94}
95/**
96 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
97 * @tpos: the type * to use as a loop cursor.
98 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
99 * @head: the head for your list.
100 * @member: the name of the hlist_nulls_node within the struct.
101 *
102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \
105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next))
108
109#endif
110#endif
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 4cd64b0d9825..164332cbb77c 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -108,6 +108,7 @@ struct rfkill {
108 108
109 struct device dev; 109 struct device dev;
110 struct list_head node; 110 struct list_head node;
111 enum rfkill_state state_for_resume;
111}; 112};
112#define to_rfkill(d) container_of(d, struct rfkill, dev) 113#define to_rfkill(d) container_of(d, struct rfkill, dev)
113 114
@@ -148,11 +149,4 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill)
148#endif 149#endif
149} 150}
150 151
151/* rfkill notification chain */
152#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
153 switch has changed */
154
155int register_rfkill_notifier(struct notifier_block *nb);
156int unregister_rfkill_notifier(struct notifier_block *nb);
157
158#endif /* RFKILL_H */ 152#endif /* RFKILL_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 2b3d51c6ec9c..e88f7058b3a1 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -107,6 +107,11 @@ enum {
107 RTM_GETADDRLABEL, 107 RTM_GETADDRLABEL,
108#define RTM_GETADDRLABEL RTM_GETADDRLABEL 108#define RTM_GETADDRLABEL RTM_GETADDRLABEL
109 109
110 RTM_GETDCB = 78,
111#define RTM_GETDCB RTM_GETDCB
112 RTM_SETDCB,
113#define RTM_SETDCB RTM_SETDCB
114
110 __RTM_MAX, 115 __RTM_MAX,
111#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 116#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
112}; 117};
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2725f4e5a9bf..cf2cb50f77d1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -250,6 +250,9 @@ typedef unsigned char *sk_buff_data_t;
250 * @tc_verd: traffic control verdict 250 * @tc_verd: traffic control verdict
251 * @ndisc_nodetype: router type (from link layer) 251 * @ndisc_nodetype: router type (from link layer)
252 * @do_not_encrypt: set to prevent encryption of this frame 252 * @do_not_encrypt: set to prevent encryption of this frame
253 * @requeue: set to indicate that the wireless core should attempt
254 * a software retry on this frame if we failed to
255 * receive an ACK for it
253 * @dma_cookie: a cookie to one of several possible DMA operations 256 * @dma_cookie: a cookie to one of several possible DMA operations
254 * done by skb DMA functions 257 * done by skb DMA functions
255 * @secmark: security marking 258 * @secmark: security marking
@@ -269,8 +272,9 @@ struct sk_buff {
269 struct dst_entry *dst; 272 struct dst_entry *dst;
270 struct rtable *rtable; 273 struct rtable *rtable;
271 }; 274 };
275#ifdef CONFIG_XFRM
272 struct sec_path *sp; 276 struct sec_path *sp;
273 277#endif
274 /* 278 /*
275 * This is the control buffer. It is free to use for every 279 * This is the control buffer. It is free to use for every
276 * layer. Please put your private variables there. If you 280 * layer. Please put your private variables there. If you
@@ -325,6 +329,7 @@ struct sk_buff {
325#endif 329#endif
326#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 330#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
327 __u8 do_not_encrypt:1; 331 __u8 do_not_encrypt:1;
332 __u8 requeue:1;
328#endif 333#endif
329 /* 0/13/14 bit hole */ 334 /* 0/13/14 bit hole */
330 335
@@ -488,6 +493,19 @@ static inline bool skb_queue_is_last(const struct sk_buff_head *list,
488} 493}
489 494
490/** 495/**
496 * skb_queue_is_first - check if skb is the first entry in the queue
497 * @list: queue head
498 * @skb: buffer
499 *
500 * Returns true if @skb is the first buffer on the list.
501 */
502static inline bool skb_queue_is_first(const struct sk_buff_head *list,
503 const struct sk_buff *skb)
504{
505 return (skb->prev == (struct sk_buff *) list);
506}
507
508/**
491 * skb_queue_next - return the next packet in the queue 509 * skb_queue_next - return the next packet in the queue
492 * @list: queue head 510 * @list: queue head
493 * @skb: current buffer 511 * @skb: current buffer
@@ -506,6 +524,24 @@ static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
506} 524}
507 525
508/** 526/**
527 * skb_queue_prev - return the prev packet in the queue
528 * @list: queue head
529 * @skb: current buffer
530 *
531 * Return the prev packet in @list before @skb. It is only valid to
532 * call this if skb_queue_is_first() evaluates to false.
533 */
534static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
535 const struct sk_buff *skb)
536{
537 /* This BUG_ON may seem severe, but if we just return then we
538 * are going to dereference garbage.
539 */
540 BUG_ON(skb_queue_is_first(list, skb));
541 return skb->prev;
542}
543
544/**
509 * skb_get - reference buffer 545 * skb_get - reference buffer
510 * @skb: buffer to reference 546 * @skb: buffer to reference
511 * 547 *
@@ -1647,8 +1683,12 @@ extern int skb_splice_bits(struct sk_buff *skb,
1647extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1683extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1648extern void skb_split(struct sk_buff *skb, 1684extern void skb_split(struct sk_buff *skb,
1649 struct sk_buff *skb1, const u32 len); 1685 struct sk_buff *skb1, const u32 len);
1686extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1687 int shiftlen);
1650 1688
1651extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1689extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1690extern int skb_gro_receive(struct sk_buff **head,
1691 struct sk_buff *skb);
1652 1692
1653static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1693static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1654 int len, void *buffer) 1694 int len, void *buffer)
@@ -1864,6 +1904,18 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
1864 to->queue_mapping = from->queue_mapping; 1904 to->queue_mapping = from->queue_mapping;
1865} 1905}
1866 1906
1907#ifdef CONFIG_XFRM
1908static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1909{
1910 return skb->sp;
1911}
1912#else
1913static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1914{
1915 return NULL;
1916}
1917#endif
1918
1867static inline int skb_is_gso(const struct sk_buff *skb) 1919static inline int skb_is_gso(const struct sk_buff *skb)
1868{ 1920{
1869 return skb_shinfo(skb)->gso_size; 1921 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
new file mode 100644
index 000000000000..1cbf0313adde
--- /dev/null
+++ b/include/linux/smsc911x.h
@@ -0,0 +1,47 @@
1/***************************************************************************
2 *
3 * Copyright (C) 2004-2008 SMSC
4 * Copyright (C) 2005-2008 ARM
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 ***************************************************************************/
21#ifndef __LINUX_SMSC911X_H__
22#define __LINUX_SMSC911X_H__
23
24#include <linux/phy.h>
25
26/* platform_device configuration data, should be assigned to
27 * the platform_device's dev.platform_data */
28struct smsc911x_platform_config {
29 unsigned int irq_polarity;
30 unsigned int irq_type;
31 unsigned int flags;
32 phy_interface_t phy_interface;
33};
34
35/* Constants for platform_device irq polarity configuration */
36#define SMSC911X_IRQ_POLARITY_ACTIVE_LOW 0
37#define SMSC911X_IRQ_POLARITY_ACTIVE_HIGH 1
38
39/* Constants for platform_device irq type configuration */
40#define SMSC911X_IRQ_TYPE_OPEN_DRAIN 0
41#define SMSC911X_IRQ_TYPE_PUSH_PULL 1
42
43/* Constants for flags */
44#define SMSC911X_USE_16BIT (BIT(0))
45#define SMSC911X_USE_32BIT (BIT(1))
46
47#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 7a6e6bba4a71..aee3f1e1d1ce 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -216,6 +216,9 @@ enum
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ 216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ 217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */
218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ 218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */
219 LINUX_MIB_SACKSHIFTED,
220 LINUX_MIB_SACKMERGED,
221 LINUX_MIB_SACKSHIFTFALLBACK,
219 __LINUX_MIB_MAX 222 __LINUX_MIB_MAX
220}; 223};
221 224
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 6fd7b016517f..0127daca4354 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -139,14 +139,14 @@ static inline char *__svc_print_addr(struct sockaddr *addr,
139{ 139{
140 switch (addr->sa_family) { 140 switch (addr->sa_family) {
141 case AF_INET: 141 case AF_INET:
142 snprintf(buf, len, "%u.%u.%u.%u, port=%u", 142 snprintf(buf, len, "%pI4, port=%u",
143 NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), 143 &((struct sockaddr_in *)addr)->sin_addr,
144 ntohs(((struct sockaddr_in *) addr)->sin_port)); 144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break; 145 break;
146 146
147 case AF_INET6: 147 case AF_INET6:
148 snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", 148 snprintf(buf, len, "%pI6, port=%u",
149 NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), 149 &((struct sockaddr_in6 *)addr)->sin6_addr,
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); 150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
151 break; 151 break;
152 152
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 5e33761b9b8a..5cdd0aa8bde9 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -20,6 +20,7 @@
20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ 20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
23#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
23 24
24struct virtio_net_config 25struct virtio_net_config
25{ 26{
@@ -44,4 +45,12 @@ struct virtio_net_hdr
44 __u16 csum_start; /* Position to start checksumming from */ 45 __u16 csum_start; /* Position to start checksumming from */
45 __u16 csum_offset; /* Offset after that to place checksum */ 46 __u16 csum_offset; /* Offset after that to place checksum */
46}; 47};
48
49/* This is the version of the header to use when the MRG_RXBUF
50 * feature has been negotiated. */
51struct virtio_net_hdr_mrg_rxbuf {
52 struct virtio_net_hdr hdr;
53 __u16 num_buffers; /* Number of merged rx buffers */
54};
55
47#endif /* _LINUX_VIRTIO_NET_H */ 56#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 4bc1e6b86cb2..52f3abd453a1 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -199,6 +199,9 @@ enum {
199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO 199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
200 XFRM_MSG_GETSPDINFO, 200 XFRM_MSG_GETSPDINFO,
201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO 201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
202
203 XFRM_MSG_MAPPING,
204#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
202 __XFRM_MSG_MAX 205 __XFRM_MSG_MAX
203}; 206};
204#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 207#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -438,6 +441,15 @@ struct xfrm_user_migrate {
438 __u16 new_family; 441 __u16 new_family;
439}; 442};
440 443
444struct xfrm_user_mapping {
445 struct xfrm_usersa_id id;
446 __u32 reqid;
447 xfrm_address_t old_saddr;
448 xfrm_address_t new_saddr;
449 __be16 old_sport;
450 __be16 new_sport;
451};
452
441#ifndef __KERNEL__ 453#ifndef __KERNEL__
442/* backwards compatibility for userspace */ 454/* backwards compatibility for userspace */
443#define XFRMGRP_ACQUIRE 1 455#define XFRMGRP_ACQUIRE 1
@@ -464,6 +476,8 @@ enum xfrm_nlgroups {
464#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 476#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
465 XFRMNLGRP_MIGRATE, 477 XFRMNLGRP_MIGRATE,
466#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE 478#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE
479 XFRMNLGRP_MAPPING,
480#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING
467 __XFRMNLGRP_MAX 481 __XFRMNLGRP_MAX
468}; 482};
469#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 483#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 996d12df7594..a04f8463ac7e 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -54,8 +54,8 @@
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __func__ , ## arg) 57#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 58#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
59 59
60/* Connection and socket states */ 60/* Connection and socket states */
61enum { 61enum {
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3cc294919312..3645139e68c7 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -54,7 +54,7 @@
54 54
55/* HCI device quirks */ 55/* HCI device quirks */
56enum { 56enum {
57 HCI_QUIRK_RESET_ON_INIT, 57 HCI_QUIRK_NO_RESET,
58 HCI_QUIRK_RAW_DEVICE, 58 HCI_QUIRK_RAW_DEVICE,
59 HCI_QUIRK_FIXUP_BUFFER_SIZE 59 HCI_QUIRK_FIXUP_BUFFER_SIZE
60}; 60};
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0e85ec39b638..23c0ab74ded6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5,6 +5,8 @@
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <net/genetlink.h> 7#include <net/genetlink.h>
8/* remove once we remove the wext stuff */
9#include <net/iw_handler.h>
8 10
9/* 11/*
10 * 802.11 configuration in-kernel interface 12 * 802.11 configuration in-kernel interface
@@ -167,6 +169,9 @@ struct station_parameters {
167 * @STATION_INFO_LLID: @llid filled 169 * @STATION_INFO_LLID: @llid filled
168 * @STATION_INFO_PLID: @plid filled 170 * @STATION_INFO_PLID: @plid filled
169 * @STATION_INFO_PLINK_STATE: @plink_state filled 171 * @STATION_INFO_PLINK_STATE: @plink_state filled
172 * @STATION_INFO_SIGNAL: @signal filled
173 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
174 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
170 */ 175 */
171enum station_info_flags { 176enum station_info_flags {
172 STATION_INFO_INACTIVE_TIME = 1<<0, 177 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -175,6 +180,39 @@ enum station_info_flags {
175 STATION_INFO_LLID = 1<<3, 180 STATION_INFO_LLID = 1<<3,
176 STATION_INFO_PLID = 1<<4, 181 STATION_INFO_PLID = 1<<4,
177 STATION_INFO_PLINK_STATE = 1<<5, 182 STATION_INFO_PLINK_STATE = 1<<5,
183 STATION_INFO_SIGNAL = 1<<6,
184 STATION_INFO_TX_BITRATE = 1<<7,
185};
186
187/**
188 * enum station_info_rate_flags - bitrate info flags
189 *
190 * Used by the driver to indicate the specific rate transmission
191 * type for 802.11n transmissions.
192 *
193 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
194 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
195 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
196 */
197enum rate_info_flags {
198 RATE_INFO_FLAGS_MCS = 1<<0,
199 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
200 RATE_INFO_FLAGS_SHORT_GI = 1<<2,
201};
202
203/**
204 * struct rate_info - bitrate information
205 *
206 * Information about a receiving or transmitting bitrate
207 *
208 * @flags: bitflag of flags from &enum rate_info_flags
209 * @mcs: mcs index if struct describes a 802.11n bitrate
210 * @legacy: bitrate in 100kbit/s for 802.11abg
211 */
212struct rate_info {
213 u8 flags;
214 u8 mcs;
215 u16 legacy;
178}; 216};
179 217
180/** 218/**
@@ -189,6 +227,8 @@ enum station_info_flags {
189 * @llid: mesh local link id 227 * @llid: mesh local link id
190 * @plid: mesh peer link id 228 * @plid: mesh peer link id
191 * @plink_state: mesh peer link state 229 * @plink_state: mesh peer link state
230 * @signal: signal strength of last received packet in dBm
231 * @txrate: current unicast bitrate to this station
192 */ 232 */
193struct station_info { 233struct station_info {
194 u32 filled; 234 u32 filled;
@@ -198,6 +238,8 @@ struct station_info {
198 u16 llid; 238 u16 llid;
199 u16 plid; 239 u16 plid;
200 u8 plink_state; 240 u8 plink_state;
241 s8 signal;
242 struct rate_info txrate;
201}; 243};
202 244
203/** 245/**
@@ -280,11 +322,16 @@ struct mpath_info {
280 * (0 = no, 1 = yes, -1 = do not change) 322 * (0 = no, 1 = yes, -1 = do not change)
281 * @use_short_slot_time: Whether the use of short slot time is allowed 323 * @use_short_slot_time: Whether the use of short slot time is allowed
282 * (0 = no, 1 = yes, -1 = do not change) 324 * (0 = no, 1 = yes, -1 = do not change)
325 * @basic_rates: basic rates in IEEE 802.11 format
326 * (or NULL for no change)
327 * @basic_rates_len: number of basic rates
283 */ 328 */
284struct bss_parameters { 329struct bss_parameters {
285 int use_cts_prot; 330 int use_cts_prot;
286 int use_short_preamble; 331 int use_short_preamble;
287 int use_short_slot_time; 332 int use_short_slot_time;
333 u8 *basic_rates;
334 u8 basic_rates_len;
288}; 335};
289 336
290/** 337/**
@@ -331,25 +378,65 @@ struct ieee80211_regdomain {
331 struct ieee80211_reg_rule reg_rules[]; 378 struct ieee80211_reg_rule reg_rules[];
332}; 379};
333 380
334#define MHZ_TO_KHZ(freq) (freq * 1000) 381#define MHZ_TO_KHZ(freq) ((freq) * 1000)
335#define KHZ_TO_MHZ(freq) (freq / 1000) 382#define KHZ_TO_MHZ(freq) ((freq) / 1000)
336#define DBI_TO_MBI(gain) (gain * 100) 383#define DBI_TO_MBI(gain) ((gain) * 100)
337#define MBI_TO_DBI(gain) (gain / 100) 384#define MBI_TO_DBI(gain) ((gain) / 100)
338#define DBM_TO_MBM(gain) (gain * 100) 385#define DBM_TO_MBM(gain) ((gain) * 100)
339#define MBM_TO_DBM(gain) (gain / 100) 386#define MBM_TO_DBM(gain) ((gain) / 100)
340 387
341#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 388#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
342 .freq_range.start_freq_khz = (start) * 1000, \ 389 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
343 .freq_range.end_freq_khz = (end) * 1000, \ 390 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
344 .freq_range.max_bandwidth_khz = (bw) * 1000, \ 391 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
345 .power_rule.max_antenna_gain = (gain) * 100, \ 392 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
346 .power_rule.max_eirp = (eirp) * 100, \ 393 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
347 .flags = reg_flags, \ 394 .flags = reg_flags, \
348 } 395 }
349 396
397struct mesh_config {
398 /* Timeouts in ms */
399 /* Mesh plink management parameters */
400 u16 dot11MeshRetryTimeout;
401 u16 dot11MeshConfirmTimeout;
402 u16 dot11MeshHoldingTimeout;
403 u16 dot11MeshMaxPeerLinks;
404 u8 dot11MeshMaxRetries;
405 u8 dot11MeshTTL;
406 bool auto_open_plinks;
407 /* HWMP parameters */
408 u8 dot11MeshHWMPmaxPREQretries;
409 u32 path_refresh_time;
410 u16 min_discovery_timeout;
411 u32 dot11MeshHWMPactivePathTimeout;
412 u16 dot11MeshHWMPpreqMinInterval;
413 u16 dot11MeshHWMPnetDiameterTraversalTime;
414};
415
416/**
417 * struct ieee80211_txq_params - TX queue parameters
418 * @queue: TX queue identifier (NL80211_TXQ_Q_*)
419 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
420 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
421 * 1..32767]
422 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
423 * 1..32767]
424 * @aifs: Arbitration interframe space [0..255]
425 */
426struct ieee80211_txq_params {
427 enum nl80211_txq_q queue;
428 u16 txop;
429 u16 cwmin;
430 u16 cwmax;
431 u8 aifs;
432};
433
350/* from net/wireless.h */ 434/* from net/wireless.h */
351struct wiphy; 435struct wiphy;
352 436
437/* from net/ieee80211.h */
438struct ieee80211_channel;
439
353/** 440/**
354 * struct cfg80211_ops - backend description for wireless configuration 441 * struct cfg80211_ops - backend description for wireless configuration
355 * 442 *
@@ -397,9 +484,19 @@ struct wiphy;
397 * 484 *
398 * @change_station: Modify a given station. 485 * @change_station: Modify a given station.
399 * 486 *
487 * @get_mesh_params: Put the current mesh parameters into *params
488 *
489 * @set_mesh_params: Set mesh parameters.
490 * The mask is a bitfield which tells us which parameters to
491 * set, and which to leave alone.
492 *
400 * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 493 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
401 * 494 *
402 * @change_bss: Modify parameters for a given BSS. 495 * @change_bss: Modify parameters for a given BSS.
496 *
497 * @set_txq_params: Set TX queue parameters
498 *
499 * @set_channel: Set channel
403 */ 500 */
404struct cfg80211_ops { 501struct cfg80211_ops {
405 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
@@ -452,9 +549,30 @@ struct cfg80211_ops {
452 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 549 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
453 int idx, u8 *dst, u8 *next_hop, 550 int idx, u8 *dst, u8 *next_hop,
454 struct mpath_info *pinfo); 551 struct mpath_info *pinfo);
455 552 int (*get_mesh_params)(struct wiphy *wiphy,
553 struct net_device *dev,
554 struct mesh_config *conf);
555 int (*set_mesh_params)(struct wiphy *wiphy,
556 struct net_device *dev,
557 const struct mesh_config *nconf, u32 mask);
456 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 558 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
457 struct bss_parameters *params); 559 struct bss_parameters *params);
560
561 int (*set_txq_params)(struct wiphy *wiphy,
562 struct ieee80211_txq_params *params);
563
564 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type);
458}; 567};
459 568
569/* temporary wext handlers */
570int cfg80211_wext_giwname(struct net_device *dev,
571 struct iw_request_info *info,
572 char *name, char *extra);
573int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
574 u32 *mode, char *extra);
575int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
576 u32 *mode, char *extra);
577
460#endif /* __NET_CFG80211_H */ 578#endif /* __NET_CFG80211_H */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 07602b7fa218..ba55d8b8c87c 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -98,7 +98,7 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
98{ 98{
99 __be32 diff[] = { ~from, to }; 99 __be32 diff[] = { ~from, to };
100 100
101 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); 101 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
102} 102}
103 103
104static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 104static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
new file mode 100644
index 000000000000..775cfc8055be
--- /dev/null
+++ b/include/net/dcbnl.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __NET_DCBNL_H__
21#define __NET_DCBNL_H__
22
23/*
24 * Ops struct for the netlink callbacks. Used by DCB-enabled drivers through
25 * the netdevice struct.
26 */
27struct dcbnl_rtnl_ops {
28 u8 (*getstate)(struct net_device *);
29 u8 (*setstate)(struct net_device *, u8);
30 void (*getpermhwaddr)(struct net_device *, u8 *);
31 void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8);
32 void (*setpgbwgcfgtx)(struct net_device *, int, u8);
33 void (*setpgtccfgrx)(struct net_device *, int, u8, u8, u8, u8);
34 void (*setpgbwgcfgrx)(struct net_device *, int, u8);
35 void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
36 void (*getpgbwgcfgtx)(struct net_device *, int, u8 *);
37 void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *);
38 void (*getpgbwgcfgrx)(struct net_device *, int, u8 *);
39 void (*setpfccfg)(struct net_device *, int, u8);
40 void (*getpfccfg)(struct net_device *, int, u8 *);
41 u8 (*setall)(struct net_device *);
42 u8 (*getcap)(struct net_device *, int, u8 *);
43 u8 (*getnumtcs)(struct net_device *, int, u8 *);
44 u8 (*setnumtcs)(struct net_device *, int, u8);
45 u8 (*getpfcstate)(struct net_device *);
46 void (*setpfcstate)(struct net_device *, u8);
47 void (*getbcncfg)(struct net_device *, int, u32 *);
48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8);
51};
52
53#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dn.h b/include/net/dn.h
index 627778384c84..e5469f7b67a3 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -4,9 +4,7 @@
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <asm/byteorder.h> 6#include <asm/byteorder.h>
7 7#include <asm/unaligned.h>
8#define dn_ntohs(x) le16_to_cpu(x)
9#define dn_htons(x) cpu_to_le16(x)
10 8
11struct dn_scp /* Session Control Port */ 9struct dn_scp /* Session Control Port */
12{ 10{
@@ -175,7 +173,7 @@ struct dn_skb_cb {
175 173
176static inline __le16 dn_eth2dn(unsigned char *ethaddr) 174static inline __le16 dn_eth2dn(unsigned char *ethaddr)
177{ 175{
178 return dn_htons(ethaddr[4] | (ethaddr[5] << 8)); 176 return get_unaligned((__le16 *)(ethaddr + 4));
179} 177}
180 178
181static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) 179static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
@@ -185,7 +183,7 @@ static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
185 183
186static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) 184static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
187{ 185{
188 __u16 a = dn_ntohs(addr); 186 __u16 a = le16_to_cpu(addr);
189 ethaddr[0] = 0xAA; 187 ethaddr[0] = 0xAA;
190 ethaddr[1] = 0x00; 188 ethaddr[1] = 0x00;
191 ethaddr[2] = 0x04; 189 ethaddr[2] = 0x04;
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 30125119c950..c378be7bf960 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -181,9 +181,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res)
181 181
182static inline __le16 dnet_make_mask(int n) 182static inline __le16 dnet_make_mask(int n)
183{ 183{
184 if (n) 184 if (n)
185 return dn_htons(~((1<<(16-n))-1)); 185 return cpu_to_le16(~((1 << (16 - n)) - 1));
186 return 0; 186 return cpu_to_le16(0);
187} 187}
188 188
189#endif /* _NET_DN_FIB_H */ 189#endif /* _NET_DN_FIB_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 8a8b71e5f3f1..6be3b082a070 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -59,8 +59,11 @@ struct dst_entry
59 59
60 struct neighbour *neighbour; 60 struct neighbour *neighbour;
61 struct hh_cache *hh; 61 struct hh_cache *hh;
62#ifdef CONFIG_XFRM
62 struct xfrm_state *xfrm; 63 struct xfrm_state *xfrm;
63 64#else
65 void *__pad1;
66#endif
64 int (*input)(struct sk_buff*); 67 int (*input)(struct sk_buff*);
65 int (*output)(struct sk_buff*); 68 int (*output)(struct sk_buff*);
66 69
@@ -70,8 +73,20 @@ struct dst_entry
70 73
71#ifdef CONFIG_NET_CLS_ROUTE 74#ifdef CONFIG_NET_CLS_ROUTE
72 __u32 tclassid; 75 __u32 tclassid;
76#else
77 __u32 __pad2;
73#endif 78#endif
74 79
80
81 /*
82 * Align __refcnt to a 64 bytes alignment
83 * (L1_CACHE_SIZE would be too much)
84 */
85#ifdef CONFIG_64BIT
86 long __pad_to_align_refcnt[2];
87#else
88 long __pad_to_align_refcnt[1];
89#endif
75 /* 90 /*
76 * __refcnt wants to be on a different cache line from 91 * __refcnt wants to be on a different cache line from
77 * input/output/ops or performance tanks badly 92 * input/output/ops or performance tanks badly
@@ -103,7 +118,6 @@ struct dst_ops
103 void (*link_failure)(struct sk_buff *); 118 void (*link_failure)(struct sk_buff *);
104 void (*update_pmtu)(struct dst_entry *dst, u32 mtu); 119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
105 int (*local_out)(struct sk_buff *skb); 120 int (*local_out)(struct sk_buff *skb);
106 int entry_size;
107 121
108 atomic_t entries; 122 atomic_t entries;
109 struct kmem_cache *kmem_cachep; 123 struct kmem_cache *kmem_cachep;
@@ -157,6 +171,11 @@ dst_metric_locked(struct dst_entry *dst, int metric)
157 171
158static inline void dst_hold(struct dst_entry * dst) 172static inline void dst_hold(struct dst_entry * dst)
159{ 173{
174 /*
175 * If your kernel compilation stops here, please check
176 * __pad_to_align_refcnt declaration in struct dst_entry
177 */
178 BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
160 atomic_inc(&dst->__refcnt); 179 atomic_inc(&dst->__refcnt);
161} 180}
162 181
@@ -272,21 +291,21 @@ enum {
272 291
273struct flowi; 292struct flowi;
274#ifndef CONFIG_XFRM 293#ifndef CONFIG_XFRM
275static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 294static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
276 struct sock *sk, int flags) 295 struct flowi *fl, struct sock *sk, int flags)
277{ 296{
278 return 0; 297 return 0;
279} 298}
280static inline int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 299static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
281 struct sock *sk, int flags) 300 struct flowi *fl, struct sock *sk, int flags)
282{ 301{
283 return 0; 302 return 0;
284} 303}
285#else 304#else
286extern int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 305extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
287 struct sock *sk, int flags); 306 struct flowi *fl, struct sock *sk, int flags);
288extern int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, 307extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
289 struct sock *sk, int flags); 308 struct flowi *fl, struct sock *sk, int flags);
290#endif 309#endif
291#endif 310#endif
292 311
diff --git a/include/net/flow.h b/include/net/flow.h
index b45a5e4fcadd..809970b7dfee 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -84,12 +84,13 @@ struct flowi {
84#define FLOW_DIR_OUT 1 84#define FLOW_DIR_OUT 1
85#define FLOW_DIR_FWD 2 85#define FLOW_DIR_FWD 2
86 86
87struct net;
87struct sock; 88struct sock;
88typedef int (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family,
89 void **objp, atomic_t **obj_refp); 90 u8 dir, void **objp, atomic_t **obj_refp);
90 91
91extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
92 flow_resolve_t resolver); 93 u8 dir, flow_resolve_t resolver);
93extern void flow_cache_flush(void); 94extern void flow_cache_flush(void);
94extern atomic_t flow_cache_genid; 95extern atomic_t flow_cache_genid;
95 96
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index 8cd8185fa2ed..d136b5240ef2 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -45,5 +45,6 @@ extern void gen_kill_estimator(struct gnet_stats_basic *bstats,
45extern int gen_replace_estimator(struct gnet_stats_basic *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48 48extern bool gen_estimator_active(const struct gnet_stats_basic *bstats,
49 const struct gnet_stats_rate_est *rate_est);
49#endif 50#endif
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 93a56de3594b..adb7cf31f781 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -28,6 +28,9 @@
28#include <linux/if_ether.h> /* ETH_ALEN */ 28#include <linux/if_ether.h> /* ETH_ALEN */
29#include <linux/kernel.h> /* ARRAY_SIZE */ 29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h> 30#include <linux/wireless.h>
31#include <linux/ieee80211.h>
32
33#include <net/lib80211.h>
31 34
32#define IEEE80211_VERSION "git-1.1.13" 35#define IEEE80211_VERSION "git-1.1.13"
33 36
@@ -127,10 +130,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level)
127} 130}
128#endif /* CONFIG_IEEE80211_DEBUG */ 131#endif /* CONFIG_IEEE80211_DEBUG */
129 132
130/* escape_essid() is intended to be used in debug (and possibly error)
131 * messages. It should never be used for passing essid to user space. */
132const char *escape_essid(const char *essid, u8 essid_len);
133
134/* 133/*
135 * To use the debug system: 134 * To use the debug system:
136 * 135 *
@@ -218,94 +217,6 @@ struct ieee80211_snap_hdr {
218#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) 217#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
219#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) 218#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
220 219
221/* Authentication algorithms */
222#define WLAN_AUTH_OPEN 0
223#define WLAN_AUTH_SHARED_KEY 1
224#define WLAN_AUTH_LEAP 2
225
226#define WLAN_AUTH_CHALLENGE_LEN 128
227
228#define WLAN_CAPABILITY_ESS (1<<0)
229#define WLAN_CAPABILITY_IBSS (1<<1)
230#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
231#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
232#define WLAN_CAPABILITY_PRIVACY (1<<4)
233#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
234#define WLAN_CAPABILITY_PBCC (1<<6)
235#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
236#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
237#define WLAN_CAPABILITY_QOS (1<<9)
238#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
239#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
240
241/* 802.11g ERP information element */
242#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
243#define WLAN_ERP_USE_PROTECTION (1<<1)
244#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
245
246/* Status codes */
247enum ieee80211_statuscode {
248 WLAN_STATUS_SUCCESS = 0,
249 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
250 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
251 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
252 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
253 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
254 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
255 WLAN_STATUS_CHALLENGE_FAIL = 15,
256 WLAN_STATUS_AUTH_TIMEOUT = 16,
257 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
258 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
259 /* 802.11b */
260 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
261 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
262 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
263 /* 802.11h */
264 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
265 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
266 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
267 /* 802.11g */
268 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
269 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
270 /* 802.11i */
271 WLAN_STATUS_INVALID_IE = 40,
272 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
273 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
274 WLAN_STATUS_INVALID_AKMP = 43,
275 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
276 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
277 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
278};
279
280/* Reason codes */
281enum ieee80211_reasoncode {
282 WLAN_REASON_UNSPECIFIED = 1,
283 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
284 WLAN_REASON_DEAUTH_LEAVING = 3,
285 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
286 WLAN_REASON_DISASSOC_AP_BUSY = 5,
287 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
288 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
289 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
290 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
291 /* 802.11h */
292 WLAN_REASON_DISASSOC_BAD_POWER = 10,
293 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
294 /* 802.11i */
295 WLAN_REASON_INVALID_IE = 13,
296 WLAN_REASON_MIC_FAILURE = 14,
297 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
298 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
299 WLAN_REASON_IE_DIFFERENT = 17,
300 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
301 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
302 WLAN_REASON_INVALID_AKMP = 20,
303 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
304 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
305 WLAN_REASON_IEEE8021X_FAILED = 23,
306 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
307};
308
309/* Action categories - 802.11h */ 220/* Action categories - 802.11h */
310enum ieee80211_actioncategories { 221enum ieee80211_actioncategories {
311 WLAN_ACTION_SPECTRUM_MGMT = 0, 222 WLAN_ACTION_SPECTRUM_MGMT = 0,
@@ -446,8 +357,6 @@ struct ieee80211_stats {
446 357
447struct ieee80211_device; 358struct ieee80211_device;
448 359
449#include "ieee80211_crypt.h"
450
451#define SEC_KEY_1 (1<<0) 360#define SEC_KEY_1 (1<<0)
452#define SEC_KEY_2 (1<<1) 361#define SEC_KEY_2 (1<<1)
453#define SEC_KEY_3 (1<<2) 362#define SEC_KEY_3 (1<<2)
@@ -476,9 +385,8 @@ struct ieee80211_device;
476#define SCM_TEMPORAL_KEY_LENGTH 16 385#define SCM_TEMPORAL_KEY_LENGTH 16
477 386
478struct ieee80211_security { 387struct ieee80211_security {
479 u16 active_key:2, 388 u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
480 enabled:1, 389 u8 auth_mode;
481 auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1;
482 u8 encode_alg[WEP_KEYS]; 390 u8 encode_alg[WEP_KEYS];
483 u8 key_sizes[WEP_KEYS]; 391 u8 key_sizes[WEP_KEYS];
484 u8 keys[WEP_KEYS][SCM_KEY_LEN]; 392 u8 keys[WEP_KEYS][SCM_KEY_LEN];
@@ -534,15 +442,6 @@ enum ieee80211_mfie {
534 MFIE_TYPE_QOS_PARAMETER = 222, 442 MFIE_TYPE_QOS_PARAMETER = 222,
535}; 443};
536 444
537/* Minimal header; can be used for passing 802.11 frames with sufficient
538 * information to determine what type of underlying data type is actually
539 * stored in the data. */
540struct ieee80211_hdr {
541 __le16 frame_ctl;
542 __le16 duration_id;
543 u8 payload[0];
544} __attribute__ ((packed));
545
546struct ieee80211_hdr_1addr { 445struct ieee80211_hdr_1addr {
547 __le16 frame_ctl; 446 __le16 frame_ctl;
548 __le16 duration_id; 447 __le16 duration_id;
@@ -590,18 +489,6 @@ struct ieee80211_hdr_3addrqos {
590 __le16 qos_ctl; 489 __le16 qos_ctl;
591} __attribute__ ((packed)); 490} __attribute__ ((packed));
592 491
593struct ieee80211_hdr_4addrqos {
594 __le16 frame_ctl;
595 __le16 duration_id;
596 u8 addr1[ETH_ALEN];
597 u8 addr2[ETH_ALEN];
598 u8 addr3[ETH_ALEN];
599 __le16 seq_ctl;
600 u8 addr4[ETH_ALEN];
601 u8 payload[0];
602 __le16 qos_ctl;
603} __attribute__ ((packed));
604
605struct ieee80211_info_element { 492struct ieee80211_info_element {
606 u8 id; 493 u8 id;
607 u8 len; 494 u8 len;
@@ -733,7 +620,6 @@ struct ieee80211_txb {
733 620
734#define MAX_WPA_IE_LEN 64 621#define MAX_WPA_IE_LEN 64
735 622
736#define NETWORK_EMPTY_ESSID (1<<0)
737#define NETWORK_HAS_OFDM (1<<1) 623#define NETWORK_HAS_OFDM (1<<1)
738#define NETWORK_HAS_CCK (1<<2) 624#define NETWORK_HAS_CCK (1<<2)
739 625
@@ -1050,11 +936,7 @@ struct ieee80211_device {
1050 size_t wpa_ie_len; 936 size_t wpa_ie_len;
1051 u8 *wpa_ie; 937 u8 *wpa_ie;
1052 938
1053 struct list_head crypt_deinit_list; 939 struct lib80211_crypt_info crypt_info;
1054 struct ieee80211_crypt_data *crypt[WEP_KEYS];
1055 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
1056 struct timer_list crypt_deinit_timer;
1057 int crypt_quiesced;
1058 940
1059 int bcrx_sta_key; /* use individual keys to override default keys even 941 int bcrx_sta_key; /* use individual keys to override default keys even
1060 * with RX of broad/multicast frames */ 942 * with RX of broad/multicast frames */
@@ -1135,22 +1017,6 @@ static inline void *ieee80211_priv(struct net_device *dev)
1135 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 1017 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1136} 1018}
1137 1019
1138static inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
1139{
1140 /* Single white space is for Linksys APs */
1141 if (essid_len == 1 && essid[0] == ' ')
1142 return 1;
1143
1144 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1145 while (essid_len) {
1146 essid_len--;
1147 if (essid[essid_len] != '\0')
1148 return 0;
1149 }
1150
1151 return 1;
1152}
1153
1154static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, 1020static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1155 int mode) 1021 int mode)
1156{ 1022{
@@ -1208,7 +1074,7 @@ static inline int ieee80211_get_hdrlen(u16 fc)
1208 1074
1209static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) 1075static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1210{ 1076{
1211 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { 1077 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1212 case IEEE80211_1ADDR_LEN: 1078 case IEEE80211_1ADDR_LEN:
1213 return ((struct ieee80211_hdr_1addr *)hdr)->payload; 1079 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1214 case IEEE80211_2ADDR_LEN: 1080 case IEEE80211_2ADDR_LEN:
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index d364fd594ea4..384698cb773a 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -1,7 +1,4 @@
1/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ 1/*
2/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */
3
4/*-
5 * Copyright (c) 2003, 2004 David Young. All rights reserved. 2 * Copyright (c) 2003, 2004 David Young. All rights reserved.
6 * 3 *
7 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
@@ -42,8 +39,6 @@
42#include <linux/kernel.h> 39#include <linux/kernel.h>
43#include <asm/unaligned.h> 40#include <asm/unaligned.h>
44 41
45/* Radiotap header version (from official NetBSD feed) */
46#define IEEE80211RADIOTAP_VERSION "1.5"
47/* Base version of the radiotap packet header data */ 42/* Base version of the radiotap packet header data */
48#define PKTHDR_RADIOTAP_VERSION 0 43#define PKTHDR_RADIOTAP_VERSION 0
49 44
@@ -62,12 +57,8 @@
62 * readers. 57 * readers.
63 */ 58 */
64 59
65/* XXX tcpdump/libpcap do not tolerate variable-length headers, 60/*
66 * yet, so we pad every radiotap header to 64 bytes. Ugh. 61 * The radio capture header precedes the 802.11 header.
67 */
68#define IEEE80211_RADIOTAP_HDRLEN 64
69
70/* The radio capture header precedes the 802.11 header.
71 * All data in the header is little endian on all platforms. 62 * All data in the header is little endian on all platforms.
72 */ 63 */
73struct ieee80211_radiotap_header { 64struct ieee80211_radiotap_header {
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 5cc182f9ecae..f44bb5c77a70 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -41,8 +41,8 @@
41 * I'll experiment with dynamic table growth later. 41 * I'll experiment with dynamic table growth later.
42 */ 42 */
43struct inet_ehash_bucket { 43struct inet_ehash_bucket {
44 struct hlist_head chain; 44 struct hlist_nulls_head chain;
45 struct hlist_head twchain; 45 struct hlist_nulls_head twchain;
46}; 46};
47 47
48/* There are a few simple rules, which allow for local port reuse by 48/* There are a few simple rules, which allow for local port reuse by
@@ -77,13 +77,20 @@ struct inet_ehash_bucket {
77 * ports are created in O(1) time? I thought so. ;-) -DaveM 77 * ports are created in O(1) time? I thought so. ;-) -DaveM
78 */ 78 */
79struct inet_bind_bucket { 79struct inet_bind_bucket {
80#ifdef CONFIG_NET_NS
80 struct net *ib_net; 81 struct net *ib_net;
82#endif
81 unsigned short port; 83 unsigned short port;
82 signed short fastreuse; 84 signed short fastreuse;
83 struct hlist_node node; 85 struct hlist_node node;
84 struct hlist_head owners; 86 struct hlist_head owners;
85}; 87};
86 88
89static inline struct net *ib_net(struct inet_bind_bucket *ib)
90{
91 return read_pnet(&ib->ib_net);
92}
93
87#define inet_bind_bucket_for_each(tb, node, head) \ 94#define inet_bind_bucket_for_each(tb, node, head) \
88 hlist_for_each_entry(tb, node, head, node) 95 hlist_for_each_entry(tb, node, head, node)
89 96
@@ -92,6 +99,18 @@ struct inet_bind_hashbucket {
92 struct hlist_head chain; 99 struct hlist_head chain;
93}; 100};
94 101
102/*
103 * Sockets can be hashed in established or listening table
104 * We must use different 'nulls' end-of-chain value for listening
105 * hash table, or we might find a socket that was closed and
106 * reallocated/inserted into established hash table
107 */
108#define LISTENING_NULLS_BASE (1U << 29)
109struct inet_listen_hashbucket {
110 spinlock_t lock;
111 struct hlist_nulls_head head;
112};
113
95/* This is for listening sockets, thus all sockets which possess wildcards. */ 114/* This is for listening sockets, thus all sockets which possess wildcards. */
96#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */ 115#define INET_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */
97 116
@@ -104,7 +123,7 @@ struct inet_hashinfo {
104 * TIME_WAIT sockets use a separate chain (twchain). 123 * TIME_WAIT sockets use a separate chain (twchain).
105 */ 124 */
106 struct inet_ehash_bucket *ehash; 125 struct inet_ehash_bucket *ehash;
107 rwlock_t *ehash_locks; 126 spinlock_t *ehash_locks;
108 unsigned int ehash_size; 127 unsigned int ehash_size;
109 unsigned int ehash_locks_mask; 128 unsigned int ehash_locks_mask;
110 129
@@ -116,22 +135,21 @@ struct inet_hashinfo {
116 unsigned int bhash_size; 135 unsigned int bhash_size;
117 /* Note : 4 bytes padding on 64 bit arches */ 136 /* Note : 4 bytes padding on 64 bit arches */
118 137
119 /* All sockets in TCP_LISTEN state will be in here. This is the only 138 struct kmem_cache *bind_bucket_cachep;
120 * table where wildcard'd TCP sockets can exist. Hash function here
121 * is just local port number.
122 */
123 struct hlist_head listening_hash[INET_LHTABLE_SIZE];
124 139
125 /* All the above members are written once at bootup and 140 /* All the above members are written once at bootup and
126 * never written again _or_ are predominantly read-access. 141 * never written again _or_ are predominantly read-access.
127 * 142 *
128 * Now align to a new cache line as all the following members 143 * Now align to a new cache line as all the following members
129 * are often dirty. 144 * might be often dirty.
130 */ 145 */
131 rwlock_t lhash_lock ____cacheline_aligned; 146 /* All sockets in TCP_LISTEN state will be in here. This is the only
132 atomic_t lhash_users; 147 * table where wildcard'd TCP sockets can exist. Hash function here
133 wait_queue_head_t lhash_wait; 148 * is just local port number.
134 struct kmem_cache *bind_bucket_cachep; 149 */
150 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
151 ____cacheline_aligned_in_smp;
152
135}; 153};
136 154
137static inline struct inet_ehash_bucket *inet_ehash_bucket( 155static inline struct inet_ehash_bucket *inet_ehash_bucket(
@@ -141,7 +159,7 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket(
141 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; 159 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
142} 160}
143 161
144static inline rwlock_t *inet_ehash_lockp( 162static inline spinlock_t *inet_ehash_lockp(
145 struct inet_hashinfo *hashinfo, 163 struct inet_hashinfo *hashinfo,
146 unsigned int hash) 164 unsigned int hash)
147{ 165{
@@ -166,16 +184,16 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
166 size = 4096; 184 size = 4096;
167 if (sizeof(rwlock_t) != 0) { 185 if (sizeof(rwlock_t) != 0) {
168#ifdef CONFIG_NUMA 186#ifdef CONFIG_NUMA
169 if (size * sizeof(rwlock_t) > PAGE_SIZE) 187 if (size * sizeof(spinlock_t) > PAGE_SIZE)
170 hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t)); 188 hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
171 else 189 else
172#endif 190#endif
173 hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t), 191 hashinfo->ehash_locks = kmalloc(size * sizeof(spinlock_t),
174 GFP_KERNEL); 192 GFP_KERNEL);
175 if (!hashinfo->ehash_locks) 193 if (!hashinfo->ehash_locks)
176 return ENOMEM; 194 return ENOMEM;
177 for (i = 0; i < size; i++) 195 for (i = 0; i < size; i++)
178 rwlock_init(&hashinfo->ehash_locks[i]); 196 spin_lock_init(&hashinfo->ehash_locks[i]);
179 } 197 }
180 hashinfo->ehash_locks_mask = size - 1; 198 hashinfo->ehash_locks_mask = size - 1;
181 return 0; 199 return 0;
@@ -186,7 +204,7 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
186 if (hashinfo->ehash_locks) { 204 if (hashinfo->ehash_locks) {
187#ifdef CONFIG_NUMA 205#ifdef CONFIG_NUMA
188 unsigned int size = (hashinfo->ehash_locks_mask + 1) * 206 unsigned int size = (hashinfo->ehash_locks_mask + 1) *
189 sizeof(rwlock_t); 207 sizeof(spinlock_t);
190 if (size > PAGE_SIZE) 208 if (size > PAGE_SIZE)
191 vfree(hashinfo->ehash_locks); 209 vfree(hashinfo->ehash_locks);
192 else 210 else
@@ -229,26 +247,7 @@ extern void __inet_inherit_port(struct sock *sk, struct sock *child);
229 247
230extern void inet_put_port(struct sock *sk); 248extern void inet_put_port(struct sock *sk);
231 249
232extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); 250void inet_hashinfo_init(struct inet_hashinfo *h);
233
234/*
235 * - We may sleep inside this lock.
236 * - If sleeping is not required (or called from BH),
237 * use plain read_(un)lock(&inet_hashinfo.lhash_lock).
238 */
239static inline void inet_listen_lock(struct inet_hashinfo *hashinfo)
240{
241 /* read_lock synchronizes to candidates to writers */
242 read_lock(&hashinfo->lhash_lock);
243 atomic_inc(&hashinfo->lhash_users);
244 read_unlock(&hashinfo->lhash_lock);
245}
246
247static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
248{
249 if (atomic_dec_and_test(&hashinfo->lhash_users))
250 wake_up(&hashinfo->lhash_wait);
251}
252 251
253extern void __inet_hash_nolisten(struct sock *sk); 252extern void __inet_hash_nolisten(struct sock *sk);
254extern void inet_hash(struct sock *sk); 253extern void inet_hash(struct sock *sk);
@@ -299,25 +298,25 @@ typedef __u64 __bitwise __addrpair;
299 ((__force __u64)(__be32)(__saddr))); 298 ((__force __u64)(__be32)(__saddr)));
300#endif /* __BIG_ENDIAN */ 299#endif /* __BIG_ENDIAN */
301#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 300#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
302 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 301 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
303 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 302 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
304 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 303 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
305 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 304 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
306#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 305#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
307 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 306 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
308 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 307 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
309 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 308 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
310 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 309 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
311#else /* 32-bit arch */ 310#else /* 32-bit arch */
312#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 311#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
313#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 312#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
314 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 313 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
315 (inet_sk(__sk)->daddr == (__saddr)) && \ 314 (inet_sk(__sk)->daddr == (__saddr)) && \
316 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 315 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
317 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 316 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
318 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 317 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
319#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 318#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
320 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 319 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
321 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 320 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
322 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 321 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
323 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 322 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 80e4977631b8..4b8ece22b8e9 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -110,7 +110,7 @@ struct inet_timewait_sock {
110#define tw_state __tw_common.skc_state 110#define tw_state __tw_common.skc_state
111#define tw_reuse __tw_common.skc_reuse 111#define tw_reuse __tw_common.skc_reuse
112#define tw_bound_dev_if __tw_common.skc_bound_dev_if 112#define tw_bound_dev_if __tw_common.skc_bound_dev_if
113#define tw_node __tw_common.skc_node 113#define tw_node __tw_common.skc_nulls_node
114#define tw_bind_node __tw_common.skc_bind_node 114#define tw_bind_node __tw_common.skc_bind_node
115#define tw_refcnt __tw_common.skc_refcnt 115#define tw_refcnt __tw_common.skc_refcnt
116#define tw_hash __tw_common.skc_hash 116#define tw_hash __tw_common.skc_hash
@@ -137,10 +137,10 @@ struct inet_timewait_sock {
137 struct hlist_node tw_death_node; 137 struct hlist_node tw_death_node;
138}; 138};
139 139
140static inline void inet_twsk_add_node(struct inet_timewait_sock *tw, 140static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
141 struct hlist_head *list) 141 struct hlist_nulls_head *list)
142{ 142{
143 hlist_add_head(&tw->tw_node, list); 143 hlist_nulls_add_head_rcu(&tw->tw_node, list);
144} 144}
145 145
146static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, 146static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
@@ -175,7 +175,7 @@ static inline int inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
175} 175}
176 176
177#define inet_twsk_for_each(tw, node, head) \ 177#define inet_twsk_for_each(tw, node, head) \
178 hlist_for_each_entry(tw, node, head, tw_node) 178 hlist_nulls_for_each_entry(tw, node, head, tw_node)
179 179
180#define inet_twsk_for_each_inmate(tw, node, jail) \ 180#define inet_twsk_for_each_inmate(tw, node, jail) \
181 hlist_for_each_entry(tw, node, jail, tw_death_node) 181 hlist_for_each_entry(tw, node, jail, tw_death_node)
diff --git a/include/net/ip.h b/include/net/ip.h
index bc026ecb513f..10868139e656 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -110,7 +110,7 @@ extern int ip_append_data(struct sock *sk,
110 int odd, struct sk_buff *skb), 110 int odd, struct sk_buff *skb),
111 void *from, int len, int protolen, 111 void *from, int len, int protolen,
112 struct ipcm_cookie *ipc, 112 struct ipcm_cookie *ipc,
113 struct rtable *rt, 113 struct rtable **rt,
114 unsigned int flags); 114 unsigned int flags);
115extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 115extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb);
116extern ssize_t ip_append_page(struct sock *sk, struct page *page, 116extern ssize_t ip_append_page(struct sock *sk, struct page *page,
@@ -187,6 +187,7 @@ extern void inet_get_local_port_range(int *low, int *high);
187extern int sysctl_ip_default_ttl; 187extern int sysctl_ip_default_ttl;
188extern int sysctl_ip_nonlocal_bind; 188extern int sysctl_ip_nonlocal_bind;
189 189
190extern struct ctl_path net_core_path[];
190extern struct ctl_path net_ipv4_ctl_path[]; 191extern struct ctl_path net_ipv4_ctl_path[];
191 192
192/* From inetpeer.c */ 193/* From inetpeer.c */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index fe9fcf73c85e..ab9b003ab671 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -87,12 +87,12 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
87 int len; 87 int len;
88#ifdef CONFIG_IP_VS_IPV6 88#ifdef CONFIG_IP_VS_IPV6
89 if (af == AF_INET6) 89 if (af == AF_INET6)
90 len = snprintf(&buf[*idx], buf_len - *idx, "[" NIP6_FMT "]", 90 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6]",
91 NIP6(addr->in6)) + 1; 91 &addr->in6) + 1;
92 else 92 else
93#endif 93#endif
94 len = snprintf(&buf[*idx], buf_len - *idx, NIPQUAD_FMT, 94 len = snprintf(&buf[*idx], buf_len - *idx, "%pI4",
95 NIPQUAD(addr->ip)) + 1; 95 &addr->ip) + 1;
96 96
97 *idx += len; 97 *idx += len;
98 BUG_ON(*idx > buf_len + 1); 98 BUG_ON(*idx > buf_len + 1);
@@ -503,9 +503,6 @@ struct ip_vs_scheduler {
503 char *name; /* scheduler name */ 503 char *name; /* scheduler name */
504 atomic_t refcnt; /* reference counter */ 504 atomic_t refcnt; /* reference counter */
505 struct module *module; /* THIS_MODULE/NULL */ 505 struct module *module; /* THIS_MODULE/NULL */
506#ifdef CONFIG_IP_VS_IPV6
507 int supports_ipv6; /* scheduler has IPv6 support */
508#endif
509 506
510 /* scheduler initializing service */ 507 /* scheduler initializing service */
511 int (*init_service)(struct ip_vs_service *svc); 508 int (*init_service)(struct ip_vs_service *svc);
@@ -916,7 +913,7 @@ static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
916{ 913{
917 __be32 diff[2] = { ~old, new }; 914 __be32 diff[2] = { ~old, new };
918 915
919 return csum_partial((char *) diff, sizeof(diff), oldsum); 916 return csum_partial(diff, sizeof(diff), oldsum);
920} 917}
921 918
922#ifdef CONFIG_IP_VS_IPV6 919#ifdef CONFIG_IP_VS_IPV6
@@ -926,7 +923,7 @@ static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new,
926 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0], 923 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0],
927 new[3], new[2], new[1], new[0] }; 924 new[3], new[2], new[1], new[0] };
928 925
929 return csum_partial((char *) diff, sizeof(diff), oldsum); 926 return csum_partial(diff, sizeof(diff), oldsum);
930} 927}
931#endif 928#endif
932 929
@@ -934,7 +931,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
934{ 931{
935 __be16 diff[2] = { ~old, new }; 932 __be16 diff[2] = { ~old, new };
936 933
937 return csum_partial((char *) diff, sizeof(diff), oldsum); 934 return csum_partial(diff, sizeof(diff), oldsum);
938} 935}
939 936
940#endif /* __KERNEL__ */ 937#endif /* __KERNEL__ */
diff --git a/include/net/ieee80211_crypt.h b/include/net/lib80211.h
index b3d65e0bedd3..fb4e2784857d 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/lib80211.h
@@ -1,4 +1,11 @@
1/* 1/*
2 * lib80211.h -- common bits for IEEE802.11 wireless drivers
3 *
4 * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com>
5 *
6 * Some bits copied from old ieee80211 component, w/ original copyright
7 * notices below:
8 *
2 * Original code based on Host AP (software wireless LAN access point) driver 9 * Original code based on Host AP (software wireless LAN access point) driver
3 * for Intersil Prism2/2.5/3. 10 * for Intersil Prism2/2.5/3.
4 * 11 *
@@ -11,31 +18,31 @@
11 * 18 *
12 * Copyright (c) 2004, Intel Corporation 19 * Copyright (c) 2004, Intel Corporation
13 * 20 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. See README and COPYING for
17 * more details.
18 */ 21 */
19 22
20/* 23#ifndef LIB80211_H
21 * This file defines the interface to the ieee80211 crypto module. 24#define LIB80211_H
22 */
23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/ieee80211.h> 28#include <linux/module.h>
29#include <asm/atomic.h> 29#include <asm/atomic.h>
30#include <linux/if.h>
31#include <linux/skbuff.h>
32#include <linux/ieee80211.h>
33#include <linux/timer.h>
34/* print_ssid() is intended to be used in debug (and possibly error)
35 * messages. It should never be used for passing ssid to user space. */
36const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
37#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
38
39#define NUM_WEP_KEYS 4
30 40
31enum { 41enum {
32 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 42 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
33}; 43};
34 44
35struct sk_buff; 45struct lib80211_crypto_ops {
36struct module;
37
38struct ieee80211_crypto_ops {
39 const char *name; 46 const char *name;
40 struct list_head list; 47 struct list_head list;
41 48
@@ -87,22 +94,36 @@ struct ieee80211_crypto_ops {
87 struct module *owner; 94 struct module *owner;
88}; 95};
89 96
90struct ieee80211_crypt_data { 97struct lib80211_crypt_data {
91 struct list_head list; /* delayed deletion list */ 98 struct list_head list; /* delayed deletion list */
92 struct ieee80211_crypto_ops *ops; 99 struct lib80211_crypto_ops *ops;
93 void *priv; 100 void *priv;
94 atomic_t refcnt; 101 atomic_t refcnt;
95}; 102};
96 103
97struct ieee80211_device; 104struct lib80211_crypt_info {
98 105 char *name;
99int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 106 /* Most clients will already have a lock,
100int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 107 so just point to that. */
101struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); 108 spinlock_t *lock;
102void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); 109
103void ieee80211_crypt_deinit_handler(unsigned long); 110 struct lib80211_crypt_data *crypt[NUM_WEP_KEYS];
104void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 111 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
105 struct ieee80211_crypt_data **crypt); 112 struct list_head crypt_deinit_list;
106void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); 113 struct timer_list crypt_deinit_timer;
114 int crypt_quiesced;
115};
107 116
108#endif 117int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
118 spinlock_t *lock);
119void lib80211_crypt_info_free(struct lib80211_crypt_info *info);
120int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops);
121int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
122struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name);
123void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *, int);
124void lib80211_crypt_deinit_handler(unsigned long);
125void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info,
126 struct lib80211_crypt_data **crypt);
127void lib80211_crypt_quiescing(struct lib80211_crypt_info *info);
128
129#endif /* LIB80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 73d81bc6aa75..b3bd00a9d992 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2002-2005, Devicescape Software, Inc. 4 * Copyright 2002-2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -107,7 +107,7 @@ enum ieee80211_max_queues {
107 * The information provided in this structure is required for QoS 107 * The information provided in this structure is required for QoS
108 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. 108 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
109 * 109 *
110 * @aifs: arbitration interface space [0..255] 110 * @aifs: arbitration interframe space [0..255]
111 * @cw_min: minimum contention window [a value of the form 111 * @cw_min: minimum contention window [a value of the form
112 * 2^n-1 in the range 1..32767] 112 * 2^n-1 in the range 1..32767]
113 * @cw_max: maximum contention window [like @cw_min] 113 * @cw_max: maximum contention window [like @cw_min]
@@ -164,6 +164,14 @@ enum ieee80211_bss_change {
164}; 164};
165 165
166/** 166/**
167 * struct ieee80211_bss_ht_conf - BSS's changing HT configuration
168 * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info)
169 */
170struct ieee80211_bss_ht_conf {
171 u16 operation_mode;
172};
173
174/**
167 * struct ieee80211_bss_conf - holds the BSS's changing parameters 175 * struct ieee80211_bss_conf - holds the BSS's changing parameters
168 * 176 *
169 * This structure keeps information about a BSS (and an association 177 * This structure keeps information about a BSS (and an association
@@ -172,15 +180,17 @@ enum ieee80211_bss_change {
172 * @assoc: association status 180 * @assoc: association status
173 * @aid: association ID number, valid only when @assoc is true 181 * @aid: association ID number, valid only when @assoc is true
174 * @use_cts_prot: use CTS protection 182 * @use_cts_prot: use CTS protection
175 * @use_short_preamble: use 802.11b short preamble 183 * @use_short_preamble: use 802.11b short preamble;
176 * @use_short_slot: use short slot time (only relevant for ERP) 184 * if the hardware cannot handle this it must set the
185 * IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
186 * @use_short_slot: use short slot time (only relevant for ERP);
187 * if the hardware cannot handle this it must set the
188 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
177 * @dtim_period: num of beacons before the next DTIM, for PSM 189 * @dtim_period: num of beacons before the next DTIM, for PSM
178 * @timestamp: beacon timestamp 190 * @timestamp: beacon timestamp
179 * @beacon_int: beacon interval 191 * @beacon_int: beacon interval
180 * @assoc_capability: capabilities taken from assoc resp 192 * @assoc_capability: capabilities taken from assoc resp
181 * @assoc_ht: association in HT mode 193 * @ht: BSS's HT configuration
182 * @ht_conf: ht capabilities
183 * @ht_bss_conf: ht extended capabilities
184 * @basic_rates: bitmap of basic rates, each bit stands for an 194 * @basic_rates: bitmap of basic rates, each bit stands for an
185 * index into the rate table configured by the driver in 195 * index into the rate table configured by the driver in
186 * the current band. 196 * the current band.
@@ -198,10 +208,7 @@ struct ieee80211_bss_conf {
198 u16 assoc_capability; 208 u16 assoc_capability;
199 u64 timestamp; 209 u64 timestamp;
200 u64 basic_rates; 210 u64 basic_rates;
201 /* ht related data */ 211 struct ieee80211_bss_ht_conf ht;
202 bool assoc_ht;
203 struct ieee80211_ht_info *ht_conf;
204 struct ieee80211_ht_bss_info *ht_bss_conf;
205}; 212};
206 213
207/** 214/**
@@ -210,29 +217,24 @@ struct ieee80211_bss_conf {
210 * These flags are used with the @flags member of &ieee80211_tx_info. 217 * These flags are used with the @flags member of &ieee80211_tx_info.
211 * 218 *
212 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. 219 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
213 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame 220 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
214 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 221 * number to this frame, taking care of not overwriting the fragment
215 * for combined 802.11g / 802.11b networks) 222 * number and increasing the sequence number only when the
223 * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
224 * assign sequence numbers to QoS-data frames but cannot do so correctly
225 * for non-QoS-data and management frames because beacons need them from
226 * that counter as well and mac80211 cannot guarantee proper sequencing.
227 * If this flag is set, the driver should instruct the hardware to
228 * assign a sequence number to the frame or assign one itself. Cf. IEEE
229 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
230 * beacons and always be clear for frames without a sequence number field.
216 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack 231 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
217 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: TBD
218 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination 232 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
219 * station 233 * station
220 * @IEEE80211_TX_CTL_REQUEUE: TBD
221 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame 234 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
222 * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD
223 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
224 * through set_retry_limit configured long retry value
225 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 235 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
226 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 236 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
227 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 237 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
228 * of streams when this flag is on can be extracted from antenna_sel_tx,
229 * so if 1 antenna is marked use SISO, 2 antennas marked use MIMO, n
230 * antennas marked use MIMO_n.
231 * @IEEE80211_TX_CTL_GREEN_FIELD: use green field protection for this frame
232 * @IEEE80211_TX_CTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
233 * @IEEE80211_TX_CTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
234 * @IEEE80211_TX_CTL_SHORT_GI: send this frame using short guard interval
235 * @IEEE80211_TX_CTL_INJECTED: TBD
236 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 238 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
237 * because the destination STA was in powersave mode. 239 * because the destination STA was in powersave mode.
238 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 240 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
@@ -240,63 +242,67 @@ struct ieee80211_bss_conf {
240 * is for the whole aggregation. 242 * is for the whole aggregation.
241 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, 243 * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
242 * so consider using block ack request (BAR). 244 * so consider using block ack request (BAR).
243 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence 245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
244 * number to this frame, taking care of not overwriting the fragment 246 * set by rate control algorithms to indicate probe rate, will
245 * number and increasing the sequence number only when the 247 * be cleared for fragmented frames (except on the last fragment)
246 * IEEE80211_TX_CTL_FIRST_FRAGMENT flags is set. mac80211 will properly
247 * assign sequence numbers to QoS-data frames but cannot do so correctly
248 * for non-QoS-data and management frames because beacons need them from
249 * that counter as well and mac80211 cannot guarantee proper sequencing.
250 * If this flag is set, the driver should instruct the hardware to
251 * assign a sequence number to the frame or assign one itself. Cf. IEEE
252 * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
253 * beacons always be clear for frames without a sequence number field.
254 */ 248 */
255enum mac80211_tx_control_flags { 249enum mac80211_tx_control_flags {
256 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
257 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2), 251 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1),
258 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3), 252 IEEE80211_TX_CTL_NO_ACK = BIT(2),
259 IEEE80211_TX_CTL_NO_ACK = BIT(4), 253 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3),
260 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5), 254 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4),
261 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6), 255 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5),
262 IEEE80211_TX_CTL_REQUEUE = BIT(7), 256 IEEE80211_TX_CTL_AMPDU = BIT(6),
263 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8), 257 IEEE80211_TX_CTL_INJECTED = BIT(7),
264 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9), 258 IEEE80211_TX_STAT_TX_FILTERED = BIT(8),
265 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10), 259 IEEE80211_TX_STAT_ACK = BIT(9),
266 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12), 260 IEEE80211_TX_STAT_AMPDU = BIT(10),
267 IEEE80211_TX_CTL_AMPDU = BIT(13), 261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
268 IEEE80211_TX_CTL_OFDM_HT = BIT(14), 262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
269 IEEE80211_TX_CTL_GREEN_FIELD = BIT(15), 263};
270 IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16), 264
271 IEEE80211_TX_CTL_DUP_DATA = BIT(17), 265enum mac80211_rate_control_flags {
272 IEEE80211_TX_CTL_SHORT_GI = BIT(18), 266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
273 IEEE80211_TX_CTL_INJECTED = BIT(19), 267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
274 IEEE80211_TX_STAT_TX_FILTERED = BIT(20), 268 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
275 IEEE80211_TX_STAT_ACK = BIT(21), 269
276 IEEE80211_TX_STAT_AMPDU = BIT(22), 270 /* rate index is an MCS rate number instead of an index */
277 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(23), 271 IEEE80211_TX_RC_MCS = BIT(3),
278 IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(24), 272 IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
273 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
274 IEEE80211_TX_RC_DUP_DATA = BIT(6),
275 IEEE80211_TX_RC_SHORT_GI = BIT(7),
279}; 276};
280 277
281 278
282#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \ 279/* there are 40 bytes if you don't need the rateset to be kept */
283 (sizeof(((struct sk_buff *)0)->cb) - 8) 280#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
284#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
285 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
286 281
287/* maximum number of alternate rate retry stages */ 282/* if you do need the rateset, then you have less space */
288#define IEEE80211_TX_MAX_ALTRATE 3 283#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
284
285/* maximum number of rate stages */
286#define IEEE80211_TX_MAX_RATES 5
289 287
290/** 288/**
291 * struct ieee80211_tx_altrate - alternate rate selection/status 289 * struct ieee80211_tx_rate - rate selection/status
290 *
291 * @idx: rate index to attempt to send with
292 * @flags: rate control flags (&enum mac80211_rate_control_flags)
293 * @count: number of tries in this rate before going to the next rate
292 * 294 *
293 * @rate_idx: rate index to attempt to send with 295 * A value of -1 for @idx indicates an invalid rate and, if used
294 * @limit: number of retries before fallback 296 * in an array of retry rates, that no more rates should be tried.
297 *
298 * When used for transmit status reporting, the driver should
299 * always report the rate along with the flags it used.
295 */ 300 */
296struct ieee80211_tx_altrate { 301struct ieee80211_tx_rate {
297 s8 rate_idx; 302 s8 idx;
298 u8 limit; 303 u8 count;
299}; 304 u8 flags;
305} __attribute__((packed));
300 306
301/** 307/**
302 * struct ieee80211_tx_info - skb transmit information 308 * struct ieee80211_tx_info - skb transmit information
@@ -310,15 +316,13 @@ struct ieee80211_tx_altrate {
310 * it may be NULL. 316 * it may be NULL.
311 * 317 *
312 * @flags: transmit info flags, defined above 318 * @flags: transmit info flags, defined above
313 * @band: TBD 319 * @band: the band to transmit on (use for checking for races)
314 * @tx_rate_idx: TBD 320 * @antenna_sel_tx: antenna to use, 0 for automatic diversity
315 * @antenna_sel_tx: TBD 321 * @pad: padding, ignore
316 * @control: union for control data 322 * @control: union for control data
317 * @status: union for status data 323 * @status: union for status data
318 * @driver_data: array of driver_data pointers 324 * @driver_data: array of driver_data pointers
319 * @retry_count: number of retries 325 * @retry_count: number of retries
320 * @excessive_retries: set to 1 if the frame was retried many times
321 * but not acknowledged
322 * @ampdu_ack_len: number of aggregated frames. 326 * @ampdu_ack_len: number of aggregated frames.
323 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 327 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
324 * @ampdu_ack_map: block ack bit map for the aggregation. 328 * @ampdu_ack_map: block ack bit map for the aggregation.
@@ -329,31 +333,44 @@ struct ieee80211_tx_info {
329 /* common information */ 333 /* common information */
330 u32 flags; 334 u32 flags;
331 u8 band; 335 u8 band;
332 s8 tx_rate_idx; 336
333 u8 antenna_sel_tx; 337 u8 antenna_sel_tx;
334 338
335 /* 1 byte hole */ 339 /* 2 byte hole */
340 u8 pad[2];
336 341
337 union { 342 union {
338 struct { 343 struct {
344 union {
345 /* rate control */
346 struct {
347 struct ieee80211_tx_rate rates[
348 IEEE80211_TX_MAX_RATES];
349 s8 rts_cts_rate_idx;
350 };
351 /* only needed before rate control */
352 unsigned long jiffies;
353 };
339 /* NB: vif can be NULL for injected frames */ 354 /* NB: vif can be NULL for injected frames */
340 struct ieee80211_vif *vif; 355 struct ieee80211_vif *vif;
341 struct ieee80211_key_conf *hw_key; 356 struct ieee80211_key_conf *hw_key;
342 struct ieee80211_sta *sta; 357 struct ieee80211_sta *sta;
343 unsigned long jiffies;
344 s8 rts_cts_rate_idx;
345 u8 retry_limit;
346 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE];
347 } control; 358 } control;
348 struct { 359 struct {
360 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
361 u8 ampdu_ack_len;
349 u64 ampdu_ack_map; 362 u64 ampdu_ack_map;
350 int ack_signal; 363 int ack_signal;
351 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1]; 364 /* 8 bytes free */
352 u8 retry_count;
353 bool excessive_retries;
354 u8 ampdu_ack_len;
355 } status; 365 } status;
356 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS]; 366 struct {
367 struct ieee80211_tx_rate driver_rates[
368 IEEE80211_TX_MAX_RATES];
369 void *rate_driver_data[
370 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
371 };
372 void *driver_data[
373 IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
357 }; 374 };
358}; 375};
359 376
@@ -362,6 +379,41 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
362 return (struct ieee80211_tx_info *)skb->cb; 379 return (struct ieee80211_tx_info *)skb->cb;
363} 380}
364 381
382/**
383 * ieee80211_tx_info_clear_status - clear TX status
384 *
385 * @info: The &struct ieee80211_tx_info to be cleared.
386 *
387 * When the driver passes an skb back to mac80211, it must report
388 * a number of things in TX status. This function clears everything
389 * in the TX status but the rate control information (it does clear
390 * the count since you need to fill that in anyway).
391 *
392 * NOTE: You can only use this function if you do NOT use
393 * info->driver_data! Use info->rate_driver_data
394 * instead if you need only the less space that allows.
395 */
396static inline void
397ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
398{
399 int i;
400
401 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
402 offsetof(struct ieee80211_tx_info, control.rates));
403 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
404 offsetof(struct ieee80211_tx_info, driver_rates));
405 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
406 /* clear the rate counts */
407 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
408 info->status.rates[i].count = 0;
409
410 BUILD_BUG_ON(
411 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23);
412 memset(&info->status.ampdu_ack_len, 0,
413 sizeof(struct ieee80211_tx_info) -
414 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
415}
416
365 417
366/** 418/**
367 * enum mac80211_rx_flags - receive flags 419 * enum mac80211_rx_flags - receive flags
@@ -384,6 +436,9 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
384 * is valid. This is useful in monitor mode and necessary for beacon frames 436 * is valid. This is useful in monitor mode and necessary for beacon frames
385 * to enable IBSS merging. 437 * to enable IBSS merging.
386 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 438 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
439 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
440 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
441 * @RX_FLAG_SHORT_GI: Short guard interval was used
387 */ 442 */
388enum mac80211_rx_flags { 443enum mac80211_rx_flags {
389 RX_FLAG_MMIC_ERROR = 1<<0, 444 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -394,7 +449,10 @@ enum mac80211_rx_flags {
394 RX_FLAG_FAILED_FCS_CRC = 1<<5, 449 RX_FLAG_FAILED_FCS_CRC = 1<<5,
395 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 450 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
396 RX_FLAG_TSFT = 1<<7, 451 RX_FLAG_TSFT = 1<<7,
397 RX_FLAG_SHORTPRE = 1<<8 452 RX_FLAG_SHORTPRE = 1<<8,
453 RX_FLAG_HT = 1<<9,
454 RX_FLAG_40MHZ = 1<<10,
455 RX_FLAG_SHORT_GI = 1<<11,
398}; 456};
399 457
400/** 458/**
@@ -414,7 +472,8 @@ enum mac80211_rx_flags {
414 * @noise: noise when receiving this frame, in dBm. 472 * @noise: noise when receiving this frame, in dBm.
415 * @qual: overall signal quality indication, in percent (0-100). 473 * @qual: overall signal quality indication, in percent (0-100).
416 * @antenna: antenna used 474 * @antenna: antenna used
417 * @rate_idx: index of data rate into band's supported rates 475 * @rate_idx: index of data rate into band's supported rates or MCS index if
476 * HT rates are use (RX_FLAG_HT)
418 * @flag: %RX_FLAG_* 477 * @flag: %RX_FLAG_*
419 */ 478 */
420struct ieee80211_rx_status { 479struct ieee80211_rx_status {
@@ -434,21 +493,49 @@ struct ieee80211_rx_status {
434 * 493 *
435 * Flags to define PHY configuration options 494 * Flags to define PHY configuration options
436 * 495 *
437 * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
438 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 496 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
439 * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
440 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 497 * @IEEE80211_CONF_PS: Enable 802.11 power save mode
441 */ 498 */
442enum ieee80211_conf_flags { 499enum ieee80211_conf_flags {
443 /* 500 IEEE80211_CONF_RADIOTAP = (1<<0),
444 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers 501 IEEE80211_CONF_PS = (1<<1),
445 * have been converted to use bss_info_changed() for slot time 502};
446 * configuration 503
447 */ 504/* XXX: remove all this once drivers stop trying to use it */
448 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), 505static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
449 IEEE80211_CONF_RADIOTAP = (1<<1), 506{
450 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), 507 return 0;
451 IEEE80211_CONF_PS = (1<<3), 508}
509#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
510
511struct ieee80211_ht_conf {
512 bool enabled;
513 enum nl80211_channel_type channel_type;
514};
515
516/**
517 * enum ieee80211_conf_changed - denotes which configuration changed
518 *
519 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed
520 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
521 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
522 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
523 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
524 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
525 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
526 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
527 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
528 */
529enum ieee80211_conf_changed {
530 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
531 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
532 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
533 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
534 IEEE80211_CONF_CHANGE_PS = BIT(4),
535 IEEE80211_CONF_CHANGE_POWER = BIT(5),
536 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
537 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
538 IEEE80211_CONF_CHANGE_HT = BIT(8),
452}; 539};
453 540
454/** 541/**
@@ -457,34 +544,31 @@ enum ieee80211_conf_flags {
457 * This struct indicates how the driver shall configure the hardware. 544 * This struct indicates how the driver shall configure the hardware.
458 * 545 *
459 * @radio_enabled: when zero, driver is required to switch off the radio. 546 * @radio_enabled: when zero, driver is required to switch off the radio.
460 * TODO make a flag
461 * @beacon_int: beacon interval (TODO make interface config) 547 * @beacon_int: beacon interval (TODO make interface config)
462 * @listen_interval: listen interval in units of beacon interval 548 * @listen_interval: listen interval in units of beacon interval
463 * @flags: configuration flags defined above 549 * @flags: configuration flags defined above
464 * @power_level: requested transmit power (in dBm) 550 * @power_level: requested transmit power (in dBm)
465 * @max_antenna_gain: maximum antenna gain (in dBi)
466 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
467 * 1/2: antenna 0/1
468 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
469 * @ht_conf: describes current self configuration of 802.11n HT capabilies
470 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
471 * @channel: the channel to tune to 551 * @channel: the channel to tune to
552 * @ht: the HT configuration for the device
553 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
554 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
555 * but actually means the number of transmissions not the number of retries
556 * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
557 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
558 * number of transmissions not the number of retries
472 */ 559 */
473struct ieee80211_conf { 560struct ieee80211_conf {
474 int radio_enabled;
475
476 int beacon_int; 561 int beacon_int;
477 u16 listen_interval;
478 u32 flags; 562 u32 flags;
479 int power_level; 563 int power_level;
480 int max_antenna_gain;
481 u8 antenna_sel_tx;
482 u8 antenna_sel_rx;
483 564
484 struct ieee80211_channel *channel; 565 u16 listen_interval;
566 bool radio_enabled;
567
568 u8 long_frame_max_tx_count, short_frame_max_tx_count;
485 569
486 struct ieee80211_ht_info ht_conf; 570 struct ieee80211_channel *channel;
487 struct ieee80211_ht_bss_info ht_bss_conf; 571 struct ieee80211_ht_conf ht;
488}; 572};
489 573
490/** 574/**
@@ -494,11 +578,14 @@ struct ieee80211_conf {
494 * use during the life of a virtual interface. 578 * use during the life of a virtual interface.
495 * 579 *
496 * @type: type of this virtual interface 580 * @type: type of this virtual interface
581 * @bss_conf: BSS configuration for this interface, either our own
582 * or the BSS we're associated to
497 * @drv_priv: data area for driver use, will always be aligned to 583 * @drv_priv: data area for driver use, will always be aligned to
498 * sizeof(void *). 584 * sizeof(void *).
499 */ 585 */
500struct ieee80211_vif { 586struct ieee80211_vif {
501 enum nl80211_iftype type; 587 enum nl80211_iftype type;
588 struct ieee80211_bss_conf bss_conf;
502 /* must be last */ 589 /* must be last */
503 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 590 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
504}; 591};
@@ -542,14 +629,12 @@ struct ieee80211_if_init_conf {
542 * enum ieee80211_if_conf_change - interface config change flags 629 * enum ieee80211_if_conf_change - interface config change flags
543 * 630 *
544 * @IEEE80211_IFCC_BSSID: The BSSID changed. 631 * @IEEE80211_IFCC_BSSID: The BSSID changed.
545 * @IEEE80211_IFCC_SSID: The SSID changed.
546 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 632 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
547 * (currently AP and MESH only), use ieee80211_beacon_get(). 633 * (currently AP and MESH only), use ieee80211_beacon_get().
548 */ 634 */
549enum ieee80211_if_conf_change { 635enum ieee80211_if_conf_change {
550 IEEE80211_IFCC_BSSID = BIT(0), 636 IEEE80211_IFCC_BSSID = BIT(0),
551 IEEE80211_IFCC_SSID = BIT(1), 637 IEEE80211_IFCC_BEACON = BIT(1),
552 IEEE80211_IFCC_BEACON = BIT(2),
553}; 638};
554 639
555/** 640/**
@@ -557,11 +642,6 @@ enum ieee80211_if_conf_change {
557 * 642 *
558 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 643 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
559 * @bssid: BSSID of the network we are associated to/creating. 644 * @bssid: BSSID of the network we are associated to/creating.
560 * @ssid: used (together with @ssid_len) by drivers for hardware that
561 * generate beacons independently. The pointer is valid only during the
562 * config_interface() call, so copy the value somewhere if you need
563 * it.
564 * @ssid_len: length of the @ssid field.
565 * 645 *
566 * This structure is passed to the config_interface() callback of 646 * This structure is passed to the config_interface() callback of
567 * &struct ieee80211_hw. 647 * &struct ieee80211_hw.
@@ -569,8 +649,6 @@ enum ieee80211_if_conf_change {
569struct ieee80211_if_conf { 649struct ieee80211_if_conf {
570 u32 changed; 650 u32 changed;
571 u8 *bssid; 651 u8 *bssid;
572 u8 *ssid;
573 size_t ssid_len;
574}; 652};
575 653
576/** 654/**
@@ -677,7 +755,7 @@ enum set_key_cmd {
677 * @addr: MAC address 755 * @addr: MAC address
678 * @aid: AID we assigned to the station if we're an AP 756 * @aid: AID we assigned to the station if we're an AP
679 * @supp_rates: Bitmap of supported rates (per band) 757 * @supp_rates: Bitmap of supported rates (per band)
680 * @ht_info: HT capabilities of this STA 758 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities
681 * @drv_priv: data area for driver use, will always be aligned to 759 * @drv_priv: data area for driver use, will always be aligned to
682 * sizeof(void *), size is determined in hw information. 760 * sizeof(void *), size is determined in hw information.
683 */ 761 */
@@ -685,7 +763,7 @@ struct ieee80211_sta {
685 u64 supp_rates[IEEE80211_NUM_BANDS]; 763 u64 supp_rates[IEEE80211_NUM_BANDS];
686 u8 addr[ETH_ALEN]; 764 u8 addr[ETH_ALEN];
687 u16 aid; 765 u16 aid;
688 struct ieee80211_ht_info ht_info; 766 struct ieee80211_sta_ht_cap ht_cap;
689 767
690 /* must be last */ 768 /* must be last */
691 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 769 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
@@ -695,13 +773,17 @@ struct ieee80211_sta {
695 * enum sta_notify_cmd - sta notify command 773 * enum sta_notify_cmd - sta notify command
696 * 774 *
697 * Used with the sta_notify() callback in &struct ieee80211_ops, this 775 * Used with the sta_notify() callback in &struct ieee80211_ops, this
698 * indicates addition and removal of a station to station table. 776 * indicates addition and removal of a station to station table,
777 * or if a associated station made a power state transition.
699 * 778 *
700 * @STA_NOTIFY_ADD: a station was added to the station table 779 * @STA_NOTIFY_ADD: a station was added to the station table
701 * @STA_NOTIFY_REMOVE: a station being removed from the station table 780 * @STA_NOTIFY_REMOVE: a station being removed from the station table
781 * @STA_NOTIFY_SLEEP: a station is now sleeping
782 * @STA_NOTIFY_AWAKE: a sleeping station woke up
702 */ 783 */
703enum sta_notify_cmd { 784enum sta_notify_cmd {
704 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE 785 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE,
786 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
705}; 787};
706 788
707/** 789/**
@@ -769,6 +851,14 @@ enum ieee80211_tkip_key_type {
769 * @IEEE80211_HW_SPECTRUM_MGMT: 851 * @IEEE80211_HW_SPECTRUM_MGMT:
770 * Hardware supports spectrum management defined in 802.11h 852 * Hardware supports spectrum management defined in 802.11h
771 * Measurement, Channel Switch, Quieting, TPC 853 * Measurement, Channel Switch, Quieting, TPC
854 *
855 * @IEEE80211_HW_AMPDU_AGGREGATION:
856 * Hardware supports 11n A-MPDU aggregation.
857 *
858 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS:
859 * Hardware which has dynamic power save support, meaning
860 * that power save is enabled in idle periods, and don't need support
861 * from stack.
772 */ 862 */
773enum ieee80211_hw_flags { 863enum ieee80211_hw_flags {
774 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 864 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -780,6 +870,8 @@ enum ieee80211_hw_flags {
780 IEEE80211_HW_SIGNAL_DBM = 1<<7, 870 IEEE80211_HW_SIGNAL_DBM = 1<<7,
781 IEEE80211_HW_NOISE_DBM = 1<<8, 871 IEEE80211_HW_NOISE_DBM = 1<<8,
782 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 872 IEEE80211_HW_SPECTRUM_MGMT = 1<<9,
873 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10,
874 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11,
783}; 875};
784 876
785/** 877/**
@@ -838,8 +930,8 @@ enum ieee80211_hw_flags {
838 * @sta_data_size: size (in bytes) of the drv_priv data area 930 * @sta_data_size: size (in bytes) of the drv_priv data area
839 * within &struct ieee80211_sta. 931 * within &struct ieee80211_sta.
840 * 932 *
841 * @max_altrates: maximum number of alternate rate retry stages 933 * @max_rates: maximum number of alternate rate retry stages
842 * @max_altrate_tries: maximum number of tries for each stage 934 * @max_rate_tries: maximum number of tries for each stage
843 */ 935 */
844struct ieee80211_hw { 936struct ieee80211_hw {
845 struct ieee80211_conf conf; 937 struct ieee80211_conf conf;
@@ -856,12 +948,10 @@ struct ieee80211_hw {
856 u16 ampdu_queues; 948 u16 ampdu_queues;
857 u16 max_listen_interval; 949 u16 max_listen_interval;
858 s8 max_signal; 950 s8 max_signal;
859 u8 max_altrates; 951 u8 max_rates;
860 u8 max_altrate_tries; 952 u8 max_rate_tries;
861}; 953};
862 954
863struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
864
865/** 955/**
866 * SET_IEEE80211_DEV - set device for 802.11 hardware 956 * SET_IEEE80211_DEV - set device for 802.11 hardware
867 * 957 *
@@ -874,7 +964,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev
874} 964}
875 965
876/** 966/**
877 * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware 967 * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware
878 * 968 *
879 * @hw: the &struct ieee80211_hw to set the MAC address for 969 * @hw: the &struct ieee80211_hw to set the MAC address for
880 * @addr: the address to set 970 * @addr: the address to set
@@ -898,9 +988,9 @@ static inline struct ieee80211_rate *
898ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 988ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
899 const struct ieee80211_tx_info *c) 989 const struct ieee80211_tx_info *c)
900{ 990{
901 if (WARN_ON(c->tx_rate_idx < 0)) 991 if (WARN_ON(c->control.rates[0].idx < 0))
902 return NULL; 992 return NULL;
903 return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx]; 993 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
904} 994}
905 995
906static inline struct ieee80211_rate * 996static inline struct ieee80211_rate *
@@ -916,9 +1006,9 @@ static inline struct ieee80211_rate *
916ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 1006ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
917 const struct ieee80211_tx_info *c, int idx) 1007 const struct ieee80211_tx_info *c, int idx)
918{ 1008{
919 if (c->control.retries[idx].rate_idx < 0) 1009 if (c->control.rates[idx + 1].idx < 0)
920 return NULL; 1010 return NULL;
921 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx]; 1011 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
922} 1012}
923 1013
924/** 1014/**
@@ -967,7 +1057,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
967 * This happens everytime the iv16 wraps around (every 65536 packets). The 1057 * This happens everytime the iv16 wraps around (every 65536 packets). The
968 * set_key() call will happen only once for each key (unless the AP did 1058 * set_key() call will happen only once for each key (unless the AP did
969 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is 1059 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
970 * provided by udpate_tkip_key only. The trigger that makes mac80211 call this 1060 * provided by update_tkip_key only. The trigger that makes mac80211 call this
971 * handler is software decryption with wrap around of iv16. 1061 * handler is software decryption with wrap around of iv16.
972 */ 1062 */
973 1063
@@ -1060,12 +1150,14 @@ enum ieee80211_filter_flags {
1060 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1150 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1061 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1151 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1062 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1152 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1153 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation
1063 */ 1154 */
1064enum ieee80211_ampdu_mlme_action { 1155enum ieee80211_ampdu_mlme_action {
1065 IEEE80211_AMPDU_RX_START, 1156 IEEE80211_AMPDU_RX_START,
1066 IEEE80211_AMPDU_RX_STOP, 1157 IEEE80211_AMPDU_RX_STOP,
1067 IEEE80211_AMPDU_TX_START, 1158 IEEE80211_AMPDU_TX_START,
1068 IEEE80211_AMPDU_TX_STOP, 1159 IEEE80211_AMPDU_TX_STOP,
1160 IEEE80211_AMPDU_TX_RESUME,
1069}; 1161};
1070 1162
1071/** 1163/**
@@ -1101,7 +1193,7 @@ enum ieee80211_ampdu_mlme_action {
1101 * Must be implemented. 1193 * Must be implemented.
1102 * 1194 *
1103 * @add_interface: Called when a netdevice attached to the hardware is 1195 * @add_interface: Called when a netdevice attached to the hardware is
1104 * enabled. Because it is not called for monitor mode devices, @open 1196 * enabled. Because it is not called for monitor mode devices, @start
1105 * and @stop must be implemented. 1197 * and @stop must be implemented.
1106 * The driver should perform any initialization it needs before 1198 * The driver should perform any initialization it needs before
1107 * the device can be enabled. The initial configuration for the 1199 * the device can be enabled. The initial configuration for the
@@ -1163,14 +1255,9 @@ enum ieee80211_ampdu_mlme_action {
1163 * 1255 *
1164 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1256 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1165 * 1257 *
1166 * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if 1258 * @sta_notify: Notifies low level driver about addition, removal or power
1167 * the device does fragmentation by itself; if this method is assigned then 1259 * state transition of an associated station, AP, IBSS/WDS/mesh peer etc.
1168 * the stack will not do fragmentation. 1260 * Must be atomic.
1169 *
1170 * @set_retry_limit: Configuration of retry limits (if device needs it)
1171 *
1172 * @sta_notify: Notifies low level driver about addition or removal
1173 * of assocaited station or AP.
1174 * 1261 *
1175 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1262 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1176 * bursting) for a hardware TX queue. 1263 * bursting) for a hardware TX queue.
@@ -1194,8 +1281,6 @@ enum ieee80211_ampdu_mlme_action {
1194 * This is needed only for IBSS mode and the result of this function is 1281 * This is needed only for IBSS mode and the result of this function is
1195 * used to determine whether to reply to Probe Requests. 1282 * used to determine whether to reply to Probe Requests.
1196 * 1283 *
1197 * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic.
1198 *
1199 * @ampdu_action: Perform a certain A-MPDU action 1284 * @ampdu_action: Perform a certain A-MPDU action
1200 * The RA/TID combination determines the destination and TID we want 1285 * The RA/TID combination determines the destination and TID we want
1201 * the ampdu action to be performed for. The action is defined through 1286 * the ampdu action to be performed for. The action is defined through
@@ -1211,7 +1296,7 @@ struct ieee80211_ops {
1211 struct ieee80211_if_init_conf *conf); 1296 struct ieee80211_if_init_conf *conf);
1212 void (*remove_interface)(struct ieee80211_hw *hw, 1297 void (*remove_interface)(struct ieee80211_hw *hw,
1213 struct ieee80211_if_init_conf *conf); 1298 struct ieee80211_if_init_conf *conf);
1214 int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); 1299 int (*config)(struct ieee80211_hw *hw, u32 changed);
1215 int (*config_interface)(struct ieee80211_hw *hw, 1300 int (*config_interface)(struct ieee80211_hw *hw,
1216 struct ieee80211_vif *vif, 1301 struct ieee80211_vif *vif,
1217 struct ieee80211_if_conf *conf); 1302 struct ieee80211_if_conf *conf);
@@ -1237,9 +1322,6 @@ struct ieee80211_ops {
1237 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1322 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1238 u32 *iv32, u16 *iv16); 1323 u32 *iv32, u16 *iv16);
1239 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1324 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1240 int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
1241 int (*set_retry_limit)(struct ieee80211_hw *hw,
1242 u32 short_retry, u32 long_retr);
1243 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1325 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1244 enum sta_notify_cmd, struct ieee80211_sta *sta); 1326 enum sta_notify_cmd, struct ieee80211_sta *sta);
1245 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1327 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
@@ -1472,7 +1554,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1472 * the next beacon frame from the 802.11 code. The low-level is responsible 1554 * the next beacon frame from the 802.11 code. The low-level is responsible
1473 * for calling this function before beacon data is needed (e.g., based on 1555 * for calling this function before beacon data is needed (e.g., based on
1474 * hardware interrupt). Returned skb is used only once and low-level driver 1556 * hardware interrupt). Returned skb is used only once and low-level driver
1475 * is responsible of freeing it. 1557 * is responsible for freeing it.
1476 */ 1558 */
1477struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1559struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1478 struct ieee80211_vif *vif); 1560 struct ieee80211_vif *vif);
@@ -1803,24 +1885,38 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1803 1885
1804 1886
1805/* Rate control API */ 1887/* Rate control API */
1888
1806/** 1889/**
1807 * struct rate_selection - rate information for/from rate control algorithms 1890 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1808 * 1891 *
1809 * @rate_idx: selected transmission rate index 1892 * @hw: The hardware the algorithm is invoked for.
1810 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used 1893 * @sband: The band this frame is being transmitted on.
1811 * @probe_idx: rate for probing (or -1) 1894 * @bss_conf: the current BSS configuration
1812 * @max_rate_idx: maximum rate index that can be used, this is 1895 * @reported_rate: The rate control algorithm can fill this in to indicate
1813 * input to the algorithm and will be enforced 1896 * which rate should be reported to userspace as the current rate and
1814 */ 1897 * used for rate calculations in the mesh network.
1815struct rate_selection { 1898 * @rts: whether RTS will be used for this frame because it is longer than the
1816 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx; 1899 * RTS threshold
1900 * @short_preamble: whether mac80211 will request short-preamble transmission
1901 * if the selected rate supports it
1902 * @max_rate_idx: user-requested maximum rate (not MCS for now)
1903 * @skb: the skb that will be transmitted, the control information in it needs
1904 * to be filled in
1905 */
1906struct ieee80211_tx_rate_control {
1907 struct ieee80211_hw *hw;
1908 struct ieee80211_supported_band *sband;
1909 struct ieee80211_bss_conf *bss_conf;
1910 struct sk_buff *skb;
1911 struct ieee80211_tx_rate reported_rate;
1912 bool rts, short_preamble;
1913 u8 max_rate_idx;
1817}; 1914};
1818 1915
1819struct rate_control_ops { 1916struct rate_control_ops {
1820 struct module *module; 1917 struct module *module;
1821 const char *name; 1918 const char *name;
1822 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 1919 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
1823 void (*clear)(void *priv);
1824 void (*free)(void *priv); 1920 void (*free)(void *priv);
1825 1921
1826 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 1922 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
@@ -1832,10 +1928,8 @@ struct rate_control_ops {
1832 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, 1928 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1833 struct ieee80211_sta *sta, void *priv_sta, 1929 struct ieee80211_sta *sta, void *priv_sta,
1834 struct sk_buff *skb); 1930 struct sk_buff *skb);
1835 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, 1931 void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1836 struct ieee80211_sta *sta, void *priv_sta, 1932 struct ieee80211_tx_rate_control *txrc);
1837 struct sk_buff *skb,
1838 struct rate_selection *sel);
1839 1933
1840 void (*add_sta_debugfs)(void *priv, void *priv_sta, 1934 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1841 struct dentry *dir); 1935 struct dentry *dir);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 11dd0137c6a5..ce532f2222ce 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -108,6 +108,20 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
108 108
109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); 109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
110 110
111extern struct sk_buff *ndisc_build_skb(struct net_device *dev,
112 const struct in6_addr *daddr,
113 const struct in6_addr *saddr,
114 struct icmp6hdr *icmp6h,
115 const struct in6_addr *target,
116 int llinfo);
117
118extern void ndisc_send_skb(struct sk_buff *skb,
119 struct net_device *dev,
120 struct neighbour *neigh,
121 const struct in6_addr *daddr,
122 const struct in6_addr *saddr,
123 struct icmp6hdr *icmp6h);
124
111 125
112 126
113/* 127/*
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index aa4b708654a4..d8d790e56d3d 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -180,9 +180,6 @@ struct neigh_table
180 __u32 hash_rnd; 180 __u32 hash_rnd;
181 unsigned int hash_chain_gc; 181 unsigned int hash_chain_gc;
182 struct pneigh_entry **phash_buckets; 182 struct pneigh_entry **phash_buckets;
183#ifdef CONFIG_PROC_FS
184 struct proc_dir_entry *pde;
185#endif
186}; 183};
187 184
188/* flags for neigh_update() */ 185/* flags for neigh_update() */
@@ -223,11 +220,7 @@ extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *p
223static inline 220static inline
224struct net *neigh_parms_net(const struct neigh_parms *parms) 221struct net *neigh_parms_net(const struct neigh_parms *parms)
225{ 222{
226#ifdef CONFIG_NET_NS 223 return read_pnet(&parms->net);
227 return parms->net;
228#else
229 return &init_net;
230#endif
231} 224}
232 225
233extern unsigned long neigh_rand_reach_time(unsigned long base); 226extern unsigned long neigh_rand_reach_time(unsigned long base);
@@ -244,11 +237,7 @@ extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void
244static inline 237static inline
245struct net *pneigh_net(const struct pneigh_entry *pneigh) 238struct net *pneigh_net(const struct pneigh_entry *pneigh)
246{ 239{
247#ifdef CONFIG_NET_NS 240 return read_pnet(&pneigh->net);
248 return pneigh->net;
249#else
250 return &init_net;
251#endif
252} 241}
253 242
254extern void neigh_app_ns(struct neighbour *n); 243extern void neigh_app_ns(struct neighbour *n);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 700c53a3c6fa..6fc13d905c5f 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -19,6 +19,7 @@
19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
20#include <net/netns/conntrack.h> 20#include <net/netns/conntrack.h>
21#endif 21#endif
22#include <net/netns/xfrm.h>
22 23
23struct proc_dir_entry; 24struct proc_dir_entry;
24struct net_device; 25struct net_device;
@@ -74,6 +75,9 @@ struct net {
74 struct netns_ct ct; 75 struct netns_ct ct;
75#endif 76#endif
76#endif 77#endif
78#ifdef CONFIG_XFRM
79 struct netns_xfrm xfrm;
80#endif
77 struct net_generic *gen; 81 struct net_generic *gen;
78}; 82};
79 83
@@ -192,6 +196,24 @@ static inline void release_net(struct net *net)
192} 196}
193#endif 197#endif
194 198
199#ifdef CONFIG_NET_NS
200
201static inline void write_pnet(struct net **pnet, struct net *net)
202{
203 *pnet = net;
204}
205
206static inline struct net *read_pnet(struct net * const *pnet)
207{
208 return *pnet;
209}
210
211#else
212
213#define write_pnet(pnet, net) do { (void)(net);} while (0)
214#define read_pnet(pnet) (&init_net)
215
216#endif
195 217
196#define for_each_net(VAR) \ 218#define for_each_net(VAR) \
197 list_for_each_entry(VAR, &net_namespace_list, list) 219 list_for_each_entry(VAR, &net_namespace_list, list)
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index b76a8685b5b5..2e0c53641cbe 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -199,7 +199,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
199 199
200extern void nf_conntrack_hash_insert(struct nf_conn *ct); 200extern void nf_conntrack_hash_insert(struct nf_conn *ct);
201 201
202extern void nf_conntrack_flush(struct net *net); 202extern void nf_conntrack_flush(struct net *net, u32 pid, int report);
203 203
204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
205 unsigned int nhoff, u_int16_t l3num, 205 unsigned int nhoff, u_int16_t l3num,
@@ -298,5 +298,8 @@ do { \
298 local_bh_enable(); \ 298 local_bh_enable(); \
299} while (0) 299} while (0)
300 300
301#define MODULE_ALIAS_NFCT_HELPER(helper) \
302 MODULE_ALIAS("nfct-helper-" helper)
303
301#endif /* __KERNEL__ */ 304#endif /* __KERNEL__ */
302#endif /* _NF_CONNTRACK_H */ 305#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 1285ff26a014..0ff0dc69ca4a 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -17,6 +17,13 @@ struct nf_conntrack_ecache {
17 unsigned int events; 17 unsigned int events;
18}; 18};
19 19
20/* This structure is passed to event handler */
21struct nf_ct_event {
22 struct nf_conn *ct;
23 u32 pid;
24 int report;
25};
26
20extern struct atomic_notifier_head nf_conntrack_chain; 27extern struct atomic_notifier_head nf_conntrack_chain;
21extern int nf_conntrack_register_notifier(struct notifier_block *nb); 28extern int nf_conntrack_register_notifier(struct notifier_block *nb);
22extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); 29extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
@@ -39,22 +46,56 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
39 local_bh_enable(); 46 local_bh_enable();
40} 47}
41 48
42static inline void nf_conntrack_event(enum ip_conntrack_events event, 49static inline void
43 struct nf_conn *ct) 50nf_conntrack_event_report(enum ip_conntrack_events event,
51 struct nf_conn *ct,
52 u32 pid,
53 int report)
44{ 54{
55 struct nf_ct_event item = {
56 .ct = ct,
57 .pid = pid,
58 .report = report
59 };
45 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 60 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
46 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); 61 atomic_notifier_call_chain(&nf_conntrack_chain, event, &item);
47} 62}
48 63
64static inline void
65nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
66{
67 nf_conntrack_event_report(event, ct, 0, 0);
68}
69
70struct nf_exp_event {
71 struct nf_conntrack_expect *exp;
72 u32 pid;
73 int report;
74};
75
49extern struct atomic_notifier_head nf_ct_expect_chain; 76extern struct atomic_notifier_head nf_ct_expect_chain;
50extern int nf_ct_expect_register_notifier(struct notifier_block *nb); 77extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
51extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); 78extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
52 79
53static inline void 80static inline void
81nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
82 struct nf_conntrack_expect *exp,
83 u32 pid,
84 int report)
85{
86 struct nf_exp_event item = {
87 .exp = exp,
88 .pid = pid,
89 .report = report
90 };
91 atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item);
92}
93
94static inline void
54nf_ct_expect_event(enum ip_conntrack_expect_events event, 95nf_ct_expect_event(enum ip_conntrack_expect_events event,
55 struct nf_conntrack_expect *exp) 96 struct nf_conntrack_expect *exp)
56{ 97{
57 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); 98 nf_ct_expect_event_report(event, exp, 0, 0);
58} 99}
59 100
60extern int nf_conntrack_ecache_init(struct net *net); 101extern int nf_conntrack_ecache_init(struct net *net);
@@ -66,9 +107,17 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
66 struct nf_conn *ct) {} 107 struct nf_conn *ct) {}
67static inline void nf_conntrack_event(enum ip_conntrack_events event, 108static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct) {} 109 struct nf_conn *ct) {}
110static inline void nf_conntrack_event_report(enum ip_conntrack_events event,
111 struct nf_conn *ct,
112 u32 pid,
113 int report) {}
69static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 114static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
70static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 115static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
71 struct nf_conntrack_expect *exp) {} 116 struct nf_conntrack_expect *exp) {}
117static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
118 struct nf_conntrack_expect *exp,
119 u32 pid,
120 int report) {}
72static inline void nf_ct_event_cache_flush(struct net *net) {} 121static inline void nf_ct_event_cache_flush(struct net *net) {}
73 122
74static inline int nf_conntrack_ecache_init(struct net *net) 123static inline int nf_conntrack_ecache_init(struct net *net)
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 37a7fc1164b0..ab17a159ac66 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -100,6 +100,8 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
100 u_int8_t, const __be16 *, const __be16 *); 100 u_int8_t, const __be16 *, const __be16 *);
101void nf_ct_expect_put(struct nf_conntrack_expect *exp); 101void nf_ct_expect_put(struct nf_conntrack_expect *exp);
102int nf_ct_expect_related(struct nf_conntrack_expect *expect); 102int nf_ct_expect_related(struct nf_conntrack_expect *expect);
103int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
104 u32 pid, int report);
103 105
104#endif /*_NF_CONNTRACK_EXPECT_H*/ 106#endif /*_NF_CONNTRACK_EXPECT_H*/
105 107
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index f8060ab5a083..66d65a7caa39 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -39,9 +39,6 @@ struct nf_conntrack_helper
39}; 39};
40 40
41extern struct nf_conntrack_helper * 41extern struct nf_conntrack_helper *
42__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
43
44extern struct nf_conntrack_helper *
45__nf_conntrack_helper_find_byname(const char *name); 42__nf_conntrack_helper_find_byname(const char *name);
46 43
47extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 44extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
@@ -49,6 +46,8 @@ extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
49 46
50extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 47extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
51 48
49extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags);
50
52static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 51static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
53{ 52{
54 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 53 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 7f2f43c77284..debdaf75cecf 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -129,7 +129,7 @@ extern const struct nla_policy nf_ct_port_nla_policy[];
129 && net_ratelimit()) 129 && net_ratelimit())
130#endif 130#endif
131#else 131#else
132#define LOG_INVALID(net, proto) 0 132static inline int LOG_INVALID(struct net *net, int proto) { return 0; }
133#endif /* CONFIG_SYSCTL */ 133#endif /* CONFIG_SYSCTL */
134 134
135#endif /*_NF_CONNTRACK_PROTOCOL_H*/ 135#endif /*_NF_CONNTRACK_PROTOCOL_H*/
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index a6874ba22d54..f2f6aa73dc10 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -112,20 +112,20 @@ struct nf_conntrack_tuple_mask
112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) 112static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t)
113{ 113{
114#ifdef DEBUG 114#ifdef DEBUG
115 printk("tuple %p: %u " NIPQUAD_FMT ":%hu -> " NIPQUAD_FMT ":%hu\n", 115 printk("tuple %p: %u %pI4:%hu -> %pI4:%hu\n",
116 t, t->dst.protonum, 116 t, t->dst.protonum,
117 NIPQUAD(t->src.u3.ip), ntohs(t->src.u.all), 117 &t->src.u3.ip, ntohs(t->src.u.all),
118 NIPQUAD(t->dst.u3.ip), ntohs(t->dst.u.all)); 118 &t->dst.u3.ip, ntohs(t->dst.u.all));
119#endif 119#endif
120} 120}
121 121
122static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t) 122static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t)
123{ 123{
124#ifdef DEBUG 124#ifdef DEBUG
125 printk("tuple %p: %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", 125 printk("tuple %p: %u %pI6 %hu -> %pI6 %hu\n",
126 t, t->dst.protonum, 126 t, t->dst.protonum,
127 NIP6(*(struct in6_addr *)t->src.u3.all), ntohs(t->src.u.all), 127 t->src.u3.all, ntohs(t->src.u.all),
128 NIP6(*(struct in6_addr *)t->dst.u3.all), ntohs(t->dst.u.all)); 128 t->dst.u3.all, ntohs(t->dst.u.all));
129#endif 129#endif
130} 130}
131 131
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
new file mode 100644
index 000000000000..b0569ff0775e
--- /dev/null
+++ b/include/net/netfilter/nfnetlink_log.h
@@ -0,0 +1,14 @@
1#ifndef _KER_NFNETLINK_LOG_H
2#define _KER_NFNETLINK_LOG_H
3
4void
5nfulnl_log_packet(u_int8_t pf,
6 unsigned int hooknum,
7 const struct sk_buff *skb,
8 const struct net_device *in,
9 const struct net_device *out,
10 const struct nf_loginfo *li_user,
11 const char *prefix);
12
13#endif /* _KER_NFNETLINK_LOG_H */
14
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 3643bbb8e585..8a6150a3f4c7 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -233,7 +233,7 @@ extern int nla_parse(struct nlattr *tb[], int maxtype,
233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
235 size_t dstsize); 235 size_t dstsize);
236extern int nla_memcpy(void *dest, struct nlattr *src, int count); 236extern int nla_memcpy(void *dest, const struct nlattr *src, int count);
237extern int nla_memcmp(const struct nlattr *nla, const void *data, 237extern int nla_memcmp(const struct nlattr *nla, const void *data,
238 size_t size); 238 size_t size);
239extern int nla_strcmp(const struct nlattr *nla, const char *str); 239extern int nla_strcmp(const struct nlattr *nla, const char *str);
@@ -332,7 +332,7 @@ static inline int nlmsg_attrlen(const struct nlmsghdr *nlh, int hdrlen)
332 */ 332 */
333static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining) 333static inline int nlmsg_ok(const struct nlmsghdr *nlh, int remaining)
334{ 334{
335 return (remaining >= sizeof(struct nlmsghdr) && 335 return (remaining >= (int) sizeof(struct nlmsghdr) &&
336 nlh->nlmsg_len >= sizeof(struct nlmsghdr) && 336 nlh->nlmsg_len >= sizeof(struct nlmsghdr) &&
337 nlh->nlmsg_len <= remaining); 337 nlh->nlmsg_len <= remaining);
338} 338}
@@ -741,7 +741,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
741 * See nla_parse() 741 * See nla_parse()
742 */ 742 */
743static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, 743static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
744 struct nlattr *nla, 744 const struct nlattr *nla,
745 const struct nla_policy *policy) 745 const struct nla_policy *policy)
746{ 746{
747 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); 747 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
@@ -875,7 +875,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
875 * nla_get_u32 - return payload of u32 attribute 875 * nla_get_u32 - return payload of u32 attribute
876 * @nla: u32 netlink attribute 876 * @nla: u32 netlink attribute
877 */ 877 */
878static inline u32 nla_get_u32(struct nlattr *nla) 878static inline u32 nla_get_u32(const struct nlattr *nla)
879{ 879{
880 return *(u32 *) nla_data(nla); 880 return *(u32 *) nla_data(nla);
881} 881}
@@ -884,7 +884,7 @@ static inline u32 nla_get_u32(struct nlattr *nla)
884 * nla_get_be32 - return payload of __be32 attribute 884 * nla_get_be32 - return payload of __be32 attribute
885 * @nla: __be32 netlink attribute 885 * @nla: __be32 netlink attribute
886 */ 886 */
887static inline __be32 nla_get_be32(struct nlattr *nla) 887static inline __be32 nla_get_be32(const struct nlattr *nla)
888{ 888{
889 return *(__be32 *) nla_data(nla); 889 return *(__be32 *) nla_data(nla);
890} 890}
@@ -893,7 +893,7 @@ static inline __be32 nla_get_be32(struct nlattr *nla)
893 * nla_get_u16 - return payload of u16 attribute 893 * nla_get_u16 - return payload of u16 attribute
894 * @nla: u16 netlink attribute 894 * @nla: u16 netlink attribute
895 */ 895 */
896static inline u16 nla_get_u16(struct nlattr *nla) 896static inline u16 nla_get_u16(const struct nlattr *nla)
897{ 897{
898 return *(u16 *) nla_data(nla); 898 return *(u16 *) nla_data(nla);
899} 899}
@@ -902,7 +902,7 @@ static inline u16 nla_get_u16(struct nlattr *nla)
902 * nla_get_be16 - return payload of __be16 attribute 902 * nla_get_be16 - return payload of __be16 attribute
903 * @nla: __be16 netlink attribute 903 * @nla: __be16 netlink attribute
904 */ 904 */
905static inline __be16 nla_get_be16(struct nlattr *nla) 905static inline __be16 nla_get_be16(const struct nlattr *nla)
906{ 906{
907 return *(__be16 *) nla_data(nla); 907 return *(__be16 *) nla_data(nla);
908} 908}
@@ -911,7 +911,7 @@ static inline __be16 nla_get_be16(struct nlattr *nla)
911 * nla_get_le16 - return payload of __le16 attribute 911 * nla_get_le16 - return payload of __le16 attribute
912 * @nla: __le16 netlink attribute 912 * @nla: __le16 netlink attribute
913 */ 913 */
914static inline __le16 nla_get_le16(struct nlattr *nla) 914static inline __le16 nla_get_le16(const struct nlattr *nla)
915{ 915{
916 return *(__le16 *) nla_data(nla); 916 return *(__le16 *) nla_data(nla);
917} 917}
@@ -920,7 +920,7 @@ static inline __le16 nla_get_le16(struct nlattr *nla)
920 * nla_get_u8 - return payload of u8 attribute 920 * nla_get_u8 - return payload of u8 attribute
921 * @nla: u8 netlink attribute 921 * @nla: u8 netlink attribute
922 */ 922 */
923static inline u8 nla_get_u8(struct nlattr *nla) 923static inline u8 nla_get_u8(const struct nlattr *nla)
924{ 924{
925 return *(u8 *) nla_data(nla); 925 return *(u8 *) nla_data(nla);
926} 926}
@@ -929,7 +929,7 @@ static inline u8 nla_get_u8(struct nlattr *nla)
929 * nla_get_u64 - return payload of u64 attribute 929 * nla_get_u64 - return payload of u64 attribute
930 * @nla: u64 netlink attribute 930 * @nla: u64 netlink attribute
931 */ 931 */
932static inline u64 nla_get_u64(struct nlattr *nla) 932static inline u64 nla_get_u64(const struct nlattr *nla)
933{ 933{
934 u64 tmp; 934 u64 tmp;
935 935
@@ -942,7 +942,7 @@ static inline u64 nla_get_u64(struct nlattr *nla)
942 * nla_get_flag - return payload of flag attribute 942 * nla_get_flag - return payload of flag attribute
943 * @nla: flag netlink attribute 943 * @nla: flag netlink attribute
944 */ 944 */
945static inline int nla_get_flag(struct nlattr *nla) 945static inline int nla_get_flag(const struct nlattr *nla)
946{ 946{
947 return !!nla; 947 return !!nla;
948} 948}
@@ -953,7 +953,7 @@ static inline int nla_get_flag(struct nlattr *nla)
953 * 953 *
954 * Returns the number of milliseconds in jiffies. 954 * Returns the number of milliseconds in jiffies.
955 */ 955 */
956static inline unsigned long nla_get_msecs(struct nlattr *nla) 956static inline unsigned long nla_get_msecs(const struct nlattr *nla)
957{ 957{
958 u64 msecs = nla_get_u64(nla); 958 u64 msecs = nla_get_u64(nla);
959 959
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ece1c926b5d1..977f482d97a9 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -49,6 +49,8 @@ struct netns_ipv4 {
49 int sysctl_icmp_ratelimit; 49 int sysctl_icmp_ratelimit;
50 int sysctl_icmp_ratemask; 50 int sysctl_icmp_ratemask;
51 int sysctl_icmp_errors_use_inbound_ifaddr; 51 int sysctl_icmp_errors_use_inbound_ifaddr;
52 int sysctl_rt_cache_rebuild_count;
53 int current_rt_cache_rebuild_count;
52 54
53 struct timer_list rt_secret_timer; 55 struct timer_list rt_secret_timer;
54 atomic_t rt_genid; 56 atomic_t rt_genid;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 2932721180c0..afab4e4cbac7 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -55,5 +55,17 @@ struct netns_ipv6 {
55 struct sock *ndisc_sk; 55 struct sock *ndisc_sk;
56 struct sock *tcp_sk; 56 struct sock *tcp_sk;
57 struct sock *igmp_sk; 57 struct sock *igmp_sk;
58#ifdef CONFIG_IPV6_MROUTE
59 struct sock *mroute6_sk;
60 struct mfc6_cache **mfc6_cache_array;
61 struct mif_device *vif6_table;
62 int maxvif;
63 atomic_t cache_resolve_queue_len;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#ifdef CONFIG_IPV6_PIMSM_V2
67 int mroute_reg_vif_num;
68#endif
69#endif
58}; 70};
59#endif 71#endif
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 10cb7c336de5..0b44112e2366 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -20,6 +20,9 @@ struct netns_mib {
20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); 21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
22#endif 22#endif
23#ifdef CONFIG_XFRM_STATISTICS
24 DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics);
25#endif
23}; 26};
24 27
25#endif 28#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index b8093971ccb4..9554a644a8f8 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -4,7 +4,12 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6 6
7struct ebt_table;
8
7struct netns_xt { 9struct netns_xt {
8 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 struct ebt_table *broute_table;
12 struct ebt_table *frame_filter;
13 struct ebt_table *frame_nat;
9}; 14};
10#endif 15#endif
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
new file mode 100644
index 000000000000..1ba912749caa
--- /dev/null
+++ b/include/net/netns/xfrm.h
@@ -0,0 +1,56 @@
1#ifndef __NETNS_XFRM_H
2#define __NETNS_XFRM_H
3
4#include <linux/list.h>
5#include <linux/wait.h>
6#include <linux/workqueue.h>
7#include <linux/xfrm.h>
8
9struct ctl_table_header;
10
11struct xfrm_policy_hash {
12 struct hlist_head *table;
13 unsigned int hmask;
14};
15
16struct netns_xfrm {
17 struct list_head state_all;
18 /*
19 * Hash table to find appropriate SA towards given target (endpoint of
20 * tunnel or destination of transport mode) allowed by selector.
21 *
22 * Main use is finding SA after policy selected tunnel or transport
23 * mode. Also, it can be used by ah/esp icmp error handler to find
24 * offending SA.
25 */
26 struct hlist_head *state_bydst;
27 struct hlist_head *state_bysrc;
28 struct hlist_head *state_byspi;
29 unsigned int state_hmask;
30 unsigned int state_num;
31 struct work_struct state_hash_work;
32 struct hlist_head state_gc_list;
33 struct work_struct state_gc_work;
34
35 wait_queue_head_t km_waitq;
36
37 struct list_head policy_all;
38 struct hlist_head *policy_byidx;
39 unsigned int policy_idx_hmask;
40 struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2];
41 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
42 unsigned int policy_count[XFRM_POLICY_MAX * 2];
43 struct work_struct policy_hash_work;
44
45 struct sock *nlsk;
46
47 u32 sysctl_aevent_etime;
48 u32 sysctl_aevent_rseqth;
49 int sysctl_larval_drop;
50 u32 sysctl_acq_expires;
51#ifdef CONFIG_SYSCTL
52 struct ctl_table_header *sysctl_hdr;
53#endif
54};
55
56#endif
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index fcd793030e4d..4c61cdce4e5f 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -35,12 +35,12 @@ struct pep_sock {
35 struct sock *listener; 35 struct sock *listener;
36 struct sk_buff_head ctrlreq_queue; 36 struct sk_buff_head ctrlreq_queue;
37#define PNPIPE_CTRLREQ_MAX 10 37#define PNPIPE_CTRLREQ_MAX 10
38 atomic_t tx_credits;
38 int ifindex; 39 int ifindex;
39 u16 peer_type; /* peer type/subtype */ 40 u16 peer_type; /* peer type/subtype */
40 u8 pipe_handle; 41 u8 pipe_handle;
41 42
42 u8 rx_credits; 43 u8 rx_credits;
43 u8 tx_credits;
44 u8 rx_fc; /* RX flow control */ 44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */ 45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 46 u8 init_enable; /* auto-enable at creation */
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index c6a245184460..057b0a8a2885 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -46,7 +46,7 @@ static inline struct pn_sock *pn_sk(struct sock *sk)
46 46
47extern const struct proto_ops phonet_dgram_ops; 47extern const struct proto_ops phonet_dgram_ops;
48 48
49struct sock *pn_find_sock_by_sa(const struct sockaddr_pn *sa); 49struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
50void phonet_get_local_port_range(int *min, int *max); 50void phonet_get_local_port_range(int *min, int *max);
51void pn_sock_hash(struct sock *sk); 51void pn_sock_hash(struct sock *sk);
52void pn_sock_unhash(struct sock *sk); 52void pn_sock_unhash(struct sock *sk);
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index bbd2a836e04c..aa1c59a1d33f 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -43,7 +43,7 @@ struct net_device *phonet_device_get(struct net *net);
43int phonet_address_add(struct net_device *dev, u8 addr); 43int phonet_address_add(struct net_device *dev, u8 addr);
44int phonet_address_del(struct net_device *dev, u8 addr); 44int phonet_address_del(struct net_device *dev, u8 addr);
45u8 phonet_address_get(struct net_device *dev, u8 addr); 45u8 phonet_address_get(struct net_device *dev, u8 addr);
46int phonet_address_lookup(u8 addr); 46int phonet_address_lookup(struct net *net, u8 addr);
47 47
48#define PN_NO_ADDR 0xff 48#define PN_NO_ADDR 0xff
49 49
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index aa9e282db485..d1ca31444644 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -246,7 +246,7 @@ struct tcf_ematch_ops
246}; 246};
247 247
248extern int tcf_em_register(struct tcf_ematch_ops *); 248extern int tcf_em_register(struct tcf_ematch_ops *);
249extern int tcf_em_unregister(struct tcf_ematch_ops *); 249extern void tcf_em_unregister(struct tcf_ematch_ops *);
250extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, 250extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *,
251 struct tcf_ematch_tree *); 251 struct tcf_ematch_tree *);
252extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); 252extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 8d024d7cb741..cb2965aa1b62 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -39,6 +39,9 @@ struct net_protocol {
39 int (*gso_send_check)(struct sk_buff *skb); 39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 int features); 41 int features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb);
42 unsigned int no_policy:1, 45 unsigned int no_policy:1,
43 netns_ok:1; 46 netns_ok:1;
44}; 47};
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3fe49d808957..f8c47429044a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -53,7 +53,6 @@ struct Qdisc
53 atomic_t refcnt; 53 atomic_t refcnt;
54 unsigned long state; 54 unsigned long state;
55 struct sk_buff *gso_skb; 55 struct sk_buff *gso_skb;
56 struct sk_buff_head requeue;
57 struct sk_buff_head q; 56 struct sk_buff_head q;
58 struct netdev_queue *dev_queue; 57 struct netdev_queue *dev_queue;
59 struct Qdisc *next_sched; 58 struct Qdisc *next_sched;
@@ -111,7 +110,7 @@ struct Qdisc_ops
111 110
112 int (*enqueue)(struct sk_buff *, struct Qdisc *); 111 int (*enqueue)(struct sk_buff *, struct Qdisc *);
113 struct sk_buff * (*dequeue)(struct Qdisc *); 112 struct sk_buff * (*dequeue)(struct Qdisc *);
114 int (*requeue)(struct sk_buff *, struct Qdisc *); 113 struct sk_buff * (*peek)(struct Qdisc *);
115 unsigned int (*drop)(struct Qdisc *); 114 unsigned int (*drop)(struct Qdisc *);
116 115
117 int (*init)(struct Qdisc *, struct nlattr *arg); 116 int (*init)(struct Qdisc *, struct nlattr *arg);
@@ -432,19 +431,38 @@ static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch)
432 return __qdisc_dequeue_tail(sch, &sch->q); 431 return __qdisc_dequeue_tail(sch, &sch->q);
433} 432}
434 433
435static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, 434static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
436 struct sk_buff_head *list)
437{ 435{
438 __skb_queue_head(list, skb); 436 return skb_peek(&sch->q);
439 sch->qstats.backlog += qdisc_pkt_len(skb); 437}
440 sch->qstats.requeues++;
441 438
442 return NET_XMIT_SUCCESS; 439/* generic pseudo peek method for non-work-conserving qdisc */
440static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
441{
442 /* we can reuse ->gso_skb because peek isn't called for root qdiscs */
443 if (!sch->gso_skb) {
444 sch->gso_skb = sch->dequeue(sch);
445 if (sch->gso_skb)
446 /* it's still part of the queue */
447 sch->q.qlen++;
448 }
449
450 return sch->gso_skb;
443} 451}
444 452
445static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) 453/* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */
454static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
446{ 455{
447 return __qdisc_requeue(skb, sch, &sch->q); 456 struct sk_buff *skb = sch->gso_skb;
457
458 if (skb) {
459 sch->gso_skb = NULL;
460 sch->q.qlen--;
461 } else {
462 skb = sch->dequeue(sch);
463 }
464
465 return skb;
448} 466}
449 467
450static inline void __qdisc_reset_queue(struct Qdisc *sch, 468static inline void __qdisc_reset_queue(struct Qdisc *sch,
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ed71b110edf7..bbb7742195b0 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -138,6 +138,7 @@ void sctp_write_space(struct sock *sk);
138unsigned int sctp_poll(struct file *file, struct socket *sock, 138unsigned int sctp_poll(struct file *file, struct socket *sock,
139 poll_table *wait); 139 poll_table *wait);
140void sctp_sock_rfree(struct sk_buff *skb); 140void sctp_sock_rfree(struct sk_buff *skb);
141extern struct percpu_counter sctp_sockets_allocated;
141 142
142/* 143/*
143 * sctp/primitive.c 144 * sctp/primitive.c
@@ -285,15 +286,15 @@ extern int sctp_debug_flag;
285 if (sctp_debug_flag) { \ 286 if (sctp_debug_flag) { \
286 if (saddr->sa.sa_family == AF_INET6) { \ 287 if (saddr->sa.sa_family == AF_INET6) { \
287 printk(KERN_DEBUG \ 288 printk(KERN_DEBUG \
288 lead NIP6_FMT trail, \ 289 lead "%pI6" trail, \
289 leadparm, \ 290 leadparm, \
290 NIP6(saddr->v6.sin6_addr), \ 291 &saddr->v6.sin6_addr, \
291 otherparms); \ 292 otherparms); \
292 } else { \ 293 } else { \
293 printk(KERN_DEBUG \ 294 printk(KERN_DEBUG \
294 lead NIPQUAD_FMT trail, \ 295 lead "%pI4" trail, \
295 leadparm, \ 296 leadparm, \
296 NIPQUAD(saddr->v4.sin_addr.s_addr), \ 297 &saddr->v4.sin_addr.s_addr, \
297 otherparms); \ 298 otherparms); \
298 } \ 299 } \
299 } 300 }
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f205b10f0ab9..b259fc5798fb 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -118,6 +118,8 @@ enum sctp_optname {
118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS 118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ 119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */
120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS 120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS
121 SCTP_GET_ASSOC_NUMBER, /* Read only */
122#define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER
121 123
122 124
123 /* Internal Socket Options. Some of the sctp library functions are 125 /* Internal Socket Options. Some of the sctp library functions are
diff --git a/include/net/sock.h b/include/net/sock.h
index 2f47107f6d0f..5a3a151bd730 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -42,6 +42,7 @@
42 42
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/list.h> 44#include <linux/list.h>
45#include <linux/list_nulls.h>
45#include <linux/timer.h> 46#include <linux/timer.h>
46#include <linux/cache.h> 47#include <linux/cache.h>
47#include <linux/module.h> 48#include <linux/module.h>
@@ -52,6 +53,7 @@
52#include <linux/security.h> 53#include <linux/security.h>
53 54
54#include <linux/filter.h> 55#include <linux/filter.h>
56#include <linux/rculist_nulls.h>
55 57
56#include <asm/atomic.h> 58#include <asm/atomic.h>
57#include <net/dst.h> 59#include <net/dst.h>
@@ -106,6 +108,7 @@ struct net;
106 * @skc_reuse: %SO_REUSEADDR setting 108 * @skc_reuse: %SO_REUSEADDR setting
107 * @skc_bound_dev_if: bound device index if != 0 109 * @skc_bound_dev_if: bound device index if != 0
108 * @skc_node: main hash linkage for various protocol lookup tables 110 * @skc_node: main hash linkage for various protocol lookup tables
111 * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
109 * @skc_bind_node: bind hash linkage for various protocol lookup tables 112 * @skc_bind_node: bind hash linkage for various protocol lookup tables
110 * @skc_refcnt: reference count 113 * @skc_refcnt: reference count
111 * @skc_hash: hash value used with various protocol lookup tables 114 * @skc_hash: hash value used with various protocol lookup tables
@@ -120,7 +123,10 @@ struct sock_common {
120 volatile unsigned char skc_state; 123 volatile unsigned char skc_state;
121 unsigned char skc_reuse; 124 unsigned char skc_reuse;
122 int skc_bound_dev_if; 125 int skc_bound_dev_if;
123 struct hlist_node skc_node; 126 union {
127 struct hlist_node skc_node;
128 struct hlist_nulls_node skc_nulls_node;
129 };
124 struct hlist_node skc_bind_node; 130 struct hlist_node skc_bind_node;
125 atomic_t skc_refcnt; 131 atomic_t skc_refcnt;
126 unsigned int skc_hash; 132 unsigned int skc_hash;
@@ -206,6 +212,7 @@ struct sock {
206#define sk_reuse __sk_common.skc_reuse 212#define sk_reuse __sk_common.skc_reuse
207#define sk_bound_dev_if __sk_common.skc_bound_dev_if 213#define sk_bound_dev_if __sk_common.skc_bound_dev_if
208#define sk_node __sk_common.skc_node 214#define sk_node __sk_common.skc_node
215#define sk_nulls_node __sk_common.skc_nulls_node
209#define sk_bind_node __sk_common.skc_bind_node 216#define sk_bind_node __sk_common.skc_bind_node
210#define sk_refcnt __sk_common.skc_refcnt 217#define sk_refcnt __sk_common.skc_refcnt
211#define sk_hash __sk_common.skc_hash 218#define sk_hash __sk_common.skc_hash
@@ -229,7 +236,9 @@ struct sock {
229 } sk_backlog; 236 } sk_backlog;
230 wait_queue_head_t *sk_sleep; 237 wait_queue_head_t *sk_sleep;
231 struct dst_entry *sk_dst_cache; 238 struct dst_entry *sk_dst_cache;
239#ifdef CONFIG_XFRM
232 struct xfrm_policy *sk_policy[2]; 240 struct xfrm_policy *sk_policy[2];
241#endif
233 rwlock_t sk_dst_lock; 242 rwlock_t sk_dst_lock;
234 atomic_t sk_rmem_alloc; 243 atomic_t sk_rmem_alloc;
235 atomic_t sk_wmem_alloc; 244 atomic_t sk_wmem_alloc;
@@ -237,7 +246,9 @@ struct sock {
237 int sk_sndbuf; 246 int sk_sndbuf;
238 struct sk_buff_head sk_receive_queue; 247 struct sk_buff_head sk_receive_queue;
239 struct sk_buff_head sk_write_queue; 248 struct sk_buff_head sk_write_queue;
249#ifdef CONFIG_NET_DMA
240 struct sk_buff_head sk_async_wait_queue; 250 struct sk_buff_head sk_async_wait_queue;
251#endif
241 int sk_wmem_queued; 252 int sk_wmem_queued;
242 int sk_forward_alloc; 253 int sk_forward_alloc;
243 gfp_t sk_allocation; 254 gfp_t sk_allocation;
@@ -269,7 +280,9 @@ struct sock {
269 struct sk_buff *sk_send_head; 280 struct sk_buff *sk_send_head;
270 __u32 sk_sndmsg_off; 281 __u32 sk_sndmsg_off;
271 int sk_write_pending; 282 int sk_write_pending;
283#ifdef CONFIG_SECURITY
272 void *sk_security; 284 void *sk_security;
285#endif
273 __u32 sk_mark; 286 __u32 sk_mark;
274 /* XXX 4 bytes hole on 64 bit */ 287 /* XXX 4 bytes hole on 64 bit */
275 void (*sk_state_change)(struct sock *sk); 288 void (*sk_state_change)(struct sock *sk);
@@ -294,12 +307,30 @@ static inline struct sock *sk_head(const struct hlist_head *head)
294 return hlist_empty(head) ? NULL : __sk_head(head); 307 return hlist_empty(head) ? NULL : __sk_head(head);
295} 308}
296 309
310static inline struct sock *__sk_nulls_head(const struct hlist_nulls_head *head)
311{
312 return hlist_nulls_entry(head->first, struct sock, sk_nulls_node);
313}
314
315static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)
316{
317 return hlist_nulls_empty(head) ? NULL : __sk_nulls_head(head);
318}
319
297static inline struct sock *sk_next(const struct sock *sk) 320static inline struct sock *sk_next(const struct sock *sk)
298{ 321{
299 return sk->sk_node.next ? 322 return sk->sk_node.next ?
300 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL; 323 hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL;
301} 324}
302 325
326static inline struct sock *sk_nulls_next(const struct sock *sk)
327{
328 return (!is_a_nulls(sk->sk_nulls_node.next)) ?
329 hlist_nulls_entry(sk->sk_nulls_node.next,
330 struct sock, sk_nulls_node) :
331 NULL;
332}
333
303static inline int sk_unhashed(const struct sock *sk) 334static inline int sk_unhashed(const struct sock *sk)
304{ 335{
305 return hlist_unhashed(&sk->sk_node); 336 return hlist_unhashed(&sk->sk_node);
@@ -315,6 +346,11 @@ static __inline__ void sk_node_init(struct hlist_node *node)
315 node->pprev = NULL; 346 node->pprev = NULL;
316} 347}
317 348
349static __inline__ void sk_nulls_node_init(struct hlist_nulls_node *node)
350{
351 node->pprev = NULL;
352}
353
318static __inline__ void __sk_del_node(struct sock *sk) 354static __inline__ void __sk_del_node(struct sock *sk)
319{ 355{
320 __hlist_del(&sk->sk_node); 356 __hlist_del(&sk->sk_node);
@@ -361,6 +397,27 @@ static __inline__ int sk_del_node_init(struct sock *sk)
361 return rc; 397 return rc;
362} 398}
363 399
400static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
401{
402 if (sk_hashed(sk)) {
403 hlist_nulls_del_init_rcu(&sk->sk_nulls_node);
404 return 1;
405 }
406 return 0;
407}
408
409static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk)
410{
411 int rc = __sk_nulls_del_node_init_rcu(sk);
412
413 if (rc) {
414 /* paranoid for a while -acme */
415 WARN_ON(atomic_read(&sk->sk_refcnt) == 1);
416 __sock_put(sk);
417 }
418 return rc;
419}
420
364static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) 421static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list)
365{ 422{
366 hlist_add_head(&sk->sk_node, list); 423 hlist_add_head(&sk->sk_node, list);
@@ -372,6 +429,17 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
372 __sk_add_node(sk, list); 429 __sk_add_node(sk, list);
373} 430}
374 431
432static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
433{
434 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
435}
436
437static __inline__ void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
438{
439 sock_hold(sk);
440 __sk_nulls_add_node_rcu(sk, list);
441}
442
375static __inline__ void __sk_del_bind_node(struct sock *sk) 443static __inline__ void __sk_del_bind_node(struct sock *sk)
376{ 444{
377 __hlist_del(&sk->sk_bind_node); 445 __hlist_del(&sk->sk_bind_node);
@@ -385,9 +453,16 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
385 453
386#define sk_for_each(__sk, node, list) \ 454#define sk_for_each(__sk, node, list) \
387 hlist_for_each_entry(__sk, node, list, sk_node) 455 hlist_for_each_entry(__sk, node, list, sk_node)
456#define sk_nulls_for_each(__sk, node, list) \
457 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
458#define sk_nulls_for_each_rcu(__sk, node, list) \
459 hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node)
388#define sk_for_each_from(__sk, node) \ 460#define sk_for_each_from(__sk, node) \
389 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 461 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
390 hlist_for_each_entry_from(__sk, node, sk_node) 462 hlist_for_each_entry_from(__sk, node, sk_node)
463#define sk_nulls_for_each_from(__sk, node) \
464 if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \
465 hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node)
391#define sk_for_each_continue(__sk, node) \ 466#define sk_for_each_continue(__sk, node) \
392 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 467 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \
393 hlist_for_each_entry_continue(__sk, node, sk_node) 468 hlist_for_each_entry_continue(__sk, node, sk_node)
@@ -574,7 +649,7 @@ struct proto {
574 /* Memory pressure */ 649 /* Memory pressure */
575 void (*enter_memory_pressure)(struct sock *sk); 650 void (*enter_memory_pressure)(struct sock *sk);
576 atomic_t *memory_allocated; /* Current allocated memory. */ 651 atomic_t *memory_allocated; /* Current allocated memory. */
577 atomic_t *sockets_allocated; /* Current number of sockets. */ 652 struct percpu_counter *sockets_allocated; /* Current number of sockets. */
578 /* 653 /*
579 * Pressure flag: try to collapse. 654 * Pressure flag: try to collapse.
580 * Technical note: it is used by multiple contexts non atomically. 655 * Technical note: it is used by multiple contexts non atomically.
@@ -587,17 +662,18 @@ struct proto {
587 int *sysctl_rmem; 662 int *sysctl_rmem;
588 int max_header; 663 int max_header;
589 664
590 struct kmem_cache *slab; 665 struct kmem_cache *slab;
591 unsigned int obj_size; 666 unsigned int obj_size;
667 int slab_flags;
592 668
593 atomic_t *orphan_count; 669 struct percpu_counter *orphan_count;
594 670
595 struct request_sock_ops *rsk_prot; 671 struct request_sock_ops *rsk_prot;
596 struct timewait_sock_ops *twsk_prot; 672 struct timewait_sock_ops *twsk_prot;
597 673
598 union { 674 union {
599 struct inet_hashinfo *hashinfo; 675 struct inet_hashinfo *hashinfo;
600 struct hlist_head *udp_hash; 676 struct udp_table *udp_table;
601 struct raw_hashinfo *raw_hash; 677 struct raw_hashinfo *raw_hash;
602 } h; 678 } h;
603 679
diff --git a/include/net/syncppp.h b/include/net/syncppp.h
deleted file mode 100644
index 9e306f7f579a..000000000000
--- a/include/net/syncppp.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Defines for synchronous PPP/Cisco link level subroutines.
3 *
4 * Copyright (C) 1994 Cronyx Ltd.
5 * Author: Serge Vakulenko, <vak@zebub.msk.su>
6 *
7 * This software is distributed with NO WARRANTIES, not even the implied
8 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * Authors grant any other persons or organizations permission to use
11 * or modify this software as long as this message is kept with the software,
12 * all derivative works or modified versions.
13 *
14 * Version 1.7, Wed Jun 7 22:12:02 MSD 1995
15 *
16 *
17 *
18 */
19
20#ifndef _SYNCPPP_H_
21#define _SYNCPPP_H_ 1
22
23#ifdef __KERNEL__
24struct slcp {
25 u16 state; /* state machine */
26 u32 magic; /* local magic number */
27 u_char echoid; /* id of last keepalive echo request */
28 u_char confid; /* id of last configuration request */
29};
30
31struct sipcp {
32 u16 state; /* state machine */
33 u_char confid; /* id of last configuration request */
34};
35
36struct sppp
37{
38 struct sppp * pp_next; /* next interface in keepalive list */
39 u32 pp_flags; /* use Cisco protocol instead of PPP */
40 u16 pp_alivecnt; /* keepalive packets counter */
41 u16 pp_loopcnt; /* loopback detection counter */
42 u32 pp_seq; /* local sequence number */
43 u32 pp_rseq; /* remote sequence number */
44 struct slcp lcp; /* LCP params */
45 struct sipcp ipcp; /* IPCP params */
46 struct timer_list pp_timer;
47 struct net_device *pp_if;
48 char pp_link_state; /* Link status */
49 spinlock_t lock;
50};
51
52struct ppp_device
53{
54 struct net_device *dev; /* Network device pointer */
55 struct sppp sppp; /* Synchronous PPP */
56};
57
58static inline struct sppp *sppp_of(struct net_device *dev)
59{
60 struct ppp_device **ppp = dev->ml_priv;
61 BUG_ON((*ppp)->dev != dev);
62 return &(*ppp)->sppp;
63}
64
65#define PP_KEEPALIVE 0x01 /* use keepalive protocol */
66#define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */
67#define PP_TIMO 0x04 /* cp_timeout routine active */
68#define PP_DEBUG 0x08
69
70#define PPP_MTU 1500 /* max. transmit unit */
71
72#define LCP_STATE_CLOSED 0 /* LCP state: closed (conf-req sent) */
73#define LCP_STATE_ACK_RCVD 1 /* LCP state: conf-ack received */
74#define LCP_STATE_ACK_SENT 2 /* LCP state: conf-ack sent */
75#define LCP_STATE_OPENED 3 /* LCP state: opened */
76
77#define IPCP_STATE_CLOSED 0 /* IPCP state: closed (conf-req sent) */
78#define IPCP_STATE_ACK_RCVD 1 /* IPCP state: conf-ack received */
79#define IPCP_STATE_ACK_SENT 2 /* IPCP state: conf-ack sent */
80#define IPCP_STATE_OPENED 3 /* IPCP state: opened */
81
82#define SPPP_LINK_DOWN 0 /* link down - no keepalive */
83#define SPPP_LINK_UP 1 /* link is up - keepalive ok */
84
85void sppp_attach (struct ppp_device *pd);
86void sppp_detach (struct net_device *dev);
87int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
88struct sk_buff *sppp_dequeue (struct net_device *dev);
89int sppp_isempty (struct net_device *dev);
90void sppp_flush (struct net_device *dev);
91int sppp_open (struct net_device *dev);
92int sppp_reopen (struct net_device *dev);
93int sppp_close (struct net_device *dev);
94#endif
95
96#define SPPPIOCCISCO (SIOCDEVPRIVATE)
97#define SPPPIOCPPP (SIOCDEVPRIVATE+1)
98#define SPPPIOCDEBUG (SIOCDEVPRIVATE+2)
99#define SPPPIOCSFLAGS (SIOCDEVPRIVATE+3)
100#define SPPPIOCGFLAGS (SIOCDEVPRIVATE+4)
101
102#endif /* _SYNCPPP_H_ */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 438014d57610..218235de8963 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -46,7 +46,7 @@
46 46
47extern struct inet_hashinfo tcp_hashinfo; 47extern struct inet_hashinfo tcp_hashinfo;
48 48
49extern atomic_t tcp_orphan_count; 49extern struct percpu_counter tcp_orphan_count;
50extern void tcp_time_wait(struct sock *sk, int state, int timeo); 50extern void tcp_time_wait(struct sock *sk, int state, int timeo);
51 51
52#define MAX_TCP_HEADER (128 + MAX_HEADER) 52#define MAX_TCP_HEADER (128 + MAX_HEADER)
@@ -238,7 +238,7 @@ extern int sysctl_tcp_slow_start_after_idle;
238extern int sysctl_tcp_max_ssthresh; 238extern int sysctl_tcp_max_ssthresh;
239 239
240extern atomic_t tcp_memory_allocated; 240extern atomic_t tcp_memory_allocated;
241extern atomic_t tcp_sockets_allocated; 241extern struct percpu_counter tcp_sockets_allocated;
242extern int tcp_memory_pressure; 242extern int tcp_memory_pressure;
243 243
244/* 244/*
@@ -472,8 +472,6 @@ extern void tcp_send_delayed_ack(struct sock *sk);
472 472
473/* tcp_input.c */ 473/* tcp_input.c */
474extern void tcp_cwnd_application_limited(struct sock *sk); 474extern void tcp_cwnd_application_limited(struct sock *sk);
475extern void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp,
476 struct sk_buff *skb);
477 475
478/* tcp_timer.c */ 476/* tcp_timer.c */
479extern void tcp_init_xmit_timers(struct sock *); 477extern void tcp_init_xmit_timers(struct sock *);
@@ -590,7 +588,6 @@ struct tcp_skb_cb {
590#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 588#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
591#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 589#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
592 590
593 __u16 urg_ptr; /* Valid w/URG flags is set. */
594 __u32 ack_seq; /* Sequence number ACK'd */ 591 __u32 ack_seq; /* Sequence number ACK'd */
595}; 592};
596 593
@@ -764,8 +761,6 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
764 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 761 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
765} 762}
766 763
767extern int tcp_limit_reno_sacked(struct tcp_sock *tp);
768
769/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 764/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
770 * The exception is rate halving phase, when cwnd is decreasing towards 765 * The exception is rate halving phase, when cwnd is decreasing towards
771 * ssthresh. 766 * ssthresh.
@@ -1195,6 +1190,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu
1195 return skb_queue_next(&sk->sk_write_queue, skb); 1190 return skb_queue_next(&sk->sk_write_queue, skb);
1196} 1191}
1197 1192
1193static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_buff *skb)
1194{
1195 return skb_queue_prev(&sk->sk_write_queue, skb);
1196}
1197
1198#define tcp_for_write_queue(skb, sk) \ 1198#define tcp_for_write_queue(skb, sk) \
1199 skb_queue_walk(&(sk)->sk_write_queue, skb) 1199 skb_queue_walk(&(sk)->sk_write_queue, skb)
1200 1200
@@ -1358,6 +1358,12 @@ extern void tcp_v4_destroy_sock(struct sock *sk);
1358 1358
1359extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1359extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1360extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); 1360extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
1361extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1362 struct sk_buff *skb);
1363extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
1364 struct sk_buff *skb);
1365extern int tcp_gro_complete(struct sk_buff *skb);
1366extern int tcp4_gro_complete(struct sk_buff *skb);
1361 1367
1362#ifdef CONFIG_PROC_FS 1368#ifdef CONFIG_PROC_FS
1363extern int tcp4_proc_init(void); 1369extern int tcp4_proc_init(void);
diff --git a/include/net/udp.h b/include/net/udp.h
index 1e205095ea68..90e6ce56be65 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -50,8 +50,15 @@ struct udp_skb_cb {
50}; 50};
51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb)) 51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb))
52 52
53extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; 53struct udp_hslot {
54extern rwlock_t udp_hash_lock; 54 struct hlist_nulls_head head;
55 spinlock_t lock;
56} __attribute__((aligned(2 * sizeof(long))));
57struct udp_table {
58 struct udp_hslot hash[UDP_HTABLE_SIZE];
59};
60extern struct udp_table udp_table;
61extern void udp_table_init(struct udp_table *);
55 62
56 63
57/* Note: this must match 'valbool' in sock_setsockopt */ 64/* Note: this must match 'valbool' in sock_setsockopt */
@@ -110,15 +117,7 @@ static inline void udp_lib_hash(struct sock *sk)
110 BUG(); 117 BUG();
111} 118}
112 119
113static inline void udp_lib_unhash(struct sock *sk) 120extern void udp_lib_unhash(struct sock *sk);
114{
115 write_lock_bh(&udp_hash_lock);
116 if (sk_del_node_init(sk)) {
117 inet_sk(sk)->num = 0;
118 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
119 }
120 write_unlock_bh(&udp_hash_lock);
121}
122 121
123static inline void udp_lib_close(struct sock *sk, long timeout) 122static inline void udp_lib_close(struct sock *sk, long timeout)
124{ 123{
@@ -187,7 +186,7 @@ extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
187struct udp_seq_afinfo { 186struct udp_seq_afinfo {
188 char *name; 187 char *name;
189 sa_family_t family; 188 sa_family_t family;
190 struct hlist_head *hashtable; 189 struct udp_table *udp_table;
191 struct file_operations seq_fops; 190 struct file_operations seq_fops;
192 struct seq_operations seq_ops; 191 struct seq_operations seq_ops;
193}; 192};
@@ -196,7 +195,7 @@ struct udp_iter_state {
196 struct seq_net_private p; 195 struct seq_net_private p;
197 sa_family_t family; 196 sa_family_t family;
198 int bucket; 197 int bucket;
199 struct hlist_head *hashtable; 198 struct udp_table *udp_table;
200}; 199};
201 200
202#ifdef CONFIG_PROC_FS 201#ifdef CONFIG_PROC_FS
diff --git a/include/net/udplite.h b/include/net/udplite.h
index b76b2e377af4..afdffe607b24 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -11,7 +11,7 @@
11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */ 11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */
12 12
13extern struct proto udplite_prot; 13extern struct proto udplite_prot;
14extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; 14extern struct udp_table udplite_table;
15 15
16/* 16/*
17 * Checksum computation is all in software, hence simpler getfrag. 17 * Checksum computation is all in software, hence simpler getfrag.
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 721efb363db7..21c5d966142d 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -10,6 +10,7 @@
10#include <linux/netdevice.h> 10#include <linux/netdevice.h>
11#include <linux/debugfs.h> 11#include <linux/debugfs.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/ieee80211.h>
13#include <net/cfg80211.h> 14#include <net/cfg80211.h>
14 15
15/** 16/**
@@ -133,23 +134,23 @@ struct ieee80211_rate {
133}; 134};
134 135
135/** 136/**
136 * struct ieee80211_ht_info - describing STA's HT capabilities 137 * struct ieee80211_sta_ht_cap - STA's HT capabilities
137 * 138 *
138 * This structure describes most essential parameters needed 139 * This structure describes most essential parameters needed
139 * to describe 802.11n HT capabilities for an STA. 140 * to describe 802.11n HT capabilities for an STA.
140 * 141 *
141 * @ht_supported: is HT supported by STA, 0: no, 1: yes 142 * @ht_supported: is HT supported by the STA
142 * @cap: HT capabilities map as described in 802.11n spec 143 * @cap: HT capabilities map as described in 802.11n spec
143 * @ampdu_factor: Maximum A-MPDU length factor 144 * @ampdu_factor: Maximum A-MPDU length factor
144 * @ampdu_density: Minimum A-MPDU spacing 145 * @ampdu_density: Minimum A-MPDU spacing
145 * @supp_mcs_set: Supported MCS set as described in 802.11n spec 146 * @mcs: Supported MCS rates
146 */ 147 */
147struct ieee80211_ht_info { 148struct ieee80211_sta_ht_cap {
148 u16 cap; /* use IEEE80211_HT_CAP_ */ 149 u16 cap; /* use IEEE80211_HT_CAP_ */
149 u8 ht_supported; 150 bool ht_supported;
150 u8 ampdu_factor; 151 u8 ampdu_factor;
151 u8 ampdu_density; 152 u8 ampdu_density;
152 u8 supp_mcs_set[16]; 153 struct ieee80211_mcs_info mcs;
153}; 154};
154 155
155/** 156/**
@@ -173,13 +174,18 @@ struct ieee80211_supported_band {
173 enum ieee80211_band band; 174 enum ieee80211_band band;
174 int n_channels; 175 int n_channels;
175 int n_bitrates; 176 int n_bitrates;
176 struct ieee80211_ht_info ht_info; 177 struct ieee80211_sta_ht_cap ht_cap;
177}; 178};
178 179
179/** 180/**
180 * struct wiphy - wireless hardware description 181 * struct wiphy - wireless hardware description
181 * @idx: the wiphy index assigned to this item 182 * @idx: the wiphy index assigned to this item
182 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device
185 * has its own regulatory solution and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE).
183 * @reg_notifier: the driver's regulatory notification callback 189 * @reg_notifier: the driver's regulatory notification callback
184 */ 190 */
185struct wiphy { 191struct wiphy {
@@ -191,6 +197,8 @@ struct wiphy {
191 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
192 u16 interface_modes; 198 u16 interface_modes;
193 199
200 bool fw_handles_regulatory;
201
194 /* If multiple wiphys are registered and you're handed e.g. 202 /* If multiple wiphys are registered and you're handed e.g.
195 * a regular netdev with assigned ieee80211_ptr, you won't 203 * a regular netdev with assigned ieee80211_ptr, you won't
196 * know whether it points to a wiphy your driver has registered 204 * know whether it points to a wiphy your driver has registered
@@ -262,9 +270,9 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
262/** 270/**
263 * wiphy_name - get wiphy name 271 * wiphy_name - get wiphy name
264 */ 272 */
265static inline char *wiphy_name(struct wiphy *wiphy) 273static inline const char *wiphy_name(struct wiphy *wiphy)
266{ 274{
267 return wiphy->dev.bus_id; 275 return dev_name(&wiphy->dev);
268} 276}
269 277
270/** 278/**
@@ -340,55 +348,51 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
340} 348}
341 349
342/** 350/**
343 * __regulatory_hint - hint to the wireless core a regulatory domain 351 * ieee80211_get_response_rate - get basic rate for a given rate
344 * @wiphy: if a driver is providing the hint this is the driver's very
345 * own &struct wiphy
346 * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
347 * should be in. If @rd is set this should be NULL
348 * @rd: a complete regulatory domain, if passed the caller need not worry
349 * about freeing it
350 *
351 * The Wireless subsystem can use this function to hint to the wireless core
352 * what it believes should be the current regulatory domain by
353 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
354 * domain should be in or by providing a completely build regulatory domain.
355 * 352 *
356 * Returns -EALREADY if *a regulatory domain* has already been set. Note that 353 * @sband: the band to look for rates in
357 * this could be by another driver. It is safe for drivers to continue if 354 * @basic_rates: bitmap of basic rates
358 * -EALREADY is returned, if drivers are not capable of world roaming they 355 * @bitrate: the bitrate for which to find the basic rate
359 * should not register more channels than they support. Right now we only
360 * support listening to the first driver hint. If the driver is capable
361 * of world roaming but wants to respect its own EEPROM mappings for
362 * specific regulatory domains it should register the @reg_notifier callback
363 * on the &struct wiphy. Returns 0 if the hint went through fine or through an
364 * intersection operation. Otherwise a standard error code is returned.
365 * 356 *
357 * This function returns the basic rate corresponding to a given
358 * bitrate, that is the next lower bitrate contained in the basic
359 * rate map, which is, for this function, given as a bitmap of
360 * indices of rates in the band's bitrate table.
366 */ 361 */
367extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, 362struct ieee80211_rate *
368 const char *alpha2, struct ieee80211_regdomain *rd); 363ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate);
365
369/** 366/**
370 * regulatory_hint - driver hint to the wireless core a regulatory domain 367 * regulatory_hint - driver hint to the wireless core a regulatory domain
371 * @wiphy: the driver's very own &struct wiphy 368 * @wiphy: the wireless device giving the hint (used only for reporting
369 * conflicts)
372 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 370 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
373 * should be in. If @rd is set this should be NULL. Note that if you 371 * should be in. If @rd is set this should be NULL. Note that if you
374 * set this to NULL you should still set rd->alpha2 to some accepted 372 * set this to NULL you should still set rd->alpha2 to some accepted
375 * alpha2. 373 * alpha2.
376 * @rd: a complete regulatory domain provided by the driver. If passed
377 * the driver does not need to worry about freeing it.
378 * 374 *
379 * Wireless drivers can use this function to hint to the wireless core 375 * Wireless drivers can use this function to hint to the wireless core
380 * what it believes should be the current regulatory domain by 376 * what it believes should be the current regulatory domain by
381 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 377 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
382 * domain should be in or by providing a completely build regulatory domain. 378 * domain should be in or by providing a completely build regulatory domain.
383 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 379 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
384 * for a regulatory domain structure for the respective country. If 380 * for a regulatory domain structure for the respective country.
385 * a regulatory domain is build and passed you should set the alpha2 381 */
386 * if possible, otherwise set it to the special value of "99" which tells 382extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
387 * the wireless core it is unknown. If you pass a built regulatory domain 383
388 * and we return non zero you are in charge of kfree()'ing the structure. 384/**
385 * regulatory_hint_11d - hints a country IE as a regulatory domain
386 * @wiphy: the wireless device giving the hint (used only for reporting
387 * conflicts)
388 * @country_ie: pointer to the country IE
389 * @country_ie_len: length of the country IE
389 * 390 *
390 * See __regulatory_hint() documentation for possible return values. 391 * We will intersect the rd with the what CRDA tells us should apply
392 * for the alpha2 this country IE belongs to, this prevents APs from
393 * sending us incorrect or outdated information against a country.
391 */ 394 */
392extern int regulatory_hint(struct wiphy *wiphy, 395extern void regulatory_hint_11d(struct wiphy *wiphy,
393 const char *alpha2, struct ieee80211_regdomain *rd); 396 u8 *country_ie,
397 u8 country_ie_len);
394#endif /* __NET_WIRELESS_H */ 398#endif /* __NET_WIRELESS_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 11c890ad8ebb..2e9f5c0018ae 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -38,22 +38,15 @@
38 MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) 38 MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto))
39 39
40#ifdef CONFIG_XFRM_STATISTICS 40#ifdef CONFIG_XFRM_STATISTICS
41DECLARE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); 41#define XFRM_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.xfrm_statistics, field)
42#define XFRM_INC_STATS(field) SNMP_INC_STATS(xfrm_statistics, field) 42#define XFRM_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.xfrm_statistics, field)
43#define XFRM_INC_STATS_BH(field) SNMP_INC_STATS_BH(xfrm_statistics, field) 43#define XFRM_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)-mib.xfrm_statistics, field)
44#define XFRM_INC_STATS_USER(field) SNMP_INC_STATS_USER(xfrm_statistics, field)
45#else 44#else
46#define XFRM_INC_STATS(field) 45#define XFRM_INC_STATS(net, field) ((void)(net))
47#define XFRM_INC_STATS_BH(field) 46#define XFRM_INC_STATS_BH(net, field) ((void)(net))
48#define XFRM_INC_STATS_USER(field) 47#define XFRM_INC_STATS_USER(net, field) ((void)(net))
49#endif 48#endif
50 49
51extern struct sock *xfrm_nl;
52extern u32 sysctl_xfrm_aevent_etime;
53extern u32 sysctl_xfrm_aevent_rseqth;
54extern int sysctl_xfrm_larval_drop;
55extern u32 sysctl_xfrm_acq_expires;
56
57extern struct mutex xfrm_cfg_mutex; 50extern struct mutex xfrm_cfg_mutex;
58 51
59/* Organization of SPD aka "XFRM rules" 52/* Organization of SPD aka "XFRM rules"
@@ -130,6 +123,9 @@ struct xfrm_state_walk {
130/* Full description of state of transformer. */ 123/* Full description of state of transformer. */
131struct xfrm_state 124struct xfrm_state
132{ 125{
126#ifdef CONFIG_NET_NS
127 struct net *xs_net;
128#endif
133 union { 129 union {
134 struct hlist_node gclist; 130 struct hlist_node gclist;
135 struct hlist_node bydst; 131 struct hlist_node bydst;
@@ -223,6 +219,11 @@ struct xfrm_state
223 void *data; 219 void *data;
224}; 220};
225 221
222static inline struct net *xs_net(struct xfrm_state *x)
223{
224 return read_pnet(&x->xs_net);
225}
226
226/* xflags - make enum if more show up */ 227/* xflags - make enum if more show up */
227#define XFRM_TIME_DEFER 1 228#define XFRM_TIME_DEFER 1
228 229
@@ -249,6 +250,7 @@ struct km_event
249 u32 seq; 250 u32 seq;
250 u32 pid; 251 u32 pid;
251 u32 event; 252 u32 event;
253 struct net *net;
252}; 254};
253 255
254struct net_device; 256struct net_device;
@@ -257,10 +259,11 @@ struct xfrm_dst;
257struct xfrm_policy_afinfo { 259struct xfrm_policy_afinfo {
258 unsigned short family; 260 unsigned short family;
259 struct dst_ops *dst_ops; 261 struct dst_ops *dst_ops;
260 void (*garbage_collect)(void); 262 void (*garbage_collect)(struct net *net);
261 struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, 263 struct dst_entry *(*dst_lookup)(struct net *net, int tos,
264 xfrm_address_t *saddr,
262 xfrm_address_t *daddr); 265 xfrm_address_t *daddr);
263 int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); 266 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
264 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); 267 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
265 void (*decode_session)(struct sk_buff *skb, 268 void (*decode_session)(struct sk_buff *skb,
266 struct flowi *fl, 269 struct flowi *fl,
@@ -467,7 +470,9 @@ struct xfrm_policy_walk {
467 470
468struct xfrm_policy 471struct xfrm_policy
469{ 472{
470 struct xfrm_policy *next; 473#ifdef CONFIG_NET_NS
474 struct net *xp_net;
475#endif
471 struct hlist_node bydst; 476 struct hlist_node bydst;
472 struct hlist_node byidx; 477 struct hlist_node byidx;
473 478
@@ -492,6 +497,11 @@ struct xfrm_policy
492 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 497 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
493}; 498};
494 499
500static inline struct net *xp_net(struct xfrm_policy *xp)
501{
502 return read_pnet(&xp->xp_net);
503}
504
495struct xfrm_kmaddress { 505struct xfrm_kmaddress {
496 xfrm_address_t local; 506 xfrm_address_t local;
497 xfrm_address_t remote; 507 xfrm_address_t remote;
@@ -537,15 +547,13 @@ struct xfrm_mgr
537 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 547 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
538 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 548 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
539 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 549 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
540 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 550 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
541 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); 551 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k);
542}; 552};
543 553
544extern int xfrm_register_km(struct xfrm_mgr *km); 554extern int xfrm_register_km(struct xfrm_mgr *km);
545extern int xfrm_unregister_km(struct xfrm_mgr *km); 555extern int xfrm_unregister_km(struct xfrm_mgr *km);
546 556
547extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
548
549/* 557/*
550 * This structure is used for the duration where packets are being 558 * This structure is used for the duration where packets are being
551 * transformed by IPsec. As soon as the packet leaves IPsec the 559 * transformed by IPsec. As soon as the packet leaves IPsec the
@@ -882,6 +890,7 @@ struct xfrm_dst
882 u32 path_cookie; 890 u32 path_cookie;
883}; 891};
884 892
893#ifdef CONFIG_XFRM
885static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) 894static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
886{ 895{
887 dst_release(xdst->route); 896 dst_release(xdst->route);
@@ -894,6 +903,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
894 xdst->partner = NULL; 903 xdst->partner = NULL;
895#endif 904#endif
896} 905}
906#endif
897 907
898extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 908extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
899 909
@@ -977,12 +987,13 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir,
977 struct sk_buff *skb, 987 struct sk_buff *skb,
978 unsigned int family, int reverse) 988 unsigned int family, int reverse)
979{ 989{
990 struct net *net = dev_net(skb->dev);
980 int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0); 991 int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0);
981 992
982 if (sk && sk->sk_policy[XFRM_POLICY_IN]) 993 if (sk && sk->sk_policy[XFRM_POLICY_IN])
983 return __xfrm_policy_check(sk, ndir, skb, family); 994 return __xfrm_policy_check(sk, ndir, skb, family);
984 995
985 return (!xfrm_policy_count[dir] && !skb->sp) || 996 return (!net->xfrm.policy_count[dir] && !skb->sp) ||
986 (skb->dst->flags & DST_NOPOLICY) || 997 (skb->dst->flags & DST_NOPOLICY) ||
987 __xfrm_policy_check(sk, ndir, skb, family); 998 __xfrm_policy_check(sk, ndir, skb, family);
988} 999}
@@ -1034,7 +1045,9 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
1034 1045
1035static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 1046static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1036{ 1047{
1037 return !xfrm_policy_count[XFRM_POLICY_OUT] || 1048 struct net *net = dev_net(skb->dev);
1049
1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] ||
1038 (skb->dst->flags & DST_NOXFRM) || 1051 (skb->dst->flags & DST_NOXFRM) ||
1039 __xfrm_route_forward(skb, family); 1052 __xfrm_route_forward(skb, family);
1040} 1053}
@@ -1268,7 +1281,8 @@ struct xfrm6_tunnel {
1268 1281
1269extern void xfrm_init(void); 1282extern void xfrm_init(void);
1270extern void xfrm4_init(void); 1283extern void xfrm4_init(void);
1271extern void xfrm_state_init(void); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net);
1272extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);
1273#ifdef CONFIG_XFRM 1287#ifdef CONFIG_XFRM
1274extern int xfrm6_init(void); 1288extern int xfrm6_init(void);
@@ -1287,19 +1301,30 @@ static inline void xfrm6_fini(void)
1287#endif 1301#endif
1288 1302
1289#ifdef CONFIG_XFRM_STATISTICS 1303#ifdef CONFIG_XFRM_STATISTICS
1290extern int xfrm_proc_init(void); 1304extern int xfrm_proc_init(struct net *net);
1305extern void xfrm_proc_fini(struct net *net);
1306#endif
1307
1308extern int xfrm_sysctl_init(struct net *net);
1309#ifdef CONFIG_SYSCTL
1310extern void xfrm_sysctl_fini(struct net *net);
1311#else
1312static inline void xfrm_sysctl_fini(struct net *net)
1313{
1314}
1291#endif 1315#endif
1292 1316
1293extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1317extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1294extern int xfrm_state_walk(struct xfrm_state_walk *walk, 1318extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1295 int (*func)(struct xfrm_state *, int, void*), void *); 1319 int (*func)(struct xfrm_state *, int, void*), void *);
1296extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1320extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1297extern struct xfrm_state *xfrm_state_alloc(void); 1321extern struct xfrm_state *xfrm_state_alloc(struct net *net);
1298extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1322extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
1299 struct flowi *fl, struct xfrm_tmpl *tmpl, 1323 struct flowi *fl, struct xfrm_tmpl *tmpl,
1300 struct xfrm_policy *pol, int *err, 1324 struct xfrm_policy *pol, int *err,
1301 unsigned short family); 1325 unsigned short family);
1302extern struct xfrm_state * xfrm_stateonly_find(xfrm_address_t *daddr, 1326extern struct xfrm_state * xfrm_stateonly_find(struct net *net,
1327 xfrm_address_t *daddr,
1303 xfrm_address_t *saddr, 1328 xfrm_address_t *saddr,
1304 unsigned short family, 1329 unsigned short family,
1305 u8 mode, u8 proto, u32 reqid); 1330 u8 mode, u8 proto, u32 reqid);
@@ -1307,8 +1332,8 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
1307extern void xfrm_state_insert(struct xfrm_state *x); 1332extern void xfrm_state_insert(struct xfrm_state *x);
1308extern int xfrm_state_add(struct xfrm_state *x); 1333extern int xfrm_state_add(struct xfrm_state *x);
1309extern int xfrm_state_update(struct xfrm_state *x); 1334extern int xfrm_state_update(struct xfrm_state *x);
1310extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); 1335extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family);
1311extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 1336extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family);
1312#ifdef CONFIG_XFRM_SUB_POLICY 1337#ifdef CONFIG_XFRM_SUB_POLICY
1313extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1338extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1314 int n, unsigned short family); 1339 int n, unsigned short family);
@@ -1345,9 +1370,9 @@ struct xfrmk_spdinfo {
1345 u32 spdhmcnt; 1370 u32 spdhmcnt;
1346}; 1371};
1347 1372
1348extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 1373extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq);
1349extern int xfrm_state_delete(struct xfrm_state *x); 1374extern int xfrm_state_delete(struct xfrm_state *x);
1350extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 1375extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1351extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); 1376extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
1352extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); 1377extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
1353extern int xfrm_replay_check(struct xfrm_state *x, 1378extern int xfrm_replay_check(struct xfrm_state *x,
@@ -1415,22 +1440,22 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1415} 1440}
1416#endif 1441#endif
1417 1442
1418struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 1443struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp);
1419 1444
1420extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); 1445extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1421extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, 1446extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1422 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1447 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1423extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1448extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1424int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1449int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1425struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1450struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir,
1426 struct xfrm_selector *sel, 1451 struct xfrm_selector *sel,
1427 struct xfrm_sec_ctx *ctx, int delete, 1452 struct xfrm_sec_ctx *ctx, int delete,
1428 int *err); 1453 int *err);
1429struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); 1454struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err);
1430int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 1455int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1431u32 xfrm_get_acqseq(void); 1456u32 xfrm_get_acqseq(void);
1432extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1457extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1433struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 1458struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto,
1434 xfrm_address_t *daddr, xfrm_address_t *saddr, 1459 xfrm_address_t *daddr, xfrm_address_t *saddr,
1435 int create, unsigned short family); 1460 int create, unsigned short family);
1436extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1461extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
@@ -1449,10 +1474,9 @@ extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1449 struct xfrm_kmaddress *k); 1474 struct xfrm_kmaddress *k);
1450#endif 1475#endif
1451 1476
1452extern wait_queue_head_t km_waitq;
1453extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1477extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1454extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1478extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
1455extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1479extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1456 1480
1457extern void xfrm_input_init(void); 1481extern void xfrm_input_init(void);
1458extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); 1482extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
@@ -1497,18 +1521,20 @@ static inline int xfrm_policy_id2dir(u32 index)
1497 return index & 7; 1521 return index & 7;
1498} 1522}
1499 1523
1500static inline int xfrm_aevent_is_on(void) 1524#ifdef CONFIG_XFRM
1525static inline int xfrm_aevent_is_on(struct net *net)
1501{ 1526{
1502 struct sock *nlsk; 1527 struct sock *nlsk;
1503 int ret = 0; 1528 int ret = 0;
1504 1529
1505 rcu_read_lock(); 1530 rcu_read_lock();
1506 nlsk = rcu_dereference(xfrm_nl); 1531 nlsk = rcu_dereference(net->xfrm.nlsk);
1507 if (nlsk) 1532 if (nlsk)
1508 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS); 1533 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS);
1509 rcu_read_unlock(); 1534 rcu_read_unlock();
1510 return ret; 1535 return ret;
1511} 1536}
1537#endif
1512 1538
1513static inline int xfrm_alg_len(struct xfrm_algo *alg) 1539static inline int xfrm_alg_len(struct xfrm_algo *alg)
1514{ 1540{
@@ -1536,9 +1562,11 @@ static inline void xfrm_states_delete(struct xfrm_state **states, int n)
1536} 1562}
1537#endif 1563#endif
1538 1564
1565#ifdef CONFIG_XFRM
1539static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) 1566static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1540{ 1567{
1541 return skb->sp->xvec[skb->sp->len - 1]; 1568 return skb->sp->xvec[skb->sp->len - 1];
1542} 1569}
1570#endif
1543 1571
1544#endif /* _NET_XFRM_H */ 1572#endif /* _NET_XFRM_H */