aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:08:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:08:52 -0400
commit73287a43cc79ca06629a88d1a199cd283f42456a (patch)
treeacf4456e260115bea77ee31a29f10ce17f0db45c /include/net
parent251df49db3327c64bf917bfdba94491fde2b4ee0 (diff)
parent20074f357da4a637430aec2879c9d864c5d2c23c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Highlights (1721 non-merge commits, this has to be a record of some sort): 1) Add 'random' mode to team driver, from Jiri Pirko and Eric Dumazet. 2) Make it so that any driver that supports configuration of multiple MAC addresses can provide the forwarding database add and del calls by providing a default implementation and hooking that up if the driver doesn't have an explicit set of handlers. From Vlad Yasevich. 3) Support GSO segmentation over tunnels and other encapsulating devices such as VXLAN, from Pravin B Shelar. 4) Support L2 GRE tunnels in the flow dissector, from Michael Dalton. 5) Implement Tail Loss Probe (TLP) detection in TCP, from Nandita Dukkipati. 6) In the PHY layer, allow supporting wake-on-lan in situations where the PHY registers have to be written for it to be configured. Use it to support wake-on-lan in mv643xx_eth. From Michael Stapelberg. 7) Significantly improve firewire IPV6 support, from YOSHIFUJI Hideaki. 8) Allow multiple packets to be sent in a single transmission using network coding in batman-adv, from Martin Hundebøll. 9) Add support for T5 cxgb4 chips, from Santosh Rastapur. 10) Generalize the VXLAN forwarding tables so that there is more flexibility in configurating various aspects of the endpoints. From David Stevens. 11) Support RSS and TSO in hardware over GRE tunnels in bxn2x driver, from Dmitry Kravkov. 12) Zero copy support in nfnelink_queue, from Eric Dumazet and Pablo Neira Ayuso. 13) Start adding networking selftests. 14) In situations of overload on the same AF_PACKET fanout socket, or per-cpu packet receive queue, minimize drop by distributing the load to other cpus/fanouts. From Willem de Bruijn and Eric Dumazet. 15) Add support for new payload offset BPF instruction, from Daniel Borkmann. 16) Convert several drivers over to mdoule_platform_driver(), from Sachin Kamat. 17) Provide a minimal BPF JIT image disassembler userspace tool, from Daniel Borkmann. 18) Rewrite F-RTO implementation in TCP to match the final specification of it in RFC4138 and RFC5682. From Yuchung Cheng. 19) Provide netlink socket diag of netlink sockets ("Yo dawg, I hear you like netlink, so I implemented netlink dumping of netlink sockets.") From Andrey Vagin. 20) Remove ugly passing of rtnetlink attributes into rtnl_doit functions, from Thomas Graf. 21) Allow userspace to be able to see if a configuration change occurs in the middle of an address or device list dump, from Nicolas Dichtel. 22) Support RFC3168 ECN protection for ipv6 fragments, from Hannes Frederic Sowa. 23) Increase accuracy of packet length used by packet scheduler, from Jason Wang. 24) Beginning set of changes to make ipv4/ipv6 fragment handling more scalable and less susceptible to overload and locking contention, from Jesper Dangaard Brouer. 25) Get rid of using non-type-safe NLMSG_* macros and use nlmsg_*() instead. From Hong Zhiguo. 26) Optimize route usage in IPVS by avoiding reference counting where possible, from Julian Anastasov. 27) Convert IPVS schedulers to RCU, also from Julian Anastasov. 28) Support cpu fanouts in xt_NFQUEUE netfilter target, from Holger Eitzenberger. 29) Network namespace support for nf_log, ebt_log, xt_LOG, ipt_ULOG, nfnetlink_log, and nfnetlink_queue. From Gao feng. 30) Implement RFC3168 ECN protection, from Hannes Frederic Sowa. 31) Support several new r8169 chips, from Hayes Wang. 32) Support tokenized interface identifiers in ipv6, from Daniel Borkmann. 33) Use usbnet_link_change() helper in USB net driver, from Ming Lei. 34) Add 802.1ad vlan offload support, from Patrick McHardy. 35) Support mmap() based netlink communication, also from Patrick McHardy. 36) Support HW timestamping in mlx4 driver, from Amir Vadai. 37) Rationalize AF_PACKET packet timestamping when transmitting, from Willem de Bruijn and Daniel Borkmann. 38) Bring parity to what's provided by /proc/net/packet socket dumping and the info provided by netlink socket dumping of AF_PACKET sockets. From Nicolas Dichtel. 39) Fix peeking beyond zero sized SKBs in AF_UNIX, from Benjamin Poirier" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1722 commits) filter: fix va_list build error af_unix: fix a fatal race with bit fields bnx2x: Prevent memory leak when cnic is absent bnx2x: correct reading of speed capabilities net: sctp: attribute printl with __printf for gcc fmt checks netlink: kconfig: move mmap i/o into netlink kconfig netpoll: convert mutex into a semaphore netlink: Fix skb ref counting. net_sched: act_ipt forward compat with xtables mlx4_en: fix a build error on 32bit arches Revert "bnx2x: allow nvram test to run when device is down" bridge: avoid OOPS if root port not found drivers: net: cpsw: fix kernel warn on cpsw irq enable sh_eth: use random MAC address if no valid one supplied 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA) tg3: fix to append hardware time stamping flags unix/stream: fix peeking with an offset larger than data in queue unix/dgram: fix peeking with an offset larger than data in queue unix/dgram: peek beyond 0-sized skbs openvswitch: Remove unneeded ovs_netdev_get_ifindex() ...
Diffstat (limited to 'include/net')
-rw-r--r--include/net/af_unix.h8
-rw-r--r--include/net/bluetooth/bluetooth.h17
-rw-r--r--include/net/bluetooth/hci.h30
-rw-r--r--include/net/bluetooth/hci_core.h128
-rw-r--r--include/net/bluetooth/l2cap.h15
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/caif/caif_dev.h2
-rw-r--r--include/net/caif/caif_device.h2
-rw-r--r--include/net/caif/caif_hsi.h1
-rw-r--r--include/net/caif/caif_layer.h2
-rw-r--r--include/net/caif/caif_shm.h26
-rw-r--r--include/net/caif/cfcnfg.h2
-rw-r--r--include/net/caif/cfctrl.h2
-rw-r--r--include/net/caif/cffrml.h2
-rw-r--r--include/net/caif/cfmuxl.h2
-rw-r--r--include/net/caif/cfpkt.h2
-rw-r--r--include/net/caif/cfserl.h2
-rw-r--r--include/net/caif/cfsrvl.h2
-rw-r--r--include/net/cfg80211.h164
-rw-r--r--include/net/cls_cgroup.h4
-rw-r--r--include/net/dn_fib.h28
-rw-r--r--include/net/firewire.h25
-rw-r--r--include/net/genetlink.h1
-rw-r--r--include/net/gre.h51
-rw-r--r--include/net/ieee802154_netdev.h5
-rw-r--r--include/net/if_inet6.h4
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_frag.h24
-rw-r--r--include/net/ip6_tunnel.h21
-rw-r--r--include/net/ip_tunnels.h177
-rw-r--r--include/net/ip_vs.h140
-rw-r--r--include/net/ipip.h87
-rw-r--r--include/net/ipv6.h22
-rw-r--r--include/net/mac80211.h224
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netfilter/nf_conntrack_core.h1
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h4
-rw-r--r--include/net/netfilter/nf_log.h14
-rw-r--r--include/net/netfilter/nf_queue.h6
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/netns/netfilter.h18
-rw-r--r--include/net/netprio_cgroup.h4
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/request_sock.h10
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/scm.h16
-rw-r--r--include/net/sctp/checksum.h2
-rw-r--r--include/net/sctp/constants.h1
-rw-r--r--include/net/sctp/structs.h20
-rw-r--r--include/net/sctp/ulpqueue.h1
-rw-r--r--include/net/sctp/user.h782
-rw-r--r--include/net/secure_seq.h1
-rw-r--r--include/net/sock.h6
-rw-r--r--include/net/tcp.h146
-rw-r--r--include/net/xfrm.h1
56 files changed, 965 insertions, 1310 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 0a996a3517ed..dbdfd2b0f3b3 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -29,7 +29,8 @@ struct unix_address {
29 29
30struct unix_skb_parms { 30struct unix_skb_parms {
31 struct pid *pid; /* Skb credentials */ 31 struct pid *pid; /* Skb credentials */
32 const struct cred *cred; 32 kuid_t uid;
33 kgid_t gid;
33 struct scm_fp_list *fp; /* Passed files */ 34 struct scm_fp_list *fp; /* Passed files */
34#ifdef CONFIG_SECURITY_NETWORK 35#ifdef CONFIG_SECURITY_NETWORK
35 u32 secid; /* Security ID */ 36 u32 secid; /* Security ID */
@@ -56,9 +57,10 @@ struct unix_sock {
56 struct list_head link; 57 struct list_head link;
57 atomic_long_t inflight; 58 atomic_long_t inflight;
58 spinlock_t lock; 59 spinlock_t lock;
59 unsigned int gc_candidate : 1;
60 unsigned int gc_maybe_cycle : 1;
61 unsigned char recursion_level; 60 unsigned char recursion_level;
61 unsigned long gc_flags;
62#define UNIX_GC_CANDIDATE 0
63#define UNIX_GC_MAYBE_CYCLE 1
62 struct socket_wq peer_wq; 64 struct socket_wq peer_wq;
63}; 65};
64#define unix_sk(__sk) ((struct unix_sock *)__sk) 66#define unix_sk(__sk) ((struct unix_sock *)__sk)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 9531beee09b5..6912ef9a1881 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -193,11 +193,11 @@ static inline bool bdaddr_type_is_le(__u8 type)
193#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) 193#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })
194 194
195/* Copy, swap, convert BD Address */ 195/* Copy, swap, convert BD Address */
196static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) 196static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
197{ 197{
198 return memcmp(ba1, ba2, sizeof(bdaddr_t)); 198 return memcmp(ba1, ba2, sizeof(bdaddr_t));
199} 199}
200static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) 200static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
201{ 201{
202 memcpy(dst, src, sizeof(bdaddr_t)); 202 memcpy(dst, src, sizeof(bdaddr_t));
203} 203}
@@ -232,7 +232,7 @@ struct bt_sock_list {
232}; 232};
233 233
234int bt_sock_register(int proto, const struct net_proto_family *ops); 234int bt_sock_register(int proto, const struct net_proto_family *ops);
235int bt_sock_unregister(int proto); 235void bt_sock_unregister(int proto);
236void bt_sock_link(struct bt_sock_list *l, struct sock *s); 236void bt_sock_link(struct bt_sock_list *l, struct sock *s);
237void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 237void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
238int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, 238int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
@@ -260,12 +260,23 @@ struct l2cap_ctrl {
260 __u8 retries; 260 __u8 retries;
261}; 261};
262 262
263struct hci_dev;
264
265typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status);
266
267struct hci_req_ctrl {
268 bool start;
269 u8 event;
270 hci_req_complete_t complete;
271};
272
263struct bt_skb_cb { 273struct bt_skb_cb {
264 __u8 pkt_type; 274 __u8 pkt_type;
265 __u8 incoming; 275 __u8 incoming;
266 __u16 expect; 276 __u16 expect;
267 __u8 force_active; 277 __u8 force_active;
268 struct l2cap_ctrl control; 278 struct l2cap_ctrl control;
279 struct hci_req_ctrl req;
269}; 280};
270#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 281#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
271 282
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 7f12c25f1fca..e0512aaef4b8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -119,10 +119,16 @@ enum {
119 HCI_CONNECTABLE, 119 HCI_CONNECTABLE,
120 HCI_DISCOVERABLE, 120 HCI_DISCOVERABLE,
121 HCI_LINK_SECURITY, 121 HCI_LINK_SECURITY,
122 HCI_PENDING_CLASS,
123 HCI_PERIODIC_INQ, 122 HCI_PERIODIC_INQ,
123 HCI_FAST_CONNECTABLE,
124}; 124};
125 125
126/* A mask for the flags that are supposed to remain when a reset happens
127 * or the HCI device is closed.
128 */
129#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
130 BIT(HCI_FAST_CONNECTABLE))
131
126/* HCI ioctl defines */ 132/* HCI ioctl defines */
127#define HCIDEVUP _IOW('H', 201, int) 133#define HCIDEVUP _IOW('H', 201, int)
128#define HCIDEVDOWN _IOW('H', 202, int) 134#define HCIDEVDOWN _IOW('H', 202, int)
@@ -881,12 +887,25 @@ struct hci_rp_read_data_block_size {
881 __le16 num_blocks; 887 __le16 num_blocks;
882} __packed; 888} __packed;
883 889
890#define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b
891struct hci_rp_read_page_scan_activity {
892 __u8 status;
893 __le16 interval;
894 __le16 window;
895} __packed;
896
884#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 897#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
885struct hci_cp_write_page_scan_activity { 898struct hci_cp_write_page_scan_activity {
886 __le16 interval; 899 __le16 interval;
887 __le16 window; 900 __le16 window;
888} __packed; 901} __packed;
889 902
903#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46
904struct hci_rp_read_page_scan_type {
905 __u8 status;
906 __u8 type;
907} __packed;
908
890#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 909#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
891 #define PAGE_SCAN_TYPE_STANDARD 0x00 910 #define PAGE_SCAN_TYPE_STANDARD 0x00
892 #define PAGE_SCAN_TYPE_INTERLACED 0x01 911 #define PAGE_SCAN_TYPE_INTERLACED 0x01
@@ -965,6 +984,9 @@ struct hci_cp_le_set_adv_data {
965 984
966#define HCI_OP_LE_SET_ADV_ENABLE 0x200a 985#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
967 986
987#define LE_SCAN_PASSIVE 0x00
988#define LE_SCAN_ACTIVE 0x01
989
968#define HCI_OP_LE_SET_SCAN_PARAM 0x200b 990#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
969struct hci_cp_le_set_scan_param { 991struct hci_cp_le_set_scan_param {
970 __u8 type; 992 __u8 type;
@@ -974,8 +996,10 @@ struct hci_cp_le_set_scan_param {
974 __u8 filter_policy; 996 __u8 filter_policy;
975} __packed; 997} __packed;
976 998
977#define LE_SCANNING_DISABLED 0x00 999#define LE_SCAN_DISABLE 0x00
978#define LE_SCANNING_ENABLED 0x01 1000#define LE_SCAN_ENABLE 0x01
1001#define LE_SCAN_FILTER_DUP_DISABLE 0x00
1002#define LE_SCAN_FILTER_DUP_ENABLE 0x01
979 1003
980#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 1004#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
981struct hci_cp_le_set_scan_enable { 1005struct hci_cp_le_set_scan_enable {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 90cf75afcb02..35a57cd1704c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -134,6 +134,8 @@ struct amp_assoc {
134 __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; 134 __u8 data[HCI_MAX_AMP_ASSOC_SIZE];
135}; 135};
136 136
137#define HCI_MAX_PAGES 3
138
137#define NUM_REASSEMBLY 4 139#define NUM_REASSEMBLY 4
138struct hci_dev { 140struct hci_dev {
139 struct list_head list; 141 struct list_head list;
@@ -151,8 +153,8 @@ struct hci_dev {
151 __u8 dev_class[3]; 153 __u8 dev_class[3];
152 __u8 major_class; 154 __u8 major_class;
153 __u8 minor_class; 155 __u8 minor_class;
154 __u8 features[8]; 156 __u8 max_page;
155 __u8 host_features[8]; 157 __u8 features[HCI_MAX_PAGES][8];
156 __u8 le_features[8]; 158 __u8 le_features[8];
157 __u8 le_white_list_size; 159 __u8 le_white_list_size;
158 __u8 le_states[8]; 160 __u8 le_states[8];
@@ -165,6 +167,10 @@ struct hci_dev {
165 __u16 voice_setting; 167 __u16 voice_setting;
166 __u8 io_capability; 168 __u8 io_capability;
167 __s8 inq_tx_power; 169 __s8 inq_tx_power;
170 __u16 page_scan_interval;
171 __u16 page_scan_window;
172 __u8 page_scan_type;
173
168 __u16 devid_source; 174 __u16 devid_source;
169 __u16 devid_vendor; 175 __u16 devid_vendor;
170 __u16 devid_product; 176 __u16 devid_product;
@@ -240,6 +246,7 @@ struct hci_dev {
240 struct sk_buff_head raw_q; 246 struct sk_buff_head raw_q;
241 struct sk_buff_head cmd_q; 247 struct sk_buff_head cmd_q;
242 248
249 struct sk_buff *recv_evt;
243 struct sk_buff *sent_cmd; 250 struct sk_buff *sent_cmd;
244 struct sk_buff *reassembly[NUM_REASSEMBLY]; 251 struct sk_buff *reassembly[NUM_REASSEMBLY];
245 252
@@ -248,8 +255,6 @@ struct hci_dev {
248 __u32 req_status; 255 __u32 req_status;
249 __u32 req_result; 256 __u32 req_result;
250 257
251 __u16 init_last_cmd;
252
253 struct list_head mgmt_pending; 258 struct list_head mgmt_pending;
254 259
255 struct discovery_state discovery; 260 struct discovery_state discovery;
@@ -266,8 +271,6 @@ struct hci_dev {
266 271
267 struct hci_dev_stats stat; 272 struct hci_dev_stats stat;
268 273
269 struct sk_buff_head driver_init;
270
271 atomic_t promisc; 274 atomic_t promisc;
272 275
273 struct dentry *debugfs; 276 struct dentry *debugfs;
@@ -290,6 +293,7 @@ struct hci_dev {
290 int (*open)(struct hci_dev *hdev); 293 int (*open)(struct hci_dev *hdev);
291 int (*close)(struct hci_dev *hdev); 294 int (*close)(struct hci_dev *hdev);
292 int (*flush)(struct hci_dev *hdev); 295 int (*flush)(struct hci_dev *hdev);
296 int (*setup)(struct hci_dev *hdev);
293 int (*send)(struct sk_buff *skb); 297 int (*send)(struct sk_buff *skb);
294 void (*notify)(struct hci_dev *hdev, unsigned int evt); 298 void (*notify)(struct hci_dev *hdev, unsigned int evt);
295 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 299 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
@@ -311,7 +315,7 @@ struct hci_conn {
311 bool out; 315 bool out;
312 __u8 attempt; 316 __u8 attempt;
313 __u8 dev_class[3]; 317 __u8 dev_class[3];
314 __u8 features[8]; 318 __u8 features[HCI_MAX_PAGES][8];
315 __u16 interval; 319 __u16 interval;
316 __u16 pkt_type; 320 __u16 pkt_type;
317 __u16 link_policy; 321 __u16 link_policy;
@@ -343,7 +347,6 @@ struct hci_conn {
343 struct timer_list auto_accept_timer; 347 struct timer_list auto_accept_timer;
344 348
345 struct device dev; 349 struct device dev;
346 atomic_t devref;
347 350
348 struct hci_dev *hdev; 351 struct hci_dev *hdev;
349 void *l2cap_data; 352 void *l2cap_data;
@@ -574,7 +577,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
574 return NULL; 577 return NULL;
575} 578}
576 579
577void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 580void hci_disconnect(struct hci_conn *conn, __u8 reason);
578void hci_setup_sync(struct hci_conn *conn, __u16 handle); 581void hci_setup_sync(struct hci_conn *conn, __u16 handle);
579void hci_sco_setup(struct hci_conn *conn, __u8 status); 582void hci_sco_setup(struct hci_conn *conn, __u8 status);
580 583
@@ -582,7 +585,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
582int hci_conn_del(struct hci_conn *conn); 585int hci_conn_del(struct hci_conn *conn);
583void hci_conn_hash_flush(struct hci_dev *hdev); 586void hci_conn_hash_flush(struct hci_dev *hdev);
584void hci_conn_check_pending(struct hci_dev *hdev); 587void hci_conn_check_pending(struct hci_dev *hdev);
585void hci_conn_accept(struct hci_conn *conn, int mask);
586 588
587struct hci_chan *hci_chan_create(struct hci_conn *conn); 589struct hci_chan *hci_chan_create(struct hci_conn *conn);
588void hci_chan_del(struct hci_chan *chan); 590void hci_chan_del(struct hci_chan *chan);
@@ -599,8 +601,36 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
599 601
600void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 602void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
601 603
602void hci_conn_hold_device(struct hci_conn *conn); 604/*
603void hci_conn_put_device(struct hci_conn *conn); 605 * hci_conn_get() and hci_conn_put() are used to control the life-time of an
606 * "hci_conn" object. They do not guarantee that the hci_conn object is running,
607 * working or anything else. They just guarantee that the object is available
608 * and can be dereferenced. So you can use its locks, local variables and any
609 * other constant data.
610 * Before accessing runtime data, you _must_ lock the object and then check that
611 * it is still running. As soon as you release the locks, the connection might
612 * get dropped, though.
613 *
614 * On the other hand, hci_conn_hold() and hci_conn_drop() are used to control
615 * how long the underlying connection is held. So every channel that runs on the
616 * hci_conn object calls this to prevent the connection from disappearing. As
617 * long as you hold a device, you must also guarantee that you have a valid
618 * reference to the device via hci_conn_get() (or the initial reference from
619 * hci_conn_add()).
620 * The hold()/drop() ref-count is known to drop below 0 sometimes, which doesn't
621 * break because nobody cares for that. But this means, we cannot use
622 * _get()/_drop() in it, but require the caller to have a valid ref (FIXME).
623 */
624
625static inline void hci_conn_get(struct hci_conn *conn)
626{
627 get_device(&conn->dev);
628}
629
630static inline void hci_conn_put(struct hci_conn *conn)
631{
632 put_device(&conn->dev);
633}
604 634
605static inline void hci_conn_hold(struct hci_conn *conn) 635static inline void hci_conn_hold(struct hci_conn *conn)
606{ 636{
@@ -610,7 +640,7 @@ static inline void hci_conn_hold(struct hci_conn *conn)
610 cancel_delayed_work(&conn->disc_work); 640 cancel_delayed_work(&conn->disc_work);
611} 641}
612 642
613static inline void hci_conn_put(struct hci_conn *conn) 643static inline void hci_conn_drop(struct hci_conn *conn)
614{ 644{
615 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt)); 645 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt));
616 646
@@ -742,8 +772,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
742 u8 *randomizer); 772 u8 *randomizer);
743int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 773int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
744 774
745int hci_update_ad(struct hci_dev *hdev);
746
747void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 775void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
748 776
749int hci_recv_frame(struct sk_buff *skb); 777int hci_recv_frame(struct sk_buff *skb);
@@ -760,29 +788,29 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
760#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) 788#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
761 789
762/* ----- LMP capabilities ----- */ 790/* ----- LMP capabilities ----- */
763#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) 791#define lmp_encrypt_capable(dev) ((dev)->features[0][0] & LMP_ENCRYPT)
764#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) 792#define lmp_rswitch_capable(dev) ((dev)->features[0][0] & LMP_RSWITCH)
765#define lmp_hold_capable(dev) ((dev)->features[0] & LMP_HOLD) 793#define lmp_hold_capable(dev) ((dev)->features[0][0] & LMP_HOLD)
766#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) 794#define lmp_sniff_capable(dev) ((dev)->features[0][0] & LMP_SNIFF)
767#define lmp_park_capable(dev) ((dev)->features[1] & LMP_PARK) 795#define lmp_park_capable(dev) ((dev)->features[0][1] & LMP_PARK)
768#define lmp_inq_rssi_capable(dev) ((dev)->features[3] & LMP_RSSI_INQ) 796#define lmp_inq_rssi_capable(dev) ((dev)->features[0][3] & LMP_RSSI_INQ)
769#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 797#define lmp_esco_capable(dev) ((dev)->features[0][3] & LMP_ESCO)
770#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) 798#define lmp_bredr_capable(dev) (!((dev)->features[0][4] & LMP_NO_BREDR))
771#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 799#define lmp_le_capable(dev) ((dev)->features[0][4] & LMP_LE)
772#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 800#define lmp_sniffsubr_capable(dev) ((dev)->features[0][5] & LMP_SNIFF_SUBR)
773#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC) 801#define lmp_pause_enc_capable(dev) ((dev)->features[0][5] & LMP_PAUSE_ENC)
774#define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ) 802#define lmp_ext_inq_capable(dev) ((dev)->features[0][6] & LMP_EXT_INQ)
775#define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR) 803#define lmp_le_br_capable(dev) (!!((dev)->features[0][6] & LMP_SIMUL_LE_BR))
776#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 804#define lmp_ssp_capable(dev) ((dev)->features[0][6] & LMP_SIMPLE_PAIR)
777#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 805#define lmp_no_flush_capable(dev) ((dev)->features[0][6] & LMP_NO_FLUSH)
778#define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO) 806#define lmp_lsto_capable(dev) ((dev)->features[0][7] & LMP_LSTO)
779#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[7] & LMP_INQ_TX_PWR) 807#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[0][7] & LMP_INQ_TX_PWR)
780#define lmp_ext_feat_capable(dev) ((dev)->features[7] & LMP_EXTFEATURES) 808#define lmp_ext_feat_capable(dev) ((dev)->features[0][7] & LMP_EXTFEATURES)
781 809
782/* ----- Extended LMP capabilities ----- */ 810/* ----- Extended LMP capabilities ----- */
783#define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP) 811#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP)
784#define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE) 812#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
785#define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR) 813#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
786 814
787/* returns true if at least one AMP active */ 815/* returns true if at least one AMP active */
788static inline bool hci_amp_capable(void) 816static inline bool hci_amp_capable(void)
@@ -1041,7 +1069,31 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
1041int hci_register_cb(struct hci_cb *hcb); 1069int hci_register_cb(struct hci_cb *hcb);
1042int hci_unregister_cb(struct hci_cb *hcb); 1070int hci_unregister_cb(struct hci_cb *hcb);
1043 1071
1044int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 1072struct hci_request {
1073 struct hci_dev *hdev;
1074 struct sk_buff_head cmd_q;
1075
1076 /* If something goes wrong when building the HCI request, the error
1077 * value is stored in this field.
1078 */
1079 int err;
1080};
1081
1082void hci_req_init(struct hci_request *req, struct hci_dev *hdev);
1083int hci_req_run(struct hci_request *req, hci_req_complete_t complete);
1084void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
1085 const void *param);
1086void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1087 const void *param, u8 event);
1088void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1089
1090struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1091 const void *param, u32 timeout);
1092struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
1093 const void *param, u8 event, u32 timeout);
1094
1095int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
1096 const void *param);
1045void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); 1097void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
1046void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 1098void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
1047 1099
@@ -1153,7 +1205,7 @@ struct hci_sec_filter {
1153#define hci_req_lock(d) mutex_lock(&d->req_lock) 1205#define hci_req_lock(d) mutex_lock(&d->req_lock)
1154#define hci_req_unlock(d) mutex_unlock(&d->req_lock) 1206#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1155 1207
1156void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); 1208void hci_update_ad(struct hci_request *req);
1157 1209
1158void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1210void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1159 u16 latency, u16 to_multiplier); 1211 u16 latency, u16 to_multiplier);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index cdd33021f831..fb94cf13c777 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -583,6 +583,14 @@ struct l2cap_conn {
583 583
584 struct list_head chan_l; 584 struct list_head chan_l;
585 struct mutex chan_lock; 585 struct mutex chan_lock;
586 struct kref ref;
587 struct list_head users;
588};
589
590struct l2cap_user {
591 struct list_head list;
592 int (*probe) (struct l2cap_conn *conn, struct l2cap_user *user);
593 void (*remove) (struct l2cap_conn *conn, struct l2cap_user *user);
586}; 594};
587 595
588#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 596#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
@@ -786,6 +794,7 @@ extern bool disable_ertm;
786 794
787int l2cap_init_sockets(void); 795int l2cap_init_sockets(void);
788void l2cap_cleanup_sockets(void); 796void l2cap_cleanup_sockets(void);
797bool l2cap_is_socket(struct socket *sock);
789 798
790void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); 799void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
791int __l2cap_wait_ack(struct sock *sk); 800int __l2cap_wait_ack(struct sock *sk);
@@ -812,4 +821,10 @@ void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
812 u8 status); 821 u8 status);
813void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); 822void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
814 823
824void l2cap_conn_get(struct l2cap_conn *conn);
825void l2cap_conn_put(struct l2cap_conn *conn);
826
827int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
828void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user);
829
815#endif /* __L2CAP_H */ 830#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index e2e3ecad1008..7afd4199d6b6 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -158,7 +158,6 @@ struct rfcomm_session {
158 struct timer_list timer; 158 struct timer_list timer;
159 unsigned long state; 159 unsigned long state;
160 unsigned long flags; 160 unsigned long flags;
161 atomic_t refcnt;
162 int initiator; 161 int initiator;
163 162
164 /* Default DLC parameters */ 163 /* Default DLC parameters */
@@ -276,11 +275,6 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)
276void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, 275void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src,
277 bdaddr_t *dst); 276 bdaddr_t *dst);
278 277
279static inline void rfcomm_session_hold(struct rfcomm_session *s)
280{
281 atomic_inc(&s->refcnt);
282}
283
284/* ---- RFCOMM sockets ---- */ 278/* ---- RFCOMM sockets ---- */
285struct sockaddr_rc { 279struct sockaddr_rc {
286 sa_family_t rc_family; 280 sa_family_t rc_family;
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index ef2dd9438bb1..028b754ae9b1 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h
index d02f044adb8a..d6e3c4267c81 100644
--- a/include/net/caif/caif_device.h
+++ b/include/net/caif/caif_device.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index bcb9cc3ce98b..4795e817afe5 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * Author: Daniel Martensson / daniel.martensson@stericsson.com 3 * Author: Daniel Martensson / daniel.martensson@stericsson.com
5 * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com 4 * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com
6 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 0f3a39125f90..94e5ed64dc6d 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland / sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/caif_shm.h b/include/net/caif/caif_shm.h
deleted file mode 100644
index 5bcce55438cf..000000000000
--- a/include/net/caif/caif_shm.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * Author: Amarnath Revanna / amarnath.bangalore.revanna@stericsson.com
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef CAIF_SHM_H_
9#define CAIF_SHM_H_
10
11struct shmdev_layer {
12 u32 shm_base_addr;
13 u32 shm_total_sz;
14 u32 shm_id;
15 u32 shm_loopback;
16 void *hmbx;
17 int (*pshmdev_mbxsend) (u32 shm_id, u32 mbx_msg);
18 int (*pshmdev_mbxsetup) (void *pshmdrv_cb,
19 struct shmdev_layer *pshm_dev, void *pshm_drv);
20 struct net_device *pshm_netdev;
21};
22
23extern int caif_shmcore_probe(struct shmdev_layer *pshm_dev);
24extern void caif_shmcore_remove(struct net_device *pshm_netdev);
25
26#endif
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 90b4ff8bad83..70bfd017581f 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
index 9e5425b4a1d7..f2ae33d23baf 100644
--- a/include/net/caif/cfctrl.h
+++ b/include/net/caif/cfctrl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h
index afac1a48cce7..a06e33fbaa8b 100644
--- a/include/net/caif/cffrml.h
+++ b/include/net/caif/cffrml.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h
index 5847a196b8ad..752999572f21 100644
--- a/include/net/caif/cfmuxl.h
+++ b/include/net/caif/cfmuxl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
index 83a89ba3005b..1c1ad46250d5 100644
--- a/include/net/caif/cfpkt.h
+++ b/include/net/caif/cfpkt.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
index f121299a3427..b5b020f3c72e 100644
--- a/include/net/caif/cfserl.h
+++ b/include/net/caif/cfserl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index 0f5905241843..cd47705c2cc3 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d581c6de5d64..26b5b692c22b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -611,22 +611,10 @@ struct cfg80211_ap_settings {
611}; 611};
612 612
613/** 613/**
614 * enum plink_action - actions to perform in mesh peers
615 *
616 * @PLINK_ACTION_INVALID: action 0 is reserved
617 * @PLINK_ACTION_OPEN: start mesh peer link establishment
618 * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
619 */
620enum plink_actions {
621 PLINK_ACTION_INVALID,
622 PLINK_ACTION_OPEN,
623 PLINK_ACTION_BLOCK,
624};
625
626/**
627 * enum station_parameters_apply_mask - station parameter values to apply 614 * enum station_parameters_apply_mask - station parameter values to apply
628 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 615 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
629 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 616 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
617 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
630 * 618 *
631 * Not all station parameters have in-band "no change" signalling, 619 * Not all station parameters have in-band "no change" signalling,
632 * for those that don't these flags will are used. 620 * for those that don't these flags will are used.
@@ -634,6 +622,7 @@ enum plink_actions {
634enum station_parameters_apply_mask { 622enum station_parameters_apply_mask {
635 STATION_PARAM_APPLY_UAPSD = BIT(0), 623 STATION_PARAM_APPLY_UAPSD = BIT(0),
636 STATION_PARAM_APPLY_CAPABILITY = BIT(1), 624 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
625 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
637}; 626};
638 627
639/** 628/**
@@ -669,7 +658,7 @@ enum station_parameters_apply_mask {
669 * @ext_capab_len: number of extended capabilities 658 * @ext_capab_len: number of extended capabilities
670 */ 659 */
671struct station_parameters { 660struct station_parameters {
672 u8 *supported_rates; 661 const u8 *supported_rates;
673 struct net_device *vlan; 662 struct net_device *vlan;
674 u32 sta_flags_mask, sta_flags_set; 663 u32 sta_flags_mask, sta_flags_set;
675 u32 sta_modify_mask; 664 u32 sta_modify_mask;
@@ -678,17 +667,60 @@ struct station_parameters {
678 u8 supported_rates_len; 667 u8 supported_rates_len;
679 u8 plink_action; 668 u8 plink_action;
680 u8 plink_state; 669 u8 plink_state;
681 struct ieee80211_ht_cap *ht_capa; 670 const struct ieee80211_ht_cap *ht_capa;
682 struct ieee80211_vht_cap *vht_capa; 671 const struct ieee80211_vht_cap *vht_capa;
683 u8 uapsd_queues; 672 u8 uapsd_queues;
684 u8 max_sp; 673 u8 max_sp;
685 enum nl80211_mesh_power_mode local_pm; 674 enum nl80211_mesh_power_mode local_pm;
686 u16 capability; 675 u16 capability;
687 u8 *ext_capab; 676 const u8 *ext_capab;
688 u8 ext_capab_len; 677 u8 ext_capab_len;
689}; 678};
690 679
691/** 680/**
681 * enum cfg80211_station_type - the type of station being modified
682 * @CFG80211_STA_AP_CLIENT: client of an AP interface
683 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
684 * the AP MLME in the device
685 * @CFG80211_STA_AP_STA: AP station on managed interface
686 * @CFG80211_STA_IBSS: IBSS station
687 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
688 * while TDLS setup is in progress, it moves out of this state when
689 * being marked authorized; use this only if TDLS with external setup is
690 * supported/used)
691 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
692 * entry that is operating, has been marked authorized by userspace)
693 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
694 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
695 */
696enum cfg80211_station_type {
697 CFG80211_STA_AP_CLIENT,
698 CFG80211_STA_AP_MLME_CLIENT,
699 CFG80211_STA_AP_STA,
700 CFG80211_STA_IBSS,
701 CFG80211_STA_TDLS_PEER_SETUP,
702 CFG80211_STA_TDLS_PEER_ACTIVE,
703 CFG80211_STA_MESH_PEER_KERNEL,
704 CFG80211_STA_MESH_PEER_USER,
705};
706
707/**
708 * cfg80211_check_station_change - validate parameter changes
709 * @wiphy: the wiphy this operates on
710 * @params: the new parameters for a station
711 * @statype: the type of station being modified
712 *
713 * Utility function for the @change_station driver method. Call this function
714 * with the appropriate station type looking up the station (and checking that
715 * it exists). It will verify whether the station change is acceptable, and if
716 * not will return an error code. Note that it may modify the parameters for
717 * backward compatibility reasons, so don't use them before calling this.
718 */
719int cfg80211_check_station_change(struct wiphy *wiphy,
720 struct station_parameters *params,
721 enum cfg80211_station_type statype);
722
723/**
692 * enum station_info_flags - station information flags 724 * enum station_info_flags - station information flags
693 * 725 *
694 * Used by the driver to indicate which info in &struct station_info 726 * Used by the driver to indicate which info in &struct station_info
@@ -1119,6 +1151,7 @@ struct mesh_config {
1119 * @ie_len: length of vendor information elements 1151 * @ie_len: length of vendor information elements
1120 * @is_authenticated: this mesh requires authentication 1152 * @is_authenticated: this mesh requires authentication
1121 * @is_secure: this mesh uses security 1153 * @is_secure: this mesh uses security
1154 * @user_mpm: userspace handles all MPM functions
1122 * @dtim_period: DTIM period to use 1155 * @dtim_period: DTIM period to use
1123 * @beacon_interval: beacon interval to use 1156 * @beacon_interval: beacon interval to use
1124 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1157 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
@@ -1136,6 +1169,7 @@ struct mesh_setup {
1136 u8 ie_len; 1169 u8 ie_len;
1137 bool is_authenticated; 1170 bool is_authenticated;
1138 bool is_secure; 1171 bool is_secure;
1172 bool user_mpm;
1139 u8 dtim_period; 1173 u8 dtim_period;
1140 u16 beacon_interval; 1174 u16 beacon_interval;
1141 int mcast_rate[IEEE80211_NUM_BANDS]; 1175 int mcast_rate[IEEE80211_NUM_BANDS];
@@ -1398,9 +1432,11 @@ struct cfg80211_auth_request {
1398 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 1432 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
1399 * 1433 *
1400 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1434 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
1435 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
1401 */ 1436 */
1402enum cfg80211_assoc_req_flags { 1437enum cfg80211_assoc_req_flags {
1403 ASSOC_REQ_DISABLE_HT = BIT(0), 1438 ASSOC_REQ_DISABLE_HT = BIT(0),
1439 ASSOC_REQ_DISABLE_VHT = BIT(1),
1404}; 1440};
1405 1441
1406/** 1442/**
@@ -1422,6 +1458,8 @@ enum cfg80211_assoc_req_flags {
1422 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1458 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1423 * will be used in ht_capa. Un-supported values will be ignored. 1459 * will be used in ht_capa. Un-supported values will be ignored.
1424 * @ht_capa_mask: The bits of ht_capa which are to be used. 1460 * @ht_capa_mask: The bits of ht_capa which are to be used.
1461 * @vht_capa: VHT capability override
1462 * @vht_capa_mask: VHT capability mask indicating which fields to use
1425 */ 1463 */
1426struct cfg80211_assoc_request { 1464struct cfg80211_assoc_request {
1427 struct cfg80211_bss *bss; 1465 struct cfg80211_bss *bss;
@@ -1432,6 +1470,7 @@ struct cfg80211_assoc_request {
1432 u32 flags; 1470 u32 flags;
1433 struct ieee80211_ht_cap ht_capa; 1471 struct ieee80211_ht_cap ht_capa;
1434 struct ieee80211_ht_cap ht_capa_mask; 1472 struct ieee80211_ht_cap ht_capa_mask;
1473 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1435}; 1474};
1436 1475
1437/** 1476/**
@@ -1542,6 +1581,8 @@ struct cfg80211_ibss_params {
1542 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1581 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1543 * will be used in ht_capa. Un-supported values will be ignored. 1582 * will be used in ht_capa. Un-supported values will be ignored.
1544 * @ht_capa_mask: The bits of ht_capa which are to be used. 1583 * @ht_capa_mask: The bits of ht_capa which are to be used.
1584 * @vht_capa: VHT Capability overrides
1585 * @vht_capa_mask: The bits of vht_capa which are to be used.
1545 */ 1586 */
1546struct cfg80211_connect_params { 1587struct cfg80211_connect_params {
1547 struct ieee80211_channel *channel; 1588 struct ieee80211_channel *channel;
@@ -1560,6 +1601,8 @@ struct cfg80211_connect_params {
1560 int bg_scan_period; 1601 int bg_scan_period;
1561 struct ieee80211_ht_cap ht_capa; 1602 struct ieee80211_ht_cap ht_capa;
1562 struct ieee80211_ht_cap ht_capa_mask; 1603 struct ieee80211_ht_cap ht_capa_mask;
1604 struct ieee80211_vht_cap vht_capa;
1605 struct ieee80211_vht_cap vht_capa_mask;
1563}; 1606};
1564 1607
1565/** 1608/**
@@ -1722,6 +1765,21 @@ struct cfg80211_gtk_rekey_data {
1722}; 1765};
1723 1766
1724/** 1767/**
1768 * struct cfg80211_update_ft_ies_params - FT IE Information
1769 *
1770 * This structure provides information needed to update the fast transition IE
1771 *
1772 * @md: The Mobility Domain ID, 2 Octet value
1773 * @ie: Fast Transition IEs
1774 * @ie_len: Length of ft_ie in octets
1775 */
1776struct cfg80211_update_ft_ies_params {
1777 u16 md;
1778 const u8 *ie;
1779 size_t ie_len;
1780};
1781
1782/**
1725 * struct cfg80211_ops - backend description for wireless configuration 1783 * struct cfg80211_ops - backend description for wireless configuration
1726 * 1784 *
1727 * This struct is registered by fullmac card drivers and/or wireless stacks 1785 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -1781,9 +1839,8 @@ struct cfg80211_gtk_rekey_data {
1781 * @change_station: Modify a given station. Note that flags changes are not much 1839 * @change_station: Modify a given station. Note that flags changes are not much
1782 * validated in cfg80211, in particular the auth/assoc/authorized flags 1840 * validated in cfg80211, in particular the auth/assoc/authorized flags
1783 * might come to the driver in invalid combinations -- make sure to check 1841 * might come to the driver in invalid combinations -- make sure to check
1784 * them, also against the existing state! Also, supported_rates changes are 1842 * them, also against the existing state! Drivers must call
1785 * not checked in station mode -- drivers need to reject (or ignore) them 1843 * cfg80211_check_station_change() to validate the information.
1786 * for anything but TDLS peers.
1787 * @get_station: get station information for the station identified by @mac 1844 * @get_station: get station information for the station identified by @mac
1788 * @dump_station: dump station callback -- resume dump at index @idx 1845 * @dump_station: dump station callback -- resume dump at index @idx
1789 * 1846 *
@@ -1941,6 +1998,16 @@ struct cfg80211_gtk_rekey_data {
1941 * advertise the support for MAC based ACL have to implement this callback. 1998 * advertise the support for MAC based ACL have to implement this callback.
1942 * 1999 *
1943 * @start_radar_detection: Start radar detection in the driver. 2000 * @start_radar_detection: Start radar detection in the driver.
2001 *
2002 * @update_ft_ies: Provide updated Fast BSS Transition information to the
2003 * driver. If the SME is in the driver/firmware, this information can be
2004 * used in building Authentication and Reassociation Request frames.
2005 *
2006 * @crit_proto_start: Indicates a critical protocol needs more link reliability
2007 * for a given duration (milliseconds). The protocol is provided so the
2008 * driver can take the most appropriate actions.
2009 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
2010 * reliability. This operation can not fail.
1944 */ 2011 */
1945struct cfg80211_ops { 2012struct cfg80211_ops {
1946 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2013 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2168,6 +2235,14 @@ struct cfg80211_ops {
2168 int (*start_radar_detection)(struct wiphy *wiphy, 2235 int (*start_radar_detection)(struct wiphy *wiphy,
2169 struct net_device *dev, 2236 struct net_device *dev,
2170 struct cfg80211_chan_def *chandef); 2237 struct cfg80211_chan_def *chandef);
2238 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2239 struct cfg80211_update_ft_ies_params *ftie);
2240 int (*crit_proto_start)(struct wiphy *wiphy,
2241 struct wireless_dev *wdev,
2242 enum nl80211_crit_proto_id protocol,
2243 u16 duration);
2244 void (*crit_proto_stop)(struct wiphy *wiphy,
2245 struct wireless_dev *wdev);
2171}; 2246};
2172 2247
2173/* 2248/*
@@ -2485,6 +2560,8 @@ struct wiphy_wowlan_support {
2485 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 2560 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
2486 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 2561 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
2487 * If null, then none can be over-ridden. 2562 * If null, then none can be over-ridden.
2563 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
2564 * If null, then none can be over-ridden.
2488 * 2565 *
2489 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 2566 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
2490 * supports for ACL. 2567 * supports for ACL.
@@ -2593,6 +2670,7 @@ struct wiphy {
2593 struct dentry *debugfsdir; 2670 struct dentry *debugfsdir;
2594 2671
2595 const struct ieee80211_ht_cap *ht_capa_mod_mask; 2672 const struct ieee80211_ht_cap *ht_capa_mod_mask;
2673 const struct ieee80211_vht_cap *vht_capa_mod_mask;
2596 2674
2597#ifdef CONFIG_NET_NS 2675#ifdef CONFIG_NET_NS
2598 /* the network namespace this phy lives in currently */ 2676 /* the network namespace this phy lives in currently */
@@ -3958,6 +4036,17 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3958void cfg80211_ch_switch_notify(struct net_device *dev, 4036void cfg80211_ch_switch_notify(struct net_device *dev,
3959 struct cfg80211_chan_def *chandef); 4037 struct cfg80211_chan_def *chandef);
3960 4038
4039/**
4040 * ieee80211_operating_class_to_band - convert operating class to band
4041 *
4042 * @operating_class: the operating class to convert
4043 * @band: band pointer to fill
4044 *
4045 * Returns %true if the conversion was successful, %false otherwise.
4046 */
4047bool ieee80211_operating_class_to_band(u8 operating_class,
4048 enum ieee80211_band *band);
4049
3961/* 4050/*
3962 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 4051 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
3963 * @dev: the device on which the operation is requested 4052 * @dev: the device on which the operation is requested
@@ -4002,6 +4091,30 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);
4002void cfg80211_unregister_wdev(struct wireless_dev *wdev); 4091void cfg80211_unregister_wdev(struct wireless_dev *wdev);
4003 4092
4004/** 4093/**
4094 * struct cfg80211_ft_event - FT Information Elements
4095 * @ies: FT IEs
4096 * @ies_len: length of the FT IE in bytes
4097 * @target_ap: target AP's MAC address
4098 * @ric_ies: RIC IE
4099 * @ric_ies_len: length of the RIC IE in bytes
4100 */
4101struct cfg80211_ft_event_params {
4102 const u8 *ies;
4103 size_t ies_len;
4104 const u8 *target_ap;
4105 const u8 *ric_ies;
4106 size_t ric_ies_len;
4107};
4108
4109/**
4110 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
4111 * @netdev: network device
4112 * @ft_event: IE information
4113 */
4114void cfg80211_ft_event(struct net_device *netdev,
4115 struct cfg80211_ft_event_params *ft_event);
4116
4117/**
4005 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 4118 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
4006 * @ies: the input IE buffer 4119 * @ies: the input IE buffer
4007 * @len: the input length 4120 * @len: the input length
@@ -4036,6 +4149,17 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4036 struct cfg80211_wowlan_wakeup *wakeup, 4149 struct cfg80211_wowlan_wakeup *wakeup,
4037 gfp_t gfp); 4150 gfp_t gfp);
4038 4151
4152/**
4153 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
4154 *
4155 * @wdev: the wireless device for which critical protocol is stopped.
4156 *
4157 * This function can be called by the driver to indicate it has reverted
4158 * operation back to normal. One reason could be that the duration given
4159 * by .crit_proto_start() has expired.
4160 */
4161void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
4162
4039/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4163/* Logging, debugging and troubleshooting/diagnostic helpers. */
4040 4164
4041/* wiphy_printk helpers, similar to dev_printk */ 4165/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 2581638f4a3d..0fee0617fb7d 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,7 +24,7 @@ struct cgroup_cls_state
24 u32 classid; 24 u32 classid;
25}; 25};
26 26
27extern void sock_update_classid(struct sock *sk, struct task_struct *task); 27extern void sock_update_classid(struct sock *sk);
28 28
29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) 29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
30static inline u32 task_cls_classid(struct task_struct *p) 30static inline u32 task_cls_classid(struct task_struct *p)
@@ -61,7 +61,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
61} 61}
62#endif 62#endif
63#else /* !CGROUP_NET_CLS_CGROUP */ 63#else /* !CGROUP_NET_CLS_CGROUP */
64static inline void sock_update_classid(struct sock *sk, struct task_struct *task) 64static inline void sock_update_classid(struct sock *sk)
65{ 65{
66} 66}
67 67
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 1ee9d4bda30d..74004af31c48 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -1,24 +1,9 @@
1#ifndef _NET_DN_FIB_H 1#ifndef _NET_DN_FIB_H
2#define _NET_DN_FIB_H 2#define _NET_DN_FIB_H
3 3
4/* WARNING: The ordering of these elements must match ordering 4#include <linux/netlink.h>
5 * of RTA_* rtnetlink attribute numbers. 5
6 */ 6extern const struct nla_policy rtm_dn_policy[];
7struct dn_kern_rta {
8 void *rta_dst;
9 void *rta_src;
10 int *rta_iif;
11 int *rta_oif;
12 void *rta_gw;
13 u32 *rta_priority;
14 void *rta_prefsrc;
15 struct rtattr *rta_mx;
16 struct rtattr *rta_mp;
17 unsigned char *rta_protoinfo;
18 u32 *rta_flow;
19 struct rta_cacheinfo *rta_ci;
20 struct rta_session *rta_sess;
21};
22 7
23struct dn_fib_res { 8struct dn_fib_res {
24 struct fib_rule *r; 9 struct fib_rule *r;
@@ -93,10 +78,10 @@ struct dn_fib_table {
93 u32 n; 78 u32 n;
94 79
95 int (*insert)(struct dn_fib_table *t, struct rtmsg *r, 80 int (*insert)(struct dn_fib_table *t, struct rtmsg *r,
96 struct dn_kern_rta *rta, struct nlmsghdr *n, 81 struct nlattr *attrs[], struct nlmsghdr *n,
97 struct netlink_skb_parms *req); 82 struct netlink_skb_parms *req);
98 int (*delete)(struct dn_fib_table *t, struct rtmsg *r, 83 int (*delete)(struct dn_fib_table *t, struct rtmsg *r,
99 struct dn_kern_rta *rta, struct nlmsghdr *n, 84 struct nlattr *attrs[], struct nlmsghdr *n,
100 struct netlink_skb_parms *req); 85 struct netlink_skb_parms *req);
101 int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld, 86 int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld,
102 struct dn_fib_res *res); 87 struct dn_fib_res *res);
@@ -116,13 +101,12 @@ extern void dn_fib_cleanup(void);
116extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, 101extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd,
117 unsigned long arg); 102 unsigned long arg);
118extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, 103extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
119 struct dn_kern_rta *rta, 104 struct nlattr *attrs[],
120 const struct nlmsghdr *nlh, int *errp); 105 const struct nlmsghdr *nlh, int *errp);
121extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 106extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
122 const struct flowidn *fld, 107 const struct flowidn *fld,
123 struct dn_fib_res *res); 108 struct dn_fib_res *res);
124extern void dn_fib_release_info(struct dn_fib_info *fi); 109extern void dn_fib_release_info(struct dn_fib_info *fi);
125extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
126extern void dn_fib_flush(void); 110extern void dn_fib_flush(void);
127extern void dn_fib_select_multipath(const struct flowidn *fld, 111extern void dn_fib_select_multipath(const struct flowidn *fld,
128 struct dn_fib_res *res); 112 struct dn_fib_res *res);
diff --git a/include/net/firewire.h b/include/net/firewire.h
new file mode 100644
index 000000000000..31bcbfe7a220
--- /dev/null
+++ b/include/net/firewire.h
@@ -0,0 +1,25 @@
1#ifndef _NET_FIREWIRE_H
2#define _NET_FIREWIRE_H
3
4/* Pseudo L2 address */
5#define FWNET_ALEN 16
6union fwnet_hwaddr {
7 u8 u[FWNET_ALEN];
8 /* "Hardware address" defined in RFC2734/RF3146 */
9 struct {
10 __be64 uniq_id; /* EUI-64 */
11 u8 max_rec; /* max packet size */
12 u8 sspd; /* max speed */
13 __be16 fifo_hi; /* hi 16bits of FIFO addr */
14 __be32 fifo_lo; /* lo 32bits of FIFO addr */
15 } __packed uc;
16};
17
18/* Pseudo L2 Header */
19#define FWNET_HLEN 18
20struct fwnet_header {
21 u8 h_dest[FWNET_ALEN]; /* destination address */
22 __be16 h_proto; /* packet type ID field */
23} __packed;
24
25#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index bdfbe68c1c3b..93024a47e0e2 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -50,6 +50,7 @@ struct genl_family {
50 unsigned int version; 50 unsigned int version;
51 unsigned int maxattr; 51 unsigned int maxattr;
52 bool netnsok; 52 bool netnsok;
53 bool parallel_ops;
53 int (*pre_doit)(struct genl_ops *ops, 54 int (*pre_doit)(struct genl_ops *ops,
54 struct sk_buff *skb, 55 struct sk_buff *skb,
55 struct genl_info *info); 56 struct genl_info *info);
diff --git a/include/net/gre.h b/include/net/gre.h
index 82665474bcb7..9f03a390c826 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -2,6 +2,7 @@
2#define __LINUX_GRE_H 2#define __LINUX_GRE_H
3 3
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5#include <net/ip_tunnels.h>
5 6
6#define GREPROTO_CISCO 0 7#define GREPROTO_CISCO 0
7#define GREPROTO_PPTP 1 8#define GREPROTO_PPTP 1
@@ -12,7 +13,57 @@ struct gre_protocol {
12 void (*err_handler)(struct sk_buff *skb, u32 info); 13 void (*err_handler)(struct sk_buff *skb, u32 info);
13}; 14};
14 15
16struct gre_base_hdr {
17 __be16 flags;
18 __be16 protocol;
19};
20#define GRE_HEADER_SECTION 4
21
15int gre_add_protocol(const struct gre_protocol *proto, u8 version); 22int gre_add_protocol(const struct gre_protocol *proto, u8 version);
16int gre_del_protocol(const struct gre_protocol *proto, u8 version); 23int gre_del_protocol(const struct gre_protocol *proto, u8 version);
17 24
25static inline __be16 gre_flags_to_tnl_flags(__be16 flags)
26{
27 __be16 tflags = 0;
28
29 if (flags & GRE_CSUM)
30 tflags |= TUNNEL_CSUM;
31 if (flags & GRE_ROUTING)
32 tflags |= TUNNEL_ROUTING;
33 if (flags & GRE_KEY)
34 tflags |= TUNNEL_KEY;
35 if (flags & GRE_SEQ)
36 tflags |= TUNNEL_SEQ;
37 if (flags & GRE_STRICT)
38 tflags |= TUNNEL_STRICT;
39 if (flags & GRE_REC)
40 tflags |= TUNNEL_REC;
41 if (flags & GRE_VERSION)
42 tflags |= TUNNEL_VERSION;
43
44 return tflags;
45}
46
47static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
48{
49 __be16 flags = 0;
50
51 if (tflags & TUNNEL_CSUM)
52 flags |= GRE_CSUM;
53 if (tflags & TUNNEL_ROUTING)
54 flags |= GRE_ROUTING;
55 if (tflags & TUNNEL_KEY)
56 flags |= GRE_KEY;
57 if (tflags & TUNNEL_SEQ)
58 flags |= GRE_SEQ;
59 if (tflags & TUNNEL_STRICT)
60 flags |= GRE_STRICT;
61 if (tflags & TUNNEL_REC)
62 flags |= GRE_REC;
63 if (tflags & TUNNEL_VERSION)
64 flags |= GRE_VERSION;
65
66 return flags;
67}
68
18#endif 69#endif
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index d104c882fc29..8196d5d40359 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -85,6 +85,8 @@ struct wpan_phy;
85 * Use wpan_wpy_put to put that reference. 85 * Use wpan_wpy_put to put that reference.
86 */ 86 */
87struct ieee802154_mlme_ops { 87struct ieee802154_mlme_ops {
88 /* The following fields are optional (can be NULL). */
89
88 int (*assoc_req)(struct net_device *dev, 90 int (*assoc_req)(struct net_device *dev,
89 struct ieee802154_addr *addr, 91 struct ieee802154_addr *addr,
90 u8 channel, u8 page, u8 cap); 92 u8 channel, u8 page, u8 cap);
@@ -101,6 +103,8 @@ struct ieee802154_mlme_ops {
101 int (*scan_req)(struct net_device *dev, 103 int (*scan_req)(struct net_device *dev,
102 u8 type, u32 channels, u8 page, u8 duration); 104 u8 type, u32 channels, u8 page, u8 duration);
103 105
106 /* The fields below are required. */
107
104 struct wpan_phy *(*get_phy)(const struct net_device *dev); 108 struct wpan_phy *(*get_phy)(const struct net_device *dev);
105 109
106 /* 110 /*
@@ -110,7 +114,6 @@ struct ieee802154_mlme_ops {
110 u16 (*get_pan_id)(const struct net_device *dev); 114 u16 (*get_pan_id)(const struct net_device *dev);
111 u16 (*get_short_addr)(const struct net_device *dev); 115 u16 (*get_short_addr)(const struct net_device *dev);
112 u8 (*get_dsn)(const struct net_device *dev); 116 u8 (*get_dsn)(const struct net_device *dev);
113 u8 (*get_bsn)(const struct net_device *dev);
114}; 117};
115 118
116/* The IEEE 802.15.4 standard defines 2 type of the devices: 119/* The IEEE 802.15.4 standard defines 2 type of the devices:
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 93563221d29a..100fb8cec17c 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -71,6 +71,8 @@ struct inet6_ifaddr {
71 struct inet6_ifaddr *ifpub; 71 struct inet6_ifaddr *ifpub;
72 int regen_count; 72 int regen_count;
73#endif 73#endif
74 bool tokenized;
75
74 struct rcu_head rcu; 76 struct rcu_head rcu;
75}; 77};
76 78
@@ -187,6 +189,8 @@ struct inet6_dev {
187 struct list_head tempaddr_list; 189 struct list_head tempaddr_list;
188#endif 190#endif
189 191
192 struct in6_addr token;
193
190 struct neigh_parms *nd_parms; 194 struct neigh_parms *nd_parms;
191 struct inet6_dev *next; 195 struct inet6_dev *next;
192 struct ipv6_devconf cnf; 196 struct ipv6_devconf cnf;
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 183292722f6e..de2c78529afa 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -133,6 +133,8 @@ struct inet_connection_sock {
133#define ICSK_TIME_RETRANS 1 /* Retransmit timer */ 133#define ICSK_TIME_RETRANS 1 /* Retransmit timer */
134#define ICSK_TIME_DACK 2 /* Delayed ack timer */ 134#define ICSK_TIME_DACK 2 /* Delayed ack timer */
135#define ICSK_TIME_PROBE0 3 /* Zero window probe timer */ 135#define ICSK_TIME_PROBE0 3 /* Zero window probe timer */
136#define ICSK_TIME_EARLY_RETRANS 4 /* Early retransmit timer */
137#define ICSK_TIME_LOSS_PROBE 5 /* Tail loss probe timer */
136 138
137static inline struct inet_connection_sock *inet_csk(const struct sock *sk) 139static inline struct inet_connection_sock *inet_csk(const struct sock *sk)
138{ 140{
@@ -222,7 +224,8 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
222 when = max_when; 224 when = max_when;
223 } 225 }
224 226
225 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) { 227 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0 ||
228 what == ICSK_TIME_EARLY_RETRANS || what == ICSK_TIME_LOSS_PROBE) {
226 icsk->icsk_pending = what; 229 icsk->icsk_pending = what;
227 icsk->icsk_timeout = jiffies + when; 230 icsk->icsk_timeout = jiffies + when;
228 sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout); 231 sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout);
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 0a1dcc2fa2f5..4182c9be8bb5 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -41,7 +41,7 @@ struct inet_frag_queue {
41 struct netns_frags *net; 41 struct netns_frags *net;
42}; 42};
43 43
44#define INETFRAGS_HASHSZ 64 44#define INETFRAGS_HASHSZ 1024
45 45
46/* averaged: 46/* averaged:
47 * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / 47 * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ /
@@ -50,10 +50,16 @@ struct inet_frag_queue {
50 */ 50 */
51#define INETFRAGS_MAXDEPTH 128 51#define INETFRAGS_MAXDEPTH 128
52 52
53struct inet_frag_bucket {
54 struct hlist_head chain;
55 spinlock_t chain_lock;
56};
57
53struct inet_frags { 58struct inet_frags {
54 struct hlist_head hash[INETFRAGS_HASHSZ]; 59 struct inet_frag_bucket hash[INETFRAGS_HASHSZ];
55 /* This rwlock is a global lock (seperate per IPv4, IPv6 and 60 /* This rwlock is a global lock (seperate per IPv4, IPv6 and
56 * netfilter). Important to keep this on a seperate cacheline. 61 * netfilter). Important to keep this on a seperate cacheline.
62 * Its primarily a rebuild protection rwlock.
57 */ 63 */
58 rwlock_t lock ____cacheline_aligned_in_smp; 64 rwlock_t lock ____cacheline_aligned_in_smp;
59 int secret_interval; 65 int secret_interval;
@@ -143,6 +149,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
143{ 149{
144 spin_lock(&q->net->lru_lock); 150 spin_lock(&q->net->lru_lock);
145 list_del(&q->lru_list); 151 list_del(&q->lru_list);
152 q->net->nqueues--;
146 spin_unlock(&q->net->lru_lock); 153 spin_unlock(&q->net->lru_lock);
147} 154}
148 155
@@ -151,6 +158,19 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
151{ 158{
152 spin_lock(&nf->lru_lock); 159 spin_lock(&nf->lru_lock);
153 list_add_tail(&q->lru_list, &nf->lru_list); 160 list_add_tail(&q->lru_list, &nf->lru_list);
161 q->net->nqueues++;
154 spin_unlock(&nf->lru_lock); 162 spin_unlock(&nf->lru_lock);
155} 163}
164
165/* RFC 3168 support :
166 * We want to check ECN values of all fragments, do detect invalid combinations.
167 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
168 */
169#define IPFRAG_ECN_NOT_ECT 0x01 /* one frag had ECN_NOT_ECT */
170#define IPFRAG_ECN_ECT_1 0x02 /* one frag had ECN_ECT_1 */
171#define IPFRAG_ECN_ECT_0 0x04 /* one frag had ECN_ECT_0 */
172#define IPFRAG_ECN_CE 0x08 /* one frag had ECN_CE */
173
174extern const u8 ip_frag_ecn_table[16];
175
156#endif 176#endif
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index e03047f7090b..4da5de10d1d4 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/ipv6.h> 4#include <linux/ipv6.h>
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/if_tunnel.h>
6#include <linux/ip6_tunnel.h> 7#include <linux/ip6_tunnel.h>
7 8
8#define IP6TUNNEL_ERR_TIMEO (30*HZ) 9#define IP6TUNNEL_ERR_TIMEO (30*HZ)
@@ -68,4 +69,24 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
68__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, 69__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
69 const struct in6_addr *raddr); 70 const struct in6_addr *raddr);
70 71
72static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
73{
74 struct net_device_stats *stats = &dev->stats;
75 int pkt_len, err;
76
77 nf_reset(skb);
78 pkt_len = skb->len;
79 err = ip6_local_out(skb);
80
81 if (net_xmit_eval(err) == 0) {
82 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
83 u64_stats_update_begin(&tstats->syncp);
84 tstats->tx_bytes += pkt_len;
85 tstats->tx_packets++;
86 u64_stats_update_end(&tstats->syncp);
87 } else {
88 stats->tx_errors++;
89 stats->tx_aborted_errors++;
90 }
91}
71#endif 92#endif
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
new file mode 100644
index 000000000000..4b6f0b28f41f
--- /dev/null
+++ b/include/net/ip_tunnels.h
@@ -0,0 +1,177 @@
1#ifndef __NET_IP_TUNNELS_H
2#define __NET_IP_TUNNELS_H 1
3
4#include <linux/if_tunnel.h>
5#include <linux/netdevice.h>
6#include <linux/skbuff.h>
7#include <linux/types.h>
8#include <linux/u64_stats_sync.h>
9#include <net/dsfield.h>
10#include <net/gro_cells.h>
11#include <net/inet_ecn.h>
12#include <net/ip.h>
13#include <net/rtnetlink.h>
14
15#if IS_ENABLED(CONFIG_IPV6)
16#include <net/ipv6.h>
17#include <net/ip6_fib.h>
18#include <net/ip6_route.h>
19#endif
20
21/* Keep error state on tunnel for 30 sec */
22#define IPTUNNEL_ERR_TIMEO (30*HZ)
23
24/* 6rd prefix/relay information */
25#ifdef CONFIG_IPV6_SIT_6RD
26struct ip_tunnel_6rd_parm {
27 struct in6_addr prefix;
28 __be32 relay_prefix;
29 u16 prefixlen;
30 u16 relay_prefixlen;
31};
32#endif
33
34struct ip_tunnel_prl_entry {
35 struct ip_tunnel_prl_entry __rcu *next;
36 __be32 addr;
37 u16 flags;
38 struct rcu_head rcu_head;
39};
40
41struct ip_tunnel {
42 struct ip_tunnel __rcu *next;
43 struct hlist_node hash_node;
44 struct net_device *dev;
45
46 int err_count; /* Number of arrived ICMP errors */
47 unsigned long err_time; /* Time when the last ICMP error
48 * arrived */
49
50 /* These four fields used only by GRE */
51 __u32 i_seqno; /* The last seen seqno */
52 __u32 o_seqno; /* The last output seqno */
53 int hlen; /* Precalculated header length */
54 int mlink;
55
56 struct ip_tunnel_parm parms;
57
58 /* for SIT */
59#ifdef CONFIG_IPV6_SIT_6RD
60 struct ip_tunnel_6rd_parm ip6rd;
61#endif
62 struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
63 unsigned int prl_count; /* # of entries in PRL */
64 int ip_tnl_net_id;
65 struct gro_cells gro_cells;
66};
67
68#define TUNNEL_CSUM __cpu_to_be16(0x01)
69#define TUNNEL_ROUTING __cpu_to_be16(0x02)
70#define TUNNEL_KEY __cpu_to_be16(0x04)
71#define TUNNEL_SEQ __cpu_to_be16(0x08)
72#define TUNNEL_STRICT __cpu_to_be16(0x10)
73#define TUNNEL_REC __cpu_to_be16(0x20)
74#define TUNNEL_VERSION __cpu_to_be16(0x40)
75#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
76
77struct tnl_ptk_info {
78 __be16 flags;
79 __be16 proto;
80 __be32 key;
81 __be32 seq;
82};
83
84#define PACKET_RCVD 0
85#define PACKET_REJECT 1
86
87#define IP_TNL_HASH_BITS 10
88#define IP_TNL_HASH_SIZE (1 << IP_TNL_HASH_BITS)
89
90struct ip_tunnel_net {
91 struct hlist_head *tunnels;
92 struct net_device *fb_tunnel_dev;
93};
94
95int ip_tunnel_init(struct net_device *dev);
96void ip_tunnel_uninit(struct net_device *dev);
97void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
98int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
99 struct rtnl_link_ops *ops, char *devname);
100
101void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102
103void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104 const struct iphdr *tnl_params);
105int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
106int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
107
108struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
109 struct rtnl_link_stats64 *tot);
110struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
111 int link, __be16 flags,
112 __be32 remote, __be32 local,
113 __be32 key);
114
115int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
116 const struct tnl_ptk_info *tpi, bool log_ecn_error);
117int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
118 struct ip_tunnel_parm *p);
119int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
120 struct ip_tunnel_parm *p);
121void ip_tunnel_setup(struct net_device *dev, int net_id);
122
123/* Extract dsfield from inner protocol */
124static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
125 const struct sk_buff *skb)
126{
127 if (skb->protocol == htons(ETH_P_IP))
128 return iph->tos;
129 else if (skb->protocol == htons(ETH_P_IPV6))
130 return ipv6_get_dsfield((const struct ipv6hdr *)iph);
131 else
132 return 0;
133}
134
135/* Propogate ECN bits out */
136static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
137 const struct sk_buff *skb)
138{
139 u8 inner = ip_tunnel_get_dsfield(iph, skb);
140
141 return INET_ECN_encapsulate(tos, inner);
142}
143
144static inline void tunnel_ip_select_ident(struct sk_buff *skb,
145 const struct iphdr *old_iph,
146 struct dst_entry *dst)
147{
148 struct iphdr *iph = ip_hdr(skb);
149
150 /* Use inner packet iph-id if possible. */
151 if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
152 iph->id = old_iph->id;
153 else
154 __ip_select_ident(iph, dst,
155 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
156}
157
158static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
159{
160 int err;
161 int pkt_len = skb->len - skb_transport_offset(skb);
162 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
163
164 nf_reset(skb);
165
166 err = ip_local_out(skb);
167 if (likely(net_xmit_eval(err) == 0)) {
168 u64_stats_update_begin(&tstats->syncp);
169 tstats->tx_bytes += pkt_len;
170 tstats->tx_packets++;
171 u64_stats_update_end(&tstats->syncp);
172 } else {
173 dev->stats.tx_errors++;
174 dev->stats.tx_aborted_errors++;
175 }
176}
177#endif /* __NET_IP_TUNNELS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index fce8e6b66d55..4c062ccff9aa 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -233,6 +233,21 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
233 dst->ip = src->ip; 233 dst->ip = src->ip;
234} 234}
235 235
236static inline void ip_vs_addr_set(int af, union nf_inet_addr *dst,
237 const union nf_inet_addr *src)
238{
239#ifdef CONFIG_IP_VS_IPV6
240 if (af == AF_INET6) {
241 dst->in6 = src->in6;
242 return;
243 }
244#endif
245 dst->ip = src->ip;
246 dst->all[1] = 0;
247 dst->all[2] = 0;
248 dst->all[3] = 0;
249}
250
236static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, 251static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
237 const union nf_inet_addr *b) 252 const union nf_inet_addr *b)
238{ 253{
@@ -344,8 +359,6 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
344#define LeaveFunction(level) do {} while (0) 359#define LeaveFunction(level) do {} while (0)
345#endif 360#endif
346 361
347#define IP_VS_WAIT_WHILE(expr) while (expr) { cpu_relax(); }
348
349 362
350/* 363/*
351 * The port number of FTP service (in network order). 364 * The port number of FTP service (in network order).
@@ -459,7 +472,7 @@ struct ip_vs_estimator {
459struct ip_vs_stats { 472struct ip_vs_stats {
460 struct ip_vs_stats_user ustats; /* statistics */ 473 struct ip_vs_stats_user ustats; /* statistics */
461 struct ip_vs_estimator est; /* estimator */ 474 struct ip_vs_estimator est; /* estimator */
462 struct ip_vs_cpu_stats *cpustats; /* per cpu counters */ 475 struct ip_vs_cpu_stats __percpu *cpustats; /* per cpu counters */
463 spinlock_t lock; /* spin lock */ 476 spinlock_t lock; /* spin lock */
464 struct ip_vs_stats_user ustats0; /* reset values */ 477 struct ip_vs_stats_user ustats0; /* reset values */
465}; 478};
@@ -566,20 +579,19 @@ struct ip_vs_conn_param {
566 */ 579 */
567struct ip_vs_conn { 580struct ip_vs_conn {
568 struct hlist_node c_list; /* hashed list heads */ 581 struct hlist_node c_list; /* hashed list heads */
569#ifdef CONFIG_NET_NS
570 struct net *net; /* Name space */
571#endif
572 /* Protocol, addresses and port numbers */ 582 /* Protocol, addresses and port numbers */
573 u16 af; /* address family */
574 __be16 cport; 583 __be16 cport;
575 __be16 vport;
576 __be16 dport; 584 __be16 dport;
577 __u32 fwmark; /* Fire wall mark from skb */ 585 __be16 vport;
586 u16 af; /* address family */
578 union nf_inet_addr caddr; /* client address */ 587 union nf_inet_addr caddr; /* client address */
579 union nf_inet_addr vaddr; /* virtual address */ 588 union nf_inet_addr vaddr; /* virtual address */
580 union nf_inet_addr daddr; /* destination address */ 589 union nf_inet_addr daddr; /* destination address */
581 volatile __u32 flags; /* status flags */ 590 volatile __u32 flags; /* status flags */
582 __u16 protocol; /* Which protocol (TCP/UDP) */ 591 __u16 protocol; /* Which protocol (TCP/UDP) */
592#ifdef CONFIG_NET_NS
593 struct net *net; /* Name space */
594#endif
583 595
584 /* counter and timer */ 596 /* counter and timer */
585 atomic_t refcnt; /* reference count */ 597 atomic_t refcnt; /* reference count */
@@ -593,6 +605,7 @@ struct ip_vs_conn {
593 * state transition triggerd 605 * state transition triggerd
594 * synchronization 606 * synchronization
595 */ 607 */
608 __u32 fwmark; /* Fire wall mark from skb */
596 unsigned long sync_endtime; /* jiffies + sent_retries */ 609 unsigned long sync_endtime; /* jiffies + sent_retries */
597 610
598 /* Control members */ 611 /* Control members */
@@ -620,6 +633,8 @@ struct ip_vs_conn {
620 const struct ip_vs_pe *pe; 633 const struct ip_vs_pe *pe;
621 char *pe_data; 634 char *pe_data;
622 __u8 pe_data_len; 635 __u8 pe_data_len;
636
637 struct rcu_head rcu_head;
623}; 638};
624 639
625/* 640/*
@@ -663,7 +678,7 @@ struct ip_vs_service_user_kern {
663 u16 af; 678 u16 af;
664 u16 protocol; 679 u16 protocol;
665 union nf_inet_addr addr; /* virtual ip address */ 680 union nf_inet_addr addr; /* virtual ip address */
666 u16 port; 681 __be16 port;
667 u32 fwmark; /* firwall mark of service */ 682 u32 fwmark; /* firwall mark of service */
668 683
669 /* virtual service options */ 684 /* virtual service options */
@@ -671,14 +686,14 @@ struct ip_vs_service_user_kern {
671 char *pe_name; 686 char *pe_name;
672 unsigned int flags; /* virtual service flags */ 687 unsigned int flags; /* virtual service flags */
673 unsigned int timeout; /* persistent timeout in sec */ 688 unsigned int timeout; /* persistent timeout in sec */
674 u32 netmask; /* persistent netmask */ 689 __be32 netmask; /* persistent netmask or plen */
675}; 690};
676 691
677 692
678struct ip_vs_dest_user_kern { 693struct ip_vs_dest_user_kern {
679 /* destination server address */ 694 /* destination server address */
680 union nf_inet_addr addr; 695 union nf_inet_addr addr;
681 u16 port; 696 __be16 port;
682 697
683 /* real server options */ 698 /* real server options */
684 unsigned int conn_flags; /* connection flags */ 699 unsigned int conn_flags; /* connection flags */
@@ -695,10 +710,9 @@ struct ip_vs_dest_user_kern {
695 * and the forwarding entries 710 * and the forwarding entries
696 */ 711 */
697struct ip_vs_service { 712struct ip_vs_service {
698 struct list_head s_list; /* for normal service table */ 713 struct hlist_node s_list; /* for normal service table */
699 struct list_head f_list; /* for fwmark-based service table */ 714 struct hlist_node f_list; /* for fwmark-based service table */
700 atomic_t refcnt; /* reference counter */ 715 atomic_t refcnt; /* reference counter */
701 atomic_t usecnt; /* use counter */
702 716
703 u16 af; /* address family */ 717 u16 af; /* address family */
704 __u16 protocol; /* which protocol (TCP/UDP) */ 718 __u16 protocol; /* which protocol (TCP/UDP) */
@@ -707,31 +721,41 @@ struct ip_vs_service {
707 __u32 fwmark; /* firewall mark of the service */ 721 __u32 fwmark; /* firewall mark of the service */
708 unsigned int flags; /* service status flags */ 722 unsigned int flags; /* service status flags */
709 unsigned int timeout; /* persistent timeout in ticks */ 723 unsigned int timeout; /* persistent timeout in ticks */
710 __be32 netmask; /* grouping granularity */ 724 __be32 netmask; /* grouping granularity, mask/plen */
711 struct net *net; 725 struct net *net;
712 726
713 struct list_head destinations; /* real server d-linked list */ 727 struct list_head destinations; /* real server d-linked list */
714 __u32 num_dests; /* number of servers */ 728 __u32 num_dests; /* number of servers */
715 struct ip_vs_stats stats; /* statistics for the service */ 729 struct ip_vs_stats stats; /* statistics for the service */
716 struct ip_vs_app *inc; /* bind conns to this app inc */
717 730
718 /* for scheduling */ 731 /* for scheduling */
719 struct ip_vs_scheduler *scheduler; /* bound scheduler object */ 732 struct ip_vs_scheduler __rcu *scheduler; /* bound scheduler object */
720 rwlock_t sched_lock; /* lock sched_data */ 733 spinlock_t sched_lock; /* lock sched_data */
721 void *sched_data; /* scheduler application data */ 734 void *sched_data; /* scheduler application data */
722 735
723 /* alternate persistence engine */ 736 /* alternate persistence engine */
724 struct ip_vs_pe *pe; 737 struct ip_vs_pe __rcu *pe;
738
739 struct rcu_head rcu_head;
725}; 740};
726 741
742/* Information for cached dst */
743struct ip_vs_dest_dst {
744 struct dst_entry *dst_cache; /* destination cache entry */
745 u32 dst_cookie;
746 union nf_inet_addr dst_saddr;
747 struct rcu_head rcu_head;
748};
727 749
750/* In grace period after removing */
751#define IP_VS_DEST_STATE_REMOVING 0x01
728/* 752/*
729 * The real server destination forwarding entry 753 * The real server destination forwarding entry
730 * with ip address, port number, and so on. 754 * with ip address, port number, and so on.
731 */ 755 */
732struct ip_vs_dest { 756struct ip_vs_dest {
733 struct list_head n_list; /* for the dests in the service */ 757 struct list_head n_list; /* for the dests in the service */
734 struct list_head d_list; /* for table with all the dests */ 758 struct hlist_node d_list; /* for table with all the dests */
735 759
736 u16 af; /* address family */ 760 u16 af; /* address family */
737 __be16 port; /* port number of the server */ 761 __be16 port; /* port number of the server */
@@ -742,6 +766,7 @@ struct ip_vs_dest {
742 766
743 atomic_t refcnt; /* reference counter */ 767 atomic_t refcnt; /* reference counter */
744 struct ip_vs_stats stats; /* statistics */ 768 struct ip_vs_stats stats; /* statistics */
769 unsigned long state; /* state flags */
745 770
746 /* connection counters and thresholds */ 771 /* connection counters and thresholds */
747 atomic_t activeconns; /* active connections */ 772 atomic_t activeconns; /* active connections */
@@ -752,10 +777,7 @@ struct ip_vs_dest {
752 777
753 /* for destination cache */ 778 /* for destination cache */
754 spinlock_t dst_lock; /* lock of dst_cache */ 779 spinlock_t dst_lock; /* lock of dst_cache */
755 struct dst_entry *dst_cache; /* destination cache entry */ 780 struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */
756 u32 dst_rtos; /* RT_TOS(tos) for dst */
757 u32 dst_cookie;
758 union nf_inet_addr dst_saddr;
759 781
760 /* for virtual service */ 782 /* for virtual service */
761 struct ip_vs_service *svc; /* service it belongs to */ 783 struct ip_vs_service *svc; /* service it belongs to */
@@ -763,6 +785,10 @@ struct ip_vs_dest {
763 __be16 vport; /* virtual port number */ 785 __be16 vport; /* virtual port number */
764 union nf_inet_addr vaddr; /* virtual IP address */ 786 union nf_inet_addr vaddr; /* virtual IP address */
765 __u32 vfwmark; /* firewall mark of service */ 787 __u32 vfwmark; /* firewall mark of service */
788
789 struct list_head t_list; /* in dest_trash */
790 struct rcu_head rcu_head;
791 unsigned int in_rs_table:1; /* we are in rs_table */
766}; 792};
767 793
768 794
@@ -778,9 +804,13 @@ struct ip_vs_scheduler {
778 /* scheduler initializing service */ 804 /* scheduler initializing service */
779 int (*init_service)(struct ip_vs_service *svc); 805 int (*init_service)(struct ip_vs_service *svc);
780 /* scheduling service finish */ 806 /* scheduling service finish */
781 int (*done_service)(struct ip_vs_service *svc); 807 void (*done_service)(struct ip_vs_service *svc);
782 /* scheduler updating service */ 808 /* dest is linked */
783 int (*update_service)(struct ip_vs_service *svc); 809 int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
810 /* dest is unlinked */
811 int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
812 /* dest is updated */
813 int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
784 814
785 /* selecting a server from the given service */ 815 /* selecting a server from the given service */
786 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, 816 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc,
@@ -819,6 +849,7 @@ struct ip_vs_app {
819 struct ip_vs_app *app; /* its real application */ 849 struct ip_vs_app *app; /* its real application */
820 __be16 port; /* port number in net order */ 850 __be16 port; /* port number in net order */
821 atomic_t usecnt; /* usage counter */ 851 atomic_t usecnt; /* usage counter */
852 struct rcu_head rcu_head;
822 853
823 /* 854 /*
824 * output hook: Process packet in inout direction, diff set for TCP. 855 * output hook: Process packet in inout direction, diff set for TCP.
@@ -881,6 +912,9 @@ struct ipvs_master_sync_state {
881 struct netns_ipvs *ipvs; 912 struct netns_ipvs *ipvs;
882}; 913};
883 914
915/* How much time to keep dests in trash */
916#define IP_VS_DEST_TRASH_PERIOD (120 * HZ)
917
884/* IPVS in network namespace */ 918/* IPVS in network namespace */
885struct netns_ipvs { 919struct netns_ipvs {
886 int gen; /* Generation */ 920 int gen; /* Generation */
@@ -892,7 +926,7 @@ struct netns_ipvs {
892 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) 926 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
893 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) 927 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
894 928
895 struct list_head rs_table[IP_VS_RTAB_SIZE]; 929 struct hlist_head rs_table[IP_VS_RTAB_SIZE];
896 /* ip_vs_app */ 930 /* ip_vs_app */
897 struct list_head app_list; 931 struct list_head app_list;
898 /* ip_vs_proto */ 932 /* ip_vs_proto */
@@ -904,7 +938,6 @@ struct netns_ipvs {
904 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) 938 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
905 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) 939 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
906 struct list_head tcp_apps[TCP_APP_TAB_SIZE]; 940 struct list_head tcp_apps[TCP_APP_TAB_SIZE];
907 spinlock_t tcp_app_lock;
908#endif 941#endif
909 /* ip_vs_proto_udp */ 942 /* ip_vs_proto_udp */
910#ifdef CONFIG_IP_VS_PROTO_UDP 943#ifdef CONFIG_IP_VS_PROTO_UDP
@@ -912,7 +945,6 @@ struct netns_ipvs {
912 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) 945 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
913 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) 946 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
914 struct list_head udp_apps[UDP_APP_TAB_SIZE]; 947 struct list_head udp_apps[UDP_APP_TAB_SIZE];
915 spinlock_t udp_app_lock;
916#endif 948#endif
917 /* ip_vs_proto_sctp */ 949 /* ip_vs_proto_sctp */
918#ifdef CONFIG_IP_VS_PROTO_SCTP 950#ifdef CONFIG_IP_VS_PROTO_SCTP
@@ -921,7 +953,6 @@ struct netns_ipvs {
921 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) 953 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
922 /* Hash table for SCTP application incarnations */ 954 /* Hash table for SCTP application incarnations */
923 struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; 955 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
924 spinlock_t sctp_app_lock;
925#endif 956#endif
926 /* ip_vs_conn */ 957 /* ip_vs_conn */
927 atomic_t conn_count; /* connection counter */ 958 atomic_t conn_count; /* connection counter */
@@ -931,9 +962,10 @@ struct netns_ipvs {
931 962
932 int num_services; /* no of virtual services */ 963 int num_services; /* no of virtual services */
933 964
934 rwlock_t rs_lock; /* real services table */
935 /* Trash for destinations */ 965 /* Trash for destinations */
936 struct list_head dest_trash; 966 struct list_head dest_trash;
967 spinlock_t dest_trash_lock;
968 struct timer_list dest_trash_timer; /* expiration timer */
937 /* Service counters */ 969 /* Service counters */
938 atomic_t ftpsvc_counter; 970 atomic_t ftpsvc_counter;
939 atomic_t nullsvc_counter; 971 atomic_t nullsvc_counter;
@@ -1181,9 +1213,19 @@ struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
1181 const struct ip_vs_iphdr *iph, 1213 const struct ip_vs_iphdr *iph,
1182 int inverse); 1214 int inverse);
1183 1215
1216/* Get reference to gain full access to conn.
1217 * By default, RCU read-side critical sections have access only to
1218 * conn fields and its PE data, see ip_vs_conn_rcu_free() for reference.
1219 */
1220static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp)
1221{
1222 return atomic_inc_not_zero(&cp->refcnt);
1223}
1224
1184/* put back the conn without restarting its timer */ 1225/* put back the conn without restarting its timer */
1185static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 1226static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1186{ 1227{
1228 smp_mb__before_atomic_dec();
1187 atomic_dec(&cp->refcnt); 1229 atomic_dec(&cp->refcnt);
1188} 1230}
1189extern void ip_vs_conn_put(struct ip_vs_conn *cp); 1231extern void ip_vs_conn_put(struct ip_vs_conn *cp);
@@ -1298,8 +1340,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
1298extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1340extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1299extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); 1341extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1300 1342
1301void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe);
1302void ip_vs_unbind_pe(struct ip_vs_service *svc);
1303int register_ip_vs_pe(struct ip_vs_pe *pe); 1343int register_ip_vs_pe(struct ip_vs_pe *pe);
1304int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1344int unregister_ip_vs_pe(struct ip_vs_pe *pe);
1305struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); 1345struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
@@ -1346,7 +1386,8 @@ extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1346extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1386extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1347extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, 1387extern int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1348 struct ip_vs_scheduler *scheduler); 1388 struct ip_vs_scheduler *scheduler);
1349extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); 1389extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc,
1390 struct ip_vs_scheduler *sched);
1350extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); 1391extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1351extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1392extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1352extern struct ip_vs_conn * 1393extern struct ip_vs_conn *
@@ -1366,17 +1407,12 @@ extern struct ip_vs_stats ip_vs_stats;
1366extern int sysctl_ip_vs_sync_ver; 1407extern int sysctl_ip_vs_sync_ver;
1367 1408
1368extern struct ip_vs_service * 1409extern struct ip_vs_service *
1369ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, 1410ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol,
1370 const union nf_inet_addr *vaddr, __be16 vport); 1411 const union nf_inet_addr *vaddr, __be16 vport);
1371 1412
1372static inline void ip_vs_service_put(struct ip_vs_service *svc) 1413extern bool
1373{ 1414ip_vs_has_real_service(struct net *net, int af, __u16 protocol,
1374 atomic_dec(&svc->usecnt); 1415 const union nf_inet_addr *daddr, __be16 dport);
1375}
1376
1377extern struct ip_vs_dest *
1378ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
1379 const union nf_inet_addr *daddr, __be16 dport);
1380 1416
1381extern int ip_vs_use_count_inc(void); 1417extern int ip_vs_use_count_inc(void);
1382extern void ip_vs_use_count_dec(void); 1418extern void ip_vs_use_count_dec(void);
@@ -1388,8 +1424,18 @@ extern struct ip_vs_dest *
1388ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1424ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
1389 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1425 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1390 __u16 protocol, __u32 fwmark, __u32 flags); 1426 __u16 protocol, __u32 fwmark, __u32 flags);
1391extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1427extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1392 1428
1429static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1430{
1431 atomic_inc(&dest->refcnt);
1432}
1433
1434static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1435{
1436 smp_mb__before_atomic_dec();
1437 atomic_dec(&dest->refcnt);
1438}
1393 1439
1394/* 1440/*
1395 * IPVS sync daemon data and function prototypes 1441 * IPVS sync daemon data and function prototypes
@@ -1428,7 +1474,7 @@ extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1428extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1474extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1429 struct ip_vs_protocol *pp, int offset, 1475 struct ip_vs_protocol *pp, int offset,
1430 unsigned int hooknum, struct ip_vs_iphdr *iph); 1476 unsigned int hooknum, struct ip_vs_iphdr *iph);
1431extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 1477extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1432 1478
1433#ifdef CONFIG_IP_VS_IPV6 1479#ifdef CONFIG_IP_VS_IPV6
1434extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1480extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
diff --git a/include/net/ipip.h b/include/net/ipip.h
deleted file mode 100644
index 982141c15200..000000000000
--- a/include/net/ipip.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef __NET_IPIP_H
2#define __NET_IPIP_H 1
3
4#include <linux/if_tunnel.h>
5#include <net/gro_cells.h>
6#include <net/ip.h>
7
8/* Keep error state on tunnel for 30 sec */
9#define IPTUNNEL_ERR_TIMEO (30*HZ)
10
11/* 6rd prefix/relay information */
12struct ip_tunnel_6rd_parm {
13 struct in6_addr prefix;
14 __be32 relay_prefix;
15 u16 prefixlen;
16 u16 relay_prefixlen;
17};
18
19struct ip_tunnel {
20 struct ip_tunnel __rcu *next;
21 struct net_device *dev;
22
23 int err_count; /* Number of arrived ICMP errors */
24 unsigned long err_time; /* Time when the last ICMP error arrived */
25
26 /* These four fields used only by GRE */
27 __u32 i_seqno; /* The last seen seqno */
28 __u32 o_seqno; /* The last output seqno */
29 int hlen; /* Precalculated GRE header length */
30 int mlink;
31
32 struct ip_tunnel_parm parms;
33
34 /* for SIT */
35#ifdef CONFIG_IPV6_SIT_6RD
36 struct ip_tunnel_6rd_parm ip6rd;
37#endif
38 struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
39 unsigned int prl_count; /* # of entries in PRL */
40
41 struct gro_cells gro_cells;
42};
43
44struct ip_tunnel_prl_entry {
45 struct ip_tunnel_prl_entry __rcu *next;
46 __be32 addr;
47 u16 flags;
48 struct rcu_head rcu_head;
49};
50
51static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
52{
53 int err;
54 struct iphdr *iph = ip_hdr(skb);
55 int pkt_len = skb->len - skb_transport_offset(skb);
56 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
57
58 nf_reset(skb);
59 skb->ip_summed = CHECKSUM_NONE;
60 ip_select_ident(iph, skb_dst(skb), NULL);
61
62 err = ip_local_out(skb);
63 if (likely(net_xmit_eval(err) == 0)) {
64 u64_stats_update_begin(&tstats->syncp);
65 tstats->tx_bytes += pkt_len;
66 tstats->tx_packets++;
67 u64_stats_update_end(&tstats->syncp);
68 } else {
69 dev->stats.tx_errors++;
70 dev->stats.tx_aborted_errors++;
71 }
72}
73
74static inline void tunnel_ip_select_ident(struct sk_buff *skb,
75 const struct iphdr *old_iph,
76 struct dst_entry *dst)
77{
78 struct iphdr *iph = ip_hdr(skb);
79
80 /* Use inner packet iph-id if possible. */
81 if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
82 iph->id = old_iph->id;
83 else
84 __ip_select_ident(iph, dst,
85 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
86}
87#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 64d12e77719a..0810aa57c780 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -217,7 +217,7 @@ struct ipv6_txoptions {
217}; 217};
218 218
219struct ip6_flowlabel { 219struct ip6_flowlabel {
220 struct ip6_flowlabel *next; 220 struct ip6_flowlabel __rcu *next;
221 __be32 label; 221 __be32 label;
222 atomic_t users; 222 atomic_t users;
223 struct in6_addr dst; 223 struct in6_addr dst;
@@ -238,9 +238,9 @@ struct ip6_flowlabel {
238#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) 238#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
239 239
240struct ipv6_fl_socklist { 240struct ipv6_fl_socklist {
241 struct ipv6_fl_socklist *next; 241 struct ipv6_fl_socklist __rcu *next;
242 struct ip6_flowlabel *fl; 242 struct ip6_flowlabel *fl;
243 struct rcu_head rcu; 243 struct rcu_head rcu;
244}; 244};
245 245
246extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 246extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
@@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr)
320 return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); 320 return __ipv6_addr_src_scope(__ipv6_addr_type(addr));
321} 321}
322 322
323static inline bool __ipv6_addr_needs_scope_id(int type)
324{
325 return type & IPV6_ADDR_LINKLOCAL ||
326 (type & IPV6_ADDR_MULTICAST &&
327 (type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)));
328}
329
330static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface)
331{
332 return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0;
333}
334
323static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) 335static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
324{ 336{
325 return memcmp(a1, a2, sizeof(struct in6_addr)); 337 return memcmp(a1, a2, sizeof(struct in6_addr));
@@ -466,6 +478,7 @@ struct ip6_create_arg {
466 u32 user; 478 u32 user;
467 const struct in6_addr *src; 479 const struct in6_addr *src;
468 const struct in6_addr *dst; 480 const struct in6_addr *dst;
481 u8 ecn;
469}; 482};
470 483
471void ip6_frag_init(struct inet_frag_queue *q, void *a); 484void ip6_frag_init(struct inet_frag_queue *q, void *a);
@@ -485,6 +498,7 @@ struct frag_queue {
485 int iif; 498 int iif;
486 unsigned int csum; 499 unsigned int csum;
487 __u16 nhoffset; 500 __u16 nhoffset;
501 u8 ecn;
488}; 502};
489 503
490void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, 504void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f7eba1300d82..04c2d4670dc6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -93,9 +93,11 @@ struct device;
93 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
94 * 94 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set
96 */ 97 */
97enum ieee80211_max_queues { 98enum ieee80211_max_queues {
98 IEEE80211_MAX_QUEUES = 16, 99 IEEE80211_MAX_QUEUES = 16,
100 IEEE80211_MAX_QUEUE_MAP = BIT(IEEE80211_MAX_QUEUES) - 1,
99}; 101};
100 102
101#define IEEE80211_INVAL_HW_QUEUE 0xff 103#define IEEE80211_INVAL_HW_QUEUE 0xff
@@ -126,6 +128,7 @@ enum ieee80211_ac_numbers {
126 * 2^n-1 in the range 1..32767] 128 * 2^n-1 in the range 1..32767]
127 * @cw_max: maximum contention window [like @cw_min] 129 * @cw_max: maximum contention window [like @cw_min]
128 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled 130 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
131 * @acm: is mandatory admission control required for the access category
129 * @uapsd: is U-APSD mode enabled for the queue 132 * @uapsd: is U-APSD mode enabled for the queue
130 */ 133 */
131struct ieee80211_tx_queue_params { 134struct ieee80211_tx_queue_params {
@@ -133,6 +136,7 @@ struct ieee80211_tx_queue_params {
133 u16 cw_min; 136 u16 cw_min;
134 u16 cw_max; 137 u16 cw_max;
135 u8 aifs; 138 u8 aifs;
139 bool acm;
136 bool uapsd; 140 bool uapsd;
137}; 141};
138 142
@@ -207,7 +211,7 @@ struct ieee80211_chanctx_conf {
207 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note 211 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
208 * that it is only ever disabled for station mode. 212 * that it is only ever disabled for station mode.
209 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. 213 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
210 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 214 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
211 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) 215 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
212 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) 216 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
213 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface 217 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
@@ -324,12 +328,11 @@ enum ieee80211_rssi_event {
324 * your driver/device needs to do. 328 * your driver/device needs to do.
325 * @ps: power-save mode (STA only). This flag is NOT affected by 329 * @ps: power-save mode (STA only). This flag is NOT affected by
326 * offchannel/dynamic_ps operations. 330 * offchannel/dynamic_ps operations.
327 * @ssid: The SSID of the current vif. Only valid in AP-mode. 331 * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
328 * @ssid_len: Length of SSID given in @ssid. 332 * @ssid_len: Length of SSID given in @ssid.
329 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. 333 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
330 * @txpower: TX power in dBm 334 * @txpower: TX power in dBm
331 * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces 335 * @p2p_noa_attr: P2P NoA attribute for P2P powersave
332 * @p2p_oppps: P2P opportunistic PS is enabled
333 */ 336 */
334struct ieee80211_bss_conf { 337struct ieee80211_bss_conf {
335 const u8 *bssid; 338 const u8 *bssid;
@@ -363,8 +366,7 @@ struct ieee80211_bss_conf {
363 size_t ssid_len; 366 size_t ssid_len;
364 bool hidden_ssid; 367 bool hidden_ssid;
365 int txpower; 368 int txpower;
366 u8 p2p_ctwindow; 369 struct ieee80211_p2p_noa_attr p2p_noa_attr;
367 bool p2p_oppps;
368}; 370};
369 371
370/** 372/**
@@ -561,6 +563,9 @@ enum mac80211_rate_control_flags {
561/* maximum number of rate stages */ 563/* maximum number of rate stages */
562#define IEEE80211_TX_MAX_RATES 4 564#define IEEE80211_TX_MAX_RATES 4
563 565
566/* maximum number of rate table entries */
567#define IEEE80211_TX_RATE_TABLE_SIZE 4
568
564/** 569/**
565 * struct ieee80211_tx_rate - rate selection/status 570 * struct ieee80211_tx_rate - rate selection/status
566 * 571 *
@@ -601,8 +606,8 @@ static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
601 u8 mcs, u8 nss) 606 u8 mcs, u8 nss)
602{ 607{
603 WARN_ON(mcs & ~0xF); 608 WARN_ON(mcs & ~0xF);
604 WARN_ON(nss & ~0x7); 609 WARN_ON((nss - 1) & ~0x7);
605 rate->idx = (nss << 4) | mcs; 610 rate->idx = ((nss - 1) << 4) | mcs;
606} 611}
607 612
608static inline u8 613static inline u8
@@ -614,7 +619,7 @@ ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
614static inline u8 619static inline u8
615ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate) 620ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
616{ 621{
617 return rate->idx >> 4; 622 return (rate->idx >> 4) + 1;
618} 623}
619 624
620/** 625/**
@@ -655,7 +660,11 @@ struct ieee80211_tx_info {
655 struct ieee80211_tx_rate rates[ 660 struct ieee80211_tx_rate rates[
656 IEEE80211_TX_MAX_RATES]; 661 IEEE80211_TX_MAX_RATES];
657 s8 rts_cts_rate_idx; 662 s8 rts_cts_rate_idx;
658 /* 3 bytes free */ 663 u8 use_rts:1;
664 u8 use_cts_prot:1;
665 u8 short_preamble:1;
666 u8 skip_table:1;
667 /* 2 bytes free */
659 }; 668 };
660 /* only needed before rate control */ 669 /* only needed before rate control */
661 unsigned long jiffies; 670 unsigned long jiffies;
@@ -676,6 +685,8 @@ struct ieee80211_tx_info {
676 struct { 685 struct {
677 struct ieee80211_tx_rate driver_rates[ 686 struct ieee80211_tx_rate driver_rates[
678 IEEE80211_TX_MAX_RATES]; 687 IEEE80211_TX_MAX_RATES];
688 u8 pad[4];
689
679 void *rate_driver_data[ 690 void *rate_driver_data[
680 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; 691 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
681 }; 692 };
@@ -974,8 +985,7 @@ enum ieee80211_smps_mode {
974 * @power_level: requested transmit power (in dBm), backward compatibility 985 * @power_level: requested transmit power (in dBm), backward compatibility
975 * value only that is set to the minimum of all interfaces 986 * value only that is set to the minimum of all interfaces
976 * 987 *
977 * @channel: the channel to tune to 988 * @chandef: the channel definition to tune to
978 * @channel_type: the channel (HT) type
979 * @radar_enabled: whether radar detection is enabled 989 * @radar_enabled: whether radar detection is enabled
980 * 990 *
981 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 991 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
@@ -1001,8 +1011,7 @@ struct ieee80211_conf {
1001 1011
1002 u8 long_frame_max_tx_count, short_frame_max_tx_count; 1012 u8 long_frame_max_tx_count, short_frame_max_tx_count;
1003 1013
1004 struct ieee80211_channel *channel; 1014 struct cfg80211_chan_def chandef;
1005 enum nl80211_channel_type channel_type;
1006 bool radar_enabled; 1015 bool radar_enabled;
1007 enum ieee80211_smps_mode smps_mode; 1016 enum ieee80211_smps_mode smps_mode;
1008}; 1017};
@@ -1019,13 +1028,13 @@ struct ieee80211_conf {
1019 * the driver passed into mac80211. 1028 * the driver passed into mac80211.
1020 * @block_tx: Indicates whether transmission must be blocked before the 1029 * @block_tx: Indicates whether transmission must be blocked before the
1021 * scheduled channel switch, as indicated by the AP. 1030 * scheduled channel switch, as indicated by the AP.
1022 * @channel: the new channel to switch to 1031 * @chandef: the new channel to switch to
1023 * @count: the number of TBTT's until the channel switch event 1032 * @count: the number of TBTT's until the channel switch event
1024 */ 1033 */
1025struct ieee80211_channel_switch { 1034struct ieee80211_channel_switch {
1026 u64 timestamp; 1035 u64 timestamp;
1027 bool block_tx; 1036 bool block_tx;
1028 struct ieee80211_channel *channel; 1037 struct cfg80211_chan_def chandef;
1029 u8 count; 1038 u8 count;
1030}; 1039};
1031 1040
@@ -1067,6 +1076,9 @@ enum ieee80211_vif_flags {
1067 * path needing to access it; even though the netdev carrier will always 1076 * path needing to access it; even though the netdev carrier will always
1068 * be off when it is %NULL there can still be races and packets could be 1077 * be off when it is %NULL there can still be races and packets could be
1069 * processed after it switches back to %NULL. 1078 * processed after it switches back to %NULL.
1079 * @debugfs_dir: debugfs dentry, can be used by drivers to create own per
1080 * interface debug files. Note that it will be NULL for the virtual
1081 * monitor interface (if that is requested.)
1070 * @drv_priv: data area for driver use, will always be aligned to 1082 * @drv_priv: data area for driver use, will always be aligned to
1071 * sizeof(void *). 1083 * sizeof(void *).
1072 */ 1084 */
@@ -1083,6 +1095,10 @@ struct ieee80211_vif {
1083 1095
1084 u32 driver_flags; 1096 u32 driver_flags;
1085 1097
1098#ifdef CONFIG_MAC80211_DEBUGFS
1099 struct dentry *debugfs_dir;
1100#endif
1101
1086 /* must be last */ 1102 /* must be last */
1087 u8 drv_priv[0] __aligned(sizeof(void *)); 1103 u8 drv_priv[0] __aligned(sizeof(void *));
1088}; 1104};
@@ -1101,8 +1117,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1101 * These flags are used for communication about keys between the driver 1117 * These flags are used for communication about keys between the driver
1102 * and mac80211, with the @flags parameter of &struct ieee80211_key_conf. 1118 * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.
1103 * 1119 *
1104 * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates
1105 * that the STA this key will be used with could be using QoS.
1106 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the 1120 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
1107 * driver to indicate that it requires IV generation for this 1121 * driver to indicate that it requires IV generation for this
1108 * particular key. 1122 * particular key.
@@ -1127,7 +1141,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1127 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. 1141 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
1128 */ 1142 */
1129enum ieee80211_key_flags { 1143enum ieee80211_key_flags {
1130 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
1131 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 1144 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
1132 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 1145 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
1133 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 1146 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
@@ -1219,6 +1232,24 @@ enum ieee80211_sta_rx_bandwidth {
1219}; 1232};
1220 1233
1221/** 1234/**
1235 * struct ieee80211_sta_rates - station rate selection table
1236 *
1237 * @rcu_head: RCU head used for freeing the table on update
1238 * @rates: transmit rates/flags to be used by default.
1239 * Overriding entries per-packet is possible by using cb tx control.
1240 */
1241struct ieee80211_sta_rates {
1242 struct rcu_head rcu_head;
1243 struct {
1244 s8 idx;
1245 u8 count;
1246 u8 count_cts;
1247 u8 count_rts;
1248 u16 flags;
1249 } rate[IEEE80211_TX_RATE_TABLE_SIZE];
1250};
1251
1252/**
1222 * struct ieee80211_sta - station table entry 1253 * struct ieee80211_sta - station table entry
1223 * 1254 *
1224 * A station table entry represents a station we are possibly 1255 * A station table entry represents a station we are possibly
@@ -1231,9 +1262,8 @@ enum ieee80211_sta_rx_bandwidth {
1231 * @addr: MAC address 1262 * @addr: MAC address
1232 * @aid: AID we assigned to the station if we're an AP 1263 * @aid: AID we assigned to the station if we're an AP
1233 * @supp_rates: Bitmap of supported rates (per band) 1264 * @supp_rates: Bitmap of supported rates (per band)
1234 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities 1265 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
1235 * @vht_cap: VHT capabilities of this STA; Not restricting any capabilities 1266 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
1236 * of remote STA. Taking as is.
1237 * @wme: indicates whether the STA supports WME. Only valid during AP-mode. 1267 * @wme: indicates whether the STA supports WME. Only valid during AP-mode.
1238 * @drv_priv: data area for driver use, will always be aligned to 1268 * @drv_priv: data area for driver use, will always be aligned to
1239 * sizeof(void *), size is determined in hw information. 1269 * sizeof(void *), size is determined in hw information.
@@ -1246,6 +1276,7 @@ enum ieee80211_sta_rx_bandwidth {
1246 * notifications and capabilities. The value is only valid after 1276 * notifications and capabilities. The value is only valid after
1247 * the station moves to associated state. 1277 * the station moves to associated state.
1248 * @smps_mode: current SMPS mode (off, static or dynamic) 1278 * @smps_mode: current SMPS mode (off, static or dynamic)
1279 * @tx_rates: rate control selection table
1249 */ 1280 */
1250struct ieee80211_sta { 1281struct ieee80211_sta {
1251 u32 supp_rates[IEEE80211_NUM_BANDS]; 1282 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1259,6 +1290,7 @@ struct ieee80211_sta {
1259 u8 rx_nss; 1290 u8 rx_nss;
1260 enum ieee80211_sta_rx_bandwidth bandwidth; 1291 enum ieee80211_sta_rx_bandwidth bandwidth;
1261 enum ieee80211_smps_mode smps_mode; 1292 enum ieee80211_smps_mode smps_mode;
1293 struct ieee80211_sta_rates __rcu *rates;
1262 1294
1263 /* must be last */ 1295 /* must be last */
1264 u8 drv_priv[0] __aligned(sizeof(void *)); 1296 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1414,6 +1446,9 @@ struct ieee80211_tx_control {
1414 * for different virtual interfaces. See the doc section on HW queue 1446 * for different virtual interfaces. See the doc section on HW queue
1415 * control for more details. 1447 * control for more details.
1416 * 1448 *
1449 * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
1450 * selection table provided by the rate control algorithm.
1451 *
1417 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any 1452 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1418 * P2P Interface. This will be honoured even if more than one interface 1453 * P2P Interface. This will be honoured even if more than one interface
1419 * is supported. 1454 * is supported.
@@ -1446,6 +1481,7 @@ enum ieee80211_hw_flags {
1446 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1481 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1447 IEEE80211_HW_AP_LINK_PS = 1<<22, 1482 IEEE80211_HW_AP_LINK_PS = 1<<22,
1448 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1483 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1484 IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24,
1449 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1485 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1450 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1486 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1451}; 1487};
@@ -1531,6 +1567,17 @@ enum ieee80211_hw_flags {
1531 * @netdev_features: netdev features to be set in each netdev created 1567 * @netdev_features: netdev features to be set in each netdev created
1532 * from this HW. Note only HW checksum features are currently 1568 * from this HW. Note only HW checksum features are currently
1533 * compatible with mac80211. Other feature bits will be rejected. 1569 * compatible with mac80211. Other feature bits will be rejected.
1570 *
1571 * @uapsd_queues: This bitmap is included in (re)association frame to indicate
1572 * for each access category if it is uAPSD trigger-enabled and delivery-
1573 * enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
1574 * Each bit corresponds to different AC. Value '1' in specific bit means
1575 * that corresponding AC is both trigger- and delivery-enabled. '0' means
1576 * neither enabled.
1577 *
1578 * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
1579 * deliver to a WMM STA during any Service Period triggered by the WMM STA.
1580 * Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
1534 */ 1581 */
1535struct ieee80211_hw { 1582struct ieee80211_hw {
1536 struct ieee80211_conf conf; 1583 struct ieee80211_conf conf;
@@ -1556,6 +1603,8 @@ struct ieee80211_hw {
1556 u8 radiotap_mcs_details; 1603 u8 radiotap_mcs_details;
1557 u16 radiotap_vht_details; 1604 u16 radiotap_vht_details;
1558 netdev_features_t netdev_features; 1605 netdev_features_t netdev_features;
1606 u8 uapsd_queues;
1607 u8 uapsd_max_sp_len;
1559}; 1608};
1560 1609
1561/** 1610/**
@@ -1950,14 +1999,14 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1950 * filter those response frames except in the case of frames that 1999 * filter those response frames except in the case of frames that
1951 * are buffered in the driver -- those must remain buffered to avoid 2000 * are buffered in the driver -- those must remain buffered to avoid
1952 * reordering. Because it is possible that no frames are released 2001 * reordering. Because it is possible that no frames are released
1953 * in this case, the driver must call ieee80211_sta_eosp_irqsafe() 2002 * in this case, the driver must call ieee80211_sta_eosp()
1954 * to indicate to mac80211 that the service period ended anyway. 2003 * to indicate to mac80211 that the service period ended anyway.
1955 * 2004 *
1956 * Finally, if frames from multiple TIDs are released from mac80211 2005 * Finally, if frames from multiple TIDs are released from mac80211
1957 * but the driver might reorder them, it must clear & set the flags 2006 * but the driver might reorder them, it must clear & set the flags
1958 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP) 2007 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)
1959 * and also take care of the EOSP and MORE_DATA bits in the frame. 2008 * and also take care of the EOSP and MORE_DATA bits in the frame.
1960 * The driver may also use ieee80211_sta_eosp_irqsafe() in this case. 2009 * The driver may also use ieee80211_sta_eosp() in this case.
1961 */ 2010 */
1962 2011
1963/** 2012/**
@@ -2135,6 +2184,24 @@ enum ieee80211_rate_control_changed {
2135}; 2184};
2136 2185
2137/** 2186/**
2187 * enum ieee80211_roc_type - remain on channel type
2188 *
2189 * With the support for multi channel contexts and multi channel operations,
2190 * remain on channel operations might be limited/deferred/aborted by other
2191 * flows/operations which have higher priority (and vise versa).
2192 * Specifying the ROC type can be used by devices to prioritize the ROC
2193 * operations compared to other operations/flows.
2194 *
2195 * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC.
2196 * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required
2197 * for sending managment frames offchannel.
2198 */
2199enum ieee80211_roc_type {
2200 IEEE80211_ROC_TYPE_NORMAL = 0,
2201 IEEE80211_ROC_TYPE_MGMT_TX,
2202};
2203
2204/**
2138 * struct ieee80211_ops - callbacks from mac80211 to the driver 2205 * struct ieee80211_ops - callbacks from mac80211 to the driver
2139 * 2206 *
2140 * This structure contains various callbacks that the driver may 2207 * This structure contains various callbacks that the driver may
@@ -2212,18 +2279,6 @@ enum ieee80211_rate_control_changed {
2212 * MAC address of the device going away. 2279 * MAC address of the device going away.
2213 * Hence, this callback must be implemented. It can sleep. 2280 * Hence, this callback must be implemented. It can sleep.
2214 * 2281 *
2215 * @add_interface_debugfs: Drivers can use this callback to add debugfs files
2216 * when a vif is added to mac80211. This callback and
2217 * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS
2218 * conditional. @remove_interface_debugfs must be provided for cleanup.
2219 * This callback can sleep.
2220 *
2221 * @remove_interface_debugfs: Remove the debugfs files which were added using
2222 * @add_interface_debugfs. This callback must remove all debugfs entries
2223 * that were added because mac80211 only removes interface debugfs when the
2224 * interface is destroyed, not when it is removed from the driver.
2225 * This callback can sleep.
2226 *
2227 * @config: Handler for configuration requests. IEEE 802.11 code calls this 2282 * @config: Handler for configuration requests. IEEE 802.11 code calls this
2228 * function to change hardware configuration, e.g., channel. 2283 * function to change hardware configuration, e.g., channel.
2229 * This function should never fail but returns a negative error code 2284 * This function should never fail but returns a negative error code
@@ -2245,6 +2300,9 @@ enum ieee80211_rate_control_changed {
2245 * See the section "Frame filtering" for more information. 2300 * See the section "Frame filtering" for more information.
2246 * This callback must be implemented and can sleep. 2301 * This callback must be implemented and can sleep.
2247 * 2302 *
2303 * @set_multicast_list: Configure the device's interface specific RX multicast
2304 * filter. This callback is optional. This callback must be atomic.
2305 *
2248 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 2306 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
2249 * must be set or cleared for a given STA. Must be atomic. 2307 * must be set or cleared for a given STA. Must be atomic.
2250 * 2308 *
@@ -2426,8 +2484,11 @@ enum ieee80211_rate_control_changed {
2426 * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. 2484 * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.
2427 * 2485 *
2428 * @flush: Flush all pending frames from the hardware queue, making sure 2486 * @flush: Flush all pending frames from the hardware queue, making sure
2429 * that the hardware queues are empty. If the parameter @drop is set 2487 * that the hardware queues are empty. The @queues parameter is a bitmap
2430 * to %true, pending frames may be dropped. The callback can sleep. 2488 * of queues to flush, which is useful if different virtual interfaces
2489 * use different hardware queues; it may also indicate all queues.
2490 * If the parameter @drop is set to %true, pending frames may be dropped.
2491 * The callback can sleep.
2431 * 2492 *
2432 * @channel_switch: Drivers that need (or want) to offload the channel 2493 * @channel_switch: Drivers that need (or want) to offload the channel
2433 * switch operation for CSAs received from the AP may implement this 2494 * switch operation for CSAs received from the AP may implement this
@@ -2492,7 +2553,7 @@ enum ieee80211_rate_control_changed {
2492 * setting the EOSP flag in the QoS header of the frames. Also, when the 2553 * setting the EOSP flag in the QoS header of the frames. Also, when the
2493 * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP 2554 * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP
2494 * on the last frame in the SP. Alternatively, it may call the function 2555 * on the last frame in the SP. Alternatively, it may call the function
2495 * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. 2556 * ieee80211_sta_eosp() to inform mac80211 of the end of the SP.
2496 * This callback must be atomic. 2557 * This callback must be atomic.
2497 * @allow_buffered_frames: Prepare device to allow the given number of frames 2558 * @allow_buffered_frames: Prepare device to allow the given number of frames
2498 * to go out to the given station. The frames will be sent by mac80211 2559 * to go out to the given station. The frames will be sent by mac80211
@@ -2503,7 +2564,7 @@ enum ieee80211_rate_control_changed {
2503 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2564 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
2504 * on the last frame and clear it on all others and also handle the EOSP 2565 * on the last frame and clear it on all others and also handle the EOSP
2505 * bit in the QoS header correctly. Alternatively, it can also call the 2566 * bit in the QoS header correctly. Alternatively, it can also call the
2506 * ieee80211_sta_eosp_irqsafe() function. 2567 * ieee80211_sta_eosp() function.
2507 * The @tids parameter is a bitmap and tells the driver which TIDs the 2568 * The @tids parameter is a bitmap and tells the driver which TIDs the
2508 * frames will be on; it will at most have two bits set. 2569 * frames will be on; it will at most have two bits set.
2509 * This callback must be atomic. 2570 * This callback must be atomic.
@@ -2591,6 +2652,10 @@ struct ieee80211_ops {
2591 unsigned int changed_flags, 2652 unsigned int changed_flags,
2592 unsigned int *total_flags, 2653 unsigned int *total_flags,
2593 u64 multicast); 2654 u64 multicast);
2655 void (*set_multicast_list)(struct ieee80211_hw *hw,
2656 struct ieee80211_vif *vif, bool allmulti,
2657 struct netdev_hw_addr_list *mc_list);
2658
2594 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 2659 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2595 bool set); 2660 bool set);
2596 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 2661 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
@@ -2637,12 +2702,6 @@ struct ieee80211_ops {
2637 struct ieee80211_vif *vif, 2702 struct ieee80211_vif *vif,
2638 struct ieee80211_sta *sta, 2703 struct ieee80211_sta *sta,
2639 struct dentry *dir); 2704 struct dentry *dir);
2640 void (*add_interface_debugfs)(struct ieee80211_hw *hw,
2641 struct ieee80211_vif *vif,
2642 struct dentry *dir);
2643 void (*remove_interface_debugfs)(struct ieee80211_hw *hw,
2644 struct ieee80211_vif *vif,
2645 struct dentry *dir);
2646#endif 2705#endif
2647 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2706 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2648 enum sta_notify_cmd, struct ieee80211_sta *sta); 2707 enum sta_notify_cmd, struct ieee80211_sta *sta);
@@ -2677,7 +2736,7 @@ struct ieee80211_ops {
2677 struct netlink_callback *cb, 2736 struct netlink_callback *cb,
2678 void *data, int len); 2737 void *data, int len);
2679#endif 2738#endif
2680 void (*flush)(struct ieee80211_hw *hw, bool drop); 2739 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
2681 void (*channel_switch)(struct ieee80211_hw *hw, 2740 void (*channel_switch)(struct ieee80211_hw *hw,
2682 struct ieee80211_channel_switch *ch_switch); 2741 struct ieee80211_channel_switch *ch_switch);
2683 int (*napi_poll)(struct ieee80211_hw *hw, int budget); 2742 int (*napi_poll)(struct ieee80211_hw *hw, int budget);
@@ -2687,7 +2746,8 @@ struct ieee80211_ops {
2687 int (*remain_on_channel)(struct ieee80211_hw *hw, 2746 int (*remain_on_channel)(struct ieee80211_hw *hw,
2688 struct ieee80211_vif *vif, 2747 struct ieee80211_vif *vif,
2689 struct ieee80211_channel *chan, 2748 struct ieee80211_channel *chan,
2690 int duration); 2749 int duration,
2750 enum ieee80211_roc_type type);
2691 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); 2751 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
2692 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); 2752 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
2693 void (*get_ringparam)(struct ieee80211_hw *hw, 2753 void (*get_ringparam)(struct ieee80211_hw *hw,
@@ -3108,6 +3168,25 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
3108 u8 tid, bool buffered); 3168 u8 tid, bool buffered);
3109 3169
3110/** 3170/**
3171 * ieee80211_get_tx_rates - get the selected transmit rates for a packet
3172 *
3173 * Call this function in a driver with per-packet rate selection support
3174 * to combine the rate info in the packet tx info with the most recent
3175 * rate selection table for the station entry.
3176 *
3177 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3178 * @sta: the receiver station to which this packet is sent.
3179 * @skb: the frame to be transmitted.
3180 * @dest: buffer for extracted rate/retry information
3181 * @max_rates: maximum number of rates to fetch
3182 */
3183void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
3184 struct ieee80211_sta *sta,
3185 struct sk_buff *skb,
3186 struct ieee80211_tx_rate *dest,
3187 int max_rates);
3188
3189/**
3111 * ieee80211_tx_status - transmit status callback 3190 * ieee80211_tx_status - transmit status callback
3112 * 3191 *
3113 * Call this function for all transmitted frames after they have been 3192 * Call this function for all transmitted frames after they have been
@@ -3842,14 +3921,17 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
3842 * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. 3921 * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.
3843 * This applies for PS-Poll as well as uAPSD. 3922 * This applies for PS-Poll as well as uAPSD.
3844 * 3923 *
3845 * Note that there is no non-_irqsafe version right now as 3924 * Note that just like with _tx_status() and _rx() drivers must
3846 * it wasn't needed, but just like _tx_status() and _rx() 3925 * not mix calls to irqsafe/non-irqsafe versions, this function
3847 * must not be mixed in irqsafe/non-irqsafe versions, this 3926 * must not be mixed with those either. Use the all irqsafe, or
3848 * function must not be mixed with those either. Use the 3927 * all non-irqsafe, don't mix!
3849 * all irqsafe, or all non-irqsafe, don't mix! If you need 3928 *
3850 * the non-irqsafe version of this, you need to add it. 3929 * NB: the _irqsafe version of this function doesn't exist, no
3930 * driver needs it right now. Don't call this function if
3931 * you'd need the _irqsafe version, look at the git history
3932 * and restore the _irqsafe version!
3851 */ 3933 */
3852void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); 3934void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);
3853 3935
3854/** 3936/**
3855 * ieee80211_iter_keys - iterate keys programmed into the device 3937 * ieee80211_iter_keys - iterate keys programmed into the device
@@ -4079,7 +4161,7 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
4079 * (deprecated; this will be removed once drivers get updated to use 4161 * (deprecated; this will be removed once drivers get updated to use
4080 * rate_idx_mask) 4162 * rate_idx_mask)
4081 * @rate_idx_mask: user-requested (legacy) rate mask 4163 * @rate_idx_mask: user-requested (legacy) rate mask
4082 * @rate_idx_mcs_mask: user-requested MCS rate mask 4164 * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)
4083 * @bss: whether this frame is sent out in AP or IBSS mode 4165 * @bss: whether this frame is sent out in AP or IBSS mode
4084 */ 4166 */
4085struct ieee80211_tx_rate_control { 4167struct ieee80211_tx_rate_control {
@@ -4091,7 +4173,7 @@ struct ieee80211_tx_rate_control {
4091 bool rts, short_preamble; 4173 bool rts, short_preamble;
4092 u8 max_rate_idx; 4174 u8 max_rate_idx;
4093 u32 rate_idx_mask; 4175 u32 rate_idx_mask;
4094 u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; 4176 u8 *rate_idx_mcs_mask;
4095 bool bss; 4177 bool bss;
4096}; 4178};
4097 4179
@@ -4180,37 +4262,55 @@ bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
4180 return false; 4262 return false;
4181} 4263}
4182 4264
4265/**
4266 * rate_control_set_rates - pass the sta rate selection to mac80211/driver
4267 *
4268 * When not doing a rate control probe to test rates, rate control should pass
4269 * its rate selection to mac80211. If the driver supports receiving a station
4270 * rate table, it will use it to ensure that frames are always sent based on
4271 * the most recent rate control module decision.
4272 *
4273 * @hw: pointer as obtained from ieee80211_alloc_hw()
4274 * @pubsta: &struct ieee80211_sta pointer to the target destination.
4275 * @rates: new tx rate set to be used for this station.
4276 */
4277int rate_control_set_rates(struct ieee80211_hw *hw,
4278 struct ieee80211_sta *pubsta,
4279 struct ieee80211_sta_rates *rates);
4280
4183int ieee80211_rate_control_register(struct rate_control_ops *ops); 4281int ieee80211_rate_control_register(struct rate_control_ops *ops);
4184void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 4282void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
4185 4283
4186static inline bool 4284static inline bool
4187conf_is_ht20(struct ieee80211_conf *conf) 4285conf_is_ht20(struct ieee80211_conf *conf)
4188{ 4286{
4189 return conf->channel_type == NL80211_CHAN_HT20; 4287 return conf->chandef.width == NL80211_CHAN_WIDTH_20;
4190} 4288}
4191 4289
4192static inline bool 4290static inline bool
4193conf_is_ht40_minus(struct ieee80211_conf *conf) 4291conf_is_ht40_minus(struct ieee80211_conf *conf)
4194{ 4292{
4195 return conf->channel_type == NL80211_CHAN_HT40MINUS; 4293 return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
4294 conf->chandef.center_freq1 < conf->chandef.chan->center_freq;
4196} 4295}
4197 4296
4198static inline bool 4297static inline bool
4199conf_is_ht40_plus(struct ieee80211_conf *conf) 4298conf_is_ht40_plus(struct ieee80211_conf *conf)
4200{ 4299{
4201 return conf->channel_type == NL80211_CHAN_HT40PLUS; 4300 return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
4301 conf->chandef.center_freq1 > conf->chandef.chan->center_freq;
4202} 4302}
4203 4303
4204static inline bool 4304static inline bool
4205conf_is_ht40(struct ieee80211_conf *conf) 4305conf_is_ht40(struct ieee80211_conf *conf)
4206{ 4306{
4207 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); 4307 return conf->chandef.width == NL80211_CHAN_WIDTH_40;
4208} 4308}
4209 4309
4210static inline bool 4310static inline bool
4211conf_is_ht(struct ieee80211_conf *conf) 4311conf_is_ht(struct ieee80211_conf *conf)
4212{ 4312{
4213 return conf->channel_type != NL80211_CHAN_NO_HT; 4313 return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT;
4214} 4314}
4215 4315
4216static inline enum nl80211_iftype 4316static inline enum nl80211_iftype
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index de644bcd8613..b17697827482 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -17,6 +17,7 @@
17#include <net/netns/ipv6.h> 17#include <net/netns/ipv6.h>
18#include <net/netns/sctp.h> 18#include <net/netns/sctp.h>
19#include <net/netns/dccp.h> 19#include <net/netns/dccp.h>
20#include <net/netns/netfilter.h>
20#include <net/netns/x_tables.h> 21#include <net/netns/x_tables.h>
21#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
22#include <net/netns/conntrack.h> 23#include <net/netns/conntrack.h>
@@ -94,6 +95,7 @@ struct net {
94 struct netns_dccp dccp; 95 struct netns_dccp dccp;
95#endif 96#endif
96#ifdef CONFIG_NETFILTER 97#ifdef CONFIG_NETFILTER
98 struct netns_nf nf;
97 struct netns_xt xt; 99 struct netns_xt xt;
98#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 100#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
99 struct netns_ct ct; 101 struct netns_ct ct;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index caca0c4d6b4b..644d9c223d24 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -184,7 +184,7 @@ extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184extern void nf_ct_delete_from_lists(struct nf_conn *ct); 184extern void nf_ct_delete_from_lists(struct nf_conn *ct);
185extern void nf_ct_dying_timeout(struct nf_conn *ct); 185extern void nf_ct_dying_timeout(struct nf_conn *ct);
186 186
187extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); 187extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
188 188
189extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 189extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
190 unsigned int nhoff, u_int16_t l3num, 190 unsigned int nhoff, u_int16_t l3num,
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 930275fa2ea6..fb2b6234e937 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -27,6 +27,7 @@ extern unsigned int nf_conntrack_in(struct net *net,
27 27
28extern int nf_conntrack_init_net(struct net *net); 28extern int nf_conntrack_init_net(struct net *net);
29extern void nf_conntrack_cleanup_net(struct net *net); 29extern void nf_conntrack_cleanup_net(struct net *net);
30extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
30 31
31extern int nf_conntrack_proto_pernet_init(struct net *net); 32extern int nf_conntrack_proto_pernet_init(struct net *net);
32extern void nf_conntrack_proto_pernet_fini(struct net *net); 33extern void nf_conntrack_proto_pernet_fini(struct net *net);
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index cbbae7621e22..3f3aecbc8632 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -88,7 +88,7 @@ nf_ct_find_expectation(struct net *net, u16 zone,
88 const struct nf_conntrack_tuple *tuple); 88 const struct nf_conntrack_tuple *tuple);
89 89
90void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, 90void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
91 u32 pid, int report); 91 u32 portid, int report);
92static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp) 92static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
93{ 93{
94 nf_ct_unlink_expect_report(exp, 0, 0); 94 nf_ct_unlink_expect_report(exp, 0, 0);
@@ -106,7 +106,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
106 u_int8_t, const __be16 *, const __be16 *); 106 u_int8_t, const __be16 *, const __be16 *);
107void nf_ct_expect_put(struct nf_conntrack_expect *exp); 107void nf_ct_expect_put(struct nf_conntrack_expect *exp);
108int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, 108int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
109 u32 pid, int report); 109 u32 portid, int report);
110static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect) 110static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
111{ 111{
112 return nf_ct_expect_related_report(expect, 0, 0); 112 return nf_ct_expect_related_report(expect, 0, 0);
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index e991bd0a27af..31f1fb9eb784 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -49,12 +49,18 @@ struct nf_logger {
49int nf_log_register(u_int8_t pf, struct nf_logger *logger); 49int nf_log_register(u_int8_t pf, struct nf_logger *logger);
50void nf_log_unregister(struct nf_logger *logger); 50void nf_log_unregister(struct nf_logger *logger);
51 51
52int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger); 52void nf_log_set(struct net *net, u_int8_t pf,
53void nf_log_unbind_pf(u_int8_t pf); 53 const struct nf_logger *logger);
54void nf_log_unset(struct net *net, const struct nf_logger *logger);
55
56int nf_log_bind_pf(struct net *net, u_int8_t pf,
57 const struct nf_logger *logger);
58void nf_log_unbind_pf(struct net *net, u_int8_t pf);
54 59
55/* Calls the registered backend logging function */ 60/* Calls the registered backend logging function */
56__printf(7, 8) 61__printf(8, 9)
57void nf_log_packet(u_int8_t pf, 62void nf_log_packet(struct net *net,
63 u_int8_t pf,
58 unsigned int hooknum, 64 unsigned int hooknum,
59 const struct sk_buff *skb, 65 const struct sk_buff *skb,
60 const struct net_device *in, 66 const struct net_device *in,
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index fb1c0be38b6d..aaba4bbcdda0 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -9,10 +9,13 @@ struct nf_queue_entry {
9 9
10 struct nf_hook_ops *elem; 10 struct nf_hook_ops *elem;
11 u_int8_t pf; 11 u_int8_t pf;
12 u16 size; /* sizeof(entry) + saved route keys */
12 unsigned int hook; 13 unsigned int hook;
13 struct net_device *indev; 14 struct net_device *indev;
14 struct net_device *outdev; 15 struct net_device *outdev;
15 int (*okfn)(struct sk_buff *); 16 int (*okfn)(struct sk_buff *);
17
18 /* extra space to store route keys */
16}; 19};
17 20
18#define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) 21#define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry))
@@ -27,4 +30,7 @@ void nf_register_queue_handler(const struct nf_queue_handler *qh);
27void nf_unregister_queue_handler(void); 30void nf_unregister_queue_handler(void);
28extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 31extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
29 32
33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry);
34void nf_queue_entry_release_refs(struct nf_queue_entry *entry);
35
30#endif /* _NF_QUEUE_H */ 36#endif /* _NF_QUEUE_H */
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 1242f371718b..005e2c2e39a9 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -71,6 +71,7 @@ struct netns_ipv6 {
71 struct fib_rules_ops *mr6_rules_ops; 71 struct fib_rules_ops *mr6_rules_ops;
72#endif 72#endif
73#endif 73#endif
74 atomic_t dev_addr_genid;
74}; 75};
75 76
76#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 77#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h
new file mode 100644
index 000000000000..88740024ccf3
--- /dev/null
+++ b/include/net/netns/netfilter.h
@@ -0,0 +1,18 @@
1#ifndef __NETNS_NETFILTER_H
2#define __NETNS_NETFILTER_H
3
4#include <linux/proc_fs.h>
5#include <linux/netfilter.h>
6
7struct nf_logger;
8
9struct netns_nf {
10#if defined CONFIG_PROC_FS
11 struct proc_dir_entry *proc_netfilter;
12#endif
13 const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO];
14#ifdef CONFIG_SYSCTL
15 struct ctl_table_header *nf_log_dir_header;
16#endif
17};
18#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 1d04b6f0fbd4..50ab8c26ab59 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -29,7 +29,7 @@ struct cgroup_netprio_state {
29 struct cgroup_subsys_state css; 29 struct cgroup_subsys_state css;
30}; 30};
31 31
32extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); 32extern void sock_update_netprioidx(struct sock *sk);
33 33
34#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) 34#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
35 35
@@ -68,7 +68,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
68 return 0; 68 return 0;
69} 69}
70 70
71#define sock_update_netprioidx(sk, task) 71#define sock_update_netprioidx(sk)
72 72
73#endif /* CONFIG_NETPRIO_CGROUP */ 73#endif /* CONFIG_NETPRIO_CGROUP */
74 74
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 87a6417fc934..5eb80bb3cbb2 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -122,6 +122,8 @@ struct nfc_dev {
122 122
123 bool shutting_down; 123 bool shutting_down;
124 124
125 struct rfkill *rfkill;
126
125 struct nfc_ops *ops; 127 struct nfc_ops *ops;
126}; 128};
127#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) 129#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index a51dbd17c2de..59795e42c8b6 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -27,19 +27,13 @@ struct sk_buff;
27struct dst_entry; 27struct dst_entry;
28struct proto; 28struct proto;
29 29
30/* empty to "strongly type" an otherwise void parameter.
31 */
32struct request_values {
33};
34
35struct request_sock_ops { 30struct request_sock_ops {
36 int family; 31 int family;
37 int obj_size; 32 int obj_size;
38 struct kmem_cache *slab; 33 struct kmem_cache *slab;
39 char *slab_name; 34 char *slab_name;
40 int (*rtx_syn_ack)(struct sock *sk, 35 int (*rtx_syn_ack)(struct sock *sk,
41 struct request_sock *req, 36 struct request_sock *req);
42 struct request_values *rvp);
43 void (*send_ack)(struct sock *sk, struct sk_buff *skb, 37 void (*send_ack)(struct sock *sk, struct sk_buff *skb,
44 struct request_sock *req); 38 struct request_sock *req);
45 void (*send_reset)(struct sock *sk, 39 void (*send_reset)(struct sock *sk,
@@ -54,7 +48,7 @@ extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
54/* struct request_sock - mini sock to represent a connection request 48/* struct request_sock - mini sock to represent a connection request
55 */ 49 */
56struct request_sock { 50struct request_sock {
57 struct request_sock *dl_next; /* Must be first member! */ 51 struct request_sock *dl_next;
58 u16 mss; 52 u16 mss;
59 u8 num_retrans; /* number of retransmits */ 53 u8 num_retrans; /* number of retransmits */
60 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ 54 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 5a15fabd6a75..702664833a53 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -4,7 +4,7 @@
4#include <linux/rtnetlink.h> 4#include <linux/rtnetlink.h>
5#include <net/netlink.h> 5#include <net/netlink.h>
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
diff --git a/include/net/scm.h b/include/net/scm.h
index b11708105681..8de2d37d2077 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -26,7 +26,6 @@ struct scm_fp_list {
26 26
27struct scm_cookie { 27struct scm_cookie {
28 struct pid *pid; /* Skb credentials */ 28 struct pid *pid; /* Skb credentials */
29 const struct cred *cred;
30 struct scm_fp_list *fp; /* Passed files */ 29 struct scm_fp_list *fp; /* Passed files */
31 struct scm_creds creds; /* Skb credentials */ 30 struct scm_creds creds; /* Skb credentials */
32#ifdef CONFIG_SECURITY_NETWORK 31#ifdef CONFIG_SECURITY_NETWORK
@@ -51,23 +50,18 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co
51#endif /* CONFIG_SECURITY_NETWORK */ 50#endif /* CONFIG_SECURITY_NETWORK */
52 51
53static __inline__ void scm_set_cred(struct scm_cookie *scm, 52static __inline__ void scm_set_cred(struct scm_cookie *scm,
54 struct pid *pid, const struct cred *cred) 53 struct pid *pid, kuid_t uid, kgid_t gid)
55{ 54{
56 scm->pid = get_pid(pid); 55 scm->pid = get_pid(pid);
57 scm->cred = cred ? get_cred(cred) : NULL;
58 scm->creds.pid = pid_vnr(pid); 56 scm->creds.pid = pid_vnr(pid);
59 scm->creds.uid = cred ? cred->uid : INVALID_UID; 57 scm->creds.uid = uid;
60 scm->creds.gid = cred ? cred->gid : INVALID_GID; 58 scm->creds.gid = gid;
61} 59}
62 60
63static __inline__ void scm_destroy_cred(struct scm_cookie *scm) 61static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
64{ 62{
65 put_pid(scm->pid); 63 put_pid(scm->pid);
66 scm->pid = NULL; 64 scm->pid = NULL;
67
68 if (scm->cred)
69 put_cred(scm->cred);
70 scm->cred = NULL;
71} 65}
72 66
73static __inline__ void scm_destroy(struct scm_cookie *scm) 67static __inline__ void scm_destroy(struct scm_cookie *scm)
@@ -81,8 +75,10 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
81 struct scm_cookie *scm, bool forcecreds) 75 struct scm_cookie *scm, bool forcecreds)
82{ 76{
83 memset(scm, 0, sizeof(*scm)); 77 memset(scm, 0, sizeof(*scm));
78 scm->creds.uid = INVALID_UID;
79 scm->creds.gid = INVALID_GID;
84 if (forcecreds) 80 if (forcecreds)
85 scm_set_cred(scm, task_tgid(current), current_cred()); 81 scm_set_cred(scm, task_tgid(current), current_uid(), current_gid());
86 unix_get_peersec_dgram(sock, scm); 82 unix_get_peersec_dgram(sock, scm);
87 if (msg->msg_controllen <= 0) 83 if (msg->msg_controllen <= 0)
88 return 0; 84 return 0;
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index befc8d2a1b9f..5a2110d3176d 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
77 return sctp_crc32c(crc32, buffer, length); 77 return sctp_crc32c(crc32, buffer, length);
78} 78}
79 79
80static inline __le32 sctp_end_cksum(__be32 crc32) 80static inline __le32 sctp_end_cksum(__u32 crc32)
81{ 81{
82 return cpu_to_le32(~crc32); 82 return cpu_to_le32(~crc32);
83} 83}
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index a7dd5c50df79..ca50e0751e47 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -49,7 +49,6 @@
49 49
50#include <linux/sctp.h> 50#include <linux/sctp.h>
51#include <linux/ipv6.h> /* For ipv6hdr. */ 51#include <linux/ipv6.h> /* For ipv6hdr. */
52#include <net/sctp/user.h>
53#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */ 52#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */
54 53
55/* Value used for stream negotiation. */ 54/* Value used for stream negotiation. */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0e0f9d2322e3..1bd4c4144fe8 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -399,7 +399,6 @@ struct sctp_stream {
399struct sctp_ssnmap { 399struct sctp_ssnmap {
400 struct sctp_stream in; 400 struct sctp_stream in;
401 struct sctp_stream out; 401 struct sctp_stream out;
402 int malloced;
403}; 402};
404 403
405struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, 404struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
@@ -715,8 +714,7 @@ struct sctp_packet {
715 has_sack:1, /* This packet contains a SACK chunk. */ 714 has_sack:1, /* This packet contains a SACK chunk. */
716 has_auth:1, /* This packet contains an AUTH chunk */ 715 has_auth:1, /* This packet contains an AUTH chunk */
717 has_data:1, /* This packet contains at least 1 DATA chunk */ 716 has_data:1, /* This packet contains at least 1 DATA chunk */
718 ipfragok:1, /* So let ip fragment this packet */ 717 ipfragok:1; /* So let ip fragment this packet */
719 malloced:1; /* Is it malloced? */
720}; 718};
721 719
722struct sctp_packet *sctp_packet_init(struct sctp_packet *, 720struct sctp_packet *sctp_packet_init(struct sctp_packet *,
@@ -780,10 +778,7 @@ struct sctp_transport {
780 hb_sent:1, 778 hb_sent:1,
781 779
782 /* Is the Path MTU update pending on this tranport */ 780 /* Is the Path MTU update pending on this tranport */
783 pmtu_pending:1, 781 pmtu_pending:1;
784
785 /* Is this structure kfree()able? */
786 malloced:1;
787 782
788 /* Has this transport moved the ctsn since we last sacked */ 783 /* Has this transport moved the ctsn since we last sacked */
789 __u32 sack_generation; 784 __u32 sack_generation;
@@ -992,8 +987,6 @@ struct sctp_inq {
992 * messages. 987 * messages.
993 */ 988 */
994 struct work_struct immediate; 989 struct work_struct immediate;
995
996 int malloced; /* Is this structure kfree()able? */
997}; 990};
998 991
999void sctp_inq_init(struct sctp_inq *); 992void sctp_inq_init(struct sctp_inq *);
@@ -1062,9 +1055,6 @@ struct sctp_outq {
1062 1055
1063 /* Is this structure empty? */ 1056 /* Is this structure empty? */
1064 char empty; 1057 char empty;
1065
1066 /* Are we kfree()able? */
1067 char malloced;
1068}; 1058};
1069 1059
1070void sctp_outq_init(struct sctp_association *, struct sctp_outq *); 1060void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
@@ -1102,8 +1092,6 @@ struct sctp_bind_addr {
1102 * peer(s) in INIT and INIT ACK chunks. 1092 * peer(s) in INIT and INIT ACK chunks.
1103 */ 1093 */
1104 struct list_head address_list; 1094 struct list_head address_list;
1105
1106 int malloced; /* Are we kfree()able? */
1107}; 1095};
1108 1096
1109void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); 1097void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
@@ -1174,11 +1162,9 @@ struct sctp_ep_common {
1174 /* Some fields to help us manage this object. 1162 /* Some fields to help us manage this object.
1175 * refcnt - Reference count access to this object. 1163 * refcnt - Reference count access to this object.
1176 * dead - Do not attempt to use this object. 1164 * dead - Do not attempt to use this object.
1177 * malloced - Do we need to kfree this object?
1178 */ 1165 */
1179 atomic_t refcnt; 1166 atomic_t refcnt;
1180 char dead; 1167 bool dead;
1181 char malloced;
1182 1168
1183 /* What socket does this endpoint belong to? */ 1169 /* What socket does this endpoint belong to? */
1184 struct sock *sk; 1170 struct sock *sk;
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index ff1b8ba73ab1..00e50ba3f24b 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -49,7 +49,6 @@
49 49
50/* A structure to carry information to the ULP (e.g. Sockets API) */ 50/* A structure to carry information to the ULP (e.g. Sockets API) */
51struct sctp_ulpq { 51struct sctp_ulpq {
52 char malloced;
53 char pd_mode; 52 char pd_mode;
54 struct sctp_association *asoc; 53 struct sctp_association *asoc;
55 struct sk_buff_head reasm; 54 struct sk_buff_head reasm;
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
deleted file mode 100644
index 9a0ae091366d..000000000000
--- a/include/net/sctp/user.h
+++ /dev/null
@@ -1,782 +0,0 @@
1/* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2001, 2004
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2002 Intel Corp.
6 *
7 * This file is part of the SCTP kernel implementation
8 *
9 * This header represents the structures and constants needed to support
10 * the SCTP Extension to the Sockets API.
11 *
12 * This SCTP implementation is free software;
13 * you can redistribute it and/or modify it under the terms of
14 * the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * This SCTP implementation is distributed in the hope that it
19 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
20 * ************************
21 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 * See the GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with GNU CC; see the file COPYING. If not, write to
26 * the Free Software Foundation, 59 Temple Place - Suite 330,
27 * Boston, MA 02111-1307, USA.
28 *
29 * Please send any bug reports or fixes you make to the
30 * email address(es):
31 * lksctp developers <lksctp-developers@lists.sourceforge.net>
32 *
33 * Or submit a bug report through the following website:
34 * http://www.sf.net/projects/lksctp
35 *
36 * Written or modified by:
37 * La Monte H.P. Yarroll <piggy@acm.org>
38 * R. Stewart <randall@sctp.chicago.il.us>
39 * K. Morneau <kmorneau@cisco.com>
40 * Q. Xie <qxie1@email.mot.com>
41 * Karl Knutson <karl@athena.chicago.il.us>
42 * Jon Grimm <jgrimm@us.ibm.com>
43 * Daisy Chang <daisyc@us.ibm.com>
44 * Ryan Layer <rmlayer@us.ibm.com>
45 * Ardelle Fan <ardelle.fan@intel.com>
46 * Sridhar Samudrala <sri@us.ibm.com>
47 *
48 * Any bugs reported given to us we will try to fix... any fixes shared will
49 * be incorporated into the next SCTP release.
50 */
51
52#ifndef __net_sctp_user_h__
53#define __net_sctp_user_h__
54
55#include <linux/types.h>
56#include <linux/socket.h>
57
58typedef __s32 sctp_assoc_t;
59
60/* The following symbols come from the Sockets API Extensions for
61 * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
62 */
63#define SCTP_RTOINFO 0
64#define SCTP_ASSOCINFO 1
65#define SCTP_INITMSG 2
66#define SCTP_NODELAY 3 /* Get/set nodelay option. */
67#define SCTP_AUTOCLOSE 4
68#define SCTP_SET_PEER_PRIMARY_ADDR 5
69#define SCTP_PRIMARY_ADDR 6
70#define SCTP_ADAPTATION_LAYER 7
71#define SCTP_DISABLE_FRAGMENTS 8
72#define SCTP_PEER_ADDR_PARAMS 9
73#define SCTP_DEFAULT_SEND_PARAM 10
74#define SCTP_EVENTS 11
75#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */
76#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */
77#define SCTP_STATUS 14
78#define SCTP_GET_PEER_ADDR_INFO 15
79#define SCTP_DELAYED_ACK_TIME 16
80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
81#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
82#define SCTP_CONTEXT 17
83#define SCTP_FRAGMENT_INTERLEAVE 18
84#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
85#define SCTP_MAX_BURST 20 /* Set/Get max burst */
86#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */
87#define SCTP_HMAC_IDENT 22
88#define SCTP_AUTH_KEY 23
89#define SCTP_AUTH_ACTIVE_KEY 24
90#define SCTP_AUTH_DELETE_KEY 25
91#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */
92#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */
93#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
94#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */
95#define SCTP_AUTO_ASCONF 30
96#define SCTP_PEER_ADDR_THLDS 31
97
98/* Internal Socket Options. Some of the sctp library functions are
99 * implemented using these socket options.
100 */
101#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */
102#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */
103#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */
104/* Options 104-106 are deprecated and removed. Do not use this space */
105#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */
106#define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */
107#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */
108#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
109#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
110#define SCTP_GET_ASSOC_STATS 112 /* Read only */
111
112/*
113 * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
114 *
115 * This cmsghdr structure provides information for initializing new
116 * SCTP associations with sendmsg(). The SCTP_INITMSG socket option
117 * uses this same data structure. This structure is not used for
118 * recvmsg().
119 *
120 * cmsg_level cmsg_type cmsg_data[]
121 * ------------ ------------ ----------------------
122 * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
123 *
124 */
125struct sctp_initmsg {
126 __u16 sinit_num_ostreams;
127 __u16 sinit_max_instreams;
128 __u16 sinit_max_attempts;
129 __u16 sinit_max_init_timeo;
130};
131
132/*
133 * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
134 *
135 * This cmsghdr structure specifies SCTP options for sendmsg() and
136 * describes SCTP header information about a received message through
137 * recvmsg().
138 *
139 * cmsg_level cmsg_type cmsg_data[]
140 * ------------ ------------ ----------------------
141 * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
142 *
143 */
144struct sctp_sndrcvinfo {
145 __u16 sinfo_stream;
146 __u16 sinfo_ssn;
147 __u16 sinfo_flags;
148 __u32 sinfo_ppid;
149 __u32 sinfo_context;
150 __u32 sinfo_timetolive;
151 __u32 sinfo_tsn;
152 __u32 sinfo_cumtsn;
153 sctp_assoc_t sinfo_assoc_id;
154};
155
156/*
157 * sinfo_flags: 16 bits (unsigned integer)
158 *
159 * This field may contain any of the following flags and is composed of
160 * a bitwise OR of these values.
161 */
162
163enum sctp_sinfo_flags {
164 SCTP_UNORDERED = 1, /* Send/receive message unordered. */
165 SCTP_ADDR_OVER = 2, /* Override the primary destination. */
166 SCTP_ABORT=4, /* Send an ABORT message to the peer. */
167 SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
168 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
169};
170
171
172/* These are cmsg_types. */
173typedef enum sctp_cmsg_type {
174 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
175 SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
176} sctp_cmsg_t;
177
178
179/*
180 * 5.3.1.1 SCTP_ASSOC_CHANGE
181 *
182 * Communication notifications inform the ULP that an SCTP association
183 * has either begun or ended. The identifier for a new association is
184 * provided by this notificaion. The notification information has the
185 * following format:
186 *
187 */
188struct sctp_assoc_change {
189 __u16 sac_type;
190 __u16 sac_flags;
191 __u32 sac_length;
192 __u16 sac_state;
193 __u16 sac_error;
194 __u16 sac_outbound_streams;
195 __u16 sac_inbound_streams;
196 sctp_assoc_t sac_assoc_id;
197 __u8 sac_info[0];
198};
199
200/*
201 * sac_state: 32 bits (signed integer)
202 *
203 * This field holds one of a number of values that communicate the
204 * event that happened to the association. They include:
205 *
206 * Note: The following state names deviate from the API draft as
207 * the names clash too easily with other kernel symbols.
208 */
209enum sctp_sac_state {
210 SCTP_COMM_UP,
211 SCTP_COMM_LOST,
212 SCTP_RESTART,
213 SCTP_SHUTDOWN_COMP,
214 SCTP_CANT_STR_ASSOC,
215};
216
217/*
218 * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
219 *
220 * When a destination address on a multi-homed peer encounters a change
221 * an interface details event is sent. The information has the
222 * following structure:
223 */
224struct sctp_paddr_change {
225 __u16 spc_type;
226 __u16 spc_flags;
227 __u32 spc_length;
228 struct sockaddr_storage spc_aaddr;
229 int spc_state;
230 int spc_error;
231 sctp_assoc_t spc_assoc_id;
232} __attribute__((packed, aligned(4)));
233
234/*
235 * spc_state: 32 bits (signed integer)
236 *
237 * This field holds one of a number of values that communicate the
238 * event that happened to the address. They include:
239 */
240enum sctp_spc_state {
241 SCTP_ADDR_AVAILABLE,
242 SCTP_ADDR_UNREACHABLE,
243 SCTP_ADDR_REMOVED,
244 SCTP_ADDR_ADDED,
245 SCTP_ADDR_MADE_PRIM,
246 SCTP_ADDR_CONFIRMED,
247};
248
249
250/*
251 * 5.3.1.3 SCTP_REMOTE_ERROR
252 *
253 * A remote peer may send an Operational Error message to its peer.
254 * This message indicates a variety of error conditions on an
255 * association. The entire error TLV as it appears on the wire is
256 * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
257 * specification [SCTP] and any extensions for a list of possible
258 * error formats. SCTP error TLVs have the format:
259 */
260struct sctp_remote_error {
261 __u16 sre_type;
262 __u16 sre_flags;
263 __u32 sre_length;
264 __u16 sre_error;
265 sctp_assoc_t sre_assoc_id;
266 __u8 sre_data[0];
267};
268
269
270/*
271 * 5.3.1.4 SCTP_SEND_FAILED
272 *
273 * If SCTP cannot deliver a message it may return the message as a
274 * notification.
275 */
276struct sctp_send_failed {
277 __u16 ssf_type;
278 __u16 ssf_flags;
279 __u32 ssf_length;
280 __u32 ssf_error;
281 struct sctp_sndrcvinfo ssf_info;
282 sctp_assoc_t ssf_assoc_id;
283 __u8 ssf_data[0];
284};
285
286/*
287 * ssf_flags: 16 bits (unsigned integer)
288 *
289 * The flag value will take one of the following values
290 *
291 * SCTP_DATA_UNSENT - Indicates that the data was never put on
292 * the wire.
293 *
294 * SCTP_DATA_SENT - Indicates that the data was put on the wire.
295 * Note that this does not necessarily mean that the
296 * data was (or was not) successfully delivered.
297 */
298enum sctp_ssf_flags {
299 SCTP_DATA_UNSENT,
300 SCTP_DATA_SENT,
301};
302
303/*
304 * 5.3.1.5 SCTP_SHUTDOWN_EVENT
305 *
306 * When a peer sends a SHUTDOWN, SCTP delivers this notification to
307 * inform the application that it should cease sending data.
308 */
309struct sctp_shutdown_event {
310 __u16 sse_type;
311 __u16 sse_flags;
312 __u32 sse_length;
313 sctp_assoc_t sse_assoc_id;
314};
315
316/*
317 * 5.3.1.6 SCTP_ADAPTATION_INDICATION
318 *
319 * When a peer sends a Adaptation Layer Indication parameter , SCTP
320 * delivers this notification to inform the application
321 * that of the peers requested adaptation layer.
322 */
323struct sctp_adaptation_event {
324 __u16 sai_type;
325 __u16 sai_flags;
326 __u32 sai_length;
327 __u32 sai_adaptation_ind;
328 sctp_assoc_t sai_assoc_id;
329};
330
331/*
332 * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
333 *
334 * When a receiver is engaged in a partial delivery of a
335 * message this notification will be used to indicate
336 * various events.
337 */
338struct sctp_pdapi_event {
339 __u16 pdapi_type;
340 __u16 pdapi_flags;
341 __u32 pdapi_length;
342 __u32 pdapi_indication;
343 sctp_assoc_t pdapi_assoc_id;
344};
345
346enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
347
348struct sctp_authkey_event {
349 __u16 auth_type;
350 __u16 auth_flags;
351 __u32 auth_length;
352 __u16 auth_keynumber;
353 __u16 auth_altkeynumber;
354 __u32 auth_indication;
355 sctp_assoc_t auth_assoc_id;
356};
357
358enum { SCTP_AUTH_NEWKEY = 0, };
359
360/*
361 * 6.1.9. SCTP_SENDER_DRY_EVENT
362 *
363 * When the SCTP stack has no more user data to send or retransmit, this
364 * notification is given to the user. Also, at the time when a user app
365 * subscribes to this event, if there is no data to be sent or
366 * retransmit, the stack will immediately send up this notification.
367 */
368struct sctp_sender_dry_event {
369 __u16 sender_dry_type;
370 __u16 sender_dry_flags;
371 __u32 sender_dry_length;
372 sctp_assoc_t sender_dry_assoc_id;
373};
374
375/*
376 * Described in Section 7.3
377 * Ancillary Data and Notification Interest Options
378 */
379struct sctp_event_subscribe {
380 __u8 sctp_data_io_event;
381 __u8 sctp_association_event;
382 __u8 sctp_address_event;
383 __u8 sctp_send_failure_event;
384 __u8 sctp_peer_error_event;
385 __u8 sctp_shutdown_event;
386 __u8 sctp_partial_delivery_event;
387 __u8 sctp_adaptation_layer_event;
388 __u8 sctp_authentication_event;
389 __u8 sctp_sender_dry_event;
390};
391
392/*
393 * 5.3.1 SCTP Notification Structure
394 *
395 * The notification structure is defined as the union of all
396 * notification types.
397 *
398 */
399union sctp_notification {
400 struct {
401 __u16 sn_type; /* Notification type. */
402 __u16 sn_flags;
403 __u32 sn_length;
404 } sn_header;
405 struct sctp_assoc_change sn_assoc_change;
406 struct sctp_paddr_change sn_paddr_change;
407 struct sctp_remote_error sn_remote_error;
408 struct sctp_send_failed sn_send_failed;
409 struct sctp_shutdown_event sn_shutdown_event;
410 struct sctp_adaptation_event sn_adaptation_event;
411 struct sctp_pdapi_event sn_pdapi_event;
412 struct sctp_authkey_event sn_authkey_event;
413 struct sctp_sender_dry_event sn_sender_dry_event;
414};
415
416/* Section 5.3.1
417 * All standard values for sn_type flags are greater than 2^15.
418 * Values from 2^15 and down are reserved.
419 */
420
421enum sctp_sn_type {
422 SCTP_SN_TYPE_BASE = (1<<15),
423 SCTP_ASSOC_CHANGE,
424 SCTP_PEER_ADDR_CHANGE,
425 SCTP_SEND_FAILED,
426 SCTP_REMOTE_ERROR,
427 SCTP_SHUTDOWN_EVENT,
428 SCTP_PARTIAL_DELIVERY_EVENT,
429 SCTP_ADAPTATION_INDICATION,
430 SCTP_AUTHENTICATION_EVENT,
431#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT
432 SCTP_SENDER_DRY_EVENT,
433};
434
435/* Notification error codes used to fill up the error fields in some
436 * notifications.
437 * SCTP_PEER_ADDRESS_CHAGE : spc_error
438 * SCTP_ASSOC_CHANGE : sac_error
439 * These names should be potentially included in the draft 04 of the SCTP
440 * sockets API specification.
441 */
442typedef enum sctp_sn_error {
443 SCTP_FAILED_THRESHOLD,
444 SCTP_RECEIVED_SACK,
445 SCTP_HEARTBEAT_SUCCESS,
446 SCTP_RESPONSE_TO_USER_REQ,
447 SCTP_INTERNAL_ERROR,
448 SCTP_SHUTDOWN_GUARD_EXPIRES,
449 SCTP_PEER_FAULTY,
450} sctp_sn_error_t;
451
452/*
453 * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
454 *
455 * The protocol parameters used to initialize and bound retransmission
456 * timeout (RTO) are tunable. See [SCTP] for more information on how
457 * these parameters are used in RTO calculation.
458 */
459struct sctp_rtoinfo {
460 sctp_assoc_t srto_assoc_id;
461 __u32 srto_initial;
462 __u32 srto_max;
463 __u32 srto_min;
464};
465
466/*
467 * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
468 *
469 * This option is used to both examine and set various association and
470 * endpoint parameters.
471 */
472struct sctp_assocparams {
473 sctp_assoc_t sasoc_assoc_id;
474 __u16 sasoc_asocmaxrxt;
475 __u16 sasoc_number_peer_destinations;
476 __u32 sasoc_peer_rwnd;
477 __u32 sasoc_local_rwnd;
478 __u32 sasoc_cookie_life;
479};
480
481/*
482 * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
483 *
484 * Requests that the peer mark the enclosed address as the association
485 * primary. The enclosed address must be one of the association's
486 * locally bound addresses. The following structure is used to make a
487 * set primary request:
488 */
489struct sctp_setpeerprim {
490 sctp_assoc_t sspp_assoc_id;
491 struct sockaddr_storage sspp_addr;
492} __attribute__((packed, aligned(4)));
493
494/*
495 * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
496 *
497 * Requests that the local SCTP stack use the enclosed peer address as
498 * the association primary. The enclosed address must be one of the
499 * association peer's addresses. The following structure is used to
500 * make a set peer primary request:
501 */
502struct sctp_prim {
503 sctp_assoc_t ssp_assoc_id;
504 struct sockaddr_storage ssp_addr;
505} __attribute__((packed, aligned(4)));
506
507/*
508 * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
509 *
510 * Requests that the local endpoint set the specified Adaptation Layer
511 * Indication parameter for all future INIT and INIT-ACK exchanges.
512 */
513struct sctp_setadaptation {
514 __u32 ssb_adaptation_ind;
515};
516
517/*
518 * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
519 *
520 * Applications can enable or disable heartbeats for any peer address
521 * of an association, modify an address's heartbeat interval, force a
522 * heartbeat to be sent immediately, and adjust the address's maximum
523 * number of retransmissions sent before an address is considered
524 * unreachable. The following structure is used to access and modify an
525 * address's parameters:
526 */
527enum sctp_spp_flags {
528 SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
529 SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
530 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
531 SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
532 SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
533 SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
534 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
535 SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
536 SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
537 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
538 SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
539};
540
541struct sctp_paddrparams {
542 sctp_assoc_t spp_assoc_id;
543 struct sockaddr_storage spp_address;
544 __u32 spp_hbinterval;
545 __u16 spp_pathmaxrxt;
546 __u32 spp_pathmtu;
547 __u32 spp_sackdelay;
548 __u32 spp_flags;
549} __attribute__((packed, aligned(4)));
550
551/*
552 * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
553 *
554 * This set option adds a chunk type that the user is requesting to be
555 * received only in an authenticated way. Changes to the list of chunks
556 * will only effect future associations on the socket.
557 */
558struct sctp_authchunk {
559 __u8 sauth_chunk;
560};
561
562/*
563 * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
564 *
565 * This option gets or sets the list of HMAC algorithms that the local
566 * endpoint requires the peer to use.
567*/
568struct sctp_hmacalgo {
569 __u32 shmac_num_idents;
570 __u16 shmac_idents[];
571};
572
573/*
574 * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
575 *
576 * This option will set a shared secret key which is used to build an
577 * association shared key.
578 */
579struct sctp_authkey {
580 sctp_assoc_t sca_assoc_id;
581 __u16 sca_keynumber;
582 __u16 sca_keylength;
583 __u8 sca_key[];
584};
585
586/*
587 * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
588 *
589 * This option will get or set the active shared key to be used to build
590 * the association shared key.
591 */
592
593struct sctp_authkeyid {
594 sctp_assoc_t scact_assoc_id;
595 __u16 scact_keynumber;
596};
597
598
599/*
600 * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK)
601 *
602 * This option will effect the way delayed acks are performed. This
603 * option allows you to get or set the delayed ack time, in
604 * milliseconds. It also allows changing the delayed ack frequency.
605 * Changing the frequency to 1 disables the delayed sack algorithm. If
606 * the assoc_id is 0, then this sets or gets the endpoints default
607 * values. If the assoc_id field is non-zero, then the set or get
608 * effects the specified association for the one to many model (the
609 * assoc_id field is ignored by the one to one model). Note that if
610 * sack_delay or sack_freq are 0 when setting this option, then the
611 * current values will remain unchanged.
612 */
613struct sctp_sack_info {
614 sctp_assoc_t sack_assoc_id;
615 uint32_t sack_delay;
616 uint32_t sack_freq;
617};
618
619struct sctp_assoc_value {
620 sctp_assoc_t assoc_id;
621 uint32_t assoc_value;
622};
623
624/*
625 * 7.2.2 Peer Address Information
626 *
627 * Applications can retrieve information about a specific peer address
628 * of an association, including its reachability state, congestion
629 * window, and retransmission timer values. This information is
630 * read-only. The following structure is used to access this
631 * information:
632 */
633struct sctp_paddrinfo {
634 sctp_assoc_t spinfo_assoc_id;
635 struct sockaddr_storage spinfo_address;
636 __s32 spinfo_state;
637 __u32 spinfo_cwnd;
638 __u32 spinfo_srtt;
639 __u32 spinfo_rto;
640 __u32 spinfo_mtu;
641} __attribute__((packed, aligned(4)));
642
643/* Peer addresses's state. */
644/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
645 * calls.
646 * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
647 * Not yet confirmed by a heartbeat and not available for data
648 * transfers.
649 * ACTIVE : Peer address confirmed, active and available for data transfers.
650 * INACTIVE: Peer address inactive and not available for data transfers.
651 */
652enum sctp_spinfo_state {
653 SCTP_INACTIVE,
654 SCTP_PF,
655 SCTP_ACTIVE,
656 SCTP_UNCONFIRMED,
657 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
658};
659
660/*
661 * 7.2.1 Association Status (SCTP_STATUS)
662 *
663 * Applications can retrieve current status information about an
664 * association, including association state, peer receiver window size,
665 * number of unacked data chunks, and number of data chunks pending
666 * receipt. This information is read-only. The following structure is
667 * used to access this information:
668 */
669struct sctp_status {
670 sctp_assoc_t sstat_assoc_id;
671 __s32 sstat_state;
672 __u32 sstat_rwnd;
673 __u16 sstat_unackdata;
674 __u16 sstat_penddata;
675 __u16 sstat_instrms;
676 __u16 sstat_outstrms;
677 __u32 sstat_fragmentation_point;
678 struct sctp_paddrinfo sstat_primary;
679};
680
681/*
682 * 7.2.3. Get the list of chunks the peer requires to be authenticated
683 * (SCTP_PEER_AUTH_CHUNKS)
684 *
685 * This option gets a list of chunks for a specified association that
686 * the peer requires to be received authenticated only.
687 */
688struct sctp_authchunks {
689 sctp_assoc_t gauth_assoc_id;
690 __u32 gauth_number_of_chunks;
691 uint8_t gauth_chunks[];
692};
693
694/*
695 * 8.2.6. Get the Current Identifiers of Associations
696 * (SCTP_GET_ASSOC_ID_LIST)
697 *
698 * This option gets the current list of SCTP association identifiers of
699 * the SCTP associations handled by a one-to-many style socket.
700 */
701struct sctp_assoc_ids {
702 __u32 gaids_number_of_ids;
703 sctp_assoc_t gaids_assoc_id[];
704};
705
706/*
707 * 8.3, 8.5 get all peer/local addresses in an association.
708 * This parameter struct is used by SCTP_GET_PEER_ADDRS and
709 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
710 * sctp_getpaddrs() and sctp_getladdrs() API.
711 */
712struct sctp_getaddrs_old {
713 sctp_assoc_t assoc_id;
714 int addr_num;
715 struct sockaddr __user *addrs;
716};
717struct sctp_getaddrs {
718 sctp_assoc_t assoc_id; /*input*/
719 __u32 addr_num; /*output*/
720 __u8 addrs[0]; /*output, variable size*/
721};
722
723/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
724 * association stats. All stats are counts except sas_maxrto and
725 * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
726 * the last call. Will return 0 when RTO was not update since last call
727 */
728struct sctp_assoc_stats {
729 sctp_assoc_t sas_assoc_id; /* Input */
730 /* Transport of observed max RTO */
731 struct sockaddr_storage sas_obs_rto_ipaddr;
732 __u64 sas_maxrto; /* Maximum Observed RTO for period */
733 __u64 sas_isacks; /* SACKs received */
734 __u64 sas_osacks; /* SACKs sent */
735 __u64 sas_opackets; /* Packets sent */
736 __u64 sas_ipackets; /* Packets received */
737 __u64 sas_rtxchunks; /* Retransmitted Chunks */
738 __u64 sas_outofseqtsns;/* TSN received > next expected */
739 __u64 sas_idupchunks; /* Dups received (ordered+unordered) */
740 __u64 sas_gapcnt; /* Gap Acknowledgements Received */
741 __u64 sas_ouodchunks; /* Unordered data chunks sent */
742 __u64 sas_iuodchunks; /* Unordered data chunks received */
743 __u64 sas_oodchunks; /* Ordered data chunks sent */
744 __u64 sas_iodchunks; /* Ordered data chunks received */
745 __u64 sas_octrlchunks; /* Control chunks sent */
746 __u64 sas_ictrlchunks; /* Control chunks received */
747};
748
749/* These are bit fields for msghdr->msg_flags. See section 5.1. */
750/* On user space Linux, these live in <bits/socket.h> as an enum. */
751enum sctp_msg_flags {
752 MSG_NOTIFICATION = 0x8000,
753#define MSG_NOTIFICATION MSG_NOTIFICATION
754};
755
756/*
757 * 8.1 sctp_bindx()
758 *
759 * The flags parameter is formed from the bitwise OR of zero or more of the
760 * following currently defined flags:
761 */
762#define SCTP_BINDX_ADD_ADDR 0x01
763#define SCTP_BINDX_REM_ADDR 0x02
764
765/* This is the structure that is passed as an argument(optval) to
766 * getsockopt(SCTP_SOCKOPT_PEELOFF).
767 */
768typedef struct {
769 sctp_assoc_t associd;
770 int sd;
771} sctp_peeloff_arg_t;
772
773/*
774 * Peer Address Thresholds socket option
775 */
776struct sctp_paddrthlds {
777 sctp_assoc_t spt_assoc_id;
778 struct sockaddr_storage spt_address;
779 __u16 spt_pathmaxrxt;
780 __u16 spt_pathpfthld;
781};
782#endif /* __net_sctp_user_h__ */
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
index c2e542b27a5a..6ca975bebd37 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern void net_secret_init(void);
6extern __u32 secure_ip_id(__be32 daddr); 7extern __u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ipv6_id(const __be32 daddr[4]); 8extern __u32 secure_ipv6_id(const __be32 daddr[4]);
8extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 9extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
diff --git a/include/net/sock.h b/include/net/sock.h
index 14f6e9d19dc7..5c97b0fc5623 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -667,6 +667,7 @@ enum sock_flags {
667 * user-space instead. 667 * user-space instead.
668 */ 668 */
669 SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */ 669 SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */
670 SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */
670}; 671};
671 672
672static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 673static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -2158,10 +2159,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2158 * @sk: socket sending this packet 2159 * @sk: socket sending this packet
2159 * @tx_flags: filled with instructions for time stamping 2160 * @tx_flags: filled with instructions for time stamping
2160 * 2161 *
2161 * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if 2162 * Currently only depends on SOCK_TIMESTAMPING* flags.
2162 * parameters are invalid.
2163 */ 2163 */
2164extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2164extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2165 2165
2166/** 2166/**
2167 * sk_eat_skb - Release a skb if it is no longer needed 2167 * sk_eat_skb - Release a skb if it is no longer needed
diff --git a/include/net/tcp.h b/include/net/tcp.h
index cf0694d4ad60..5bba80fbd1d9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -179,7 +179,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
179#define TCPOPT_SACK 5 /* SACK Block */ 179#define TCPOPT_SACK 5 /* SACK Block */
180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
182#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */
183#define TCPOPT_EXP 254 /* Experimental */ 182#define TCPOPT_EXP 254 /* Experimental */
184/* Magic number to be after the option value for sharing TCP 183/* Magic number to be after the option value for sharing TCP
185 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt 184 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt
@@ -273,7 +272,6 @@ extern int sysctl_tcp_app_win;
273extern int sysctl_tcp_adv_win_scale; 272extern int sysctl_tcp_adv_win_scale;
274extern int sysctl_tcp_tw_reuse; 273extern int sysctl_tcp_tw_reuse;
275extern int sysctl_tcp_frto; 274extern int sysctl_tcp_frto;
276extern int sysctl_tcp_frto_response;
277extern int sysctl_tcp_low_latency; 275extern int sysctl_tcp_low_latency;
278extern int sysctl_tcp_dma_copybreak; 276extern int sysctl_tcp_dma_copybreak;
279extern int sysctl_tcp_nometrics_save; 277extern int sysctl_tcp_nometrics_save;
@@ -284,7 +282,6 @@ extern int sysctl_tcp_base_mss;
284extern int sysctl_tcp_workaround_signed_windows; 282extern int sysctl_tcp_workaround_signed_windows;
285extern int sysctl_tcp_slow_start_after_idle; 283extern int sysctl_tcp_slow_start_after_idle;
286extern int sysctl_tcp_max_ssthresh; 284extern int sysctl_tcp_max_ssthresh;
287extern int sysctl_tcp_cookie_size;
288extern int sysctl_tcp_thin_linear_timeouts; 285extern int sysctl_tcp_thin_linear_timeouts;
289extern int sysctl_tcp_thin_dupack; 286extern int sysctl_tcp_thin_dupack;
290extern int sysctl_tcp_early_retrans; 287extern int sysctl_tcp_early_retrans;
@@ -373,6 +370,7 @@ extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
373extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 370extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
374 size_t size, int flags); 371 size_t size, int flags);
375extern void tcp_release_cb(struct sock *sk); 372extern void tcp_release_cb(struct sock *sk);
373extern void tcp_wfree(struct sk_buff *skb);
376extern void tcp_write_timer_handler(struct sock *sk); 374extern void tcp_write_timer_handler(struct sock *sk);
377extern void tcp_delack_timer_handler(struct sock *sk); 375extern void tcp_delack_timer_handler(struct sock *sk);
378extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 376extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
@@ -425,8 +423,6 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
425 bool fastopen); 423 bool fastopen);
426extern int tcp_child_process(struct sock *parent, struct sock *child, 424extern int tcp_child_process(struct sock *parent, struct sock *child,
427 struct sk_buff *skb); 425 struct sk_buff *skb);
428extern bool tcp_use_frto(struct sock *sk);
429extern void tcp_enter_frto(struct sock *sk);
430extern void tcp_enter_loss(struct sock *sk, int how); 426extern void tcp_enter_loss(struct sock *sk, int how);
431extern void tcp_clear_retrans(struct tcp_sock *tp); 427extern void tcp_clear_retrans(struct tcp_sock *tp);
432extern void tcp_update_metrics(struct sock *sk); 428extern void tcp_update_metrics(struct sock *sk);
@@ -454,7 +450,7 @@ extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
454extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 450extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
455 size_t len, int nonblock, int flags, int *addr_len); 451 size_t len, int nonblock, int flags, int *addr_len);
456extern void tcp_parse_options(const struct sk_buff *skb, 452extern void tcp_parse_options(const struct sk_buff *skb,
457 struct tcp_options_received *opt_rx, const u8 **hvpp, 453 struct tcp_options_received *opt_rx,
458 int estab, struct tcp_fastopen_cookie *foc); 454 int estab, struct tcp_fastopen_cookie *foc);
459extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); 455extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
460 456
@@ -476,7 +472,6 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
476extern int tcp_connect(struct sock *sk); 472extern int tcp_connect(struct sock *sk);
477extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 473extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
478 struct request_sock *req, 474 struct request_sock *req,
479 struct request_values *rvp,
480 struct tcp_fastopen_cookie *foc); 475 struct tcp_fastopen_cookie *foc);
481extern int tcp_disconnect(struct sock *sk, int flags); 476extern int tcp_disconnect(struct sock *sk, int flags);
482 477
@@ -543,6 +538,8 @@ extern bool tcp_syn_flood_action(struct sock *sk,
543extern void tcp_push_one(struct sock *, unsigned int mss_now); 538extern void tcp_push_one(struct sock *, unsigned int mss_now);
544extern void tcp_send_ack(struct sock *sk); 539extern void tcp_send_ack(struct sock *sk);
545extern void tcp_send_delayed_ack(struct sock *sk); 540extern void tcp_send_delayed_ack(struct sock *sk);
541extern void tcp_send_loss_probe(struct sock *sk);
542extern bool tcp_schedule_loss_probe(struct sock *sk);
546 543
547/* tcp_input.c */ 544/* tcp_input.c */
548extern void tcp_cwnd_application_limited(struct sock *sk); 545extern void tcp_cwnd_application_limited(struct sock *sk);
@@ -756,7 +753,6 @@ enum tcp_ca_event {
756 CA_EVENT_TX_START, /* first transmit when no packets in flight */ 753 CA_EVENT_TX_START, /* first transmit when no packets in flight */
757 CA_EVENT_CWND_RESTART, /* congestion window restart */ 754 CA_EVENT_CWND_RESTART, /* congestion window restart */
758 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ 755 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */
759 CA_EVENT_FRTO, /* fast recovery timeout */
760 CA_EVENT_LOSS, /* loss timeout */ 756 CA_EVENT_LOSS, /* loss timeout */
761 CA_EVENT_FAST_ACK, /* in sequence ack */ 757 CA_EVENT_FAST_ACK, /* in sequence ack */
762 CA_EVENT_SLOW_ACK, /* other ack */ 758 CA_EVENT_SLOW_ACK, /* other ack */
@@ -873,8 +869,8 @@ static inline void tcp_enable_fack(struct tcp_sock *tp)
873static inline void tcp_enable_early_retrans(struct tcp_sock *tp) 869static inline void tcp_enable_early_retrans(struct tcp_sock *tp)
874{ 870{
875 tp->do_early_retrans = sysctl_tcp_early_retrans && 871 tp->do_early_retrans = sysctl_tcp_early_retrans &&
876 !sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3; 872 sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack &&
877 tp->early_retrans_delayed = 0; 873 sysctl_tcp_reordering == 3;
878} 874}
879 875
880static inline void tcp_disable_early_retrans(struct tcp_sock *tp) 876static inline void tcp_disable_early_retrans(struct tcp_sock *tp)
@@ -1030,50 +1026,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1030#endif 1026#endif
1031} 1027}
1032 1028
1033/* Packet is added to VJ-style prequeue for processing in process 1029extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
1034 * context, if a reader task is waiting. Apparently, this exciting
1035 * idea (VJ's mail "Re: query about TCP header on tcp-ip" of 07 Sep 93)
1036 * failed somewhere. Latency? Burstiness? Well, at least now we will
1037 * see, why it failed. 8)8) --ANK
1038 *
1039 * NOTE: is this not too big to inline?
1040 */
1041static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
1042{
1043 struct tcp_sock *tp = tcp_sk(sk);
1044
1045 if (sysctl_tcp_low_latency || !tp->ucopy.task)
1046 return false;
1047
1048 if (skb->len <= tcp_hdrlen(skb) &&
1049 skb_queue_len(&tp->ucopy.prequeue) == 0)
1050 return false;
1051
1052 __skb_queue_tail(&tp->ucopy.prequeue, skb);
1053 tp->ucopy.memory += skb->truesize;
1054 if (tp->ucopy.memory > sk->sk_rcvbuf) {
1055 struct sk_buff *skb1;
1056
1057 BUG_ON(sock_owned_by_user(sk));
1058
1059 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
1060 sk_backlog_rcv(sk, skb1);
1061 NET_INC_STATS_BH(sock_net(sk),
1062 LINUX_MIB_TCPPREQUEUEDROPPED);
1063 }
1064
1065 tp->ucopy.memory = 0;
1066 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
1067 wake_up_interruptible_sync_poll(sk_sleep(sk),
1068 POLLIN | POLLRDNORM | POLLRDBAND);
1069 if (!inet_csk_ack_scheduled(sk))
1070 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
1071 (3 * tcp_rto_min(sk)) / 4,
1072 TCP_RTO_MAX);
1073 }
1074 return true;
1075}
1076
1077 1030
1078#undef STATE_TRACE 1031#undef STATE_TRACE
1079 1032
@@ -1630,91 +1583,6 @@ struct tcp_request_sock_ops {
1630#endif 1583#endif
1631}; 1584};
1632 1585
1633/* Using SHA1 for now, define some constants.
1634 */
1635#define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS)
1636#define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4)
1637#define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS)
1638
1639extern int tcp_cookie_generator(u32 *bakery);
1640
1641/**
1642 * struct tcp_cookie_values - each socket needs extra space for the
1643 * cookies, together with (optional) space for any SYN data.
1644 *
1645 * A tcp_sock contains a pointer to the current value, and this is
1646 * cloned to the tcp_timewait_sock.
1647 *
1648 * @cookie_pair: variable data from the option exchange.
1649 *
1650 * @cookie_desired: user specified tcpct_cookie_desired. Zero
1651 * indicates default (sysctl_tcp_cookie_size).
1652 * After cookie sent, remembers size of cookie.
1653 * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX.
1654 *
1655 * @s_data_desired: user specified tcpct_s_data_desired. When the
1656 * constant payload is specified (@s_data_constant),
1657 * holds its length instead.
1658 * Range 0 to TCP_MSS_DESIRED.
1659 *
1660 * @s_data_payload: constant data that is to be included in the
1661 * payload of SYN or SYNACK segments when the
1662 * cookie option is present.
1663 */
1664struct tcp_cookie_values {
1665 struct kref kref;
1666 u8 cookie_pair[TCP_COOKIE_PAIR_SIZE];
1667 u8 cookie_pair_size;
1668 u8 cookie_desired;
1669 u16 s_data_desired:11,
1670 s_data_constant:1,
1671 s_data_in:1,
1672 s_data_out:1,
1673 s_data_unused:2;
1674 u8 s_data_payload[0];
1675};
1676
1677static inline void tcp_cookie_values_release(struct kref *kref)
1678{
1679 kfree(container_of(kref, struct tcp_cookie_values, kref));
1680}
1681
1682/* The length of constant payload data. Note that s_data_desired is
1683 * overloaded, depending on s_data_constant: either the length of constant
1684 * data (returned here) or the limit on variable data.
1685 */
1686static inline int tcp_s_data_size(const struct tcp_sock *tp)
1687{
1688 return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant)
1689 ? tp->cookie_values->s_data_desired
1690 : 0;
1691}
1692
1693/**
1694 * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace.
1695 *
1696 * As tcp_request_sock has already been extended in other places, the
1697 * only remaining method is to pass stack values along as function
1698 * parameters. These parameters are not needed after sending SYNACK.
1699 *
1700 * @cookie_bakery: cryptographic secret and message workspace.
1701 *
1702 * @cookie_plus: bytes in authenticator/cookie option, copied from
1703 * struct tcp_options_received (above).
1704 */
1705struct tcp_extend_values {
1706 struct request_values rv;
1707 u32 cookie_bakery[COOKIE_WORKSPACE_WORDS];
1708 u8 cookie_plus:6,
1709 cookie_out_never:1,
1710 cookie_in_always:1;
1711};
1712
1713static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp)
1714{
1715 return (struct tcp_extend_values *)rvp;
1716}
1717
1718extern void tcp_v4_init(void); 1586extern void tcp_v4_init(void);
1719extern void tcp_init(void); 1587extern void tcp_init(void);
1720 1588
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 24c8886fd969..ae16531d0d35 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -162,6 +162,7 @@ struct xfrm_state {
162 xfrm_address_t saddr; 162 xfrm_address_t saddr;
163 int header_len; 163 int header_len;
164 int trailer_len; 164 int trailer_len;
165 u32 extra_flags;
165 } props; 166 } props;
166 167
167 struct xfrm_lifetime_cfg lft; 168 struct xfrm_lifetime_cfg lft;