aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/af_unix.h4
-rw-r--r--include/net/caif/caif_dev.h8
-rw-r--r--include/net/caif/caif_layer.h6
-rw-r--r--include/net/caif/caif_spi.h153
-rw-r--r--include/net/caif/cfcnfg.h16
-rw-r--r--include/net/caif/cfsrvl.h15
-rw-r--r--include/net/cfg80211.h152
-rw-r--r--include/net/dn_dev.h8
-rw-r--r--include/net/dn_nsp.h16
-rw-r--r--include/net/dn_route.h4
-rw-r--r--include/net/genetlink.h15
-rw-r--r--include/net/inet_common.h59
-rw-r--r--include/net/inet_frag.h1
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/inetpeer.h30
-rw-r--r--include/net/ip.h29
-rw-r--r--include/net/ip6_fib.h10
-rw-r--r--include/net/ip6_tunnel.h2
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h16
-rw-r--r--include/net/ipx.h8
-rw-r--r--include/net/mac80211.h120
-rw-r--r--include/net/mip6.h2
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h17
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h12
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/netfilter/nf_nat_rule.h2
-rw-r--r--include/net/netfilter/xt_rateest.h11
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/phonet/pn_dev.h1
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/route.h6
-rw-r--r--include/net/sch_generic.h38
-rw-r--r--include/net/scm.h30
-rw-r--r--include/net/sctp/structs.h4
-rw-r--r--include/net/snmp.h75
-rw-r--r--include/net/sock.h14
-rw-r--r--include/net/tcp.h260
-rw-r--r--include/net/udp.h38
42 files changed, 758 insertions, 441 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h
index c05fd717c588..bab385f13ac3 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -20,6 +20,7 @@ struct tcf_common {
20 struct gnet_stats_queue tcfc_qstats; 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est tcfc_rate_est; 21 struct gnet_stats_rate_est tcfc_rate_est;
22 spinlock_t tcfc_lock; 22 spinlock_t tcfc_lock;
23 struct rcu_head tcfc_rcu;
23}; 24};
24#define tcf_next common.tcfc_next 25#define tcf_next common.tcfc_next
25#define tcf_index common.tcfc_index 26#define tcf_index common.tcfc_index
@@ -32,6 +33,7 @@ struct tcf_common {
32#define tcf_qstats common.tcfc_qstats 33#define tcf_qstats common.tcfc_qstats
33#define tcf_rate_est common.tcfc_rate_est 34#define tcf_rate_est common.tcfc_rate_est
34#define tcf_lock common.tcfc_lock 35#define tcf_lock common.tcfc_lock
36#define tcf_rcu common.tcfc_rcu
35 37
36struct tcf_police { 38struct tcf_police {
37 struct tcf_common common; 39 struct tcf_common common;
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 20725e213aee..90c9e2872f27 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -23,7 +23,8 @@ struct unix_address {
23}; 23};
24 24
25struct unix_skb_parms { 25struct unix_skb_parms {
26 struct ucred creds; /* Skb credentials */ 26 struct pid *pid; /* Skb credentials */
27 const struct cred *cred;
27 struct scm_fp_list *fp; /* Passed files */ 28 struct scm_fp_list *fp; /* Passed files */
28#ifdef CONFIG_SECURITY_NETWORK 29#ifdef CONFIG_SECURITY_NETWORK
29 u32 secid; /* Security ID */ 30 u32 secid; /* Security ID */
@@ -31,7 +32,6 @@ struct unix_skb_parms {
31}; 32};
32 33
33#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) 34#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
35#define UNIXSID(skb) (&UNIXCB((skb)).secid) 35#define UNIXSID(skb) (&UNIXCB((skb)).secid)
36 36
37#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock) 37#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index 318ab9478a44..6da573c75d54 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -50,6 +50,9 @@ struct caif_connect_request {
50 * @client_layer: User implementation of client layer. This layer 50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions 51 * MUST have receive and control callback functions
52 * implemented. 52 * implemented.
53 * @ifindex: Link layer interface index used for this connection.
54 * @headroom: Head room needed by CAIF protocol.
55 * @tailroom: Tail room needed by CAIF protocol.
53 * 56 *
54 * This function connects a CAIF channel. The Client must implement 57 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds 58 * the struct cflayer. This layer represents the Client layer and holds
@@ -59,8 +62,9 @@ struct caif_connect_request {
59 * E.g. CAIF Socket will call this function for each socket it connects 62 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket. 63 * and have one client_layer instance for each socket.
61 */ 64 */
62int caif_connect_client(struct caif_connect_request *config, 65int caif_connect_client(struct caif_connect_request *conn_req,
63 struct cflayer *client_layer); 66 struct cflayer *client_layer, int *ifindex,
67 int *headroom, int *tailroom);
64 68
65/** 69/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack. 70 * caif_disconnect_client - Disconnects a client from the CAIF stack.
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 25c472f0e5b8..c8b07a904e78 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -15,14 +15,8 @@ struct cfpktq;
15struct caif_payload_info; 15struct caif_payload_info;
16struct caif_packet_funcs; 16struct caif_packet_funcs;
17 17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22 18
23#define CAIF_LAYER_NAME_SZ 16 19#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26 20
27/** 21/**
28 * caif_assert() - Assert function for CAIF. 22 * caif_assert() - Assert function for CAIF.
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h
new file mode 100644
index 000000000000..ce4570dff020
--- /dev/null
+++ b/include/net/caif/caif_spi.h
@@ -0,0 +1,153 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Daniel Martensson / Daniel.Martensson@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_SPI_H_
8#define CAIF_SPI_H_
9
10#include <net/caif/caif_device.h>
11
12#define SPI_CMD_WR 0x00
13#define SPI_CMD_RD 0x01
14#define SPI_CMD_EOT 0x02
15#define SPI_CMD_IND 0x04
16
17#define SPI_DMA_BUF_LEN 8192
18
19#define WL_SZ 2 /* 16 bits. */
20#define SPI_CMD_SZ 4 /* 32 bits. */
21#define SPI_IND_SZ 4 /* 32 bits. */
22
23#define SPI_XFER 0
24#define SPI_SS_ON 1
25#define SPI_SS_OFF 2
26#define SPI_TERMINATE 3
27
28/* Minimum time between different levels is 50 microseconds. */
29#define MIN_TRANSITION_TIME_USEC 50
30
31/* Defines for calculating duration of SPI transfers for a particular
32 * number of bytes.
33 */
34#define SPI_MASTER_CLK_MHZ 13
35#define SPI_XFER_TIME_USEC(bytes, clk) (((bytes) * 8) / clk)
36
37/* Normally this should be aligned on the modem in order to benefit from full
38 * duplex transfers. However a size of 8188 provokes errors when running with
39 * the modem. These errors occur when packet sizes approaches 4 kB of data.
40 */
41#define CAIF_MAX_SPI_FRAME 4092
42
43/* Maximum number of uplink CAIF frames that can reside in the same SPI frame.
44 * This number should correspond with the modem setting. The application side
45 * CAIF accepts any number of embedded downlink CAIF frames.
46 */
47#define CAIF_MAX_SPI_PKTS 9
48
49/* Decides if SPI buffers should be prefilled with 0xFF pattern for easier
50 * debugging. Both TX and RX buffers will be filled before the transfer.
51 */
52#define CFSPI_DBG_PREFILL 0
53
54/* Structure describing a SPI transfer. */
55struct cfspi_xfer {
56 u16 tx_dma_len;
57 u16 rx_dma_len;
58 void *va_tx;
59 dma_addr_t pa_tx;
60 void *va_rx;
61 dma_addr_t pa_rx;
62};
63
64/* Structure implemented by the SPI interface. */
65struct cfspi_ifc {
66 void (*ss_cb) (bool assert, struct cfspi_ifc *ifc);
67 void (*xfer_done_cb) (struct cfspi_ifc *ifc);
68 void *priv;
69};
70
71/* Structure implemented by SPI clients. */
72struct cfspi_dev {
73 int (*init_xfer) (struct cfspi_xfer *xfer, struct cfspi_dev *dev);
74 void (*sig_xfer) (bool xfer, struct cfspi_dev *dev);
75 struct cfspi_ifc *ifc;
76 char *name;
77 u32 clk_mhz;
78 void *priv;
79};
80
81/* Enumeration describing the CAIF SPI state. */
82enum cfspi_state {
83 CFSPI_STATE_WAITING = 0,
84 CFSPI_STATE_AWAKE,
85 CFSPI_STATE_FETCH_PKT,
86 CFSPI_STATE_GET_NEXT,
87 CFSPI_STATE_INIT_XFER,
88 CFSPI_STATE_WAIT_ACTIVE,
89 CFSPI_STATE_SIG_ACTIVE,
90 CFSPI_STATE_WAIT_XFER_DONE,
91 CFSPI_STATE_XFER_DONE,
92 CFSPI_STATE_WAIT_INACTIVE,
93 CFSPI_STATE_SIG_INACTIVE,
94 CFSPI_STATE_DELIVER_PKT,
95 CFSPI_STATE_MAX,
96};
97
98/* Structure implemented by SPI physical interfaces. */
99struct cfspi {
100 struct caif_dev_common cfdev;
101 struct net_device *ndev;
102 struct platform_device *pdev;
103 struct sk_buff_head qhead;
104 struct sk_buff_head chead;
105 u16 cmd;
106 u16 tx_cpck_len;
107 u16 tx_npck_len;
108 u16 rx_cpck_len;
109 u16 rx_npck_len;
110 struct cfspi_ifc ifc;
111 struct cfspi_xfer xfer;
112 struct cfspi_dev *dev;
113 unsigned long state;
114 struct work_struct work;
115 struct workqueue_struct *wq;
116 struct list_head list;
117 int flow_off_sent;
118 u32 qd_low_mark;
119 u32 qd_high_mark;
120 struct completion comp;
121 wait_queue_head_t wait;
122 spinlock_t lock;
123 bool flow_stop;
124#ifdef CONFIG_DEBUG_FS
125 enum cfspi_state dbg_state;
126 u16 pcmd;
127 u16 tx_ppck_len;
128 u16 rx_ppck_len;
129 struct dentry *dbgfs_dir;
130 struct dentry *dbgfs_state;
131 struct dentry *dbgfs_frame;
132#endif /* CONFIG_DEBUG_FS */
133};
134
135extern int spi_frm_align;
136extern int spi_up_head_align;
137extern int spi_up_tail_align;
138extern int spi_down_head_align;
139extern int spi_down_tail_align;
140extern struct platform_driver cfspi_spi_driver;
141
142void cfspi_dbg_state(struct cfspi *cfspi, int state);
143int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len);
144int cfspi_xmitlen(struct cfspi *cfspi);
145int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len);
146int cfspi_spi_remove(struct platform_device *pdev);
147int cfspi_spi_probe(struct platform_device *pdev);
148int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len);
149int cfspi_xmitlen(struct cfspi *cfspi);
150int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len);
151void cfspi_xfer(struct work_struct *work);
152
153#endif /* CAIF_SPI_H_ */
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 9fc2fc20b884..bd646faffa47 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -7,6 +7,7 @@
7#ifndef CFCNFG_H_ 7#ifndef CFCNFG_H_
8#define CFCNFG_H_ 8#define CFCNFG_H_
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/netdevice.h>
10#include <net/caif/caif_layer.h> 11#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h> 12#include <net/caif/cfctrl.h>
12 13
@@ -73,8 +74,8 @@ void cfcnfg_remove(struct cfcnfg *cfg);
73 74
74void 75void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, 76cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid, 77 struct net_device *dev, struct cflayer *phy_layer,
77 enum cfcnfg_phy_preference pref, 78 u16 *phyid, enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx); 79 bool fcs, bool stx);
79 80
80/** 81/**
@@ -114,11 +115,18 @@ void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
114 * @param: Link setup parameters. 115 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and 116 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure. 117 * flow-control functions MUST be set in the structure.
117 * 118 * @ifindex: Link layer interface index used for this connection.
119 * @proto_head: Protocol head-space needed by CAIF protocol,
120 * excluding link layer.
121 * @proto_tail: Protocol tail-space needed by CAIF protocol,
122 * excluding link layer.
118 */ 123 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, 124int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param, 125 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer); 126 struct cflayer *adap_layer,
127 int *ifindex,
128 int *proto_head,
129 int *proto_tail);
122 130
123/** 131/**
124 * cfcnfg_get_phyid() - Get physical ID, given type. 132 * cfcnfg_get_phyid() - Get physical ID, given type.
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index 2dc9eb193ecf..b1fa87ee0992 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -16,6 +16,8 @@ struct cfsrvl {
16 bool open; 16 bool open;
17 bool phy_flow_on; 17 bool phy_flow_on;
18 bool modem_flow_on; 18 bool modem_flow_on;
19 bool supports_flowctrl;
20 void (*release)(struct kref *);
19 struct dev_info dev_info; 21 struct dev_info dev_info;
20 struct kref ref; 22 struct kref ref;
21}; 23};
@@ -25,13 +27,15 @@ struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); 27struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); 28struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info); 29struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info); 30struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
31 int mtu_size);
29struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); 32struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
30bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); 33bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
31void cfservl_destroy(struct cflayer *layer); 34void cfservl_destroy(struct cflayer *layer);
32void cfsrvl_init(struct cfsrvl *service, 35void cfsrvl_init(struct cfsrvl *service,
33 u8 channel_id, 36 u8 channel_id,
34 struct dev_info *dev_info); 37 struct dev_info *dev_info,
38 bool supports_flowctrl);
35bool cfsrvl_ready(struct cfsrvl *service, int *err); 39bool cfsrvl_ready(struct cfsrvl *service, int *err);
36u8 cfsrvl_getphyid(struct cflayer *layer); 40u8 cfsrvl_getphyid(struct cflayer *layer);
37 41
@@ -50,7 +54,10 @@ static inline void cfsrvl_put(struct cflayer *layr)
50 if (layr == NULL) 54 if (layr == NULL)
51 return; 55 return;
52 s = container_of(layr, struct cfsrvl, layer); 56 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release); 57
58 WARN_ON(!s->release);
59 if (s->release)
60 kref_put(&s->ref, s->release);
54} 61}
55 62
56#endif /* CFSRVL_H_ */ 63#endif /* CFSRVL_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b44a2e5321a3..168fe530b214 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -37,6 +37,7 @@
37 * 37 *
38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
40 * @IEEE80211_NUM_BANDS: number of defined bands
40 */ 41 */
41enum ieee80211_band { 42enum ieee80211_band {
42 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 43 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
@@ -89,7 +90,7 @@ enum ieee80211_channel_flags {
89 * @max_power: maximum transmission power (in dBm) 90 * @max_power: maximum transmission power (in dBm)
90 * @beacon_found: helper to regulatory code to indicate when a beacon 91 * @beacon_found: helper to regulatory code to indicate when a beacon
91 * has been found on this channel. Use regulatory_hint_found_beacon() 92 * has been found on this channel. Use regulatory_hint_found_beacon()
92 * to enable this, this is is useful only on 5 GHz band. 93 * to enable this, this is useful only on 5 GHz band.
93 * @orig_mag: internal use 94 * @orig_mag: internal use
94 * @orig_mpwr: internal use 95 * @orig_mpwr: internal use
95 */ 96 */
@@ -188,6 +189,7 @@ struct ieee80211_sta_ht_cap {
188 * in this band. Must be sorted to give a valid "supported 189 * in this band. Must be sorted to give a valid "supported
189 * rates" IE, i.e. CCK rates first, then OFDM. 190 * rates" IE, i.e. CCK rates first, then OFDM.
190 * @n_bitrates: Number of bitrates in @bitrates 191 * @n_bitrates: Number of bitrates in @bitrates
192 * @ht_cap: HT capabilities in this band
191 */ 193 */
192struct ieee80211_supported_band { 194struct ieee80211_supported_band {
193 struct ieee80211_channel *channels; 195 struct ieee80211_channel *channels;
@@ -225,6 +227,7 @@ struct vif_params {
225 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 227 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
226 * with the get_key() callback, must be in little endian, 228 * with the get_key() callback, must be in little endian,
227 * length given by @seq_len. 229 * length given by @seq_len.
230 * @seq_len: length of @seq.
228 */ 231 */
229struct key_params { 232struct key_params {
230 u8 *key; 233 u8 *key;
@@ -237,6 +240,8 @@ struct key_params {
237/** 240/**
238 * enum survey_info_flags - survey information flags 241 * enum survey_info_flags - survey information flags
239 * 242 *
243 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
244 *
240 * Used by the driver to indicate which info in &struct survey_info 245 * Used by the driver to indicate which info in &struct survey_info
241 * it has filled in during the get_survey(). 246 * it has filled in during the get_survey().
242 */ 247 */
@@ -247,13 +252,13 @@ enum survey_info_flags {
247/** 252/**
248 * struct survey_info - channel survey response 253 * struct survey_info - channel survey response
249 * 254 *
250 * Used by dump_survey() to report back per-channel survey information.
251 *
252 * @channel: the channel this survey record reports, mandatory 255 * @channel: the channel this survey record reports, mandatory
253 * @filled: bitflag of flags from &enum survey_info_flags 256 * @filled: bitflag of flags from &enum survey_info_flags
254 * @noise: channel noise in dBm. This and all following fields are 257 * @noise: channel noise in dBm. This and all following fields are
255 * optional 258 * optional
256 * 259 *
260 * Used by dump_survey() to report back per-channel survey information.
261 *
257 * This structure can later be expanded with things like 262 * This structure can later be expanded with things like
258 * channel duty cycle etc. 263 * channel duty cycle etc.
259 */ 264 */
@@ -288,7 +293,7 @@ struct beacon_parameters {
288 * 293 *
289 * @PLINK_ACTION_INVALID: action 0 is reserved 294 * @PLINK_ACTION_INVALID: action 0 is reserved
290 * @PLINK_ACTION_OPEN: start mesh peer link establishment 295 * @PLINK_ACTION_OPEN: start mesh peer link establishment
291 * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 296 * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
292 */ 297 */
293enum plink_actions { 298enum plink_actions {
294 PLINK_ACTION_INVALID, 299 PLINK_ACTION_INVALID,
@@ -311,6 +316,8 @@ enum plink_actions {
311 * (bitmask of BIT(NL80211_STA_FLAG_...)) 316 * (bitmask of BIT(NL80211_STA_FLAG_...))
312 * @listen_interval: listen interval or -1 for no change 317 * @listen_interval: listen interval or -1 for no change
313 * @aid: AID or zero for no change 318 * @aid: AID or zero for no change
319 * @plink_action: plink action to take
320 * @ht_capa: HT capabilities of station
314 */ 321 */
315struct station_parameters { 322struct station_parameters {
316 u8 *supported_rates; 323 u8 *supported_rates;
@@ -448,13 +455,13 @@ enum monitor_flags {
448 * Used by the driver to indicate which info in &struct mpath_info it has filled 455 * Used by the driver to indicate which info in &struct mpath_info it has filled
449 * in during get_station() or dump_station(). 456 * in during get_station() or dump_station().
450 * 457 *
451 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 458 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
452 * MPATH_INFO_SN: @sn filled 459 * @MPATH_INFO_SN: @sn filled
453 * MPATH_INFO_METRIC: @metric filled 460 * @MPATH_INFO_METRIC: @metric filled
454 * MPATH_INFO_EXPTIME: @exptime filled 461 * @MPATH_INFO_EXPTIME: @exptime filled
455 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 462 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
456 * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 463 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
457 * MPATH_INFO_FLAGS: @flags filled 464 * @MPATH_INFO_FLAGS: @flags filled
458 */ 465 */
459enum mpath_info_flags { 466enum mpath_info_flags {
460 MPATH_INFO_FRAME_QLEN = BIT(0), 467 MPATH_INFO_FRAME_QLEN = BIT(0),
@@ -587,6 +594,7 @@ struct cfg80211_ssid {
587 * @ie_len: length of ie in octets 594 * @ie_len: length of ie in octets
588 * @wiphy: the wiphy this was for 595 * @wiphy: the wiphy this was for
589 * @dev: the interface 596 * @dev: the interface
597 * @aborted: (internal) scan request was notified as aborted
590 */ 598 */
591struct cfg80211_scan_request { 599struct cfg80211_scan_request {
592 struct cfg80211_ssid *ssids; 600 struct cfg80211_ssid *ssids;
@@ -623,6 +631,7 @@ enum cfg80211_signal_type {
623 * This structure describes a BSS (which may also be a mesh network) 631 * This structure describes a BSS (which may also be a mesh network)
624 * for use in scan results and similar. 632 * for use in scan results and similar.
625 * 633 *
634 * @channel: channel this BSS is on
626 * @bssid: BSSID of the BSS 635 * @bssid: BSSID of the BSS
627 * @tsf: timestamp of last received update 636 * @tsf: timestamp of last received update
628 * @beacon_interval: the beacon interval as from the frame 637 * @beacon_interval: the beacon interval as from the frame
@@ -801,6 +810,7 @@ struct cfg80211_disassoc_request {
801 * @beacon_interval: beacon interval to use 810 * @beacon_interval: beacon interval to use
802 * @privacy: this is a protected network, keys will be configured 811 * @privacy: this is a protected network, keys will be configured
803 * after joining 812 * after joining
813 * @basic_rates: bitmap of basic rates to use when creating the IBSS
804 */ 814 */
805struct cfg80211_ibss_params { 815struct cfg80211_ibss_params {
806 u8 *ssid; 816 u8 *ssid;
@@ -809,6 +819,7 @@ struct cfg80211_ibss_params {
809 u8 *ie; 819 u8 *ie;
810 u8 ssid_len, ie_len; 820 u8 ssid_len, ie_len;
811 u16 beacon_interval; 821 u16 beacon_interval;
822 u32 basic_rates;
812 bool channel_fixed; 823 bool channel_fixed;
813 bool privacy; 824 bool privacy;
814}; 825};
@@ -826,8 +837,8 @@ struct cfg80211_ibss_params {
826 * @ssid: SSID 837 * @ssid: SSID
827 * @ssid_len: Length of ssid in octets 838 * @ssid_len: Length of ssid in octets
828 * @auth_type: Authentication type (algorithm) 839 * @auth_type: Authentication type (algorithm)
829 * @assoc_ie: IEs for association request 840 * @ie: IEs for association request
830 * @assoc_ie_len: Length of assoc_ie in octets 841 * @ie_len: Length of assoc_ie in octets
831 * @privacy: indicates whether privacy-enabled APs should be used 842 * @privacy: indicates whether privacy-enabled APs should be used
832 * @crypto: crypto settings 843 * @crypto: crypto settings
833 * @key_len: length of WEP key for shared key authentication 844 * @key_len: length of WEP key for shared key authentication
@@ -850,10 +861,11 @@ struct cfg80211_connect_params {
850 861
851/** 862/**
852 * enum wiphy_params_flags - set_wiphy_params bitfield values 863 * enum wiphy_params_flags - set_wiphy_params bitfield values
853 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 864 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
854 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 865 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
855 * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 866 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
856 * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 867 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
868 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
857 */ 869 */
858enum wiphy_params_flags { 870enum wiphy_params_flags {
859 WIPHY_PARAM_RETRY_SHORT = 1 << 0, 871 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
@@ -863,19 +875,6 @@ enum wiphy_params_flags {
863 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 875 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
864}; 876};
865 877
866/**
867 * enum tx_power_setting - TX power adjustment
868 *
869 * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
870 * @TX_POWER_LIMITED: limit TX power by the dbm parameter
871 * @TX_POWER_FIXED: fix TX power to the dbm parameter
872 */
873enum tx_power_setting {
874 TX_POWER_AUTOMATIC,
875 TX_POWER_LIMITED,
876 TX_POWER_FIXED,
877};
878
879/* 878/*
880 * cfg80211_bitrate_mask - masks for bitrate control 879 * cfg80211_bitrate_mask - masks for bitrate control
881 */ 880 */
@@ -949,10 +948,16 @@ struct cfg80211_pmksa {
949 * @del_beacon: Remove beacon configuration and stop sending the beacon. 948 * @del_beacon: Remove beacon configuration and stop sending the beacon.
950 * 949 *
951 * @add_station: Add a new station. 950 * @add_station: Add a new station.
952 *
953 * @del_station: Remove a station; @mac may be NULL to remove all stations. 951 * @del_station: Remove a station; @mac may be NULL to remove all stations.
954 *
955 * @change_station: Modify a given station. 952 * @change_station: Modify a given station.
953 * @get_station: get station information for the station identified by @mac
954 * @dump_station: dump station callback -- resume dump at index @idx
955 *
956 * @add_mpath: add a fixed mesh path
957 * @del_mpath: delete a given mesh path
958 * @change_mpath: change a given mesh path
959 * @get_mpath: get a mesh path for the given parameters
960 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
956 * 961 *
957 * @get_mesh_params: Put the current mesh parameters into *params 962 * @get_mesh_params: Put the current mesh parameters into *params
958 * 963 *
@@ -960,8 +965,6 @@ struct cfg80211_pmksa {
960 * The mask is a bitfield which tells us which parameters to 965 * The mask is a bitfield which tells us which parameters to
961 * set, and which to leave alone. 966 * set, and which to leave alone.
962 * 967 *
963 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
964 *
965 * @change_bss: Modify parameters for a given BSS. 968 * @change_bss: Modify parameters for a given BSS.
966 * 969 *
967 * @set_txq_params: Set TX queue parameters 970 * @set_txq_params: Set TX queue parameters
@@ -1002,6 +1005,8 @@ struct cfg80211_pmksa {
1002 * @get_tx_power: store the current TX power into the dbm variable; 1005 * @get_tx_power: store the current TX power into the dbm variable;
1003 * return 0 if successful 1006 * return 0 if successful
1004 * 1007 *
1008 * @set_wds_peer: set the WDS peer for a WDS interface
1009 *
1005 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 1010 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
1006 * functions to adjust rfkill hw state 1011 * functions to adjust rfkill hw state
1007 * 1012 *
@@ -1019,6 +1024,8 @@ struct cfg80211_pmksa {
1019 * 1024 *
1020 * @testmode_cmd: run a test mode command 1025 * @testmode_cmd: run a test mode command
1021 * 1026 *
1027 * @set_bitrate_mask: set the bitrate mask configuration
1028 *
1022 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 1029 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
1023 * devices running firmwares capable of generating the (re) association 1030 * devices running firmwares capable of generating the (re) association
1024 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 1031 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
@@ -1129,7 +1136,7 @@ struct cfg80211_ops {
1129 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 1136 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
1130 1137
1131 int (*set_tx_power)(struct wiphy *wiphy, 1138 int (*set_tx_power)(struct wiphy *wiphy,
1132 enum tx_power_setting type, int dbm); 1139 enum nl80211_tx_power_setting type, int mbm);
1133 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1140 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
1134 1141
1135 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1142 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
@@ -1168,6 +1175,7 @@ struct cfg80211_ops {
1168 int (*action)(struct wiphy *wiphy, struct net_device *dev, 1175 int (*action)(struct wiphy *wiphy, struct net_device *dev,
1169 struct ieee80211_channel *chan, 1176 struct ieee80211_channel *chan,
1170 enum nl80211_channel_type channel_type, 1177 enum nl80211_channel_type channel_type,
1178 bool channel_type_valid,
1171 const u8 *buf, size_t len, u64 *cookie); 1179 const u8 *buf, size_t len, u64 *cookie);
1172 1180
1173 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1181 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
@@ -1230,8 +1238,6 @@ struct mac_address {
1230 1238
1231/** 1239/**
1232 * struct wiphy - wireless hardware description 1240 * struct wiphy - wireless hardware description
1233 * @idx: the wiphy index assigned to this item
1234 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
1235 * @reg_notifier: the driver's regulatory notification callback 1241 * @reg_notifier: the driver's regulatory notification callback
1236 * @regd: the driver's regulatory domain, if one was requested via 1242 * @regd: the driver's regulatory domain, if one was requested via
1237 * the regulatory_hint() API. This can be used by the driver 1243 * the regulatory_hint() API. This can be used by the driver
@@ -1245,7 +1251,7 @@ struct mac_address {
1245 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1251 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
1246 * -1 = fragmentation disabled, only odd values >= 256 used 1252 * -1 = fragmentation disabled, only odd values >= 256 used
1247 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1253 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1248 * @net: the network namespace this wiphy currently lives in 1254 * @_net: the network namespace this wiphy currently lives in
1249 * @perm_addr: permanent MAC address of this device 1255 * @perm_addr: permanent MAC address of this device
1250 * @addr_mask: If the device supports multiple MAC addresses by masking, 1256 * @addr_mask: If the device supports multiple MAC addresses by masking,
1251 * set this to a mask with variable bits set to 1, e.g. if the last 1257 * set this to a mask with variable bits set to 1, e.g. if the last
@@ -1258,6 +1264,28 @@ struct mac_address {
1258 * by default for perm_addr. In this case, the mask should be set to 1264 * by default for perm_addr. In this case, the mask should be set to
1259 * all-zeroes. In this case it is assumed that the device can handle 1265 * all-zeroes. In this case it is assumed that the device can handle
1260 * the same number of arbitrary MAC addresses. 1266 * the same number of arbitrary MAC addresses.
1267 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
1268 * automatically on wiphy renames
1269 * @dev: (virtual) struct device for this wiphy
1270 * @wext: wireless extension handlers
1271 * @priv: driver private data (sized according to wiphy_new() parameter)
1272 * @interface_modes: bitmask of interfaces types valid for this wiphy,
1273 * must be set by driver
1274 * @flags: wiphy flags, see &enum wiphy_flags
1275 * @bss_priv_size: each BSS struct has private data allocated with it,
1276 * this variable determines its size
1277 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
1278 * any given scan
1279 * @max_scan_ie_len: maximum length of user-controlled IEs device can
1280 * add to probe request frames transmitted during a scan, must not
1281 * include fixed IEs like supported rates
1282 * @coverage_class: current coverage class
1283 * @fw_version: firmware version for ethtool reporting
1284 * @hw_version: hardware version for ethtool reporting
1285 * @max_num_pmkids: maximum number of PMKIDs supported by device
1286 * @privid: a pointer that drivers can use to identify if an arbitrary
1287 * wiphy is theirs, e.g. in global notifiers
1288 * @bands: information about bands/channels supported by this device
1261 */ 1289 */
1262struct wiphy { 1290struct wiphy {
1263 /* assign these fields before you register the wiphy */ 1291 /* assign these fields before you register the wiphy */
@@ -1330,26 +1358,15 @@ struct wiphy {
1330 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1358 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1331}; 1359};
1332 1360
1333#ifdef CONFIG_NET_NS
1334static inline struct net *wiphy_net(struct wiphy *wiphy)
1335{
1336 return wiphy->_net;
1337}
1338
1339static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1340{
1341 wiphy->_net = net;
1342}
1343#else
1344static inline struct net *wiphy_net(struct wiphy *wiphy) 1361static inline struct net *wiphy_net(struct wiphy *wiphy)
1345{ 1362{
1346 return &init_net; 1363 return read_pnet(&wiphy->_net);
1347} 1364}
1348 1365
1349static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1366static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1350{ 1367{
1368 write_pnet(&wiphy->_net, net);
1351} 1369}
1352#endif
1353 1370
1354/** 1371/**
1355 * wiphy_priv - return priv from wiphy 1372 * wiphy_priv - return priv from wiphy
@@ -1471,13 +1488,14 @@ struct cfg80211_cached_keys;
1471 * @ssid: (private) Used by the internal configuration code 1488 * @ssid: (private) Used by the internal configuration code
1472 * @ssid_len: (private) Used by the internal configuration code 1489 * @ssid_len: (private) Used by the internal configuration code
1473 * @wext: (private) Used by the internal wireless extensions compat code 1490 * @wext: (private) Used by the internal wireless extensions compat code
1474 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1475 * @use_4addr: indicates 4addr mode is used on this interface, must be 1491 * @use_4addr: indicates 4addr mode is used on this interface, must be
1476 * set by driver (if supported) on add_interface BEFORE registering the 1492 * set by driver (if supported) on add_interface BEFORE registering the
1477 * netdev and may otherwise be used by driver read-only, will be update 1493 * netdev and may otherwise be used by driver read-only, will be update
1478 * by cfg80211 on change_interface 1494 * by cfg80211 on change_interface
1479 * @action_registrations: list of registrations for action frames 1495 * @action_registrations: list of registrations for action frames
1480 * @action_registrations_lock: lock for the list 1496 * @action_registrations_lock: lock for the list
1497 * @mtx: mutex used to lock data in this struct
1498 * @cleanup_work: work struct used for cleanup that can't be done directly
1481 */ 1499 */
1482struct wireless_dev { 1500struct wireless_dev {
1483 struct wiphy *wiphy; 1501 struct wiphy *wiphy;
@@ -1551,11 +1569,13 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
1551 1569
1552/** 1570/**
1553 * ieee80211_channel_to_frequency - convert channel number to frequency 1571 * ieee80211_channel_to_frequency - convert channel number to frequency
1572 * @chan: channel number
1554 */ 1573 */
1555extern int ieee80211_channel_to_frequency(int chan); 1574extern int ieee80211_channel_to_frequency(int chan);
1556 1575
1557/** 1576/**
1558 * ieee80211_frequency_to_channel - convert frequency to channel number 1577 * ieee80211_frequency_to_channel - convert frequency to channel number
1578 * @freq: center frequency
1559 */ 1579 */
1560extern int ieee80211_frequency_to_channel(int freq); 1580extern int ieee80211_frequency_to_channel(int freq);
1561 1581
@@ -1570,6 +1590,8 @@ extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1570 int freq); 1590 int freq);
1571/** 1591/**
1572 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1592 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1593 * @wiphy: the struct wiphy to get the channel for
1594 * @freq: the center frequency of the channel
1573 */ 1595 */
1574static inline struct ieee80211_channel * 1596static inline struct ieee80211_channel *
1575ieee80211_get_channel(struct wiphy *wiphy, int freq) 1597ieee80211_get_channel(struct wiphy *wiphy, int freq)
@@ -1630,9 +1652,6 @@ struct ieee80211_radiotap_vendor_namespaces {
1630 * @is_radiotap_ns: indicates whether the current namespace is the default 1652 * @is_radiotap_ns: indicates whether the current namespace is the default
1631 * radiotap namespace or not 1653 * radiotap namespace or not
1632 * 1654 *
1633 * @overrides: override standard radiotap fields
1634 * @n_overrides: number of overrides
1635 *
1636 * @_rtheader: pointer to the radiotap header we are walking through 1655 * @_rtheader: pointer to the radiotap header we are walking through
1637 * @_max_length: length of radiotap header in cpu byte ordering 1656 * @_max_length: length of radiotap header in cpu byte ordering
1638 * @_arg_index: next argument index 1657 * @_arg_index: next argument index
@@ -1948,10 +1967,12 @@ int cfg80211_wext_giwap(struct net_device *dev,
1948void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 1967void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
1949 1968
1950/** 1969/**
1951 * cfg80211_inform_bss - inform cfg80211 of a new BSS 1970 * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
1952 * 1971 *
1953 * @wiphy: the wiphy reporting the BSS 1972 * @wiphy: the wiphy reporting the BSS
1954 * @bss: the found BSS 1973 * @channel: The channel the frame was received on
1974 * @mgmt: the management frame (probe response or beacon)
1975 * @len: length of the management frame
1955 * @signal: the signal strength, type depends on the wiphy's signal_type 1976 * @signal: the signal strength, type depends on the wiphy's signal_type
1956 * @gfp: context flags 1977 * @gfp: context flags
1957 * 1978 *
@@ -1964,6 +1985,23 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
1964 struct ieee80211_mgmt *mgmt, size_t len, 1985 struct ieee80211_mgmt *mgmt, size_t len,
1965 s32 signal, gfp_t gfp); 1986 s32 signal, gfp_t gfp);
1966 1987
1988/**
1989 * cfg80211_inform_bss - inform cfg80211 of a new BSS
1990 *
1991 * @wiphy: the wiphy reporting the BSS
1992 * @channel: The channel the frame was received on
1993 * @bssid: the BSSID of the BSS
1994 * @timestamp: the TSF timestamp sent by the peer
1995 * @capability: the capability field sent by the peer
1996 * @beacon_interval: the beacon interval announced by the peer
1997 * @ie: additional IEs sent by the peer
1998 * @ielen: length of the additional IEs
1999 * @signal: the signal strength, type depends on the wiphy's signal_type
2000 * @gfp: context flags
2001 *
2002 * This informs cfg80211 that BSS information was found and
2003 * the BSS should be updated/added.
2004 */
1967struct cfg80211_bss* 2005struct cfg80211_bss*
1968cfg80211_inform_bss(struct wiphy *wiphy, 2006cfg80211_inform_bss(struct wiphy *wiphy,
1969 struct ieee80211_channel *channel, 2007 struct ieee80211_channel *channel,
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index 511a459ec10f..0916bbf3bdff 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -101,7 +101,7 @@ struct dn_short_packet {
101 __le16 dstnode; 101 __le16 dstnode;
102 __le16 srcnode; 102 __le16 srcnode;
103 __u8 forward; 103 __u8 forward;
104} __attribute__((packed)); 104} __packed;
105 105
106struct dn_long_packet { 106struct dn_long_packet {
107 __u8 msgflg; 107 __u8 msgflg;
@@ -115,7 +115,7 @@ struct dn_long_packet {
115 __u8 visit_ct; 115 __u8 visit_ct;
116 __u8 s_class; 116 __u8 s_class;
117 __u8 pt; 117 __u8 pt;
118} __attribute__((packed)); 118} __packed;
119 119
120/*------------------------- DRP - Routing messages ---------------------*/ 120/*------------------------- DRP - Routing messages ---------------------*/
121 121
@@ -132,7 +132,7 @@ struct endnode_hello_message {
132 __u8 mpd; 132 __u8 mpd;
133 __u8 datalen; 133 __u8 datalen;
134 __u8 data[2]; 134 __u8 data[2];
135} __attribute__((packed)); 135} __packed;
136 136
137struct rtnode_hello_message { 137struct rtnode_hello_message {
138 __u8 msgflg; 138 __u8 msgflg;
@@ -144,7 +144,7 @@ struct rtnode_hello_message {
144 __u8 area; 144 __u8 area;
145 __le16 timer; 145 __le16 timer;
146 __u8 mpd; 146 __u8 mpd;
147} __attribute__((packed)); 147} __packed;
148 148
149 149
150extern void dn_dev_init(void); 150extern void dn_dev_init(void);
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index 17d43d2db5ec..e43a2893f132 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -74,18 +74,18 @@ struct nsp_data_seg_msg {
74 __u8 msgflg; 74 __u8 msgflg;
75 __le16 dstaddr; 75 __le16 dstaddr;
76 __le16 srcaddr; 76 __le16 srcaddr;
77} __attribute__((packed)); 77} __packed;
78 78
79struct nsp_data_opt_msg { 79struct nsp_data_opt_msg {
80 __le16 acknum; 80 __le16 acknum;
81 __le16 segnum; 81 __le16 segnum;
82 __le16 lsflgs; 82 __le16 lsflgs;
83} __attribute__((packed)); 83} __packed;
84 84
85struct nsp_data_opt_msg1 { 85struct nsp_data_opt_msg1 {
86 __le16 acknum; 86 __le16 acknum;
87 __le16 segnum; 87 __le16 segnum;
88} __attribute__((packed)); 88} __packed;
89 89
90 90
91/* Acknowledgment Message (data/other data) */ 91/* Acknowledgment Message (data/other data) */
@@ -94,13 +94,13 @@ struct nsp_data_ack_msg {
94 __le16 dstaddr; 94 __le16 dstaddr;
95 __le16 srcaddr; 95 __le16 srcaddr;
96 __le16 acknum; 96 __le16 acknum;
97} __attribute__((packed)); 97} __packed;
98 98
99/* Connect Acknowledgment Message */ 99/* Connect Acknowledgment Message */
100struct nsp_conn_ack_msg { 100struct nsp_conn_ack_msg {
101 __u8 msgflg; 101 __u8 msgflg;
102 __le16 dstaddr; 102 __le16 dstaddr;
103} __attribute__((packed)); 103} __packed;
104 104
105 105
106/* Connect Initiate/Retransmit Initiate/Connect Confirm */ 106/* Connect Initiate/Retransmit Initiate/Connect Confirm */
@@ -117,7 +117,7 @@ struct nsp_conn_init_msg {
117#define NSP_FC_MASK 0x0c /* FC type mask */ 117#define NSP_FC_MASK 0x0c /* FC type mask */
118 __u8 info; 118 __u8 info;
119 __le16 segsize; 119 __le16 segsize;
120} __attribute__((packed)); 120} __packed;
121 121
122/* Disconnect Initiate/Disconnect Confirm */ 122/* Disconnect Initiate/Disconnect Confirm */
123struct nsp_disconn_init_msg { 123struct nsp_disconn_init_msg {
@@ -125,7 +125,7 @@ struct nsp_disconn_init_msg {
125 __le16 dstaddr; 125 __le16 dstaddr;
126 __le16 srcaddr; 126 __le16 srcaddr;
127 __le16 reason; 127 __le16 reason;
128} __attribute__((packed)); 128} __packed;
129 129
130 130
131 131
@@ -135,7 +135,7 @@ struct srcobj_fmt {
135 __le16 grpcode; 135 __le16 grpcode;
136 __le16 usrcode; 136 __le16 usrcode;
137 __u8 dlen; 137 __u8 dlen;
138} __attribute__((packed)); 138} __packed;
139 139
140/* 140/*
141 * A collection of functions for manipulating the sequence 141 * A collection of functions for manipulating the sequence
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 60c9f22d8694..ccadab3aa3f6 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -65,9 +65,7 @@ extern void dn_rt_cache_flush(int delay);
65 * packets to the originating host. 65 * packets to the originating host.
66 */ 66 */
67struct dn_route { 67struct dn_route {
68 union { 68 struct dst_entry dst;
69 struct dst_entry dst;
70 } u;
71 69
72 struct flowi fl; 70 struct flowi fl;
73 71
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index eb551baafc04..f7dcd2c70412 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -68,26 +68,15 @@ struct genl_info {
68#endif 68#endif
69}; 69};
70 70
71#ifdef CONFIG_NET_NS
72static inline struct net *genl_info_net(struct genl_info *info) 71static inline struct net *genl_info_net(struct genl_info *info)
73{ 72{
74 return info->_net; 73 return read_pnet(&info->_net);
75} 74}
76 75
77static inline void genl_info_net_set(struct genl_info *info, struct net *net) 76static inline void genl_info_net_set(struct genl_info *info, struct net *net)
78{ 77{
79 info->_net = net; 78 write_pnet(&info->_net, net);
80} 79}
81#else
82static inline struct net *genl_info_net(struct genl_info *info)
83{
84 return &init_net;
85}
86
87static inline void genl_info_net_set(struct genl_info *info, struct net *net)
88{
89}
90#endif
91 80
92/** 81/**
93 * struct genl_ops - generic netlink operations 82 * struct genl_ops - generic netlink operations
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 18c773286b91..22fac9892b16 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -1,8 +1,8 @@
1#ifndef _INET_COMMON_H 1#ifndef _INET_COMMON_H
2#define _INET_COMMON_H 2#define _INET_COMMON_H
3 3
4extern const struct proto_ops inet_stream_ops; 4extern const struct proto_ops inet_stream_ops;
5extern const struct proto_ops inet_dgram_ops; 5extern const struct proto_ops inet_dgram_ops;
6 6
7/* 7/*
8 * INET4 prototypes used by INET6 8 * INET4 prototypes used by INET6
@@ -13,37 +13,28 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16extern int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, 17extern int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
18 struct sockaddr * uaddr, 18 int addr_len, int flags);
19 int addr_len, int flags); 19extern int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr,
20extern int inet_dgram_connect(struct socket *sock, 20 int addr_len, int flags);
21 struct sockaddr * uaddr, 21extern int inet_accept(struct socket *sock, struct socket *newsock, int flags);
22 int addr_len, int flags); 22extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock,
23extern int inet_accept(struct socket *sock, 23 struct msghdr *msg, size_t size);
24 struct socket *newsock, int flags); 24extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
25extern int inet_sendmsg(struct kiocb *iocb, 25 size_t size, int flags);
26 struct socket *sock, 26extern int inet_recvmsg(struct kiocb *iocb, struct socket *sock,
27 struct msghdr *msg, 27 struct msghdr *msg, size_t size, int flags);
28 size_t size); 28extern int inet_shutdown(struct socket *sock, int how);
29extern int inet_shutdown(struct socket *sock, int how); 29extern int inet_listen(struct socket *sock, int backlog);
30extern int inet_listen(struct socket *sock, int backlog); 30extern void inet_sock_destruct(struct sock *sk);
31 31extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
32extern void inet_sock_destruct(struct sock *sk); 32extern int inet_getname(struct socket *sock, struct sockaddr *uaddr,
33 33 int *uaddr_len, int peer);
34extern int inet_bind(struct socket *sock, 34extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
35 struct sockaddr *uaddr, int addr_len); 35extern int inet_ctl_sock_create(struct sock **sk, unsigned short family,
36extern int inet_getname(struct socket *sock, 36 unsigned short type, unsigned char protocol,
37 struct sockaddr *uaddr, 37 struct net *net);
38 int *uaddr_len, int peer);
39extern int inet_ioctl(struct socket *sock,
40 unsigned int cmd, unsigned long arg);
41
42extern int inet_ctl_sock_create(struct sock **sk,
43 unsigned short family,
44 unsigned short type,
45 unsigned char protocol,
46 struct net *net);
47 38
48static inline void inet_ctl_sock_destroy(struct sock *sk) 39static inline void inet_ctl_sock_destroy(struct sock *sk)
49{ 40{
@@ -51,5 +42,3 @@ static inline void inet_ctl_sock_destroy(struct sock *sk)
51} 42}
52 43
53#endif 44#endif
54
55
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 39f2dc943908..16ff29a7bb30 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -20,6 +20,7 @@ struct inet_frag_queue {
20 atomic_t refcnt; 20 atomic_t refcnt;
21 struct timer_list timer; /* when will this queue expire? */ 21 struct timer_list timer; /* when will this queue expire? */
22 struct sk_buff *fragments; /* list of received fragments */ 22 struct sk_buff *fragments; /* list of received fragments */
23 struct sk_buff *fragments_tail;
23 ktime_t stamp; 24 ktime_t stamp;
24 int len; /* total length of orig datagram */ 25 int len; /* total length of orig datagram */
25 int meat; 26 int meat;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1653de515cee..1989cfd7405f 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -137,7 +137,8 @@ struct inet_sock {
137 hdrincl:1, 137 hdrincl:1,
138 mc_loop:1, 138 mc_loop:1,
139 transparent:1, 139 transparent:1,
140 mc_all:1; 140 mc_all:1,
141 nodefrag:1;
141 int mc_index; 142 int mc_index;
142 __be32 mc_addr; 143 __be32 mc_addr;
143 struct ip_mc_socklist *mc_list; 144 struct ip_mc_socklist *mc_list;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 87b1df0d4d8c..417d0c894f29 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -22,10 +22,21 @@ struct inet_peer {
22 __u32 dtime; /* the time of last use of not 22 __u32 dtime; /* the time of last use of not
23 * referenced entries */ 23 * referenced entries */
24 atomic_t refcnt; 24 atomic_t refcnt;
25 atomic_t rid; /* Frag reception counter */ 25 /*
26 atomic_t ip_id_count; /* IP ID for the next packet */ 26 * Once inet_peer is queued for deletion (refcnt == -1), following fields
27 __u32 tcp_ts; 27 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
28 __u32 tcp_ts_stamp; 28 * We can share memory with rcu_head to keep inet_peer small
29 * (less then 64 bytes)
30 */
31 union {
32 struct {
33 atomic_t rid; /* Frag reception counter */
34 atomic_t ip_id_count; /* IP ID for the next packet */
35 __u32 tcp_ts;
36 __u32 tcp_ts_stamp;
37 };
38 struct rcu_head rcu;
39 };
29}; 40};
30 41
31void inet_initpeers(void) __init; 42void inet_initpeers(void) __init;
@@ -36,10 +47,21 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create);
36/* can be called from BH context or outside */ 47/* can be called from BH context or outside */
37extern void inet_putpeer(struct inet_peer *p); 48extern void inet_putpeer(struct inet_peer *p);
38 49
50/*
51 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
52 * tcp_ts_stamp if no refcount is taken on inet_peer
53 */
54static inline void inet_peer_refcheck(const struct inet_peer *p)
55{
56 WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
57}
58
59
39/* can be called with or without local BH being disabled */ 60/* can be called with or without local BH being disabled */
40static inline __u16 inet_getid(struct inet_peer *p, int more) 61static inline __u16 inet_getid(struct inet_peer *p, int more)
41{ 62{
42 more++; 63 more++;
64 inet_peer_refcheck(p);
43 return atomic_add_return(more, &p->ip_id_count) - more; 65 return atomic_add_return(more, &p->ip_id_count) - more;
44} 66}
45 67
diff --git a/include/net/ip.h b/include/net/ip.h
index 452f229c380a..890f9725d681 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -61,11 +61,14 @@ struct ipcm_cookie {
61struct ip_ra_chain { 61struct ip_ra_chain {
62 struct ip_ra_chain *next; 62 struct ip_ra_chain *next;
63 struct sock *sk; 63 struct sock *sk;
64 void (*destructor)(struct sock *); 64 union {
65 void (*destructor)(struct sock *);
66 struct sock *saved_sk;
67 };
68 struct rcu_head rcu;
65}; 69};
66 70
67extern struct ip_ra_chain *ip_ra_chain; 71extern struct ip_ra_chain *ip_ra_chain;
68extern rwlock_t ip_ra_lock;
69 72
70/* IP flags. */ 73/* IP flags. */
71#define IP_CE 0x8000 /* Flag: "Congestion" */ 74#define IP_CE 0x8000 /* Flag: "Congestion" */
@@ -162,12 +165,12 @@ struct ipv4_config {
162}; 165};
163 166
164extern struct ipv4_config ipv4_config; 167extern struct ipv4_config ipv4_config;
165#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) 168#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
166#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) 169#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
167#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val) 170#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
168#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) 171#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val)
169#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val) 172#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
170#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val) 173#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS64_BH((net)->mib.ip_statistics, field, val)
171#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 174#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
172#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 175#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
173#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 176#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
@@ -175,7 +178,15 @@ extern struct ipv4_config ipv4_config;
175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 178#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
176 179
177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); 180extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); 181#if BITS_PER_LONG==32
182extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
183#else
184static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off)
185{
186 return snmp_fold_field(mib, offt);
187}
188#endif
189extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
179extern void snmp_mib_free(void __percpu *ptr[2]); 190extern void snmp_mib_free(void __percpu *ptr[2]);
180 191
181extern struct local_ports { 192extern struct local_ports {
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 4b1dc1161c37..062a823d311c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -84,13 +84,11 @@ struct rt6key {
84struct fib6_table; 84struct fib6_table;
85 85
86struct rt6_info { 86struct rt6_info {
87 union { 87 struct dst_entry dst;
88 struct dst_entry dst;
89 } u;
90 88
91#define rt6i_dev u.dst.dev 89#define rt6i_dev dst.dev
92#define rt6i_nexthop u.dst.neighbour 90#define rt6i_nexthop dst.neighbour
93#define rt6i_expires u.dst.expires 91#define rt6i_expires dst.expires
94 92
95 /* 93 /*
96 * Tail elements of dst_entry (__refcnt etc.) 94 * Tail elements of dst_entry (__refcnt etc.)
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index fbf9d1cda27b..fc94ec568a50 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -27,6 +27,6 @@ struct ipv6_tlv_tnl_enc_lim {
27 __u8 type; /* type-code for option */ 27 __u8 type; /* type-code for option */
28 __u8 length; /* option length */ 28 __u8 length; /* option length */
29 __u8 encap_limit; /* tunnel encapsulation limit */ 29 __u8 encap_limit; /* tunnel encapsulation limit */
30} __attribute__ ((packed)); 30} __packed;
31 31
32#endif 32#endif
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 11e8513d2d07..65caea8b414f 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -50,7 +50,7 @@ struct ip_tunnel_prl_entry {
50 int pkt_len = skb->len - skb_transport_offset(skb); \ 50 int pkt_len = skb->len - skb_transport_offset(skb); \
51 \ 51 \
52 skb->ip_summed = CHECKSUM_NONE; \ 52 skb->ip_summed = CHECKSUM_NONE; \
53 ip_select_ident(iph, &rt->u.dst, NULL); \ 53 ip_select_ident(iph, &rt->dst, NULL); \
54 \ 54 \
55 err = ip_local_out(skb); \ 55 err = ip_local_out(skb); \
56 if (likely(net_xmit_eval(err) == 0)) { \ 56 if (likely(net_xmit_eval(err) == 0)) { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 2600b69757b8..1f8412410998 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -136,17 +136,17 @@ extern struct ctl_path net_ipv6_ctl_path[];
136/* MIBs */ 136/* MIBs */
137 137
138#define IP6_INC_STATS(net, idev,field) \ 138#define IP6_INC_STATS(net, idev,field) \
139 _DEVINC(net, ipv6, , idev, field) 139 _DEVINC(net, ipv6, 64, idev, field)
140#define IP6_INC_STATS_BH(net, idev,field) \ 140#define IP6_INC_STATS_BH(net, idev,field) \
141 _DEVINC(net, ipv6, _BH, idev, field) 141 _DEVINC(net, ipv6, 64_BH, idev, field)
142#define IP6_ADD_STATS(net, idev,field,val) \ 142#define IP6_ADD_STATS(net, idev,field,val) \
143 _DEVADD(net, ipv6, , idev, field, val) 143 _DEVADD(net, ipv6, 64, idev, field, val)
144#define IP6_ADD_STATS_BH(net, idev,field,val) \ 144#define IP6_ADD_STATS_BH(net, idev,field,val) \
145 _DEVADD(net, ipv6, _BH, idev, field, val) 145 _DEVADD(net, ipv6, 64_BH, idev, field, val)
146#define IP6_UPD_PO_STATS(net, idev,field,val) \ 146#define IP6_UPD_PO_STATS(net, idev,field,val) \
147 _DEVUPD(net, ipv6, , idev, field, val) 147 _DEVUPD(net, ipv6, 64, idev, field, val)
148#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ 148#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
149 _DEVUPD(net, ipv6, _BH, idev, field, val) 149 _DEVUPD(net, ipv6, 64_BH, idev, field, val)
150#define ICMP6_INC_STATS(net, idev, field) \ 150#define ICMP6_INC_STATS(net, idev, field) \
151 _DEVINC(net, icmpv6, , idev, field) 151 _DEVINC(net, icmpv6, , idev, field)
152#define ICMP6_INC_STATS_BH(net, idev, field) \ 152#define ICMP6_INC_STATS_BH(net, idev, field) \
@@ -551,6 +551,10 @@ extern int ipv6_ext_hdr(u8 nexthdr);
551 551
552extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 552extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
553 553
554extern struct in6_addr *fl6_update_dst(struct flowi *fl,
555 const struct ipv6_txoptions *opt,
556 struct in6_addr *orig);
557
554/* 558/*
555 * socket options (ipv6_sockglue.c) 559 * socket options (ipv6_sockglue.c)
556 */ 560 */
diff --git a/include/net/ipx.h b/include/net/ipx.h
index ef51a668ba19..05d7e4a88b49 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -27,9 +27,9 @@ struct ipx_address {
27#define IPX_MAX_PPROP_HOPS 8 27#define IPX_MAX_PPROP_HOPS 8
28 28
29struct ipxhdr { 29struct ipxhdr {
30 __be16 ipx_checksum __attribute__ ((packed)); 30 __be16 ipx_checksum __packed;
31#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF) 31#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
32 __be16 ipx_pktsize __attribute__ ((packed)); 32 __be16 ipx_pktsize __packed;
33 __u8 ipx_tctrl; 33 __u8 ipx_tctrl;
34 __u8 ipx_type; 34 __u8 ipx_type;
35#define IPX_TYPE_UNKNOWN 0x00 35#define IPX_TYPE_UNKNOWN 0x00
@@ -38,8 +38,8 @@ struct ipxhdr {
38#define IPX_TYPE_SPX 0x05 /* SPX protocol */ 38#define IPX_TYPE_SPX 0x05 /* SPX protocol */
39#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */ 39#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
40#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */ 40#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
41 struct ipx_address ipx_dest __attribute__ ((packed)); 41 struct ipx_address ipx_dest __packed;
42 struct ipx_address ipx_source __attribute__ ((packed)); 42 struct ipx_address ipx_source __packed;
43}; 43};
44 44
45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index de22cbfef232..7f256e23c57f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -146,6 +146,7 @@ struct ieee80211_low_level_stats {
146 * enabled/disabled (beaconing modes) 146 * enabled/disabled (beaconing modes)
147 * @BSS_CHANGED_CQM: Connection quality monitor config changed 147 * @BSS_CHANGED_CQM: Connection quality monitor config changed
148 * @BSS_CHANGED_IBSS: IBSS join status changed 148 * @BSS_CHANGED_IBSS: IBSS join status changed
149 * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed.
149 */ 150 */
150enum ieee80211_bss_change { 151enum ieee80211_bss_change {
151 BSS_CHANGED_ASSOC = 1<<0, 152 BSS_CHANGED_ASSOC = 1<<0,
@@ -160,10 +161,18 @@ enum ieee80211_bss_change {
160 BSS_CHANGED_BEACON_ENABLED = 1<<9, 161 BSS_CHANGED_BEACON_ENABLED = 1<<9,
161 BSS_CHANGED_CQM = 1<<10, 162 BSS_CHANGED_CQM = 1<<10,
162 BSS_CHANGED_IBSS = 1<<11, 163 BSS_CHANGED_IBSS = 1<<11,
164 BSS_CHANGED_ARP_FILTER = 1<<12,
163 165
164 /* when adding here, make sure to change ieee80211_reconfig */ 166 /* when adding here, make sure to change ieee80211_reconfig */
165}; 167};
166 168
169/*
170 * The maximum number of IPv4 addresses listed for ARP filtering. If the number
171 * of addresses for an interface increase beyond this value, hardware ARP
172 * filtering will be disabled.
173 */
174#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
175
167/** 176/**
168 * struct ieee80211_bss_conf - holds the BSS's changing parameters 177 * struct ieee80211_bss_conf - holds the BSS's changing parameters
169 * 178 *
@@ -199,6 +208,15 @@ enum ieee80211_bss_change {
199 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value 208 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
200 * implies disabled 209 * implies disabled
201 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis 210 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
211 * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
212 * may filter ARP queries targeted for other addresses than listed here.
213 * The driver must allow ARP queries targeted for all address listed here
214 * to pass through. An empty list implies no ARP queries need to pass.
215 * @arp_addr_cnt: Number of addresses currently on the list.
216 * @arp_filter_enabled: Enable ARP filtering - if enabled, the hardware may
217 * filter ARP queries based on the @arp_addr_list, if disabled, the
218 * hardware must not perform any ARP filtering. Note, that the filter will
219 * be enabled also in promiscuous mode.
202 */ 220 */
203struct ieee80211_bss_conf { 221struct ieee80211_bss_conf {
204 const u8 *bssid; 222 const u8 *bssid;
@@ -219,6 +237,9 @@ struct ieee80211_bss_conf {
219 s32 cqm_rssi_thold; 237 s32 cqm_rssi_thold;
220 u32 cqm_rssi_hyst; 238 u32 cqm_rssi_hyst;
221 enum nl80211_channel_type channel_type; 239 enum nl80211_channel_type channel_type;
240 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
241 u8 arp_addr_cnt;
242 bool arp_filter_enabled;
222}; 243};
223 244
224/** 245/**
@@ -312,9 +333,10 @@ enum mac80211_tx_control_flags {
312 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 333 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
313 IEEE80211_TX_CTL_LDPC = BIT(22), 334 IEEE80211_TX_CTL_LDPC = BIT(22),
314 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), 335 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
315#define IEEE80211_TX_CTL_STBC_SHIFT 23
316}; 336};
317 337
338#define IEEE80211_TX_CTL_STBC_SHIFT 23
339
318/** 340/**
319 * enum mac80211_rate_control_flags - per-rate flags set by the 341 * enum mac80211_rate_control_flags - per-rate flags set by the
320 * Rate Control algorithm. 342 * Rate Control algorithm.
@@ -412,8 +434,6 @@ struct ieee80211_tx_rate {
412 * @driver_data: array of driver_data pointers 434 * @driver_data: array of driver_data pointers
413 * @ampdu_ack_len: number of acked aggregated frames. 435 * @ampdu_ack_len: number of acked aggregated frames.
414 * relevant only if IEEE80211_TX_STAT_AMPDU was set. 436 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
415 * @ampdu_ack_map: block ack bit map for the aggregation.
416 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
417 * @ampdu_len: number of aggregated frames. 437 * @ampdu_len: number of aggregated frames.
418 * relevant only if IEEE80211_TX_STAT_AMPDU was set. 438 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
419 * @ack_signal: signal strength of the ACK frame 439 * @ack_signal: signal strength of the ACK frame
@@ -448,10 +468,9 @@ struct ieee80211_tx_info {
448 struct { 468 struct {
449 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 469 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
450 u8 ampdu_ack_len; 470 u8 ampdu_ack_len;
451 u64 ampdu_ack_map;
452 int ack_signal; 471 int ack_signal;
453 u8 ampdu_len; 472 u8 ampdu_len;
454 /* 7 bytes free */ 473 /* 15 bytes free */
455 } status; 474 } status;
456 struct { 475 struct {
457 struct ieee80211_tx_rate driver_rates[ 476 struct ieee80211_tx_rate driver_rates[
@@ -676,9 +695,6 @@ enum ieee80211_smps_mode {
676 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 695 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
677 * powersave documentation below. This variable is valid only when 696 * powersave documentation below. This variable is valid only when
678 * the CONF_PS flag is set. 697 * the CONF_PS flag is set.
679 * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
680 * by cfg80211 (essentially, wext) If set, this value overrules the value
681 * chosen by mac80211 based on ps qos network latency.
682 * 698 *
683 * @power_level: requested transmit power (in dBm) 699 * @power_level: requested transmit power (in dBm)
684 * 700 *
@@ -698,7 +714,7 @@ enum ieee80211_smps_mode {
698 */ 714 */
699struct ieee80211_conf { 715struct ieee80211_conf {
700 u32 flags; 716 u32 flags;
701 int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout; 717 int power_level, dynamic_ps_timeout;
702 int max_sleep_period; 718 int max_sleep_period;
703 719
704 u16 listen_interval; 720 u16 listen_interval;
@@ -815,7 +831,6 @@ enum ieee80211_key_flags {
815 * encrypted in hardware. 831 * encrypted in hardware.
816 * @alg: The key algorithm. 832 * @alg: The key algorithm.
817 * @flags: key flags, see &enum ieee80211_key_flags. 833 * @flags: key flags, see &enum ieee80211_key_flags.
818 * @ap_addr: AP's MAC address
819 * @keyidx: the key index (0-3) 834 * @keyidx: the key index (0-3)
820 * @keylen: key material length 835 * @keylen: key material length
821 * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) 836 * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte)
@@ -881,16 +896,12 @@ struct ieee80211_sta {
881 * enum sta_notify_cmd - sta notify command 896 * enum sta_notify_cmd - sta notify command
882 * 897 *
883 * Used with the sta_notify() callback in &struct ieee80211_ops, this 898 * Used with the sta_notify() callback in &struct ieee80211_ops, this
884 * indicates addition and removal of a station to station table, 899 * indicates if an associated station made a power state transition.
885 * or if a associated station made a power state transition.
886 * 900 *
887 * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table
888 * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table
889 * @STA_NOTIFY_SLEEP: a station is now sleeping 901 * @STA_NOTIFY_SLEEP: a station is now sleeping
890 * @STA_NOTIFY_AWAKE: a sleeping station woke up 902 * @STA_NOTIFY_AWAKE: a sleeping station woke up
891 */ 903 */
892enum sta_notify_cmd { 904enum sta_notify_cmd {
893 STA_NOTIFY_ADD, STA_NOTIFY_REMOVE,
894 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE, 905 STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
895}; 906};
896 907
@@ -1260,6 +1271,15 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1260 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS 1271 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
1261 * enabled whenever user has enabled powersave. 1272 * enabled whenever user has enabled powersave.
1262 * 1273 *
1274 * Some hardware need to toggle a single shared antenna between WLAN and
1275 * Bluetooth to facilitate co-existence. These types of hardware set
1276 * limitations on the use of host controlled dynamic powersave whenever there
1277 * is simultaneous WLAN and Bluetooth traffic. For these types of hardware, the
1278 * driver may request temporarily going into full power save, in order to
1279 * enable toggling the antenna between BT and WLAN. If the driver requests
1280 * disabling dynamic powersave, the @dynamic_ps_timeout value will be
1281 * temporarily set to zero until the driver re-enables dynamic powersave.
1282 *
1263 * Driver informs U-APSD client support by enabling 1283 * Driver informs U-APSD client support by enabling
1264 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the 1284 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1265 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS 1285 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS
@@ -1451,7 +1471,7 @@ enum ieee80211_filter_flags {
1451 * 1471 *
1452 * Note that drivers MUST be able to deal with a TX aggregation 1472 * Note that drivers MUST be able to deal with a TX aggregation
1453 * session being stopped even before they OK'ed starting it by 1473 * session being stopped even before they OK'ed starting it by
1454 * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer 1474 * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer
1455 * might receive the addBA frame and send a delBA right away! 1475 * might receive the addBA frame and send a delBA right away!
1456 * 1476 *
1457 * @IEEE80211_AMPDU_RX_START: start Rx aggregation 1477 * @IEEE80211_AMPDU_RX_START: start Rx aggregation
@@ -1636,7 +1656,7 @@ enum ieee80211_ampdu_mlme_action {
1636 * is the first frame we expect to perform the action on. Notice 1656 * is the first frame we expect to perform the action on. Notice
1637 * that TX/RX_STOP can pass NULL for this parameter. 1657 * that TX/RX_STOP can pass NULL for this parameter.
1638 * Returns a negative error code on failure. 1658 * Returns a negative error code on failure.
1639 * The callback must be atomic. 1659 * The callback can sleep.
1640 * 1660 *
1641 * @get_survey: Return per-channel survey information 1661 * @get_survey: Return per-channel survey information
1642 * 1662 *
@@ -2307,25 +2327,14 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
2307int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid); 2327int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2308 2328
2309/** 2329/**
2310 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
2311 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2312 * @ra: receiver address of the BA session recipient.
2313 * @tid: the TID to BA on.
2314 *
2315 * This function must be called by low level driver once it has
2316 * finished with preparations for the BA session.
2317 */
2318void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
2319
2320/**
2321 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. 2330 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
2322 * @vif: &struct ieee80211_vif pointer from the add_interface callback 2331 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2323 * @ra: receiver address of the BA session recipient. 2332 * @ra: receiver address of the BA session recipient.
2324 * @tid: the TID to BA on. 2333 * @tid: the TID to BA on.
2325 * 2334 *
2326 * This function must be called by low level driver once it has 2335 * This function must be called by low level driver once it has
2327 * finished with preparations for the BA session. 2336 * finished with preparations for the BA session. It can be called
2328 * This version of the function is IRQ-safe. 2337 * from any context.
2329 */ 2338 */
2330void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, 2339void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2331 u16 tid); 2340 u16 tid);
@@ -2334,27 +2343,14 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2334 * ieee80211_stop_tx_ba_session - Stop a Block Ack session. 2343 * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
2335 * @sta: the station whose BA session to stop 2344 * @sta: the station whose BA session to stop
2336 * @tid: the TID to stop BA. 2345 * @tid: the TID to stop BA.
2337 * @initiator: if indicates initiator DELBA frame will be sent.
2338 * 2346 *
2339 * Return: error if no sta with matching da found, success otherwise 2347 * Return: negative error if the TID is invalid, or no aggregation active
2340 * 2348 *
2341 * Although mac80211/low level driver/user space application can estimate 2349 * Although mac80211/low level driver/user space application can estimate
2342 * the need to stop aggregation on a certain RA/TID, the session level 2350 * the need to stop aggregation on a certain RA/TID, the session level
2343 * will be managed by the mac80211. 2351 * will be managed by the mac80211.
2344 */ 2352 */
2345int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid, 2353int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2346 enum ieee80211_back_parties initiator);
2347
2348/**
2349 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
2350 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2351 * @ra: receiver address of the BA session recipient.
2352 * @tid: the desired TID to BA on.
2353 *
2354 * This function must be called by low level driver once it has
2355 * finished with preparations for the BA session tear down.
2356 */
2357void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2358 2354
2359/** 2355/**
2360 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. 2356 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
@@ -2363,8 +2359,8 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2363 * @tid: the desired TID to BA on. 2359 * @tid: the desired TID to BA on.
2364 * 2360 *
2365 * This function must be called by low level driver once it has 2361 * This function must be called by low level driver once it has
2366 * finished with preparations for the BA session tear down. 2362 * finished with preparations for the BA session tear down. It
2367 * This version of the function is IRQ-safe. 2363 * can be called from any context.
2368 */ 2364 */
2369void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, 2365void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
2370 u16 tid); 2366 u16 tid);
@@ -2460,6 +2456,36 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
2460void ieee80211_connection_loss(struct ieee80211_vif *vif); 2456void ieee80211_connection_loss(struct ieee80211_vif *vif);
2461 2457
2462/** 2458/**
2459 * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm
2460 *
2461 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2462 *
2463 * Some hardware require full power save to manage simultaneous BT traffic
2464 * on the WLAN frequency. Full PSM is required periodically, whenever there are
2465 * burst of BT traffic. The hardware gets information of BT traffic via
2466 * hardware co-existence lines, and consequentially requests mac80211 to
2467 * (temporarily) enter full psm.
2468 * This function will only temporarily disable dynamic PS, not enable PSM if
2469 * it was not already enabled.
2470 * The driver must make sure to re-enable dynamic PS using
2471 * ieee80211_enable_dyn_ps() if the driver has disabled it.
2472 *
2473 */
2474void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif);
2475
2476/**
2477 * ieee80211_enable_dyn_ps - restore dynamic psm after being disabled
2478 *
2479 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2480 *
2481 * This function restores dynamic PS after being temporarily disabled via
2482 * ieee80211_disable_dyn_ps(). Each ieee80211_disable_dyn_ps() call must
2483 * be coupled with an eventual call to this function.
2484 *
2485 */
2486void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
2487
2488/**
2463 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring 2489 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
2464 * rssi threshold triggered 2490 * rssi threshold triggered
2465 * 2491 *
diff --git a/include/net/mip6.h b/include/net/mip6.h
index a83ad1982a90..26ba99b5a4b1 100644
--- a/include/net/mip6.h
+++ b/include/net/mip6.h
@@ -39,7 +39,7 @@ struct ip6_mh {
39 __u16 ip6mh_cksum; 39 __u16 ip6mh_cksum;
40 /* Followed by type specific messages */ 40 /* Followed by type specific messages */
41 __u8 data[0]; 41 __u8 data[0];
42} __attribute__ ((__packed__)); 42} __packed;
43 43
44#define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */ 44#define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */
45#define IP6_MH_TYPE_HOTI 1 /* HOTI Message */ 45#define IP6_MH_TYPE_HOTI 1 /* HOTI Message */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index f76f22d05721..895997bc2ead 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -82,7 +82,7 @@ struct ra_msg {
82struct nd_opt_hdr { 82struct nd_opt_hdr {
83 __u8 nd_opt_type; 83 __u8 nd_opt_type;
84 __u8 nd_opt_len; 84 __u8 nd_opt_len;
85} __attribute__((__packed__)); 85} __packed;
86 86
87 87
88extern int ndisc_init(void); 88extern int ndisc_init(void);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index eb21340a573b..242879b6c4df 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -151,7 +151,7 @@ struct neigh_table {
151 void (*proxy_redo)(struct sk_buff *skb); 151 void (*proxy_redo)(struct sk_buff *skb);
152 char *id; 152 char *id;
153 struct neigh_parms parms; 153 struct neigh_parms parms;
154 /* HACK. gc_* shoul follow parms without a gap! */ 154 /* HACK. gc_* should follow parms without a gap! */
155 int gc_interval; 155 int gc_interval;
156 int gc_thresh1; 156 int gc_thresh1;
157 int gc_thresh2; 157 int gc_thresh2;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index bde095f7e845..e624dae54fa4 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -152,11 +152,7 @@ extern struct net init_net;
152 152
153static inline struct net *nf_ct_net(const struct nf_conn *ct) 153static inline struct net *nf_ct_net(const struct nf_conn *ct)
154{ 154{
155#ifdef CONFIG_NET_NS 155 return read_pnet(&ct->ct_net);
156 return ct->ct_net;
157#else
158 return &init_net;
159#endif
160} 156}
161 157
162/* Alter reply tuple (maybe alter helper). */ 158/* Alter reply tuple (maybe alter helper). */
@@ -261,7 +257,12 @@ extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct,
261 u32 seq); 257 u32 seq);
262 258
263/* Fake conntrack entry for untracked connections */ 259/* Fake conntrack entry for untracked connections */
264extern struct nf_conn nf_conntrack_untracked; 260DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
261static inline struct nf_conn *nf_ct_untracked_get(void)
262{
263 return &__raw_get_cpu_var(nf_conntrack_untracked);
264}
265extern void nf_ct_untracked_status_or(unsigned long bits);
265 266
266/* Iterate over all conntracks: if iter returns true, it's deleted. */ 267/* Iterate over all conntracks: if iter returns true, it's deleted. */
267extern void 268extern void
@@ -289,9 +290,9 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
289 return test_bit(IPS_DYING_BIT, &ct->status); 290 return test_bit(IPS_DYING_BIT, &ct->status);
290} 291}
291 292
292static inline int nf_ct_is_untracked(const struct sk_buff *skb) 293static inline int nf_ct_is_untracked(const struct nf_conn *ct)
293{ 294{
294 return (skb->nfct == &nf_conntrack_untracked.ct_general); 295 return test_bit(IPS_UNTRACKED_BIT, &ct->status);
295} 296}
296 297
297extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 298extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 03e218f0be43..4e9c63a20db2 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -45,6 +45,18 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
45extern unsigned int 45extern unsigned int
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir);
47 47
48/* Check if connection tracking accounting is enabled */
49static inline bool nf_ct_acct_enabled(struct net *net)
50{
51 return net->ct.sysctl_acct != 0;
52}
53
54/* Enable/disable connection tracking accounting */
55static inline void nf_ct_set_acct(struct net *net, bool enable)
56{
57 net->ct.sysctl_acct = enable;
58}
59
48extern int nf_conntrack_acct_init(struct net *net); 60extern int nf_conntrack_acct_init(struct net *net);
49extern void nf_conntrack_acct_fini(struct net *net); 61extern void nf_conntrack_acct_fini(struct net *net);
50 62
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 3d7524fba194..aced085132e7 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -60,7 +60,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
60 struct nf_conn *ct = (struct nf_conn *)skb->nfct; 60 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
61 int ret = NF_ACCEPT; 61 int ret = NF_ACCEPT;
62 62
63 if (ct && ct != &nf_conntrack_untracked) { 63 if (ct && !nf_ct_is_untracked(ct)) {
64 if (!nf_ct_is_confirmed(ct)) 64 if (!nf_ct_is_confirmed(ct))
65 ret = __nf_conntrack_confirm(skb); 65 ret = __nf_conntrack_confirm(skb);
66 if (likely(ret == NF_ACCEPT)) 66 if (likely(ret == NF_ACCEPT))
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index e4a18ae361c6..2890bdc4cd92 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -12,6 +12,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb,
12 const struct net_device *out, 12 const struct net_device *out,
13 struct nf_conn *ct); 13 struct nf_conn *ct);
14 14
15extern unsigned int
16alloc_null_binding(struct nf_conn *ct, unsigned int hooknum);
17#endif /* _NF_NAT_RULE_H */ 15#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index ddbf37e19616..5a2978d1cb22 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -2,13 +2,18 @@
2#define _XT_RATEEST_H 2#define _XT_RATEEST_H
3 3
4struct xt_rateest { 4struct xt_rateest {
5 /* keep lock and bstats on same cache line to speedup xt_rateest_tg() */
6 struct gnet_stats_basic_packed bstats;
7 spinlock_t lock;
8 /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */
9 struct gnet_stats_rate_est rstats;
10
11 /* following fields not accessed in hot path */
5 struct hlist_node list; 12 struct hlist_node list;
6 char name[IFNAMSIZ]; 13 char name[IFNAMSIZ];
7 unsigned int refcnt; 14 unsigned int refcnt;
8 spinlock_t lock;
9 struct gnet_estimator params; 15 struct gnet_estimator params;
10 struct gnet_stats_rate_est rstats; 16 struct rcu_head rcu;
11 struct gnet_stats_basic_packed bstats;
12}; 17};
13 18
14extern struct xt_rateest *xt_rateest_lookup(const char *name); 19extern struct xt_rateest *xt_rateest_lookup(const char *name);
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 4fc05b58503e..f3b201d335b3 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -35,7 +35,7 @@
35 * nlmsg_new() create a new netlink message 35 * nlmsg_new() create a new netlink message
36 * nlmsg_put() add a netlink message to an skb 36 * nlmsg_put() add a netlink message to an skb
37 * nlmsg_put_answer() callback based nlmsg_put() 37 * nlmsg_put_answer() callback based nlmsg_put()
38 * nlmsg_end() finanlize netlink message 38 * nlmsg_end() finalize netlink message
39 * nlmsg_get_pos() return current position in message 39 * nlmsg_get_pos() return current position in message
40 * nlmsg_trim() trim part of message 40 * nlmsg_trim() trim part of message
41 * nlmsg_cancel() cancel message construction 41 * nlmsg_cancel() cancel message construction
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index d7b989ca3d63..2d16783d5e20 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -34,6 +34,7 @@ struct phonet_device {
34 struct list_head list; 34 struct list_head list;
35 struct net_device *netdev; 35 struct net_device *netdev;
36 DECLARE_BITMAP(addrs, 64); 36 DECLARE_BITMAP(addrs, 64);
37 struct rcu_head rcu;
37}; 38};
38 39
39int phonet_device_init(void); 40int phonet_device_init(void);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 9d4d87cc970e..d9549af6929a 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -95,7 +95,7 @@ extern void __qdisc_run(struct Qdisc *q);
95 95
96static inline void qdisc_run(struct Qdisc *q) 96static inline void qdisc_run(struct Qdisc *q)
97{ 97{
98 if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) 98 if (qdisc_run_begin(q))
99 __qdisc_run(q); 99 __qdisc_run(q);
100} 100}
101 101
diff --git a/include/net/route.h b/include/net/route.h
index af6cf4b4c9dc..bd732d62e1c3 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,9 +50,7 @@
50struct fib_nh; 50struct fib_nh;
51struct inet_peer; 51struct inet_peer;
52struct rtable { 52struct rtable {
53 union { 53 struct dst_entry dst;
54 struct dst_entry dst;
55 } u;
56 54
57 /* Cache lookup keys */ 55 /* Cache lookup keys */
58 struct flowi fl; 56 struct flowi fl;
@@ -144,7 +142,7 @@ extern void fib_add_ifaddr(struct in_ifaddr *);
144static inline void ip_rt_put(struct rtable * rt) 142static inline void ip_rt_put(struct rtable * rt)
145{ 143{
146 if (rt) 144 if (rt)
147 dst_release(&rt->u.dst); 145 dst_release(&rt->dst);
148} 146}
149 147
150#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) 148#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 433604bb3fe8..3c8728aaab4e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -23,11 +23,17 @@ struct qdisc_rate_table {
23}; 23};
24 24
25enum qdisc_state_t { 25enum qdisc_state_t {
26 __QDISC_STATE_RUNNING,
27 __QDISC_STATE_SCHED, 26 __QDISC_STATE_SCHED,
28 __QDISC_STATE_DEACTIVATED, 27 __QDISC_STATE_DEACTIVATED,
29}; 28};
30 29
30/*
31 * following bits are only changed while qdisc lock is held
32 */
33enum qdisc___state_t {
34 __QDISC___STATE_RUNNING,
35};
36
31struct qdisc_size_table { 37struct qdisc_size_table {
32 struct list_head list; 38 struct list_head list;
33 struct tc_sizespec szopts; 39 struct tc_sizespec szopts;
@@ -72,10 +78,27 @@ struct Qdisc {
72 unsigned long state; 78 unsigned long state;
73 struct sk_buff_head q; 79 struct sk_buff_head q;
74 struct gnet_stats_basic_packed bstats; 80 struct gnet_stats_basic_packed bstats;
81 unsigned long __state;
75 struct gnet_stats_queue qstats; 82 struct gnet_stats_queue qstats;
76 struct rcu_head rcu_head; 83 struct rcu_head rcu_head;
84 spinlock_t busylock;
77}; 85};
78 86
87static inline bool qdisc_is_running(struct Qdisc *qdisc)
88{
89 return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
90}
91
92static inline bool qdisc_run_begin(struct Qdisc *qdisc)
93{
94 return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
95}
96
97static inline void qdisc_run_end(struct Qdisc *qdisc)
98{
99 __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
100}
101
79struct Qdisc_class_ops { 102struct Qdisc_class_ops {
80 /* Child qdisc manipulation */ 103 /* Child qdisc manipulation */
81 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); 104 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
@@ -583,9 +606,16 @@ static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
583} 606}
584 607
585#ifdef CONFIG_NET_CLS_ACT 608#ifdef CONFIG_NET_CLS_ACT
586static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask) 609static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
610 int action)
587{ 611{
588 struct sk_buff *n = skb_clone(skb, gfp_mask); 612 struct sk_buff *n;
613
614 if ((action == TC_ACT_STOLEN || action == TC_ACT_QUEUED) &&
615 !skb_shared(skb))
616 n = skb_get(skb);
617 else
618 n = skb_clone(skb, gfp_mask);
589 619
590 if (n) { 620 if (n) {
591 n->tc_verd = SET_TC_VERD(n->tc_verd, 0); 621 n->tc_verd = SET_TC_VERD(n->tc_verd, 0);
diff --git a/include/net/scm.h b/include/net/scm.h
index 8360e47aa7e3..31656506d967 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -19,8 +19,10 @@ struct scm_fp_list {
19}; 19};
20 20
21struct scm_cookie { 21struct scm_cookie {
22 struct ucred creds; /* Skb credentials */ 22 struct pid *pid; /* Skb credentials */
23 const struct cred *cred;
23 struct scm_fp_list *fp; /* Passed files */ 24 struct scm_fp_list *fp; /* Passed files */
25 struct ucred creds; /* Skb credentials */
24#ifdef CONFIG_SECURITY_NETWORK 26#ifdef CONFIG_SECURITY_NETWORK
25 u32 secid; /* Passed security ID */ 27 u32 secid; /* Passed security ID */
26#endif 28#endif
@@ -42,8 +44,27 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co
42{ } 44{ }
43#endif /* CONFIG_SECURITY_NETWORK */ 45#endif /* CONFIG_SECURITY_NETWORK */
44 46
47static __inline__ void scm_set_cred(struct scm_cookie *scm,
48 struct pid *pid, const struct cred *cred)
49{
50 scm->pid = get_pid(pid);
51 scm->cred = get_cred(cred);
52 cred_to_ucred(pid, cred, &scm->creds);
53}
54
55static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
56{
57 put_pid(scm->pid);
58 scm->pid = NULL;
59
60 if (scm->cred)
61 put_cred(scm->cred);
62 scm->cred = NULL;
63}
64
45static __inline__ void scm_destroy(struct scm_cookie *scm) 65static __inline__ void scm_destroy(struct scm_cookie *scm)
46{ 66{
67 scm_destroy_cred(scm);
47 if (scm && scm->fp) 68 if (scm && scm->fp)
48 __scm_destroy(scm); 69 __scm_destroy(scm);
49} 70}
@@ -51,10 +72,7 @@ static __inline__ void scm_destroy(struct scm_cookie *scm)
51static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 72static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
52 struct scm_cookie *scm) 73 struct scm_cookie *scm)
53{ 74{
54 struct task_struct *p = current; 75 scm_set_cred(scm, task_tgid(current), current_cred());
55 scm->creds.uid = current_uid();
56 scm->creds.gid = current_gid();
57 scm->creds.pid = task_tgid_vnr(p);
58 scm->fp = NULL; 76 scm->fp = NULL;
59 unix_get_peersec_dgram(sock, scm); 77 unix_get_peersec_dgram(sock, scm);
60 if (msg->msg_controllen <= 0) 78 if (msg->msg_controllen <= 0)
@@ -96,6 +114,8 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
96 if (test_bit(SOCK_PASSCRED, &sock->flags)) 114 if (test_bit(SOCK_PASSCRED, &sock->flags))
97 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); 115 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
98 116
117 scm_destroy_cred(scm);
118
99 scm_passec(sock, msg, scm); 119 scm_passec(sock, msg, scm);
100 120
101 if (!scm->fp) 121 if (!scm->fp)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 4b860116e096..f9e7473613bd 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -443,7 +443,7 @@ struct sctp_signed_cookie {
443 __u8 signature[SCTP_SECRET_SIZE]; 443 __u8 signature[SCTP_SECRET_SIZE];
444 __u32 __pad; /* force sctp_cookie alignment to 64 bits */ 444 __u32 __pad; /* force sctp_cookie alignment to 64 bits */
445 struct sctp_cookie c; 445 struct sctp_cookie c;
446} __attribute__((packed)); 446} __packed;
447 447
448/* This is another convenience type to allocate memory for address 448/* This is another convenience type to allocate memory for address
449 * params for the maximum size and pass such structures around 449 * params for the maximum size and pass such structures around
@@ -488,7 +488,7 @@ typedef struct sctp_sender_hb_info {
488 union sctp_addr daddr; 488 union sctp_addr daddr;
489 unsigned long sent_at; 489 unsigned long sent_at;
490 __u64 hb_nonce; 490 __u64 hb_nonce;
491} __attribute__((packed)) sctp_sender_hb_info_t; 491} __packed sctp_sender_hb_info_t;
492 492
493/* 493/*
494 * RFC 2960 1.3.2 Sequenced Delivery within Streams 494 * RFC 2960 1.3.2 Sequenced Delivery within Streams
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 899003d18db9..a0e61806d480 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -47,15 +47,16 @@ struct snmp_mib {
47} 47}
48 48
49/* 49/*
50 * We use all unsigned longs. Linux will soon be so reliable that even 50 * We use unsigned longs for most mibs but u64 for ipstats.
51 * these will rapidly get too small 8-). Seriously consider the IpInReceives
52 * count on the 20Gb/s + networks people expect in a few years time!
53 */ 51 */
52#include <linux/u64_stats_sync.h>
54 53
55/* IPstats */ 54/* IPstats */
56#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX 55#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
57struct ipstats_mib { 56struct ipstats_mib {
58 unsigned long mibs[IPSTATS_MIB_MAX]; 57 /* mibs[] must be first field of struct ipstats_mib */
58 u64 mibs[IPSTATS_MIB_MAX];
59 struct u64_stats_sync syncp;
59}; 60};
60 61
61/* ICMP */ 62/* ICMP */
@@ -155,4 +156,70 @@ struct linux_xfrm_mib {
155 ptr->mibs[basefield##PKTS]++; \ 156 ptr->mibs[basefield##PKTS]++; \
156 ptr->mibs[basefield##OCTETS] += addend;\ 157 ptr->mibs[basefield##OCTETS] += addend;\
157 } while (0) 158 } while (0)
159
160
161#if BITS_PER_LONG==32
162
163#define SNMP_ADD_STATS64_BH(mib, field, addend) \
164 do { \
165 __typeof__(*mib[0]) *ptr = __this_cpu_ptr((mib)[0]); \
166 u64_stats_update_begin(&ptr->syncp); \
167 ptr->mibs[field] += addend; \
168 u64_stats_update_end(&ptr->syncp); \
169 } while (0)
170#define SNMP_ADD_STATS64_USER(mib, field, addend) \
171 do { \
172 __typeof__(*mib[0]) *ptr; \
173 preempt_disable(); \
174 ptr = __this_cpu_ptr((mib)[1]); \
175 u64_stats_update_begin(&ptr->syncp); \
176 ptr->mibs[field] += addend; \
177 u64_stats_update_end(&ptr->syncp); \
178 preempt_enable(); \
179 } while (0)
180#define SNMP_ADD_STATS64(mib, field, addend) \
181 do { \
182 __typeof__(*mib[0]) *ptr; \
183 preempt_disable(); \
184 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \
185 u64_stats_update_begin(&ptr->syncp); \
186 ptr->mibs[field] += addend; \
187 u64_stats_update_end(&ptr->syncp); \
188 preempt_enable(); \
189 } while (0)
190#define SNMP_INC_STATS64_BH(mib, field) SNMP_ADD_STATS64_BH(mib, field, 1)
191#define SNMP_INC_STATS64_USER(mib, field) SNMP_ADD_STATS64_USER(mib, field, 1)
192#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
193#define SNMP_UPD_PO_STATS64(mib, basefield, addend) \
194 do { \
195 __typeof__(*mib[0]) *ptr; \
196 preempt_disable(); \
197 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \
198 u64_stats_update_begin(&ptr->syncp); \
199 ptr->mibs[basefield##PKTS]++; \
200 ptr->mibs[basefield##OCTETS] += addend; \
201 u64_stats_update_end(&ptr->syncp); \
202 preempt_enable(); \
203 } while (0)
204#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
205 do { \
206 __typeof__(*mib[0]) *ptr; \
207 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \
208 u64_stats_update_begin(&ptr->syncp); \
209 ptr->mibs[basefield##PKTS]++; \
210 ptr->mibs[basefield##OCTETS] += addend; \
211 u64_stats_update_end(&ptr->syncp); \
212 } while (0)
213#else
214#define SNMP_INC_STATS64_BH(mib, field) SNMP_INC_STATS_BH(mib, field)
215#define SNMP_INC_STATS64_USER(mib, field) SNMP_INC_STATS_USER(mib, field)
216#define SNMP_INC_STATS64(mib, field) SNMP_INC_STATS(mib, field)
217#define SNMP_DEC_STATS64(mib, field) SNMP_DEC_STATS(mib, field)
218#define SNMP_ADD_STATS64_BH(mib, field, addend) SNMP_ADD_STATS_BH(mib, field, addend)
219#define SNMP_ADD_STATS64_USER(mib, field, addend) SNMP_ADD_STATS_USER(mib, field, addend)
220#define SNMP_ADD_STATS64(mib, field, addend) SNMP_ADD_STATS(mib, field, addend)
221#define SNMP_UPD_PO_STATS64(mib, basefield, addend) SNMP_UPD_PO_STATS(mib, basefield, addend)
222#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) SNMP_UPD_PO_STATS_BH(mib, basefield, addend)
223#endif
224
158#endif 225#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index 0a691ea7654a..a441c9cdd625 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -295,7 +295,8 @@ struct sock {
295 unsigned short sk_ack_backlog; 295 unsigned short sk_ack_backlog;
296 unsigned short sk_max_ack_backlog; 296 unsigned short sk_max_ack_backlog;
297 __u32 sk_priority; 297 __u32 sk_priority;
298 struct ucred sk_peercred; 298 struct pid *sk_peer_pid;
299 const struct cred *sk_peer_cred;
299 long sk_rcvtimeo; 300 long sk_rcvtimeo;
300 long sk_sndtimeo; 301 long sk_sndtimeo;
301 struct sk_filter *sk_filter; 302 struct sk_filter *sk_filter;
@@ -771,6 +772,7 @@ struct proto {
771 int *sysctl_wmem; 772 int *sysctl_wmem;
772 int *sysctl_rmem; 773 int *sysctl_rmem;
773 int max_header; 774 int max_header;
775 bool no_autobind;
774 776
775 struct kmem_cache *slab; 777 struct kmem_cache *slab;
776 unsigned int obj_size; 778 unsigned int obj_size;
@@ -1706,19 +1708,13 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1706static inline 1708static inline
1707struct net *sock_net(const struct sock *sk) 1709struct net *sock_net(const struct sock *sk)
1708{ 1710{
1709#ifdef CONFIG_NET_NS 1711 return read_pnet(&sk->sk_net);
1710 return sk->sk_net;
1711#else
1712 return &init_net;
1713#endif
1714} 1712}
1715 1713
1716static inline 1714static inline
1717void sock_net_set(struct sock *sk, struct net *net) 1715void sock_net_set(struct sock *sk, struct net *net)
1718{ 1716{
1719#ifdef CONFIG_NET_NS 1717 write_pnet(&sk->sk_net, net);
1720 sk->sk_net = net;
1721#endif
1722} 1718}
1723 1719
1724/* 1720/*
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a1449144848a..df6a2eb20193 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -296,45 +296,30 @@ extern struct proto tcp_prot;
296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
298 298
299extern void tcp_v4_err(struct sk_buff *skb, u32); 299extern void tcp_v4_err(struct sk_buff *skb, u32);
300 300
301extern void tcp_shutdown (struct sock *sk, int how); 301extern void tcp_shutdown (struct sock *sk, int how);
302 302
303extern int tcp_v4_rcv(struct sk_buff *skb); 303extern int tcp_v4_rcv(struct sk_buff *skb);
304 304
305extern int tcp_v4_remember_stamp(struct sock *sk); 305extern int tcp_v4_remember_stamp(struct sock *sk);
306 306extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
307extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 307extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
308 308 size_t size);
309extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, 309extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
310 struct msghdr *msg, size_t size); 310 size_t size, int flags);
311extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); 311extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
312 312extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
313extern int tcp_ioctl(struct sock *sk, 313 struct tcphdr *th, unsigned len);
314 int cmd, 314extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
315 unsigned long arg); 315 struct tcphdr *th, unsigned len);
316 316extern void tcp_rcv_space_adjust(struct sock *sk);
317extern int tcp_rcv_state_process(struct sock *sk, 317extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
318 struct sk_buff *skb, 318extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
319 struct tcphdr *th, 319extern void tcp_twsk_destructor(struct sock *sk);
320 unsigned len); 320extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
321 321 struct pipe_inode_info *pipe, size_t len,
322extern int tcp_rcv_established(struct sock *sk, 322 unsigned int flags);
323 struct sk_buff *skb,
324 struct tcphdr *th,
325 unsigned len);
326
327extern void tcp_rcv_space_adjust(struct sock *sk);
328
329extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
330
331extern int tcp_twsk_unique(struct sock *sk,
332 struct sock *sktw, void *twp);
333
334extern void tcp_twsk_destructor(struct sock *sk);
335
336extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
337 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
338 323
339static inline void tcp_dec_quickack_mode(struct sock *sk, 324static inline void tcp_dec_quickack_mode(struct sock *sk,
340 const unsigned int pkts) 325 const unsigned int pkts)
@@ -372,88 +357,59 @@ enum tcp_tw_status {
372}; 357};
373 358
374 359
375extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, 360extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
376 struct sk_buff *skb, 361 struct sk_buff *skb,
377 const struct tcphdr *th); 362 const struct tcphdr *th);
378 363extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
379extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 364 struct request_sock *req,
380 struct request_sock *req, 365 struct request_sock **prev);
381 struct request_sock **prev); 366extern int tcp_child_process(struct sock *parent, struct sock *child,
382extern int tcp_child_process(struct sock *parent, 367 struct sk_buff *skb);
383 struct sock *child, 368extern int tcp_use_frto(struct sock *sk);
384 struct sk_buff *skb); 369extern void tcp_enter_frto(struct sock *sk);
385extern int tcp_use_frto(struct sock *sk); 370extern void tcp_enter_loss(struct sock *sk, int how);
386extern void tcp_enter_frto(struct sock *sk); 371extern void tcp_clear_retrans(struct tcp_sock *tp);
387extern void tcp_enter_loss(struct sock *sk, int how); 372extern void tcp_update_metrics(struct sock *sk);
388extern void tcp_clear_retrans(struct tcp_sock *tp); 373extern void tcp_close(struct sock *sk, long timeout);
389extern void tcp_update_metrics(struct sock *sk); 374extern unsigned int tcp_poll(struct file * file, struct socket *sock,
390 375 struct poll_table_struct *wait);
391extern void tcp_close(struct sock *sk, 376extern int tcp_getsockopt(struct sock *sk, int level, int optname,
392 long timeout); 377 char __user *optval, int __user *optlen);
393extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); 378extern int tcp_setsockopt(struct sock *sk, int level, int optname,
394 379 char __user *optval, unsigned int optlen);
395extern int tcp_getsockopt(struct sock *sk, int level, 380extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
396 int optname, 381 char __user *optval, int __user *optlen);
397 char __user *optval, 382extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
398 int __user *optlen); 383 char __user *optval, unsigned int optlen);
399extern int tcp_setsockopt(struct sock *sk, int level, 384extern void tcp_set_keepalive(struct sock *sk, int val);
400 int optname, char __user *optval, 385extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
401 unsigned int optlen); 386extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
402extern int compat_tcp_getsockopt(struct sock *sk, 387 size_t len, int nonblock, int flags, int *addr_len);
403 int level, int optname, 388extern void tcp_parse_options(struct sk_buff *skb,
404 char __user *optval, int __user *optlen); 389 struct tcp_options_received *opt_rx, u8 **hvpp,
405extern int compat_tcp_setsockopt(struct sock *sk, 390 int estab);
406 int level, int optname, 391extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
407 char __user *optval, unsigned int optlen);
408extern void tcp_set_keepalive(struct sock *sk, int val);
409extern void tcp_syn_ack_timeout(struct sock *sk,
410 struct request_sock *req);
411extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
412 struct msghdr *msg,
413 size_t len, int nonblock,
414 int flags, int *addr_len);
415
416extern void tcp_parse_options(struct sk_buff *skb,
417 struct tcp_options_received *opt_rx,
418 u8 **hvpp,
419 int estab);
420
421extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
422 392
423/* 393/*
424 * TCP v4 functions exported for the inet6 API 394 * TCP v4 functions exported for the inet6 API
425 */ 395 */
426 396
427extern void tcp_v4_send_check(struct sock *sk, 397extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
428 struct sk_buff *skb); 398extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
429 399extern struct sock * tcp_create_openreq_child(struct sock *sk,
430extern int tcp_v4_conn_request(struct sock *sk, 400 struct request_sock *req,
431 struct sk_buff *skb);
432
433extern struct sock * tcp_create_openreq_child(struct sock *sk,
434 struct request_sock *req,
435 struct sk_buff *skb);
436
437extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk,
438 struct sk_buff *skb,
439 struct request_sock *req,
440 struct dst_entry *dst);
441
442extern int tcp_v4_do_rcv(struct sock *sk,
443 struct sk_buff *skb); 401 struct sk_buff *skb);
444 402extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
445extern int tcp_v4_connect(struct sock *sk, 403 struct request_sock *req,
446 struct sockaddr *uaddr, 404 struct dst_entry *dst);
447 int addr_len); 405extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
448 406extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
449extern int tcp_connect(struct sock *sk); 407 int addr_len);
450 408extern int tcp_connect(struct sock *sk);
451extern struct sk_buff * tcp_make_synack(struct sock *sk, 409extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
452 struct dst_entry *dst, 410 struct request_sock *req,
453 struct request_sock *req, 411 struct request_values *rvp);
454 struct request_values *rvp); 412extern int tcp_disconnect(struct sock *sk, int flags);
455
456extern int tcp_disconnect(struct sock *sk, int flags);
457 413
458 414
459/* From syncookies.c */ 415/* From syncookies.c */
@@ -464,7 +420,7 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
464 __u16 *mss); 420 __u16 *mss);
465 421
466extern __u32 cookie_init_timestamp(struct request_sock *req); 422extern __u32 cookie_init_timestamp(struct request_sock *req);
467extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt); 423extern bool cookie_check_timestamp(struct tcp_options_received *opt, bool *);
468 424
469/* From net/ipv6/syncookies.c */ 425/* From net/ipv6/syncookies.c */
470extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 426extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
@@ -485,10 +441,10 @@ extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
485 441
486extern void tcp_send_probe0(struct sock *); 442extern void tcp_send_probe0(struct sock *);
487extern void tcp_send_partial(struct sock *); 443extern void tcp_send_partial(struct sock *);
488extern int tcp_write_wakeup(struct sock *); 444extern int tcp_write_wakeup(struct sock *);
489extern void tcp_send_fin(struct sock *sk); 445extern void tcp_send_fin(struct sock *sk);
490extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 446extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
491extern int tcp_send_synack(struct sock *); 447extern int tcp_send_synack(struct sock *);
492extern void tcp_push_one(struct sock *, unsigned int mss_now); 448extern void tcp_push_one(struct sock *, unsigned int mss_now);
493extern void tcp_send_ack(struct sock *sk); 449extern void tcp_send_ack(struct sock *sk);
494extern void tcp_send_delayed_ack(struct sock *sk); 450extern void tcp_send_delayed_ack(struct sock *sk);
@@ -592,7 +548,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
592 * scaling applied to the result. The caller does these things 548 * scaling applied to the result. The caller does these things
593 * if necessary. This is a "raw" window selection. 549 * if necessary. This is a "raw" window selection.
594 */ 550 */
595extern u32 __tcp_select_window(struct sock *sk); 551extern u32 __tcp_select_window(struct sock *sk);
596 552
597/* TCP timestamps are only 32-bits, this causes a slight 553/* TCP timestamps are only 32-bits, this causes a slight
598 * complication on 64-bit systems since we store a snapshot 554 * complication on 64-bit systems since we store a snapshot
@@ -602,12 +558,22 @@ extern u32 __tcp_select_window(struct sock *sk);
602 */ 558 */
603#define tcp_time_stamp ((__u32)(jiffies)) 559#define tcp_time_stamp ((__u32)(jiffies))
604 560
561#define tcp_flag_byte(th) (((u_int8_t *)th)[13])
562
563#define TCPHDR_FIN 0x01
564#define TCPHDR_SYN 0x02
565#define TCPHDR_RST 0x04
566#define TCPHDR_PSH 0x08
567#define TCPHDR_ACK 0x10
568#define TCPHDR_URG 0x20
569#define TCPHDR_ECE 0x40
570#define TCPHDR_CWR 0x80
571
605/* This is what the send packet queuing engine uses to pass 572/* This is what the send packet queuing engine uses to pass
606 * TCP per-packet control information to the transmission 573 * TCP per-packet control information to the transmission code.
607 * code. We also store the host-order sequence numbers in 574 * We also store the host-order sequence numbers in here too.
608 * here too. This is 36 bytes on 32-bit architectures, 575 * This is 44 bytes if IPV6 is enabled.
609 * 40 bytes on 64-bit machines, if this grows please adjust 576 * If this grows please adjust skbuff.h:skbuff->cb[xxx] size appropriately.
610 * skbuff.h:skbuff->cb[xxx] size appropriately.
611 */ 577 */
612struct tcp_skb_cb { 578struct tcp_skb_cb {
613 union { 579 union {
@@ -620,19 +586,6 @@ struct tcp_skb_cb {
620 __u32 end_seq; /* SEQ + FIN + SYN + datalen */ 586 __u32 end_seq; /* SEQ + FIN + SYN + datalen */
621 __u32 when; /* used to compute rtt's */ 587 __u32 when; /* used to compute rtt's */
622 __u8 flags; /* TCP header flags. */ 588 __u8 flags; /* TCP header flags. */
623
624 /* NOTE: These must match up to the flags byte in a
625 * real TCP header.
626 */
627#define TCPCB_FLAG_FIN 0x01
628#define TCPCB_FLAG_SYN 0x02
629#define TCPCB_FLAG_RST 0x04
630#define TCPCB_FLAG_PSH 0x08
631#define TCPCB_FLAG_ACK 0x10
632#define TCPCB_FLAG_URG 0x20
633#define TCPCB_FLAG_ECE 0x40
634#define TCPCB_FLAG_CWR 0x80
635
636 __u8 sacked; /* State flags for SACK/FACK. */ 589 __u8 sacked; /* State flags for SACK/FACK. */
637#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ 590#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
638#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 591#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
@@ -1176,22 +1129,14 @@ struct tcp_md5sig_pool {
1176#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ 1129#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
1177 1130
1178/* - functions */ 1131/* - functions */
1179extern int tcp_v4_md5_hash_skb(char *md5_hash, 1132extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1180 struct tcp_md5sig_key *key, 1133 struct sock *sk, struct request_sock *req,
1181 struct sock *sk, 1134 struct sk_buff *skb);
1182 struct request_sock *req, 1135extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk,
1183 struct sk_buff *skb); 1136 struct sock *addr_sk);
1184 1137extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey,
1185extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 1138 u8 newkeylen);
1186 struct sock *addr_sk); 1139extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr);
1187
1188extern int tcp_v4_md5_do_add(struct sock *sk,
1189 __be32 addr,
1190 u8 *newkey,
1191 u8 newkeylen);
1192
1193extern int tcp_v4_md5_do_del(struct sock *sk,
1194 __be32 addr);
1195 1140
1196#ifdef CONFIG_TCP_MD5SIG 1141#ifdef CONFIG_TCP_MD5SIG
1197#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1142#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \
@@ -1204,10 +1149,10 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1204#endif 1149#endif
1205 1150
1206extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); 1151extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1207extern void tcp_free_md5sig_pool(void); 1152extern void tcp_free_md5sig_pool(void);
1208 1153
1209extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1154extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1210extern void tcp_put_md5sig_pool(void); 1155extern void tcp_put_md5sig_pool(void);
1211 1156
1212extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); 1157extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1213extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, 1158extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
@@ -1413,7 +1358,8 @@ struct tcp_iter_state {
1413 sa_family_t family; 1358 sa_family_t family;
1414 enum tcp_seq_states state; 1359 enum tcp_seq_states state;
1415 struct sock *syn_wait_sk; 1360 struct sock *syn_wait_sk;
1416 int bucket, sbucket, num, uid; 1361 int bucket, offset, sbucket, num, uid;
1362 loff_t last_pos;
1417}; 1363};
1418 1364
1419extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); 1365extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
@@ -1434,7 +1380,7 @@ extern int tcp_gro_complete(struct sk_buff *skb);
1434extern int tcp4_gro_complete(struct sk_buff *skb); 1380extern int tcp4_gro_complete(struct sk_buff *skb);
1435 1381
1436#ifdef CONFIG_PROC_FS 1382#ifdef CONFIG_PROC_FS
1437extern int tcp4_proc_init(void); 1383extern int tcp4_proc_init(void);
1438extern void tcp4_proc_exit(void); 1384extern void tcp4_proc_exit(void);
1439#endif 1385#endif
1440 1386
diff --git a/include/net/udp.h b/include/net/udp.h
index 5348d80b25bb..7abdf305da50 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -157,30 +157,28 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
157 sk_common_release(sk); 157 sk_common_release(sk);
158} 158}
159 159
160extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 160extern int udp_lib_get_port(struct sock *sk, unsigned short snum,
161 int (*)(const struct sock *,const struct sock *), 161 int (*)(const struct sock *,const struct sock *),
162 unsigned int hash2_nulladdr); 162 unsigned int hash2_nulladdr);
163 163
164/* net/ipv4/udp.c */ 164/* net/ipv4/udp.c */
165extern int udp_get_port(struct sock *sk, unsigned short snum, 165extern int udp_get_port(struct sock *sk, unsigned short snum,
166 int (*saddr_cmp)(const struct sock *, const struct sock *)); 166 int (*saddr_cmp)(const struct sock *,
167extern void udp_err(struct sk_buff *, u32); 167 const struct sock *));
168 168extern void udp_err(struct sk_buff *, u32);
169extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 169extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
170 struct msghdr *msg, size_t len); 170 struct msghdr *msg, size_t len);
171extern void udp_flush_pending_frames(struct sock *sk); 171extern void udp_flush_pending_frames(struct sock *sk);
172 172extern int udp_rcv(struct sk_buff *skb);
173extern int udp_rcv(struct sk_buff *skb); 173extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
174extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 174extern int udp_disconnect(struct sock *sk, int flags);
175extern int udp_disconnect(struct sock *sk, int flags);
176extern unsigned int udp_poll(struct file *file, struct socket *sock, 175extern unsigned int udp_poll(struct file *file, struct socket *sock,
177 poll_table *wait); 176 poll_table *wait);
178extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 177extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
179 char __user *optval, int __user *optlen); 178 char __user *optval, int __user *optlen);
180extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 179extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
181 char __user *optval, unsigned int optlen, 180 char __user *optval, unsigned int optlen,
182 int (*push_pending_frames)(struct sock *)); 181 int (*push_pending_frames)(struct sock *));
183
184extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 182extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
185 __be32 daddr, __be16 dport, 183 __be32 daddr, __be16 dport,
186 int dif); 184 int dif);
@@ -236,7 +234,7 @@ struct udp_iter_state {
236extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); 234extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
237extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); 235extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
238 236
239extern int udp4_proc_init(void); 237extern int udp4_proc_init(void);
240extern void udp4_proc_exit(void); 238extern void udp4_proc_exit(void);
241#endif 239#endif
242 240