aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/9p/9p.h3
-rw-r--r--include/net/9p/client.h7
-rw-r--r--include/net/addrconf.h2
-rw-r--r--include/net/af_ieee802154.h (renamed from include/net/ieee802154/af_ieee802154.h)6
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/bluetooth/bluetooth.h5
-rw-r--r--include/net/bluetooth/hci_core.h10
-rw-r--r--include/net/bluetooth/l2cap.h134
-rw-r--r--include/net/bluetooth/rfcomm.h2
-rw-r--r--include/net/cfg80211.h570
-rw-r--r--include/net/compat.h4
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/dst.h23
-rw-r--r--include/net/dst_ops.h28
-rw-r--r--include/net/genetlink.h66
-rw-r--r--include/net/ieee802154.h (renamed from include/net/ieee802154/mac_def.h)4
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/ieee802154_netdev.h (renamed from include/net/ieee802154/netdevice.h)6
-rw-r--r--include/net/inet_connection_sock.h6
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/ip.h6
-rw-r--r--include/net/ip6_fib.h6
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/ip_vs.h119
-rw-r--r--include/net/ipip.h8
-rw-r--r--include/net/ipv6.h16
-rw-r--r--include/net/irda/ircomm_event.h2
-rw-r--r--include/net/irda/ircomm_tty_attach.h4
-rw-r--r--include/net/irda/irlap_event.h2
-rw-r--r--include/net/irda/irlmp_event.h4
-rw-r--r--include/net/iw_handler.h8
-rw-r--r--include/net/mac80211.h203
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/neighbour.h6
-rw-r--r--include/net/net_namespace.h26
-rw-r--r--include/net/netfilter/nf_conntrack.h8
-rw-r--r--include/net/netfilter/nf_nat_core.h2
-rw-r--r--include/net/netfilter/nf_nat_helper.h4
-rw-r--r--include/net/netlink.h4
-rw-r--r--include/net/netns/ipv6.h3
-rw-r--r--include/net/netns/x_tables.h3
-rw-r--r--include/net/nl802154.h126
-rw-r--r--include/net/phonet/pn_dev.h2
-rw-r--r--include/net/pkt_sched.h3
-rw-r--r--include/net/protocol.h13
-rw-r--r--include/net/rtnetlink.h5
-rw-r--r--include/net/sch_generic.h22
-rw-r--r--include/net/scm.h2
-rw-r--r--include/net/sctp/command.h3
-rw-r--r--include/net/sctp/constants.h13
-rw-r--r--include/net/sctp/sctp.h7
-rw-r--r--include/net/sctp/structs.h70
-rw-r--r--include/net/sctp/user.h6
-rw-r--r--include/net/sock.h22
-rw-r--r--include/net/tcp.h53
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h5
-rw-r--r--include/net/wext.h1
-rw-r--r--include/net/wpan-phy.h63
-rw-r--r--include/net/xfrm.h2
60 files changed, 1325 insertions, 463 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index b77c1478c99f..a7fb54808a23 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -38,6 +38,8 @@
38 * @P9_DEBUG_SLABS: memory management tracing 38 * @P9_DEBUG_SLABS: memory management tracing
39 * @P9_DEBUG_FCALL: verbose dump of protocol messages 39 * @P9_DEBUG_FCALL: verbose dump of protocol messages
40 * @P9_DEBUG_FID: fid allocation/deallocation tracking 40 * @P9_DEBUG_FID: fid allocation/deallocation tracking
41 * @P9_DEBUG_PKT: packet marshalling/unmarshalling
42 * @P9_DEBUG_FSC: FS-cache tracing
41 * 43 *
42 * These flags are passed at mount time to turn on various levels of 44 * These flags are passed at mount time to turn on various levels of
43 * verbosity and tracing which will be output to the system logs. 45 * verbosity and tracing which will be output to the system logs.
@@ -54,6 +56,7 @@ enum p9_debug_flags {
54 P9_DEBUG_FCALL = (1<<8), 56 P9_DEBUG_FCALL = (1<<8),
55 P9_DEBUG_FID = (1<<9), 57 P9_DEBUG_FID = (1<<9),
56 P9_DEBUG_PKT = (1<<10), 58 P9_DEBUG_PKT = (1<<10),
59 P9_DEBUG_FSC = (1<<11),
57}; 60};
58 61
59#ifdef CONFIG_NET_9P_DEBUG 62#ifdef CONFIG_NET_9P_DEBUG
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index e26812274b75..fb00b329f0d3 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -159,8 +159,7 @@ struct p9_client {
159 * @qid: the &p9_qid server identifier this handle points to 159 * @qid: the &p9_qid server identifier this handle points to
160 * @iounit: the server reported maximum transaction size for this file 160 * @iounit: the server reported maximum transaction size for this file
161 * @uid: the numeric uid of the local user who owns this handle 161 * @uid: the numeric uid of the local user who owns this handle
162 * @aux: transport specific information (unused?) 162 * @rdir: readdir accounting structure (allocated on demand)
163 * @rdir_fpos: tracks offset of file position when reading directory contents
164 * @flist: per-client-instance fid tracking 163 * @flist: per-client-instance fid tracking
165 * @dlist: per-dentry fid tracking 164 * @dlist: per-dentry fid tracking
166 * 165 *
@@ -174,9 +173,9 @@ struct p9_fid {
174 struct p9_qid qid; 173 struct p9_qid qid;
175 u32 iounit; 174 u32 iounit;
176 uid_t uid; 175 uid_t uid;
177 void *aux;
178 176
179 int rdir_fpos; 177 void *rdir;
178
180 struct list_head flist; 179 struct list_head flist;
181 struct list_head dlist; /* list of all fids attached to a dentry */ 180 struct list_head dlist; /* list of all fids attached to a dentry */
182}; 181};
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 7b55ab215a64..0f7c37825fc1 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -143,6 +143,8 @@ extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr
143extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr); 143extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr);
144extern void ipv6_mc_up(struct inet6_dev *idev); 144extern void ipv6_mc_up(struct inet6_dev *idev);
145extern void ipv6_mc_down(struct inet6_dev *idev); 145extern void ipv6_mc_down(struct inet6_dev *idev);
146extern void ipv6_mc_unmap(struct inet6_dev *idev);
147extern void ipv6_mc_remap(struct inet6_dev *idev);
146extern void ipv6_mc_init_dev(struct inet6_dev *idev); 148extern void ipv6_mc_init_dev(struct inet6_dev *idev);
147extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); 149extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
148extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); 150extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/af_ieee802154.h
index 0d78605fb1a6..75e64c7a2960 100644
--- a/include/net/ieee802154/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -54,7 +54,9 @@ struct sockaddr_ieee802154 {
54 struct ieee802154_addr addr; 54 struct ieee802154_addr addr;
55}; 55};
56 56
57/* master device */ 57/* get/setsockopt */
58#define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0) 58#define SOL_IEEE802154 0
59
60#define WPAN_WANTACK 0
59 61
60#endif 62#endif
diff --git a/include/net/arp.h b/include/net/arp.h
index c236270ec95e..716f43c5c98e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -26,6 +26,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
26 const unsigned char *target_hw); 26 const unsigned char *target_hw);
27extern void arp_xmit(struct sk_buff *skb); 27extern void arp_xmit(struct sk_buff *skb);
28 28
29extern struct neigh_ops arp_broken_ops; 29extern const struct neigh_ops arp_broken_ops;
30 30
31#endif /* _ARP_H */ 31#endif /* _ARP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 968166a45f86..718394e2c01e 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -138,8 +138,11 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
138struct bt_skb_cb { 138struct bt_skb_cb {
139 __u8 pkt_type; 139 __u8 pkt_type;
140 __u8 incoming; 140 __u8 incoming;
141 __u8 tx_seq;
142 __u8 retries;
143 __u8 sar;
141}; 144};
142#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 145#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
143 146
144static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) 147static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
145{ 148{
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index c4ca4228b083..7b640aeddb64 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -117,7 +117,7 @@ struct hci_dev {
117 struct sk_buff *sent_cmd; 117 struct sk_buff *sent_cmd;
118 struct sk_buff *reassembly[3]; 118 struct sk_buff *reassembly[3];
119 119
120 struct semaphore req_lock; 120 struct mutex req_lock;
121 wait_queue_head_t req_wait_q; 121 wait_queue_head_t req_wait_q;
122 __u32 req_status; 122 __u32 req_status;
123 __u32 req_result; 123 __u32 req_result;
@@ -187,6 +187,7 @@ struct hci_conn {
187 struct work_struct work_del; 187 struct work_struct work_del;
188 188
189 struct device dev; 189 struct device dev;
190 atomic_t devref;
190 191
191 struct hci_dev *hdev; 192 struct hci_dev *hdev;
192 void *l2cap_data; 193 void *l2cap_data;
@@ -339,6 +340,9 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
339void hci_conn_enter_active_mode(struct hci_conn *conn); 340void hci_conn_enter_active_mode(struct hci_conn *conn);
340void hci_conn_enter_sniff_mode(struct hci_conn *conn); 341void hci_conn_enter_sniff_mode(struct hci_conn *conn);
341 342
343void hci_conn_hold_device(struct hci_conn *conn);
344void hci_conn_put_device(struct hci_conn *conn);
345
342static inline void hci_conn_hold(struct hci_conn *conn) 346static inline void hci_conn_hold(struct hci_conn *conn)
343{ 347{
344 atomic_inc(&conn->refcnt); 348 atomic_inc(&conn->refcnt);
@@ -700,8 +704,8 @@ struct hci_sec_filter {
700#define HCI_REQ_PEND 1 704#define HCI_REQ_PEND 1
701#define HCI_REQ_CANCELED 2 705#define HCI_REQ_CANCELED 2
702 706
703#define hci_req_lock(d) down(&d->req_lock) 707#define hci_req_lock(d) mutex_lock(&d->req_lock)
704#define hci_req_unlock(d) up(&d->req_lock) 708#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
705 709
706void hci_req_complete(struct hci_dev *hdev, int result); 710void hci_req_complete(struct hci_dev *hdev, int result);
707 711
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index e919fca1072a..9516f4b4a3c2 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -27,12 +27,14 @@
27 27
28/* L2CAP defaults */ 28/* L2CAP defaults */
29#define L2CAP_DEFAULT_MTU 672 29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_MIN_MTU 48
30#define L2CAP_DEFAULT_FLUSH_TO 0xffff 31#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31#define L2CAP_DEFAULT_RX_WINDOW 1 32#define L2CAP_DEFAULT_TX_WINDOW 63
32#define L2CAP_DEFAULT_MAX_RECEIVE 1 33#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
33#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */ 34#define L2CAP_DEFAULT_MAX_TX 3
34#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */ 35#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
35#define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7 36#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
37#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
36 38
37#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 39#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
38#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 40#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -52,6 +54,7 @@ struct l2cap_options {
52 __u16 imtu; 54 __u16 imtu;
53 __u16 flush_to; 55 __u16 flush_to;
54 __u8 mode; 56 __u8 mode;
57 __u8 fcs;
55}; 58};
56 59
57#define L2CAP_CONNINFO 0x02 60#define L2CAP_CONNINFO 0x02
@@ -93,6 +96,32 @@ struct l2cap_conninfo {
93#define L2CAP_FCS_NONE 0x00 96#define L2CAP_FCS_NONE 0x00
94#define L2CAP_FCS_CRC16 0x01 97#define L2CAP_FCS_CRC16 0x01
95 98
99/* L2CAP Control Field bit masks */
100#define L2CAP_CTRL_SAR 0xC000
101#define L2CAP_CTRL_REQSEQ 0x3F00
102#define L2CAP_CTRL_TXSEQ 0x007E
103#define L2CAP_CTRL_RETRANS 0x0080
104#define L2CAP_CTRL_FINAL 0x0080
105#define L2CAP_CTRL_POLL 0x0010
106#define L2CAP_CTRL_SUPERVISE 0x000C
107#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */
108
109#define L2CAP_CTRL_TXSEQ_SHIFT 1
110#define L2CAP_CTRL_REQSEQ_SHIFT 8
111#define L2CAP_CTRL_SAR_SHIFT 14
112
113/* L2CAP Supervisory Function */
114#define L2CAP_SUPER_RCV_READY 0x0000
115#define L2CAP_SUPER_REJECT 0x0004
116#define L2CAP_SUPER_RCV_NOT_READY 0x0008
117#define L2CAP_SUPER_SELECT_REJECT 0x000C
118
119/* L2CAP Segmentation and Reassembly */
120#define L2CAP_SDU_UNSEGMENTED 0x0000
121#define L2CAP_SDU_START 0x4000
122#define L2CAP_SDU_END 0x8000
123#define L2CAP_SDU_CONTINUE 0xC000
124
96/* L2CAP structures */ 125/* L2CAP structures */
97struct l2cap_hdr { 126struct l2cap_hdr {
98 __le16 len; 127 __le16 len;
@@ -190,7 +219,7 @@ struct l2cap_conf_rfc {
190#define L2CAP_MODE_RETRANS 0x01 219#define L2CAP_MODE_RETRANS 0x01
191#define L2CAP_MODE_FLOWCTL 0x02 220#define L2CAP_MODE_FLOWCTL 0x02
192#define L2CAP_MODE_ERTM 0x03 221#define L2CAP_MODE_ERTM 0x03
193#define L2CAP_MODE_STREAM 0x04 222#define L2CAP_MODE_STREAMING 0x04
194 223
195struct l2cap_disconn_req { 224struct l2cap_disconn_req {
196 __le16 dcid; 225 __le16 dcid;
@@ -261,6 +290,14 @@ struct l2cap_conn {
261 290
262/* ----- L2CAP channel and socket info ----- */ 291/* ----- L2CAP channel and socket info ----- */
263#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 292#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
293#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
294#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
295#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list)
296
297struct srej_list {
298 __u8 tx_seq;
299 struct list_head list;
300};
264 301
265struct l2cap_pinfo { 302struct l2cap_pinfo {
266 struct bt_sock bt; 303 struct bt_sock bt;
@@ -271,30 +308,97 @@ struct l2cap_pinfo {
271 __u16 imtu; 308 __u16 imtu;
272 __u16 omtu; 309 __u16 omtu;
273 __u16 flush_to; 310 __u16 flush_to;
274 __u8 sec_level; 311 __u8 mode;
312 __u8 num_conf_req;
313 __u8 num_conf_rsp;
314
315 __u8 fcs;
316 __u8 sec_level;
275 __u8 role_switch; 317 __u8 role_switch;
276 __u8 force_reliable; 318 __u8 force_reliable;
277 319
278 __u8 conf_req[64]; 320 __u8 conf_req[64];
279 __u8 conf_len; 321 __u8 conf_len;
280 __u8 conf_state; 322 __u8 conf_state;
281 __u8 conf_retry; 323 __u8 conn_state;
324
325 __u8 next_tx_seq;
326 __u8 expected_ack_seq;
327 __u8 req_seq;
328 __u8 expected_tx_seq;
329 __u8 buffer_seq;
330 __u8 buffer_seq_srej;
331 __u8 srej_save_reqseq;
332 __u8 unacked_frames;
333 __u8 retry_count;
334 __u8 num_to_ack;
335 __u16 sdu_len;
336 __u16 partial_sdu_len;
337 struct sk_buff *sdu;
282 338
283 __u8 ident; 339 __u8 ident;
284 340
341 __u8 remote_tx_win;
342 __u8 remote_max_tx;
343 __u16 retrans_timeout;
344 __u16 monitor_timeout;
345 __u16 max_pdu_size;
346
285 __le16 sport; 347 __le16 sport;
286 348
349 struct timer_list retrans_timer;
350 struct timer_list monitor_timer;
351 struct sk_buff_head tx_queue;
352 struct sk_buff_head srej_queue;
353 struct srej_list srej_l;
287 struct l2cap_conn *conn; 354 struct l2cap_conn *conn;
288 struct sock *next_c; 355 struct sock *next_c;
289 struct sock *prev_c; 356 struct sock *prev_c;
290}; 357};
291 358
292#define L2CAP_CONF_REQ_SENT 0x01 359#define L2CAP_CONF_REQ_SENT 0x01
293#define L2CAP_CONF_INPUT_DONE 0x02 360#define L2CAP_CONF_INPUT_DONE 0x02
294#define L2CAP_CONF_OUTPUT_DONE 0x04 361#define L2CAP_CONF_OUTPUT_DONE 0x04
295#define L2CAP_CONF_CONNECT_PEND 0x80 362#define L2CAP_CONF_MTU_DONE 0x08
296 363#define L2CAP_CONF_MODE_DONE 0x10
297#define L2CAP_CONF_MAX_RETRIES 2 364#define L2CAP_CONF_CONNECT_PEND 0x20
365#define L2CAP_CONF_NO_FCS_RECV 0x40
366#define L2CAP_CONF_STATE2_DEVICE 0x80
367
368#define L2CAP_CONF_MAX_CONF_REQ 2
369#define L2CAP_CONF_MAX_CONF_RSP 2
370
371#define L2CAP_CONN_SAR_SDU 0x01
372#define L2CAP_CONN_SREJ_SENT 0x02
373#define L2CAP_CONN_WAIT_F 0x04
374#define L2CAP_CONN_SREJ_ACT 0x08
375#define L2CAP_CONN_SEND_PBIT 0x10
376#define L2CAP_CONN_REMOTE_BUSY 0x20
377#define L2CAP_CONN_LOCAL_BUSY 0x40
378
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
381#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
382 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
383
384static inline int l2cap_tx_window_full(struct sock *sk)
385{
386 struct l2cap_pinfo *pi = l2cap_pi(sk);
387 int sub;
388
389 sub = (pi->next_tx_seq - pi->expected_ack_seq) % 64;
390
391 if (sub < 0)
392 sub += 64;
393
394 return (sub == pi->remote_tx_win);
395}
396
397#define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1
398#define __get_reqseq(ctrl) ((ctrl) & L2CAP_CTRL_REQSEQ) >> 8
399#define __is_iframe(ctrl) !((ctrl) & L2CAP_CTRL_FRAME_TYPE)
400#define __is_sframe(ctrl) (ctrl) & L2CAP_CTRL_FRAME_TYPE
401#define __is_sar_start(ctrl) ((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START
298 402
299void l2cap_load(void); 403void l2cap_load(void);
300 404
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index c274993234e3..921d7b3c7f8d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -29,6 +29,7 @@
29#define RFCOMM_CONN_TIMEOUT (HZ * 30) 29#define RFCOMM_CONN_TIMEOUT (HZ * 30)
30#define RFCOMM_DISC_TIMEOUT (HZ * 20) 30#define RFCOMM_DISC_TIMEOUT (HZ * 20)
31#define RFCOMM_AUTH_TIMEOUT (HZ * 25) 31#define RFCOMM_AUTH_TIMEOUT (HZ * 25)
32#define RFCOMM_IDLE_TIMEOUT (HZ * 2)
32 33
33#define RFCOMM_DEFAULT_MTU 127 34#define RFCOMM_DEFAULT_MTU 127
34#define RFCOMM_DEFAULT_CREDITS 7 35#define RFCOMM_DEFAULT_CREDITS 7
@@ -154,6 +155,7 @@ struct rfcomm_msc {
154struct rfcomm_session { 155struct rfcomm_session {
155 struct list_head list; 156 struct list_head list;
156 struct socket *sock; 157 struct socket *sock;
158 struct timer_list timer;
157 unsigned long state; 159 unsigned long state;
158 unsigned long flags; 160 unsigned long flags;
159 atomic_t refcnt; 161 atomic_t refcnt;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d1892d66701a..3d874c620219 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -80,7 +80,6 @@ enum ieee80211_channel_flags {
80 * with cfg80211. 80 * with cfg80211.
81 * 81 *
82 * @center_freq: center frequency in MHz 82 * @center_freq: center frequency in MHz
83 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
84 * @hw_value: hardware-specific value for the channel 83 * @hw_value: hardware-specific value for the channel
85 * @flags: channel flags from &enum ieee80211_channel_flags. 84 * @flags: channel flags from &enum ieee80211_channel_flags.
86 * @orig_flags: channel flags at registration time, used by regulatory 85 * @orig_flags: channel flags at registration time, used by regulatory
@@ -97,7 +96,6 @@ enum ieee80211_channel_flags {
97struct ieee80211_channel { 96struct ieee80211_channel {
98 enum ieee80211_band band; 97 enum ieee80211_band band;
99 u16 center_freq; 98 u16 center_freq;
100 u8 max_bandwidth;
101 u16 hw_value; 99 u16 hw_value;
102 u32 flags; 100 u32 flags;
103 int max_antenna_gain; 101 int max_antenna_gain;
@@ -372,6 +370,10 @@ struct rate_info {
372 * @txrate: current unicast bitrate to this station 370 * @txrate: current unicast bitrate to this station
373 * @rx_packets: packets received from this station 371 * @rx_packets: packets received from this station
374 * @tx_packets: packets transmitted to this station 372 * @tx_packets: packets transmitted to this station
373 * @generation: generation number for nl80211 dumps.
374 * This number should increase every time the list of stations
375 * changes, i.e. when a station is added or removed, so that
376 * userspace can tell whether it got a consistent snapshot.
375 */ 377 */
376struct station_info { 378struct station_info {
377 u32 filled; 379 u32 filled;
@@ -385,6 +387,8 @@ struct station_info {
385 struct rate_info txrate; 387 struct rate_info txrate;
386 u32 rx_packets; 388 u32 rx_packets;
387 u32 tx_packets; 389 u32 tx_packets;
390
391 int generation;
388}; 392};
389 393
390/** 394/**
@@ -444,6 +448,10 @@ enum mpath_info_flags {
444 * @flags: mesh path flags 448 * @flags: mesh path flags
445 * @discovery_timeout: total mesh path discovery timeout, in msecs 449 * @discovery_timeout: total mesh path discovery timeout, in msecs
446 * @discovery_retries: mesh path discovery retries 450 * @discovery_retries: mesh path discovery retries
451 * @generation: generation number for nl80211 dumps.
452 * This number should increase every time the list of mesh paths
453 * changes, i.e. when a station is added or removed, so that
454 * userspace can tell whether it got a consistent snapshot.
447 */ 455 */
448struct mpath_info { 456struct mpath_info {
449 u32 filled; 457 u32 filled;
@@ -454,6 +462,8 @@ struct mpath_info {
454 u32 discovery_timeout; 462 u32 discovery_timeout;
455 u8 discovery_retries; 463 u8 discovery_retries;
456 u8 flags; 464 u8 flags;
465
466 int generation;
457}; 467};
458 468
459/** 469/**
@@ -538,23 +548,26 @@ struct cfg80211_ssid {
538 * @ssids: SSIDs to scan for (active scan only) 548 * @ssids: SSIDs to scan for (active scan only)
539 * @n_ssids: number of SSIDs 549 * @n_ssids: number of SSIDs
540 * @channels: channels to scan on. 550 * @channels: channels to scan on.
541 * @n_channels: number of channels for each band 551 * @n_channels: total number of channels to scan
542 * @ie: optional information element(s) to add into Probe Request or %NULL 552 * @ie: optional information element(s) to add into Probe Request or %NULL
543 * @ie_len: length of ie in octets 553 * @ie_len: length of ie in octets
544 * @wiphy: the wiphy this was for 554 * @wiphy: the wiphy this was for
545 * @ifidx: the interface index 555 * @dev: the interface
546 */ 556 */
547struct cfg80211_scan_request { 557struct cfg80211_scan_request {
548 struct cfg80211_ssid *ssids; 558 struct cfg80211_ssid *ssids;
549 int n_ssids; 559 int n_ssids;
550 struct ieee80211_channel **channels;
551 u32 n_channels; 560 u32 n_channels;
552 const u8 *ie; 561 const u8 *ie;
553 size_t ie_len; 562 size_t ie_len;
554 563
555 /* internal */ 564 /* internal */
556 struct wiphy *wiphy; 565 struct wiphy *wiphy;
557 int ifidx; 566 struct net_device *dev;
567 bool aborted;
568
569 /* keep last */
570 struct ieee80211_channel *channels[0];
558}; 571};
559 572
560/** 573/**
@@ -584,7 +597,6 @@ enum cfg80211_signal_type {
584 * is no guarantee that these are well-formed!) 597 * is no guarantee that these are well-formed!)
585 * @len_information_elements: total length of the information elements 598 * @len_information_elements: total length of the information elements
586 * @signal: signal strength value (type depends on the wiphy's signal_type) 599 * @signal: signal strength value (type depends on the wiphy's signal_type)
587 * @hold: BSS should not expire
588 * @free_priv: function pointer to free private data 600 * @free_priv: function pointer to free private data
589 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 601 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
590 */ 602 */
@@ -605,37 +617,59 @@ struct cfg80211_bss {
605}; 617};
606 618
607/** 619/**
620 * ieee80211_bss_get_ie - find IE with given ID
621 * @bss: the bss to search
622 * @ie: the IE ID
623 * Returns %NULL if not found.
624 */
625const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
626
627
628/**
629 * struct cfg80211_crypto_settings - Crypto settings
630 * @wpa_versions: indicates which, if any, WPA versions are enabled
631 * (from enum nl80211_wpa_versions)
632 * @cipher_group: group key cipher suite (or 0 if unset)
633 * @n_ciphers_pairwise: number of AP supported unicast ciphers
634 * @ciphers_pairwise: unicast key cipher suites
635 * @n_akm_suites: number of AKM suites
636 * @akm_suites: AKM suites
637 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
638 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
639 * required to assume that the port is unauthorized until authorized by
640 * user space. Otherwise, port is marked authorized by default.
641 */
642struct cfg80211_crypto_settings {
643 u32 wpa_versions;
644 u32 cipher_group;
645 int n_ciphers_pairwise;
646 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
647 int n_akm_suites;
648 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
649 bool control_port;
650};
651
652/**
608 * struct cfg80211_auth_request - Authentication request data 653 * struct cfg80211_auth_request - Authentication request data
609 * 654 *
610 * This structure provides information needed to complete IEEE 802.11 655 * This structure provides information needed to complete IEEE 802.11
611 * authentication. 656 * authentication.
612 * NOTE: This structure will likely change when more code from mac80211 is 657 *
613 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. 658 * @bss: The BSS to authenticate with.
614 * Before using this in a driver that does not use mac80211, it would be better
615 * to check the status of that work and better yet, volunteer to work on it.
616 *
617 * @chan: The channel to use or %NULL if not specified (auto-select based on
618 * scan results)
619 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
620 * this field is required to be present; if the driver wants to help with
621 * BSS selection, it should use (yet to be added) MLME event to allow user
622 * space SME to be notified of roaming candidate, so that the SME can then
623 * use the authentication request with the recommended BSSID and whatever
624 * other data may be needed for authentication/association
625 * @ssid: SSID or %NULL if not yet available
626 * @ssid_len: Length of ssid in octets
627 * @auth_type: Authentication type (algorithm) 659 * @auth_type: Authentication type (algorithm)
628 * @ie: Extra IEs to add to Authentication frame or %NULL 660 * @ie: Extra IEs to add to Authentication frame or %NULL
629 * @ie_len: Length of ie buffer in octets 661 * @ie_len: Length of ie buffer in octets
662 * @key_len: length of WEP key for shared key authentication
663 * @key_idx: index of WEP key for shared key authentication
664 * @key: WEP key for shared key authentication
630 */ 665 */
631struct cfg80211_auth_request { 666struct cfg80211_auth_request {
632 struct ieee80211_channel *chan; 667 struct cfg80211_bss *bss;
633 u8 *peer_addr;
634 const u8 *ssid;
635 size_t ssid_len;
636 enum nl80211_auth_type auth_type;
637 const u8 *ie; 668 const u8 *ie;
638 size_t ie_len; 669 size_t ie_len;
670 enum nl80211_auth_type auth_type;
671 const u8 *key;
672 u8 key_len, key_idx;
639}; 673};
640 674
641/** 675/**
@@ -643,35 +677,19 @@ struct cfg80211_auth_request {
643 * 677 *
644 * This structure provides information needed to complete IEEE 802.11 678 * This structure provides information needed to complete IEEE 802.11
645 * (re)association. 679 * (re)association.
646 * NOTE: This structure will likely change when more code from mac80211 is 680 * @bss: The BSS to associate with.
647 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
648 * Before using this in a driver that does not use mac80211, it would be better
649 * to check the status of that work and better yet, volunteer to work on it.
650 *
651 * @chan: The channel to use or %NULL if not specified (auto-select based on
652 * scan results)
653 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
654 * to be present and the STA must be in State 2 (authenticated) with the
655 * peer STA
656 * @ssid: SSID
657 * @ssid_len: Length of ssid in octets
658 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 681 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
659 * @ie_len: Length of ie buffer in octets 682 * @ie_len: Length of ie buffer in octets
660 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 683 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
661 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 684 * @crypto: crypto settings
662 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 685 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
663 * required to assume that the port is unauthorized until authorized by
664 * user space. Otherwise, port is marked authorized by default.
665 */ 686 */
666struct cfg80211_assoc_request { 687struct cfg80211_assoc_request {
667 struct ieee80211_channel *chan; 688 struct cfg80211_bss *bss;
668 u8 *peer_addr; 689 const u8 *ie, *prev_bssid;
669 const u8 *ssid;
670 size_t ssid_len;
671 const u8 *ie;
672 size_t ie_len; 690 size_t ie_len;
691 struct cfg80211_crypto_settings crypto;
673 bool use_mfp; 692 bool use_mfp;
674 bool control_port;
675}; 693};
676 694
677/** 695/**
@@ -680,16 +698,16 @@ struct cfg80211_assoc_request {
680 * This structure provides information needed to complete IEEE 802.11 698 * This structure provides information needed to complete IEEE 802.11
681 * deauthentication. 699 * deauthentication.
682 * 700 *
683 * @peer_addr: The address of the peer STA (AP BSSID); this field is required 701 * @bss: the BSS to deauthenticate from
684 * to be present and the STA must be authenticated with the peer STA
685 * @ie: Extra IEs to add to Deauthentication frame or %NULL 702 * @ie: Extra IEs to add to Deauthentication frame or %NULL
686 * @ie_len: Length of ie buffer in octets 703 * @ie_len: Length of ie buffer in octets
704 * @reason_code: The reason code for the deauthentication
687 */ 705 */
688struct cfg80211_deauth_request { 706struct cfg80211_deauth_request {
689 u8 *peer_addr; 707 struct cfg80211_bss *bss;
690 u16 reason_code;
691 const u8 *ie; 708 const u8 *ie;
692 size_t ie_len; 709 size_t ie_len;
710 u16 reason_code;
693}; 711};
694 712
695/** 713/**
@@ -698,16 +716,16 @@ struct cfg80211_deauth_request {
698 * This structure provides information needed to complete IEEE 802.11 716 * This structure provides information needed to complete IEEE 802.11
699 * disassocation. 717 * disassocation.
700 * 718 *
701 * @peer_addr: The address of the peer STA (AP BSSID); this field is required 719 * @bss: the BSS to disassociate from
702 * to be present and the STA must be associated with the peer STA
703 * @ie: Extra IEs to add to Disassociation frame or %NULL 720 * @ie: Extra IEs to add to Disassociation frame or %NULL
704 * @ie_len: Length of ie buffer in octets 721 * @ie_len: Length of ie buffer in octets
722 * @reason_code: The reason code for the disassociation
705 */ 723 */
706struct cfg80211_disassoc_request { 724struct cfg80211_disassoc_request {
707 u8 *peer_addr; 725 struct cfg80211_bss *bss;
708 u16 reason_code;
709 const u8 *ie; 726 const u8 *ie;
710 size_t ie_len; 727 size_t ie_len;
728 u16 reason_code;
711}; 729};
712 730
713/** 731/**
@@ -726,6 +744,8 @@ struct cfg80211_disassoc_request {
726 * @ie: information element(s) to include in the beacon 744 * @ie: information element(s) to include in the beacon
727 * @ie_len: length of that 745 * @ie_len: length of that
728 * @beacon_interval: beacon interval to use 746 * @beacon_interval: beacon interval to use
747 * @privacy: this is a protected network, keys will be configured
748 * after joining
729 */ 749 */
730struct cfg80211_ibss_params { 750struct cfg80211_ibss_params {
731 u8 *ssid; 751 u8 *ssid;
@@ -735,6 +755,42 @@ struct cfg80211_ibss_params {
735 u8 ssid_len, ie_len; 755 u8 ssid_len, ie_len;
736 u16 beacon_interval; 756 u16 beacon_interval;
737 bool channel_fixed; 757 bool channel_fixed;
758 bool privacy;
759};
760
761/**
762 * struct cfg80211_connect_params - Connection parameters
763 *
764 * This structure provides information needed to complete IEEE 802.11
765 * authentication and association.
766 *
767 * @channel: The channel to use or %NULL if not specified (auto-select based
768 * on scan results)
769 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
770 * results)
771 * @ssid: SSID
772 * @ssid_len: Length of ssid in octets
773 * @auth_type: Authentication type (algorithm)
774 * @assoc_ie: IEs for association request
775 * @assoc_ie_len: Length of assoc_ie in octets
776 * @privacy: indicates whether privacy-enabled APs should be used
777 * @crypto: crypto settings
778 * @key_len: length of WEP key for shared key authentication
779 * @key_idx: index of WEP key for shared key authentication
780 * @key: WEP key for shared key authentication
781 */
782struct cfg80211_connect_params {
783 struct ieee80211_channel *channel;
784 u8 *bssid;
785 u8 *ssid;
786 size_t ssid_len;
787 enum nl80211_auth_type auth_type;
788 u8 *ie;
789 size_t ie_len;
790 bool privacy;
791 struct cfg80211_crypto_settings crypto;
792 const u8 *key;
793 u8 key_len, key_idx;
738}; 794};
739 795
740/** 796/**
@@ -764,6 +820,26 @@ enum tx_power_setting {
764 TX_POWER_FIXED, 820 TX_POWER_FIXED,
765}; 821};
766 822
823/*
824 * cfg80211_bitrate_mask - masks for bitrate control
825 */
826struct cfg80211_bitrate_mask {
827/*
828 * As discussed in Berlin, this struct really
829 * should look like this:
830
831 struct {
832 u32 legacy;
833 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
834 } control[IEEE80211_NUM_BANDS];
835
836 * Since we can always fix in-kernel users, let's keep
837 * it simpler for now:
838 */
839 u32 fixed; /* fixed bitrate, 0 == not fixed */
840 u32 maxrate; /* in kbps, 0 == no limit */
841};
842
767/** 843/**
768 * struct cfg80211_ops - backend description for wireless configuration 844 * struct cfg80211_ops - backend description for wireless configuration
769 * 845 *
@@ -781,7 +857,8 @@ enum tx_power_setting {
781 * @resume: wiphy device needs to be resumed 857 * @resume: wiphy device needs to be resumed
782 * 858 *
783 * @add_virtual_intf: create a new virtual interface with the given name, 859 * @add_virtual_intf: create a new virtual interface with the given name,
784 * must set the struct wireless_dev's iftype. 860 * must set the struct wireless_dev's iftype. Beware: You must create
861 * the new netdev in the wiphy's network namespace!
785 * 862 *
786 * @del_virtual_intf: remove the virtual interface determined by ifindex. 863 * @del_virtual_intf: remove the virtual interface determined by ifindex.
787 * 864 *
@@ -841,6 +918,12 @@ enum tx_power_setting {
841 * @deauth: Request to deauthenticate from the specified peer 918 * @deauth: Request to deauthenticate from the specified peer
842 * @disassoc: Request to disassociate from the specified peer 919 * @disassoc: Request to disassociate from the specified peer
843 * 920 *
921 * @connect: Connect to the ESS with the specified parameters. When connected,
922 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
923 * If the connection fails for some reason, call cfg80211_connect_result()
924 * with the status from the AP.
925 * @disconnect: Disconnect from the BSS/ESS.
926 *
844 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 927 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
845 * cfg80211_ibss_joined(), also call that function when changing BSSID due 928 * cfg80211_ibss_joined(), also call that function when changing BSSID due
846 * to a merge. 929 * to a merge.
@@ -857,6 +940,8 @@ enum tx_power_setting {
857 * 940 *
858 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 941 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
859 * functions to adjust rfkill hw state 942 * functions to adjust rfkill hw state
943 *
944 * @testmode_cmd: run a test mode command
860 */ 945 */
861struct cfg80211_ops { 946struct cfg80211_ops {
862 int (*suspend)(struct wiphy *wiphy); 947 int (*suspend)(struct wiphy *wiphy);
@@ -865,8 +950,9 @@ struct cfg80211_ops {
865 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 950 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
866 enum nl80211_iftype type, u32 *flags, 951 enum nl80211_iftype type, u32 *flags,
867 struct vif_params *params); 952 struct vif_params *params);
868 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 953 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);
869 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 954 int (*change_virtual_intf)(struct wiphy *wiphy,
955 struct net_device *dev,
870 enum nl80211_iftype type, u32 *flags, 956 enum nl80211_iftype type, u32 *flags,
871 struct vif_params *params); 957 struct vif_params *params);
872 958
@@ -939,9 +1025,16 @@ struct cfg80211_ops {
939 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1025 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
940 struct cfg80211_assoc_request *req); 1026 struct cfg80211_assoc_request *req);
941 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1027 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
942 struct cfg80211_deauth_request *req); 1028 struct cfg80211_deauth_request *req,
1029 void *cookie);
943 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1030 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
944 struct cfg80211_disassoc_request *req); 1031 struct cfg80211_disassoc_request *req,
1032 void *cookie);
1033
1034 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1035 struct cfg80211_connect_params *sme);
1036 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1037 u16 reason_code);
945 1038
946 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 1039 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
947 struct cfg80211_ibss_params *params); 1040 struct cfg80211_ibss_params *params);
@@ -953,7 +1046,23 @@ struct cfg80211_ops {
953 enum tx_power_setting type, int dbm); 1046 enum tx_power_setting type, int dbm);
954 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1047 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
955 1048
1049 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1050 u8 *addr);
1051
956 void (*rfkill_poll)(struct wiphy *wiphy); 1052 void (*rfkill_poll)(struct wiphy *wiphy);
1053
1054#ifdef CONFIG_NL80211_TESTMODE
1055 int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
1056#endif
1057
1058 int (*set_bitrate_mask)(struct wiphy *wiphy,
1059 struct net_device *dev,
1060 const u8 *peer,
1061 const struct cfg80211_bitrate_mask *mask);
1062
1063 /* some temporary stuff to finish wext */
1064 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1065 bool enabled, int timeout);
957}; 1066};
958 1067
959/* 1068/*
@@ -996,6 +1105,12 @@ struct cfg80211_ops {
996 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1105 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
997 * -1 = fragmentation disabled, only odd values >= 256 used 1106 * -1 = fragmentation disabled, only odd values >= 256 used
998 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1107 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1108 * @net: the network namespace this wiphy currently lives in
1109 * @netnsok: if set to false, do not allow changing the netns of this
1110 * wiphy at all
1111 * @ps_default: default for powersave, will be set depending on the
1112 * kernel's default on wiphy_new(), but can be changed by the
1113 * driver if it has a good reason to override the default
999 */ 1114 */
1000struct wiphy { 1115struct wiphy {
1001 /* assign these fields before you register the wiphy */ 1116 /* assign these fields before you register the wiphy */
@@ -1010,6 +1125,9 @@ struct wiphy {
1010 bool strict_regulatory; 1125 bool strict_regulatory;
1011 bool disable_beacon_hints; 1126 bool disable_beacon_hints;
1012 1127
1128 bool netnsok;
1129 bool ps_default;
1130
1013 enum cfg80211_signal_type signal_type; 1131 enum cfg80211_signal_type signal_type;
1014 1132
1015 int bss_priv_size; 1133 int bss_priv_size;
@@ -1048,9 +1166,35 @@ struct wiphy {
1048 /* dir in debugfs: ieee80211/<wiphyname> */ 1166 /* dir in debugfs: ieee80211/<wiphyname> */
1049 struct dentry *debugfsdir; 1167 struct dentry *debugfsdir;
1050 1168
1169#ifdef CONFIG_NET_NS
1170 /* the network namespace this phy lives in currently */
1171 struct net *_net;
1172#endif
1173
1051 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1174 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1052}; 1175};
1053 1176
1177#ifdef CONFIG_NET_NS
1178static inline struct net *wiphy_net(struct wiphy *wiphy)
1179{
1180 return wiphy->_net;
1181}
1182
1183static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1184{
1185 wiphy->_net = net;
1186}
1187#else
1188static inline struct net *wiphy_net(struct wiphy *wiphy)
1189{
1190 return &init_net;
1191}
1192
1193static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1194{
1195}
1196#endif
1197
1054/** 1198/**
1055 * wiphy_priv - return priv from wiphy 1199 * wiphy_priv - return priv from wiphy
1056 * 1200 *
@@ -1063,6 +1207,17 @@ static inline void *wiphy_priv(struct wiphy *wiphy)
1063} 1207}
1064 1208
1065/** 1209/**
1210 * priv_to_wiphy - return the wiphy containing the priv
1211 *
1212 * @priv: a pointer previously returned by wiphy_priv
1213 */
1214static inline struct wiphy *priv_to_wiphy(void *priv)
1215{
1216 BUG_ON(!priv);
1217 return container_of(priv, struct wiphy, priv);
1218}
1219
1220/**
1066 * set_wiphy_dev - set device pointer for wiphy 1221 * set_wiphy_dev - set device pointer for wiphy
1067 * 1222 *
1068 * @wiphy: The wiphy whose device to bind 1223 * @wiphy: The wiphy whose device to bind
@@ -1134,6 +1289,13 @@ extern void wiphy_unregister(struct wiphy *wiphy);
1134 */ 1289 */
1135extern void wiphy_free(struct wiphy *wiphy); 1290extern void wiphy_free(struct wiphy *wiphy);
1136 1291
1292/* internal structs */
1293struct cfg80211_conn;
1294struct cfg80211_internal_bss;
1295struct cfg80211_cached_keys;
1296
1297#define MAX_AUTH_BSSES 4
1298
1137/** 1299/**
1138 * struct wireless_dev - wireless per-netdev state 1300 * struct wireless_dev - wireless per-netdev state
1139 * 1301 *
@@ -1157,22 +1319,45 @@ struct wireless_dev {
1157 struct wiphy *wiphy; 1319 struct wiphy *wiphy;
1158 enum nl80211_iftype iftype; 1320 enum nl80211_iftype iftype;
1159 1321
1160 /* private to the generic wireless code */ 1322 /* the remainder of this struct should be private to cfg80211 */
1161 struct list_head list; 1323 struct list_head list;
1162 struct net_device *netdev; 1324 struct net_device *netdev;
1163 1325
1164 /* currently used for IBSS - might be rearranged in the future */ 1326 struct mutex mtx;
1165 struct cfg80211_bss *current_bss; 1327
1166 u8 bssid[ETH_ALEN]; 1328 struct work_struct cleanup_work;
1329
1330 /* currently used for IBSS and SME - might be rearranged later */
1167 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1331 u8 ssid[IEEE80211_MAX_SSID_LEN];
1168 u8 ssid_len; 1332 u8 ssid_len;
1333 enum {
1334 CFG80211_SME_IDLE,
1335 CFG80211_SME_CONNECTING,
1336 CFG80211_SME_CONNECTED,
1337 } sme_state;
1338 struct cfg80211_conn *conn;
1339 struct cfg80211_cached_keys *connect_keys;
1340
1341 struct list_head event_list;
1342 spinlock_t event_lock;
1343
1344 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
1345 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1346 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1169 1347
1170#ifdef CONFIG_WIRELESS_EXT 1348#ifdef CONFIG_WIRELESS_EXT
1171 /* wext data */ 1349 /* wext data */
1172 struct { 1350 struct {
1173 struct cfg80211_ibss_params ibss; 1351 struct cfg80211_ibss_params ibss;
1174 u8 bssid[ETH_ALEN]; 1352 struct cfg80211_connect_params connect;
1353 struct cfg80211_cached_keys *keys;
1354 u8 *ie;
1355 size_t ie_len;
1356 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
1357 u8 ssid[IEEE80211_MAX_SSID_LEN];
1175 s8 default_key, default_mgmt_key; 1358 s8 default_key, default_mgmt_key;
1359 bool ps, prev_bssid_valid;
1360 int ps_timeout;
1176 } wext; 1361 } wext;
1177#endif 1362#endif
1178}; 1363};
@@ -1352,20 +1537,6 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1352extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1537extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1353 1538
1354/** 1539/**
1355 * regulatory_hint_11d - hints a country IE as a regulatory domain
1356 * @wiphy: the wireless device giving the hint (used only for reporting
1357 * conflicts)
1358 * @country_ie: pointer to the country IE
1359 * @country_ie_len: length of the country IE
1360 *
1361 * We will intersect the rd with the what CRDA tells us should apply
1362 * for the alpha2 this country IE belongs to, this prevents APs from
1363 * sending us incorrect or outdated information against a country.
1364 */
1365extern void regulatory_hint_11d(struct wiphy *wiphy,
1366 u8 *country_ie,
1367 u8 country_ie_len);
1368/**
1369 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1540 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1370 * @wiphy: the wireless device we want to process the regulatory domain on 1541 * @wiphy: the wireless device we want to process the regulatory domain on
1371 * @regd: the custom regulatory domain to use for this wiphy 1542 * @regd: the custom regulatory domain to use for this wiphy
@@ -1433,27 +1604,34 @@ int cfg80211_wext_siwmlme(struct net_device *dev,
1433int cfg80211_wext_giwrange(struct net_device *dev, 1604int cfg80211_wext_giwrange(struct net_device *dev,
1434 struct iw_request_info *info, 1605 struct iw_request_info *info,
1435 struct iw_point *data, char *extra); 1606 struct iw_point *data, char *extra);
1436int cfg80211_ibss_wext_siwfreq(struct net_device *dev, 1607int cfg80211_wext_siwgenie(struct net_device *dev,
1437 struct iw_request_info *info, 1608 struct iw_request_info *info,
1438 struct iw_freq *freq, char *extra); 1609 struct iw_point *data, char *extra);
1439int cfg80211_ibss_wext_giwfreq(struct net_device *dev, 1610int cfg80211_wext_siwauth(struct net_device *dev,
1440 struct iw_request_info *info, 1611 struct iw_request_info *info,
1441 struct iw_freq *freq, char *extra); 1612 struct iw_param *data, char *extra);
1442int cfg80211_ibss_wext_siwessid(struct net_device *dev, 1613int cfg80211_wext_giwauth(struct net_device *dev,
1443 struct iw_request_info *info, 1614 struct iw_request_info *info,
1444 struct iw_point *data, char *ssid); 1615 struct iw_param *data, char *extra);
1445int cfg80211_ibss_wext_giwessid(struct net_device *dev,
1446 struct iw_request_info *info,
1447 struct iw_point *data, char *ssid);
1448int cfg80211_ibss_wext_siwap(struct net_device *dev,
1449 struct iw_request_info *info,
1450 struct sockaddr *ap_addr, char *extra);
1451int cfg80211_ibss_wext_giwap(struct net_device *dev,
1452 struct iw_request_info *info,
1453 struct sockaddr *ap_addr, char *extra);
1454 1616
1455struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 1617int cfg80211_wext_siwfreq(struct net_device *dev,
1456 struct iw_freq *freq); 1618 struct iw_request_info *info,
1619 struct iw_freq *freq, char *extra);
1620int cfg80211_wext_giwfreq(struct net_device *dev,
1621 struct iw_request_info *info,
1622 struct iw_freq *freq, char *extra);
1623int cfg80211_wext_siwessid(struct net_device *dev,
1624 struct iw_request_info *info,
1625 struct iw_point *data, char *ssid);
1626int cfg80211_wext_giwessid(struct net_device *dev,
1627 struct iw_request_info *info,
1628 struct iw_point *data, char *ssid);
1629int cfg80211_wext_siwrate(struct net_device *dev,
1630 struct iw_request_info *info,
1631 struct iw_param *rate, char *extra);
1632int cfg80211_wext_giwrate(struct net_device *dev,
1633 struct iw_request_info *info,
1634 struct iw_param *rate, char *extra);
1457 1635
1458int cfg80211_wext_siwrts(struct net_device *dev, 1636int cfg80211_wext_siwrts(struct net_device *dev,
1459 struct iw_request_info *info, 1637 struct iw_request_info *info,
@@ -1488,6 +1666,21 @@ int cfg80211_wext_siwtxpower(struct net_device *dev,
1488int cfg80211_wext_giwtxpower(struct net_device *dev, 1666int cfg80211_wext_giwtxpower(struct net_device *dev,
1489 struct iw_request_info *info, 1667 struct iw_request_info *info,
1490 union iwreq_data *data, char *keybuf); 1668 union iwreq_data *data, char *keybuf);
1669struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev);
1670
1671int cfg80211_wext_siwpower(struct net_device *dev,
1672 struct iw_request_info *info,
1673 struct iw_param *wrq, char *extra);
1674int cfg80211_wext_giwpower(struct net_device *dev,
1675 struct iw_request_info *info,
1676 struct iw_param *wrq, char *extra);
1677
1678int cfg80211_wext_siwap(struct net_device *dev,
1679 struct iw_request_info *info,
1680 struct sockaddr *ap_addr, char *extra);
1681int cfg80211_wext_giwap(struct net_device *dev,
1682 struct iw_request_info *info,
1683 struct sockaddr *ap_addr, char *extra);
1491 1684
1492/* 1685/*
1493 * callbacks for asynchronous cfg80211 methods, notification 1686 * callbacks for asynchronous cfg80211 methods, notification
@@ -1569,7 +1762,7 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
1569 * This function is called whenever an authentication has been processed in 1762 * This function is called whenever an authentication has been processed in
1570 * station mode. The driver is required to call either this function or 1763 * station mode. The driver is required to call either this function or
1571 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 1764 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1572 * call. 1765 * call. This function may sleep.
1573 */ 1766 */
1574void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1767void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1575 1768
@@ -1577,6 +1770,8 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1577 * cfg80211_send_auth_timeout - notification of timed out authentication 1770 * cfg80211_send_auth_timeout - notification of timed out authentication
1578 * @dev: network device 1771 * @dev: network device
1579 * @addr: The MAC address of the device with which the authentication timed out 1772 * @addr: The MAC address of the device with which the authentication timed out
1773 *
1774 * This function may sleep.
1580 */ 1775 */
1581void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 1776void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1582 1777
@@ -1589,7 +1784,7 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1589 * This function is called whenever a (re)association response has been 1784 * This function is called whenever a (re)association response has been
1590 * processed in station mode. The driver is required to call either this 1785 * processed in station mode. The driver is required to call either this
1591 * function or cfg80211_send_assoc_timeout() to indicate the result of 1786 * function or cfg80211_send_assoc_timeout() to indicate the result of
1592 * cfg80211_ops::assoc() call. 1787 * cfg80211_ops::assoc() call. This function may sleep.
1593 */ 1788 */
1594void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1789void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1595 1790
@@ -1597,6 +1792,8 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1597 * cfg80211_send_assoc_timeout - notification of timed out association 1792 * cfg80211_send_assoc_timeout - notification of timed out association
1598 * @dev: network device 1793 * @dev: network device
1599 * @addr: The MAC address of the device with which the association timed out 1794 * @addr: The MAC address of the device with which the association timed out
1795 *
1796 * This function may sleep.
1600 */ 1797 */
1601void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 1798void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1602 1799
@@ -1605,41 +1802,30 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1605 * @dev: network device 1802 * @dev: network device
1606 * @buf: deauthentication frame (header + body) 1803 * @buf: deauthentication frame (header + body)
1607 * @len: length of the frame data 1804 * @len: length of the frame data
1805 * @cookie: cookie from ->deauth if called within that callback,
1806 * %NULL otherwise
1608 * 1807 *
1609 * This function is called whenever deauthentication has been processed in 1808 * This function is called whenever deauthentication has been processed in
1610 * station mode. This includes both received deauthentication frames and 1809 * station mode. This includes both received deauthentication frames and
1611 * locally generated ones. 1810 * locally generated ones. This function may sleep.
1612 */ 1811 */
1613void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 1812void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len,
1813 void *cookie);
1614 1814
1615/** 1815/**
1616 * cfg80211_send_disassoc - notification of processed disassociation 1816 * cfg80211_send_disassoc - notification of processed disassociation
1617 * @dev: network device 1817 * @dev: network device
1618 * @buf: disassociation response frame (header + body) 1818 * @buf: disassociation response frame (header + body)
1619 * @len: length of the frame data 1819 * @len: length of the frame data
1820 * @cookie: cookie from ->disassoc if called within that callback,
1821 * %NULL otherwise
1620 * 1822 *
1621 * This function is called whenever disassociation has been processed in 1823 * This function is called whenever disassociation has been processed in
1622 * station mode. This includes both received disassociation frames and locally 1824 * station mode. This includes both received disassociation frames and locally
1623 * generated ones. 1825 * generated ones. This function may sleep.
1624 */
1625void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
1626
1627/**
1628 * cfg80211_hold_bss - exclude bss from expiration
1629 * @bss: bss which should not expire
1630 *
1631 * In a case when the BSS is not updated but it shouldn't expire this
1632 * function can be used to mark the BSS to be excluded from expiration.
1633 */
1634void cfg80211_hold_bss(struct cfg80211_bss *bss);
1635
1636/**
1637 * cfg80211_unhold_bss - remove expiration exception from the BSS
1638 * @bss: bss which can expire again
1639 *
1640 * This function marks the BSS to be expirable again.
1641 */ 1826 */
1642void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1827void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len,
1828 void *cookie);
1643 1829
1644/** 1830/**
1645 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1831 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
@@ -1648,6 +1834,7 @@ void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1648 * @key_type: The key type that the received frame used 1834 * @key_type: The key type that the received frame used
1649 * @key_id: Key identifier (0..3) 1835 * @key_id: Key identifier (0..3)
1650 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 1836 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1837 * @gfp: allocation flags
1651 * 1838 *
1652 * This function is called whenever the local MAC detects a MIC failure in a 1839 * This function is called whenever the local MAC detects a MIC failure in a
1653 * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 1840 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
@@ -1655,7 +1842,7 @@ void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1655 */ 1842 */
1656void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 1843void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1657 enum nl80211_key_type key_type, int key_id, 1844 enum nl80211_key_type key_type, int key_id,
1658 const u8 *tsc); 1845 const u8 *tsc, gfp_t gfp);
1659 1846
1660/** 1847/**
1661 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 1848 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
@@ -1692,4 +1879,137 @@ void wiphy_rfkill_start_polling(struct wiphy *wiphy);
1692 */ 1879 */
1693void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 1880void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
1694 1881
1882#ifdef CONFIG_NL80211_TESTMODE
1883/**
1884 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
1885 * @wiphy: the wiphy
1886 * @approxlen: an upper bound of the length of the data that will
1887 * be put into the skb
1888 *
1889 * This function allocates and pre-fills an skb for a reply to
1890 * the testmode command. Since it is intended for a reply, calling
1891 * it outside of the @testmode_cmd operation is invalid.
1892 *
1893 * The returned skb (or %NULL if any errors happen) is pre-filled
1894 * with the wiphy index and set up in a way that any data that is
1895 * put into the skb (with skb_put(), nla_put() or similar) will end
1896 * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
1897 * needs to be done with the skb is adding data for the corresponding
1898 * userspace tool which can then read that data out of the testdata
1899 * attribute. You must not modify the skb in any other way.
1900 *
1901 * When done, call cfg80211_testmode_reply() with the skb and return
1902 * its error code as the result of the @testmode_cmd operation.
1903 */
1904struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
1905 int approxlen);
1906
1907/**
1908 * cfg80211_testmode_reply - send the reply skb
1909 * @skb: The skb, must have been allocated with
1910 * cfg80211_testmode_alloc_reply_skb()
1911 *
1912 * Returns an error code or 0 on success, since calling this
1913 * function will usually be the last thing before returning
1914 * from the @testmode_cmd you should return the error code.
1915 * Note that this function consumes the skb regardless of the
1916 * return value.
1917 */
1918int cfg80211_testmode_reply(struct sk_buff *skb);
1919
1920/**
1921 * cfg80211_testmode_alloc_event_skb - allocate testmode event
1922 * @wiphy: the wiphy
1923 * @approxlen: an upper bound of the length of the data that will
1924 * be put into the skb
1925 * @gfp: allocation flags
1926 *
1927 * This function allocates and pre-fills an skb for an event on the
1928 * testmode multicast group.
1929 *
1930 * The returned skb (or %NULL if any errors happen) is set up in the
1931 * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
1932 * for an event. As there, you should simply add data to it that will
1933 * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
1934 * not modify the skb in any other way.
1935 *
1936 * When done filling the skb, call cfg80211_testmode_event() with the
1937 * skb to send the event.
1938 */
1939struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
1940 int approxlen, gfp_t gfp);
1941
1942/**
1943 * cfg80211_testmode_event - send the event
1944 * @skb: The skb, must have been allocated with
1945 * cfg80211_testmode_alloc_event_skb()
1946 * @gfp: allocation flags
1947 *
1948 * This function sends the given @skb, which must have been allocated
1949 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
1950 * consumes it.
1951 */
1952void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
1953
1954#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
1955#else
1956#define CFG80211_TESTMODE_CMD(cmd)
1957#endif
1958
1959/**
1960 * cfg80211_connect_result - notify cfg80211 of connection result
1961 *
1962 * @dev: network device
1963 * @bssid: the BSSID of the AP
1964 * @req_ie: association request IEs (maybe be %NULL)
1965 * @req_ie_len: association request IEs length
1966 * @resp_ie: association response IEs (may be %NULL)
1967 * @resp_ie_len: assoc response IEs length
1968 * @status: status code, 0 for successful connection, use
1969 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
1970 * the real status code for failures.
1971 * @gfp: allocation flags
1972 *
1973 * It should be called by the underlying driver whenever connect() has
1974 * succeeded.
1975 */
1976void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
1977 const u8 *req_ie, size_t req_ie_len,
1978 const u8 *resp_ie, size_t resp_ie_len,
1979 u16 status, gfp_t gfp);
1980
1981/**
1982 * cfg80211_roamed - notify cfg80211 of roaming
1983 *
1984 * @dev: network device
1985 * @bssid: the BSSID of the new AP
1986 * @req_ie: association request IEs (maybe be %NULL)
1987 * @req_ie_len: association request IEs length
1988 * @resp_ie: association response IEs (may be %NULL)
1989 * @resp_ie_len: assoc response IEs length
1990 * @gfp: allocation flags
1991 *
1992 * It should be called by the underlying driver whenever it roamed
1993 * from one AP to another while connected.
1994 */
1995void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
1996 const u8 *req_ie, size_t req_ie_len,
1997 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
1998
1999/**
2000 * cfg80211_disconnected - notify cfg80211 that connection was dropped
2001 *
2002 * @dev: network device
2003 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
2004 * @ie_len: length of IEs
2005 * @reason: reason code for the disconnection, set it to 0 if unknown
2006 * @gfp: allocation flags
2007 *
2008 * After it calls this function, the driver should enter an idle state
2009 * and not try to connect to any AP any more.
2010 */
2011void cfg80211_disconnected(struct net_device *dev, u16 reason,
2012 u8 *ie, size_t ie_len, gfp_t gfp);
2013
2014
1695#endif /* __NET_CFG80211_H */ 2015#endif /* __NET_CFG80211_H */
diff --git a/include/net/compat.h b/include/net/compat.h
index 5bbf8bf9efea..7c3002832d05 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -40,8 +40,8 @@ extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
40 40
41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
42 42
43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int, 43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
44 int (*)(struct sock *, int, int, char __user *, int)); 44 int (*)(struct sock *, int, int, char __user *, unsigned int));
45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, 45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *,
46 int __user *, int (*)(struct sock *, int, int, char __user *, 46 int __user *, int (*)(struct sock *, int, int, char __user *,
47 int __user *)); 47 int __user *));
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 775cfc8055be..b36ac7e0914d 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 void (*setbcncfg)(struct net_device *, int, u32); 48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *); 49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8); 50 void (*setbcnrp)(struct net_device *, int, u8);
51 u8 (*setapp)(struct net_device *, u8, u16, u8);
52 u8 (*getapp)(struct net_device *, u8, u16);
51}; 53};
52 54
53#endif /* __NET_DCBNL_H__ */ 55#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dst.h b/include/net/dst.h
index 7fc409c19b37..5a900ddcf10d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -8,6 +8,7 @@
8#ifndef _NET_DST_H 8#ifndef _NET_DST_H
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <net/dst_ops.h>
11#include <linux/netdevice.h> 12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
@@ -102,28 +103,6 @@ struct dst_entry
102 }; 103 };
103}; 104};
104 105
105
106struct dst_ops
107{
108 unsigned short family;
109 __be16 protocol;
110 unsigned gc_thresh;
111
112 int (*gc)(struct dst_ops *ops);
113 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
114 void (*destroy)(struct dst_entry *);
115 void (*ifdown)(struct dst_entry *,
116 struct net_device *dev, int how);
117 struct dst_entry * (*negative_advice)(struct dst_entry *);
118 void (*link_failure)(struct sk_buff *);
119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
120 int (*local_out)(struct sk_buff *skb);
121
122 atomic_t entries;
123 struct kmem_cache *kmem_cachep;
124 struct net *dst_net;
125};
126
127#ifdef __KERNEL__ 106#ifdef __KERNEL__
128 107
129static inline u32 108static inline u32
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
new file mode 100644
index 000000000000..d1ff9b7e99b8
--- /dev/null
+++ b/include/net/dst_ops.h
@@ -0,0 +1,28 @@
1#ifndef _NET_DST_OPS_H
2#define _NET_DST_OPS_H
3#include <linux/types.h>
4
5struct dst_entry;
6struct kmem_cachep;
7struct net_device;
8struct sk_buff;
9
10struct dst_ops {
11 unsigned short family;
12 __be16 protocol;
13 unsigned gc_thresh;
14
15 int (*gc)(struct dst_ops *ops);
16 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
17 void (*destroy)(struct dst_entry *);
18 void (*ifdown)(struct dst_entry *,
19 struct net_device *dev, int how);
20 struct dst_entry * (*negative_advice)(struct dst_entry *);
21 void (*link_failure)(struct sk_buff *);
22 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
23 int (*local_out)(struct sk_buff *skb);
24
25 atomic_t entries;
26 struct kmem_cache *kmem_cachep;
27};
28#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 1b0e3ee4ddd8..2a1c06874c42 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/genetlink.h> 4#include <linux/genetlink.h>
5#include <net/netlink.h> 5#include <net/netlink.h>
6#include <net/net_namespace.h>
6 7
7/** 8/**
8 * struct genl_multicast_group - generic netlink multicast group 9 * struct genl_multicast_group - generic netlink multicast group
@@ -27,6 +28,8 @@ struct genl_multicast_group
27 * @name: name of family 28 * @name: name of family
28 * @version: protocol version 29 * @version: protocol version
29 * @maxattr: maximum number of attributes supported 30 * @maxattr: maximum number of attributes supported
31 * @netnsok: set to true if the family can handle network
32 * namespaces and should be presented in all of them
30 * @attrbuf: buffer to store parsed attributes 33 * @attrbuf: buffer to store parsed attributes
31 * @ops_list: list of all assigned operations 34 * @ops_list: list of all assigned operations
32 * @family_list: family list 35 * @family_list: family list
@@ -39,6 +42,7 @@ struct genl_family
39 char name[GENL_NAMSIZ]; 42 char name[GENL_NAMSIZ];
40 unsigned int version; 43 unsigned int version;
41 unsigned int maxattr; 44 unsigned int maxattr;
45 bool netnsok;
42 struct nlattr ** attrbuf; /* private */ 46 struct nlattr ** attrbuf; /* private */
43 struct list_head ops_list; /* private */ 47 struct list_head ops_list; /* private */
44 struct list_head family_list; /* private */ 48 struct list_head family_list; /* private */
@@ -62,8 +66,32 @@ struct genl_info
62 struct genlmsghdr * genlhdr; 66 struct genlmsghdr * genlhdr;
63 void * userhdr; 67 void * userhdr;
64 struct nlattr ** attrs; 68 struct nlattr ** attrs;
69#ifdef CONFIG_NET_NS
70 struct net * _net;
71#endif
65}; 72};
66 73
74#ifdef CONFIG_NET_NS
75static inline struct net *genl_info_net(struct genl_info *info)
76{
77 return info->_net;
78}
79
80static inline void genl_info_net_set(struct genl_info *info, struct net *net)
81{
82 info->_net = net;
83}
84#else
85static inline struct net *genl_info_net(struct genl_info *info)
86{
87 return &init_net;
88}
89
90static inline void genl_info_net_set(struct genl_info *info, struct net *net)
91{
92}
93#endif
94
67/** 95/**
68 * struct genl_ops - generic netlink operations 96 * struct genl_ops - generic netlink operations
69 * @cmd: command identifier 97 * @cmd: command identifier
@@ -98,8 +126,6 @@ extern int genl_register_mc_group(struct genl_family *family,
98extern void genl_unregister_mc_group(struct genl_family *family, 126extern void genl_unregister_mc_group(struct genl_family *family,
99 struct genl_multicast_group *grp); 127 struct genl_multicast_group *grp);
100 128
101extern struct sock *genl_sock;
102
103/** 129/**
104 * genlmsg_put - Add generic netlink header to netlink message 130 * genlmsg_put - Add generic netlink header to netlink message
105 * @skb: socket buffer holding the message 131 * @skb: socket buffer holding the message
@@ -170,7 +196,21 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
170} 196}
171 197
172/** 198/**
173 * genlmsg_multicast - multicast a netlink message 199 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
200 * @net: the net namespace
201 * @skb: netlink message as socket buffer
202 * @pid: own netlink pid to avoid sending to yourself
203 * @group: multicast group id
204 * @flags: allocation flags
205 */
206static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
207 u32 pid, unsigned int group, gfp_t flags)
208{
209 return nlmsg_multicast(net->genl_sock, skb, pid, group, flags);
210}
211
212/**
213 * genlmsg_multicast - multicast a netlink message to the default netns
174 * @skb: netlink message as socket buffer 214 * @skb: netlink message as socket buffer
175 * @pid: own netlink pid to avoid sending to yourself 215 * @pid: own netlink pid to avoid sending to yourself
176 * @group: multicast group id 216 * @group: multicast group id
@@ -179,17 +219,29 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
179static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 219static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid,
180 unsigned int group, gfp_t flags) 220 unsigned int group, gfp_t flags)
181{ 221{
182 return nlmsg_multicast(genl_sock, skb, pid, group, flags); 222 return genlmsg_multicast_netns(&init_net, skb, pid, group, flags);
183} 223}
184 224
185/** 225/**
226 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
227 * @skb: netlink message as socket buffer
228 * @pid: own netlink pid to avoid sending to yourself
229 * @group: multicast group id
230 * @flags: allocation flags
231 *
232 * This function must hold the RTNL or rcu_read_lock().
233 */
234int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid,
235 unsigned int group, gfp_t flags);
236
237/**
186 * genlmsg_unicast - unicast a netlink message 238 * genlmsg_unicast - unicast a netlink message
187 * @skb: netlink message as socket buffer 239 * @skb: netlink message as socket buffer
188 * @pid: netlink pid of the destination socket 240 * @pid: netlink pid of the destination socket
189 */ 241 */
190static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) 242static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
191{ 243{
192 return nlmsg_unicast(genl_sock, skb, pid); 244 return nlmsg_unicast(net->genl_sock, skb, pid);
193} 245}
194 246
195/** 247/**
@@ -199,7 +251,7 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
199 */ 251 */
200static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) 252static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
201{ 253{
202 return genlmsg_unicast(skb, info->snd_pid); 254 return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid);
203} 255}
204 256
205/** 257/**
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154.h
index 8cb684635650..d52685defb11 100644
--- a/include/net/ieee802154/mac_def.h
+++ b/include/net/ieee802154.h
@@ -23,8 +23,8 @@
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */ 24 */
25 25
26#ifndef IEEE802154_MAC_DEF_H 26#ifndef NET_IEEE802154_H
27#define IEEE802154_MAC_DEF_H 27#define NET_IEEE802154_H
28 28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
deleted file mode 100644
index 78efcdf52b59..000000000000
--- a/include/net/ieee802154/nl802154.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154_netdev.h
index e2506af3e7c8..5dc6a61952de 100644
--- a/include/net/ieee802154/netdevice.h
+++ b/include/net/ieee802154_netdev.h
@@ -80,7 +80,7 @@ static inline int mac_cb_type(struct sk_buff *skb)
80struct ieee802154_mlme_ops { 80struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev, 81 int (*assoc_req)(struct net_device *dev,
82 struct ieee802154_addr *addr, 82 struct ieee802154_addr *addr,
83 u8 channel, u8 cap); 83 u8 channel, u8 page, u8 cap);
84 int (*assoc_resp)(struct net_device *dev, 84 int (*assoc_resp)(struct net_device *dev,
85 struct ieee802154_addr *addr, 85 struct ieee802154_addr *addr,
86 u16 short_addr, u8 status); 86 u16 short_addr, u8 status);
@@ -89,10 +89,10 @@ struct ieee802154_mlme_ops {
89 u8 reason); 89 u8 reason);
90 int (*start_req)(struct net_device *dev, 90 int (*start_req)(struct net_device *dev,
91 struct ieee802154_addr *addr, 91 struct ieee802154_addr *addr,
92 u8 channel, u8 bcn_ord, u8 sf_ord, 92 u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
93 u8 pan_coord, u8 blx, u8 coord_realign); 93 u8 pan_coord, u8 blx, u8 coord_realign);
94 int (*scan_req)(struct net_device *dev, 94 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 duration); 95 u8 type, u32 channels, u8 page, u8 duration);
96 96
97 /* 97 /*
98 * FIXME: these should become the part of PIB/MIB interface. 98 * FIXME: these should become the part of PIB/MIB interface.
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 03cffd9f64e3..696d6e4ce68a 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -48,13 +48,13 @@ struct inet_connection_sock_af_ops {
48 u16 net_header_len; 48 u16 net_header_len;
49 u16 sockaddr_len; 49 u16 sockaddr_len;
50 int (*setsockopt)(struct sock *sk, int level, int optname, 50 int (*setsockopt)(struct sock *sk, int level, int optname,
51 char __user *optval, int optlen); 51 char __user *optval, unsigned int optlen);
52 int (*getsockopt)(struct sock *sk, int level, int optname, 52 int (*getsockopt)(struct sock *sk, int level, int optname,
53 char __user *optval, int __user *optlen); 53 char __user *optval, int __user *optlen);
54#ifdef CONFIG_COMPAT 54#ifdef CONFIG_COMPAT
55 int (*compat_setsockopt)(struct sock *sk, 55 int (*compat_setsockopt)(struct sock *sk,
56 int level, int optname, 56 int level, int optname,
57 char __user *optval, int optlen); 57 char __user *optval, unsigned int optlen);
58 int (*compat_getsockopt)(struct sock *sk, 58 int (*compat_getsockopt)(struct sock *sk,
59 int level, int optname, 59 int level, int optname,
60 char __user *optval, int __user *optlen); 60 char __user *optval, int __user *optlen);
@@ -332,5 +332,5 @@ extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
332extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 332extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
333 char __user *optval, int __user *optlen); 333 char __user *optval, int __user *optlen);
334extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 334extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
335 char __user *optval, int optlen); 335 char __user *optval, unsigned int optlen);
336#endif /* _INET_CONNECTION_SOCK_H */ 336#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index b63b80fac567..f93ad90a601b 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -130,11 +130,11 @@ struct inet_timewait_sock {
130 __u16 tw_num; 130 __u16 tw_num;
131 kmemcheck_bitfield_begin(flags); 131 kmemcheck_bitfield_begin(flags);
132 /* And these are ours. */ 132 /* And these are ours. */
133 __u8 tw_ipv6only:1, 133 unsigned int tw_ipv6only : 1,
134 tw_transparent:1; 134 tw_transparent : 1,
135 /* 14 bits hole, try to pack */ 135 tw_pad : 14, /* 14 bits hole */
136 tw_ipv6_offset : 16;
136 kmemcheck_bitfield_end(flags); 137 kmemcheck_bitfield_end(flags);
137 __u16 tw_ipv6_offset;
138 unsigned long tw_ttd; 138 unsigned long tw_ttd;
139 struct inet_bind_bucket *tw_tb; 139 struct inet_bind_bucket *tw_tb;
140 struct hlist_node tw_death_node; 140 struct hlist_node tw_death_node;
diff --git a/include/net/ip.h b/include/net/ip.h
index 72c36926c26d..2f47e5482b55 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -381,10 +381,10 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
381extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 381extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
382extern int ip_cmsg_send(struct net *net, 382extern int ip_cmsg_send(struct net *net,
383 struct msghdr *msg, struct ipcm_cookie *ipc); 383 struct msghdr *msg, struct ipcm_cookie *ipc);
384extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); 384extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen);
385extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 385extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
386extern int compat_ip_setsockopt(struct sock *sk, int level, 386extern int compat_ip_setsockopt(struct sock *sk, int level,
387 int optname, char __user *optval, int optlen); 387 int optname, char __user *optval, unsigned int optlen);
388extern int compat_ip_getsockopt(struct sock *sk, int level, 388extern int compat_ip_getsockopt(struct sock *sk, int level,
389 int optname, char __user *optval, int __user *optlen); 389 int optname, char __user *optval, int __user *optlen);
390extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 390extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
@@ -399,7 +399,7 @@ extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
399 * fed into the routing cache should use these handlers. 399 * fed into the routing cache should use these handlers.
400 */ 400 */
401int ipv4_doint_and_flush(ctl_table *ctl, int write, 401int ipv4_doint_and_flush(ctl_table *ctl, int write,
402 struct file* filp, void __user *buffer, 402 void __user *buffer,
403 size_t *lenp, loff_t *ppos); 403 size_t *lenp, loff_t *ppos);
404int ipv4_doint_and_flush_strategy(ctl_table *table, 404int ipv4_doint_and_flush_strategy(ctl_table *table,
405 void __user *oldval, size_t __user *oldlenp, 405 void __user *oldval, size_t __user *oldlenp,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 7c5c0f79168a..15b492a9aa79 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -22,6 +22,12 @@
22#include <net/flow.h> 22#include <net/flow.h>
23#include <net/netlink.h> 23#include <net/netlink.h>
24 24
25#ifdef CONFIG_IPV6_MULTIPLE_TABLES
26#define FIB6_TABLE_HASHSZ 256
27#else
28#define FIB6_TABLE_HASHSZ 1
29#endif
30
25struct rt6_info; 31struct rt6_info;
26 32
27struct fib6_config 33struct fib6_config
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index ef91fe924ba4..4d22fabc7719 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -210,7 +210,8 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id);
210extern const struct nla_policy rtm_ipv4_policy[]; 210extern const struct nla_policy rtm_ipv4_policy[];
211extern void ip_fib_init(void); 211extern void ip_fib_init(void);
212extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 212extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
213 struct net_device *dev, __be32 *spec_dst, u32 *itag); 213 struct net_device *dev, __be32 *spec_dst,
214 u32 *itag, u32 mark);
214extern void fib_select_default(struct net *net, const struct flowi *flp, 215extern void fib_select_default(struct net *net, const struct flowi *flp,
215 struct fib_result *res); 216 struct fib_result *res);
216 217
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index bbae1e87efcd..98978e73f666 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -99,47 +99,47 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
99 return &buf[*idx - len]; 99 return &buf[*idx - len];
100} 100}
101 101
102#define IP_VS_DBG_BUF(level, msg...) \ 102#define IP_VS_DBG_BUF(level, msg, ...) \
103 do { \ 103 do { \
104 char ip_vs_dbg_buf[160]; \ 104 char ip_vs_dbg_buf[160]; \
105 int ip_vs_dbg_idx = 0; \ 105 int ip_vs_dbg_idx = 0; \
106 if (level <= ip_vs_get_debug_level()) \ 106 if (level <= ip_vs_get_debug_level()) \
107 printk(KERN_DEBUG "IPVS: " msg); \ 107 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
108 } while (0) 108 } while (0)
109#define IP_VS_ERR_BUF(msg...) \ 109#define IP_VS_ERR_BUF(msg...) \
110 do { \ 110 do { \
111 char ip_vs_dbg_buf[160]; \ 111 char ip_vs_dbg_buf[160]; \
112 int ip_vs_dbg_idx = 0; \ 112 int ip_vs_dbg_idx = 0; \
113 printk(KERN_ERR "IPVS: " msg); \ 113 pr_err(msg); \
114 } while (0) 114 } while (0)
115 115
116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */ 116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
117#define IP_VS_DBG_ADDR(af, addr) \ 117#define IP_VS_DBG_ADDR(af, addr) \
118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \ 118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
119 sizeof(ip_vs_dbg_buf), addr, \ 119 sizeof(ip_vs_dbg_buf), addr, \
120 &ip_vs_dbg_idx) 120 &ip_vs_dbg_idx)
121 121
122#define IP_VS_DBG(level, msg...) \ 122#define IP_VS_DBG(level, msg, ...) \
123 do { \ 123 do { \
124 if (level <= ip_vs_get_debug_level()) \ 124 if (level <= ip_vs_get_debug_level()) \
125 printk(KERN_DEBUG "IPVS: " msg); \ 125 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
126 } while (0) 126 } while (0)
127#define IP_VS_DBG_RL(msg...) \ 127#define IP_VS_DBG_RL(msg, ...) \
128 do { \ 128 do { \
129 if (net_ratelimit()) \ 129 if (net_ratelimit()) \
130 printk(KERN_DEBUG "IPVS: " msg); \ 130 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
131 } while (0) 131 } while (0)
132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ 132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \
133 do { \ 133 do { \
134 if (level <= ip_vs_get_debug_level()) \ 134 if (level <= ip_vs_get_debug_level()) \
135 pp->debug_packet(pp, skb, ofs, msg); \ 135 pp->debug_packet(pp, skb, ofs, msg); \
136 } while (0) 136 } while (0)
137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ 137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
138 do { \ 138 do { \
139 if (level <= ip_vs_get_debug_level() && \ 139 if (level <= ip_vs_get_debug_level() && \
140 net_ratelimit()) \ 140 net_ratelimit()) \
141 pp->debug_packet(pp, skb, ofs, msg); \ 141 pp->debug_packet(pp, skb, ofs, msg); \
142 } while (0) 142 } while (0)
143#else /* NO DEBUGGING at ALL */ 143#else /* NO DEBUGGING at ALL */
144#define IP_VS_DBG_BUF(level, msg...) do {} while (0) 144#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
145#define IP_VS_ERR_BUF(msg...) do {} while (0) 145#define IP_VS_ERR_BUF(msg...) do {} while (0)
@@ -150,29 +150,27 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
150#endif 150#endif
151 151
152#define IP_VS_BUG() BUG() 152#define IP_VS_BUG() BUG()
153#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg) 153#define IP_VS_ERR_RL(msg, ...) \
154#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg) 154 do { \
155#define IP_VS_WARNING(msg...) \ 155 if (net_ratelimit()) \
156 printk(KERN_WARNING "IPVS: " msg) 156 pr_err(msg, ##__VA_ARGS__); \
157#define IP_VS_ERR_RL(msg...) \ 157 } while (0)
158 do { \
159 if (net_ratelimit()) \
160 printk(KERN_ERR "IPVS: " msg); \
161 } while (0)
162 158
163#ifdef CONFIG_IP_VS_DEBUG 159#ifdef CONFIG_IP_VS_DEBUG
164#define EnterFunction(level) \ 160#define EnterFunction(level) \
165 do { \ 161 do { \
166 if (level <= ip_vs_get_debug_level()) \ 162 if (level <= ip_vs_get_debug_level()) \
167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ 163 printk(KERN_DEBUG \
168 __func__, __FILE__, __LINE__); \ 164 pr_fmt("Enter: %s, %s line %i\n"), \
169 } while (0) 165 __func__, __FILE__, __LINE__); \
170#define LeaveFunction(level) \ 166 } while (0)
171 do { \ 167#define LeaveFunction(level) \
172 if (level <= ip_vs_get_debug_level()) \ 168 do { \
173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ 169 if (level <= ip_vs_get_debug_level()) \
174 __func__, __FILE__, __LINE__); \ 170 printk(KERN_DEBUG \
175 } while (0) 171 pr_fmt("Leave: %s, %s line %i\n"), \
172 __func__, __FILE__, __LINE__); \
173 } while (0)
176#else 174#else
177#define EnterFunction(level) do {} while (0) 175#define EnterFunction(level) do {} while (0)
178#define LeaveFunction(level) do {} while (0) 176#define LeaveFunction(level) do {} while (0)
@@ -740,7 +738,8 @@ extern void ip_vs_protocol_cleanup(void);
740extern void ip_vs_protocol_timeout_change(int flags); 738extern void ip_vs_protocol_timeout_change(int flags);
741extern int *ip_vs_create_timeout_table(int *table, int size); 739extern int *ip_vs_create_timeout_table(int *table, int size);
742extern int 740extern int
743ip_vs_set_state_timeout(int *table, int num, char **names, char *name, int to); 741ip_vs_set_state_timeout(int *table, int num, const char *const *names,
742 const char *name, int to);
744extern void 743extern void
745ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb, 744ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb,
746 int offset, const char *msg); 745 int offset, const char *msg);
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 5d3036fa1511..87acf8f3a155 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -12,7 +12,6 @@ struct ip_tunnel
12 struct ip_tunnel *next; 12 struct ip_tunnel *next;
13 struct net_device *dev; 13 struct net_device *dev;
14 14
15 int recursion; /* Depth of hard_start_xmit recursion */
16 int err_count; /* Number of arrived ICMP errors */ 15 int err_count; /* Number of arrived ICMP errors */
17 unsigned long err_time; /* Time when the last ICMP error arrived */ 16 unsigned long err_time; /* Time when the last ICMP error arrived */
18 17
@@ -28,18 +27,11 @@ struct ip_tunnel
28 unsigned int prl_count; /* # of entries in PRL */ 27 unsigned int prl_count; /* # of entries in PRL */
29}; 28};
30 29
31/* ISATAP: default interval between RS in secondy */
32#define IPTUNNEL_RS_DEFAULT_DELAY (900)
33
34struct ip_tunnel_prl_entry 30struct ip_tunnel_prl_entry
35{ 31{
36 struct ip_tunnel_prl_entry *next; 32 struct ip_tunnel_prl_entry *next;
37 __be32 addr; 33 __be32 addr;
38 u16 flags; 34 u16 flags;
39 unsigned long rs_delay;
40 struct timer_list rs_timer;
41 struct ip_tunnel *tunnel;
42 spinlock_t lock;
43}; 35};
44 36
45#define IPTUNNEL_XMIT() do { \ 37#define IPTUNNEL_XMIT() do { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f27fd83d67d8..8c31d8a0c1fe 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -441,6 +441,18 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
441 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 441 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
442} 442}
443 443
444static __inline__ void ipv6_select_ident(struct frag_hdr *fhdr)
445{
446 static u32 ipv6_fragmentation_id = 1;
447 static DEFINE_SPINLOCK(ip6_id_lock);
448
449 spin_lock_bh(&ip6_id_lock);
450 fhdr->identification = htonl(ipv6_fragmentation_id);
451 if (++ipv6_fragmentation_id == 0)
452 ipv6_fragmentation_id = 1;
453 spin_unlock_bh(&ip6_id_lock);
454}
455
444/* 456/*
445 * Prototypes exported by ipv6 457 * Prototypes exported by ipv6
446 */ 458 */
@@ -538,7 +550,7 @@ extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
538extern int ipv6_setsockopt(struct sock *sk, int level, 550extern int ipv6_setsockopt(struct sock *sk, int level,
539 int optname, 551 int optname,
540 char __user *optval, 552 char __user *optval,
541 int optlen); 553 unsigned int optlen);
542extern int ipv6_getsockopt(struct sock *sk, int level, 554extern int ipv6_getsockopt(struct sock *sk, int level,
543 int optname, 555 int optname,
544 char __user *optval, 556 char __user *optval,
@@ -547,7 +559,7 @@ extern int compat_ipv6_setsockopt(struct sock *sk,
547 int level, 559 int level,
548 int optname, 560 int optname,
549 char __user *optval, 561 char __user *optval,
550 int optlen); 562 unsigned int optlen);
551extern int compat_ipv6_getsockopt(struct sock *sk, 563extern int compat_ipv6_getsockopt(struct sock *sk,
552 int level, 564 int level,
553 int optname, 565 int optname,
diff --git a/include/net/irda/ircomm_event.h b/include/net/irda/ircomm_event.h
index c290447872d1..bc0c6f31f1c6 100644
--- a/include/net/irda/ircomm_event.h
+++ b/include/net/irda/ircomm_event.h
@@ -74,7 +74,7 @@ struct ircomm_info {
74 struct qos_info *qos; 74 struct qos_info *qos;
75}; 75};
76 76
77extern char *ircomm_state[]; 77extern const char *const ircomm_state[];
78 78
79struct ircomm_cb; /* Forward decl. */ 79struct ircomm_cb; /* Forward decl. */
80 80
diff --git a/include/net/irda/ircomm_tty_attach.h b/include/net/irda/ircomm_tty_attach.h
index f91a5695aa44..0a63bbb972d7 100644
--- a/include/net/irda/ircomm_tty_attach.h
+++ b/include/net/irda/ircomm_tty_attach.h
@@ -66,8 +66,8 @@ struct ircomm_tty_info {
66 __u8 dlsap_sel; 66 __u8 dlsap_sel;
67}; 67};
68 68
69extern char *ircomm_state[]; 69extern const char *const ircomm_state[];
70extern char *ircomm_tty_state[]; 70extern const char *const ircomm_tty_state[];
71 71
72int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, 72int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
73 struct sk_buff *skb, struct ircomm_tty_info *info); 73 struct sk_buff *skb, struct ircomm_tty_info *info);
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
index 2ae2e119ef4b..4c90824c50fb 100644
--- a/include/net/irda/irlap_event.h
+++ b/include/net/irda/irlap_event.h
@@ -120,7 +120,7 @@ typedef enum { /* FIXME check the two first reason codes */
120 LAP_PRIMARY_CONFLICT, 120 LAP_PRIMARY_CONFLICT,
121} LAP_REASON; 121} LAP_REASON;
122 122
123extern const char *irlap_state[]; 123extern const char *const irlap_state[];
124 124
125void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, 125void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
126 struct sk_buff *skb, struct irlap_info *info); 126 struct sk_buff *skb, struct irlap_info *info);
diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h
index e03ae4ae3963..9e4ec17a7449 100644
--- a/include/net/irda/irlmp_event.h
+++ b/include/net/irda/irlmp_event.h
@@ -79,8 +79,8 @@ typedef enum {
79 LM_LAP_IDLE_TIMEOUT, 79 LM_LAP_IDLE_TIMEOUT,
80} IRLMP_EVENT; 80} IRLMP_EVENT;
81 81
82extern const char *irlmp_state[]; 82extern const char *const irlmp_state[];
83extern const char *irlsap_state[]; 83extern const char *const irlsap_state[];
84 84
85void irlmp_watchdog_timer_expired(void *data); 85void irlmp_watchdog_timer_expired(void *data);
86void irlmp_discovery_timer_expired(void *data); 86void irlmp_discovery_timer_expired(void *data);
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 51b9a37de991..e9054a283fde 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -416,13 +416,13 @@ struct iw_spy_data
416 * data (i.e. valid as long as struct net_device exist, same locking rules). 416 * data (i.e. valid as long as struct net_device exist, same locking rules).
417 */ 417 */
418/* Forward declaration */ 418/* Forward declaration */
419struct ieee80211_device; 419struct libipw_device;
420/* The struct */ 420/* The struct */
421struct iw_public_data { 421struct iw_public_data {
422 /* Driver enhanced spy support */ 422 /* Driver enhanced spy support */
423 struct iw_spy_data * spy_data; 423 struct iw_spy_data * spy_data;
424 /* Structure managed by the in-kernel IEEE 802.11 layer */ 424 /* Legacy structure managed by the ipw2x00-specific IEEE 802.11 layer */
425 struct ieee80211_device * ieee80211; 425 struct libipw_device * libipw;
426}; 426};
427 427
428/**************************** PROTOTYPES ****************************/ 428/**************************** PROTOTYPES ****************************/
@@ -443,7 +443,7 @@ extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
443extern void wireless_send_event(struct net_device * dev, 443extern void wireless_send_event(struct net_device * dev,
444 unsigned int cmd, 444 unsigned int cmd,
445 union iwreq_data * wrqu, 445 union iwreq_data * wrqu,
446 char * extra); 446 const char * extra);
447 447
448/* We may need a function to send a stream of events to user space. 448/* We may need a function to send a stream of events to user space.
449 * More on that later... */ 449 * More on that later... */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c06104476973..998c30fc8981 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -73,6 +73,21 @@
73 */ 73 */
74 74
75/** 75/**
76 * DOC: mac80211 workqueue
77 *
78 * mac80211 provides its own workqueue for drivers and internal mac80211 use.
79 * The workqueue is a single threaded workqueue and can only be accessed by
80 * helpers for sanity checking. Drivers must ensure all work added onto the
81 * mac80211 workqueue should be cancelled on the driver stop() callback.
82 *
83 * mac80211 will flushed the workqueue upon interface removal and during
84 * suspend.
85 *
86 * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
87 *
88 */
89
90/**
76 * enum ieee80211_max_queues - maximum number of queues 91 * enum ieee80211_max_queues - maximum number of queues
77 * 92 *
78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 93 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -224,7 +239,14 @@ struct ieee80211_bss_conf {
224 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 239 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
225 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211. 240 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
226 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 241 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
227 * because the destination STA was in powersave mode. 242 * because the destination STA was in powersave mode. Note that to
243 * avoid race conditions, the filter must be set by the hardware or
244 * firmware upon receiving a frame that indicates that the station
245 * went to sleep (must be done on device to filter frames already on
246 * the queue) and may only be unset after mac80211 gives the OK for
247 * that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
248 * since only then is it guaranteed that no more frames are in the
249 * hardware queue.
228 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 250 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
229 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status 251 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
230 * is for the whole aggregation. 252 * is for the whole aggregation.
@@ -241,6 +263,15 @@ struct ieee80211_bss_conf {
241 * it can be sent out. 263 * it can be sent out.
242 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, 264 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
243 * used to indicate that a frame was already retried due to PS 265 * used to indicate that a frame was already retried due to PS
266 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
267 * used to indicate frame should not be encrypted
268 * @IEEE80211_TX_CTL_PSPOLL_RESPONSE: (internal?)
269 * This frame is a response to a PS-poll frame and should be sent
270 * although the station is in powersave mode.
271 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
272 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full.
244 */ 275 */
245enum mac80211_tx_control_flags { 276enum mac80211_tx_control_flags {
246 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -259,6 +290,9 @@ enum mac80211_tx_control_flags {
259 IEEE80211_TX_INTFL_RCALGO = BIT(13), 290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
260 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
261 IEEE80211_TX_INTFL_RETRIED = BIT(15), 292 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
262}; 296};
263 297
264/** 298/**
@@ -316,6 +350,21 @@ enum mac80211_rate_control_flags {
316 * 350 *
317 * When used for transmit status reporting, the driver should 351 * When used for transmit status reporting, the driver should
318 * always report the rate along with the flags it used. 352 * always report the rate along with the flags it used.
353 *
354 * &struct ieee80211_tx_info contains an array of these structs
355 * in the control information, and it will be filled by the rate
356 * control algorithm according to what should be sent. For example,
357 * if this array contains, in the format { <idx>, <count> } the
358 * information
359 * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
360 * then this means that the frame should be transmitted
361 * up to twice at rate 3, up to twice at rate 2, and up to four
362 * times at rate 1 if it doesn't get acknowledged. Say it gets
363 * acknowledged by the peer after the fifth attempt, the status
364 * information should then contain
365 * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
366 * since it was transmitted twice at rate 3, twice at rate 2
367 * and once at rate 1 after which we received an acknowledgement.
319 */ 368 */
320struct ieee80211_tx_rate { 369struct ieee80211_tx_rate {
321 s8 idx; 370 s8 idx;
@@ -397,6 +446,11 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
397 return (struct ieee80211_tx_info *)skb->cb; 446 return (struct ieee80211_tx_info *)skb->cb;
398} 447}
399 448
449static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
450{
451 return (struct ieee80211_rx_status *)skb->cb;
452}
453
400/** 454/**
401 * ieee80211_tx_info_clear_status - clear TX status 455 * ieee80211_tx_info_clear_status - clear TX status
402 * 456 *
@@ -478,7 +532,7 @@ enum mac80211_rx_flags {
478 * 532 *
479 * The low-level driver should provide this information (the subset 533 * The low-level driver should provide this information (the subset
480 * supported by hardware) to the 802.11 code with each received 534 * supported by hardware) to the 802.11 code with each received
481 * frame. 535 * frame, in the skb's control buffer (cb).
482 * 536 *
483 * @mactime: value in microseconds of the 64-bit Time Synchronization Function 537 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
484 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. 538 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
@@ -529,7 +583,6 @@ enum ieee80211_conf_flags {
529/** 583/**
530 * enum ieee80211_conf_changed - denotes which configuration changed 584 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 585 *
532 * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 587 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
@@ -539,7 +592,6 @@ enum ieee80211_conf_flags {
539 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 592 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
540 */ 593 */
541enum ieee80211_conf_changed { 594enum ieee80211_conf_changed {
542 _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 596 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
545 IEEE80211_CONF_CHANGE_PS = BIT(4), 597 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -549,14 +601,6 @@ enum ieee80211_conf_changed {
549 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 601 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
550}; 602};
551 603
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
554{
555 return _IEEE80211_CONF_CHANGE_RADIO_ENABLED;
556}
557#define IEEE80211_CONF_CHANGE_RADIO_ENABLED \
558 __IEEE80211_CONF_CHANGE_RADIO_ENABLED()
559
560/** 604/**
561 * struct ieee80211_conf - configuration of the device 605 * struct ieee80211_conf - configuration of the device
562 * 606 *
@@ -564,9 +608,6 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
564 * 608 *
565 * @flags: configuration flags defined above 609 * @flags: configuration flags defined above
566 * 610 *
567 * @radio_enabled: when zero, driver is required to switch off the radio.
568 * @beacon_int: DEPRECATED, DO NOT USE
569 *
570 * @listen_interval: listen interval in units of beacon interval 611 * @listen_interval: listen interval in units of beacon interval
571 * @max_sleep_period: the maximum number of beacon intervals to sleep for 612 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this 613 * before checking the beacon for a TIM bit (managed mode only); this
@@ -590,13 +631,11 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
590 * number of transmissions not the number of retries 631 * number of transmissions not the number of retries
591 */ 632 */
592struct ieee80211_conf { 633struct ieee80211_conf {
593 int __deprecated beacon_int;
594 u32 flags; 634 u32 flags;
595 int power_level, dynamic_ps_timeout; 635 int power_level, dynamic_ps_timeout;
596 int max_sleep_period; 636 int max_sleep_period;
597 637
598 u16 listen_interval; 638 u16 listen_interval;
599 bool __deprecated radio_enabled;
600 639
601 u8 long_frame_max_tx_count, short_frame_max_tx_count; 640 u8 long_frame_max_tx_count, short_frame_max_tx_count;
602 641
@@ -901,12 +940,6 @@ enum ieee80211_hw_flags {
901 * 940 *
902 * @conf: &struct ieee80211_conf, device configuration, don't use. 941 * @conf: &struct ieee80211_conf, device configuration, don't use.
903 * 942 *
904 * @workqueue: single threaded workqueue available for driver use,
905 * allocated by mac80211 on registration and flushed when an
906 * interface is removed.
907 * NOTICE: All work performed on this workqueue must not
908 * acquire the RTNL lock.
909 *
910 * @priv: pointer to private area that was allocated for driver use 943 * @priv: pointer to private area that was allocated for driver use
911 * along with this structure. 944 * along with this structure.
912 * 945 *
@@ -942,7 +975,6 @@ enum ieee80211_hw_flags {
942struct ieee80211_hw { 975struct ieee80211_hw {
943 struct ieee80211_conf conf; 976 struct ieee80211_conf conf;
944 struct wiphy *wiphy; 977 struct wiphy *wiphy;
945 struct workqueue_struct *workqueue;
946 const char *rate_control_algorithm; 978 const char *rate_control_algorithm;
947 void *priv; 979 void *priv;
948 u32 flags; 980 u32 flags;
@@ -1172,10 +1204,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1172 * the driver's configure_filter() function which frames should be 1204 * the driver's configure_filter() function which frames should be
1173 * passed to mac80211 and which should be filtered out. 1205 * passed to mac80211 and which should be filtered out.
1174 * 1206 *
1175 * The configure_filter() callback is invoked with the parameters 1207 * Before configure_filter() is invoked, the prepare_multicast()
1176 * @mc_count and @mc_list for the combined multicast address list 1208 * callback is invoked with the parameters @mc_count and @mc_list
1177 * of all virtual interfaces, @changed_flags telling which flags 1209 * for the combined multicast address list of all virtual interfaces.
1178 * were changed and @total_flags with the new flag states. 1210 * It's use is optional, and it returns a u64 that is passed to
1211 * configure_filter(). Additionally, configure_filter() has the
1212 * arguments @changed_flags telling which flags were changed and
1213 * @total_flags with the new flag states.
1179 * 1214 *
1180 * If your device has no multicast address filters your driver will 1215 * If your device has no multicast address filters your driver will
1181 * need to check both the %FIF_ALLMULTI flag and the @mc_count 1216 * need to check both the %FIF_ALLMULTI flag and the @mc_count
@@ -1224,10 +1259,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1224 * mac80211 needs to do and the amount of CPU wakeups, so you should 1259 * mac80211 needs to do and the amount of CPU wakeups, so you should
1225 * honour this flag if possible. 1260 * honour this flag if possible.
1226 * 1261 *
1227 * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then 1262 * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS
1228 * only those addressed to this station 1263 * is not set then only those addressed to this station.
1229 * 1264 *
1230 * @FIF_OTHER_BSS: pass frames destined to other BSSes 1265 * @FIF_OTHER_BSS: pass frames destined to other BSSes
1266 *
1267 * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
1268 * those addressed to this station.
1231 */ 1269 */
1232enum ieee80211_filter_flags { 1270enum ieee80211_filter_flags {
1233 FIF_PROMISC_IN_BSS = 1<<0, 1271 FIF_PROMISC_IN_BSS = 1<<0,
@@ -1237,6 +1275,7 @@ enum ieee80211_filter_flags {
1237 FIF_BCN_PRBRESP_PROMISC = 1<<4, 1275 FIF_BCN_PRBRESP_PROMISC = 1<<4,
1238 FIF_CONTROL = 1<<5, 1276 FIF_CONTROL = 1<<5,
1239 FIF_OTHER_BSS = 1<<6, 1277 FIF_OTHER_BSS = 1<<6,
1278 FIF_PSPOLL = 1<<7,
1240}; 1279};
1241 1280
1242/** 1281/**
@@ -1244,6 +1283,12 @@ enum ieee80211_filter_flags {
1244 * 1283 *
1245 * These flags are used with the ampdu_action() callback in 1284 * These flags are used with the ampdu_action() callback in
1246 * &struct ieee80211_ops to indicate which action is needed. 1285 * &struct ieee80211_ops to indicate which action is needed.
1286 *
1287 * Note that drivers MUST be able to deal with a TX aggregation
1288 * session being stopped even before they OK'ed starting it by
1289 * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer
1290 * might receive the addBA frame and send a delBA right away!
1291 *
1247 * @IEEE80211_AMPDU_RX_START: start Rx aggregation 1292 * @IEEE80211_AMPDU_RX_START: start Rx aggregation
1248 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1293 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1249 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1294 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
@@ -1289,7 +1334,8 @@ enum ieee80211_ampdu_mlme_action {
1289 * is disabled. This should turn off the hardware (at least 1334 * is disabled. This should turn off the hardware (at least
1290 * it must turn off frame reception.) 1335 * it must turn off frame reception.)
1291 * May be called right after add_interface if that rejects 1336 * May be called right after add_interface if that rejects
1292 * an interface. 1337 * an interface. If you added any work onto the mac80211 workqueue
1338 * you should ensure to cancel it on this callback.
1293 * Must be implemented. 1339 * Must be implemented.
1294 * 1340 *
1295 * @add_interface: Called when a netdevice attached to the hardware is 1341 * @add_interface: Called when a netdevice attached to the hardware is
@@ -1323,9 +1369,13 @@ enum ieee80211_ampdu_mlme_action {
1323 * for association indication. The @changed parameter indicates which 1369 * for association indication. The @changed parameter indicates which
1324 * of the bss parameters has changed when a call is made. 1370 * of the bss parameters has changed when a call is made.
1325 * 1371 *
1372 * @prepare_multicast: Prepare for multicast filter configuration.
1373 * This callback is optional, and its return value is passed
1374 * to configure_filter(). This callback must be atomic.
1375 *
1326 * @configure_filter: Configure the device's RX filter. 1376 * @configure_filter: Configure the device's RX filter.
1327 * See the section "Frame filtering" for more information. 1377 * See the section "Frame filtering" for more information.
1328 * This callback must be implemented and atomic. 1378 * This callback must be implemented.
1329 * 1379 *
1330 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1380 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1331 * must be set or cleared for a given STA. Must be atomic. 1381 * must be set or cleared for a given STA. Must be atomic.
@@ -1411,6 +1461,8 @@ enum ieee80211_ampdu_mlme_action {
1411 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1461 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1412 * need to set wiphy->rfkill_poll to %true before registration, 1462 * need to set wiphy->rfkill_poll to %true before registration,
1413 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1463 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1464 *
1465 * @testmode_cmd: Implement a cfg80211 test mode command.
1414 */ 1466 */
1415struct ieee80211_ops { 1467struct ieee80211_ops {
1416 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1468 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1425,10 +1477,12 @@ struct ieee80211_ops {
1425 struct ieee80211_vif *vif, 1477 struct ieee80211_vif *vif,
1426 struct ieee80211_bss_conf *info, 1478 struct ieee80211_bss_conf *info,
1427 u32 changed); 1479 u32 changed);
1480 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1481 int mc_count, struct dev_addr_list *mc_list);
1428 void (*configure_filter)(struct ieee80211_hw *hw, 1482 void (*configure_filter)(struct ieee80211_hw *hw,
1429 unsigned int changed_flags, 1483 unsigned int changed_flags,
1430 unsigned int *total_flags, 1484 unsigned int *total_flags,
1431 int mc_count, struct dev_addr_list *mc_list); 1485 u64 multicast);
1432 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1486 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1433 bool set); 1487 bool set);
1434 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1488 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
@@ -1461,6 +1515,9 @@ struct ieee80211_ops {
1461 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1515 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1462 1516
1463 void (*rfkill_poll)(struct ieee80211_hw *hw); 1517 void (*rfkill_poll)(struct ieee80211_hw *hw);
1518#ifdef CONFIG_NL80211_TESTMODE
1519 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1520#endif
1464}; 1521};
1465 1522
1466/** 1523/**
@@ -1606,10 +1663,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
1606 */ 1663 */
1607void ieee80211_restart_hw(struct ieee80211_hw *hw); 1664void ieee80211_restart_hw(struct ieee80211_hw *hw);
1608 1665
1609/* trick to avoid symbol clashes with the ieee80211 subsystem */
1610void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1611 struct ieee80211_rx_status *status);
1612
1613/** 1666/**
1614 * ieee80211_rx - receive frame 1667 * ieee80211_rx - receive frame
1615 * 1668 *
@@ -1622,16 +1675,12 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1622 * to this function and ieee80211_rx_irqsafe() may not be mixed for a 1675 * to this function and ieee80211_rx_irqsafe() may not be mixed for a
1623 * single hardware. 1676 * single hardware.
1624 * 1677 *
1678 * Note that right now, this function must be called with softirqs disabled.
1679 *
1625 * @hw: the hardware this frame came in on 1680 * @hw: the hardware this frame came in on
1626 * @skb: the buffer to receive, owned by mac80211 after this call 1681 * @skb: the buffer to receive, owned by mac80211 after this call
1627 * @status: status of this frame; the status pointer need not be valid
1628 * after this function returns
1629 */ 1682 */
1630static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1683void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
1631 struct ieee80211_rx_status *status)
1632{
1633 __ieee80211_rx(hw, skb, status);
1634}
1635 1684
1636/** 1685/**
1637 * ieee80211_rx_irqsafe - receive frame 1686 * ieee80211_rx_irqsafe - receive frame
@@ -1644,13 +1693,8 @@ static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1644 * 1693 *
1645 * @hw: the hardware this frame came in on 1694 * @hw: the hardware this frame came in on
1646 * @skb: the buffer to receive, owned by mac80211 after this call 1695 * @skb: the buffer to receive, owned by mac80211 after this call
1647 * @status: status of this frame; the status pointer need not be valid
1648 * after this function returns and is not freed by mac80211,
1649 * it is recommended that it points to a stack area
1650 */ 1696 */
1651void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, 1697void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
1652 struct sk_buff *skb,
1653 struct ieee80211_rx_status *status);
1654 1698
1655/** 1699/**
1656 * ieee80211_tx_status - transmit status callback 1700 * ieee80211_tx_status - transmit status callback
@@ -1917,6 +1961,31 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1917 void *data); 1961 void *data);
1918 1962
1919/** 1963/**
1964 * ieee80211_queue_work - add work onto the mac80211 workqueue
1965 *
1966 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
1967 * This helper ensures drivers are not queueing work when they should not be.
1968 *
1969 * @hw: the hardware struct for the interface we are adding work for
1970 * @work: the work we want to add onto the mac80211 workqueue
1971 */
1972void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
1973
1974/**
1975 * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
1976 *
1977 * Drivers and mac80211 use this to queue delayed work onto the mac80211
1978 * workqueue.
1979 *
1980 * @hw: the hardware struct for the interface we are adding work for
1981 * @dwork: delayable work to queue onto the mac80211 workqueue
1982 * @delay: number of jiffies to wait before queueing
1983 */
1984void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
1985 struct delayed_work *dwork,
1986 unsigned long delay);
1987
1988/**
1920 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 1989 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1921 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1990 * @hw: pointer as obtained from ieee80211_alloc_hw().
1922 * @ra: receiver address of the BA session recipient 1991 * @ra: receiver address of the BA session recipient
@@ -2090,6 +2159,29 @@ static inline int rate_supported(struct ieee80211_sta *sta,
2090 return (sta == NULL || sta->supp_rates[band] & BIT(index)); 2159 return (sta == NULL || sta->supp_rates[band] & BIT(index));
2091} 2160}
2092 2161
2162/**
2163 * rate_control_send_low - helper for drivers for management/no-ack frames
2164 *
2165 * Rate control algorithms that agree to use the lowest rate to
2166 * send management frames and NO_ACK data with the respective hw
2167 * retries should use this in the beginning of their mac80211 get_rate
2168 * callback. If true is returned the rate control can simply return.
2169 * If false is returned we guarantee that sta and sta and priv_sta is
2170 * not null.
2171 *
2172 * Rate control algorithms wishing to do more intelligent selection of
2173 * rate for multicast/broadcast frames may choose to not use this.
2174 *
2175 * @sta: &struct ieee80211_sta pointer to the target destination. Note
2176 * that this may be null.
2177 * @priv_sta: private rate control structure. This may be null.
2178 * @txrc: rate control information we sholud populate for mac80211.
2179 */
2180bool rate_control_send_low(struct ieee80211_sta *sta,
2181 void *priv_sta,
2182 struct ieee80211_tx_rate_control *txrc);
2183
2184
2093static inline s8 2185static inline s8
2094rate_lowest_index(struct ieee80211_supported_band *sband, 2186rate_lowest_index(struct ieee80211_supported_band *sband,
2095 struct ieee80211_sta *sta) 2187 struct ieee80211_sta *sta)
@@ -2106,6 +2198,17 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
2106 return 0; 2198 return 0;
2107} 2199}
2108 2200
2201static inline
2202bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
2203 struct ieee80211_sta *sta)
2204{
2205 unsigned int i;
2206
2207 for (i = 0; i < sband->n_bitrates; i++)
2208 if (rate_supported(sta, sband->band, i))
2209 return true;
2210 return false;
2211}
2109 2212
2110int ieee80211_rate_control_register(struct rate_control_ops *ops); 2213int ieee80211_rate_control_register(struct rate_control_ops *ops);
2111void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2214void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 1459ed3e2697..f76f22d05721 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -55,7 +55,6 @@ enum {
55#include <net/neighbour.h> 55#include <net/neighbour.h>
56 56
57struct ctl_table; 57struct ctl_table;
58struct file;
59struct inet6_dev; 58struct inet6_dev;
60struct net_device; 59struct net_device;
61struct net_proto_family; 60struct net_proto_family;
@@ -139,7 +138,6 @@ extern int igmp6_event_report(struct sk_buff *skb);
139#ifdef CONFIG_SYSCTL 138#ifdef CONFIG_SYSCTL
140extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, 139extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
141 int write, 140 int write,
142 struct file * filp,
143 void __user *buffer, 141 void __user *buffer,
144 size_t *lenp, 142 size_t *lenp,
145 loff_t *ppos); 143 loff_t *ppos);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index d8d790e56d3d..3817fda82a80 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -24,6 +24,7 @@
24 24
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <linux/workqueue.h>
27#include <net/rtnetlink.h> 28#include <net/rtnetlink.h>
28 29
29/* 30/*
@@ -117,7 +118,7 @@ struct neighbour
117 int (*output)(struct sk_buff *skb); 118 int (*output)(struct sk_buff *skb);
118 struct sk_buff_head arp_queue; 119 struct sk_buff_head arp_queue;
119 struct timer_list timer; 120 struct timer_list timer;
120 struct neigh_ops *ops; 121 const struct neigh_ops *ops;
121 u8 primary_key[0]; 122 u8 primary_key[0];
122}; 123};
123 124
@@ -167,7 +168,7 @@ struct neigh_table
167 int gc_thresh2; 168 int gc_thresh2;
168 int gc_thresh3; 169 int gc_thresh3;
169 unsigned long last_flush; 170 unsigned long last_flush;
170 struct timer_list gc_timer; 171 struct delayed_work gc_work;
171 struct timer_list proxy_timer; 172 struct timer_list proxy_timer;
172 struct sk_buff_head proxy_queue; 173 struct sk_buff_head proxy_queue;
173 atomic_t entries; 174 atomic_t entries;
@@ -178,7 +179,6 @@ struct neigh_table
178 struct neighbour **hash_buckets; 179 struct neighbour **hash_buckets;
179 unsigned int hash_mask; 180 unsigned int hash_mask;
180 __u32 hash_rnd; 181 __u32 hash_rnd;
181 unsigned int hash_chain_gc;
182 struct pneigh_entry **phash_buckets; 182 struct pneigh_entry **phash_buckets;
183}; 183};
184 184
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ded434b032a4..a1202841aadd 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -26,6 +26,7 @@ struct net_device;
26struct sock; 26struct sock;
27struct ctl_table_header; 27struct ctl_table_header;
28struct net_generic; 28struct net_generic;
29struct sock;
29 30
30struct net { 31struct net {
31 atomic_t count; /* To decided when the network 32 atomic_t count; /* To decided when the network
@@ -57,6 +58,7 @@ struct net {
57 spinlock_t rules_mod_lock; 58 spinlock_t rules_mod_lock;
58 59
59 struct sock *rtnl; /* rtnetlink socket */ 60 struct sock *rtnl; /* rtnetlink socket */
61 struct sock *genl_sock;
60 62
61 struct netns_core core; 63 struct netns_core core;
62 struct netns_mib mib; 64 struct netns_mib mib;
@@ -78,6 +80,9 @@ struct net {
78#ifdef CONFIG_XFRM 80#ifdef CONFIG_XFRM
79 struct netns_xfrm xfrm; 81 struct netns_xfrm xfrm;
80#endif 82#endif
83#ifdef CONFIG_WIRELESS_EXT
84 struct sk_buff_head wext_nlevents;
85#endif
81 struct net_generic *gen; 86 struct net_generic *gen;
82}; 87};
83 88
@@ -106,6 +111,8 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
106 111
107extern struct list_head net_namespace_list; 112extern struct list_head net_namespace_list;
108 113
114extern struct net *get_net_ns_by_pid(pid_t pid);
115
109#ifdef CONFIG_NET_NS 116#ifdef CONFIG_NET_NS
110extern void __put_net(struct net *net); 117extern void __put_net(struct net *net);
111 118
@@ -208,6 +215,9 @@ static inline struct net *read_pnet(struct net * const *pnet)
208#define for_each_net(VAR) \ 215#define for_each_net(VAR) \
209 list_for_each_entry(VAR, &net_namespace_list, list) 216 list_for_each_entry(VAR, &net_namespace_list, list)
210 217
218#define for_each_net_rcu(VAR) \
219 list_for_each_entry_rcu(VAR, &net_namespace_list, list)
220
211#ifdef CONFIG_NET_NS 221#ifdef CONFIG_NET_NS
212#define __net_init 222#define __net_init
213#define __net_exit 223#define __net_exit
@@ -229,13 +239,15 @@ struct pernet_operations {
229 * needs per network namespace operations use device pernet operations, 239 * needs per network namespace operations use device pernet operations,
230 * otherwise use pernet subsys operations. 240 * otherwise use pernet subsys operations.
231 * 241 *
232 * This is critically important. Most of the network code cleanup 242 * Network interfaces need to be removed from a dying netns _before_
233 * runs with the assumption that dev_remove_pack has been called so no 243 * subsys notifiers can be called, as most of the network code cleanup
234 * new packets will arrive during and after the cleanup functions have 244 * (which is done from subsys notifiers) runs with the assumption that
235 * been called. dev_remove_pack is not per namespace so instead the 245 * dev_remove_pack has been called so no new packets will arrive during
236 * guarantee of no more packets arriving in a network namespace is 246 * and after the cleanup functions have been called. dev_remove_pack
237 * provided by ensuring that all network devices and all sockets have 247 * is not per namespace so instead the guarantee of no more packets
238 * left the network namespace before the cleanup methods are called. 248 * arriving in a network namespace is provided by ensuring that all
249 * network devices and all sockets have left the network namespace
250 * before the cleanup methods are called.
239 * 251 *
240 * For the longest time the ipv4 icmp code was registered as a pernet 252 * For the longest time the ipv4 icmp code was registered as a pernet
241 * device which caused kernel oops, and panics during network 253 * device which caused kernel oops, and panics during network
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index cbdd6284996d..5cf7270e3ffc 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -255,11 +255,9 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
255} 255}
256 256
257/* These are for NAT. Icky. */ 257/* These are for NAT. Icky. */
258/* Update TCP window tracking data when NAT mangles the packet */ 258extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct,
259extern void nf_conntrack_tcp_update(const struct sk_buff *skb, 259 enum ip_conntrack_dir dir,
260 unsigned int dataoff, 260 u32 seq);
261 struct nf_conn *ct, int dir,
262 s16 offset);
263 261
264/* Fake conntrack entry for untracked connections */ 262/* Fake conntrack entry for untracked connections */
265extern struct nf_conn nf_conntrack_untracked; 263extern struct nf_conn nf_conntrack_untracked;
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 58684066388c..33602ab66190 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -31,6 +31,6 @@ struct nlattr;
31extern int 31extern int
32(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct, 32(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct,
33 enum nf_nat_manip_type manip, 33 enum nf_nat_manip_type manip,
34 struct nlattr *attr); 34 const struct nlattr *attr);
35 35
36#endif /* _NF_NAT_CORE_H */ 36#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 237a961f40e1..4222220920a5 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -32,4 +32,8 @@ extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
32 * to port ct->master->saved_proto. */ 32 * to port ct->master->saved_proto. */
33extern void nf_nat_follow_master(struct nf_conn *ct, 33extern void nf_nat_follow_master(struct nf_conn *ct,
34 struct nf_conntrack_expect *this); 34 struct nf_conntrack_expect *this);
35
36extern s16 nf_nat_get_offset(const struct nf_conn *ct,
37 enum ip_conntrack_dir dir,
38 u32 seq);
35#endif 39#endif
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 007bdb07dabb..a63b2192ac1c 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -365,7 +365,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
365 * 365 *
366 * See nla_parse() 366 * See nla_parse()
367 */ 367 */
368static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, 368static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
369 struct nlattr *tb[], int maxtype, 369 struct nlattr *tb[], int maxtype,
370 const struct nla_policy *policy) 370 const struct nla_policy *policy)
371{ 371{
@@ -414,7 +414,7 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
414 * 414 *
415 * Returns 1 if a report back to the application is requested. 415 * Returns 1 if a report back to the application is requested.
416 */ 416 */
417static inline int nlmsg_report(struct nlmsghdr *nlh) 417static inline int nlmsg_report(const struct nlmsghdr *nlh)
418{ 418{
419 return !!(nlh->nlmsg_flags & NLM_F_ECHO); 419 return !!(nlh->nlmsg_flags & NLM_F_ECHO);
420} 420}
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index afab4e4cbac7..dfeb2d7c425b 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -6,6 +6,7 @@
6 6
7#ifndef __NETNS_IPV6_H__ 7#ifndef __NETNS_IPV6_H__
8#define __NETNS_IPV6_H__ 8#define __NETNS_IPV6_H__
9#include <net/dst_ops.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -42,7 +43,7 @@ struct netns_ipv6 {
42 struct timer_list ip6_fib_timer; 43 struct timer_list ip6_fib_timer;
43 struct hlist_head *fib_table_hash; 44 struct hlist_head *fib_table_hash;
44 struct fib6_table *fib6_main_tbl; 45 struct fib6_table *fib6_main_tbl;
45 struct dst_ops *ip6_dst_ops; 46 struct dst_ops ip6_dst_ops;
46 unsigned int ip6_rt_gc_expire; 47 unsigned int ip6_rt_gc_expire;
47 unsigned long ip6_rt_last_gc; 48 unsigned long ip6_rt_last_gc;
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 49#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 9554a644a8f8..591db7d657a3 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -8,8 +8,11 @@ struct ebt_table;
8 8
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
12 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
11 struct ebt_table *broute_table; 13 struct ebt_table *broute_table;
12 struct ebt_table *frame_filter; 14 struct ebt_table *frame_filter;
13 struct ebt_table *frame_nat; 15 struct ebt_table *frame_nat;
16#endif
14}; 17};
15#endif 18#endif
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
new file mode 100644
index 000000000000..99d2ba1c7e03
--- /dev/null
+++ b/include/net/nl802154.h
@@ -0,0 +1,126 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27/**
28 * ieee802154_nl_assoc_indic - Notify userland of an association request.
29 * @dev: The network device on which this association request was
30 * received.
31 * @addr: The address of the device requesting association.
32 * @cap: The capability information field from the device.
33 *
34 * This informs a userland coordinator of a device requesting to
35 * associate with the PAN controlled by the coordinator.
36 *
37 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
38 */
39int ieee802154_nl_assoc_indic(struct net_device *dev,
40 struct ieee802154_addr *addr, u8 cap);
41
42/**
43 * ieee802154_nl_assoc_confirm - Notify userland of association.
44 * @dev: The device which has completed association.
45 * @short_addr: The short address assigned to the device.
46 * @status: The status of the association.
47 *
48 * Inform userland of the result of an association request. If the
49 * association request included asking the coordinator to allocate
50 * a short address then it is returned in @short_addr.
51 *
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status);
56
57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
59 * @dev: The device on which disassociation was indicated.
60 * @addr: The device which is disassociating.
61 * @reason: The reason for the disassociation.
62 *
63 * Inform userland that a device has disassociated from the network.
64 *
65 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
66 */
67int ieee802154_nl_disassoc_indic(struct net_device *dev,
68 struct ieee802154_addr *addr, u8 reason);
69
70/**
71 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
72 * completion.
73 * @dev: The device on which disassociation was ordered.
74 * @status: The result of the disassociation.
75 *
76 * Inform userland of the result of requesting that a device
77 * disassociate, or the result of requesting that we disassociate from
78 * a PAN managed by another coordinator.
79 *
80 * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document.
81 */
82int ieee802154_nl_disassoc_confirm(struct net_device *dev,
83 u8 status);
84
85/**
86 * ieee802154_nl_scan_confirm - Notify userland of completion of scan.
87 * @dev: The device which was instructed to scan.
88 * @status: The status of the scan operation.
89 * @scan_type: What type of scan was performed.
90 * @unscanned: Any channels that the device was unable to scan.
91 * @edl: The energy levels (if a passive scan).
92 *
93 *
94 * Note: This is in section 7.1.11 of the IEEE 802.15.4 document.
95 * Note: This API does not permit the return of an active scan result.
96 */
97int ieee802154_nl_scan_confirm(struct net_device *dev,
98 u8 status, u8 scan_type, u32 unscanned, u8 page,
99 u8 *edl/*, struct list_head *pan_desc_list */);
100
101/**
102 * ieee802154_nl_beacon_indic - Notify userland of a received beacon.
103 * @dev: The device on which a beacon was received.
104 * @panid: The PAN of the coordinator.
105 * @coord_addr: The short address of the coordinator on that PAN.
106 *
107 * Note: This is in section 7.1.5 of the IEEE 802.15.4 document.
108 * Note: This API does not provide extended information such as what
109 * channel the PAN is on or what the LQI of the beacon frame was on
110 * receipt.
111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode.
113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
115 u16 coord_addr);
116
117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
119 * @dev: The device which was instructed to scan.
120 * @status: The status of the scan operation.
121 *
122 * Note: This is in section 7.1.14 of the IEEE 802.15.4 document.
123 */
124int ieee802154_nl_start_confirm(struct net_device *dev, u8 status);
125
126#endif
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index 29d126736611..44c923c9e21d 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -49,4 +49,6 @@ void phonet_address_notify(int event, struct net_device *dev, u8 addr);
49 49
50#define PN_NO_ADDR 0xff 50#define PN_NO_ADDR 0xff
51 51
52extern const struct file_operations pn_sock_seq_fops;
53
52#endif 54#endif
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 82a3191375f5..f911ec7598ef 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -87,6 +87,9 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
87extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 87extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
88extern void qdisc_put_stab(struct qdisc_size_table *tab); 88extern void qdisc_put_stab(struct qdisc_size_table *tab);
89extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc); 89extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
90extern int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
91 struct net_device *dev, struct netdev_queue *txq,
92 spinlock_t *root_lock);
90 93
91extern void __qdisc_run(struct Qdisc *q); 94extern void __qdisc_run(struct Qdisc *q);
92 95
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 1089d5aabd49..60249e51b669 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -94,21 +94,20 @@ struct inet_protosw {
94#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ 94#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
95#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ 95#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
96 96
97extern struct net_protocol *inet_protocol_base; 97extern const struct net_protocol *inet_protos[MAX_INET_PROTOS];
98extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
99 98
100#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 99#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
101extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; 100extern const struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
102#endif 101#endif
103 102
104extern int inet_add_protocol(struct net_protocol *prot, unsigned char num); 103extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
105extern int inet_del_protocol(struct net_protocol *prot, unsigned char num); 104extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
106extern void inet_register_protosw(struct inet_protosw *p); 105extern void inet_register_protosw(struct inet_protosw *p);
107extern void inet_unregister_protosw(struct inet_protosw *p); 106extern void inet_unregister_protosw(struct inet_protosw *p);
108 107
109#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 108#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
110extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); 109extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
111extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); 110extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
112extern int inet6_register_protosw(struct inet_protosw *p); 111extern int inet6_register_protosw(struct inet_protosw *p);
113extern void inet6_unregister_protosw(struct inet_protosw *p); 112extern void inet6_unregister_protosw(struct inet_protosw *p);
114#endif 113#endif
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 3c1895e54b7f..c3aa044d3fc3 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -14,7 +14,7 @@ extern void rtnl_register(int protocol, int msgtype,
14extern int rtnl_unregister(int protocol, int msgtype); 14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol); 15extern void rtnl_unregister_all(int protocol);
16 16
17static inline int rtnl_msg_family(struct nlmsghdr *nlh) 17static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
18{ 18{
19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) 19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; 20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
@@ -70,6 +70,9 @@ struct rtnl_link_ops {
70 size_t (*get_xstats_size)(const struct net_device *dev); 70 size_t (*get_xstats_size)(const struct net_device *dev);
71 int (*fill_xstats)(struct sk_buff *skb, 71 int (*fill_xstats)(struct sk_buff *skb,
72 const struct net_device *dev); 72 const struct net_device *dev);
73 int (*get_tx_queues)(struct net *net, struct nlattr *tb[],
74 unsigned int *tx_queues,
75 unsigned int *real_tx_queues);
73}; 76};
74 77
75extern int __rtnl_link_register(struct rtnl_link_ops *ops); 78extern int __rtnl_link_register(struct rtnl_link_ops *ops);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5482e9582f55..c33180dd42b4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -45,6 +45,8 @@ struct Qdisc
45#define TCQ_F_BUILTIN 1 45#define TCQ_F_BUILTIN 1
46#define TCQ_F_THROTTLED 2 46#define TCQ_F_THROTTLED 2
47#define TCQ_F_INGRESS 4 47#define TCQ_F_INGRESS 4
48#define TCQ_F_CAN_BYPASS 8
49#define TCQ_F_MQROOT 16
48#define TCQ_F_WARN_NONWC (1 << 16) 50#define TCQ_F_WARN_NONWC (1 << 16)
49 int padded; 51 int padded;
50 struct Qdisc_ops *ops; 52 struct Qdisc_ops *ops;
@@ -79,6 +81,7 @@ struct Qdisc
79struct Qdisc_class_ops 81struct Qdisc_class_ops
80{ 82{
81 /* Child qdisc manipulation */ 83 /* Child qdisc manipulation */
84 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
82 int (*graft)(struct Qdisc *, unsigned long cl, 85 int (*graft)(struct Qdisc *, unsigned long cl,
83 struct Qdisc *, struct Qdisc **); 86 struct Qdisc *, struct Qdisc **);
84 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); 87 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
@@ -121,6 +124,7 @@ struct Qdisc_ops
121 void (*reset)(struct Qdisc *); 124 void (*reset)(struct Qdisc *);
122 void (*destroy)(struct Qdisc *); 125 void (*destroy)(struct Qdisc *);
123 int (*change)(struct Qdisc *, struct nlattr *arg); 126 int (*change)(struct Qdisc *, struct nlattr *arg);
127 void (*attach)(struct Qdisc *);
124 128
125 int (*dump)(struct Qdisc *, struct sk_buff *); 129 int (*dump)(struct Qdisc *, struct sk_buff *);
126 int (*dump_stats)(struct Qdisc *, struct gnet_dump *); 130 int (*dump_stats)(struct Qdisc *, struct gnet_dump *);
@@ -182,6 +186,11 @@ struct qdisc_skb_cb {
182 char data[]; 186 char data[];
183}; 187};
184 188
189static inline int qdisc_qlen(struct Qdisc *q)
190{
191 return q->q.qlen;
192}
193
185static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb) 194static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb)
186{ 195{
187 return (struct qdisc_skb_cb *)skb->cb; 196 return (struct qdisc_skb_cb *)skb->cb;
@@ -249,6 +258,8 @@ static inline void sch_tree_unlock(struct Qdisc *q)
249 258
250extern struct Qdisc noop_qdisc; 259extern struct Qdisc noop_qdisc;
251extern struct Qdisc_ops noop_qdisc_ops; 260extern struct Qdisc_ops noop_qdisc_ops;
261extern struct Qdisc_ops pfifo_fast_ops;
262extern struct Qdisc_ops mq_qdisc_ops;
252 263
253struct Qdisc_class_common 264struct Qdisc_class_common
254{ 265{
@@ -296,6 +307,8 @@ extern void dev_init_scheduler(struct net_device *dev);
296extern void dev_shutdown(struct net_device *dev); 307extern void dev_shutdown(struct net_device *dev);
297extern void dev_activate(struct net_device *dev); 308extern void dev_activate(struct net_device *dev);
298extern void dev_deactivate(struct net_device *dev); 309extern void dev_deactivate(struct net_device *dev);
310extern struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
311 struct Qdisc *qdisc);
299extern void qdisc_reset(struct Qdisc *qdisc); 312extern void qdisc_reset(struct Qdisc *qdisc);
300extern void qdisc_destroy(struct Qdisc *qdisc); 313extern void qdisc_destroy(struct Qdisc *qdisc);
301extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); 314extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
@@ -387,13 +400,18 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
387 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; 400 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
388} 401}
389 402
403static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len)
404{
405 sch->bstats.bytes += len;
406 sch->bstats.packets++;
407}
408
390static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 409static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
391 struct sk_buff_head *list) 410 struct sk_buff_head *list)
392{ 411{
393 __skb_queue_tail(list, skb); 412 __skb_queue_tail(list, skb);
394 sch->qstats.backlog += qdisc_pkt_len(skb); 413 sch->qstats.backlog += qdisc_pkt_len(skb);
395 sch->bstats.bytes += qdisc_pkt_len(skb); 414 __qdisc_update_bstats(sch, qdisc_pkt_len(skb));
396 sch->bstats.packets++;
397 415
398 return NET_XMIT_SUCCESS; 416 return NET_XMIT_SUCCESS;
399} 417}
diff --git a/include/net/scm.h b/include/net/scm.h
index f45bb6eca7d4..cf48c800e926 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -26,7 +26,6 @@ struct scm_cookie
26#ifdef CONFIG_SECURITY_NETWORK 26#ifdef CONFIG_SECURITY_NETWORK
27 u32 secid; /* Passed security ID */ 27 u32 secid; /* Passed security ID */
28#endif 28#endif
29 unsigned long seq; /* Connection seqno */
30}; 29};
31 30
32extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); 31extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
@@ -59,7 +58,6 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
59 scm->creds.gid = current_gid(); 58 scm->creds.gid = current_gid();
60 scm->creds.pid = task_tgid_vnr(p); 59 scm->creds.pid = task_tgid_vnr(p);
61 scm->fp = NULL; 60 scm->fp = NULL;
62 scm->seq = 0;
63 unix_get_peersec_dgram(sock, scm); 61 unix_get_peersec_dgram(sock, scm);
64 if (msg->msg_controllen <= 0) 62 if (msg->msg_controllen <= 0)
65 return 0; 63 return 0;
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 3b966802e05d..8be5135ff7aa 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -106,6 +106,7 @@ typedef enum {
106 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ 106 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ 107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ 108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
109 SCTP_CMD_SEND_MSG, /* Send the whole use message */
109 SCTP_CMD_LAST 110 SCTP_CMD_LAST
110} sctp_verb_t; 111} sctp_verb_t;
111 112
@@ -139,6 +140,7 @@ typedef union {
139 struct sctp_ulpevent *ulpevent; 140 struct sctp_ulpevent *ulpevent;
140 struct sctp_packet *packet; 141 struct sctp_packet *packet;
141 sctp_sackhdr_t *sackh; 142 sctp_sackhdr_t *sackh;
143 struct sctp_datamsg *msg;
142} sctp_arg_t; 144} sctp_arg_t;
143 145
144/* We are simulating ML type constructors here. 146/* We are simulating ML type constructors here.
@@ -188,6 +190,7 @@ SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init)
188SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent) 190SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent)
189SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet) 191SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet)
190SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) 192SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh)
193SCTP_ARG_CONSTRUCTOR(DATAMSG, struct sctp_datamsg *, msg)
191 194
192typedef struct { 195typedef struct {
193 sctp_arg_t obj; 196 sctp_arg_t obj;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index b05b0557211f..58f714a3b670 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -231,7 +231,7 @@ typedef enum {
231 SCTP_SS_LISTENING = TCP_LISTEN, 231 SCTP_SS_LISTENING = TCP_LISTEN,
232 SCTP_SS_ESTABLISHING = TCP_SYN_SENT, 232 SCTP_SS_ESTABLISHING = TCP_SYN_SENT,
233 SCTP_SS_ESTABLISHED = TCP_ESTABLISHED, 233 SCTP_SS_ESTABLISHED = TCP_ESTABLISHED,
234 SCTP_SS_DISCONNECTING = TCP_CLOSING, 234 SCTP_SS_CLOSING = TCP_CLOSING,
235} sctp_sock_state_t; 235} sctp_sock_state_t;
236 236
237/* These functions map various type to printable names. */ 237/* These functions map various type to printable names. */
@@ -241,7 +241,9 @@ const char *sctp_tname(const sctp_subtype_t); /* timeouts */
241const char *sctp_pname(const sctp_subtype_t); /* primitives */ 241const char *sctp_pname(const sctp_subtype_t); /* primitives */
242 242
243/* This is a table of printable names of sctp_state_t's. */ 243/* This is a table of printable names of sctp_state_t's. */
244extern const char *sctp_state_tbl[], *sctp_evttype_tbl[], *sctp_status_tbl[]; 244extern const char *const sctp_state_tbl[];
245extern const char *const sctp_evttype_tbl[];
246extern const char *const sctp_status_tbl[];
245 247
246/* Maximum chunk length considering padding requirements. */ 248/* Maximum chunk length considering padding requirements. */
247enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) }; 249enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) };
@@ -361,6 +363,13 @@ typedef enum {
361 SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */ 363 SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */
362} sctp_scope_t; 364} sctp_scope_t;
363 365
366typedef enum {
367 SCTP_SCOPE_POLICY_DISABLE, /* Disable IPv4 address scoping */
368 SCTP_SCOPE_POLICY_ENABLE, /* Enable IPv4 address scoping */
369 SCTP_SCOPE_POLICY_PRIVATE, /* Follow draft but allow IPv4 private addresses */
370 SCTP_SCOPE_POLICY_LINK, /* Follow draft but allow IPv4 link local addresses */
371} sctp_scope_policy_t;
372
364/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>, 373/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>,
365 * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24, 374 * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24,
366 * 192.88.99.0/24. 375 * 192.88.99.0/24.
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d16a304cbed4..8a6d5297de16 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -486,15 +486,16 @@ static inline __s32 sctp_jitter(__u32 rto)
486} 486}
487 487
488/* Break down data chunks at this point. */ 488/* Break down data chunks at this point. */
489static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu) 489static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
490{ 490{
491 struct sctp_sock *sp = sctp_sk(asoc->base.sk);
491 int frag = pmtu; 492 int frag = pmtu;
492 493
493 frag -= sp->pf->af->net_header_len; 494 frag -= sp->pf->af->net_header_len;
494 frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk); 495 frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk);
495 496
496 if (sp->user_frag) 497 if (asoc->user_frag)
497 frag = min_t(int, frag, sp->user_frag); 498 frag = min_t(int, frag, asoc->user_frag);
498 499
499 frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN); 500 frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN);
500 501
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index edfcacf3250e..0a474568b003 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -219,6 +219,15 @@ extern struct sctp_globals {
219 /* Flag to idicate if SCTP-AUTH is enabled */ 219 /* Flag to idicate if SCTP-AUTH is enabled */
220 int auth_enable; 220 int auth_enable;
221 221
222 /*
223 * Policy to control SCTP IPv4 address scoping
224 * 0 - Disable IPv4 address scoping
225 * 1 - Enable IPv4 address scoping
226 * 2 - Selectively allow only IPv4 private addresses
227 * 3 - Selectively allow only IPv4 link local address
228 */
229 int ipv4_scope_policy;
230
222 /* Flag to indicate whether computing and verifying checksum 231 /* Flag to indicate whether computing and verifying checksum
223 * is disabled. */ 232 * is disabled. */
224 int checksum_disable; 233 int checksum_disable;
@@ -252,6 +261,7 @@ extern struct sctp_globals {
252#define sctp_port_hashtable (sctp_globals.port_hashtable) 261#define sctp_port_hashtable (sctp_globals.port_hashtable)
253#define sctp_local_addr_list (sctp_globals.local_addr_list) 262#define sctp_local_addr_list (sctp_globals.local_addr_list)
254#define sctp_local_addr_lock (sctp_globals.addr_list_lock) 263#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
264#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
255#define sctp_addip_enable (sctp_globals.addip_enable) 265#define sctp_addip_enable (sctp_globals.addip_enable)
256#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 266#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
257#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 267#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
@@ -534,7 +544,7 @@ struct sctp_af {
534 int level, 544 int level,
535 int optname, 545 int optname,
536 char __user *optval, 546 char __user *optval,
537 int optlen); 547 unsigned int optlen);
538 int (*getsockopt) (struct sock *sk, 548 int (*getsockopt) (struct sock *sk,
539 int level, 549 int level,
540 int optname, 550 int optname,
@@ -544,7 +554,7 @@ struct sctp_af {
544 int level, 554 int level,
545 int optname, 555 int optname,
546 char __user *optval, 556 char __user *optval,
547 int optlen); 557 unsigned int optlen);
548 int (*compat_getsockopt) (struct sock *sk, 558 int (*compat_getsockopt) (struct sock *sk,
549 int level, 559 int level,
550 int optname, 560 int optname,
@@ -628,7 +638,7 @@ struct sctp_datamsg {
628 /* Chunks waiting to be submitted to lower layer. */ 638 /* Chunks waiting to be submitted to lower layer. */
629 struct list_head chunks; 639 struct list_head chunks;
630 /* Chunks that have been transmitted. */ 640 /* Chunks that have been transmitted. */
631 struct list_head track; 641 size_t msg_size;
632 /* Reference counting. */ 642 /* Reference counting. */
633 atomic_t refcnt; 643 atomic_t refcnt;
634 /* When is this message no longer interesting to the peer? */ 644 /* When is this message no longer interesting to the peer? */
@@ -643,6 +653,7 @@ struct sctp_datamsg {
643struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 653struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
644 struct sctp_sndrcvinfo *, 654 struct sctp_sndrcvinfo *,
645 struct msghdr *, int len); 655 struct msghdr *, int len);
656void sctp_datamsg_free(struct sctp_datamsg *);
646void sctp_datamsg_put(struct sctp_datamsg *); 657void sctp_datamsg_put(struct sctp_datamsg *);
647void sctp_chunk_fail(struct sctp_chunk *, int error); 658void sctp_chunk_fail(struct sctp_chunk *, int error);
648int sctp_chunk_abandoned(struct sctp_chunk *); 659int sctp_chunk_abandoned(struct sctp_chunk *);
@@ -811,22 +822,12 @@ struct sctp_packet {
811 /* pointer to the auth chunk for this packet */ 822 /* pointer to the auth chunk for this packet */
812 struct sctp_chunk *auth; 823 struct sctp_chunk *auth;
813 824
814 /* This packet contains a COOKIE-ECHO chunk. */ 825 u8 has_cookie_echo:1, /* This packet contains a COOKIE-ECHO chunk. */
815 __u8 has_cookie_echo; 826 has_sack:1, /* This packet contains a SACK chunk. */
816 827 has_auth:1, /* This packet contains an AUTH chunk */
817 /* This packet contains a SACK chunk. */ 828 has_data:1, /* This packet contains at least 1 DATA chunk */
818 __u8 has_sack; 829 ipfragok:1, /* So let ip fragment this packet */
819 830 malloced:1; /* Is it malloced? */
820 /* This packet contains an AUTH chunk */
821 __u8 has_auth;
822
823 /* This packet contains at least 1 DATA chunk */
824 __u8 has_data;
825
826 /* SCTP cannot fragment this packet. So let ip fragment it. */
827 __u8 ipfragok;
828
829 __u8 malloced;
830}; 831};
831 832
832struct sctp_packet *sctp_packet_init(struct sctp_packet *, 833struct sctp_packet *sctp_packet_init(struct sctp_packet *,
@@ -892,7 +893,6 @@ struct sctp_transport {
892 */ 893 */
893 /* RTO : The current retransmission timeout value. */ 894 /* RTO : The current retransmission timeout value. */
894 unsigned long rto; 895 unsigned long rto;
895 unsigned long last_rto;
896 896
897 __u32 rtt; /* This is the most recent RTT. */ 897 __u32 rtt; /* This is the most recent RTT. */
898 898
@@ -1567,13 +1567,13 @@ struct sctp_association {
1567 __u32 sack_cnt; 1567 __u32 sack_cnt;
1568 1568
1569 /* These are capabilities which our peer advertised. */ 1569 /* These are capabilities which our peer advertised. */
1570 __u8 ecn_capable; /* Can peer do ECN? */ 1570 __u8 ecn_capable:1, /* Can peer do ECN? */
1571 __u8 ipv4_address; /* Peer understands IPv4 addresses? */ 1571 ipv4_address:1, /* Peer understands IPv4 addresses? */
1572 __u8 ipv6_address; /* Peer understands IPv6 addresses? */ 1572 ipv6_address:1, /* Peer understands IPv6 addresses? */
1573 __u8 hostname_address;/* Peer understands DNS addresses? */ 1573 hostname_address:1, /* Peer understands DNS addresses? */
1574 __u8 asconf_capable; /* Does peer support ADDIP? */ 1574 asconf_capable:1, /* Does peer support ADDIP? */
1575 __u8 prsctp_capable; /* Can peer do PR-SCTP? */ 1575 prsctp_capable:1, /* Can peer do PR-SCTP? */
1576 __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ 1576 auth_capable:1; /* Is peer doing SCTP-AUTH? */
1577 1577
1578 __u32 adaptation_ind; /* Adaptation Code point. */ 1578 __u32 adaptation_ind; /* Adaptation Code point. */
1579 1579
@@ -1738,6 +1738,12 @@ struct sctp_association {
1738 */ 1738 */
1739 __u32 rwnd_over; 1739 __u32 rwnd_over;
1740 1740
1741 /* Keeps treack of rwnd pressure. This happens when we have
1742 * a window, but not recevie buffer (i.e small packets). This one
1743 * is releases slowly (1 PMTU at a time ).
1744 */
1745 __u32 rwnd_press;
1746
1741 /* This is the sndbuf size in use for the association. 1747 /* This is the sndbuf size in use for the association.
1742 * This corresponds to the sndbuf size for the association, 1748 * This corresponds to the sndbuf size for the association,
1743 * as specified in the sk->sndbuf. 1749 * as specified in the sk->sndbuf.
@@ -1756,6 +1762,7 @@ struct sctp_association {
1756 1762
1757 /* The message size at which SCTP fragmentation will occur. */ 1763 /* The message size at which SCTP fragmentation will occur. */
1758 __u32 frag_point; 1764 __u32 frag_point;
1765 __u32 user_frag;
1759 1766
1760 /* Counter used to count INIT errors. */ 1767 /* Counter used to count INIT errors. */
1761 int init_err_counter; 1768 int init_err_counter;
@@ -1905,11 +1912,8 @@ struct sctp_association {
1905 1912
1906 __u16 active_key_id; 1913 __u16 active_key_id;
1907 1914
1908 /* Need to send an ECNE Chunk? */ 1915 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
1909 char need_ecne; 1916 temp:1; /* Is it a temporary association? */
1910
1911 /* Is it a temporary association? */
1912 char temp;
1913}; 1917};
1914 1918
1915 1919
@@ -1975,7 +1979,7 @@ void sctp_assoc_set_primary(struct sctp_association *,
1975void sctp_assoc_del_nonprimary_peers(struct sctp_association *, 1979void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
1976 struct sctp_transport *); 1980 struct sctp_transport *);
1977int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, 1981int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
1978 gfp_t); 1982 sctp_scope_t, gfp_t);
1979int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, 1983int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
1980 struct sctp_cookie*, 1984 struct sctp_cookie*,
1981 gfp_t gfp); 1985 gfp_t gfp);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 1580c04f68bc..be2334aaf52e 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -210,12 +210,6 @@ enum sctp_sinfo_flags {
210}; 210};
211 211
212 212
213typedef union {
214 __u8 raw;
215 struct sctp_initmsg init;
216 struct sctp_sndrcvinfo sndrcv;
217} sctp_cmsg_data_t;
218
219/* These are cmsg_types. */ 213/* These are cmsg_types. */
220typedef enum sctp_cmsg_type { 214typedef enum sctp_cmsg_type {
221 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ 215 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
diff --git a/include/net/sock.h b/include/net/sock.h
index 950409dcec3d..9f96394f694e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -226,12 +226,12 @@ struct sock {
226#define sk_prot __sk_common.skc_prot 226#define sk_prot __sk_common.skc_prot
227#define sk_net __sk_common.skc_net 227#define sk_net __sk_common.skc_net
228 kmemcheck_bitfield_begin(flags); 228 kmemcheck_bitfield_begin(flags);
229 unsigned char sk_shutdown : 2, 229 unsigned int sk_shutdown : 2,
230 sk_no_check : 2, 230 sk_no_check : 2,
231 sk_userlocks : 4; 231 sk_userlocks : 4,
232 sk_protocol : 8,
233 sk_type : 16;
232 kmemcheck_bitfield_end(flags); 234 kmemcheck_bitfield_end(flags);
233 unsigned char sk_protocol;
234 unsigned short sk_type;
235 int sk_rcvbuf; 235 int sk_rcvbuf;
236 socket_lock_t sk_lock; 236 socket_lock_t sk_lock;
237 /* 237 /*
@@ -624,7 +624,7 @@ struct proto {
624 void (*shutdown)(struct sock *sk, int how); 624 void (*shutdown)(struct sock *sk, int how);
625 int (*setsockopt)(struct sock *sk, int level, 625 int (*setsockopt)(struct sock *sk, int level,
626 int optname, char __user *optval, 626 int optname, char __user *optval,
627 int optlen); 627 unsigned int optlen);
628 int (*getsockopt)(struct sock *sk, int level, 628 int (*getsockopt)(struct sock *sk, int level,
629 int optname, char __user *optval, 629 int optname, char __user *optval,
630 int __user *option); 630 int __user *option);
@@ -632,7 +632,7 @@ struct proto {
632 int (*compat_setsockopt)(struct sock *sk, 632 int (*compat_setsockopt)(struct sock *sk,
633 int level, 633 int level,
634 int optname, char __user *optval, 634 int optname, char __user *optval,
635 int optlen); 635 unsigned int optlen);
636 int (*compat_getsockopt)(struct sock *sk, 636 int (*compat_getsockopt)(struct sock *sk,
637 int level, 637 int level,
638 int optname, char __user *optval, 638 int optname, char __user *optval,
@@ -951,7 +951,7 @@ extern void sock_rfree(struct sk_buff *skb);
951 951
952extern int sock_setsockopt(struct socket *sock, int level, 952extern int sock_setsockopt(struct socket *sock, int level,
953 int op, char __user *optval, 953 int op, char __user *optval,
954 int optlen); 954 unsigned int optlen);
955 955
956extern int sock_getsockopt(struct socket *sock, int level, 956extern int sock_getsockopt(struct socket *sock, int level,
957 int op, char __user *optval, 957 int op, char __user *optval,
@@ -993,7 +993,7 @@ extern int sock_no_shutdown(struct socket *, int);
993extern int sock_no_getsockopt(struct socket *, int , int, 993extern int sock_no_getsockopt(struct socket *, int , int,
994 char __user *, int __user *); 994 char __user *, int __user *);
995extern int sock_no_setsockopt(struct socket *, int, int, 995extern int sock_no_setsockopt(struct socket *, int, int,
996 char __user *, int); 996 char __user *, unsigned int);
997extern int sock_no_sendmsg(struct kiocb *, struct socket *, 997extern int sock_no_sendmsg(struct kiocb *, struct socket *,
998 struct msghdr *, size_t); 998 struct msghdr *, size_t);
999extern int sock_no_recvmsg(struct kiocb *, struct socket *, 999extern int sock_no_recvmsg(struct kiocb *, struct socket *,
@@ -1015,11 +1015,11 @@ extern int sock_common_getsockopt(struct socket *sock, int level, int optname,
1015extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1015extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1016 struct msghdr *msg, size_t size, int flags); 1016 struct msghdr *msg, size_t size, int flags);
1017extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1017extern int sock_common_setsockopt(struct socket *sock, int level, int optname,
1018 char __user *optval, int optlen); 1018 char __user *optval, unsigned int optlen);
1019extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1019extern int compat_sock_common_getsockopt(struct socket *sock, int level,
1020 int optname, char __user *optval, int __user *optlen); 1020 int optname, char __user *optval, int __user *optlen);
1021extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1021extern int compat_sock_common_setsockopt(struct socket *sock, int level,
1022 int optname, char __user *optval, int optlen); 1022 int optname, char __user *optval, unsigned int optlen);
1023 1023
1024extern void sk_common_release(struct sock *sk); 1024extern void sk_common_release(struct sock *sk);
1025 1025
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 88af84306471..03a49c703377 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -394,13 +394,13 @@ extern int tcp_getsockopt(struct sock *sk, int level,
394 int __user *optlen); 394 int __user *optlen);
395extern int tcp_setsockopt(struct sock *sk, int level, 395extern int tcp_setsockopt(struct sock *sk, int level,
396 int optname, char __user *optval, 396 int optname, char __user *optval,
397 int optlen); 397 unsigned int optlen);
398extern int compat_tcp_getsockopt(struct sock *sk, 398extern int compat_tcp_getsockopt(struct sock *sk,
399 int level, int optname, 399 int level, int optname,
400 char __user *optval, int __user *optlen); 400 char __user *optval, int __user *optlen);
401extern int compat_tcp_setsockopt(struct sock *sk, 401extern int compat_tcp_setsockopt(struct sock *sk,
402 int level, int optname, 402 int level, int optname,
403 char __user *optval, int optlen); 403 char __user *optval, unsigned int optlen);
404extern void tcp_set_keepalive(struct sock *sk, int val); 404extern void tcp_set_keepalive(struct sock *sk, int val);
405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
406 struct msghdr *msg, 406 struct msghdr *msg,
@@ -469,6 +469,7 @@ extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
469 int nonagle); 469 int nonagle);
470extern int tcp_may_send_now(struct sock *sk); 470extern int tcp_may_send_now(struct sock *sk);
471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
472extern void tcp_retransmit_timer(struct sock *sk);
472extern void tcp_xmit_retransmit_queue(struct sock *); 473extern void tcp_xmit_retransmit_queue(struct sock *);
473extern void tcp_simple_retransmit(struct sock *); 474extern void tcp_simple_retransmit(struct sock *);
474extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 475extern int tcp_trim_head(struct sock *, struct sk_buff *, u32);
@@ -521,6 +522,17 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
521extern int tcp_mss_to_mtu(struct sock *sk, int mss); 522extern int tcp_mss_to_mtu(struct sock *sk, int mss);
522extern void tcp_mtup_init(struct sock *sk); 523extern void tcp_mtup_init(struct sock *sk);
523 524
525static inline void tcp_bound_rto(const struct sock *sk)
526{
527 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX)
528 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
529}
530
531static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
532{
533 return (tp->srtt >> 3) + tp->rttvar;
534}
535
524static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 536static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
525{ 537{
526 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 538 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
@@ -781,6 +793,13 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
781 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 793 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
782} 794}
783 795
796#define TCP_INFINITE_SSTHRESH 0x7fffffff
797
798static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp)
799{
800 return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH;
801}
802
784/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 803/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
785 * The exception is rate halving phase, when cwnd is decreasing towards 804 * The exception is rate halving phase, when cwnd is decreasing towards
786 * ssthresh. 805 * ssthresh.
@@ -1007,6 +1026,11 @@ static inline int keepalive_time_when(const struct tcp_sock *tp)
1007 return tp->keepalive_time ? : sysctl_tcp_keepalive_time; 1026 return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
1008} 1027}
1009 1028
1029static inline int keepalive_probes(const struct tcp_sock *tp)
1030{
1031 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
1032}
1033
1010static inline int tcp_fin_time(const struct sock *sk) 1034static inline int tcp_fin_time(const struct sock *sk)
1011{ 1035{
1012 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1036 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
@@ -1169,7 +1193,7 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1169#define tcp_twsk_md5_key(twsk) NULL 1193#define tcp_twsk_md5_key(twsk) NULL
1170#endif 1194#endif
1171 1195
1172extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void); 1196extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *);
1173extern void tcp_free_md5sig_pool(void); 1197extern void tcp_free_md5sig_pool(void);
1174 1198
1175extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1199extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
@@ -1235,6 +1259,29 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1235#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1259#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1236 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1260 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1237 1261
1262/* This function calculates a "timeout" which is equivalent to the timeout of a
1263 * TCP connection after "boundary" unsucessful, exponentially backed-off
1264 * retransmissions with an initial RTO of TCP_RTO_MIN.
1265 */
1266static inline bool retransmits_timed_out(const struct sock *sk,
1267 unsigned int boundary)
1268{
1269 unsigned int timeout, linear_backoff_thresh;
1270
1271 if (!inet_csk(sk)->icsk_retransmits)
1272 return false;
1273
1274 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1275
1276 if (boundary <= linear_backoff_thresh)
1277 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
1278 else
1279 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
1280 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
1281
1282 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
1283}
1284
1238static inline struct sk_buff *tcp_send_head(struct sock *sk) 1285static inline struct sk_buff *tcp_send_head(struct sock *sk)
1239{ 1286{
1240 return sk->sk_send_head; 1287 return sk->sk_send_head;
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index bfb240c6cf79..d65381cad0fc 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -51,7 +51,7 @@ extern int datagram_send_ctl(struct net *net,
51/* 51/*
52 * address family specific functions 52 * address family specific functions
53 */ 53 */
54extern struct inet_connection_sock_af_ops ipv4_specific; 54extern const struct inet_connection_sock_af_ops ipv4_specific;
55 55
56extern void inet6_destroy_sock(struct sock *sk); 56extern void inet6_destroy_sock(struct sock *sk);
57 57
diff --git a/include/net/udp.h b/include/net/udp.h
index 90e6ce56be65..f98abd2ce709 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -144,7 +144,7 @@ extern unsigned int udp_poll(struct file *file, struct socket *sock,
144extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 144extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
145 char __user *optval, int __user *optlen); 145 char __user *optval, int __user *optlen);
146extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 146extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
147 char __user *optval, int optlen, 147 char __user *optval, unsigned int optlen,
148 int (*push_pending_frames)(struct sock *)); 148 int (*push_pending_frames)(struct sock *));
149 149
150extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 150extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
@@ -207,4 +207,7 @@ extern void udp4_proc_exit(void);
207#endif 207#endif
208 208
209extern void udp_init(void); 209extern void udp_init(void);
210
211extern int udp4_ufo_send_check(struct sk_buff *skb);
212extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features);
210#endif /* _UDP_H */ 213#endif /* _UDP_H */
diff --git a/include/net/wext.h b/include/net/wext.h
index 6d76a39a9c5b..3f2b94de2cfa 100644
--- a/include/net/wext.h
+++ b/include/net/wext.h
@@ -14,6 +14,7 @@ extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cm
14 void __user *arg); 14 void __user *arg);
15extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, 15extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
16 unsigned long arg); 16 unsigned long arg);
17extern struct iw_statistics *get_wireless_stats(struct net_device *dev);
17#else 18#else
18static inline int wext_proc_init(struct net *net) 19static inline int wext_proc_init(struct net *net)
19{ 20{
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
new file mode 100644
index 000000000000..547b1e271ac9
--- /dev/null
+++ b/include/net/wpan-phy.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2007, 2008, 2009 Siemens AG
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Written by:
18 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
19 */
20
21#ifndef WPAN_PHY_H
22#define WPAN_PHY_H
23
24#include <linux/netdevice.h>
25#include <linux/mutex.h>
26
27struct wpan_phy {
28 struct mutex pib_lock;
29
30 /*
31 * This is a PIB acording to 802.15.4-2006.
32 * We do not provide timing-related variables, as they
33 * aren't used outside of driver
34 */
35 u8 current_channel;
36 u8 current_page;
37 u32 channels_supported;
38 u8 transmit_power;
39 u8 cca_mode;
40
41 struct device dev;
42 int idx;
43
44 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
45};
46
47struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48int wpan_phy_register(struct device *parent, struct wpan_phy *phy);
49void wpan_phy_unregister(struct wpan_phy *phy);
50void wpan_phy_free(struct wpan_phy *phy);
51
52static inline void *wpan_phy_priv(struct wpan_phy *phy)
53{
54 BUG_ON(!phy);
55 return &phy->priv;
56}
57
58struct wpan_phy *wpan_phy_find(const char *str);
59static inline const char *wpan_phy_name(struct wpan_phy *phy)
60{
61 return dev_name(&phy->dev);
62}
63#endif
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9e3a3f4c1f60..223e90a44824 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1280,7 +1280,7 @@ struct xfrm6_tunnel {
1280}; 1280};
1281 1281
1282extern void xfrm_init(void); 1282extern void xfrm_init(void);
1283extern void xfrm4_init(void); 1283extern void xfrm4_init(int rt_hash_size);
1284extern int xfrm_state_init(struct net *net); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net); 1285extern void xfrm_state_fini(struct net *net);
1286extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);