aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/af_unix.h20
-rw-r--r--include/net/bluetooth/hci_core.h6
-rw-r--r--include/net/bluetooth/l2cap.h41
-rw-r--r--include/net/caif/caif_dev.h103
-rw-r--r--include/net/caif/caif_device.h55
-rw-r--r--include/net/caif/caif_layer.h283
-rw-r--r--include/net/caif/cfcnfg.h140
-rw-r--r--include/net/caif/cfctrl.h139
-rw-r--r--include/net/caif/cffrml.h16
-rw-r--r--include/net/caif/cfmuxl.h22
-rw-r--r--include/net/caif/cfpkt.h274
-rw-r--r--include/net/caif/cfserl.h12
-rw-r--r--include/net/caif/cfsrvl.h56
-rw-r--r--include/net/cfg80211.h47
-rw-r--r--include/net/dn_fib.h4
-rw-r--r--include/net/dst.h83
-rw-r--r--include/net/fib_rules.h3
-rw-r--r--include/net/flow.h23
-rw-r--r--include/net/icmp.h11
-rw-r--r--include/net/if_inet6.h25
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/inet_timewait_sock.h4
-rw-r--r--include/net/ip.h9
-rw-r--r--include/net/ip6_fib.h29
-rw-r--r--include/net/ip6_route.h4
-rw-r--r--include/net/ipv6.h10
-rw-r--r--include/net/iw_handler.h2
-rw-r--r--include/net/mac80211.h149
-rw-r--r--include/net/mld.h75
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/netns/generic.h9
-rw-r--r--include/net/netns/ipv4.h15
-rw-r--r--include/net/netns/ipv6.h14
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/raw.h13
-rw-r--r--include/net/route.h17
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sctp/sm.h2
-rw-r--r--include/net/sctp/structs.h66
-rw-r--r--include/net/snmp.h31
-rw-r--r--include/net/sock.h192
-rw-r--r--include/net/tcp.h13
-rw-r--r--include/net/tipc/tipc.h16
-rw-r--r--include/net/transp_v6.h3
-rw-r--r--include/net/x25.h10
-rw-r--r--include/net/x25device.h1
-rw-r--r--include/net/xfrm.h19
50 files changed, 1827 insertions, 268 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 1614d78c60ed..20725e213aee 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -30,7 +30,7 @@ struct unix_skb_parms {
30#endif 30#endif
31}; 31};
32 32
33#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 33#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
35#define UNIXSID(skb) (&UNIXCB((skb)).secid) 35#define UNIXSID(skb) (&UNIXCB((skb)).secid)
36 36
@@ -45,21 +45,23 @@ struct unix_skb_parms {
45struct unix_sock { 45struct unix_sock {
46 /* WARNING: sk has to be the first member */ 46 /* WARNING: sk has to be the first member */
47 struct sock sk; 47 struct sock sk;
48 struct unix_address *addr; 48 struct unix_address *addr;
49 struct dentry *dentry; 49 struct dentry *dentry;
50 struct vfsmount *mnt; 50 struct vfsmount *mnt;
51 struct mutex readlock; 51 struct mutex readlock;
52 struct sock *peer; 52 struct sock *peer;
53 struct sock *other; 53 struct sock *other;
54 struct list_head link; 54 struct list_head link;
55 atomic_long_t inflight; 55 atomic_long_t inflight;
56 spinlock_t lock; 56 spinlock_t lock;
57 unsigned int gc_candidate : 1; 57 unsigned int gc_candidate : 1;
58 unsigned int gc_maybe_cycle : 1; 58 unsigned int gc_maybe_cycle : 1;
59 wait_queue_head_t peer_wait; 59 struct socket_wq peer_wq;
60}; 60};
61#define unix_sk(__sk) ((struct unix_sock *)__sk) 61#define unix_sk(__sk) ((struct unix_sock *)__sk)
62 62
63#define peer_wait peer_wq.wait
64
63#ifdef CONFIG_SYSCTL 65#ifdef CONFIG_SYSCTL
64extern int unix_sysctl_register(struct net *net); 66extern int unix_sysctl_register(struct net *net);
65extern void unix_sysctl_unregister(struct net *net); 67extern void unix_sysctl_unregister(struct net *net);
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ce3c99e5fa25..e42f6ed5421c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -107,6 +107,8 @@ struct hci_dev {
107 unsigned long acl_last_tx; 107 unsigned long acl_last_tx;
108 unsigned long sco_last_tx; 108 unsigned long sco_last_tx;
109 109
110 struct workqueue_struct *workqueue;
111
110 struct tasklet_struct cmd_task; 112 struct tasklet_struct cmd_task;
111 struct tasklet_struct rx_task; 113 struct tasklet_struct rx_task;
112 struct tasklet_struct tx_task; 114 struct tasklet_struct tx_task;
@@ -636,8 +638,8 @@ int hci_register_notifier(struct notifier_block *nb);
636int hci_unregister_notifier(struct notifier_block *nb); 638int hci_unregister_notifier(struct notifier_block *nb);
637 639
638int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 640int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
639int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 641void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
640int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 642void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
641 643
642void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 644void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
643 645
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 17a689f27a6a..7c695bfd853c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -30,11 +30,12 @@
30#define L2CAP_DEFAULT_MIN_MTU 48 30#define L2CAP_DEFAULT_MIN_MTU 48
31#define L2CAP_DEFAULT_FLUSH_TO 0xffff 31#define L2CAP_DEFAULT_FLUSH_TO 0xffff
32#define L2CAP_DEFAULT_TX_WINDOW 63 32#define L2CAP_DEFAULT_TX_WINDOW 63
33#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
34#define L2CAP_DEFAULT_MAX_TX 3 33#define L2CAP_DEFAULT_MAX_TX 3
35#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ 34#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
36#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 35#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
37#define L2CAP_DEFAULT_MAX_PDU_SIZE 672 36#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
37#define L2CAP_DEFAULT_ACK_TO 200
38#define L2CAP_LOCAL_BUSY_TRIES 12
38 39
39#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 40#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
40#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 41#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -55,6 +56,8 @@ struct l2cap_options {
55 __u16 flush_to; 56 __u16 flush_to;
56 __u8 mode; 57 __u8 mode;
57 __u8 fcs; 58 __u8 fcs;
59 __u8 max_tx;
60 __u16 txwin_size;
58}; 61};
59 62
60#define L2CAP_CONNINFO 0x02 63#define L2CAP_CONNINFO 0x02
@@ -292,6 +295,7 @@ struct l2cap_conn {
292#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 295#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
293#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) 296#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
294#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) 297#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
298#define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue)
295#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) 299#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list)
296 300
297struct srej_list { 301struct srej_list {
@@ -320,7 +324,7 @@ struct l2cap_pinfo {
320 __u8 conf_req[64]; 324 __u8 conf_req[64];
321 __u8 conf_len; 325 __u8 conf_len;
322 __u8 conf_state; 326 __u8 conf_state;
323 __u8 conn_state; 327 __u16 conn_state;
324 328
325 __u8 next_tx_seq; 329 __u8 next_tx_seq;
326 __u8 expected_ack_seq; 330 __u8 expected_ack_seq;
@@ -328,27 +332,35 @@ struct l2cap_pinfo {
328 __u8 buffer_seq; 332 __u8 buffer_seq;
329 __u8 buffer_seq_srej; 333 __u8 buffer_seq_srej;
330 __u8 srej_save_reqseq; 334 __u8 srej_save_reqseq;
335 __u8 frames_sent;
331 __u8 unacked_frames; 336 __u8 unacked_frames;
332 __u8 retry_count; 337 __u8 retry_count;
333 __u8 num_to_ack; 338 __u8 num_acked;
334 __u16 sdu_len; 339 __u16 sdu_len;
335 __u16 partial_sdu_len; 340 __u16 partial_sdu_len;
336 struct sk_buff *sdu; 341 struct sk_buff *sdu;
337 342
338 __u8 ident; 343 __u8 ident;
339 344
345 __u8 tx_win;
346 __u8 max_tx;
340 __u8 remote_tx_win; 347 __u8 remote_tx_win;
341 __u8 remote_max_tx; 348 __u8 remote_max_tx;
342 __u16 retrans_timeout; 349 __u16 retrans_timeout;
343 __u16 monitor_timeout; 350 __u16 monitor_timeout;
344 __u16 max_pdu_size; 351 __u16 remote_mps;
352 __u16 mps;
345 353
346 __le16 sport; 354 __le16 sport;
347 355
356 spinlock_t send_lock;
348 struct timer_list retrans_timer; 357 struct timer_list retrans_timer;
349 struct timer_list monitor_timer; 358 struct timer_list monitor_timer;
359 struct timer_list ack_timer;
350 struct sk_buff_head tx_queue; 360 struct sk_buff_head tx_queue;
351 struct sk_buff_head srej_queue; 361 struct sk_buff_head srej_queue;
362 struct sk_buff_head busy_queue;
363 struct work_struct busy_work;
352 struct srej_list srej_l; 364 struct srej_list srej_l;
353 struct l2cap_conn *conn; 365 struct l2cap_conn *conn;
354 struct sock *next_c; 366 struct sock *next_c;
@@ -367,19 +379,24 @@ struct l2cap_pinfo {
367#define L2CAP_CONF_MAX_CONF_REQ 2 379#define L2CAP_CONF_MAX_CONF_REQ 2
368#define L2CAP_CONF_MAX_CONF_RSP 2 380#define L2CAP_CONF_MAX_CONF_RSP 2
369 381
370#define L2CAP_CONN_SAR_SDU 0x01 382#define L2CAP_CONN_SAR_SDU 0x0001
371#define L2CAP_CONN_SREJ_SENT 0x02 383#define L2CAP_CONN_SREJ_SENT 0x0002
372#define L2CAP_CONN_WAIT_F 0x04 384#define L2CAP_CONN_WAIT_F 0x0004
373#define L2CAP_CONN_SREJ_ACT 0x08 385#define L2CAP_CONN_SREJ_ACT 0x0008
374#define L2CAP_CONN_SEND_PBIT 0x10 386#define L2CAP_CONN_SEND_PBIT 0x0010
375#define L2CAP_CONN_REMOTE_BUSY 0x20 387#define L2CAP_CONN_REMOTE_BUSY 0x0020
376#define L2CAP_CONN_LOCAL_BUSY 0x40 388#define L2CAP_CONN_LOCAL_BUSY 0x0040
377#define L2CAP_CONN_REJ_ACT 0x80 389#define L2CAP_CONN_REJ_ACT 0x0080
390#define L2CAP_CONN_SEND_FBIT 0x0100
391#define L2CAP_CONN_RNR_SENT 0x0200
392#define L2CAP_CONN_SAR_RETRY 0x0400
378 393
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ 394#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); 395 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
381#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ 396#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
382 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); 397 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
398#define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \
399 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
383 400
384static inline int l2cap_tx_window_full(struct sock *sk) 401static inline int l2cap_tx_window_full(struct sock *sk)
385{ 402{
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
new file mode 100644
index 000000000000..318ab9478a44
--- /dev/null
+++ b/include/net/caif/caif_dev.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_DEV_H_
8#define CAIF_DEV_H_
9
10#include <net/caif/caif_layer.h>
11#include <net/caif/cfcnfg.h>
12#include <linux/caif/caif_socket.h>
13#include <linux/if.h>
14
15/**
16 * struct caif_param - CAIF parameters.
17 * @size: Length of data
18 * @data: Binary Data Blob
19 */
20struct caif_param {
21 u16 size;
22 u8 data[256];
23};
24
25/**
26 * struct caif_connect_request - Request data for CAIF channel setup.
27 * @protocol: Type of CAIF protocol to use (at, datagram etc)
28 * @sockaddr: Socket address to connect.
29 * @priority: Priority of the connection.
30 * @link_selector: Link selector (high bandwidth or low latency)
31 * @link_name: Name of the CAIF Link Layer to use.
32 * @param: Connect Request parameters (CAIF_SO_REQ_PARAM).
33 *
34 * This struct is used when connecting a CAIF channel.
35 * It contains all CAIF channel configuration options.
36 */
37struct caif_connect_request {
38 enum caif_protocol_type protocol;
39 struct sockaddr_caif sockaddr;
40 enum caif_channel_priority priority;
41 enum caif_link_selector link_selector;
42 char link_name[16];
43 struct caif_param param;
44};
45
46/**
47 * caif_connect_client - Connect a client to CAIF Core Stack.
48 * @config: Channel setup parameters, specifying what address
49 * to connect on the Modem.
50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions
52 * implemented.
53 *
54 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds
56 * receive functions and control callback functions. Control callback
57 * function will receive information about connect/disconnect responses,
58 * flow control etc (see enum caif_control).
59 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket.
61 */
62int caif_connect_client(struct caif_connect_request *config,
63 struct cflayer *client_layer);
64
65/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack.
67 *
68 * @client_layer: Client layer to be removed.
69 */
70int caif_disconnect_client(struct cflayer *client_layer);
71
72/**
73 * caif_release_client - Release adaptation layer reference to client.
74 *
75 * @client_layer: Client layer.
76 *
77 * Releases a client/adaptation layer use of the caif stack.
78 * This function must be used after caif_disconnect_client to
79 * decrease the reference count of the service layer.
80 */
81void caif_release_client(struct cflayer *client_layer);
82
83/**
84 * connect_req_to_link_param - Translate configuration parameters
85 * from socket format to internal format.
86 * @cnfg: Pointer to configuration handler
87 * @con_req: Configuration parameters supplied in function
88 * caif_connect_client
89 * @channel_setup_param: Parameters supplied to the CAIF Core stack for
90 * setting up channels.
91 *
92 */
93int connect_req_to_link_param(struct cfcnfg *cnfg,
94 struct caif_connect_request *con_req,
95 struct cfctrl_link_param *channel_setup_param);
96
97/**
98 * get_caif_conf() - Get the configuration handler.
99 */
100struct cfcnfg *get_caif_conf(void);
101
102
103#endif /* CAIF_DEV_H_ */
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h
new file mode 100644
index 000000000000..d02f044adb8a
--- /dev/null
+++ b/include/net/caif/caif_device.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_DEVICE_H_
8#define CAIF_DEVICE_H_
9#include <linux/kernel.h>
10#include <linux/net.h>
11#include <linux/netdevice.h>
12#include <linux/caif/caif_socket.h>
13#include <net/caif/caif_device.h>
14
15/**
16 * struct caif_dev_common - data shared between CAIF drivers and stack.
17 * @flowctrl: Flow Control callback function. This function is
18 * supplied by CAIF Core Stack and is used by CAIF
19 * Link Layer to send flow-stop to CAIF Core.
20 * The flow information will be distributed to all
21 * clients of CAIF.
22 *
23 * @link_select: Profile of device, either high-bandwidth or
24 * low-latency. This member is set by CAIF Link
25 * Layer Device in order to indicate if this device
26 * is a high bandwidth or low latency device.
27 *
28 * @use_frag: CAIF Frames may be fragmented.
29 * Is set by CAIF Link Layer in order to indicate if the
30 * interface receives fragmented frames that must be
31 * assembled by CAIF Core Layer.
32 *
33 * @use_fcs: Indicate if Frame CheckSum (fcs) is used.
34 * Is set if the physical interface is
35 * using Frame Checksum on the CAIF Frames.
36 *
37 * @use_stx: Indicate STart of frame eXtension (stx) in use.
38 * Is set if the CAIF Link Layer expects
39 * CAIF Frames to start with the STX byte.
40 *
41 * This structure is shared between the CAIF drivers and the CAIF stack.
42 * It is used by the device to register its behavior.
43 * CAIF Core layer must set the member flowctrl in order to supply
44 * CAIF Link Layer with the flow control function.
45 *
46 */
47 struct caif_dev_common {
48 void (*flowctrl)(struct net_device *net, int on);
49 enum caif_link_selector link_select;
50 int use_frag;
51 int use_fcs;
52 int use_stx;
53};
54
55#endif /* CAIF_DEVICE_H_ */
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
new file mode 100644
index 000000000000..25c472f0e5b8
--- /dev/null
+++ b/include/net/caif/caif_layer.h
@@ -0,0 +1,283 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_LAYER_H_
8#define CAIF_LAYER_H_
9
10#include <linux/list.h>
11
12struct cflayer;
13struct cfpkt;
14struct cfpktq;
15struct caif_payload_info;
16struct caif_packet_funcs;
17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22
23#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26
27/**
28 * caif_assert() - Assert function for CAIF.
29 * @assert: expression to evaluate.
30 *
31 * This function will print a error message and a do WARN_ON if the
32 * assertion failes. Normally this will do a stack up at the current location.
33 */
34#define caif_assert(assert) \
35do { \
36 if (!(assert)) { \
37 pr_err("caif:Assert detected:'%s'\n", #assert); \
38 WARN_ON(!(assert)); \
39 } \
40} while (0)
41
42
43/**
44 * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd().
45 *
46 * @CAIF_CTRLCMD_FLOW_OFF_IND: Flow Control is OFF, transmit function
47 * should stop sending data
48 *
49 * @CAIF_CTRLCMD_FLOW_ON_IND: Flow Control is ON, transmit function
50 * can start sending data
51 *
52 * @CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: Remote end modem has decided to close
53 * down channel
54 *
55 * @CAIF_CTRLCMD_INIT_RSP: Called initially when the layer below
56 * has finished initialization
57 *
58 * @CAIF_CTRLCMD_DEINIT_RSP: Called when de-initialization is
59 * complete
60 *
61 * @CAIF_CTRLCMD_INIT_FAIL_RSP: Called if initialization fails
62 *
63 * @_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: CAIF Link layer temporarily cannot
64 * send more packets.
65 * @_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND: Called if CAIF Link layer is able
66 * to send packets again.
67 * @_CAIF_CTRLCMD_PHYIF_DOWN_IND: Called if CAIF Link layer is going
68 * down.
69 *
70 * These commands are sent upwards in the CAIF stack to the CAIF Client.
71 * They are used for signaling originating from the modem or CAIF Link Layer.
72 * These are either responses (*_RSP) or events (*_IND).
73 */
74enum caif_ctrlcmd {
75 CAIF_CTRLCMD_FLOW_OFF_IND,
76 CAIF_CTRLCMD_FLOW_ON_IND,
77 CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND,
78 CAIF_CTRLCMD_INIT_RSP,
79 CAIF_CTRLCMD_DEINIT_RSP,
80 CAIF_CTRLCMD_INIT_FAIL_RSP,
81 _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND,
82 _CAIF_CTRLCMD_PHYIF_FLOW_ON_IND,
83 _CAIF_CTRLCMD_PHYIF_DOWN_IND,
84};
85
86/**
87 * enum caif_modemcmd - Modem Control Signaling, sent from CAIF Client
88 * to the CAIF Link Layer or modem.
89 *
90 * @CAIF_MODEMCMD_FLOW_ON_REQ: Flow Control is ON, transmit function
91 * can start sending data.
92 *
93 * @CAIF_MODEMCMD_FLOW_OFF_REQ: Flow Control is OFF, transmit function
94 * should stop sending data.
95 *
96 * @_CAIF_MODEMCMD_PHYIF_USEFULL: Notify physical layer that it is in use
97 *
98 * @_CAIF_MODEMCMD_PHYIF_USELESS: Notify physical layer that it is
99 * no longer in use.
100 *
101 * These are requests sent 'downwards' in the stack.
102 * Flow ON, OFF can be indicated to the modem.
103 */
104enum caif_modemcmd {
105 CAIF_MODEMCMD_FLOW_ON_REQ = 0,
106 CAIF_MODEMCMD_FLOW_OFF_REQ = 1,
107 _CAIF_MODEMCMD_PHYIF_USEFULL = 3,
108 _CAIF_MODEMCMD_PHYIF_USELESS = 4
109};
110
111/**
112 * enum caif_direction - CAIF Packet Direction.
113 * Indicate if a packet is to be sent out or to be received in.
114 * @CAIF_DIR_IN: Incoming packet received.
115 * @CAIF_DIR_OUT: Outgoing packet to be transmitted.
116 */
117enum caif_direction {
118 CAIF_DIR_IN = 0,
119 CAIF_DIR_OUT = 1
120};
121
122/**
123 * struct cflayer - CAIF Stack layer.
124 * Defines the framework for the CAIF Core Stack.
125 * @up: Pointer up to the layer above.
126 * @dn: Pointer down to the layer below.
127 * @node: List node used when layer participate in a list.
128 * @receive: Packet receive function.
129 * @transmit: Packet transmit funciton.
130 * @ctrlcmd: Used for control signalling upwards in the stack.
131 * @modemcmd: Used for control signaling downwards in the stack.
132 * @prio: Priority of this layer.
133 * @id: The identity of this layer
134 * @type: The type of this layer
135 * @name: Name of the layer.
136 *
137 * This structure defines the layered structure in CAIF.
138 *
139 * It defines CAIF layering structure, used by all CAIF Layers and the
140 * layers interfacing CAIF.
141 *
142 * In order to integrate with CAIF an adaptation layer on top of the CAIF stack
143 * and PHY layer below the CAIF stack
144 * must be implemented. These layer must follow the design principles below.
145 *
146 * Principles for layering of protocol layers:
147 * - All layers must use this structure. If embedding it, then place this
148 * structure first in the layer specific structure.
149 *
150 * - Each layer should not depend on any others layer private data.
151 *
152 * - In order to send data upwards do
153 * layer->up->receive(layer->up, packet);
154 *
155 * - In order to send data downwards do
156 * layer->dn->transmit(layer->dn, info, packet);
157 */
158struct cflayer {
159 struct cflayer *up;
160 struct cflayer *dn;
161 struct list_head node;
162
163 /*
164 * receive() - Receive Function.
165 * Contract: Each layer must implement a receive function passing the
166 * CAIF packets upwards in the stack.
167 * Packet handling rules:
168 * - The CAIF packet (cfpkt) cannot be accessed after
169 * passing it to the next layer using up->receive().
170 * - If parsing of the packet fails, the packet must be
171 * destroyed and -1 returned from the function.
172 * - If parsing succeeds (and above layers return OK) then
173 * the function must return a value > 0.
174 *
175 * Returns result < 0 indicates an error, 0 or positive value
176 * indicates success.
177 *
178 * @layr: Pointer to the current layer the receive function is
179 * implemented for (this pointer).
180 * @cfpkt: Pointer to CaifPacket to be handled.
181 */
182 int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt);
183
184 /*
185 * transmit() - Transmit Function.
186 * Contract: Each layer must implement a transmit function passing the
187 * CAIF packet downwards in the stack.
188 * Packet handling rules:
189 * - The CAIF packet (cfpkt) ownership is passed to the
190 * transmit function. This means that the the packet
191 * cannot be accessed after passing it to the below
192 * layer using dn->transmit().
193 *
194 * - If transmit fails, however, the ownership is returned
195 * to thecaller. The caller of "dn->transmit()" must
196 * destroy or resend packet.
197 *
198 * - Return value less than zero means error, zero or
199 * greater than zero means OK.
200 *
201 * result < 0 indicates an error, 0 or positive value
202 * indicate success.
203 *
204 * @layr: Pointer to the current layer the receive function
205 * isimplemented for (this pointer).
206 * @cfpkt: Pointer to CaifPacket to be handled.
207 */
208 int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt);
209
210 /*
211 * cttrlcmd() - Control Function upwards in CAIF Stack.
212 * Used for signaling responses (CAIF_CTRLCMD_*_RSP)
213 * and asynchronous events from the modem (CAIF_CTRLCMD_*_IND)
214 *
215 * @layr: Pointer to the current layer the receive function
216 * is implemented for (this pointer).
217 * @ctrl: Control Command.
218 */
219 void (*ctrlcmd) (struct cflayer *layr, enum caif_ctrlcmd ctrl,
220 int phyid);
221
222 /*
223 * modemctrl() - Control Function used for controlling the modem.
224 * Used to signal down-wards in the CAIF stack.
225 * Returns 0 on success, < 0 upon failure.
226 *
227 * @layr: Pointer to the current layer the receive function
228 * is implemented for (this pointer).
229 * @ctrl: Control Command.
230 */
231 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl);
232
233 unsigned short prio;
234 unsigned int id;
235 unsigned int type;
236 char name[CAIF_LAYER_NAME_SZ];
237};
238
239/**
240 * layer_set_up() - Set the up pointer for a specified layer.
241 * @layr: Layer where up pointer shall be set.
242 * @above: Layer above.
243 */
244#define layer_set_up(layr, above) ((layr)->up = (struct cflayer *)(above))
245
246/**
247 * layer_set_dn() - Set the down pointer for a specified layer.
248 * @layr: Layer where down pointer shall be set.
249 * @below: Layer below.
250 */
251#define layer_set_dn(layr, below) ((layr)->dn = (struct cflayer *)(below))
252
253/**
254 * struct dev_info - Physical Device info information about physical layer.
255 * @dev: Pointer to native physical device.
256 * @id: Physical ID of the physical connection used by the
257 * logical CAIF connection. Used by service layers to
258 * identify their physical id to Caif MUX (CFMUXL)so
259 * that the MUX can add the correct physical ID to the
260 * packet.
261 */
262struct dev_info {
263 void *dev;
264 unsigned int id;
265};
266
267/**
268 * struct caif_payload_info - Payload information embedded in packet (sk_buff).
269 *
270 * @dev_info: Information about the receiving device.
271 *
272 * @hdr_len: Header length, used to align pay load on 32bit boundary.
273 *
274 * @channel_id: Channel ID of the logical CAIF connection.
275 * Used by mux to insert channel id into the caif packet.
276 */
277struct caif_payload_info {
278 struct dev_info *dev_info;
279 unsigned short hdr_len;
280 unsigned short channel_id;
281};
282
283#endif /* CAIF_LAYER_H_ */
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
new file mode 100644
index 000000000000..9fc2fc20b884
--- /dev/null
+++ b/include/net/caif/cfcnfg.h
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCNFG_H_
8#define CFCNFG_H_
9#include <linux/spinlock.h>
10#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h>
12
13struct cfcnfg;
14
15/**
16 * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack
17 *
18 * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
19 * @CFPHYTYPE_CAIF: Generic CAIF physical interface
20 */
21enum cfcnfg_phy_type {
22 CFPHYTYPE_FRAG = 1,
23 CFPHYTYPE_CAIF,
24 CFPHYTYPE_MAX
25};
26
27/**
28 * enum cfcnfg_phy_preference - Physical preference HW Abstraction
29 *
30 * @CFPHYPREF_UNSPECIFIED: Default physical interface
31 *
32 * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
33 * traffic
34 * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
35 * traffic
36 * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
37 * responses.
38 *
39 */
40enum cfcnfg_phy_preference {
41 CFPHYPREF_UNSPECIFIED,
42 CFPHYPREF_LOW_LAT,
43 CFPHYPREF_HIGH_BW,
44 CFPHYPREF_LOOP
45};
46
47/**
48 * cfcnfg_create() - Create the CAIF configuration object.
49 */
50struct cfcnfg *cfcnfg_create(void);
51
52/**
53 * cfcnfg_remove() - Remove the CFCNFG object
54 * @cfg: config object
55 */
56void cfcnfg_remove(struct cfcnfg *cfg);
57
58/**
59 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
60 * @cnfg: Pointer to a CAIF configuration object, created by
61 * cfcnfg_create().
62 * @phy_type: Specifies the type of physical interface, e.g.
63 * CFPHYTYPE_FRAG.
64 * @dev: Pointer to link layer device
65 * @phy_layer: Specify the physical layer. The transmit function
66 * MUST be set in the structure.
67 * @phyid: The assigned physical ID for this layer, used in
68 * cfcnfg_add_adapt_layer to specify PHY for the link.
69 * @pref: The phy (link layer) preference.
70 * @fcs: Specify if checksum is used in CAIF Framing Layer.
71 * @stx: Specify if Start Of Frame eXtention is used.
72 */
73
74void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid,
77 enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx);
79
80/**
81 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
82 *
83 * @cnfg: Pointer to a CAIF configuration object, created by
84 * cfcnfg_create().
85 * @phy_layer: Adaptation layer to be removed.
86 */
87int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
88
89/**
90 * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer.
91 *
92 * @cnfg: Pointer to a CAIF configuration object, created by
93 * cfcnfg_create().
94 * @adap_layer: Adaptation layer to be removed.
95 */
96int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg,
97 struct cflayer *adap_layer);
98
99/**
100 * cfcnfg_release_adap_layer - Used by client to release the adaptation layer.
101 *
102 * @adap_layer: Adaptation layer.
103 */
104void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
105
106/**
107 * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
108 *
109 * The adaptation Layer is where the interface to application or higher-level
110 * driver functionality is implemented.
111 *
112 * @cnfg: Pointer to a CAIF configuration object, created by
113 * cfcnfg_create().
114 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure.
117 *
118 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer);
122
123/**
124 * cfcnfg_get_phyid() - Get physical ID, given type.
125 * Returns one of the physical interfaces matching the given type.
126 * Zero if no match is found.
127 * @cnfg: Configuration object
128 * @phy_pref: Caif Link Layer preference
129 */
130struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
131 enum cfcnfg_phy_preference phy_pref);
132
133/**
134 * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer
135 * @cnfg: Configuration object
136 * @name: Name of the Physical Layer (Caif Link Layer)
137 */
138int cfcnfg_get_named(struct cfcnfg *cnfg, char *name);
139
140#endif /* CFCNFG_H_ */
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
new file mode 100644
index 000000000000..997603f2bf4c
--- /dev/null
+++ b/include/net/caif/cfctrl.h
@@ -0,0 +1,139 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCTRL_H_
8#define CFCTRL_H_
9#include <net/caif/caif_layer.h>
10#include <net/caif/cfsrvl.h>
11
12/* CAIF Control packet commands */
13enum cfctrl_cmd {
14 CFCTRL_CMD_LINK_SETUP = 0,
15 CFCTRL_CMD_LINK_DESTROY = 1,
16 CFCTRL_CMD_LINK_ERR = 2,
17 CFCTRL_CMD_ENUM = 3,
18 CFCTRL_CMD_SLEEP = 4,
19 CFCTRL_CMD_WAKE = 5,
20 CFCTRL_CMD_LINK_RECONF = 6,
21 CFCTRL_CMD_START_REASON = 7,
22 CFCTRL_CMD_RADIO_SET = 8,
23 CFCTRL_CMD_MODEM_SET = 9,
24 CFCTRL_CMD_MASK = 0xf
25};
26
27/* Channel types */
28enum cfctrl_srv {
29 CFCTRL_SRV_DECM = 0,
30 CFCTRL_SRV_VEI = 1,
31 CFCTRL_SRV_VIDEO = 2,
32 CFCTRL_SRV_DBG = 3,
33 CFCTRL_SRV_DATAGRAM = 4,
34 CFCTRL_SRV_RFM = 5,
35 CFCTRL_SRV_UTIL = 6,
36 CFCTRL_SRV_MASK = 0xf
37};
38
39#define CFCTRL_RSP_BIT 0x20
40#define CFCTRL_ERR_BIT 0x10
41
42struct cfctrl_rsp {
43 void (*linksetup_rsp)(struct cflayer *layer, u8 linkid,
44 enum cfctrl_srv serv, u8 phyid,
45 struct cflayer *adapt_layer);
46 void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid);
47 void (*linkerror_ind)(void);
48 void (*enum_rsp)(void);
49 void (*sleep_rsp)(void);
50 void (*wake_rsp)(void);
51 void (*restart_rsp)(void);
52 void (*radioset_rsp)(void);
53 void (*reject_rsp)(struct cflayer *layer, u8 linkid,
54 struct cflayer *client_layer);;
55};
56
57/* Link Setup Parameters for CAIF-Links. */
58struct cfctrl_link_param {
59 enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */
60 u8 priority; /* (P4,P0) Priority of the channel */
61 u8 phyid; /* (U2-U0) Physical interface to connect */
62 u8 endpoint; /* (E1,E0) Endpoint for data channels */
63 u8 chtype; /* (H1,H0) Channel-Type, applies to
64 * VEI, DEBUG */
65 union {
66 struct {
67 u8 connid; /* (D7,D0) Video LinkId */
68 } video;
69
70 struct {
71 u32 connid; /* (N31,Ngit0) Connection ID used
72 * for Datagram */
73 } datagram;
74
75 struct {
76 u32 connid; /* Connection ID used for RFM */
77 char volume[20]; /* Volume to mount for RFM */
78 } rfm; /* Configuration for RFM */
79
80 struct {
81 u16 fifosize_kb; /* Psock FIFO size in KB */
82 u16 fifosize_bufs; /* Psock # signal buffers */
83 char name[16]; /* Name of the PSOCK service */
84 u8 params[255]; /* Link setup Parameters> */
85 u16 paramlen; /* Length of Link Setup
86 * Parameters */
87 } utility; /* Configuration for Utility Links (Psock) */
88 } u;
89};
90
91/* This structure is used internally in CFCTRL */
92struct cfctrl_request_info {
93 int sequence_no;
94 enum cfctrl_cmd cmd;
95 u8 channel_id;
96 struct cfctrl_link_param param;
97 struct cfctrl_request_info *next;
98 struct cflayer *client_layer;
99};
100
101struct cfctrl {
102 struct cfsrvl serv;
103 struct cfctrl_rsp res;
104 atomic_t req_seq_no;
105 atomic_t rsp_seq_no;
106 struct cfctrl_request_info *first_req;
107 /* Protects from simultaneous access to first_req list */
108 spinlock_t info_list_lock;
109#ifndef CAIF_NO_LOOP
110 u8 loop_linkid;
111 int loop_linkused[256];
112 /* Protects simultaneous access to loop_linkid and loop_linkused */
113 spinlock_t loop_linkid_lock;
114#endif
115
116};
117
118void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid);
119int cfctrl_linkup_request(struct cflayer *cfctrl,
120 struct cfctrl_link_param *param,
121 struct cflayer *user_layer);
122int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid,
123 struct cflayer *client);
124void cfctrl_sleep_req(struct cflayer *cfctrl);
125void cfctrl_wake_req(struct cflayer *cfctrl);
126void cfctrl_getstartreason_req(struct cflayer *cfctrl);
127struct cflayer *cfctrl_create(void);
128void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn);
129void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up);
130struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer);
131bool cfctrl_req_eq(struct cfctrl_request_info *r1,
132 struct cfctrl_request_info *r2);
133void cfctrl_insert_req(struct cfctrl *ctrl,
134 struct cfctrl_request_info *req);
135struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,
136 struct cfctrl_request_info *req);
137void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer);
138
139#endif /* CFCTRL_H_ */
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h
new file mode 100644
index 000000000000..3f14d2e1ce61
--- /dev/null
+++ b/include/net/caif/cffrml.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFFRML_H_
8#define CFFRML_H_
9#include <net/caif/caif_layer.h>
10
11struct cffrml;
12struct cflayer *cffrml_create(u16 phyid, bool DoFCS);
13void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up);
14void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn);
15
16#endif /* CFFRML_H_ */
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h
new file mode 100644
index 000000000000..4e1b4f33423e
--- /dev/null
+++ b/include/net/caif/cfmuxl.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFMUXL_H_
8#define CFMUXL_H_
9#include <net/caif/caif_layer.h>
10
11struct cfsrvl;
12struct cffrml;
13
14struct cflayer *cfmuxl_create(void);
15int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid);
16struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid);
17int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid);
18struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid);
19bool cfmuxl_is_phy_inuse(struct cflayer *layr, u8 phyid);
20u8 cfmuxl_get_phyid(struct cflayer *layr, u8 channel_id);
21
22#endif /* CFMUXL_H_ */
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
new file mode 100644
index 000000000000..fbc681beff52
--- /dev/null
+++ b/include/net/caif/cfpkt.h
@@ -0,0 +1,274 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFPKT_H_
8#define CFPKT_H_
9#include <net/caif/caif_layer.h>
10#include <linux/types.h>
11struct cfpkt;
12
13/* Create a CAIF packet.
14 * len: Length of packet to be created
15 * @return New packet.
16 */
17struct cfpkt *cfpkt_create(u16 len);
18
19/* Create a CAIF packet.
20 * data Data to copy.
21 * len Length of packet to be created
22 * @return New packet.
23 */
24struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len);
25/*
26 * Destroy a CAIF Packet.
27 * pkt Packet to be destoyed.
28 */
29void cfpkt_destroy(struct cfpkt *pkt);
30
31/*
32 * Extract header from packet.
33 *
34 * pkt Packet to extract header data from.
35 * data Pointer to copy the header data into.
36 * len Length of head data to copy.
37 * @return zero on success and error code upon failure
38 */
39int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len);
40
41/*
42 * Peek header from packet.
43 * Reads data from packet without changing packet.
44 *
45 * pkt Packet to extract header data from.
46 * data Pointer to copy the header data into.
47 * len Length of head data to copy.
48 * @return zero on success and error code upon failure
49 */
50int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len);
51
52/*
53 * Extract header from trailer (end of packet).
54 *
55 * pkt Packet to extract header data from.
56 * data Pointer to copy the trailer data into.
57 * len Length of header data to copy.
58 * @return zero on success and error code upon failure
59 */
60int cfpkt_extr_trail(struct cfpkt *pkt, void *data, u16 len);
61
62/*
63 * Add header to packet.
64 *
65 *
66 * pkt Packet to add header data to.
67 * data Pointer to data to copy into the header.
68 * len Length of header data to copy.
69 * @return zero on success and error code upon failure
70 */
71int cfpkt_add_head(struct cfpkt *pkt, const void *data, u16 len);
72
73/*
74 * Add trailer to packet.
75 *
76 *
77 * pkt Packet to add trailer data to.
78 * data Pointer to data to copy into the trailer.
79 * len Length of trailer data to copy.
80 * @return zero on success and error code upon failure
81 */
82int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len);
83
84/*
85 * Pad trailer on packet.
86 * Moves data pointer in packet, no content copied.
87 *
88 * pkt Packet in which to pad trailer.
89 * len Length of padding to add.
90 * @return zero on success and error code upon failure
91 */
92int cfpkt_pad_trail(struct cfpkt *pkt, u16 len);
93
94/*
95 * Add a single byte to packet body (tail).
96 *
97 * pkt Packet in which to add byte.
98 * data Byte to add.
99 * @return zero on success and error code upon failure
100 */
101int cfpkt_addbdy(struct cfpkt *pkt, const u8 data);
102
103/*
104 * Add a data to packet body (tail).
105 *
106 * pkt Packet in which to add data.
107 * data Pointer to data to copy into the packet body.
108 * len Length of data to add.
109 * @return zero on success and error code upon failure
110 */
111int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len);
112
113/*
114 * Checks whether there are more data to process in packet.
115 * pkt Packet to check.
116 * @return true if more data are available in packet false otherwise
117 */
118bool cfpkt_more(struct cfpkt *pkt);
119
120/*
121 * Checks whether the packet is erroneous,
122 * i.e. if it has been attempted to extract more data than available in packet
123 * or writing more data than has been allocated in cfpkt_create().
124 * pkt Packet to check.
125 * @return true on error false otherwise
126 */
127bool cfpkt_erroneous(struct cfpkt *pkt);
128
129/*
130 * Get the packet length.
131 * pkt Packet to get length from.
132 * @return Number of bytes in packet.
133 */
134u16 cfpkt_getlen(struct cfpkt *pkt);
135
136/*
137 * Set the packet length, by adjusting the trailer pointer according to length.
138 * pkt Packet to set length.
139 * len Packet length.
140 * @return Number of bytes in packet.
141 */
142int cfpkt_setlen(struct cfpkt *pkt, u16 len);
143
144/*
145 * cfpkt_append - Appends a packet's data to another packet.
146 * dstpkt: Packet to append data into, WILL BE FREED BY THIS FUNCTION
147 * addpkt: Packet to be appended and automatically released,
148 * WILL BE FREED BY THIS FUNCTION.
149 * expectlen: Packet's expected total length. This should be considered
150 * as a hint.
151 * NB: Input packets will be destroyed after appending and cannot be used
152 * after calling this function.
153 * @return The new appended packet.
154 */
155struct cfpkt *cfpkt_append(struct cfpkt *dstpkt, struct cfpkt *addpkt,
156 u16 expectlen);
157
158/*
159 * cfpkt_split - Split a packet into two packets at the specified split point.
160 * pkt: Packet to be split (will contain the first part of the data on exit)
161 * pos: Position to split packet in two parts.
162 * @return The new packet, containing the second part of the data.
163 */
164struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos);
165
166/*
167 * Iteration function, iterates the packet buffers from start to end.
168 *
169 * Checksum iteration function used to iterate buffers
170 * (we may have packets consisting of a chain of buffers)
171 * pkt: Packet to calculate checksum for
172 * iter_func: Function pointer to iteration function
173 * chks: Checksum calculated so far.
174 * buf: Pointer to the buffer to checksum
175 * len: Length of buf.
176 * data: Initial checksum value.
177 * @return Checksum of buffer.
178 */
179
180u16 cfpkt_iterate(struct cfpkt *pkt,
181 u16 (*iter_func)(u16 chks, void *buf, u16 len),
182 u16 data);
183
184/* Append by giving user access to packet buffer
185 * cfpkt Packet to append to
186 * buf Buffer inside pkt that user shall copy data into
187 * buflen Length of buffer and number of bytes added to packet
188 * @return 0 on error, 1 on success
189 */
190int cfpkt_raw_append(struct cfpkt *cfpkt, void **buf, unsigned int buflen);
191
192/* Extract by giving user access to packet buffer
193 * cfpkt Packet to extract from
194 * buf Buffer inside pkt that user shall copy data from
195 * buflen Length of buffer and number of bytes removed from packet
196 * @return 0 on error, 1 on success
197 */
198int cfpkt_raw_extract(struct cfpkt *cfpkt, void **buf, unsigned int buflen);
199
200/* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet.
201 * dir - Direction indicating whether this packet is to be sent or received.
202 * nativepkt - The native packet to be transformed to a CAIF packet
203 * @return The mapped CAIF Packet CFPKT.
204 */
205struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt);
206
207/* Map from a CAIF packet to a "native" packet (e.g. Linux Socket Buffer).
208 * pkt - The CAIF packet to be transformed into a "native" packet.
209 * @return The native packet transformed from a CAIF packet.
210 */
211void *cfpkt_tonative(struct cfpkt *pkt);
212
213/*
214 * Insert a packet in the packet queue.
215 * pktq Packet queue to insert into
216 * pkt Packet to be inserted in queue
217 * prio Priority of packet
218 */
219void cfpkt_queue(struct cfpktq *pktq, struct cfpkt *pkt,
220 unsigned short prio);
221
222/*
223 * Remove a packet from the packet queue.
224 * pktq Packet queue to fetch packets from.
225 * @return Dequeued packet.
226 */
227struct cfpkt *cfpkt_dequeue(struct cfpktq *pktq);
228
229/*
230 * Peek into a packet from the packet queue.
231 * pktq Packet queue to fetch packets from.
232 * @return Peeked packet.
233 */
234struct cfpkt *cfpkt_qpeek(struct cfpktq *pktq);
235
236/*
237 * Initiates the packet queue.
238 * @return Pointer to new packet queue.
239 */
240struct cfpktq *cfpktq_create(void);
241
242/*
243 * Get the number of packets in the queue.
244 * pktq Packet queue to fetch count from.
245 * @return Number of packets in queue.
246 */
247int cfpkt_qcount(struct cfpktq *pktq);
248
249/*
250 * Put content of packet into buffer for debuging purposes.
251 * pkt Packet to copy data from
252 * buf Buffer to copy data into
253 * buflen Length of data to copy
254 * @return Pointer to copied data
255 */
256char *cfpkt_log_pkt(struct cfpkt *pkt, char *buf, int buflen);
257
258/*
259 * Clones a packet and releases the original packet.
260 * This is used for taking ownership of a packet e.g queueing.
261 * pkt Packet to clone and release.
262 * @return Cloned packet.
263 */
264struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt);
265
266
267/*
268 * Returns packet information for a packet.
269 * pkt Packet to get info from;
270 * @return Packet information
271 */
272struct caif_payload_info *cfpkt_info(struct cfpkt *pkt);
273/*! @} */
274#endif /* CFPKT_H_ */
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
new file mode 100644
index 000000000000..b8374321b362
--- /dev/null
+++ b/include/net/caif/cfserl.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSERL_H_
8#define CFSERL_H_
9#include <net/caif/caif_layer.h>
10
11struct cflayer *cfserl_create(int type, int instance, bool use_stx);
12#endif /* CFSERL_H_ */
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
new file mode 100644
index 000000000000..2dc9eb193ecf
--- /dev/null
+++ b/include/net/caif/cfsrvl.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSRVL_H_
8#define CFSRVL_H_
9#include <linux/list.h>
10#include <linux/stddef.h>
11#include <linux/types.h>
12#include <linux/kref.h>
13
14struct cfsrvl {
15 struct cflayer layer;
16 bool open;
17 bool phy_flow_on;
18 bool modem_flow_on;
19 struct dev_info dev_info;
20 struct kref ref;
21};
22
23void cfsrvl_release(struct kref *kref);
24struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info);
29struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
30bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
31void cfservl_destroy(struct cflayer *layer);
32void cfsrvl_init(struct cfsrvl *service,
33 u8 channel_id,
34 struct dev_info *dev_info);
35bool cfsrvl_ready(struct cfsrvl *service, int *err);
36u8 cfsrvl_getphyid(struct cflayer *layer);
37
38static inline void cfsrvl_get(struct cflayer *layr)
39{
40 struct cfsrvl *s;
41 if (layr == NULL)
42 return;
43 s = container_of(layr, struct cfsrvl, layer);
44 kref_get(&s->ref);
45}
46
47static inline void cfsrvl_put(struct cflayer *layr)
48{
49 struct cfsrvl *s;
50 if (layr == NULL)
51 return;
52 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release);
54}
55
56#endif /* CFSRVL_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3d134a1fb96b..b44a2e5321a3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -511,6 +511,7 @@ struct mpath_info {
511 * @basic_rates: basic rates in IEEE 802.11 format 511 * @basic_rates: basic rates in IEEE 802.11 format
512 * (or NULL for no change) 512 * (or NULL for no change)
513 * @basic_rates_len: number of basic rates 513 * @basic_rates_len: number of basic rates
514 * @ap_isolate: do not forward packets between connected stations
514 */ 515 */
515struct bss_parameters { 516struct bss_parameters {
516 int use_cts_prot; 517 int use_cts_prot;
@@ -518,6 +519,7 @@ struct bss_parameters {
518 int use_short_slot_time; 519 int use_short_slot_time;
519 u8 *basic_rates; 520 u8 *basic_rates;
520 u8 basic_rates_len; 521 u8 basic_rates_len;
522 int ap_isolate;
521}; 523};
522 524
523struct mesh_config { 525struct mesh_config {
@@ -704,6 +706,10 @@ struct cfg80211_crypto_settings {
704 * @key_len: length of WEP key for shared key authentication 706 * @key_len: length of WEP key for shared key authentication
705 * @key_idx: index of WEP key for shared key authentication 707 * @key_idx: index of WEP key for shared key authentication
706 * @key: WEP key for shared key authentication 708 * @key: WEP key for shared key authentication
709 * @local_state_change: This is a request for a local state only, i.e., no
710 * Authentication frame is to be transmitted and authentication state is
711 * to be changed without having to wait for a response from the peer STA
712 * (AP).
707 */ 713 */
708struct cfg80211_auth_request { 714struct cfg80211_auth_request {
709 struct cfg80211_bss *bss; 715 struct cfg80211_bss *bss;
@@ -712,6 +718,7 @@ struct cfg80211_auth_request {
712 enum nl80211_auth_type auth_type; 718 enum nl80211_auth_type auth_type;
713 const u8 *key; 719 const u8 *key;
714 u8 key_len, key_idx; 720 u8 key_len, key_idx;
721 bool local_state_change;
715}; 722};
716 723
717/** 724/**
@@ -744,12 +751,15 @@ struct cfg80211_assoc_request {
744 * @ie: Extra IEs to add to Deauthentication frame or %NULL 751 * @ie: Extra IEs to add to Deauthentication frame or %NULL
745 * @ie_len: Length of ie buffer in octets 752 * @ie_len: Length of ie buffer in octets
746 * @reason_code: The reason code for the deauthentication 753 * @reason_code: The reason code for the deauthentication
754 * @local_state_change: This is a request for a local state only, i.e., no
755 * Deauthentication frame is to be transmitted.
747 */ 756 */
748struct cfg80211_deauth_request { 757struct cfg80211_deauth_request {
749 struct cfg80211_bss *bss; 758 struct cfg80211_bss *bss;
750 const u8 *ie; 759 const u8 *ie;
751 size_t ie_len; 760 size_t ie_len;
752 u16 reason_code; 761 u16 reason_code;
762 bool local_state_change;
753}; 763};
754 764
755/** 765/**
@@ -762,12 +772,15 @@ struct cfg80211_deauth_request {
762 * @ie: Extra IEs to add to Disassociation frame or %NULL 772 * @ie: Extra IEs to add to Disassociation frame or %NULL
763 * @ie_len: Length of ie buffer in octets 773 * @ie_len: Length of ie buffer in octets
764 * @reason_code: The reason code for the disassociation 774 * @reason_code: The reason code for the disassociation
775 * @local_state_change: This is a request for a local state only, i.e., no
776 * Disassociation frame is to be transmitted.
765 */ 777 */
766struct cfg80211_disassoc_request { 778struct cfg80211_disassoc_request {
767 struct cfg80211_bss *bss; 779 struct cfg80211_bss *bss;
768 const u8 *ie; 780 const u8 *ie;
769 size_t ie_len; 781 size_t ie_len;
770 u16 reason_code; 782 u16 reason_code;
783 bool local_state_change;
771}; 784};
772 785
773/** 786/**
@@ -953,7 +966,11 @@ struct cfg80211_pmksa {
953 * 966 *
954 * @set_txq_params: Set TX queue parameters 967 * @set_txq_params: Set TX queue parameters
955 * 968 *
956 * @set_channel: Set channel 969 * @set_channel: Set channel for a given wireless interface. Some devices
970 * may support multi-channel operation (by channel hopping) so cfg80211
971 * doesn't verify much. Note, however, that the passed netdev may be
972 * %NULL as well if the user requested changing the channel for the
973 * device itself, or for a monitor interface.
957 * 974 *
958 * @scan: Request to do a scan. If returning zero, the scan request is given 975 * @scan: Request to do a scan. If returning zero, the scan request is given
959 * the driver, and will be valid until passed to cfg80211_scan_done(). 976 * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1007,6 +1024,9 @@ struct cfg80211_pmksa {
1007 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 1024 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
1008 * @del_pmksa: Delete a cached PMKID. 1025 * @del_pmksa: Delete a cached PMKID.
1009 * @flush_pmksa: Flush all cached PMKIDs. 1026 * @flush_pmksa: Flush all cached PMKIDs.
1027 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
1028 * allows the driver to adjust the dynamic ps timeout value.
1029 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1010 * 1030 *
1011 */ 1031 */
1012struct cfg80211_ops { 1032struct cfg80211_ops {
@@ -1079,7 +1099,7 @@ struct cfg80211_ops {
1079 int (*set_txq_params)(struct wiphy *wiphy, 1099 int (*set_txq_params)(struct wiphy *wiphy,
1080 struct ieee80211_txq_params *params); 1100 struct ieee80211_txq_params *params);
1081 1101
1082 int (*set_channel)(struct wiphy *wiphy, 1102 int (*set_channel)(struct wiphy *wiphy, struct net_device *dev,
1083 struct ieee80211_channel *chan, 1103 struct ieee80211_channel *chan,
1084 enum nl80211_channel_type channel_type); 1104 enum nl80211_channel_type channel_type);
1085 1105
@@ -1152,6 +1172,10 @@ struct cfg80211_ops {
1152 1172
1153 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1173 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1154 bool enabled, int timeout); 1174 bool enabled, int timeout);
1175
1176 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
1177 struct net_device *dev,
1178 s32 rssi_thold, u32 rssi_hyst);
1155}; 1179};
1156 1180
1157/* 1181/*
@@ -1441,6 +1465,8 @@ struct cfg80211_cached_keys;
1441 * @list: (private) Used to collect the interfaces 1465 * @list: (private) Used to collect the interfaces
1442 * @netdev: (private) Used to reference back to the netdev 1466 * @netdev: (private) Used to reference back to the netdev
1443 * @current_bss: (private) Used by the internal configuration code 1467 * @current_bss: (private) Used by the internal configuration code
1468 * @channel: (private) Used by the internal configuration code to track
1469 * user-set AP, monitor and WDS channels for wireless extensions
1444 * @bssid: (private) Used by the internal configuration code 1470 * @bssid: (private) Used by the internal configuration code
1445 * @ssid: (private) Used by the internal configuration code 1471 * @ssid: (private) Used by the internal configuration code
1446 * @ssid_len: (private) Used by the internal configuration code 1472 * @ssid_len: (private) Used by the internal configuration code
@@ -1487,6 +1513,7 @@ struct wireless_dev {
1487 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 1513 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
1488 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1514 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1489 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1515 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1516 struct ieee80211_channel *channel;
1490 1517
1491 bool ps; 1518 bool ps;
1492 int ps_timeout; 1519 int ps_timeout;
@@ -1627,7 +1654,7 @@ struct ieee80211_radiotap_iterator {
1627 const struct ieee80211_radiotap_namespace *current_namespace; 1654 const struct ieee80211_radiotap_namespace *current_namespace;
1628 1655
1629 unsigned char *_arg, *_next_ns_data; 1656 unsigned char *_arg, *_next_ns_data;
1630 uint32_t *_next_bitmap; 1657 __le32 *_next_bitmap;
1631 1658
1632 unsigned char *this_arg; 1659 unsigned char *this_arg;
1633 int this_arg_index; 1660 int this_arg_index;
@@ -2337,4 +2364,18 @@ bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf,
2337void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, 2364void cfg80211_action_tx_status(struct net_device *dev, u64 cookie,
2338 const u8 *buf, size_t len, bool ack, gfp_t gfp); 2365 const u8 *buf, size_t len, bool ack, gfp_t gfp);
2339 2366
2367
2368/**
2369 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
2370 * @dev: network device
2371 * @rssi_event: the triggered RSSI event
2372 * @gfp: context flags
2373 *
2374 * This function is called when a configured connection quality monitoring
2375 * rssi threshold reached event occurs.
2376 */
2377void cfg80211_cqm_rssi_notify(struct net_device *dev,
2378 enum nl80211_cqm_rssi_threshold_event rssi_event,
2379 gfp_t gfp);
2380
2340#endif /* __NET_CFG80211_H */ 2381#endif /* __NET_CFG80211_H */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 52da6c3dd50d..bbcde3238e58 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -50,10 +50,6 @@ struct dn_fib_info {
50 __le16 fib_prefsrc; 50 __le16 fib_prefsrc;
51 __u32 fib_priority; 51 __u32 fib_priority;
52 __u32 fib_metrics[RTAX_MAX]; 52 __u32 fib_metrics[RTAX_MAX];
53#define dn_fib_mtu fib_metrics[RTAX_MTU-1]
54#define dn_fib_window fib_metrics[RTAX_WINDOW-1]
55#define dn_fib_rtt fib_metrics[RTAX_RTT-1]
56#define dn_fib_advmss fib_metrics[RTAX_ADVMSS-1]
57 int fib_nhs; 53 int fib_nhs;
58 int fib_power; 54 int fib_power;
59 struct dn_fib_nh fib_nh[0]; 55 struct dn_fib_nh fib_nh[0];
diff --git a/include/net/dst.h b/include/net/dst.h
index ce078cda6b74..612069beda73 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -168,6 +168,12 @@ static inline void dst_use(struct dst_entry *dst, unsigned long time)
168 dst->lastuse = time; 168 dst->lastuse = time;
169} 169}
170 170
171static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
172{
173 dst->__use++;
174 dst->lastuse = time;
175}
176
171static inline 177static inline
172struct dst_entry * dst_clone(struct dst_entry * dst) 178struct dst_entry * dst_clone(struct dst_entry * dst)
173{ 179{
@@ -177,11 +183,67 @@ struct dst_entry * dst_clone(struct dst_entry * dst)
177} 183}
178 184
179extern void dst_release(struct dst_entry *dst); 185extern void dst_release(struct dst_entry *dst);
186
187static inline void refdst_drop(unsigned long refdst)
188{
189 if (!(refdst & SKB_DST_NOREF))
190 dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
191}
192
193/**
194 * skb_dst_drop - drops skb dst
195 * @skb: buffer
196 *
197 * Drops dst reference count if a reference was taken.
198 */
180static inline void skb_dst_drop(struct sk_buff *skb) 199static inline void skb_dst_drop(struct sk_buff *skb)
181{ 200{
182 if (skb->_skb_dst) 201 if (skb->_skb_refdst) {
183 dst_release(skb_dst(skb)); 202 refdst_drop(skb->_skb_refdst);
184 skb->_skb_dst = 0UL; 203 skb->_skb_refdst = 0UL;
204 }
205}
206
207static inline void skb_dst_copy(struct sk_buff *nskb, const struct sk_buff *oskb)
208{
209 nskb->_skb_refdst = oskb->_skb_refdst;
210 if (!(nskb->_skb_refdst & SKB_DST_NOREF))
211 dst_clone(skb_dst(nskb));
212}
213
214/**
215 * skb_dst_force - makes sure skb dst is refcounted
216 * @skb: buffer
217 *
218 * If dst is not yet refcounted, let's do it
219 */
220static inline void skb_dst_force(struct sk_buff *skb)
221{
222 if (skb_dst_is_noref(skb)) {
223 WARN_ON(!rcu_read_lock_held());
224 skb->_skb_refdst &= ~SKB_DST_NOREF;
225 dst_clone(skb_dst(skb));
226 }
227}
228
229
230/**
231 * skb_tunnel_rx - prepare skb for rx reinsert
232 * @skb: buffer
233 * @dev: tunnel device
234 *
235 * After decapsulation, packet is going to re-enter (netif_rx()) our stack,
236 * so make some cleanups, and perform accounting.
237 */
238static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
239{
240 skb->dev = dev;
241 /* TODO : stats should be SMP safe */
242 dev->stats.rx_packets++;
243 dev->stats.rx_bytes += skb->len;
244 skb->rxhash = 0;
245 skb_dst_drop(skb);
246 nf_reset(skb);
185} 247}
186 248
187/* Children define the path of the packet through the 249/* Children define the path of the packet through the
@@ -225,21 +287,6 @@ static inline void dst_confirm(struct dst_entry *dst)
225 neigh_confirm(dst->neighbour); 287 neigh_confirm(dst->neighbour);
226} 288}
227 289
228static inline void dst_negative_advice(struct dst_entry **dst_p,
229 struct sock *sk)
230{
231 struct dst_entry * dst = *dst_p;
232 if (dst && dst->ops->negative_advice) {
233 *dst_p = dst->ops->negative_advice(dst);
234
235 if (dst != *dst_p) {
236 extern void sk_reset_txq(struct sock *sk);
237
238 sk_reset_txq(sk);
239 }
240 }
241}
242
243static inline void dst_link_failure(struct sk_buff *skb) 290static inline void dst_link_failure(struct sk_buff *skb)
244{ 291{
245 struct dst_entry *dst = skb_dst(skb); 292 struct dst_entry *dst = skb_dst(skb);
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c49086d2bc7d..e8923bc20f9f 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -104,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
104 return frh->table; 104 return frh->table;
105} 105}
106 106
107extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *); 107extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *);
108extern void fib_rules_unregister(struct fib_rules_ops *); 108extern void fib_rules_unregister(struct fib_rules_ops *);
109extern void fib_rules_cleanup_ops(struct fib_rules_ops *); 109extern void fib_rules_cleanup_ops(struct fib_rules_ops *);
110 110
@@ -114,4 +114,5 @@ extern int fib_rules_lookup(struct fib_rules_ops *,
114extern int fib_default_rule_add(struct fib_rules_ops *, 114extern int fib_default_rule_add(struct fib_rules_ops *,
115 u32 pref, u32 table, 115 u32 pref, u32 table,
116 u32 flags); 116 u32 flags);
117extern u32 fib_default_rule_pref(struct fib_rules_ops *ops);
117#endif 118#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 809970b7dfee..bb08692a20b0 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -86,11 +86,26 @@ struct flowi {
86 86
87struct net; 87struct net;
88struct sock; 88struct sock;
89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family, 89struct flow_cache_ops;
90 u8 dir, void **objp, atomic_t **obj_refp); 90
91struct flow_cache_object {
92 const struct flow_cache_ops *ops;
93};
94
95struct flow_cache_ops {
96 struct flow_cache_object *(*get)(struct flow_cache_object *);
97 int (*check)(struct flow_cache_object *);
98 void (*delete)(struct flow_cache_object *);
99};
100
101typedef struct flow_cache_object *(*flow_resolve_t)(
102 struct net *net, struct flowi *key, u16 family,
103 u8 dir, struct flow_cache_object *oldobj, void *ctx);
104
105extern struct flow_cache_object *flow_cache_lookup(
106 struct net *net, struct flowi *key, u16 family,
107 u8 dir, flow_resolve_t resolver, void *ctx);
91 108
92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
93 u8 dir, flow_resolve_t resolver);
94extern void flow_cache_flush(void); 109extern void flow_cache_flush(void);
95extern atomic_t flow_cache_genid; 110extern atomic_t flow_cache_genid;
96 111
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 15b3dfe9fce8..6e991e0d0d6f 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -48,15 +48,4 @@ extern void icmp_out_count(struct net *net, unsigned char type);
48/* Move into dst.h ? */ 48/* Move into dst.h ? */
49extern int xrlim_allow(struct dst_entry *dst, int timeout); 49extern int xrlim_allow(struct dst_entry *dst, int timeout);
50 50
51struct raw_sock {
52 /* inet_sock has to be the first member */
53 struct inet_sock inet;
54 struct icmp_filter filter;
55};
56
57static inline struct raw_sock *raw_sk(const struct sock *sk)
58{
59 return (struct raw_sock *)sk;
60}
61
62#endif /* _ICMP_H */ 51#endif /* _ICMP_H */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 545d8b059bef..f95ff8d9aa47 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -32,6 +32,13 @@
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34 34
35enum {
36 INET6_IFADDR_STATE_DAD,
37 INET6_IFADDR_STATE_POSTDAD,
38 INET6_IFADDR_STATE_UP,
39 INET6_IFADDR_STATE_DEAD,
40};
41
35struct inet6_ifaddr { 42struct inet6_ifaddr {
36 struct in6_addr addr; 43 struct in6_addr addr;
37 __u32 prefix_len; 44 __u32 prefix_len;
@@ -40,6 +47,9 @@ struct inet6_ifaddr {
40 __u32 prefered_lft; 47 __u32 prefered_lft;
41 atomic_t refcnt; 48 atomic_t refcnt;
42 spinlock_t lock; 49 spinlock_t lock;
50 spinlock_t state_lock;
51
52 int state;
43 53
44 __u8 probes; 54 __u8 probes;
45 __u8 flags; 55 __u8 flags;
@@ -54,16 +64,15 @@ struct inet6_ifaddr {
54 struct inet6_dev *idev; 64 struct inet6_dev *idev;
55 struct rt6_info *rt; 65 struct rt6_info *rt;
56 66
57 struct inet6_ifaddr *lst_next; /* next addr in addr_lst */ 67 struct hlist_node addr_lst;
58 struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ 68 struct list_head if_list;
59 69
60#ifdef CONFIG_IPV6_PRIVACY 70#ifdef CONFIG_IPV6_PRIVACY
61 struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */ 71 struct list_head tmp_list;
62 struct inet6_ifaddr *ifpub; 72 struct inet6_ifaddr *ifpub;
63 int regen_count; 73 int regen_count;
64#endif 74#endif
65 75 struct rcu_head rcu;
66 int dead;
67}; 76};
68 77
69struct ip6_sf_socklist { 78struct ip6_sf_socklist {
@@ -151,9 +160,9 @@ struct ipv6_devstat {
151}; 160};
152 161
153struct inet6_dev { 162struct inet6_dev {
154 struct net_device *dev; 163 struct net_device *dev;
155 164
156 struct inet6_ifaddr *addr_list; 165 struct list_head addr_list;
157 166
158 struct ifmcaddr6 *mc_list; 167 struct ifmcaddr6 *mc_list;
159 struct ifmcaddr6 *mc_tomb; 168 struct ifmcaddr6 *mc_tomb;
@@ -175,7 +184,7 @@ struct inet6_dev {
175#ifdef CONFIG_IPV6_PRIVACY 184#ifdef CONFIG_IPV6_PRIVACY
176 u8 rndid[8]; 185 u8 rndid[8];
177 struct timer_list regen_timer; 186 struct timer_list regen_timer;
178 struct inet6_ifaddr *tempaddr_list; 187 struct list_head tempaddr_list;
179#endif 188#endif
180 189
181 struct neigh_parms *nd_parms; 190 struct neigh_parms *nd_parms;
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index f13ddc2543b1..aae08f686633 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
38 38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40 40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); 41extern int inet6_csk_xmit(struct sk_buff *skb);
42#endif /* _INET6_CONNECTION_SOCK_H */ 42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 696d6e4ce68a..b6d3b55da19b 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -36,9 +36,8 @@ struct tcp_congestion_ops;
36 * (i.e. things that depend on the address family) 36 * (i.e. things that depend on the address family)
37 */ 37 */
38struct inet_connection_sock_af_ops { 38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok); 39 int (*queue_xmit)(struct sk_buff *skb);
40 void (*send_check)(struct sock *sk, int len, 40 void (*send_check)(struct sock *sk, struct sk_buff *skb);
41 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk); 41 int (*rebuild_header)(struct sock *sk);
43 int (*conn_request)(struct sock *sk, struct sk_buff *skb); 42 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, 43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 83fd34437cf1..1653de515cee 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -21,6 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/jhash.h> 23#include <linux/jhash.h>
24#include <linux/netdevice.h>
24 25
25#include <net/flow.h> 26#include <net/flow.h>
26#include <net/sock.h> 27#include <net/sock.h>
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 79f67eae8a7e..a066fdd50da6 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -224,7 +224,9 @@ static inline
224struct net *twsk_net(const struct inet_timewait_sock *twsk) 224struct net *twsk_net(const struct inet_timewait_sock *twsk)
225{ 225{
226#ifdef CONFIG_NET_NS 226#ifdef CONFIG_NET_NS
227 return rcu_dereference(twsk->tw_net); 227 return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
228 /* reference counting, */
229 /* initialization, or RCU. */
228#else 230#else
229 return &init_net; 231 return &init_net;
230#endif 232#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index 503994a38ed1..63548f0a44b1 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -101,7 +101,7 @@ extern int ip_do_nat(struct sk_buff *skb);
101extern void ip_send_check(struct iphdr *ip); 101extern void ip_send_check(struct iphdr *ip);
102extern int __ip_local_out(struct sk_buff *skb); 102extern int __ip_local_out(struct sk_buff *skb);
103extern int ip_local_out(struct sk_buff *skb); 103extern int ip_local_out(struct sk_buff *skb);
104extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 104extern int ip_queue_xmit(struct sk_buff *skb);
105extern void ip_init(void); 105extern void ip_init(void);
106extern int ip_append_data(struct sock *sk, 106extern int ip_append_data(struct sock *sk,
107 int getfrag(void *from, char *to, int offset, int len, 107 int getfrag(void *from, char *to, int offset, int len,
@@ -184,6 +184,12 @@ extern struct local_ports {
184} sysctl_local_ports; 184} sysctl_local_ports;
185extern void inet_get_local_port_range(int *low, int *high); 185extern void inet_get_local_port_range(int *low, int *high);
186 186
187extern unsigned long *sysctl_local_reserved_ports;
188static inline int inet_is_reserved_local_port(int port)
189{
190 return test_bit(port, sysctl_local_reserved_ports);
191}
192
187extern int sysctl_ip_default_ttl; 193extern int sysctl_ip_default_ttl;
188extern int sysctl_ip_nonlocal_bind; 194extern int sysctl_ip_nonlocal_bind;
189 195
@@ -393,6 +399,7 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
393 * Functions provided by ip_sockglue.c 399 * Functions provided by ip_sockglue.c
394 */ 400 */
395 401
402extern int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
396extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 403extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
397extern int ip_cmsg_send(struct net *net, 404extern int ip_cmsg_send(struct net *net,
398 struct msghdr *msg, struct ipcm_cookie *ipc); 405 struct msghdr *msg, struct ipcm_cookie *ipc);
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 86f46c49e318..4b1dc1161c37 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -88,34 +88,37 @@ struct rt6_info {
88 struct dst_entry dst; 88 struct dst_entry dst;
89 } u; 89 } u;
90 90
91 struct inet6_dev *rt6i_idev;
92
93#define rt6i_dev u.dst.dev 91#define rt6i_dev u.dst.dev
94#define rt6i_nexthop u.dst.neighbour 92#define rt6i_nexthop u.dst.neighbour
95#define rt6i_expires u.dst.expires 93#define rt6i_expires u.dst.expires
96 94
95 /*
96 * Tail elements of dst_entry (__refcnt etc.)
97 * and these elements (rarely used in hot path) are in
98 * the same cache line.
99 */
100 struct fib6_table *rt6i_table;
97 struct fib6_node *rt6i_node; 101 struct fib6_node *rt6i_node;
98 102
99 struct in6_addr rt6i_gateway; 103 struct in6_addr rt6i_gateway;
100
101 u32 rt6i_flags;
102 u32 rt6i_metric;
103 atomic_t rt6i_ref;
104 104
105 /* more non-fragment space at head required */ 105 atomic_t rt6i_ref;
106 unsigned short rt6i_nfheader_len;
107
108 u8 rt6i_protocol;
109 106
110 struct fib6_table *rt6i_table; 107 /* These are in a separate cache line. */
108 struct rt6key rt6i_dst ____cacheline_aligned_in_smp;
109 u32 rt6i_flags;
110 struct rt6key rt6i_src;
111 u32 rt6i_metric;
111 112
112 struct rt6key rt6i_dst; 113 struct inet6_dev *rt6i_idev;
113 114
114#ifdef CONFIG_XFRM 115#ifdef CONFIG_XFRM
115 u32 rt6i_flow_cache_genid; 116 u32 rt6i_flow_cache_genid;
116#endif 117#endif
118 /* more non-fragment space at head required */
119 unsigned short rt6i_nfheader_len;
117 120
118 struct rt6key rt6i_src; 121 u8 rt6i_protocol;
119}; 122};
120 123
121static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) 124static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 68f67836e146..278312c95f96 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -152,9 +152,9 @@ static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst,
152static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, 152static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
153 struct in6_addr *daddr, struct in6_addr *saddr) 153 struct in6_addr *daddr, struct in6_addr *saddr)
154{ 154{
155 write_lock(&sk->sk_dst_lock); 155 spin_lock(&sk->sk_dst_lock);
156 __ip6_dst_store(sk, dst, daddr, saddr); 156 __ip6_dst_store(sk, dst, daddr, saddr);
157 write_unlock(&sk->sk_dst_lock); 157 spin_unlock(&sk->sk_dst_lock);
158} 158}
159 159
160static inline int ipv6_unicast_destination(struct sk_buff *skb) 160static inline int ipv6_unicast_destination(struct sk_buff *skb)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e72fb10ce573..eba5cc00325a 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -422,7 +422,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a
422 for (i = 0; i < addrlen; i++) { 422 for (i = 0; i < addrlen; i++) {
423 __be32 xb = a1[i] ^ a2[i]; 423 __be32 xb = a1[i] ^ a2[i];
424 if (xb) 424 if (xb)
425 return i * 32 + 32 - fls(ntohl(xb)); 425 return i * 32 + 31 - __fls(ntohl(xb));
426 } 426 }
427 427
428 /* 428 /*
@@ -482,8 +482,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
482extern int ip6_xmit(struct sock *sk, 482extern int ip6_xmit(struct sock *sk,
483 struct sk_buff *skb, 483 struct sk_buff *skb,
484 struct flowi *fl, 484 struct flowi *fl,
485 struct ipv6_txoptions *opt, 485 struct ipv6_txoptions *opt);
486 int ipfragok);
487 486
488extern int ip6_nd_hdr(struct sock *sk, 487extern int ip6_nd_hdr(struct sock *sk,
489 struct sk_buff *skb, 488 struct sk_buff *skb,
@@ -504,7 +503,8 @@ extern int ip6_append_data(struct sock *sk,
504 struct ipv6_txoptions *opt, 503 struct ipv6_txoptions *opt,
505 struct flowi *fl, 504 struct flowi *fl,
506 struct rt6_info *rt, 505 struct rt6_info *rt,
507 unsigned int flags); 506 unsigned int flags,
507 int dontfrag);
508 508
509extern int ip6_push_pending_frames(struct sock *sk); 509extern int ip6_push_pending_frames(struct sock *sk);
510 510
@@ -578,9 +578,11 @@ extern int ip6_datagram_connect(struct sock *sk,
578 struct sockaddr *addr, int addr_len); 578 struct sockaddr *addr, int addr_len);
579 579
580extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 580extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
581extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
581extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 582extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
582 u32 info, u8 *payload); 583 u32 info, u8 *payload);
583extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 584extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
585extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu);
584 586
585extern int inet6_release(struct socket *sock); 587extern int inet6_release(struct socket *sock);
586extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, 588extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index b2b98f3fa265..3afdb21cc31d 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -323,7 +323,7 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
323struct iw_handler_def { 323struct iw_handler_def {
324 324
325 /* Array of handlers for standard ioctls 325 /* Array of handlers for standard ioctls
326 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] 326 * We will call dev->wireless_handlers->standard[ioctl - SIOCIWFIRST]
327 */ 327 */
328 const iw_handler * standard; 328 const iw_handler * standard;
329 /* Number of handlers defined (more precisely, index of the 329 /* Number of handlers defined (more precisely, index of the
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 45d7d44d7cbe..5be900d19660 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -144,6 +144,8 @@ struct ieee80211_low_level_stats {
144 * new beacon (beaconing modes) 144 * new beacon (beaconing modes)
145 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be 145 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
146 * enabled/disabled (beaconing modes) 146 * enabled/disabled (beaconing modes)
147 * @BSS_CHANGED_CQM: Connection quality monitor config changed
148 * @BSS_CHANGED_IBSS: IBSS join status changed
147 */ 149 */
148enum ieee80211_bss_change { 150enum ieee80211_bss_change {
149 BSS_CHANGED_ASSOC = 1<<0, 151 BSS_CHANGED_ASSOC = 1<<0,
@@ -156,6 +158,10 @@ enum ieee80211_bss_change {
156 BSS_CHANGED_BSSID = 1<<7, 158 BSS_CHANGED_BSSID = 1<<7,
157 BSS_CHANGED_BEACON = 1<<8, 159 BSS_CHANGED_BEACON = 1<<8,
158 BSS_CHANGED_BEACON_ENABLED = 1<<9, 160 BSS_CHANGED_BEACON_ENABLED = 1<<9,
161 BSS_CHANGED_CQM = 1<<10,
162 BSS_CHANGED_IBSS = 1<<11,
163
164 /* when adding here, make sure to change ieee80211_reconfig */
159}; 165};
160 166
161/** 167/**
@@ -165,6 +171,8 @@ enum ieee80211_bss_change {
165 * to that BSS) that can change during the lifetime of the BSS. 171 * to that BSS) that can change during the lifetime of the BSS.
166 * 172 *
167 * @assoc: association status 173 * @assoc: association status
174 * @ibss_joined: indicates whether this station is part of an IBSS
175 * or not
168 * @aid: association ID number, valid only when @assoc is true 176 * @aid: association ID number, valid only when @assoc is true
169 * @use_cts_prot: use CTS protection 177 * @use_cts_prot: use CTS protection
170 * @use_short_preamble: use 802.11b short preamble; 178 * @use_short_preamble: use 802.11b short preamble;
@@ -183,13 +191,19 @@ enum ieee80211_bss_change {
183 * the current band. 191 * the current band.
184 * @bssid: The BSSID for this BSS 192 * @bssid: The BSSID for this BSS
185 * @enable_beacon: whether beaconing should be enabled or not 193 * @enable_beacon: whether beaconing should be enabled or not
194 * @channel_type: Channel type for this BSS -- the hardware might be
195 * configured for HT40+ while this BSS only uses no-HT, for
196 * example.
186 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). 197 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
187 * This field is only valid when the channel type is one of the HT types. 198 * This field is only valid when the channel type is one of the HT types.
199 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
200 * implies disabled
201 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
188 */ 202 */
189struct ieee80211_bss_conf { 203struct ieee80211_bss_conf {
190 const u8 *bssid; 204 const u8 *bssid;
191 /* association related data */ 205 /* association related data */
192 bool assoc; 206 bool assoc, ibss_joined;
193 u16 aid; 207 u16 aid;
194 /* erp related data */ 208 /* erp related data */
195 bool use_cts_prot; 209 bool use_cts_prot;
@@ -202,6 +216,9 @@ struct ieee80211_bss_conf {
202 u64 timestamp; 216 u64 timestamp;
203 u32 basic_rates; 217 u32 basic_rates;
204 u16 ht_operation_mode; 218 u16 ht_operation_mode;
219 s32 cqm_rssi_thold;
220 u32 cqm_rssi_hyst;
221 enum nl80211_channel_type channel_type;
205}; 222};
206 223
207/** 224/**
@@ -267,6 +284,9 @@ struct ieee80211_bss_conf {
267 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 284 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
268 * MLME command (internal to mac80211 to figure out whether to send TX 285 * MLME command (internal to mac80211 to figure out whether to send TX
269 * status to user space) 286 * status to user space)
287 * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
288 * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
289 * frame and selects the maximum number of streams that it can use.
270 */ 290 */
271enum mac80211_tx_control_flags { 291enum mac80211_tx_control_flags {
272 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 292 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -290,6 +310,9 @@ enum mac80211_tx_control_flags {
290 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 310 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
291 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), 311 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20),
292 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 312 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
313 IEEE80211_TX_CTL_LDPC = BIT(22),
314 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
315#define IEEE80211_TX_CTL_STBC_SHIFT 23
293}; 316};
294 317
295/** 318/**
@@ -388,11 +411,11 @@ struct ieee80211_tx_rate {
388 * @status: union for status data 411 * @status: union for status data
389 * @driver_data: array of driver_data pointers 412 * @driver_data: array of driver_data pointers
390 * @ampdu_ack_len: number of acked aggregated frames. 413 * @ampdu_ack_len: number of acked aggregated frames.
391 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 414 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
392 * @ampdu_ack_map: block ack bit map for the aggregation. 415 * @ampdu_ack_map: block ack bit map for the aggregation.
393 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 416 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
394 * @ampdu_len: number of aggregated frames. 417 * @ampdu_len: number of aggregated frames.
395 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 418 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
396 * @ack_signal: signal strength of the ACK frame 419 * @ack_signal: signal strength of the ACK frame
397 */ 420 */
398struct ieee80211_tx_info { 421struct ieee80211_tx_info {
@@ -543,7 +566,6 @@ enum mac80211_rx_flags {
543 * @signal: signal strength when receiving this frame, either in dBm, in dB or 566 * @signal: signal strength when receiving this frame, either in dBm, in dB or
544 * unspecified depending on the hardware capabilities flags 567 * unspecified depending on the hardware capabilities flags
545 * @IEEE80211_HW_SIGNAL_* 568 * @IEEE80211_HW_SIGNAL_*
546 * @noise: noise when receiving this frame, in dBm.
547 * @antenna: antenna used 569 * @antenna: antenna used
548 * @rate_idx: index of data rate into band's supported rates or MCS index if 570 * @rate_idx: index of data rate into band's supported rates or MCS index if
549 * HT rates are use (RX_FLAG_HT) 571 * HT rates are use (RX_FLAG_HT)
@@ -554,7 +576,6 @@ struct ieee80211_rx_status {
554 enum ieee80211_band band; 576 enum ieee80211_band band;
555 int freq; 577 int freq;
556 int signal; 578 int signal;
557 int noise;
558 int antenna; 579 int antenna;
559 int rate_idx; 580 int rate_idx;
560 int flag; 581 int flag;
@@ -580,11 +601,15 @@ struct ieee80211_rx_status {
580 * may turn the device off as much as possible. Typically, this flag will 601 * may turn the device off as much as possible. Typically, this flag will
581 * be set when an interface is set UP but not associated or scanning, but 602 * be set when an interface is set UP but not associated or scanning, but
582 * it can also be unset in that case when monitor interfaces are active. 603 * it can also be unset in that case when monitor interfaces are active.
604 * @IEEE80211_CONF_QOS: Enable 802.11e QoS also know as WMM (Wireless
605 * Multimedia). On some drivers (iwlwifi is one of know) we have
606 * to enable/disable QoS explicitly.
583 */ 607 */
584enum ieee80211_conf_flags { 608enum ieee80211_conf_flags {
585 IEEE80211_CONF_MONITOR = (1<<0), 609 IEEE80211_CONF_MONITOR = (1<<0),
586 IEEE80211_CONF_PS = (1<<1), 610 IEEE80211_CONF_PS = (1<<1),
587 IEEE80211_CONF_IDLE = (1<<2), 611 IEEE80211_CONF_IDLE = (1<<2),
612 IEEE80211_CONF_QOS = (1<<3),
588}; 613};
589 614
590 615
@@ -599,6 +624,7 @@ enum ieee80211_conf_flags {
599 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 624 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
600 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 625 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
601 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed 626 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
627 * @IEEE80211_CONF_CHANGE_QOS: Quality of service was enabled or disabled
602 */ 628 */
603enum ieee80211_conf_changed { 629enum ieee80211_conf_changed {
604 IEEE80211_CONF_CHANGE_SMPS = BIT(1), 630 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
@@ -609,6 +635,7 @@ enum ieee80211_conf_changed {
609 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 635 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
610 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 636 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
611 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 637 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
638 IEEE80211_CONF_CHANGE_QOS = BIT(9),
612}; 639};
613 640
614/** 641/**
@@ -649,6 +676,9 @@ enum ieee80211_smps_mode {
649 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 676 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
650 * powersave documentation below. This variable is valid only when 677 * powersave documentation below. This variable is valid only when
651 * the CONF_PS flag is set. 678 * the CONF_PS flag is set.
679 * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
680 * by cfg80211 (essentially, wext) If set, this value overrules the value
681 * chosen by mac80211 based on ps qos network latency.
652 * 682 *
653 * @power_level: requested transmit power (in dBm) 683 * @power_level: requested transmit power (in dBm)
654 * 684 *
@@ -668,7 +698,7 @@ enum ieee80211_smps_mode {
668 */ 698 */
669struct ieee80211_conf { 699struct ieee80211_conf {
670 u32 flags; 700 u32 flags;
671 int power_level, dynamic_ps_timeout; 701 int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout;
672 int max_sleep_period; 702 int max_sleep_period;
673 703
674 u16 listen_interval; 704 u16 listen_interval;
@@ -682,6 +712,28 @@ struct ieee80211_conf {
682}; 712};
683 713
684/** 714/**
715 * struct ieee80211_channel_switch - holds the channel switch data
716 *
717 * The information provided in this structure is required for channel switch
718 * operation.
719 *
720 * @timestamp: value in microseconds of the 64-bit Time Synchronization
721 * Function (TSF) timer when the frame containing the channel switch
722 * announcement was received. This is simply the rx.mactime parameter
723 * the driver passed into mac80211.
724 * @block_tx: Indicates whether transmission must be blocked before the
725 * scheduled channel switch, as indicated by the AP.
726 * @channel: the new channel to switch to
727 * @count: the number of TBTT's until the channel switch event
728 */
729struct ieee80211_channel_switch {
730 u64 timestamp;
731 bool block_tx;
732 struct ieee80211_channel *channel;
733 u8 count;
734};
735
736/**
685 * struct ieee80211_vif - per-interface data 737 * struct ieee80211_vif - per-interface data
686 * 738 *
687 * Data in this structure is continually present for driver 739 * Data in this structure is continually present for driver
@@ -779,6 +831,7 @@ struct ieee80211_key_conf {
779 u8 iv_len; 831 u8 iv_len;
780 u8 hw_key_idx; 832 u8 hw_key_idx;
781 u8 flags; 833 u8 flags;
834 u8 *ap_addr;
782 s8 keyidx; 835 s8 keyidx;
783 u8 keylen; 836 u8 keylen;
784 u8 key[0]; 837 u8 key[0];
@@ -907,10 +960,6 @@ enum ieee80211_tkip_key_type {
907 * one milliwatt. This is the preferred method since it is standardized 960 * one milliwatt. This is the preferred method since it is standardized
908 * between different devices. @max_signal does not need to be set. 961 * between different devices. @max_signal does not need to be set.
909 * 962 *
910 * @IEEE80211_HW_NOISE_DBM:
911 * Hardware can provide noise (radio interference) values in units dBm,
912 * decibel difference from one milliwatt.
913 *
914 * @IEEE80211_HW_SPECTRUM_MGMT: 963 * @IEEE80211_HW_SPECTRUM_MGMT:
915 * Hardware supports spectrum management defined in 802.11h 964 * Hardware supports spectrum management defined in 802.11h
916 * Measurement, Channel Switch, Quieting, TPC 965 * Measurement, Channel Switch, Quieting, TPC
@@ -954,6 +1003,17 @@ enum ieee80211_tkip_key_type {
954 * Hardware can provide ack status reports of Tx frames to 1003 * Hardware can provide ack status reports of Tx frames to
955 * the stack. 1004 * the stack.
956 * 1005 *
1006 * @IEEE80211_HW_CONNECTION_MONITOR:
1007 * The hardware performs its own connection monitoring, including
1008 * periodic keep-alives to the AP and probing the AP on beacon loss.
1009 * When this flag is set, signaling beacon-loss will cause an immediate
1010 * change to disassociated state.
1011 *
1012 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1013 * Hardware can do connection quality monitoring - i.e. it can monitor
1014 * connection quality related parameters, such as the RSSI level and
1015 * provide notifications if configured trigger levels are reached.
1016 *
957 */ 1017 */
958enum ieee80211_hw_flags { 1018enum ieee80211_hw_flags {
959 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1019 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -963,7 +1023,7 @@ enum ieee80211_hw_flags {
963 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 1023 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
964 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 1024 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
965 IEEE80211_HW_SIGNAL_DBM = 1<<6, 1025 IEEE80211_HW_SIGNAL_DBM = 1<<6,
966 IEEE80211_HW_NOISE_DBM = 1<<7, 1026 /* use this hole */
967 IEEE80211_HW_SPECTRUM_MGMT = 1<<8, 1027 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
968 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, 1028 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
969 IEEE80211_HW_SUPPORTS_PS = 1<<10, 1029 IEEE80211_HW_SUPPORTS_PS = 1<<10,
@@ -975,6 +1035,8 @@ enum ieee80211_hw_flags {
975 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1035 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
976 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1036 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
977 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1037 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1038 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1039 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20,
978}; 1040};
979 1041
980/** 1042/**
@@ -1591,6 +1653,11 @@ enum ieee80211_ampdu_mlme_action {
1591 * @flush: Flush all pending frames from the hardware queue, making sure 1653 * @flush: Flush all pending frames from the hardware queue, making sure
1592 * that the hardware queues are empty. If the parameter @drop is set 1654 * that the hardware queues are empty. If the parameter @drop is set
1593 * to %true, pending frames may be dropped. The callback can sleep. 1655 * to %true, pending frames may be dropped. The callback can sleep.
1656 *
1657 * @channel_switch: Drivers that need (or want) to offload the channel
1658 * switch operation for CSAs received from the AP may implement this
1659 * callback. They must then call ieee80211_chswitch_done() to indicate
1660 * completion of the channel switch.
1594 */ 1661 */
1595struct ieee80211_ops { 1662struct ieee80211_ops {
1596 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1663 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1606,7 +1673,7 @@ struct ieee80211_ops {
1606 struct ieee80211_bss_conf *info, 1673 struct ieee80211_bss_conf *info,
1607 u32 changed); 1674 u32 changed);
1608 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 1675 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1609 int mc_count, struct dev_addr_list *mc_list); 1676 struct netdev_hw_addr_list *mc_list);
1610 void (*configure_filter)(struct ieee80211_hw *hw, 1677 void (*configure_filter)(struct ieee80211_hw *hw,
1611 unsigned int changed_flags, 1678 unsigned int changed_flags,
1612 unsigned int *total_flags, 1679 unsigned int *total_flags,
@@ -1621,7 +1688,7 @@ struct ieee80211_ops {
1621 struct ieee80211_key_conf *conf, 1688 struct ieee80211_key_conf *conf,
1622 struct ieee80211_sta *sta, 1689 struct ieee80211_sta *sta,
1623 u32 iv32, u16 *phase1key); 1690 u32 iv32, u16 *phase1key);
1624 int (*hw_scan)(struct ieee80211_hw *hw, 1691 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1625 struct cfg80211_scan_request *req); 1692 struct cfg80211_scan_request *req);
1626 void (*sw_scan_start)(struct ieee80211_hw *hw); 1693 void (*sw_scan_start)(struct ieee80211_hw *hw);
1627 void (*sw_scan_complete)(struct ieee80211_hw *hw); 1694 void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -1646,13 +1713,16 @@ struct ieee80211_ops {
1646 struct ieee80211_vif *vif, 1713 struct ieee80211_vif *vif,
1647 enum ieee80211_ampdu_mlme_action action, 1714 enum ieee80211_ampdu_mlme_action action,
1648 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1715 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1649 1716 int (*get_survey)(struct ieee80211_hw *hw, int idx,
1717 struct survey_info *survey);
1650 void (*rfkill_poll)(struct ieee80211_hw *hw); 1718 void (*rfkill_poll)(struct ieee80211_hw *hw);
1651 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); 1719 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
1652#ifdef CONFIG_NL80211_TESTMODE 1720#ifdef CONFIG_NL80211_TESTMODE
1653 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); 1721 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1654#endif 1722#endif
1655 void (*flush)(struct ieee80211_hw *hw, bool drop); 1723 void (*flush)(struct ieee80211_hw *hw, bool drop);
1724 void (*channel_switch)(struct ieee80211_hw *hw,
1725 struct ieee80211_channel_switch *ch_switch);
1656}; 1726};
1657 1727
1658/** 1728/**
@@ -1802,7 +1872,10 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
1802 * ieee80211_rx - receive frame 1872 * ieee80211_rx - receive frame
1803 * 1873 *
1804 * Use this function to hand received frames to mac80211. The receive 1874 * Use this function to hand received frames to mac80211. The receive
1805 * buffer in @skb must start with an IEEE 802.11 header. 1875 * buffer in @skb must start with an IEEE 802.11 header. In case of a
1876 * paged @skb is used, the driver is recommended to put the ieee80211
1877 * header of the frame on the linear part of the @skb to avoid memory
1878 * allocation and/or memcpy by the stack.
1806 * 1879 *
1807 * This function may not be called in IRQ context. Calls to this function 1880 * This function may not be called in IRQ context. Calls to this function
1808 * for a single hardware must be synchronized against each other. Calls to 1881 * for a single hardware must be synchronized against each other. Calls to
@@ -2364,12 +2437,52 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
2364 * 2437 *
2365 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2438 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2366 * 2439 *
2367 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and 2440 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and
2368 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the 2441 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2369 * hardware is not receiving beacons with this function. 2442 * hardware is not receiving beacons with this function.
2370 */ 2443 */
2371void ieee80211_beacon_loss(struct ieee80211_vif *vif); 2444void ieee80211_beacon_loss(struct ieee80211_vif *vif);
2372 2445
2446/**
2447 * ieee80211_connection_loss - inform hardware has lost connection to the AP
2448 *
2449 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2450 *
2451 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and
2452 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
2453 * needs to inform if the connection to the AP has been lost.
2454 *
2455 * This function will cause immediate change to disassociated state,
2456 * without connection recovery attempts.
2457 */
2458void ieee80211_connection_loss(struct ieee80211_vif *vif);
2459
2460/**
2461 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
2462 * rssi threshold triggered
2463 *
2464 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2465 * @rssi_event: the RSSI trigger event type
2466 * @gfp: context flags
2467 *
2468 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality
2469 * monitoring is configured with an rssi threshold, the driver will inform
2470 * whenever the rssi level reaches the threshold.
2471 */
2472void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
2473 enum nl80211_cqm_rssi_threshold_event rssi_event,
2474 gfp_t gfp);
2475
2476/**
2477 * ieee80211_chswitch_done - Complete channel switch process
2478 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2479 * @success: make the channel switch successful or not
2480 *
2481 * Complete the channel switch post-process: set the new operational channel
2482 * and wake up the suspended queues.
2483 */
2484void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
2485
2373/* Rate control API */ 2486/* Rate control API */
2374 2487
2375/** 2488/**
diff --git a/include/net/mld.h b/include/net/mld.h
new file mode 100644
index 000000000000..467143cd4e2f
--- /dev/null
+++ b/include/net/mld.h
@@ -0,0 +1,75 @@
1#ifndef LINUX_MLD_H
2#define LINUX_MLD_H
3
4#include <linux/in6.h>
5#include <linux/icmpv6.h>
6
7/* MLDv1 Query/Report/Done */
8struct mld_msg {
9 struct icmp6hdr mld_hdr;
10 struct in6_addr mld_mca;
11};
12
13#define mld_type mld_hdr.icmp6_type
14#define mld_code mld_hdr.icmp6_code
15#define mld_cksum mld_hdr.icmp6_cksum
16#define mld_maxdelay mld_hdr.icmp6_maxdelay
17#define mld_reserved mld_hdr.icmp6_dataun.un_data16[1]
18
19/* Multicast Listener Discovery version 2 headers */
20/* MLDv2 Report */
21struct mld2_grec {
22 __u8 grec_type;
23 __u8 grec_auxwords;
24 __be16 grec_nsrcs;
25 struct in6_addr grec_mca;
26 struct in6_addr grec_src[0];
27};
28
29struct mld2_report {
30 struct icmp6hdr mld2r_hdr;
31 struct mld2_grec mld2r_grec[0];
32};
33
34#define mld2r_type mld2r_hdr.icmp6_type
35#define mld2r_resv1 mld2r_hdr.icmp6_code
36#define mld2r_cksum mld2r_hdr.icmp6_cksum
37#define mld2r_resv2 mld2r_hdr.icmp6_dataun.un_data16[0]
38#define mld2r_ngrec mld2r_hdr.icmp6_dataun.un_data16[1]
39
40/* MLDv2 Query */
41struct mld2_query {
42 struct icmp6hdr mld2q_hdr;
43 struct in6_addr mld2q_mca;
44#if defined(__LITTLE_ENDIAN_BITFIELD)
45 __u8 mld2q_qrv:3,
46 mld2q_suppress:1,
47 mld2q_resv2:4;
48#elif defined(__BIG_ENDIAN_BITFIELD)
49 __u8 mld2q_resv2:4,
50 mld2q_suppress:1,
51 mld2q_qrv:3;
52#else
53#error "Please fix <asm/byteorder.h>"
54#endif
55 __u8 mld2q_qqic;
56 __be16 mld2q_nsrcs;
57 struct in6_addr mld2q_srcs[0];
58};
59
60#define mld2q_type mld2q_hdr.icmp6_type
61#define mld2q_code mld2q_hdr.icmp6_code
62#define mld2q_cksum mld2q_hdr.icmp6_cksum
63#define mld2q_mrc mld2q_hdr.icmp6_maxdelay
64#define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1]
65
66/* Max Response Code */
67#define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
68#define MLDV2_EXP(thresh, nbmant, nbexp, value) \
69 ((value) < (thresh) ? (value) : \
70 ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \
71 (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp))))
72
73#define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value)
74
75#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index da1d58be31b7..eb21340a573b 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -299,6 +299,20 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
299 return 0; 299 return 0;
300} 300}
301 301
302#ifdef CONFIG_BRIDGE_NETFILTER
303static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
304{
305 unsigned seq, hh_alen;
306
307 do {
308 seq = read_seqbegin(&hh->hh_lock);
309 hh_alen = HH_DATA_ALIGN(ETH_HLEN);
310 memcpy(skb->data - hh_alen, hh->hh_data, ETH_ALEN + hh_alen - ETH_HLEN);
311 } while (read_seqretry(&hh->hh_lock, seq));
312 return 0;
313}
314#endif
315
302static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 316static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
303{ 317{
304 unsigned seq; 318 unsigned seq;
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index ff4982ab84b6..81a31c0db3e7 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -14,11 +14,8 @@
14 * The rules are simple: 14 * The rules are simple:
15 * 1. set pernet_operations->id. After register_pernet_device you 15 * 1. set pernet_operations->id. After register_pernet_device you
16 * will have the id of your private pointer. 16 * will have the id of your private pointer.
17 * 2. Either set pernet_operations->size (to have the code allocate and 17 * 2. set pernet_operations->size to have the code allocate and free
18 * free a private structure pointed to from struct net ) or 18 * a private structure pointed to from struct net.
19 * call net_assign_generic() to put the private data on the struct
20 * net (most preferably this should be done in the ->init callback
21 * of the ops registered);
22 * 3. do not change this pointer while the net is alive; 19 * 3. do not change this pointer while the net is alive;
23 * 4. do not try to have any private reference on the net_generic object. 20 * 4. do not try to have any private reference on the net_generic object.
24 * 21 *
@@ -46,6 +43,4 @@ static inline void *net_generic(struct net *net, int id)
46 43
47 return ptr; 44 return ptr;
48} 45}
49
50extern int net_assign_generic(struct net *net, int id, void *data);
51#endif 46#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2764994c9136..d68c3f121774 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -55,19 +55,14 @@ struct netns_ipv4 {
55 int sysctl_rt_cache_rebuild_count; 55 int sysctl_rt_cache_rebuild_count;
56 int current_rt_cache_rebuild_count; 56 int current_rt_cache_rebuild_count;
57 57
58 struct timer_list rt_secret_timer;
59 atomic_t rt_genid; 58 atomic_t rt_genid;
60 59
61#ifdef CONFIG_IP_MROUTE 60#ifdef CONFIG_IP_MROUTE
62 struct sock *mroute_sk; 61#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
63 struct mfc_cache **mfc_cache_array; 62 struct mr_table *mrt;
64 struct vif_device *vif_table; 63#else
65 int maxvif; 64 struct list_head mr_tables;
66 atomic_t cache_resolve_queue_len; 65 struct fib_rules_ops *mr_rules_ops;
67 int mroute_do_assert;
68 int mroute_do_pim;
69#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
70 int mroute_reg_vif_num;
71#endif 66#endif
72#endif 67#endif
73}; 68};
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 1f11ebc22151..81abfcb2eb4e 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -59,15 +59,11 @@ struct netns_ipv6 {
59 struct sock *tcp_sk; 59 struct sock *tcp_sk;
60 struct sock *igmp_sk; 60 struct sock *igmp_sk;
61#ifdef CONFIG_IPV6_MROUTE 61#ifdef CONFIG_IPV6_MROUTE
62 struct sock *mroute6_sk; 62#ifndef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
63 struct mfc6_cache **mfc6_cache_array; 63 struct mr6_table *mrt6;
64 struct mif_device *vif6_table; 64#else
65 int maxvif; 65 struct list_head mr6_tables;
66 atomic_t cache_resolve_queue_len; 66 struct fib_rules_ops *mr6_rules_ops;
67 int mroute_do_assert;
68 int mroute_do_pim;
69#ifdef CONFIG_IPV6_PIMSM_V2
70 int mroute_reg_vif_num;
71#endif 67#endif
72#endif 68#endif
73}; 69};
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b6cdc33b39c1..9d4d87cc970e 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -12,7 +12,7 @@ struct qdisc_walker {
12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); 12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
13}; 13};
14 14
15#define QDISC_ALIGNTO 32 15#define QDISC_ALIGNTO 64
16#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) 16#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
17 17
18static inline void *qdisc_priv(struct Qdisc *q) 18static inline void *qdisc_priv(struct Qdisc *q)
diff --git a/include/net/raw.h b/include/net/raw.h
index 6c14a656357a..43c57502659b 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -19,6 +19,7 @@
19 19
20 20
21#include <net/protocol.h> 21#include <net/protocol.h>
22#include <linux/icmp.h>
22 23
23extern struct proto raw_prot; 24extern struct proto raw_prot;
24 25
@@ -56,4 +57,16 @@ int raw_seq_open(struct inode *ino, struct file *file,
56void raw_hash_sk(struct sock *sk); 57void raw_hash_sk(struct sock *sk);
57void raw_unhash_sk(struct sock *sk); 58void raw_unhash_sk(struct sock *sk);
58 59
60struct raw_sock {
61 /* inet_sock has to be the first member */
62 struct inet_sock inet;
63 struct icmp_filter filter;
64 u32 ipmr_table;
65};
66
67static inline struct raw_sock *raw_sk(const struct sock *sk)
68{
69 return (struct raw_sock *)sk;
70}
71
59#endif /* _RAW_H */ 72#endif /* _RAW_H */
diff --git a/include/net/route.h b/include/net/route.h
index 2c9fba7f7731..af6cf4b4c9dc 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -112,7 +112,22 @@ extern void rt_cache_flush_batch(void);
112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
115extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); 115
116extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
117 u8 tos, struct net_device *devin, bool noref);
118
119static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
120 u8 tos, struct net_device *devin)
121{
122 return ip_route_input_common(skb, dst, src, tos, devin, false);
123}
124
125static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
126 u8 tos, struct net_device *devin)
127{
128 return ip_route_input_common(skb, dst, src, tos, devin, true);
129}
130
116extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); 131extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
117extern void ip_rt_send_redirect(struct sk_buff *skb); 132extern void ip_rt_send_redirect(struct sk_buff *skb);
118 133
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 67dc08eaaa45..03ca5d826757 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -73,6 +73,7 @@ struct Qdisc {
73 struct sk_buff_head q; 73 struct sk_buff_head q;
74 struct gnet_stats_basic_packed bstats; 74 struct gnet_stats_basic_packed bstats;
75 struct gnet_stats_queue qstats; 75 struct gnet_stats_queue qstats;
76 struct rcu_head rcu_head;
76}; 77};
77 78
78struct Qdisc_class_ops { 79struct Qdisc_class_ops {
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index fa6cde578a1d..65946bc43d00 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -269,7 +269,7 @@ enum {
269#define SCTP_MIB_MAX __SCTP_MIB_MAX 269#define SCTP_MIB_MAX __SCTP_MIB_MAX
270struct sctp_mib { 270struct sctp_mib {
271 unsigned long mibs[SCTP_MIB_MAX]; 271 unsigned long mibs[SCTP_MIB_MAX];
272} __SNMP_MIB_ALIGN__; 272};
273 273
274 274
275/* Print debugging messages. */ 275/* Print debugging messages. */
@@ -547,7 +547,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
547#define WORD_ROUND(s) (((s)+3)&~3) 547#define WORD_ROUND(s) (((s)+3)&~3)
548 548
549/* Make a new instance of type. */ 549/* Make a new instance of type. */
550#define t_new(type, flags) (type *)kmalloc(sizeof(type), flags) 550#define t_new(type, flags) (type *)kzalloc(sizeof(type), flags)
551 551
552/* Compare two timevals. */ 552/* Compare two timevals. */
553#define tv_lt(s, t) \ 553#define tv_lt(s, t) \
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 61d73e37d543..4088c89a9055 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -438,7 +438,7 @@ sctp_vtag_verify_either(const struct sctp_chunk *chunk,
438 */ 438 */
439 if ((!sctp_test_T_bit(chunk) && 439 if ((!sctp_test_T_bit(chunk) &&
440 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) || 440 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) ||
441 (sctp_test_T_bit(chunk) && 441 (sctp_test_T_bit(chunk) && asoc->c.peer_vtag &&
442 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) { 442 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) {
443 return 1; 443 return 1;
444 } 444 }
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 219043a67bf7..6173c619913a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -643,17 +643,15 @@ struct sctp_pf {
643struct sctp_datamsg { 643struct sctp_datamsg {
644 /* Chunks waiting to be submitted to lower layer. */ 644 /* Chunks waiting to be submitted to lower layer. */
645 struct list_head chunks; 645 struct list_head chunks;
646 /* Chunks that have been transmitted. */
647 size_t msg_size;
648 /* Reference counting. */ 646 /* Reference counting. */
649 atomic_t refcnt; 647 atomic_t refcnt;
650 /* When is this message no longer interesting to the peer? */ 648 /* When is this message no longer interesting to the peer? */
651 unsigned long expires_at; 649 unsigned long expires_at;
652 /* Did the messenge fail to send? */ 650 /* Did the messenge fail to send? */
653 int send_error; 651 int send_error;
654 char send_failed; 652 u8 send_failed:1,
655 /* Control whether chunks from this message can be abandoned. */ 653 can_abandon:1, /* can chunks from this message can be abandoned. */
656 char can_abandon; 654 can_delay; /* should this message be Nagle delayed */
657}; 655};
658 656
659struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 657struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
@@ -757,7 +755,6 @@ struct sctp_chunk {
757#define SCTP_NEED_FRTX 0x1 755#define SCTP_NEED_FRTX 0x1
758#define SCTP_DONT_FRTX 0x2 756#define SCTP_DONT_FRTX 0x2
759 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ 757 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
760 resent:1, /* Has this chunk ever been resent. */
761 has_tsn:1, /* Does this chunk have a TSN yet? */ 758 has_tsn:1, /* Does this chunk have a TSN yet? */
762 has_ssn:1, /* Does this chunk have a SSN yet? */ 759 has_ssn:1, /* Does this chunk have a SSN yet? */
763 singleton:1, /* Only chunk in the packet? */ 760 singleton:1, /* Only chunk in the packet? */
@@ -879,7 +876,30 @@ struct sctp_transport {
879 876
880 /* Reference counting. */ 877 /* Reference counting. */
881 atomic_t refcnt; 878 atomic_t refcnt;
882 int dead; 879 int dead:1,
880 /* RTO-Pending : A flag used to track if one of the DATA
881 * chunks sent to this address is currently being
882 * used to compute a RTT. If this flag is 0,
883 * the next DATA chunk sent to this destination
884 * should be used to compute a RTT and this flag
885 * should be set. Every time the RTT
886 * calculation completes (i.e. the DATA chunk
887 * is SACK'd) clear this flag.
888 */
889 rto_pending:1,
890
891 /*
892 * hb_sent : a flag that signals that we have a pending
893 * heartbeat.
894 */
895 hb_sent:1,
896
897 /* Is the Path MTU update pending on this tranport */
898 pmtu_pending:1,
899
900 /* Is this structure kfree()able? */
901 malloced:1;
902
883 903
884 /* This is the peer's IP address and port. */ 904 /* This is the peer's IP address and port. */
885 union sctp_addr ipaddr; 905 union sctp_addr ipaddr;
@@ -909,22 +929,6 @@ struct sctp_transport {
909 /* SRTT : The current smoothed round trip time. */ 929 /* SRTT : The current smoothed round trip time. */
910 __u32 srtt; 930 __u32 srtt;
911 931
912 /* RTO-Pending : A flag used to track if one of the DATA
913 * chunks sent to this address is currently being
914 * used to compute a RTT. If this flag is 0,
915 * the next DATA chunk sent to this destination
916 * should be used to compute a RTT and this flag
917 * should be set. Every time the RTT
918 * calculation completes (i.e. the DATA chunk
919 * is SACK'd) clear this flag.
920 * hb_sent : a flag that signals that we have a pending heartbeat.
921 */
922 __u8 rto_pending;
923 __u8 hb_sent;
924
925 /* Flag to track the current fast recovery state */
926 __u8 fast_recovery;
927
928 /* 932 /*
929 * These are the congestion stats. 933 * These are the congestion stats.
930 */ 934 */
@@ -944,9 +948,6 @@ struct sctp_transport {
944 948
945 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ 949 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */
946 950
947 /* TSN marking the fast recovery exit point */
948 __u32 fast_recovery_exit;
949
950 /* Destination */ 951 /* Destination */
951 struct dst_entry *dst; 952 struct dst_entry *dst;
952 /* Source address. */ 953 /* Source address. */
@@ -977,9 +978,6 @@ struct sctp_transport {
977 */ 978 */
978 __u16 pathmaxrxt; 979 __u16 pathmaxrxt;
979 980
980 /* is the Path MTU update pending on this tranport */
981 __u8 pmtu_pending;
982
983 /* PMTU : The current known path MTU. */ 981 /* PMTU : The current known path MTU. */
984 __u32 pathmtu; 982 __u32 pathmtu;
985 983
@@ -1026,8 +1024,6 @@ struct sctp_transport {
1026 /* This is the list of transports that have chunks to send. */ 1024 /* This is the list of transports that have chunks to send. */
1027 struct list_head send_ready; 1025 struct list_head send_ready;
1028 1026
1029 int malloced; /* Is this structure kfree()able? */
1030
1031 /* State information saved for SFR_CACC algorithm. The key 1027 /* State information saved for SFR_CACC algorithm. The key
1032 * idea in SFR_CACC is to maintain state at the sender on a 1028 * idea in SFR_CACC is to maintain state at the sender on a
1033 * per-destination basis when a changeover happens. 1029 * per-destination basis when a changeover happens.
@@ -1069,7 +1065,7 @@ void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
1069 struct sctp_sock *); 1065 struct sctp_sock *);
1070void sctp_transport_pmtu(struct sctp_transport *); 1066void sctp_transport_pmtu(struct sctp_transport *);
1071void sctp_transport_free(struct sctp_transport *); 1067void sctp_transport_free(struct sctp_transport *);
1072void sctp_transport_reset_timers(struct sctp_transport *, int); 1068void sctp_transport_reset_timers(struct sctp_transport *);
1073void sctp_transport_hold(struct sctp_transport *); 1069void sctp_transport_hold(struct sctp_transport *);
1074void sctp_transport_put(struct sctp_transport *); 1070void sctp_transport_put(struct sctp_transport *);
1075void sctp_transport_update_rto(struct sctp_transport *, __u32); 1071void sctp_transport_update_rto(struct sctp_transport *, __u32);
@@ -1723,6 +1719,12 @@ struct sctp_association {
1723 /* Highest TSN that is acknowledged by incoming SACKs. */ 1719 /* Highest TSN that is acknowledged by incoming SACKs. */
1724 __u32 highest_sacked; 1720 __u32 highest_sacked;
1725 1721
1722 /* TSN marking the fast recovery exit point */
1723 __u32 fast_recovery_exit;
1724
1725 /* Flag to track the current fast recovery state */
1726 __u8 fast_recovery;
1727
1726 /* The number of unacknowledged data chunks. Reported through 1728 /* The number of unacknowledged data chunks. Reported through
1727 * the SCTP_STATUS sockopt. 1729 * the SCTP_STATUS sockopt.
1728 */ 1730 */
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 692ee0061dc4..92456f1035f5 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -52,26 +52,11 @@ struct snmp_mib {
52 * count on the 20Gb/s + networks people expect in a few years time! 52 * count on the 20Gb/s + networks people expect in a few years time!
53 */ 53 */
54 54
55/*
56 * The rule for padding:
57 * Best is power of two because then the right structure can be found by a
58 * simple shift. The structure should be always cache line aligned.
59 * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add
60 * instructions to emulate multiply in case it is not power-of-two.
61 * Currently n is always <=3 for all sizes so simple cache line alignment
62 * is enough.
63 *
64 * The best solution would be a global CPU local area , especially on 64
65 * and 128byte cacheline machine it makes a *lot* of sense -AK
66 */
67
68#define __SNMP_MIB_ALIGN__ ____cacheline_aligned
69
70/* IPstats */ 55/* IPstats */
71#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX 56#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
72struct ipstats_mib { 57struct ipstats_mib {
73 unsigned long mibs[IPSTATS_MIB_MAX]; 58 unsigned long mibs[IPSTATS_MIB_MAX];
74} __SNMP_MIB_ALIGN__; 59};
75 60
76/* ICMP */ 61/* ICMP */
77#define ICMP_MIB_DUMMY __ICMP_MIB_MAX 62#define ICMP_MIB_DUMMY __ICMP_MIB_MAX
@@ -79,36 +64,36 @@ struct ipstats_mib {
79 64
80struct icmp_mib { 65struct icmp_mib {
81 unsigned long mibs[ICMP_MIB_MAX]; 66 unsigned long mibs[ICMP_MIB_MAX];
82} __SNMP_MIB_ALIGN__; 67};
83 68
84#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX 69#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX
85struct icmpmsg_mib { 70struct icmpmsg_mib {
86 unsigned long mibs[ICMPMSG_MIB_MAX]; 71 unsigned long mibs[ICMPMSG_MIB_MAX];
87} __SNMP_MIB_ALIGN__; 72};
88 73
89/* ICMP6 (IPv6-ICMP) */ 74/* ICMP6 (IPv6-ICMP) */
90#define ICMP6_MIB_MAX __ICMP6_MIB_MAX 75#define ICMP6_MIB_MAX __ICMP6_MIB_MAX
91struct icmpv6_mib { 76struct icmpv6_mib {
92 unsigned long mibs[ICMP6_MIB_MAX]; 77 unsigned long mibs[ICMP6_MIB_MAX];
93} __SNMP_MIB_ALIGN__; 78};
94 79
95#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX 80#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX
96struct icmpv6msg_mib { 81struct icmpv6msg_mib {
97 unsigned long mibs[ICMP6MSG_MIB_MAX]; 82 unsigned long mibs[ICMP6MSG_MIB_MAX];
98} __SNMP_MIB_ALIGN__; 83};
99 84
100 85
101/* TCP */ 86/* TCP */
102#define TCP_MIB_MAX __TCP_MIB_MAX 87#define TCP_MIB_MAX __TCP_MIB_MAX
103struct tcp_mib { 88struct tcp_mib {
104 unsigned long mibs[TCP_MIB_MAX]; 89 unsigned long mibs[TCP_MIB_MAX];
105} __SNMP_MIB_ALIGN__; 90};
106 91
107/* UDP */ 92/* UDP */
108#define UDP_MIB_MAX __UDP_MIB_MAX 93#define UDP_MIB_MAX __UDP_MIB_MAX
109struct udp_mib { 94struct udp_mib {
110 unsigned long mibs[UDP_MIB_MAX]; 95 unsigned long mibs[UDP_MIB_MAX];
111} __SNMP_MIB_ALIGN__; 96};
112 97
113/* Linux */ 98/* Linux */
114#define LINUX_MIB_MAX __LINUX_MIB_MAX 99#define LINUX_MIB_MAX __LINUX_MIB_MAX
@@ -148,6 +133,8 @@ struct linux_xfrm_mib {
148 __this_cpu_add(mib[0]->mibs[field], addend) 133 __this_cpu_add(mib[0]->mibs[field], addend)
149#define SNMP_ADD_STATS_USER(mib, field, addend) \ 134#define SNMP_ADD_STATS_USER(mib, field, addend) \
150 this_cpu_add(mib[1]->mibs[field], addend) 135 this_cpu_add(mib[1]->mibs[field], addend)
136#define SNMP_ADD_STATS(mib, field, addend) \
137 this_cpu_add(mib[0]->mibs[field], addend)
151/* 138/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 139 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
153 * to make @ptr a non-percpu pointer. 140 * to make @ptr a non-percpu pointer.
diff --git a/include/net/sock.h b/include/net/sock.h
index 1ad6435f252e..5697caf8cc76 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -159,7 +159,7 @@ struct sock_common {
159 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings 159 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings
160 * @sk_lock: synchronizer 160 * @sk_lock: synchronizer
161 * @sk_rcvbuf: size of receive buffer in bytes 161 * @sk_rcvbuf: size of receive buffer in bytes
162 * @sk_sleep: sock wait queue 162 * @sk_wq: sock wait queue and async head
163 * @sk_dst_cache: destination cache 163 * @sk_dst_cache: destination cache
164 * @sk_dst_lock: destination cache lock 164 * @sk_dst_lock: destination cache lock
165 * @sk_policy: flow policy 165 * @sk_policy: flow policy
@@ -177,6 +177,7 @@ struct sock_common {
177 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 177 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
178 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 178 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
179 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 179 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
180 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
180 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 181 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
181 * @sk_gso_max_size: Maximum GSO segment size to build 182 * @sk_gso_max_size: Maximum GSO segment size to build
182 * @sk_lingertime: %SO_LINGER l_linger setting 183 * @sk_lingertime: %SO_LINGER l_linger setting
@@ -198,6 +199,7 @@ struct sock_common {
198 * @sk_rcvlowat: %SO_RCVLOWAT setting 199 * @sk_rcvlowat: %SO_RCVLOWAT setting
199 * @sk_rcvtimeo: %SO_RCVTIMEO setting 200 * @sk_rcvtimeo: %SO_RCVTIMEO setting
200 * @sk_sndtimeo: %SO_SNDTIMEO setting 201 * @sk_sndtimeo: %SO_SNDTIMEO setting
202 * @sk_rxhash: flow hash received from netif layer
201 * @sk_filter: socket filtering instructions 203 * @sk_filter: socket filtering instructions
202 * @sk_protinfo: private area, net family specific, when not using slab 204 * @sk_protinfo: private area, net family specific, when not using slab
203 * @sk_timer: sock cleanup timer 205 * @sk_timer: sock cleanup timer
@@ -255,14 +257,13 @@ struct sock {
255 struct sk_buff *head; 257 struct sk_buff *head;
256 struct sk_buff *tail; 258 struct sk_buff *tail;
257 int len; 259 int len;
258 int limit;
259 } sk_backlog; 260 } sk_backlog;
260 wait_queue_head_t *sk_sleep; 261 struct socket_wq *sk_wq;
261 struct dst_entry *sk_dst_cache; 262 struct dst_entry *sk_dst_cache;
262#ifdef CONFIG_XFRM 263#ifdef CONFIG_XFRM
263 struct xfrm_policy *sk_policy[2]; 264 struct xfrm_policy *sk_policy[2];
264#endif 265#endif
265 rwlock_t sk_dst_lock; 266 spinlock_t sk_dst_lock;
266 atomic_t sk_rmem_alloc; 267 atomic_t sk_rmem_alloc;
267 atomic_t sk_wmem_alloc; 268 atomic_t sk_wmem_alloc;
268 atomic_t sk_omem_alloc; 269 atomic_t sk_omem_alloc;
@@ -276,9 +277,13 @@ struct sock {
276 int sk_forward_alloc; 277 int sk_forward_alloc;
277 gfp_t sk_allocation; 278 gfp_t sk_allocation;
278 int sk_route_caps; 279 int sk_route_caps;
280 int sk_route_nocaps;
279 int sk_gso_type; 281 int sk_gso_type;
280 unsigned int sk_gso_max_size; 282 unsigned int sk_gso_max_size;
281 int sk_rcvlowat; 283 int sk_rcvlowat;
284#ifdef CONFIG_RPS
285 __u32 sk_rxhash;
286#endif
282 unsigned long sk_flags; 287 unsigned long sk_flags;
283 unsigned long sk_lingertime; 288 unsigned long sk_lingertime;
284 struct sk_buff_head sk_error_queue; 289 struct sk_buff_head sk_error_queue;
@@ -595,19 +600,32 @@ static inline int sk_stream_memory_free(struct sock *sk)
595/* OOB backlog add */ 600/* OOB backlog add */
596static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 601static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
597{ 602{
598 if (!sk->sk_backlog.tail) { 603 /* dont let skb dst not refcounted, we are going to leave rcu lock */
599 sk->sk_backlog.head = sk->sk_backlog.tail = skb; 604 skb_dst_force(skb);
600 } else { 605
606 if (!sk->sk_backlog.tail)
607 sk->sk_backlog.head = skb;
608 else
601 sk->sk_backlog.tail->next = skb; 609 sk->sk_backlog.tail->next = skb;
602 sk->sk_backlog.tail = skb; 610
603 } 611 sk->sk_backlog.tail = skb;
604 skb->next = NULL; 612 skb->next = NULL;
605} 613}
606 614
615/*
616 * Take into account size of receive queue and backlog queue
617 */
618static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb)
619{
620 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
621
622 return qsize + skb->truesize > sk->sk_rcvbuf;
623}
624
607/* The per-socket spinlock must be held here. */ 625/* The per-socket spinlock must be held here. */
608static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) 626static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb)
609{ 627{
610 if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1)) 628 if (sk_rcvqueues_full(sk, skb))
611 return -ENOBUFS; 629 return -ENOBUFS;
612 630
613 __sk_add_backlog(sk, skb); 631 __sk_add_backlog(sk, skb);
@@ -620,6 +638,40 @@ static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
620 return sk->sk_backlog_rcv(sk, skb); 638 return sk->sk_backlog_rcv(sk, skb);
621} 639}
622 640
641static inline void sock_rps_record_flow(const struct sock *sk)
642{
643#ifdef CONFIG_RPS
644 struct rps_sock_flow_table *sock_flow_table;
645
646 rcu_read_lock();
647 sock_flow_table = rcu_dereference(rps_sock_flow_table);
648 rps_record_sock_flow(sock_flow_table, sk->sk_rxhash);
649 rcu_read_unlock();
650#endif
651}
652
653static inline void sock_rps_reset_flow(const struct sock *sk)
654{
655#ifdef CONFIG_RPS
656 struct rps_sock_flow_table *sock_flow_table;
657
658 rcu_read_lock();
659 sock_flow_table = rcu_dereference(rps_sock_flow_table);
660 rps_reset_sock_flow(sock_flow_table, sk->sk_rxhash);
661 rcu_read_unlock();
662#endif
663}
664
665static inline void sock_rps_save_rxhash(struct sock *sk, u32 rxhash)
666{
667#ifdef CONFIG_RPS
668 if (unlikely(sk->sk_rxhash != rxhash)) {
669 sock_rps_reset_flow(sk);
670 sk->sk_rxhash = rxhash;
671 }
672#endif
673}
674
623#define sk_wait_event(__sk, __timeo, __condition) \ 675#define sk_wait_event(__sk, __timeo, __condition) \
624 ({ int __rc; \ 676 ({ int __rc; \
625 release_sock(__sk); \ 677 release_sock(__sk); \
@@ -974,6 +1026,16 @@ extern void release_sock(struct sock *sk);
974 SINGLE_DEPTH_NESTING) 1026 SINGLE_DEPTH_NESTING)
975#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1027#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
976 1028
1029static inline void lock_sock_bh(struct sock *sk)
1030{
1031 spin_lock_bh(&sk->sk_lock.slock);
1032}
1033
1034static inline void unlock_sock_bh(struct sock *sk)
1035{
1036 spin_unlock_bh(&sk->sk_lock.slock);
1037}
1038
977extern struct sock *sk_alloc(struct net *net, int family, 1039extern struct sock *sk_alloc(struct net *net, int family,
978 gfp_t priority, 1040 gfp_t priority,
979 struct proto *prot); 1041 struct proto *prot);
@@ -1160,6 +1222,10 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1160 sk->sk_socket = sock; 1222 sk->sk_socket = sock;
1161} 1223}
1162 1224
1225static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1226{
1227 return &sk->sk_wq->wait;
1228}
1163/* Detach socket from process context. 1229/* Detach socket from process context.
1164 * Announce socket dead, detach it from wait queue and inode. 1230 * Announce socket dead, detach it from wait queue and inode.
1165 * Note that parent inode held reference count on this struct sock, 1231 * Note that parent inode held reference count on this struct sock,
@@ -1172,14 +1238,14 @@ static inline void sock_orphan(struct sock *sk)
1172 write_lock_bh(&sk->sk_callback_lock); 1238 write_lock_bh(&sk->sk_callback_lock);
1173 sock_set_flag(sk, SOCK_DEAD); 1239 sock_set_flag(sk, SOCK_DEAD);
1174 sk_set_socket(sk, NULL); 1240 sk_set_socket(sk, NULL);
1175 sk->sk_sleep = NULL; 1241 sk->sk_wq = NULL;
1176 write_unlock_bh(&sk->sk_callback_lock); 1242 write_unlock_bh(&sk->sk_callback_lock);
1177} 1243}
1178 1244
1179static inline void sock_graft(struct sock *sk, struct socket *parent) 1245static inline void sock_graft(struct sock *sk, struct socket *parent)
1180{ 1246{
1181 write_lock_bh(&sk->sk_callback_lock); 1247 write_lock_bh(&sk->sk_callback_lock);
1182 sk->sk_sleep = &parent->wait; 1248 rcu_assign_pointer(sk->sk_wq, parent->wq);
1183 parent->sk = sk; 1249 parent->sk = sk;
1184 sk_set_socket(sk, parent); 1250 sk_set_socket(sk, parent);
1185 security_sock_graft(sk, parent); 1251 security_sock_graft(sk, parent);
@@ -1192,7 +1258,9 @@ extern unsigned long sock_i_ino(struct sock *sk);
1192static inline struct dst_entry * 1258static inline struct dst_entry *
1193__sk_dst_get(struct sock *sk) 1259__sk_dst_get(struct sock *sk)
1194{ 1260{
1195 return sk->sk_dst_cache; 1261 return rcu_dereference_check(sk->sk_dst_cache, rcu_read_lock_held() ||
1262 sock_owned_by_user(sk) ||
1263 lockdep_is_held(&sk->sk_lock.slock));
1196} 1264}
1197 1265
1198static inline struct dst_entry * 1266static inline struct dst_entry *
@@ -1200,50 +1268,65 @@ sk_dst_get(struct sock *sk)
1200{ 1268{
1201 struct dst_entry *dst; 1269 struct dst_entry *dst;
1202 1270
1203 read_lock(&sk->sk_dst_lock); 1271 rcu_read_lock();
1204 dst = sk->sk_dst_cache; 1272 dst = rcu_dereference(sk->sk_dst_cache);
1205 if (dst) 1273 if (dst)
1206 dst_hold(dst); 1274 dst_hold(dst);
1207 read_unlock(&sk->sk_dst_lock); 1275 rcu_read_unlock();
1208 return dst; 1276 return dst;
1209} 1277}
1210 1278
1279extern void sk_reset_txq(struct sock *sk);
1280
1281static inline void dst_negative_advice(struct sock *sk)
1282{
1283 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
1284
1285 if (dst && dst->ops->negative_advice) {
1286 ndst = dst->ops->negative_advice(dst);
1287
1288 if (ndst != dst) {
1289 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1290 sk_reset_txq(sk);
1291 }
1292 }
1293}
1294
1211static inline void 1295static inline void
1212__sk_dst_set(struct sock *sk, struct dst_entry *dst) 1296__sk_dst_set(struct sock *sk, struct dst_entry *dst)
1213{ 1297{
1214 struct dst_entry *old_dst; 1298 struct dst_entry *old_dst;
1215 1299
1216 sk_tx_queue_clear(sk); 1300 sk_tx_queue_clear(sk);
1217 old_dst = sk->sk_dst_cache; 1301 /*
1218 sk->sk_dst_cache = dst; 1302 * This can be called while sk is owned by the caller only,
1303 * with no state that can be checked in a rcu_dereference_check() cond
1304 */
1305 old_dst = rcu_dereference_raw(sk->sk_dst_cache);
1306 rcu_assign_pointer(sk->sk_dst_cache, dst);
1219 dst_release(old_dst); 1307 dst_release(old_dst);
1220} 1308}
1221 1309
1222static inline void 1310static inline void
1223sk_dst_set(struct sock *sk, struct dst_entry *dst) 1311sk_dst_set(struct sock *sk, struct dst_entry *dst)
1224{ 1312{
1225 write_lock(&sk->sk_dst_lock); 1313 spin_lock(&sk->sk_dst_lock);
1226 __sk_dst_set(sk, dst); 1314 __sk_dst_set(sk, dst);
1227 write_unlock(&sk->sk_dst_lock); 1315 spin_unlock(&sk->sk_dst_lock);
1228} 1316}
1229 1317
1230static inline void 1318static inline void
1231__sk_dst_reset(struct sock *sk) 1319__sk_dst_reset(struct sock *sk)
1232{ 1320{
1233 struct dst_entry *old_dst; 1321 __sk_dst_set(sk, NULL);
1234
1235 sk_tx_queue_clear(sk);
1236 old_dst = sk->sk_dst_cache;
1237 sk->sk_dst_cache = NULL;
1238 dst_release(old_dst);
1239} 1322}
1240 1323
1241static inline void 1324static inline void
1242sk_dst_reset(struct sock *sk) 1325sk_dst_reset(struct sock *sk)
1243{ 1326{
1244 write_lock(&sk->sk_dst_lock); 1327 spin_lock(&sk->sk_dst_lock);
1245 __sk_dst_reset(sk); 1328 __sk_dst_reset(sk);
1246 write_unlock(&sk->sk_dst_lock); 1329 spin_unlock(&sk->sk_dst_lock);
1247} 1330}
1248 1331
1249extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1332extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
@@ -1257,6 +1340,12 @@ static inline int sk_can_gso(const struct sock *sk)
1257 1340
1258extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1341extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1259 1342
1343static inline void sk_nocaps_add(struct sock *sk, int flags)
1344{
1345 sk->sk_route_nocaps |= flags;
1346 sk->sk_route_caps &= ~flags;
1347}
1348
1260static inline int skb_copy_to_page(struct sock *sk, char __user *from, 1349static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1261 struct sk_buff *skb, struct page *page, 1350 struct sk_buff *skb, struct page *page,
1262 int off, int copy) 1351 int off, int copy)
@@ -1314,12 +1403,12 @@ static inline int sk_has_allocations(const struct sock *sk)
1314} 1403}
1315 1404
1316/** 1405/**
1317 * sk_has_sleeper - check if there are any waiting processes 1406 * wq_has_sleeper - check if there are any waiting processes
1318 * @sk: socket 1407 * @sk: struct socket_wq
1319 * 1408 *
1320 * Returns true if socket has waiting processes 1409 * Returns true if socket_wq has waiting processes
1321 * 1410 *
1322 * The purpose of the sk_has_sleeper and sock_poll_wait is to wrap the memory 1411 * The purpose of the wq_has_sleeper and sock_poll_wait is to wrap the memory
1323 * barrier call. They were added due to the race found within the tcp code. 1412 * barrier call. They were added due to the race found within the tcp code.
1324 * 1413 *
1325 * Consider following tcp code paths: 1414 * Consider following tcp code paths:
@@ -1332,9 +1421,10 @@ static inline int sk_has_allocations(const struct sock *sk)
1332 * ... ... 1421 * ... ...
1333 * tp->rcv_nxt check sock_def_readable 1422 * tp->rcv_nxt check sock_def_readable
1334 * ... { 1423 * ... {
1335 * schedule ... 1424 * schedule rcu_read_lock();
1336 * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1425 * wq = rcu_dereference(sk->sk_wq);
1337 * wake_up_interruptible(sk->sk_sleep) 1426 * if (wq && waitqueue_active(&wq->wait))
1427 * wake_up_interruptible(&wq->wait)
1338 * ... 1428 * ...
1339 * } 1429 * }
1340 * 1430 *
@@ -1343,19 +1433,18 @@ static inline int sk_has_allocations(const struct sock *sk)
1343 * could then endup calling schedule and sleep forever if there are no more 1433 * could then endup calling schedule and sleep forever if there are no more
1344 * data on the socket. 1434 * data on the socket.
1345 * 1435 *
1346 * The sk_has_sleeper is always called right after a call to read_lock, so we
1347 * can use smp_mb__after_lock barrier.
1348 */ 1436 */
1349static inline int sk_has_sleeper(struct sock *sk) 1437static inline bool wq_has_sleeper(struct socket_wq *wq)
1350{ 1438{
1439
1351 /* 1440 /*
1352 * We need to be sure we are in sync with the 1441 * We need to be sure we are in sync with the
1353 * add_wait_queue modifications to the wait queue. 1442 * add_wait_queue modifications to the wait queue.
1354 * 1443 *
1355 * This memory barrier is paired in the sock_poll_wait. 1444 * This memory barrier is paired in the sock_poll_wait.
1356 */ 1445 */
1357 smp_mb__after_lock(); 1446 smp_mb();
1358 return sk->sk_sleep && waitqueue_active(sk->sk_sleep); 1447 return wq && waitqueue_active(&wq->wait);
1359} 1448}
1360 1449
1361/** 1450/**
@@ -1364,7 +1453,7 @@ static inline int sk_has_sleeper(struct sock *sk)
1364 * @wait_address: socket wait queue 1453 * @wait_address: socket wait queue
1365 * @p: poll_table 1454 * @p: poll_table
1366 * 1455 *
1367 * See the comments in the sk_has_sleeper function. 1456 * See the comments in the wq_has_sleeper function.
1368 */ 1457 */
1369static inline void sock_poll_wait(struct file *filp, 1458static inline void sock_poll_wait(struct file *filp,
1370 wait_queue_head_t *wait_address, poll_table *p) 1459 wait_queue_head_t *wait_address, poll_table *p)
@@ -1375,7 +1464,7 @@ static inline void sock_poll_wait(struct file *filp,
1375 * We need to be sure we are in sync with the 1464 * We need to be sure we are in sync with the
1376 * socket flags modification. 1465 * socket flags modification.
1377 * 1466 *
1378 * This memory barrier is paired in the sk_has_sleeper. 1467 * This memory barrier is paired in the wq_has_sleeper.
1379 */ 1468 */
1380 smp_mb(); 1469 smp_mb();
1381 } 1470 }
@@ -1557,7 +1646,24 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1557 sk->sk_stamp = kt; 1646 sk->sk_stamp = kt;
1558} 1647}
1559 1648
1560extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); 1649extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1650 struct sk_buff *skb);
1651
1652static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1653 struct sk_buff *skb)
1654{
1655#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
1656 (1UL << SOCK_RCVTSTAMP) | \
1657 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \
1658 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
1659 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
1660 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
1661
1662 if (sk->sk_flags & FLAGS_TS_OR_DROPS)
1663 __sock_recv_ts_and_drops(msg, sk, skb);
1664 else
1665 sk->sk_stamp = skb->tstamp;
1666}
1561 1667
1562/** 1668/**
1563 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 1669 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
diff --git a/include/net/tcp.h b/include/net/tcp.h
index aa04b9a5093b..a1449144848a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -294,6 +294,7 @@ extern struct proto tcp_prot;
294#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field) 294#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field)
295#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) 295#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field)
296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
297 298
298extern void tcp_v4_err(struct sk_buff *skb, u32); 299extern void tcp_v4_err(struct sk_buff *skb, u32);
299 300
@@ -423,7 +424,7 @@ extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
423 * TCP v4 functions exported for the inet6 API 424 * TCP v4 functions exported for the inet6 API
424 */ 425 */
425 426
426extern void tcp_v4_send_check(struct sock *sk, int len, 427extern void tcp_v4_send_check(struct sock *sk,
427 struct sk_buff *skb); 428 struct sk_buff *skb);
428 429
429extern int tcp_v4_conn_request(struct sock *sk, 430extern int tcp_v4_conn_request(struct sock *sk,
@@ -939,7 +940,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
939 940
940 tp->ucopy.memory = 0; 941 tp->ucopy.memory = 0;
941 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { 942 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
942 wake_up_interruptible_sync_poll(sk->sk_sleep, 943 wake_up_interruptible_sync_poll(sk_sleep(sk),
943 POLLIN | POLLRDNORM | POLLRDBAND); 944 POLLIN | POLLRDNORM | POLLRDBAND);
944 if (!inet_csk_ack_scheduled(sk)) 945 if (!inet_csk_ack_scheduled(sk))
945 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 946 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
@@ -1032,6 +1033,14 @@ static inline int keepalive_probes(const struct tcp_sock *tp)
1032 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; 1033 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
1033} 1034}
1034 1035
1036static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)
1037{
1038 const struct inet_connection_sock *icsk = &tp->inet_conn;
1039
1040 return min_t(u32, tcp_time_stamp - icsk->icsk_ack.lrcvtime,
1041 tcp_time_stamp - tp->rcv_tstamp);
1042}
1043
1035static inline int tcp_fin_time(const struct sock *sk) 1044static inline int tcp_fin_time(const struct sock *sk)
1036{ 1045{
1037 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1046 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h
index 9566608c88cf..15af6dca0b49 100644
--- a/include/net/tipc/tipc.h
+++ b/include/net/tipc/tipc.h
@@ -2,7 +2,7 @@
2 * include/net/tipc/tipc.h: Main include file for TIPC users 2 * include/net/tipc/tipc.h: Main include file for TIPC users
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005,2010 Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -126,7 +126,7 @@ int tipc_createport(unsigned int tipc_user,
126 tipc_msg_event message_cb, 126 tipc_msg_event message_cb,
127 tipc_named_msg_event named_message_cb, 127 tipc_named_msg_event named_message_cb,
128 tipc_conn_msg_event conn_message_cb, 128 tipc_conn_msg_event conn_message_cb,
129 tipc_continue_event continue_event_cb,/* May be zero */ 129 tipc_continue_event continue_event_cb,
130 u32 *portref); 130 u32 *portref);
131 131
132int tipc_deleteport(u32 portref); 132int tipc_deleteport(u32 portref);
@@ -145,13 +145,13 @@ int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
145int tipc_publish(u32 portref, unsigned int scope, 145int tipc_publish(u32 portref, unsigned int scope,
146 struct tipc_name_seq const *name_seq); 146 struct tipc_name_seq const *name_seq);
147int tipc_withdraw(u32 portref, unsigned int scope, 147int tipc_withdraw(u32 portref, unsigned int scope,
148 struct tipc_name_seq const *name_seq); /* 0: all */ 148 struct tipc_name_seq const *name_seq);
149 149
150int tipc_connect2port(u32 portref, struct tipc_portid const *port); 150int tipc_connect2port(u32 portref, struct tipc_portid const *port);
151 151
152int tipc_disconnect(u32 portref); 152int tipc_disconnect(u32 portref);
153 153
154int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */ 154int tipc_shutdown(u32 ref);
155 155
156int tipc_isconnected(u32 portref, int *isconnected); 156int tipc_isconnected(u32 portref, int *isconnected);
157 157
@@ -176,7 +176,7 @@ int tipc_send_buf(u32 portref,
176 176
177int tipc_send2name(u32 portref, 177int tipc_send2name(u32 portref,
178 struct tipc_name const *name, 178 struct tipc_name const *name,
179 u32 domain, /* 0:own zone */ 179 u32 domain,
180 unsigned int num_sect, 180 unsigned int num_sect,
181 struct iovec const *msg_sect); 181 struct iovec const *msg_sect);
182 182
@@ -188,7 +188,7 @@ int tipc_send_buf2name(u32 portref,
188 188
189int tipc_forward2name(u32 portref, 189int tipc_forward2name(u32 portref,
190 struct tipc_name const *name, 190 struct tipc_name const *name,
191 u32 domain, /*0: own zone */ 191 u32 domain,
192 unsigned int section_count, 192 unsigned int section_count,
193 struct iovec const *msg_sect, 193 struct iovec const *msg_sect,
194 struct tipc_portid const *origin, 194 struct tipc_portid const *origin,
@@ -228,14 +228,14 @@ int tipc_forward_buf2port(u32 portref,
228 228
229int tipc_multicast(u32 portref, 229int tipc_multicast(u32 portref,
230 struct tipc_name_seq const *seq, 230 struct tipc_name_seq const *seq,
231 u32 domain, /* 0:own zone */ 231 u32 domain, /* currently unused */
232 unsigned int section_count, 232 unsigned int section_count,
233 struct iovec const *msg); 233 struct iovec const *msg);
234 234
235#if 0 235#if 0
236int tipc_multicast_buf(u32 portref, 236int tipc_multicast_buf(u32 portref,
237 struct tipc_name_seq const *seq, 237 struct tipc_name_seq const *seq,
238 u32 domain, /* 0:own zone */ 238 u32 domain,
239 void *buf, 239 void *buf,
240 unsigned int size); 240 unsigned int size);
241#endif 241#endif
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index d65381cad0fc..42a0eb68b7b6 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,8 @@ extern int datagram_send_ctl(struct net *net,
44 struct msghdr *msg, 44 struct msghdr *msg,
45 struct flowi *fl, 45 struct flowi *fl,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass); 47 int *hlimit, int *tclass,
48 int *dontfrag);
48 49
49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) 50#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 51
diff --git a/include/net/x25.h b/include/net/x25.h
index 468551ea4f1d..1479cb4a41fc 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -80,8 +80,6 @@ enum {
80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ 80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */
81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ 81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */
82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ 82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */
83#define X25_DENY_ACCPT_APPRV 0x01 /* Default value */
84#define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */
85 83
86#define X25_SMODULUS 8 84#define X25_SMODULUS 8
87#define X25_EMODULUS 128 85#define X25_EMODULUS 128
@@ -113,6 +111,11 @@ enum {
113#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ 111#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
114#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ 112#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
115 113
114/* Bitset in x25_sock->flags for misc flags */
115#define X25_Q_BIT_FLAG 0
116#define X25_INTERRUPT_FLAG 1
117#define X25_ACCPT_APPRV_FLAG 2
118
116/** 119/**
117 * struct x25_route - x25 routing entry 120 * struct x25_route - x25 routing entry
118 * @node - entry in x25_list_lock 121 * @node - entry in x25_list_lock
@@ -146,10 +149,11 @@ struct x25_sock {
146 struct x25_address source_addr, dest_addr; 149 struct x25_address source_addr, dest_addr;
147 struct x25_neigh *neighbour; 150 struct x25_neigh *neighbour;
148 unsigned int lci, cudmatchlength; 151 unsigned int lci, cudmatchlength;
149 unsigned char state, condition, qbitincl, intflag, accptapprv; 152 unsigned char state, condition;
150 unsigned short vs, vr, va, vl; 153 unsigned short vs, vr, va, vl;
151 unsigned long t2, t21, t22, t23; 154 unsigned long t2, t21, t22, t23;
152 unsigned short fraglen; 155 unsigned short fraglen;
156 unsigned long flags;
153 struct sk_buff_head ack_queue; 157 struct sk_buff_head ack_queue;
154 struct sk_buff_head fragment_queue; 158 struct sk_buff_head fragment_queue;
155 struct sk_buff_head interrupt_in_queue; 159 struct sk_buff_head interrupt_in_queue;
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1415bcf93980..1fa08b49f1c2 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/if_ether.h> 4#include <linux/if_ether.h>
5#include <linux/if_packet.h> 5#include <linux/if_packet.h>
6#include <linux/if_x25.h>
6#include <linux/skbuff.h> 7#include <linux/skbuff.h>
7 8
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 9static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ac52f33f3e4a..1913af67c43d 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -20,6 +20,7 @@
20#include <net/route.h> 20#include <net/route.h>
21#include <net/ipv6.h> 21#include <net/ipv6.h>
22#include <net/ip6_fib.h> 22#include <net/ip6_fib.h>
23#include <net/flow.h>
23 24
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
25 26
@@ -267,7 +268,6 @@ struct xfrm_policy_afinfo {
267 xfrm_address_t *saddr, 268 xfrm_address_t *saddr,
268 xfrm_address_t *daddr); 269 xfrm_address_t *daddr);
269 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); 270 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
270 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
271 void (*decode_session)(struct sk_buff *skb, 271 void (*decode_session)(struct sk_buff *skb,
272 struct flowi *fl, 272 struct flowi *fl,
273 int reverse); 273 int reverse);
@@ -482,13 +482,14 @@ struct xfrm_policy {
482 atomic_t refcnt; 482 atomic_t refcnt;
483 struct timer_list timer; 483 struct timer_list timer;
484 484
485 struct flow_cache_object flo;
486 atomic_t genid;
485 u32 priority; 487 u32 priority;
486 u32 index; 488 u32 index;
487 struct xfrm_mark mark; 489 struct xfrm_mark mark;
488 struct xfrm_selector selector; 490 struct xfrm_selector selector;
489 struct xfrm_lifetime_cfg lft; 491 struct xfrm_lifetime_cfg lft;
490 struct xfrm_lifetime_cur curlft; 492 struct xfrm_lifetime_cur curlft;
491 struct dst_entry *bundles;
492 struct xfrm_policy_walk_entry walk; 493 struct xfrm_policy_walk_entry walk;
493 u8 type; 494 u8 type;
494 u8 action; 495 u8 action;
@@ -735,19 +736,12 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy)
735 xfrm_policy_destroy(policy); 736 xfrm_policy_destroy(policy);
736} 737}
737 738
738#ifdef CONFIG_XFRM_SUB_POLICY
739static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) 739static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
740{ 740{
741 int i; 741 int i;
742 for (i = npols - 1; i >= 0; --i) 742 for (i = npols - 1; i >= 0; --i)
743 xfrm_pol_put(pols[i]); 743 xfrm_pol_put(pols[i]);
744} 744}
745#else
746static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
747{
748 xfrm_pol_put(pols[0]);
749}
750#endif
751 745
752extern void __xfrm_state_destroy(struct xfrm_state *); 746extern void __xfrm_state_destroy(struct xfrm_state *);
753 747
@@ -878,11 +872,15 @@ struct xfrm_dst {
878 struct rt6_info rt6; 872 struct rt6_info rt6;
879 } u; 873 } u;
880 struct dst_entry *route; 874 struct dst_entry *route;
875 struct flow_cache_object flo;
876 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
877 int num_pols, num_xfrms;
881#ifdef CONFIG_XFRM_SUB_POLICY 878#ifdef CONFIG_XFRM_SUB_POLICY
882 struct flowi *origin; 879 struct flowi *origin;
883 struct xfrm_selector *partner; 880 struct xfrm_selector *partner;
884#endif 881#endif
885 u32 genid; 882 u32 xfrm_genid;
883 u32 policy_genid;
886 u32 route_mtu_cached; 884 u32 route_mtu_cached;
887 u32 child_mtu_cached; 885 u32 child_mtu_cached;
888 u32 route_cookie; 886 u32 route_cookie;
@@ -892,6 +890,7 @@ struct xfrm_dst {
892#ifdef CONFIG_XFRM 890#ifdef CONFIG_XFRM
893static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) 891static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
894{ 892{
893 xfrm_pols_put(xdst->pols, xdst->num_pols);
895 dst_release(xdst->route); 894 dst_release(xdst->route);
896 if (likely(xdst->u.dst.xfrm)) 895 if (likely(xdst->u.dst.xfrm))
897 xfrm_state_put(xdst->u.dst.xfrm); 896 xfrm_state_put(xdst->u.dst.xfrm);