aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-24 13:01:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-24 13:01:50 -0400
commit3c4cfadef6a1665d9cd02a543782d03d3e6740c6 (patch)
tree3df72faaacd494d5ac8c9668df4f529b1b5e4457 /include/net
parente017507f37d5cb8b541df165a824958bc333bec3 (diff)
parent320f5ea0cedc08ef65d67e056bcb9d181386ef2c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking changes from David S Miller: 1) Remove the ipv4 routing cache. Now lookups go directly into the FIB trie and use prebuilt routes cached there. No more garbage collection, no more rDOS attacks on the routing cache. Instead we now get predictable and consistent performance, no matter what the pattern of traffic we service. This has been almost 2 years in the making. Special thanks to Julian Anastasov, Eric Dumazet, Steffen Klassert, and others who have helped along the way. I'm sure that with a change of this magnitude there will be some kind of fallout, but such things ought the be simple to fix at this point. Luckily I'm not European so I'll be around all of August to fix things :-) The major stages of this work here are each fronted by a forced merge commit whose commit message contains a top-level description of the motivations and implementation issues. 2) Pre-demux of established ipv4 TCP sockets, saves a route demux on input. 3) TCP SYN/ACK performance tweaks from Eric Dumazet. 4) Add namespace support for netfilter L4 conntrack helpers, from Gao Feng. 5) Add config mechanism for Energy Efficient Ethernet to ethtool, from Yuval Mintz. 6) Remove quadratic behavior from /proc/net/unix, from Eric Dumazet. 7) Support for connection tracker helpers in userspace, from Pablo Neira Ayuso. 8) Allow userspace driven TX load balancing functions in TEAM driver, from Jiri Pirko. 9) Kill off NLMSG_PUT and RTA_PUT macros, more gross stuff with embedded gotos. 10) TCP Small Queues, essentially minimize the amount of TCP data queued up in the packet scheduler layer. Whereas the existing BQL (Byte Queue Limits) limits the pkt_sched --> netdevice queuing levels, this controls the TCP --> pkt_sched queueing levels. From Eric Dumazet. 11) Reduce the number of get_page/put_page ops done on SKB fragments, from Alexander Duyck. 12) Implement protection against blind resets in TCP (RFC 5961), from Eric Dumazet. 13) Support the client side of TCP Fast Open, basically the ability to send data in the SYN exchange, from Yuchung Cheng. Basically, the sender queues up data with a sendmsg() call using MSG_FASTOPEN, then they do the connect() which emits the queued up fastopen data. 14) Avoid all the problems we get into in TCP when timers or PMTU events hit a locked socket. The TCP Small Queues changes added a tcp_release_cb() that allows us to queue work up to the release_sock() caller, and that's what we use here too. From Eric Dumazet. 15) Zero copy on TX support for TUN driver, from Michael S. Tsirkin. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1870 commits) genetlink: define lockdep_genl_is_held() when CONFIG_LOCKDEP r8169: revert "add byte queue limit support". ipv4: Change rt->rt_iif encoding. net: Make skb->skb_iif always track skb->dev ipv4: Prepare for change of rt->rt_iif encoding. ipv4: Remove all RTCF_DIRECTSRC handliing. ipv4: Really ignore ICMP address requests/replies. decnet: Don't set RTCF_DIRECTSRC. net/ipv4/ip_vti.c: Fix __rcu warnings detected by sparse. ipv4: Remove redundant assignment rds: set correct msg_namelen openvswitch: potential NULL deref in sample() tcp: dont drop MTU reduction indications bnx2x: Add new 57840 device IDs tcp: avoid oops in tcp_metrics and reset tcpm_stamp niu: Change niu_rbr_fill() to use unlikely() to check niu_rbr_add_page() return value niu: Fix to check for dma mapping errors. net: Fix references to out-of-scope variables in put_cmsg_compat() net: ethernet: davinci_emac: add pm_runtime support net: ethernet: davinci_emac: Remove unnecessary #include ...
Diffstat (limited to 'include/net')
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/af_unix.h3
-rw-r--r--include/net/arp.h25
-rw-r--r--include/net/bluetooth/a2mp.h126
-rw-r--r--include/net/bluetooth/bluetooth.h39
-rw-r--r--include/net/bluetooth/hci.h110
-rw-r--r--include/net/bluetooth/hci_core.h37
-rw-r--r--include/net/bluetooth/l2cap.h210
-rw-r--r--include/net/bluetooth/mgmt.h2
-rw-r--r--include/net/caif/caif_hsi.h71
-rw-r--r--include/net/cfg80211.h278
-rw-r--r--include/net/dn_route.h2
-rw-r--r--include/net/dst.h92
-rw-r--r--include/net/dst_ops.h10
-rw-r--r--include/net/fib_rules.h1
-rw-r--r--include/net/flow.h3
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/inet6_connection_sock.h3
-rw-r--r--include/net/inet_common.h6
-rw-r--r--include/net/inet_connection_sock.h3
-rw-r--r--include/net/inet_hashtables.h4
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/inetpeer.h90
-rw-r--r--include/net/ip.h8
-rw-r--r--include/net/ip6_fib.h35
-rw-r--r--include/net/ip6_route.h41
-rw-r--r--include/net/ip6_tunnel.h2
-rw-r--r--include/net/ip_fib.h83
-rw-r--r--include/net/ipv6.h39
-rw-r--r--include/net/mac80211.h109
-rw-r--r--include/net/mac802154.h8
-rw-r--r--include/net/ndisc.h50
-rw-r--r--include/net/neighbour.h26
-rw-r--r--include/net/net_namespace.h1
-rw-r--r--include/net/netevent.h4
-rw-r--r--include/net/netfilter/nf_conntrack.h35
-rw-r--r--include/net/netfilter/nf_conntrack_core.h4
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h4
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h9
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h29
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h11
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h33
-rw-r--r--include/net/netfilter/nf_nat_helper.h4
-rw-r--r--include/net/netfilter/nfnetlink_queue.h43
-rw-r--r--include/net/netns/conntrack.h55
-rw-r--r--include/net/netns/ipv4.h14
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/netprio_cgroup.h4
-rw-r--r--include/net/nfc/hci.h22
-rw-r--r--include/net/nfc/nfc.h16
-rw-r--r--include/net/nfc/shdlc.h3
-rw-r--r--include/net/protocol.h8
-rw-r--r--include/net/regulatory.h5
-rw-r--r--include/net/route.h76
-rw-r--r--include/net/rtnetlink.h10
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--include/net/sctp/constants.h1
-rw-r--r--include/net/sctp/sctp.h6
-rw-r--r--include/net/sctp/structs.h24
-rw-r--r--include/net/sctp/user.h11
-rw-r--r--include/net/sock.h8
-rw-r--r--include/net/tcp.h48
-rw-r--r--include/net/timewait_sock.h8
-rw-r--r--include/net/xfrm.h12
64 files changed, 1383 insertions, 652 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index f2b801c4b555..089a09d001d1 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -46,7 +46,8 @@ struct prefix_info {
46#include <net/if_inet6.h> 46#include <net/if_inet6.h>
47#include <net/ipv6.h> 47#include <net/ipv6.h>
48 48
49#define IN6_ADDR_HSIZE 16 49#define IN6_ADDR_HSIZE_SHIFT 4
50#define IN6_ADDR_HSIZE (1 << IN6_ADDR_HSIZE_SHIFT)
50 51
51extern int addrconf_init(void); 52extern int addrconf_init(void);
52extern void addrconf_cleanup(void); 53extern void addrconf_cleanup(void);
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 2ee33da36a7a..b5f8988e4283 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -14,10 +14,11 @@ extern struct sock *unix_get_socket(struct file *filp);
14extern struct sock *unix_peer_get(struct sock *); 14extern struct sock *unix_peer_get(struct sock *);
15 15
16#define UNIX_HASH_SIZE 256 16#define UNIX_HASH_SIZE 256
17#define UNIX_HASH_BITS 8
17 18
18extern unsigned int unix_tot_inflight; 19extern unsigned int unix_tot_inflight;
19extern spinlock_t unix_table_lock; 20extern spinlock_t unix_table_lock;
20extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; 21extern struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE];
21 22
22struct unix_address { 23struct unix_address {
23 atomic_t refcnt; 24 atomic_t refcnt;
diff --git a/include/net/arp.h b/include/net/arp.h
index 4a1f3fb562eb..7f7df93f37cd 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -15,24 +15,31 @@ static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd
15 return val * hash_rnd; 15 return val * hash_rnd;
16} 16}
17 17
18static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key) 18static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
19{ 19{
20 struct neigh_hash_table *nht; 20 struct neigh_hash_table *nht = rcu_dereference_bh(arp_tbl.nht);
21 struct neighbour *n; 21 struct neighbour *n;
22 u32 hash_val; 22 u32 hash_val;
23 23
24 rcu_read_lock_bh();
25 nht = rcu_dereference_bh(arp_tbl.nht);
26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); 24 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); 25 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
28 n != NULL; 26 n != NULL;
29 n = rcu_dereference_bh(n->next)) { 27 n = rcu_dereference_bh(n->next)) {
30 if (n->dev == dev && *(u32 *)n->primary_key == key) { 28 if (n->dev == dev && *(u32 *)n->primary_key == key)
31 if (!atomic_inc_not_zero(&n->refcnt)) 29 return n;
32 n = NULL;
33 break;
34 }
35 } 30 }
31
32 return NULL;
33}
34
35static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
36{
37 struct neighbour *n;
38
39 rcu_read_lock_bh();
40 n = __ipv4_neigh_lookup_noref(dev, key);
41 if (n && !atomic_inc_not_zero(&n->refcnt))
42 n = NULL;
36 rcu_read_unlock_bh(); 43 rcu_read_unlock_bh();
37 44
38 return n; 45 return n;
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
new file mode 100644
index 000000000000..6a76e0a0705e
--- /dev/null
+++ b/include/net/bluetooth/a2mp.h
@@ -0,0 +1,126 @@
1/*
2 Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
3 Copyright (c) 2011,2012 Intel Corp.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 and
7 only version 2 as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef __A2MP_H
16#define __A2MP_H
17
18#include <net/bluetooth/l2cap.h>
19
20#define A2MP_FEAT_EXT 0x8000
21
22struct amp_mgr {
23 struct l2cap_conn *l2cap_conn;
24 struct l2cap_chan *a2mp_chan;
25 struct kref kref;
26 __u8 ident;
27 __u8 handle;
28 unsigned long flags;
29};
30
31struct a2mp_cmd {
32 __u8 code;
33 __u8 ident;
34 __le16 len;
35 __u8 data[0];
36} __packed;
37
38/* A2MP command codes */
39#define A2MP_COMMAND_REJ 0x01
40struct a2mp_cmd_rej {
41 __le16 reason;
42 __u8 data[0];
43} __packed;
44
45#define A2MP_DISCOVER_REQ 0x02
46struct a2mp_discov_req {
47 __le16 mtu;
48 __le16 ext_feat;
49} __packed;
50
51struct a2mp_cl {
52 __u8 id;
53 __u8 type;
54 __u8 status;
55} __packed;
56
57#define A2MP_DISCOVER_RSP 0x03
58struct a2mp_discov_rsp {
59 __le16 mtu;
60 __le16 ext_feat;
61 struct a2mp_cl cl[0];
62} __packed;
63
64#define A2MP_CHANGE_NOTIFY 0x04
65#define A2MP_CHANGE_RSP 0x05
66
67#define A2MP_GETINFO_REQ 0x06
68struct a2mp_info_req {
69 __u8 id;
70} __packed;
71
72#define A2MP_GETINFO_RSP 0x07
73struct a2mp_info_rsp {
74 __u8 id;
75 __u8 status;
76 __le32 total_bw;
77 __le32 max_bw;
78 __le32 min_latency;
79 __le16 pal_cap;
80 __le16 assoc_size;
81} __packed;
82
83#define A2MP_GETAMPASSOC_REQ 0x08
84struct a2mp_amp_assoc_req {
85 __u8 id;
86} __packed;
87
88#define A2MP_GETAMPASSOC_RSP 0x09
89struct a2mp_amp_assoc_rsp {
90 __u8 id;
91 __u8 status;
92 __u8 amp_assoc[0];
93} __packed;
94
95#define A2MP_CREATEPHYSLINK_REQ 0x0A
96#define A2MP_DISCONNPHYSLINK_REQ 0x0C
97struct a2mp_physlink_req {
98 __u8 local_id;
99 __u8 remote_id;
100 __u8 amp_assoc[0];
101} __packed;
102
103#define A2MP_CREATEPHYSLINK_RSP 0x0B
104#define A2MP_DISCONNPHYSLINK_RSP 0x0D
105struct a2mp_physlink_rsp {
106 __u8 local_id;
107 __u8 remote_id;
108 __u8 status;
109} __packed;
110
111/* A2MP response status */
112#define A2MP_STATUS_SUCCESS 0x00
113#define A2MP_STATUS_INVALID_CTRL_ID 0x01
114#define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
115#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
116#define A2MP_STATUS_COLLISION_OCCURED 0x03
117#define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
118#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
119#define A2MP_STATUS_SECURITY_VIOLATION 0x06
120
121void amp_mgr_get(struct amp_mgr *mgr);
122int amp_mgr_put(struct amp_mgr *mgr);
123struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
124 struct sk_buff *skb);
125
126#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 961669b648fd..565d4bee1e49 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -1,4 +1,4 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 4
@@ -12,22 +12,19 @@
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED. 22 SOFTWARE IS DISCLAIMED.
23*/ 23*/
24 24
25#ifndef __BLUETOOTH_H 25#ifndef __BLUETOOTH_H
26#define __BLUETOOTH_H 26#define __BLUETOOTH_H
27 27
28#include <asm/types.h>
29#include <asm/byteorder.h>
30#include <linux/list.h>
31#include <linux/poll.h> 28#include <linux/poll.h>
32#include <net/sock.h> 29#include <net/sock.h>
33 30
@@ -168,8 +165,8 @@ typedef struct {
168#define BDADDR_LE_PUBLIC 0x01 165#define BDADDR_LE_PUBLIC 0x01
169#define BDADDR_LE_RANDOM 0x02 166#define BDADDR_LE_RANDOM 0x02
170 167
171#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) 168#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} })
172#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) 169#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })
173 170
174/* Copy, swap, convert BD Address */ 171/* Copy, swap, convert BD Address */
175static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) 172static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2)
@@ -215,7 +212,7 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
215 struct msghdr *msg, size_t len, int flags); 212 struct msghdr *msg, size_t len, int flags);
216int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, 213int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
217 struct msghdr *msg, size_t len, int flags); 214 struct msghdr *msg, size_t len, int flags);
218uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); 215uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
219int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 216int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
220int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 217int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
221 218
@@ -225,12 +222,12 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
225 222
226/* Skb helpers */ 223/* Skb helpers */
227struct l2cap_ctrl { 224struct l2cap_ctrl {
228 unsigned int sframe : 1, 225 unsigned int sframe:1,
229 poll : 1, 226 poll:1,
230 final : 1, 227 final:1,
231 fcs : 1, 228 fcs:1,
232 sar : 2, 229 sar:2,
233 super : 2; 230 super:2;
234 __u16 reqseq; 231 __u16 reqseq;
235 __u16 txseq; 232 __u16 txseq;
236 __u8 retries; 233 __u8 retries;
@@ -249,7 +246,8 @@ static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
249{ 246{
250 struct sk_buff *skb; 247 struct sk_buff *skb;
251 248
252 if ((skb = alloc_skb(len + BT_SKB_RESERVE, how))) { 249 skb = alloc_skb(len + BT_SKB_RESERVE, how);
250 if (skb) {
253 skb_reserve(skb, BT_SKB_RESERVE); 251 skb_reserve(skb, BT_SKB_RESERVE);
254 bt_cb(skb)->incoming = 0; 252 bt_cb(skb)->incoming = 0;
255 } 253 }
@@ -261,7 +259,8 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
261{ 259{
262 struct sk_buff *skb; 260 struct sk_buff *skb;
263 261
264 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { 262 skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err);
263 if (skb) {
265 skb_reserve(skb, BT_SKB_RESERVE); 264 skb_reserve(skb, BT_SKB_RESERVE);
266 bt_cb(skb)->incoming = 0; 265 bt_cb(skb)->incoming = 0;
267 } 266 }
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3def64ba77fa..ccd723e0f783 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -30,6 +30,9 @@
30#define HCI_MAX_EVENT_SIZE 260 30#define HCI_MAX_EVENT_SIZE 260
31#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 31#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
32 32
33#define HCI_LINK_KEY_SIZE 16
34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE)
35
33/* HCI dev events */ 36/* HCI dev events */
34#define HCI_DEV_REG 1 37#define HCI_DEV_REG 1
35#define HCI_DEV_UNREG 2 38#define HCI_DEV_UNREG 2
@@ -56,9 +59,12 @@
56#define HCI_BREDR 0x00 59#define HCI_BREDR 0x00
57#define HCI_AMP 0x01 60#define HCI_AMP 0x01
58 61
62/* First BR/EDR Controller shall have ID = 0 */
63#define HCI_BREDR_ID 0
64
59/* HCI device quirks */ 65/* HCI device quirks */
60enum { 66enum {
61 HCI_QUIRK_NO_RESET, 67 HCI_QUIRK_RESET_ON_CLOSE,
62 HCI_QUIRK_RAW_DEVICE, 68 HCI_QUIRK_RAW_DEVICE,
63 HCI_QUIRK_FIXUP_BUFFER_SIZE 69 HCI_QUIRK_FIXUP_BUFFER_SIZE
64}; 70};
@@ -133,13 +139,12 @@ enum {
133#define HCIINQUIRY _IOR('H', 240, int) 139#define HCIINQUIRY _IOR('H', 240, int)
134 140
135/* HCI timeouts */ 141/* HCI timeouts */
136#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 142#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
137#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 143#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
138#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 144#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */
139#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 145#define HCI_CMD_TIMEOUT msecs_to_jiffies(1000) /* 1 second */
140#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 146#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
141#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 147#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
142#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */
143 148
144/* HCI data types */ 149/* HCI data types */
145#define HCI_COMMAND_PKT 0x01 150#define HCI_COMMAND_PKT 0x01
@@ -371,7 +376,7 @@ struct hci_cp_reject_conn_req {
371#define HCI_OP_LINK_KEY_REPLY 0x040b 376#define HCI_OP_LINK_KEY_REPLY 0x040b
372struct hci_cp_link_key_reply { 377struct hci_cp_link_key_reply {
373 bdaddr_t bdaddr; 378 bdaddr_t bdaddr;
374 __u8 link_key[16]; 379 __u8 link_key[HCI_LINK_KEY_SIZE];
375} __packed; 380} __packed;
376 381
377#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 382#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
@@ -523,6 +528,28 @@ struct hci_cp_io_capability_neg_reply {
523 __u8 reason; 528 __u8 reason;
524} __packed; 529} __packed;
525 530
531#define HCI_OP_CREATE_PHY_LINK 0x0435
532struct hci_cp_create_phy_link {
533 __u8 phy_handle;
534 __u8 key_len;
535 __u8 key_type;
536 __u8 key[HCI_AMP_LINK_KEY_SIZE];
537} __packed;
538
539#define HCI_OP_ACCEPT_PHY_LINK 0x0436
540struct hci_cp_accept_phy_link {
541 __u8 phy_handle;
542 __u8 key_len;
543 __u8 key_type;
544 __u8 key[HCI_AMP_LINK_KEY_SIZE];
545} __packed;
546
547#define HCI_OP_DISCONN_PHY_LINK 0x0437
548struct hci_cp_disconn_phy_link {
549 __u8 phy_handle;
550 __u8 reason;
551} __packed;
552
526#define HCI_OP_SNIFF_MODE 0x0803 553#define HCI_OP_SNIFF_MODE 0x0803
527struct hci_cp_sniff_mode { 554struct hci_cp_sniff_mode {
528 __le16 handle; 555 __le16 handle;
@@ -818,6 +845,31 @@ struct hci_rp_read_local_amp_info {
818 __le32 be_flush_to; 845 __le32 be_flush_to;
819} __packed; 846} __packed;
820 847
848#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
849struct hci_cp_read_local_amp_assoc {
850 __u8 phy_handle;
851 __le16 len_so_far;
852 __le16 max_len;
853} __packed;
854struct hci_rp_read_local_amp_assoc {
855 __u8 status;
856 __u8 phy_handle;
857 __le16 rem_len;
858 __u8 frag[0];
859} __packed;
860
861#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
862struct hci_cp_write_remote_amp_assoc {
863 __u8 phy_handle;
864 __le16 len_so_far;
865 __le16 rem_len;
866 __u8 frag[0];
867} __packed;
868struct hci_rp_write_remote_amp_assoc {
869 __u8 status;
870 __u8 phy_handle;
871} __packed;
872
821#define HCI_OP_LE_SET_EVENT_MASK 0x2001 873#define HCI_OP_LE_SET_EVENT_MASK 0x2001
822struct hci_cp_le_set_event_mask { 874struct hci_cp_le_set_event_mask {
823 __u8 mask[8]; 875 __u8 mask[8];
@@ -1048,7 +1100,7 @@ struct hci_ev_link_key_req {
1048#define HCI_EV_LINK_KEY_NOTIFY 0x18 1100#define HCI_EV_LINK_KEY_NOTIFY 0x18
1049struct hci_ev_link_key_notify { 1101struct hci_ev_link_key_notify {
1050 bdaddr_t bdaddr; 1102 bdaddr_t bdaddr;
1051 __u8 link_key[16]; 1103 __u8 link_key[HCI_LINK_KEY_SIZE];
1052 __u8 key_type; 1104 __u8 key_type;
1053} __packed; 1105} __packed;
1054 1106
@@ -1196,6 +1248,39 @@ struct hci_ev_le_meta {
1196 __u8 subevent; 1248 __u8 subevent;
1197} __packed; 1249} __packed;
1198 1250
1251#define HCI_EV_PHY_LINK_COMPLETE 0x40
1252struct hci_ev_phy_link_complete {
1253 __u8 status;
1254 __u8 phy_handle;
1255} __packed;
1256
1257#define HCI_EV_CHANNEL_SELECTED 0x41
1258struct hci_ev_channel_selected {
1259 __u8 phy_handle;
1260} __packed;
1261
1262#define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42
1263struct hci_ev_disconn_phy_link_complete {
1264 __u8 status;
1265 __u8 phy_handle;
1266 __u8 reason;
1267} __packed;
1268
1269#define HCI_EV_LOGICAL_LINK_COMPLETE 0x45
1270struct hci_ev_logical_link_complete {
1271 __u8 status;
1272 __le16 handle;
1273 __u8 phy_handle;
1274 __u8 flow_spec_id;
1275} __packed;
1276
1277#define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46
1278struct hci_ev_disconn_logical_link_complete {
1279 __u8 status;
1280 __le16 handle;
1281 __u8 reason;
1282} __packed;
1283
1199#define HCI_EV_NUM_COMP_BLOCKS 0x48 1284#define HCI_EV_NUM_COMP_BLOCKS 0x48
1200struct hci_comp_blocks_info { 1285struct hci_comp_blocks_info {
1201 __le16 handle; 1286 __le16 handle;
@@ -1296,7 +1381,6 @@ struct hci_sco_hdr {
1296 __u8 dlen; 1381 __u8 dlen;
1297} __packed; 1382} __packed;
1298 1383
1299#include <linux/skbuff.h>
1300static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 1384static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1301{ 1385{
1302 return (struct hci_event_hdr *) skb->data; 1386 return (struct hci_event_hdr *) skb->data;
@@ -1313,12 +1397,12 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1313} 1397}
1314 1398
1315/* Command opcode pack/unpack */ 1399/* Command opcode pack/unpack */
1316#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 1400#define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10)))
1317#define hci_opcode_ogf(op) (op >> 10) 1401#define hci_opcode_ogf(op) (op >> 10)
1318#define hci_opcode_ocf(op) (op & 0x03ff) 1402#define hci_opcode_ocf(op) (op & 0x03ff)
1319 1403
1320/* ACL handle and flags pack/unpack */ 1404/* ACL handle and flags pack/unpack */
1321#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) 1405#define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12)))
1322#define hci_handle(h) (h & 0x0fff) 1406#define hci_handle(h) (h & 0x0fff)
1323#define hci_flags(h) (h >> 12) 1407#define hci_flags(h) (h >> 12)
1324 1408
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 9fc7728f94e4..475b8c04ba52 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -25,7 +25,6 @@
25#ifndef __HCI_CORE_H 25#ifndef __HCI_CORE_H
26#define __HCI_CORE_H 26#define __HCI_CORE_H
27 27
28#include <linux/interrupt.h>
29#include <net/bluetooth/hci.h> 28#include <net/bluetooth/hci.h>
30 29
31/* HCI priority */ 30/* HCI priority */
@@ -65,7 +64,7 @@ struct discovery_state {
65 DISCOVERY_RESOLVING, 64 DISCOVERY_RESOLVING,
66 DISCOVERY_STOPPING, 65 DISCOVERY_STOPPING,
67 } state; 66 } state;
68 struct list_head all; /* All devices found during inquiry */ 67 struct list_head all; /* All devices found during inquiry */
69 struct list_head unknown; /* Name state not known */ 68 struct list_head unknown; /* Name state not known */
70 struct list_head resolve; /* Name needs to be resolved */ 69 struct list_head resolve; /* Name needs to be resolved */
71 __u32 timestamp; 70 __u32 timestamp;
@@ -105,7 +104,7 @@ struct link_key {
105 struct list_head list; 104 struct list_head list;
106 bdaddr_t bdaddr; 105 bdaddr_t bdaddr;
107 u8 type; 106 u8 type;
108 u8 val[16]; 107 u8 val[HCI_LINK_KEY_SIZE];
109 u8 pin_len; 108 u8 pin_len;
110}; 109};
111 110
@@ -333,6 +332,7 @@ struct hci_conn {
333 void *l2cap_data; 332 void *l2cap_data;
334 void *sco_data; 333 void *sco_data;
335 void *smp_conn; 334 void *smp_conn;
335 struct amp_mgr *amp_mgr;
336 336
337 struct hci_conn *link; 337 struct hci_conn *link;
338 338
@@ -360,7 +360,8 @@ extern int l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
360extern int l2cap_disconn_ind(struct hci_conn *hcon); 360extern int l2cap_disconn_ind(struct hci_conn *hcon);
361extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); 361extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
362extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); 362extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
363extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); 363extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
364 u16 flags);
364 365
365extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 366extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
366extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status); 367extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status);
@@ -429,8 +430,8 @@ enum {
429static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 430static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
430{ 431{
431 struct hci_dev *hdev = conn->hdev; 432 struct hci_dev *hdev = conn->hdev;
432 return (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && 433 return test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) &&
433 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)); 434 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
434} 435}
435 436
436static inline void hci_conn_hash_init(struct hci_dev *hdev) 437static inline void hci_conn_hash_init(struct hci_dev *hdev)
@@ -586,18 +587,24 @@ void hci_conn_put_device(struct hci_conn *conn);
586 587
587static inline void hci_conn_hold(struct hci_conn *conn) 588static inline void hci_conn_hold(struct hci_conn *conn)
588{ 589{
590 BT_DBG("hcon %p refcnt %d -> %d", conn, atomic_read(&conn->refcnt),
591 atomic_read(&conn->refcnt) + 1);
592
589 atomic_inc(&conn->refcnt); 593 atomic_inc(&conn->refcnt);
590 cancel_delayed_work(&conn->disc_work); 594 cancel_delayed_work(&conn->disc_work);
591} 595}
592 596
593static inline void hci_conn_put(struct hci_conn *conn) 597static inline void hci_conn_put(struct hci_conn *conn)
594{ 598{
599 BT_DBG("hcon %p refcnt %d -> %d", conn, atomic_read(&conn->refcnt),
600 atomic_read(&conn->refcnt) - 1);
601
595 if (atomic_dec_and_test(&conn->refcnt)) { 602 if (atomic_dec_and_test(&conn->refcnt)) {
596 unsigned long timeo; 603 unsigned long timeo;
597 if (conn->type == ACL_LINK || conn->type == LE_LINK) { 604 if (conn->type == ACL_LINK || conn->type == LE_LINK) {
598 del_timer(&conn->idle_timer); 605 del_timer(&conn->idle_timer);
599 if (conn->state == BT_CONNECTED) { 606 if (conn->state == BT_CONNECTED) {
600 timeo = msecs_to_jiffies(conn->disc_timeout); 607 timeo = conn->disc_timeout;
601 if (!conn->out) 608 if (!conn->out)
602 timeo *= 2; 609 timeo *= 2;
603 } else { 610 } else {
@@ -640,6 +647,19 @@ static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
640 dev_set_drvdata(&hdev->dev, data); 647 dev_set_drvdata(&hdev->dev, data);
641} 648}
642 649
650/* hci_dev_list shall be locked */
651static inline uint8_t __hci_num_ctrl(void)
652{
653 uint8_t count = 0;
654 struct list_head *p;
655
656 list_for_each(p, &hci_dev_list) {
657 count++;
658 }
659
660 return count;
661}
662
643struct hci_dev *hci_dev_get(int index); 663struct hci_dev *hci_dev_get(int index);
644struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 664struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
645 665
@@ -661,7 +681,8 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
661int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); 681int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
662int hci_inquiry(void __user *arg); 682int hci_inquiry(void __user *arg);
663 683
664struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 684struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
685 bdaddr_t *bdaddr);
665int hci_blacklist_clear(struct hci_dev *hdev); 686int hci_blacklist_clear(struct hci_dev *hdev);
666int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 687int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
667int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 688int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 1c7d1cd5e679..a7679f8913d2 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -40,11 +40,11 @@
40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
42#define L2CAP_DEFAULT_ACK_TO 200 42#define L2CAP_DEFAULT_ACK_TO 200
43#define L2CAP_LE_DEFAULT_MTU 23
44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF 43#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 44#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF 45#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
47#define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */ 46#define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */
47#define L2CAP_LE_MIN_MTU 23
48 48
49#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) 49#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
50#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) 50#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
@@ -52,6 +52,8 @@
52#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) 52#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
53#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) 53#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
54 54
55#define L2CAP_A2MP_DEFAULT_MTU 670
56
55/* L2CAP socket address */ 57/* L2CAP socket address */
56struct sockaddr_l2 { 58struct sockaddr_l2 {
57 sa_family_t l2_family; 59 sa_family_t l2_family;
@@ -229,9 +231,14 @@ struct l2cap_conn_rsp {
229 __le16 status; 231 __le16 status;
230} __packed; 232} __packed;
231 233
234/* protocol/service multiplexer (PSM) */
235#define L2CAP_PSM_SDP 0x0001
236#define L2CAP_PSM_RFCOMM 0x0003
237
232/* channel indentifier */ 238/* channel indentifier */
233#define L2CAP_CID_SIGNALING 0x0001 239#define L2CAP_CID_SIGNALING 0x0001
234#define L2CAP_CID_CONN_LESS 0x0002 240#define L2CAP_CID_CONN_LESS 0x0002
241#define L2CAP_CID_A2MP 0x0003
235#define L2CAP_CID_LE_DATA 0x0004 242#define L2CAP_CID_LE_DATA 0x0004
236#define L2CAP_CID_LE_SIGNALING 0x0005 243#define L2CAP_CID_LE_SIGNALING 0x0005
237#define L2CAP_CID_SMP 0x0006 244#define L2CAP_CID_SMP 0x0006
@@ -271,6 +278,9 @@ struct l2cap_conf_rsp {
271#define L2CAP_CONF_PENDING 0x0004 278#define L2CAP_CONF_PENDING 0x0004
272#define L2CAP_CONF_EFS_REJECT 0x0005 279#define L2CAP_CONF_EFS_REJECT 0x0005
273 280
281/* configuration req/rsp continuation flag */
282#define L2CAP_CONF_FLAG_CONTINUATION 0x0001
283
274struct l2cap_conf_opt { 284struct l2cap_conf_opt {
275 __u8 type; 285 __u8 type;
276 __u8 len; 286 __u8 len;
@@ -419,11 +429,6 @@ struct l2cap_seq_list {
419#define L2CAP_SEQ_LIST_CLEAR 0xFFFF 429#define L2CAP_SEQ_LIST_CLEAR 0xFFFF
420#define L2CAP_SEQ_LIST_TAIL 0x8000 430#define L2CAP_SEQ_LIST_TAIL 0x8000
421 431
422struct srej_list {
423 __u16 tx_seq;
424 struct list_head list;
425};
426
427struct l2cap_chan { 432struct l2cap_chan {
428 struct sock *sk; 433 struct sock *sk;
429 434
@@ -459,6 +464,7 @@ struct l2cap_chan {
459 464
460 __u16 tx_win; 465 __u16 tx_win;
461 __u16 tx_win_max; 466 __u16 tx_win_max;
467 __u16 ack_win;
462 __u8 max_tx; 468 __u8 max_tx;
463 __u16 retrans_timeout; 469 __u16 retrans_timeout;
464 __u16 monitor_timeout; 470 __u16 monitor_timeout;
@@ -475,14 +481,12 @@ struct l2cap_chan {
475 __u16 expected_ack_seq; 481 __u16 expected_ack_seq;
476 __u16 expected_tx_seq; 482 __u16 expected_tx_seq;
477 __u16 buffer_seq; 483 __u16 buffer_seq;
478 __u16 buffer_seq_srej;
479 __u16 srej_save_reqseq; 484 __u16 srej_save_reqseq;
480 __u16 last_acked_seq; 485 __u16 last_acked_seq;
481 __u16 frames_sent; 486 __u16 frames_sent;
482 __u16 unacked_frames; 487 __u16 unacked_frames;
483 __u8 retry_count; 488 __u8 retry_count;
484 __u16 srej_queue_next; 489 __u16 srej_queue_next;
485 __u8 num_acked;
486 __u16 sdu_len; 490 __u16 sdu_len;
487 struct sk_buff *sdu; 491 struct sk_buff *sdu;
488 struct sk_buff *sdu_last_frag; 492 struct sk_buff *sdu_last_frag;
@@ -515,7 +519,6 @@ struct l2cap_chan {
515 struct sk_buff_head srej_q; 519 struct sk_buff_head srej_q;
516 struct l2cap_seq_list srej_list; 520 struct l2cap_seq_list srej_list;
517 struct l2cap_seq_list retrans_list; 521 struct l2cap_seq_list retrans_list;
518 struct list_head srej_l;
519 522
520 struct list_head list; 523 struct list_head list;
521 struct list_head global_l; 524 struct list_head global_l;
@@ -528,10 +531,14 @@ struct l2cap_chan {
528struct l2cap_ops { 531struct l2cap_ops {
529 char *name; 532 char *name;
530 533
531 struct l2cap_chan *(*new_connection) (void *data); 534 struct l2cap_chan *(*new_connection) (struct l2cap_chan *chan);
532 int (*recv) (void *data, struct sk_buff *skb); 535 int (*recv) (struct l2cap_chan * chan,
533 void (*close) (void *data); 536 struct sk_buff *skb);
534 void (*state_change) (void *data, int state); 537 void (*teardown) (struct l2cap_chan *chan, int err);
538 void (*close) (struct l2cap_chan *chan);
539 void (*state_change) (struct l2cap_chan *chan,
540 int state);
541 void (*ready) (struct l2cap_chan *chan);
535 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 542 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
536 unsigned long len, int nb); 543 unsigned long len, int nb);
537}; 544};
@@ -575,6 +582,7 @@ struct l2cap_conn {
575#define L2CAP_CHAN_RAW 1 582#define L2CAP_CHAN_RAW 1
576#define L2CAP_CHAN_CONN_LESS 2 583#define L2CAP_CHAN_CONN_LESS 2
577#define L2CAP_CHAN_CONN_ORIENTED 3 584#define L2CAP_CHAN_CONN_ORIENTED 3
585#define L2CAP_CHAN_CONN_FIX_A2MP 4
578 586
579/* ----- L2CAP socket info ----- */ 587/* ----- L2CAP socket info ----- */
580#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 588#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -597,6 +605,7 @@ enum {
597 CONF_EWS_RECV, 605 CONF_EWS_RECV,
598 CONF_LOC_CONF_PEND, 606 CONF_LOC_CONF_PEND,
599 CONF_REM_CONF_PEND, 607 CONF_REM_CONF_PEND,
608 CONF_NOT_COMPLETE,
600}; 609};
601 610
602#define L2CAP_CONF_MAX_CONF_REQ 2 611#define L2CAP_CONF_MAX_CONF_REQ 2
@@ -664,11 +673,15 @@ enum {
664 673
665static inline void l2cap_chan_hold(struct l2cap_chan *c) 674static inline void l2cap_chan_hold(struct l2cap_chan *c)
666{ 675{
676 BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->refcnt));
677
667 atomic_inc(&c->refcnt); 678 atomic_inc(&c->refcnt);
668} 679}
669 680
670static inline void l2cap_chan_put(struct l2cap_chan *c) 681static inline void l2cap_chan_put(struct l2cap_chan *c)
671{ 682{
683 BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->refcnt));
684
672 if (atomic_dec_and_test(&c->refcnt)) 685 if (atomic_dec_and_test(&c->refcnt))
673 kfree(c); 686 kfree(c);
674} 687}
@@ -713,11 +726,7 @@ static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
713 726
714#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 727#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
715#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 728#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
716#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
717 msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
718#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) 729#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
719#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
720 msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
721#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) 730#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
722#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ 731#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
723 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); 732 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
@@ -736,173 +745,17 @@ static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
736 return (seq + 1) % (chan->tx_win_max + 1); 745 return (seq + 1) % (chan->tx_win_max + 1);
737} 746}
738 747
739static inline int l2cap_tx_window_full(struct l2cap_chan *ch) 748static inline struct l2cap_chan *l2cap_chan_no_new_connection(struct l2cap_chan *chan)
740{
741 int sub;
742
743 sub = (ch->next_tx_seq - ch->expected_ack_seq) % 64;
744
745 if (sub < 0)
746 sub += 64;
747
748 return sub == ch->remote_tx_win;
749}
750
751static inline __u16 __get_reqseq(struct l2cap_chan *chan, __u32 ctrl)
752{
753 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
754 return (ctrl & L2CAP_EXT_CTRL_REQSEQ) >>
755 L2CAP_EXT_CTRL_REQSEQ_SHIFT;
756 else
757 return (ctrl & L2CAP_CTRL_REQSEQ) >> L2CAP_CTRL_REQSEQ_SHIFT;
758}
759
760static inline __u32 __set_reqseq(struct l2cap_chan *chan, __u32 reqseq)
761{
762 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
763 return (reqseq << L2CAP_EXT_CTRL_REQSEQ_SHIFT) &
764 L2CAP_EXT_CTRL_REQSEQ;
765 else
766 return (reqseq << L2CAP_CTRL_REQSEQ_SHIFT) & L2CAP_CTRL_REQSEQ;
767}
768
769static inline __u16 __get_txseq(struct l2cap_chan *chan, __u32 ctrl)
770{
771 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
772 return (ctrl & L2CAP_EXT_CTRL_TXSEQ) >>
773 L2CAP_EXT_CTRL_TXSEQ_SHIFT;
774 else
775 return (ctrl & L2CAP_CTRL_TXSEQ) >> L2CAP_CTRL_TXSEQ_SHIFT;
776}
777
778static inline __u32 __set_txseq(struct l2cap_chan *chan, __u32 txseq)
779{
780 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
781 return (txseq << L2CAP_EXT_CTRL_TXSEQ_SHIFT) &
782 L2CAP_EXT_CTRL_TXSEQ;
783 else
784 return (txseq << L2CAP_CTRL_TXSEQ_SHIFT) & L2CAP_CTRL_TXSEQ;
785}
786
787static inline bool __is_sframe(struct l2cap_chan *chan, __u32 ctrl)
788{
789 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
790 return ctrl & L2CAP_EXT_CTRL_FRAME_TYPE;
791 else
792 return ctrl & L2CAP_CTRL_FRAME_TYPE;
793}
794
795static inline __u32 __set_sframe(struct l2cap_chan *chan)
796{
797 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
798 return L2CAP_EXT_CTRL_FRAME_TYPE;
799 else
800 return L2CAP_CTRL_FRAME_TYPE;
801}
802
803static inline __u8 __get_ctrl_sar(struct l2cap_chan *chan, __u32 ctrl)
804{ 749{
805 if (test_bit(FLAG_EXT_CTRL, &chan->flags)) 750 return NULL;
806 return (ctrl & L2CAP_EXT_CTRL_SAR) >> L2CAP_EXT_CTRL_SAR_SHIFT;
807 else
808 return (ctrl & L2CAP_CTRL_SAR) >> L2CAP_CTRL_SAR_SHIFT;
809} 751}
810 752
811static inline __u32 __set_ctrl_sar(struct l2cap_chan *chan, __u32 sar) 753static inline void l2cap_chan_no_teardown(struct l2cap_chan *chan, int err)
812{ 754{
813 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
814 return (sar << L2CAP_EXT_CTRL_SAR_SHIFT) & L2CAP_EXT_CTRL_SAR;
815 else
816 return (sar << L2CAP_CTRL_SAR_SHIFT) & L2CAP_CTRL_SAR;
817} 755}
818 756
819static inline bool __is_sar_start(struct l2cap_chan *chan, __u32 ctrl) 757static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
820{ 758{
821 return __get_ctrl_sar(chan, ctrl) == L2CAP_SAR_START;
822}
823
824static inline __u32 __get_sar_mask(struct l2cap_chan *chan)
825{
826 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
827 return L2CAP_EXT_CTRL_SAR;
828 else
829 return L2CAP_CTRL_SAR;
830}
831
832static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl)
833{
834 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
835 return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >>
836 L2CAP_EXT_CTRL_SUPER_SHIFT;
837 else
838 return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT;
839}
840
841static inline __u32 __set_ctrl_super(struct l2cap_chan *chan, __u32 super)
842{
843 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
844 return (super << L2CAP_EXT_CTRL_SUPER_SHIFT) &
845 L2CAP_EXT_CTRL_SUPERVISE;
846 else
847 return (super << L2CAP_CTRL_SUPER_SHIFT) &
848 L2CAP_CTRL_SUPERVISE;
849}
850
851static inline __u32 __set_ctrl_final(struct l2cap_chan *chan)
852{
853 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
854 return L2CAP_EXT_CTRL_FINAL;
855 else
856 return L2CAP_CTRL_FINAL;
857}
858
859static inline bool __is_ctrl_final(struct l2cap_chan *chan, __u32 ctrl)
860{
861 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
862 return ctrl & L2CAP_EXT_CTRL_FINAL;
863 else
864 return ctrl & L2CAP_CTRL_FINAL;
865}
866
867static inline __u32 __set_ctrl_poll(struct l2cap_chan *chan)
868{
869 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
870 return L2CAP_EXT_CTRL_POLL;
871 else
872 return L2CAP_CTRL_POLL;
873}
874
875static inline bool __is_ctrl_poll(struct l2cap_chan *chan, __u32 ctrl)
876{
877 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
878 return ctrl & L2CAP_EXT_CTRL_POLL;
879 else
880 return ctrl & L2CAP_CTRL_POLL;
881}
882
883static inline __u32 __get_control(struct l2cap_chan *chan, void *p)
884{
885 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
886 return get_unaligned_le32(p);
887 else
888 return get_unaligned_le16(p);
889}
890
891static inline void __put_control(struct l2cap_chan *chan, __u32 control,
892 void *p)
893{
894 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
895 return put_unaligned_le32(control, p);
896 else
897 return put_unaligned_le16(control, p);
898}
899
900static inline __u8 __ctrl_size(struct l2cap_chan *chan)
901{
902 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
903 return L2CAP_EXT_HDR_SIZE - L2CAP_HDR_SIZE;
904 else
905 return L2CAP_ENH_HDR_SIZE - L2CAP_HDR_SIZE;
906} 759}
907 760
908extern bool disable_ertm; 761extern bool disable_ertm;
@@ -926,5 +779,8 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
926void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 779void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
927int l2cap_chan_check_security(struct l2cap_chan *chan); 780int l2cap_chan_check_security(struct l2cap_chan *chan);
928void l2cap_chan_set_defaults(struct l2cap_chan *chan); 781void l2cap_chan_set_defaults(struct l2cap_chan *chan);
782int l2cap_ertm_init(struct l2cap_chan *chan);
783void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
784void l2cap_chan_del(struct l2cap_chan *chan, int err);
929 785
930#endif /* __L2CAP_H */ 786#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 23fd0546fccb..4348ee8bda69 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -444,7 +444,7 @@ struct mgmt_ev_auth_failed {
444struct mgmt_ev_device_found { 444struct mgmt_ev_device_found {
445 struct mgmt_addr_info addr; 445 struct mgmt_addr_info addr;
446 __s8 rssi; 446 __s8 rssi;
447 __u8 flags[4]; 447 __le32 flags;
448 __le16 eir_len; 448 __le16 eir_len;
449 __u8 eir[0]; 449 __u8 eir[0];
450} __packed; 450} __packed;
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 439dadc8102f..bcb9cc3ce98b 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -93,25 +93,25 @@ struct cfhsi_desc {
93#endif 93#endif
94 94
95/* Structure implemented by the CAIF HSI driver. */ 95/* Structure implemented by the CAIF HSI driver. */
96struct cfhsi_drv { 96struct cfhsi_cb_ops {
97 void (*tx_done_cb) (struct cfhsi_drv *drv); 97 void (*tx_done_cb) (struct cfhsi_cb_ops *drv);
98 void (*rx_done_cb) (struct cfhsi_drv *drv); 98 void (*rx_done_cb) (struct cfhsi_cb_ops *drv);
99 void (*wake_up_cb) (struct cfhsi_drv *drv); 99 void (*wake_up_cb) (struct cfhsi_cb_ops *drv);
100 void (*wake_down_cb) (struct cfhsi_drv *drv); 100 void (*wake_down_cb) (struct cfhsi_cb_ops *drv);
101}; 101};
102 102
103/* Structure implemented by HSI device. */ 103/* Structure implemented by HSI device. */
104struct cfhsi_dev { 104struct cfhsi_ops {
105 int (*cfhsi_up) (struct cfhsi_dev *dev); 105 int (*cfhsi_up) (struct cfhsi_ops *dev);
106 int (*cfhsi_down) (struct cfhsi_dev *dev); 106 int (*cfhsi_down) (struct cfhsi_ops *dev);
107 int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_dev *dev); 107 int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_ops *dev);
108 int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_dev *dev); 108 int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_ops *dev);
109 int (*cfhsi_wake_up) (struct cfhsi_dev *dev); 109 int (*cfhsi_wake_up) (struct cfhsi_ops *dev);
110 int (*cfhsi_wake_down) (struct cfhsi_dev *dev); 110 int (*cfhsi_wake_down) (struct cfhsi_ops *dev);
111 int (*cfhsi_get_peer_wake) (struct cfhsi_dev *dev, bool *status); 111 int (*cfhsi_get_peer_wake) (struct cfhsi_ops *dev, bool *status);
112 int (*cfhsi_fifo_occupancy)(struct cfhsi_dev *dev, size_t *occupancy); 112 int (*cfhsi_fifo_occupancy) (struct cfhsi_ops *dev, size_t *occupancy);
113 int (*cfhsi_rx_cancel)(struct cfhsi_dev *dev); 113 int (*cfhsi_rx_cancel)(struct cfhsi_ops *dev);
114 struct cfhsi_drv *drv; 114 struct cfhsi_cb_ops *cb_ops;
115}; 115};
116 116
117/* Structure holds status of received CAIF frames processing */ 117/* Structure holds status of received CAIF frames processing */
@@ -132,17 +132,26 @@ enum {
132 CFHSI_PRIO_LAST, 132 CFHSI_PRIO_LAST,
133}; 133};
134 134
135struct cfhsi_config {
136 u32 inactivity_timeout;
137 u32 aggregation_timeout;
138 u32 head_align;
139 u32 tail_align;
140 u32 q_high_mark;
141 u32 q_low_mark;
142};
143
135/* Structure implemented by CAIF HSI drivers. */ 144/* Structure implemented by CAIF HSI drivers. */
136struct cfhsi { 145struct cfhsi {
137 struct caif_dev_common cfdev; 146 struct caif_dev_common cfdev;
138 struct net_device *ndev; 147 struct net_device *ndev;
139 struct platform_device *pdev; 148 struct platform_device *pdev;
140 struct sk_buff_head qhead[CFHSI_PRIO_LAST]; 149 struct sk_buff_head qhead[CFHSI_PRIO_LAST];
141 struct cfhsi_drv drv; 150 struct cfhsi_cb_ops cb_ops;
142 struct cfhsi_dev *dev; 151 struct cfhsi_ops *ops;
143 int tx_state; 152 int tx_state;
144 struct cfhsi_rx_state rx_state; 153 struct cfhsi_rx_state rx_state;
145 unsigned long inactivity_timeout; 154 struct cfhsi_config cfg;
146 int rx_len; 155 int rx_len;
147 u8 *rx_ptr; 156 u8 *rx_ptr;
148 u8 *tx_buf; 157 u8 *tx_buf;
@@ -150,8 +159,6 @@ struct cfhsi {
150 u8 *rx_flip_buf; 159 u8 *rx_flip_buf;
151 spinlock_t lock; 160 spinlock_t lock;
152 int flow_off_sent; 161 int flow_off_sent;
153 u32 q_low_mark;
154 u32 q_high_mark;
155 struct list_head list; 162 struct list_head list;
156 struct work_struct wake_up_work; 163 struct work_struct wake_up_work;
157 struct work_struct wake_down_work; 164 struct work_struct wake_down_work;
@@ -164,13 +171,31 @@ struct cfhsi {
164 struct timer_list rx_slowpath_timer; 171 struct timer_list rx_slowpath_timer;
165 172
166 /* TX aggregation */ 173 /* TX aggregation */
167 unsigned long aggregation_timeout;
168 int aggregation_len; 174 int aggregation_len;
169 struct timer_list aggregation_timer; 175 struct timer_list aggregation_timer;
170 176
171 unsigned long bits; 177 unsigned long bits;
172}; 178};
173
174extern struct platform_driver cfhsi_driver; 179extern struct platform_driver cfhsi_driver;
175 180
181/**
182 * enum ifla_caif_hsi - CAIF HSI NetlinkRT parameters.
183 * @IFLA_CAIF_HSI_INACTIVITY_TOUT: Inactivity timeout before
184 * taking the HSI wakeline down, in milliseconds.
185 * When using RT Netlink to create, destroy or configure a CAIF HSI interface,
186 * enum ifla_caif_hsi is used to specify the configuration attributes.
187 */
188enum ifla_caif_hsi {
189 __IFLA_CAIF_HSI_UNSPEC,
190 __IFLA_CAIF_HSI_INACTIVITY_TOUT,
191 __IFLA_CAIF_HSI_AGGREGATION_TOUT,
192 __IFLA_CAIF_HSI_HEAD_ALIGN,
193 __IFLA_CAIF_HSI_TAIL_ALIGN,
194 __IFLA_CAIF_HSI_QHIGH_WATERMARK,
195 __IFLA_CAIF_HSI_QLOW_WATERMARK,
196 __IFLA_CAIF_HSI_MAX
197};
198
199extern struct cfhsi_ops *cfhsi_get_ops(void);
200
176#endif /* CAIF_HSI_H_ */ 201#endif /* CAIF_HSI_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0289d4ce7070..493fa0c79005 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -70,11 +70,13 @@
70 * 70 *
71 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 71 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
72 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 72 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
73 * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
73 * @IEEE80211_NUM_BANDS: number of defined bands 74 * @IEEE80211_NUM_BANDS: number of defined bands
74 */ 75 */
75enum ieee80211_band { 76enum ieee80211_band {
76 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 77 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
77 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 78 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
79 IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
78 80
79 /* keep last */ 81 /* keep last */
80 IEEE80211_NUM_BANDS 82 IEEE80211_NUM_BANDS
@@ -211,6 +213,22 @@ struct ieee80211_sta_ht_cap {
211}; 213};
212 214
213/** 215/**
216 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
217 *
218 * This structure describes most essential parameters needed
219 * to describe 802.11ac VHT capabilities for an STA.
220 *
221 * @vht_supported: is VHT supported by the STA
222 * @cap: VHT capabilities map as described in 802.11ac spec
223 * @vht_mcs: Supported VHT MCS rates
224 */
225struct ieee80211_sta_vht_cap {
226 bool vht_supported;
227 u32 cap; /* use IEEE80211_VHT_CAP_ */
228 struct ieee80211_vht_mcs_info vht_mcs;
229};
230
231/**
214 * struct ieee80211_supported_band - frequency band definition 232 * struct ieee80211_supported_band - frequency band definition
215 * 233 *
216 * This structure describes a frequency band a wiphy 234 * This structure describes a frequency band a wiphy
@@ -233,6 +251,7 @@ struct ieee80211_supported_band {
233 int n_channels; 251 int n_channels;
234 int n_bitrates; 252 int n_bitrates;
235 struct ieee80211_sta_ht_cap ht_cap; 253 struct ieee80211_sta_ht_cap ht_cap;
254 struct ieee80211_sta_vht_cap vht_cap;
236}; 255};
237 256
238/* 257/*
@@ -404,6 +423,8 @@ struct cfg80211_beacon_data {
404 * 423 *
405 * Used to configure an AP interface. 424 * Used to configure an AP interface.
406 * 425 *
426 * @channel: the channel to start the AP on
427 * @channel_type: the channel type to use
407 * @beacon: beacon data 428 * @beacon: beacon data
408 * @beacon_interval: beacon interval 429 * @beacon_interval: beacon interval
409 * @dtim_period: DTIM period 430 * @dtim_period: DTIM period
@@ -417,6 +438,9 @@ struct cfg80211_beacon_data {
417 * @inactivity_timeout: time in seconds to determine station's inactivity. 438 * @inactivity_timeout: time in seconds to determine station's inactivity.
418 */ 439 */
419struct cfg80211_ap_settings { 440struct cfg80211_ap_settings {
441 struct ieee80211_channel *channel;
442 enum nl80211_channel_type channel_type;
443
420 struct cfg80211_beacon_data beacon; 444 struct cfg80211_beacon_data beacon;
421 445
422 int beacon_interval, dtim_period; 446 int beacon_interval, dtim_period;
@@ -556,11 +580,13 @@ enum station_info_flags {
556 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 580 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
557 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 581 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
558 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 582 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
583 * @RATE_INFO_FLAGS_60G: 60gHz MCS
559 */ 584 */
560enum rate_info_flags { 585enum rate_info_flags {
561 RATE_INFO_FLAGS_MCS = 1<<0, 586 RATE_INFO_FLAGS_MCS = 1<<0,
562 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 587 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
563 RATE_INFO_FLAGS_SHORT_GI = 1<<2, 588 RATE_INFO_FLAGS_SHORT_GI = 1<<2,
589 RATE_INFO_FLAGS_60G = 1<<3,
564}; 590};
565 591
566/** 592/**
@@ -622,10 +648,10 @@ struct sta_bss_parameters {
622 * @llid: mesh local link id 648 * @llid: mesh local link id
623 * @plid: mesh peer link id 649 * @plid: mesh peer link id
624 * @plink_state: mesh peer link state 650 * @plink_state: mesh peer link state
625 * @signal: the signal strength, type depends on the wiphy's signal_type 651 * @signal: The signal strength, type depends on the wiphy's signal_type.
626 NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 652 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
627 * @signal_avg: avg signal strength, type depends on the wiphy's signal_type 653 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
628 NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 654 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
629 * @txrate: current unicast bitrate from this station 655 * @txrate: current unicast bitrate from this station
630 * @rxrate: current unicast bitrate to this station 656 * @rxrate: current unicast bitrate to this station
631 * @rx_packets: packets received from this station 657 * @rx_packets: packets received from this station
@@ -785,47 +811,101 @@ struct bss_parameters {
785 int ht_opmode; 811 int ht_opmode;
786}; 812};
787 813
788/* 814/**
789 * struct mesh_config - 802.11s mesh configuration 815 * struct mesh_config - 802.11s mesh configuration
790 * 816 *
791 * These parameters can be changed while the mesh is active. 817 * These parameters can be changed while the mesh is active.
818 *
819 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
820 * by the Mesh Peering Open message
821 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
822 * used by the Mesh Peering Open message
823 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
824 * the mesh peering management to close a mesh peering
825 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
826 * mesh interface
827 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
828 * be sent to establish a new peer link instance in a mesh
829 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
830 * @element_ttl: the value of TTL field set at a mesh STA for path selection
831 * elements
832 * @auto_open_plinks: whether we should automatically open peer links when we
833 * detect compatible mesh peers
834 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
835 * synchronize to for 11s default synchronization method
836 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
837 * that an originator mesh STA can send to a particular path target
838 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
839 * @min_discovery_timeout: the minimum length of time to wait until giving up on
840 * a path discovery in milliseconds
841 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
842 * receiving a PREQ shall consider the forwarding information from the
843 * root to be valid. (TU = time unit)
844 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
845 * which a mesh STA can send only one action frame containing a PREQ
846 * element
847 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
848 * which a mesh STA can send only one Action frame containing a PERR
849 * element
850 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
851 * it takes for an HWMP information element to propagate across the mesh
852 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
853 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
854 * announcements are transmitted
855 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
856 * station has access to a broader network beyond the MBSS. (This is
857 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
858 * only means that the station will announce others it's a mesh gate, but
859 * not necessarily using the gate announcement protocol. Still keeping the
860 * same nomenclature to be in sync with the spec)
861 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
862 * entity (default is TRUE - forwarding entity)
863 * @rssi_threshold: the threshold for average signal strength of candidate
864 * station to establish a peer link
865 * @ht_opmode: mesh HT protection mode
866 *
867 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
868 * receiving a proactive PREQ shall consider the forwarding information to
869 * the root mesh STA to be valid.
870 *
871 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
872 * PREQs are transmitted.
873 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
874 * during which a mesh STA can send only one Action frame containing
875 * a PREQ element for root path confirmation.
792 */ 876 */
793struct mesh_config { 877struct mesh_config {
794 /* Timeouts in ms */
795 /* Mesh plink management parameters */
796 u16 dot11MeshRetryTimeout; 878 u16 dot11MeshRetryTimeout;
797 u16 dot11MeshConfirmTimeout; 879 u16 dot11MeshConfirmTimeout;
798 u16 dot11MeshHoldingTimeout; 880 u16 dot11MeshHoldingTimeout;
799 u16 dot11MeshMaxPeerLinks; 881 u16 dot11MeshMaxPeerLinks;
800 u8 dot11MeshMaxRetries; 882 u8 dot11MeshMaxRetries;
801 u8 dot11MeshTTL; 883 u8 dot11MeshTTL;
802 /* ttl used in path selection information elements */ 884 u8 element_ttl;
803 u8 element_ttl;
804 bool auto_open_plinks; 885 bool auto_open_plinks;
805 /* neighbor offset synchronization */
806 u32 dot11MeshNbrOffsetMaxNeighbor; 886 u32 dot11MeshNbrOffsetMaxNeighbor;
807 /* HWMP parameters */ 887 u8 dot11MeshHWMPmaxPREQretries;
808 u8 dot11MeshHWMPmaxPREQretries;
809 u32 path_refresh_time; 888 u32 path_refresh_time;
810 u16 min_discovery_timeout; 889 u16 min_discovery_timeout;
811 u32 dot11MeshHWMPactivePathTimeout; 890 u32 dot11MeshHWMPactivePathTimeout;
812 u16 dot11MeshHWMPpreqMinInterval; 891 u16 dot11MeshHWMPpreqMinInterval;
813 u16 dot11MeshHWMPperrMinInterval; 892 u16 dot11MeshHWMPperrMinInterval;
814 u16 dot11MeshHWMPnetDiameterTraversalTime; 893 u16 dot11MeshHWMPnetDiameterTraversalTime;
815 u8 dot11MeshHWMPRootMode; 894 u8 dot11MeshHWMPRootMode;
816 u16 dot11MeshHWMPRannInterval; 895 u16 dot11MeshHWMPRannInterval;
817 /* This is missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol 896 bool dot11MeshGateAnnouncementProtocol;
818 * set to true only means that the station will announce others it's a
819 * mesh gate, but not necessarily using the gate announcement protocol.
820 * Still keeping the same nomenclature to be in sync with the spec. */
821 bool dot11MeshGateAnnouncementProtocol;
822 bool dot11MeshForwarding; 897 bool dot11MeshForwarding;
823 s32 rssi_threshold; 898 s32 rssi_threshold;
824 u16 ht_opmode; 899 u16 ht_opmode;
900 u32 dot11MeshHWMPactivePathToRootTimeout;
901 u16 dot11MeshHWMProotInterval;
902 u16 dot11MeshHWMPconfirmationInterval;
825}; 903};
826 904
827/** 905/**
828 * struct mesh_setup - 802.11s mesh setup configuration 906 * struct mesh_setup - 802.11s mesh setup configuration
907 * @channel: the channel to start the mesh network on
908 * @channel_type: the channel type to use
829 * @mesh_id: the mesh ID 909 * @mesh_id: the mesh ID
830 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 910 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
831 * @sync_method: which synchronization method to use 911 * @sync_method: which synchronization method to use
@@ -840,6 +920,8 @@ struct mesh_config {
840 * These parameters are fixed when the mesh is created. 920 * These parameters are fixed when the mesh is created.
841 */ 921 */
842struct mesh_setup { 922struct mesh_setup {
923 struct ieee80211_channel *channel;
924 enum nl80211_channel_type channel_type;
843 const u8 *mesh_id; 925 const u8 *mesh_id;
844 u8 mesh_id_len; 926 u8 mesh_id_len;
845 u8 sync_method; 927 u8 sync_method;
@@ -917,7 +999,7 @@ struct cfg80211_ssid {
917 * @ie_len: length of ie in octets 999 * @ie_len: length of ie in octets
918 * @rates: bitmap of rates to advertise for each band 1000 * @rates: bitmap of rates to advertise for each band
919 * @wiphy: the wiphy this was for 1001 * @wiphy: the wiphy this was for
920 * @dev: the interface 1002 * @wdev: the wireless device to scan for
921 * @aborted: (internal) scan request was notified as aborted 1003 * @aborted: (internal) scan request was notified as aborted
922 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1004 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
923 */ 1005 */
@@ -930,9 +1012,10 @@ struct cfg80211_scan_request {
930 1012
931 u32 rates[IEEE80211_NUM_BANDS]; 1013 u32 rates[IEEE80211_NUM_BANDS];
932 1014
1015 struct wireless_dev *wdev;
1016
933 /* internal */ 1017 /* internal */
934 struct wiphy *wiphy; 1018 struct wiphy *wiphy;
935 struct net_device *dev;
936 bool aborted; 1019 bool aborted;
937 bool no_cck; 1020 bool no_cck;
938 1021
@@ -966,6 +1049,7 @@ struct cfg80211_match_set {
966 * @wiphy: the wiphy this was for 1049 * @wiphy: the wiphy this was for
967 * @dev: the interface 1050 * @dev: the interface
968 * @channels: channels to scan 1051 * @channels: channels to scan
1052 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
969 */ 1053 */
970struct cfg80211_sched_scan_request { 1054struct cfg80211_sched_scan_request {
971 struct cfg80211_ssid *ssids; 1055 struct cfg80211_ssid *ssids;
@@ -976,6 +1060,7 @@ struct cfg80211_sched_scan_request {
976 size_t ie_len; 1060 size_t ie_len;
977 struct cfg80211_match_set *match_sets; 1061 struct cfg80211_match_set *match_sets;
978 int n_match_sets; 1062 int n_match_sets;
1063 s32 rssi_thold;
979 1064
980 /* internal */ 1065 /* internal */
981 struct wiphy *wiphy; 1066 struct wiphy *wiphy;
@@ -1351,10 +1436,10 @@ struct cfg80211_gtk_rekey_data {
1351 * 1436 *
1352 * @add_virtual_intf: create a new virtual interface with the given name, 1437 * @add_virtual_intf: create a new virtual interface with the given name,
1353 * must set the struct wireless_dev's iftype. Beware: You must create 1438 * must set the struct wireless_dev's iftype. Beware: You must create
1354 * the new netdev in the wiphy's network namespace! Returns the netdev, 1439 * the new netdev in the wiphy's network namespace! Returns the struct
1355 * or an ERR_PTR. 1440 * wireless_dev, or an ERR_PTR.
1356 * 1441 *
1357 * @del_virtual_intf: remove the virtual interface determined by ifindex. 1442 * @del_virtual_intf: remove the virtual interface
1358 * 1443 *
1359 * @change_virtual_intf: change type/configuration of virtual interface, 1444 * @change_virtual_intf: change type/configuration of virtual interface,
1360 * keep the struct wireless_dev's iftype updated. 1445 * keep the struct wireless_dev's iftype updated.
@@ -1411,14 +1496,14 @@ struct cfg80211_gtk_rekey_data {
1411 * 1496 *
1412 * @set_txq_params: Set TX queue parameters 1497 * @set_txq_params: Set TX queue parameters
1413 * 1498 *
1414 * @set_channel: Set channel for a given wireless interface. Some devices 1499 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
1415 * may support multi-channel operation (by channel hopping) so cfg80211 1500 * as it doesn't implement join_mesh and needs to set the channel to
1416 * doesn't verify much. Note, however, that the passed netdev may be 1501 * join the mesh instead.
1417 * %NULL as well if the user requested changing the channel for the 1502 *
1418 * device itself, or for a monitor interface. 1503 * @set_monitor_channel: Set the monitor mode channel for the device. If other
1419 * @get_channel: Get the current operating channel, should return %NULL if 1504 * interfaces are active this callback should reject the configuration.
1420 * there's no single defined operating channel if for example the 1505 * If no interfaces are active or the device is down, the channel should
1421 * device implements channel hopping for multi-channel virtual interfaces. 1506 * be stored for when a monitor interface becomes active.
1422 * 1507 *
1423 * @scan: Request to do a scan. If returning zero, the scan request is given 1508 * @scan: Request to do a scan. If returning zero, the scan request is given
1424 * the driver, and will be valid until passed to cfg80211_scan_done(). 1509 * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1488,6 +1573,8 @@ struct cfg80211_gtk_rekey_data {
1488 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 1573 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
1489 * allows the driver to adjust the dynamic ps timeout value. 1574 * allows the driver to adjust the dynamic ps timeout value.
1490 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 1575 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1576 * @set_cqm_txe_config: Configure connection quality monitor TX error
1577 * thresholds.
1491 * @sched_scan_start: Tell the driver to start a scheduled scan. 1578 * @sched_scan_start: Tell the driver to start a scheduled scan.
1492 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled 1579 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled
1493 * scan. The driver_initiated flag specifies whether the driver 1580 * scan. The driver_initiated flag specifies whether the driver
@@ -1525,18 +1612,23 @@ struct cfg80211_gtk_rekey_data {
1525 * @get_et_strings: Ethtool API to get a set of strings to describe stats 1612 * @get_et_strings: Ethtool API to get a set of strings to describe stats
1526 * and perhaps other supported types of ethtool data-sets. 1613 * and perhaps other supported types of ethtool data-sets.
1527 * See @ethtool_ops.get_strings 1614 * See @ethtool_ops.get_strings
1615 *
1616 * @get_channel: Get the current operating channel for the virtual interface.
1617 * For monitor interfaces, it should return %NULL unless there's a single
1618 * current monitoring channel.
1528 */ 1619 */
1529struct cfg80211_ops { 1620struct cfg80211_ops {
1530 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1621 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
1531 int (*resume)(struct wiphy *wiphy); 1622 int (*resume)(struct wiphy *wiphy);
1532 void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 1623 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
1533 1624
1534 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1625 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
1535 char *name, 1626 char *name,
1536 enum nl80211_iftype type, 1627 enum nl80211_iftype type,
1537 u32 *flags, 1628 u32 *flags,
1538 struct vif_params *params); 1629 struct vif_params *params);
1539 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 1630 int (*del_virtual_intf)(struct wiphy *wiphy,
1631 struct wireless_dev *wdev);
1540 int (*change_virtual_intf)(struct wiphy *wiphy, 1632 int (*change_virtual_intf)(struct wiphy *wiphy,
1541 struct net_device *dev, 1633 struct net_device *dev,
1542 enum nl80211_iftype type, u32 *flags, 1634 enum nl80211_iftype type, u32 *flags,
@@ -1605,11 +1697,15 @@ struct cfg80211_ops {
1605 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 1697 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
1606 struct ieee80211_txq_params *params); 1698 struct ieee80211_txq_params *params);
1607 1699
1608 int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, 1700 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
1609 struct ieee80211_channel *chan, 1701 struct net_device *dev,
1610 enum nl80211_channel_type channel_type); 1702 struct ieee80211_channel *chan);
1703
1704 int (*set_monitor_channel)(struct wiphy *wiphy,
1705 struct ieee80211_channel *chan,
1706 enum nl80211_channel_type channel_type);
1611 1707
1612 int (*scan)(struct wiphy *wiphy, struct net_device *dev, 1708 int (*scan)(struct wiphy *wiphy,
1613 struct cfg80211_scan_request *request); 1709 struct cfg80211_scan_request *request);
1614 1710
1615 int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1711 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
@@ -1663,23 +1759,23 @@ struct cfg80211_ops {
1663 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 1759 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
1664 1760
1665 int (*remain_on_channel)(struct wiphy *wiphy, 1761 int (*remain_on_channel)(struct wiphy *wiphy,
1666 struct net_device *dev, 1762 struct wireless_dev *wdev,
1667 struct ieee80211_channel *chan, 1763 struct ieee80211_channel *chan,
1668 enum nl80211_channel_type channel_type, 1764 enum nl80211_channel_type channel_type,
1669 unsigned int duration, 1765 unsigned int duration,
1670 u64 *cookie); 1766 u64 *cookie);
1671 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 1767 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
1672 struct net_device *dev, 1768 struct wireless_dev *wdev,
1673 u64 cookie); 1769 u64 cookie);
1674 1770
1675 int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1771 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1676 struct ieee80211_channel *chan, bool offchan, 1772 struct ieee80211_channel *chan, bool offchan,
1677 enum nl80211_channel_type channel_type, 1773 enum nl80211_channel_type channel_type,
1678 bool channel_type_valid, unsigned int wait, 1774 bool channel_type_valid, unsigned int wait,
1679 const u8 *buf, size_t len, bool no_cck, 1775 const u8 *buf, size_t len, bool no_cck,
1680 bool dont_wait_for_ack, u64 *cookie); 1776 bool dont_wait_for_ack, u64 *cookie);
1681 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1777 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1682 struct net_device *dev, 1778 struct wireless_dev *wdev,
1683 u64 cookie); 1779 u64 cookie);
1684 1780
1685 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1781 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
@@ -1689,8 +1785,12 @@ struct cfg80211_ops {
1689 struct net_device *dev, 1785 struct net_device *dev,
1690 s32 rssi_thold, u32 rssi_hyst); 1786 s32 rssi_thold, u32 rssi_hyst);
1691 1787
1788 int (*set_cqm_txe_config)(struct wiphy *wiphy,
1789 struct net_device *dev,
1790 u32 rate, u32 pkts, u32 intvl);
1791
1692 void (*mgmt_frame_register)(struct wiphy *wiphy, 1792 void (*mgmt_frame_register)(struct wiphy *wiphy,
1693 struct net_device *dev, 1793 struct wireless_dev *wdev,
1694 u16 frame_type, bool reg); 1794 u16 frame_type, bool reg);
1695 1795
1696 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 1796 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
@@ -1721,15 +1821,17 @@ struct cfg80211_ops {
1721 struct net_device *dev, 1821 struct net_device *dev,
1722 u16 noack_map); 1822 u16 noack_map);
1723 1823
1724 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy,
1725 enum nl80211_channel_type *type);
1726
1727 int (*get_et_sset_count)(struct wiphy *wiphy, 1824 int (*get_et_sset_count)(struct wiphy *wiphy,
1728 struct net_device *dev, int sset); 1825 struct net_device *dev, int sset);
1729 void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev, 1826 void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
1730 struct ethtool_stats *stats, u64 *data); 1827 struct ethtool_stats *stats, u64 *data);
1731 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev, 1828 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1732 u32 sset, u8 *data); 1829 u32 sset, u8 *data);
1830
1831 struct ieee80211_channel *
1832 (*get_channel)(struct wiphy *wiphy,
1833 struct wireless_dev *wdev,
1834 enum nl80211_channel_type *type);
1733}; 1835};
1734 1836
1735/* 1837/*
@@ -2083,7 +2185,9 @@ struct wiphy {
2083 char fw_version[ETHTOOL_BUSINFO_LEN]; 2185 char fw_version[ETHTOOL_BUSINFO_LEN];
2084 u32 hw_version; 2186 u32 hw_version;
2085 2187
2188#ifdef CONFIG_PM
2086 struct wiphy_wowlan_support wowlan; 2189 struct wiphy_wowlan_support wowlan;
2190#endif
2087 2191
2088 u16 max_remain_on_channel_duration; 2192 u16 max_remain_on_channel_duration;
2089 2193
@@ -2250,20 +2354,31 @@ struct cfg80211_internal_bss;
2250struct cfg80211_cached_keys; 2354struct cfg80211_cached_keys;
2251 2355
2252/** 2356/**
2253 * struct wireless_dev - wireless per-netdev state 2357 * struct wireless_dev - wireless device state
2358 *
2359 * For netdevs, this structure must be allocated by the driver
2360 * that uses the ieee80211_ptr field in struct net_device (this
2361 * is intentional so it can be allocated along with the netdev.)
2362 * It need not be registered then as netdev registration will
2363 * be intercepted by cfg80211 to see the new wireless device.
2254 * 2364 *
2255 * This structure must be allocated by the driver/stack 2365 * For non-netdev uses, it must also be allocated by the driver
2256 * that uses the ieee80211_ptr field in struct net_device 2366 * in response to the cfg80211 callbacks that require it, as
2257 * (this is intentional so it can be allocated along with 2367 * there's no netdev registration in that case it may not be
2258 * the netdev.) 2368 * allocated outside of callback operations that return it.
2259 * 2369 *
2260 * @wiphy: pointer to hardware description 2370 * @wiphy: pointer to hardware description
2261 * @iftype: interface type 2371 * @iftype: interface type
2262 * @list: (private) Used to collect the interfaces 2372 * @list: (private) Used to collect the interfaces
2263 * @netdev: (private) Used to reference back to the netdev 2373 * @netdev: (private) Used to reference back to the netdev, may be %NULL
2374 * @identifier: (private) Identifier used in nl80211 to identify this
2375 * wireless device if it has no netdev
2264 * @current_bss: (private) Used by the internal configuration code 2376 * @current_bss: (private) Used by the internal configuration code
2265 * @channel: (private) Used by the internal configuration code to track 2377 * @channel: (private) Used by the internal configuration code to track
2266 * user-set AP, monitor and WDS channels for wireless extensions 2378 * the user-set AP, monitor and WDS channel
2379 * @preset_chan: (private) Used by the internal configuration code to
2380 * track the channel to be used for AP later
2381 * @preset_chantype: (private) the corresponding channel type
2267 * @bssid: (private) Used by the internal configuration code 2382 * @bssid: (private) Used by the internal configuration code
2268 * @ssid: (private) Used by the internal configuration code 2383 * @ssid: (private) Used by the internal configuration code
2269 * @ssid_len: (private) Used by the internal configuration code 2384 * @ssid_len: (private) Used by the internal configuration code
@@ -2289,6 +2404,8 @@ struct wireless_dev {
2289 struct list_head list; 2404 struct list_head list;
2290 struct net_device *netdev; 2405 struct net_device *netdev;
2291 2406
2407 u32 identifier;
2408
2292 struct list_head mgmt_registrations; 2409 struct list_head mgmt_registrations;
2293 spinlock_t mgmt_registrations_lock; 2410 spinlock_t mgmt_registrations_lock;
2294 2411
@@ -2313,8 +2430,14 @@ struct wireless_dev {
2313 spinlock_t event_lock; 2430 spinlock_t event_lock;
2314 2431
2315 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2432 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2433 struct ieee80211_channel *preset_chan;
2434 enum nl80211_channel_type preset_chantype;
2435
2436 /* for AP and mesh channel tracking */
2316 struct ieee80211_channel *channel; 2437 struct ieee80211_channel *channel;
2317 2438
2439 bool ibss_fixed;
2440
2318 bool ps; 2441 bool ps;
2319 int ps_timeout; 2442 int ps_timeout;
2320 2443
@@ -3169,7 +3292,7 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3169 3292
3170/** 3293/**
3171 * cfg80211_ready_on_channel - notification of remain_on_channel start 3294 * cfg80211_ready_on_channel - notification of remain_on_channel start
3172 * @dev: network device 3295 * @wdev: wireless device
3173 * @cookie: the request cookie 3296 * @cookie: the request cookie
3174 * @chan: The current channel (from remain_on_channel request) 3297 * @chan: The current channel (from remain_on_channel request)
3175 * @channel_type: Channel type 3298 * @channel_type: Channel type
@@ -3177,21 +3300,20 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3177 * channel 3300 * channel
3178 * @gfp: allocation flags 3301 * @gfp: allocation flags
3179 */ 3302 */
3180void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 3303void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3181 struct ieee80211_channel *chan, 3304 struct ieee80211_channel *chan,
3182 enum nl80211_channel_type channel_type, 3305 enum nl80211_channel_type channel_type,
3183 unsigned int duration, gfp_t gfp); 3306 unsigned int duration, gfp_t gfp);
3184 3307
3185/** 3308/**
3186 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 3309 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
3187 * @dev: network device 3310 * @wdev: wireless device
3188 * @cookie: the request cookie 3311 * @cookie: the request cookie
3189 * @chan: The current channel (from remain_on_channel request) 3312 * @chan: The current channel (from remain_on_channel request)
3190 * @channel_type: Channel type 3313 * @channel_type: Channel type
3191 * @gfp: allocation flags 3314 * @gfp: allocation flags
3192 */ 3315 */
3193void cfg80211_remain_on_channel_expired(struct net_device *dev, 3316void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
3194 u64 cookie,
3195 struct ieee80211_channel *chan, 3317 struct ieee80211_channel *chan,
3196 enum nl80211_channel_type channel_type, 3318 enum nl80211_channel_type channel_type,
3197 gfp_t gfp); 3319 gfp_t gfp);
@@ -3219,7 +3341,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3219 3341
3220/** 3342/**
3221 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3343 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3222 * @dev: network device 3344 * @wdev: wireless device receiving the frame
3223 * @freq: Frequency on which the frame was received in MHz 3345 * @freq: Frequency on which the frame was received in MHz
3224 * @sig_dbm: signal strength in mBm, or 0 if unknown 3346 * @sig_dbm: signal strength in mBm, or 0 if unknown
3225 * @buf: Management frame (header + body) 3347 * @buf: Management frame (header + body)
@@ -3234,12 +3356,12 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3234 * This function is called whenever an Action frame is received for a station 3356 * This function is called whenever an Action frame is received for a station
3235 * mode interface, but is not processed in kernel. 3357 * mode interface, but is not processed in kernel.
3236 */ 3358 */
3237bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, 3359bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3238 const u8 *buf, size_t len, gfp_t gfp); 3360 const u8 *buf, size_t len, gfp_t gfp);
3239 3361
3240/** 3362/**
3241 * cfg80211_mgmt_tx_status - notification of TX status for management frame 3363 * cfg80211_mgmt_tx_status - notification of TX status for management frame
3242 * @dev: network device 3364 * @wdev: wireless device receiving the frame
3243 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 3365 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
3244 * @buf: Management frame (header + body) 3366 * @buf: Management frame (header + body)
3245 * @len: length of the frame data 3367 * @len: length of the frame data
@@ -3250,7 +3372,7 @@ bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm,
3250 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 3372 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3251 * transmission attempt. 3373 * transmission attempt.
3252 */ 3374 */
3253void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, 3375void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
3254 const u8 *buf, size_t len, bool ack, gfp_t gfp); 3376 const u8 *buf, size_t len, bool ack, gfp_t gfp);
3255 3377
3256 3378
@@ -3280,6 +3402,21 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3280 const u8 *peer, u32 num_packets, gfp_t gfp); 3402 const u8 *peer, u32 num_packets, gfp_t gfp);
3281 3403
3282/** 3404/**
3405 * cfg80211_cqm_txe_notify - TX error rate event
3406 * @dev: network device
3407 * @peer: peer's MAC address
3408 * @num_packets: how many packets were lost
3409 * @rate: % of packets which failed transmission
3410 * @intvl: interval (in s) over which the TX failure threshold was breached.
3411 * @gfp: context flags
3412 *
3413 * Notify userspace when configured % TX failures over number of packets in a
3414 * given interval is exceeded.
3415 */
3416void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
3417 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
3418
3419/**
3283 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 3420 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3284 * @dev: network device 3421 * @dev: network device
3285 * @bssid: BSSID of AP (to avoid races) 3422 * @bssid: BSSID of AP (to avoid races)
@@ -3359,11 +3496,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3359 const u8 *frame, size_t len, 3496 const u8 *frame, size_t len,
3360 int freq, int sig_dbm, gfp_t gfp); 3497 int freq, int sig_dbm, gfp_t gfp);
3361 3498
3362/* 3499/**
3363 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3500 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
3364 * @wiphy: the wiphy 3501 * @wiphy: the wiphy
3365 * @chan: main channel 3502 * @chan: main channel
3366 * @channel_type: HT mode 3503 * @channel_type: HT mode
3504 *
3505 * This function returns true if there is no secondary channel or the secondary
3506 * channel can be used for beaconing (i.e. is not a radar channel etc.)
3367 */ 3507 */
3368bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, 3508bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3369 struct ieee80211_channel *chan, 3509 struct ieee80211_channel *chan,
@@ -3386,7 +3526,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
3386 * 3526 *
3387 * return 0 if MCS index >= 32 3527 * return 0 if MCS index >= 32
3388 */ 3528 */
3389u16 cfg80211_calculate_bitrate(struct rate_info *rate); 3529u32 cfg80211_calculate_bitrate(struct rate_info *rate);
3390 3530
3391/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3531/* Logging, debugging and troubleshooting/diagnostic helpers. */
3392 3532
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index c507e05d172f..4f7d6a182381 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -67,6 +67,8 @@ extern void dn_rt_cache_flush(int delay);
67struct dn_route { 67struct dn_route {
68 struct dst_entry dst; 68 struct dst_entry dst;
69 69
70 struct neighbour *n;
71
70 struct flowidn fld; 72 struct flowidn fld;
71 73
72 __le16 rt_saddr; 74 __le16 rt_saddr;
diff --git a/include/net/dst.h b/include/net/dst.h
index 8197eadca819..baf597890064 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -42,16 +42,16 @@ struct dst_entry {
42 struct dst_entry *from; 42 struct dst_entry *from;
43 }; 43 };
44 struct dst_entry *path; 44 struct dst_entry *path;
45 struct neighbour __rcu *_neighbour; 45 void *__pad0;
46#ifdef CONFIG_XFRM 46#ifdef CONFIG_XFRM
47 struct xfrm_state *xfrm; 47 struct xfrm_state *xfrm;
48#else 48#else
49 void *__pad1; 49 void *__pad1;
50#endif 50#endif
51 int (*input)(struct sk_buff*); 51 int (*input)(struct sk_buff *);
52 int (*output)(struct sk_buff*); 52 int (*output)(struct sk_buff *);
53 53
54 int flags; 54 unsigned short flags;
55#define DST_HOST 0x0001 55#define DST_HOST 0x0001
56#define DST_NOXFRM 0x0002 56#define DST_NOXFRM 0x0002
57#define DST_NOPOLICY 0x0004 57#define DST_NOPOLICY 0x0004
@@ -62,8 +62,23 @@ struct dst_entry {
62#define DST_FAKE_RTABLE 0x0080 62#define DST_FAKE_RTABLE 0x0080
63#define DST_XFRM_TUNNEL 0x0100 63#define DST_XFRM_TUNNEL 0x0100
64 64
65 unsigned short pending_confirm;
66
65 short error; 67 short error;
68
69 /* A non-zero value of dst->obsolete forces by-hand validation
70 * of the route entry. Positive values are set by the generic
71 * dst layer to indicate that the entry has been forcefully
72 * destroyed.
73 *
74 * Negative values are used by the implementation layer code to
75 * force invocation of the dst_ops->check() method.
76 */
66 short obsolete; 77 short obsolete;
78#define DST_OBSOLETE_NONE 0
79#define DST_OBSOLETE_DEAD 2
80#define DST_OBSOLETE_FORCE_CHK -1
81#define DST_OBSOLETE_KILL -2
67 unsigned short header_len; /* more space at head required */ 82 unsigned short header_len; /* more space at head required */
68 unsigned short trailer_len; /* space to reserve at tail */ 83 unsigned short trailer_len; /* space to reserve at tail */
69#ifdef CONFIG_IP_ROUTE_CLASSID 84#ifdef CONFIG_IP_ROUTE_CLASSID
@@ -94,21 +109,6 @@ struct dst_entry {
94 }; 109 };
95}; 110};
96 111
97static inline struct neighbour *dst_get_neighbour_noref(struct dst_entry *dst)
98{
99 return rcu_dereference(dst->_neighbour);
100}
101
102static inline struct neighbour *dst_get_neighbour_noref_raw(struct dst_entry *dst)
103{
104 return rcu_dereference_raw(dst->_neighbour);
105}
106
107static inline void dst_set_neighbour(struct dst_entry *dst, struct neighbour *neigh)
108{
109 rcu_assign_pointer(dst->_neighbour, neigh);
110}
111
112extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 112extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
113extern const u32 dst_default_metrics[RTAX_MAX]; 113extern const u32 dst_default_metrics[RTAX_MAX];
114 114
@@ -222,12 +222,6 @@ static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metr
222 return msecs_to_jiffies(dst_metric(dst, metric)); 222 return msecs_to_jiffies(dst_metric(dst, metric));
223} 223}
224 224
225static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric,
226 unsigned long rtt)
227{
228 dst_metric_set(dst, metric, jiffies_to_msecs(rtt));
229}
230
231static inline u32 225static inline u32
232dst_allfrag(const struct dst_entry *dst) 226dst_allfrag(const struct dst_entry *dst)
233{ 227{
@@ -241,7 +235,7 @@ dst_metric_locked(const struct dst_entry *dst, int metric)
241 return dst_metric(dst, RTAX_LOCK) & (1<<metric); 235 return dst_metric(dst, RTAX_LOCK) & (1<<metric);
242} 236}
243 237
244static inline void dst_hold(struct dst_entry * dst) 238static inline void dst_hold(struct dst_entry *dst)
245{ 239{
246 /* 240 /*
247 * If your kernel compilation stops here, please check 241 * If your kernel compilation stops here, please check
@@ -264,8 +258,7 @@ static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
264 dst->lastuse = time; 258 dst->lastuse = time;
265} 259}
266 260
267static inline 261static inline struct dst_entry *dst_clone(struct dst_entry *dst)
268struct dst_entry * dst_clone(struct dst_entry * dst)
269{ 262{
270 if (dst) 263 if (dst)
271 atomic_inc(&dst->__refcnt); 264 atomic_inc(&dst->__refcnt);
@@ -371,14 +364,15 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
371} 364}
372 365
373extern int dst_discard(struct sk_buff *skb); 366extern int dst_discard(struct sk_buff *skb);
374extern void *dst_alloc(struct dst_ops * ops, struct net_device *dev, 367extern void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
375 int initial_ref, int initial_obsolete, int flags); 368 int initial_ref, int initial_obsolete,
376extern void __dst_free(struct dst_entry * dst); 369 unsigned short flags);
377extern struct dst_entry *dst_destroy(struct dst_entry * dst); 370extern void __dst_free(struct dst_entry *dst);
371extern struct dst_entry *dst_destroy(struct dst_entry *dst);
378 372
379static inline void dst_free(struct dst_entry * dst) 373static inline void dst_free(struct dst_entry *dst)
380{ 374{
381 if (dst->obsolete > 1) 375 if (dst->obsolete > 0)
382 return; 376 return;
383 if (!atomic_read(&dst->__refcnt)) { 377 if (!atomic_read(&dst->__refcnt)) {
384 dst = dst_destroy(dst); 378 dst = dst_destroy(dst);
@@ -396,19 +390,35 @@ static inline void dst_rcu_free(struct rcu_head *head)
396 390
397static inline void dst_confirm(struct dst_entry *dst) 391static inline void dst_confirm(struct dst_entry *dst)
398{ 392{
399 if (dst) { 393 dst->pending_confirm = 1;
400 struct neighbour *n; 394}
401 395
402 rcu_read_lock(); 396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n,
403 n = dst_get_neighbour_noref(dst); 397 struct sk_buff *skb)
404 neigh_confirm(n); 398{
405 rcu_read_unlock(); 399 struct hh_cache *hh;
400
401 if (unlikely(dst->pending_confirm)) {
402 n->confirmed = jiffies;
403 dst->pending_confirm = 0;
406 } 404 }
405
406 hh = &n->hh;
407 if ((n->nud_state & NUD_CONNECTED) && hh->hh_len)
408 return neigh_hh_output(hh, skb);
409 else
410 return n->output(n, skb);
407} 411}
408 412
409static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) 413static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
410{ 414{
411 return dst->ops->neigh_lookup(dst, daddr); 415 return dst->ops->neigh_lookup(dst, NULL, daddr);
416}
417
418static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
419 struct sk_buff *skb)
420{
421 return dst->ops->neigh_lookup(dst, skb, NULL);
412} 422}
413 423
414static inline void dst_link_failure(struct sk_buff *skb) 424static inline void dst_link_failure(struct sk_buff *skb)
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index 3682a0a076c1..2f26dfb8450e 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -8,6 +8,7 @@ struct dst_entry;
8struct kmem_cachep; 8struct kmem_cachep;
9struct net_device; 9struct net_device;
10struct sk_buff; 10struct sk_buff;
11struct sock;
11 12
12struct dst_ops { 13struct dst_ops {
13 unsigned short family; 14 unsigned short family;
@@ -24,9 +25,14 @@ struct dst_ops {
24 struct net_device *dev, int how); 25 struct net_device *dev, int how);
25 struct dst_entry * (*negative_advice)(struct dst_entry *); 26 struct dst_entry * (*negative_advice)(struct dst_entry *);
26 void (*link_failure)(struct sk_buff *); 27 void (*link_failure)(struct sk_buff *);
27 void (*update_pmtu)(struct dst_entry *dst, u32 mtu); 28 void (*update_pmtu)(struct dst_entry *dst, struct sock *sk,
29 struct sk_buff *skb, u32 mtu);
30 void (*redirect)(struct dst_entry *dst, struct sock *sk,
31 struct sk_buff *skb);
28 int (*local_out)(struct sk_buff *skb); 32 int (*local_out)(struct sk_buff *skb);
29 struct neighbour * (*neigh_lookup)(const struct dst_entry *dst, const void *daddr); 33 struct neighbour * (*neigh_lookup)(const struct dst_entry *dst,
34 struct sk_buff *skb,
35 const void *daddr);
30 36
31 struct kmem_cache *kmem_cachep; 37 struct kmem_cache *kmem_cachep;
32 38
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 075f1e3a0fed..e361f4882426 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -52,6 +52,7 @@ struct fib_rules_ops {
52 struct sk_buff *, 52 struct sk_buff *,
53 struct fib_rule_hdr *, 53 struct fib_rule_hdr *,
54 struct nlattr **); 54 struct nlattr **);
55 void (*delete)(struct fib_rule *);
55 int (*compare)(struct fib_rule *, 56 int (*compare)(struct fib_rule *,
56 struct fib_rule_hdr *, 57 struct fib_rule_hdr *,
57 struct nlattr **); 58 struct nlattr **);
diff --git a/include/net/flow.h b/include/net/flow.h
index 6c469dbdb917..e1dd5082ec7e 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -20,8 +20,7 @@ struct flowi_common {
20 __u8 flowic_proto; 20 __u8 flowic_proto;
21 __u8 flowic_flags; 21 __u8 flowic_flags;
22#define FLOWI_FLAG_ANYSRC 0x01 22#define FLOWI_FLAG_ANYSRC 0x01
23#define FLOWI_FLAG_PRECOW_METRICS 0x02 23#define FLOWI_FLAG_CAN_SLEEP 0x02
24#define FLOWI_FLAG_CAN_SLEEP 0x04
25 __u32 flowic_secid; 24 __u32 flowic_secid;
26}; 25};
27 26
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index ccb68880abf5..48905cd3884c 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -5,6 +5,8 @@
5#include <net/netlink.h> 5#include <net/netlink.h>
6#include <net/net_namespace.h> 6#include <net/net_namespace.h>
7 7
8#define GENLMSG_DEFAULT_SIZE (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)
9
8/** 10/**
9 * struct genl_multicast_group - generic netlink multicast group 11 * struct genl_multicast_group - generic netlink multicast group
10 * @name: name of the multicast group, names are per-family 12 * @name: name of the multicast group, names are per-family
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 1866a676c810..04642c920431 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -26,6 +26,7 @@ extern int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb, bool relax); 26 const struct inet_bind_bucket *tb, bool relax);
27 27
28extern struct dst_entry* inet6_csk_route_req(struct sock *sk, 28extern struct dst_entry* inet6_csk_route_req(struct sock *sk,
29 struct flowi6 *fl6,
29 const struct request_sock *req); 30 const struct request_sock *req);
30 31
31extern struct request_sock *inet6_csk_search_req(const struct sock *sk, 32extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
@@ -42,4 +43,6 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
42extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 43extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
43 44
44extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); 45extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl);
46
47extern struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu);
45#endif /* _INET6_CONNECTION_SOCK_H */ 48#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 22fac9892b16..234008782c8c 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -14,9 +14,11 @@ struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16extern int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr, 17extern int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
18 int addr_len, int flags); 18 int addr_len, int flags);
19extern int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr, 19extern int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
20 int addr_len, int flags);
21extern int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
20 int addr_len, int flags); 22 int addr_len, int flags);
21extern int inet_accept(struct socket *sock, struct socket *newsock, int flags); 23extern int inet_accept(struct socket *sock, struct socket *newsock, int flags);
22extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock, 24extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock,
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 7d83f90f203f..5ee66f517b4f 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -43,7 +43,6 @@ struct inet_connection_sock_af_ops {
43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, 43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
44 struct request_sock *req, 44 struct request_sock *req,
45 struct dst_entry *dst); 45 struct dst_entry *dst);
46 struct inet_peer *(*get_peer)(struct sock *sk, bool *release_it);
47 u16 net_header_len; 46 u16 net_header_len;
48 u16 net_frag_header_len; 47 u16 net_frag_header_len;
49 u16 sockaddr_len; 48 u16 sockaddr_len;
@@ -337,4 +336,6 @@ extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
337 char __user *optval, int __user *optlen); 336 char __user *optval, int __user *optlen);
338extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 337extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
339 char __user *optval, unsigned int optlen); 338 char __user *optval, unsigned int optlen);
339
340extern struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
340#endif /* _INET_CONNECTION_SOCK_H */ 341#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 808fc5f76b03..54be0287eb98 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -379,10 +379,10 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
379 const __be16 sport, 379 const __be16 sport,
380 const __be16 dport) 380 const __be16 dport)
381{ 381{
382 struct sock *sk; 382 struct sock *sk = skb_steal_sock(skb);
383 const struct iphdr *iph = ip_hdr(skb); 383 const struct iphdr *iph = ip_hdr(skb);
384 384
385 if (unlikely(sk = skb_steal_sock(skb))) 385 if (sk)
386 return sk; 386 return sk;
387 else 387 else
388 return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, 388 return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index ae17e1352d7e..613cfa401672 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -172,6 +172,7 @@ struct inet_sock {
172 int uc_index; 172 int uc_index;
173 int mc_index; 173 int mc_index;
174 __be32 mc_addr; 174 __be32 mc_addr;
175 int rx_dst_ifindex;
175 struct ip_mc_socklist __rcu *mc_list; 176 struct ip_mc_socklist __rcu *mc_list;
176 struct inet_cork_full cork; 177 struct inet_cork_full cork;
177}; 178};
@@ -245,8 +246,6 @@ static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
245 246
246 if (inet_sk(sk)->transparent || inet_sk(sk)->hdrincl) 247 if (inet_sk(sk)->transparent || inet_sk(sk)->hdrincl)
247 flags |= FLOWI_FLAG_ANYSRC; 248 flags |= FLOWI_FLAG_ANYSRC;
248 if (sk->sk_protocol == IPPROTO_TCP)
249 flags |= FLOWI_FLAG_PRECOW_METRICS;
250 return flags; 249 return flags;
251} 250}
252 251
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 2040bff945d4..53f464d7cddc 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -36,25 +36,19 @@ struct inet_peer {
36 u32 metrics[RTAX_MAX]; 36 u32 metrics[RTAX_MAX];
37 u32 rate_tokens; /* rate limiting for ICMP */ 37 u32 rate_tokens; /* rate limiting for ICMP */
38 unsigned long rate_last; 38 unsigned long rate_last;
39 unsigned long pmtu_expires;
40 u32 pmtu_orig;
41 u32 pmtu_learned;
42 struct inetpeer_addr_base redirect_learned;
43 union { 39 union {
44 struct list_head gc_list; 40 struct list_head gc_list;
45 struct rcu_head gc_rcu; 41 struct rcu_head gc_rcu;
46 }; 42 };
47 /* 43 /*
48 * Once inet_peer is queued for deletion (refcnt == -1), following fields 44 * Once inet_peer is queued for deletion (refcnt == -1), following fields
49 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 45 * are not available: rid, ip_id_count
50 * We can share memory with rcu_head to help keep inet_peer small. 46 * We can share memory with rcu_head to help keep inet_peer small.
51 */ 47 */
52 union { 48 union {
53 struct { 49 struct {
54 atomic_t rid; /* Frag reception counter */ 50 atomic_t rid; /* Frag reception counter */
55 atomic_t ip_id_count; /* IP ID for the next packet */ 51 atomic_t ip_id_count; /* IP ID for the next packet */
56 __u32 tcp_ts;
57 __u32 tcp_ts_stamp;
58 }; 52 };
59 struct rcu_head rcu; 53 struct rcu_head rcu;
60 struct inet_peer *gc_next; 54 struct inet_peer *gc_next;
@@ -65,6 +59,69 @@ struct inet_peer {
65 atomic_t refcnt; 59 atomic_t refcnt;
66}; 60};
67 61
62struct inet_peer_base {
63 struct inet_peer __rcu *root;
64 seqlock_t lock;
65 u32 flush_seq;
66 int total;
67};
68
69#define INETPEER_BASE_BIT 0x1UL
70
71static inline struct inet_peer *inetpeer_ptr(unsigned long val)
72{
73 BUG_ON(val & INETPEER_BASE_BIT);
74 return (struct inet_peer *) val;
75}
76
77static inline struct inet_peer_base *inetpeer_base_ptr(unsigned long val)
78{
79 if (!(val & INETPEER_BASE_BIT))
80 return NULL;
81 val &= ~INETPEER_BASE_BIT;
82 return (struct inet_peer_base *) val;
83}
84
85static inline bool inetpeer_ptr_is_peer(unsigned long val)
86{
87 return !(val & INETPEER_BASE_BIT);
88}
89
90static inline void __inetpeer_ptr_set_peer(unsigned long *val, struct inet_peer *peer)
91{
92 /* This implicitly clears INETPEER_BASE_BIT */
93 *val = (unsigned long) peer;
94}
95
96static inline bool inetpeer_ptr_set_peer(unsigned long *ptr, struct inet_peer *peer)
97{
98 unsigned long val = (unsigned long) peer;
99 unsigned long orig = *ptr;
100
101 if (!(orig & INETPEER_BASE_BIT) ||
102 cmpxchg(ptr, orig, val) != orig)
103 return false;
104 return true;
105}
106
107static inline void inetpeer_init_ptr(unsigned long *ptr, struct inet_peer_base *base)
108{
109 *ptr = (unsigned long) base | INETPEER_BASE_BIT;
110}
111
112static inline void inetpeer_transfer_peer(unsigned long *to, unsigned long *from)
113{
114 unsigned long val = *from;
115
116 *to = val;
117 if (inetpeer_ptr_is_peer(val)) {
118 struct inet_peer *peer = inetpeer_ptr(val);
119 atomic_inc(&peer->refcnt);
120 }
121}
122
123extern void inet_peer_base_init(struct inet_peer_base *);
124
68void inet_initpeers(void) __init; 125void inet_initpeers(void) __init;
69 126
70#define INETPEER_METRICS_NEW (~(u32) 0) 127#define INETPEER_METRICS_NEW (~(u32) 0)
@@ -75,31 +132,38 @@ static inline bool inet_metrics_new(const struct inet_peer *p)
75} 132}
76 133
77/* can be called with or without local BH being disabled */ 134/* can be called with or without local BH being disabled */
78struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create); 135struct inet_peer *inet_getpeer(struct inet_peer_base *base,
136 const struct inetpeer_addr *daddr,
137 int create);
79 138
80static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) 139static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base,
140 __be32 v4daddr,
141 int create)
81{ 142{
82 struct inetpeer_addr daddr; 143 struct inetpeer_addr daddr;
83 144
84 daddr.addr.a4 = v4daddr; 145 daddr.addr.a4 = v4daddr;
85 daddr.family = AF_INET; 146 daddr.family = AF_INET;
86 return inet_getpeer(&daddr, create); 147 return inet_getpeer(base, &daddr, create);
87} 148}
88 149
89static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create) 150static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
151 const struct in6_addr *v6daddr,
152 int create)
90{ 153{
91 struct inetpeer_addr daddr; 154 struct inetpeer_addr daddr;
92 155
93 *(struct in6_addr *)daddr.addr.a6 = *v6daddr; 156 *(struct in6_addr *)daddr.addr.a6 = *v6daddr;
94 daddr.family = AF_INET6; 157 daddr.family = AF_INET6;
95 return inet_getpeer(&daddr, create); 158 return inet_getpeer(base, &daddr, create);
96} 159}
97 160
98/* can be called from BH context or outside */ 161/* can be called from BH context or outside */
99extern void inet_putpeer(struct inet_peer *p); 162extern void inet_putpeer(struct inet_peer *p);
100extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 163extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
101 164
102extern void inetpeer_invalidate_tree(int family); 165extern void inetpeer_invalidate_tree(struct inet_peer_base *);
166extern void inetpeer_invalidate_family(int family);
103 167
104/* 168/*
105 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/include/net/ip.h b/include/net/ip.h
index 83e0619f59d0..bd5e444a19ce 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -158,8 +158,9 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
158 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; 158 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
159} 159}
160 160
161void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, 161void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
162 const struct ip_reply_arg *arg, unsigned int len); 162 __be32 saddr, const struct ip_reply_arg *arg,
163 unsigned int len);
163 164
164struct ipv4_config { 165struct ipv4_config {
165 int log_martians; 166 int log_martians;
@@ -210,6 +211,9 @@ extern int inet_peer_threshold;
210extern int inet_peer_minttl; 211extern int inet_peer_minttl;
211extern int inet_peer_maxttl; 212extern int inet_peer_maxttl;
212 213
214/* From ip_input.c */
215extern int sysctl_ip_early_demux;
216
213/* From ip_output.c */ 217/* From ip_output.c */
214extern int sysctl_ip_dynaddr; 218extern int sysctl_ip_dynaddr;
215 219
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 0ae759a6c76e..0fedbd8d747a 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -86,6 +86,8 @@ struct fib6_table;
86struct rt6_info { 86struct rt6_info {
87 struct dst_entry dst; 87 struct dst_entry dst;
88 88
89 struct neighbour *n;
90
89 /* 91 /*
90 * Tail elements of dst_entry (__refcnt etc.) 92 * Tail elements of dst_entry (__refcnt etc.)
91 * and these elements (rarely used in hot path) are in 93 * and these elements (rarely used in hot path) are in
@@ -107,7 +109,7 @@ struct rt6_info {
107 u32 rt6i_peer_genid; 109 u32 rt6i_peer_genid;
108 110
109 struct inet6_dev *rt6i_idev; 111 struct inet6_dev *rt6i_idev;
110 struct inet_peer *rt6i_peer; 112 unsigned long _rt6i_peer;
111 113
112#ifdef CONFIG_XFRM 114#ifdef CONFIG_XFRM
113 u32 rt6i_flow_cache_genid; 115 u32 rt6i_flow_cache_genid;
@@ -118,6 +120,36 @@ struct rt6_info {
118 u8 rt6i_protocol; 120 u8 rt6i_protocol;
119}; 121};
120 122
123static inline struct inet_peer *rt6_peer_ptr(struct rt6_info *rt)
124{
125 return inetpeer_ptr(rt->_rt6i_peer);
126}
127
128static inline bool rt6_has_peer(struct rt6_info *rt)
129{
130 return inetpeer_ptr_is_peer(rt->_rt6i_peer);
131}
132
133static inline void __rt6_set_peer(struct rt6_info *rt, struct inet_peer *peer)
134{
135 __inetpeer_ptr_set_peer(&rt->_rt6i_peer, peer);
136}
137
138static inline bool rt6_set_peer(struct rt6_info *rt, struct inet_peer *peer)
139{
140 return inetpeer_ptr_set_peer(&rt->_rt6i_peer, peer);
141}
142
143static inline void rt6_init_peer(struct rt6_info *rt, struct inet_peer_base *base)
144{
145 inetpeer_init_ptr(&rt->_rt6i_peer, base);
146}
147
148static inline void rt6_transfer_peer(struct rt6_info *rt, struct rt6_info *ort)
149{
150 inetpeer_transfer_peer(&rt->_rt6i_peer, &ort->_rt6i_peer);
151}
152
121static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) 153static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
122{ 154{
123 return ((struct rt6_info *)dst)->rt6i_idev; 155 return ((struct rt6_info *)dst)->rt6i_idev;
@@ -207,6 +239,7 @@ struct fib6_table {
207 u32 tb6_id; 239 u32 tb6_id;
208 rwlock_t tb6_lock; 240 rwlock_t tb6_lock;
209 struct fib6_node tb6_root; 241 struct fib6_node tb6_root;
242 struct inet_peer_base tb6_peers;
210}; 243};
211 244
212#define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC 245#define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 37c1a1ed82c1..5fa2af00634a 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -53,16 +53,25 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
53 return (flags >> 3) & 7; 53 return (flags >> 3) & 7;
54} 54}
55 55
56extern void rt6_bind_peer(struct rt6_info *rt, 56extern void rt6_bind_peer(struct rt6_info *rt, int create);
57 int create); 57
58static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
59{
60 if (rt6_has_peer(rt))
61 return rt6_peer_ptr(rt);
62
63 rt6_bind_peer(rt, create);
64 return (rt6_has_peer(rt) ? rt6_peer_ptr(rt) : NULL);
65}
58 66
59static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt) 67static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
60{ 68{
61 if (rt->rt6i_peer) 69 return __rt6_get_peer(rt, 0);
62 return rt->rt6i_peer; 70}
63 71
64 rt6_bind_peer(rt, 0); 72static inline struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
65 return rt->rt6i_peer; 73{
74 return __rt6_get_peer(rt, 1);
66} 75}
67 76
68extern void ip6_route_input(struct sk_buff *skb); 77extern void ip6_route_input(struct sk_buff *skb);
@@ -124,17 +133,12 @@ extern int rt6_route_rcv(struct net_device *dev,
124 u8 *opt, int len, 133 u8 *opt, int len,
125 const struct in6_addr *gwaddr); 134 const struct in6_addr *gwaddr);
126 135
127extern void rt6_redirect(const struct in6_addr *dest, 136extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
128 const struct in6_addr *src, 137 int oif, u32 mark);
129 const struct in6_addr *saddr, 138extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,
130 struct neighbour *neigh, 139 __be32 mtu);
131 u8 *lladdr, 140extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
132 int on_link); 141extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
133
134extern void rt6_pmtu_discovery(const struct in6_addr *daddr,
135 const struct in6_addr *saddr,
136 struct net_device *dev,
137 u32 pmtu);
138 142
139struct netlink_callback; 143struct netlink_callback;
140 144
@@ -154,7 +158,8 @@ extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
154 * Store a destination cache entry in a socket 158 * Store a destination cache entry in a socket
155 */ 159 */
156static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst, 160static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst,
157 struct in6_addr *daddr, struct in6_addr *saddr) 161 const struct in6_addr *daddr,
162 const struct in6_addr *saddr)
158{ 163{
159 struct ipv6_pinfo *np = inet6_sk(sk); 164 struct ipv6_pinfo *np = inet6_sk(sk);
160 struct rt6_info *rt = (struct rt6_info *) dst; 165 struct rt6_info *rt = (struct rt6_info *) dst;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index fc73e667b50e..358fb86f57eb 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -9,6 +9,8 @@
9#define IP6_TNL_F_CAP_XMIT 0x10000 9#define IP6_TNL_F_CAP_XMIT 0x10000
10/* capable of receiving packets */ 10/* capable of receiving packets */
11#define IP6_TNL_F_CAP_RCV 0x20000 11#define IP6_TNL_F_CAP_RCV 0x20000
12/* determine capability on a per-packet basis */
13#define IP6_TNL_F_CAP_PER_PACKET 0x40000
12 14
13/* IPv6 tunnel */ 15/* IPv6 tunnel */
14 16
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 78df0866cc38..e69c3a47153d 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -18,7 +18,9 @@
18 18
19#include <net/flow.h> 19#include <net/flow.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/rcupdate.h>
21#include <net/fib_rules.h> 22#include <net/fib_rules.h>
23#include <net/inetpeer.h>
22 24
23struct fib_config { 25struct fib_config {
24 u8 fc_dst_len; 26 u8 fc_dst_len;
@@ -44,6 +46,23 @@ struct fib_config {
44 }; 46 };
45 47
46struct fib_info; 48struct fib_info;
49struct rtable;
50
51struct fib_nh_exception {
52 struct fib_nh_exception __rcu *fnhe_next;
53 __be32 fnhe_daddr;
54 u32 fnhe_pmtu;
55 __be32 fnhe_gw;
56 unsigned long fnhe_expires;
57 unsigned long fnhe_stamp;
58};
59
60struct fnhe_hash_bucket {
61 struct fib_nh_exception __rcu *chain;
62};
63
64#define FNHE_HASH_SIZE 2048
65#define FNHE_RECLAIM_DEPTH 5
47 66
48struct fib_nh { 67struct fib_nh {
49 struct net_device *nh_dev; 68 struct net_device *nh_dev;
@@ -62,6 +81,9 @@ struct fib_nh {
62 __be32 nh_gw; 81 __be32 nh_gw;
63 __be32 nh_saddr; 82 __be32 nh_saddr;
64 int nh_saddr_genid; 83 int nh_saddr_genid;
84 struct rtable *nh_rth_output;
85 struct rtable *nh_rth_input;
86 struct fnhe_hash_bucket *nh_exceptions;
65}; 87};
66 88
67/* 89/*
@@ -105,12 +127,10 @@ struct fib_result {
105 unsigned char nh_sel; 127 unsigned char nh_sel;
106 unsigned char type; 128 unsigned char type;
107 unsigned char scope; 129 unsigned char scope;
130 u32 tclassid;
108 struct fib_info *fi; 131 struct fib_info *fi;
109 struct fib_table *table; 132 struct fib_table *table;
110 struct list_head *fa_head; 133 struct list_head *fa_head;
111#ifdef CONFIG_IP_MULTIPLE_TABLES
112 struct fib_rule *r;
113#endif
114}; 134};
115 135
116struct fib_result_nl { 136struct fib_result_nl {
@@ -157,11 +177,11 @@ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
157 FIB_RES_SADDR(net, res)) 177 FIB_RES_SADDR(net, res))
158 178
159struct fib_table { 179struct fib_table {
160 struct hlist_node tb_hlist; 180 struct hlist_node tb_hlist;
161 u32 tb_id; 181 u32 tb_id;
162 int tb_default; 182 int tb_default;
163 int tb_num_default; 183 int tb_num_default;
164 unsigned long tb_data[0]; 184 unsigned long tb_data[0];
165}; 185};
166 186
167extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, 187extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
@@ -214,24 +234,55 @@ static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
214extern int __net_init fib4_rules_init(struct net *net); 234extern int __net_init fib4_rules_init(struct net *net);
215extern void __net_exit fib4_rules_exit(struct net *net); 235extern void __net_exit fib4_rules_exit(struct net *net);
216 236
217#ifdef CONFIG_IP_ROUTE_CLASSID
218extern u32 fib_rules_tclass(const struct fib_result *res);
219#endif
220
221extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res);
222
223extern struct fib_table *fib_new_table(struct net *net, u32 id); 237extern struct fib_table *fib_new_table(struct net *net, u32 id);
224extern struct fib_table *fib_get_table(struct net *net, u32 id); 238extern struct fib_table *fib_get_table(struct net *net, u32 id);
225 239
240extern int __fib_lookup(struct net *net, struct flowi4 *flp,
241 struct fib_result *res);
242
243static inline int fib_lookup(struct net *net, struct flowi4 *flp,
244 struct fib_result *res)
245{
246 if (!net->ipv4.fib_has_custom_rules) {
247 res->tclassid = 0;
248 if (net->ipv4.fib_local &&
249 !fib_table_lookup(net->ipv4.fib_local, flp, res,
250 FIB_LOOKUP_NOREF))
251 return 0;
252 if (net->ipv4.fib_main &&
253 !fib_table_lookup(net->ipv4.fib_main, flp, res,
254 FIB_LOOKUP_NOREF))
255 return 0;
256 if (net->ipv4.fib_default &&
257 !fib_table_lookup(net->ipv4.fib_default, flp, res,
258 FIB_LOOKUP_NOREF))
259 return 0;
260 return -ENETUNREACH;
261 }
262 return __fib_lookup(net, flp, res);
263}
264
226#endif /* CONFIG_IP_MULTIPLE_TABLES */ 265#endif /* CONFIG_IP_MULTIPLE_TABLES */
227 266
228/* Exported by fib_frontend.c */ 267/* Exported by fib_frontend.c */
229extern const struct nla_policy rtm_ipv4_policy[]; 268extern const struct nla_policy rtm_ipv4_policy[];
230extern void ip_fib_init(void); 269extern void ip_fib_init(void);
270extern __be32 fib_compute_spec_dst(struct sk_buff *skb);
231extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, 271extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
232 u8 tos, int oif, struct net_device *dev, 272 u8 tos, int oif, struct net_device *dev,
233 __be32 *spec_dst, u32 *itag); 273 struct in_device *idev, u32 *itag);
234extern void fib_select_default(struct fib_result *res); 274extern void fib_select_default(struct fib_result *res);
275#ifdef CONFIG_IP_ROUTE_CLASSID
276static inline int fib_num_tclassid_users(struct net *net)
277{
278 return net->ipv4.fib_num_tclassid_users;
279}
280#else
281static inline int fib_num_tclassid_users(struct net *net)
282{
283 return 0;
284}
285#endif
235 286
236/* Exported by fib_semantics.c */ 287/* Exported by fib_semantics.c */
237extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 288extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
@@ -253,7 +304,7 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
253#endif 304#endif
254 *itag = FIB_RES_NH(*res).nh_tclassid<<16; 305 *itag = FIB_RES_NH(*res).nh_tclassid<<16;
255#ifdef CONFIG_IP_MULTIPLE_TABLES 306#ifdef CONFIG_IP_MULTIPLE_TABLES
256 rtag = fib_rules_tclass(res); 307 rtag = res->tclassid;
257 if (*itag == 0) 308 if (*itag == 0)
258 *itag = (rtag<<16); 309 *itag = (rtag<<16);
259 *itag |= (rtag>>16); 310 *itag |= (rtag>>16);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index aecf88436abf..01c34b363a34 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -251,6 +251,8 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
251 atomic_dec(&fl->users); 251 atomic_dec(&fl->users);
252} 252}
253 253
254extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
255
254extern int ip6_ra_control(struct sock *sk, int sel); 256extern int ip6_ra_control(struct sock *sk, int sel);
255 257
256extern int ipv6_parse_hopopts(struct sk_buff *skb); 258extern int ipv6_parse_hopopts(struct sk_buff *skb);
@@ -298,14 +300,23 @@ static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr
298 return memcmp(a1, a2, sizeof(struct in6_addr)); 300 return memcmp(a1, a2, sizeof(struct in6_addr));
299} 301}
300 302
301static inline int 303static inline bool
302ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, 304ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
303 const struct in6_addr *a2) 305 const struct in6_addr *a2)
304{ 306{
307#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
308 const unsigned long *ul1 = (const unsigned long *)a1;
309 const unsigned long *ulm = (const unsigned long *)m;
310 const unsigned long *ul2 = (const unsigned long *)a2;
311
312 return !!(((ul1[0] ^ ul2[0]) & ulm[0]) |
313 ((ul1[1] ^ ul2[1]) & ulm[1]));
314#else
305 return !!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) | 315 return !!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) |
306 ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) | 316 ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) |
307 ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) | 317 ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) |
308 ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3])); 318 ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]));
319#endif
309} 320}
310 321
311static inline void ipv6_addr_prefix(struct in6_addr *pfx, 322static inline void ipv6_addr_prefix(struct in6_addr *pfx,
@@ -335,10 +346,17 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
335static inline bool ipv6_addr_equal(const struct in6_addr *a1, 346static inline bool ipv6_addr_equal(const struct in6_addr *a1,
336 const struct in6_addr *a2) 347 const struct in6_addr *a2)
337{ 348{
349#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
350 const unsigned long *ul1 = (const unsigned long *)a1;
351 const unsigned long *ul2 = (const unsigned long *)a2;
352
353 return ((ul1[0] ^ ul2[0]) | (ul1[1] ^ ul2[1])) == 0UL;
354#else
338 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | 355 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
339 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | 356 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
340 (a1->s6_addr32[2] ^ a2->s6_addr32[2]) | 357 (a1->s6_addr32[2] ^ a2->s6_addr32[2]) |
341 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0; 358 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0;
359#endif
342} 360}
343 361
344static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, 362static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
@@ -391,8 +409,27 @@ bool ip6_frag_match(struct inet_frag_queue *q, void *a);
391 409
392static inline bool ipv6_addr_any(const struct in6_addr *a) 410static inline bool ipv6_addr_any(const struct in6_addr *a)
393{ 411{
412#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
413 const unsigned long *ul = (const unsigned long *)a;
414
415 return (ul[0] | ul[1]) == 0UL;
416#else
394 return (a->s6_addr32[0] | a->s6_addr32[1] | 417 return (a->s6_addr32[0] | a->s6_addr32[1] |
395 a->s6_addr32[2] | a->s6_addr32[3]) == 0; 418 a->s6_addr32[2] | a->s6_addr32[3]) == 0;
419#endif
420}
421
422static inline u32 ipv6_addr_hash(const struct in6_addr *a)
423{
424#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
425 const unsigned long *ul = (const unsigned long *)a;
426 unsigned long x = ul[0] ^ ul[1];
427
428 return (u32)(x ^ (x >> 32));
429#else
430 return (__force u32)(a->s6_addr32[0] ^ a->s6_addr32[1] ^
431 a->s6_addr32[2] ^ a->s6_addr32[3]);
432#endif
396} 433}
397 434
398static inline bool ipv6_addr_loopback(const struct in6_addr *a) 435static inline bool ipv6_addr_loopback(const struct in6_addr *a)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 95e39b6a02ec..bb86aa6f98dd 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -233,8 +233,10 @@ enum ieee80211_rssi_event {
233 * valid in station mode only while @assoc is true and if also 233 * valid in station mode only while @assoc is true and if also
234 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf 234 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf
235 * @ps_dtim_period) 235 * @ps_dtim_period)
236 * @last_tsf: last beacon's/probe response's TSF timestamp (could be old 236 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
237 * as it may have been received during scanning long ago) 237 * as it may have been received during scanning long ago)
238 * @sync_device_ts: the device timestamp corresponding to the sync_tsf,
239 * the driver/device can use this to calculate synchronisation
238 * @beacon_int: beacon interval 240 * @beacon_int: beacon interval
239 * @assoc_capability: capabilities taken from assoc resp 241 * @assoc_capability: capabilities taken from assoc resp
240 * @basic_rates: bitmap of basic rates, each bit stands for an 242 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -281,7 +283,8 @@ struct ieee80211_bss_conf {
281 u8 dtim_period; 283 u8 dtim_period;
282 u16 beacon_int; 284 u16 beacon_int;
283 u16 assoc_capability; 285 u16 assoc_capability;
284 u64 last_tsf; 286 u64 sync_tsf;
287 u32 sync_device_ts;
285 u32 basic_rates; 288 u32 basic_rates;
286 int mcast_rate[IEEE80211_NUM_BANDS]; 289 int mcast_rate[IEEE80211_NUM_BANDS];
287 u16 ht_operation_mode; 290 u16 ht_operation_mode;
@@ -475,7 +478,7 @@ enum mac80211_rate_control_flags {
475#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24 478#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
476 479
477/* maximum number of rate stages */ 480/* maximum number of rate stages */
478#define IEEE80211_TX_MAX_RATES 5 481#define IEEE80211_TX_MAX_RATES 4
479 482
480/** 483/**
481 * struct ieee80211_tx_rate - rate selection/status 484 * struct ieee80211_tx_rate - rate selection/status
@@ -563,11 +566,11 @@ struct ieee80211_tx_info {
563 } control; 566 } control;
564 struct { 567 struct {
565 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 568 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
566 u8 ampdu_ack_len;
567 int ack_signal; 569 int ack_signal;
570 u8 ampdu_ack_len;
568 u8 ampdu_len; 571 u8 ampdu_len;
569 u8 antenna; 572 u8 antenna;
570 /* 14 bytes free */ 573 /* 21 bytes free */
571 } status; 574 } status;
572 struct { 575 struct {
573 struct ieee80211_tx_rate driver_rates[ 576 struct ieee80211_tx_rate driver_rates[
@@ -634,7 +637,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
634 info->status.rates[i].count = 0; 637 info->status.rates[i].count = 0;
635 638
636 BUILD_BUG_ON( 639 BUILD_BUG_ON(
637 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23); 640 offsetof(struct ieee80211_tx_info, status.ack_signal) != 20);
638 memset(&info->status.ampdu_ack_len, 0, 641 memset(&info->status.ampdu_ack_len, 0,
639 sizeof(struct ieee80211_tx_info) - 642 sizeof(struct ieee80211_tx_info) -
640 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len)); 643 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
@@ -696,6 +699,8 @@ enum mac80211_rx_flags {
696 * 699 *
697 * @mactime: value in microseconds of the 64-bit Time Synchronization Function 700 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
698 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. 701 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
702 * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
703 * it but can store it and pass it back to the driver for synchronisation
699 * @band: the active band when this frame was received 704 * @band: the active band when this frame was received
700 * @freq: frequency the radio was tuned to when receiving this frame, in MHz 705 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
701 * @signal: signal strength when receiving this frame, either in dBm, in dB or 706 * @signal: signal strength when receiving this frame, either in dBm, in dB or
@@ -709,13 +714,14 @@ enum mac80211_rx_flags {
709 */ 714 */
710struct ieee80211_rx_status { 715struct ieee80211_rx_status {
711 u64 mactime; 716 u64 mactime;
712 enum ieee80211_band band; 717 u32 device_timestamp;
713 int freq; 718 u16 flag;
714 int signal; 719 u16 freq;
715 int antenna; 720 u8 rate_idx;
716 int rate_idx; 721 u8 rx_flags;
717 int flag; 722 u8 band;
718 unsigned int rx_flags; 723 u8 antenna;
724 s8 signal;
719}; 725};
720 726
721/** 727/**
@@ -1297,6 +1303,10 @@ enum ieee80211_hw_flags {
1297 * reports, by default it is set to _MCS, _GI and _BW but doesn't 1303 * reports, by default it is set to _MCS, _GI and _BW but doesn't
1298 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only 1304 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
1299 * adding _BW is supported today. 1305 * adding _BW is supported today.
1306 *
1307 * @netdev_features: netdev features to be set in each netdev created
1308 * from this HW. Note only HW checksum features are currently
1309 * compatible with mac80211. Other feature bits will be rejected.
1300 */ 1310 */
1301struct ieee80211_hw { 1311struct ieee80211_hw {
1302 struct ieee80211_conf conf; 1312 struct ieee80211_conf conf;
@@ -1319,6 +1329,7 @@ struct ieee80211_hw {
1319 u8 max_tx_aggregation_subframes; 1329 u8 max_tx_aggregation_subframes;
1320 u8 offchannel_tx_hw_queue; 1330 u8 offchannel_tx_hw_queue;
1321 u8 radiotap_mcs_details; 1331 u8 radiotap_mcs_details;
1332 netdev_features_t netdev_features;
1322}; 1333};
1323 1334
1324/** 1335/**
@@ -1891,19 +1902,6 @@ enum ieee80211_rate_control_changed {
1891 * The low-level driver should send the frame out based on 1902 * The low-level driver should send the frame out based on
1892 * configuration in the TX control data. This handler should, 1903 * configuration in the TX control data. This handler should,
1893 * preferably, never fail and stop queues appropriately. 1904 * preferably, never fail and stop queues appropriately.
1894 * This must be implemented if @tx_frags is not.
1895 * Must be atomic.
1896 *
1897 * @tx_frags: Called to transmit multiple fragments of a single MSDU.
1898 * This handler must consume all fragments, sending out some of
1899 * them only is useless and it can't ask for some of them to be
1900 * queued again. If the frame is not fragmented the queue has a
1901 * single SKB only. To avoid issues with the networking stack
1902 * when TX status is reported the frames should be removed from
1903 * the skb queue.
1904 * If this is used, the tx_info @vif and @sta pointers will be
1905 * invalid -- you must not use them in that case.
1906 * This must be implemented if @tx isn't.
1907 * Must be atomic. 1905 * Must be atomic.
1908 * 1906 *
1909 * @start: Called before the first netdevice attached to the hardware 1907 * @start: Called before the first netdevice attached to the hardware
@@ -2183,7 +2181,10 @@ enum ieee80211_rate_control_changed {
2183 * offload. Frames to transmit on the off-channel channel are transmitted 2181 * offload. Frames to transmit on the off-channel channel are transmitted
2184 * normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the 2182 * normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the
2185 * duration (which will always be non-zero) expires, the driver must call 2183 * duration (which will always be non-zero) expires, the driver must call
2186 * ieee80211_remain_on_channel_expired(). This callback may sleep. 2184 * ieee80211_remain_on_channel_expired().
2185 * Note that this callback may be called while the device is in IDLE and
2186 * must be accepted in this case.
2187 * This callback may sleep.
2187 * @cancel_remain_on_channel: Requests that an ongoing off-channel period is 2188 * @cancel_remain_on_channel: Requests that an ongoing off-channel period is
2188 * aborted before it expires. This callback may sleep. 2189 * aborted before it expires. This callback may sleep.
2189 * 2190 *
@@ -2246,11 +2247,24 @@ enum ieee80211_rate_control_changed {
2246 * @get_et_strings: Ethtool API to get a set of strings to describe stats 2247 * @get_et_strings: Ethtool API to get a set of strings to describe stats
2247 * and perhaps other supported types of ethtool data-sets. 2248 * and perhaps other supported types of ethtool data-sets.
2248 * 2249 *
2250 * @get_rssi: Get current signal strength in dBm, the function is optional
2251 * and can sleep.
2252 *
2253 * @mgd_prepare_tx: Prepare for transmitting a management frame for association
2254 * before associated. In multi-channel scenarios, a virtual interface is
2255 * bound to a channel before it is associated, but as it isn't associated
2256 * yet it need not necessarily be given airtime, in particular since any
2257 * transmission to a P2P GO needs to be synchronized against the GO's
2258 * powersave state. mac80211 will call this function before transmitting a
2259 * management frame prior to having successfully associated to allow the
2260 * driver to give it channel time for the transmission, to get a response
2261 * and to be able to synchronize with the GO.
2262 * The callback will be called before each transmission and upon return
2263 * mac80211 will transmit the frame right away.
2264 * The callback is optional and can (should!) sleep.
2249 */ 2265 */
2250struct ieee80211_ops { 2266struct ieee80211_ops {
2251 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 2267 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
2252 void (*tx_frags)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2253 struct ieee80211_sta *sta, struct sk_buff_head *skbs);
2254 int (*start)(struct ieee80211_hw *hw); 2268 int (*start)(struct ieee80211_hw *hw);
2255 void (*stop)(struct ieee80211_hw *hw); 2269 void (*stop)(struct ieee80211_hw *hw);
2256#ifdef CONFIG_PM 2270#ifdef CONFIG_PM
@@ -2385,6 +2399,11 @@ struct ieee80211_ops {
2385 void (*get_et_strings)(struct ieee80211_hw *hw, 2399 void (*get_et_strings)(struct ieee80211_hw *hw,
2386 struct ieee80211_vif *vif, 2400 struct ieee80211_vif *vif,
2387 u32 sset, u8 *data); 2401 u32 sset, u8 *data);
2402 int (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2403 struct ieee80211_sta *sta, s8 *rssi_dbm);
2404
2405 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2406 struct ieee80211_vif *vif);
2388}; 2407};
2389 2408
2390/** 2409/**
@@ -3557,16 +3576,6 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
3557 gfp_t gfp); 3576 gfp_t gfp);
3558 3577
3559/** 3578/**
3560 * ieee80211_get_operstate - get the operstate of the vif
3561 *
3562 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3563 *
3564 * The driver might need to know the operstate of the net_device
3565 * (specifically, whether the link is IF_OPER_UP after resume)
3566 */
3567unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif);
3568
3569/**
3570 * ieee80211_chswitch_done - Complete channel switch process 3579 * ieee80211_chswitch_done - Complete channel switch process
3571 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3580 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3572 * @success: make the channel switch successful or not 3581 * @success: make the channel switch successful or not
@@ -3589,22 +3598,6 @@ void ieee80211_request_smps(struct ieee80211_vif *vif,
3589 enum ieee80211_smps_mode smps_mode); 3598 enum ieee80211_smps_mode smps_mode);
3590 3599
3591/** 3600/**
3592 * ieee80211_key_removed - disable hw acceleration for key
3593 * @key_conf: The key hw acceleration should be disabled for
3594 *
3595 * This allows drivers to indicate that the given key has been
3596 * removed from hardware acceleration, due to a new key that
3597 * was added. Don't use this if the key can continue to be used
3598 * for TX, if the key restriction is on RX only it is permitted
3599 * to keep the key for TX only and not call this function.
3600 *
3601 * Due to locking constraints, it may only be called during
3602 * @set_key. This function must be allowed to sleep, and the
3603 * key it tries to disable may still be used until it returns.
3604 */
3605void ieee80211_key_removed(struct ieee80211_key_conf *key_conf);
3606
3607/**
3608 * ieee80211_ready_on_channel - notification of remain-on-channel start 3601 * ieee80211_ready_on_channel - notification of remain-on-channel start
3609 * @hw: pointer as obtained from ieee80211_alloc_hw() 3602 * @hw: pointer as obtained from ieee80211_alloc_hw()
3610 */ 3603 */
@@ -3829,12 +3822,6 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
3829 3822
3830void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); 3823void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
3831 3824
3832int ieee80211_add_srates_ie(struct ieee80211_vif *vif,
3833 struct sk_buff *skb, bool need_basic);
3834
3835int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
3836 struct sk_buff *skb, bool need_basic);
3837
3838/** 3825/**
3839 * ieee80211_ave_rssi - report the average rssi for the specified interface 3826 * ieee80211_ave_rssi - report the average rssi for the specified interface
3840 * 3827 *
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index c9f8ab5cc687..d0d11df9cba1 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -21,6 +21,14 @@
21 21
22#include <net/af_ieee802154.h> 22#include <net/af_ieee802154.h>
23 23
24/* General MAC frame format:
25 * 2 bytes: Frame Control
26 * 1 byte: Sequence Number
27 * 20 bytes: Addressing fields
28 * 14 bytes: Auxiliary Security Header
29 */
30#define MAC802154_FRAME_HARD_HEADER_LEN (2 + 1 + 20 + 14)
31
24/* The following flags are used to indicate changed address settings from 32/* The following flags are used to indicate changed address settings from
25 * the stack to the hardware. 33 * the stack to the hardware.
26 */ 34 */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index c02b6ad3f6c5..96a3b5c03e37 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -47,6 +47,8 @@ enum {
47#include <linux/icmpv6.h> 47#include <linux/icmpv6.h>
48#include <linux/in6.h> 48#include <linux/in6.h>
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/if_arp.h>
51#include <linux/netdevice.h>
50 52
51#include <net/neighbour.h> 53#include <net/neighbour.h>
52 54
@@ -80,6 +82,54 @@ struct nd_opt_hdr {
80 __u8 nd_opt_len; 82 __u8 nd_opt_len;
81} __packed; 83} __packed;
82 84
85/* ND options */
86struct ndisc_options {
87 struct nd_opt_hdr *nd_opt_array[__ND_OPT_ARRAY_MAX];
88#ifdef CONFIG_IPV6_ROUTE_INFO
89 struct nd_opt_hdr *nd_opts_ri;
90 struct nd_opt_hdr *nd_opts_ri_end;
91#endif
92 struct nd_opt_hdr *nd_useropts;
93 struct nd_opt_hdr *nd_useropts_end;
94};
95
96#define nd_opts_src_lladdr nd_opt_array[ND_OPT_SOURCE_LL_ADDR]
97#define nd_opts_tgt_lladdr nd_opt_array[ND_OPT_TARGET_LL_ADDR]
98#define nd_opts_pi nd_opt_array[ND_OPT_PREFIX_INFO]
99#define nd_opts_pi_end nd_opt_array[__ND_OPT_PREFIX_INFO_END]
100#define nd_opts_rh nd_opt_array[ND_OPT_REDIRECT_HDR]
101#define nd_opts_mtu nd_opt_array[ND_OPT_MTU]
102
103#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7)
104
105extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
106 struct ndisc_options *ndopts);
107
108/*
109 * Return the padding between the option length and the start of the
110 * link addr. Currently only IP-over-InfiniBand needs this, although
111 * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may
112 * also need a pad of 2.
113 */
114static int ndisc_addr_option_pad(unsigned short type)
115{
116 switch (type) {
117 case ARPHRD_INFINIBAND: return 2;
118 default: return 0;
119 }
120}
121
122static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p,
123 struct net_device *dev)
124{
125 u8 *lladdr = (u8 *)(p + 1);
126 int lladdrlen = p->nd_opt_len << 3;
127 int prepad = ndisc_addr_option_pad(dev->type);
128 if (lladdrlen != NDISC_OPT_SPACE(dev->addr_len + prepad))
129 return NULL;
130 return lladdr + prepad;
131}
132
83static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd) 133static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd)
84{ 134{
85 const u32 *p32 = pkey; 135 const u32 *p32 = pkey;
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 6cdfeedb650b..344d8988842a 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -202,9 +202,16 @@ extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
202extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, 202extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl,
203 struct net *net, 203 struct net *net,
204 const void *pkey); 204 const void *pkey);
205extern struct neighbour * neigh_create(struct neigh_table *tbl, 205extern struct neighbour * __neigh_create(struct neigh_table *tbl,
206 const void *pkey,
207 struct net_device *dev,
208 bool want_ref);
209static inline struct neighbour *neigh_create(struct neigh_table *tbl,
206 const void *pkey, 210 const void *pkey,
207 struct net_device *dev); 211 struct net_device *dev)
212{
213 return __neigh_create(tbl, pkey, dev, true);
214}
208extern void neigh_destroy(struct neighbour *neigh); 215extern void neigh_destroy(struct neighbour *neigh);
209extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb); 216extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb);
210extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, 217extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
@@ -302,12 +309,6 @@ static inline struct neighbour * neigh_clone(struct neighbour *neigh)
302 309
303#define neigh_hold(n) atomic_inc(&(n)->refcnt) 310#define neigh_hold(n) atomic_inc(&(n)->refcnt)
304 311
305static inline void neigh_confirm(struct neighbour *neigh)
306{
307 if (neigh)
308 neigh->confirmed = jiffies;
309}
310
311static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) 312static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
312{ 313{
313 unsigned long now = jiffies; 314 unsigned long now = jiffies;
@@ -351,15 +352,6 @@ static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
351 return dev_queue_xmit(skb); 352 return dev_queue_xmit(skb);
352} 353}
353 354
354static inline int neigh_output(struct neighbour *n, struct sk_buff *skb)
355{
356 struct hh_cache *hh = &n->hh;
357 if ((n->nud_state & NUD_CONNECTED) && hh->hh_len)
358 return neigh_hh_output(hh, skb);
359 else
360 return n->output(n, skb);
361}
362
363static inline struct neighbour * 355static inline struct neighbour *
364__neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat) 356__neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat)
365{ 357{
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ac9195e6a062..ae1cd6c9ba52 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -101,6 +101,7 @@ struct net {
101 struct netns_xfrm xfrm; 101 struct netns_xfrm xfrm;
102#endif 102#endif
103 struct netns_ipvs *ipvs; 103 struct netns_ipvs *ipvs;
104 struct sock *diag_nlsk;
104}; 105};
105 106
106 107
diff --git a/include/net/netevent.h b/include/net/netevent.h
index 086f8a5b59dc..3ce4988c9c08 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -12,10 +12,14 @@
12 */ 12 */
13 13
14struct dst_entry; 14struct dst_entry;
15struct neighbour;
15 16
16struct netevent_redirect { 17struct netevent_redirect {
17 struct dst_entry *old; 18 struct dst_entry *old;
19 struct neighbour *old_neigh;
18 struct dst_entry *new; 20 struct dst_entry *new;
21 struct neighbour *new_neigh;
22 const void *daddr;
19}; 23};
20 24
21enum netevent_notif_type { 25enum netevent_notif_type {
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index cce7f6a798bf..f1494feba79f 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -39,36 +39,6 @@ union nf_conntrack_expect_proto {
39 /* insert expect proto private data here */ 39 /* insert expect proto private data here */
40}; 40};
41 41
42/* Add protocol helper include file here */
43#include <linux/netfilter/nf_conntrack_ftp.h>
44#include <linux/netfilter/nf_conntrack_pptp.h>
45#include <linux/netfilter/nf_conntrack_h323.h>
46#include <linux/netfilter/nf_conntrack_sane.h>
47#include <linux/netfilter/nf_conntrack_sip.h>
48
49/* per conntrack: application helper private data */
50union nf_conntrack_help {
51 /* insert conntrack helper private data (master) here */
52#if defined(CONFIG_NF_CONNTRACK_FTP) || defined(CONFIG_NF_CONNTRACK_FTP_MODULE)
53 struct nf_ct_ftp_master ct_ftp_info;
54#endif
55#if defined(CONFIG_NF_CONNTRACK_PPTP) || \
56 defined(CONFIG_NF_CONNTRACK_PPTP_MODULE)
57 struct nf_ct_pptp_master ct_pptp_info;
58#endif
59#if defined(CONFIG_NF_CONNTRACK_H323) || \
60 defined(CONFIG_NF_CONNTRACK_H323_MODULE)
61 struct nf_ct_h323_master ct_h323_info;
62#endif
63#if defined(CONFIG_NF_CONNTRACK_SANE) || \
64 defined(CONFIG_NF_CONNTRACK_SANE_MODULE)
65 struct nf_ct_sane_master ct_sane_info;
66#endif
67#if defined(CONFIG_NF_CONNTRACK_SIP) || defined(CONFIG_NF_CONNTRACK_SIP_MODULE)
68 struct nf_ct_sip_master ct_sip_info;
69#endif
70};
71
72#include <linux/types.h> 42#include <linux/types.h>
73#include <linux/skbuff.h> 43#include <linux/skbuff.h>
74#include <linux/timer.h> 44#include <linux/timer.h>
@@ -89,12 +59,13 @@ struct nf_conn_help {
89 /* Helper. if any */ 59 /* Helper. if any */
90 struct nf_conntrack_helper __rcu *helper; 60 struct nf_conntrack_helper __rcu *helper;
91 61
92 union nf_conntrack_help help;
93
94 struct hlist_head expectations; 62 struct hlist_head expectations;
95 63
96 /* Current number of expected connections */ 64 /* Current number of expected connections */
97 u8 expecting[NF_CT_MAX_EXPECT_CLASSES]; 65 u8 expecting[NF_CT_MAX_EXPECT_CLASSES];
66
67 /* private helper information. */
68 char data[];
98}; 69};
99 70
100#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 71#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index aced085132e7..d8f5b9f52169 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -28,8 +28,8 @@ extern unsigned int nf_conntrack_in(struct net *net,
28extern int nf_conntrack_init(struct net *net); 28extern int nf_conntrack_init(struct net *net);
29extern void nf_conntrack_cleanup(struct net *net); 29extern void nf_conntrack_cleanup(struct net *net);
30 30
31extern int nf_conntrack_proto_init(void); 31extern int nf_conntrack_proto_init(struct net *net);
32extern void nf_conntrack_proto_fini(void); 32extern void nf_conntrack_proto_fini(struct net *net);
33 33
34extern bool 34extern bool
35nf_ct_get_tuple(const struct sk_buff *skb, 35nf_ct_get_tuple(const struct sk_buff *skb,
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 4619caadd9d1..983f00263243 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -59,10 +59,12 @@ static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
59 return nf_ct_net(exp->master); 59 return nf_ct_net(exp->master);
60} 60}
61 61
62#define NF_CT_EXP_POLICY_NAME_LEN 16
63
62struct nf_conntrack_expect_policy { 64struct nf_conntrack_expect_policy {
63 unsigned int max_expected; 65 unsigned int max_expected;
64 unsigned int timeout; 66 unsigned int timeout;
65 const char *name; 67 char name[NF_CT_EXP_POLICY_NAME_LEN];
66}; 68};
67 69
68#define NF_CT_EXPECT_CLASS_DEFAULT 0 70#define NF_CT_EXPECT_CLASS_DEFAULT 0
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 96755c3798a5..8b4d1fc29096 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -80,10 +80,13 @@ static inline void nf_ct_ext_free(struct nf_conn *ct)
80} 80}
81 81
82/* Add this type, returns pointer to data or NULL. */ 82/* Add this type, returns pointer to data or NULL. */
83void * 83void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
84__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp); 84 size_t var_alloc_len, gfp_t gfp);
85
85#define nf_ct_ext_add(ct, id, gfp) \ 86#define nf_ct_ext_add(ct, id, gfp) \
86 ((id##_TYPE *)__nf_ct_ext_add((ct), (id), (gfp))) 87 ((id##_TYPE *)__nf_ct_ext_add_length((ct), (id), 0, (gfp)))
88#define nf_ct_ext_add_length(ct, id, len, gfp) \
89 ((id##_TYPE *)__nf_ct_ext_add_length((ct), (id), (len), (gfp)))
87 90
88#define NF_CT_EXT_F_PREALLOC 0x0001 91#define NF_CT_EXT_F_PREALLOC 0x0001
89 92
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 1d1889409b9e..9aad956d1008 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -11,18 +11,27 @@
11#define _NF_CONNTRACK_HELPER_H 11#define _NF_CONNTRACK_HELPER_H
12#include <net/netfilter/nf_conntrack.h> 12#include <net/netfilter/nf_conntrack.h>
13#include <net/netfilter/nf_conntrack_extend.h> 13#include <net/netfilter/nf_conntrack_extend.h>
14#include <net/netfilter/nf_conntrack_expect.h>
14 15
15struct module; 16struct module;
16 17
18enum nf_ct_helper_flags {
19 NF_CT_HELPER_F_USERSPACE = (1 << 0),
20 NF_CT_HELPER_F_CONFIGURED = (1 << 1),
21};
22
17#define NF_CT_HELPER_NAME_LEN 16 23#define NF_CT_HELPER_NAME_LEN 16
18 24
19struct nf_conntrack_helper { 25struct nf_conntrack_helper {
20 struct hlist_node hnode; /* Internal use. */ 26 struct hlist_node hnode; /* Internal use. */
21 27
22 const char *name; /* name of the module */ 28 char name[NF_CT_HELPER_NAME_LEN]; /* name of the module */
23 struct module *me; /* pointer to self */ 29 struct module *me; /* pointer to self */
24 const struct nf_conntrack_expect_policy *expect_policy; 30 const struct nf_conntrack_expect_policy *expect_policy;
25 31
32 /* length of internal data, ie. sizeof(struct nf_ct_*_master) */
33 size_t data_len;
34
26 /* Tuple of things we will help (compared against server response) */ 35 /* Tuple of things we will help (compared against server response) */
27 struct nf_conntrack_tuple tuple; 36 struct nf_conntrack_tuple tuple;
28 37
@@ -35,8 +44,12 @@ struct nf_conntrack_helper {
35 44
36 void (*destroy)(struct nf_conn *ct); 45 void (*destroy)(struct nf_conn *ct);
37 46
47 int (*from_nlattr)(struct nlattr *attr, struct nf_conn *ct);
38 int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct); 48 int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct);
39 unsigned int expect_class_max; 49 unsigned int expect_class_max;
50
51 unsigned int flags;
52 unsigned int queue_num; /* For user-space helpers. */
40}; 53};
41 54
42extern struct nf_conntrack_helper * 55extern struct nf_conntrack_helper *
@@ -48,7 +61,7 @@ nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum);
48extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 61extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
49extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 62extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
50 63
51extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 64extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, struct nf_conntrack_helper *helper, gfp_t gfp);
52 65
53extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, 66extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
54 gfp_t flags); 67 gfp_t flags);
@@ -60,6 +73,15 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
60 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 73 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
61} 74}
62 75
76static inline void *nfct_help_data(const struct nf_conn *ct)
77{
78 struct nf_conn_help *help;
79
80 help = nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
81
82 return (void *)help->data;
83}
84
63extern int nf_conntrack_helper_init(struct net *net); 85extern int nf_conntrack_helper_init(struct net *net);
64extern void nf_conntrack_helper_fini(struct net *net); 86extern void nf_conntrack_helper_fini(struct net *net);
65 87
@@ -82,4 +104,7 @@ nf_ct_helper_expectfn_find_by_name(const char *name);
82struct nf_ct_helper_expectfn * 104struct nf_ct_helper_expectfn *
83nf_ct_helper_expectfn_find_by_symbol(const void *symbol); 105nf_ct_helper_expectfn_find_by_symbol(const void *symbol);
84 106
107extern struct hlist_head *nf_ct_helper_hash;
108extern unsigned int nf_ct_helper_hsize;
109
85#endif /*_NF_CONNTRACK_HELPER_H*/ 110#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 9699c028b74b..6f7c13f4ac03 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -64,11 +64,12 @@ struct nf_conntrack_l3proto {
64 size_t nla_size; 64 size_t nla_size;
65 65
66#ifdef CONFIG_SYSCTL 66#ifdef CONFIG_SYSCTL
67 struct ctl_table_header *ctl_table_header;
68 const char *ctl_table_path; 67 const char *ctl_table_path;
69 struct ctl_table *ctl_table;
70#endif /* CONFIG_SYSCTL */ 68#endif /* CONFIG_SYSCTL */
71 69
70 /* Init l3proto pernet data */
71 int (*init_net)(struct net *net);
72
72 /* Module (if any) which this is connected to. */ 73 /* Module (if any) which this is connected to. */
73 struct module *me; 74 struct module *me;
74}; 75};
@@ -76,8 +77,10 @@ struct nf_conntrack_l3proto {
76extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
77 78
78/* Protocol registration. */ 79/* Protocol registration. */
79extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 80extern int nf_conntrack_l3proto_register(struct net *net,
80extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 81 struct nf_conntrack_l3proto *proto);
82extern void nf_conntrack_l3proto_unregister(struct net *net,
83 struct nf_conntrack_l3proto *proto);
81extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); 84extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
82extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 85extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
83 86
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 3b572bb20aa2..c3be4aef6bf7 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -12,6 +12,7 @@
12#include <linux/netlink.h> 12#include <linux/netlink.h>
13#include <net/netlink.h> 13#include <net/netlink.h>
14#include <net/netfilter/nf_conntrack.h> 14#include <net/netfilter/nf_conntrack.h>
15#include <net/netns/generic.h>
15 16
16struct seq_file; 17struct seq_file;
17 18
@@ -86,23 +87,21 @@ struct nf_conntrack_l4proto {
86#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT) 87#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
87 struct { 88 struct {
88 size_t obj_size; 89 size_t obj_size;
89 int (*nlattr_to_obj)(struct nlattr *tb[], void *data); 90 int (*nlattr_to_obj)(struct nlattr *tb[],
91 struct net *net, void *data);
90 int (*obj_to_nlattr)(struct sk_buff *skb, const void *data); 92 int (*obj_to_nlattr)(struct sk_buff *skb, const void *data);
91 93
92 unsigned int nlattr_max; 94 unsigned int nlattr_max;
93 const struct nla_policy *nla_policy; 95 const struct nla_policy *nla_policy;
94 } ctnl_timeout; 96 } ctnl_timeout;
95#endif 97#endif
98 int *net_id;
99 /* Init l4proto pernet data */
100 int (*init_net)(struct net *net, u_int16_t proto);
101
102 /* Return the per-net protocol part. */
103 struct nf_proto_net *(*get_net_proto)(struct net *net);
96 104
97#ifdef CONFIG_SYSCTL
98 struct ctl_table_header **ctl_table_header;
99 struct ctl_table *ctl_table;
100 unsigned int *ctl_table_users;
101#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
102 struct ctl_table_header *ctl_compat_table_header;
103 struct ctl_table *ctl_compat_table;
104#endif
105#endif
106 /* Protocol name */ 105 /* Protocol name */
107 const char *name; 106 const char *name;
108 107
@@ -123,8 +122,18 @@ nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto);
123extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); 122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
124 123
125/* Protocol registration. */ 124/* Protocol registration. */
126extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 125extern int nf_conntrack_l4proto_register(struct net *net,
127extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 126 struct nf_conntrack_l4proto *proto);
127extern void nf_conntrack_l4proto_unregister(struct net *net,
128 struct nf_conntrack_l4proto *proto);
129
130static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
131{
132#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
133 kfree(pn->ctl_compat_table);
134 pn->ctl_compat_table = NULL;
135#endif
136}
128 137
129/* Generic netlink helpers */ 138/* Generic netlink helpers */
130extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb, 139extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 02bb6c29dc3d..7d8fb7b46c44 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -54,4 +54,8 @@ extern void nf_nat_follow_master(struct nf_conn *ct,
54extern s16 nf_nat_get_offset(const struct nf_conn *ct, 54extern s16 nf_nat_get_offset(const struct nf_conn *ct,
55 enum ip_conntrack_dir dir, 55 enum ip_conntrack_dir dir,
56 u32 seq); 56 u32 seq);
57
58extern void nf_nat_tcp_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
59 u32 dir, int off);
60
57#endif 61#endif
diff --git a/include/net/netfilter/nfnetlink_queue.h b/include/net/netfilter/nfnetlink_queue.h
new file mode 100644
index 000000000000..86267a529514
--- /dev/null
+++ b/include/net/netfilter/nfnetlink_queue.h
@@ -0,0 +1,43 @@
1#ifndef _NET_NFNL_QUEUE_H_
2#define _NET_NFNL_QUEUE_H_
3
4#include <linux/netfilter/nf_conntrack_common.h>
5
6struct nf_conn;
7
8#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT
9struct nf_conn *nfqnl_ct_get(struct sk_buff *entskb, size_t *size,
10 enum ip_conntrack_info *ctinfo);
11struct nf_conn *nfqnl_ct_parse(const struct sk_buff *skb,
12 const struct nlattr *attr,
13 enum ip_conntrack_info *ctinfo);
14int nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct,
15 enum ip_conntrack_info ctinfo);
16void nfqnl_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
17 enum ip_conntrack_info ctinfo, int diff);
18#else
19inline struct nf_conn *
20nfqnl_ct_get(struct sk_buff *entskb, size_t *size, enum ip_conntrack_info *ctinfo)
21{
22 return NULL;
23}
24
25inline struct nf_conn *nfqnl_ct_parse(const struct sk_buff *skb,
26 const struct nlattr *attr,
27 enum ip_conntrack_info *ctinfo)
28{
29 return NULL;
30}
31
32inline int
33nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info ctinfo)
34{
35 return 0;
36}
37
38inline void nfqnl_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
39 enum ip_conntrack_info ctinfo, int diff)
40{
41}
42#endif /* NF_CONNTRACK */
43#endif
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index a053a19870cf..3aecdc7a84fb 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -4,10 +4,64 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/list_nulls.h> 5#include <linux/list_nulls.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/netfilter/nf_conntrack_tcp.h>
7 8
8struct ctl_table_header; 9struct ctl_table_header;
9struct nf_conntrack_ecache; 10struct nf_conntrack_ecache;
10 11
12struct nf_proto_net {
13#ifdef CONFIG_SYSCTL
14 struct ctl_table_header *ctl_table_header;
15 struct ctl_table *ctl_table;
16#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
17 struct ctl_table_header *ctl_compat_header;
18 struct ctl_table *ctl_compat_table;
19#endif
20#endif
21 unsigned int users;
22};
23
24struct nf_generic_net {
25 struct nf_proto_net pn;
26 unsigned int timeout;
27};
28
29struct nf_tcp_net {
30 struct nf_proto_net pn;
31 unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX];
32 unsigned int tcp_loose;
33 unsigned int tcp_be_liberal;
34 unsigned int tcp_max_retrans;
35};
36
37enum udp_conntrack {
38 UDP_CT_UNREPLIED,
39 UDP_CT_REPLIED,
40 UDP_CT_MAX
41};
42
43struct nf_udp_net {
44 struct nf_proto_net pn;
45 unsigned int timeouts[UDP_CT_MAX];
46};
47
48struct nf_icmp_net {
49 struct nf_proto_net pn;
50 unsigned int timeout;
51};
52
53struct nf_ip_net {
54 struct nf_generic_net generic;
55 struct nf_tcp_net tcp;
56 struct nf_udp_net udp;
57 struct nf_icmp_net icmp;
58 struct nf_icmp_net icmpv6;
59#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
60 struct ctl_table_header *ctl_table_header;
61 struct ctl_table *ctl_table;
62#endif
63};
64
11struct netns_ct { 65struct netns_ct {
12 atomic_t count; 66 atomic_t count;
13 unsigned int expect_count; 67 unsigned int expect_count;
@@ -28,6 +82,7 @@ struct netns_ct {
28 unsigned int sysctl_log_invalid; /* Log invalid packets */ 82 unsigned int sysctl_log_invalid; /* Log invalid packets */
29 int sysctl_auto_assign_helper; 83 int sysctl_auto_assign_helper;
30 bool auto_assign_helper_warned; 84 bool auto_assign_helper_warned;
85 struct nf_ip_net nf_ct_proto;
31#ifdef CONFIG_SYSCTL 86#ifdef CONFIG_SYSCTL
32 struct ctl_table_header *sysctl_header; 87 struct ctl_table_header *sysctl_header;
33 struct ctl_table_header *acct_sysctl_header; 88 struct ctl_table_header *acct_sysctl_header;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index bbd023a1c9b9..0ffb8e31f3cd 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -7,10 +7,12 @@
7 7
8#include <net/inet_frag.h> 8#include <net/inet_frag.h>
9 9
10struct tcpm_hash_bucket;
10struct ctl_table_header; 11struct ctl_table_header;
11struct ipv4_devconf; 12struct ipv4_devconf;
12struct fib_rules_ops; 13struct fib_rules_ops;
13struct hlist_head; 14struct hlist_head;
15struct fib_table;
14struct sock; 16struct sock;
15 17
16struct netns_ipv4 { 18struct netns_ipv4 {
@@ -24,13 +26,21 @@ struct netns_ipv4 {
24 struct ipv4_devconf *devconf_dflt; 26 struct ipv4_devconf *devconf_dflt;
25#ifdef CONFIG_IP_MULTIPLE_TABLES 27#ifdef CONFIG_IP_MULTIPLE_TABLES
26 struct fib_rules_ops *rules_ops; 28 struct fib_rules_ops *rules_ops;
29 bool fib_has_custom_rules;
30 struct fib_table *fib_local;
31 struct fib_table *fib_main;
32 struct fib_table *fib_default;
33#endif
34#ifdef CONFIG_IP_ROUTE_CLASSID
35 int fib_num_tclassid_users;
27#endif 36#endif
28 struct hlist_head *fib_table_hash; 37 struct hlist_head *fib_table_hash;
29 struct sock *fibnl; 38 struct sock *fibnl;
30 39
31 struct sock **icmp_sk; 40 struct sock **icmp_sk;
32 struct sock *tcp_sock; 41 struct inet_peer_base *peers;
33 42 struct tcpm_hash_bucket *tcp_metrics_hash;
43 unsigned int tcp_metrics_hash_log;
34 struct netns_frags frags; 44 struct netns_frags frags;
35#ifdef CONFIG_NETFILTER 45#ifdef CONFIG_NETFILTER
36 struct xt_table *iptable_filter; 46 struct xt_table *iptable_filter;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index b42be53587ba..df0a5456a3fd 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -33,6 +33,7 @@ struct netns_ipv6 {
33 struct netns_sysctl_ipv6 sysctl; 33 struct netns_sysctl_ipv6 sysctl;
34 struct ipv6_devconf *devconf_all; 34 struct ipv6_devconf *devconf_all;
35 struct ipv6_devconf *devconf_dflt; 35 struct ipv6_devconf *devconf_dflt;
36 struct inet_peer_base *peers;
36 struct netns_frags frags; 37 struct netns_frags frags;
37#ifdef CONFIG_NETFILTER 38#ifdef CONFIG_NETFILTER
38 struct xt_table *ip6table_filter; 39 struct xt_table *ip6table_filter;
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index d58fdec47597..2719dec6b5a8 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -35,7 +35,7 @@ struct cgroup_netprio_state {
35extern int net_prio_subsys_id; 35extern int net_prio_subsys_id;
36#endif 36#endif
37 37
38extern void sock_update_netprioidx(struct sock *sk); 38extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
39 39
40#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) 40#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
41 41
@@ -82,7 +82,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
82#endif /* CONFIG_NETPRIO_CGROUP */ 82#endif /* CONFIG_NETPRIO_CGROUP */
83 83
84#else 84#else
85#define sock_update_netprioidx(sk) 85#define sock_update_netprioidx(sk, task)
86#endif 86#endif
87 87
88#endif /* _NET_CLS_CGROUP_H */ 88#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 4467c9460857..f5169b04f082 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -31,7 +31,8 @@ struct nfc_hci_ops {
31 void (*close) (struct nfc_hci_dev *hdev); 31 void (*close) (struct nfc_hci_dev *hdev);
32 int (*hci_ready) (struct nfc_hci_dev *hdev); 32 int (*hci_ready) (struct nfc_hci_dev *hdev);
33 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); 33 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
34 int (*start_poll) (struct nfc_hci_dev *hdev, u32 protocols); 34 int (*start_poll) (struct nfc_hci_dev *hdev,
35 u32 im_protocols, u32 tm_protocols);
35 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate, 36 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
36 struct nfc_target *target); 37 struct nfc_target *target);
37 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, 38 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
@@ -43,10 +44,20 @@ struct nfc_hci_ops {
43 struct nfc_target *target); 44 struct nfc_target *target);
44}; 45};
45 46
46#define NFC_HCI_MAX_CUSTOM_GATES 15 47/* Pipes */
48#define NFC_HCI_INVALID_PIPE 0x80
49#define NFC_HCI_LINK_MGMT_PIPE 0x00
50#define NFC_HCI_ADMIN_PIPE 0x01
51
52struct nfc_hci_gate {
53 u8 gate;
54 u8 pipe;
55};
56
57#define NFC_HCI_MAX_CUSTOM_GATES 50
47struct nfc_hci_init_data { 58struct nfc_hci_init_data {
48 u8 gate_count; 59 u8 gate_count;
49 u8 gates[NFC_HCI_MAX_CUSTOM_GATES]; 60 struct nfc_hci_gate gates[NFC_HCI_MAX_CUSTOM_GATES];
50 char session_id[9]; 61 char session_id[9];
51}; 62};
52 63
@@ -111,6 +122,8 @@ void nfc_hci_unregister_device(struct nfc_hci_dev *hdev);
111void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata); 122void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
112void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev); 123void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
113 124
125void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err);
126
114/* Host IDs */ 127/* Host IDs */
115#define NFC_HCI_HOST_CONTROLLER_ID 0x00 128#define NFC_HCI_HOST_CONTROLLER_ID 0x00
116#define NFC_HCI_TERMINAL_HOST_ID 0x01 129#define NFC_HCI_TERMINAL_HOST_ID 0x01
@@ -179,7 +192,8 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
179void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb); 192void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb);
180 193
181/* connecting to gates and sending hci instructions */ 194/* connecting to gates and sending hci instructions */
182int nfc_hci_connect_gate(struct nfc_hci_dev *hdev, u8 dest_host, u8 dest_gate); 195int nfc_hci_connect_gate(struct nfc_hci_dev *hdev, u8 dest_host, u8 dest_gate,
196 u8 pipe);
183int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate); 197int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate);
184int nfc_hci_disconnect_all_gates(struct nfc_hci_dev *hdev); 198int nfc_hci_disconnect_all_gates(struct nfc_hci_dev *hdev);
185int nfc_hci_get_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx, 199int nfc_hci_get_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index b7ca4a2a1d72..6431f5e39022 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -53,7 +53,8 @@ struct nfc_target;
53struct nfc_ops { 53struct nfc_ops {
54 int (*dev_up)(struct nfc_dev *dev); 54 int (*dev_up)(struct nfc_dev *dev);
55 int (*dev_down)(struct nfc_dev *dev); 55 int (*dev_down)(struct nfc_dev *dev);
56 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 56 int (*start_poll)(struct nfc_dev *dev,
57 u32 im_protocols, u32 tm_protocols);
57 void (*stop_poll)(struct nfc_dev *dev); 58 void (*stop_poll)(struct nfc_dev *dev);
58 int (*dep_link_up)(struct nfc_dev *dev, struct nfc_target *target, 59 int (*dep_link_up)(struct nfc_dev *dev, struct nfc_target *target,
59 u8 comm_mode, u8 *gb, size_t gb_len); 60 u8 comm_mode, u8 *gb, size_t gb_len);
@@ -62,9 +63,10 @@ struct nfc_ops {
62 u32 protocol); 63 u32 protocol);
63 void (*deactivate_target)(struct nfc_dev *dev, 64 void (*deactivate_target)(struct nfc_dev *dev,
64 struct nfc_target *target); 65 struct nfc_target *target);
65 int (*data_exchange)(struct nfc_dev *dev, struct nfc_target *target, 66 int (*im_transceive)(struct nfc_dev *dev, struct nfc_target *target,
66 struct sk_buff *skb, data_exchange_cb_t cb, 67 struct sk_buff *skb, data_exchange_cb_t cb,
67 void *cb_context); 68 void *cb_context);
69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
68 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); 70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
69}; 71};
70 72
@@ -99,10 +101,10 @@ struct nfc_dev {
99 int targets_generation; 101 int targets_generation;
100 struct device dev; 102 struct device dev;
101 bool dev_up; 103 bool dev_up;
104 u8 rf_mode;
102 bool polling; 105 bool polling;
103 struct nfc_target *active_target; 106 struct nfc_target *active_target;
104 bool dep_link_up; 107 bool dep_link_up;
105 u32 dep_rf_mode;
106 struct nfc_genl_data genl_data; 108 struct nfc_genl_data genl_data;
107 u32 supported_protocols; 109 u32 supported_protocols;
108 110
@@ -188,6 +190,7 @@ struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp);
188 190
189int nfc_set_remote_general_bytes(struct nfc_dev *dev, 191int nfc_set_remote_general_bytes(struct nfc_dev *dev,
190 u8 *gt, u8 gt_len); 192 u8 *gt, u8 gt_len);
193u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, size_t *gb_len);
191 194
192int nfc_targets_found(struct nfc_dev *dev, 195int nfc_targets_found(struct nfc_dev *dev,
193 struct nfc_target *targets, int ntargets); 196 struct nfc_target *targets, int ntargets);
@@ -196,4 +199,11 @@ int nfc_target_lost(struct nfc_dev *dev, u32 target_idx);
196int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, 199int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
197 u8 comm_mode, u8 rf_mode); 200 u8 comm_mode, u8 rf_mode);
198 201
202int nfc_tm_activated(struct nfc_dev *dev, u32 protocol, u8 comm_mode,
203 u8 *gb, size_t gb_len);
204int nfc_tm_deactivated(struct nfc_dev *dev);
205int nfc_tm_data_received(struct nfc_dev *dev, struct sk_buff *skb);
206
207void nfc_driver_failure(struct nfc_dev *dev, int err);
208
199#endif /* __NET_NFC_H */ 209#endif /* __NET_NFC_H */
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h
index ab06afd462da..35e930d2f638 100644
--- a/include/net/nfc/shdlc.h
+++ b/include/net/nfc/shdlc.h
@@ -27,7 +27,8 @@ struct nfc_shdlc_ops {
27 void (*close) (struct nfc_shdlc *shdlc); 27 void (*close) (struct nfc_shdlc *shdlc);
28 int (*hci_ready) (struct nfc_shdlc *shdlc); 28 int (*hci_ready) (struct nfc_shdlc *shdlc);
29 int (*xmit) (struct nfc_shdlc *shdlc, struct sk_buff *skb); 29 int (*xmit) (struct nfc_shdlc *shdlc, struct sk_buff *skb);
30 int (*start_poll) (struct nfc_shdlc *shdlc, u32 protocols); 30 int (*start_poll) (struct nfc_shdlc *shdlc,
31 u32 im_protocols, u32 tm_protocols);
31 int (*target_from_gate) (struct nfc_shdlc *shdlc, u8 gate, 32 int (*target_from_gate) (struct nfc_shdlc *shdlc, u8 gate,
32 struct nfc_target *target); 33 struct nfc_target *target);
33 int (*complete_target_discovered) (struct nfc_shdlc *shdlc, u8 gate, 34 int (*complete_target_discovered) (struct nfc_shdlc *shdlc, u8 gate,
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 875f4895b033..057f2d315567 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -29,11 +29,15 @@
29#include <linux/ipv6.h> 29#include <linux/ipv6.h>
30#endif 30#endif
31 31
32#define MAX_INET_PROTOS 256 /* Must be a power of 2 */ 32/* This is one larger than the largest protocol value that can be
33 33 * found in an ipv4 or ipv6 header. Since in both cases the protocol
34 * value is presented in a __u8, this is defined to be 256.
35 */
36#define MAX_INET_PROTOS 256
34 37
35/* This is used to register protocols. */ 38/* This is used to register protocols. */
36struct net_protocol { 39struct net_protocol {
40 void (*early_demux)(struct sk_buff *skb);
37 int (*handler)(struct sk_buff *skb); 41 int (*handler)(struct sk_buff *skb);
38 void (*err_handler)(struct sk_buff *skb, u32 info); 42 void (*err_handler)(struct sk_buff *skb, u32 info);
39 int (*gso_send_check)(struct sk_buff *skb); 43 int (*gso_send_check)(struct sk_buff *skb);
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index a5f79933e211..7dcaa2794fde 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -52,6 +52,10 @@ enum environment_cap {
52 * DFS master operation on a known DFS region (NL80211_DFS_*), 52 * DFS master operation on a known DFS region (NL80211_DFS_*),
53 * dfs_region represents that region. Drivers can use this and the 53 * dfs_region represents that region. Drivers can use this and the
54 * @alpha2 to adjust their device's DFS parameters as required. 54 * @alpha2 to adjust their device's DFS parameters as required.
55 * @user_reg_hint_type: if the @initiator was of type
56 * %NL80211_REGDOM_SET_BY_USER, this classifies the type
57 * of hint passed. This could be any of the %NL80211_USER_REG_HINT_*
58 * types.
55 * @intersect: indicates whether the wireless core should intersect 59 * @intersect: indicates whether the wireless core should intersect
56 * the requested regulatory domain with the presently set regulatory 60 * the requested regulatory domain with the presently set regulatory
57 * domain. 61 * domain.
@@ -70,6 +74,7 @@ enum environment_cap {
70struct regulatory_request { 74struct regulatory_request {
71 int wiphy_idx; 75 int wiphy_idx;
72 enum nl80211_reg_initiator initiator; 76 enum nl80211_reg_initiator initiator;
77 enum nl80211_user_reg_hint_type user_reg_hint_type;
73 char alpha2[2]; 78 char alpha2[2];
74 u8 dfs_region; 79 u8 dfs_region;
75 bool intersect; 80 bool intersect;
diff --git a/include/net/route.h b/include/net/route.h
index 98705468ac03..c29ef2733f2d 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -40,45 +40,39 @@
40#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) 40#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE))
41 41
42struct fib_nh; 42struct fib_nh;
43struct inet_peer;
44struct fib_info; 43struct fib_info;
45struct rtable { 44struct rtable {
46 struct dst_entry dst; 45 struct dst_entry dst;
47 46
48 /* Lookup key. */
49 __be32 rt_key_dst;
50 __be32 rt_key_src;
51
52 int rt_genid; 47 int rt_genid;
53 unsigned int rt_flags; 48 unsigned int rt_flags;
54 __u16 rt_type; 49 __u16 rt_type;
55 __u8 rt_key_tos; 50 __u16 rt_is_input;
56 51
57 __be32 rt_dst; /* Path destination */
58 __be32 rt_src; /* Path source */
59 int rt_route_iif;
60 int rt_iif; 52 int rt_iif;
61 int rt_oif;
62 __u32 rt_mark;
63 53
64 /* Info on neighbour */ 54 /* Info on neighbour */
65 __be32 rt_gateway; 55 __be32 rt_gateway;
66 56
67 /* Miscellaneous cached information */ 57 /* Miscellaneous cached information */
68 __be32 rt_spec_dst; /* RFC1122 specific destination */ 58 u32 rt_pmtu;
69 u32 rt_peer_genid;
70 struct inet_peer *peer; /* long-living peer info */
71 struct fib_info *fi; /* for client ref to shared metrics */
72}; 59};
73 60
74static inline bool rt_is_input_route(const struct rtable *rt) 61static inline bool rt_is_input_route(const struct rtable *rt)
75{ 62{
76 return rt->rt_route_iif != 0; 63 return rt->rt_is_input != 0;
77} 64}
78 65
79static inline bool rt_is_output_route(const struct rtable *rt) 66static inline bool rt_is_output_route(const struct rtable *rt)
80{ 67{
81 return rt->rt_route_iif == 0; 68 return rt->rt_is_input == 0;
69}
70
71static inline __be32 rt_nexthop(const struct rtable *rt, __be32 daddr)
72{
73 if (rt->rt_gateway)
74 return rt->rt_gateway;
75 return daddr;
82} 76}
83 77
84struct ip_rt_acct { 78struct ip_rt_acct {
@@ -111,10 +105,7 @@ extern struct ip_rt_acct __percpu *ip_rt_acct;
111 105
112struct in_device; 106struct in_device;
113extern int ip_rt_init(void); 107extern int ip_rt_init(void);
114extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
115 __be32 src, struct net_device *dev);
116extern void rt_cache_flush(struct net *net, int how); 108extern void rt_cache_flush(struct net *net, int how);
117extern void rt_cache_flush_batch(struct net *net);
118extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); 109extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
119extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, 110extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
120 struct sock *sk); 111 struct sock *sk);
@@ -166,24 +157,16 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
166 return ip_route_output_key(net, fl4); 157 return ip_route_output_key(net, fl4);
167} 158}
168 159
169extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, 160extern int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
170 u8 tos, struct net_device *devin, bool noref); 161 u8 tos, struct net_device *devin);
171
172static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
173 u8 tos, struct net_device *devin)
174{
175 return ip_route_input_common(skb, dst, src, tos, devin, false);
176}
177
178static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
179 u8 tos, struct net_device *devin)
180{
181 return ip_route_input_common(skb, dst, src, tos, devin, true);
182}
183 162
184extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, 163extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
185 unsigned short new_mtu, struct net_device *dev); 164 int oif, u32 mark, u8 protocol, int flow_flags);
186extern void ip_rt_send_redirect(struct sk_buff *skb); 165extern void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu);
166extern void ipv4_redirect(struct sk_buff *skb, struct net *net,
167 int oif, u32 mark, u8 protocol, int flow_flags);
168extern void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk);
169extern void ip_rt_send_redirect(struct sk_buff *skb);
187 170
188extern unsigned int inet_addr_type(struct net *net, __be32 addr); 171extern unsigned int inet_addr_type(struct net *net, __be32 addr);
189extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); 172extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
@@ -244,8 +227,6 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32
244 227
245 if (inet_sk(sk)->transparent) 228 if (inet_sk(sk)->transparent)
246 flow_flags |= FLOWI_FLAG_ANYSRC; 229 flow_flags |= FLOWI_FLAG_ANYSRC;
247 if (protocol == IPPROTO_TCP)
248 flow_flags |= FLOWI_FLAG_PRECOW_METRICS;
249 if (can_sleep) 230 if (can_sleep)
250 flow_flags |= FLOWI_FLAG_CAN_SLEEP; 231 flow_flags |= FLOWI_FLAG_CAN_SLEEP;
251 232
@@ -294,20 +275,13 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable
294 return rt; 275 return rt;
295} 276}
296 277
297extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create);
298
299static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr)
300{
301 if (rt->peer)
302 return rt->peer;
303
304 rt_bind_peer(rt, daddr, 0);
305 return rt->peer;
306}
307
308static inline int inet_iif(const struct sk_buff *skb) 278static inline int inet_iif(const struct sk_buff *skb)
309{ 279{
310 return skb_rtable(skb)->rt_iif; 280 int iif = skb_rtable(skb)->rt_iif;
281
282 if (iif)
283 return iif;
284 return skb->skb_iif;
311} 285}
312 286
313extern int sysctl_ip_default_ttl; 287extern int sysctl_ip_default_ttl;
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index bbcfd0993432..6b00c4fc4291 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -44,8 +44,10 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
44 * @get_xstats_size: Function to calculate required room for dumping device 44 * @get_xstats_size: Function to calculate required room for dumping device
45 * specific statistics 45 * specific statistics
46 * @fill_xstats: Function to dump device specific statistics 46 * @fill_xstats: Function to dump device specific statistics
47 * @get_tx_queues: Function to determine number of transmit queues to create when 47 * @get_num_tx_queues: Function to determine number of transmit queues
48 * creating a new device. 48 * to create when creating a new device.
49 * @get_num_rx_queues: Function to determine number of receive queues
50 * to create when creating a new device.
49 */ 51 */
50struct rtnl_link_ops { 52struct rtnl_link_ops {
51 struct list_head list; 53 struct list_head list;
@@ -77,8 +79,8 @@ struct rtnl_link_ops {
77 size_t (*get_xstats_size)(const struct net_device *dev); 79 size_t (*get_xstats_size)(const struct net_device *dev);
78 int (*fill_xstats)(struct sk_buff *skb, 80 int (*fill_xstats)(struct sk_buff *skb,
79 const struct net_device *dev); 81 const struct net_device *dev);
80 int (*get_tx_queues)(struct net *net, 82 unsigned int (*get_num_tx_queues)(void);
81 struct nlattr *tb[]); 83 unsigned int (*get_num_rx_queues)(void);
82}; 84};
83 85
84extern int __rtnl_link_register(struct rtnl_link_ops *ops); 86extern int __rtnl_link_register(struct rtnl_link_ops *ops);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 9d7d54a00e63..d9611e032418 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -220,7 +220,7 @@ struct tcf_proto {
220 220
221struct qdisc_skb_cb { 221struct qdisc_skb_cb {
222 unsigned int pkt_len; 222 unsigned int pkt_len;
223 u16 bond_queue_mapping; 223 u16 slave_dev_queue_mapping;
224 u16 _pad; 224 u16 _pad;
225 unsigned char data[20]; 225 unsigned char data[20];
226}; 226};
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 942b864f6135..d053d2e99876 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -334,6 +334,7 @@ typedef enum {
334typedef enum { 334typedef enum {
335 SCTP_TRANSPORT_UP, 335 SCTP_TRANSPORT_UP,
336 SCTP_TRANSPORT_DOWN, 336 SCTP_TRANSPORT_DOWN,
337 SCTP_TRANSPORT_PF,
337} sctp_transport_cmd_t; 338} sctp_transport_cmd_t;
338 339
339/* These are the address scopes defined mainly for IPv4 addresses 340/* These are the address scopes defined mainly for IPv4 addresses
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a2ef81466b00..ff499640528b 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -162,6 +162,8 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *,
162void sctp_err_finish(struct sock *, struct sctp_association *); 162void sctp_err_finish(struct sock *, struct sctp_association *);
163void sctp_icmp_frag_needed(struct sock *, struct sctp_association *, 163void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
164 struct sctp_transport *t, __u32 pmtu); 164 struct sctp_transport *t, __u32 pmtu);
165void sctp_icmp_redirect(struct sock *, struct sctp_transport *,
166 struct sk_buff *);
165void sctp_icmp_proto_unreachable(struct sock *sk, 167void sctp_icmp_proto_unreachable(struct sock *sk,
166 struct sctp_association *asoc, 168 struct sctp_association *asoc,
167 struct sctp_transport *t); 169 struct sctp_transport *t);
@@ -517,10 +519,10 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
517 return frag; 519 return frag;
518} 520}
519 521
520static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc) 522static inline void sctp_assoc_pending_pmtu(struct sock *sk, struct sctp_association *asoc)
521{ 523{
522 524
523 sctp_assoc_sync_pmtu(asoc); 525 sctp_assoc_sync_pmtu(sk, asoc);
524 asoc->pmtu_pending = 0; 526 asoc->pmtu_pending = 0;
525} 527}
526 528
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index fecdf31816f2..fc5e60016e37 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -161,6 +161,12 @@ extern struct sctp_globals {
161 int max_retrans_path; 161 int max_retrans_path;
162 int max_retrans_init; 162 int max_retrans_init;
163 163
164 /* Potentially-Failed.Max.Retrans sysctl value
165 * taken from:
166 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
167 */
168 int pf_retrans;
169
164 /* 170 /*
165 * Policy for preforming sctp/socket accounting 171 * Policy for preforming sctp/socket accounting
166 * 0 - do socket level accounting, all assocs share sk_sndbuf 172 * 0 - do socket level accounting, all assocs share sk_sndbuf
@@ -258,6 +264,7 @@ extern struct sctp_globals {
258#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy) 264#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy)
259#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy) 265#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy)
260#define sctp_max_retrans_path (sctp_globals.max_retrans_path) 266#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
267#define sctp_pf_retrans (sctp_globals.pf_retrans)
261#define sctp_max_retrans_init (sctp_globals.max_retrans_init) 268#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
262#define sctp_sack_timeout (sctp_globals.sack_timeout) 269#define sctp_sack_timeout (sctp_globals.sack_timeout)
263#define sctp_hb_interval (sctp_globals.hb_interval) 270#define sctp_hb_interval (sctp_globals.hb_interval)
@@ -990,10 +997,15 @@ struct sctp_transport {
990 997
991 /* This is the max_retrans value for the transport and will 998 /* This is the max_retrans value for the transport and will
992 * be initialized from the assocs value. This can be changed 999 * be initialized from the assocs value. This can be changed
993 * using SCTP_SET_PEER_ADDR_PARAMS socket option. 1000 * using the SCTP_SET_PEER_ADDR_PARAMS socket option.
994 */ 1001 */
995 __u16 pathmaxrxt; 1002 __u16 pathmaxrxt;
996 1003
1004 /* This is the partially failed retrans value for the transport
1005 * and will be initialized from the assocs value. This can be changed
1006 * using the SCTP_PEER_ADDR_THLDS socket option
1007 */
1008 int pf_retrans;
997 /* PMTU : The current known path MTU. */ 1009 /* PMTU : The current known path MTU. */
998 __u32 pathmtu; 1010 __u32 pathmtu;
999 1011
@@ -1091,7 +1103,7 @@ void sctp_transport_burst_limited(struct sctp_transport *);
1091void sctp_transport_burst_reset(struct sctp_transport *); 1103void sctp_transport_burst_reset(struct sctp_transport *);
1092unsigned long sctp_transport_timeout(struct sctp_transport *); 1104unsigned long sctp_transport_timeout(struct sctp_transport *);
1093void sctp_transport_reset(struct sctp_transport *); 1105void sctp_transport_reset(struct sctp_transport *);
1094void sctp_transport_update_pmtu(struct sctp_transport *, u32); 1106void sctp_transport_update_pmtu(struct sock *, struct sctp_transport *, u32);
1095void sctp_transport_immediate_rtx(struct sctp_transport *); 1107void sctp_transport_immediate_rtx(struct sctp_transport *);
1096 1108
1097 1109
@@ -1664,6 +1676,12 @@ struct sctp_association {
1664 */ 1676 */
1665 int max_retrans; 1677 int max_retrans;
1666 1678
1679 /* This is the partially failed retrans value for the transport
1680 * and will be initialized from the assocs value. This can be
1681 * changed using the SCTP_PEER_ADDR_THLDS socket option
1682 */
1683 int pf_retrans;
1684
1667 /* Maximum number of times the endpoint will retransmit INIT */ 1685 /* Maximum number of times the endpoint will retransmit INIT */
1668 __u16 max_init_attempts; 1686 __u16 max_init_attempts;
1669 1687
@@ -2003,7 +2021,7 @@ void sctp_assoc_update(struct sctp_association *old,
2003 2021
2004__u32 sctp_association_get_next_tsn(struct sctp_association *); 2022__u32 sctp_association_get_next_tsn(struct sctp_association *);
2005 2023
2006void sctp_assoc_sync_pmtu(struct sctp_association *); 2024void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);
2007void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); 2025void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
2008void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); 2026void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
2009void sctp_assoc_set_primary(struct sctp_association *, 2027void sctp_assoc_set_primary(struct sctp_association *,
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 0842ef00b2fe..1b02d7ad453b 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -93,6 +93,7 @@ typedef __s32 sctp_assoc_t;
93#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ 93#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
94#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ 94#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */
95#define SCTP_AUTO_ASCONF 30 95#define SCTP_AUTO_ASCONF 30
96#define SCTP_PEER_ADDR_THLDS 31
96 97
97/* Internal Socket Options. Some of the sctp library functions are 98/* Internal Socket Options. Some of the sctp library functions are
98 * implemented using these socket options. 99 * implemented using these socket options.
@@ -649,6 +650,7 @@ struct sctp_paddrinfo {
649 */ 650 */
650enum sctp_spinfo_state { 651enum sctp_spinfo_state {
651 SCTP_INACTIVE, 652 SCTP_INACTIVE,
653 SCTP_PF,
652 SCTP_ACTIVE, 654 SCTP_ACTIVE,
653 SCTP_UNCONFIRMED, 655 SCTP_UNCONFIRMED,
654 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ 656 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
@@ -741,4 +743,13 @@ typedef struct {
741 int sd; 743 int sd;
742} sctp_peeloff_arg_t; 744} sctp_peeloff_arg_t;
743 745
746/*
747 * Peer Address Thresholds socket option
748 */
749struct sctp_paddrthlds {
750 sctp_assoc_t spt_assoc_id;
751 struct sockaddr_storage spt_address;
752 __u16 spt_pathmaxrxt;
753 __u16 spt_pathpfthld;
754};
744#endif /* __net_sctp_user_h__ */ 755#endif /* __net_sctp_user_h__ */
diff --git a/include/net/sock.h b/include/net/sock.h
index 4a4521699563..e067f8c18f88 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -198,6 +198,7 @@ struct cg_proto;
198 * @sk_lock: synchronizer 198 * @sk_lock: synchronizer
199 * @sk_rcvbuf: size of receive buffer in bytes 199 * @sk_rcvbuf: size of receive buffer in bytes
200 * @sk_wq: sock wait queue and async head 200 * @sk_wq: sock wait queue and async head
201 * @sk_rx_dst: receive input route used by early tcp demux
201 * @sk_dst_cache: destination cache 202 * @sk_dst_cache: destination cache
202 * @sk_dst_lock: destination cache lock 203 * @sk_dst_lock: destination cache lock
203 * @sk_policy: flow policy 204 * @sk_policy: flow policy
@@ -317,6 +318,7 @@ struct sock {
317 struct xfrm_policy *sk_policy[2]; 318 struct xfrm_policy *sk_policy[2];
318#endif 319#endif
319 unsigned long sk_flags; 320 unsigned long sk_flags;
321 struct dst_entry *sk_rx_dst;
320 struct dst_entry *sk_dst_cache; 322 struct dst_entry *sk_dst_cache;
321 spinlock_t sk_dst_lock; 323 spinlock_t sk_dst_lock;
322 atomic_t sk_wmem_alloc; 324 atomic_t sk_wmem_alloc;
@@ -856,6 +858,9 @@ struct proto {
856 int (*backlog_rcv) (struct sock *sk, 858 int (*backlog_rcv) (struct sock *sk,
857 struct sk_buff *skb); 859 struct sk_buff *skb);
858 860
861 void (*release_cb)(struct sock *sk);
862 void (*mtu_reduced)(struct sock *sk);
863
859 /* Keeping track of sk's, looking them up, and port selection methods. */ 864 /* Keeping track of sk's, looking them up, and port selection methods. */
860 void (*hash)(struct sock *sk); 865 void (*hash)(struct sock *sk);
861 void (*unhash)(struct sock *sk); 866 void (*unhash)(struct sock *sk);
@@ -1426,6 +1431,7 @@ extern struct sk_buff *sock_rmalloc(struct sock *sk,
1426 gfp_t priority); 1431 gfp_t priority);
1427extern void sock_wfree(struct sk_buff *skb); 1432extern void sock_wfree(struct sk_buff *skb);
1428extern void sock_rfree(struct sk_buff *skb); 1433extern void sock_rfree(struct sk_buff *skb);
1434extern void sock_edemux(struct sk_buff *skb);
1429 1435
1430extern int sock_setsockopt(struct socket *sock, int level, 1436extern int sock_setsockopt(struct socket *sock, int level,
1431 int op, char __user *optval, 1437 int op, char __user *optval,
@@ -2152,7 +2158,7 @@ static inline void sk_change_net(struct sock *sk, struct net *net)
2152 2158
2153static inline struct sock *skb_steal_sock(struct sk_buff *skb) 2159static inline struct sock *skb_steal_sock(struct sk_buff *skb)
2154{ 2160{
2155 if (unlikely(skb->sk)) { 2161 if (skb->sk) {
2156 struct sock *sk = skb->sk; 2162 struct sock *sk = skb->sk;
2157 2163
2158 skb->destructor = NULL; 2164 skb->destructor = NULL;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e79aa48d9fc1..e19124b84cd2 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -170,6 +170,11 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
170#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 170#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
171#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 171#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
172#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */ 172#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */
173#define TCPOPT_EXP 254 /* Experimental */
174/* Magic number to be after the option value for sharing TCP
175 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt
176 */
177#define TCPOPT_FASTOPEN_MAGIC 0xF989
173 178
174/* 179/*
175 * TCP option lengths 180 * TCP option lengths
@@ -180,6 +185,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
180#define TCPOLEN_SACK_PERM 2 185#define TCPOLEN_SACK_PERM 2
181#define TCPOLEN_TIMESTAMP 10 186#define TCPOLEN_TIMESTAMP 10
182#define TCPOLEN_MD5SIG 18 187#define TCPOLEN_MD5SIG 18
188#define TCPOLEN_EXP_FASTOPEN_BASE 4
183#define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */ 189#define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */
184#define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */ 190#define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */
185#define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN) 191#define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN)
@@ -206,6 +212,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
206/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */ 212/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */
207#define TCP_INIT_CWND 10 213#define TCP_INIT_CWND 10
208 214
215/* Bit Flags for sysctl_tcp_fastopen */
216#define TFO_CLIENT_ENABLE 1
217#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
218
209extern struct inet_timewait_death_row tcp_death_row; 219extern struct inet_timewait_death_row tcp_death_row;
210 220
211/* sysctl variables for tcp */ 221/* sysctl variables for tcp */
@@ -222,6 +232,7 @@ extern int sysctl_tcp_retries1;
222extern int sysctl_tcp_retries2; 232extern int sysctl_tcp_retries2;
223extern int sysctl_tcp_orphan_retries; 233extern int sysctl_tcp_orphan_retries;
224extern int sysctl_tcp_syncookies; 234extern int sysctl_tcp_syncookies;
235extern int sysctl_tcp_fastopen;
225extern int sysctl_tcp_retrans_collapse; 236extern int sysctl_tcp_retrans_collapse;
226extern int sysctl_tcp_stdurg; 237extern int sysctl_tcp_stdurg;
227extern int sysctl_tcp_rfc1337; 238extern int sysctl_tcp_rfc1337;
@@ -253,6 +264,8 @@ extern int sysctl_tcp_cookie_size;
253extern int sysctl_tcp_thin_linear_timeouts; 264extern int sysctl_tcp_thin_linear_timeouts;
254extern int sysctl_tcp_thin_dupack; 265extern int sysctl_tcp_thin_dupack;
255extern int sysctl_tcp_early_retrans; 266extern int sysctl_tcp_early_retrans;
267extern int sysctl_tcp_limit_output_bytes;
268extern int sysctl_tcp_challenge_ack_limit;
256 269
257extern atomic_long_t tcp_memory_allocated; 270extern atomic_long_t tcp_memory_allocated;
258extern struct percpu_counter tcp_sockets_allocated; 271extern struct percpu_counter tcp_sockets_allocated;
@@ -321,19 +334,24 @@ extern struct proto tcp_prot;
321 334
322extern void tcp_init_mem(struct net *net); 335extern void tcp_init_mem(struct net *net);
323 336
337extern void tcp_tasklet_init(void);
338
324extern void tcp_v4_err(struct sk_buff *skb, u32); 339extern void tcp_v4_err(struct sk_buff *skb, u32);
325 340
326extern void tcp_shutdown (struct sock *sk, int how); 341extern void tcp_shutdown (struct sock *sk, int how);
327 342
343extern void tcp_v4_early_demux(struct sk_buff *skb);
328extern int tcp_v4_rcv(struct sk_buff *skb); 344extern int tcp_v4_rcv(struct sk_buff *skb);
329 345
330extern struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it); 346extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
331extern void *tcp_v4_tw_get_peer(struct sock *sk);
332extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 347extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
333extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 348extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
334 size_t size); 349 size_t size);
335extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 350extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
336 size_t size, int flags); 351 size_t size, int flags);
352extern void tcp_release_cb(struct sock *sk);
353extern void tcp_write_timer_handler(struct sock *sk);
354extern void tcp_delack_timer_handler(struct sock *sk);
337extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 355extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
338extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 356extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
339 const struct tcphdr *th, unsigned int len); 357 const struct tcphdr *th, unsigned int len);
@@ -388,6 +406,19 @@ extern void tcp_enter_frto(struct sock *sk);
388extern void tcp_enter_loss(struct sock *sk, int how); 406extern void tcp_enter_loss(struct sock *sk, int how);
389extern void tcp_clear_retrans(struct tcp_sock *tp); 407extern void tcp_clear_retrans(struct tcp_sock *tp);
390extern void tcp_update_metrics(struct sock *sk); 408extern void tcp_update_metrics(struct sock *sk);
409extern void tcp_init_metrics(struct sock *sk);
410extern void tcp_metrics_init(void);
411extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check);
412extern bool tcp_remember_stamp(struct sock *sk);
413extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
414extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
415 struct tcp_fastopen_cookie *cookie,
416 int *syn_loss, unsigned long *last_syn_loss);
417extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
418 struct tcp_fastopen_cookie *cookie,
419 bool syn_lost);
420extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
421extern void tcp_disable_fack(struct tcp_sock *tp);
391extern void tcp_close(struct sock *sk, long timeout); 422extern void tcp_close(struct sock *sk, long timeout);
392extern void tcp_init_sock(struct sock *sk); 423extern void tcp_init_sock(struct sock *sk);
393extern unsigned int tcp_poll(struct file * file, struct socket *sock, 424extern unsigned int tcp_poll(struct file * file, struct socket *sock,
@@ -406,7 +437,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
406 size_t len, int nonblock, int flags, int *addr_len); 437 size_t len, int nonblock, int flags, int *addr_len);
407extern void tcp_parse_options(const struct sk_buff *skb, 438extern void tcp_parse_options(const struct sk_buff *skb,
408 struct tcp_options_received *opt_rx, const u8 **hvpp, 439 struct tcp_options_received *opt_rx, const u8 **hvpp,
409 int estab); 440 int estab, struct tcp_fastopen_cookie *foc);
410extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); 441extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
411 442
412/* 443/*
@@ -556,6 +587,8 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
556 return (tp->srtt >> 3) + tp->rttvar; 587 return (tp->srtt >> 3) + tp->rttvar;
557} 588}
558 589
590extern void tcp_set_rto(struct sock *sk);
591
559static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 592static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
560{ 593{
561 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 594 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
@@ -1264,6 +1297,15 @@ extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff
1264extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1297extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1265 const struct tcp_md5sig_key *key); 1298 const struct tcp_md5sig_key *key);
1266 1299
1300struct tcp_fastopen_request {
1301 /* Fast Open cookie. Size 0 means a cookie request */
1302 struct tcp_fastopen_cookie cookie;
1303 struct msghdr *data; /* data in MSG_FASTOPEN */
1304 u16 copied; /* queued in tcp_connect() */
1305};
1306
1307void tcp_free_fastopen_req(struct tcp_sock *tp);
1308
1267/* write queue abstraction */ 1309/* write queue abstraction */
1268static inline void tcp_write_queue_purge(struct sock *sk) 1310static inline void tcp_write_queue_purge(struct sock *sk)
1269{ 1311{
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index 8d6689cb2c66..68f0ecad6c6e 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -22,7 +22,6 @@ struct timewait_sock_ops {
22 int (*twsk_unique)(struct sock *sk, 22 int (*twsk_unique)(struct sock *sk,
23 struct sock *sktw, void *twp); 23 struct sock *sktw, void *twp);
24 void (*twsk_destructor)(struct sock *sk); 24 void (*twsk_destructor)(struct sock *sk);
25 void *(*twsk_getpeer)(struct sock *sk);
26}; 25};
27 26
28static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) 27static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
@@ -41,11 +40,4 @@ static inline void twsk_destructor(struct sock *sk)
41 sk->sk_prot->twsk_prot->twsk_destructor(sk); 40 sk->sk_prot->twsk_prot->twsk_destructor(sk);
42} 41}
43 42
44static inline void *twsk_getpeer(struct sock *sk)
45{
46 if (sk->sk_prot->twsk_prot->twsk_getpeer)
47 return sk->sk_prot->twsk_prot->twsk_getpeer(sk);
48 return NULL;
49}
50
51#endif /* _TIMEWAIT_SOCK_H */ 43#endif /* _TIMEWAIT_SOCK_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index e0a55df5bde8..d9509eb29b80 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1475,6 +1475,8 @@ extern int xfrm4_output(struct sk_buff *skb);
1475extern int xfrm4_output_finish(struct sk_buff *skb); 1475extern int xfrm4_output_finish(struct sk_buff *skb);
1476extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1476extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1477extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1477extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1478extern int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel *handler);
1479extern int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel *handler);
1478extern int xfrm6_extract_header(struct sk_buff *skb); 1480extern int xfrm6_extract_header(struct sk_buff *skb);
1479extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1481extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1480extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1482extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
@@ -1682,13 +1684,11 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1682 1684
1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m) 1685static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1684{ 1686{
1685 if ((m->m | m->v) && 1687 int ret = 0;
1686 nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m))
1687 goto nla_put_failure;
1688 return 0;
1689 1688
1690nla_put_failure: 1689 if (m->m | m->v)
1691 return -1; 1690 ret = nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
1691 return ret;
1692} 1692}
1693 1693
1694#endif /* _NET_XFRM_H */ 1694#endif /* _NET_XFRM_H */