aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /include/net
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'include/net')
-rw-r--r--include/net/9p/client.h20
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/ah.h33
-rw-r--r--include/net/ax25.h1
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/bluetooth/hci.h6
-rw-r--r--include/net/bluetooth/hci_core.h44
-rw-r--r--include/net/bluetooth/l2cap.h2
-rw-r--r--include/net/cfg80211.h483
-rw-r--r--include/net/compat.h14
-rw-r--r--include/net/dn_dev.h13
-rw-r--r--include/net/dn_fib.h3
-rw-r--r--include/net/dn_nsp.h24
-rw-r--r--include/net/dst.h25
-rw-r--r--include/net/fib_rules.h22
-rw-r--r--include/net/gen_stats.h4
-rw-r--r--include/net/genetlink.h12
-rw-r--r--include/net/icmp.h2
-rw-r--r--include/net/ieee80211_radiotap.h6
-rw-r--r--include/net/ieee802154_netdev.h16
-rw-r--r--include/net/if_inet6.h26
-rw-r--r--include/net/inet6_hashtables.h6
-rw-r--r--include/net/inet_hashtables.h28
-rw-r--r--include/net/inet_sock.h38
-rw-r--r--include/net/inet_timewait_sock.h13
-rw-r--r--include/net/inetpeer.h19
-rw-r--r--include/net/ip.h53
-rw-r--r--include/net/ip6_fib.h19
-rw-r--r--include/net/ip6_route.h21
-rw-r--r--include/net/ip6_tunnel.h1
-rw-r--r--include/net/ip_fib.h25
-rw-r--r--include/net/ip_vs.h44
-rw-r--r--include/net/ipcomp.h2
-rw-r--r--include/net/ipip.h25
-rw-r--r--include/net/ipv6.h28
-rw-r--r--include/net/ipx.h1
-rw-r--r--include/net/irda/irttp.h2
-rw-r--r--include/net/iucv/iucv.h1
-rw-r--r--include/net/iw_handler.h26
-rw-r--r--include/net/llc.h39
-rw-r--r--include/net/llc_conn.h2
-rw-r--r--include/net/mac80211.h586
-rw-r--r--include/net/neighbour.h31
-rw-r--r--include/net/net_namespace.h23
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h16
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h59
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h22
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h10
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h11
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h3
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h7
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h12
-rw-r--r--include/net/netfilter/nf_conntrack_zones.h25
-rw-r--r--include/net/netfilter/nf_nat.h15
-rw-r--r--include/net/netfilter/nf_nat_helper.h32
-rw-r--r--include/net/netfilter/nf_nat_protocol.h3
-rw-r--r--include/net/netlabel.h1
-rw-r--r--include/net/netlink.h8
-rw-r--r--include/net/netns/conntrack.h5
-rw-r--r--include/net/netns/core.h2
-rw-r--r--include/net/netns/generic.h8
-rw-r--r--include/net/netns/ipv4.h3
-rw-r--r--include/net/netns/ipv6.h2
-rw-r--r--include/net/netns/packet.h4
-rw-r--r--include/net/netns/xfrm.h7
-rw-r--r--include/net/netrom.h3
-rw-r--r--include/net/phonet/pep.h3
-rw-r--r--include/net/phonet/phonet.h2
-rw-r--r--include/net/phonet/pn_dev.h8
-rw-r--r--include/net/pkt_cls.h28
-rw-r--r--include/net/pkt_sched.h4
-rw-r--r--include/net/protocol.h7
-rw-r--r--include/net/red.h6
-rw-r--r--include/net/regulatory.h1
-rw-r--r--include/net/request_sock.h10
-rw-r--r--include/net/route.h15
-rw-r--r--include/net/rtnetlink.h13
-rw-r--r--include/net/sch_generic.h49
-rw-r--r--include/net/scm.h9
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/constants.h4
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sctp/sm.h4
-rw-r--r--include/net/sctp/structs.h22
-rw-r--r--include/net/sctp/user.h134
-rw-r--r--include/net/snmp.h60
-rw-r--r--include/net/sock.h83
-rw-r--r--include/net/tc_act/tc_skbedit.h2
-rw-r--r--include/net/tcp.h190
-rw-r--r--include/net/udp.h42
-rw-r--r--include/net/wext.h49
-rw-r--r--include/net/wimax.h8
-rw-r--r--include/net/wpan-phy.h22
-rw-r--r--include/net/x25.h11
-rw-r--r--include/net/xfrm.h137
97 files changed, 1979 insertions, 1009 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index fb00b329f0d3..4f3760afc20f 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -29,6 +29,19 @@
29/* Number of requests per row */ 29/* Number of requests per row */
30#define P9_ROW_MAXTAG 255 30#define P9_ROW_MAXTAG 255
31 31
32/** enum p9_proto_versions - 9P protocol versions
33 * @p9_proto_legacy: 9P Legacy mode, pre-9P2000.u
34 * @p9_proto_2000u: 9P2000.u extension
35 * @p9_proto_2000L: 9P2000.L extension
36 */
37
38enum p9_proto_versions{
39 p9_proto_legacy = 0,
40 p9_proto_2000u = 1,
41 p9_proto_2000L = 2,
42};
43
44
32/** 45/**
33 * enum p9_trans_status - different states of underlying transports 46 * enum p9_trans_status - different states of underlying transports
34 * @Connected: transport is connected and healthy 47 * @Connected: transport is connected and healthy
@@ -41,6 +54,7 @@
41 54
42enum p9_trans_status { 55enum p9_trans_status {
43 Connected, 56 Connected,
57 BeginDisconnect,
44 Disconnected, 58 Disconnected,
45 Hung, 59 Hung,
46}; 60};
@@ -111,6 +125,7 @@ struct p9_req_t {
111 * @lock: protect @fidlist 125 * @lock: protect @fidlist
112 * @msize: maximum data size negotiated by protocol 126 * @msize: maximum data size negotiated by protocol
113 * @dotu: extension flags negotiated by protocol 127 * @dotu: extension flags negotiated by protocol
128 * @proto_version: 9P protocol version to use
114 * @trans_mod: module API instantiated with this client 129 * @trans_mod: module API instantiated with this client
115 * @trans: tranport instance state and API 130 * @trans: tranport instance state and API
116 * @conn: connection state information used by trans_fd 131 * @conn: connection state information used by trans_fd
@@ -137,7 +152,7 @@ struct p9_req_t {
137struct p9_client { 152struct p9_client {
138 spinlock_t lock; /* protect client structure */ 153 spinlock_t lock; /* protect client structure */
139 int msize; 154 int msize;
140 unsigned char dotu; 155 unsigned char proto_version;
141 struct p9_trans_module *trans_mod; 156 struct p9_trans_module *trans_mod;
142 enum p9_trans_status status; 157 enum p9_trans_status status;
143 void *trans; 158 void *trans;
@@ -184,6 +199,7 @@ int p9_client_version(struct p9_client *);
184struct p9_client *p9_client_create(const char *dev_name, char *options); 199struct p9_client *p9_client_create(const char *dev_name, char *options);
185void p9_client_destroy(struct p9_client *clnt); 200void p9_client_destroy(struct p9_client *clnt);
186void p9_client_disconnect(struct p9_client *clnt); 201void p9_client_disconnect(struct p9_client *clnt);
202void p9_client_begin_disconnect(struct p9_client *clnt);
187struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, 203struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
188 char *uname, u32 n_uname, char *aname); 204 char *uname, u32 n_uname, char *aname);
189struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, 205struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
@@ -209,5 +225,7 @@ int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
209int p9stat_read(char *, int, struct p9_wstat *, int); 225int p9stat_read(char *, int, struct p9_wstat *, int);
210void p9stat_free(struct p9_wstat *); 226void p9stat_free(struct p9_wstat *);
211 227
228int p9_is_proto_dotu(struct p9_client *clnt);
229int p9_is_proto_dotl(struct p9_client *clnt);
212 230
213#endif /* NET_9P_CLIENT_H */ 231#endif /* NET_9P_CLIENT_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 0f7c37825fc1..45375b41a2a0 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb);
177static inline struct inet6_dev * 177static inline struct inet6_dev *
178__in6_dev_get(struct net_device *dev) 178__in6_dev_get(struct net_device *dev)
179{ 179{
180 return rcu_dereference(dev->ip6_ptr); 180 return rcu_dereference_check(dev->ip6_ptr,
181 rcu_read_lock_held() ||
182 lockdep_rtnl_is_held());
181} 183}
182 184
183static inline struct inet6_dev * 185static inline struct inet6_dev *
diff --git a/include/net/ah.h b/include/net/ah.h
index ae1c322f4242..f0129f79a31a 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -1,43 +1,20 @@
1#ifndef _NET_AH_H 1#ifndef _NET_AH_H
2#define _NET_AH_H 2#define _NET_AH_H
3 3
4#include <linux/crypto.h> 4#include <linux/skbuff.h>
5#include <net/xfrm.h>
6 5
7/* This is the maximum truncated ICV length that we know of. */ 6/* This is the maximum truncated ICV length that we know of. */
8#define MAX_AH_AUTH_LEN 12 7#define MAX_AH_AUTH_LEN 12
9 8
10struct ah_data 9struct crypto_ahash;
11{ 10
12 u8 *work_icv; 11struct ah_data {
13 int icv_full_len; 12 int icv_full_len;
14 int icv_trunc_len; 13 int icv_trunc_len;
15 14
16 struct crypto_hash *tfm; 15 struct crypto_ahash *ahash;
17}; 16};
18 17
19static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb,
20 u8 *auth_data)
21{
22 struct hash_desc desc;
23 int err;
24
25 desc.tfm = ahp->tfm;
26 desc.flags = 0;
27
28 memset(auth_data, 0, ahp->icv_trunc_len);
29 err = crypto_hash_init(&desc);
30 if (unlikely(err))
31 goto out;
32 err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update);
33 if (unlikely(err))
34 goto out;
35 err = crypto_hash_final(&desc, ahp->work_icv);
36
37out:
38 return err;
39}
40
41struct ip_auth_hdr; 18struct ip_auth_hdr;
42 19
43static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) 20static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb)
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 717e2192d521..206d22297ac3 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -10,6 +10,7 @@
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/slab.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14 15
15#define AX25_T1CLAMPLO 1 16#define AX25_T1CLAMPLO 1
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 718394e2c01e..ff77e8f882f1 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -121,7 +121,7 @@ struct bt_sock_list {
121 rwlock_t lock; 121 rwlock_t lock;
122}; 122};
123 123
124int bt_sock_register(int proto, struct net_proto_family *ops); 124int bt_sock_register(int proto, const struct net_proto_family *ops);
125int bt_sock_unregister(int proto); 125int bt_sock_unregister(int proto);
126void bt_sock_link(struct bt_sock_list *l, struct sock *s); 126void bt_sock_link(struct bt_sock_list *l, struct sock *s);
127void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 127void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
@@ -176,6 +176,6 @@ extern void hci_sock_cleanup(void);
176extern int bt_sysfs_init(void); 176extern int bt_sysfs_init(void);
177extern void bt_sysfs_cleanup(void); 177extern void bt_sysfs_cleanup(void);
178 178
179extern struct class *bt_class; 179extern struct dentry *bt_debugfs;
180 180
181#endif /* __BLUETOOTH_H */ 181#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ed3aea1605e8..fc0c502d9fd1 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -43,7 +43,7 @@
43#define HCI_NOTIFY_CONN_DEL 2 43#define HCI_NOTIFY_CONN_DEL 2
44#define HCI_NOTIFY_VOICE_SETTING 3 44#define HCI_NOTIFY_VOICE_SETTING 3
45 45
46/* HCI device types */ 46/* HCI bus types */
47#define HCI_VIRTUAL 0 47#define HCI_VIRTUAL 0
48#define HCI_USB 1 48#define HCI_USB 1
49#define HCI_PCCARD 2 49#define HCI_PCCARD 2
@@ -52,6 +52,10 @@
52#define HCI_PCI 5 52#define HCI_PCI 5
53#define HCI_SDIO 6 53#define HCI_SDIO 6
54 54
55/* HCI controller types */
56#define HCI_BREDR 0x00
57#define HCI_80211 0x01
58
55/* HCI device quirks */ 59/* HCI device quirks */
56enum { 60enum {
57 HCI_QUIRK_NO_RESET, 61 HCI_QUIRK_NO_RESET,
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7b640aeddb64..ce3c99e5fa25 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -70,7 +70,8 @@ struct hci_dev {
70 char name[8]; 70 char name[8];
71 unsigned long flags; 71 unsigned long flags;
72 __u16 id; 72 __u16 id;
73 __u8 type; 73 __u8 bus;
74 __u8 dev_type;
74 bdaddr_t bdaddr; 75 bdaddr_t bdaddr;
75 __u8 dev_name[248]; 76 __u8 dev_name[248];
76 __u8 dev_class[3]; 77 __u8 dev_class[3];
@@ -134,6 +135,8 @@ struct hci_dev {
134 135
135 atomic_t promisc; 136 atomic_t promisc;
136 137
138 struct dentry *debugfs;
139
137 struct device *parent; 140 struct device *parent;
138 struct device dev; 141 struct device dev;
139 142
@@ -367,22 +370,6 @@ static inline void hci_conn_put(struct hci_conn *conn)
367 } 370 }
368} 371}
369 372
370/* ----- HCI tasks ----- */
371static inline void hci_sched_cmd(struct hci_dev *hdev)
372{
373 tasklet_schedule(&hdev->cmd_task);
374}
375
376static inline void hci_sched_rx(struct hci_dev *hdev)
377{
378 tasklet_schedule(&hdev->rx_task);
379}
380
381static inline void hci_sched_tx(struct hci_dev *hdev)
382{
383 tasklet_schedule(&hdev->tx_task);
384}
385
386/* ----- HCI Devices ----- */ 373/* ----- HCI Devices ----- */
387static inline void __hci_dev_put(struct hci_dev *d) 374static inline void __hci_dev_put(struct hci_dev *d)
388{ 375{
@@ -437,28 +424,7 @@ int hci_inquiry(void __user *arg);
437 424
438void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 425void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
439 426
440/* Receive frame from HCI drivers */ 427int hci_recv_frame(struct sk_buff *skb);
441static inline int hci_recv_frame(struct sk_buff *skb)
442{
443 struct hci_dev *hdev = (struct hci_dev *) skb->dev;
444 if (!hdev || (!test_bit(HCI_UP, &hdev->flags)
445 && !test_bit(HCI_INIT, &hdev->flags))) {
446 kfree_skb(skb);
447 return -ENXIO;
448 }
449
450 /* Incomming skb */
451 bt_cb(skb)->incoming = 1;
452
453 /* Time stamp */
454 __net_timestamp(skb);
455
456 /* Queue frame for rx task */
457 skb_queue_tail(&hdev->rx_q, skb);
458 hci_sched_rx(hdev);
459 return 0;
460}
461
462int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 428int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
463 429
464int hci_register_sysfs(struct hci_dev *hdev); 430int hci_register_sysfs(struct hci_dev *hdev);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 9516f4b4a3c2..17a689f27a6a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -324,7 +324,6 @@ struct l2cap_pinfo {
324 324
325 __u8 next_tx_seq; 325 __u8 next_tx_seq;
326 __u8 expected_ack_seq; 326 __u8 expected_ack_seq;
327 __u8 req_seq;
328 __u8 expected_tx_seq; 327 __u8 expected_tx_seq;
329 __u8 buffer_seq; 328 __u8 buffer_seq;
330 __u8 buffer_seq_srej; 329 __u8 buffer_seq_srej;
@@ -375,6 +374,7 @@ struct l2cap_pinfo {
375#define L2CAP_CONN_SEND_PBIT 0x10 374#define L2CAP_CONN_SEND_PBIT 0x10
376#define L2CAP_CONN_REMOTE_BUSY 0x20 375#define L2CAP_CONN_REMOTE_BUSY 0x20
377#define L2CAP_CONN_LOCAL_BUSY 0x40 376#define L2CAP_CONN_LOCAL_BUSY 0x40
377#define L2CAP_CONN_REJ_ACT 0x80
378 378
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ 379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); 380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3d874c620219..3d134a1fb96b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * 802.11 device and configuration interface 4 * 802.11 device and configuration interface
5 * 5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006-2010 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
@@ -39,8 +39,8 @@
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
40 */ 40 */
41enum ieee80211_band { 41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ, 42 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ, 43 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
44 44
45 /* keep last */ 45 /* keep last */
46 IEEE80211_NUM_BANDS 46 IEEE80211_NUM_BANDS
@@ -206,10 +206,12 @@ struct ieee80211_supported_band {
206 * struct vif_params - describes virtual interface parameters 206 * struct vif_params - describes virtual interface parameters
207 * @mesh_id: mesh ID to use 207 * @mesh_id: mesh ID to use
208 * @mesh_id_len: length of the mesh ID 208 * @mesh_id_len: length of the mesh ID
209 * @use_4addr: use 4-address frames
209 */ 210 */
210struct vif_params { 211struct vif_params {
211 u8 *mesh_id; 212 u8 *mesh_id;
212 int mesh_id_len; 213 int mesh_id_len;
214 int use_4addr;
213}; 215};
214 216
215/** 217/**
@@ -233,6 +235,35 @@ struct key_params {
233}; 235};
234 236
235/** 237/**
238 * enum survey_info_flags - survey information flags
239 *
240 * Used by the driver to indicate which info in &struct survey_info
241 * it has filled in during the get_survey().
242 */
243enum survey_info_flags {
244 SURVEY_INFO_NOISE_DBM = 1<<0,
245};
246
247/**
248 * struct survey_info - channel survey response
249 *
250 * Used by dump_survey() to report back per-channel survey information.
251 *
252 * @channel: the channel this survey record reports, mandatory
253 * @filled: bitflag of flags from &enum survey_info_flags
254 * @noise: channel noise in dBm. This and all following fields are
255 * optional
256 *
257 * This structure can later be expanded with things like
258 * channel duty cycle etc.
259 */
260struct survey_info {
261 struct ieee80211_channel *channel;
262 u32 filled;
263 s8 noise;
264};
265
266/**
236 * struct beacon_parameters - beacon parameters 267 * struct beacon_parameters - beacon parameters
237 * 268 *
238 * Used to configure the beacon for an interface. 269 * Used to configure the beacon for an interface.
@@ -418,7 +449,7 @@ enum monitor_flags {
418 * in during get_station() or dump_station(). 449 * in during get_station() or dump_station().
419 * 450 *
420 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 451 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
421 * MPATH_INFO_DSN: @dsn filled 452 * MPATH_INFO_SN: @sn filled
422 * MPATH_INFO_METRIC: @metric filled 453 * MPATH_INFO_METRIC: @metric filled
423 * MPATH_INFO_EXPTIME: @exptime filled 454 * MPATH_INFO_EXPTIME: @exptime filled
424 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 455 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
@@ -427,7 +458,7 @@ enum monitor_flags {
427 */ 458 */
428enum mpath_info_flags { 459enum mpath_info_flags {
429 MPATH_INFO_FRAME_QLEN = BIT(0), 460 MPATH_INFO_FRAME_QLEN = BIT(0),
430 MPATH_INFO_DSN = BIT(1), 461 MPATH_INFO_SN = BIT(1),
431 MPATH_INFO_METRIC = BIT(2), 462 MPATH_INFO_METRIC = BIT(2),
432 MPATH_INFO_EXPTIME = BIT(3), 463 MPATH_INFO_EXPTIME = BIT(3),
433 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 464 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
@@ -442,7 +473,7 @@ enum mpath_info_flags {
442 * 473 *
443 * @filled: bitfield of flags from &enum mpath_info_flags 474 * @filled: bitfield of flags from &enum mpath_info_flags
444 * @frame_qlen: number of queued frames for this destination 475 * @frame_qlen: number of queued frames for this destination
445 * @dsn: destination sequence number 476 * @sn: target sequence number
446 * @metric: metric (cost) of this mesh path 477 * @metric: metric (cost) of this mesh path
447 * @exptime: expiration time for the mesh path from now, in msecs 478 * @exptime: expiration time for the mesh path from now, in msecs
448 * @flags: mesh path flags 479 * @flags: mesh path flags
@@ -456,7 +487,7 @@ enum mpath_info_flags {
456struct mpath_info { 487struct mpath_info {
457 u32 filled; 488 u32 filled;
458 u32 frame_qlen; 489 u32 frame_qlen;
459 u32 dsn; 490 u32 sn;
460 u32 metric; 491 u32 metric;
461 u32 exptime; 492 u32 exptime;
462 u32 discovery_timeout; 493 u32 discovery_timeout;
@@ -506,6 +537,7 @@ struct mesh_config {
506 u32 dot11MeshHWMPactivePathTimeout; 537 u32 dot11MeshHWMPactivePathTimeout;
507 u16 dot11MeshHWMPpreqMinInterval; 538 u16 dot11MeshHWMPpreqMinInterval;
508 u16 dot11MeshHWMPnetDiameterTraversalTime; 539 u16 dot11MeshHWMPnetDiameterTraversalTime;
540 u8 dot11MeshHWMPRootMode;
509}; 541};
510 542
511/** 543/**
@@ -594,8 +626,14 @@ enum cfg80211_signal_type {
594 * @beacon_interval: the beacon interval as from the frame 626 * @beacon_interval: the beacon interval as from the frame
595 * @capability: the capability field in host byte order 627 * @capability: the capability field in host byte order
596 * @information_elements: the information elements (Note that there 628 * @information_elements: the information elements (Note that there
597 * is no guarantee that these are well-formed!) 629 * is no guarantee that these are well-formed!); this is a pointer to
630 * either the beacon_ies or proberesp_ies depending on whether Probe
631 * Response frame has been received
598 * @len_information_elements: total length of the information elements 632 * @len_information_elements: total length of the information elements
633 * @beacon_ies: the information elements from the last Beacon frame
634 * @len_beacon_ies: total length of the beacon_ies
635 * @proberesp_ies: the information elements from the last Probe Response frame
636 * @len_proberesp_ies: total length of the proberesp_ies
599 * @signal: signal strength value (type depends on the wiphy's signal_type) 637 * @signal: signal strength value (type depends on the wiphy's signal_type)
600 * @free_priv: function pointer to free private data 638 * @free_priv: function pointer to free private data
601 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 639 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
@@ -609,6 +647,10 @@ struct cfg80211_bss {
609 u16 capability; 647 u16 capability;
610 u8 *information_elements; 648 u8 *information_elements;
611 size_t len_information_elements; 649 size_t len_information_elements;
650 u8 *beacon_ies;
651 size_t len_beacon_ies;
652 u8 *proberesp_ies;
653 size_t len_proberesp_ies;
612 654
613 s32 signal; 655 s32 signal;
614 656
@@ -805,6 +847,7 @@ enum wiphy_params_flags {
805 WIPHY_PARAM_RETRY_LONG = 1 << 1, 847 WIPHY_PARAM_RETRY_LONG = 1 << 1,
806 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 848 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
807 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 849 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
850 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
808}; 851};
809 852
810/** 853/**
@@ -824,20 +867,24 @@ enum tx_power_setting {
824 * cfg80211_bitrate_mask - masks for bitrate control 867 * cfg80211_bitrate_mask - masks for bitrate control
825 */ 868 */
826struct cfg80211_bitrate_mask { 869struct cfg80211_bitrate_mask {
827/*
828 * As discussed in Berlin, this struct really
829 * should look like this:
830
831 struct { 870 struct {
832 u32 legacy; 871 u32 legacy;
833 u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 872 /* TODO: add support for masking MCS rates; e.g.: */
873 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
834 } control[IEEE80211_NUM_BANDS]; 874 } control[IEEE80211_NUM_BANDS];
835 875};
836 * Since we can always fix in-kernel users, let's keep 876/**
837 * it simpler for now: 877 * struct cfg80211_pmksa - PMK Security Association
878 *
879 * This structure is passed to the set/del_pmksa() method for PMKSA
880 * caching.
881 *
882 * @bssid: The AP's BSSID.
883 * @pmkid: The PMK material itself.
838 */ 884 */
839 u32 fixed; /* fixed bitrate, 0 == not fixed */ 885struct cfg80211_pmksa {
840 u32 maxrate; /* in kbps, 0 == no limit */ 886 u8 *bssid;
887 u8 *pmkid;
841}; 888};
842 889
843/** 890/**
@@ -941,7 +988,26 @@ struct cfg80211_bitrate_mask {
941 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 988 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
942 * functions to adjust rfkill hw state 989 * functions to adjust rfkill hw state
943 * 990 *
991 * @dump_survey: get site survey information.
992 *
993 * @remain_on_channel: Request the driver to remain awake on the specified
994 * channel for the specified duration to complete an off-channel
995 * operation (e.g., public action frame exchange). When the driver is
996 * ready on the requested channel, it must indicate this with an event
997 * notification by calling cfg80211_ready_on_channel().
998 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
999 * This allows the operation to be terminated prior to timeout based on
1000 * the duration value.
1001 * @action: Transmit an action frame
1002 *
944 * @testmode_cmd: run a test mode command 1003 * @testmode_cmd: run a test mode command
1004 *
1005 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
1006 * devices running firmwares capable of generating the (re) association
1007 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
1008 * @del_pmksa: Delete a cached PMKID.
1009 * @flush_pmksa: Flush all cached PMKIDs.
1010 *
945 */ 1011 */
946struct cfg80211_ops { 1012struct cfg80211_ops {
947 int (*suspend)(struct wiphy *wiphy); 1013 int (*suspend)(struct wiphy *wiphy);
@@ -1060,7 +1126,30 @@ struct cfg80211_ops {
1060 const u8 *peer, 1126 const u8 *peer,
1061 const struct cfg80211_bitrate_mask *mask); 1127 const struct cfg80211_bitrate_mask *mask);
1062 1128
1063 /* some temporary stuff to finish wext */ 1129 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
1130 int idx, struct survey_info *info);
1131
1132 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
1133 struct cfg80211_pmksa *pmksa);
1134 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
1135 struct cfg80211_pmksa *pmksa);
1136 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
1137
1138 int (*remain_on_channel)(struct wiphy *wiphy,
1139 struct net_device *dev,
1140 struct ieee80211_channel *chan,
1141 enum nl80211_channel_type channel_type,
1142 unsigned int duration,
1143 u64 *cookie);
1144 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
1145 struct net_device *dev,
1146 u64 cookie);
1147
1148 int (*action)(struct wiphy *wiphy, struct net_device *dev,
1149 struct ieee80211_channel *chan,
1150 enum nl80211_channel_type channel_type,
1151 const u8 *buf, size_t len, u64 *cookie);
1152
1064 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1153 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1065 bool enabled, int timeout); 1154 bool enabled, int timeout);
1066}; 1155};
@@ -1071,27 +1160,54 @@ struct cfg80211_ops {
1071 */ 1160 */
1072 1161
1073/** 1162/**
1074 * struct wiphy - wireless hardware description 1163 * enum wiphy_flags - wiphy capability flags
1075 * @idx: the wiphy index assigned to this item 1164 *
1076 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 1165 * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device
1077 * @custom_regulatory: tells us the driver for this device
1078 * has its own custom regulatory domain and cannot identify the 1166 * has its own custom regulatory domain and cannot identify the
1079 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1167 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
1080 * we will disregard the first regulatory hint (when the 1168 * we will disregard the first regulatory hint (when the
1081 * initiator is %REGDOM_SET_BY_CORE). 1169 * initiator is %REGDOM_SET_BY_CORE).
1082 * @strict_regulatory: tells us the driver for this device will ignore 1170 * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
1083 * regulatory domain settings until it gets its own regulatory domain 1171 * ignore regulatory domain settings until it gets its own regulatory
1084 * via its regulatory_hint(). After its gets its own regulatory domain 1172 * domain via its regulatory_hint(). After its gets its own regulatory
1085 * it will only allow further regulatory domain settings to further 1173 * domain it will only allow further regulatory domain settings to
1086 * enhance compliance. For example if channel 13 and 14 are disabled 1174 * further enhance compliance. For example if channel 13 and 14 are
1087 * by this regulatory domain no user regulatory domain can enable these 1175 * disabled by this regulatory domain no user regulatory domain can
1088 * channels at a later time. This can be used for devices which do not 1176 * enable these channels at a later time. This can be used for devices
1089 * have calibration information gauranteed for frequencies or settings 1177 * which do not have calibration information gauranteed for frequencies
1090 * outside of its regulatory domain. 1178 * or settings outside of its regulatory domain.
1091 * @disable_beacon_hints: enable this if your driver needs to ensure that 1179 * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
1092 * passive scan flags and beaconing flags may not be lifted by cfg80211 1180 * that passive scan flags and beaconing flags may not be lifted by
1093 * due to regulatory beacon hints. For more information on beacon 1181 * cfg80211 due to regulatory beacon hints. For more information on beacon
1094 * hints read the documenation for regulatory_hint_found_beacon() 1182 * hints read the documenation for regulatory_hint_found_beacon()
1183 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
1184 * wiphy at all
1185 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
1186 * by default -- this flag will be set depending on the kernel's default
1187 * on wiphy_new(), but can be changed by the driver if it has a good
1188 * reason to override the default
1189 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
1190 * on a VLAN interface)
1191 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
1192 */
1193enum wiphy_flags {
1194 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),
1195 WIPHY_FLAG_STRICT_REGULATORY = BIT(1),
1196 WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2),
1197 WIPHY_FLAG_NETNS_OK = BIT(3),
1198 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
1199 WIPHY_FLAG_4ADDR_AP = BIT(5),
1200 WIPHY_FLAG_4ADDR_STATION = BIT(6),
1201};
1202
1203struct mac_address {
1204 u8 addr[ETH_ALEN];
1205};
1206
1207/**
1208 * struct wiphy - wireless hardware description
1209 * @idx: the wiphy index assigned to this item
1210 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
1095 * @reg_notifier: the driver's regulatory notification callback 1211 * @reg_notifier: the driver's regulatory notification callback
1096 * @regd: the driver's regulatory domain, if one was requested via 1212 * @regd: the driver's regulatory domain, if one was requested via
1097 * the regulatory_hint() API. This can be used by the driver 1213 * the regulatory_hint() API. This can be used by the driver
@@ -1106,27 +1222,33 @@ struct cfg80211_ops {
1106 * -1 = fragmentation disabled, only odd values >= 256 used 1222 * -1 = fragmentation disabled, only odd values >= 256 used
1107 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1223 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1108 * @net: the network namespace this wiphy currently lives in 1224 * @net: the network namespace this wiphy currently lives in
1109 * @netnsok: if set to false, do not allow changing the netns of this 1225 * @perm_addr: permanent MAC address of this device
1110 * wiphy at all 1226 * @addr_mask: If the device supports multiple MAC addresses by masking,
1111 * @ps_default: default for powersave, will be set depending on the 1227 * set this to a mask with variable bits set to 1, e.g. if the last
1112 * kernel's default on wiphy_new(), but can be changed by the 1228 * four bits are variable then set it to 00:...:00:0f. The actual
1113 * driver if it has a good reason to override the default 1229 * variable bits shall be determined by the interfaces added, with
1230 * interfaces not matching the mask being rejected to be brought up.
1231 * @n_addresses: number of addresses in @addresses.
1232 * @addresses: If the device has more than one address, set this pointer
1233 * to a list of addresses (6 bytes each). The first one will be used
1234 * by default for perm_addr. In this case, the mask should be set to
1235 * all-zeroes. In this case it is assumed that the device can handle
1236 * the same number of arbitrary MAC addresses.
1114 */ 1237 */
1115struct wiphy { 1238struct wiphy {
1116 /* assign these fields before you register the wiphy */ 1239 /* assign these fields before you register the wiphy */
1117 1240
1118 /* permanent MAC address */ 1241 /* permanent MAC address(es) */
1119 u8 perm_addr[ETH_ALEN]; 1242 u8 perm_addr[ETH_ALEN];
1243 u8 addr_mask[ETH_ALEN];
1244
1245 u16 n_addresses;
1246 struct mac_address *addresses;
1120 1247
1121 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1248 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1122 u16 interface_modes; 1249 u16 interface_modes;
1123 1250
1124 bool custom_regulatory; 1251 u32 flags;
1125 bool strict_regulatory;
1126 bool disable_beacon_hints;
1127
1128 bool netnsok;
1129 bool ps_default;
1130 1252
1131 enum cfg80211_signal_type signal_type; 1253 enum cfg80211_signal_type signal_type;
1132 1254
@@ -1141,6 +1263,12 @@ struct wiphy {
1141 u8 retry_long; 1263 u8 retry_long;
1142 u32 frag_threshold; 1264 u32 frag_threshold;
1143 u32 rts_threshold; 1265 u32 rts_threshold;
1266 u8 coverage_class;
1267
1268 char fw_version[ETHTOOL_BUSINFO_LEN];
1269 u32 hw_version;
1270
1271 u8 max_num_pmkids;
1144 1272
1145 /* If multiple wiphys are registered and you're handed e.g. 1273 /* If multiple wiphys are registered and you're handed e.g.
1146 * a regular netdev with assigned ieee80211_ptr, you won't 1274 * a regular netdev with assigned ieee80211_ptr, you won't
@@ -1171,6 +1299,10 @@ struct wiphy {
1171 struct net *_net; 1299 struct net *_net;
1172#endif 1300#endif
1173 1301
1302#ifdef CONFIG_CFG80211_WEXT
1303 const struct iw_handler_def *wext;
1304#endif
1305
1174 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1306 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1175}; 1307};
1176 1308
@@ -1314,6 +1446,12 @@ struct cfg80211_cached_keys;
1314 * @ssid_len: (private) Used by the internal configuration code 1446 * @ssid_len: (private) Used by the internal configuration code
1315 * @wext: (private) Used by the internal wireless extensions compat code 1447 * @wext: (private) Used by the internal wireless extensions compat code
1316 * @wext_bssid: (private) Used by the internal wireless extensions compat code 1448 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1449 * @use_4addr: indicates 4addr mode is used on this interface, must be
1450 * set by driver (if supported) on add_interface BEFORE registering the
1451 * netdev and may otherwise be used by driver read-only, will be update
1452 * by cfg80211 on change_interface
1453 * @action_registrations: list of registrations for action frames
1454 * @action_registrations_lock: lock for the list
1317 */ 1455 */
1318struct wireless_dev { 1456struct wireless_dev {
1319 struct wiphy *wiphy; 1457 struct wiphy *wiphy;
@@ -1323,10 +1461,15 @@ struct wireless_dev {
1323 struct list_head list; 1461 struct list_head list;
1324 struct net_device *netdev; 1462 struct net_device *netdev;
1325 1463
1464 struct list_head action_registrations;
1465 spinlock_t action_registrations_lock;
1466
1326 struct mutex mtx; 1467 struct mutex mtx;
1327 1468
1328 struct work_struct cleanup_work; 1469 struct work_struct cleanup_work;
1329 1470
1471 bool use_4addr;
1472
1330 /* currently used for IBSS and SME - might be rearranged later */ 1473 /* currently used for IBSS and SME - might be rearranged later */
1331 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1474 u8 ssid[IEEE80211_MAX_SSID_LEN];
1332 u8 ssid_len; 1475 u8 ssid_len;
@@ -1345,7 +1488,10 @@ struct wireless_dev {
1345 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1488 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1346 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1489 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1347 1490
1348#ifdef CONFIG_WIRELESS_EXT 1491 bool ps;
1492 int ps_timeout;
1493
1494#ifdef CONFIG_CFG80211_WEXT
1349 /* wext data */ 1495 /* wext data */
1350 struct { 1496 struct {
1351 struct cfg80211_ibss_params ibss; 1497 struct cfg80211_ibss_params ibss;
@@ -1356,8 +1502,7 @@ struct wireless_dev {
1356 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1502 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
1357 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1503 u8 ssid[IEEE80211_MAX_SSID_LEN];
1358 s8 default_key, default_mgmt_key; 1504 s8 default_key, default_mgmt_key;
1359 bool ps, prev_bssid_valid; 1505 bool prev_bssid_valid;
1360 int ps_timeout;
1361 } wext; 1506 } wext;
1362#endif 1507#endif
1363}; 1508};
@@ -1428,37 +1573,82 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1428 * Documentation in Documentation/networking/radiotap-headers.txt 1573 * Documentation in Documentation/networking/radiotap-headers.txt
1429 */ 1574 */
1430 1575
1576struct radiotap_align_size {
1577 uint8_t align:4, size:4;
1578};
1579
1580struct ieee80211_radiotap_namespace {
1581 const struct radiotap_align_size *align_size;
1582 int n_bits;
1583 uint32_t oui;
1584 uint8_t subns;
1585};
1586
1587struct ieee80211_radiotap_vendor_namespaces {
1588 const struct ieee80211_radiotap_namespace *ns;
1589 int n_ns;
1590};
1591
1431/** 1592/**
1432 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 1593 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1433 * @rtheader: pointer to the radiotap header we are walking through 1594 * @this_arg_index: index of current arg, valid after each successful call
1434 * @max_length: length of radiotap header in cpu byte ordering 1595 * to ieee80211_radiotap_iterator_next()
1435 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 1596 * @this_arg: pointer to current radiotap arg; it is valid after each
1436 * @this_arg: pointer to current radiotap arg 1597 * call to ieee80211_radiotap_iterator_next() but also after
1437 * @arg_index: internal next argument index 1598 * ieee80211_radiotap_iterator_init() where it will point to
1438 * @arg: internal next argument pointer 1599 * the beginning of the actual data portion
1439 * @next_bitmap: internal pointer to next present u32 1600 * @this_arg_size: length of the current arg, for convenience
1440 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 1601 * @current_namespace: pointer to the current namespace definition
1602 * (or internally %NULL if the current namespace is unknown)
1603 * @is_radiotap_ns: indicates whether the current namespace is the default
1604 * radiotap namespace or not
1605 *
1606 * @overrides: override standard radiotap fields
1607 * @n_overrides: number of overrides
1608 *
1609 * @_rtheader: pointer to the radiotap header we are walking through
1610 * @_max_length: length of radiotap header in cpu byte ordering
1611 * @_arg_index: next argument index
1612 * @_arg: next argument pointer
1613 * @_next_bitmap: internal pointer to next present u32
1614 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1615 * @_vns: vendor namespace definitions
1616 * @_next_ns_data: beginning of the next namespace's data
1617 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
1618 * next bitmap word
1619 *
1620 * Describes the radiotap parser state. Fields prefixed with an underscore
1621 * must not be used by users of the parser, only by the parser internally.
1441 */ 1622 */
1442 1623
1443struct ieee80211_radiotap_iterator { 1624struct ieee80211_radiotap_iterator {
1444 struct ieee80211_radiotap_header *rtheader; 1625 struct ieee80211_radiotap_header *_rtheader;
1445 int max_length; 1626 const struct ieee80211_radiotap_vendor_namespaces *_vns;
1627 const struct ieee80211_radiotap_namespace *current_namespace;
1628
1629 unsigned char *_arg, *_next_ns_data;
1630 uint32_t *_next_bitmap;
1631
1632 unsigned char *this_arg;
1446 int this_arg_index; 1633 int this_arg_index;
1447 u8 *this_arg; 1634 int this_arg_size;
1448 1635
1449 int arg_index; 1636 int is_radiotap_ns;
1450 u8 *arg; 1637
1451 __le32 *next_bitmap; 1638 int _max_length;
1452 u32 bitmap_shifter; 1639 int _arg_index;
1640 uint32_t _bitmap_shifter;
1641 int _reset_on_ext;
1453}; 1642};
1454 1643
1455extern int ieee80211_radiotap_iterator_init( 1644extern int ieee80211_radiotap_iterator_init(
1456 struct ieee80211_radiotap_iterator *iterator, 1645 struct ieee80211_radiotap_iterator *iterator,
1457 struct ieee80211_radiotap_header *radiotap_header, 1646 struct ieee80211_radiotap_header *radiotap_header,
1458 int max_length); 1647 int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
1459 1648
1460extern int ieee80211_radiotap_iterator_next( 1649extern int ieee80211_radiotap_iterator_next(
1461 struct ieee80211_radiotap_iterator *iterator); 1650 struct ieee80211_radiotap_iterator *iterator);
1651
1462 1652
1463extern const unsigned char rfc1042_header[6]; 1653extern const unsigned char rfc1042_header[6];
1464extern const unsigned char bridge_tunnel_header[6]; 1654extern const unsigned char bridge_tunnel_header[6];
@@ -1487,7 +1677,7 @@ unsigned int ieee80211_hdrlen(__le16 fc);
1487 * @addr: the device MAC address 1677 * @addr: the device MAC address
1488 * @iftype: the virtual interface type 1678 * @iftype: the virtual interface type
1489 */ 1679 */
1490int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, 1680int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
1491 enum nl80211_iftype iftype); 1681 enum nl80211_iftype iftype);
1492 1682
1493/** 1683/**
@@ -1498,15 +1688,49 @@ int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
1498 * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1688 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
1499 * @qos: build 802.11 QoS data frame 1689 * @qos: build 802.11 QoS data frame
1500 */ 1690 */
1501int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, 1691int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
1502 enum nl80211_iftype iftype, u8 *bssid, bool qos); 1692 enum nl80211_iftype iftype, u8 *bssid, bool qos);
1503 1693
1504/** 1694/**
1695 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
1696 *
1697 * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
1698 * 802.3 frames. The @list will be empty if the decode fails. The
1699 * @skb is consumed after the function returns.
1700 *
1701 * @skb: The input IEEE 802.11n A-MSDU frame.
1702 * @list: The output list of 802.3 frames. It must be allocated and
1703 * initialized by by the caller.
1704 * @addr: The device MAC address.
1705 * @iftype: The device interface type.
1706 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
1707 */
1708void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
1709 const u8 *addr, enum nl80211_iftype iftype,
1710 const unsigned int extra_headroom);
1711
1712/**
1505 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1713 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
1506 * @skb: the data frame 1714 * @skb: the data frame
1507 */ 1715 */
1508unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1716unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1509 1717
1718/**
1719 * cfg80211_find_ie - find information element in data
1720 *
1721 * @eid: element ID
1722 * @ies: data consisting of IEs
1723 * @len: length of data
1724 *
1725 * This function will return %NULL if the element ID could
1726 * not be found or if the element is invalid (claims to be
1727 * longer than the given data), or a pointer to the first byte
1728 * of the requested element, that is the byte containing the
1729 * element ID. There are no checks on the element length
1730 * other than having to fit into the given data.
1731 */
1732const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
1733
1510/* 1734/*
1511 * Regulatory helper functions for wiphys 1735 * Regulatory helper functions for wiphys
1512 */ 1736 */
@@ -1776,6 +2000,18 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1776void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 2000void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1777 2001
1778/** 2002/**
2003 * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2004 * @dev: network device
2005 * @addr: The MAC address of the device with which the authentication timed out
2006 *
2007 * When a pending authentication had no action yet, the driver may decide
2008 * to not send a deauth frame, but in that case must calls this function
2009 * to tell cfg80211 about this decision. It is only valid to call this
2010 * function within the deauth() callback.
2011 */
2012void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2013
2014/**
1779 * cfg80211_send_rx_assoc - notification of processed association 2015 * cfg80211_send_rx_assoc - notification of processed association
1780 * @dev: network device 2016 * @dev: network device
1781 * @buf: (re)association response frame (header + body) 2017 * @buf: (re)association response frame (header + body)
@@ -1802,30 +2038,45 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1802 * @dev: network device 2038 * @dev: network device
1803 * @buf: deauthentication frame (header + body) 2039 * @buf: deauthentication frame (header + body)
1804 * @len: length of the frame data 2040 * @len: length of the frame data
1805 * @cookie: cookie from ->deauth if called within that callback,
1806 * %NULL otherwise
1807 * 2041 *
1808 * This function is called whenever deauthentication has been processed in 2042 * This function is called whenever deauthentication has been processed in
1809 * station mode. This includes both received deauthentication frames and 2043 * station mode. This includes both received deauthentication frames and
1810 * locally generated ones. This function may sleep. 2044 * locally generated ones. This function may sleep.
1811 */ 2045 */
1812void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, 2046void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
1813 void *cookie); 2047
2048/**
2049 * __cfg80211_send_deauth - notification of processed deauthentication
2050 * @dev: network device
2051 * @buf: deauthentication frame (header + body)
2052 * @len: length of the frame data
2053 *
2054 * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
2055 */
2056void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
1814 2057
1815/** 2058/**
1816 * cfg80211_send_disassoc - notification of processed disassociation 2059 * cfg80211_send_disassoc - notification of processed disassociation
1817 * @dev: network device 2060 * @dev: network device
1818 * @buf: disassociation response frame (header + body) 2061 * @buf: disassociation response frame (header + body)
1819 * @len: length of the frame data 2062 * @len: length of the frame data
1820 * @cookie: cookie from ->disassoc if called within that callback,
1821 * %NULL otherwise
1822 * 2063 *
1823 * This function is called whenever disassociation has been processed in 2064 * This function is called whenever disassociation has been processed in
1824 * station mode. This includes both received disassociation frames and locally 2065 * station mode. This includes both received disassociation frames and locally
1825 * generated ones. This function may sleep. 2066 * generated ones. This function may sleep.
1826 */ 2067 */
1827void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, 2068void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
1828 void *cookie); 2069
2070/**
2071 * __cfg80211_send_disassoc - notification of processed disassociation
2072 * @dev: network device
2073 * @buf: disassociation response frame (header + body)
2074 * @len: length of the frame data
2075 *
2076 * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
2077 */
2078void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
2079 size_t len);
1829 2080
1830/** 2081/**
1831 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 2082 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
@@ -2011,5 +2262,79 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
2011void cfg80211_disconnected(struct net_device *dev, u16 reason, 2262void cfg80211_disconnected(struct net_device *dev, u16 reason,
2012 u8 *ie, size_t ie_len, gfp_t gfp); 2263 u8 *ie, size_t ie_len, gfp_t gfp);
2013 2264
2265/**
2266 * cfg80211_ready_on_channel - notification of remain_on_channel start
2267 * @dev: network device
2268 * @cookie: the request cookie
2269 * @chan: The current channel (from remain_on_channel request)
2270 * @channel_type: Channel type
2271 * @duration: Duration in milliseconds that the driver intents to remain on the
2272 * channel
2273 * @gfp: allocation flags
2274 */
2275void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie,
2276 struct ieee80211_channel *chan,
2277 enum nl80211_channel_type channel_type,
2278 unsigned int duration, gfp_t gfp);
2279
2280/**
2281 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
2282 * @dev: network device
2283 * @cookie: the request cookie
2284 * @chan: The current channel (from remain_on_channel request)
2285 * @channel_type: Channel type
2286 * @gfp: allocation flags
2287 */
2288void cfg80211_remain_on_channel_expired(struct net_device *dev,
2289 u64 cookie,
2290 struct ieee80211_channel *chan,
2291 enum nl80211_channel_type channel_type,
2292 gfp_t gfp);
2293
2294
2295/**
2296 * cfg80211_new_sta - notify userspace about station
2297 *
2298 * @dev: the netdev
2299 * @mac_addr: the station's address
2300 * @sinfo: the station information
2301 * @gfp: allocation flags
2302 */
2303void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
2304 struct station_info *sinfo, gfp_t gfp);
2305
2306/**
2307 * cfg80211_rx_action - notification of received, unprocessed Action frame
2308 * @dev: network device
2309 * @freq: Frequency on which the frame was received in MHz
2310 * @buf: Action frame (header + body)
2311 * @len: length of the frame data
2312 * @gfp: context flags
2313 * Returns %true if a user space application is responsible for rejecting the
2314 * unrecognized Action frame; %false if no such application is registered
2315 * (i.e., the driver is responsible for rejecting the unrecognized Action
2316 * frame)
2317 *
2318 * This function is called whenever an Action frame is received for a station
2319 * mode interface, but is not processed in kernel.
2320 */
2321bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf,
2322 size_t len, gfp_t gfp);
2323
2324/**
2325 * cfg80211_action_tx_status - notification of TX status for Action frame
2326 * @dev: network device
2327 * @cookie: Cookie returned by cfg80211_ops::action()
2328 * @buf: Action frame (header + body)
2329 * @len: length of the frame data
2330 * @ack: Whether frame was acknowledged
2331 * @gfp: context flags
2332 *
2333 * This function is called whenever an Action frame was requested to be
2334 * transmitted with cfg80211_ops::action() to report the TX status of the
2335 * transmission attempt.
2336 */
2337void cfg80211_action_tx_status(struct net_device *dev, u64 cookie,
2338 const u8 *buf, size_t len, bool ack, gfp_t gfp);
2014 2339
2015#endif /* __NET_CFG80211_H */ 2340#endif /* __NET_CFG80211_H */
diff --git a/include/net/compat.h b/include/net/compat.h
index 7c3002832d05..28d5428ec6a2 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -18,6 +18,11 @@ struct compat_msghdr {
18 compat_uint_t msg_flags; 18 compat_uint_t msg_flags;
19}; 19};
20 20
21struct compat_mmsghdr {
22 struct compat_msghdr msg_hdr;
23 compat_uint_t msg_len;
24};
25
21struct compat_cmsghdr { 26struct compat_cmsghdr {
22 compat_size_t cmsg_len; 27 compat_size_t cmsg_len;
23 compat_int_t cmsg_level; 28 compat_int_t cmsg_level;
@@ -28,13 +33,20 @@ extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
28extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); 33extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
29 34
30#else /* defined(CONFIG_COMPAT) */ 35#else /* defined(CONFIG_COMPAT) */
31#define compat_msghdr msghdr /* to avoid compiler warnings */ 36/*
37 * To avoid compiler warnings:
38 */
39#define compat_msghdr msghdr
40#define compat_mmsghdr mmsghdr
32#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
33 42
34extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
35extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); 44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int);
36extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); 45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
37extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); 46extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
47extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
48 unsigned, unsigned,
49 struct compat_timespec __user *);
38extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 50extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
39extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 51extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
40 52
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index cee46821dc53..511a459ec10f 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -75,7 +75,6 @@ struct dn_dev_parms {
75 unsigned long t3; /* Default value of t3 */ 75 unsigned long t3; /* Default value of t3 */
76 int priority; /* Priority to be a router */ 76 int priority; /* Priority to be a router */
77 char *name; /* Name for sysctl */ 77 char *name; /* Name for sysctl */
78 int ctl_name; /* Index for sysctl */
79 int (*up)(struct net_device *); 78 int (*up)(struct net_device *);
80 void (*down)(struct net_device *); 79 void (*down)(struct net_device *);
81 void (*timer3)(struct net_device *, struct dn_ifaddr *ifa); 80 void (*timer3)(struct net_device *, struct dn_ifaddr *ifa);
@@ -97,16 +96,14 @@ struct dn_dev {
97 unsigned long uptime; /* Time device went up in jiffies */ 96 unsigned long uptime; /* Time device went up in jiffies */
98}; 97};
99 98
100struct dn_short_packet 99struct dn_short_packet {
101{
102 __u8 msgflg; 100 __u8 msgflg;
103 __le16 dstnode; 101 __le16 dstnode;
104 __le16 srcnode; 102 __le16 srcnode;
105 __u8 forward; 103 __u8 forward;
106} __attribute__((packed)); 104} __attribute__((packed));
107 105
108struct dn_long_packet 106struct dn_long_packet {
109{
110 __u8 msgflg; 107 __u8 msgflg;
111 __u8 d_area; 108 __u8 d_area;
112 __u8 d_subarea; 109 __u8 d_subarea;
@@ -122,8 +119,7 @@ struct dn_long_packet
122 119
123/*------------------------- DRP - Routing messages ---------------------*/ 120/*------------------------- DRP - Routing messages ---------------------*/
124 121
125struct endnode_hello_message 122struct endnode_hello_message {
126{
127 __u8 msgflg; 123 __u8 msgflg;
128 __u8 tiver[3]; 124 __u8 tiver[3];
129 __u8 id[6]; 125 __u8 id[6];
@@ -138,8 +134,7 @@ struct endnode_hello_message
138 __u8 data[2]; 134 __u8 data[2];
139} __attribute__((packed)); 135} __attribute__((packed));
140 136
141struct rtnode_hello_message 137struct rtnode_hello_message {
142{
143 __u8 msgflg; 138 __u8 msgflg;
144 __u8 tiver[3]; 139 __u8 tiver[3];
145 __u8 id[6]; 140 __u8 id[6];
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index c378be7bf960..52da6c3dd50d 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -4,8 +4,7 @@
4/* WARNING: The ordering of these elements must match ordering 4/* WARNING: The ordering of these elements must match ordering
5 * of RTA_* rtnetlink attribute numbers. 5 * of RTA_* rtnetlink attribute numbers.
6 */ 6 */
7struct dn_kern_rta 7struct dn_kern_rta {
8{
9 void *rta_dst; 8 void *rta_dst;
10 void *rta_src; 9 void *rta_src;
11 int *rta_iif; 10 int *rta_iif;
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index 96e816b6974d..17d43d2db5ec 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -70,30 +70,26 @@ extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int nobl
70 70
71/* Data Messages (data segment/interrupt/link service) */ 71/* Data Messages (data segment/interrupt/link service) */
72 72
73struct nsp_data_seg_msg 73struct nsp_data_seg_msg {
74{
75 __u8 msgflg; 74 __u8 msgflg;
76 __le16 dstaddr; 75 __le16 dstaddr;
77 __le16 srcaddr; 76 __le16 srcaddr;
78} __attribute__((packed)); 77} __attribute__((packed));
79 78
80struct nsp_data_opt_msg 79struct nsp_data_opt_msg {
81{
82 __le16 acknum; 80 __le16 acknum;
83 __le16 segnum; 81 __le16 segnum;
84 __le16 lsflgs; 82 __le16 lsflgs;
85} __attribute__((packed)); 83} __attribute__((packed));
86 84
87struct nsp_data_opt_msg1 85struct nsp_data_opt_msg1 {
88{
89 __le16 acknum; 86 __le16 acknum;
90 __le16 segnum; 87 __le16 segnum;
91} __attribute__((packed)); 88} __attribute__((packed));
92 89
93 90
94/* Acknowledgment Message (data/other data) */ 91/* Acknowledgment Message (data/other data) */
95struct nsp_data_ack_msg 92struct nsp_data_ack_msg {
96{
97 __u8 msgflg; 93 __u8 msgflg;
98 __le16 dstaddr; 94 __le16 dstaddr;
99 __le16 srcaddr; 95 __le16 srcaddr;
@@ -101,16 +97,14 @@ struct nsp_data_ack_msg
101} __attribute__((packed)); 97} __attribute__((packed));
102 98
103/* Connect Acknowledgment Message */ 99/* Connect Acknowledgment Message */
104struct nsp_conn_ack_msg 100struct nsp_conn_ack_msg {
105{
106 __u8 msgflg; 101 __u8 msgflg;
107 __le16 dstaddr; 102 __le16 dstaddr;
108} __attribute__((packed)); 103} __attribute__((packed));
109 104
110 105
111/* Connect Initiate/Retransmit Initiate/Connect Confirm */ 106/* Connect Initiate/Retransmit Initiate/Connect Confirm */
112struct nsp_conn_init_msg 107struct nsp_conn_init_msg {
113{
114 __u8 msgflg; 108 __u8 msgflg;
115#define NSP_CI 0x18 /* Connect Initiate */ 109#define NSP_CI 0x18 /* Connect Initiate */
116#define NSP_RCI 0x68 /* Retrans. Conn Init */ 110#define NSP_RCI 0x68 /* Retrans. Conn Init */
@@ -126,8 +120,7 @@ struct nsp_conn_init_msg
126} __attribute__((packed)); 120} __attribute__((packed));
127 121
128/* Disconnect Initiate/Disconnect Confirm */ 122/* Disconnect Initiate/Disconnect Confirm */
129struct nsp_disconn_init_msg 123struct nsp_disconn_init_msg {
130{
131 __u8 msgflg; 124 __u8 msgflg;
132 __le16 dstaddr; 125 __le16 dstaddr;
133 __le16 srcaddr; 126 __le16 srcaddr;
@@ -136,8 +129,7 @@ struct nsp_disconn_init_msg
136 129
137 130
138 131
139struct srcobj_fmt 132struct srcobj_fmt {
140{
141 __u8 format; 133 __u8 format;
142 __u8 task; 134 __u8 task;
143 __le16 grpcode; 135 __le16 grpcode;
diff --git a/include/net/dst.h b/include/net/dst.h
index 5a900ddcf10d..ce078cda6b74 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -36,8 +36,7 @@
36 36
37struct sk_buff; 37struct sk_buff;
38 38
39struct dst_entry 39struct dst_entry {
40{
41 struct rcu_head rcu_head; 40 struct rcu_head rcu_head;
42 struct dst_entry *child; 41 struct dst_entry *child;
43 struct net_device *dev; 42 struct net_device *dev;
@@ -84,8 +83,6 @@ struct dst_entry
84 * (L1_CACHE_SIZE would be too much) 83 * (L1_CACHE_SIZE would be too much)
85 */ 84 */
86#ifdef CONFIG_64BIT 85#ifdef CONFIG_64BIT
87 long __pad_to_align_refcnt[2];
88#else
89 long __pad_to_align_refcnt[1]; 86 long __pad_to_align_refcnt[1];
90#endif 87#endif
91 /* 88 /*
@@ -111,6 +108,12 @@ dst_metric(const struct dst_entry *dst, int metric)
111 return dst->metrics[metric-1]; 108 return dst->metrics[metric-1];
112} 109}
113 110
111static inline u32
112dst_feature(const struct dst_entry *dst, u32 feature)
113{
114 return dst_metric(dst, RTAX_FEATURES) & feature;
115}
116
114static inline u32 dst_mtu(const struct dst_entry *dst) 117static inline u32 dst_mtu(const struct dst_entry *dst)
115{ 118{
116 u32 mtu = dst_metric(dst, RTAX_MTU); 119 u32 mtu = dst_metric(dst, RTAX_MTU);
@@ -136,7 +139,7 @@ static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric,
136static inline u32 139static inline u32
137dst_allfrag(const struct dst_entry *dst) 140dst_allfrag(const struct dst_entry *dst)
138{ 141{
139 int ret = dst_metric(dst, RTAX_FEATURES) & RTAX_FEATURE_ALLFRAG; 142 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG);
140 /* Yes, _exactly_. This is paranoia. */ 143 /* Yes, _exactly_. This is paranoia. */
141 barrier(); 144 barrier();
142 return ret; 145 return ret;
@@ -222,11 +225,19 @@ static inline void dst_confirm(struct dst_entry *dst)
222 neigh_confirm(dst->neighbour); 225 neigh_confirm(dst->neighbour);
223} 226}
224 227
225static inline void dst_negative_advice(struct dst_entry **dst_p) 228static inline void dst_negative_advice(struct dst_entry **dst_p,
229 struct sock *sk)
226{ 230{
227 struct dst_entry * dst = *dst_p; 231 struct dst_entry * dst = *dst_p;
228 if (dst && dst->ops->negative_advice) 232 if (dst && dst->ops->negative_advice) {
229 *dst_p = dst->ops->negative_advice(dst); 233 *dst_p = dst->ops->negative_advice(dst);
234
235 if (dst != *dst_p) {
236 extern void sk_reset_txq(struct sock *sk);
237
238 sk_reset_txq(sk);
239 }
240 }
230} 241}
231 242
232static inline void dst_link_failure(struct sk_buff *skb) 243static inline void dst_link_failure(struct sk_buff *skb)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index ca4b2e840078..c49086d2bc7d 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -2,17 +2,17 @@
2#define __NET_FIB_RULES_H 2#define __NET_FIB_RULES_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/slab.h>
5#include <linux/netdevice.h> 6#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 7#include <linux/fib_rules.h>
7#include <net/flow.h> 8#include <net/flow.h>
8#include <net/rtnetlink.h> 9#include <net/rtnetlink.h>
9 10
10struct fib_rule 11struct fib_rule {
11{
12 struct list_head list; 12 struct list_head list;
13 atomic_t refcnt; 13 atomic_t refcnt;
14 int ifindex; 14 int iifindex;
15 char ifname[IFNAMSIZ]; 15 int oifindex;
16 u32 mark; 16 u32 mark;
17 u32 mark_mask; 17 u32 mark_mask;
18 u32 pref; 18 u32 pref;
@@ -21,19 +21,19 @@ struct fib_rule
21 u8 action; 21 u8 action;
22 u32 target; 22 u32 target;
23 struct fib_rule * ctarget; 23 struct fib_rule * ctarget;
24 char iifname[IFNAMSIZ];
25 char oifname[IFNAMSIZ];
24 struct rcu_head rcu; 26 struct rcu_head rcu;
25 struct net * fr_net; 27 struct net * fr_net;
26}; 28};
27 29
28struct fib_lookup_arg 30struct fib_lookup_arg {
29{
30 void *lookup_ptr; 31 void *lookup_ptr;
31 void *result; 32 void *result;
32 struct fib_rule *rule; 33 struct fib_rule *rule;
33}; 34};
34 35
35struct fib_rules_ops 36struct fib_rules_ops {
36{
37 int family; 37 int family;
38 struct list_head list; 38 struct list_head list;
39 int rule_size; 39 int rule_size;
@@ -67,10 +67,12 @@ struct fib_rules_ops
67 struct list_head rules_list; 67 struct list_head rules_list;
68 struct module *owner; 68 struct module *owner;
69 struct net *fro_net; 69 struct net *fro_net;
70 struct rcu_head rcu;
70}; 71};
71 72
72#define FRA_GENERIC_POLICY \ 73#define FRA_GENERIC_POLICY \
73 [FRA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ 74 [FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
75 [FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
74 [FRA_PRIORITY] = { .type = NLA_U32 }, \ 76 [FRA_PRIORITY] = { .type = NLA_U32 }, \
75 [FRA_FWMARK] = { .type = NLA_U32 }, \ 77 [FRA_FWMARK] = { .type = NLA_U32 }, \
76 [FRA_FWMASK] = { .type = NLA_U32 }, \ 78 [FRA_FWMASK] = { .type = NLA_U32 }, \
@@ -102,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
102 return frh->table; 104 return frh->table;
103} 105}
104 106
105extern int fib_rules_register(struct fib_rules_ops *); 107extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *);
106extern void fib_rules_unregister(struct fib_rules_ops *); 108extern void fib_rules_unregister(struct fib_rules_ops *);
107extern void fib_rules_cleanup_ops(struct fib_rules_ops *); 109extern void fib_rules_cleanup_ops(struct fib_rules_ops *);
108 110
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index c1488553e349..fa157712e982 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -6,8 +6,7 @@
6#include <linux/rtnetlink.h> 6#include <linux/rtnetlink.h>
7#include <linux/pkt_sched.h> 7#include <linux/pkt_sched.h>
8 8
9struct gnet_dump 9struct gnet_dump {
10{
11 spinlock_t * lock; 10 spinlock_t * lock;
12 struct sk_buff * skb; 11 struct sk_buff * skb;
13 struct nlattr * tail; 12 struct nlattr * tail;
@@ -30,6 +29,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
30extern int gnet_stats_copy_basic(struct gnet_dump *d, 29extern int gnet_stats_copy_basic(struct gnet_dump *d,
31 struct gnet_stats_basic_packed *b); 30 struct gnet_stats_basic_packed *b);
32extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 31extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
32 const struct gnet_stats_basic_packed *b,
33 struct gnet_stats_rate_est *r); 33 struct gnet_stats_rate_est *r);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 34extern int gnet_stats_copy_queue(struct gnet_dump *d,
35 struct gnet_stats_queue *q); 35 struct gnet_stats_queue *q);
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 2a1c06874c42..eb551baafc04 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -13,8 +13,7 @@
13 * @list: list entry for linking 13 * @list: list entry for linking
14 * @family: pointer to family, need not be set before registering 14 * @family: pointer to family, need not be set before registering
15 */ 15 */
16struct genl_multicast_group 16struct genl_multicast_group {
17{
18 struct genl_family *family; /* private */ 17 struct genl_family *family; /* private */
19 struct list_head list; /* private */ 18 struct list_head list; /* private */
20 char name[GENL_NAMSIZ]; 19 char name[GENL_NAMSIZ];
@@ -35,8 +34,7 @@ struct genl_multicast_group
35 * @family_list: family list 34 * @family_list: family list
36 * @mcast_groups: multicast groups list 35 * @mcast_groups: multicast groups list
37 */ 36 */
38struct genl_family 37struct genl_family {
39{
40 unsigned int id; 38 unsigned int id;
41 unsigned int hdrsize; 39 unsigned int hdrsize;
42 char name[GENL_NAMSIZ]; 40 char name[GENL_NAMSIZ];
@@ -58,8 +56,7 @@ struct genl_family
58 * @userhdr: user specific header 56 * @userhdr: user specific header
59 * @attrs: netlink attributes 57 * @attrs: netlink attributes
60 */ 58 */
61struct genl_info 59struct genl_info {
62{
63 u32 snd_seq; 60 u32 snd_seq;
64 u32 snd_pid; 61 u32 snd_pid;
65 struct nlmsghdr * nlhdr; 62 struct nlmsghdr * nlhdr;
@@ -102,8 +99,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
102 * @done: completion callback for dumps 99 * @done: completion callback for dumps
103 * @ops_list: operations list 100 * @ops_list: operations list
104 */ 101 */
105struct genl_ops 102struct genl_ops {
106{
107 u8 cmd; 103 u8 cmd;
108 unsigned int flags; 104 unsigned int flags;
109 const struct nla_policy *policy; 105 const struct nla_policy *policy;
diff --git a/include/net/icmp.h b/include/net/icmp.h
index dfa72d4e8907..15b3dfe9fce8 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -28,7 +28,7 @@ struct icmp_err {
28 unsigned fatal:1; 28 unsigned fatal:1;
29}; 29};
30 30
31extern struct icmp_err icmp_err_convert[]; 31extern const struct icmp_err icmp_err_convert[];
32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) 32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) 33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field)
34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) 34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256)
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 23c3f3d97779..af49f8ab7f81 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -80,7 +80,7 @@ struct ieee80211_radiotap_header {
80 * Additional extensions are made 80 * Additional extensions are made
81 * by setting bit 31. 81 * by setting bit 31.
82 */ 82 */
83}; 83} __packed;
84 84
85/* Name Data type Units 85/* Name Data type Units
86 * ---- --------- ----- 86 * ---- --------- -----
@@ -198,6 +198,10 @@ enum ieee80211_radiotap_type {
198 IEEE80211_RADIOTAP_TX_FLAGS = 15, 198 IEEE80211_RADIOTAP_TX_FLAGS = 15,
199 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 199 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
200 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 200 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
201
202 /* valid in every it_present bitmap, even vendor namespaces */
203 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
204 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
201 IEEE80211_RADIOTAP_EXT = 31 205 IEEE80211_RADIOTAP_EXT = 31
202}; 206};
203 207
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 5dc6a61952de..57430555487a 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -74,8 +74,12 @@ static inline int mac_cb_type(struct sk_buff *skb)
74#define IEEE802154_MAC_SCAN_PASSIVE 2 74#define IEEE802154_MAC_SCAN_PASSIVE 2
75#define IEEE802154_MAC_SCAN_ORPHAN 3 75#define IEEE802154_MAC_SCAN_ORPHAN 3
76 76
77struct wpan_phy;
77/* 78/*
78 * This should be located at net_device->ml_priv 79 * This should be located at net_device->ml_priv
80 *
81 * get_phy should increment the reference counting on returned phy.
82 * Use wpan_wpy_put to put that reference.
79 */ 83 */
80struct ieee802154_mlme_ops { 84struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev, 85 int (*assoc_req)(struct net_device *dev,
@@ -94,18 +98,20 @@ struct ieee802154_mlme_ops {
94 int (*scan_req)(struct net_device *dev, 98 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 page, u8 duration); 99 u8 type, u32 channels, u8 page, u8 duration);
96 100
101 struct wpan_phy *(*get_phy)(const struct net_device *dev);
102
97 /* 103 /*
98 * FIXME: these should become the part of PIB/MIB interface. 104 * FIXME: these should become the part of PIB/MIB interface.
99 * However we still don't have IB interface of any kind 105 * However we still don't have IB interface of any kind
100 */ 106 */
101 u16 (*get_pan_id)(struct net_device *dev); 107 u16 (*get_pan_id)(const struct net_device *dev);
102 u16 (*get_short_addr)(struct net_device *dev); 108 u16 (*get_short_addr)(const struct net_device *dev);
103 u8 (*get_dsn)(struct net_device *dev); 109 u8 (*get_dsn)(const struct net_device *dev);
104 u8 (*get_bsn)(struct net_device *dev); 110 u8 (*get_bsn)(const struct net_device *dev);
105}; 111};
106 112
107static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( 113static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops(
108 struct net_device *dev) 114 const struct net_device *dev)
109{ 115{
110 return dev->ml_priv; 116 return dev->ml_priv;
111} 117}
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 38b78132019b..545d8b059bef 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -32,8 +32,7 @@
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34 34
35struct inet6_ifaddr 35struct inet6_ifaddr {
36{
37 struct in6_addr addr; 36 struct in6_addr addr;
38 __u32 prefix_len; 37 __u32 prefix_len;
39 38
@@ -67,8 +66,7 @@ struct inet6_ifaddr
67 int dead; 66 int dead;
68}; 67};
69 68
70struct ip6_sf_socklist 69struct ip6_sf_socklist {
71{
72 unsigned int sl_max; 70 unsigned int sl_max;
73 unsigned int sl_count; 71 unsigned int sl_count;
74 struct in6_addr sl_addr[0]; 72 struct in6_addr sl_addr[0];
@@ -79,8 +77,7 @@ struct ip6_sf_socklist
79 77
80#define IP6_SFBLOCK 10 /* allocate this many at once */ 78#define IP6_SFBLOCK 10 /* allocate this many at once */
81 79
82struct ipv6_mc_socklist 80struct ipv6_mc_socklist {
83{
84 struct in6_addr addr; 81 struct in6_addr addr;
85 int ifindex; 82 int ifindex;
86 struct ipv6_mc_socklist *next; 83 struct ipv6_mc_socklist *next;
@@ -89,8 +86,7 @@ struct ipv6_mc_socklist
89 struct ip6_sf_socklist *sflist; 86 struct ip6_sf_socklist *sflist;
90}; 87};
91 88
92struct ip6_sf_list 89struct ip6_sf_list {
93{
94 struct ip6_sf_list *sf_next; 90 struct ip6_sf_list *sf_next;
95 struct in6_addr sf_addr; 91 struct in6_addr sf_addr;
96 unsigned long sf_count[2]; /* include/exclude counts */ 92 unsigned long sf_count[2]; /* include/exclude counts */
@@ -105,8 +101,7 @@ struct ip6_sf_list
105#define MAF_NOREPORT 0x08 101#define MAF_NOREPORT 0x08
106#define MAF_GSQUERY 0x10 102#define MAF_GSQUERY 0x10
107 103
108struct ifmcaddr6 104struct ifmcaddr6 {
109{
110 struct in6_addr mca_addr; 105 struct in6_addr mca_addr;
111 struct inet6_dev *idev; 106 struct inet6_dev *idev;
112 struct ifmcaddr6 *next; 107 struct ifmcaddr6 *next;
@@ -126,15 +121,13 @@ struct ifmcaddr6
126 121
127/* Anycast stuff */ 122/* Anycast stuff */
128 123
129struct ipv6_ac_socklist 124struct ipv6_ac_socklist {
130{
131 struct in6_addr acl_addr; 125 struct in6_addr acl_addr;
132 int acl_ifindex; 126 int acl_ifindex;
133 struct ipv6_ac_socklist *acl_next; 127 struct ipv6_ac_socklist *acl_next;
134}; 128};
135 129
136struct ifacaddr6 130struct ifacaddr6 {
137{
138 struct in6_addr aca_addr; 131 struct in6_addr aca_addr;
139 struct inet6_dev *aca_idev; 132 struct inet6_dev *aca_idev;
140 struct rt6_info *aca_rt; 133 struct rt6_info *aca_rt;
@@ -157,15 +150,14 @@ struct ipv6_devstat {
157 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg); 150 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg);
158}; 151};
159 152
160struct inet6_dev 153struct inet6_dev {
161{
162 struct net_device *dev; 154 struct net_device *dev;
163 155
164 struct inet6_ifaddr *addr_list; 156 struct inet6_ifaddr *addr_list;
165 157
166 struct ifmcaddr6 *mc_list; 158 struct ifmcaddr6 *mc_list;
167 struct ifmcaddr6 *mc_tomb; 159 struct ifmcaddr6 *mc_tomb;
168 rwlock_t mc_lock; 160 spinlock_t mc_lock;
169 unsigned char mc_qrv; 161 unsigned char mc_qrv;
170 unsigned char mc_gq_running; 162 unsigned char mc_gq_running;
171 unsigned char mc_ifc_count; 163 unsigned char mc_ifc_count;
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 22c73a77cd99..e46674d5daea 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -46,14 +46,14 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
46 const struct ipv6_pinfo *np = inet6_sk(sk); 46 const struct ipv6_pinfo *np = inet6_sk(sk);
47 const struct in6_addr *laddr = &np->rcv_saddr; 47 const struct in6_addr *laddr = &np->rcv_saddr;
48 const struct in6_addr *faddr = &np->daddr; 48 const struct in6_addr *faddr = &np->daddr;
49 const __u16 lport = inet->num; 49 const __u16 lport = inet->inet_num;
50 const __be16 fport = inet->dport; 50 const __be16 fport = inet->inet_dport;
51 struct net *net = sock_net(sk); 51 struct net *net = sock_net(sk);
52 52
53 return inet6_ehashfn(net, laddr, lport, faddr, fport); 53 return inet6_ehashfn(net, laddr, lport, faddr, fport);
54} 54}
55 55
56extern void __inet6_hash(struct sock *sk); 56extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
57 57
58/* 58/*
59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index d522dcf3031a..74358d1b3f43 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -92,8 +92,8 @@ static inline struct net *ib_net(struct inet_bind_bucket *ib)
92 return read_pnet(&ib->ib_net); 92 return read_pnet(&ib->ib_net);
93} 93}
94 94
95#define inet_bind_bucket_for_each(tb, node, head) \ 95#define inet_bind_bucket_for_each(tb, pos, head) \
96 hlist_for_each_entry(tb, node, head, node) 96 hlist_for_each_entry(tb, pos, head, node)
97 97
98struct inet_bind_hashbucket { 98struct inet_bind_hashbucket {
99 spinlock_t lock; 99 spinlock_t lock;
@@ -125,7 +125,7 @@ struct inet_hashinfo {
125 */ 125 */
126 struct inet_ehash_bucket *ehash; 126 struct inet_ehash_bucket *ehash;
127 spinlock_t *ehash_locks; 127 spinlock_t *ehash_locks;
128 unsigned int ehash_size; 128 unsigned int ehash_mask;
129 unsigned int ehash_locks_mask; 129 unsigned int ehash_locks_mask;
130 130
131 /* Ok, let's try this, I give up, we do need a local binding 131 /* Ok, let's try this, I give up, we do need a local binding
@@ -158,7 +158,7 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket(
158 struct inet_hashinfo *hashinfo, 158 struct inet_hashinfo *hashinfo,
159 unsigned int hash) 159 unsigned int hash)
160{ 160{
161 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; 161 return &hashinfo->ehash[hash & hashinfo->ehash_mask];
162} 162}
163 163
164static inline spinlock_t *inet_ehash_lockp( 164static inline spinlock_t *inet_ehash_lockp(
@@ -241,7 +241,7 @@ static inline int inet_lhashfn(struct net *net, const unsigned short num)
241 241
242static inline int inet_sk_listen_hashfn(const struct sock *sk) 242static inline int inet_sk_listen_hashfn(const struct sock *sk)
243{ 243{
244 return inet_lhashfn(sock_net(sk), inet_sk(sk)->num); 244 return inet_lhashfn(sock_net(sk), inet_sk(sk)->inet_num);
245} 245}
246 246
247/* Caller must disable local BH processing. */ 247/* Caller must disable local BH processing. */
@@ -251,7 +251,7 @@ extern void inet_put_port(struct sock *sk);
251 251
252void inet_hashinfo_init(struct inet_hashinfo *h); 252void inet_hashinfo_init(struct inet_hashinfo *h);
253 253
254extern void __inet_hash_nolisten(struct sock *sk); 254extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
255extern void inet_hash(struct sock *sk); 255extern void inet_hash(struct sock *sk);
256extern void inet_unhash(struct sock *sk); 256extern void inet_unhash(struct sock *sk);
257 257
@@ -301,8 +301,8 @@ typedef __u64 __bitwise __addrpair;
301#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 302#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
303 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 303 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
304 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 304 ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie)) && \
305 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 305 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \
306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
307#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 307#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
308 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 308 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
@@ -313,9 +313,9 @@ typedef __u64 __bitwise __addrpair;
313#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 313#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
314#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 314#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
315 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 315 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
316 (inet_sk(__sk)->daddr == (__saddr)) && \ 316 (inet_sk(__sk)->inet_daddr == (__saddr)) && \
317 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 317 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \
318 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 318 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \
319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
320#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 320#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
321 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 321 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
@@ -391,10 +391,12 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
391} 391}
392 392
393extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 393extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
394 struct sock *sk, u32 port_offset, 394 struct sock *sk,
395 u32 port_offset,
395 int (*check_established)(struct inet_timewait_death_row *, 396 int (*check_established)(struct inet_timewait_death_row *,
396 struct sock *, __u16, struct inet_timewait_sock **), 397 struct sock *, __u16, struct inet_timewait_sock **),
397 void (*hash)(struct sock *sk)); 398 int (*hash)(struct sock *sk, struct inet_timewait_sock *twp));
399
398extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 400extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
399 struct sock *sk); 401 struct sock *sk);
400#endif /* _INET_HASHTABLES_H */ 402#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 47004f35cc7e..83fd34437cf1 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -93,14 +93,14 @@ struct rtable;
93 * 93 *
94 * @sk - ancestor class 94 * @sk - ancestor class
95 * @pinet6 - pointer to IPv6 control block 95 * @pinet6 - pointer to IPv6 control block
96 * @daddr - Foreign IPv4 addr 96 * @inet_daddr - Foreign IPv4 addr
97 * @rcv_saddr - Bound local IPv4 addr 97 * @inet_rcv_saddr - Bound local IPv4 addr
98 * @dport - Destination port 98 * @inet_dport - Destination port
99 * @num - Local port 99 * @inet_num - Local port
100 * @saddr - Sending source 100 * @inet_saddr - Sending source
101 * @uc_ttl - Unicast TTL 101 * @uc_ttl - Unicast TTL
102 * @sport - Source port 102 * @inet_sport - Source port
103 * @id - ID counter for DF pkts 103 * @inet_id - ID counter for DF pkts
104 * @tos - TOS 104 * @tos - TOS
105 * @mc_ttl - Multicasting TTL 105 * @mc_ttl - Multicasting TTL
106 * @is_icsk - is this an inet_connection_sock? 106 * @is_icsk - is this an inet_connection_sock?
@@ -115,17 +115,19 @@ struct inet_sock {
115 struct ipv6_pinfo *pinet6; 115 struct ipv6_pinfo *pinet6;
116#endif 116#endif
117 /* Socket demultiplex comparisons on incoming packets. */ 117 /* Socket demultiplex comparisons on incoming packets. */
118 __be32 daddr; 118 __be32 inet_daddr;
119 __be32 rcv_saddr; 119 __be32 inet_rcv_saddr;
120 __be16 dport; 120 __be16 inet_dport;
121 __u16 num; 121 __u16 inet_num;
122 __be32 saddr; 122 __be32 inet_saddr;
123 __s16 uc_ttl; 123 __s16 uc_ttl;
124 __u16 cmsg_flags; 124 __u16 cmsg_flags;
125 __be16 inet_sport;
126 __u16 inet_id;
127
125 struct ip_options *opt; 128 struct ip_options *opt;
126 __be16 sport;
127 __u16 id;
128 __u8 tos; 129 __u8 tos;
130 __u8 min_ttl;
129 __u8 mc_ttl; 131 __u8 mc_ttl;
130 __u8 pmtudisc; 132 __u8 pmtudisc;
131 __u8 recverr:1, 133 __u8 recverr:1,
@@ -190,10 +192,10 @@ static inline unsigned int inet_ehashfn(struct net *net,
190static inline int inet_sk_ehashfn(const struct sock *sk) 192static inline int inet_sk_ehashfn(const struct sock *sk)
191{ 193{
192 const struct inet_sock *inet = inet_sk(sk); 194 const struct inet_sock *inet = inet_sk(sk);
193 const __be32 laddr = inet->rcv_saddr; 195 const __be32 laddr = inet->inet_rcv_saddr;
194 const __u16 lport = inet->num; 196 const __u16 lport = inet->inet_num;
195 const __be32 faddr = inet->daddr; 197 const __be32 faddr = inet->inet_daddr;
196 const __be16 fport = inet->dport; 198 const __be16 fport = inet->inet_dport;
197 struct net *net = sock_net(sk); 199 struct net *net = sock_net(sk);
198 200
199 return inet_ehashfn(net, laddr, lport, faddr, fport); 201 return inet_ehashfn(net, laddr, lport, faddr, fport);
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f93ad90a601b..79f67eae8a7e 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -194,11 +194,16 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
194static inline __be32 inet_rcv_saddr(const struct sock *sk) 194static inline __be32 inet_rcv_saddr(const struct sock *sk)
195{ 195{
196 return likely(sk->sk_state != TCP_TIME_WAIT) ? 196 return likely(sk->sk_state != TCP_TIME_WAIT) ?
197 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; 197 inet_sk(sk)->inet_rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
198} 198}
199 199
200extern void inet_twsk_put(struct inet_timewait_sock *tw); 200extern void inet_twsk_put(struct inet_timewait_sock *tw);
201 201
202extern int inet_twsk_unhash(struct inet_timewait_sock *tw);
203
204extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
205 struct inet_hashinfo *hashinfo);
206
202extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 207extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
203 const int state); 208 const int state);
204 209
@@ -212,14 +217,14 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw,
212extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, 217extern void inet_twsk_deschedule(struct inet_timewait_sock *tw,
213 struct inet_timewait_death_row *twdr); 218 struct inet_timewait_death_row *twdr);
214 219
215extern void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo, 220extern void inet_twsk_purge(struct inet_hashinfo *hashinfo,
216 struct inet_timewait_death_row *twdr, int family); 221 struct inet_timewait_death_row *twdr, int family);
217 222
218static inline 223static inline
219struct net *twsk_net(const struct inet_timewait_sock *twsk) 224struct net *twsk_net(const struct inet_timewait_sock *twsk)
220{ 225{
221#ifdef CONFIG_NET_NS 226#ifdef CONFIG_NET_NS
222 return twsk->tw_net; 227 return rcu_dereference(twsk->tw_net);
223#else 228#else
224 return &init_net; 229 return &init_net;
225#endif 230#endif
@@ -229,7 +234,7 @@ static inline
229void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) 234void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
230{ 235{
231#ifdef CONFIG_NET_NS 236#ifdef CONFIG_NET_NS
232 twsk->tw_net = net; 237 rcu_assign_pointer(twsk->tw_net, net);
233#endif 238#endif
234} 239}
235#endif /* _INET_TIMEWAIT_SOCK_ */ 240#endif /* _INET_TIMEWAIT_SOCK_ */
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 15e1f8fe4c1f..87b1df0d4d8c 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -13,20 +13,19 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <asm/atomic.h> 14#include <asm/atomic.h>
15 15
16struct inet_peer 16struct inet_peer {
17{
18 /* group together avl_left,avl_right,v4daddr to speedup lookups */ 17 /* group together avl_left,avl_right,v4daddr to speedup lookups */
19 struct inet_peer *avl_left, *avl_right; 18 struct inet_peer *avl_left, *avl_right;
20 __be32 v4daddr; /* peer's address */ 19 __be32 v4daddr; /* peer's address */
21 __u16 avl_height; 20 __u32 avl_height;
22 __u16 ip_id_count; /* IP ID for the next packet */
23 struct list_head unused; 21 struct list_head unused;
24 __u32 dtime; /* the time of last use of not 22 __u32 dtime; /* the time of last use of not
25 * referenced entries */ 23 * referenced entries */
26 atomic_t refcnt; 24 atomic_t refcnt;
27 atomic_t rid; /* Frag reception counter */ 25 atomic_t rid; /* Frag reception counter */
26 atomic_t ip_id_count; /* IP ID for the next packet */
28 __u32 tcp_ts; 27 __u32 tcp_ts;
29 unsigned long tcp_ts_stamp; 28 __u32 tcp_ts_stamp;
30}; 29};
31 30
32void inet_initpeers(void) __init; 31void inet_initpeers(void) __init;
@@ -37,17 +36,11 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create);
37/* can be called from BH context or outside */ 36/* can be called from BH context or outside */
38extern void inet_putpeer(struct inet_peer *p); 37extern void inet_putpeer(struct inet_peer *p);
39 38
40extern spinlock_t inet_peer_idlock;
41/* can be called with or without local BH being disabled */ 39/* can be called with or without local BH being disabled */
42static inline __u16 inet_getid(struct inet_peer *p, int more) 40static inline __u16 inet_getid(struct inet_peer *p, int more)
43{ 41{
44 __u16 id; 42 more++;
45 43 return atomic_add_return(more, &p->ip_id_count) - more;
46 spin_lock_bh(&inet_peer_idlock);
47 id = p->ip_id_count;
48 p->ip_id_count += 1 + more;
49 spin_unlock_bh(&inet_peer_idlock);
50 return id;
51} 44}
52 45
53#endif /* _NET_INETPEER_H */ 46#endif /* _NET_INETPEER_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index 2f47e5482b55..503994a38ed1 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -33,8 +33,7 @@
33 33
34struct sock; 34struct sock;
35 35
36struct inet_skb_parm 36struct inet_skb_parm {
37{
38 struct ip_options opt; /* Compiled IP options */ 37 struct ip_options opt; /* Compiled IP options */
39 unsigned char flags; 38 unsigned char flags;
40 39
@@ -50,8 +49,7 @@ static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
50 return ip_hdr(skb)->ihl * 4; 49 return ip_hdr(skb)->ihl * 4;
51} 50}
52 51
53struct ipcm_cookie 52struct ipcm_cookie {
54{
55 __be32 addr; 53 __be32 addr;
56 int oif; 54 int oif;
57 struct ip_options *opt; 55 struct ip_options *opt;
@@ -60,8 +58,7 @@ struct ipcm_cookie
60 58
61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 59#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
62 60
63struct ip_ra_chain 61struct ip_ra_chain {
64{
65 struct ip_ra_chain *next; 62 struct ip_ra_chain *next;
66 struct sock *sk; 63 struct sock *sk;
67 void (*destructor)(struct sock *); 64 void (*destructor)(struct sock *);
@@ -159,8 +156,7 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
159void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, 156void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
160 unsigned int len); 157 unsigned int len);
161 158
162struct ipv4_config 159struct ipv4_config {
163{
164 int log_martians; 160 int log_martians;
165 int no_pmtu_disc; 161 int no_pmtu_disc;
166}; 162};
@@ -178,9 +174,9 @@ extern struct ipv4_config ipv4_config;
178#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 174#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
179#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
180 176
181extern unsigned long snmp_fold_field(void *mib[], int offt); 177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
182extern int snmp_mib_init(void *ptr[2], size_t mibsize); 178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize);
183extern void snmp_mib_free(void *ptr[2]); 179extern void snmp_mib_free(void __percpu *ptr[2]);
184 180
185extern struct local_ports { 181extern struct local_ports {
186 seqlock_t lock; 182 seqlock_t lock;
@@ -240,8 +236,8 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
240 * does not change, they drop every other packet in 236 * does not change, they drop every other packet in
241 * a TCP stream using header compression. 237 * a TCP stream using header compression.
242 */ 238 */
243 iph->id = (sk && inet_sk(sk)->daddr) ? 239 iph->id = (sk && inet_sk(sk)->inet_daddr) ?
244 htons(inet_sk(sk)->id++) : 0; 240 htons(inet_sk(sk)->inet_id++) : 0;
245 } else 241 } else
246 __ip_select_ident(iph, dst, 0); 242 __ip_select_ident(iph, dst, 0);
247} 243}
@@ -249,9 +245,9 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
249static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) 245static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more)
250{ 246{
251 if (iph->frag_off & htons(IP_DF)) { 247 if (iph->frag_off & htons(IP_DF)) {
252 if (sk && inet_sk(sk)->daddr) { 248 if (sk && inet_sk(sk)->inet_daddr) {
253 iph->id = htons(inet_sk(sk)->id); 249 iph->id = htons(inet_sk(sk)->inet_id);
254 inet_sk(sk)->id += 1 + more; 250 inet_sk(sk)->inet_id += 1 + more;
255 } else 251 } else
256 iph->id = 0; 252 iph->id = 0;
257 } else 253 } else
@@ -317,7 +313,7 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch
317 313
318static __inline__ void inet_reset_saddr(struct sock *sk) 314static __inline__ void inet_reset_saddr(struct sock *sk)
319{ 315{
320 inet_sk(sk)->rcv_saddr = inet_sk(sk)->saddr = 0; 316 inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
321#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 317#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
322 if (sk->sk_family == PF_INET6) { 318 if (sk->sk_family == PF_INET6) {
323 struct ipv6_pinfo *np = inet6_sk(sk); 319 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -330,18 +326,37 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
330 326
331#endif 327#endif
332 328
329static inline int sk_mc_loop(struct sock *sk)
330{
331 if (!sk)
332 return 1;
333 switch (sk->sk_family) {
334 case AF_INET:
335 return inet_sk(sk)->mc_loop;
336#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
337 case AF_INET6:
338 return inet6_sk(sk)->mc_loop;
339#endif
340 }
341 WARN_ON(1);
342 return 1;
343}
344
333extern int ip_call_ra_chain(struct sk_buff *skb); 345extern int ip_call_ra_chain(struct sk_buff *skb);
334 346
335/* 347/*
336 * Functions provided by ip_fragment.c 348 * Functions provided by ip_fragment.c
337 */ 349 */
338 350
339enum ip_defrag_users 351enum ip_defrag_users {
340{
341 IP_DEFRAG_LOCAL_DELIVER, 352 IP_DEFRAG_LOCAL_DELIVER,
342 IP_DEFRAG_CALL_RA_CHAIN, 353 IP_DEFRAG_CALL_RA_CHAIN,
343 IP_DEFRAG_CONNTRACK_IN, 354 IP_DEFRAG_CONNTRACK_IN,
355 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX,
344 IP_DEFRAG_CONNTRACK_OUT, 356 IP_DEFRAG_CONNTRACK_OUT,
357 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX,
358 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
359 __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX,
345 IP_DEFRAG_VS_IN, 360 IP_DEFRAG_VS_IN,
346 IP_DEFRAG_VS_OUT, 361 IP_DEFRAG_VS_OUT,
347 IP_DEFRAG_VS_FWD 362 IP_DEFRAG_VS_FWD
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 15b492a9aa79..86f46c49e318 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -30,8 +30,7 @@
30 30
31struct rt6_info; 31struct rt6_info;
32 32
33struct fib6_config 33struct fib6_config {
34{
35 u32 fc_table; 34 u32 fc_table;
36 u32 fc_metric; 35 u32 fc_metric;
37 int fc_dst_len; 36 int fc_dst_len;
@@ -51,8 +50,7 @@ struct fib6_config
51 struct nl_info fc_nlinfo; 50 struct nl_info fc_nlinfo;
52}; 51};
53 52
54struct fib6_node 53struct fib6_node {
55{
56 struct fib6_node *parent; 54 struct fib6_node *parent;
57 struct fib6_node *left; 55 struct fib6_node *left;
58 struct fib6_node *right; 56 struct fib6_node *right;
@@ -78,16 +76,14 @@ struct fib6_node
78 * 76 *
79 */ 77 */
80 78
81struct rt6key 79struct rt6key {
82{
83 struct in6_addr addr; 80 struct in6_addr addr;
84 int plen; 81 int plen;
85}; 82};
86 83
87struct fib6_table; 84struct fib6_table;
88 85
89struct rt6_info 86struct rt6_info {
90{
91 union { 87 union {
92 struct dst_entry dst; 88 struct dst_entry dst;
93 } u; 89 } u;
@@ -127,13 +123,14 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
127 return ((struct rt6_info *)dst)->rt6i_idev; 123 return ((struct rt6_info *)dst)->rt6i_idev;
128} 124}
129 125
130struct fib6_walker_t 126struct fib6_walker_t {
131{ 127 struct list_head lh;
132 struct fib6_walker_t *prev, *next;
133 struct fib6_node *root, *node; 128 struct fib6_node *root, *node;
134 struct rt6_info *leaf; 129 struct rt6_info *leaf;
135 unsigned char state; 130 unsigned char state;
136 unsigned char prune; 131 unsigned char prune;
132 unsigned int skip;
133 unsigned int count;
137 int (*func)(struct fib6_walker_t *); 134 int (*func)(struct fib6_walker_t *);
138 void *args; 135 void *args;
139}; 136};
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 0e1b8aebaff8..68f67836e146 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -37,6 +37,24 @@ struct route_info {
37#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 37#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
38#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 38#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
39 39
40/*
41 * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
42 * between IPV6_ADDR_PREFERENCES socket option values
43 * IPV6_PREFER_SRC_TMP = 0x1
44 * IPV6_PREFER_SRC_PUBLIC = 0x2
45 * IPV6_PREFER_SRC_COA = 0x4
46 * and above RT6_LOOKUP_F_SRCPREF_xxx flags.
47 */
48static inline int rt6_srcprefs2flags(unsigned int srcprefs)
49{
50 /* No need to bitmask because srcprefs have only 3 bits. */
51 return srcprefs << 3;
52}
53
54static inline unsigned int rt6_flags2srcprefs(int flags)
55{
56 return (flags >> 3) & 7;
57}
40 58
41extern void ip6_route_input(struct sk_buff *skb); 59extern void ip6_route_input(struct sk_buff *skb);
42 60
@@ -103,8 +121,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr,
103 121
104struct netlink_callback; 122struct netlink_callback;
105 123
106struct rt6_rtnl_dump_arg 124struct rt6_rtnl_dump_arg {
107{
108 struct sk_buff *skb; 125 struct sk_buff *skb;
109 struct netlink_callback *cb; 126 struct netlink_callback *cb;
110 struct net *net; 127 struct net *net;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 83b4e008b16d..fbf9d1cda27b 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -15,7 +15,6 @@
15struct ip6_tnl { 15struct ip6_tnl {
16 struct ip6_tnl *next; /* next tunnel in list */ 16 struct ip6_tnl *next; /* next tunnel in list */
17 struct net_device *dev; /* virtual device associated with tunnel */ 17 struct net_device *dev; /* virtual device associated with tunnel */
18 int recursion; /* depth of hard_start_xmit recursion */
19 struct ip6_tnl_parm parms; /* tunnel configuration parameters */ 18 struct ip6_tnl_parm parms; /* tunnel configuration parameters */
20 struct flowi fl; /* flowi template for xmit */ 19 struct flowi fl; /* flowi template for xmit */
21 struct dst_entry *dst_cache; /* cached dst */ 20 struct dst_entry *dst_cache; /* cached dst */
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 4d22fabc7719..c93f94edc610 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -144,18 +144,21 @@ struct fib_table {
144 struct hlist_node tb_hlist; 144 struct hlist_node tb_hlist;
145 u32 tb_id; 145 u32 tb_id;
146 int tb_default; 146 int tb_default;
147 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
148 int (*tb_insert)(struct fib_table *, struct fib_config *);
149 int (*tb_delete)(struct fib_table *, struct fib_config *);
150 int (*tb_dump)(struct fib_table *table, struct sk_buff *skb,
151 struct netlink_callback *cb);
152 int (*tb_flush)(struct fib_table *table);
153 void (*tb_select_default)(struct fib_table *table,
154 const struct flowi *flp, struct fib_result *res);
155
156 unsigned char tb_data[0]; 147 unsigned char tb_data[0];
157}; 148};
158 149
150extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp,
151 struct fib_result *res);
152extern int fib_table_insert(struct fib_table *, struct fib_config *);
153extern int fib_table_delete(struct fib_table *, struct fib_config *);
154extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
155 struct netlink_callback *cb);
156extern int fib_table_flush(struct fib_table *table);
157extern void fib_table_select_default(struct fib_table *table,
158 const struct flowi *flp,
159 struct fib_result *res);
160
161
159#ifndef CONFIG_IP_MULTIPLE_TABLES 162#ifndef CONFIG_IP_MULTIPLE_TABLES
160 163
161#define TABLE_LOCAL_INDEX 0 164#define TABLE_LOCAL_INDEX 0
@@ -182,11 +185,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp,
182 struct fib_table *table; 185 struct fib_table *table;
183 186
184 table = fib_get_table(net, RT_TABLE_LOCAL); 187 table = fib_get_table(net, RT_TABLE_LOCAL);
185 if (!table->tb_lookup(table, flp, res)) 188 if (!fib_table_lookup(table, flp, res))
186 return 0; 189 return 0;
187 190
188 table = fib_get_table(net, RT_TABLE_MAIN); 191 table = fib_get_table(net, RT_TABLE_MAIN);
189 if (!table->tb_lookup(table, flp, res)) 192 if (!fib_table_lookup(table, flp, res))
190 return 0; 193 return 0;
191 return -ENETUNREACH; 194 return -ENETUNREACH;
192} 195}
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 98978e73f666..fe82b1e10a29 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -26,6 +26,11 @@
26#include <linux/ipv6.h> /* for struct ipv6hdr */ 26#include <linux/ipv6.h> /* for struct ipv6hdr */
27#include <net/ipv6.h> /* for ipv6_addr_copy */ 27#include <net/ipv6.h> /* for ipv6_addr_copy */
28 28
29
30/* Connections' size value needed by ip_vs_ctl.c */
31extern int ip_vs_conn_tab_size;
32
33
29struct ip_vs_iphdr { 34struct ip_vs_iphdr {
30 int len; 35 int len;
31 __u8 protocol; 36 __u8 protocol;
@@ -220,6 +225,26 @@ enum {
220}; 225};
221 226
222/* 227/*
228 * SCTP State Values
229 */
230enum ip_vs_sctp_states {
231 IP_VS_SCTP_S_NONE,
232 IP_VS_SCTP_S_INIT_CLI,
233 IP_VS_SCTP_S_INIT_SER,
234 IP_VS_SCTP_S_INIT_ACK_CLI,
235 IP_VS_SCTP_S_INIT_ACK_SER,
236 IP_VS_SCTP_S_ECHO_CLI,
237 IP_VS_SCTP_S_ECHO_SER,
238 IP_VS_SCTP_S_ESTABLISHED,
239 IP_VS_SCTP_S_SHUT_CLI,
240 IP_VS_SCTP_S_SHUT_SER,
241 IP_VS_SCTP_S_SHUT_ACK_CLI,
242 IP_VS_SCTP_S_SHUT_ACK_SER,
243 IP_VS_SCTP_S_CLOSED,
244 IP_VS_SCTP_S_LAST
245};
246
247/*
223 * Delta sequence info structure 248 * Delta sequence info structure
224 * Each ip_vs_conn has 2 (output AND input seq. changes). 249 * Each ip_vs_conn has 2 (output AND input seq. changes).
225 * Only used in the VS/NAT. 250 * Only used in the VS/NAT.
@@ -251,8 +276,7 @@ struct ip_vs_estimator {
251 u32 outbps; 276 u32 outbps;
252}; 277};
253 278
254struct ip_vs_stats 279struct ip_vs_stats {
255{
256 struct ip_vs_stats_user ustats; /* statistics */ 280 struct ip_vs_stats_user ustats; /* statistics */
257 struct ip_vs_estimator est; /* estimator */ 281 struct ip_vs_estimator est; /* estimator */
258 282
@@ -518,8 +542,7 @@ struct ip_vs_scheduler {
518/* 542/*
519 * The application module object (a.k.a. app incarnation) 543 * The application module object (a.k.a. app incarnation)
520 */ 544 */
521struct ip_vs_app 545struct ip_vs_app {
522{
523 struct list_head a_list; /* member in app list */ 546 struct list_head a_list; /* member in app list */
524 int type; /* IP_VS_APP_TYPE_xxx */ 547 int type; /* IP_VS_APP_TYPE_xxx */
525 char *name; /* application module name */ 548 char *name; /* application module name */
@@ -594,17 +617,6 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
594 * (from ip_vs_conn.c) 617 * (from ip_vs_conn.c)
595 */ 618 */
596 619
597/*
598 * IPVS connection entry hash table
599 */
600#ifndef CONFIG_IP_VS_TAB_BITS
601#define CONFIG_IP_VS_TAB_BITS 12
602#endif
603
604#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS
605#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
606#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
607
608enum { 620enum {
609 IP_VS_DIR_INPUT = 0, 621 IP_VS_DIR_INPUT = 0,
610 IP_VS_DIR_OUTPUT, 622 IP_VS_DIR_OUTPUT,
@@ -749,7 +761,7 @@ extern struct ip_vs_protocol ip_vs_protocol_udp;
749extern struct ip_vs_protocol ip_vs_protocol_icmp; 761extern struct ip_vs_protocol ip_vs_protocol_icmp;
750extern struct ip_vs_protocol ip_vs_protocol_esp; 762extern struct ip_vs_protocol ip_vs_protocol_esp;
751extern struct ip_vs_protocol ip_vs_protocol_ah; 763extern struct ip_vs_protocol ip_vs_protocol_ah;
752 764extern struct ip_vs_protocol ip_vs_protocol_sctp;
753 765
754/* 766/*
755 * Registering/unregistering scheduler functions 767 * Registering/unregistering scheduler functions
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h
index 2a1092abaa07..cc4f30cd7315 100644
--- a/include/net/ipcomp.h
+++ b/include/net/ipcomp.h
@@ -9,7 +9,7 @@ struct crypto_comp;
9 9
10struct ipcomp_data { 10struct ipcomp_data {
11 u16 threshold; 11 u16 threshold;
12 struct crypto_comp **tfms; 12 struct crypto_comp * __percpu *tfms;
13}; 13};
14 14
15struct ip_comp_hdr; 15struct ip_comp_hdr;
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 87acf8f3a155..11e8513d2d07 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -7,8 +7,15 @@
7/* Keep error state on tunnel for 30 sec */ 7/* Keep error state on tunnel for 30 sec */
8#define IPTUNNEL_ERR_TIMEO (30*HZ) 8#define IPTUNNEL_ERR_TIMEO (30*HZ)
9 9
10struct ip_tunnel 10/* 6rd prefix/relay information */
11{ 11struct ip_tunnel_6rd_parm {
12 struct in6_addr prefix;
13 __be32 relay_prefix;
14 u16 prefixlen;
15 u16 relay_prefixlen;
16};
17
18struct ip_tunnel {
12 struct ip_tunnel *next; 19 struct ip_tunnel *next;
13 struct net_device *dev; 20 struct net_device *dev;
14 21
@@ -23,15 +30,19 @@ struct ip_tunnel
23 30
24 struct ip_tunnel_parm parms; 31 struct ip_tunnel_parm parms;
25 32
33 /* for SIT */
34#ifdef CONFIG_IPV6_SIT_6RD
35 struct ip_tunnel_6rd_parm ip6rd;
36#endif
26 struct ip_tunnel_prl_entry *prl; /* potential router list */ 37 struct ip_tunnel_prl_entry *prl; /* potential router list */
27 unsigned int prl_count; /* # of entries in PRL */ 38 unsigned int prl_count; /* # of entries in PRL */
28}; 39};
29 40
30struct ip_tunnel_prl_entry 41struct ip_tunnel_prl_entry {
31{
32 struct ip_tunnel_prl_entry *next; 42 struct ip_tunnel_prl_entry *next;
33 __be32 addr; 43 __be32 addr;
34 u16 flags; 44 u16 flags;
45 struct rcu_head rcu_head;
35}; 46};
36 47
37#define IPTUNNEL_XMIT() do { \ 48#define IPTUNNEL_XMIT() do { \
@@ -42,9 +53,9 @@ struct ip_tunnel_prl_entry
42 ip_select_ident(iph, &rt->u.dst, NULL); \ 53 ip_select_ident(iph, &rt->u.dst, NULL); \
43 \ 54 \
44 err = ip_local_out(skb); \ 55 err = ip_local_out(skb); \
45 if (net_xmit_eval(err) == 0) { \ 56 if (likely(net_xmit_eval(err) == 0)) { \
46 stats->tx_bytes += pkt_len; \ 57 txq->tx_bytes += pkt_len; \
47 stats->tx_packets++; \ 58 txq->tx_packets++; \
48 } else { \ 59 } else { \
49 stats->tx_errors++; \ 60 stats->tx_errors++; \
50 stats->tx_aborted_errors++; \ 61 stats->tx_aborted_errors++; \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8c31d8a0c1fe..e72fb10ce573 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -73,7 +73,6 @@
73#define IPV6_ADDR_SCOPE_MASK 0x00f0U 73#define IPV6_ADDR_SCOPE_MASK 0x00f0U
74 74
75#define IPV6_ADDR_MAPPED 0x1000U 75#define IPV6_ADDR_MAPPED 0x1000U
76#define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */
77 76
78/* 77/*
79 * Addr scopes 78 * Addr scopes
@@ -160,8 +159,7 @@ extern struct ctl_path net_ipv6_ctl_path[];
160#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ 159#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \
161 _DEVINC(net, icmpv6msg, _BH, idev, field) 160 _DEVINC(net, icmpv6msg, _BH, idev, field)
162 161
163struct ip6_ra_chain 162struct ip6_ra_chain {
164{
165 struct ip6_ra_chain *next; 163 struct ip6_ra_chain *next;
166 struct sock *sk; 164 struct sock *sk;
167 int sel; 165 int sel;
@@ -176,8 +174,7 @@ extern rwlock_t ip6_ra_lock;
176 ancillary data and passed to IPv6. 174 ancillary data and passed to IPv6.
177 */ 175 */
178 176
179struct ipv6_txoptions 177struct ipv6_txoptions {
180{
181 /* Length of this structure */ 178 /* Length of this structure */
182 int tot_len; 179 int tot_len;
183 180
@@ -194,8 +191,7 @@ struct ipv6_txoptions
194 /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ 191 /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */
195}; 192};
196 193
197struct ip6_flowlabel 194struct ip6_flowlabel {
198{
199 struct ip6_flowlabel *next; 195 struct ip6_flowlabel *next;
200 __be32 label; 196 __be32 label;
201 atomic_t users; 197 atomic_t users;
@@ -212,8 +208,7 @@ struct ip6_flowlabel
212#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) 208#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)
213#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) 209#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
214 210
215struct ipv6_fl_socklist 211struct ipv6_fl_socklist {
216{
217 struct ipv6_fl_socklist *next; 212 struct ipv6_fl_socklist *next;
218 struct ip6_flowlabel *fl; 213 struct ip6_flowlabel *fl;
219}; 214};
@@ -250,7 +245,9 @@ extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
250int ip6_frag_nqueues(struct net *net); 245int ip6_frag_nqueues(struct net *net);
251int ip6_frag_mem(struct net *net); 246int ip6_frag_mem(struct net *net);
252 247
253#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ 248#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */
249#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */
250#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
254 251
255extern int __ipv6_addr_type(const struct in6_addr *addr); 252extern int __ipv6_addr_type(const struct in6_addr *addr);
256static inline int ipv6_addr_type(const struct in6_addr *addr) 253static inline int ipv6_addr_type(const struct in6_addr *addr)
@@ -354,8 +351,19 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1,
354 351
355struct inet_frag_queue; 352struct inet_frag_queue;
356 353
354enum ip6_defrag_users {
355 IP6_DEFRAG_LOCAL_DELIVER,
356 IP6_DEFRAG_CONNTRACK_IN,
357 __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHORT_MAX,
358 IP6_DEFRAG_CONNTRACK_OUT,
359 __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHORT_MAX,
360 IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
361 __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX,
362};
363
357struct ip6_create_arg { 364struct ip6_create_arg {
358 __be32 id; 365 __be32 id;
366 u32 user;
359 struct in6_addr *src; 367 struct in6_addr *src;
360 struct in6_addr *dst; 368 struct in6_addr *dst;
361}; 369};
diff --git a/include/net/ipx.h b/include/net/ipx.h
index a14121dd1932..ef51a668ba19 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -13,6 +13,7 @@
13#include <net/datalink.h> 13#include <net/datalink.h>
14#include <linux/ipx.h> 14#include <linux/ipx.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/slab.h>
16 17
17struct ipx_address { 18struct ipx_address {
18 __be32 net; 19 __be32 net;
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h
index 0788c23d2828..11aee7a2972a 100644
--- a/include/net/irda/irttp.h
+++ b/include/net/irda/irttp.h
@@ -97,7 +97,7 @@
97#define TTP_MAX_SDU_SIZE 0x01 97#define TTP_MAX_SDU_SIZE 0x01
98 98
99/* 99/*
100 * This structure contains all data assosiated with one instance of a TTP 100 * This structure contains all data associated with one instance of a TTP
101 * connection. 101 * connection.
102 */ 102 */
103struct tsap_cb { 103struct tsap_cb {
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index 5e310c8d8e2f..205a3360156e 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/slab.h>
31#include <asm/debug.h> 32#include <asm/debug.h>
32 33
33/* 34/*
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index e9054a283fde..b2b98f3fa265 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -300,8 +300,7 @@
300 * This struct is also my long term insurance. I can add new fields here 300 * This struct is also my long term insurance. I can add new fields here
301 * without breaking the prototype of iw_handler... 301 * without breaking the prototype of iw_handler...
302 */ 302 */
303struct iw_request_info 303struct iw_request_info {
304{
305 __u16 cmd; /* Wireless Extension command */ 304 __u16 cmd; /* Wireless Extension command */
306 __u16 flags; /* More to come ;-) */ 305 __u16 flags; /* More to come ;-) */
307}; 306};
@@ -321,20 +320,20 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
321 * shared by all driver instances... Same for the members... 320 * shared by all driver instances... Same for the members...
322 * This will be linked from net_device in <linux/netdevice.h> 321 * This will be linked from net_device in <linux/netdevice.h>
323 */ 322 */
324struct iw_handler_def 323struct iw_handler_def {
325{
326 /* Number of handlers defined (more precisely, index of the
327 * last defined handler + 1) */
328 __u16 num_standard;
329 __u16 num_private;
330 /* Number of private arg description */
331 __u16 num_private_args;
332 324
333 /* Array of handlers for standard ioctls 325 /* Array of handlers for standard ioctls
334 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] 326 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT]
335 */ 327 */
336 const iw_handler * standard; 328 const iw_handler * standard;
329 /* Number of handlers defined (more precisely, index of the
330 * last defined handler + 1) */
331 __u16 num_standard;
337 332
333#ifdef CONFIG_WEXT_PRIV
334 __u16 num_private;
335 /* Number of private arg description */
336 __u16 num_private_args;
338 /* Array of handlers for private ioctls 337 /* Array of handlers for private ioctls
339 * Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV] 338 * Will call dev->wireless_handlers->private[ioctl - SIOCIWFIRSTPRIV]
340 */ 339 */
@@ -344,6 +343,7 @@ struct iw_handler_def
344 * can put it in any order you want and should not leave holes... 343 * can put it in any order you want and should not leave holes...
345 * We will automatically export that to user space... */ 344 * We will automatically export that to user space... */
346 const struct iw_priv_args * private_args; 345 const struct iw_priv_args * private_args;
346#endif
347 347
348 /* New location of get_wireless_stats, to de-bloat struct net_device. 348 /* New location of get_wireless_stats, to de-bloat struct net_device.
349 * The old pointer in struct net_device will be gradually phased 349 * The old pointer in struct net_device will be gradually phased
@@ -370,8 +370,7 @@ struct iw_handler_def
370/* 370/*
371 * Describe how a standard IOCTL looks like. 371 * Describe how a standard IOCTL looks like.
372 */ 372 */
373struct iw_ioctl_description 373struct iw_ioctl_description {
374{
375 __u8 header_type; /* NULL, iw_point or other */ 374 __u8 header_type; /* NULL, iw_point or other */
376 __u8 token_type; /* Future */ 375 __u8 token_type; /* Future */
377 __u16 token_size; /* Granularity of payload */ 376 __u16 token_size; /* Granularity of payload */
@@ -393,8 +392,7 @@ struct iw_ioctl_description
393/* 392/*
394 * Instance specific spy data, i.e. addresses spied and quality for them. 393 * Instance specific spy data, i.e. addresses spied and quality for them.
395 */ 394 */
396struct iw_spy_data 395struct iw_spy_data {
397{
398 /* --- Standard spy support --- */ 396 /* --- Standard spy support --- */
399 int spy_number; 397 int spy_number;
400 u_char spy_address[IW_MAX_SPY][ETH_ALEN]; 398 u_char spy_address[IW_MAX_SPY][ETH_ALEN];
diff --git a/include/net/llc.h b/include/net/llc.h
index 7940da1606e7..5503b74ab170 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -16,6 +16,9 @@
16#include <linux/if_ether.h> 16#include <linux/if_ether.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/rculist_nulls.h>
20#include <linux/hash.h>
21#include <linux/jhash.h>
19 22
20#include <asm/atomic.h> 23#include <asm/atomic.h>
21 24
@@ -31,6 +34,12 @@ struct llc_addr {
31#define LLC_SAP_STATE_INACTIVE 1 34#define LLC_SAP_STATE_INACTIVE 1
32#define LLC_SAP_STATE_ACTIVE 2 35#define LLC_SAP_STATE_ACTIVE 2
33 36
37#define LLC_SK_DEV_HASH_BITS 6
38#define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS)
39
40#define LLC_SK_LADDR_HASH_BITS 6
41#define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS)
42
34/** 43/**
35 * struct llc_sap - Defines the SAP component 44 * struct llc_sap - Defines the SAP component
36 * 45 *
@@ -53,18 +62,38 @@ struct llc_sap {
53 struct net_device *orig_dev); 62 struct net_device *orig_dev);
54 struct llc_addr laddr; 63 struct llc_addr laddr;
55 struct list_head node; 64 struct list_head node;
56 struct { 65 spinlock_t sk_lock;
57 rwlock_t lock; 66 int sk_count;
58 struct hlist_head list; 67 struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES];
59 } sk_list; 68 struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
60}; 69};
61 70
71static inline
72struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
73{
74 return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
75}
76
77static inline
78u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr)
79{
80 return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0),
81 LLC_SK_LADDR_HASH_BITS);
82}
83
84static inline
85struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap,
86 const struct llc_addr *laddr)
87{
88 return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)];
89}
90
62#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ 91#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
63#define LLC_DEST_SAP 1 /* Type 1 goes here */ 92#define LLC_DEST_SAP 1 /* Type 1 goes here */
64#define LLC_DEST_CONN 2 /* Type 2 goes here */ 93#define LLC_DEST_CONN 2 /* Type 2 goes here */
65 94
66extern struct list_head llc_sap_list; 95extern struct list_head llc_sap_list;
67extern rwlock_t llc_sap_list_lock; 96extern spinlock_t llc_sap_list_lock;
68 97
69extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 98extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
70 struct packet_type *pt, struct net_device *orig_dev); 99 struct packet_type *pt, struct net_device *orig_dev);
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index e2374e34989f..2f97d8ddce92 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -76,6 +76,8 @@ struct llc_sock {
76 u32 rx_pdu_hdr; /* used for saving header of last pdu 76 u32 rx_pdu_hdr; /* used for saving header of last pdu
77 received and caused sending FRMR. 77 received and caused sending FRMR.
78 Used for resending FRMR */ 78 Used for resending FRMR */
79 u32 cmsg_flags;
80 struct hlist_node dev_hash_node;
79}; 81};
80 82
81static inline struct llc_sock *llc_sk(const struct sock *sk) 83static inline struct llc_sock *llc_sk(const struct sock *sk)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 998c30fc8981..45d7d44d7cbe 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-2008 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2010 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,25 +107,14 @@ enum ieee80211_max_queues {
107 * 2^n-1 in the range 1..32767] 107 * 2^n-1 in the range 1..32767]
108 * @cw_max: maximum contention window [like @cw_min] 108 * @cw_max: maximum contention window [like @cw_min]
109 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled 109 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
110 * @uapsd: is U-APSD mode enabled for the queue
110 */ 111 */
111struct ieee80211_tx_queue_params { 112struct ieee80211_tx_queue_params {
112 u16 txop; 113 u16 txop;
113 u16 cw_min; 114 u16 cw_min;
114 u16 cw_max; 115 u16 cw_max;
115 u8 aifs; 116 u8 aifs;
116}; 117 bool uapsd;
117
118/**
119 * struct ieee80211_tx_queue_stats - transmit queue statistics
120 *
121 * @len: number of packets in queue
122 * @limit: queue length limit
123 * @count: number of frames sent
124 */
125struct ieee80211_tx_queue_stats {
126 unsigned int len;
127 unsigned int limit;
128 unsigned int count;
129}; 118};
130 119
131struct ieee80211_low_level_stats { 120struct ieee80211_low_level_stats {
@@ -184,7 +173,8 @@ enum ieee80211_bss_change {
184 * @use_short_slot: use short slot time (only relevant for ERP); 173 * @use_short_slot: use short slot time (only relevant for ERP);
185 * if the hardware cannot handle this it must set the 174 * if the hardware cannot handle this it must set the
186 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 175 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
187 * @dtim_period: num of beacons before the next DTIM, for PSM 176 * @dtim_period: num of beacons before the next DTIM, for beaconing,
177 * not valid in station mode (cf. hw conf ps_dtim_period)
188 * @timestamp: beacon timestamp 178 * @timestamp: beacon timestamp
189 * @beacon_int: beacon interval 179 * @beacon_int: beacon interval
190 * @assoc_capability: capabilities taken from assoc resp 180 * @assoc_capability: capabilities taken from assoc resp
@@ -219,7 +209,7 @@ struct ieee80211_bss_conf {
219 * 209 *
220 * These flags are used with the @flags member of &ieee80211_tx_info. 210 * These flags are used with the @flags member of &ieee80211_tx_info.
221 * 211 *
222 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. 212 * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
223 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence 213 * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
224 * number to this frame, taking care of not overwriting the fragment 214 * number to this frame, taking care of not overwriting the fragment
225 * number and increasing the sequence number only when the 215 * number and increasing the sequence number only when the
@@ -255,9 +245,6 @@ struct ieee80211_bss_conf {
255 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
256 * set by rate control algorithms to indicate probe rate, will 246 * set by rate control algorithms to indicate probe rate, will
257 * be cleared for fragmented frames (except on the last fragment) 247 * be cleared for fragmented frames (except on the last fragment)
258 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
259 * set this flag in the driver; indicates that the rate control
260 * algorithm was used and should be notified of TX status
261 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, 248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
262 * used to indicate that a pending frame requires TX processing before 249 * used to indicate that a pending frame requires TX processing before
263 * it can be sent out. 250 * it can be sent out.
@@ -272,6 +259,14 @@ struct ieee80211_bss_conf {
272 * transmit function after the current frame, this can be used 259 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the 260 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full. 261 * queue gets full.
262 * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
263 * after TX status because the destination was asleep, it must not
264 * be modified again (no seqno assignment, crypto, etc.)
265 * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still
266 * has a radiotap header at skb->data.
267 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
268 * MLME command (internal to mac80211 to figure out whether to send TX
269 * status to user space)
275 */ 270 */
276enum mac80211_tx_control_flags { 271enum mac80211_tx_control_flags {
277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 272 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -287,12 +282,14 @@ enum mac80211_tx_control_flags {
287 IEEE80211_TX_STAT_AMPDU = BIT(10), 282 IEEE80211_TX_STAT_AMPDU = BIT(10),
288 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 283 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
289 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 284 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 285 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
292 IEEE80211_TX_INTFL_RETRIED = BIT(15), 286 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 287 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), 288 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 289 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
290 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
291 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20),
292 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
296}; 293};
297 294
298/** 295/**
@@ -390,10 +387,12 @@ struct ieee80211_tx_rate {
390 * @control: union for control data 387 * @control: union for control data
391 * @status: union for status data 388 * @status: union for status data
392 * @driver_data: array of driver_data pointers 389 * @driver_data: array of driver_data pointers
393 * @ampdu_ack_len: number of aggregated frames. 390 * @ampdu_ack_len: number of acked aggregated frames.
394 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 391 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
395 * @ampdu_ack_map: block ack bit map for the aggregation. 392 * @ampdu_ack_map: block ack bit map for the aggregation.
396 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 393 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
394 * @ampdu_len: number of aggregated frames.
395 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
397 * @ack_signal: signal strength of the ACK frame 396 * @ack_signal: signal strength of the ACK frame
398 */ 397 */
399struct ieee80211_tx_info { 398struct ieee80211_tx_info {
@@ -428,7 +427,8 @@ struct ieee80211_tx_info {
428 u8 ampdu_ack_len; 427 u8 ampdu_ack_len;
429 u64 ampdu_ack_map; 428 u64 ampdu_ack_map;
430 int ack_signal; 429 int ack_signal;
431 /* 8 bytes free */ 430 u8 ampdu_len;
431 /* 7 bytes free */
432 } status; 432 } status;
433 struct { 433 struct {
434 struct ieee80211_tx_rate driver_rates[ 434 struct ieee80211_tx_rate driver_rates[
@@ -494,7 +494,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
494 * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. 494 * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
495 * Use together with %RX_FLAG_MMIC_STRIPPED. 495 * Use together with %RX_FLAG_MMIC_STRIPPED.
496 * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. 496 * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
497 * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header.
498 * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, 497 * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
499 * verification has been done by the hardware. 498 * verification has been done by the hardware.
500 * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. 499 * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame.
@@ -511,11 +510,13 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
511 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 510 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
512 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 511 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
513 * @RX_FLAG_SHORT_GI: Short guard interval was used 512 * @RX_FLAG_SHORT_GI: Short guard interval was used
513 * @RX_FLAG_INTERNAL_CMTR: set internally after frame was reported
514 * on cooked monitor to avoid double-reporting it for multiple
515 * virtual interfaces
514 */ 516 */
515enum mac80211_rx_flags { 517enum mac80211_rx_flags {
516 RX_FLAG_MMIC_ERROR = 1<<0, 518 RX_FLAG_MMIC_ERROR = 1<<0,
517 RX_FLAG_DECRYPTED = 1<<1, 519 RX_FLAG_DECRYPTED = 1<<1,
518 RX_FLAG_RADIOTAP = 1<<2,
519 RX_FLAG_MMIC_STRIPPED = 1<<3, 520 RX_FLAG_MMIC_STRIPPED = 1<<3,
520 RX_FLAG_IV_STRIPPED = 1<<4, 521 RX_FLAG_IV_STRIPPED = 1<<4,
521 RX_FLAG_FAILED_FCS_CRC = 1<<5, 522 RX_FLAG_FAILED_FCS_CRC = 1<<5,
@@ -525,6 +526,7 @@ enum mac80211_rx_flags {
525 RX_FLAG_HT = 1<<9, 526 RX_FLAG_HT = 1<<9,
526 RX_FLAG_40MHZ = 1<<10, 527 RX_FLAG_40MHZ = 1<<10,
527 RX_FLAG_SHORT_GI = 1<<11, 528 RX_FLAG_SHORT_GI = 1<<11,
529 RX_FLAG_INTERNAL_CMTR = 1<<12,
528}; 530};
529 531
530/** 532/**
@@ -542,7 +544,6 @@ enum mac80211_rx_flags {
542 * unspecified depending on the hardware capabilities flags 544 * unspecified depending on the hardware capabilities flags
543 * @IEEE80211_HW_SIGNAL_* 545 * @IEEE80211_HW_SIGNAL_*
544 * @noise: noise when receiving this frame, in dBm. 546 * @noise: noise when receiving this frame, in dBm.
545 * @qual: overall signal quality indication, in percent (0-100).
546 * @antenna: antenna used 547 * @antenna: antenna used
547 * @rate_idx: index of data rate into band's supported rates or MCS index if 548 * @rate_idx: index of data rate into band's supported rates or MCS index if
548 * HT rates are use (RX_FLAG_HT) 549 * HT rates are use (RX_FLAG_HT)
@@ -554,7 +555,6 @@ struct ieee80211_rx_status {
554 int freq; 555 int freq;
555 int signal; 556 int signal;
556 int noise; 557 int noise;
557 int qual;
558 int antenna; 558 int antenna;
559 int rate_idx; 559 int rate_idx;
560 int flag; 560 int flag;
@@ -565,8 +565,16 @@ struct ieee80211_rx_status {
565 * 565 *
566 * Flags to define PHY configuration options 566 * Flags to define PHY configuration options
567 * 567 *
568 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 568 * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
569 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) 569 * to determine for example whether to calculate timestamps for packets
570 * or not, do not use instead of filter flags!
571 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only).
572 * This is the power save mode defined by IEEE 802.11-2007 section 11.2,
573 * meaning that the hardware still wakes up for beacons, is able to
574 * transmit frames and receive the possible acknowledgment frames.
575 * Not to be confused with hardware specific wakeup/sleep states,
576 * driver is responsible for that. See the section "Powersave support"
577 * for more.
570 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set 578 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
571 * the driver should be prepared to handle configuration requests but 579 * the driver should be prepared to handle configuration requests but
572 * may turn the device off as much as possible. Typically, this flag will 580 * may turn the device off as much as possible. Typically, this flag will
@@ -574,7 +582,7 @@ struct ieee80211_rx_status {
574 * it can also be unset in that case when monitor interfaces are active. 582 * it can also be unset in that case when monitor interfaces are active.
575 */ 583 */
576enum ieee80211_conf_flags { 584enum ieee80211_conf_flags {
577 IEEE80211_CONF_RADIOTAP = (1<<0), 585 IEEE80211_CONF_MONITOR = (1<<0),
578 IEEE80211_CONF_PS = (1<<1), 586 IEEE80211_CONF_PS = (1<<1),
579 IEEE80211_CONF_IDLE = (1<<2), 587 IEEE80211_CONF_IDLE = (1<<2),
580}; 588};
@@ -584,16 +592,18 @@ enum ieee80211_conf_flags {
584 * enum ieee80211_conf_changed - denotes which configuration changed 592 * enum ieee80211_conf_changed - denotes which configuration changed
585 * 593 *
586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 594 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
587 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 595 * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed
588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 596 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
589 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 597 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
590 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 598 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
591 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 599 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
592 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 600 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
601 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
593 */ 602 */
594enum ieee80211_conf_changed { 603enum ieee80211_conf_changed {
604 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 605 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
596 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 606 IEEE80211_CONF_CHANGE_MONITOR = BIT(3),
597 IEEE80211_CONF_CHANGE_PS = BIT(4), 607 IEEE80211_CONF_CHANGE_PS = BIT(4),
598 IEEE80211_CONF_CHANGE_POWER = BIT(5), 608 IEEE80211_CONF_CHANGE_POWER = BIT(5),
599 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 609 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
@@ -602,6 +612,25 @@ enum ieee80211_conf_changed {
602}; 612};
603 613
604/** 614/**
615 * enum ieee80211_smps_mode - spatial multiplexing power save mode
616 *
617 * @IEEE80211_SMPS_AUTOMATIC: automatic
618 * @IEEE80211_SMPS_OFF: off
619 * @IEEE80211_SMPS_STATIC: static
620 * @IEEE80211_SMPS_DYNAMIC: dynamic
621 * @IEEE80211_SMPS_NUM_MODES: internal, don't use
622 */
623enum ieee80211_smps_mode {
624 IEEE80211_SMPS_AUTOMATIC,
625 IEEE80211_SMPS_OFF,
626 IEEE80211_SMPS_STATIC,
627 IEEE80211_SMPS_DYNAMIC,
628
629 /* keep last */
630 IEEE80211_SMPS_NUM_MODES,
631};
632
633/**
605 * struct ieee80211_conf - configuration of the device 634 * struct ieee80211_conf - configuration of the device
606 * 635 *
607 * This struct indicates how the driver shall configure the hardware. 636 * This struct indicates how the driver shall configure the hardware.
@@ -614,6 +643,9 @@ enum ieee80211_conf_changed {
614 * value will be only achievable between DTIM frames, the hardware 643 * value will be only achievable between DTIM frames, the hardware
615 * needs to check for the multicast traffic bit in DTIM beacons. 644 * needs to check for the multicast traffic bit in DTIM beacons.
616 * This variable is valid only when the CONF_PS flag is set. 645 * This variable is valid only when the CONF_PS flag is set.
646 * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
647 * in power saving. Power saving will not be enabled until a beacon
648 * has been received and the DTIM period is known.
617 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 649 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
618 * powersave documentation below. This variable is valid only when 650 * powersave documentation below. This variable is valid only when
619 * the CONF_PS flag is set. 651 * the CONF_PS flag is set.
@@ -629,6 +661,10 @@ enum ieee80211_conf_changed {
629 * @short_frame_max_tx_count: Maximum number of transmissions for a "short" 661 * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
630 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the 662 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
631 * number of transmissions not the number of retries 663 * number of transmissions not the number of retries
664 *
665 * @smps_mode: spatial multiplexing powersave mode; note that
666 * %IEEE80211_SMPS_STATIC is used when the device is not
667 * configured for an HT channel
632 */ 668 */
633struct ieee80211_conf { 669struct ieee80211_conf {
634 u32 flags; 670 u32 flags;
@@ -636,11 +672,13 @@ struct ieee80211_conf {
636 int max_sleep_period; 672 int max_sleep_period;
637 673
638 u16 listen_interval; 674 u16 listen_interval;
675 u8 ps_dtim_period;
639 676
640 u8 long_frame_max_tx_count, short_frame_max_tx_count; 677 u8 long_frame_max_tx_count, short_frame_max_tx_count;
641 678
642 struct ieee80211_channel *channel; 679 struct ieee80211_channel *channel;
643 enum nl80211_channel_type channel_type; 680 enum nl80211_channel_type channel_type;
681 enum ieee80211_smps_mode smps_mode;
644}; 682};
645 683
646/** 684/**
@@ -652,12 +690,14 @@ struct ieee80211_conf {
652 * @type: type of this virtual interface 690 * @type: type of this virtual interface
653 * @bss_conf: BSS configuration for this interface, either our own 691 * @bss_conf: BSS configuration for this interface, either our own
654 * or the BSS we're associated to 692 * or the BSS we're associated to
693 * @addr: address of this interface
655 * @drv_priv: data area for driver use, will always be aligned to 694 * @drv_priv: data area for driver use, will always be aligned to
656 * sizeof(void *). 695 * sizeof(void *).
657 */ 696 */
658struct ieee80211_vif { 697struct ieee80211_vif {
659 enum nl80211_iftype type; 698 enum nl80211_iftype type;
660 struct ieee80211_bss_conf bss_conf; 699 struct ieee80211_bss_conf bss_conf;
700 u8 addr[ETH_ALEN];
661 /* must be last */ 701 /* must be last */
662 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 702 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
663}; 703};
@@ -671,33 +711,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
671} 711}
672 712
673/** 713/**
674 * struct ieee80211_if_init_conf - initial configuration of an interface
675 *
676 * @vif: pointer to a driver-use per-interface structure. The pointer
677 * itself is also used for various functions including
678 * ieee80211_beacon_get() and ieee80211_get_buffered_bc().
679 * @type: one of &enum nl80211_iftype constants. Determines the type of
680 * added/removed interface.
681 * @mac_addr: pointer to MAC address of the interface. This pointer is valid
682 * until the interface is removed (i.e. it cannot be used after
683 * remove_interface() callback was called for this interface).
684 *
685 * This structure is used in add_interface() and remove_interface()
686 * callbacks of &struct ieee80211_hw.
687 *
688 * When you allow multiple interfaces to be added to your PHY, take care
689 * that the hardware can actually handle multiple MAC addresses. However,
690 * also take care that when there's no interface left with mac_addr != %NULL
691 * you remove the MAC address from the device to avoid acknowledging packets
692 * in pure monitor mode.
693 */
694struct ieee80211_if_init_conf {
695 enum nl80211_iftype type;
696 struct ieee80211_vif *vif;
697 void *mac_addr;
698};
699
700/**
701 * enum ieee80211_key_alg - key algorithm 714 * enum ieee80211_key_alg - key algorithm
702 * @ALG_WEP: WEP40 or WEP104 715 * @ALG_WEP: WEP40 or WEP104
703 * @ALG_TKIP: TKIP 716 * @ALG_TKIP: TKIP
@@ -792,7 +805,7 @@ enum set_key_cmd {
792 * mac80211, any ieee80211_sta pointer you get access to must 805 * mac80211, any ieee80211_sta pointer you get access to must
793 * either be protected by rcu_read_lock() explicitly or implicitly, 806 * either be protected by rcu_read_lock() explicitly or implicitly,
794 * or you must take good care to not use such a pointer after a 807 * or you must take good care to not use such a pointer after a
795 * call to your sta_notify callback that removed it. 808 * call to your sta_remove callback that removed it.
796 * 809 *
797 * @addr: MAC address 810 * @addr: MAC address
798 * @aid: AID we assigned to the station if we're an AP 811 * @aid: AID we assigned to the station if we're an AP
@@ -818,8 +831,8 @@ struct ieee80211_sta {
818 * indicates addition and removal of a station to station table, 831 * indicates addition and removal of a station to station table,
819 * or if a associated station made a power state transition. 832 * or if a associated station made a power state transition.
820 * 833 *
821 * @STA_NOTIFY_ADD: a station was added to the station table 834 * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table
822 * @STA_NOTIFY_REMOVE: a station being removed from the station table 835 * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table
823 * @STA_NOTIFY_SLEEP: a station is now sleeping 836 * @STA_NOTIFY_SLEEP: a station is now sleeping
824 * @STA_NOTIFY_AWAKE: a sleeping station woke up 837 * @STA_NOTIFY_AWAKE: a sleeping station woke up
825 */ 838 */
@@ -852,6 +865,19 @@ enum ieee80211_tkip_key_type {
852 * any particular flags. There are some exceptions to this rule, 865 * any particular flags. There are some exceptions to this rule,
853 * however, so you are advised to review these flags carefully. 866 * however, so you are advised to review these flags carefully.
854 * 867 *
868 * @IEEE80211_HW_HAS_RATE_CONTROL:
869 * The hardware or firmware includes rate control, and cannot be
870 * controlled by the stack. As such, no rate control algorithm
871 * should be instantiated, and the TX rate reported to userspace
872 * will be taken from the TX status instead of the rate control
873 * algorithm.
874 * Note that this requires that the driver implement a number of
875 * callbacks so it has the correct information, it needs to have
876 * the @set_rts_threshold callback and must look at the BSS config
877 * @use_cts_prot for G/N protection, @use_short_slot for slot
878 * timing in 2.4 GHz and @use_short_preamble for preambles for
879 * CCK frames.
880 *
855 * @IEEE80211_HW_RX_INCLUDES_FCS: 881 * @IEEE80211_HW_RX_INCLUDES_FCS:
856 * Indicates that received frames passed to the stack include 882 * Indicates that received frames passed to the stack include
857 * the FCS at the end. 883 * the FCS at the end.
@@ -908,8 +934,29 @@ enum ieee80211_tkip_key_type {
908 * @IEEE80211_HW_BEACON_FILTER: 934 * @IEEE80211_HW_BEACON_FILTER:
909 * Hardware supports dropping of irrelevant beacon frames to 935 * Hardware supports dropping of irrelevant beacon frames to
910 * avoid waking up cpu. 936 * avoid waking up cpu.
937 *
938 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
939 * Hardware supports static spatial multiplexing powersave,
940 * ie. can turn off all but one chain even on HT connections
941 * that should be using more chains.
942 *
943 * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS:
944 * Hardware supports dynamic spatial multiplexing powersave,
945 * ie. can turn off all but one chain and then wake the rest
946 * up as required after, for example, rts/cts handshake.
947 *
948 * @IEEE80211_HW_SUPPORTS_UAPSD:
949 * Hardware supports Unscheduled Automatic Power Save Delivery
950 * (U-APSD) in managed mode. The mode is configured with
951 * conf_tx() operation.
952 *
953 * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
954 * Hardware can provide ack status reports of Tx frames to
955 * the stack.
956 *
911 */ 957 */
912enum ieee80211_hw_flags { 958enum ieee80211_hw_flags {
959 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
913 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 960 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
914 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, 961 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
915 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 962 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
@@ -924,6 +971,10 @@ enum ieee80211_hw_flags {
924 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 971 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
925 IEEE80211_HW_MFP_CAPABLE = 1<<13, 972 IEEE80211_HW_MFP_CAPABLE = 1<<13,
926 IEEE80211_HW_BEACON_FILTER = 1<<14, 973 IEEE80211_HW_BEACON_FILTER = 1<<14,
974 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
975 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
976 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
977 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
927}; 978};
928 979
929/** 980/**
@@ -1102,18 +1153,24 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1102 * 1153 *
1103 * mac80211 has support for various powersave implementations. 1154 * mac80211 has support for various powersave implementations.
1104 * 1155 *
1105 * First, it can support hardware that handles all powersaving by 1156 * First, it can support hardware that handles all powersaving by itself,
1106 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS 1157 * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware
1107 * hardware flag. In that case, it will be told about the desired 1158 * flag. In that case, it will be told about the desired powersave mode
1108 * powersave mode depending on the association status, and the driver 1159 * with the %IEEE80211_CONF_PS flag depending on the association status.
1109 * must take care of sending nullfunc frames when necessary, i.e. when 1160 * The hardware must take care of sending nullfunc frames when necessary,
1110 * entering and leaving powersave mode. The driver is required to look at 1161 * i.e. when entering and leaving powersave mode. The hardware is required
1111 * the AID in beacons and signal to the AP that it woke up when it finds 1162 * to look at the AID in beacons and signal to the AP that it woke up when
1112 * traffic directed to it. This mode supports dynamic PS by simply 1163 * it finds traffic directed to it.
1113 * enabling/disabling PS. 1164 *
1114 * 1165 * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
1115 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS 1166 * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
1116 * flag to indicate that it can support dynamic PS mode itself (see below). 1167 * with hardware wakeup and sleep states. Driver is responsible for waking
1168 * up the hardware before issueing commands to the hardware and putting it
1169 * back to sleep at approriate times.
1170 *
1171 * When PS is enabled, hardware needs to wakeup for beacons and receive the
1172 * buffered multicast/broadcast frames after the beacon. Also it must be
1173 * possible to send frames and receive the acknowledment frame.
1117 * 1174 *
1118 * Other hardware designs cannot send nullfunc frames by themselves and also 1175 * Other hardware designs cannot send nullfunc frames by themselves and also
1119 * need software support for parsing the TIM bitmap. This is also supported 1176 * need software support for parsing the TIM bitmap. This is also supported
@@ -1121,14 +1178,35 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1121 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 1178 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1122 * required to pass up beacons. The hardware is still required to handle 1179 * required to pass up beacons. The hardware is still required to handle
1123 * waking up for multicast traffic; if it cannot the driver must handle that 1180 * waking up for multicast traffic; if it cannot the driver must handle that
1124 * as best as it can, mac80211 is too slow. 1181 * as best as it can, mac80211 is too slow to do that.
1125 * 1182 *
1126 * Dynamic powersave mode is an extension to normal powersave mode in which 1183 * Dynamic powersave is an extension to normal powersave in which the
1127 * the hardware stays awake for a user-specified period of time after sending 1184 * hardware stays awake for a user-specified period of time after sending a
1128 * a frame so that reply frames need not be buffered and therefore delayed 1185 * frame so that reply frames need not be buffered and therefore delayed to
1129 * to the next wakeup. This can either be supported by hardware, in which case 1186 * the next wakeup. It's compromise of getting good enough latency when
1130 * the driver needs to look at the @dynamic_ps_timeout hardware configuration 1187 * there's data traffic and still saving significantly power in idle
1131 * value, or by the stack if all nullfunc handling is in the stack. 1188 * periods.
1189 *
1190 * Dynamic powersave is supported by simply mac80211 enabling and disabling
1191 * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
1192 * flag and mac80211 will handle everything automatically. Additionally,
1193 * hardware having support for the dynamic PS feature may set the
1194 * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support
1195 * dynamic PS mode itself. The driver needs to look at the
1196 * @dynamic_ps_timeout hardware configuration value and use it that value
1197 * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable
1198 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
1199 * enabled whenever user has enabled powersave.
1200 *
1201 * Driver informs U-APSD client support by enabling
1202 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1203 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS
1204 * Nullfunc frames and stay awake until the service period has ended. To
1205 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
1206 * from that AC are transmitted with powersave enabled.
1207 *
1208 * Note: U-APSD client mode is not yet supported with
1209 * %IEEE80211_HW_PS_NULLFUNC_STACK.
1132 */ 1210 */
1133 1211
1134/** 1212/**
@@ -1192,6 +1270,31 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1192 */ 1270 */
1193 1271
1194/** 1272/**
1273 * DOC: Spatial multiplexing power save
1274 *
1275 * SMPS (Spatial multiplexing power save) is a mechanism to conserve
1276 * power in an 802.11n implementation. For details on the mechanism
1277 * and rationale, please refer to 802.11 (as amended by 802.11n-2009)
1278 * "11.2.3 SM power save".
1279 *
1280 * The mac80211 implementation is capable of sending action frames
1281 * to update the AP about the station's SMPS mode, and will instruct
1282 * the driver to enter the specific mode. It will also announce the
1283 * requested SMPS mode during the association handshake. Hardware
1284 * support for this feature is required, and can be indicated by
1285 * hardware flags.
1286 *
1287 * The default mode will be "automatic", which nl80211/cfg80211
1288 * defines to be dynamic SMPS in (regular) powersave, and SMPS
1289 * turned off otherwise.
1290 *
1291 * To support this feature, the driver must set the appropriate
1292 * hardware support flags, and handle the SMPS flag to the config()
1293 * operation. It will then with this mechanism be instructed to
1294 * enter the requested SMPS mode while associated to an HT AP.
1295 */
1296
1297/**
1195 * DOC: Frame filtering 1298 * DOC: Frame filtering
1196 * 1299 *
1197 * mac80211 requires to see many management frames for proper 1300 * mac80211 requires to see many management frames for proper
@@ -1328,7 +1431,7 @@ enum ieee80211_ampdu_mlme_action {
1328 * When the device is started it should not have a MAC address 1431 * When the device is started it should not have a MAC address
1329 * to avoid acknowledging frames before a non-monitor device 1432 * to avoid acknowledging frames before a non-monitor device
1330 * is added. 1433 * is added.
1331 * Must be implemented. 1434 * Must be implemented and can sleep.
1332 * 1435 *
1333 * @stop: Called after last netdevice attached to the hardware 1436 * @stop: Called after last netdevice attached to the hardware
1334 * is disabled. This should turn off the hardware (at least 1437 * is disabled. This should turn off the hardware (at least
@@ -1336,7 +1439,7 @@ enum ieee80211_ampdu_mlme_action {
1336 * May be called right after add_interface if that rejects 1439 * May be called right after add_interface if that rejects
1337 * an interface. If you added any work onto the mac80211 workqueue 1440 * an interface. If you added any work onto the mac80211 workqueue
1338 * you should ensure to cancel it on this callback. 1441 * you should ensure to cancel it on this callback.
1339 * Must be implemented. 1442 * Must be implemented and can sleep.
1340 * 1443 *
1341 * @add_interface: Called when a netdevice attached to the hardware is 1444 * @add_interface: Called when a netdevice attached to the hardware is
1342 * enabled. Because it is not called for monitor mode devices, @start 1445 * enabled. Because it is not called for monitor mode devices, @start
@@ -1346,7 +1449,7 @@ enum ieee80211_ampdu_mlme_action {
1346 * interface is given in the conf parameter. 1449 * interface is given in the conf parameter.
1347 * The callback may refuse to add an interface by returning a 1450 * The callback may refuse to add an interface by returning a
1348 * negative error code (which will be seen in userspace.) 1451 * negative error code (which will be seen in userspace.)
1349 * Must be implemented. 1452 * Must be implemented and can sleep.
1350 * 1453 *
1351 * @remove_interface: Notifies a driver that an interface is going down. 1454 * @remove_interface: Notifies a driver that an interface is going down.
1352 * The @stop callback is called after this if it is the last interface 1455 * The @stop callback is called after this if it is the last interface
@@ -1355,19 +1458,20 @@ enum ieee80211_ampdu_mlme_action {
1355 * must be cleared so the device no longer acknowledges packets, 1458 * must be cleared so the device no longer acknowledges packets,
1356 * the mac_addr member of the conf structure is, however, set to the 1459 * the mac_addr member of the conf structure is, however, set to the
1357 * MAC address of the device going away. 1460 * MAC address of the device going away.
1358 * Hence, this callback must be implemented. 1461 * Hence, this callback must be implemented. It can sleep.
1359 * 1462 *
1360 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1463 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1361 * function to change hardware configuration, e.g., channel. 1464 * function to change hardware configuration, e.g., channel.
1362 * This function should never fail but returns a negative error code 1465 * This function should never fail but returns a negative error code
1363 * if it does. 1466 * if it does. The callback can sleep.
1364 * 1467 *
1365 * @bss_info_changed: Handler for configuration requests related to BSS 1468 * @bss_info_changed: Handler for configuration requests related to BSS
1366 * parameters that may vary during BSS's lifespan, and may affect low 1469 * parameters that may vary during BSS's lifespan, and may affect low
1367 * level driver (e.g. assoc/disassoc status, erp parameters). 1470 * level driver (e.g. assoc/disassoc status, erp parameters).
1368 * This function should not be used if no BSS has been set, unless 1471 * This function should not be used if no BSS has been set, unless
1369 * for association indication. The @changed parameter indicates which 1472 * for association indication. The @changed parameter indicates which
1370 * of the bss parameters has changed when a call is made. 1473 * of the bss parameters has changed when a call is made. The callback
1474 * can sleep.
1371 * 1475 *
1372 * @prepare_multicast: Prepare for multicast filter configuration. 1476 * @prepare_multicast: Prepare for multicast filter configuration.
1373 * This callback is optional, and its return value is passed 1477 * This callback is optional, and its return value is passed
@@ -1375,20 +1479,22 @@ enum ieee80211_ampdu_mlme_action {
1375 * 1479 *
1376 * @configure_filter: Configure the device's RX filter. 1480 * @configure_filter: Configure the device's RX filter.
1377 * See the section "Frame filtering" for more information. 1481 * See the section "Frame filtering" for more information.
1378 * This callback must be implemented. 1482 * This callback must be implemented and can sleep.
1379 * 1483 *
1380 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1484 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1381 * must be set or cleared for a given STA. Must be atomic. 1485 * must be set or cleared for a given STA. Must be atomic.
1382 * 1486 *
1383 * @set_key: See the section "Hardware crypto acceleration" 1487 * @set_key: See the section "Hardware crypto acceleration"
1384 * This callback can sleep, and is only called between add_interface 1488 * This callback is only called between add_interface and
1385 * and remove_interface calls, i.e. while the given virtual interface 1489 * remove_interface calls, i.e. while the given virtual interface
1386 * is enabled. 1490 * is enabled.
1387 * Returns a negative error code if the key can't be added. 1491 * Returns a negative error code if the key can't be added.
1492 * The callback can sleep.
1388 * 1493 *
1389 * @update_tkip_key: See the section "Hardware crypto acceleration" 1494 * @update_tkip_key: See the section "Hardware crypto acceleration"
1390 * This callback will be called in the context of Rx. Called for drivers 1495 * This callback will be called in the context of Rx. Called for drivers
1391 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. 1496 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
1497 * The callback must be atomic.
1392 * 1498 *
1393 * @hw_scan: Ask the hardware to service the scan request, no need to start 1499 * @hw_scan: Ask the hardware to service the scan request, no need to start
1394 * the scan state machine in stack. The scan must honour the channel 1500 * the scan state machine in stack. The scan must honour the channel
@@ -1402,53 +1508,64 @@ enum ieee80211_ampdu_mlme_action {
1402 * When the scan finishes, ieee80211_scan_completed() must be called; 1508 * When the scan finishes, ieee80211_scan_completed() must be called;
1403 * note that it also must be called when the scan cannot finish due to 1509 * note that it also must be called when the scan cannot finish due to
1404 * any error unless this callback returned a negative error code. 1510 * any error unless this callback returned a negative error code.
1511 * The callback can sleep.
1405 * 1512 *
1406 * @sw_scan_start: Notifier function that is called just before a software scan 1513 * @sw_scan_start: Notifier function that is called just before a software scan
1407 * is started. Can be NULL, if the driver doesn't need this notification. 1514 * is started. Can be NULL, if the driver doesn't need this notification.
1515 * The callback can sleep.
1408 * 1516 *
1409 * @sw_scan_complete: Notifier function that is called just after a software scan 1517 * @sw_scan_complete: Notifier function that is called just after a
1410 * finished. Can be NULL, if the driver doesn't need this notification. 1518 * software scan finished. Can be NULL, if the driver doesn't need
1519 * this notification.
1520 * The callback can sleep.
1411 * 1521 *
1412 * @get_stats: Return low-level statistics. 1522 * @get_stats: Return low-level statistics.
1413 * Returns zero if statistics are available. 1523 * Returns zero if statistics are available.
1524 * The callback can sleep.
1414 * 1525 *
1415 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1526 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1416 * callback should be provided to read the TKIP transmit IVs (both IV32 1527 * callback should be provided to read the TKIP transmit IVs (both IV32
1417 * and IV16) for the given key from hardware. 1528 * and IV16) for the given key from hardware.
1529 * The callback must be atomic.
1418 * 1530 *
1419 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1531 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1532 * The callback can sleep.
1533 *
1534 * @sta_add: Notifies low level driver about addition of an associated station,
1535 * AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1420 * 1536 *
1421 * @sta_notify: Notifies low level driver about addition, removal or power 1537 * @sta_remove: Notifies low level driver about removal of an associated
1422 * state transition of an associated station, AP, IBSS/WDS/mesh peer etc. 1538 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1423 * Must be atomic. 1539 *
1540 * @sta_notify: Notifies low level driver about power state transition of an
1541 * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic.
1424 * 1542 *
1425 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1543 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1426 * bursting) for a hardware TX queue. 1544 * bursting) for a hardware TX queue.
1427 * Returns a negative error code on failure. 1545 * Returns a negative error code on failure.
1428 * 1546 * The callback can sleep.
1429 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1430 * to get number of currently queued packets (queue length), maximum queue
1431 * size (limit), and total number of packets sent using each TX queue
1432 * (count). The 'stats' pointer points to an array that has hw->queues
1433 * items.
1434 * 1547 *
1435 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1548 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1436 * this is only used for IBSS mode BSSID merging and debugging. Is not a 1549 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1437 * required function. 1550 * required function.
1551 * The callback can sleep.
1438 * 1552 *
1439 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. 1553 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1440 * Currently, this is only used for IBSS mode debugging. Is not a 1554 * Currently, this is only used for IBSS mode debugging. Is not a
1441 * required function. 1555 * required function.
1556 * The callback can sleep.
1442 * 1557 *
1443 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1558 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1444 * with other STAs in the IBSS. This is only used in IBSS mode. This 1559 * with other STAs in the IBSS. This is only used in IBSS mode. This
1445 * function is optional if the firmware/hardware takes full care of 1560 * function is optional if the firmware/hardware takes full care of
1446 * TSF synchronization. 1561 * TSF synchronization.
1562 * The callback can sleep.
1447 * 1563 *
1448 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1564 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1449 * This is needed only for IBSS mode and the result of this function is 1565 * This is needed only for IBSS mode and the result of this function is
1450 * used to determine whether to reply to Probe Requests. 1566 * used to determine whether to reply to Probe Requests.
1451 * Returns non-zero if this device sent the last beacon. 1567 * Returns non-zero if this device sent the last beacon.
1568 * The callback can sleep.
1452 * 1569 *
1453 * @ampdu_action: Perform a certain A-MPDU action 1570 * @ampdu_action: Perform a certain A-MPDU action
1454 * The RA/TID combination determines the destination and TID we want 1571 * The RA/TID combination determines the destination and TID we want
@@ -1457,21 +1574,32 @@ enum ieee80211_ampdu_mlme_action {
1457 * is the first frame we expect to perform the action on. Notice 1574 * is the first frame we expect to perform the action on. Notice
1458 * that TX/RX_STOP can pass NULL for this parameter. 1575 * that TX/RX_STOP can pass NULL for this parameter.
1459 * Returns a negative error code on failure. 1576 * Returns a negative error code on failure.
1577 * The callback must be atomic.
1460 * 1578 *
1461 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1579 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1462 * need to set wiphy->rfkill_poll to %true before registration, 1580 * need to set wiphy->rfkill_poll to %true before registration,
1463 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1581 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1582 * The callback can sleep.
1583 *
1584 * @set_coverage_class: Set slot time for given coverage class as specified
1585 * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
1586 * accordingly. This callback is not required and may sleep.
1464 * 1587 *
1465 * @testmode_cmd: Implement a cfg80211 test mode command. 1588 * @testmode_cmd: Implement a cfg80211 test mode command.
1589 * The callback can sleep.
1590 *
1591 * @flush: Flush all pending frames from the hardware queue, making sure
1592 * that the hardware queues are empty. If the parameter @drop is set
1593 * to %true, pending frames may be dropped. The callback can sleep.
1466 */ 1594 */
1467struct ieee80211_ops { 1595struct ieee80211_ops {
1468 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1596 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1469 int (*start)(struct ieee80211_hw *hw); 1597 int (*start)(struct ieee80211_hw *hw);
1470 void (*stop)(struct ieee80211_hw *hw); 1598 void (*stop)(struct ieee80211_hw *hw);
1471 int (*add_interface)(struct ieee80211_hw *hw, 1599 int (*add_interface)(struct ieee80211_hw *hw,
1472 struct ieee80211_if_init_conf *conf); 1600 struct ieee80211_vif *vif);
1473 void (*remove_interface)(struct ieee80211_hw *hw, 1601 void (*remove_interface)(struct ieee80211_hw *hw,
1474 struct ieee80211_if_init_conf *conf); 1602 struct ieee80211_vif *vif);
1475 int (*config)(struct ieee80211_hw *hw, u32 changed); 1603 int (*config)(struct ieee80211_hw *hw, u32 changed);
1476 void (*bss_info_changed)(struct ieee80211_hw *hw, 1604 void (*bss_info_changed)(struct ieee80211_hw *hw,
1477 struct ieee80211_vif *vif, 1605 struct ieee80211_vif *vif,
@@ -1489,8 +1617,10 @@ struct ieee80211_ops {
1489 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 1617 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1490 struct ieee80211_key_conf *key); 1618 struct ieee80211_key_conf *key);
1491 void (*update_tkip_key)(struct ieee80211_hw *hw, 1619 void (*update_tkip_key)(struct ieee80211_hw *hw,
1492 struct ieee80211_key_conf *conf, const u8 *address, 1620 struct ieee80211_vif *vif,
1493 u32 iv32, u16 *phase1key); 1621 struct ieee80211_key_conf *conf,
1622 struct ieee80211_sta *sta,
1623 u32 iv32, u16 *phase1key);
1494 int (*hw_scan)(struct ieee80211_hw *hw, 1624 int (*hw_scan)(struct ieee80211_hw *hw,
1495 struct cfg80211_scan_request *req); 1625 struct cfg80211_scan_request *req);
1496 void (*sw_scan_start)(struct ieee80211_hw *hw); 1626 void (*sw_scan_start)(struct ieee80211_hw *hw);
@@ -1500,24 +1630,29 @@ struct ieee80211_ops {
1500 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1630 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1501 u32 *iv32, u16 *iv16); 1631 u32 *iv32, u16 *iv16);
1502 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1632 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1633 int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1634 struct ieee80211_sta *sta);
1635 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1636 struct ieee80211_sta *sta);
1503 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1637 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1504 enum sta_notify_cmd, struct ieee80211_sta *sta); 1638 enum sta_notify_cmd, struct ieee80211_sta *sta);
1505 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1639 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1506 const struct ieee80211_tx_queue_params *params); 1640 const struct ieee80211_tx_queue_params *params);
1507 int (*get_tx_stats)(struct ieee80211_hw *hw,
1508 struct ieee80211_tx_queue_stats *stats);
1509 u64 (*get_tsf)(struct ieee80211_hw *hw); 1641 u64 (*get_tsf)(struct ieee80211_hw *hw);
1510 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); 1642 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1511 void (*reset_tsf)(struct ieee80211_hw *hw); 1643 void (*reset_tsf)(struct ieee80211_hw *hw);
1512 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1644 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1513 int (*ampdu_action)(struct ieee80211_hw *hw, 1645 int (*ampdu_action)(struct ieee80211_hw *hw,
1646 struct ieee80211_vif *vif,
1514 enum ieee80211_ampdu_mlme_action action, 1647 enum ieee80211_ampdu_mlme_action action,
1515 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1648 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1516 1649
1517 void (*rfkill_poll)(struct ieee80211_hw *hw); 1650 void (*rfkill_poll)(struct ieee80211_hw *hw);
1651 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
1518#ifdef CONFIG_NL80211_TESTMODE 1652#ifdef CONFIG_NL80211_TESTMODE
1519 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); 1653 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1520#endif 1654#endif
1655 void (*flush)(struct ieee80211_hw *hw, bool drop);
1521}; 1656};
1522 1657
1523/** 1658/**
@@ -1667,15 +1802,14 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
1667 * ieee80211_rx - receive frame 1802 * ieee80211_rx - receive frame
1668 * 1803 *
1669 * Use this function to hand received frames to mac80211. The receive 1804 * Use this function to hand received frames to mac80211. The receive
1670 * buffer in @skb must start with an IEEE 802.11 header or a radiotap 1805 * buffer in @skb must start with an IEEE 802.11 header.
1671 * header if %RX_FLAG_RADIOTAP is set in the @status flags.
1672 * 1806 *
1673 * This function may not be called in IRQ context. Calls to this function 1807 * This function may not be called in IRQ context. Calls to this function
1674 * for a single hardware must be synchronized against each other. Calls 1808 * for a single hardware must be synchronized against each other. Calls to
1675 * to this function and ieee80211_rx_irqsafe() may not be mixed for a 1809 * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
1676 * single hardware. 1810 * mixed for a single hardware.
1677 * 1811 *
1678 * Note that right now, this function must be called with softirqs disabled. 1812 * In process context use instead ieee80211_rx_ni().
1679 * 1813 *
1680 * @hw: the hardware this frame came in on 1814 * @hw: the hardware this frame came in on
1681 * @skb: the buffer to receive, owned by mac80211 after this call 1815 * @skb: the buffer to receive, owned by mac80211 after this call
@@ -1688,8 +1822,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
1688 * Like ieee80211_rx() but can be called in IRQ context 1822 * Like ieee80211_rx() but can be called in IRQ context
1689 * (internally defers to a tasklet.) 1823 * (internally defers to a tasklet.)
1690 * 1824 *
1691 * Calls to this function and ieee80211_rx() may not be mixed for a 1825 * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
1692 * single hardware. 1826 * be mixed for a single hardware.
1693 * 1827 *
1694 * @hw: the hardware this frame came in on 1828 * @hw: the hardware this frame came in on
1695 * @skb: the buffer to receive, owned by mac80211 after this call 1829 * @skb: the buffer to receive, owned by mac80211 after this call
@@ -1697,6 +1831,32 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
1697void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); 1831void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
1698 1832
1699/** 1833/**
1834 * ieee80211_rx_ni - receive frame (in process context)
1835 *
1836 * Like ieee80211_rx() but can be called in process context
1837 * (internally disables bottom halves).
1838 *
1839 * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
1840 * not be mixed for a single hardware.
1841 *
1842 * @hw: the hardware this frame came in on
1843 * @skb: the buffer to receive, owned by mac80211 after this call
1844 */
1845static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
1846 struct sk_buff *skb)
1847{
1848 local_bh_disable();
1849 ieee80211_rx(hw, skb);
1850 local_bh_enable();
1851}
1852
1853/*
1854 * The TX headroom reserved by mac80211 for its own tx_status functions.
1855 * This is enough for the radiotap header.
1856 */
1857#define IEEE80211_TX_STATUS_HEADROOM 13
1858
1859/**
1700 * ieee80211_tx_status - transmit status callback 1860 * ieee80211_tx_status - transmit status callback
1701 * 1861 *
1702 * Call this function for all transmitted frames after they have been 1862 * Call this function for all transmitted frames after they have been
@@ -1730,24 +1890,97 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1730 struct sk_buff *skb); 1890 struct sk_buff *skb);
1731 1891
1732/** 1892/**
1733 * ieee80211_beacon_get - beacon generation function 1893 * ieee80211_beacon_get_tim - beacon generation function
1734 * @hw: pointer obtained from ieee80211_alloc_hw(). 1894 * @hw: pointer obtained from ieee80211_alloc_hw().
1735 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1895 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1896 * @tim_offset: pointer to variable that will receive the TIM IE offset.
1897 * Set to 0 if invalid (in non-AP modes).
1898 * @tim_length: pointer to variable that will receive the TIM IE length,
1899 * (including the ID and length bytes!).
1900 * Set to 0 if invalid (in non-AP modes).
1901 *
1902 * If the driver implements beaconing modes, it must use this function to
1903 * obtain the beacon frame/template.
1736 * 1904 *
1737 * If the beacon frames are generated by the host system (i.e., not in 1905 * If the beacon frames are generated by the host system (i.e., not in
1738 * hardware/firmware), the low-level driver uses this function to receive 1906 * hardware/firmware), the driver uses this function to get each beacon
1739 * the next beacon frame from the 802.11 code. The low-level is responsible 1907 * frame from mac80211 -- it is responsible for calling this function
1740 * for calling this function before beacon data is needed (e.g., based on 1908 * before the beacon is needed (e.g. based on hardware interrupt).
1741 * hardware interrupt). Returned skb is used only once and low-level driver 1909 *
1742 * is responsible for freeing it. 1910 * If the beacon frames are generated by the device, then the driver
1911 * must use the returned beacon as the template and change the TIM IE
1912 * according to the current DTIM parameters/TIM bitmap.
1913 *
1914 * The driver is responsible for freeing the returned skb.
1915 */
1916struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
1917 struct ieee80211_vif *vif,
1918 u16 *tim_offset, u16 *tim_length);
1919
1920/**
1921 * ieee80211_beacon_get - beacon generation function
1922 * @hw: pointer obtained from ieee80211_alloc_hw().
1923 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1924 *
1925 * See ieee80211_beacon_get_tim().
1926 */
1927static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1928 struct ieee80211_vif *vif)
1929{
1930 return ieee80211_beacon_get_tim(hw, vif, NULL, NULL);
1931}
1932
1933/**
1934 * ieee80211_pspoll_get - retrieve a PS Poll template
1935 * @hw: pointer obtained from ieee80211_alloc_hw().
1936 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1937 *
1938 * Creates a PS Poll a template which can, for example, uploaded to
1939 * hardware. The template must be updated after association so that correct
1940 * AID, BSSID and MAC address is used.
1941 *
1942 * Note: Caller (or hardware) is responsible for setting the
1943 * &IEEE80211_FCTL_PM bit.
1743 */ 1944 */
1744struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1945struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
1745 struct ieee80211_vif *vif); 1946 struct ieee80211_vif *vif);
1746 1947
1747/** 1948/**
1949 * ieee80211_nullfunc_get - retrieve a nullfunc template
1950 * @hw: pointer obtained from ieee80211_alloc_hw().
1951 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1952 *
1953 * Creates a Nullfunc template which can, for example, uploaded to
1954 * hardware. The template must be updated after association so that correct
1955 * BSSID and address is used.
1956 *
1957 * Note: Caller (or hardware) is responsible for setting the
1958 * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
1959 */
1960struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
1961 struct ieee80211_vif *vif);
1962
1963/**
1964 * ieee80211_probereq_get - retrieve a Probe Request template
1965 * @hw: pointer obtained from ieee80211_alloc_hw().
1966 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1967 * @ssid: SSID buffer
1968 * @ssid_len: length of SSID
1969 * @ie: buffer containing all IEs except SSID for the template
1970 * @ie_len: length of the IE buffer
1971 *
1972 * Creates a Probe Request template which can, for example, be uploaded to
1973 * hardware.
1974 */
1975struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
1976 struct ieee80211_vif *vif,
1977 const u8 *ssid, size_t ssid_len,
1978 const u8 *ie, size_t ie_len);
1979
1980/**
1748 * ieee80211_rts_get - RTS frame generation function 1981 * ieee80211_rts_get - RTS frame generation function
1749 * @hw: pointer obtained from ieee80211_alloc_hw(). 1982 * @hw: pointer obtained from ieee80211_alloc_hw().
1750 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1983 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1751 * @frame: pointer to the frame that is going to be protected by the RTS. 1984 * @frame: pointer to the frame that is going to be protected by the RTS.
1752 * @frame_len: the frame length (in octets). 1985 * @frame_len: the frame length (in octets).
1753 * @frame_txctl: &struct ieee80211_tx_info of the frame. 1986 * @frame_txctl: &struct ieee80211_tx_info of the frame.
@@ -1766,7 +1999,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1766/** 1999/**
1767 * ieee80211_rts_duration - Get the duration field for an RTS frame 2000 * ieee80211_rts_duration - Get the duration field for an RTS frame
1768 * @hw: pointer obtained from ieee80211_alloc_hw(). 2001 * @hw: pointer obtained from ieee80211_alloc_hw().
1769 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2002 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1770 * @frame_len: the length of the frame that is going to be protected by the RTS. 2003 * @frame_len: the length of the frame that is going to be protected by the RTS.
1771 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2004 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1772 * 2005 *
@@ -1781,7 +2014,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1781/** 2014/**
1782 * ieee80211_ctstoself_get - CTS-to-self frame generation function 2015 * ieee80211_ctstoself_get - CTS-to-self frame generation function
1783 * @hw: pointer obtained from ieee80211_alloc_hw(). 2016 * @hw: pointer obtained from ieee80211_alloc_hw().
1784 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2017 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1785 * @frame: pointer to the frame that is going to be protected by the CTS-to-self. 2018 * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
1786 * @frame_len: the frame length (in octets). 2019 * @frame_len: the frame length (in octets).
1787 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2020 * @frame_txctl: &struct ieee80211_tx_info of the frame.
@@ -1801,7 +2034,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1801/** 2034/**
1802 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame 2035 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
1803 * @hw: pointer obtained from ieee80211_alloc_hw(). 2036 * @hw: pointer obtained from ieee80211_alloc_hw().
1804 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2037 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1805 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. 2038 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
1806 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2039 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1807 * 2040 *
@@ -1817,7 +2050,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1817/** 2050/**
1818 * ieee80211_generic_frame_duration - Calculate the duration field for a frame 2051 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
1819 * @hw: pointer obtained from ieee80211_alloc_hw(). 2052 * @hw: pointer obtained from ieee80211_alloc_hw().
1820 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2053 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1821 * @frame_len: the length of the frame. 2054 * @frame_len: the length of the frame.
1822 * @rate: the rate at which the frame is going to be transmitted. 2055 * @rate: the rate at which the frame is going to be transmitted.
1823 * 2056 *
@@ -1832,7 +2065,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1832/** 2065/**
1833 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames 2066 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
1834 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2067 * @hw: pointer as obtained from ieee80211_alloc_hw().
1835 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2068 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1836 * 2069 *
1837 * Function for accessing buffered broadcast and multicast frames. If 2070 * Function for accessing buffered broadcast and multicast frames. If
1838 * hardware/firmware does not implement buffering of broadcast/multicast 2071 * hardware/firmware does not implement buffering of broadcast/multicast
@@ -1987,8 +2220,7 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
1987 2220
1988/** 2221/**
1989 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 2222 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1990 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2223 * @sta: the station for which to start a BA session
1991 * @ra: receiver address of the BA session recipient
1992 * @tid: the TID to BA on. 2224 * @tid: the TID to BA on.
1993 * 2225 *
1994 * Return: success if addBA request was sent, failure otherwise 2226 * Return: success if addBA request was sent, failure otherwise
@@ -1997,22 +2229,22 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
1997 * the need to start aggregation on a certain RA/TID, the session level 2229 * the need to start aggregation on a certain RA/TID, the session level
1998 * will be managed by the mac80211. 2230 * will be managed by the mac80211.
1999 */ 2231 */
2000int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid); 2232int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2001 2233
2002/** 2234/**
2003 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. 2235 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
2004 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2236 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2005 * @ra: receiver address of the BA session recipient. 2237 * @ra: receiver address of the BA session recipient.
2006 * @tid: the TID to BA on. 2238 * @tid: the TID to BA on.
2007 * 2239 *
2008 * This function must be called by low level driver once it has 2240 * This function must be called by low level driver once it has
2009 * finished with preparations for the BA session. 2241 * finished with preparations for the BA session.
2010 */ 2242 */
2011void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid); 2243void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
2012 2244
2013/** 2245/**
2014 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. 2246 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
2015 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2247 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2016 * @ra: receiver address of the BA session recipient. 2248 * @ra: receiver address of the BA session recipient.
2017 * @tid: the TID to BA on. 2249 * @tid: the TID to BA on.
2018 * 2250 *
@@ -2020,13 +2252,12 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid);
2020 * finished with preparations for the BA session. 2252 * finished with preparations for the BA session.
2021 * This version of the function is IRQ-safe. 2253 * This version of the function is IRQ-safe.
2022 */ 2254 */
2023void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, 2255void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2024 u16 tid); 2256 u16 tid);
2025 2257
2026/** 2258/**
2027 * ieee80211_stop_tx_ba_session - Stop a Block Ack session. 2259 * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
2028 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2260 * @sta: the station whose BA session to stop
2029 * @ra: receiver address of the BA session recipient
2030 * @tid: the TID to stop BA. 2261 * @tid: the TID to stop BA.
2031 * @initiator: if indicates initiator DELBA frame will be sent. 2262 * @initiator: if indicates initiator DELBA frame will be sent.
2032 * 2263 *
@@ -2036,24 +2267,23 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
2036 * the need to stop aggregation on a certain RA/TID, the session level 2267 * the need to stop aggregation on a certain RA/TID, the session level
2037 * will be managed by the mac80211. 2268 * will be managed by the mac80211.
2038 */ 2269 */
2039int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, 2270int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
2040 u8 *ra, u16 tid,
2041 enum ieee80211_back_parties initiator); 2271 enum ieee80211_back_parties initiator);
2042 2272
2043/** 2273/**
2044 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. 2274 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
2045 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2275 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2046 * @ra: receiver address of the BA session recipient. 2276 * @ra: receiver address of the BA session recipient.
2047 * @tid: the desired TID to BA on. 2277 * @tid: the desired TID to BA on.
2048 * 2278 *
2049 * This function must be called by low level driver once it has 2279 * This function must be called by low level driver once it has
2050 * finished with preparations for the BA session tear down. 2280 * finished with preparations for the BA session tear down.
2051 */ 2281 */
2052void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); 2282void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2053 2283
2054/** 2284/**
2055 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. 2285 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
2056 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2286 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2057 * @ra: receiver address of the BA session recipient. 2287 * @ra: receiver address of the BA session recipient.
2058 * @tid: the desired TID to BA on. 2288 * @tid: the desired TID to BA on.
2059 * 2289 *
@@ -2061,25 +2291,78 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid);
2061 * finished with preparations for the BA session tear down. 2291 * finished with preparations for the BA session tear down.
2062 * This version of the function is IRQ-safe. 2292 * This version of the function is IRQ-safe.
2063 */ 2293 */
2064void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, 2294void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2065 u16 tid); 2295 u16 tid);
2066 2296
2067/** 2297/**
2068 * ieee80211_find_sta - find a station 2298 * ieee80211_find_sta - find a station
2069 * 2299 *
2070 * @hw: pointer as obtained from ieee80211_alloc_hw() 2300 * @vif: virtual interface to look for station on
2071 * @addr: station's address 2301 * @addr: station's address
2072 * 2302 *
2073 * This function must be called under RCU lock and the 2303 * This function must be called under RCU lock and the
2074 * resulting pointer is only valid under RCU lock as well. 2304 * resulting pointer is only valid under RCU lock as well.
2075 */ 2305 */
2076struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, 2306struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
2077 const u8 *addr); 2307 const u8 *addr);
2078 2308
2079/** 2309/**
2310 * ieee80211_find_sta_by_hw - find a station on hardware
2311 *
2312 * @hw: pointer as obtained from ieee80211_alloc_hw()
2313 * @addr: station's address
2314 *
2315 * This function must be called under RCU lock and the
2316 * resulting pointer is only valid under RCU lock as well.
2317 *
2318 * NOTE: This function should not be used! When mac80211 is converted
2319 * internally to properly keep track of stations on multiple
2320 * virtual interfaces, it will not always know which station to
2321 * return here since a single address might be used by multiple
2322 * logical stations (e.g. consider a station connecting to another
2323 * BSSID on the same AP hardware without disconnecting first).
2324 *
2325 * DO NOT USE THIS FUNCTION.
2326 */
2327struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw,
2328 const u8 *addr);
2329
2330/**
2331 * ieee80211_sta_block_awake - block station from waking up
2332 * @hw: the hardware
2333 * @pubsta: the station
2334 * @block: whether to block or unblock
2335 *
2336 * Some devices require that all frames that are on the queues
2337 * for a specific station that went to sleep are flushed before
2338 * a poll response or frames after the station woke up can be
2339 * delivered to that it. Note that such frames must be rejected
2340 * by the driver as filtered, with the appropriate status flag.
2341 *
2342 * This function allows implementing this mode in a race-free
2343 * manner.
2344 *
2345 * To do this, a driver must keep track of the number of frames
2346 * still enqueued for a specific station. If this number is not
2347 * zero when the station goes to sleep, the driver must call
2348 * this function to force mac80211 to consider the station to
2349 * be asleep regardless of the station's actual state. Once the
2350 * number of outstanding frames reaches zero, the driver must
2351 * call this function again to unblock the station. That will
2352 * cause mac80211 to be able to send ps-poll responses, and if
2353 * the station queried in the meantime then frames will also
2354 * be sent out as a result of this. Additionally, the driver
2355 * will be notified that the station woke up some time after
2356 * it is unblocked, regardless of whether the station actually
2357 * woke up while blocked or not.
2358 */
2359void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
2360 struct ieee80211_sta *pubsta, bool block);
2361
2362/**
2080 * ieee80211_beacon_loss - inform hardware does not receive beacons 2363 * ieee80211_beacon_loss - inform hardware does not receive beacons
2081 * 2364 *
2082 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2365 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2083 * 2366 *
2084 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and 2367 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
2085 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the 2368 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
@@ -2113,8 +2396,12 @@ enum rate_control_changed {
2113 * @short_preamble: whether mac80211 will request short-preamble transmission 2396 * @short_preamble: whether mac80211 will request short-preamble transmission
2114 * if the selected rate supports it 2397 * if the selected rate supports it
2115 * @max_rate_idx: user-requested maximum rate (not MCS for now) 2398 * @max_rate_idx: user-requested maximum rate (not MCS for now)
2399 * (deprecated; this will be removed once drivers get updated to use
2400 * rate_idx_mask)
2401 * @rate_idx_mask: user-requested rate mask (not MCS for now)
2116 * @skb: the skb that will be transmitted, the control information in it needs 2402 * @skb: the skb that will be transmitted, the control information in it needs
2117 * to be filled in 2403 * to be filled in
2404 * @ap: whether this frame is sent out in AP mode
2118 */ 2405 */
2119struct ieee80211_tx_rate_control { 2406struct ieee80211_tx_rate_control {
2120 struct ieee80211_hw *hw; 2407 struct ieee80211_hw *hw;
@@ -2124,6 +2411,8 @@ struct ieee80211_tx_rate_control {
2124 struct ieee80211_tx_rate reported_rate; 2411 struct ieee80211_tx_rate reported_rate;
2125 bool rts, short_preamble; 2412 bool rts, short_preamble;
2126 u8 max_rate_idx; 2413 u8 max_rate_idx;
2414 u32 rate_idx_mask;
2415 bool ap;
2127}; 2416};
2128 2417
2129struct rate_control_ops { 2418struct rate_control_ops {
@@ -2137,7 +2426,8 @@ struct rate_control_ops {
2137 struct ieee80211_sta *sta, void *priv_sta); 2426 struct ieee80211_sta *sta, void *priv_sta);
2138 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, 2427 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2139 struct ieee80211_sta *sta, 2428 struct ieee80211_sta *sta,
2140 void *priv_sta, u32 changed); 2429 void *priv_sta, u32 changed,
2430 enum nl80211_channel_type oper_chan_type);
2141 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2431 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
2142 void *priv_sta); 2432 void *priv_sta);
2143 2433
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 3817fda82a80..da1d58be31b7 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -37,8 +37,7 @@
37 37
38struct neighbour; 38struct neighbour;
39 39
40struct neigh_parms 40struct neigh_parms {
41{
42#ifdef CONFIG_NET_NS 41#ifdef CONFIG_NET_NS
43 struct net *net; 42 struct net *net;
44#endif 43#endif
@@ -70,8 +69,7 @@ struct neigh_parms
70 int locktime; 69 int locktime;
71}; 70};
72 71
73struct neigh_statistics 72struct neigh_statistics {
74{
75 unsigned long allocs; /* number of allocated neighs */ 73 unsigned long allocs; /* number of allocated neighs */
76 unsigned long destroys; /* number of destroyed neighs */ 74 unsigned long destroys; /* number of destroyed neighs */
77 unsigned long hash_grows; /* number of hash resizes */ 75 unsigned long hash_grows; /* number of hash resizes */
@@ -90,15 +88,9 @@ struct neigh_statistics
90 unsigned long unres_discards; /* number of unresolved drops */ 88 unsigned long unres_discards; /* number of unresolved drops */
91}; 89};
92 90
93#define NEIGH_CACHE_STAT_INC(tbl, field) \ 91#define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field)
94 do { \
95 preempt_disable(); \
96 (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \
97 preempt_enable(); \
98 } while (0)
99 92
100struct neighbour 93struct neighbour {
101{
102 struct neighbour *next; 94 struct neighbour *next;
103 struct neigh_table *tbl; 95 struct neigh_table *tbl;
104 struct neigh_parms *parms; 96 struct neigh_parms *parms;
@@ -122,8 +114,7 @@ struct neighbour
122 u8 primary_key[0]; 114 u8 primary_key[0];
123}; 115};
124 116
125struct neigh_ops 117struct neigh_ops {
126{
127 int family; 118 int family;
128 void (*solicit)(struct neighbour *, struct sk_buff*); 119 void (*solicit)(struct neighbour *, struct sk_buff*);
129 void (*error_report)(struct neighbour *, struct sk_buff*); 120 void (*error_report)(struct neighbour *, struct sk_buff*);
@@ -133,8 +124,7 @@ struct neigh_ops
133 int (*queue_xmit)(struct sk_buff*); 124 int (*queue_xmit)(struct sk_buff*);
134}; 125};
135 126
136struct pneigh_entry 127struct pneigh_entry {
137{
138 struct pneigh_entry *next; 128 struct pneigh_entry *next;
139#ifdef CONFIG_NET_NS 129#ifdef CONFIG_NET_NS
140 struct net *net; 130 struct net *net;
@@ -149,8 +139,7 @@ struct pneigh_entry
149 */ 139 */
150 140
151 141
152struct neigh_table 142struct neigh_table {
153{
154 struct neigh_table *next; 143 struct neigh_table *next;
155 int family; 144 int family;
156 int entry_size; 145 int entry_size;
@@ -175,7 +164,7 @@ struct neigh_table
175 rwlock_t lock; 164 rwlock_t lock;
176 unsigned long last_rand; 165 unsigned long last_rand;
177 struct kmem_cache *kmem_cachep; 166 struct kmem_cache *kmem_cachep;
178 struct neigh_statistics *stats; 167 struct neigh_statistics __percpu *stats;
179 struct neighbour **hash_buckets; 168 struct neighbour **hash_buckets;
180 unsigned int hash_mask; 169 unsigned int hash_mask;
181 __u32 hash_rnd; 170 __u32 hash_rnd;
@@ -262,10 +251,8 @@ extern void neigh_seq_stop(struct seq_file *, void *);
262 251
263extern int neigh_sysctl_register(struct net_device *dev, 252extern int neigh_sysctl_register(struct net_device *dev,
264 struct neigh_parms *p, 253 struct neigh_parms *p,
265 int p_id, int pdev_id,
266 char *p_name, 254 char *p_name,
267 proc_handler *proc_handler, 255 proc_handler *proc_handler);
268 ctl_handler *strategy);
269extern void neigh_sysctl_unregister(struct neigh_parms *p); 256extern void neigh_sysctl_unregister(struct neigh_parms *p);
270 257
271static inline void __neigh_parms_put(struct neigh_parms *parms) 258static inline void __neigh_parms_put(struct neigh_parms *parms)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index a1202841aadd..bd10a7908993 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -28,6 +28,10 @@ struct ctl_table_header;
28struct net_generic; 28struct net_generic;
29struct sock; 29struct sock;
30 30
31
32#define NETDEV_HASHBITS 8
33#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
34
31struct net { 35struct net {
32 atomic_t count; /* To decided when the network 36 atomic_t count; /* To decided when the network
33 * namespace should be freed. 37 * namespace should be freed.
@@ -38,7 +42,8 @@ struct net {
38 */ 42 */
39#endif 43#endif
40 struct list_head list; /* list of network namespaces */ 44 struct list_head list; /* list of network namespaces */
41 struct work_struct work; /* work struct for freeing */ 45 struct list_head cleanup_list; /* namespaces on death row */
46 struct list_head exit_list; /* Use only net_mutex */
42 47
43 struct proc_dir_entry *proc_net; 48 struct proc_dir_entry *proc_net;
44 struct proc_dir_entry *proc_net_stat; 49 struct proc_dir_entry *proc_net_stat;
@@ -76,11 +81,13 @@ struct net {
76#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 81#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
77 struct netns_ct ct; 82 struct netns_ct ct;
78#endif 83#endif
84 struct sock *nfnl;
85 struct sock *nfnl_stash;
79#endif 86#endif
80#ifdef CONFIG_XFRM 87#ifdef CONFIG_XFRM
81 struct netns_xfrm xfrm; 88 struct netns_xfrm xfrm;
82#endif 89#endif
83#ifdef CONFIG_WIRELESS_EXT 90#ifdef CONFIG_WEXT_CORE
84 struct sk_buff_head wext_nlevents; 91 struct sk_buff_head wext_nlevents;
85#endif 92#endif
86 struct net_generic *gen; 93 struct net_generic *gen;
@@ -93,14 +100,9 @@ struct net {
93extern struct net init_net; 100extern struct net init_net;
94 101
95#ifdef CONFIG_NET 102#ifdef CONFIG_NET
96#define INIT_NET_NS(net_ns) .net_ns = &init_net,
97
98extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); 103extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns);
99 104
100#else /* CONFIG_NET */ 105#else /* CONFIG_NET */
101
102#define INIT_NET_NS(net_ns)
103
104static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) 106static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
105{ 107{
106 /* There is nothing to copy so this is a noop */ 108 /* There is nothing to copy so this is a noop */
@@ -232,6 +234,9 @@ struct pernet_operations {
232 struct list_head list; 234 struct list_head list;
233 int (*init)(struct net *net); 235 int (*init)(struct net *net);
234 void (*exit)(struct net *net); 236 void (*exit)(struct net *net);
237 void (*exit_batch)(struct list_head *net_exit_list);
238 int *id;
239 size_t size;
235}; 240};
236 241
237/* 242/*
@@ -255,12 +260,8 @@ struct pernet_operations {
255 */ 260 */
256extern int register_pernet_subsys(struct pernet_operations *); 261extern int register_pernet_subsys(struct pernet_operations *);
257extern void unregister_pernet_subsys(struct pernet_operations *); 262extern void unregister_pernet_subsys(struct pernet_operations *);
258extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
259extern void unregister_pernet_gen_subsys(int id, struct pernet_operations *);
260extern int register_pernet_device(struct pernet_operations *); 263extern int register_pernet_device(struct pernet_operations *);
261extern void unregister_pernet_device(struct pernet_operations *); 264extern void unregister_pernet_device(struct pernet_operations *);
262extern int register_pernet_gen_device(int *id, struct pernet_operations *);
263extern void unregister_pernet_gen_device(int id, struct pernet_operations *);
264 265
265struct ctl_path; 266struct ctl_path;
266struct ctl_table; 267struct ctl_table;
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
index abc55ad75c2b..1ee717eb5b09 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -9,7 +9,7 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9 9
10extern int nf_ct_frag6_init(void); 10extern int nf_ct_frag6_init(void);
11extern void nf_ct_frag6_cleanup(void); 11extern void nf_ct_frag6_cleanup(void);
12extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb); 12extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
13extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, 13extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
14 struct net_device *in, 14 struct net_device *in,
15 struct net_device *out, 15 struct net_device *out,
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 5cf7270e3ffc..bde095f7e845 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -70,7 +70,7 @@ union nf_conntrack_help {
70struct nf_conntrack_helper; 70struct nf_conntrack_helper;
71 71
72/* Must be kept in sync with the classes defined by helpers */ 72/* Must be kept in sync with the classes defined by helpers */
73#define NF_CT_MAX_EXPECT_CLASSES 3 73#define NF_CT_MAX_EXPECT_CLASSES 4
74 74
75/* nf_conn feature for connections that have a helper */ 75/* nf_conn feature for connections that have a helper */
76struct nf_conn_help { 76struct nf_conn_help {
@@ -198,7 +198,8 @@ extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int null
198extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); 198extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);
199 199
200extern struct nf_conntrack_tuple_hash * 200extern struct nf_conntrack_tuple_hash *
201__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 201__nf_conntrack_find(struct net *net, u16 zone,
202 const struct nf_conntrack_tuple *tuple);
202 203
203extern void nf_conntrack_hash_insert(struct nf_conn *ct); 204extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204extern void nf_ct_delete_from_lists(struct nf_conn *ct); 205extern void nf_ct_delete_from_lists(struct nf_conn *ct);
@@ -267,11 +268,16 @@ extern void
267nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); 268nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data);
268extern void nf_conntrack_free(struct nf_conn *ct); 269extern void nf_conntrack_free(struct nf_conn *ct);
269extern struct nf_conn * 270extern struct nf_conn *
270nf_conntrack_alloc(struct net *net, 271nf_conntrack_alloc(struct net *net, u16 zone,
271 const struct nf_conntrack_tuple *orig, 272 const struct nf_conntrack_tuple *orig,
272 const struct nf_conntrack_tuple *repl, 273 const struct nf_conntrack_tuple *repl,
273 gfp_t gfp); 274 gfp_t gfp);
274 275
276static inline int nf_ct_is_template(const struct nf_conn *ct)
277{
278 return test_bit(IPS_TEMPLATE_BIT, &ct->status);
279}
280
275/* It's confirmed if it is, or has been in the hash table. */ 281/* It's confirmed if it is, or has been in the hash table. */
276static inline int nf_ct_is_confirmed(struct nf_conn *ct) 282static inline int nf_ct_is_confirmed(struct nf_conn *ct)
277{ 283{
@@ -293,11 +299,11 @@ extern unsigned int nf_conntrack_htable_size;
293extern unsigned int nf_conntrack_max; 299extern unsigned int nf_conntrack_max;
294 300
295#define NF_CT_STAT_INC(net, count) \ 301#define NF_CT_STAT_INC(net, count) \
296 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) 302 __this_cpu_inc((net)->ct.stat->count)
297#define NF_CT_STAT_INC_ATOMIC(net, count) \ 303#define NF_CT_STAT_INC_ATOMIC(net, count) \
298do { \ 304do { \
299 local_bh_disable(); \ 305 local_bh_disable(); \
300 per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \ 306 __this_cpu_inc((net)->ct.stat->count); \
301 local_bh_enable(); \ 307 local_bh_enable(); \
302} while (0) 308} while (0)
303 309
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 5a449b44ba33..dffde8e6920e 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -49,7 +49,8 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 49
50/* Find a connection corresponding to a tuple. */ 50/* Find a connection corresponding to a tuple. */
51extern struct nf_conntrack_tuple_hash * 51extern struct nf_conntrack_tuple_hash *
52nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); 52nf_conntrack_find_get(struct net *net, u16 zone,
53 const struct nf_conntrack_tuple *tuple);
53 54
54extern int __nf_conntrack_confirm(struct sk_buff *skb); 55extern int __nf_conntrack_confirm(struct sk_buff *skb);
55 56
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 4f20d58e2ab7..96ba5f7dcab6 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -12,28 +12,12 @@
12#include <linux/netfilter/nf_conntrack_tuple_common.h> 12#include <linux/netfilter/nf_conntrack_tuple_common.h>
13#include <net/netfilter/nf_conntrack_extend.h> 13#include <net/netfilter/nf_conntrack_extend.h>
14 14
15/* Connection tracking event types */
16enum ip_conntrack_events
17{
18 IPCT_NEW = 0, /* new conntrack */
19 IPCT_RELATED = 1, /* related conntrack */
20 IPCT_DESTROY = 2, /* destroyed conntrack */
21 IPCT_STATUS = 3, /* status has changed */
22 IPCT_PROTOINFO = 4, /* protocol information has changed */
23 IPCT_HELPER = 5, /* new helper has been set */
24 IPCT_MARK = 6, /* new mark has been set */
25 IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */
26 IPCT_SECMARK = 8, /* new security mark has been set */
27};
28
29enum ip_conntrack_expect_events {
30 IPEXP_NEW = 0, /* new expectation */
31};
32
33struct nf_conntrack_ecache { 15struct nf_conntrack_ecache {
34 unsigned long cache; /* bitops want long */ 16 unsigned long cache; /* bitops want long */
35 unsigned long missed; /* missed events */ 17 unsigned long missed; /* missed events */
36 u32 pid; /* netlink pid of destroyer */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 pid; /* netlink pid of destroyer */
37}; 21};
38 22
39static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
@@ -43,14 +27,24 @@ nf_ct_ecache_find(const struct nf_conn *ct)
43} 27}
44 28
45static inline struct nf_conntrack_ecache * 29static inline struct nf_conntrack_ecache *
46nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp) 30nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
47{ 31{
48 struct net *net = nf_ct_net(ct); 32 struct net *net = nf_ct_net(ct);
33 struct nf_conntrack_ecache *e;
49 34
50 if (!net->ct.sysctl_events) 35 if (!ctmask && !expmask && net->ct.sysctl_events) {
36 ctmask = ~0;
37 expmask = ~0;
38 }
39 if (!ctmask && !expmask)
51 return NULL; 40 return NULL;
52 41
53 return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); 42 e = nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp);
43 if (e) {
44 e->ctmask = ctmask;
45 e->expmask = expmask;
46 }
47 return e;
54}; 48};
55 49
56#ifdef CONFIG_NF_CONNTRACK_EVENTS 50#ifdef CONFIG_NF_CONNTRACK_EVENTS
@@ -83,6 +77,9 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
83 if (e == NULL) 77 if (e == NULL)
84 return; 78 return;
85 79
80 if (!(e->ctmask & (1 << event)))
81 return;
82
86 set_bit(event, &e->cache); 83 set_bit(event, &e->cache);
87} 84}
88 85
@@ -93,7 +90,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
93 int report) 90 int report)
94{ 91{
95 int ret = 0; 92 int ret = 0;
96 struct net *net = nf_ct_net(ct);
97 struct nf_ct_event_notifier *notify; 93 struct nf_ct_event_notifier *notify;
98 struct nf_conntrack_ecache *e; 94 struct nf_conntrack_ecache *e;
99 95
@@ -102,9 +98,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
102 if (notify == NULL) 98 if (notify == NULL)
103 goto out_unlock; 99 goto out_unlock;
104 100
105 if (!net->ct.sysctl_events)
106 goto out_unlock;
107
108 e = nf_ct_ecache_find(ct); 101 e = nf_ct_ecache_find(ct);
109 if (e == NULL) 102 if (e == NULL)
110 goto out_unlock; 103 goto out_unlock;
@@ -118,6 +111,9 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
118 /* This is a resent of a destroy event? If so, skip missed */ 111 /* This is a resent of a destroy event? If so, skip missed */
119 unsigned long missed = e->pid ? 0 : e->missed; 112 unsigned long missed = e->pid ? 0 : e->missed;
120 113
114 if (!((eventmask | missed) & e->ctmask))
115 goto out_unlock;
116
121 ret = notify->fcn(eventmask | missed, &item); 117 ret = notify->fcn(eventmask | missed, &item);
122 if (unlikely(ret < 0 || missed)) { 118 if (unlikely(ret < 0 || missed)) {
123 spin_lock_bh(&ct->lock); 119 spin_lock_bh(&ct->lock);
@@ -173,18 +169,19 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
173 u32 pid, 169 u32 pid,
174 int report) 170 int report)
175{ 171{
176 struct net *net = nf_ct_exp_net(exp);
177 struct nf_exp_event_notifier *notify; 172 struct nf_exp_event_notifier *notify;
173 struct nf_conntrack_ecache *e;
178 174
179 rcu_read_lock(); 175 rcu_read_lock();
180 notify = rcu_dereference(nf_expect_event_cb); 176 notify = rcu_dereference(nf_expect_event_cb);
181 if (notify == NULL) 177 if (notify == NULL)
182 goto out_unlock; 178 goto out_unlock;
183 179
184 if (!net->ct.sysctl_events) 180 e = nf_ct_ecache_find(exp->master);
181 if (e == NULL)
185 goto out_unlock; 182 goto out_unlock;
186 183
187 { 184 if (e->expmask & (1 << event)) {
188 struct nf_exp_event item = { 185 struct nf_exp_event item = {
189 .exp = exp, 186 .exp = exp,
190 .pid = pid, 187 .pid = pid,
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index a9652806d0df..11e815084fcf 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -9,8 +9,7 @@
9extern unsigned int nf_ct_expect_hsize; 9extern unsigned int nf_ct_expect_hsize;
10extern unsigned int nf_ct_expect_max; 10extern unsigned int nf_ct_expect_max;
11 11
12struct nf_conntrack_expect 12struct nf_conntrack_expect {
13{
14 /* Conntrack expectation list member */ 13 /* Conntrack expectation list member */
15 struct hlist_node lnode; 14 struct hlist_node lnode;
16 15
@@ -57,17 +56,13 @@ struct nf_conntrack_expect
57 56
58static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) 57static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
59{ 58{
60#ifdef CONFIG_NET_NS 59 return nf_ct_net(exp->master);
61 return exp->master->ct_net; /* by definition */
62#else
63 return &init_net;
64#endif
65} 60}
66 61
67struct nf_conntrack_expect_policy 62struct nf_conntrack_expect_policy {
68{
69 unsigned int max_expected; 63 unsigned int max_expected;
70 unsigned int timeout; 64 unsigned int timeout;
65 const char *name;
71}; 66};
72 67
73#define NF_CT_EXPECT_CLASS_DEFAULT 0 68#define NF_CT_EXPECT_CLASS_DEFAULT 0
@@ -79,13 +74,16 @@ int nf_conntrack_expect_init(struct net *net);
79void nf_conntrack_expect_fini(struct net *net); 74void nf_conntrack_expect_fini(struct net *net);
80 75
81struct nf_conntrack_expect * 76struct nf_conntrack_expect *
82__nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple); 77__nf_ct_expect_find(struct net *net, u16 zone,
78 const struct nf_conntrack_tuple *tuple);
83 79
84struct nf_conntrack_expect * 80struct nf_conntrack_expect *
85nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); 81nf_ct_expect_find_get(struct net *net, u16 zone,
82 const struct nf_conntrack_tuple *tuple);
86 83
87struct nf_conntrack_expect * 84struct nf_conntrack_expect *
88nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple); 85nf_ct_find_expectation(struct net *net, u16 zone,
86 const struct nf_conntrack_tuple *tuple);
89 87
90void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); 88void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
91void nf_ct_remove_expectations(struct nf_conn *ct); 89void nf_ct_remove_expectations(struct nf_conn *ct);
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 7f8fc5d123c5..32d15bd6efa3 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -1,14 +1,16 @@
1#ifndef _NF_CONNTRACK_EXTEND_H 1#ifndef _NF_CONNTRACK_EXTEND_H
2#define _NF_CONNTRACK_EXTEND_H 2#define _NF_CONNTRACK_EXTEND_H
3 3
4#include <linux/slab.h>
5
4#include <net/netfilter/nf_conntrack.h> 6#include <net/netfilter/nf_conntrack.h>
5 7
6enum nf_ct_ext_id 8enum nf_ct_ext_id {
7{
8 NF_CT_EXT_HELPER, 9 NF_CT_EXT_HELPER,
9 NF_CT_EXT_NAT, 10 NF_CT_EXT_NAT,
10 NF_CT_EXT_ACCT, 11 NF_CT_EXT_ACCT,
11 NF_CT_EXT_ECACHE, 12 NF_CT_EXT_ECACHE,
13 NF_CT_EXT_ZONE,
12 NF_CT_EXT_NUM, 14 NF_CT_EXT_NUM,
13}; 15};
14 16
@@ -16,6 +18,7 @@ enum nf_ct_ext_id
16#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 18#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
17#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 19#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
18#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 20#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
21#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
19 22
20/* Extensions: optional stuff which isn't permanently in struct. */ 23/* Extensions: optional stuff which isn't permanently in struct. */
21struct nf_ct_ext { 24struct nf_ct_ext {
@@ -65,8 +68,7 @@ __nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);
65 68
66#define NF_CT_EXT_F_PREALLOC 0x0001 69#define NF_CT_EXT_F_PREALLOC 0x0001
67 70
68struct nf_ct_ext_type 71struct nf_ct_ext_type {
69{
70 /* Destroys relationships (can be NULL). */ 72 /* Destroys relationships (can be NULL). */
71 void (*destroy)(struct nf_conn *ct); 73 void (*destroy)(struct nf_conn *ct);
72 /* Called when realloacted (can be NULL). 74 /* Called when realloacted (can be NULL).
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 1b7068000927..32c305dbdab6 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -16,8 +16,7 @@ struct module;
16 16
17#define NF_CT_HELPER_NAME_LEN 16 17#define NF_CT_HELPER_NAME_LEN 16
18 18
19struct nf_conntrack_helper 19struct nf_conntrack_helper {
20{
21 struct hlist_node hnode; /* Internal use. */ 20 struct hlist_node hnode; /* Internal use. */
22 21
23 const char *name; /* name of the module */ 22 const char *name; /* name of the module */
@@ -41,14 +40,18 @@ struct nf_conntrack_helper
41}; 40};
42 41
43extern struct nf_conntrack_helper * 42extern struct nf_conntrack_helper *
44__nf_conntrack_helper_find_byname(const char *name); 43__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum);
44
45extern struct nf_conntrack_helper *
46nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum);
45 47
46extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 48extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
47extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 49extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
48 50
49extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 51extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
50 52
51extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); 53extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
54 gfp_t flags);
52 55
53extern void nf_ct_helper_destroy(struct nf_conn *ct); 56extern void nf_ct_helper_destroy(struct nf_conn *ct);
54 57
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 9f99d36d5de9..a7547611e8f1 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -16,8 +16,7 @@
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include <net/netfilter/nf_conntrack.h> 17#include <net/netfilter/nf_conntrack.h>
18 18
19struct nf_conntrack_l3proto 19struct nf_conntrack_l3proto {
20{
21 /* L3 Protocol Family number. ex) PF_INET */ 20 /* L3 Protocol Family number. ex) PF_INET */
22 u_int16_t l3proto; 21 u_int16_t l3proto;
23 22
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 3767fb41e541..e3d3ee3c06a2 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -15,8 +15,7 @@
15 15
16struct seq_file; 16struct seq_file;
17 17
18struct nf_conntrack_l4proto 18struct nf_conntrack_l4proto {
19{
20 /* L3 Protocol number. */ 19 /* L3 Protocol number. */
21 u_int16_t l3proto; 20 u_int16_t l3proto;
22 21
@@ -50,8 +49,8 @@ struct nf_conntrack_l4proto
50 /* Called when a conntrack entry is destroyed */ 49 /* Called when a conntrack entry is destroyed */
51 void (*destroy)(struct nf_conn *ct); 50 void (*destroy)(struct nf_conn *ct);
52 51
53 int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, 52 int (*error)(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
54 enum ip_conntrack_info *ctinfo, 53 unsigned int dataoff, enum ip_conntrack_info *ctinfo,
55 u_int8_t pf, unsigned int hooknum); 54 u_int8_t pf, unsigned int hooknum);
56 55
57 /* Print out the per-protocol part of the tuple. Return like seq_* */ 56 /* Print out the per-protocol part of the tuple. Return like seq_* */
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 2628c154d40e..4ee44c84a304 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -26,8 +26,7 @@
26 26
27/* The protocol-specific manipulable parts of the tuple: always in 27/* The protocol-specific manipulable parts of the tuple: always in
28 network order! */ 28 network order! */
29union nf_conntrack_man_proto 29union nf_conntrack_man_proto {
30{
31 /* Add other protocols here. */ 30 /* Add other protocols here. */
32 __be16 all; 31 __be16 all;
33 32
@@ -52,8 +51,7 @@ union nf_conntrack_man_proto
52}; 51};
53 52
54/* The manipulable part of the tuple. */ 53/* The manipulable part of the tuple. */
55struct nf_conntrack_man 54struct nf_conntrack_man {
56{
57 union nf_inet_addr u3; 55 union nf_inet_addr u3;
58 union nf_conntrack_man_proto u; 56 union nf_conntrack_man_proto u;
59 /* Layer 3 protocol */ 57 /* Layer 3 protocol */
@@ -61,8 +59,7 @@ struct nf_conntrack_man
61}; 59};
62 60
63/* This contains the information to distinguish a connection. */ 61/* This contains the information to distinguish a connection. */
64struct nf_conntrack_tuple 62struct nf_conntrack_tuple {
65{
66 struct nf_conntrack_man src; 63 struct nf_conntrack_man src;
67 64
68 /* These are the parts of the tuple which are fixed. */ 65 /* These are the parts of the tuple which are fixed. */
@@ -100,8 +97,7 @@ struct nf_conntrack_tuple
100 } dst; 97 } dst;
101}; 98};
102 99
103struct nf_conntrack_tuple_mask 100struct nf_conntrack_tuple_mask {
104{
105 struct { 101 struct {
106 union nf_inet_addr u3; 102 union nf_inet_addr u3;
107 union nf_conntrack_man_proto u; 103 union nf_conntrack_man_proto u;
diff --git a/include/net/netfilter/nf_conntrack_zones.h b/include/net/netfilter/nf_conntrack_zones.h
new file mode 100644
index 000000000000..034efe8d45a5
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_zones.h
@@ -0,0 +1,25 @@
1#ifndef _NF_CONNTRACK_ZONES_H
2#define _NF_CONNTRACK_ZONES_H
3
4#define NF_CT_DEFAULT_ZONE 0
5
6#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
7#include <net/netfilter/nf_conntrack_extend.h>
8
9struct nf_conntrack_zone {
10 u16 id;
11};
12
13static inline u16 nf_ct_zone(const struct nf_conn *ct)
14{
15#ifdef CONFIG_NF_CONNTRACK_ZONES
16 struct nf_conntrack_zone *nf_ct_zone;
17 nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE);
18 if (nf_ct_zone)
19 return nf_ct_zone->id;
20#endif
21 return NF_CT_DEFAULT_ZONE;
22}
23
24#endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */
25#endif /* _NF_CONNTRACK_ZONES_H */
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 8df0b7f7fc6e..f5f09f032a90 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -5,8 +5,7 @@
5 5
6#define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16 6#define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7 7
8enum nf_nat_manip_type 8enum nf_nat_manip_type {
9{
10 IP_NAT_MANIP_SRC, 9 IP_NAT_MANIP_SRC,
11 IP_NAT_MANIP_DST 10 IP_NAT_MANIP_DST
12}; 11};
@@ -30,8 +29,7 @@ struct nf_nat_seq {
30}; 29};
31 30
32/* Single range specification. */ 31/* Single range specification. */
33struct nf_nat_range 32struct nf_nat_range {
34{
35 /* Set to OR of flags above. */ 33 /* Set to OR of flags above. */
36 unsigned int flags; 34 unsigned int flags;
37 35
@@ -43,8 +41,7 @@ struct nf_nat_range
43}; 41};
44 42
45/* For backwards compat: don't use in modern code. */ 43/* For backwards compat: don't use in modern code. */
46struct nf_nat_multi_range_compat 44struct nf_nat_multi_range_compat {
47{
48 unsigned int rangesize; /* Must be 1. */ 45 unsigned int rangesize; /* Must be 1. */
49 46
50 /* hangs off end. */ 47 /* hangs off end. */
@@ -57,8 +54,7 @@ struct nf_nat_multi_range_compat
57#include <net/netfilter/nf_conntrack_extend.h> 54#include <net/netfilter/nf_conntrack_extend.h>
58 55
59/* per conntrack: nat application helper private data */ 56/* per conntrack: nat application helper private data */
60union nf_conntrack_nat_help 57union nf_conntrack_nat_help {
61{
62 /* insert nat helper private data here */ 58 /* insert nat helper private data here */
63 struct nf_nat_pptp nat_pptp_info; 59 struct nf_nat_pptp nat_pptp_info;
64}; 60};
@@ -66,8 +62,7 @@ union nf_conntrack_nat_help
66struct nf_conn; 62struct nf_conn;
67 63
68/* The structure embedded in the conntrack structure. */ 64/* The structure embedded in the conntrack structure. */
69struct nf_conn_nat 65struct nf_conn_nat {
70{
71 struct hlist_node bysource; 66 struct hlist_node bysource;
72 struct nf_nat_seq seq[IP_CT_DIR_MAX]; 67 struct nf_nat_seq seq[IP_CT_DIR_MAX];
73 struct nf_conn *ct; 68 struct nf_conn *ct;
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 4222220920a5..02bb6c29dc3d 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,13 +7,27 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11 struct nf_conn *ct, 11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo, 12 enum ip_conntrack_info ctinfo,
13 unsigned int match_offset, 13 unsigned int match_offset,
14 unsigned int match_len, 14 unsigned int match_len,
15 const char *rep_buffer, 15 const char *rep_buffer,
16 unsigned int rep_len); 16 unsigned int rep_len, bool adjust);
17
18static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
19 struct nf_conn *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len)
25{
26 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
27 match_offset, match_len,
28 rep_buffer, rep_len, true);
29}
30
17extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 31extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
18 struct nf_conn *ct, 32 struct nf_conn *ct,
19 enum ip_conntrack_info ctinfo, 33 enum ip_conntrack_info ctinfo,
@@ -21,6 +35,10 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
21 unsigned int match_len, 35 unsigned int match_len,
22 const char *rep_buffer, 36 const char *rep_buffer,
23 unsigned int rep_len); 37 unsigned int rep_len);
38
39extern void nf_nat_set_seq_adjust(struct nf_conn *ct,
40 enum ip_conntrack_info ctinfo,
41 __be32 seq, s16 off);
24extern int nf_nat_seq_adjust(struct sk_buff *skb, 42extern int nf_nat_seq_adjust(struct sk_buff *skb,
25 struct nf_conn *ct, 43 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo); 44 enum ip_conntrack_info ctinfo);
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
index f3662c4394ef..c398017ccfa3 100644
--- a/include/net/netfilter/nf_nat_protocol.h
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -6,8 +6,7 @@
6 6
7struct nf_nat_range; 7struct nf_nat_range;
8 8
9struct nf_nat_protocol 9struct nf_nat_protocol {
10{
11 /* Protocol number. */ 10 /* Protocol number. */
12 unsigned int protonum; 11 unsigned int protonum;
13 12
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 60ebbc1fef46..9db401a8b4d9 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -31,6 +31,7 @@
31#define _NETLABEL_H 31#define _NETLABEL_H
32 32
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/slab.h>
34#include <linux/net.h> 35#include <linux/net.h>
35#include <linux/skbuff.h> 36#include <linux/skbuff.h>
36#include <linux/in.h> 37#include <linux/in.h>
diff --git a/include/net/netlink.h b/include/net/netlink.h
index a63b2192ac1c..4fc05b58503e 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -196,7 +196,7 @@ enum {
196 * All other Exact length of attribute payload 196 * All other Exact length of attribute payload
197 * 197 *
198 * Example: 198 * Example:
199 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 199 * static const struct nla_policy my_policy[ATTR_MAX+1] = {
200 * [ATTR_FOO] = { .type = NLA_U16 }, 200 * [ATTR_FOO] = { .type = NLA_U16 },
201 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, 201 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
202 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 202 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
@@ -945,7 +945,11 @@ static inline u64 nla_get_u64(const struct nlattr *nla)
945 */ 945 */
946static inline __be64 nla_get_be64(const struct nlattr *nla) 946static inline __be64 nla_get_be64(const struct nlattr *nla)
947{ 947{
948 return *(__be64 *) nla_data(nla); 948 __be64 tmp;
949
950 nla_memcpy(&tmp, nla, sizeof(tmp));
951
952 return tmp;
949} 953}
950 954
951/** 955/**
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index ba1ba0c5efd1..d4958d4c6574 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -11,11 +11,13 @@ struct nf_conntrack_ecache;
11struct netns_ct { 11struct netns_ct {
12 atomic_t count; 12 atomic_t count;
13 unsigned int expect_count; 13 unsigned int expect_count;
14 unsigned int htable_size;
15 struct kmem_cache *nf_conntrack_cachep;
14 struct hlist_nulls_head *hash; 16 struct hlist_nulls_head *hash;
15 struct hlist_head *expect_hash; 17 struct hlist_head *expect_hash;
16 struct hlist_nulls_head unconfirmed; 18 struct hlist_nulls_head unconfirmed;
17 struct hlist_nulls_head dying; 19 struct hlist_nulls_head dying;
18 struct ip_conntrack_stat *stat; 20 struct ip_conntrack_stat __percpu *stat;
19 int sysctl_events; 21 int sysctl_events;
20 unsigned int sysctl_events_retry_timeout; 22 unsigned int sysctl_events_retry_timeout;
21 int sysctl_acct; 23 int sysctl_acct;
@@ -28,5 +30,6 @@ struct netns_ct {
28#endif 30#endif
29 int hash_vmalloc; 31 int hash_vmalloc;
30 int expect_vmalloc; 32 int expect_vmalloc;
33 char *slabname;
31}; 34};
32#endif 35#endif
diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 24d4be76bbd1..78eb1ff75475 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -10,7 +10,7 @@ struct netns_core {
10 10
11 int sysctl_somaxconn; 11 int sysctl_somaxconn;
12 12
13 struct prot_inuse *inuse; 13 struct prot_inuse __percpu *inuse;
14}; 14};
15 15
16#endif 16#endif
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 0c04fd2a700b..ff4982ab84b6 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -12,9 +12,11 @@
12 * stuff on the struct net without explicit struct net modification 12 * stuff on the struct net without explicit struct net modification
13 * 13 *
14 * The rules are simple: 14 * The rules are simple:
15 * 1. register the ops with register_pernet_gen_device to get the id 15 * 1. set pernet_operations->id. After register_pernet_device you
16 * of your private pointer; 16 * will have the id of your private pointer.
17 * 2. call net_assign_generic() to put the private data on the struct 17 * 2. Either set pernet_operations->size (to have the code allocate and
18 * free a private structure pointed to from struct net ) or
19 * call net_assign_generic() to put the private data on the struct
18 * net (most preferably this should be done in the ->init callback 20 * net (most preferably this should be done in the ->init callback
19 * of the ops registered); 21 * of the ops registered);
20 * 3. do not change this pointer while the net is alive; 22 * 3. do not change this pointer while the net is alive;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2eb3814d6258..2764994c9136 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -37,9 +37,12 @@ struct netns_ipv4 {
37 struct xt_table *iptable_mangle; 37 struct xt_table *iptable_mangle;
38 struct xt_table *iptable_raw; 38 struct xt_table *iptable_raw;
39 struct xt_table *arptable_filter; 39 struct xt_table *arptable_filter;
40#ifdef CONFIG_SECURITY
40 struct xt_table *iptable_security; 41 struct xt_table *iptable_security;
42#endif
41 struct xt_table *nat_table; 43 struct xt_table *nat_table;
42 struct hlist_head *nat_bysource; 44 struct hlist_head *nat_bysource;
45 unsigned int nat_htable_size;
43 int nat_vmalloced; 46 int nat_vmalloced;
44#endif 47#endif
45 48
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index dfeb2d7c425b..1f11ebc22151 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -36,8 +36,10 @@ struct netns_ipv6 {
36 struct xt_table *ip6table_filter; 36 struct xt_table *ip6table_filter;
37 struct xt_table *ip6table_mangle; 37 struct xt_table *ip6table_mangle;
38 struct xt_table *ip6table_raw; 38 struct xt_table *ip6table_raw;
39#ifdef CONFIG_SECURITY
39 struct xt_table *ip6table_security; 40 struct xt_table *ip6table_security;
40#endif 41#endif
42#endif
41 struct rt6_info *ip6_null_entry; 43 struct rt6_info *ip6_null_entry;
42 struct rt6_statistics *rt6_stats; 44 struct rt6_statistics *rt6_stats;
43 struct timer_list ip6_fib_timer; 45 struct timer_list ip6_fib_timer;
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index 637daf698884..cb4e894c0f8d 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -4,11 +4,11 @@
4#ifndef __NETNS_PACKET_H__ 4#ifndef __NETNS_PACKET_H__
5#define __NETNS_PACKET_H__ 5#define __NETNS_PACKET_H__
6 6
7#include <linux/list.h> 7#include <linux/rculist.h>
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9 9
10struct netns_packet { 10struct netns_packet {
11 rwlock_t sklist_lock; 11 spinlock_t sklist_lock;
12 struct hlist_head sklist; 12 struct hlist_head sklist;
13}; 13};
14 14
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 1ba912749caa..74f119a2829a 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -5,6 +5,7 @@
5#include <linux/wait.h> 5#include <linux/wait.h>
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7#include <linux/xfrm.h> 7#include <linux/xfrm.h>
8#include <net/dst_ops.h>
8 9
9struct ctl_table_header; 10struct ctl_table_header;
10 11
@@ -42,7 +43,13 @@ struct netns_xfrm {
42 unsigned int policy_count[XFRM_POLICY_MAX * 2]; 43 unsigned int policy_count[XFRM_POLICY_MAX * 2];
43 struct work_struct policy_hash_work; 44 struct work_struct policy_hash_work;
44 45
46 struct dst_ops xfrm4_dst_ops;
47#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
48 struct dst_ops xfrm6_dst_ops;
49#endif
50
45 struct sock *nlsk; 51 struct sock *nlsk;
52 struct sock *nlsk_stash;
46 53
47 u32 sysctl_aevent_etime; 54 u32 sysctl_aevent_etime;
48 u32 sysctl_aevent_rseqth; 55 u32 sysctl_aevent_rseqth;
diff --git a/include/net/netrom.h b/include/net/netrom.h
index 15696b1fd30f..f0793c1cb5f8 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/netrom.h> 10#include <linux/netrom.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/slab.h>
12#include <net/sock.h> 13#include <net/sock.h>
13 14
14#define NR_NETWORK_LEN 15 15#define NR_NETWORK_LEN 15
@@ -132,6 +133,8 @@ static __inline__ void nr_node_put(struct nr_node *nr_node)
132static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh) 133static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh)
133{ 134{
134 if (atomic_dec_and_test(&nr_neigh->refcount)) { 135 if (atomic_dec_and_test(&nr_neigh->refcount)) {
136 if (nr_neigh->ax25)
137 ax25_cb_put(nr_neigh->ax25);
135 kfree(nr_neigh->digipeat); 138 kfree(nr_neigh->digipeat);
136 kfree(nr_neigh); 139 kfree(nr_neigh);
137 } 140 }
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index 4c61cdce4e5f..35672b1cf44a 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -44,6 +44,7 @@ struct pep_sock {
44 u8 rx_fc; /* RX flow control */ 44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */ 45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 46 u8 init_enable; /* auto-enable at creation */
47 u8 aligned;
47}; 48};
48 49
49static inline struct pep_sock *pep_sk(struct sock *sk) 50static inline struct pep_sock *pep_sk(struct sock *sk)
@@ -77,6 +78,7 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
77 78
78enum { 79enum {
79 PNS_PIPE_DATA = 0x20, 80 PNS_PIPE_DATA = 0x20,
81 PNS_PIPE_ALIGNED_DATA,
80 82
81 PNS_PEP_CONNECT_REQ = 0x40, 83 PNS_PEP_CONNECT_REQ = 0x40,
82 PNS_PEP_CONNECT_RESP, 84 PNS_PEP_CONNECT_RESP,
@@ -138,6 +140,7 @@ enum {
138 PN_PIPE_SB_NEGOTIATED_FC, 140 PN_PIPE_SB_NEGOTIATED_FC,
139 PN_PIPE_SB_REQUIRED_FC_TX, 141 PN_PIPE_SB_REQUIRED_FC_TX,
140 PN_PIPE_SB_PREFERRED_FC_RX, 142 PN_PIPE_SB_PREFERRED_FC_RX,
143 PN_PIPE_SB_ALIGNED_DATA,
141}; 144};
142 145
143/* Phonet pipe flow control models */ 146/* Phonet pipe flow control models */
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index d43f71b5ec00..7b114079a51b 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -46,7 +46,9 @@ static inline struct pn_sock *pn_sk(struct sock *sk)
46 46
47extern const struct proto_ops phonet_dgram_ops; 47extern const struct proto_ops phonet_dgram_ops;
48 48
49void pn_sock_init(void);
49struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa); 50struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
51void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb);
50void phonet_get_local_port_range(int *min, int *max); 52void phonet_get_local_port_range(int *min, int *max);
51void pn_sock_hash(struct sock *sk); 53void pn_sock_hash(struct sock *sk);
52void pn_sock_unhash(struct sock *sk); 54void pn_sock_unhash(struct sock *sk);
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index 44c923c9e21d..d7b989ca3d63 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -25,7 +25,7 @@
25 25
26struct phonet_device_list { 26struct phonet_device_list {
27 struct list_head list; 27 struct list_head list;
28 spinlock_t lock; 28 struct mutex lock;
29}; 29};
30 30
31struct phonet_device_list *phonet_device_list(struct net *net); 31struct phonet_device_list *phonet_device_list(struct net *net);
@@ -47,6 +47,12 @@ u8 phonet_address_get(struct net_device *dev, u8 addr);
47int phonet_address_lookup(struct net *net, u8 addr); 47int phonet_address_lookup(struct net *net, u8 addr);
48void phonet_address_notify(int event, struct net_device *dev, u8 addr); 48void phonet_address_notify(int event, struct net_device *dev, u8 addr);
49 49
50int phonet_route_add(struct net_device *dev, u8 daddr);
51int phonet_route_del(struct net_device *dev, u8 daddr);
52void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
53struct net_device *phonet_route_get(struct net *net, u8 daddr);
54struct net_device *phonet_route_output(struct net *net, u8 daddr);
55
50#define PN_NO_ADDR 0xff 56#define PN_NO_ADDR 0xff
51 57
52extern const struct file_operations pn_sock_seq_fops; 58extern const struct file_operations pn_sock_seq_fops;
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index d1ca31444644..dd3031aed9d5 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -7,8 +7,7 @@
7 7
8/* Basic packet classifier frontend definitions. */ 8/* Basic packet classifier frontend definitions. */
9 9
10struct tcf_walker 10struct tcf_walker {
11{
12 int stop; 11 int stop;
13 int skip; 12 int skip;
14 int count; 13 int count;
@@ -61,8 +60,7 @@ tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r)
61 tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); 60 tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
62} 61}
63 62
64struct tcf_exts 63struct tcf_exts {
65{
66#ifdef CONFIG_NET_CLS_ACT 64#ifdef CONFIG_NET_CLS_ACT
67 struct tc_action *action; 65 struct tc_action *action;
68#endif 66#endif
@@ -71,8 +69,7 @@ struct tcf_exts
71/* Map to export classifier specific extension TLV types to the 69/* Map to export classifier specific extension TLV types to the
72 * generic extensions API. Unsupported extensions must be set to 0. 70 * generic extensions API. Unsupported extensions must be set to 0.
73 */ 71 */
74struct tcf_ext_map 72struct tcf_ext_map {
75{
76 int action; 73 int action;
77 int police; 74 int police;
78}; 75};
@@ -143,8 +140,7 @@ extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
143/** 140/**
144 * struct tcf_pkt_info - packet information 141 * struct tcf_pkt_info - packet information
145 */ 142 */
146struct tcf_pkt_info 143struct tcf_pkt_info {
147{
148 unsigned char * ptr; 144 unsigned char * ptr;
149 int nexthdr; 145 int nexthdr;
150}; 146};
@@ -162,8 +158,7 @@ struct tcf_ematch_ops;
162 * @datalen: length of the ematch specific configuration data 158 * @datalen: length of the ematch specific configuration data
163 * @data: ematch specific data 159 * @data: ematch specific data
164 */ 160 */
165struct tcf_ematch 161struct tcf_ematch {
166{
167 struct tcf_ematch_ops * ops; 162 struct tcf_ematch_ops * ops;
168 unsigned long data; 163 unsigned long data;
169 unsigned int datalen; 164 unsigned int datalen;
@@ -211,8 +206,7 @@ static inline int tcf_em_early_end(struct tcf_ematch *em, int result)
211 * @hdr: ematch tree header supplied by userspace 206 * @hdr: ematch tree header supplied by userspace
212 * @matches: array of ematches 207 * @matches: array of ematches
213 */ 208 */
214struct tcf_ematch_tree 209struct tcf_ematch_tree {
215{
216 struct tcf_ematch_tree_hdr hdr; 210 struct tcf_ematch_tree_hdr hdr;
217 struct tcf_ematch * matches; 211 struct tcf_ematch * matches;
218 212
@@ -230,8 +224,7 @@ struct tcf_ematch_tree
230 * @owner: owner, must be set to THIS_MODULE 224 * @owner: owner, must be set to THIS_MODULE
231 * @link: link to previous/next ematch module (internal use) 225 * @link: link to previous/next ematch module (internal use)
232 */ 226 */
233struct tcf_ematch_ops 227struct tcf_ematch_ops {
234{
235 int kind; 228 int kind;
236 int datalen; 229 int datalen;
237 int (*change)(struct tcf_proto *, void *, 230 int (*change)(struct tcf_proto *, void *,
@@ -302,8 +295,7 @@ static inline int tcf_em_tree_match(struct sk_buff *skb,
302 295
303#else /* CONFIG_NET_EMATCH */ 296#else /* CONFIG_NET_EMATCH */
304 297
305struct tcf_ematch_tree 298struct tcf_ematch_tree {
306{
307}; 299};
308 300
309#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0) 301#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
@@ -351,9 +343,9 @@ tcf_match_indev(struct sk_buff *skb, char *indev)
351 struct net_device *dev; 343 struct net_device *dev;
352 344
353 if (indev[0]) { 345 if (indev[0]) {
354 if (!skb->iif) 346 if (!skb->skb_iif)
355 return 0; 347 return 0;
356 dev = __dev_get_by_index(dev_net(skb->dev), skb->iif); 348 dev = __dev_get_by_index(dev_net(skb->dev), skb->skb_iif);
357 if (!dev || strcmp(indev, dev->name)) 349 if (!dev || strcmp(indev, dev->name))
358 return 0; 350 return 0;
359 } 351 }
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index f911ec7598ef..b6cdc33b39c1 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -5,8 +5,7 @@
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <net/sch_generic.h> 6#include <net/sch_generic.h>
7 7
8struct qdisc_walker 8struct qdisc_walker {
9{
10 int stop; 9 int stop;
11 int skip; 10 int skip;
12 int count; 11 int count;
@@ -72,6 +71,7 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
72 71
73extern struct Qdisc_ops pfifo_qdisc_ops; 72extern struct Qdisc_ops pfifo_qdisc_ops;
74extern struct Qdisc_ops bfifo_qdisc_ops; 73extern struct Qdisc_ops bfifo_qdisc_ops;
74extern struct Qdisc_ops pfifo_head_drop_qdisc_ops;
75 75
76extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); 76extern int fifo_set_limit(struct Qdisc *q, unsigned int limit);
77extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, 77extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 60249e51b669..f1effdd3c265 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -47,8 +47,7 @@ struct net_protocol {
47}; 47};
48 48
49#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 49#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
50struct inet6_protocol 50struct inet6_protocol {
51{
52 int (*handler)(struct sk_buff *skb); 51 int (*handler)(struct sk_buff *skb);
53 52
54 void (*err_handler)(struct sk_buff *skb, 53 void (*err_handler)(struct sk_buff *skb,
@@ -83,10 +82,6 @@ struct inet_protosw {
83 struct proto *prot; 82 struct proto *prot;
84 const struct proto_ops *ops; 83 const struct proto_ops *ops;
85 84
86 int capability; /* Which (if any) capability do
87 * we need to use this socket
88 * interface?
89 */
90 char no_check; /* checksum on rcv/xmit/none? */ 85 char no_check; /* checksum on rcv/xmit/none? */
91 unsigned char flags; /* See INET_PROTOSW_* below. */ 86 unsigned char flags; /* See INET_PROTOSW_* below. */
92}; 87};
diff --git a/include/net/red.h b/include/net/red.h
index 3cf31d466a81..995108e54d9f 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -90,8 +90,7 @@
90#define RED_STAB_SIZE 256 90#define RED_STAB_SIZE 256
91#define RED_STAB_MASK (RED_STAB_SIZE - 1) 91#define RED_STAB_MASK (RED_STAB_SIZE - 1)
92 92
93struct red_stats 93struct red_stats {
94{
95 u32 prob_drop; /* Early probability drops */ 94 u32 prob_drop; /* Early probability drops */
96 u32 prob_mark; /* Early probability marks */ 95 u32 prob_mark; /* Early probability marks */
97 u32 forced_drop; /* Forced drops, qavg > max_thresh */ 96 u32 forced_drop; /* Forced drops, qavg > max_thresh */
@@ -101,8 +100,7 @@ struct red_stats
101 u32 backlog; 100 u32 backlog;
102}; 101};
103 102
104struct red_parms 103struct red_parms {
105{
106 /* Parameters */ 104 /* Parameters */
107 u32 qth_min; /* Min avg length threshold: A scaled */ 105 u32 qth_min; /* Min avg length threshold: A scaled */
108 u32 qth_max; /* Max avg length threshold: A scaled */ 106 u32 qth_max; /* Max avg length threshold: A scaled */
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 47995b81c5d7..f873ee37f7e4 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -39,6 +39,7 @@ enum environment_cap {
39 * 00 - World regulatory domain 39 * 00 - World regulatory domain
40 * 99 - built by driver but a specific alpha2 cannot be determined 40 * 99 - built by driver but a specific alpha2 cannot be determined
41 * 98 - result of an intersection between two regulatory domains 41 * 98 - result of an intersection between two regulatory domains
42 * 97 - regulatory domain has not yet been configured
42 * @intersect: indicates whether the wireless core should intersect 43 * @intersect: indicates whether the wireless core should intersect
43 * the requested regulatory domain with the presently set regulatory 44 * the requested regulatory domain with the presently set regulatory
44 * domain. 45 * domain.
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index c7190846e128..99e6e19b57c2 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -27,18 +27,26 @@ struct sk_buff;
27struct dst_entry; 27struct dst_entry;
28struct proto; 28struct proto;
29 29
30/* empty to "strongly type" an otherwise void parameter.
31 */
32struct request_values {
33};
34
30struct request_sock_ops { 35struct request_sock_ops {
31 int family; 36 int family;
32 int obj_size; 37 int obj_size;
33 struct kmem_cache *slab; 38 struct kmem_cache *slab;
34 char *slab_name; 39 char *slab_name;
35 int (*rtx_syn_ack)(struct sock *sk, 40 int (*rtx_syn_ack)(struct sock *sk,
36 struct request_sock *req); 41 struct request_sock *req,
42 struct request_values *rvp);
37 void (*send_ack)(struct sock *sk, struct sk_buff *skb, 43 void (*send_ack)(struct sock *sk, struct sk_buff *skb,
38 struct request_sock *req); 44 struct request_sock *req);
39 void (*send_reset)(struct sock *sk, 45 void (*send_reset)(struct sock *sk,
40 struct sk_buff *skb); 46 struct sk_buff *skb);
41 void (*destructor)(struct request_sock *req); 47 void (*destructor)(struct request_sock *req);
48 void (*syn_ack_timeout)(struct sock *sk,
49 struct request_sock *req);
42}; 50};
43 51
44/* struct request_sock - mini sock to represent a connection request 52/* struct request_sock - mini sock to represent a connection request
diff --git a/include/net/route.h b/include/net/route.h
index 40f6346ef496..2c9fba7f7731 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -49,10 +49,8 @@
49 49
50struct fib_nh; 50struct fib_nh;
51struct inet_peer; 51struct inet_peer;
52struct rtable 52struct rtable {
53{ 53 union {
54 union
55 {
56 struct dst_entry dst; 54 struct dst_entry dst;
57 } u; 55 } u;
58 56
@@ -77,16 +75,14 @@ struct rtable
77 struct inet_peer *peer; /* long-living peer info */ 75 struct inet_peer *peer; /* long-living peer info */
78}; 76};
79 77
80struct ip_rt_acct 78struct ip_rt_acct {
81{
82 __u32 o_bytes; 79 __u32 o_bytes;
83 __u32 o_packets; 80 __u32 o_packets;
84 __u32 i_bytes; 81 __u32 i_bytes;
85 __u32 i_packets; 82 __u32 i_packets;
86}; 83};
87 84
88struct rt_cache_stat 85struct rt_cache_stat {
89{
90 unsigned int in_hit; 86 unsigned int in_hit;
91 unsigned int in_slow_tot; 87 unsigned int in_slow_tot;
92 unsigned int in_slow_mc; 88 unsigned int in_slow_mc;
@@ -105,13 +101,14 @@ struct rt_cache_stat
105 unsigned int out_hlist_search; 101 unsigned int out_hlist_search;
106}; 102};
107 103
108extern struct ip_rt_acct *ip_rt_acct; 104extern struct ip_rt_acct __percpu *ip_rt_acct;
109 105
110struct in_device; 106struct in_device;
111extern int ip_rt_init(void); 107extern int ip_rt_init(void);
112extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, 108extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
113 __be32 src, struct net_device *dev); 109 __be32 src, struct net_device *dev);
114extern void rt_cache_flush(struct net *net, int how); 110extern void rt_cache_flush(struct net *net, int how);
111extern void rt_cache_flush_batch(void);
115extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
116extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
117extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index c3aa044d3fc3..af60fd050844 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -55,13 +55,15 @@ struct rtnl_link_ops {
55 int (*validate)(struct nlattr *tb[], 55 int (*validate)(struct nlattr *tb[],
56 struct nlattr *data[]); 56 struct nlattr *data[]);
57 57
58 int (*newlink)(struct net_device *dev, 58 int (*newlink)(struct net *src_net,
59 struct net_device *dev,
59 struct nlattr *tb[], 60 struct nlattr *tb[],
60 struct nlattr *data[]); 61 struct nlattr *data[]);
61 int (*changelink)(struct net_device *dev, 62 int (*changelink)(struct net_device *dev,
62 struct nlattr *tb[], 63 struct nlattr *tb[],
63 struct nlattr *data[]); 64 struct nlattr *data[]);
64 void (*dellink)(struct net_device *dev); 65 void (*dellink)(struct net_device *dev,
66 struct list_head *head);
65 67
66 size_t (*get_size)(const struct net_device *dev); 68 size_t (*get_size)(const struct net_device *dev);
67 int (*fill_info)(struct sk_buff *skb, 69 int (*fill_info)(struct sk_buff *skb,
@@ -82,8 +84,11 @@ extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops);
82extern int rtnl_link_register(struct rtnl_link_ops *ops); 84extern int rtnl_link_register(struct rtnl_link_ops *ops);
83extern void rtnl_link_unregister(struct rtnl_link_ops *ops); 85extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
84 86
85extern struct net_device *rtnl_create_link(struct net *net, char *ifname, 87extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
86 const struct rtnl_link_ops *ops, struct nlattr *tb[]); 88extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
89 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
90extern int rtnl_configure_link(struct net_device *dev,
91 const struct ifinfomsg *ifm);
87extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 92extern const struct nla_policy ifla_policy[IFLA_MAX+1];
88 93
89#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 94#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c33180dd42b4..67dc08eaaa45 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -15,16 +15,14 @@ struct qdisc_walker;
15struct tcf_walker; 15struct tcf_walker;
16struct module; 16struct module;
17 17
18struct qdisc_rate_table 18struct qdisc_rate_table {
19{
20 struct tc_ratespec rate; 19 struct tc_ratespec rate;
21 u32 data[256]; 20 u32 data[256];
22 struct qdisc_rate_table *next; 21 struct qdisc_rate_table *next;
23 int refcnt; 22 int refcnt;
24}; 23};
25 24
26enum qdisc_state_t 25enum qdisc_state_t {
27{
28 __QDISC_STATE_RUNNING, 26 __QDISC_STATE_RUNNING,
29 __QDISC_STATE_SCHED, 27 __QDISC_STATE_SCHED,
30 __QDISC_STATE_DEACTIVATED, 28 __QDISC_STATE_DEACTIVATED,
@@ -37,8 +35,7 @@ struct qdisc_size_table {
37 u16 data[]; 35 u16 data[];
38}; 36};
39 37
40struct Qdisc 38struct Qdisc {
41{
42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); 39 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
43 struct sk_buff * (*dequeue)(struct Qdisc *dev); 40 struct sk_buff * (*dequeue)(struct Qdisc *dev);
44 unsigned flags; 41 unsigned flags;
@@ -78,8 +75,7 @@ struct Qdisc
78 struct gnet_stats_queue qstats; 75 struct gnet_stats_queue qstats;
79}; 76};
80 77
81struct Qdisc_class_ops 78struct Qdisc_class_ops {
82{
83 /* Child qdisc manipulation */ 79 /* Child qdisc manipulation */
84 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); 80 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
85 int (*graft)(struct Qdisc *, unsigned long cl, 81 int (*graft)(struct Qdisc *, unsigned long cl,
@@ -108,8 +104,7 @@ struct Qdisc_class_ops
108 struct gnet_dump *); 104 struct gnet_dump *);
109}; 105};
110 106
111struct Qdisc_ops 107struct Qdisc_ops {
112{
113 struct Qdisc_ops *next; 108 struct Qdisc_ops *next;
114 const struct Qdisc_class_ops *cl_ops; 109 const struct Qdisc_class_ops *cl_ops;
115 char id[IFNAMSIZ]; 110 char id[IFNAMSIZ];
@@ -133,14 +128,12 @@ struct Qdisc_ops
133}; 128};
134 129
135 130
136struct tcf_result 131struct tcf_result {
137{
138 unsigned long class; 132 unsigned long class;
139 u32 classid; 133 u32 classid;
140}; 134};
141 135
142struct tcf_proto_ops 136struct tcf_proto_ops {
143{
144 struct tcf_proto_ops *next; 137 struct tcf_proto_ops *next;
145 char kind[IFNAMSIZ]; 138 char kind[IFNAMSIZ];
146 139
@@ -164,8 +157,7 @@ struct tcf_proto_ops
164 struct module *owner; 157 struct module *owner;
165}; 158};
166 159
167struct tcf_proto 160struct tcf_proto {
168{
169 /* Fast access part */ 161 /* Fast access part */
170 struct tcf_proto *next; 162 struct tcf_proto *next;
171 void *root; 163 void *root;
@@ -261,14 +253,12 @@ extern struct Qdisc_ops noop_qdisc_ops;
261extern struct Qdisc_ops pfifo_fast_ops; 253extern struct Qdisc_ops pfifo_fast_ops;
262extern struct Qdisc_ops mq_qdisc_ops; 254extern struct Qdisc_ops mq_qdisc_ops;
263 255
264struct Qdisc_class_common 256struct Qdisc_class_common {
265{
266 u32 classid; 257 u32 classid;
267 struct hlist_node hnode; 258 struct hlist_node hnode;
268}; 259};
269 260
270struct Qdisc_class_hash 261struct Qdisc_class_hash {
271{
272 struct hlist_head *hash; 262 struct hlist_head *hash;
273 unsigned int hashsize; 263 unsigned int hashsize;
274 unsigned int hashmask; 264 unsigned int hashmask;
@@ -437,6 +427,25 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
437 return __qdisc_dequeue_head(sch, &sch->q); 427 return __qdisc_dequeue_head(sch, &sch->q);
438} 428}
439 429
430static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
431 struct sk_buff_head *list)
432{
433 struct sk_buff *skb = __qdisc_dequeue_head(sch, list);
434
435 if (likely(skb != NULL)) {
436 unsigned int len = qdisc_pkt_len(skb);
437 kfree_skb(skb);
438 return len;
439 }
440
441 return 0;
442}
443
444static inline unsigned int qdisc_queue_drop_head(struct Qdisc *sch)
445{
446 return __qdisc_queue_drop_head(sch, &sch->q);
447}
448
440static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, 449static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
441 struct sk_buff_head *list) 450 struct sk_buff_head *list)
442{ 451{
diff --git a/include/net/scm.h b/include/net/scm.h
index cf48c800e926..8360e47aa7e3 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -12,15 +12,13 @@
12 */ 12 */
13#define SCM_MAX_FD 255 13#define SCM_MAX_FD 255
14 14
15struct scm_fp_list 15struct scm_fp_list {
16{
17 struct list_head list; 16 struct list_head list;
18 int count; 17 int count;
19 struct file *fp[SCM_MAX_FD]; 18 struct file *fp[SCM_MAX_FD];
20}; 19};
21 20
22struct scm_cookie 21struct scm_cookie {
23{
24 struct ucred creds; /* Skb credentials */ 22 struct ucred creds; /* Skb credentials */
25 struct scm_fp_list *fp; /* Passed files */ 23 struct scm_fp_list *fp; /* Passed files */
26#ifdef CONFIG_SECURITY_NETWORK 24#ifdef CONFIG_SECURITY_NETWORK
@@ -88,8 +86,7 @@ static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct sc
88static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, 86static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
89 struct scm_cookie *scm, int flags) 87 struct scm_cookie *scm, int flags)
90{ 88{
91 if (!msg->msg_control) 89 if (!msg->msg_control) {
92 {
93 if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp) 90 if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp)
94 msg->msg_flags |= MSG_CTRUNC; 91 msg->msg_flags |= MSG_CTRUNC;
95 scm_destroy(scm); 92 scm_destroy(scm);
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 8be5135ff7aa..2c55a7ea20af 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -107,6 +107,7 @@ typedef enum {
107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ 107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ 108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
109 SCTP_CMD_SEND_MSG, /* Send the whole use message */ 109 SCTP_CMD_SEND_MSG, /* Send the whole use message */
110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
110 SCTP_CMD_LAST 111 SCTP_CMD_LAST
111} sctp_verb_t; 112} sctp_verb_t;
112 113
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 58f714a3b670..63908840eef0 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -308,6 +308,10 @@ enum { SCTP_MAX_GABS = 16 };
308 308
309#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ 309#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */
310#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ 310#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */
311#define SCTP_DEFAULT_RWND_SHIFT 4 /* by default, update on 1/16 of
312 * rcvbuf, which is 1/8 of initial
313 * window
314 */
311#define SCTP_DEFAULT_MAXSEGMENT 1500 /* MTU size, this is the limit 315#define SCTP_DEFAULT_MAXSEGMENT 1500 /* MTU size, this is the limit
312 * to which we will raise the P-MTU. 316 * to which we will raise the P-MTU.
313 */ 317 */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 8a6d5297de16..fa6cde578a1d 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
128int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 128int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
129int sctp_inet_listen(struct socket *sock, int backlog); 129int sctp_inet_listen(struct socket *sock, int backlog);
130void sctp_write_space(struct sock *sk); 130void sctp_write_space(struct sock *sk);
131void sctp_data_ready(struct sock *sk, int len);
131unsigned int sctp_poll(struct file *file, struct socket *sock, 132unsigned int sctp_poll(struct file *file, struct socket *sock,
132 poll_table *wait); 133 poll_table *wait);
133void sctp_sock_rfree(struct sk_buff *skb); 134void sctp_sock_rfree(struct sk_buff *skb);
@@ -227,8 +228,7 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics);
227#endif /* !TEST_FRAME */ 228#endif /* !TEST_FRAME */
228 229
229/* sctp mib definitions */ 230/* sctp mib definitions */
230enum 231enum {
231{
232 SCTP_MIB_NUM = 0, 232 SCTP_MIB_NUM = 0,
233 SCTP_MIB_CURRESTAB, /* CurrEstab */ 233 SCTP_MIB_CURRESTAB, /* CurrEstab */
234 SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ 234 SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index c1dd89365833..61d73e37d543 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -243,7 +243,8 @@ struct sctp_chunk *sctp_make_op_error(const struct sctp_association *,
243 const struct sctp_chunk *chunk, 243 const struct sctp_chunk *chunk,
244 __be16 cause_code, 244 __be16 cause_code,
245 const void *payload, 245 const void *payload,
246 size_t paylen); 246 size_t paylen,
247 size_t reserve_tail);
247 248
248struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, 249struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *,
249 union sctp_addr *, 250 union sctp_addr *,
@@ -278,6 +279,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
278/* 2nd level prototypes */ 279/* 2nd level prototypes */
279void sctp_generate_t3_rtx_event(unsigned long peer); 280void sctp_generate_t3_rtx_event(unsigned long peer);
280void sctp_generate_heartbeat_event(unsigned long peer); 281void sctp_generate_heartbeat_event(unsigned long peer);
282void sctp_generate_proto_unreach_event(unsigned long peer);
281 283
282void sctp_ootb_pkt_free(struct sctp_packet *); 284void sctp_ootb_pkt_free(struct sctp_packet *);
283 285
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0a474568b003..219043a67bf7 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -231,6 +231,11 @@ extern struct sctp_globals {
231 /* Flag to indicate whether computing and verifying checksum 231 /* Flag to indicate whether computing and verifying checksum
232 * is disabled. */ 232 * is disabled. */
233 int checksum_disable; 233 int checksum_disable;
234
235 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
236 * bits is an indicator of when to send and window update SACK.
237 */
238 int rwnd_update_shift;
234} sctp_globals; 239} sctp_globals;
235 240
236#define sctp_rto_initial (sctp_globals.rto_initial) 241#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -267,6 +272,7 @@ extern struct sctp_globals {
267#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 272#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
268#define sctp_auth_enable (sctp_globals.auth_enable) 273#define sctp_auth_enable (sctp_globals.auth_enable)
269#define sctp_checksum_disable (sctp_globals.checksum_disable) 274#define sctp_checksum_disable (sctp_globals.checksum_disable)
275#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
270 276
271/* SCTP Socket type: UDP or TCP style. */ 277/* SCTP Socket type: UDP or TCP style. */
272typedef enum { 278typedef enum {
@@ -772,6 +778,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,
772 struct iovec *data); 778 struct iovec *data);
773void sctp_chunk_free(struct sctp_chunk *); 779void sctp_chunk_free(struct sctp_chunk *);
774void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 780void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
781void *sctp_addto_chunk_fixed(struct sctp_chunk *, int len, const void *data);
775struct sctp_chunk *sctp_chunkify(struct sk_buff *, 782struct sctp_chunk *sctp_chunkify(struct sk_buff *,
776 const struct sctp_association *, 783 const struct sctp_association *,
777 struct sock *); 784 struct sock *);
@@ -935,6 +942,8 @@ struct sctp_transport {
935 /* Data that has been sent, but not acknowledged. */ 942 /* Data that has been sent, but not acknowledged. */
936 __u32 flight_size; 943 __u32 flight_size;
937 944
945 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */
946
938 /* TSN marking the fast recovery exit point */ 947 /* TSN marking the fast recovery exit point */
939 __u32 fast_recovery_exit; 948 __u32 fast_recovery_exit;
940 949
@@ -943,12 +952,6 @@ struct sctp_transport {
943 /* Source address. */ 952 /* Source address. */
944 union sctp_addr saddr; 953 union sctp_addr saddr;
945 954
946 /* When was the last time(in jiffies) that a data packet was sent on
947 * this transport? This is used to adjust the cwnd when the transport
948 * becomes inactive.
949 */
950 unsigned long last_time_used;
951
952 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 955 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
953 * the destination address every heartbeat interval. 956 * the destination address every heartbeat interval.
954 */ 957 */
@@ -987,7 +990,7 @@ struct sctp_transport {
987 int init_sent_count; 990 int init_sent_count;
988 991
989 /* state : The current state of this destination, 992 /* state : The current state of this destination,
990 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN. 993 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKNOWN.
991 */ 994 */
992 int state; 995 int state;
993 996
@@ -1007,6 +1010,9 @@ struct sctp_transport {
1007 /* Heartbeat timer is per destination. */ 1010 /* Heartbeat timer is per destination. */
1008 struct timer_list hb_timer; 1011 struct timer_list hb_timer;
1009 1012
1013 /* Timer to handle ICMP proto unreachable envets */
1014 struct timer_list proto_unreach_timer;
1015
1010 /* Since we're using per-destination retransmission timers 1016 /* Since we're using per-destination retransmission timers
1011 * (see above), we're also using per-destination "transmitted" 1017 * (see above), we're also using per-destination "transmitted"
1012 * queues. This probably ought to be a private struct 1018 * queues. This probably ought to be a private struct
@@ -1069,6 +1075,8 @@ void sctp_transport_put(struct sctp_transport *);
1069void sctp_transport_update_rto(struct sctp_transport *, __u32); 1075void sctp_transport_update_rto(struct sctp_transport *, __u32);
1070void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); 1076void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1071void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); 1077void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
1078void sctp_transport_burst_limited(struct sctp_transport *);
1079void sctp_transport_burst_reset(struct sctp_transport *);
1072unsigned long sctp_transport_timeout(struct sctp_transport *); 1080unsigned long sctp_transport_timeout(struct sctp_transport *);
1073void sctp_transport_reset(struct sctp_transport *); 1081void sctp_transport_reset(struct sctp_transport *);
1074void sctp_transport_update_pmtu(struct sctp_transport *, u32); 1082void sctp_transport_update_pmtu(struct sctp_transport *, u32);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index be2334aaf52e..2b2769c5ca9f 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -60,96 +60,49 @@ typedef __s32 sctp_assoc_t;
60/* The following symbols come from the Sockets API Extensions for 60/* The following symbols come from the Sockets API Extensions for
61 * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. 61 * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
62 */ 62 */
63enum sctp_optname { 63#define SCTP_RTOINFO 0
64 SCTP_RTOINFO, 64#define SCTP_ASSOCINFO 1
65#define SCTP_RTOINFO SCTP_RTOINFO 65#define SCTP_INITMSG 2
66 SCTP_ASSOCINFO, 66#define SCTP_NODELAY 3 /* Get/set nodelay option. */
67#define SCTP_ASSOCINFO SCTP_ASSOCINFO 67#define SCTP_AUTOCLOSE 4
68 SCTP_INITMSG, 68#define SCTP_SET_PEER_PRIMARY_ADDR 5
69#define SCTP_INITMSG SCTP_INITMSG 69#define SCTP_PRIMARY_ADDR 6
70 SCTP_NODELAY, /* Get/set nodelay option. */ 70#define SCTP_ADAPTATION_LAYER 7
71#define SCTP_NODELAY SCTP_NODELAY 71#define SCTP_DISABLE_FRAGMENTS 8
72 SCTP_AUTOCLOSE, 72#define SCTP_PEER_ADDR_PARAMS 9
73#define SCTP_AUTOCLOSE SCTP_AUTOCLOSE 73#define SCTP_DEFAULT_SEND_PARAM 10
74 SCTP_SET_PEER_PRIMARY_ADDR, 74#define SCTP_EVENTS 11
75#define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR 75#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */
76 SCTP_PRIMARY_ADDR, 76#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */
77#define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR 77#define SCTP_STATUS 14
78 SCTP_ADAPTATION_LAYER, 78#define SCTP_GET_PEER_ADDR_INFO 15
79#define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER 79#define SCTP_DELAYED_ACK_TIME 16
80 SCTP_DISABLE_FRAGMENTS, 80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
81#define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS 81#define SCTP_CONTEXT 17
82 SCTP_PEER_ADDR_PARAMS, 82#define SCTP_FRAGMENT_INTERLEAVE 18
83#define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS 83#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
84 SCTP_DEFAULT_SEND_PARAM, 84#define SCTP_MAX_BURST 20 /* Set/Get max burst */
85#define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM 85#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */
86 SCTP_EVENTS, 86#define SCTP_HMAC_IDENT 22
87#define SCTP_EVENTS SCTP_EVENTS 87#define SCTP_AUTH_KEY 23
88 SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */ 88#define SCTP_AUTH_ACTIVE_KEY 24
89#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR 89#define SCTP_AUTH_DELETE_KEY 25
90 SCTP_MAXSEG, /* Get/set maximum fragment. */ 90#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */
91#define SCTP_MAXSEG SCTP_MAXSEG 91#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */
92 SCTP_STATUS, 92#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
93#define SCTP_STATUS SCTP_STATUS 93
94 SCTP_GET_PEER_ADDR_INFO, 94/* Internal Socket Options. Some of the sctp library functions are
95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO 95 * implemented using these socket options.
96 SCTP_DELAYED_ACK, 96 */
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK 97#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */
98#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK 98#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */
99 SCTP_CONTEXT, /* Receive Context */ 99#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */
100#define SCTP_CONTEXT SCTP_CONTEXT 100/* Options 104-106 are deprecated and removed. Do not use this space */
101 SCTP_FRAGMENT_INTERLEAVE, 101#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */
102#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE 102#define SCTP_GET_PEER_ADDRS 108 /* Get all peer addresss. */
103 SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */ 103#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */
104#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT 104#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
105 SCTP_MAX_BURST, /* Set/Get max burst */ 105#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
106#define SCTP_MAX_BURST SCTP_MAX_BURST
107 SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */
108#define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK
109 SCTP_HMAC_IDENT,
110#define SCTP_HMAC_IDENT SCTP_HMAC_IDENT
111 SCTP_AUTH_KEY,
112#define SCTP_AUTH_KEY SCTP_AUTH_KEY
113 SCTP_AUTH_ACTIVE_KEY,
114#define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY
115 SCTP_AUTH_DELETE_KEY,
116#define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY
117 SCTP_PEER_AUTH_CHUNKS, /* Read only */
118#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
119 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */
120#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS
121 SCTP_GET_ASSOC_NUMBER, /* Read only */
122#define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER
123
124
125 /* Internal Socket Options. Some of the sctp library functions are
126 * implemented using these socket options.
127 */
128 SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */
129#define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD
130 SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */
131#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
132 SCTP_SOCKOPT_PEELOFF, /* peel off association. */
133#define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF
134 SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */
135#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD
136 SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */
137#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD
138 SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */
139#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD
140 SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */
141#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD
142 SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */
143#define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD
144 SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
145#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS
146 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
147#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
148 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
149#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
150 SCTP_SOCKOPT_CONNECTX3, /* CONNECTX requests. (new implementation) */
151#define SCTP_SOCKOPT_CONNECTX3 SCTP_SOCKOPT_CONNECTX3
152};
153 106
154/* 107/*
155 * 5.2.1 SCTP Initiation Structure (SCTP_INIT) 108 * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
@@ -206,6 +159,7 @@ enum sctp_sinfo_flags {
206 SCTP_UNORDERED = 1, /* Send/receive message unordered. */ 159 SCTP_UNORDERED = 1, /* Send/receive message unordered. */
207 SCTP_ADDR_OVER = 2, /* Override the primary destination. */ 160 SCTP_ADDR_OVER = 2, /* Override the primary destination. */
208 SCTP_ABORT=4, /* Send an ABORT message to the peer. */ 161 SCTP_ABORT=4, /* Send an ABORT message to the peer. */
162 SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
209 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ 163 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
210}; 164};
211 165
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 8c842e06bec8..692ee0061dc4 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -32,7 +32,7 @@
32 * - name of entries. 32 * - name of entries.
33 */ 33 */
34struct snmp_mib { 34struct snmp_mib {
35 char *name; 35 const char *name;
36 int entry; 36 int entry;
37}; 37};
38 38
@@ -129,52 +129,42 @@ struct linux_xfrm_mib {
129 * nonlocked_atomic_inc() primitives -AK 129 * nonlocked_atomic_inc() primitives -AK
130 */ 130 */
131#define DEFINE_SNMP_STAT(type, name) \ 131#define DEFINE_SNMP_STAT(type, name) \
132 __typeof__(type) *name[2] 132 __typeof__(type) __percpu *name[2]
133#define DECLARE_SNMP_STAT(type, name) \ 133#define DECLARE_SNMP_STAT(type, name) \
134 extern __typeof__(type) *name[2] 134 extern __typeof__(type) __percpu *name[2]
135 135
136#define SNMP_STAT_BHPTR(name) (name[0]) 136#define SNMP_STAT_BHPTR(name) (name[0])
137#define SNMP_STAT_USRPTR(name) (name[1]) 137#define SNMP_STAT_USRPTR(name) (name[1])
138 138
139#define SNMP_INC_STATS_BH(mib, field) \ 139#define SNMP_INC_STATS_BH(mib, field) \
140 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) 140 __this_cpu_inc(mib[0]->mibs[field])
141#define SNMP_INC_STATS_USER(mib, field) \ 141#define SNMP_INC_STATS_USER(mib, field) \
142 do { \ 142 this_cpu_inc(mib[1]->mibs[field])
143 per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ 143#define SNMP_INC_STATS(mib, field) \
144 put_cpu(); \ 144 this_cpu_inc(mib[!in_softirq()]->mibs[field])
145 } while (0) 145#define SNMP_DEC_STATS(mib, field) \
146#define SNMP_INC_STATS(mib, field) \ 146 this_cpu_dec(mib[!in_softirq()]->mibs[field])
147 do { \ 147#define SNMP_ADD_STATS_BH(mib, field, addend) \
148 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ 148 __this_cpu_add(mib[0]->mibs[field], addend)
149 put_cpu(); \ 149#define SNMP_ADD_STATS_USER(mib, field, addend) \
150 } while (0) 150 this_cpu_add(mib[1]->mibs[field], addend)
151#define SNMP_DEC_STATS(mib, field) \ 151/*
152 do { \ 152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ 153 * to make @ptr a non-percpu pointer.
154 put_cpu(); \ 154 */
155 } while (0)
156#define SNMP_ADD_STATS(mib, field, addend) \
157 do { \
158 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \
159 put_cpu(); \
160 } while (0)
161#define SNMP_ADD_STATS_BH(mib, field, addend) \
162 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
163#define SNMP_ADD_STATS_USER(mib, field, addend) \
164 do { \
165 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \
166 put_cpu(); \
167 } while (0)
168#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
169 do { \ 156 do { \
170 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ 157 __typeof__(*mib[0]) *ptr; \
158 preempt_disable(); \
159 ptr = this_cpu_ptr((mib)[!in_softirq()]); \
171 ptr->mibs[basefield##PKTS]++; \ 160 ptr->mibs[basefield##PKTS]++; \
172 ptr->mibs[basefield##OCTETS] += addend;\ 161 ptr->mibs[basefield##OCTETS] += addend;\
173 put_cpu(); \ 162 preempt_enable(); \
174 } while (0) 163 } while (0)
175#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 164#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
176 do { \ 165 do { \
177 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ 166 __typeof__(*mib[0]) *ptr = \
167 __this_cpu_ptr((mib)[!in_softirq()]); \
178 ptr->mibs[basefield##PKTS]++; \ 168 ptr->mibs[basefield##PKTS]++; \
179 ptr->mibs[basefield##OCTETS] += addend;\ 169 ptr->mibs[basefield##OCTETS] += addend;\
180 } while (0) 170 } while (0)
diff --git a/include/net/sock.h b/include/net/sock.h
index 9f96394f694e..1ad6435f252e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -51,6 +51,7 @@
51#include <linux/skbuff.h> /* struct sk_buff */ 51#include <linux/skbuff.h> /* struct sk_buff */
52#include <linux/mm.h> 52#include <linux/mm.h>
53#include <linux/security.h> 53#include <linux/security.h>
54#include <linux/slab.h>
54 55
55#include <linux/filter.h> 56#include <linux/filter.h>
56#include <linux/rculist_nulls.h> 57#include <linux/rculist_nulls.h>
@@ -73,7 +74,7 @@
73 printk(KERN_DEBUG msg); } while (0) 74 printk(KERN_DEBUG msg); } while (0)
74#else 75#else
75/* Validate arguments and do nothing */ 76/* Validate arguments and do nothing */
76static void inline int __attribute__ ((format (printf, 2, 3))) 77static inline void __attribute__ ((format (printf, 2, 3)))
77SOCK_DEBUG(struct sock *sk, const char *msg, ...) 78SOCK_DEBUG(struct sock *sk, const char *msg, ...)
78{ 79{
79} 80}
@@ -105,14 +106,17 @@ struct net;
105/** 106/**
106 * struct sock_common - minimal network layer representation of sockets 107 * struct sock_common - minimal network layer representation of sockets
107 * @skc_node: main hash linkage for various protocol lookup tables 108 * @skc_node: main hash linkage for various protocol lookup tables
108 * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol 109 * @skc_nulls_node: main hash linkage for TCP/UDP/UDP-Lite protocol
109 * @skc_refcnt: reference count 110 * @skc_refcnt: reference count
111 * @skc_tx_queue_mapping: tx queue number for this connection
110 * @skc_hash: hash value used with various protocol lookup tables 112 * @skc_hash: hash value used with various protocol lookup tables
113 * @skc_u16hashes: two u16 hash values used by UDP lookup tables
111 * @skc_family: network address family 114 * @skc_family: network address family
112 * @skc_state: Connection state 115 * @skc_state: Connection state
113 * @skc_reuse: %SO_REUSEADDR setting 116 * @skc_reuse: %SO_REUSEADDR setting
114 * @skc_bound_dev_if: bound device index if != 0 117 * @skc_bound_dev_if: bound device index if != 0
115 * @skc_bind_node: bind hash linkage for various protocol lookup tables 118 * @skc_bind_node: bind hash linkage for various protocol lookup tables
119 * @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
116 * @skc_prot: protocol handlers inside a network family 120 * @skc_prot: protocol handlers inside a network family
117 * @skc_net: reference to the network namespace of this socket 121 * @skc_net: reference to the network namespace of this socket
118 * 122 *
@@ -128,13 +132,20 @@ struct sock_common {
128 struct hlist_nulls_node skc_nulls_node; 132 struct hlist_nulls_node skc_nulls_node;
129 }; 133 };
130 atomic_t skc_refcnt; 134 atomic_t skc_refcnt;
135 int skc_tx_queue_mapping;
131 136
132 unsigned int skc_hash; 137 union {
138 unsigned int skc_hash;
139 __u16 skc_u16hashes[2];
140 };
133 unsigned short skc_family; 141 unsigned short skc_family;
134 volatile unsigned char skc_state; 142 volatile unsigned char skc_state;
135 unsigned char skc_reuse; 143 unsigned char skc_reuse;
136 int skc_bound_dev_if; 144 int skc_bound_dev_if;
137 struct hlist_node skc_bind_node; 145 union {
146 struct hlist_node skc_bind_node;
147 struct hlist_nulls_node skc_portaddr_node;
148 };
138 struct proto *skc_prot; 149 struct proto *skc_prot;
139#ifdef CONFIG_NET_NS 150#ifdef CONFIG_NET_NS
140 struct net *skc_net; 151 struct net *skc_net;
@@ -215,6 +226,7 @@ struct sock {
215#define sk_node __sk_common.skc_node 226#define sk_node __sk_common.skc_node
216#define sk_nulls_node __sk_common.skc_nulls_node 227#define sk_nulls_node __sk_common.skc_nulls_node
217#define sk_refcnt __sk_common.skc_refcnt 228#define sk_refcnt __sk_common.skc_refcnt
229#define sk_tx_queue_mapping __sk_common.skc_tx_queue_mapping
218 230
219#define sk_copy_start __sk_common.skc_hash 231#define sk_copy_start __sk_common.skc_hash
220#define sk_hash __sk_common.skc_hash 232#define sk_hash __sk_common.skc_hash
@@ -242,6 +254,8 @@ struct sock {
242 struct { 254 struct {
243 struct sk_buff *head; 255 struct sk_buff *head;
244 struct sk_buff *tail; 256 struct sk_buff *tail;
257 int len;
258 int limit;
245 } sk_backlog; 259 } sk_backlog;
246 wait_queue_head_t *sk_sleep; 260 wait_queue_head_t *sk_sleep;
247 struct dst_entry *sk_dst_cache; 261 struct dst_entry *sk_dst_cache;
@@ -306,6 +320,11 @@ struct sock {
306/* 320/*
307 * Hashed lists helper routines 321 * Hashed lists helper routines
308 */ 322 */
323static inline struct sock *sk_entry(const struct hlist_node *node)
324{
325 return hlist_entry(node, struct sock, sk_node);
326}
327
309static inline struct sock *__sk_head(const struct hlist_head *head) 328static inline struct sock *__sk_head(const struct hlist_head *head)
310{ 329{
311 return hlist_entry(head->first, struct sock, sk_node); 330 return hlist_entry(head->first, struct sock, sk_node);
@@ -365,6 +384,7 @@ static __inline__ void __sk_del_node(struct sock *sk)
365 __hlist_del(&sk->sk_node); 384 __hlist_del(&sk->sk_node);
366} 385}
367 386
387/* NB: equivalent to hlist_del_init_rcu */
368static __inline__ int __sk_del_node_init(struct sock *sk) 388static __inline__ int __sk_del_node_init(struct sock *sk)
369{ 389{
370 if (sk_hashed(sk)) { 390 if (sk_hashed(sk)) {
@@ -405,6 +425,7 @@ static __inline__ int sk_del_node_init(struct sock *sk)
405 } 425 }
406 return rc; 426 return rc;
407} 427}
428#define sk_del_node_init_rcu(sk) sk_del_node_init(sk)
408 429
409static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) 430static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
410{ 431{
@@ -438,6 +459,12 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
438 __sk_add_node(sk, list); 459 __sk_add_node(sk, list);
439} 460}
440 461
462static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
463{
464 sock_hold(sk);
465 hlist_add_head_rcu(&sk->sk_node, list);
466}
467
441static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 468static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
442{ 469{
443 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 470 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
@@ -462,6 +489,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
462 489
463#define sk_for_each(__sk, node, list) \ 490#define sk_for_each(__sk, node, list) \
464 hlist_for_each_entry(__sk, node, list, sk_node) 491 hlist_for_each_entry(__sk, node, list, sk_node)
492#define sk_for_each_rcu(__sk, node, list) \
493 hlist_for_each_entry_rcu(__sk, node, list, sk_node)
465#define sk_nulls_for_each(__sk, node, list) \ 494#define sk_nulls_for_each(__sk, node, list) \
466 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) 495 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
467#define sk_nulls_for_each_rcu(__sk, node, list) \ 496#define sk_nulls_for_each_rcu(__sk, node, list) \
@@ -504,6 +533,8 @@ enum sock_flags {
504 SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */ 533 SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
505 SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */ 534 SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
506 SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ 535 SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
536 SOCK_FASYNC, /* fasync() active */
537 SOCK_RXQ_OVFL,
507}; 538};
508 539
509static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 540static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -561,8 +592,8 @@ static inline int sk_stream_memory_free(struct sock *sk)
561 return sk->sk_wmem_queued < sk->sk_sndbuf; 592 return sk->sk_wmem_queued < sk->sk_sndbuf;
562} 593}
563 594
564/* The per-socket spinlock must be held here. */ 595/* OOB backlog add */
565static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) 596static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
566{ 597{
567 if (!sk->sk_backlog.tail) { 598 if (!sk->sk_backlog.tail) {
568 sk->sk_backlog.head = sk->sk_backlog.tail = skb; 599 sk->sk_backlog.head = sk->sk_backlog.tail = skb;
@@ -573,6 +604,17 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
573 skb->next = NULL; 604 skb->next = NULL;
574} 605}
575 606
607/* The per-socket spinlock must be held here. */
608static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb)
609{
610 if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1))
611 return -ENOBUFS;
612
613 __sk_add_backlog(sk, skb);
614 sk->sk_backlog.len += skb->truesize;
615 return 0;
616}
617
576static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) 618static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
577{ 619{
578 return sk->sk_backlog_rcv(sk, skb); 620 return sk->sk_backlog_rcv(sk, skb);
@@ -1031,7 +1073,7 @@ extern void sk_common_release(struct sock *sk);
1031extern void sock_init_data(struct socket *sock, struct sock *sk); 1073extern void sock_init_data(struct socket *sock, struct sock *sk);
1032 1074
1033/** 1075/**
1034 * sk_filter_release: Release a socket filter 1076 * sk_filter_release - release a socket filter
1035 * @fp: filter to remove 1077 * @fp: filter to remove
1036 * 1078 *
1037 * Remove a filter from a socket and release its resources. 1079 * Remove a filter from a socket and release its resources.
@@ -1092,8 +1134,29 @@ static inline void sock_put(struct sock *sk)
1092extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, 1134extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb,
1093 const int nested); 1135 const int nested);
1094 1136
1137static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
1138{
1139 sk->sk_tx_queue_mapping = tx_queue;
1140}
1141
1142static inline void sk_tx_queue_clear(struct sock *sk)
1143{
1144 sk->sk_tx_queue_mapping = -1;
1145}
1146
1147static inline int sk_tx_queue_get(const struct sock *sk)
1148{
1149 return sk->sk_tx_queue_mapping;
1150}
1151
1152static inline bool sk_tx_queue_recorded(const struct sock *sk)
1153{
1154 return (sk && sk->sk_tx_queue_mapping >= 0);
1155}
1156
1095static inline void sk_set_socket(struct sock *sk, struct socket *sock) 1157static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1096{ 1158{
1159 sk_tx_queue_clear(sk);
1097 sk->sk_socket = sock; 1160 sk->sk_socket = sock;
1098} 1161}
1099 1162
@@ -1150,6 +1213,7 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
1150{ 1213{
1151 struct dst_entry *old_dst; 1214 struct dst_entry *old_dst;
1152 1215
1216 sk_tx_queue_clear(sk);
1153 old_dst = sk->sk_dst_cache; 1217 old_dst = sk->sk_dst_cache;
1154 sk->sk_dst_cache = dst; 1218 sk->sk_dst_cache = dst;
1155 dst_release(old_dst); 1219 dst_release(old_dst);
@@ -1168,6 +1232,7 @@ __sk_dst_reset(struct sock *sk)
1168{ 1232{
1169 struct dst_entry *old_dst; 1233 struct dst_entry *old_dst;
1170 1234
1235 sk_tx_queue_clear(sk);
1171 old_dst = sk->sk_dst_cache; 1236 old_dst = sk->sk_dst_cache;
1172 sk->sk_dst_cache = NULL; 1237 sk->sk_dst_cache = NULL;
1173 dst_release(old_dst); 1238 dst_release(old_dst);
@@ -1396,7 +1461,7 @@ static inline unsigned long sock_wspace(struct sock *sk)
1396 1461
1397static inline void sk_wake_async(struct sock *sk, int how, int band) 1462static inline void sk_wake_async(struct sock *sk, int how, int band)
1398{ 1463{
1399 if (sk->sk_socket && sk->sk_socket->fasync_list) 1464 if (sock_flag(sk, SOCK_FASYNC))
1400 sock_wake_async(sk->sk_socket, how, band); 1465 sock_wake_async(sk->sk_socket, how, band);
1401} 1466}
1402 1467
@@ -1492,6 +1557,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1492 sk->sk_stamp = kt; 1557 sk->sk_stamp = kt;
1493} 1558}
1494 1559
1560extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb);
1561
1495/** 1562/**
1496 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 1563 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
1497 * @msg: outgoing packet 1564 * @msg: outgoing packet
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index 6abb3ed3ebf7..e103fe02f375 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -26,7 +26,9 @@ struct tcf_skbedit {
26 struct tcf_common common; 26 struct tcf_common common;
27 u32 flags; 27 u32 flags;
28 u32 priority; 28 u32 priority;
29 u32 mark;
29 u16 queue_mapping; 30 u16 queue_mapping;
31 /* XXX: 16-bit pad here? */
30}; 32};
31#define to_skbedit(pc) \ 33#define to_skbedit(pc) \
32 container_of(pc, struct tcf_skbedit, common) 34 container_of(pc, struct tcf_skbedit, common)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 03a49c703377..aa04b9a5093b 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -30,6 +30,7 @@
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/crypto.h> 31#include <linux/crypto.h>
32#include <linux/cryptohash.h> 32#include <linux/cryptohash.h>
33#include <linux/kref.h>
33 34
34#include <net/inet_connection_sock.h> 35#include <net/inet_connection_sock.h>
35#include <net/inet_timewait_sock.h> 36#include <net/inet_timewait_sock.h>
@@ -62,9 +63,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
62/* Minimal accepted MSS. It is (60+60+8) - (20+20). */ 63/* Minimal accepted MSS. It is (60+60+8) - (20+20). */
63#define TCP_MIN_MSS 88U 64#define TCP_MIN_MSS 88U
64 65
65/* Minimal RCV_MSS. */
66#define TCP_MIN_RCVMSS 536U
67
68/* The least MTU to use for probing */ 66/* The least MTU to use for probing */
69#define TCP_BASE_MSS 512 67#define TCP_BASE_MSS 512
70 68
@@ -167,6 +165,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
167#define TCPOPT_SACK 5 /* SACK Block */ 165#define TCPOPT_SACK 5 /* SACK Block */
168#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 166#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
169#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 167#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
168#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */
170 169
171/* 170/*
172 * TCP option lengths 171 * TCP option lengths
@@ -177,6 +176,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
177#define TCPOLEN_SACK_PERM 2 176#define TCPOLEN_SACK_PERM 2
178#define TCPOLEN_TIMESTAMP 10 177#define TCPOLEN_TIMESTAMP 10
179#define TCPOLEN_MD5SIG 18 178#define TCPOLEN_MD5SIG 18
179#define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */
180#define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */
181#define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN)
182#define TCPOLEN_COOKIE_MAX (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MAX)
180 183
181/* But this is what stacks really send out. */ 184/* But this is what stacks really send out. */
182#define TCPOLEN_TSTAMP_ALIGNED 12 185#define TCPOLEN_TSTAMP_ALIGNED 12
@@ -193,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
193#define TCP_NAGLE_CORK 2 /* Socket is corked */ 196#define TCP_NAGLE_CORK 2 /* Socket is corked */
194#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ 197#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */
195 198
199/* TCP thin-stream limits */
200#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */
201
196extern struct inet_timewait_death_row tcp_death_row; 202extern struct inet_timewait_death_row tcp_death_row;
197 203
198/* sysctl variables for tcp */ 204/* sysctl variables for tcp */
@@ -237,6 +243,9 @@ extern int sysctl_tcp_base_mss;
237extern int sysctl_tcp_workaround_signed_windows; 243extern int sysctl_tcp_workaround_signed_windows;
238extern int sysctl_tcp_slow_start_after_idle; 244extern int sysctl_tcp_slow_start_after_idle;
239extern int sysctl_tcp_max_ssthresh; 245extern int sysctl_tcp_max_ssthresh;
246extern int sysctl_tcp_cookie_size;
247extern int sysctl_tcp_thin_linear_timeouts;
248extern int sysctl_tcp_thin_dupack;
240 249
241extern atomic_t tcp_memory_allocated; 250extern atomic_t tcp_memory_allocated;
242extern struct percpu_counter tcp_sockets_allocated; 251extern struct percpu_counter tcp_sockets_allocated;
@@ -343,11 +352,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
343 352
344extern void tcp_enter_quickack_mode(struct sock *sk); 353extern void tcp_enter_quickack_mode(struct sock *sk);
345 354
346static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
347{
348 rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale = 0;
349}
350
351#define TCP_ECN_OK 1 355#define TCP_ECN_OK 1
352#define TCP_ECN_QUEUE_CWR 2 356#define TCP_ECN_QUEUE_CWR 2
353#define TCP_ECN_DEMAND_CWR 4 357#define TCP_ECN_DEMAND_CWR 4
@@ -359,8 +363,7 @@ TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th)
359 inet_rsk(req)->ecn_ok = 1; 363 inet_rsk(req)->ecn_ok = 1;
360} 364}
361 365
362enum tcp_tw_status 366enum tcp_tw_status {
363{
364 TCP_TW_SUCCESS = 0, 367 TCP_TW_SUCCESS = 0,
365 TCP_TW_RST = 1, 368 TCP_TW_RST = 1,
366 TCP_TW_ACK = 2, 369 TCP_TW_ACK = 2,
@@ -402,6 +405,8 @@ extern int compat_tcp_setsockopt(struct sock *sk,
402 int level, int optname, 405 int level, int optname,
403 char __user *optval, unsigned int optlen); 406 char __user *optval, unsigned int optlen);
404extern void tcp_set_keepalive(struct sock *sk, int val); 407extern void tcp_set_keepalive(struct sock *sk, int val);
408extern void tcp_syn_ack_timeout(struct sock *sk,
409 struct request_sock *req);
405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 410extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
406 struct msghdr *msg, 411 struct msghdr *msg,
407 size_t len, int nonblock, 412 size_t len, int nonblock,
@@ -409,6 +414,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
409 414
410extern void tcp_parse_options(struct sk_buff *skb, 415extern void tcp_parse_options(struct sk_buff *skb,
411 struct tcp_options_received *opt_rx, 416 struct tcp_options_received *opt_rx,
417 u8 **hvpp,
412 int estab); 418 int estab);
413 419
414extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); 420extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
@@ -443,7 +449,8 @@ extern int tcp_connect(struct sock *sk);
443 449
444extern struct sk_buff * tcp_make_synack(struct sock *sk, 450extern struct sk_buff * tcp_make_synack(struct sock *sk,
445 struct dst_entry *dst, 451 struct dst_entry *dst,
446 struct request_sock *req); 452 struct request_sock *req,
453 struct request_values *rvp);
447 454
448extern int tcp_disconnect(struct sock *sk, int flags); 455extern int tcp_disconnect(struct sock *sk, int flags);
449 456
@@ -856,13 +863,6 @@ static inline void tcp_check_probe_timer(struct sock *sk)
856 icsk->icsk_rto, TCP_RTO_MAX); 863 icsk->icsk_rto, TCP_RTO_MAX);
857} 864}
858 865
859static inline void tcp_push_pending_frames(struct sock *sk)
860{
861 struct tcp_sock *tp = tcp_sk(sk);
862
863 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
864}
865
866static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) 866static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)
867{ 867{
868 tp->snd_wl1 = seq; 868 tp->snd_wl1 = seq;
@@ -939,7 +939,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
939 939
940 tp->ucopy.memory = 0; 940 tp->ucopy.memory = 0;
941 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { 941 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
942 wake_up_interruptible_poll(sk->sk_sleep, 942 wake_up_interruptible_sync_poll(sk->sk_sleep,
943 POLLIN | POLLRDNORM | POLLRDBAND); 943 POLLIN | POLLRDNORM | POLLRDBAND);
944 if (!inet_csk_ack_scheduled(sk)) 944 if (!inet_csk_ack_scheduled(sk))
945 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 945 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
@@ -972,7 +972,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
972/* Determine a window scaling and initial window to offer. */ 972/* Determine a window scaling and initial window to offer. */
973extern void tcp_select_initial_window(int __space, __u32 mss, 973extern void tcp_select_initial_window(int __space, __u32 mss,
974 __u32 *rcv_wnd, __u32 *window_clamp, 974 __u32 *rcv_wnd, __u32 *window_clamp,
975 int wscale_ok, __u8 *rcv_wscale); 975 int wscale_ok, __u8 *rcv_wscale,
976 __u32 init_rcv_wnd);
976 977
977static inline int tcp_win_from_space(int space) 978static inline int tcp_win_from_space(int space)
978{ 979{
@@ -1193,33 +1194,18 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1193#define tcp_twsk_md5_key(twsk) NULL 1194#define tcp_twsk_md5_key(twsk) NULL
1194#endif 1195#endif
1195 1196
1196extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *); 1197extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1197extern void tcp_free_md5sig_pool(void); 1198extern void tcp_free_md5sig_pool(void);
1198 1199
1199extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1200extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1200extern void __tcp_put_md5sig_pool(void); 1201extern void tcp_put_md5sig_pool(void);
1202
1201extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); 1203extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1202extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, 1204extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
1203 unsigned header_len); 1205 unsigned header_len);
1204extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1206extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1205 struct tcp_md5sig_key *key); 1207 struct tcp_md5sig_key *key);
1206 1208
1207static inline
1208struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
1209{
1210 int cpu = get_cpu();
1211 struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu);
1212 if (!ret)
1213 put_cpu();
1214 return ret;
1215}
1216
1217static inline void tcp_put_md5sig_pool(void)
1218{
1219 __tcp_put_md5sig_pool();
1220 put_cpu();
1221}
1222
1223/* write queue abstraction */ 1209/* write queue abstraction */
1224static inline void tcp_write_queue_purge(struct sock *sk) 1210static inline void tcp_write_queue_purge(struct sock *sk)
1225{ 1211{
@@ -1228,6 +1214,7 @@ static inline void tcp_write_queue_purge(struct sock *sk)
1228 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) 1214 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
1229 sk_wmem_free_skb(sk, skb); 1215 sk_wmem_free_skb(sk, skb);
1230 sk_mem_reclaim(sk); 1216 sk_mem_reclaim(sk);
1217 tcp_clear_all_retrans_hints(tcp_sk(sk));
1231} 1218}
1232 1219
1233static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) 1220static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
@@ -1259,29 +1246,6 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1259#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1246#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1260 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1247 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1261 1248
1262/* This function calculates a "timeout" which is equivalent to the timeout of a
1263 * TCP connection after "boundary" unsucessful, exponentially backed-off
1264 * retransmissions with an initial RTO of TCP_RTO_MIN.
1265 */
1266static inline bool retransmits_timed_out(const struct sock *sk,
1267 unsigned int boundary)
1268{
1269 unsigned int timeout, linear_backoff_thresh;
1270
1271 if (!inet_csk(sk)->icsk_retransmits)
1272 return false;
1273
1274 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1275
1276 if (boundary <= linear_backoff_thresh)
1277 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
1278 else
1279 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
1280 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
1281
1282 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
1283}
1284
1285static inline struct sk_buff *tcp_send_head(struct sock *sk) 1249static inline struct sk_buff *tcp_send_head(struct sock *sk)
1286{ 1250{
1287 return sk->sk_send_head; 1251 return sk->sk_send_head;
@@ -1364,6 +1328,15 @@ static inline int tcp_write_queue_empty(struct sock *sk)
1364 return skb_queue_empty(&sk->sk_write_queue); 1328 return skb_queue_empty(&sk->sk_write_queue);
1365} 1329}
1366 1330
1331static inline void tcp_push_pending_frames(struct sock *sk)
1332{
1333 if (tcp_send_head(sk)) {
1334 struct tcp_sock *tp = tcp_sk(sk);
1335
1336 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
1337 }
1338}
1339
1367/* Start sequence of the highest skb with SACKed bit, valid only if 1340/* Start sequence of the highest skb with SACKed bit, valid only if
1368 * sacked > 0 or when the caller has ensured validity by itself. 1341 * sacked > 0 or when the caller has ensured validity by itself.
1369 */ 1342 */
@@ -1403,6 +1376,14 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
1403 tcp_sk(sk)->highest_sack = new; 1376 tcp_sk(sk)->highest_sack = new;
1404} 1377}
1405 1378
1379/* Determines whether this is a thin stream (which may suffer from
1380 * increased latency). Used to trigger latency-reducing mechanisms.
1381 */
1382static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp)
1383{
1384 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp);
1385}
1386
1406/* /proc */ 1387/* /proc */
1407enum tcp_seq_states { 1388enum tcp_seq_states {
1408 TCP_SEQ_STATE_LISTENING, 1389 TCP_SEQ_STATE_LISTENING,
@@ -1480,6 +1461,91 @@ struct tcp_request_sock_ops {
1480#endif 1461#endif
1481}; 1462};
1482 1463
1464/* Using SHA1 for now, define some constants.
1465 */
1466#define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS)
1467#define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4)
1468#define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS)
1469
1470extern int tcp_cookie_generator(u32 *bakery);
1471
1472/**
1473 * struct tcp_cookie_values - each socket needs extra space for the
1474 * cookies, together with (optional) space for any SYN data.
1475 *
1476 * A tcp_sock contains a pointer to the current value, and this is
1477 * cloned to the tcp_timewait_sock.
1478 *
1479 * @cookie_pair: variable data from the option exchange.
1480 *
1481 * @cookie_desired: user specified tcpct_cookie_desired. Zero
1482 * indicates default (sysctl_tcp_cookie_size).
1483 * After cookie sent, remembers size of cookie.
1484 * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX.
1485 *
1486 * @s_data_desired: user specified tcpct_s_data_desired. When the
1487 * constant payload is specified (@s_data_constant),
1488 * holds its length instead.
1489 * Range 0 to TCP_MSS_DESIRED.
1490 *
1491 * @s_data_payload: constant data that is to be included in the
1492 * payload of SYN or SYNACK segments when the
1493 * cookie option is present.
1494 */
1495struct tcp_cookie_values {
1496 struct kref kref;
1497 u8 cookie_pair[TCP_COOKIE_PAIR_SIZE];
1498 u8 cookie_pair_size;
1499 u8 cookie_desired;
1500 u16 s_data_desired:11,
1501 s_data_constant:1,
1502 s_data_in:1,
1503 s_data_out:1,
1504 s_data_unused:2;
1505 u8 s_data_payload[0];
1506};
1507
1508static inline void tcp_cookie_values_release(struct kref *kref)
1509{
1510 kfree(container_of(kref, struct tcp_cookie_values, kref));
1511}
1512
1513/* The length of constant payload data. Note that s_data_desired is
1514 * overloaded, depending on s_data_constant: either the length of constant
1515 * data (returned here) or the limit on variable data.
1516 */
1517static inline int tcp_s_data_size(const struct tcp_sock *tp)
1518{
1519 return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant)
1520 ? tp->cookie_values->s_data_desired
1521 : 0;
1522}
1523
1524/**
1525 * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace.
1526 *
1527 * As tcp_request_sock has already been extended in other places, the
1528 * only remaining method is to pass stack values along as function
1529 * parameters. These parameters are not needed after sending SYNACK.
1530 *
1531 * @cookie_bakery: cryptographic secret and message workspace.
1532 *
1533 * @cookie_plus: bytes in authenticator/cookie option, copied from
1534 * struct tcp_options_received (above).
1535 */
1536struct tcp_extend_values {
1537 struct request_values rv;
1538 u32 cookie_bakery[COOKIE_WORKSPACE_WORDS];
1539 u8 cookie_plus:6,
1540 cookie_out_never:1,
1541 cookie_in_always:1;
1542};
1543
1544static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp)
1545{
1546 return (struct tcp_extend_values *)rvp;
1547}
1548
1483extern void tcp_v4_init(void); 1549extern void tcp_v4_init(void);
1484extern void tcp_init(void); 1550extern void tcp_init(void);
1485 1551
diff --git a/include/net/udp.h b/include/net/udp.h
index f98abd2ce709..5348d80b25bb 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -50,16 +50,49 @@ 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/**
54 * struct udp_hslot - UDP hash slot
55 *
56 * @head: head of list of sockets
57 * @count: number of sockets in 'head' list
58 * @lock: spinlock protecting changes to head/count
59 */
53struct udp_hslot { 60struct udp_hslot {
54 struct hlist_nulls_head head; 61 struct hlist_nulls_head head;
62 int count;
55 spinlock_t lock; 63 spinlock_t lock;
56} __attribute__((aligned(2 * sizeof(long)))); 64} __attribute__((aligned(2 * sizeof(long))));
65
66/**
67 * struct udp_table - UDP table
68 *
69 * @hash: hash table, sockets are hashed on (local port)
70 * @hash2: hash table, sockets are hashed on (local port, local address)
71 * @mask: number of slots in hash tables, minus 1
72 * @log: log2(number of slots in hash table)
73 */
57struct udp_table { 74struct udp_table {
58 struct udp_hslot hash[UDP_HTABLE_SIZE]; 75 struct udp_hslot *hash;
76 struct udp_hslot *hash2;
77 unsigned int mask;
78 unsigned int log;
59}; 79};
60extern struct udp_table udp_table; 80extern struct udp_table udp_table;
61extern void udp_table_init(struct udp_table *); 81extern void udp_table_init(struct udp_table *, const char *);
62 82static inline struct udp_hslot *udp_hashslot(struct udp_table *table,
83 struct net *net, unsigned num)
84{
85 return &table->hash[udp_hashfn(net, num, table->mask)];
86}
87/*
88 * For secondary hash, net_hash_mix() is performed before calling
89 * udp_hashslot2(), this explains difference with udp_hashslot()
90 */
91static inline struct udp_hslot *udp_hashslot2(struct udp_table *table,
92 unsigned int hash)
93{
94 return &table->hash2[hash & table->mask];
95}
63 96
64/* Note: this must match 'valbool' in sock_setsockopt */ 97/* Note: this must match 'valbool' in sock_setsockopt */
65#define UDP_CSUM_NOXMIT 1 98#define UDP_CSUM_NOXMIT 1
@@ -125,7 +158,8 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
125} 158}
126 159
127extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 160extern int udp_lib_get_port(struct sock *sk, unsigned short snum,
128 int (*)(const struct sock*,const struct sock*)); 161 int (*)(const struct sock *,const struct sock *),
162 unsigned int hash2_nulladdr);
129 163
130/* net/ipv4/udp.c */ 164/* net/ipv4/udp.c */
131extern int udp_get_port(struct sock *sk, unsigned short snum, 165extern int udp_get_port(struct sock *sk, unsigned short snum,
diff --git a/include/net/wext.h b/include/net/wext.h
index 3f2b94de2cfa..4f6e7423174c 100644
--- a/include/net/wext.h
+++ b/include/net/wext.h
@@ -1,29 +1,19 @@
1#ifndef __NET_WEXT_H 1#ifndef __NET_WEXT_H
2#define __NET_WEXT_H 2#define __NET_WEXT_H
3 3
4/* 4#include <net/iw_handler.h>
5 * wireless extensions interface to the core code
6 */
7 5
8struct net; 6struct net;
9 7
10#ifdef CONFIG_WIRELESS_EXT 8#ifdef CONFIG_WEXT_CORE
11extern int wext_proc_init(struct net *net);
12extern void wext_proc_exit(struct net *net);
13extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 9extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
14 void __user *arg); 10 void __user *arg);
15extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, 11extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
16 unsigned long arg); 12 unsigned long arg);
13
17extern struct iw_statistics *get_wireless_stats(struct net_device *dev); 14extern struct iw_statistics *get_wireless_stats(struct net_device *dev);
15extern int call_commit_handler(struct net_device *dev);
18#else 16#else
19static inline int wext_proc_init(struct net *net)
20{
21 return 0;
22}
23static inline void wext_proc_exit(struct net *net)
24{
25 return;
26}
27static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 17static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
28 void __user *arg) 18 void __user *arg)
29{ 19{
@@ -36,4 +26,35 @@ static inline int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
36} 26}
37#endif 27#endif
38 28
29#ifdef CONFIG_WEXT_PROC
30extern int wext_proc_init(struct net *net);
31extern void wext_proc_exit(struct net *net);
32#else
33static inline int wext_proc_init(struct net *net)
34{
35 return 0;
36}
37static inline void wext_proc_exit(struct net *net)
38{
39 return;
40}
41#endif
42
43#ifdef CONFIG_WEXT_PRIV
44int ioctl_private_call(struct net_device *dev, struct iwreq *iwr,
45 unsigned int cmd, struct iw_request_info *info,
46 iw_handler handler);
47int compat_private_call(struct net_device *dev, struct iwreq *iwr,
48 unsigned int cmd, struct iw_request_info *info,
49 iw_handler handler);
50int iw_handler_get_private(struct net_device * dev,
51 struct iw_request_info * info,
52 union iwreq_data * wrqu,
53 char * extra);
54#else
55#define ioctl_private_call NULL
56#define compat_private_call NULL
57#endif
58
59
39#endif /* __NET_WEXT_H */ 60#endif /* __NET_WEXT_H */
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 2af7bf839f23..3461aa1df1e0 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -79,7 +79,7 @@
79 * drivers have to only report state changes due to external 79 * drivers have to only report state changes due to external
80 * conditions. 80 * conditions.
81 * 81 *
82 * All API operations are 'atomic', serialized thorough a mutex in the 82 * All API operations are 'atomic', serialized through a mutex in the
83 * `struct wimax_dev`. 83 * `struct wimax_dev`.
84 * 84 *
85 * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK 85 * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK
@@ -195,6 +195,12 @@
195 * defining the `struct nla_policy` for each message, it has to have 195 * defining the `struct nla_policy` for each message, it has to have
196 * an array size of WIMAX_GNL_ATTR_MAX+1. 196 * an array size of WIMAX_GNL_ATTR_MAX+1.
197 * 197 *
198 * The op_*() function pointers will not be called if the wimax_dev is
199 * in a state <= %WIMAX_ST_UNINITIALIZED. The exception is:
200 *
201 * - op_reset: can be called at any time after wimax_dev_add() has
202 * been called.
203 *
198 * THE PIPE INTERFACE: 204 * THE PIPE INTERFACE:
199 * 205 *
200 * This interface is kept intentionally simple. The driver can send 206 * This interface is kept intentionally simple. The driver can send
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index 547b1e271ac9..85926231c07a 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -34,20 +34,32 @@ struct wpan_phy {
34 */ 34 */
35 u8 current_channel; 35 u8 current_channel;
36 u8 current_page; 36 u8 current_page;
37 u32 channels_supported; 37 u32 channels_supported[32];
38 u8 transmit_power; 38 u8 transmit_power;
39 u8 cca_mode; 39 u8 cca_mode;
40 40
41 struct device dev; 41 struct device dev;
42 int idx; 42 int idx;
43 43
44 struct net_device *(*add_iface)(struct wpan_phy *phy,
45 const char *name);
46 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
47
44 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 48 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
45}; 49};
46 50
51#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)
52
47struct wpan_phy *wpan_phy_alloc(size_t priv_size); 53struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48int wpan_phy_register(struct device *parent, struct wpan_phy *phy); 54static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
55{
56 phy->dev.parent = dev;
57}
58int wpan_phy_register(struct wpan_phy *phy);
49void wpan_phy_unregister(struct wpan_phy *phy); 59void wpan_phy_unregister(struct wpan_phy *phy);
50void wpan_phy_free(struct wpan_phy *phy); 60void wpan_phy_free(struct wpan_phy *phy);
61/* Same semantics as for class_for_each_device */
62int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
51 63
52static inline void *wpan_phy_priv(struct wpan_phy *phy) 64static inline void *wpan_phy_priv(struct wpan_phy *phy)
53{ 65{
@@ -56,6 +68,12 @@ static inline void *wpan_phy_priv(struct wpan_phy *phy)
56} 68}
57 69
58struct wpan_phy *wpan_phy_find(const char *str); 70struct wpan_phy *wpan_phy_find(const char *str);
71
72static inline void wpan_phy_put(struct wpan_phy *phy)
73{
74 put_device(&phy->dev);
75}
76
59static inline const char *wpan_phy_name(struct wpan_phy *phy) 77static inline const char *wpan_phy_name(struct wpan_phy *phy)
60{ 78{
61 return dev_name(&phy->dev); 79 return dev_name(&phy->dev);
diff --git a/include/net/x25.h b/include/net/x25.h
index 2cda04011568..468551ea4f1d 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -10,6 +10,7 @@
10#ifndef _X25_H 10#ifndef _X25_H
11#define _X25_H 11#define _X25_H
12#include <linux/x25.h> 12#include <linux/x25.h>
13#include <linux/slab.h>
13#include <net/sock.h> 14#include <net/sock.h>
14 15
15#define X25_ADDR_LEN 16 16#define X25_ADDR_LEN 16
@@ -182,6 +183,10 @@ extern int sysctl_x25_clear_request_timeout;
182extern int sysctl_x25_ack_holdback_timeout; 183extern int sysctl_x25_ack_holdback_timeout;
183extern int sysctl_x25_forward; 184extern int sysctl_x25_forward;
184 185
186extern int x25_parse_address_block(struct sk_buff *skb,
187 struct x25_address *called_addr,
188 struct x25_address *calling_addr);
189
185extern int x25_addr_ntoa(unsigned char *, struct x25_address *, 190extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
186 struct x25_address *); 191 struct x25_address *);
187extern int x25_addr_aton(unsigned char *, struct x25_address *, 192extern int x25_addr_aton(unsigned char *, struct x25_address *,
@@ -287,8 +292,14 @@ extern unsigned long x25_display_timer(struct sock *);
287extern void x25_check_rbuf(struct sock *); 292extern void x25_check_rbuf(struct sock *);
288 293
289/* sysctl_net_x25.c */ 294/* sysctl_net_x25.c */
295#ifdef CONFIG_SYSCTL
290extern void x25_register_sysctl(void); 296extern void x25_register_sysctl(void);
291extern void x25_unregister_sysctl(void); 297extern void x25_unregister_sysctl(void);
298#else
299static inline void x25_register_sysctl(void) {};
300static inline void x25_unregister_sysctl(void) {};
301#endif /* CONFIG_SYSCTL */
302
292struct x25_skb_cb { 303struct x25_skb_cb {
293 unsigned flags; 304 unsigned flags;
294}; 305};
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 223e90a44824..ac52f33f3e4a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -12,6 +12,7 @@
12#include <linux/in6.h> 12#include <linux/in6.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/audit.h> 14#include <linux/audit.h>
15#include <linux/slab.h>
15 16
16#include <net/sock.h> 17#include <net/sock.h>
17#include <net/dst.h> 18#include <net/dst.h>
@@ -19,6 +20,9 @@
19#include <net/route.h> 20#include <net/route.h>
20#include <net/ipv6.h> 21#include <net/ipv6.h>
21#include <net/ip6_fib.h> 22#include <net/ip6_fib.h>
23
24#include <linux/interrupt.h>
25
22#ifdef CONFIG_XFRM_STATISTICS 26#ifdef CONFIG_XFRM_STATISTICS
23#include <net/snmp.h> 27#include <net/snmp.h>
24#endif 28#endif
@@ -121,8 +125,7 @@ struct xfrm_state_walk {
121}; 125};
122 126
123/* Full description of state of transformer. */ 127/* Full description of state of transformer. */
124struct xfrm_state 128struct xfrm_state {
125{
126#ifdef CONFIG_NET_NS 129#ifdef CONFIG_NET_NS
127 struct net *xs_net; 130 struct net *xs_net;
128#endif 131#endif
@@ -138,6 +141,7 @@ struct xfrm_state
138 141
139 struct xfrm_id id; 142 struct xfrm_id id;
140 struct xfrm_selector sel; 143 struct xfrm_selector sel;
144 struct xfrm_mark mark;
141 145
142 u32 genid; 146 u32 genid;
143 147
@@ -160,7 +164,7 @@ struct xfrm_state
160 struct xfrm_lifetime_cfg lft; 164 struct xfrm_lifetime_cfg lft;
161 165
162 /* Data for transformer */ 166 /* Data for transformer */
163 struct xfrm_algo *aalg; 167 struct xfrm_algo_auth *aalg;
164 struct xfrm_algo *ealg; 168 struct xfrm_algo *ealg;
165 struct xfrm_algo *calg; 169 struct xfrm_algo *calg;
166 struct xfrm_algo_aead *aead; 170 struct xfrm_algo_aead *aead;
@@ -199,7 +203,7 @@ struct xfrm_state
199 struct xfrm_stats stats; 203 struct xfrm_stats stats;
200 204
201 struct xfrm_lifetime_cur curlft; 205 struct xfrm_lifetime_cur curlft;
202 struct timer_list timer; 206 struct tasklet_hrtimer mtimer;
203 207
204 /* Last used time */ 208 /* Last used time */
205 unsigned long lastused; 209 unsigned long lastused;
@@ -237,8 +241,7 @@ enum {
237}; 241};
238 242
239/* callback structure passed from either netlink or pfkey */ 243/* callback structure passed from either netlink or pfkey */
240struct km_event 244struct km_event {
241{
242 union { 245 union {
243 u32 hard; 246 u32 hard;
244 u32 proto; 247 u32 proto;
@@ -273,7 +276,8 @@ struct xfrm_policy_afinfo {
273 struct dst_entry *dst, 276 struct dst_entry *dst,
274 int nfheader_len); 277 int nfheader_len);
275 int (*fill_dst)(struct xfrm_dst *xdst, 278 int (*fill_dst)(struct xfrm_dst *xdst,
276 struct net_device *dev); 279 struct net_device *dev,
280 struct flowi *fl);
277}; 281};
278 282
279extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 283extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
@@ -313,12 +317,11 @@ extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
313 317
314extern void xfrm_state_delete_tunnel(struct xfrm_state *x); 318extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
315 319
316struct xfrm_type 320struct xfrm_type {
317{
318 char *description; 321 char *description;
319 struct module *owner; 322 struct module *owner;
320 __u8 proto; 323 u8 proto;
321 __u8 flags; 324 u8 flags;
322#define XFRM_TYPE_NON_FRAGMENT 1 325#define XFRM_TYPE_NON_FRAGMENT 1
323#define XFRM_TYPE_REPLAY_PROT 2 326#define XFRM_TYPE_REPLAY_PROT 2
324#define XFRM_TYPE_LOCAL_COADDR 4 327#define XFRM_TYPE_LOCAL_COADDR 4
@@ -420,8 +423,7 @@ static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipp
420 return x->inner_mode_iaf; 423 return x->inner_mode_iaf;
421} 424}
422 425
423struct xfrm_tmpl 426struct xfrm_tmpl {
424{
425/* id in template is interpreted as: 427/* id in template is interpreted as:
426 * daddr - destination of tunnel, may be zero for transport mode. 428 * daddr - destination of tunnel, may be zero for transport mode.
427 * spi - zero to acquire spi. Not zero if spi is static, then 429 * spi - zero to acquire spi. Not zero if spi is static, then
@@ -435,24 +437,24 @@ struct xfrm_tmpl
435 437
436 unsigned short encap_family; 438 unsigned short encap_family;
437 439
438 __u32 reqid; 440 u32 reqid;
439 441
440/* Mode: transport, tunnel etc. */ 442/* Mode: transport, tunnel etc. */
441 __u8 mode; 443 u8 mode;
442 444
443/* Sharing mode: unique, this session only, this user only etc. */ 445/* Sharing mode: unique, this session only, this user only etc. */
444 __u8 share; 446 u8 share;
445 447
446/* May skip this transfomration if no SA is found */ 448/* May skip this transfomration if no SA is found */
447 __u8 optional; 449 u8 optional;
448 450
449/* Skip aalgos/ealgos/calgos checks. */ 451/* Skip aalgos/ealgos/calgos checks. */
450 __u8 allalgs; 452 u8 allalgs;
451 453
452/* Bit mask of algos allowed for acquisition */ 454/* Bit mask of algos allowed for acquisition */
453 __u32 aalgos; 455 u32 aalgos;
454 __u32 ealgos; 456 u32 ealgos;
455 __u32 calgos; 457 u32 calgos;
456}; 458};
457 459
458#define XFRM_MAX_DEPTH 6 460#define XFRM_MAX_DEPTH 6
@@ -468,8 +470,7 @@ struct xfrm_policy_walk {
468 u32 seq; 470 u32 seq;
469}; 471};
470 472
471struct xfrm_policy 473struct xfrm_policy {
472{
473#ifdef CONFIG_NET_NS 474#ifdef CONFIG_NET_NS
474 struct net *xp_net; 475 struct net *xp_net;
475#endif 476#endif
@@ -483,6 +484,7 @@ struct xfrm_policy
483 484
484 u32 priority; 485 u32 priority;
485 u32 index; 486 u32 index;
487 struct xfrm_mark mark;
486 struct xfrm_selector selector; 488 struct xfrm_selector selector;
487 struct xfrm_lifetime_cfg lft; 489 struct xfrm_lifetime_cfg lft;
488 struct xfrm_lifetime_cur curlft; 490 struct xfrm_lifetime_cur curlft;
@@ -538,8 +540,7 @@ struct xfrm_migrate {
538/* default seq threshold size */ 540/* default seq threshold size */
539#define XFRM_AE_SEQT_SIZE 2 541#define XFRM_AE_SEQT_SIZE 2
540 542
541struct xfrm_mgr 543struct xfrm_mgr {
542{
543 struct list_head list; 544 struct list_head list;
544 char *id; 545 char *id;
545 int (*notify)(struct xfrm_state *x, struct km_event *c); 546 int (*notify)(struct xfrm_state *x, struct km_event *c);
@@ -626,8 +627,7 @@ struct xfrm_spi_skb_cb {
626#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) 627#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0]))
627 628
628/* Audit Information */ 629/* Audit Information */
629struct xfrm_audit 630struct xfrm_audit {
630{
631 u32 secid; 631 u32 secid;
632 uid_t loginuid; 632 uid_t loginuid;
633 u32 sessionid; 633 u32 sessionid;
@@ -774,7 +774,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
774 int pdw; 774 int pdw;
775 int pbi; 775 int pbi;
776 776
777 pdw = prefixlen >> 5; /* num of whole __u32 in prefix */ 777 pdw = prefixlen >> 5; /* num of whole u32 in prefix */
778 pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ 778 pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
779 779
780 if (pdw) 780 if (pdw)
@@ -871,8 +871,7 @@ static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ct
871 * bundles differing by session id. All the bundles grow from a parent 871 * bundles differing by session id. All the bundles grow from a parent
872 * policy rule. 872 * policy rule.
873 */ 873 */
874struct xfrm_dst 874struct xfrm_dst {
875{
876 union { 875 union {
877 struct dst_entry dst; 876 struct dst_entry dst;
878 struct rtable rt; 877 struct rtable rt;
@@ -907,8 +906,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
907 906
908extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 907extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
909 908
910struct sec_path 909struct sec_path {
911{
912 atomic_t refcnt; 910 atomic_t refcnt;
913 int len; 911 int len;
914 struct xfrm_state *xvec[XFRM_MAX_DEPTH]; 912 struct xfrm_state *xvec[XFRM_MAX_DEPTH];
@@ -1265,7 +1263,7 @@ struct xfrm_algo_desc {
1265/* XFRM tunnel handlers. */ 1263/* XFRM tunnel handlers. */
1266struct xfrm_tunnel { 1264struct xfrm_tunnel {
1267 int (*handler)(struct sk_buff *skb); 1265 int (*handler)(struct sk_buff *skb);
1268 int (*err_handler)(struct sk_buff *skb, __u32 info); 1266 int (*err_handler)(struct sk_buff *skb, u32 info);
1269 1267
1270 struct xfrm_tunnel *next; 1268 struct xfrm_tunnel *next;
1271 int priority; 1269 int priority;
@@ -1323,7 +1321,7 @@ extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t
1323 struct flowi *fl, struct xfrm_tmpl *tmpl, 1321 struct flowi *fl, struct xfrm_tmpl *tmpl,
1324 struct xfrm_policy *pol, int *err, 1322 struct xfrm_policy *pol, int *err,
1325 unsigned short family); 1323 unsigned short family);
1326extern struct xfrm_state * xfrm_stateonly_find(struct net *net, 1324extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
1327 xfrm_address_t *daddr, 1325 xfrm_address_t *daddr,
1328 xfrm_address_t *saddr, 1326 xfrm_address_t *saddr,
1329 unsigned short family, 1327 unsigned short family,
@@ -1332,8 +1330,14 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
1332extern void xfrm_state_insert(struct xfrm_state *x); 1330extern void xfrm_state_insert(struct xfrm_state *x);
1333extern int xfrm_state_add(struct xfrm_state *x); 1331extern int xfrm_state_add(struct xfrm_state *x);
1334extern int xfrm_state_update(struct xfrm_state *x); 1332extern int xfrm_state_update(struct xfrm_state *x);
1335extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); 1333extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1336extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 1334 xfrm_address_t *daddr, __be32 spi,
1335 u8 proto, unsigned short family);
1336extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1337 xfrm_address_t *daddr,
1338 xfrm_address_t *saddr,
1339 u8 proto,
1340 unsigned short family);
1337#ifdef CONFIG_XFRM_SUB_POLICY 1341#ifdef CONFIG_XFRM_SUB_POLICY
1338extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1342extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1339 int n, unsigned short family); 1343 int n, unsigned short family);
@@ -1370,11 +1374,12 @@ struct xfrmk_spdinfo {
1370 u32 spdhmcnt; 1374 u32 spdhmcnt;
1371}; 1375};
1372 1376
1373extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq); 1377extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark,
1378 u32 seq);
1374extern int xfrm_state_delete(struct xfrm_state *x); 1379extern int xfrm_state_delete(struct xfrm_state *x);
1375extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1380extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1376extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); 1381extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1377extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); 1382extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1378extern int xfrm_replay_check(struct xfrm_state *x, 1383extern int xfrm_replay_check(struct xfrm_state *x,
1379 struct sk_buff *skb, __be32 seq); 1384 struct sk_buff *skb, __be32 seq);
1380extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); 1385extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
@@ -1414,9 +1419,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1414 xfrm_address_t *saddr, u8 proto); 1419 xfrm_address_t *saddr, u8 proto);
1415extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1420extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1416extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1421extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1417extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 1422extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1418extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 1423extern void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr);
1419extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 1424extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr);
1420extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1425extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1421extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1426extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1422extern int xfrm6_output(struct sk_buff *skb); 1427extern int xfrm6_output(struct sk_buff *skb);
@@ -1447,17 +1452,20 @@ extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1447 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1452 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1448extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1453extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1449int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1454int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1450struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir, 1455struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1456 u8 type, int dir,
1451 struct xfrm_selector *sel, 1457 struct xfrm_selector *sel,
1452 struct xfrm_sec_ctx *ctx, int delete, 1458 struct xfrm_sec_ctx *ctx, int delete,
1453 int *err); 1459 int *err);
1454struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err); 1460struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err);
1455int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1461int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1456u32 xfrm_get_acqseq(void); 1462u32 xfrm_get_acqseq(void);
1457extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1463extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1458struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto, 1464struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark,
1459 xfrm_address_t *daddr, xfrm_address_t *saddr, 1465 u8 mode, u32 reqid, u8 proto,
1460 int create, unsigned short family); 1466 xfrm_address_t *daddr,
1467 xfrm_address_t *saddr, int create,
1468 unsigned short family);
1461extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1469extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1462extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, 1470extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1463 struct flowi *fl, int family, int strict); 1471 struct flowi *fl, int family, int strict);
@@ -1500,16 +1508,13 @@ struct scatterlist;
1500typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, 1508typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1501 unsigned int); 1509 unsigned int);
1502 1510
1503extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm,
1504 int offset, int len, icv_update_fn_t icv_update);
1505
1506static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, 1511static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
1507 int family) 1512 int family)
1508{ 1513{
1509 switch (family) { 1514 switch (family) {
1510 default: 1515 default:
1511 case AF_INET: 1516 case AF_INET:
1512 return (__force __u32)a->a4 - (__force __u32)b->a4; 1517 return (__force u32)a->a4 - (__force u32)b->a4;
1513 case AF_INET6: 1518 case AF_INET6:
1514 return ipv6_addr_cmp((struct in6_addr *)a, 1519 return ipv6_addr_cmp((struct in6_addr *)a,
1515 (struct in6_addr *)b); 1520 (struct in6_addr *)b);
@@ -1541,12 +1546,22 @@ static inline int xfrm_alg_len(struct xfrm_algo *alg)
1541 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 1546 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1542} 1547}
1543 1548
1549static inline int xfrm_alg_auth_len(struct xfrm_algo_auth *alg)
1550{
1551 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1552}
1553
1544#ifdef CONFIG_XFRM_MIGRATE 1554#ifdef CONFIG_XFRM_MIGRATE
1545static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1555static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1546{ 1556{
1547 return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); 1557 return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
1548} 1558}
1549 1559
1560static inline struct xfrm_algo_auth *xfrm_algo_auth_clone(struct xfrm_algo_auth *orig)
1561{
1562 return kmemdup(orig, xfrm_alg_auth_len(orig), GFP_KERNEL);
1563}
1564
1550static inline void xfrm_states_put(struct xfrm_state **states, int n) 1565static inline void xfrm_states_put(struct xfrm_state **states, int n)
1551{ 1566{
1552 int i; 1567 int i;
@@ -1569,4 +1584,24 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1569} 1584}
1570#endif 1585#endif
1571 1586
1587static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1588{
1589 if (attrs[XFRMA_MARK])
1590 memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m));
1591 else
1592 m->v = m->m = 0;
1593
1594 return m->v & m->m;
1595}
1596
1597static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m)
1598{
1599 if (m->m | m->v)
1600 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
1601 return 0;
1602
1603nla_put_failure:
1604 return -1;
1605}
1606
1572#endif /* _NET_XFRM_H */ 1607#endif /* _NET_XFRM_H */