diff options
Diffstat (limited to 'include/net')
40 files changed, 973 insertions, 692 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 0e85ec39b63..1d57835d73f 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -280,11 +280,16 @@ struct mpath_info { | |||
280 | * (0 = no, 1 = yes, -1 = do not change) | 280 | * (0 = no, 1 = yes, -1 = do not change) |
281 | * @use_short_slot_time: Whether the use of short slot time is allowed | 281 | * @use_short_slot_time: Whether the use of short slot time is allowed |
282 | * (0 = no, 1 = yes, -1 = do not change) | 282 | * (0 = no, 1 = yes, -1 = do not change) |
283 | * @basic_rates: basic rates in IEEE 802.11 format | ||
284 | * (or NULL for no change) | ||
285 | * @basic_rates_len: number of basic rates | ||
283 | */ | 286 | */ |
284 | struct bss_parameters { | 287 | struct bss_parameters { |
285 | int use_cts_prot; | 288 | int use_cts_prot; |
286 | int use_short_preamble; | 289 | int use_short_preamble; |
287 | int use_short_slot_time; | 290 | int use_short_slot_time; |
291 | u8 *basic_rates; | ||
292 | u8 basic_rates_len; | ||
288 | }; | 293 | }; |
289 | 294 | ||
290 | /** | 295 | /** |
@@ -331,22 +336,59 @@ struct ieee80211_regdomain { | |||
331 | struct ieee80211_reg_rule reg_rules[]; | 336 | struct ieee80211_reg_rule reg_rules[]; |
332 | }; | 337 | }; |
333 | 338 | ||
334 | #define MHZ_TO_KHZ(freq) (freq * 1000) | 339 | #define MHZ_TO_KHZ(freq) ((freq) * 1000) |
335 | #define KHZ_TO_MHZ(freq) (freq / 1000) | 340 | #define KHZ_TO_MHZ(freq) ((freq) / 1000) |
336 | #define DBI_TO_MBI(gain) (gain * 100) | 341 | #define DBI_TO_MBI(gain) ((gain) * 100) |
337 | #define MBI_TO_DBI(gain) (gain / 100) | 342 | #define MBI_TO_DBI(gain) ((gain) / 100) |
338 | #define DBM_TO_MBM(gain) (gain * 100) | 343 | #define DBM_TO_MBM(gain) ((gain) * 100) |
339 | #define MBM_TO_DBM(gain) (gain / 100) | 344 | #define MBM_TO_DBM(gain) ((gain) / 100) |
340 | 345 | ||
341 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ | 346 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ |
342 | .freq_range.start_freq_khz = (start) * 1000, \ | 347 | .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ |
343 | .freq_range.end_freq_khz = (end) * 1000, \ | 348 | .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ |
344 | .freq_range.max_bandwidth_khz = (bw) * 1000, \ | 349 | .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ |
345 | .power_rule.max_antenna_gain = (gain) * 100, \ | 350 | .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \ |
346 | .power_rule.max_eirp = (eirp) * 100, \ | 351 | .power_rule.max_eirp = DBM_TO_MBM(eirp), \ |
347 | .flags = reg_flags, \ | 352 | .flags = reg_flags, \ |
348 | } | 353 | } |
349 | 354 | ||
355 | struct mesh_config { | ||
356 | /* Timeouts in ms */ | ||
357 | /* Mesh plink management parameters */ | ||
358 | u16 dot11MeshRetryTimeout; | ||
359 | u16 dot11MeshConfirmTimeout; | ||
360 | u16 dot11MeshHoldingTimeout; | ||
361 | u16 dot11MeshMaxPeerLinks; | ||
362 | u8 dot11MeshMaxRetries; | ||
363 | u8 dot11MeshTTL; | ||
364 | bool auto_open_plinks; | ||
365 | /* HWMP parameters */ | ||
366 | u8 dot11MeshHWMPmaxPREQretries; | ||
367 | u32 path_refresh_time; | ||
368 | u16 min_discovery_timeout; | ||
369 | u32 dot11MeshHWMPactivePathTimeout; | ||
370 | u16 dot11MeshHWMPpreqMinInterval; | ||
371 | u16 dot11MeshHWMPnetDiameterTraversalTime; | ||
372 | }; | ||
373 | |||
374 | /** | ||
375 | * struct ieee80211_txq_params - TX queue parameters | ||
376 | * @queue: TX queue identifier (NL80211_TXQ_Q_*) | ||
377 | * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled | ||
378 | * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range | ||
379 | * 1..32767] | ||
380 | * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range | ||
381 | * 1..32767] | ||
382 | * @aifs: Arbitration interframe space [0..255] | ||
383 | */ | ||
384 | struct ieee80211_txq_params { | ||
385 | enum nl80211_txq_q queue; | ||
386 | u16 txop; | ||
387 | u16 cwmin; | ||
388 | u16 cwmax; | ||
389 | u8 aifs; | ||
390 | }; | ||
391 | |||
350 | /* from net/wireless.h */ | 392 | /* from net/wireless.h */ |
351 | struct wiphy; | 393 | struct wiphy; |
352 | 394 | ||
@@ -397,9 +439,17 @@ struct wiphy; | |||
397 | * | 439 | * |
398 | * @change_station: Modify a given station. | 440 | * @change_station: Modify a given station. |
399 | * | 441 | * |
442 | * @get_mesh_params: Put the current mesh parameters into *params | ||
443 | * | ||
444 | * @set_mesh_params: Set mesh parameters. | ||
445 | * The mask is a bitfield which tells us which parameters to | ||
446 | * set, and which to leave alone. | ||
447 | * | ||
400 | * @set_mesh_cfg: set mesh parameters (by now, just mesh id) | 448 | * @set_mesh_cfg: set mesh parameters (by now, just mesh id) |
401 | * | 449 | * |
402 | * @change_bss: Modify parameters for a given BSS. | 450 | * @change_bss: Modify parameters for a given BSS. |
451 | * | ||
452 | * @set_txq_params: Set TX queue parameters | ||
403 | */ | 453 | */ |
404 | struct cfg80211_ops { | 454 | struct cfg80211_ops { |
405 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | 455 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, |
@@ -452,9 +502,17 @@ struct cfg80211_ops { | |||
452 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, | 502 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, |
453 | int idx, u8 *dst, u8 *next_hop, | 503 | int idx, u8 *dst, u8 *next_hop, |
454 | struct mpath_info *pinfo); | 504 | struct mpath_info *pinfo); |
455 | 505 | int (*get_mesh_params)(struct wiphy *wiphy, | |
506 | struct net_device *dev, | ||
507 | struct mesh_config *conf); | ||
508 | int (*set_mesh_params)(struct wiphy *wiphy, | ||
509 | struct net_device *dev, | ||
510 | const struct mesh_config *nconf, u32 mask); | ||
456 | int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, | 511 | int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, |
457 | struct bss_parameters *params); | 512 | struct bss_parameters *params); |
513 | |||
514 | int (*set_txq_params)(struct wiphy *wiphy, | ||
515 | struct ieee80211_txq_params *params); | ||
458 | }; | 516 | }; |
459 | 517 | ||
460 | #endif /* __NET_CFG80211_H */ | 518 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/checksum.h b/include/net/checksum.h index 07602b7fa21..ba55d8b8c87 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 | ||
104 | static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) | 104 | static 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 00000000000..91e0a3d7faf --- /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 | */ | ||
27 | struct dcbnl_rtnl_ops { | ||
28 | u8 (*getstate)(struct net_device *); | ||
29 | void (*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 627778384c8..e5469f7b67a 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 | ||
11 | struct dn_scp /* Session Control Port */ | 9 | struct dn_scp /* Session Control Port */ |
12 | { | 10 | { |
@@ -175,7 +173,7 @@ struct dn_skb_cb { | |||
175 | 173 | ||
176 | static inline __le16 dn_eth2dn(unsigned char *ethaddr) | 174 | static 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 | ||
181 | static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) | 179 | static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) |
@@ -185,7 +183,7 @@ static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) | |||
185 | 183 | ||
186 | static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) | 184 | static 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 30125119c95..c378be7bf96 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 | ||
182 | static inline __le16 dnet_make_mask(int n) | 182 | static 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 8a8b71e5f3f..6be3b082a07 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 | ||
158 | static inline void dst_hold(struct dst_entry * dst) | 172 | static 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 | ||
273 | struct flowi; | 292 | struct flowi; |
274 | #ifndef CONFIG_XFRM | 293 | #ifndef CONFIG_XFRM |
275 | static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | 294 | static 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 | } |
280 | static inline int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | 299 | static 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 |
286 | extern int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | 305 | extern 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); |
288 | extern int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | 307 | extern 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 b45a5e4fcad..809970b7dfe 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 | ||
87 | struct net; | ||
87 | struct sock; | 88 | struct sock; |
88 | typedef int (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, | 89 | typedef 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 | ||
91 | extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, | 92 | extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family, |
92 | flow_resolve_t resolver); | 93 | u8 dir, flow_resolve_t resolver); |
93 | extern void flow_cache_flush(void); | 94 | extern void flow_cache_flush(void); |
94 | extern atomic_t flow_cache_genid; | 95 | extern atomic_t flow_cache_genid; |
95 | 96 | ||
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index 8cd8185fa2e..d136b5240ef 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, | |||
45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, | 45 | extern 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 | 48 | extern 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 93a56de3594..7ab3ed2bbcc 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. */ | ||
132 | const 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 */ | ||
247 | enum 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 */ | ||
281 | enum 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 */ |
310 | enum ieee80211_actioncategories { | 221 | enum ieee80211_actioncategories { |
311 | WLAN_ACTION_SPECTRUM_MGMT = 0, | 222 | WLAN_ACTION_SPECTRUM_MGMT = 0, |
@@ -446,8 +357,6 @@ struct ieee80211_stats { | |||
446 | 357 | ||
447 | struct ieee80211_device; | 358 | struct 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) |
@@ -534,15 +443,6 @@ enum ieee80211_mfie { | |||
534 | MFIE_TYPE_QOS_PARAMETER = 222, | 443 | MFIE_TYPE_QOS_PARAMETER = 222, |
535 | }; | 444 | }; |
536 | 445 | ||
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. */ | ||
540 | struct ieee80211_hdr { | ||
541 | __le16 frame_ctl; | ||
542 | __le16 duration_id; | ||
543 | u8 payload[0]; | ||
544 | } __attribute__ ((packed)); | ||
545 | |||
546 | struct ieee80211_hdr_1addr { | 446 | struct ieee80211_hdr_1addr { |
547 | __le16 frame_ctl; | 447 | __le16 frame_ctl; |
548 | __le16 duration_id; | 448 | __le16 duration_id; |
@@ -590,18 +490,6 @@ struct ieee80211_hdr_3addrqos { | |||
590 | __le16 qos_ctl; | 490 | __le16 qos_ctl; |
591 | } __attribute__ ((packed)); | 491 | } __attribute__ ((packed)); |
592 | 492 | ||
593 | struct 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 | |||
605 | struct ieee80211_info_element { | 493 | struct ieee80211_info_element { |
606 | u8 id; | 494 | u8 id; |
607 | u8 len; | 495 | u8 len; |
@@ -733,7 +621,6 @@ struct ieee80211_txb { | |||
733 | 621 | ||
734 | #define MAX_WPA_IE_LEN 64 | 622 | #define MAX_WPA_IE_LEN 64 |
735 | 623 | ||
736 | #define NETWORK_EMPTY_ESSID (1<<0) | ||
737 | #define NETWORK_HAS_OFDM (1<<1) | 624 | #define NETWORK_HAS_OFDM (1<<1) |
738 | #define NETWORK_HAS_CCK (1<<2) | 625 | #define NETWORK_HAS_CCK (1<<2) |
739 | 626 | ||
@@ -1050,11 +937,7 @@ struct ieee80211_device { | |||
1050 | size_t wpa_ie_len; | 937 | size_t wpa_ie_len; |
1051 | u8 *wpa_ie; | 938 | u8 *wpa_ie; |
1052 | 939 | ||
1053 | struct list_head crypt_deinit_list; | 940 | 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 | 941 | ||
1059 | int bcrx_sta_key; /* use individual keys to override default keys even | 942 | int bcrx_sta_key; /* use individual keys to override default keys even |
1060 | * with RX of broad/multicast frames */ | 943 | * with RX of broad/multicast frames */ |
@@ -1135,22 +1018,6 @@ static inline void *ieee80211_priv(struct net_device *dev) | |||
1135 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; | 1018 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; |
1136 | } | 1019 | } |
1137 | 1020 | ||
1138 | static 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 | |||
1154 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, | 1021 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, |
1155 | int mode) | 1022 | int mode) |
1156 | { | 1023 | { |
@@ -1208,7 +1075,7 @@ static inline int ieee80211_get_hdrlen(u16 fc) | |||
1208 | 1075 | ||
1209 | static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) | 1076 | static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) |
1210 | { | 1077 | { |
1211 | switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { | 1078 | switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) { |
1212 | case IEEE80211_1ADDR_LEN: | 1079 | case IEEE80211_1ADDR_LEN: |
1213 | return ((struct ieee80211_hdr_1addr *)hdr)->payload; | 1080 | return ((struct ieee80211_hdr_1addr *)hdr)->payload; |
1214 | case IEEE80211_2ADDR_LEN: | 1081 | case IEEE80211_2ADDR_LEN: |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 5cc182f9eca..f44bb5c77a7 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 | */ |
43 | struct inet_ehash_bucket { | 43 | struct 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 | */ |
79 | struct inet_bind_bucket { | 79 | struct 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 | ||
89 | static 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) | ||
109 | struct 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 | ||
137 | static inline struct inet_ehash_bucket *inet_ehash_bucket( | 155 | static 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 | ||
144 | static inline rwlock_t *inet_ehash_lockp( | 162 | static 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 | ||
230 | extern void inet_put_port(struct sock *sk); | 248 | extern void inet_put_port(struct sock *sk); |
231 | 249 | ||
232 | extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); | 250 | void 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 | */ | ||
239 | static 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 | |||
247 | static 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 | ||
253 | extern void __inet_hash_nolisten(struct sock *sk); | 252 | extern void __inet_hash_nolisten(struct sock *sk); |
254 | extern void inet_hash(struct sock *sk); | 253 | extern 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 80e4977631b..4b8ece22b8e 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 | ||
140 | static inline void inet_twsk_add_node(struct inet_timewait_sock *tw, | 140 | static 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 | ||
146 | static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, | 146 | static 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 bc026ecb513..10868139e65 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); |
115 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); | 115 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); |
116 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, | 116 | extern 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); | |||
187 | extern int sysctl_ip_default_ttl; | 187 | extern int sysctl_ip_default_ttl; |
188 | extern int sysctl_ip_nonlocal_bind; | 188 | extern int sysctl_ip_nonlocal_bind; |
189 | 189 | ||
190 | extern struct ctl_path net_core_path[]; | ||
190 | extern struct ctl_path net_ipv4_ctl_path[]; | 191 | extern 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 fe9fcf73c85..ab9b003ab67 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 b3d65e0bedd..fb4e2784857 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. */ | ||
36 | const 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 | ||
31 | enum { | 41 | enum { |
32 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), | 42 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), |
33 | }; | 43 | }; |
34 | 44 | ||
35 | struct sk_buff; | 45 | struct lib80211_crypto_ops { |
36 | struct module; | ||
37 | |||
38 | struct 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 | ||
90 | struct ieee80211_crypt_data { | 97 | struct 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 | ||
97 | struct ieee80211_device; | 104 | struct lib80211_crypt_info { |
98 | 105 | char *name; | |
99 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | 106 | /* Most clients will already have a lock, |
100 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | 107 | so just point to that. */ |
101 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); | 108 | spinlock_t *lock; |
102 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); | 109 | |
103 | void ieee80211_crypt_deinit_handler(unsigned long); | 110 | struct lib80211_crypt_data *crypt[NUM_WEP_KEYS]; |
104 | void 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; |
106 | void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); | 113 | struct timer_list crypt_deinit_timer; |
114 | int crypt_quiesced; | ||
115 | }; | ||
107 | 116 | ||
108 | #endif | 117 | int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name, |
118 | spinlock_t *lock); | ||
119 | void lib80211_crypt_info_free(struct lib80211_crypt_info *info); | ||
120 | int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops); | ||
121 | int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops); | ||
122 | struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name); | ||
123 | void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *, int); | ||
124 | void lib80211_crypt_deinit_handler(unsigned long); | ||
125 | void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info, | ||
126 | struct lib80211_crypt_data **crypt); | ||
127 | void 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 73d81bc6aa7..6a1d4ea1818 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,19 @@ enum ieee80211_bss_change { | |||
164 | }; | 164 | }; |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * struct ieee80211_bss_ht_conf - BSS's changing HT configuration | ||
168 | * @secondary_channel_offset: secondary channel offset, uses | ||
169 | * %IEEE80211_HT_PARAM_CHA_SEC_ values | ||
170 | * @width_40_ok: indicates that 40 MHz bandwidth may be used for TX | ||
171 | * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info) | ||
172 | */ | ||
173 | struct ieee80211_bss_ht_conf { | ||
174 | u8 secondary_channel_offset; | ||
175 | bool width_40_ok; | ||
176 | u16 operation_mode; | ||
177 | }; | ||
178 | |||
179 | /** | ||
167 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | 180 | * struct ieee80211_bss_conf - holds the BSS's changing parameters |
168 | * | 181 | * |
169 | * This structure keeps information about a BSS (and an association | 182 | * This structure keeps information about a BSS (and an association |
@@ -172,15 +185,17 @@ enum ieee80211_bss_change { | |||
172 | * @assoc: association status | 185 | * @assoc: association status |
173 | * @aid: association ID number, valid only when @assoc is true | 186 | * @aid: association ID number, valid only when @assoc is true |
174 | * @use_cts_prot: use CTS protection | 187 | * @use_cts_prot: use CTS protection |
175 | * @use_short_preamble: use 802.11b short preamble | 188 | * @use_short_preamble: use 802.11b short preamble; |
176 | * @use_short_slot: use short slot time (only relevant for ERP) | 189 | * if the hardware cannot handle this it must set the |
190 | * IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag | ||
191 | * @use_short_slot: use short slot time (only relevant for ERP); | ||
192 | * if the hardware cannot handle this it must set the | ||
193 | * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag | ||
177 | * @dtim_period: num of beacons before the next DTIM, for PSM | 194 | * @dtim_period: num of beacons before the next DTIM, for PSM |
178 | * @timestamp: beacon timestamp | 195 | * @timestamp: beacon timestamp |
179 | * @beacon_int: beacon interval | 196 | * @beacon_int: beacon interval |
180 | * @assoc_capability: capabilities taken from assoc resp | 197 | * @assoc_capability: capabilities taken from assoc resp |
181 | * @assoc_ht: association in HT mode | 198 | * @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 | 199 | * @basic_rates: bitmap of basic rates, each bit stands for an |
185 | * index into the rate table configured by the driver in | 200 | * index into the rate table configured by the driver in |
186 | * the current band. | 201 | * the current band. |
@@ -198,10 +213,7 @@ struct ieee80211_bss_conf { | |||
198 | u16 assoc_capability; | 213 | u16 assoc_capability; |
199 | u64 timestamp; | 214 | u64 timestamp; |
200 | u64 basic_rates; | 215 | u64 basic_rates; |
201 | /* ht related data */ | 216 | 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 | }; | 217 | }; |
206 | 218 | ||
207 | /** | 219 | /** |
@@ -210,29 +222,24 @@ struct ieee80211_bss_conf { | |||
210 | * These flags are used with the @flags member of &ieee80211_tx_info. | 222 | * These flags are used with the @flags member of &ieee80211_tx_info. |
211 | * | 223 | * |
212 | * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. | 224 | * @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 | 225 | * @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., | 226 | * number to this frame, taking care of not overwriting the fragment |
215 | * for combined 802.11g / 802.11b networks) | 227 | * number and increasing the sequence number only when the |
228 | * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly | ||
229 | * assign sequence numbers to QoS-data frames but cannot do so correctly | ||
230 | * for non-QoS-data and management frames because beacons need them from | ||
231 | * that counter as well and mac80211 cannot guarantee proper sequencing. | ||
232 | * If this flag is set, the driver should instruct the hardware to | ||
233 | * assign a sequence number to the frame or assign one itself. Cf. IEEE | ||
234 | * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for | ||
235 | * 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 | 236 | * @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 | 237 | * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination |
219 | * station | 238 | * station |
220 | * @IEEE80211_TX_CTL_REQUEUE: TBD | ||
221 | * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame | 239 | * @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 | 240 | * @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 | 241 | * @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 | 242 | * @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 | 243 | * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted |
237 | * because the destination STA was in powersave mode. | 244 | * because the destination STA was in powersave mode. |
238 | * @IEEE80211_TX_STAT_ACK: Frame was acknowledged | 245 | * @IEEE80211_TX_STAT_ACK: Frame was acknowledged |
@@ -240,63 +247,67 @@ struct ieee80211_bss_conf { | |||
240 | * is for the whole aggregation. | 247 | * is for the whole aggregation. |
241 | * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, | 248 | * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, |
242 | * so consider using block ack request (BAR). | 249 | * so consider using block ack request (BAR). |
243 | * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence | 250 | * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be |
244 | * number to this frame, taking care of not overwriting the fragment | 251 | * set by rate control algorithms to indicate probe rate, will |
245 | * number and increasing the sequence number only when the | 252 | * 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 | */ | 253 | */ |
255 | enum mac80211_tx_control_flags { | 254 | enum mac80211_tx_control_flags { |
256 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 255 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
257 | IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2), | 256 | IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1), |
258 | IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3), | 257 | IEEE80211_TX_CTL_NO_ACK = BIT(2), |
259 | IEEE80211_TX_CTL_NO_ACK = BIT(4), | 258 | IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3), |
260 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5), | 259 | IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4), |
261 | IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6), | 260 | IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5), |
262 | IEEE80211_TX_CTL_REQUEUE = BIT(7), | 261 | IEEE80211_TX_CTL_AMPDU = BIT(6), |
263 | IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8), | 262 | IEEE80211_TX_CTL_INJECTED = BIT(7), |
264 | IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9), | 263 | IEEE80211_TX_STAT_TX_FILTERED = BIT(8), |
265 | IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10), | 264 | IEEE80211_TX_STAT_ACK = BIT(9), |
266 | IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12), | 265 | IEEE80211_TX_STAT_AMPDU = BIT(10), |
267 | IEEE80211_TX_CTL_AMPDU = BIT(13), | 266 | IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), |
268 | IEEE80211_TX_CTL_OFDM_HT = BIT(14), | 267 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), |
269 | IEEE80211_TX_CTL_GREEN_FIELD = BIT(15), | 268 | }; |
270 | IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16), | 269 | |
271 | IEEE80211_TX_CTL_DUP_DATA = BIT(17), | 270 | enum mac80211_rate_control_flags { |
272 | IEEE80211_TX_CTL_SHORT_GI = BIT(18), | 271 | IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), |
273 | IEEE80211_TX_CTL_INJECTED = BIT(19), | 272 | IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), |
274 | IEEE80211_TX_STAT_TX_FILTERED = BIT(20), | 273 | IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2), |
275 | IEEE80211_TX_STAT_ACK = BIT(21), | 274 | |
276 | IEEE80211_TX_STAT_AMPDU = BIT(22), | 275 | /* rate index is an MCS rate number instead of an index */ |
277 | IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(23), | 276 | IEEE80211_TX_RC_MCS = BIT(3), |
278 | IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(24), | 277 | IEEE80211_TX_RC_GREEN_FIELD = BIT(4), |
278 | IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5), | ||
279 | IEEE80211_TX_RC_DUP_DATA = BIT(6), | ||
280 | IEEE80211_TX_RC_SHORT_GI = BIT(7), | ||
279 | }; | 281 | }; |
280 | 282 | ||
281 | 283 | ||
282 | #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \ | 284 | /* there are 40 bytes if you don't need the rateset to be kept */ |
283 | (sizeof(((struct sk_buff *)0)->cb) - 8) | 285 | #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40 |
284 | #define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \ | 286 | |
285 | (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)) | 287 | /* if you do need the rateset, then you have less space */ |
288 | #define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24 | ||
286 | 289 | ||
287 | /* maximum number of alternate rate retry stages */ | 290 | /* maximum number of rate stages */ |
288 | #define IEEE80211_TX_MAX_ALTRATE 3 | 291 | #define IEEE80211_TX_MAX_RATES 5 |
289 | 292 | ||
290 | /** | 293 | /** |
291 | * struct ieee80211_tx_altrate - alternate rate selection/status | 294 | * struct ieee80211_tx_rate - rate selection/status |
292 | * | 295 | * |
293 | * @rate_idx: rate index to attempt to send with | 296 | * @idx: rate index to attempt to send with |
294 | * @limit: number of retries before fallback | 297 | * @flags: rate control flags (&enum mac80211_rate_control_flags) |
298 | * @count: number of tries in this rate before going to the next rate | ||
299 | * | ||
300 | * A value of -1 for @idx indicates an invalid rate and, if used | ||
301 | * in an array of retry rates, that no more rates should be tried. | ||
302 | * | ||
303 | * When used for transmit status reporting, the driver should | ||
304 | * always report the rate along with the flags it used. | ||
295 | */ | 305 | */ |
296 | struct ieee80211_tx_altrate { | 306 | struct ieee80211_tx_rate { |
297 | s8 rate_idx; | 307 | s8 idx; |
298 | u8 limit; | 308 | u8 count; |
299 | }; | 309 | u8 flags; |
310 | } __attribute__((packed)); | ||
300 | 311 | ||
301 | /** | 312 | /** |
302 | * struct ieee80211_tx_info - skb transmit information | 313 | * struct ieee80211_tx_info - skb transmit information |
@@ -310,15 +321,12 @@ struct ieee80211_tx_altrate { | |||
310 | * it may be NULL. | 321 | * it may be NULL. |
311 | * | 322 | * |
312 | * @flags: transmit info flags, defined above | 323 | * @flags: transmit info flags, defined above |
313 | * @band: TBD | 324 | * @band: the band to transmit on (use for checking for races) |
314 | * @tx_rate_idx: TBD | 325 | * @antenna_sel_tx: antenna to use, 0 for automatic diversity |
315 | * @antenna_sel_tx: TBD | ||
316 | * @control: union for control data | 326 | * @control: union for control data |
317 | * @status: union for status data | 327 | * @status: union for status data |
318 | * @driver_data: array of driver_data pointers | 328 | * @driver_data: array of driver_data pointers |
319 | * @retry_count: number of retries | 329 | * @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. | 330 | * @ampdu_ack_len: number of aggregated frames. |
323 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. | 331 | * relevant only if IEEE80211_TX_STATUS_AMPDU was set. |
324 | * @ampdu_ack_map: block ack bit map for the aggregation. | 332 | * @ampdu_ack_map: block ack bit map for the aggregation. |
@@ -329,31 +337,44 @@ struct ieee80211_tx_info { | |||
329 | /* common information */ | 337 | /* common information */ |
330 | u32 flags; | 338 | u32 flags; |
331 | u8 band; | 339 | u8 band; |
332 | s8 tx_rate_idx; | 340 | |
333 | u8 antenna_sel_tx; | 341 | u8 antenna_sel_tx; |
334 | 342 | ||
335 | /* 1 byte hole */ | 343 | /* 2 byte hole */ |
344 | u8 pad[2]; | ||
336 | 345 | ||
337 | union { | 346 | union { |
338 | struct { | 347 | struct { |
348 | union { | ||
349 | /* rate control */ | ||
350 | struct { | ||
351 | struct ieee80211_tx_rate rates[ | ||
352 | IEEE80211_TX_MAX_RATES]; | ||
353 | s8 rts_cts_rate_idx; | ||
354 | }; | ||
355 | /* only needed before rate control */ | ||
356 | unsigned long jiffies; | ||
357 | }; | ||
339 | /* NB: vif can be NULL for injected frames */ | 358 | /* NB: vif can be NULL for injected frames */ |
340 | struct ieee80211_vif *vif; | 359 | struct ieee80211_vif *vif; |
341 | struct ieee80211_key_conf *hw_key; | 360 | struct ieee80211_key_conf *hw_key; |
342 | struct ieee80211_sta *sta; | 361 | 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; | 362 | } control; |
348 | struct { | 363 | struct { |
364 | struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; | ||
365 | u8 ampdu_ack_len; | ||
349 | u64 ampdu_ack_map; | 366 | u64 ampdu_ack_map; |
350 | int ack_signal; | 367 | int ack_signal; |
351 | struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1]; | 368 | /* 8 bytes free */ |
352 | u8 retry_count; | ||
353 | bool excessive_retries; | ||
354 | u8 ampdu_ack_len; | ||
355 | } status; | 369 | } status; |
356 | void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS]; | 370 | struct { |
371 | struct ieee80211_tx_rate driver_rates[ | ||
372 | IEEE80211_TX_MAX_RATES]; | ||
373 | void *rate_driver_data[ | ||
374 | IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; | ||
375 | }; | ||
376 | void *driver_data[ | ||
377 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)]; | ||
357 | }; | 378 | }; |
358 | }; | 379 | }; |
359 | 380 | ||
@@ -362,6 +383,41 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) | |||
362 | return (struct ieee80211_tx_info *)skb->cb; | 383 | return (struct ieee80211_tx_info *)skb->cb; |
363 | } | 384 | } |
364 | 385 | ||
386 | /** | ||
387 | * ieee80211_tx_info_clear_status - clear TX status | ||
388 | * | ||
389 | * @info: The &struct ieee80211_tx_info to be cleared. | ||
390 | * | ||
391 | * When the driver passes an skb back to mac80211, it must report | ||
392 | * a number of things in TX status. This function clears everything | ||
393 | * in the TX status but the rate control information (it does clear | ||
394 | * the count since you need to fill that in anyway). | ||
395 | * | ||
396 | * NOTE: You can only use this function if you do NOT use | ||
397 | * info->driver_data! Use info->rate_driver_data | ||
398 | * instead if you need only the less space that allows. | ||
399 | */ | ||
400 | static inline void | ||
401 | ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | ||
402 | { | ||
403 | int i; | ||
404 | |||
405 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != | ||
406 | offsetof(struct ieee80211_tx_info, control.rates)); | ||
407 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != | ||
408 | offsetof(struct ieee80211_tx_info, driver_rates)); | ||
409 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8); | ||
410 | /* clear the rate counts */ | ||
411 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) | ||
412 | info->status.rates[i].count = 0; | ||
413 | |||
414 | BUILD_BUG_ON( | ||
415 | offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23); | ||
416 | memset(&info->status.ampdu_ack_len, 0, | ||
417 | sizeof(struct ieee80211_tx_info) - | ||
418 | offsetof(struct ieee80211_tx_info, status.ampdu_ack_len)); | ||
419 | } | ||
420 | |||
365 | 421 | ||
366 | /** | 422 | /** |
367 | * enum mac80211_rx_flags - receive flags | 423 | * enum mac80211_rx_flags - receive flags |
@@ -434,21 +490,48 @@ struct ieee80211_rx_status { | |||
434 | * | 490 | * |
435 | * Flags to define PHY configuration options | 491 | * Flags to define PHY configuration options |
436 | * | 492 | * |
437 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time | ||
438 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 493 | * @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 | 494 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode |
441 | */ | 495 | */ |
442 | enum ieee80211_conf_flags { | 496 | enum ieee80211_conf_flags { |
443 | /* | 497 | IEEE80211_CONF_RADIOTAP = (1<<0), |
444 | * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers | 498 | IEEE80211_CONF_PS = (1<<1), |
445 | * have been converted to use bss_info_changed() for slot time | 499 | }; |
446 | * configuration | 500 | |
447 | */ | 501 | /* XXX: remove all this once drivers stop trying to use it */ |
448 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), | 502 | static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void) |
449 | IEEE80211_CONF_RADIOTAP = (1<<1), | 503 | { |
450 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), | 504 | return 0; |
451 | IEEE80211_CONF_PS = (1<<3), | 505 | } |
506 | #define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME()) | ||
507 | |||
508 | struct ieee80211_ht_conf { | ||
509 | bool enabled; | ||
510 | }; | ||
511 | |||
512 | /** | ||
513 | * enum ieee80211_conf_changed - denotes which configuration changed | ||
514 | * | ||
515 | * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed | ||
516 | * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed | ||
517 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed | ||
518 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed | ||
519 | * @IEEE80211_CONF_CHANGE_PS: the PS flag changed | ||
520 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed | ||
521 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed | ||
522 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed | ||
523 | * @IEEE80211_CONF_CHANGE_HT: HT configuration changed | ||
524 | */ | ||
525 | enum ieee80211_conf_changed { | ||
526 | IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), | ||
527 | IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1), | ||
528 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), | ||
529 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), | ||
530 | IEEE80211_CONF_CHANGE_PS = BIT(4), | ||
531 | IEEE80211_CONF_CHANGE_POWER = BIT(5), | ||
532 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), | ||
533 | IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), | ||
534 | IEEE80211_CONF_CHANGE_HT = BIT(8), | ||
452 | }; | 535 | }; |
453 | 536 | ||
454 | /** | 537 | /** |
@@ -457,34 +540,31 @@ enum ieee80211_conf_flags { | |||
457 | * This struct indicates how the driver shall configure the hardware. | 540 | * This struct indicates how the driver shall configure the hardware. |
458 | * | 541 | * |
459 | * @radio_enabled: when zero, driver is required to switch off the radio. | 542 | * @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) | 543 | * @beacon_int: beacon interval (TODO make interface config) |
462 | * @listen_interval: listen interval in units of beacon interval | 544 | * @listen_interval: listen interval in units of beacon interval |
463 | * @flags: configuration flags defined above | 545 | * @flags: configuration flags defined above |
464 | * @power_level: requested transmit power (in dBm) | 546 | * @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 | 547 | * @channel: the channel to tune to |
548 | * @ht: the HT configuration for the device | ||
549 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame | ||
550 | * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, | ||
551 | * but actually means the number of transmissions not the number of retries | ||
552 | * @short_frame_max_tx_count: Maximum number of transmissions for a "short" | ||
553 | * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the | ||
554 | * number of transmissions not the number of retries | ||
472 | */ | 555 | */ |
473 | struct ieee80211_conf { | 556 | struct ieee80211_conf { |
474 | int radio_enabled; | ||
475 | |||
476 | int beacon_int; | 557 | int beacon_int; |
477 | u16 listen_interval; | ||
478 | u32 flags; | 558 | u32 flags; |
479 | int power_level; | 559 | int power_level; |
480 | int max_antenna_gain; | ||
481 | u8 antenna_sel_tx; | ||
482 | u8 antenna_sel_rx; | ||
483 | 560 | ||
484 | struct ieee80211_channel *channel; | 561 | u16 listen_interval; |
562 | bool radio_enabled; | ||
563 | |||
564 | u8 long_frame_max_tx_count, short_frame_max_tx_count; | ||
485 | 565 | ||
486 | struct ieee80211_ht_info ht_conf; | 566 | struct ieee80211_channel *channel; |
487 | struct ieee80211_ht_bss_info ht_bss_conf; | 567 | struct ieee80211_ht_conf ht; |
488 | }; | 568 | }; |
489 | 569 | ||
490 | /** | 570 | /** |
@@ -494,11 +574,14 @@ struct ieee80211_conf { | |||
494 | * use during the life of a virtual interface. | 574 | * use during the life of a virtual interface. |
495 | * | 575 | * |
496 | * @type: type of this virtual interface | 576 | * @type: type of this virtual interface |
577 | * @bss_conf: BSS configuration for this interface, either our own | ||
578 | * or the BSS we're associated to | ||
497 | * @drv_priv: data area for driver use, will always be aligned to | 579 | * @drv_priv: data area for driver use, will always be aligned to |
498 | * sizeof(void *). | 580 | * sizeof(void *). |
499 | */ | 581 | */ |
500 | struct ieee80211_vif { | 582 | struct ieee80211_vif { |
501 | enum nl80211_iftype type; | 583 | enum nl80211_iftype type; |
584 | struct ieee80211_bss_conf bss_conf; | ||
502 | /* must be last */ | 585 | /* must be last */ |
503 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 586 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
504 | }; | 587 | }; |
@@ -542,14 +625,12 @@ struct ieee80211_if_init_conf { | |||
542 | * enum ieee80211_if_conf_change - interface config change flags | 625 | * enum ieee80211_if_conf_change - interface config change flags |
543 | * | 626 | * |
544 | * @IEEE80211_IFCC_BSSID: The BSSID changed. | 627 | * @IEEE80211_IFCC_BSSID: The BSSID changed. |
545 | * @IEEE80211_IFCC_SSID: The SSID changed. | ||
546 | * @IEEE80211_IFCC_BEACON: The beacon for this interface changed | 628 | * @IEEE80211_IFCC_BEACON: The beacon for this interface changed |
547 | * (currently AP and MESH only), use ieee80211_beacon_get(). | 629 | * (currently AP and MESH only), use ieee80211_beacon_get(). |
548 | */ | 630 | */ |
549 | enum ieee80211_if_conf_change { | 631 | enum ieee80211_if_conf_change { |
550 | IEEE80211_IFCC_BSSID = BIT(0), | 632 | IEEE80211_IFCC_BSSID = BIT(0), |
551 | IEEE80211_IFCC_SSID = BIT(1), | 633 | IEEE80211_IFCC_BEACON = BIT(1), |
552 | IEEE80211_IFCC_BEACON = BIT(2), | ||
553 | }; | 634 | }; |
554 | 635 | ||
555 | /** | 636 | /** |
@@ -557,11 +638,6 @@ enum ieee80211_if_conf_change { | |||
557 | * | 638 | * |
558 | * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. | 639 | * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. |
559 | * @bssid: BSSID of the network we are associated to/creating. | 640 | * @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 | * | 641 | * |
566 | * This structure is passed to the config_interface() callback of | 642 | * This structure is passed to the config_interface() callback of |
567 | * &struct ieee80211_hw. | 643 | * &struct ieee80211_hw. |
@@ -569,8 +645,6 @@ enum ieee80211_if_conf_change { | |||
569 | struct ieee80211_if_conf { | 645 | struct ieee80211_if_conf { |
570 | u32 changed; | 646 | u32 changed; |
571 | u8 *bssid; | 647 | u8 *bssid; |
572 | u8 *ssid; | ||
573 | size_t ssid_len; | ||
574 | }; | 648 | }; |
575 | 649 | ||
576 | /** | 650 | /** |
@@ -677,7 +751,7 @@ enum set_key_cmd { | |||
677 | * @addr: MAC address | 751 | * @addr: MAC address |
678 | * @aid: AID we assigned to the station if we're an AP | 752 | * @aid: AID we assigned to the station if we're an AP |
679 | * @supp_rates: Bitmap of supported rates (per band) | 753 | * @supp_rates: Bitmap of supported rates (per band) |
680 | * @ht_info: HT capabilities of this STA | 754 | * @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 | 755 | * @drv_priv: data area for driver use, will always be aligned to |
682 | * sizeof(void *), size is determined in hw information. | 756 | * sizeof(void *), size is determined in hw information. |
683 | */ | 757 | */ |
@@ -685,7 +759,7 @@ struct ieee80211_sta { | |||
685 | u64 supp_rates[IEEE80211_NUM_BANDS]; | 759 | u64 supp_rates[IEEE80211_NUM_BANDS]; |
686 | u8 addr[ETH_ALEN]; | 760 | u8 addr[ETH_ALEN]; |
687 | u16 aid; | 761 | u16 aid; |
688 | struct ieee80211_ht_info ht_info; | 762 | struct ieee80211_sta_ht_cap ht_cap; |
689 | 763 | ||
690 | /* must be last */ | 764 | /* must be last */ |
691 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 765 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
@@ -769,6 +843,9 @@ enum ieee80211_tkip_key_type { | |||
769 | * @IEEE80211_HW_SPECTRUM_MGMT: | 843 | * @IEEE80211_HW_SPECTRUM_MGMT: |
770 | * Hardware supports spectrum management defined in 802.11h | 844 | * Hardware supports spectrum management defined in 802.11h |
771 | * Measurement, Channel Switch, Quieting, TPC | 845 | * Measurement, Channel Switch, Quieting, TPC |
846 | * | ||
847 | * @IEEE80211_HW_AMPDU_AGGREGATION: | ||
848 | * Hardware supports 11n A-MPDU aggregation. | ||
772 | */ | 849 | */ |
773 | enum ieee80211_hw_flags { | 850 | enum ieee80211_hw_flags { |
774 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, | 851 | IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, |
@@ -780,6 +857,7 @@ enum ieee80211_hw_flags { | |||
780 | IEEE80211_HW_SIGNAL_DBM = 1<<7, | 857 | IEEE80211_HW_SIGNAL_DBM = 1<<7, |
781 | IEEE80211_HW_NOISE_DBM = 1<<8, | 858 | IEEE80211_HW_NOISE_DBM = 1<<8, |
782 | IEEE80211_HW_SPECTRUM_MGMT = 1<<9, | 859 | IEEE80211_HW_SPECTRUM_MGMT = 1<<9, |
860 | IEEE80211_HW_AMPDU_AGGREGATION = 1<<10, | ||
783 | }; | 861 | }; |
784 | 862 | ||
785 | /** | 863 | /** |
@@ -838,8 +916,8 @@ enum ieee80211_hw_flags { | |||
838 | * @sta_data_size: size (in bytes) of the drv_priv data area | 916 | * @sta_data_size: size (in bytes) of the drv_priv data area |
839 | * within &struct ieee80211_sta. | 917 | * within &struct ieee80211_sta. |
840 | * | 918 | * |
841 | * @max_altrates: maximum number of alternate rate retry stages | 919 | * @max_rates: maximum number of alternate rate retry stages |
842 | * @max_altrate_tries: maximum number of tries for each stage | 920 | * @max_rate_tries: maximum number of tries for each stage |
843 | */ | 921 | */ |
844 | struct ieee80211_hw { | 922 | struct ieee80211_hw { |
845 | struct ieee80211_conf conf; | 923 | struct ieee80211_conf conf; |
@@ -856,12 +934,10 @@ struct ieee80211_hw { | |||
856 | u16 ampdu_queues; | 934 | u16 ampdu_queues; |
857 | u16 max_listen_interval; | 935 | u16 max_listen_interval; |
858 | s8 max_signal; | 936 | s8 max_signal; |
859 | u8 max_altrates; | 937 | u8 max_rates; |
860 | u8 max_altrate_tries; | 938 | u8 max_rate_tries; |
861 | }; | 939 | }; |
862 | 940 | ||
863 | struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy); | ||
864 | |||
865 | /** | 941 | /** |
866 | * SET_IEEE80211_DEV - set device for 802.11 hardware | 942 | * SET_IEEE80211_DEV - set device for 802.11 hardware |
867 | * | 943 | * |
@@ -874,7 +950,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev | |||
874 | } | 950 | } |
875 | 951 | ||
876 | /** | 952 | /** |
877 | * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware | 953 | * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware |
878 | * | 954 | * |
879 | * @hw: the &struct ieee80211_hw to set the MAC address for | 955 | * @hw: the &struct ieee80211_hw to set the MAC address for |
880 | * @addr: the address to set | 956 | * @addr: the address to set |
@@ -898,9 +974,9 @@ static inline struct ieee80211_rate * | |||
898 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, | 974 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, |
899 | const struct ieee80211_tx_info *c) | 975 | const struct ieee80211_tx_info *c) |
900 | { | 976 | { |
901 | if (WARN_ON(c->tx_rate_idx < 0)) | 977 | if (WARN_ON(c->control.rates[0].idx < 0)) |
902 | return NULL; | 978 | return NULL; |
903 | return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx]; | 979 | return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; |
904 | } | 980 | } |
905 | 981 | ||
906 | static inline struct ieee80211_rate * | 982 | static inline struct ieee80211_rate * |
@@ -916,9 +992,9 @@ static inline struct ieee80211_rate * | |||
916 | ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | 992 | ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, |
917 | const struct ieee80211_tx_info *c, int idx) | 993 | const struct ieee80211_tx_info *c, int idx) |
918 | { | 994 | { |
919 | if (c->control.retries[idx].rate_idx < 0) | 995 | if (c->control.rates[idx + 1].idx < 0) |
920 | return NULL; | 996 | return NULL; |
921 | return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx]; | 997 | return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx]; |
922 | } | 998 | } |
923 | 999 | ||
924 | /** | 1000 | /** |
@@ -967,7 +1043,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
967 | * This happens everytime the iv16 wraps around (every 65536 packets). The | 1043 | * 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 | 1044 | * 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 | 1045 | * 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 | 1046 | * provided by update_tkip_key only. The trigger that makes mac80211 call this |
971 | * handler is software decryption with wrap around of iv16. | 1047 | * handler is software decryption with wrap around of iv16. |
972 | */ | 1048 | */ |
973 | 1049 | ||
@@ -1060,12 +1136,14 @@ enum ieee80211_filter_flags { | |||
1060 | * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation | 1136 | * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation |
1061 | * @IEEE80211_AMPDU_TX_START: start Tx aggregation | 1137 | * @IEEE80211_AMPDU_TX_START: start Tx aggregation |
1062 | * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation | 1138 | * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation |
1139 | * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation | ||
1063 | */ | 1140 | */ |
1064 | enum ieee80211_ampdu_mlme_action { | 1141 | enum ieee80211_ampdu_mlme_action { |
1065 | IEEE80211_AMPDU_RX_START, | 1142 | IEEE80211_AMPDU_RX_START, |
1066 | IEEE80211_AMPDU_RX_STOP, | 1143 | IEEE80211_AMPDU_RX_STOP, |
1067 | IEEE80211_AMPDU_TX_START, | 1144 | IEEE80211_AMPDU_TX_START, |
1068 | IEEE80211_AMPDU_TX_STOP, | 1145 | IEEE80211_AMPDU_TX_STOP, |
1146 | IEEE80211_AMPDU_TX_RESUME, | ||
1069 | }; | 1147 | }; |
1070 | 1148 | ||
1071 | /** | 1149 | /** |
@@ -1101,7 +1179,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1101 | * Must be implemented. | 1179 | * Must be implemented. |
1102 | * | 1180 | * |
1103 | * @add_interface: Called when a netdevice attached to the hardware is | 1181 | * @add_interface: Called when a netdevice attached to the hardware is |
1104 | * enabled. Because it is not called for monitor mode devices, @open | 1182 | * enabled. Because it is not called for monitor mode devices, @start |
1105 | * and @stop must be implemented. | 1183 | * and @stop must be implemented. |
1106 | * The driver should perform any initialization it needs before | 1184 | * The driver should perform any initialization it needs before |
1107 | * the device can be enabled. The initial configuration for the | 1185 | * the device can be enabled. The initial configuration for the |
@@ -1167,10 +1245,8 @@ enum ieee80211_ampdu_mlme_action { | |||
1167 | * the device does fragmentation by itself; if this method is assigned then | 1245 | * the device does fragmentation by itself; if this method is assigned then |
1168 | * the stack will not do fragmentation. | 1246 | * the stack will not do fragmentation. |
1169 | * | 1247 | * |
1170 | * @set_retry_limit: Configuration of retry limits (if device needs it) | ||
1171 | * | ||
1172 | * @sta_notify: Notifies low level driver about addition or removal | 1248 | * @sta_notify: Notifies low level driver about addition or removal |
1173 | * of assocaited station or AP. | 1249 | * of associated station or AP. |
1174 | * | 1250 | * |
1175 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1251 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
1176 | * bursting) for a hardware TX queue. | 1252 | * bursting) for a hardware TX queue. |
@@ -1194,8 +1270,6 @@ enum ieee80211_ampdu_mlme_action { | |||
1194 | * This is needed only for IBSS mode and the result of this function is | 1270 | * This is needed only for IBSS mode and the result of this function is |
1195 | * used to determine whether to reply to Probe Requests. | 1271 | * used to determine whether to reply to Probe Requests. |
1196 | * | 1272 | * |
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 | 1273 | * @ampdu_action: Perform a certain A-MPDU action |
1200 | * The RA/TID combination determines the destination and TID we want | 1274 | * The RA/TID combination determines the destination and TID we want |
1201 | * the ampdu action to be performed for. The action is defined through | 1275 | * the ampdu action to be performed for. The action is defined through |
@@ -1211,7 +1285,7 @@ struct ieee80211_ops { | |||
1211 | struct ieee80211_if_init_conf *conf); | 1285 | struct ieee80211_if_init_conf *conf); |
1212 | void (*remove_interface)(struct ieee80211_hw *hw, | 1286 | void (*remove_interface)(struct ieee80211_hw *hw, |
1213 | struct ieee80211_if_init_conf *conf); | 1287 | struct ieee80211_if_init_conf *conf); |
1214 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 1288 | int (*config)(struct ieee80211_hw *hw, u32 changed); |
1215 | int (*config_interface)(struct ieee80211_hw *hw, | 1289 | int (*config_interface)(struct ieee80211_hw *hw, |
1216 | struct ieee80211_vif *vif, | 1290 | struct ieee80211_vif *vif, |
1217 | struct ieee80211_if_conf *conf); | 1291 | struct ieee80211_if_conf *conf); |
@@ -1238,8 +1312,6 @@ struct ieee80211_ops { | |||
1238 | u32 *iv32, u16 *iv16); | 1312 | u32 *iv32, u16 *iv16); |
1239 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1313 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
1240 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); | 1314 | 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, | 1315 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1244 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 1316 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
1245 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, | 1317 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, |
@@ -1472,7 +1544,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 | 1544 | * 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 | 1545 | * 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 | 1546 | * hardware interrupt). Returned skb is used only once and low-level driver |
1475 | * is responsible of freeing it. | 1547 | * is responsible for freeing it. |
1476 | */ | 1548 | */ |
1477 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1549 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
1478 | struct ieee80211_vif *vif); | 1550 | struct ieee80211_vif *vif); |
@@ -1803,24 +1875,38 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | |||
1803 | 1875 | ||
1804 | 1876 | ||
1805 | /* Rate control API */ | 1877 | /* Rate control API */ |
1878 | |||
1806 | /** | 1879 | /** |
1807 | * struct rate_selection - rate information for/from rate control algorithms | 1880 | * struct ieee80211_tx_rate_control - rate control information for/from RC algo |
1808 | * | 1881 | * |
1809 | * @rate_idx: selected transmission rate index | 1882 | * @hw: The hardware the algorithm is invoked for. |
1810 | * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used | 1883 | * @sband: The band this frame is being transmitted on. |
1811 | * @probe_idx: rate for probing (or -1) | 1884 | * @bss_conf: the current BSS configuration |
1812 | * @max_rate_idx: maximum rate index that can be used, this is | 1885 | * @reported_rate: The rate control algorithm can fill this in to indicate |
1813 | * input to the algorithm and will be enforced | 1886 | * which rate should be reported to userspace as the current rate and |
1814 | */ | 1887 | * used for rate calculations in the mesh network. |
1815 | struct rate_selection { | 1888 | * @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; | 1889 | * RTS threshold |
1890 | * @short_preamble: whether mac80211 will request short-preamble transmission | ||
1891 | * if the selected rate supports it | ||
1892 | * @max_rate_idx: user-requested maximum rate (not MCS for now) | ||
1893 | * @skb: the skb that will be transmitted, the control information in it needs | ||
1894 | * to be filled in | ||
1895 | */ | ||
1896 | struct ieee80211_tx_rate_control { | ||
1897 | struct ieee80211_hw *hw; | ||
1898 | struct ieee80211_supported_band *sband; | ||
1899 | struct ieee80211_bss_conf *bss_conf; | ||
1900 | struct sk_buff *skb; | ||
1901 | struct ieee80211_tx_rate reported_rate; | ||
1902 | bool rts, short_preamble; | ||
1903 | u8 max_rate_idx; | ||
1817 | }; | 1904 | }; |
1818 | 1905 | ||
1819 | struct rate_control_ops { | 1906 | struct rate_control_ops { |
1820 | struct module *module; | 1907 | struct module *module; |
1821 | const char *name; | 1908 | const char *name; |
1822 | void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); | 1909 | void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); |
1823 | void (*clear)(void *priv); | ||
1824 | void (*free)(void *priv); | 1910 | void (*free)(void *priv); |
1825 | 1911 | ||
1826 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); | 1912 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); |
@@ -1832,10 +1918,8 @@ struct rate_control_ops { | |||
1832 | void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, | 1918 | void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, |
1833 | struct ieee80211_sta *sta, void *priv_sta, | 1919 | struct ieee80211_sta *sta, void *priv_sta, |
1834 | struct sk_buff *skb); | 1920 | struct sk_buff *skb); |
1835 | void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, | 1921 | void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta, |
1836 | struct ieee80211_sta *sta, void *priv_sta, | 1922 | struct ieee80211_tx_rate_control *txrc); |
1837 | struct sk_buff *skb, | ||
1838 | struct rate_selection *sel); | ||
1839 | 1923 | ||
1840 | void (*add_sta_debugfs)(void *priv, void *priv_sta, | 1924 | void (*add_sta_debugfs)(void *priv, void *priv_sta, |
1841 | struct dentry *dir); | 1925 | struct dentry *dir); |
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 11dd0137c6a..ce532f2222c 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 | ||
109 | extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); | 109 | extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); |
110 | 110 | ||
111 | extern 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 | |||
118 | extern 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 aa4b708654a..d8d790e56d3 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 | |||
223 | static inline | 220 | static inline |
224 | struct net *neigh_parms_net(const struct neigh_parms *parms) | 221 | struct 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 | ||
233 | extern unsigned long neigh_rand_reach_time(unsigned long base); | 226 | extern 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 | |||
244 | static inline | 237 | static inline |
245 | struct net *pneigh_net(const struct pneigh_entry *pneigh) | 238 | struct 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 | ||
254 | extern void neigh_app_ns(struct neighbour *n); | 243 | extern void neigh_app_ns(struct neighbour *n); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 700c53a3c6f..6fc13d905c5 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 | ||
23 | struct proc_dir_entry; | 24 | struct proc_dir_entry; |
24 | struct net_device; | 25 | struct 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 | |||
201 | static inline void write_pnet(struct net **pnet, struct net *net) | ||
202 | { | ||
203 | *pnet = net; | ||
204 | } | ||
205 | |||
206 | static 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 b76a8685b5b..2e0c53641cb 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 | ||
200 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 200 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
201 | 201 | ||
202 | extern void nf_conntrack_flush(struct net *net); | 202 | extern void nf_conntrack_flush(struct net *net, u32 pid, int report); |
203 | 203 | ||
204 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, | 204 | extern 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 1285ff26a01..0ff0dc69ca4 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 */ | ||
21 | struct nf_ct_event { | ||
22 | struct nf_conn *ct; | ||
23 | u32 pid; | ||
24 | int report; | ||
25 | }; | ||
26 | |||
20 | extern struct atomic_notifier_head nf_conntrack_chain; | 27 | extern struct atomic_notifier_head nf_conntrack_chain; |
21 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); | 28 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); |
22 | extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); | 29 | extern 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 | ||
42 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | 49 | static inline void |
43 | struct nf_conn *ct) | 50 | nf_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 | ||
64 | static inline void | ||
65 | nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) | ||
66 | { | ||
67 | nf_conntrack_event_report(event, ct, 0, 0); | ||
68 | } | ||
69 | |||
70 | struct nf_exp_event { | ||
71 | struct nf_conntrack_expect *exp; | ||
72 | u32 pid; | ||
73 | int report; | ||
74 | }; | ||
75 | |||
49 | extern struct atomic_notifier_head nf_ct_expect_chain; | 76 | extern struct atomic_notifier_head nf_ct_expect_chain; |
50 | extern int nf_ct_expect_register_notifier(struct notifier_block *nb); | 77 | extern int nf_ct_expect_register_notifier(struct notifier_block *nb); |
51 | extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); | 78 | extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); |
52 | 79 | ||
53 | static inline void | 80 | static inline void |
81 | nf_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 | |||
94 | static inline void | ||
54 | nf_ct_expect_event(enum ip_conntrack_expect_events event, | 95 | nf_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 | ||
60 | extern int nf_conntrack_ecache_init(struct net *net); | 101 | extern 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) {} |
67 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | 108 | static inline void nf_conntrack_event(enum ip_conntrack_events event, |
68 | struct nf_conn *ct) {} | 109 | struct nf_conn *ct) {} |
110 | static inline void nf_conntrack_event_report(enum ip_conntrack_events event, | ||
111 | struct nf_conn *ct, | ||
112 | u32 pid, | ||
113 | int report) {} | ||
69 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} | 114 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} |
70 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, | 115 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, |
71 | struct nf_conntrack_expect *exp) {} | 116 | struct nf_conntrack_expect *exp) {} |
117 | static 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) {} | ||
72 | static inline void nf_ct_event_cache_flush(struct net *net) {} | 121 | static inline void nf_ct_event_cache_flush(struct net *net) {} |
73 | 122 | ||
74 | static inline int nf_conntrack_ecache_init(struct net *net) | 123 | static 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 37a7fc1164b..ab17a159ac6 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 *); |
101 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); | 101 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); |
102 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); | 102 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); |
103 | int 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 f8060ab5a08..66d65a7caa3 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 | ||
41 | extern struct nf_conntrack_helper * | 41 | extern struct nf_conntrack_helper * |
42 | __nf_ct_helper_find(const struct nf_conntrack_tuple *tuple); | ||
43 | |||
44 | extern struct nf_conntrack_helper * | ||
45 | __nf_conntrack_helper_find_byname(const char *name); | 42 | __nf_conntrack_helper_find_byname(const char *name); |
46 | 43 | ||
47 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); | 44 | extern 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 | ||
50 | extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); | 47 | extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); |
51 | 48 | ||
49 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); | ||
50 | |||
52 | static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | 51 | static 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 7f2f43c7728..debdaf75cec 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 | 132 | static 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 a6874ba22d5..f2f6aa73dc1 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 | |||
112 | static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) | 112 | static 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 | ||
122 | static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t) | 122 | static 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 00000000000..b0569ff0775 --- /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 | |||
4 | void | ||
5 | nfulnl_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 3643bbb8e58..46b7764f177 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -233,7 +233,7 @@ extern int nla_parse(struct nlattr *tb[], int maxtype, | |||
233 | extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); | 233 | extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); |
234 | extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, | 234 | extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, |
235 | size_t dstsize); | 235 | size_t dstsize); |
236 | extern int nla_memcpy(void *dest, struct nlattr *src, int count); | 236 | extern int nla_memcpy(void *dest, const struct nlattr *src, int count); |
237 | extern int nla_memcmp(const struct nlattr *nla, const void *data, | 237 | extern int nla_memcmp(const struct nlattr *nla, const void *data, |
238 | size_t size); | 238 | size_t size); |
239 | extern int nla_strcmp(const struct nlattr *nla, const char *str); | 239 | extern int nla_strcmp(const struct nlattr *nla, const char *str); |
@@ -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 | */ |
743 | static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, | 743 | static 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 | */ |
878 | static inline u32 nla_get_u32(struct nlattr *nla) | 878 | static 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 | */ |
887 | static inline __be32 nla_get_be32(struct nlattr *nla) | 887 | static 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 | */ |
896 | static inline u16 nla_get_u16(struct nlattr *nla) | 896 | static 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 | */ |
905 | static inline __be16 nla_get_be16(struct nlattr *nla) | 905 | static 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 | */ |
914 | static inline __le16 nla_get_le16(struct nlattr *nla) | 914 | static 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 | */ |
923 | static inline u8 nla_get_u8(struct nlattr *nla) | 923 | static 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 | */ |
932 | static inline u64 nla_get_u64(struct nlattr *nla) | 932 | static 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 | */ |
945 | static inline int nla_get_flag(struct nlattr *nla) | 945 | static 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 | */ |
956 | static inline unsigned long nla_get_msecs(struct nlattr *nla) | 956 | static 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 ece1c926b5d..977f482d97a 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/mib.h b/include/net/netns/mib.h index 10cb7c336de..0b44112e236 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 b8093971ccb..9554a644a8f 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 | ||
7 | struct ebt_table; | ||
8 | |||
7 | struct netns_xt { | 9 | struct 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 00000000000..1ba912749ca --- /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 | |||
9 | struct ctl_table_header; | ||
10 | |||
11 | struct xfrm_policy_hash { | ||
12 | struct hlist_head *table; | ||
13 | unsigned int hmask; | ||
14 | }; | ||
15 | |||
16 | struct 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/pkt_cls.h b/include/net/pkt_cls.h index aa9e282db48..d1ca3144464 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 | ||
248 | extern int tcf_em_register(struct tcf_ematch_ops *); | 248 | extern int tcf_em_register(struct tcf_ematch_ops *); |
249 | extern int tcf_em_unregister(struct tcf_ematch_ops *); | 249 | extern void tcf_em_unregister(struct tcf_ematch_ops *); |
250 | extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, | 250 | extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, |
251 | struct tcf_ematch_tree *); | 251 | struct tcf_ematch_tree *); |
252 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); | 252 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 3fe49d80895..f8c47429044 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 | ||
435 | static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, | 434 | static 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 */ |
440 | static 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 | ||
445 | static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) | 453 | /* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */ |
454 | static 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 | ||
450 | static inline void __qdisc_reset_queue(struct Qdisc *sch, | 468 | static inline void __qdisc_reset_queue(struct Qdisc *sch, |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index ed71b110edf..bbb7742195b 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -138,6 +138,7 @@ void sctp_write_space(struct sock *sk); | |||
138 | unsigned int sctp_poll(struct file *file, struct socket *sock, | 138 | unsigned int sctp_poll(struct file *file, struct socket *sock, |
139 | poll_table *wait); | 139 | poll_table *wait); |
140 | void sctp_sock_rfree(struct sk_buff *skb); | 140 | void sctp_sock_rfree(struct sk_buff *skb); |
141 | extern 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/sock.h b/include/net/sock.h index 2f47107f6d0..5a3a151bd73 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 | ||
310 | static 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 | |||
315 | static 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 | |||
297 | static inline struct sock *sk_next(const struct sock *sk) | 320 | static 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 | ||
326 | static 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 | |||
303 | static inline int sk_unhashed(const struct sock *sk) | 334 | static 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 | ||
349 | static __inline__ void sk_nulls_node_init(struct hlist_nulls_node *node) | ||
350 | { | ||
351 | node->pprev = NULL; | ||
352 | } | ||
353 | |||
318 | static __inline__ void __sk_del_node(struct sock *sk) | 354 | static __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 | ||
400 | static __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 | |||
409 | static __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 | |||
364 | static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) | 421 | static __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 | ||
432 | static __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 | |||
437 | static __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 | |||
375 | static __inline__ void __sk_del_bind_node(struct sock *sk) | 443 | static __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 9e306f7f579..00000000000 --- 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__ | ||
24 | struct 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 | |||
31 | struct sipcp { | ||
32 | u16 state; /* state machine */ | ||
33 | u_char confid; /* id of last configuration request */ | ||
34 | }; | ||
35 | |||
36 | struct 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 | |||
52 | struct ppp_device | ||
53 | { | ||
54 | struct net_device *dev; /* Network device pointer */ | ||
55 | struct sppp sppp; /* Synchronous PPP */ | ||
56 | }; | ||
57 | |||
58 | static 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 | |||
85 | void sppp_attach (struct ppp_device *pd); | ||
86 | void sppp_detach (struct net_device *dev); | ||
87 | int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); | ||
88 | struct sk_buff *sppp_dequeue (struct net_device *dev); | ||
89 | int sppp_isempty (struct net_device *dev); | ||
90 | void sppp_flush (struct net_device *dev); | ||
91 | int sppp_open (struct net_device *dev); | ||
92 | int sppp_reopen (struct net_device *dev); | ||
93 | int 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 438014d5761..de1e91d959b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | extern struct inet_hashinfo tcp_hashinfo; | 47 | extern struct inet_hashinfo tcp_hashinfo; |
48 | 48 | ||
49 | extern atomic_t tcp_orphan_count; | 49 | extern struct percpu_counter tcp_orphan_count; |
50 | extern void tcp_time_wait(struct sock *sk, int state, int timeo); | 50 | extern 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; | |||
238 | extern int sysctl_tcp_max_ssthresh; | 238 | extern int sysctl_tcp_max_ssthresh; |
239 | 239 | ||
240 | extern atomic_t tcp_memory_allocated; | 240 | extern atomic_t tcp_memory_allocated; |
241 | extern atomic_t tcp_sockets_allocated; | 241 | extern struct percpu_counter tcp_sockets_allocated; |
242 | extern int tcp_memory_pressure; | 242 | extern 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 */ |
474 | extern void tcp_cwnd_application_limited(struct sock *sk); | 474 | extern void tcp_cwnd_application_limited(struct sock *sk); |
475 | extern 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 */ |
479 | extern void tcp_init_xmit_timers(struct sock *); | 477 | extern 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 | ||
767 | extern 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 | ||
1193 | static 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 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 1e205095ea6..90e6ce56be6 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 | ||
53 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | 53 | struct udp_hslot { |
54 | extern rwlock_t udp_hash_lock; | 54 | struct hlist_nulls_head head; |
55 | spinlock_t lock; | ||
56 | } __attribute__((aligned(2 * sizeof(long)))); | ||
57 | struct udp_table { | ||
58 | struct udp_hslot hash[UDP_HTABLE_SIZE]; | ||
59 | }; | ||
60 | extern struct udp_table udp_table; | ||
61 | extern 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 | ||
113 | static inline void udp_lib_unhash(struct sock *sk) | 120 | extern 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 | ||
123 | static inline void udp_lib_close(struct sock *sk, long timeout) | 122 | static 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, | |||
187 | struct udp_seq_afinfo { | 186 | struct 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 b76b2e377af..afdffe607b2 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 | ||
13 | extern struct proto udplite_prot; | 13 | extern struct proto udplite_prot; |
14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 14 | extern 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 721efb363db..21c5d966142 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 | */ |
147 | struct ieee80211_ht_info { | 148 | struct 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 | */ |
185 | struct wiphy { | 191 | struct 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 | */ |
265 | static inline char *wiphy_name(struct wiphy *wiphy) | 273 | static 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 | */ |
367 | extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | 362 | struct ieee80211_rate * |
368 | const char *alpha2, struct ieee80211_regdomain *rd); | 363 | ieee80211_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 | 382 | extern 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 | */ |
392 | extern int regulatory_hint(struct wiphy *wiphy, | 395 | extern 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 11c890ad8eb..2e9f5c0018a 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 |
41 | DECLARE_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 | ||
51 | extern struct sock *xfrm_nl; | ||
52 | extern u32 sysctl_xfrm_aevent_etime; | ||
53 | extern u32 sysctl_xfrm_aevent_rseqth; | ||
54 | extern int sysctl_xfrm_larval_drop; | ||
55 | extern u32 sysctl_xfrm_acq_expires; | ||
56 | |||
57 | extern struct mutex xfrm_cfg_mutex; | 50 | extern 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. */ |
131 | struct xfrm_state | 124 | struct 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 | ||
222 | static 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 | ||
254 | struct net_device; | 256 | struct net_device; |
@@ -257,10 +259,11 @@ struct xfrm_dst; | |||
257 | struct xfrm_policy_afinfo { | 259 | struct 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 | ||
468 | struct xfrm_policy | 471 | struct 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 | ||
500 | static inline struct net *xp_net(struct xfrm_policy *xp) | ||
501 | { | ||
502 | return read_pnet(&xp->xp_net); | ||
503 | } | ||
504 | |||
495 | struct xfrm_kmaddress { | 505 | struct 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 | ||
544 | extern int xfrm_register_km(struct xfrm_mgr *km); | 554 | extern int xfrm_register_km(struct xfrm_mgr *km); |
545 | extern int xfrm_unregister_km(struct xfrm_mgr *km); | 555 | extern int xfrm_unregister_km(struct xfrm_mgr *km); |
546 | 556 | ||
547 | extern 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 | ||
885 | static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) | 894 | static 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 | ||
898 | extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); | 908 | extern 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 | ||
1035 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | 1046 | static 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 | ||
1269 | extern void xfrm_init(void); | 1282 | extern void xfrm_init(void); |
1270 | extern void xfrm4_init(void); | 1283 | extern void xfrm4_init(void); |
1271 | extern void xfrm_state_init(void); | 1284 | extern int xfrm_state_init(struct net *net); |
1285 | extern void xfrm_state_fini(struct net *net); | ||
1272 | extern void xfrm4_state_init(void); | 1286 | extern void xfrm4_state_init(void); |
1273 | #ifdef CONFIG_XFRM | 1287 | #ifdef CONFIG_XFRM |
1274 | extern int xfrm6_init(void); | 1288 | extern 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 |
1290 | extern int xfrm_proc_init(void); | 1304 | extern int xfrm_proc_init(struct net *net); |
1305 | extern void xfrm_proc_fini(struct net *net); | ||
1306 | #endif | ||
1307 | |||
1308 | extern int xfrm_sysctl_init(struct net *net); | ||
1309 | #ifdef CONFIG_SYSCTL | ||
1310 | extern void xfrm_sysctl_fini(struct net *net); | ||
1311 | #else | ||
1312 | static inline void xfrm_sysctl_fini(struct net *net) | ||
1313 | { | ||
1314 | } | ||
1291 | #endif | 1315 | #endif |
1292 | 1316 | ||
1293 | extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); | 1317 | extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); |
1294 | extern int xfrm_state_walk(struct xfrm_state_walk *walk, | 1318 | extern 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 *); |
1296 | extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); | 1320 | extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); |
1297 | extern struct xfrm_state *xfrm_state_alloc(void); | 1321 | extern struct xfrm_state *xfrm_state_alloc(struct net *net); |
1298 | extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | 1322 | extern 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); |
1302 | extern struct xfrm_state * xfrm_stateonly_find(xfrm_address_t *daddr, | 1326 | extern 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); | |||
1307 | extern void xfrm_state_insert(struct xfrm_state *x); | 1332 | extern void xfrm_state_insert(struct xfrm_state *x); |
1308 | extern int xfrm_state_add(struct xfrm_state *x); | 1333 | extern int xfrm_state_add(struct xfrm_state *x); |
1309 | extern int xfrm_state_update(struct xfrm_state *x); | 1334 | extern int xfrm_state_update(struct xfrm_state *x); |
1310 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); | 1335 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); |
1311 | extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); | 1336 | extern 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 |
1313 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | 1338 | extern 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 | ||
1348 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 1373 | extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq); |
1349 | extern int xfrm_state_delete(struct xfrm_state *x); | 1374 | extern int xfrm_state_delete(struct xfrm_state *x); |
1350 | extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); | 1375 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); |
1351 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); | 1376 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); |
1352 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); | 1377 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); |
1353 | extern int xfrm_replay_check(struct xfrm_state *x, | 1378 | extern 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 | ||
1418 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 1443 | struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp); |
1419 | 1444 | ||
1420 | extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); | 1445 | extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); |
1421 | extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, | 1446 | extern 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 *); |
1423 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); | 1448 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); |
1424 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 1449 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
1425 | struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | 1450 | struct 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); |
1429 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); | 1454 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err); |
1430 | int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); | 1455 | int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); |
1431 | u32 xfrm_get_acqseq(void); | 1456 | u32 xfrm_get_acqseq(void); |
1432 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 1457 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
1433 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 1458 | struct 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); |
1436 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1461 | extern 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 | ||
1452 | extern wait_queue_head_t km_waitq; | ||
1453 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); | 1477 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); |
1454 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); | 1478 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); |
1455 | extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | 1479 | extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); |
1456 | 1480 | ||
1457 | extern void xfrm_input_init(void); | 1481 | extern void xfrm_input_init(void); |
1458 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); | 1482 | extern 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 | ||
1500 | static inline int xfrm_aevent_is_on(void) | 1524 | #ifdef CONFIG_XFRM |
1525 | static 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 | ||
1513 | static inline int xfrm_alg_len(struct xfrm_algo *alg) | 1539 | static 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 | ||
1539 | static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) | 1566 | static 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 */ |