aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/6lowpan.h434
-rw-r--r--include/net/9p/client.h6
-rw-r--r--include/net/9p/transport.h3
-rw-r--r--include/net/act_api.h22
-rw-r--r--include/net/addrconf.h6
-rw-r--r--include/net/af_ieee802154.h4
-rw-r--r--include/net/af_vsock.h6
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/bluetooth/hci.h76
-rw-r--r--include/net/bluetooth/hci_core.h209
-rw-r--r--include/net/bluetooth/l2cap.h8
-rw-r--r--include/net/bluetooth/mgmt.h63
-rw-r--r--include/net/bluetooth/rfcomm.h10
-rw-r--r--include/net/cfg80211.h102
-rw-r--r--include/net/checksum.h23
-rw-r--r--include/net/cls_cgroup.h2
-rw-r--r--include/net/dst.h32
-rw-r--r--include/net/flow.h16
-rw-r--r--include/net/flowcache.h25
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/ieee802154.h28
-rw-r--r--include/net/ieee802154_netdev.h195
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h2
-rw-r--r--include/net/inetpeer.h9
-rw-r--r--include/net/ip.h26
-rw-r--r--include/net/ip6_fib.h3
-rw-r--r--include/net/ip6_route.h20
-rw-r--r--include/net/ip_tunnels.h2
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/mac80211.h107
-rw-r--r--include/net/mac802154.h41
-rw-r--r--include/net/net_namespace.h13
-rw-r--r--include/net/netfilter/nf_conntrack.h11
-rw-r--r--include/net/netfilter/nf_conntrack_core.h9
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_labels.h4
-rw-r--r--include/net/netfilter/nf_tables.h28
-rw-r--r--include/net/netfilter/nf_tables_core.h10
-rw-r--r--include/net/netns/conntrack.h13
-rw-r--r--include/net/netns/ieee802154_6lowpan.h22
-rw-r--r--include/net/netns/ipv4.h9
-rw-r--r--include/net/netns/xfrm.h11
-rw-r--r--include/net/netprio_cgroup.h17
-rw-r--r--include/net/nfc/digital.h7
-rw-r--r--include/net/nfc/nfc.h3
-rw-r--r--include/net/nl802154.h6
-rw-r--r--include/net/regulatory.h21
-rw-r--r--include/net/route.h1
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/structs.h18
-rw-r--r--include/net/sock.h46
-rw-r--r--include/net/tc_act/tc_csum.h4
-rw-r--r--include/net/tc_act/tc_defact.h4
-rw-r--r--include/net/tc_act/tc_gact.h4
-rw-r--r--include/net/tc_act/tc_ipt.h4
-rw-r--r--include/net/tc_act/tc_mirred.h4
-rw-r--r--include/net/tc_act/tc_nat.h4
-rw-r--r--include/net/tc_act/tc_pedit.h4
-rw-r--r--include/net/tc_act/tc_skbedit.h4
-rw-r--r--include/net/tcp.h13
-rw-r--r--include/net/wimax.h4
-rw-r--r--include/net/wpan-phy.h19
-rw-r--r--include/net/xfrm.h134
66 files changed, 1594 insertions, 358 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
new file mode 100644
index 000000000000..f7d372b7d4ff
--- /dev/null
+++ b/include/net/6lowpan.h
@@ -0,0 +1,434 @@
1/*
2 * Copyright 2011, Siemens AG
3 * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
4 */
5
6/*
7 * Based on patches from Jon Smirl <jonsmirl@gmail.com>
8 * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24/* Jon's code is based on 6lowpan implementation for Contiki which is:
25 * Copyright (c) 2008, Swedish Institute of Computer Science.
26 * All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. Neither the name of the Institute nor the names of its contributors
37 * may be used to endorse or promote products derived from this software
38 * without specific prior written permission.
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
51 */
52
53#ifndef __6LOWPAN_H__
54#define __6LOWPAN_H__
55
56#include <net/ipv6.h>
57
58#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */
59#define UIP_IPH_LEN 40 /* ipv6 fixed header size */
60#define UIP_PROTO_UDP 17 /* ipv6 next header value for UDP */
61#define UIP_FRAGH_LEN 8 /* ipv6 fragment header size */
62
63/*
64 * ipv6 address based on mac
65 * second bit-flip (Universe/Local) is done according RFC2464
66 */
67#define is_addr_mac_addr_based(a, m) \
68 ((((a)->s6_addr[8]) == (((m)[0]) ^ 0x02)) && \
69 (((a)->s6_addr[9]) == (m)[1]) && \
70 (((a)->s6_addr[10]) == (m)[2]) && \
71 (((a)->s6_addr[11]) == (m)[3]) && \
72 (((a)->s6_addr[12]) == (m)[4]) && \
73 (((a)->s6_addr[13]) == (m)[5]) && \
74 (((a)->s6_addr[14]) == (m)[6]) && \
75 (((a)->s6_addr[15]) == (m)[7]))
76
77/* ipv6 address is unspecified */
78#define is_addr_unspecified(a) \
79 ((((a)->s6_addr32[0]) == 0) && \
80 (((a)->s6_addr32[1]) == 0) && \
81 (((a)->s6_addr32[2]) == 0) && \
82 (((a)->s6_addr32[3]) == 0))
83
84/* compare ipv6 addresses prefixes */
85#define ipaddr_prefixcmp(addr1, addr2, length) \
86 (memcmp(addr1, addr2, length >> 3) == 0)
87
88/* local link, i.e. FE80::/10 */
89#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
90
91/*
92 * check whether we can compress the IID to 16 bits,
93 * it's possible for unicast adresses with first 49 bits are zero only.
94 */
95#define lowpan_is_iid_16_bit_compressable(a) \
96 ((((a)->s6_addr16[4]) == 0) && \
97 (((a)->s6_addr[10]) == 0) && \
98 (((a)->s6_addr[11]) == 0xff) && \
99 (((a)->s6_addr[12]) == 0xfe) && \
100 (((a)->s6_addr[13]) == 0))
101
102/* multicast address */
103#define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
104
105/* check whether the 112-bit gid of the multicast address is mappable to: */
106
107/* 9 bits, for FF02::1 (all nodes) and FF02::2 (all routers) addresses only. */
108#define lowpan_is_mcast_addr_compressable(a) \
109 ((((a)->s6_addr16[1]) == 0) && \
110 (((a)->s6_addr16[2]) == 0) && \
111 (((a)->s6_addr16[3]) == 0) && \
112 (((a)->s6_addr16[4]) == 0) && \
113 (((a)->s6_addr16[5]) == 0) && \
114 (((a)->s6_addr16[6]) == 0) && \
115 (((a)->s6_addr[14]) == 0) && \
116 ((((a)->s6_addr[15]) == 1) || (((a)->s6_addr[15]) == 2)))
117
118/* 48 bits, FFXX::00XX:XXXX:XXXX */
119#define lowpan_is_mcast_addr_compressable48(a) \
120 ((((a)->s6_addr16[1]) == 0) && \
121 (((a)->s6_addr16[2]) == 0) && \
122 (((a)->s6_addr16[3]) == 0) && \
123 (((a)->s6_addr16[4]) == 0) && \
124 (((a)->s6_addr[10]) == 0))
125
126/* 32 bits, FFXX::00XX:XXXX */
127#define lowpan_is_mcast_addr_compressable32(a) \
128 ((((a)->s6_addr16[1]) == 0) && \
129 (((a)->s6_addr16[2]) == 0) && \
130 (((a)->s6_addr16[3]) == 0) && \
131 (((a)->s6_addr16[4]) == 0) && \
132 (((a)->s6_addr16[5]) == 0) && \
133 (((a)->s6_addr[12]) == 0))
134
135/* 8 bits, FF02::00XX */
136#define lowpan_is_mcast_addr_compressable8(a) \
137 ((((a)->s6_addr[1]) == 2) && \
138 (((a)->s6_addr16[1]) == 0) && \
139 (((a)->s6_addr16[2]) == 0) && \
140 (((a)->s6_addr16[3]) == 0) && \
141 (((a)->s6_addr16[4]) == 0) && \
142 (((a)->s6_addr16[5]) == 0) && \
143 (((a)->s6_addr16[6]) == 0) && \
144 (((a)->s6_addr[14]) == 0))
145
146#define lowpan_is_addr_broadcast(a) \
147 ((((a)[0]) == 0xFF) && \
148 (((a)[1]) == 0xFF) && \
149 (((a)[2]) == 0xFF) && \
150 (((a)[3]) == 0xFF) && \
151 (((a)[4]) == 0xFF) && \
152 (((a)[5]) == 0xFF) && \
153 (((a)[6]) == 0xFF) && \
154 (((a)[7]) == 0xFF))
155
156#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
157#define LOWPAN_DISPATCH_HC1 0x42 /* 01000010 = 66 */
158#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
159#define LOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx */
160#define LOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx */
161
162#define LOWPAN_DISPATCH_MASK 0xf8 /* 11111000 */
163
164#define LOWPAN_FRAG_TIMEOUT (HZ * 60) /* time-out 60 sec */
165
166#define LOWPAN_FRAG1_HEAD_SIZE 0x4
167#define LOWPAN_FRAGN_HEAD_SIZE 0x5
168
169/*
170 * According IEEE802.15.4 standard:
171 * - MTU is 127 octets
172 * - maximum MHR size is 37 octets
173 * - MFR size is 2 octets
174 *
175 * so minimal payload size that we may guarantee is:
176 * MTU - MHR - MFR = 88 octets
177 */
178#define LOWPAN_FRAG_SIZE 88
179
180/*
181 * Values of fields within the IPHC encoding first byte
182 * (C stands for compressed and I for inline)
183 */
184#define LOWPAN_IPHC_TF 0x18
185
186#define LOWPAN_IPHC_FL_C 0x10
187#define LOWPAN_IPHC_TC_C 0x08
188#define LOWPAN_IPHC_NH_C 0x04
189#define LOWPAN_IPHC_TTL_1 0x01
190#define LOWPAN_IPHC_TTL_64 0x02
191#define LOWPAN_IPHC_TTL_255 0x03
192#define LOWPAN_IPHC_TTL_I 0x00
193
194
195/* Values of fields within the IPHC encoding second byte */
196#define LOWPAN_IPHC_CID 0x80
197
198#define LOWPAN_IPHC_ADDR_00 0x00
199#define LOWPAN_IPHC_ADDR_01 0x01
200#define LOWPAN_IPHC_ADDR_02 0x02
201#define LOWPAN_IPHC_ADDR_03 0x03
202
203#define LOWPAN_IPHC_SAC 0x40
204#define LOWPAN_IPHC_SAM 0x30
205
206#define LOWPAN_IPHC_SAM_BIT 4
207
208#define LOWPAN_IPHC_M 0x08
209#define LOWPAN_IPHC_DAC 0x04
210#define LOWPAN_IPHC_DAM_00 0x00
211#define LOWPAN_IPHC_DAM_01 0x01
212#define LOWPAN_IPHC_DAM_10 0x02
213#define LOWPAN_IPHC_DAM_11 0x03
214
215#define LOWPAN_IPHC_DAM_BIT 0
216/*
217 * LOWPAN_UDP encoding (works together with IPHC)
218 */
219#define LOWPAN_NHC_UDP_MASK 0xF8
220#define LOWPAN_NHC_UDP_ID 0xF0
221#define LOWPAN_NHC_UDP_CHECKSUMC 0x04
222#define LOWPAN_NHC_UDP_CHECKSUMI 0x00
223
224#define LOWPAN_NHC_UDP_4BIT_PORT 0xF0B0
225#define LOWPAN_NHC_UDP_4BIT_MASK 0xFFF0
226#define LOWPAN_NHC_UDP_8BIT_PORT 0xF000
227#define LOWPAN_NHC_UDP_8BIT_MASK 0xFF00
228
229/* values for port compression, _with checksum_ ie bit 5 set to 0 */
230#define LOWPAN_NHC_UDP_CS_P_00 0xF0 /* all inline */
231#define LOWPAN_NHC_UDP_CS_P_01 0xF1 /* source 16bit inline,
232 dest = 0xF0 + 8 bit inline */
233#define LOWPAN_NHC_UDP_CS_P_10 0xF2 /* source = 0xF0 + 8bit inline,
234 dest = 16 bit inline */
235#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */
236#define LOWPAN_NHC_UDP_CS_C 0x04 /* checksum elided */
237
238#ifdef DEBUG
239/* print data in line */
240static inline void raw_dump_inline(const char *caller, char *msg,
241 unsigned char *buf, int len)
242{
243 if (msg)
244 pr_debug("%s():%s: ", caller, msg);
245
246 print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, buf, len, false);
247}
248
249/* print data in a table format:
250 *
251 * addr: xx xx xx xx xx xx
252 * addr: xx xx xx xx xx xx
253 * ...
254 */
255static inline void raw_dump_table(const char *caller, char *msg,
256 unsigned char *buf, int len)
257{
258 if (msg)
259 pr_debug("%s():%s:\n", caller, msg);
260
261 print_hex_dump_debug("\t", DUMP_PREFIX_OFFSET, 16, 1, buf, len, false);
262}
263#else
264static inline void raw_dump_table(const char *caller, char *msg,
265 unsigned char *buf, int len) { }
266static inline void raw_dump_inline(const char *caller, char *msg,
267 unsigned char *buf, int len) { }
268#endif
269
270static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val)
271{
272 if (unlikely(!pskb_may_pull(skb, 1)))
273 return -EINVAL;
274
275 *val = skb->data[0];
276 skb_pull(skb, 1);
277
278 return 0;
279}
280
281static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
282{
283 if (unlikely(!pskb_may_pull(skb, 2)))
284 return -EINVAL;
285
286 *val = (skb->data[0] << 8) | skb->data[1];
287 skb_pull(skb, 2);
288
289 return 0;
290}
291
292static inline bool lowpan_fetch_skb(struct sk_buff *skb,
293 void *data, const unsigned int len)
294{
295 if (unlikely(!pskb_may_pull(skb, len)))
296 return true;
297
298 skb_copy_from_linear_data(skb, data, len);
299 skb_pull(skb, len);
300
301 return false;
302}
303
304static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data,
305 const size_t len)
306{
307 memcpy(*hc_ptr, data, len);
308 *hc_ptr += len;
309}
310
311static inline u8 lowpan_addr_mode_size(const u8 addr_mode)
312{
313 static const u8 addr_sizes[] = {
314 [LOWPAN_IPHC_ADDR_00] = 16,
315 [LOWPAN_IPHC_ADDR_01] = 8,
316 [LOWPAN_IPHC_ADDR_02] = 2,
317 [LOWPAN_IPHC_ADDR_03] = 0,
318 };
319 return addr_sizes[addr_mode];
320}
321
322static inline u8 lowpan_next_hdr_size(const u8 h_enc, u16 *uncomp_header)
323{
324 u8 ret = 1;
325
326 if ((h_enc & LOWPAN_NHC_UDP_MASK) == LOWPAN_NHC_UDP_ID) {
327 *uncomp_header += sizeof(struct udphdr);
328
329 switch (h_enc & LOWPAN_NHC_UDP_CS_P_11) {
330 case LOWPAN_NHC_UDP_CS_P_00:
331 ret += 4;
332 break;
333 case LOWPAN_NHC_UDP_CS_P_01:
334 case LOWPAN_NHC_UDP_CS_P_10:
335 ret += 3;
336 break;
337 case LOWPAN_NHC_UDP_CS_P_11:
338 ret++;
339 break;
340 default:
341 break;
342 }
343
344 if (!(h_enc & LOWPAN_NHC_UDP_CS_C))
345 ret += 2;
346 }
347
348 return ret;
349}
350
351/**
352 * lowpan_uncompress_size - returns skb->len size with uncompressed header
353 * @skb: sk_buff with 6lowpan header inside
354 * @datagram_offset: optional to get the datagram_offset value
355 *
356 * Returns the skb->len with uncompressed header
357 */
358static inline u16
359lowpan_uncompress_size(const struct sk_buff *skb, u16 *dgram_offset)
360{
361 u16 ret = 2, uncomp_header = sizeof(struct ipv6hdr);
362 u8 iphc0, iphc1, h_enc;
363
364 iphc0 = skb_network_header(skb)[0];
365 iphc1 = skb_network_header(skb)[1];
366
367 switch ((iphc0 & LOWPAN_IPHC_TF) >> 3) {
368 case 0:
369 ret += 4;
370 break;
371 case 1:
372 ret += 3;
373 break;
374 case 2:
375 ret++;
376 break;
377 default:
378 break;
379 }
380
381 if (!(iphc0 & LOWPAN_IPHC_NH_C))
382 ret++;
383
384 if (!(iphc0 & 0x03))
385 ret++;
386
387 ret += lowpan_addr_mode_size((iphc1 & LOWPAN_IPHC_SAM) >>
388 LOWPAN_IPHC_SAM_BIT);
389
390 if (iphc1 & LOWPAN_IPHC_M) {
391 switch ((iphc1 & LOWPAN_IPHC_DAM_11) >>
392 LOWPAN_IPHC_DAM_BIT) {
393 case LOWPAN_IPHC_DAM_00:
394 ret += 16;
395 break;
396 case LOWPAN_IPHC_DAM_01:
397 ret += 6;
398 break;
399 case LOWPAN_IPHC_DAM_10:
400 ret += 4;
401 break;
402 case LOWPAN_IPHC_DAM_11:
403 ret++;
404 break;
405 default:
406 break;
407 }
408 } else {
409 ret += lowpan_addr_mode_size((iphc1 & LOWPAN_IPHC_DAM_11) >>
410 LOWPAN_IPHC_DAM_BIT);
411 }
412
413 if (iphc0 & LOWPAN_IPHC_NH_C) {
414 h_enc = skb_network_header(skb)[ret];
415 ret += lowpan_next_hdr_size(h_enc, &uncomp_header);
416 }
417
418 if (dgram_offset)
419 *dgram_offset = uncomp_header;
420
421 return skb->len + uncomp_header - ret;
422}
423
424typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev);
425
426int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
427 const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
428 const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
429 u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver);
430int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
431 unsigned short type, const void *_daddr,
432 const void *_saddr, unsigned int len);
433
434#endif /* __6LOWPAN_H__ */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index c38a005bd0cf..6fab66c5c5af 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -67,7 +67,6 @@ enum p9_trans_status {
67 * @REQ_STATUS_ALLOC: request has been allocated but not sent 67 * @REQ_STATUS_ALLOC: request has been allocated but not sent
68 * @REQ_STATUS_UNSENT: request waiting to be sent 68 * @REQ_STATUS_UNSENT: request waiting to be sent
69 * @REQ_STATUS_SENT: request sent to server 69 * @REQ_STATUS_SENT: request sent to server
70 * @REQ_STATUS_FLSH: a flush has been sent for this request
71 * @REQ_STATUS_RCVD: response received from server 70 * @REQ_STATUS_RCVD: response received from server
72 * @REQ_STATUS_FLSHD: request has been flushed 71 * @REQ_STATUS_FLSHD: request has been flushed
73 * @REQ_STATUS_ERROR: request encountered an error on the client side 72 * @REQ_STATUS_ERROR: request encountered an error on the client side
@@ -83,7 +82,6 @@ enum p9_req_status_t {
83 REQ_STATUS_ALLOC, 82 REQ_STATUS_ALLOC,
84 REQ_STATUS_UNSENT, 83 REQ_STATUS_UNSENT,
85 REQ_STATUS_SENT, 84 REQ_STATUS_SENT,
86 REQ_STATUS_FLSH,
87 REQ_STATUS_RCVD, 85 REQ_STATUS_RCVD,
88 REQ_STATUS_FLSHD, 86 REQ_STATUS_FLSHD,
89 REQ_STATUS_ERROR, 87 REQ_STATUS_ERROR,
@@ -130,7 +128,6 @@ struct p9_req_t {
130 * @proto_version: 9P protocol version to use 128 * @proto_version: 9P protocol version to use
131 * @trans_mod: module API instantiated with this client 129 * @trans_mod: module API instantiated with this client
132 * @trans: tranport instance state and API 130 * @trans: tranport instance state and API
133 * @conn: connection state information used by trans_fd
134 * @fidpool: fid handle accounting for session 131 * @fidpool: fid handle accounting for session
135 * @fidlist: List of active fid handles 132 * @fidlist: List of active fid handles
136 * @tagpool - transaction id accounting for session 133 * @tagpool - transaction id accounting for session
@@ -159,7 +156,6 @@ struct p9_client {
159 struct p9_trans_module *trans_mod; 156 struct p9_trans_module *trans_mod;
160 enum p9_trans_status status; 157 enum p9_trans_status status;
161 void *trans; 158 void *trans;
162 struct p9_conn *conn;
163 159
164 struct p9_idpool *fidpool; 160 struct p9_idpool *fidpool;
165 struct list_head fidlist; 161 struct list_head fidlist;
@@ -261,7 +257,7 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
261int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status); 257int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status);
262int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl); 258int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl);
263struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); 259struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
264void p9_client_cb(struct p9_client *c, struct p9_req_t *req); 260void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status);
265 261
266int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int); 262int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
267int p9stat_read(struct p9_client *, char *, int, struct p9_wstat *); 263int p9stat_read(struct p9_client *, char *, int, struct p9_wstat *);
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 9a36d9297114..d9fa68f26c41 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -40,6 +40,8 @@
40 * @close: member function to discard a connection on this transport 40 * @close: member function to discard a connection on this transport
41 * @request: member function to issue a request to the transport 41 * @request: member function to issue a request to the transport
42 * @cancel: member function to cancel a request (if it hasn't been sent) 42 * @cancel: member function to cancel a request (if it hasn't been sent)
43 * @cancelled: member function to notify that a cancelled request will not
44 * not receive a reply
43 * 45 *
44 * This is the basic API for a transport module which is registered by the 46 * This is the basic API for a transport module which is registered by the
45 * transport module with the 9P core network module and used by the client 47 * transport module with the 9P core network module and used by the client
@@ -58,6 +60,7 @@ struct p9_trans_module {
58 void (*close) (struct p9_client *); 60 void (*close) (struct p9_client *);
59 int (*request) (struct p9_client *, struct p9_req_t *req); 61 int (*request) (struct p9_client *, struct p9_req_t *req);
60 int (*cancel) (struct p9_client *, struct p9_req_t *req); 62 int (*cancel) (struct p9_client *, struct p9_req_t *req);
63 int (*cancelled)(struct p9_client *, struct p9_req_t *req);
61 int (*zc_request)(struct p9_client *, struct p9_req_t *, 64 int (*zc_request)(struct p9_client *, struct p9_req_t *,
62 char *, char *, int , int, int, int); 65 char *, char *, int , int, int, int);
63}; 66};
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 788d8378e587..3ee4c92afd1b 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -89,7 +89,7 @@ struct tc_action_ops {
89 struct module *owner; 89 struct module *owner;
90 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); 90 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
91 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 91 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
92 int (*cleanup)(struct tc_action *, int bind); 92 void (*cleanup)(struct tc_action *, int bind);
93 int (*lookup)(struct tc_action *, u32); 93 int (*lookup)(struct tc_action *, u32);
94 int (*init)(struct net *net, struct nlattr *nla, 94 int (*init)(struct net *net, struct nlattr *nla,
95 struct nlattr *est, struct tc_action *act, int ovr, 95 struct nlattr *est, struct tc_action *act, int ovr,
@@ -98,20 +98,18 @@ struct tc_action_ops {
98}; 98};
99 99
100int tcf_hash_search(struct tc_action *a, u32 index); 100int tcf_hash_search(struct tc_action *a, u32 index);
101void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); 101void tcf_hash_destroy(struct tc_action *a);
102int tcf_hash_release(struct tcf_common *p, int bind, 102int tcf_hash_release(struct tc_action *a, int bind);
103 struct tcf_hashinfo *hinfo);
104u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo); 103u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo);
105struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, 104int tcf_hash_check(u32 index, struct tc_action *a, int bind);
106 int bind); 105int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a,
107struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, 106 int size, int bind);
108 struct tc_action *a, int size, 107void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est);
109 int bind); 108void tcf_hash_insert(struct tc_action *a);
110void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo);
111 109
112int tcf_register_action(struct tc_action_ops *a); 110int tcf_register_action(struct tc_action_ops *a, unsigned int mask);
113int tcf_unregister_action(struct tc_action_ops *a); 111int tcf_unregister_action(struct tc_action_ops *a);
114void tcf_action_destroy(struct list_head *actions, int bind); 112int tcf_action_destroy(struct list_head *actions, int bind);
115int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, 113int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions,
116 struct tcf_result *res); 114 struct tcf_result *res);
117int tcf_action_init(struct net *net, struct nlattr *nla, 115int tcf_action_init(struct net *net, struct nlattr *nla,
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 50e39a8822b4..933a9f22a05f 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -314,7 +314,7 @@ static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
315{ 315{
316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
317 __u64 *p = (__u64 *)addr; 317 __be64 *p = (__be64 *)addr;
318 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL; 318 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL;
319#else 319#else
320 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 320 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
@@ -326,7 +326,7 @@ static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
326static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 326static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
327{ 327{
328#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 328#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
329 __u64 *p = (__u64 *)addr; 329 __be64 *p = (__be64 *)addr;
330 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL; 330 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL;
331#else 331#else
332 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 332 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
@@ -343,7 +343,7 @@ static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr)
343static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) 343static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr)
344{ 344{
345#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 345#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
346 __u64 *p = (__u64 *)addr; 346 __be64 *p = (__be64 *)addr;
347 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | 347 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) |
348 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) & 348 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) &
349 cpu_to_be64(0xffffffffff000000UL))) == 0UL; 349 cpu_to_be64(0xffffffffff000000UL))) == 0UL;
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
index 75e64c7a2960..f79ae2aa76d6 100644
--- a/include/net/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -36,7 +36,7 @@ enum {
36/* address length, octets */ 36/* address length, octets */
37#define IEEE802154_ADDR_LEN 8 37#define IEEE802154_ADDR_LEN 8
38 38
39struct ieee802154_addr { 39struct ieee802154_addr_sa {
40 int addr_type; 40 int addr_type;
41 u16 pan_id; 41 u16 pan_id;
42 union { 42 union {
@@ -51,7 +51,7 @@ struct ieee802154_addr {
51 51
52struct sockaddr_ieee802154 { 52struct sockaddr_ieee802154 {
53 sa_family_t family; /* AF_IEEE802154 */ 53 sa_family_t family; /* AF_IEEE802154 */
54 struct ieee802154_addr addr; 54 struct ieee802154_addr_sa addr;
55}; 55};
56 56
57/* get/setsockopt */ 57/* get/setsockopt */
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
index 7d64d3609ec9..428277869400 100644
--- a/include/net/af_vsock.h
+++ b/include/net/af_vsock.h
@@ -155,7 +155,11 @@ struct vsock_transport {
155 155
156/**** CORE ****/ 156/**** CORE ****/
157 157
158int vsock_core_init(const struct vsock_transport *t); 158int __vsock_core_init(const struct vsock_transport *t, struct module *owner);
159static inline int vsock_core_init(const struct vsock_transport *t)
160{
161 return __vsock_core_init(t, THIS_MODULE);
162}
159void vsock_core_exit(void); 163void vsock_core_exit(void);
160 164
161/**** UTILS ****/ 165/**** UTILS ****/
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index f4f9ee466791..904777c1cd24 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -65,6 +65,7 @@ struct bt_security {
65#define BT_SECURITY_LOW 1 65#define BT_SECURITY_LOW 1
66#define BT_SECURITY_MEDIUM 2 66#define BT_SECURITY_MEDIUM 2
67#define BT_SECURITY_HIGH 3 67#define BT_SECURITY_HIGH 3
68#define BT_SECURITY_FIPS 4
68 69
69#define BT_DEFER_SETUP 7 70#define BT_DEFER_SETUP 7
70 71
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 66c1cd87bfe7..be150cf8cd43 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -117,11 +117,18 @@ enum {
117 HCI_SERVICE_CACHE, 117 HCI_SERVICE_CACHE,
118 HCI_DEBUG_KEYS, 118 HCI_DEBUG_KEYS,
119 HCI_DUT_MODE, 119 HCI_DUT_MODE,
120 HCI_FORCE_SC,
121 HCI_FORCE_STATIC_ADDR,
120 HCI_UNREGISTER, 122 HCI_UNREGISTER,
121 HCI_USER_CHANNEL, 123 HCI_USER_CHANNEL,
122 124
123 HCI_LE_SCAN, 125 HCI_LE_SCAN,
124 HCI_SSP_ENABLED, 126 HCI_SSP_ENABLED,
127 HCI_SC_ENABLED,
128 HCI_SC_ONLY,
129 HCI_PRIVACY,
130 HCI_RPA_EXPIRED,
131 HCI_RPA_RESOLVING,
125 HCI_HS_ENABLED, 132 HCI_HS_ENABLED,
126 HCI_LE_ENABLED, 133 HCI_LE_ENABLED,
127 HCI_ADVERTISING, 134 HCI_ADVERTISING,
@@ -133,6 +140,7 @@ enum {
133 HCI_FAST_CONNECTABLE, 140 HCI_FAST_CONNECTABLE,
134 HCI_BREDR_ENABLED, 141 HCI_BREDR_ENABLED,
135 HCI_6LOWPAN_ENABLED, 142 HCI_6LOWPAN_ENABLED,
143 HCI_LE_SCAN_INTERRUPTED,
136}; 144};
137 145
138/* A mask for the flags that are supposed to remain when a reset happens 146/* A mask for the flags that are supposed to remain when a reset happens
@@ -175,6 +183,8 @@ enum {
175#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 183#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
176#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 184#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
177#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 185#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
186#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
187#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
178 188
179/* HCI data types */ 189/* HCI data types */
180#define HCI_COMMAND_PKT 0x01 190#define HCI_COMMAND_PKT 0x01
@@ -282,10 +292,14 @@ enum {
282#define LMP_SYNC_TRAIN 0x04 292#define LMP_SYNC_TRAIN 0x04
283#define LMP_SYNC_SCAN 0x08 293#define LMP_SYNC_SCAN 0x08
284 294
295#define LMP_SC 0x01
296#define LMP_PING 0x02
297
285/* Host features */ 298/* Host features */
286#define LMP_HOST_SSP 0x01 299#define LMP_HOST_SSP 0x01
287#define LMP_HOST_LE 0x02 300#define LMP_HOST_LE 0x02
288#define LMP_HOST_LE_BREDR 0x04 301#define LMP_HOST_LE_BREDR 0x04
302#define LMP_HOST_SC 0x08
289 303
290/* Connection modes */ 304/* Connection modes */
291#define HCI_CM_ACTIVE 0x0000 305#define HCI_CM_ACTIVE 0x0000
@@ -307,6 +321,7 @@ enum {
307#define HCI_LM_TRUSTED 0x0008 321#define HCI_LM_TRUSTED 0x0008
308#define HCI_LM_RELIABLE 0x0010 322#define HCI_LM_RELIABLE 0x0010
309#define HCI_LM_SECURE 0x0020 323#define HCI_LM_SECURE 0x0020
324#define HCI_LM_FIPS 0x0040
310 325
311/* Authentication types */ 326/* Authentication types */
312#define HCI_AT_NO_BONDING 0x00 327#define HCI_AT_NO_BONDING 0x00
@@ -327,17 +342,24 @@ enum {
327#define HCI_LK_LOCAL_UNIT 0x01 342#define HCI_LK_LOCAL_UNIT 0x01
328#define HCI_LK_REMOTE_UNIT 0x02 343#define HCI_LK_REMOTE_UNIT 0x02
329#define HCI_LK_DEBUG_COMBINATION 0x03 344#define HCI_LK_DEBUG_COMBINATION 0x03
330#define HCI_LK_UNAUTH_COMBINATION 0x04 345#define HCI_LK_UNAUTH_COMBINATION_P192 0x04
331#define HCI_LK_AUTH_COMBINATION 0x05 346#define HCI_LK_AUTH_COMBINATION_P192 0x05
332#define HCI_LK_CHANGED_COMBINATION 0x06 347#define HCI_LK_CHANGED_COMBINATION 0x06
348#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
349#define HCI_LK_AUTH_COMBINATION_P256 0x08
333/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ 350/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
334#define HCI_SMP_STK 0x80 351#define HCI_SMP_STK 0x80
335#define HCI_SMP_STK_SLAVE 0x81 352#define HCI_SMP_STK_SLAVE 0x81
336#define HCI_SMP_LTK 0x82 353#define HCI_SMP_LTK 0x82
337#define HCI_SMP_LTK_SLAVE 0x83 354#define HCI_SMP_LTK_SLAVE 0x83
338 355
356/* Long Term Key types */
357#define HCI_LTK_UNAUTH 0x00
358#define HCI_LTK_AUTH 0x01
359
339/* ---- HCI Error Codes ---- */ 360/* ---- HCI Error Codes ---- */
340#define HCI_ERROR_AUTH_FAILURE 0x05 361#define HCI_ERROR_AUTH_FAILURE 0x05
362#define HCI_ERROR_MEMORY_EXCEEDED 0x07
341#define HCI_ERROR_CONNECTION_TIMEOUT 0x08 363#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
342#define HCI_ERROR_REJ_BAD_ADDR 0x0f 364#define HCI_ERROR_REJ_BAD_ADDR 0x0f
343#define HCI_ERROR_REMOTE_USER_TERM 0x13 365#define HCI_ERROR_REMOTE_USER_TERM 0x13
@@ -660,6 +682,15 @@ struct hci_rp_set_csb {
660 682
661#define HCI_OP_START_SYNC_TRAIN 0x0443 683#define HCI_OP_START_SYNC_TRAIN 0x0443
662 684
685#define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445
686struct hci_cp_remote_oob_ext_data_reply {
687 bdaddr_t bdaddr;
688 __u8 hash192[16];
689 __u8 randomizer192[16];
690 __u8 hash256[16];
691 __u8 randomizer256[16];
692} __packed;
693
663#define HCI_OP_SNIFF_MODE 0x0803 694#define HCI_OP_SNIFF_MODE 0x0803
664struct hci_cp_sniff_mode { 695struct hci_cp_sniff_mode {
665 __le16 handle; 696 __le16 handle;
@@ -933,6 +964,26 @@ struct hci_rp_write_sync_train_params {
933 __le16 sync_train_int; 964 __le16 sync_train_int;
934} __packed; 965} __packed;
935 966
967#define HCI_OP_READ_SC_SUPPORT 0x0c79
968struct hci_rp_read_sc_support {
969 __u8 status;
970 __u8 support;
971} __packed;
972
973#define HCI_OP_WRITE_SC_SUPPORT 0x0c7a
974struct hci_cp_write_sc_support {
975 __u8 support;
976} __packed;
977
978#define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d
979struct hci_rp_read_local_oob_ext_data {
980 __u8 status;
981 __u8 hash192[16];
982 __u8 randomizer192[16];
983 __u8 hash256[16];
984 __u8 randomizer256[16];
985} __packed;
986
936#define HCI_OP_READ_LOCAL_VERSION 0x1001 987#define HCI_OP_READ_LOCAL_VERSION 0x1001
937struct hci_rp_read_local_version { 988struct hci_rp_read_local_version {
938 __u8 status; 989 __u8 status;
@@ -1133,6 +1184,9 @@ struct hci_cp_le_set_scan_enable {
1133 __u8 filter_dup; 1184 __u8 filter_dup;
1134} __packed; 1185} __packed;
1135 1186
1187#define HCI_LE_USE_PEER_ADDR 0x00
1188#define HCI_LE_USE_WHITELIST 0x01
1189
1136#define HCI_OP_LE_CREATE_CONN 0x200d 1190#define HCI_OP_LE_CREATE_CONN 0x200d
1137struct hci_cp_le_create_conn { 1191struct hci_cp_le_create_conn {
1138 __le16 scan_interval; 1192 __le16 scan_interval;
@@ -1157,6 +1211,20 @@ struct hci_rp_le_read_white_list_size {
1157 __u8 size; 1211 __u8 size;
1158} __packed; 1212} __packed;
1159 1213
1214#define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010
1215
1216#define HCI_OP_LE_ADD_TO_WHITE_LIST 0x2011
1217struct hci_cp_le_add_to_white_list {
1218 __u8 bdaddr_type;
1219 bdaddr_t bdaddr;
1220} __packed;
1221
1222#define HCI_OP_LE_DEL_FROM_WHITE_LIST 0x2012
1223struct hci_cp_le_del_from_white_list {
1224 __u8 bdaddr_type;
1225 bdaddr_t bdaddr;
1226} __packed;
1227
1160#define HCI_OP_LE_CONN_UPDATE 0x2013 1228#define HCI_OP_LE_CONN_UPDATE 0x2013
1161struct hci_cp_le_conn_update { 1229struct hci_cp_le_conn_update {
1162 __le16 handle; 1230 __le16 handle;
@@ -1171,7 +1239,7 @@ struct hci_cp_le_conn_update {
1171#define HCI_OP_LE_START_ENC 0x2019 1239#define HCI_OP_LE_START_ENC 0x2019
1172struct hci_cp_le_start_enc { 1240struct hci_cp_le_start_enc {
1173 __le16 handle; 1241 __le16 handle;
1174 __u8 rand[8]; 1242 __le64 rand;
1175 __le16 ediv; 1243 __le16 ediv;
1176 __u8 ltk[16]; 1244 __u8 ltk[16];
1177} __packed; 1245} __packed;
@@ -1583,7 +1651,7 @@ struct hci_ev_le_conn_complete {
1583#define HCI_EV_LE_LTK_REQ 0x05 1651#define HCI_EV_LE_LTK_REQ 0x05
1584struct hci_ev_le_ltk_req { 1652struct hci_ev_le_ltk_req {
1585 __le16 handle; 1653 __le16 handle;
1586 __u8 random[8]; 1654 __le64 rand;
1587 __le16 ediv; 1655 __le16 ediv;
1588} __packed; 1656} __packed;
1589 1657
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f2f0cf5865c4..5f8bc05694ac 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -91,6 +91,13 @@ struct bt_uuid {
91 u8 svc_hint; 91 u8 svc_hint;
92}; 92};
93 93
94struct smp_csrk {
95 bdaddr_t bdaddr;
96 u8 bdaddr_type;
97 u8 master;
98 u8 val[16];
99};
100
94struct smp_ltk { 101struct smp_ltk {
95 struct list_head list; 102 struct list_head list;
96 bdaddr_t bdaddr; 103 bdaddr_t bdaddr;
@@ -99,9 +106,17 @@ struct smp_ltk {
99 u8 type; 106 u8 type;
100 u8 enc_size; 107 u8 enc_size;
101 __le16 ediv; 108 __le16 ediv;
102 u8 rand[8]; 109 __le64 rand;
103 u8 val[16]; 110 u8 val[16];
104} __packed; 111};
112
113struct smp_irk {
114 struct list_head list;
115 bdaddr_t rpa;
116 bdaddr_t bdaddr;
117 u8 addr_type;
118 u8 val[16];
119};
105 120
106struct link_key { 121struct link_key {
107 struct list_head list; 122 struct list_head list;
@@ -114,12 +129,17 @@ struct link_key {
114struct oob_data { 129struct oob_data {
115 struct list_head list; 130 struct list_head list;
116 bdaddr_t bdaddr; 131 bdaddr_t bdaddr;
117 u8 hash[16]; 132 u8 hash192[16];
118 u8 randomizer[16]; 133 u8 randomizer192[16];
134 u8 hash256[16];
135 u8 randomizer256[16];
119}; 136};
120 137
121#define HCI_MAX_SHORT_NAME_LENGTH 10 138#define HCI_MAX_SHORT_NAME_LENGTH 10
122 139
140/* Default LE RPA expiry time, 15 minutes */
141#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
142
123struct amp_assoc { 143struct amp_assoc {
124 __u16 len; 144 __u16 len;
125 __u16 offset; 145 __u16 offset;
@@ -141,8 +161,9 @@ struct hci_dev {
141 __u8 bus; 161 __u8 bus;
142 __u8 dev_type; 162 __u8 dev_type;
143 bdaddr_t bdaddr; 163 bdaddr_t bdaddr;
164 bdaddr_t random_addr;
144 bdaddr_t static_addr; 165 bdaddr_t static_addr;
145 __u8 own_addr_type; 166 __u8 adv_addr_type;
146 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 167 __u8 dev_name[HCI_MAX_NAME_LENGTH];
147 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; 168 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
148 __u8 eir[HCI_MAX_EIR_LENGTH]; 169 __u8 eir[HCI_MAX_EIR_LENGTH];
@@ -167,6 +188,8 @@ struct hci_dev {
167 __u16 page_scan_interval; 188 __u16 page_scan_interval;
168 __u16 page_scan_window; 189 __u16 page_scan_window;
169 __u8 page_scan_type; 190 __u8 page_scan_type;
191 __u8 le_adv_channel_map;
192 __u8 le_scan_type;
170 __u16 le_scan_interval; 193 __u16 le_scan_interval;
171 __u16 le_scan_window; 194 __u16 le_scan_window;
172 __u16 le_conn_min_interval; 195 __u16 le_conn_min_interval;
@@ -257,19 +280,21 @@ struct hci_dev {
257 __u32 req_status; 280 __u32 req_status;
258 __u32 req_result; 281 __u32 req_result;
259 282
260 struct list_head mgmt_pending; 283 struct crypto_blkcipher *tfm_aes;
261 284
262 struct discovery_state discovery; 285 struct discovery_state discovery;
263 struct hci_conn_hash conn_hash; 286 struct hci_conn_hash conn_hash;
264 struct list_head blacklist;
265 287
288 struct list_head mgmt_pending;
289 struct list_head blacklist;
266 struct list_head uuids; 290 struct list_head uuids;
267
268 struct list_head link_keys; 291 struct list_head link_keys;
269
270 struct list_head long_term_keys; 292 struct list_head long_term_keys;
271 293 struct list_head identity_resolving_keys;
272 struct list_head remote_oob_data; 294 struct list_head remote_oob_data;
295 struct list_head le_white_list;
296 struct list_head le_conn_params;
297 struct list_head pend_le_conns;
273 298
274 struct hci_dev_stats stat; 299 struct hci_dev_stats stat;
275 300
@@ -291,6 +316,11 @@ struct hci_dev {
291 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; 316 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
292 __u8 scan_rsp_data_len; 317 __u8 scan_rsp_data_len;
293 318
319 __u8 irk[16];
320 __u32 rpa_timeout;
321 struct delayed_work rpa_expired;
322 bdaddr_t rpa;
323
294 int (*open)(struct hci_dev *hdev); 324 int (*open)(struct hci_dev *hdev);
295 int (*close)(struct hci_dev *hdev); 325 int (*close)(struct hci_dev *hdev);
296 int (*flush)(struct hci_dev *hdev); 326 int (*flush)(struct hci_dev *hdev);
@@ -310,6 +340,10 @@ struct hci_conn {
310 __u8 dst_type; 340 __u8 dst_type;
311 bdaddr_t src; 341 bdaddr_t src;
312 __u8 src_type; 342 __u8 src_type;
343 bdaddr_t init_addr;
344 __u8 init_addr_type;
345 bdaddr_t resp_addr;
346 __u8 resp_addr_type;
313 __u16 handle; 347 __u16 handle;
314 __u16 state; 348 __u16 state;
315 __u8 mode; 349 __u8 mode;
@@ -332,6 +366,8 @@ struct hci_conn {
332 __u8 passkey_entered; 366 __u8 passkey_entered;
333 __u16 disc_timeout; 367 __u16 disc_timeout;
334 __u16 setting; 368 __u16 setting;
369 __u16 le_conn_min_interval;
370 __u16 le_conn_max_interval;
335 unsigned long flags; 371 unsigned long flags;
336 372
337 __u8 remote_cap; 373 __u8 remote_cap;
@@ -347,6 +383,7 @@ struct hci_conn {
347 struct delayed_work disc_work; 383 struct delayed_work disc_work;
348 struct delayed_work auto_accept_work; 384 struct delayed_work auto_accept_work;
349 struct delayed_work idle_work; 385 struct delayed_work idle_work;
386 struct delayed_work le_conn_timeout;
350 387
351 struct device dev; 388 struct device dev;
352 389
@@ -372,6 +409,22 @@ struct hci_chan {
372 __u8 state; 409 __u8 state;
373}; 410};
374 411
412struct hci_conn_params {
413 struct list_head list;
414
415 bdaddr_t addr;
416 u8 addr_type;
417
418 u16 conn_min_interval;
419 u16 conn_max_interval;
420
421 enum {
422 HCI_AUTO_CONN_DISABLED,
423 HCI_AUTO_CONN_ALWAYS,
424 HCI_AUTO_CONN_LINK_LOSS,
425 } auto_connect;
426};
427
375extern struct list_head hci_dev_list; 428extern struct list_head hci_dev_list;
376extern struct list_head hci_cb_list; 429extern struct list_head hci_cb_list;
377extern rwlock_t hci_dev_list_lock; 430extern rwlock_t hci_dev_list_lock;
@@ -446,6 +499,8 @@ enum {
446 HCI_CONN_LE_SMP_PEND, 499 HCI_CONN_LE_SMP_PEND,
447 HCI_CONN_MGMT_CONNECTED, 500 HCI_CONN_MGMT_CONNECTED,
448 HCI_CONN_SSP_ENABLED, 501 HCI_CONN_SSP_ENABLED,
502 HCI_CONN_SC_ENABLED,
503 HCI_CONN_AES_CCM,
449 HCI_CONN_POWER_SAVE, 504 HCI_CONN_POWER_SAVE,
450 HCI_CONN_REMOTE_OOB, 505 HCI_CONN_REMOTE_OOB,
451 HCI_CONN_6LOWPAN, 506 HCI_CONN_6LOWPAN,
@@ -458,6 +513,13 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
458 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); 513 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
459} 514}
460 515
516static inline bool hci_conn_sc_enabled(struct hci_conn *conn)
517{
518 struct hci_dev *hdev = conn->hdev;
519 return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) &&
520 test_bit(HCI_CONN_SC_ENABLED, &conn->flags);
521}
522
461static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) 523static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
462{ 524{
463 struct hci_conn_hash *h = &hdev->conn_hash; 525 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -521,6 +583,13 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
521 } 583 }
522} 584}
523 585
586static inline unsigned int hci_conn_count(struct hci_dev *hdev)
587{
588 struct hci_conn_hash *c = &hdev->conn_hash;
589
590 return c->acl_num + c->amp_num + c->sco_num + c->le_num;
591}
592
524static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 593static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
525 __u16 handle) 594 __u16 handle)
526{ 595{
@@ -594,8 +663,10 @@ void hci_chan_del(struct hci_chan *chan);
594void hci_chan_list_flush(struct hci_conn *conn); 663void hci_chan_list_flush(struct hci_conn *conn);
595struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); 664struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
596 665
597struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 666struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
598 __u8 dst_type, __u8 sec_level, __u8 auth_type); 667 u8 dst_type, u8 sec_level, u8 auth_type);
668struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
669 u8 sec_level, u8 auth_type);
599struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, 670struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
600 __u16 setting); 671 __u16 setting);
601int hci_conn_check_link_mode(struct hci_conn *conn); 672int hci_conn_check_link_mode(struct hci_conn *conn);
@@ -606,6 +677,8 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
606 677
607void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 678void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
608 679
680void hci_le_conn_failed(struct hci_conn *conn, u8 status);
681
609/* 682/*
610 * hci_conn_get() and hci_conn_put() are used to control the life-time of an 683 * hci_conn_get() and hci_conn_put() are used to control the life-time of an
611 * "hci_conn" object. They do not guarantee that the hci_conn object is running, 684 * "hci_conn" object. They do not guarantee that the hci_conn object is running,
@@ -737,31 +810,64 @@ int hci_inquiry(void __user *arg);
737 810
738struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 811struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
739 bdaddr_t *bdaddr, u8 type); 812 bdaddr_t *bdaddr, u8 type);
740int hci_blacklist_clear(struct hci_dev *hdev);
741int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 813int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
742int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 814int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
743 815
744int hci_uuids_clear(struct hci_dev *hdev); 816struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev,
817 bdaddr_t *bdaddr, u8 type);
818void hci_white_list_clear(struct hci_dev *hdev);
819int hci_white_list_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
820int hci_white_list_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
821
822struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
823 bdaddr_t *addr, u8 addr_type);
824int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
825 u8 auto_connect, u16 conn_min_interval,
826 u16 conn_max_interval);
827void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
828void hci_conn_params_clear(struct hci_dev *hdev);
829
830struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev,
831 bdaddr_t *addr, u8 addr_type);
832void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
833void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
834void hci_pend_le_conns_clear(struct hci_dev *hdev);
835
836void hci_update_background_scan(struct hci_dev *hdev);
745 837
746int hci_link_keys_clear(struct hci_dev *hdev); 838void hci_uuids_clear(struct hci_dev *hdev);
839
840void hci_link_keys_clear(struct hci_dev *hdev);
747struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 841struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
748int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 842int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
749 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 843 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
750struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 844struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
751int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, 845 bool master);
752 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, 846struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
753 __le16 ediv, u8 rand[8]); 847 u8 addr_type, u8 type, u8 authenticated,
848 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand);
754struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 849struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
755 u8 addr_type); 850 u8 addr_type, bool master);
756int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); 851int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
757int hci_smp_ltks_clear(struct hci_dev *hdev); 852void hci_smp_ltks_clear(struct hci_dev *hdev);
758int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 853int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
759 854
760int hci_remote_oob_data_clear(struct hci_dev *hdev); 855struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa);
856struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
857 u8 addr_type);
858struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
859 u8 addr_type, u8 val[16], bdaddr_t *rpa);
860void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type);
861void hci_smp_irks_clear(struct hci_dev *hdev);
862
863void hci_remote_oob_data_clear(struct hci_dev *hdev);
761struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 864struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
762 bdaddr_t *bdaddr); 865 bdaddr_t *bdaddr);
763int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, 866int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
764 u8 *randomizer); 867 u8 *hash, u8 *randomizer);
868int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
869 u8 *hash192, u8 *randomizer192,
870 u8 *hash256, u8 *randomizer256);
765int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 871int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
766 872
767void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 873void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
@@ -803,9 +909,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
803#define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) 909#define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE)
804#define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) 910#define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN)
805#define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) 911#define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN)
912#define lmp_sc_capable(dev) ((dev)->features[2][1] & LMP_SC)
913#define lmp_ping_capable(dev) ((dev)->features[2][1] & LMP_PING)
806 914
807/* ----- Host capabilities ----- */ 915/* ----- Host capabilities ----- */
808#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) 916#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP)
917#define lmp_host_sc_capable(dev) ((dev)->features[1][0] & LMP_HOST_SC)
809#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 918#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
810#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 919#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
811 920
@@ -1019,6 +1128,26 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1019 return false; 1128 return false;
1020} 1129}
1021 1130
1131static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1132{
1133 if (addr_type != 0x01)
1134 return false;
1135
1136 if ((bdaddr->b[5] & 0xc0) == 0x40)
1137 return true;
1138
1139 return false;
1140}
1141
1142static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1143 bdaddr_t *bdaddr, u8 addr_type)
1144{
1145 if (!hci_bdaddr_is_rpa(bdaddr, addr_type))
1146 return NULL;
1147
1148 return hci_find_irk_by_rpa(hdev, bdaddr);
1149}
1150
1022int hci_register_cb(struct hci_cb *hcb); 1151int hci_register_cb(struct hci_cb *hcb);
1023int hci_unregister_cb(struct hci_cb *hcb); 1152int hci_unregister_cb(struct hci_cb *hcb);
1024 1153
@@ -1040,6 +1169,9 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1040 const void *param, u8 event); 1169 const void *param, u8 event);
1041void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); 1170void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1042 1171
1172void hci_req_add_le_scan_disable(struct hci_request *req);
1173void hci_req_add_le_passive_scan(struct hci_request *req);
1174
1043struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, 1175struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1044 const void *param, u32 timeout); 1176 const void *param, u32 timeout);
1045struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, 1177struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
@@ -1085,6 +1217,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered);
1085void mgmt_discoverable_timeout(struct hci_dev *hdev); 1217void mgmt_discoverable_timeout(struct hci_dev *hdev);
1086void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1218void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1087void mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1219void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1220void mgmt_advertising(struct hci_dev *hdev, u8 advertising);
1088void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1221void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1089void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1222void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1090 bool persistent); 1223 bool persistent);
@@ -1092,7 +1225,8 @@ void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1092 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1225 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1093 u8 *dev_class); 1226 u8 *dev_class);
1094void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1227void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1095 u8 link_type, u8 addr_type, u8 reason); 1228 u8 link_type, u8 addr_type, u8 reason,
1229 bool mgmt_connected);
1096void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1230void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1097 u8 link_type, u8 addr_type, u8 status); 1231 u8 link_type, u8 addr_type, u8 status);
1098void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1232void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
@@ -1103,7 +1237,7 @@ void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1103void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1237void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1104 u8 status); 1238 u8 status);
1105int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 1239int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1106 u8 link_type, u8 addr_type, __le32 value, 1240 u8 link_type, u8 addr_type, u32 value,
1107 u8 confirm_hint); 1241 u8 confirm_hint);
1108int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1242int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1109 u8 link_type, u8 addr_type, u8 status); 1243 u8 link_type, u8 addr_type, u8 status);
@@ -1122,11 +1256,13 @@ void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1122 u8 addr_type, u8 status); 1256 u8 addr_type, u8 status);
1123void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1257void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1124void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1258void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1259void mgmt_sc_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1125void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1260void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1126 u8 status); 1261 u8 status);
1127void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1262void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1128void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1263void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1129 u8 *randomizer, u8 status); 1264 u8 *randomizer192, u8 *hash256,
1265 u8 *randomizer256, u8 status);
1130void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1266void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1131 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1267 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1132 u8 ssp, u8 *eir, u16 eir_len); 1268 u8 ssp, u8 *eir, u16 eir_len);
@@ -1135,8 +1271,12 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1135void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1271void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1136int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1272int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1137int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1273int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1138void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1274void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1275void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1276void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1277 bool persistent);
1139void mgmt_reenable_advertising(struct hci_dev *hdev); 1278void mgmt_reenable_advertising(struct hci_dev *hdev);
1279void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1140 1280
1141/* HCI info for socket */ 1281/* HCI info for socket */
1142#define hci_pi(sk) ((struct hci_pinfo *) sk) 1282#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -1168,9 +1308,14 @@ struct hci_sec_filter {
1168 1308
1169void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1309void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1170 u16 latency, u16 to_multiplier); 1310 u16 latency, u16 to_multiplier);
1171void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1311void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
1172 __u8 ltk[16]); 1312 __u8 ltk[16]);
1173 1313
1314int hci_update_random_address(struct hci_request *req, bool require_privacy,
1315 u8 *own_addr_type);
1316void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
1317 u8 *bdaddr_type);
1318
1174#define SCO_AIRMODE_MASK 0x0003 1319#define SCO_AIRMODE_MASK 0x0003
1175#define SCO_AIRMODE_CVSD 0x0000 1320#define SCO_AIRMODE_CVSD 0x0000
1176#define SCO_AIRMODE_TRANSP 0x0003 1321#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index dbc4a89984ca..4abdcb220e3a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -91,6 +91,7 @@ struct l2cap_conninfo {
91#define L2CAP_LM_TRUSTED 0x0008 91#define L2CAP_LM_TRUSTED 0x0008
92#define L2CAP_LM_RELIABLE 0x0010 92#define L2CAP_LM_RELIABLE 0x0010
93#define L2CAP_LM_SECURE 0x0020 93#define L2CAP_LM_SECURE 0x0020
94#define L2CAP_LM_FIPS 0x0040
94 95
95/* L2CAP command codes */ 96/* L2CAP command codes */
96#define L2CAP_COMMAND_REJ 0x01 97#define L2CAP_COMMAND_REJ 0x01
@@ -623,6 +624,9 @@ struct l2cap_conn {
623 __u32 rx_len; 624 __u32 rx_len;
624 __u8 tx_ident; 625 __u8 tx_ident;
625 626
627 struct sk_buff_head pending_rx;
628 struct work_struct pending_rx_work;
629
626 __u8 disc_reason; 630 __u8 disc_reason;
627 631
628 struct delayed_work security_timer; 632 struct delayed_work security_timer;
@@ -647,7 +651,7 @@ struct l2cap_user {
647#define L2CAP_CHAN_RAW 1 651#define L2CAP_CHAN_RAW 1
648#define L2CAP_CHAN_CONN_LESS 2 652#define L2CAP_CHAN_CONN_LESS 2
649#define L2CAP_CHAN_CONN_ORIENTED 3 653#define L2CAP_CHAN_CONN_ORIENTED 3
650#define L2CAP_CHAN_CONN_FIX_A2MP 4 654#define L2CAP_CHAN_FIXED 4
651 655
652/* ----- L2CAP socket info ----- */ 656/* ----- L2CAP socket info ----- */
653#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 657#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -853,7 +857,6 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
853} 857}
854 858
855extern bool disable_ertm; 859extern bool disable_ertm;
856extern bool enable_lecoc;
857 860
858int l2cap_init_sockets(void); 861int l2cap_init_sockets(void);
859void l2cap_cleanup_sockets(void); 862void l2cap_cleanup_sockets(void);
@@ -878,6 +881,7 @@ int l2cap_ertm_init(struct l2cap_chan *chan);
878void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 881void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
879void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 882void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
880void l2cap_chan_del(struct l2cap_chan *chan, int err); 883void l2cap_chan_del(struct l2cap_chan *chan, int err);
884void l2cap_conn_update_id_addr(struct hci_conn *hcon);
881void l2cap_send_conn_req(struct l2cap_chan *chan); 885void l2cap_send_conn_req(struct l2cap_chan *chan);
882void l2cap_move_start(struct l2cap_chan *chan); 886void l2cap_move_start(struct l2cap_chan *chan);
883void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, 887void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 518c5c84e39a..d4b571c2f9fd 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -94,6 +94,9 @@ struct mgmt_rp_read_index_list {
94#define MGMT_SETTING_HS 0x00000100 94#define MGMT_SETTING_HS 0x00000100
95#define MGMT_SETTING_LE 0x00000200 95#define MGMT_SETTING_LE 0x00000200
96#define MGMT_SETTING_ADVERTISING 0x00000400 96#define MGMT_SETTING_ADVERTISING 0x00000400
97#define MGMT_SETTING_SECURE_CONN 0x00000800
98#define MGMT_SETTING_DEBUG_KEYS 0x00001000
99#define MGMT_SETTING_PRIVACY 0x00002000
97 100
98#define MGMT_OP_READ_INFO 0x0004 101#define MGMT_OP_READ_INFO 0x0004
99#define MGMT_READ_INFO_SIZE 0 102#define MGMT_READ_INFO_SIZE 0
@@ -180,11 +183,11 @@ struct mgmt_cp_load_link_keys {
180 183
181struct mgmt_ltk_info { 184struct mgmt_ltk_info {
182 struct mgmt_addr_info addr; 185 struct mgmt_addr_info addr;
183 __u8 authenticated; 186 __u8 type;
184 __u8 master; 187 __u8 master;
185 __u8 enc_size; 188 __u8 enc_size;
186 __le16 ediv; 189 __le16 ediv;
187 __u8 rand[8]; 190 __le64 rand;
188 __u8 val[16]; 191 __u8 val[16];
189} __packed; 192} __packed;
190 193
@@ -294,6 +297,12 @@ struct mgmt_rp_read_local_oob_data {
294 __u8 hash[16]; 297 __u8 hash[16];
295 __u8 randomizer[16]; 298 __u8 randomizer[16];
296} __packed; 299} __packed;
300struct mgmt_rp_read_local_oob_ext_data {
301 __u8 hash192[16];
302 __u8 randomizer192[16];
303 __u8 hash256[16];
304 __u8 randomizer256[16];
305} __packed;
297 306
298#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 307#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
299struct mgmt_cp_add_remote_oob_data { 308struct mgmt_cp_add_remote_oob_data {
@@ -302,6 +311,14 @@ struct mgmt_cp_add_remote_oob_data {
302 __u8 randomizer[16]; 311 __u8 randomizer[16];
303} __packed; 312} __packed;
304#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) 313#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
314struct mgmt_cp_add_remote_oob_ext_data {
315 struct mgmt_addr_info addr;
316 __u8 hash192[16];
317 __u8 randomizer192[16];
318 __u8 hash256[16];
319 __u8 randomizer256[16];
320} __packed;
321#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
305 322
306#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 323#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
307struct mgmt_cp_remove_remote_oob_data { 324struct mgmt_cp_remove_remote_oob_data {
@@ -369,6 +386,29 @@ struct mgmt_cp_set_scan_params {
369} __packed; 386} __packed;
370#define MGMT_SET_SCAN_PARAMS_SIZE 4 387#define MGMT_SET_SCAN_PARAMS_SIZE 4
371 388
389#define MGMT_OP_SET_SECURE_CONN 0x002D
390
391#define MGMT_OP_SET_DEBUG_KEYS 0x002E
392
393#define MGMT_OP_SET_PRIVACY 0x002F
394struct mgmt_cp_set_privacy {
395 __u8 privacy;
396 __u8 irk[16];
397} __packed;
398#define MGMT_SET_PRIVACY_SIZE 17
399
400struct mgmt_irk_info {
401 struct mgmt_addr_info addr;
402 __u8 val[16];
403} __packed;
404
405#define MGMT_OP_LOAD_IRKS 0x0030
406struct mgmt_cp_load_irks {
407 __le16 irk_count;
408 struct mgmt_irk_info irks[0];
409} __packed;
410#define MGMT_LOAD_IRKS_SIZE 2
411
372#define MGMT_EV_CMD_COMPLETE 0x0001 412#define MGMT_EV_CMD_COMPLETE 0x0001
373struct mgmt_ev_cmd_complete { 413struct mgmt_ev_cmd_complete {
374 __le16 opcode; 414 __le16 opcode;
@@ -504,3 +544,22 @@ struct mgmt_ev_passkey_notify {
504 __le32 passkey; 544 __le32 passkey;
505 __u8 entered; 545 __u8 entered;
506} __packed; 546} __packed;
547
548#define MGMT_EV_NEW_IRK 0x0018
549struct mgmt_ev_new_irk {
550 __u8 store_hint;
551 bdaddr_t rpa;
552 struct mgmt_irk_info irk;
553} __packed;
554
555struct mgmt_csrk_info {
556 struct mgmt_addr_info addr;
557 __u8 master;
558 __u8 val[16];
559} __packed;
560
561#define MGMT_EV_NEW_CSRK 0x0019
562struct mgmt_ev_new_csrk {
563 __u8 store_hint;
564 struct mgmt_csrk_info key;
565} __packed;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 486213a1aed8..2611cc389d7d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -238,9 +238,11 @@ int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
238 u8 channel); 238 u8 channel);
239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); 239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
241void rfcomm_dlc_send_noerror(struct rfcomm_dlc *d, struct sk_buff *skb);
241int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 242int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig);
242int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); 243int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
243void rfcomm_dlc_accept(struct rfcomm_dlc *d); 244void rfcomm_dlc_accept(struct rfcomm_dlc *d);
245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel);
244 246
245#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) spin_lock(&d->lock)
246#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock)
@@ -295,6 +297,7 @@ struct rfcomm_conninfo {
295#define RFCOMM_LM_TRUSTED 0x0008 297#define RFCOMM_LM_TRUSTED 0x0008
296#define RFCOMM_LM_RELIABLE 0x0010 298#define RFCOMM_LM_RELIABLE 0x0010
297#define RFCOMM_LM_SECURE 0x0020 299#define RFCOMM_LM_SECURE 0x0020
300#define RFCOMM_LM_FIPS 0x0040
298 301
299#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) 302#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk)
300 303
@@ -323,11 +326,16 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel,
323#define RFCOMMGETDEVINFO _IOR('R', 211, int) 326#define RFCOMMGETDEVINFO _IOR('R', 211, int)
324#define RFCOMMSTEALDLC _IOW('R', 220, int) 327#define RFCOMMSTEALDLC _IOW('R', 220, int)
325 328
329/* rfcomm_dev.flags bit definitions */
326#define RFCOMM_REUSE_DLC 0 330#define RFCOMM_REUSE_DLC 0
327#define RFCOMM_RELEASE_ONHUP 1 331#define RFCOMM_RELEASE_ONHUP 1
328#define RFCOMM_HANGUP_NOW 2 332#define RFCOMM_HANGUP_NOW 2
329#define RFCOMM_TTY_ATTACHED 3 333#define RFCOMM_TTY_ATTACHED 3
330#define RFCOMM_TTY_RELEASED 4 334#define RFCOMM_DEFUNCT_BIT4 4 /* don't reuse this bit - userspace visible */
335
336/* rfcomm_dev.status bit definitions */
337#define RFCOMM_DEV_RELEASED 0
338#define RFCOMM_TTY_OWNED 1
331 339
332struct rfcomm_dev_req { 340struct rfcomm_dev_req {
333 s16 dev_id; 341 s16 dev_id;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b1f84b05c67e..f856e5a746fa 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -151,6 +151,7 @@ enum ieee80211_channel_flags {
151 * @dfs_state: current state of this channel. Only relevant if radar is required 151 * @dfs_state: current state of this channel. Only relevant if radar is required
152 * on this channel. 152 * on this channel.
153 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 153 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
154 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
154 */ 155 */
155struct ieee80211_channel { 156struct ieee80211_channel {
156 enum ieee80211_band band; 157 enum ieee80211_band band;
@@ -165,6 +166,7 @@ struct ieee80211_channel {
165 int orig_mag, orig_mpwr; 166 int orig_mag, orig_mpwr;
166 enum nl80211_dfs_state dfs_state; 167 enum nl80211_dfs_state dfs_state;
167 unsigned long dfs_state_entered; 168 unsigned long dfs_state_entered;
169 unsigned int dfs_cac_ms;
168}; 170};
169 171
170/** 172/**
@@ -1394,10 +1396,12 @@ struct cfg80211_scan_request {
1394/** 1396/**
1395 * struct cfg80211_match_set - sets of attributes to match 1397 * struct cfg80211_match_set - sets of attributes to match
1396 * 1398 *
1397 * @ssid: SSID to be matched 1399 * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1400 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1398 */ 1401 */
1399struct cfg80211_match_set { 1402struct cfg80211_match_set {
1400 struct cfg80211_ssid ssid; 1403 struct cfg80211_ssid ssid;
1404 s32 rssi_thold;
1401}; 1405};
1402 1406
1403/** 1407/**
@@ -1420,7 +1424,8 @@ struct cfg80211_match_set {
1420 * @dev: the interface 1424 * @dev: the interface
1421 * @scan_start: start time of the scheduled scan 1425 * @scan_start: start time of the scheduled scan
1422 * @channels: channels to scan 1426 * @channels: channels to scan
1423 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1427 * @min_rssi_thold: for drivers only supporting a single threshold, this
1428 * contains the minimum over all matchsets
1424 */ 1429 */
1425struct cfg80211_sched_scan_request { 1430struct cfg80211_sched_scan_request {
1426 struct cfg80211_ssid *ssids; 1431 struct cfg80211_ssid *ssids;
@@ -1433,7 +1438,7 @@ struct cfg80211_sched_scan_request {
1433 u32 flags; 1438 u32 flags;
1434 struct cfg80211_match_set *match_sets; 1439 struct cfg80211_match_set *match_sets;
1435 int n_match_sets; 1440 int n_match_sets;
1436 s32 rssi_thold; 1441 s32 min_rssi_thold;
1437 1442
1438 /* internal */ 1443 /* internal */
1439 struct wiphy *wiphy; 1444 struct wiphy *wiphy;
@@ -1701,8 +1706,14 @@ struct cfg80211_ibss_params {
1701 * 1706 *
1702 * @channel: The channel to use or %NULL if not specified (auto-select based 1707 * @channel: The channel to use or %NULL if not specified (auto-select based
1703 * on scan results) 1708 * on scan results)
1709 * @channel_hint: The channel of the recommended BSS for initial connection or
1710 * %NULL if not specified
1704 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1711 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1705 * results) 1712 * results)
1713 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
1714 * %NULL if not specified. Unlike the @bssid parameter, the driver is
1715 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
1716 * to use.
1706 * @ssid: SSID 1717 * @ssid: SSID
1707 * @ssid_len: Length of ssid in octets 1718 * @ssid_len: Length of ssid in octets
1708 * @auth_type: Authentication type (algorithm) 1719 * @auth_type: Authentication type (algorithm)
@@ -1725,11 +1736,13 @@ struct cfg80211_ibss_params {
1725 */ 1736 */
1726struct cfg80211_connect_params { 1737struct cfg80211_connect_params {
1727 struct ieee80211_channel *channel; 1738 struct ieee80211_channel *channel;
1728 u8 *bssid; 1739 struct ieee80211_channel *channel_hint;
1729 u8 *ssid; 1740 const u8 *bssid;
1741 const u8 *bssid_hint;
1742 const u8 *ssid;
1730 size_t ssid_len; 1743 size_t ssid_len;
1731 enum nl80211_auth_type auth_type; 1744 enum nl80211_auth_type auth_type;
1732 u8 *ie; 1745 const u8 *ie;
1733 size_t ie_len; 1746 size_t ie_len;
1734 bool privacy; 1747 bool privacy;
1735 enum nl80211_mfp mfp; 1748 enum nl80211_mfp mfp;
@@ -1768,6 +1781,7 @@ struct cfg80211_bitrate_mask {
1768 u32 legacy; 1781 u32 legacy;
1769 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1782 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
1770 u16 vht_mcs[NL80211_VHT_NSS_MAX]; 1783 u16 vht_mcs[NL80211_VHT_NSS_MAX];
1784 enum nl80211_txrate_gi gi;
1771 } control[IEEE80211_NUM_BANDS]; 1785 } control[IEEE80211_NUM_BANDS];
1772}; 1786};
1773/** 1787/**
@@ -2194,7 +2208,12 @@ struct cfg80211_qos_map {
2194 * @set_cqm_txe_config: Configure connection quality monitor TX error 2208 * @set_cqm_txe_config: Configure connection quality monitor TX error
2195 * thresholds. 2209 * thresholds.
2196 * @sched_scan_start: Tell the driver to start a scheduled scan. 2210 * @sched_scan_start: Tell the driver to start a scheduled scan.
2197 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. 2211 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2212 * call must stop the scheduled scan and be ready for starting a new one
2213 * before it returns, i.e. @sched_scan_start may be called immediately
2214 * after that again and should not fail in that case. The driver should
2215 * not call cfg80211_sched_scan_stopped() for a requested stop (when this
2216 * method returns 0.)
2198 * 2217 *
2199 * @mgmt_frame_register: Notify driver that a management frame type was 2218 * @mgmt_frame_register: Notify driver that a management frame type was
2200 * registered. Note that this callback may not sleep, and cannot run 2219 * registered. Note that this callback may not sleep, and cannot run
@@ -2453,7 +2472,8 @@ struct cfg80211_ops {
2453 2472
2454 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2473 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2455 u8 *peer, u8 action_code, u8 dialog_token, 2474 u8 *peer, u8 action_code, u8 dialog_token,
2456 u16 status_code, const u8 *buf, size_t len); 2475 u16 status_code, u32 peer_capability,
2476 const u8 *buf, size_t len);
2457 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2477 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2458 u8 *peer, enum nl80211_tdls_operation oper); 2478 u8 *peer, enum nl80211_tdls_operation oper);
2459 2479
@@ -2485,7 +2505,8 @@ struct cfg80211_ops {
2485 2505
2486 int (*start_radar_detection)(struct wiphy *wiphy, 2506 int (*start_radar_detection)(struct wiphy *wiphy,
2487 struct net_device *dev, 2507 struct net_device *dev,
2488 struct cfg80211_chan_def *chandef); 2508 struct cfg80211_chan_def *chandef,
2509 u32 cac_time_ms);
2489 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2510 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2490 struct cfg80211_update_ft_ies_params *ftie); 2511 struct cfg80211_update_ft_ies_params *ftie);
2491 int (*crit_proto_start)(struct wiphy *wiphy, 2512 int (*crit_proto_start)(struct wiphy *wiphy,
@@ -2598,9 +2619,12 @@ struct ieee80211_iface_limit {
2598 * only in special cases. 2619 * only in special cases.
2599 * @radar_detect_widths: bitmap of channel widths supported for radar detection 2620 * @radar_detect_widths: bitmap of channel widths supported for radar detection
2600 * 2621 *
2601 * These examples can be expressed as follows: 2622 * With this structure the driver can describe which interface
2623 * combinations it supports concurrently.
2602 * 2624 *
2603 * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 2625 * Examples:
2626 *
2627 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
2604 * 2628 *
2605 * struct ieee80211_iface_limit limits1[] = { 2629 * struct ieee80211_iface_limit limits1[] = {
2606 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 2630 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
@@ -2614,7 +2638,7 @@ struct ieee80211_iface_limit {
2614 * }; 2638 * };
2615 * 2639 *
2616 * 2640 *
2617 * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 2641 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
2618 * 2642 *
2619 * struct ieee80211_iface_limit limits2[] = { 2643 * struct ieee80211_iface_limit limits2[] = {
2620 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 2644 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
@@ -2628,7 +2652,8 @@ struct ieee80211_iface_limit {
2628 * }; 2652 * };
2629 * 2653 *
2630 * 2654 *
2631 * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2655 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
2656 *
2632 * This allows for an infrastructure connection and three P2P connections. 2657 * This allows for an infrastructure connection and three P2P connections.
2633 * 2658 *
2634 * struct ieee80211_iface_limit limits3[] = { 2659 * struct ieee80211_iface_limit limits3[] = {
@@ -2778,7 +2803,7 @@ struct wiphy_vendor_command {
2778 * @perm_addr: permanent MAC address of this device 2803 * @perm_addr: permanent MAC address of this device
2779 * @addr_mask: If the device supports multiple MAC addresses by masking, 2804 * @addr_mask: If the device supports multiple MAC addresses by masking,
2780 * set this to a mask with variable bits set to 1, e.g. if the last 2805 * set this to a mask with variable bits set to 1, e.g. if the last
2781 * four bits are variable then set it to 00:...:00:0f. The actual 2806 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
2782 * variable bits shall be determined by the interfaces added, with 2807 * variable bits shall be determined by the interfaces added, with
2783 * interfaces not matching the mask being rejected to be brought up. 2808 * interfaces not matching the mask being rejected to be brought up.
2784 * @n_addresses: number of addresses in @addresses. 2809 * @n_addresses: number of addresses in @addresses.
@@ -2875,6 +2900,11 @@ struct wiphy_vendor_command {
2875 * @n_vendor_commands: number of vendor commands 2900 * @n_vendor_commands: number of vendor commands
2876 * @vendor_events: array of vendor events supported by the hardware 2901 * @vendor_events: array of vendor events supported by the hardware
2877 * @n_vendor_events: number of vendor events 2902 * @n_vendor_events: number of vendor events
2903 *
2904 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
2905 * (including P2P GO) or 0 to indicate no such limit is advertised. The
2906 * driver is allowed to advertise a theoretical limit that it can reach in
2907 * some cases, but may not always reach.
2878 */ 2908 */
2879struct wiphy { 2909struct wiphy {
2880 /* assign these fields before you register the wiphy */ 2910 /* assign these fields before you register the wiphy */
@@ -2990,6 +3020,8 @@ struct wiphy {
2990 const struct nl80211_vendor_cmd_info *vendor_events; 3020 const struct nl80211_vendor_cmd_info *vendor_events;
2991 int n_vendor_commands, n_vendor_events; 3021 int n_vendor_commands, n_vendor_events;
2992 3022
3023 u16 max_ap_assoc_sta;
3024
2993 char priv[0] __aligned(NETDEV_ALIGN); 3025 char priv[0] __aligned(NETDEV_ALIGN);
2994}; 3026};
2995 3027
@@ -3127,8 +3159,8 @@ struct cfg80211_cached_keys;
3127 * @identifier: (private) Identifier used in nl80211 to identify this 3159 * @identifier: (private) Identifier used in nl80211 to identify this
3128 * wireless device if it has no netdev 3160 * wireless device if it has no netdev
3129 * @current_bss: (private) Used by the internal configuration code 3161 * @current_bss: (private) Used by the internal configuration code
3130 * @channel: (private) Used by the internal configuration code to track 3162 * @chandef: (private) Used by the internal configuration code to track
3131 * the user-set AP, monitor and WDS channel 3163 * the user-set channel definition.
3132 * @preset_chandef: (private) Used by the internal configuration code to 3164 * @preset_chandef: (private) Used by the internal configuration code to
3133 * track the channel to be used for AP later 3165 * track the channel to be used for AP later
3134 * @bssid: (private) Used by the internal configuration code 3166 * @bssid: (private) Used by the internal configuration code
@@ -3151,6 +3183,7 @@ struct cfg80211_cached_keys;
3151 * @p2p_started: true if this is a P2P Device that has been started 3183 * @p2p_started: true if this is a P2P Device that has been started
3152 * @cac_started: true if DFS channel availability check has been started 3184 * @cac_started: true if DFS channel availability check has been started
3153 * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 3185 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3186 * @cac_time_ms: CAC time in ms
3154 * @ps: powersave mode is enabled 3187 * @ps: powersave mode is enabled
3155 * @ps_timeout: dynamic powersave timeout 3188 * @ps_timeout: dynamic powersave timeout
3156 * @ap_unexpected_nlportid: (private) netlink port ID of application 3189 * @ap_unexpected_nlportid: (private) netlink port ID of application
@@ -3192,9 +3225,7 @@ struct wireless_dev {
3192 3225
3193 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3226 struct cfg80211_internal_bss *current_bss; /* associated / joined */
3194 struct cfg80211_chan_def preset_chandef; 3227 struct cfg80211_chan_def preset_chandef;
3195 3228 struct cfg80211_chan_def chandef;
3196 /* for AP and mesh channel tracking */
3197 struct ieee80211_channel *channel;
3198 3229
3199 bool ibss_fixed; 3230 bool ibss_fixed;
3200 bool ibss_dfs_possible; 3231 bool ibss_dfs_possible;
@@ -3208,6 +3239,7 @@ struct wireless_dev {
3208 3239
3209 bool cac_started; 3240 bool cac_started;
3210 unsigned long cac_start_time; 3241 unsigned long cac_start_time;
3242 unsigned int cac_time_ms;
3211 3243
3212#ifdef CONFIG_CFG80211_WEXT 3244#ifdef CONFIG_CFG80211_WEXT
3213 /* wext data */ 3245 /* wext data */
@@ -3637,10 +3669,22 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy);
3637void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3669void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3638 3670
3639/** 3671/**
3672 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
3673 *
3674 * @wiphy: the wiphy on which the scheduled scan stopped
3675 *
3676 * The driver can call this function to inform cfg80211 that the
3677 * scheduled scan had to be stopped, for whatever reason. The driver
3678 * is then called back via the sched_scan_stop operation when done.
3679 * This function should be called with rtnl locked.
3680 */
3681void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy);
3682
3683/**
3640 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 3684 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
3641 * 3685 *
3642 * @wiphy: the wiphy reporting the BSS 3686 * @wiphy: the wiphy reporting the BSS
3643 * @channel: The channel the frame was received on 3687 * @rx_channel: The channel the frame was received on
3644 * @scan_width: width of the control channel 3688 * @scan_width: width of the control channel
3645 * @mgmt: the management frame (probe response or beacon) 3689 * @mgmt: the management frame (probe response or beacon)
3646 * @len: length of the management frame 3690 * @len: length of the management frame
@@ -3655,18 +3699,18 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3655 */ 3699 */
3656struct cfg80211_bss * __must_check 3700struct cfg80211_bss * __must_check
3657cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 3701cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3658 struct ieee80211_channel *channel, 3702 struct ieee80211_channel *rx_channel,
3659 enum nl80211_bss_scan_width scan_width, 3703 enum nl80211_bss_scan_width scan_width,
3660 struct ieee80211_mgmt *mgmt, size_t len, 3704 struct ieee80211_mgmt *mgmt, size_t len,
3661 s32 signal, gfp_t gfp); 3705 s32 signal, gfp_t gfp);
3662 3706
3663static inline struct cfg80211_bss * __must_check 3707static inline struct cfg80211_bss * __must_check
3664cfg80211_inform_bss_frame(struct wiphy *wiphy, 3708cfg80211_inform_bss_frame(struct wiphy *wiphy,
3665 struct ieee80211_channel *channel, 3709 struct ieee80211_channel *rx_channel,
3666 struct ieee80211_mgmt *mgmt, size_t len, 3710 struct ieee80211_mgmt *mgmt, size_t len,
3667 s32 signal, gfp_t gfp) 3711 s32 signal, gfp_t gfp)
3668{ 3712{
3669 return cfg80211_inform_bss_width_frame(wiphy, channel, 3713 return cfg80211_inform_bss_width_frame(wiphy, rx_channel,
3670 NL80211_BSS_CHAN_WIDTH_20, 3714 NL80211_BSS_CHAN_WIDTH_20,
3671 mgmt, len, signal, gfp); 3715 mgmt, len, signal, gfp);
3672} 3716}
@@ -3675,7 +3719,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3675 * cfg80211_inform_bss - inform cfg80211 of a new BSS 3719 * cfg80211_inform_bss - inform cfg80211 of a new BSS
3676 * 3720 *
3677 * @wiphy: the wiphy reporting the BSS 3721 * @wiphy: the wiphy reporting the BSS
3678 * @channel: The channel the frame was received on 3722 * @rx_channel: The channel the frame was received on
3679 * @scan_width: width of the control channel 3723 * @scan_width: width of the control channel
3680 * @bssid: the BSSID of the BSS 3724 * @bssid: the BSSID of the BSS
3681 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3725 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
@@ -3694,7 +3738,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3694 */ 3738 */
3695struct cfg80211_bss * __must_check 3739struct cfg80211_bss * __must_check
3696cfg80211_inform_bss_width(struct wiphy *wiphy, 3740cfg80211_inform_bss_width(struct wiphy *wiphy,
3697 struct ieee80211_channel *channel, 3741 struct ieee80211_channel *rx_channel,
3698 enum nl80211_bss_scan_width scan_width, 3742 enum nl80211_bss_scan_width scan_width,
3699 const u8 *bssid, u64 tsf, u16 capability, 3743 const u8 *bssid, u64 tsf, u16 capability,
3700 u16 beacon_interval, const u8 *ie, size_t ielen, 3744 u16 beacon_interval, const u8 *ie, size_t ielen,
@@ -3702,12 +3746,12 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
3702 3746
3703static inline struct cfg80211_bss * __must_check 3747static inline struct cfg80211_bss * __must_check
3704cfg80211_inform_bss(struct wiphy *wiphy, 3748cfg80211_inform_bss(struct wiphy *wiphy,
3705 struct ieee80211_channel *channel, 3749 struct ieee80211_channel *rx_channel,
3706 const u8 *bssid, u64 tsf, u16 capability, 3750 const u8 *bssid, u64 tsf, u16 capability,
3707 u16 beacon_interval, const u8 *ie, size_t ielen, 3751 u16 beacon_interval, const u8 *ie, size_t ielen,
3708 s32 signal, gfp_t gfp) 3752 s32 signal, gfp_t gfp)
3709{ 3753{
3710 return cfg80211_inform_bss_width(wiphy, channel, 3754 return cfg80211_inform_bss_width(wiphy, rx_channel,
3711 NL80211_BSS_CHAN_WIDTH_20, 3755 NL80211_BSS_CHAN_WIDTH_20,
3712 bssid, tsf, capability, 3756 bssid, tsf, capability,
3713 beacon_interval, ie, ielen, signal, 3757 beacon_interval, ie, ielen, signal,
@@ -3876,6 +3920,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3876 * 3920 *
3877 * @dev: network device 3921 * @dev: network device
3878 * @bssid: the BSSID of the IBSS joined 3922 * @bssid: the BSSID of the IBSS joined
3923 * @channel: the channel of the IBSS joined
3879 * @gfp: allocation flags 3924 * @gfp: allocation flags
3880 * 3925 *
3881 * This function notifies cfg80211 that the device joined an IBSS or 3926 * This function notifies cfg80211 that the device joined an IBSS or
@@ -3885,7 +3930,8 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3885 * with the locally generated beacon -- this guarantees that there is 3930 * with the locally generated beacon -- this guarantees that there is
3886 * always a scan result for this IBSS. cfg80211 will handle the rest. 3931 * always a scan result for this IBSS. cfg80211 will handle the rest.
3887 */ 3932 */
3888void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 3933void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
3934 struct ieee80211_channel *channel, gfp_t gfp);
3889 3935
3890/** 3936/**
3891 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 3937 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 37a0e24adbe7..a28f4e0f6251 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -69,6 +69,19 @@ static inline __wsum csum_sub(__wsum csum, __wsum addend)
69 return csum_add(csum, ~addend); 69 return csum_add(csum, ~addend);
70} 70}
71 71
72static inline __sum16 csum16_add(__sum16 csum, __be16 addend)
73{
74 u16 res = (__force u16)csum;
75
76 res += (__force u16)addend;
77 return (__force __sum16)(res + (res < (__force u16)addend));
78}
79
80static inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
81{
82 return csum16_add(csum, ~addend);
83}
84
72static inline __wsum 85static inline __wsum
73csum_block_add(__wsum csum, __wsum csum2, int offset) 86csum_block_add(__wsum csum, __wsum csum2, int offset)
74{ 87{
@@ -112,9 +125,15 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
112 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum))); 125 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
113} 126}
114 127
115static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 128/* Implements RFC 1624 (Incremental Internet Checksum)
129 * 3. Discussion states :
130 * HC' = ~(~HC + ~m + m')
131 * m : old value of a 16bit field
132 * m' : new value of a 16bit field
133 */
134static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
116{ 135{
117 csum_replace4(sum, (__force __be32)from, (__force __be32)to); 136 *sum = ~csum16_add(csum16_sub(~(*sum), old), new);
118} 137}
119 138
120struct sk_buff; 139struct sk_buff;
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 9cf2d5ef38d9..c15d39456e14 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -34,7 +34,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
34 return 0; 34 return 0;
35 35
36 rcu_read_lock(); 36 rcu_read_lock();
37 classid = container_of(task_css(p, net_cls_subsys_id), 37 classid = container_of(task_css(p, net_cls_cgrp_id),
38 struct cgroup_cls_state, css)->classid; 38 struct cgroup_cls_state, css)->classid;
39 rcu_read_unlock(); 39 rcu_read_unlock();
40 40
diff --git a/include/net/dst.h b/include/net/dst.h
index 77eb53fabfb0..71c60f42be48 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -45,7 +45,7 @@ struct dst_entry {
45 void *__pad1; 45 void *__pad1;
46#endif 46#endif
47 int (*input)(struct sk_buff *); 47 int (*input)(struct sk_buff *);
48 int (*output)(struct sk_buff *); 48 int (*output)(struct sock *sk, struct sk_buff *skb);
49 49
50 unsigned short flags; 50 unsigned short flags;
51#define DST_HOST 0x0001 51#define DST_HOST 0x0001
@@ -54,10 +54,9 @@ struct dst_entry {
54#define DST_NOHASH 0x0008 54#define DST_NOHASH 0x0008
55#define DST_NOCACHE 0x0010 55#define DST_NOCACHE 0x0010
56#define DST_NOCOUNT 0x0020 56#define DST_NOCOUNT 0x0020
57#define DST_NOPEER 0x0040 57#define DST_FAKE_RTABLE 0x0040
58#define DST_FAKE_RTABLE 0x0080 58#define DST_XFRM_TUNNEL 0x0080
59#define DST_XFRM_TUNNEL 0x0100 59#define DST_XFRM_QUEUE 0x0100
60#define DST_XFRM_QUEUE 0x0200
61 60
62 unsigned short pending_confirm; 61 unsigned short pending_confirm;
63 62
@@ -109,9 +108,11 @@ struct dst_entry {
109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 108u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[]; 109extern const u32 dst_default_metrics[];
111 110
112#define DST_METRICS_READ_ONLY 0x1UL 111#define DST_METRICS_READ_ONLY 0x1UL
112#define DST_METRICS_FORCE_OVERWRITE 0x2UL
113#define DST_METRICS_FLAGS 0x3UL
113#define __DST_METRICS_PTR(Y) \ 114#define __DST_METRICS_PTR(Y) \
114 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY)) 115 ((u32 *)((Y) & ~DST_METRICS_FLAGS))
115#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics) 116#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
116 117
117static inline bool dst_metrics_read_only(const struct dst_entry *dst) 118static inline bool dst_metrics_read_only(const struct dst_entry *dst)
@@ -119,6 +120,11 @@ static inline bool dst_metrics_read_only(const struct dst_entry *dst)
119 return dst->_metrics & DST_METRICS_READ_ONLY; 120 return dst->_metrics & DST_METRICS_READ_ONLY;
120} 121}
121 122
123static inline void dst_metrics_set_force_overwrite(struct dst_entry *dst)
124{
125 dst->_metrics |= DST_METRICS_FORCE_OVERWRITE;
126}
127
122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); 128void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123 129
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst) 130static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
@@ -361,7 +367,11 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
361 return child; 367 return child;
362} 368}
363 369
364int dst_discard(struct sk_buff *skb); 370int dst_discard_sk(struct sock *sk, struct sk_buff *skb);
371static inline int dst_discard(struct sk_buff *skb)
372{
373 return dst_discard_sk(skb->sk, skb);
374}
365void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref, 375void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
366 int initial_obsolete, unsigned short flags); 376 int initial_obsolete, unsigned short flags);
367void __dst_free(struct dst_entry *dst); 377void __dst_free(struct dst_entry *dst);
@@ -443,9 +453,13 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
443} 453}
444 454
445/* Output packet to network from transport. */ 455/* Output packet to network from transport. */
456static inline int dst_output_sk(struct sock *sk, struct sk_buff *skb)
457{
458 return skb_dst(skb)->output(sk, skb);
459}
446static inline int dst_output(struct sk_buff *skb) 460static inline int dst_output(struct sk_buff *skb)
447{ 461{
448 return skb_dst(skb)->output(skb); 462 return dst_output_sk(skb->sk, skb);
449} 463}
450 464
451/* Input packet from network to transport. */ 465/* Input packet from network to transport. */
diff --git a/include/net/flow.h b/include/net/flow.h
index d23e7fa2042e..8109a159d1b3 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -11,6 +11,14 @@
11#include <linux/in6.h> 11#include <linux/in6.h>
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13 13
14/*
15 * ifindex generation is per-net namespace, and loopback is
16 * always the 1st device in ns (see net_dev_init), thus any
17 * loopback device should get ifindex 1
18 */
19
20#define LOOPBACK_IFINDEX 1
21
14struct flowi_common { 22struct flowi_common {
15 int flowic_oif; 23 int flowic_oif;
16 int flowic_iif; 24 int flowic_iif;
@@ -80,7 +88,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
80 __be16 dport, __be16 sport) 88 __be16 dport, __be16 sport)
81{ 89{
82 fl4->flowi4_oif = oif; 90 fl4->flowi4_oif = oif;
83 fl4->flowi4_iif = 0; 91 fl4->flowi4_iif = LOOPBACK_IFINDEX;
84 fl4->flowi4_mark = mark; 92 fl4->flowi4_mark = mark;
85 fl4->flowi4_tos = tos; 93 fl4->flowi4_tos = tos;
86 fl4->flowi4_scope = scope; 94 fl4->flowi4_scope = scope;
@@ -218,9 +226,11 @@ struct flow_cache_object *flow_cache_lookup(struct net *net,
218 const struct flowi *key, u16 family, 226 const struct flowi *key, u16 family,
219 u8 dir, flow_resolve_t resolver, 227 u8 dir, flow_resolve_t resolver,
220 void *ctx); 228 void *ctx);
229int flow_cache_init(struct net *net);
230void flow_cache_fini(struct net *net);
221 231
222void flow_cache_flush(void); 232void flow_cache_flush(struct net *net);
223void flow_cache_flush_deferred(void); 233void flow_cache_flush_deferred(struct net *net);
224extern atomic_t flow_cache_genid; 234extern atomic_t flow_cache_genid;
225 235
226#endif 236#endif
diff --git a/include/net/flowcache.h b/include/net/flowcache.h
new file mode 100644
index 000000000000..c8f665ec6e0d
--- /dev/null
+++ b/include/net/flowcache.h
@@ -0,0 +1,25 @@
1#ifndef _NET_FLOWCACHE_H
2#define _NET_FLOWCACHE_H
3
4#include <linux/interrupt.h>
5#include <linux/types.h>
6#include <linux/timer.h>
7#include <linux/notifier.h>
8
9struct flow_cache_percpu {
10 struct hlist_head *hash_table;
11 int hash_count;
12 u32 hash_rnd;
13 int hash_rnd_recalc;
14 struct tasklet_struct flush_tasklet;
15};
16
17struct flow_cache {
18 u32 hash_shift;
19 struct flow_cache_percpu __percpu *percpu;
20 struct notifier_block hotcpu_notifier;
21 int low_watermark;
22 int high_watermark;
23 struct timer_list rnd_timer;
24};
25#endif /* _NET_FLOWCACHE_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 8b5b71433297..b0fd9476c538 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -316,6 +316,10 @@ enum ieee80211_radiotap_type {
316#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10 316#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10
317#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20 317#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20
318 318
319#define IEEE80211_RADIOTAP_CODING_LDPC_USER0 0x01
320#define IEEE80211_RADIOTAP_CODING_LDPC_USER1 0x02
321#define IEEE80211_RADIOTAP_CODING_LDPC_USER2 0x04
322#define IEEE80211_RADIOTAP_CODING_LDPC_USER3 0x08
319 323
320/* helpers */ 324/* helpers */
321static inline int ieee80211_get_radiotap_len(unsigned char *data) 325static inline int ieee80211_get_radiotap_len(unsigned char *data)
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index ee59f8b188dd..c7ae0ac528dc 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -42,22 +42,42 @@
42 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \ 42 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
43 } while (0) 43 } while (0)
44 44
45#define IEEE802154_FC_SECEN (1 << 3) 45#define IEEE802154_FC_SECEN_SHIFT 3
46#define IEEE802154_FC_FRPEND (1 << 4) 46#define IEEE802154_FC_SECEN (1 << IEEE802154_FC_SECEN_SHIFT)
47#define IEEE802154_FC_ACK_REQ (1 << 5) 47#define IEEE802154_FC_FRPEND_SHIFT 4
48#define IEEE802154_FC_INTRA_PAN (1 << 6) 48#define IEEE802154_FC_FRPEND (1 << IEEE802154_FC_FRPEND_SHIFT)
49#define IEEE802154_FC_ACK_REQ_SHIFT 5
50#define IEEE802154_FC_ACK_REQ (1 << IEEE802154_FC_ACK_REQ_SHIFT)
51#define IEEE802154_FC_INTRA_PAN_SHIFT 6
52#define IEEE802154_FC_INTRA_PAN (1 << IEEE802154_FC_INTRA_PAN_SHIFT)
49 53
50#define IEEE802154_FC_SAMODE_SHIFT 14 54#define IEEE802154_FC_SAMODE_SHIFT 14
51#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT) 55#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
52#define IEEE802154_FC_DAMODE_SHIFT 10 56#define IEEE802154_FC_DAMODE_SHIFT 10
53#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT) 57#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
54 58
59#define IEEE802154_FC_VERSION_SHIFT 12
60#define IEEE802154_FC_VERSION_MASK (3 << IEEE802154_FC_VERSION_SHIFT)
61#define IEEE802154_FC_VERSION(x) ((x & IEEE802154_FC_VERSION_MASK) >> IEEE802154_FC_VERSION_SHIFT)
62
55#define IEEE802154_FC_SAMODE(x) \ 63#define IEEE802154_FC_SAMODE(x) \
56 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT) 64 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
57 65
58#define IEEE802154_FC_DAMODE(x) \ 66#define IEEE802154_FC_DAMODE(x) \
59 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT) 67 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
60 68
69#define IEEE802154_SCF_SECLEVEL_MASK 7
70#define IEEE802154_SCF_SECLEVEL_SHIFT 0
71#define IEEE802154_SCF_SECLEVEL(x) (x & IEEE802154_SCF_SECLEVEL_MASK)
72#define IEEE802154_SCF_KEY_ID_MODE_SHIFT 3
73#define IEEE802154_SCF_KEY_ID_MODE_MASK (3 << IEEE802154_SCF_KEY_ID_MODE_SHIFT)
74#define IEEE802154_SCF_KEY_ID_MODE(x) \
75 ((x & IEEE802154_SCF_KEY_ID_MODE_MASK) >> IEEE802154_SCF_KEY_ID_MODE_SHIFT)
76
77#define IEEE802154_SCF_KEY_IMPLICIT 0
78#define IEEE802154_SCF_KEY_INDEX 1
79#define IEEE802154_SCF_KEY_SHORT_INDEX 2
80#define IEEE802154_SCF_KEY_HW_INDEX 3
61 81
62/* MAC footer size */ 82/* MAC footer size */
63#define IEEE802154_MFR_SIZE 2 /* 2 octets */ 83#define IEEE802154_MFR_SIZE 2 /* 2 octets */
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 8196d5d40359..5a719ca892f4 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -28,6 +28,164 @@
28#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
29 29
30#include <net/af_ieee802154.h> 30#include <net/af_ieee802154.h>
31#include <linux/netdevice.h>
32#include <linux/skbuff.h>
33
34struct ieee802154_sechdr {
35#if defined(__LITTLE_ENDIAN_BITFIELD)
36 u8 level:3,
37 key_id_mode:2,
38 reserved:3;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 u8 reserved:3,
41 key_id_mode:2,
42 level:3;
43#else
44#error "Please fix <asm/byteorder.h>"
45#endif
46 u8 key_id;
47 __le32 frame_counter;
48 union {
49 __le32 short_src;
50 __le64 extended_src;
51 };
52};
53
54struct ieee802154_addr {
55 u8 mode;
56 __le16 pan_id;
57 union {
58 __le16 short_addr;
59 __le64 extended_addr;
60 };
61};
62
63struct ieee802154_hdr_fc {
64#if defined(__LITTLE_ENDIAN_BITFIELD)
65 u16 type:3,
66 security_enabled:1,
67 frame_pending:1,
68 ack_request:1,
69 intra_pan:1,
70 reserved:3,
71 dest_addr_mode:2,
72 version:2,
73 source_addr_mode:2;
74#elif defined(__BIG_ENDIAN_BITFIELD)
75 u16 reserved:1,
76 intra_pan:1,
77 ack_request:1,
78 frame_pending:1,
79 security_enabled:1,
80 type:3,
81 source_addr_mode:2,
82 version:2,
83 dest_addr_mode:2,
84 reserved2:2;
85#else
86#error "Please fix <asm/byteorder.h>"
87#endif
88};
89
90struct ieee802154_hdr {
91 struct ieee802154_hdr_fc fc;
92 u8 seq;
93 struct ieee802154_addr source;
94 struct ieee802154_addr dest;
95 struct ieee802154_sechdr sec;
96};
97
98/* pushes hdr onto the skb. fields of hdr->fc that can be calculated from
99 * the contents of hdr will be, and the actual value of those bits in
100 * hdr->fc will be ignored. this includes the INTRA_PAN bit and the frame
101 * version, if SECEN is set.
102 */
103int ieee802154_hdr_push(struct sk_buff *skb, const struct ieee802154_hdr *hdr);
104
105/* pulls the entire 802.15.4 header off of the skb, including the security
106 * header, and performs pan id decompression
107 */
108int ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr);
109
110/* parses the frame control, sequence number of address fields in a given skb
111 * and stores them into hdr, performing pan id decompression and length checks
112 * to be suitable for use in header_ops.parse
113 */
114int ieee802154_hdr_peek_addrs(const struct sk_buff *skb,
115 struct ieee802154_hdr *hdr);
116
117static inline int ieee802154_hdr_length(struct sk_buff *skb)
118{
119 struct ieee802154_hdr hdr;
120 int len = ieee802154_hdr_pull(skb, &hdr);
121
122 if (len > 0)
123 skb_push(skb, len);
124
125 return len;
126}
127
128static inline bool ieee802154_addr_equal(const struct ieee802154_addr *a1,
129 const struct ieee802154_addr *a2)
130{
131 if (a1->pan_id != a2->pan_id || a1->mode != a2->mode)
132 return false;
133
134 if ((a1->mode == IEEE802154_ADDR_LONG &&
135 a1->extended_addr != a2->extended_addr) ||
136 (a1->mode == IEEE802154_ADDR_SHORT &&
137 a1->short_addr != a2->short_addr))
138 return false;
139
140 return true;
141}
142
143static inline __le64 ieee802154_devaddr_from_raw(const void *raw)
144{
145 u64 temp;
146
147 memcpy(&temp, raw, IEEE802154_ADDR_LEN);
148 return (__force __le64)swab64(temp);
149}
150
151static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr)
152{
153 u64 temp = swab64((__force u64)addr);
154
155 memcpy(raw, &temp, IEEE802154_ADDR_LEN);
156}
157
158static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a,
159 const struct ieee802154_addr_sa *sa)
160{
161 a->mode = sa->addr_type;
162 a->pan_id = cpu_to_le16(sa->pan_id);
163
164 switch (a->mode) {
165 case IEEE802154_ADDR_SHORT:
166 a->short_addr = cpu_to_le16(sa->short_addr);
167 break;
168 case IEEE802154_ADDR_LONG:
169 a->extended_addr = ieee802154_devaddr_from_raw(sa->hwaddr);
170 break;
171 }
172}
173
174static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
175 const struct ieee802154_addr *a)
176{
177 sa->addr_type = a->mode;
178 sa->pan_id = le16_to_cpu(a->pan_id);
179
180 switch (a->mode) {
181 case IEEE802154_ADDR_SHORT:
182 sa->short_addr = le16_to_cpu(a->short_addr);
183 break;
184 case IEEE802154_ADDR_LONG:
185 ieee802154_devaddr_to_raw(sa->hwaddr, a->extended_addr);
186 break;
187 }
188}
31 189
32/* 190/*
33 * A control block of skb passed between the ARPHRD_IEEE802154 device 191 * A control block of skb passed between the ARPHRD_IEEE802154 device
@@ -35,10 +193,10 @@
35 */ 193 */
36struct ieee802154_mac_cb { 194struct ieee802154_mac_cb {
37 u8 lqi; 195 u8 lqi;
38 struct ieee802154_addr sa;
39 struct ieee802154_addr da;
40 u8 flags; 196 u8 flags;
41 u8 seq; 197 u8 seq;
198 struct ieee802154_addr source;
199 struct ieee802154_addr dest;
42}; 200};
43 201
44static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb) 202static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
@@ -50,23 +208,17 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
50 208
51#define MAC_CB_FLAG_ACKREQ (1 << 3) 209#define MAC_CB_FLAG_ACKREQ (1 << 3)
52#define MAC_CB_FLAG_SECEN (1 << 4) 210#define MAC_CB_FLAG_SECEN (1 << 4)
53#define MAC_CB_FLAG_INTRAPAN (1 << 5)
54 211
55static inline int mac_cb_is_ackreq(struct sk_buff *skb) 212static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
56{ 213{
57 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; 214 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
58} 215}
59 216
60static inline int mac_cb_is_secen(struct sk_buff *skb) 217static inline bool mac_cb_is_secen(struct sk_buff *skb)
61{ 218{
62 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN; 219 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
63} 220}
64 221
65static inline int mac_cb_is_intrapan(struct sk_buff *skb)
66{
67 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
68}
69
70static inline int mac_cb_type(struct sk_buff *skb) 222static inline int mac_cb_type(struct sk_buff *skb)
71{ 223{
72 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; 224 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
@@ -77,6 +229,18 @@ static inline int mac_cb_type(struct sk_buff *skb)
77#define IEEE802154_MAC_SCAN_PASSIVE 2 229#define IEEE802154_MAC_SCAN_PASSIVE 2
78#define IEEE802154_MAC_SCAN_ORPHAN 3 230#define IEEE802154_MAC_SCAN_ORPHAN 3
79 231
232struct ieee802154_mac_params {
233 s8 transmit_power;
234 u8 min_be;
235 u8 max_be;
236 u8 csma_retries;
237 s8 frame_retries;
238
239 bool lbt;
240 u8 cca_mode;
241 s32 cca_ed_level;
242};
243
80struct wpan_phy; 244struct wpan_phy;
81/* 245/*
82 * This should be located at net_device->ml_priv 246 * This should be located at net_device->ml_priv
@@ -92,7 +256,7 @@ struct ieee802154_mlme_ops {
92 u8 channel, u8 page, u8 cap); 256 u8 channel, u8 page, u8 cap);
93 int (*assoc_resp)(struct net_device *dev, 257 int (*assoc_resp)(struct net_device *dev,
94 struct ieee802154_addr *addr, 258 struct ieee802154_addr *addr,
95 u16 short_addr, u8 status); 259 __le16 short_addr, u8 status);
96 int (*disassoc_req)(struct net_device *dev, 260 int (*disassoc_req)(struct net_device *dev,
97 struct ieee802154_addr *addr, 261 struct ieee802154_addr *addr,
98 u8 reason); 262 u8 reason);
@@ -103,6 +267,11 @@ struct ieee802154_mlme_ops {
103 int (*scan_req)(struct net_device *dev, 267 int (*scan_req)(struct net_device *dev,
104 u8 type, u32 channels, u8 page, u8 duration); 268 u8 type, u32 channels, u8 page, u8 duration);
105 269
270 int (*set_mac_params)(struct net_device *dev,
271 const struct ieee802154_mac_params *params);
272 void (*get_mac_params)(struct net_device *dev,
273 struct ieee802154_mac_params *params);
274
106 /* The fields below are required. */ 275 /* The fields below are required. */
107 276
108 struct wpan_phy *(*get_phy)(const struct net_device *dev); 277 struct wpan_phy *(*get_phy)(const struct net_device *dev);
@@ -111,8 +280,8 @@ struct ieee802154_mlme_ops {
111 * FIXME: these should become the part of PIB/MIB interface. 280 * FIXME: these should become the part of PIB/MIB interface.
112 * However we still don't have IB interface of any kind 281 * However we still don't have IB interface of any kind
113 */ 282 */
114 u16 (*get_pan_id)(const struct net_device *dev); 283 __le16 (*get_pan_id)(const struct net_device *dev);
115 u16 (*get_short_addr)(const struct net_device *dev); 284 __le16 (*get_short_addr)(const struct net_device *dev);
116 u8 (*get_dsn)(const struct net_device *dev); 285 u8 (*get_dsn)(const struct net_device *dev);
117}; 286};
118 287
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index f981ba7adeed..74af137304be 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -40,7 +40,7 @@ void inet6_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
40 40
41void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 41void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
42 42
43int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); 43int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
44 44
45struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu); 45struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu);
46#endif /* _INET6_CONNECTION_SOCK_H */ 46#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index c55aeed41ace..7a4313887568 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -36,7 +36,7 @@ struct tcp_congestion_ops;
36 * (i.e. things that depend on the address family) 36 * (i.e. things that depend on the address family)
37 */ 37 */
38struct inet_connection_sock_af_ops { 38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, struct flowi *fl); 39 int (*queue_xmit)(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
40 void (*send_check)(struct sock *sk, struct sk_buff *skb); 40 void (*send_check)(struct sock *sk, struct sk_buff *skb);
41 int (*rebuild_header)(struct sock *sk); 41 int (*rebuild_header)(struct sock *sk);
42 void (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb); 42 void (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb);
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 6efe73c79c52..058271bde27a 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -177,16 +177,9 @@ static inline void inet_peer_refcheck(const struct inet_peer *p)
177/* can be called with or without local BH being disabled */ 177/* can be called with or without local BH being disabled */
178static inline int inet_getid(struct inet_peer *p, int more) 178static inline int inet_getid(struct inet_peer *p, int more)
179{ 179{
180 int old, new;
181 more++; 180 more++;
182 inet_peer_refcheck(p); 181 inet_peer_refcheck(p);
183 do { 182 return atomic_add_return(more, &p->ip_id_count) - more;
184 old = atomic_read(&p->ip_id_count);
185 new = old + more;
186 if (!new)
187 new = 1;
188 } while (atomic_cmpxchg(&p->ip_id_count, old, new) != old);
189 return new;
190} 183}
191 184
192#endif /* _NET_INETPEER_H */ 185#endif /* _NET_INETPEER_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index 23be0fd37937..3ec2b0fb9d83 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -104,14 +104,19 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
104 struct net_device *orig_dev); 104 struct net_device *orig_dev);
105int ip_local_deliver(struct sk_buff *skb); 105int ip_local_deliver(struct sk_buff *skb);
106int ip_mr_input(struct sk_buff *skb); 106int ip_mr_input(struct sk_buff *skb);
107int ip_output(struct sk_buff *skb); 107int ip_output(struct sock *sk, struct sk_buff *skb);
108int ip_mc_output(struct sk_buff *skb); 108int ip_mc_output(struct sock *sk, struct sk_buff *skb);
109int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 109int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
110int ip_do_nat(struct sk_buff *skb); 110int ip_do_nat(struct sk_buff *skb);
111void ip_send_check(struct iphdr *ip); 111void ip_send_check(struct iphdr *ip);
112int __ip_local_out(struct sk_buff *skb); 112int __ip_local_out(struct sk_buff *skb);
113int ip_local_out(struct sk_buff *skb); 113int ip_local_out_sk(struct sock *sk, struct sk_buff *skb);
114int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); 114static inline int ip_local_out(struct sk_buff *skb)
115{
116 return ip_local_out_sk(skb->sk, skb);
117}
118
119int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
115void ip_init(void); 120void ip_init(void);
116int ip_append_data(struct sock *sk, struct flowi4 *fl4, 121int ip_append_data(struct sock *sk, struct flowi4 *fl4,
117 int getfrag(void *from, char *to, int offset, int len, 122 int getfrag(void *from, char *to, int offset, int len,
@@ -187,6 +192,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
187#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 192#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
188#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 193#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
189#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 194#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
195#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
190#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 196#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
191#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 197#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
192 198
@@ -266,7 +272,8 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
266 272
267static inline bool ip_sk_accept_pmtu(const struct sock *sk) 273static inline bool ip_sk_accept_pmtu(const struct sock *sk)
268{ 274{
269 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE; 275 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE &&
276 inet_sk(sk)->pmtudisc != IP_PMTUDISC_OMIT;
270} 277}
271 278
272static inline bool ip_sk_use_pmtu(const struct sock *sk) 279static inline bool ip_sk_use_pmtu(const struct sock *sk)
@@ -274,6 +281,12 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk)
274 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; 281 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
275} 282}
276 283
284static inline bool ip_sk_local_df(const struct sock *sk)
285{
286 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO ||
287 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT;
288}
289
277static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, 290static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
278 bool forwarding) 291 bool forwarding)
279{ 292{
@@ -489,7 +502,8 @@ int ip_options_rcv_srr(struct sk_buff *skb);
489 502
490void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb); 503void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
491void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 504void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
492int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc); 505int ip_cmsg_send(struct net *net, struct msghdr *msg,
506 struct ipcm_cookie *ipc, bool allow_ipv6);
493int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, 507int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
494 unsigned int optlen); 508 unsigned int optlen);
495int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, 509int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index aca0c2709fd6..9bcb220bd4ad 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -284,7 +284,8 @@ struct fib6_node *fib6_locate(struct fib6_node *root,
284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg), 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
285 void *arg); 285 void *arg);
286 286
287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info); 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info,
288 struct nlattr *mx, int mx_len);
288 289
289int fib6_del(struct rt6_info *rt, struct nl_info *info); 290int fib6_del(struct rt6_info *rt, struct nl_info *info);
290 291
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 017badb1aec7..216cecce65e9 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -32,6 +32,11 @@ struct route_info {
32#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 32#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
33#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 33#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
34 34
35/* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
36 * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
37 */
38#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
39
35/* 40/*
36 * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate 41 * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
37 * between IPV6_ADDR_PREFERENCES socket option values 42 * between IPV6_ADDR_PREFERENCES socket option values
@@ -51,6 +56,11 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
51 return (flags >> 3) & 7; 56 return (flags >> 3) & 7;
52} 57}
53 58
59static inline bool rt6_need_strict(const struct in6_addr *daddr)
60{
61 return ipv6_addr_type(daddr) &
62 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
63}
54 64
55void ip6_route_input(struct sk_buff *skb); 65void ip6_route_input(struct sk_buff *skb);
56 66
@@ -117,6 +127,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg);
117void rt6_ifdown(struct net *net, struct net_device *dev); 127void rt6_ifdown(struct net *net, struct net_device *dev);
118void rt6_mtu_change(struct net_device *dev, unsigned int mtu); 128void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
119void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 129void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
130void rt6_clean_tohost(struct net *net, struct in6_addr *gateway);
120 131
121 132
122/* 133/*
@@ -171,7 +182,14 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
171 182
172static inline bool ip6_sk_accept_pmtu(const struct sock *sk) 183static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
173{ 184{
174 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE; 185 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE &&
186 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
187}
188
189static inline bool ip6_sk_local_df(const struct sock *sk)
190{
191 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
192 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
175} 193}
176 194
177static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt) 195static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt)
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index e77c10405d51..a4daf9eb8562 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -153,7 +153,7 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
153} 153}
154 154
155int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); 155int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
156int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, 156int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
157 __be32 src, __be32 dst, __u8 proto, 157 __be32 src, __be32 dst, __u8 proto,
158 __u8 tos, __u8 ttl, __be16 df, bool xnet); 158 __u8 tos, __u8 ttl, __be16 df, bool xnet);
159 159
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 5679d927562b..624a8a54806d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1204,7 +1204,7 @@ static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp)
1204/* put back the conn without restarting its timer */ 1204/* put back the conn without restarting its timer */
1205static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 1205static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1206{ 1206{
1207 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic();
1208 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1209} 1209}
1210void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
@@ -1408,7 +1408,7 @@ static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1408 1408
1409static inline void ip_vs_dest_put(struct ip_vs_dest *dest) 1409static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1410{ 1410{
1411 smp_mb__before_atomic_dec(); 1411 smp_mb__before_atomic();
1412 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1413} 1413}
1414 1414
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 4f541f11ce63..d640925bc454 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -731,7 +731,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net,
731 * skb processing functions 731 * skb processing functions
732 */ 732 */
733 733
734int ip6_output(struct sk_buff *skb); 734int ip6_output(struct sock *sk, struct sk_buff *skb);
735int ip6_forward(struct sk_buff *skb); 735int ip6_forward(struct sk_buff *skb);
736int ip6_input(struct sk_buff *skb); 736int ip6_input(struct sk_buff *skb);
737int ip6_mc_input(struct sk_buff *skb); 737int ip6_mc_input(struct sk_buff *skb);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f4ab2fb4d50c..8248e3909fdf 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -66,10 +66,6 @@
66 * 66 *
67 * Secondly, when the hardware handles fragmentation, the frame handed to 67 * Secondly, when the hardware handles fragmentation, the frame handed to
68 * the driver from mac80211 is the MSDU, not the MPDU. 68 * the driver from mac80211 is the MSDU, not the MPDU.
69 *
70 * Finally, for received frames, the driver is able to indicate that it has
71 * filled a radiotap header and put that in front of the frame; if it does
72 * not do so then mac80211 may add this under certain circumstances.
73 */ 69 */
74 70
75/** 71/**
@@ -701,11 +697,11 @@ struct ieee80211_tx_info {
701 } control; 697 } control;
702 struct { 698 struct {
703 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 699 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
704 int ack_signal; 700 s32 ack_signal;
705 u8 ampdu_ack_len; 701 u8 ampdu_ack_len;
706 u8 ampdu_len; 702 u8 ampdu_len;
707 u8 antenna; 703 u8 antenna;
708 /* 21 bytes free */ 704 void *status_driver_data[21 / sizeof(void *)];
709 } status; 705 } status;
710 struct { 706 struct {
711 struct ieee80211_tx_rate driver_rates[ 707 struct ieee80211_tx_rate driver_rates[
@@ -808,9 +804,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
808 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 804 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
809 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index 805 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
810 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 806 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
811 * @RX_FLAG_80MHZ: 80 MHz was used
812 * @RX_FLAG_80P80MHZ: 80+80 MHz was used
813 * @RX_FLAG_160MHZ: 160 MHz was used
814 * @RX_FLAG_SHORT_GI: Short guard interval was used 807 * @RX_FLAG_SHORT_GI: Short guard interval was used
815 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 808 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
816 * Valid only for data frames (mainly A-MPDU) 809 * Valid only for data frames (mainly A-MPDU)
@@ -830,6 +823,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
830 * on this subframe 823 * on this subframe
831 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC 824 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
832 * is stored in the @ampdu_delimiter_crc field) 825 * is stored in the @ampdu_delimiter_crc field)
826 * @RX_FLAG_LDPC: LDPC was used
833 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 827 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
834 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used 828 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
835 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used 829 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -866,9 +860,7 @@ enum mac80211_rx_flags {
866 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), 860 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20),
867 RX_FLAG_MACTIME_END = BIT(21), 861 RX_FLAG_MACTIME_END = BIT(21),
868 RX_FLAG_VHT = BIT(22), 862 RX_FLAG_VHT = BIT(22),
869 RX_FLAG_80MHZ = BIT(23), 863 RX_FLAG_LDPC = BIT(23),
870 RX_FLAG_80P80MHZ = BIT(24),
871 RX_FLAG_160MHZ = BIT(25),
872 RX_FLAG_STBC_MASK = BIT(26) | BIT(27), 864 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
873 RX_FLAG_10MHZ = BIT(28), 865 RX_FLAG_10MHZ = BIT(28),
874 RX_FLAG_5MHZ = BIT(29), 866 RX_FLAG_5MHZ = BIT(29),
@@ -878,6 +870,23 @@ enum mac80211_rx_flags {
878#define RX_FLAG_STBC_SHIFT 26 870#define RX_FLAG_STBC_SHIFT 26
879 871
880/** 872/**
873 * enum mac80211_rx_vht_flags - receive VHT flags
874 *
875 * These flags are used with the @vht_flag member of
876 * &struct ieee80211_rx_status.
877 * @RX_VHT_FLAG_80MHZ: 80 MHz was used
878 * @RX_VHT_FLAG_80P80MHZ: 80+80 MHz was used
879 * @RX_VHT_FLAG_160MHZ: 160 MHz was used
880 * @RX_VHT_FLAG_BF: packet was beamformed
881 */
882enum mac80211_rx_vht_flags {
883 RX_VHT_FLAG_80MHZ = BIT(0),
884 RX_VHT_FLAG_80P80MHZ = BIT(1),
885 RX_VHT_FLAG_160MHZ = BIT(2),
886 RX_VHT_FLAG_BF = BIT(3),
887};
888
889/**
881 * struct ieee80211_rx_status - receive status 890 * struct ieee80211_rx_status - receive status
882 * 891 *
883 * The low-level driver should provide this information (the subset 892 * The low-level driver should provide this information (the subset
@@ -902,26 +911,19 @@ enum mac80211_rx_flags {
902 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT) 911 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
903 * @vht_nss: number of streams (VHT only) 912 * @vht_nss: number of streams (VHT only)
904 * @flag: %RX_FLAG_* 913 * @flag: %RX_FLAG_*
914 * @vht_flag: %RX_VHT_FLAG_*
905 * @rx_flags: internal RX flags for mac80211 915 * @rx_flags: internal RX flags for mac80211
906 * @ampdu_reference: A-MPDU reference number, must be a different value for 916 * @ampdu_reference: A-MPDU reference number, must be a different value for
907 * each A-MPDU but the same for each subframe within one A-MPDU 917 * each A-MPDU but the same for each subframe within one A-MPDU
908 * @ampdu_delimiter_crc: A-MPDU delimiter CRC 918 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
909 * @vendor_radiotap_bitmap: radiotap vendor namespace presence bitmap
910 * @vendor_radiotap_len: radiotap vendor namespace length
911 * @vendor_radiotap_align: radiotap vendor namespace alignment. Note
912 * that the actual data must be at the start of the SKB data
913 * already.
914 * @vendor_radiotap_oui: radiotap vendor namespace OUI
915 * @vendor_radiotap_subns: radiotap vendor sub namespace
916 */ 919 */
917struct ieee80211_rx_status { 920struct ieee80211_rx_status {
918 u64 mactime; 921 u64 mactime;
919 u32 device_timestamp; 922 u32 device_timestamp;
920 u32 ampdu_reference; 923 u32 ampdu_reference;
921 u32 flag; 924 u32 flag;
922 u32 vendor_radiotap_bitmap;
923 u16 vendor_radiotap_len;
924 u16 freq; 925 u16 freq;
926 u8 vht_flag;
925 u8 rate_idx; 927 u8 rate_idx;
926 u8 vht_nss; 928 u8 vht_nss;
927 u8 rx_flags; 929 u8 rx_flags;
@@ -931,9 +933,6 @@ struct ieee80211_rx_status {
931 u8 chains; 933 u8 chains;
932 s8 chain_signal[IEEE80211_MAX_CHAINS]; 934 s8 chain_signal[IEEE80211_MAX_CHAINS];
933 u8 ampdu_delimiter_crc; 935 u8 ampdu_delimiter_crc;
934 u8 vendor_radiotap_align;
935 u8 vendor_radiotap_oui[3];
936 u8 vendor_radiotap_subns;
937}; 936};
938 937
939/** 938/**
@@ -1506,8 +1505,6 @@ struct ieee80211_tx_control {
1506 * @IEEE80211_HW_CONNECTION_MONITOR: 1505 * @IEEE80211_HW_CONNECTION_MONITOR:
1507 * The hardware performs its own connection monitoring, including 1506 * The hardware performs its own connection monitoring, including
1508 * periodic keep-alives to the AP and probing the AP on beacon loss. 1507 * periodic keep-alives to the AP and probing the AP on beacon loss.
1509 * When this flag is set, signaling beacon-loss will cause an immediate
1510 * change to disassociated state.
1511 * 1508 *
1512 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC: 1509 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
1513 * This device needs to get data from beacon before association (i.e. 1510 * This device needs to get data from beacon before association (i.e.
@@ -1643,10 +1640,6 @@ enum ieee80211_hw_flags {
1643 * the hw can report back. 1640 * the hw can report back.
1644 * @max_rate_tries: maximum number of tries for each stage 1641 * @max_rate_tries: maximum number of tries for each stage
1645 * 1642 *
1646 * @napi_weight: weight used for NAPI polling. You must specify an
1647 * appropriate value here if a napi_poll operation is provided
1648 * by your driver.
1649 *
1650 * @max_rx_aggregation_subframes: maximum buffer size (number of 1643 * @max_rx_aggregation_subframes: maximum buffer size (number of
1651 * sub-frames) to be used for A-MPDU block ack receiver 1644 * sub-frames) to be used for A-MPDU block ack receiver
1652 * aggregation. 1645 * aggregation.
@@ -1700,7 +1693,6 @@ struct ieee80211_hw {
1700 int vif_data_size; 1693 int vif_data_size;
1701 int sta_data_size; 1694 int sta_data_size;
1702 int chanctx_data_size; 1695 int chanctx_data_size;
1703 int napi_weight;
1704 u16 queues; 1696 u16 queues;
1705 u16 max_listen_interval; 1697 u16 max_listen_interval;
1706 s8 max_signal; 1698 s8 max_signal;
@@ -1895,7 +1887,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1895 * 1887 *
1896 * Driver informs U-APSD client support by enabling 1888 * Driver informs U-APSD client support by enabling
1897 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the 1889 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1898 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS 1890 * uapsd parameter in conf_tx() operation. Hardware needs to send the QoS
1899 * Nullfunc frames and stay awake until the service period has ended. To 1891 * Nullfunc frames and stay awake until the service period has ended. To
1900 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames 1892 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
1901 * from that AC are transmitted with powersave enabled. 1893 * from that AC are transmitted with powersave enabled.
@@ -2101,7 +2093,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
2101 * with the number of frames to be released and which TIDs they are 2093 * with the number of frames to be released and which TIDs they are
2102 * to come from. In this case, the driver is responsible for setting 2094 * to come from. In this case, the driver is responsible for setting
2103 * the EOSP (for uAPSD) and MORE_DATA bits in the released frames, 2095 * the EOSP (for uAPSD) and MORE_DATA bits in the released frames,
2104 * to help the @more_data paramter is passed to tell the driver if 2096 * to help the @more_data parameter is passed to tell the driver if
2105 * there is more data on other TIDs -- the TIDs to release frames 2097 * there is more data on other TIDs -- the TIDs to release frames
2106 * from are ignored since mac80211 doesn't know how many frames the 2098 * from are ignored since mac80211 doesn't know how many frames the
2107 * buffers for those TIDs contain. 2099 * buffers for those TIDs contain.
@@ -2470,6 +2462,7 @@ enum ieee80211_roc_type {
2470 * This process will continue until sched_scan_stop is called. 2462 * This process will continue until sched_scan_stop is called.
2471 * 2463 *
2472 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. 2464 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
2465 * In this case, ieee80211_sched_scan_stopped() must not be called.
2473 * 2466 *
2474 * @sw_scan_start: Notifier function that is called just before a software scan 2467 * @sw_scan_start: Notifier function that is called just before a software scan
2475 * is started. Can be NULL, if the driver doesn't need this notification. 2468 * is started. Can be NULL, if the driver doesn't need this notification.
@@ -2623,8 +2616,6 @@ enum ieee80211_roc_type {
2623 * callback. They must then call ieee80211_chswitch_done() to indicate 2616 * callback. They must then call ieee80211_chswitch_done() to indicate
2624 * completion of the channel switch. 2617 * completion of the channel switch.
2625 * 2618 *
2626 * @napi_poll: Poll Rx queue for incoming data frames.
2627 *
2628 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2619 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2629 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2620 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2630 * reject TX/RX mask combinations they cannot support by returning -EINVAL 2621 * reject TX/RX mask combinations they cannot support by returning -EINVAL
@@ -2662,7 +2653,7 @@ enum ieee80211_roc_type {
2662 * parameters. In the case where the driver buffers some frames for 2653 * parameters. In the case where the driver buffers some frames for
2663 * sleeping stations mac80211 will use this callback to tell the driver 2654 * sleeping stations mac80211 will use this callback to tell the driver
2664 * to release some frames, either for PS-poll or uAPSD. 2655 * to release some frames, either for PS-poll or uAPSD.
2665 * Note that if the @more_data paramter is %false the driver must check 2656 * Note that if the @more_data parameter is %false the driver must check
2666 * if there are more frames on the given TIDs, and if there are more than 2657 * if there are more frames on the given TIDs, and if there are more than
2667 * the frames being released then it must still set the more-data bit in 2658 * the frames being released then it must still set the more-data bit in
2668 * the frame. If the @more_data parameter is %true, then of course the 2659 * the frame. If the @more_data parameter is %true, then of course the
@@ -2750,11 +2741,13 @@ enum ieee80211_roc_type {
2750 * @channel_switch_beacon: Starts a channel switch to a new channel. 2741 * @channel_switch_beacon: Starts a channel switch to a new channel.
2751 * Beacons are modified to include CSA or ECSA IEs before calling this 2742 * Beacons are modified to include CSA or ECSA IEs before calling this
2752 * function. The corresponding count fields in these IEs must be 2743 * function. The corresponding count fields in these IEs must be
2753 * decremented, and when they reach zero the driver must call 2744 * decremented, and when they reach 1 the driver must call
2754 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get() 2745 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
2755 * get the csa counter decremented by mac80211, but must check if it is 2746 * get the csa counter decremented by mac80211, but must check if it is
2756 * zero using ieee80211_csa_is_complete() after the beacon has been 2747 * 1 using ieee80211_csa_is_complete() after the beacon has been
2757 * transmitted and then call ieee80211_csa_finish(). 2748 * transmitted and then call ieee80211_csa_finish().
2749 * If the CSA count starts as zero or 1, this function will not be called,
2750 * since there won't be any time to beacon before the switch anyway.
2758 * 2751 *
2759 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all 2752 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
2760 * information in bss_conf is set up and the beacon can be retrieved. A 2753 * information in bss_conf is set up and the beacon can be retrieved. A
@@ -2817,7 +2810,7 @@ struct ieee80211_ops {
2817 struct ieee80211_vif *vif, 2810 struct ieee80211_vif *vif,
2818 struct cfg80211_sched_scan_request *req, 2811 struct cfg80211_sched_scan_request *req,
2819 struct ieee80211_sched_scan_ies *ies); 2812 struct ieee80211_sched_scan_ies *ies);
2820 void (*sched_scan_stop)(struct ieee80211_hw *hw, 2813 int (*sched_scan_stop)(struct ieee80211_hw *hw,
2821 struct ieee80211_vif *vif); 2814 struct ieee80211_vif *vif);
2822 void (*sw_scan_start)(struct ieee80211_hw *hw); 2815 void (*sw_scan_start)(struct ieee80211_hw *hw);
2823 void (*sw_scan_complete)(struct ieee80211_hw *hw); 2816 void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -2881,7 +2874,6 @@ struct ieee80211_ops {
2881 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); 2874 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
2882 void (*channel_switch)(struct ieee80211_hw *hw, 2875 void (*channel_switch)(struct ieee80211_hw *hw,
2883 struct ieee80211_channel_switch *ch_switch); 2876 struct ieee80211_channel_switch *ch_switch);
2884 int (*napi_poll)(struct ieee80211_hw *hw, int budget);
2885 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 2877 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
2886 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 2878 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
2887 2879
@@ -3163,21 +3155,21 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
3163 */ 3155 */
3164void ieee80211_restart_hw(struct ieee80211_hw *hw); 3156void ieee80211_restart_hw(struct ieee80211_hw *hw);
3165 3157
3166/** ieee80211_napi_schedule - schedule NAPI poll 3158/**
3167 * 3159 * ieee80211_napi_add - initialize mac80211 NAPI context
3168 * Use this function to schedule NAPI polling on a device. 3160 * @hw: the hardware to initialize the NAPI context on
3169 * 3161 * @napi: the NAPI context to initialize
3170 * @hw: the hardware to start polling 3162 * @napi_dev: dummy NAPI netdevice, here to not waste the space if the
3171 */ 3163 * driver doesn't use NAPI
3172void ieee80211_napi_schedule(struct ieee80211_hw *hw); 3164 * @poll: poll function
3173 3165 * @weight: default weight
3174/** ieee80211_napi_complete - complete NAPI polling
3175 *
3176 * Use this function to finish NAPI polling on a device.
3177 * 3166 *
3178 * @hw: the hardware to stop polling 3167 * See also netif_napi_add().
3179 */ 3168 */
3180void ieee80211_napi_complete(struct ieee80211_hw *hw); 3169void ieee80211_napi_add(struct ieee80211_hw *hw, struct napi_struct *napi,
3170 struct net_device *napi_dev,
3171 int (*poll)(struct napi_struct *, int),
3172 int weight);
3181 3173
3182/** 3174/**
3183 * ieee80211_rx - receive frame 3175 * ieee80211_rx - receive frame
@@ -3452,13 +3444,13 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3452 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3444 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3453 * 3445 *
3454 * After a channel switch announcement was scheduled and the counter in this 3446 * After a channel switch announcement was scheduled and the counter in this
3455 * announcement hit zero, this function must be called by the driver to 3447 * announcement hits 1, this function must be called by the driver to
3456 * notify mac80211 that the channel can be changed. 3448 * notify mac80211 that the channel can be changed.
3457 */ 3449 */
3458void ieee80211_csa_finish(struct ieee80211_vif *vif); 3450void ieee80211_csa_finish(struct ieee80211_vif *vif);
3459 3451
3460/** 3452/**
3461 * ieee80211_csa_is_complete - find out if counters reached zero 3453 * ieee80211_csa_is_complete - find out if counters reached 1
3462 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3454 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3463 * 3455 *
3464 * This function returns whether the channel switch counters reached zero. 3456 * This function returns whether the channel switch counters reached zero.
@@ -4451,7 +4443,6 @@ struct ieee80211_tx_rate_control {
4451}; 4443};
4452 4444
4453struct rate_control_ops { 4445struct rate_control_ops {
4454 struct module *module;
4455 const char *name; 4446 const char *name;
4456 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 4447 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
4457 void (*free)(void *priv); 4448 void (*free)(void *priv);
@@ -4553,8 +4544,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
4553 struct ieee80211_sta *pubsta, 4544 struct ieee80211_sta *pubsta,
4554 struct ieee80211_sta_rates *rates); 4545 struct ieee80211_sta_rates *rates);
4555 4546
4556int ieee80211_rate_control_register(struct rate_control_ops *ops); 4547int ieee80211_rate_control_register(const struct rate_control_ops *ops);
4557void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 4548void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
4558 4549
4559static inline bool 4550static inline bool
4560conf_is_ht20(struct ieee80211_conf *conf) 4551conf_is_ht20(struct ieee80211_conf *conf)
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 807d6b7a943f..a591053cae63 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -20,6 +20,7 @@
20#define NET_MAC802154_H 20#define NET_MAC802154_H
21 21
22#include <net/af_ieee802154.h> 22#include <net/af_ieee802154.h>
23#include <linux/skbuff.h>
23 24
24/* General MAC frame format: 25/* General MAC frame format:
25 * 2 bytes: Frame Control 26 * 2 bytes: Frame Control
@@ -50,7 +51,7 @@ struct ieee802154_hw_addr_filt {
50 * devices across independent networks. 51 * devices across independent networks.
51 */ 52 */
52 __le16 short_addr; 53 __le16 short_addr;
53 u8 ieee_addr[IEEE802154_ADDR_LEN]; 54 __le64 ieee_addr;
54 u8 pan_coord; 55 u8 pan_coord;
55}; 56};
56 57
@@ -113,6 +114,32 @@ struct ieee802154_dev {
113 * Set radio for listening on specific address. 114 * Set radio for listening on specific address.
114 * Set the device for listening on specified address. 115 * Set the device for listening on specified address.
115 * Returns either zero, or negative errno. 116 * Returns either zero, or negative errno.
117 *
118 * set_txpower:
119 * Set radio transmit power in dB. Called with pib_lock held.
120 * Returns either zero, or negative errno.
121 *
122 * set_lbt
123 * Enables or disables listen before talk on the device. Called with
124 * pib_lock held.
125 * Returns either zero, or negative errno.
126 *
127 * set_cca_mode
128 * Sets the CCA mode used by the device. Called with pib_lock held.
129 * Returns either zero, or negative errno.
130 *
131 * set_cca_ed_level
132 * Sets the CCA energy detection threshold in dBm. Called with pib_lock
133 * held.
134 * Returns either zero, or negative errno.
135 *
136 * set_csma_params
137 * Sets the CSMA parameter set for the PHY. Called with pib_lock held.
138 * Returns either zero, or negative errno.
139 *
140 * set_frame_retries
141 * Sets the retransmission attempt limit. Called with pib_lock held.
142 * Returns either zero, or negative errno.
116 */ 143 */
117struct ieee802154_ops { 144struct ieee802154_ops {
118 struct module *owner; 145 struct module *owner;
@@ -127,8 +154,16 @@ struct ieee802154_ops {
127 int (*set_hw_addr_filt)(struct ieee802154_dev *dev, 154 int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
128 struct ieee802154_hw_addr_filt *filt, 155 struct ieee802154_hw_addr_filt *filt,
129 unsigned long changed); 156 unsigned long changed);
130 int (*ieee_addr)(struct ieee802154_dev *dev, 157 int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr);
131 u8 addr[IEEE802154_ADDR_LEN]); 158 int (*set_txpower)(struct ieee802154_dev *dev, int db);
159 int (*set_lbt)(struct ieee802154_dev *dev, bool on);
160 int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode);
161 int (*set_cca_ed_level)(struct ieee802154_dev *dev,
162 s32 level);
163 int (*set_csma_params)(struct ieee802154_dev *dev,
164 u8 min_be, u8 max_be, u8 retries);
165 int (*set_frame_retries)(struct ieee802154_dev *dev,
166 s8 retries);
132}; 167};
133 168
134/* Basic interface to register ieee802154 device */ 169/* Basic interface to register ieee802154 device */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 991dcd94cbbf..5f9eb260990f 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -9,12 +9,14 @@
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/sysctl.h> 10#include <linux/sysctl.h>
11 11
12#include <net/flow.h>
12#include <net/netns/core.h> 13#include <net/netns/core.h>
13#include <net/netns/mib.h> 14#include <net/netns/mib.h>
14#include <net/netns/unix.h> 15#include <net/netns/unix.h>
15#include <net/netns/packet.h> 16#include <net/netns/packet.h>
16#include <net/netns/ipv4.h> 17#include <net/netns/ipv4.h>
17#include <net/netns/ipv6.h> 18#include <net/netns/ipv6.h>
19#include <net/netns/ieee802154_6lowpan.h>
18#include <net/netns/sctp.h> 20#include <net/netns/sctp.h>
19#include <net/netns/dccp.h> 21#include <net/netns/dccp.h>
20#include <net/netns/netfilter.h> 22#include <net/netns/netfilter.h>
@@ -90,6 +92,9 @@ struct net {
90#if IS_ENABLED(CONFIG_IPV6) 92#if IS_ENABLED(CONFIG_IPV6)
91 struct netns_ipv6 ipv6; 93 struct netns_ipv6 ipv6;
92#endif 94#endif
95#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
96 struct netns_ieee802154_lowpan ieee802154_lowpan;
97#endif
93#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE) 98#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
94 struct netns_sctp sctp; 99 struct netns_sctp sctp;
95#endif 100#endif
@@ -127,14 +132,6 @@ struct net {
127 atomic_t fnhe_genid; 132 atomic_t fnhe_genid;
128}; 133};
129 134
130/*
131 * ifindex generation is per-net namespace, and loopback is
132 * always the 1st device in ns (see net_dev_init), thus any
133 * loopback device should get ifindex 1
134 */
135
136#define LOOPBACK_IFINDEX 1
137
138#include <linux/seq_file_net.h> 135#include <linux/seq_file_net.h>
139 136
140/* Init's network namespace */ 137/* Init's network namespace */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index b2ac6246b7e0..37252f71a380 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -73,10 +73,17 @@ struct nf_conn_help {
73 73
74struct nf_conn { 74struct nf_conn {
75 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 75 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
76 plus 1 for any connection(s) we are `master' for */ 76 * plus 1 for any connection(s) we are `master' for
77 *
78 * Hint, SKB address this struct and refcnt via skb->nfct and
79 * helpers nf_conntrack_get() and nf_conntrack_put().
80 * Helper nf_ct_put() equals nf_conntrack_put() by dec refcnt,
81 * beware nf_ct_get() is different and don't inc refcnt.
82 */
77 struct nf_conntrack ct_general; 83 struct nf_conntrack ct_general;
78 84
79 spinlock_t lock; 85 spinlock_t lock;
86 u16 cpu;
80 87
81 /* XXX should I move this to the tail ? - Y.K */ 88 /* XXX should I move this to the tail ? - Y.K */
82 /* These are my tuples; original and reply */ 89 /* These are my tuples; original and reply */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 15308b8eb5b5..cc0c18827602 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -77,6 +77,13 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
77 const struct nf_conntrack_l3proto *l3proto, 77 const struct nf_conntrack_l3proto *l3proto,
78 const struct nf_conntrack_l4proto *proto); 78 const struct nf_conntrack_l4proto *proto);
79 79
80extern spinlock_t nf_conntrack_lock ; 80#ifdef CONFIG_LOCKDEP
81# define CONNTRACK_LOCKS 8
82#else
83# define CONNTRACK_LOCKS 1024
84#endif
85extern spinlock_t nf_conntrack_locks[CONNTRACK_LOCKS];
86
87extern spinlock_t nf_conntrack_expect_lock;
81 88
82#endif /* _NF_CONNTRACK_CORE_H */ 89#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 956b175523ff..55d15049ab2f 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -47,8 +47,8 @@ enum nf_ct_ext_id {
47/* Extensions: optional stuff which isn't permanently in struct. */ 47/* Extensions: optional stuff which isn't permanently in struct. */
48struct nf_ct_ext { 48struct nf_ct_ext {
49 struct rcu_head rcu; 49 struct rcu_head rcu;
50 u8 offset[NF_CT_EXT_NUM]; 50 u16 offset[NF_CT_EXT_NUM];
51 u8 len; 51 u16 len;
52 char data[0]; 52 char data[0];
53}; 53};
54 54
diff --git a/include/net/netfilter/nf_conntrack_labels.h b/include/net/netfilter/nf_conntrack_labels.h
index c985695283b3..dec6336bf850 100644
--- a/include/net/netfilter/nf_conntrack_labels.h
+++ b/include/net/netfilter/nf_conntrack_labels.h
@@ -7,6 +7,8 @@
7 7
8#include <uapi/linux/netfilter/xt_connlabel.h> 8#include <uapi/linux/netfilter/xt_connlabel.h>
9 9
10#define NF_CT_LABELS_MAX_SIZE ((XT_CONNLABEL_MAXBIT + 1) / BITS_PER_BYTE)
11
10struct nf_conn_labels { 12struct nf_conn_labels {
11 u8 words; 13 u8 words;
12 unsigned long bits[]; 14 unsigned long bits[];
@@ -29,7 +31,7 @@ static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
29 u8 words; 31 u8 words;
30 32
31 words = ACCESS_ONCE(net->ct.label_words); 33 words = ACCESS_ONCE(net->ct.label_words);
32 if (words == 0 || WARN_ON_ONCE(words > 8)) 34 if (words == 0)
33 return NULL; 35 return NULL;
34 36
35 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS, 37 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index e7e14ffe0f6a..e6bc14d8fa9a 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6#include <linux/netfilter/nfnetlink.h>
6#include <linux/netfilter/x_tables.h> 7#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/nf_tables.h> 8#include <linux/netfilter/nf_tables.h>
8#include <net/netlink.h> 9#include <net/netlink.h>
@@ -288,7 +289,8 @@ struct nft_expr_ops {
288 int (*init)(const struct nft_ctx *ctx, 289 int (*init)(const struct nft_ctx *ctx,
289 const struct nft_expr *expr, 290 const struct nft_expr *expr,
290 const struct nlattr * const tb[]); 291 const struct nlattr * const tb[]);
291 void (*destroy)(const struct nft_expr *expr); 292 void (*destroy)(const struct nft_ctx *ctx,
293 const struct nft_expr *expr);
292 int (*dump)(struct sk_buff *skb, 294 int (*dump)(struct sk_buff *skb,
293 const struct nft_expr *expr); 295 const struct nft_expr *expr);
294 int (*validate)(const struct nft_ctx *ctx, 296 int (*validate)(const struct nft_ctx *ctx,
@@ -325,13 +327,15 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
325 * @handle: rule handle 327 * @handle: rule handle
326 * @genmask: generation mask 328 * @genmask: generation mask
327 * @dlen: length of expression data 329 * @dlen: length of expression data
330 * @ulen: length of user data (used for comments)
328 * @data: expression data 331 * @data: expression data
329 */ 332 */
330struct nft_rule { 333struct nft_rule {
331 struct list_head list; 334 struct list_head list;
332 u64 handle:46, 335 u64 handle:42,
333 genmask:2, 336 genmask:2,
334 dlen:16; 337 dlen:12,
338 ulen:8;
335 unsigned char data[] 339 unsigned char data[]
336 __attribute__((aligned(__alignof__(struct nft_expr)))); 340 __attribute__((aligned(__alignof__(struct nft_expr))));
337}; 341};
@@ -340,19 +344,13 @@ struct nft_rule {
340 * struct nft_rule_trans - nf_tables rule update in transaction 344 * struct nft_rule_trans - nf_tables rule update in transaction
341 * 345 *
342 * @list: used internally 346 * @list: used internally
347 * @ctx: rule context
343 * @rule: rule that needs to be updated 348 * @rule: rule that needs to be updated
344 * @chain: chain that this rule belongs to
345 * @table: table for which this chain applies
346 * @nlh: netlink header of the message that contain this update
347 * @family: family expressesed as AF_*
348 */ 349 */
349struct nft_rule_trans { 350struct nft_rule_trans {
350 struct list_head list; 351 struct list_head list;
352 struct nft_ctx ctx;
351 struct nft_rule *rule; 353 struct nft_rule *rule;
352 const struct nft_chain *chain;
353 const struct nft_table *table;
354 const struct nlmsghdr *nlh;
355 u8 family;
356}; 354};
357 355
358static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
@@ -370,6 +368,11 @@ static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
370 return (struct nft_expr *)&rule->data[rule->dlen]; 368 return (struct nft_expr *)&rule->data[rule->dlen];
371} 369}
372 370
371static inline void *nft_userdata(const struct nft_rule *rule)
372{
373 return (void *)&rule->data[rule->dlen];
374}
375
373/* 376/*
374 * The last pointer isn't really necessary, but the compiler isn't able to 377 * The last pointer isn't really necessary, but the compiler isn't able to
375 * determine that the result of nft_expr_last() is always the same since it 378 * determine that the result of nft_expr_last() is always the same since it
@@ -521,6 +524,9 @@ void nft_unregister_chain_type(const struct nf_chain_type *);
521int nft_register_expr(struct nft_expr_type *); 524int nft_register_expr(struct nft_expr_type *);
522void nft_unregister_expr(struct nft_expr_type *); 525void nft_unregister_expr(struct nft_expr_type *);
523 526
527#define nft_dereference(p) \
528 nfnl_dereference(p, NFNL_SUBSYS_NFTABLES)
529
524#define MODULE_ALIAS_NFT_FAMILY(family) \ 530#define MODULE_ALIAS_NFT_FAMILY(family) \
525 MODULE_ALIAS("nft-afinfo-" __stringify(family)) 531 MODULE_ALIAS("nft-afinfo-" __stringify(family))
526 532
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
index cf2b7ae2b9d8..a75fc8e27cd6 100644
--- a/include/net/netfilter/nf_tables_core.h
+++ b/include/net/netfilter/nf_tables_core.h
@@ -13,6 +13,16 @@ struct nft_cmp_fast_expr {
13 u8 len; 13 u8 len;
14}; 14};
15 15
16/* Calculate the mask for the nft_cmp_fast expression. On big endian the
17 * mask needs to include the *upper* bytes when interpreting that data as
18 * something smaller than the full u32, therefore a cpu_to_le32 is done.
19 */
20static inline u32 nft_cmp_fast_mask(unsigned int len)
21{
22 return cpu_to_le32(~0U >> (FIELD_SIZEOF(struct nft_cmp_fast_expr,
23 data) * BITS_PER_BYTE - len));
24}
25
16extern const struct nft_expr_ops nft_cmp_fast_ops; 26extern const struct nft_expr_ops nft_cmp_fast_ops;
17 27
18int nft_cmp_module_init(void); 28int nft_cmp_module_init(void);
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index fbcc7fa536dc..773cce308bc6 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -5,6 +5,7 @@
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#include <linux/netfilter/nf_conntrack_tcp.h>
8#include <linux/seqlock.h>
8 9
9struct ctl_table_header; 10struct ctl_table_header;
10struct nf_conntrack_ecache; 11struct nf_conntrack_ecache;
@@ -62,6 +63,13 @@ struct nf_ip_net {
62#endif 63#endif
63}; 64};
64 65
66struct ct_pcpu {
67 spinlock_t lock;
68 struct hlist_nulls_head unconfirmed;
69 struct hlist_nulls_head dying;
70 struct hlist_nulls_head tmpl;
71};
72
65struct netns_ct { 73struct netns_ct {
66 atomic_t count; 74 atomic_t count;
67 unsigned int expect_count; 75 unsigned int expect_count;
@@ -83,12 +91,11 @@ struct netns_ct {
83 int sysctl_checksum; 91 int sysctl_checksum;
84 92
85 unsigned int htable_size; 93 unsigned int htable_size;
94 seqcount_t generation;
86 struct kmem_cache *nf_conntrack_cachep; 95 struct kmem_cache *nf_conntrack_cachep;
87 struct hlist_nulls_head *hash; 96 struct hlist_nulls_head *hash;
88 struct hlist_head *expect_hash; 97 struct hlist_head *expect_hash;
89 struct hlist_nulls_head unconfirmed; 98 struct ct_pcpu __percpu *pcpu_lists;
90 struct hlist_nulls_head dying;
91 struct hlist_nulls_head tmpl;
92 struct ip_conntrack_stat __percpu *stat; 99 struct ip_conntrack_stat __percpu *stat;
93 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 100 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
94 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 101 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
new file mode 100644
index 000000000000..079030c853d8
--- /dev/null
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -0,0 +1,22 @@
1/*
2 * ieee802154 6lowpan in net namespaces
3 */
4
5#include <net/inet_frag.h>
6
7#ifndef __NETNS_IEEE802154_6LOWPAN_H__
8#define __NETNS_IEEE802154_6LOWPAN_H__
9
10struct netns_sysctl_lowpan {
11#ifdef CONFIG_SYSCTL
12 struct ctl_table_header *frags_hdr;
13#endif
14};
15
16struct netns_ieee802154_lowpan {
17 struct netns_sysctl_lowpan sysctl;
18 struct netns_frags frags;
19 u16 max_dsize;
20};
21
22#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 80f500a29498..b2704fd0ec80 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -20,6 +20,11 @@ struct local_ports {
20 int range[2]; 20 int range[2];
21}; 21};
22 22
23struct ping_group_range {
24 seqlock_t lock;
25 kgid_t range[2];
26};
27
23struct netns_ipv4 { 28struct netns_ipv4 {
24#ifdef CONFIG_SYSCTL 29#ifdef CONFIG_SYSCTL
25 struct ctl_table_header *forw_hdr; 30 struct ctl_table_header *forw_hdr;
@@ -66,13 +71,13 @@ struct netns_ipv4 {
66 int sysctl_icmp_ratemask; 71 int sysctl_icmp_ratemask;
67 int sysctl_icmp_errors_use_inbound_ifaddr; 72 int sysctl_icmp_errors_use_inbound_ifaddr;
68 73
69 struct local_ports sysctl_local_ports; 74 struct local_ports ip_local_ports;
70 75
71 int sysctl_tcp_ecn; 76 int sysctl_tcp_ecn;
72 int sysctl_ip_no_pmtu_disc; 77 int sysctl_ip_no_pmtu_disc;
73 int sysctl_ip_fwd_use_pmtu; 78 int sysctl_ip_fwd_use_pmtu;
74 79
75 kgid_t sysctl_ping_group_range[2]; 80 struct ping_group_range ping_group_range;
76 81
77 atomic_t dev_addr_genid; 82 atomic_t dev_addr_genid;
78 83
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 1006a265beb3..3492434baf88 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -6,6 +6,7 @@
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7#include <linux/xfrm.h> 7#include <linux/xfrm.h>
8#include <net/dst_ops.h> 8#include <net/dst_ops.h>
9#include <net/flowcache.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -58,9 +59,17 @@ struct netns_xfrm {
58 struct dst_ops xfrm6_dst_ops; 59 struct dst_ops xfrm6_dst_ops;
59#endif 60#endif
60 spinlock_t xfrm_state_lock; 61 spinlock_t xfrm_state_lock;
61 spinlock_t xfrm_policy_sk_bundle_lock;
62 rwlock_t xfrm_policy_lock; 62 rwlock_t xfrm_policy_lock;
63 struct mutex xfrm_cfg_mutex; 63 struct mutex xfrm_cfg_mutex;
64
65 /* flow cache part */
66 struct flow_cache flow_cache_global;
67 atomic_t flow_cache_genid;
68 struct list_head flow_cache_gc_list;
69 spinlock_t flow_cache_gc_lock;
70 struct work_struct flow_cache_gc_work;
71 struct work_struct flow_cache_flush_work;
72 struct mutex flow_flush_sem;
64}; 73};
65 74
66#endif 75#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index dafc09f0fdbc..f2a9597ff53c 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -27,32 +27,17 @@ struct netprio_map {
27 27
28void sock_update_netprioidx(struct sock *sk); 28void sock_update_netprioidx(struct sock *sk);
29 29
30#if IS_BUILTIN(CONFIG_CGROUP_NET_PRIO)
31static inline u32 task_netprioidx(struct task_struct *p) 30static inline u32 task_netprioidx(struct task_struct *p)
32{ 31{
33 struct cgroup_subsys_state *css; 32 struct cgroup_subsys_state *css;
34 u32 idx; 33 u32 idx;
35 34
36 rcu_read_lock(); 35 rcu_read_lock();
37 css = task_css(p, net_prio_subsys_id); 36 css = task_css(p, net_prio_cgrp_id);
38 idx = css->cgroup->id; 37 idx = css->cgroup->id;
39 rcu_read_unlock(); 38 rcu_read_unlock();
40 return idx; 39 return idx;
41} 40}
42#elif IS_MODULE(CONFIG_CGROUP_NET_PRIO)
43static inline u32 task_netprioidx(struct task_struct *p)
44{
45 struct cgroup_subsys_state *css;
46 u32 idx = 0;
47
48 rcu_read_lock();
49 css = task_css(p, net_prio_subsys_id);
50 if (css)
51 idx = css->cgroup->id;
52 rcu_read_unlock();
53 return idx;
54}
55#endif
56#else /* !CONFIG_CGROUP_NET_PRIO */ 41#else /* !CONFIG_CGROUP_NET_PRIO */
57static inline u32 task_netprioidx(struct task_struct *p) 42static inline u32 task_netprioidx(struct task_struct *p)
58{ 43{
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index 81af21e9bcd4..7655cfe27c34 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -35,6 +35,7 @@ enum {
35 NFC_DIGITAL_RF_TECH_106A = 0, 35 NFC_DIGITAL_RF_TECH_106A = 0,
36 NFC_DIGITAL_RF_TECH_212F, 36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F, 37 NFC_DIGITAL_RF_TECH_424F,
38 NFC_DIGITAL_RF_TECH_ISO15693,
38 39
39 NFC_DIGITAL_RF_TECH_LAST, 40 NFC_DIGITAL_RF_TECH_LAST,
40}; 41};
@@ -50,6 +51,7 @@ enum {
50 51
51 NFC_DIGITAL_FRAMING_NFCA_T1T, 52 NFC_DIGITAL_FRAMING_NFCA_T1T,
52 NFC_DIGITAL_FRAMING_NFCA_T2T, 53 NFC_DIGITAL_FRAMING_NFCA_T2T,
54 NFC_DIGITAL_FRAMING_NFCA_T4T,
53 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP, 55 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP,
54 56
55 NFC_DIGITAL_FRAMING_NFCF, 57 NFC_DIGITAL_FRAMING_NFCF,
@@ -57,6 +59,9 @@ enum {
57 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP, 59 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP,
58 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED, 60 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED,
59 61
62 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY,
63 NFC_DIGITAL_FRAMING_ISO15693_T5T,
64
60 NFC_DIGITAL_FRAMING_LAST, 65 NFC_DIGITAL_FRAMING_LAST,
61}; 66};
62 67
@@ -204,6 +209,8 @@ struct nfc_digital_dev {
204 u8 curr_rf_tech; 209 u8 curr_rf_tech;
205 u8 curr_nfc_dep_pni; 210 u8 curr_nfc_dep_pni;
206 211
212 u16 target_fsc;
213
207 int (*skb_check_crc)(struct sk_buff *skb); 214 int (*skb_check_crc)(struct sk_buff *skb);
208 void (*skb_add_crc)(struct sk_buff *skb); 215 void (*skb_add_crc)(struct sk_buff *skb);
209}; 216};
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index e80894bca1d0..2e8b40c16274 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -111,6 +111,9 @@ struct nfc_target {
111 u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; 111 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
112 u8 hci_reader_gate; 112 u8 hci_reader_gate;
113 u8 logical_idx; 113 u8 logical_idx;
114 u8 is_iso15693;
115 u8 iso15693_dsfid;
116 u8 iso15693_uid[NFC_ISO15693_UID_MAXSIZE];
114}; 117};
115 118
116/** 119/**
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
index 99d2ba1c7e03..b23548e04098 100644
--- a/include/net/nl802154.h
+++ b/include/net/nl802154.h
@@ -52,7 +52,7 @@ int ieee802154_nl_assoc_indic(struct net_device *dev,
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document. 52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */ 53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev, 54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status); 55 __le16 short_addr, u8 status);
56 56
57/** 57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation. 58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
@@ -111,8 +111,8 @@ int ieee802154_nl_scan_confirm(struct net_device *dev,
111 * Note: This API cannot indicate a beacon frame for a coordinator 111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode. 112 * operating in long addressing mode.
113 */ 113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid, 114int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid,
115 u16 coord_addr); 115 __le16 coord_addr);
116 116
117/** 117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start. 118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index b07cdc9fa454..75fc1f5a948d 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -155,6 +155,7 @@ struct ieee80211_reg_rule {
155 struct ieee80211_freq_range freq_range; 155 struct ieee80211_freq_range freq_range;
156 struct ieee80211_power_rule power_rule; 156 struct ieee80211_power_rule power_rule;
157 u32 flags; 157 u32 flags;
158 u32 dfs_cac_ms;
158}; 159};
159 160
160struct ieee80211_regdomain { 161struct ieee80211_regdomain {
@@ -172,14 +173,18 @@ struct ieee80211_regdomain {
172#define DBM_TO_MBM(gain) ((gain) * 100) 173#define DBM_TO_MBM(gain) ((gain) * 100)
173#define MBM_TO_DBM(gain) ((gain) / 100) 174#define MBM_TO_DBM(gain) ((gain) / 100)
174 175
175#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ 176#define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags) \
176{ \ 177{ \
177 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ 178 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
178 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ 179 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
179 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ 180 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
180 .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\ 181 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
181 .power_rule.max_eirp = DBM_TO_MBM(eirp), \ 182 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
182 .flags = reg_flags, \ 183 .flags = reg_flags, \
184 .dfs_cac_ms = dfs_cac, \
183} 185}
184 186
187#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
188 REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
189
185#endif 190#endif
diff --git a/include/net/route.h b/include/net/route.h
index 9d1f423d5944..b17cf28f996e 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -191,7 +191,6 @@ unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
191void ip_rt_multicast_event(struct in_device *); 191void ip_rt_multicast_event(struct in_device *);
192int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 192int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
193void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 193void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
194int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
195 194
196struct in_ifaddr; 195struct in_ifaddr;
197void fib_add_ifaddr(struct in_ifaddr *); 196void fib_add_ifaddr(struct in_ifaddr *);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 661e45d38051..72240e5ac2c4 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -140,7 +140,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
140 struct nlattr *tb[]); 140 struct nlattr *tb[]);
141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm); 141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
142 142
143extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 143int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len);
144 144
145#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 145#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
146 146
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a3353f45ef94..8e4de46c052e 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -101,7 +101,7 @@ void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
101int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 101int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
102int sctp_inet_listen(struct socket *sock, int backlog); 102int sctp_inet_listen(struct socket *sock, int backlog);
103void sctp_write_space(struct sock *sk); 103void sctp_write_space(struct sock *sk);
104void sctp_data_ready(struct sock *sk, int len); 104void sctp_data_ready(struct sock *sk);
105unsigned int sctp_poll(struct file *file, struct socket *sock, 105unsigned int sctp_poll(struct file *file, struct socket *sock,
106 poll_table *wait); 106 poll_table *wait);
107void sctp_sock_rfree(struct sk_buff *skb); 107void sctp_sock_rfree(struct sk_buff *skb);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 6ee76c804893..0dfcc92600e8 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1241,6 +1241,7 @@ struct sctp_endpoint {
1241 /* SCTP-AUTH: endpoint shared keys */ 1241 /* SCTP-AUTH: endpoint shared keys */
1242 struct list_head endpoint_shared_keys; 1242 struct list_head endpoint_shared_keys;
1243 __u16 active_key_id; 1243 __u16 active_key_id;
1244 __u8 auth_enable;
1244}; 1245};
1245 1246
1246/* Recover the outter endpoint structure. */ 1247/* Recover the outter endpoint structure. */
@@ -1269,7 +1270,8 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
1269int sctp_has_association(struct net *net, const union sctp_addr *laddr, 1270int sctp_has_association(struct net *net, const union sctp_addr *laddr,
1270 const union sctp_addr *paddr); 1271 const union sctp_addr *paddr);
1271 1272
1272int sctp_verify_init(struct net *net, const struct sctp_association *asoc, 1273int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
1274 const struct sctp_association *asoc,
1273 sctp_cid_t, sctp_init_chunk_t *peer_init, 1275 sctp_cid_t, sctp_init_chunk_t *peer_init,
1274 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk); 1276 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
1275int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, 1277int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
@@ -1653,6 +1655,17 @@ struct sctp_association {
1653 /* This is the last advertised value of rwnd over a SACK chunk. */ 1655 /* This is the last advertised value of rwnd over a SACK chunk. */
1654 __u32 a_rwnd; 1656 __u32 a_rwnd;
1655 1657
1658 /* Number of bytes by which the rwnd has slopped. The rwnd is allowed
1659 * to slop over a maximum of the association's frag_point.
1660 */
1661 __u32 rwnd_over;
1662
1663 /* Keeps treack of rwnd pressure. This happens when we have
1664 * a window, but not recevie buffer (i.e small packets). This one
1665 * is releases slowly (1 PMTU at a time ).
1666 */
1667 __u32 rwnd_press;
1668
1656 /* This is the sndbuf size in use for the association. 1669 /* This is the sndbuf size in use for the association.
1657 * This corresponds to the sndbuf size for the association, 1670 * This corresponds to the sndbuf size for the association,
1658 * as specified in the sk->sndbuf. 1671 * as specified in the sk->sndbuf.
@@ -1881,7 +1894,8 @@ void sctp_assoc_update(struct sctp_association *old,
1881__u32 sctp_association_get_next_tsn(struct sctp_association *); 1894__u32 sctp_association_get_next_tsn(struct sctp_association *);
1882 1895
1883void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *); 1896void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);
1884void sctp_assoc_rwnd_update(struct sctp_association *, bool); 1897void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
1898void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
1885void sctp_assoc_set_primary(struct sctp_association *, 1899void sctp_assoc_set_primary(struct sctp_association *,
1886 struct sctp_transport *); 1900 struct sctp_transport *);
1887void sctp_assoc_del_nonprimary_peers(struct sctp_association *, 1901void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
diff --git a/include/net/sock.h b/include/net/sock.h
index b9586a137cad..21569cf456ed 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -418,7 +418,7 @@ struct sock {
418 u32 sk_classid; 418 u32 sk_classid;
419 struct cg_proto *sk_cgrp; 419 struct cg_proto *sk_cgrp;
420 void (*sk_state_change)(struct sock *sk); 420 void (*sk_state_change)(struct sock *sk);
421 void (*sk_data_ready)(struct sock *sk, int bytes); 421 void (*sk_data_ready)(struct sock *sk);
422 void (*sk_write_space)(struct sock *sk); 422 void (*sk_write_space)(struct sock *sk);
423 void (*sk_error_report)(struct sock *sk); 423 void (*sk_error_report)(struct sock *sk);
424 int (*sk_backlog_rcv)(struct sock *sk, 424 int (*sk_backlog_rcv)(struct sock *sk,
@@ -862,9 +862,9 @@ static inline void sock_rps_save_rxhash(struct sock *sk,
862 const struct sk_buff *skb) 862 const struct sk_buff *skb)
863{ 863{
864#ifdef CONFIG_RPS 864#ifdef CONFIG_RPS
865 if (unlikely(sk->sk_rxhash != skb->rxhash)) { 865 if (unlikely(sk->sk_rxhash != skb->hash)) {
866 sock_rps_reset_flow(sk); 866 sock_rps_reset_flow(sk);
867 sk->sk_rxhash = skb->rxhash; 867 sk->sk_rxhash = skb->hash;
868 } 868 }
869#endif 869#endif
870} 870}
@@ -1621,33 +1621,6 @@ void sk_common_release(struct sock *sk);
1621/* Initialise core socket variables */ 1621/* Initialise core socket variables */
1622void sock_init_data(struct socket *sock, struct sock *sk); 1622void sock_init_data(struct socket *sock, struct sock *sk);
1623 1623
1624void sk_filter_release_rcu(struct rcu_head *rcu);
1625
1626/**
1627 * sk_filter_release - release a socket filter
1628 * @fp: filter to remove
1629 *
1630 * Remove a filter from a socket and release its resources.
1631 */
1632
1633static inline void sk_filter_release(struct sk_filter *fp)
1634{
1635 if (atomic_dec_and_test(&fp->refcnt))
1636 call_rcu(&fp->rcu, sk_filter_release_rcu);
1637}
1638
1639static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
1640{
1641 atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1642 sk_filter_release(fp);
1643}
1644
1645static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
1646{
1647 atomic_inc(&fp->refcnt);
1648 atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1649}
1650
1651/* 1624/*
1652 * Socket reference counting postulates. 1625 * Socket reference counting postulates.
1653 * 1626 *
@@ -2256,8 +2229,12 @@ void sock_net_set(struct sock *sk, struct net *net)
2256 */ 2229 */
2257static inline void sk_change_net(struct sock *sk, struct net *net) 2230static inline void sk_change_net(struct sock *sk, struct net *net)
2258{ 2231{
2259 put_net(sock_net(sk)); 2232 struct net *current_net = sock_net(sk);
2260 sock_net_set(sk, hold_net(net)); 2233
2234 if (!net_eq(current_net, net)) {
2235 put_net(current_net);
2236 sock_net_set(sk, hold_net(net));
2237 }
2261} 2238}
2262 2239
2263static inline struct sock *skb_steal_sock(struct sk_buff *skb) 2240static inline struct sock *skb_steal_sock(struct sk_buff *skb)
@@ -2278,6 +2255,11 @@ int sock_get_timestampns(struct sock *, struct timespec __user *);
2278int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level, 2255int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
2279 int type); 2256 int type);
2280 2257
2258bool sk_ns_capable(const struct sock *sk,
2259 struct user_namespace *user_ns, int cap);
2260bool sk_capable(const struct sock *sk, int cap);
2261bool sk_net_capable(const struct sock *sk, int cap);
2262
2281/* 2263/*
2282 * Enable debug/info messages 2264 * Enable debug/info messages
2283 */ 2265 */
diff --git a/include/net/tc_act/tc_csum.h b/include/net/tc_act/tc_csum.h
index 9e8710be7a04..fa8f5fac65e9 100644
--- a/include/net/tc_act/tc_csum.h
+++ b/include/net/tc_act/tc_csum.h
@@ -9,7 +9,7 @@ struct tcf_csum {
9 9
10 u32 update_flags; 10 u32 update_flags;
11}; 11};
12#define to_tcf_csum(pc) \ 12#define to_tcf_csum(a) \
13 container_of(pc,struct tcf_csum,common) 13 container_of(a->priv,struct tcf_csum,common)
14 14
15#endif /* __NET_TC_CSUM_H */ 15#endif /* __NET_TC_CSUM_H */
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h
index 65f024b80958..9763dcbb9bc3 100644
--- a/include/net/tc_act/tc_defact.h
+++ b/include/net/tc_act/tc_defact.h
@@ -8,7 +8,7 @@ struct tcf_defact {
8 u32 tcfd_datalen; 8 u32 tcfd_datalen;
9 void *tcfd_defdata; 9 void *tcfd_defdata;
10}; 10};
11#define to_defact(pc) \ 11#define to_defact(a) \
12 container_of(pc, struct tcf_defact, common) 12 container_of(a->priv, struct tcf_defact, common)
13 13
14#endif /* __NET_TC_DEF_H */ 14#endif /* __NET_TC_DEF_H */
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 9e3f6767b80e..9fc9b578908a 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -11,7 +11,7 @@ struct tcf_gact {
11 int tcfg_paction; 11 int tcfg_paction;
12#endif 12#endif
13}; 13};
14#define to_gact(pc) \ 14#define to_gact(a) \
15 container_of(pc, struct tcf_gact, common) 15 container_of(a->priv, struct tcf_gact, common)
16 16
17#endif /* __NET_TC_GACT_H */ 17#endif /* __NET_TC_GACT_H */
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h
index f7d25dfcc4b7..c0f4193f432c 100644
--- a/include/net/tc_act/tc_ipt.h
+++ b/include/net/tc_act/tc_ipt.h
@@ -11,7 +11,7 @@ struct tcf_ipt {
11 char *tcfi_tname; 11 char *tcfi_tname;
12 struct xt_entry_target *tcfi_t; 12 struct xt_entry_target *tcfi_t;
13}; 13};
14#define to_ipt(pc) \ 14#define to_ipt(a) \
15 container_of(pc, struct tcf_ipt, common) 15 container_of(a->priv, struct tcf_ipt, common)
16 16
17#endif /* __NET_TC_IPT_H */ 17#endif /* __NET_TC_IPT_H */
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index cfe2943690ff..4dd77a1c106b 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -11,7 +11,7 @@ struct tcf_mirred {
11 struct net_device *tcfm_dev; 11 struct net_device *tcfm_dev;
12 struct list_head tcfm_list; 12 struct list_head tcfm_list;
13}; 13};
14#define to_mirred(pc) \ 14#define to_mirred(a) \
15 container_of(pc, struct tcf_mirred, common) 15 container_of(a->priv, struct tcf_mirred, common)
16 16
17#endif /* __NET_TC_MIR_H */ 17#endif /* __NET_TC_MIR_H */
diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h
index 4a691f34d703..63d8e9ca9d99 100644
--- a/include/net/tc_act/tc_nat.h
+++ b/include/net/tc_act/tc_nat.h
@@ -13,9 +13,9 @@ struct tcf_nat {
13 u32 flags; 13 u32 flags;
14}; 14};
15 15
16static inline struct tcf_nat *to_tcf_nat(struct tcf_common *pc) 16static inline struct tcf_nat *to_tcf_nat(struct tc_action *a)
17{ 17{
18 return container_of(pc, struct tcf_nat, common); 18 return container_of(a->priv, struct tcf_nat, common);
19} 19}
20 20
21#endif /* __NET_TC_NAT_H */ 21#endif /* __NET_TC_NAT_H */
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
index e6f6e15956f5..5b80998879c7 100644
--- a/include/net/tc_act/tc_pedit.h
+++ b/include/net/tc_act/tc_pedit.h
@@ -9,7 +9,7 @@ struct tcf_pedit {
9 unsigned char tcfp_flags; 9 unsigned char tcfp_flags;
10 struct tc_pedit_key *tcfp_keys; 10 struct tc_pedit_key *tcfp_keys;
11}; 11};
12#define to_pedit(pc) \ 12#define to_pedit(a) \
13 container_of(pc, struct tcf_pedit, common) 13 container_of(a->priv, struct tcf_pedit, common)
14 14
15#endif /* __NET_TC_PED_H */ 15#endif /* __NET_TC_PED_H */
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index dd5d86fab030..0df9a0db4a8e 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -29,7 +29,7 @@ struct tcf_skbedit {
29 u16 queue_mapping; 29 u16 queue_mapping;
30 /* XXX: 16-bit pad here? */ 30 /* XXX: 16-bit pad here? */
31}; 31};
32#define to_skbedit(pc) \ 32#define to_skbedit(a) \
33 container_of(pc, struct tcf_skbedit, common) 33 container_of(a->priv, struct tcf_skbedit, common)
34 34
35#endif /* __NET_TC_SKBEDIT_H */ 35#endif /* __NET_TC_SKBEDIT_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 743accec6c76..87d877408188 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -31,6 +31,7 @@
31#include <linux/crypto.h> 31#include <linux/crypto.h>
32#include <linux/cryptohash.h> 32#include <linux/cryptohash.h>
33#include <linux/kref.h> 33#include <linux/kref.h>
34#include <linux/ktime.h>
34 35
35#include <net/inet_connection_sock.h> 36#include <net/inet_connection_sock.h>
36#include <net/inet_timewait_sock.h> 37#include <net/inet_timewait_sock.h>
@@ -478,7 +479,6 @@ int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
478struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 479struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
479 struct ip_options *opt); 480 struct ip_options *opt);
480#ifdef CONFIG_SYN_COOKIES 481#ifdef CONFIG_SYN_COOKIES
481#include <linux/ktime.h>
482 482
483/* Syncookies use a monotonic timer which increments every 60 seconds. 483/* Syncookies use a monotonic timer which increments every 60 seconds.
484 * This counter is used both as a hash input and partially encoded into 484 * This counter is used both as a hash input and partially encoded into
@@ -620,7 +620,7 @@ static inline void tcp_bound_rto(const struct sock *sk)
620 620
621static inline u32 __tcp_set_rto(const struct tcp_sock *tp) 621static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
622{ 622{
623 return (tp->srtt >> 3) + tp->rttvar; 623 return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us);
624} 624}
625 625
626static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 626static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
@@ -657,6 +657,11 @@ static inline u32 tcp_rto_min(struct sock *sk)
657 return rto_min; 657 return rto_min;
658} 658}
659 659
660static inline u32 tcp_rto_min_us(struct sock *sk)
661{
662 return jiffies_to_usecs(tcp_rto_min(sk));
663}
664
660/* Compute the actual receive window we are currently advertising. 665/* Compute the actual receive window we are currently advertising.
661 * Rcv_nxt can be after the window if our peer push more data 666 * Rcv_nxt can be after the window if our peer push more data
662 * than the offered window. 667 * than the offered window.
@@ -779,7 +784,6 @@ enum tcp_ca_event {
779#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 784#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
780 785
781#define TCP_CONG_NON_RESTRICTED 0x1 786#define TCP_CONG_NON_RESTRICTED 0x1
782#define TCP_CONG_RTT_STAMP 0x2
783 787
784struct tcp_congestion_ops { 788struct tcp_congestion_ops {
785 struct list_head list; 789 struct list_head list;
@@ -792,8 +796,6 @@ struct tcp_congestion_ops {
792 796
793 /* return slow start threshold (required) */ 797 /* return slow start threshold (required) */
794 u32 (*ssthresh)(struct sock *sk); 798 u32 (*ssthresh)(struct sock *sk);
795 /* lower bound for congestion window (optional) */
796 u32 (*min_cwnd)(const struct sock *sk);
797 /* do new cwnd calculation (required) */ 799 /* do new cwnd calculation (required) */
798 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 800 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
799 /* call before changing ca_state (optional) */ 801 /* call before changing ca_state (optional) */
@@ -828,7 +830,6 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
828extern struct tcp_congestion_ops tcp_init_congestion_ops; 830extern struct tcp_congestion_ops tcp_init_congestion_ops;
829u32 tcp_reno_ssthresh(struct sock *sk); 831u32 tcp_reno_ssthresh(struct sock *sk);
830void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 832void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
831u32 tcp_reno_min_cwnd(const struct sock *sk);
832extern struct tcp_congestion_ops tcp_reno; 833extern struct tcp_congestion_ops tcp_reno;
833 834
834static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 98498e1daa06..e52ef5357e08 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -483,8 +483,8 @@ void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
483 * Be sure not to modify skb->data in the middle (ie: don't use 483 * Be sure not to modify skb->data in the middle (ie: don't use
484 * skb_push()/skb_pull()/skb_reserve() on the skb). 484 * skb_push()/skb_pull()/skb_reserve() on the skb).
485 * 485 *
486 * "pipe_name" is any string, than can be interpreted as the name of 486 * "pipe_name" is any string, that can be interpreted as the name of
487 * the pipe or destinatary; the interpretation of it is driver 487 * the pipe or recipient; the interpretation of it is driver
488 * specific, so the recipient can multiplex it as wished. It can be 488 * specific, so the recipient can multiplex it as wished. It can be
489 * NULL, it won't be used - an example is using a "diagnostics" tag to 489 * NULL, it won't be used - an example is using a "diagnostics" tag to
490 * send diagnostics information that a device-specific diagnostics 490 * send diagnostics information that a device-specific diagnostics
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index b52bda8d13b1..10ab0fc6d4f7 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -37,15 +37,22 @@ struct wpan_phy {
37 struct mutex pib_lock; 37 struct mutex pib_lock;
38 38
39 /* 39 /*
40 * This is a PIB according to 802.15.4-2006. 40 * This is a PIB according to 802.15.4-2011.
41 * We do not provide timing-related variables, as they 41 * We do not provide timing-related variables, as they
42 * aren't used outside of driver 42 * aren't used outside of driver
43 */ 43 */
44 u8 current_channel; 44 u8 current_channel;
45 u8 current_page; 45 u8 current_page;
46 u32 channels_supported[32]; 46 u32 channels_supported[32];
47 u8 transmit_power; 47 s8 transmit_power;
48 u8 cca_mode; 48 u8 cca_mode;
49 u8 min_be;
50 u8 max_be;
51 u8 csma_retries;
52 s8 frame_retries;
53
54 bool lbt;
55 s32 cca_ed_level;
49 56
50 struct device dev; 57 struct device dev;
51 int idx; 58 int idx;
@@ -54,6 +61,14 @@ struct wpan_phy {
54 const char *name, int type); 61 const char *name, int type);
55 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); 62 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
56 63
64 int (*set_txpower)(struct wpan_phy *phy, int db);
65 int (*set_lbt)(struct wpan_phy *phy, bool on);
66 int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode);
67 int (*set_cca_ed_level)(struct wpan_phy *phy, int level);
68 int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be,
69 u8 retries);
70 int (*set_frame_retries)(struct wpan_phy *phy, s8 retries);
71
57 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 72 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
58}; 73};
59 74
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index fb5654a8ca3c..116e9c7e19cb 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -118,11 +118,10 @@
118struct xfrm_state_walk { 118struct xfrm_state_walk {
119 struct list_head all; 119 struct list_head all;
120 u8 state; 120 u8 state;
121 union { 121 u8 dying;
122 u8 dying; 122 u8 proto;
123 u8 proto;
124 };
125 u32 seq; 123 u32 seq;
124 struct xfrm_address_filter *filter;
126}; 125};
127 126
128/* Full description of state of transformer. */ 127/* Full description of state of transformer. */
@@ -334,7 +333,7 @@ struct xfrm_state_afinfo {
334 const xfrm_address_t *saddr); 333 const xfrm_address_t *saddr);
335 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); 334 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
336 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); 335 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
337 int (*output)(struct sk_buff *skb); 336 int (*output)(struct sock *sk, struct sk_buff *skb);
338 int (*output_finish)(struct sk_buff *skb); 337 int (*output_finish)(struct sk_buff *skb);
339 int (*extract_input)(struct xfrm_state *x, 338 int (*extract_input)(struct xfrm_state *x,
340 struct sk_buff *skb); 339 struct sk_buff *skb);
@@ -350,6 +349,16 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
350struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); 349struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
351void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); 350void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
352 351
352struct xfrm_input_afinfo {
353 unsigned int family;
354 struct module *owner;
355 int (*callback)(struct sk_buff *skb, u8 protocol,
356 int err);
357};
358
359int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo);
360int xfrm_input_unregister_afinfo(struct xfrm_input_afinfo *afinfo);
361
353void xfrm_state_delete_tunnel(struct xfrm_state *x); 362void xfrm_state_delete_tunnel(struct xfrm_state *x);
354 363
355struct xfrm_type { 364struct xfrm_type {
@@ -594,21 +603,33 @@ struct xfrm_mgr {
594 const struct xfrm_migrate *m, 603 const struct xfrm_migrate *m,
595 int num_bundles, 604 int num_bundles,
596 const struct xfrm_kmaddress *k); 605 const struct xfrm_kmaddress *k);
606 bool (*is_alive)(const struct km_event *c);
597}; 607};
598 608
599int xfrm_register_km(struct xfrm_mgr *km); 609int xfrm_register_km(struct xfrm_mgr *km);
600int xfrm_unregister_km(struct xfrm_mgr *km); 610int xfrm_unregister_km(struct xfrm_mgr *km);
601 611
612struct xfrm_tunnel_skb_cb {
613 union {
614 struct inet_skb_parm h4;
615 struct inet6_skb_parm h6;
616 } header;
617
618 union {
619 struct ip_tunnel *ip4;
620 struct ip6_tnl *ip6;
621 } tunnel;
622};
623
624#define XFRM_TUNNEL_SKB_CB(__skb) ((struct xfrm_tunnel_skb_cb *)&((__skb)->cb[0]))
625
602/* 626/*
603 * This structure is used for the duration where packets are being 627 * This structure is used for the duration where packets are being
604 * transformed by IPsec. As soon as the packet leaves IPsec the 628 * transformed by IPsec. As soon as the packet leaves IPsec the
605 * area beyond the generic IP part may be overwritten. 629 * area beyond the generic IP part may be overwritten.
606 */ 630 */
607struct xfrm_skb_cb { 631struct xfrm_skb_cb {
608 union { 632 struct xfrm_tunnel_skb_cb header;
609 struct inet_skb_parm h4;
610 struct inet6_skb_parm h6;
611 } header;
612 633
613 /* Sequence number for replay protection. */ 634 /* Sequence number for replay protection. */
614 union { 635 union {
@@ -630,10 +651,7 @@ struct xfrm_skb_cb {
630 * to transmit header information to the mode input/output functions. 651 * to transmit header information to the mode input/output functions.
631 */ 652 */
632struct xfrm_mode_skb_cb { 653struct xfrm_mode_skb_cb {
633 union { 654 struct xfrm_tunnel_skb_cb header;
634 struct inet_skb_parm h4;
635 struct inet6_skb_parm h6;
636 } header;
637 655
638 /* Copied from header for IPv4, always set to zero and DF for IPv6. */ 656 /* Copied from header for IPv4, always set to zero and DF for IPv6. */
639 __be16 id; 657 __be16 id;
@@ -665,10 +683,7 @@ struct xfrm_mode_skb_cb {
665 * related information. 683 * related information.
666 */ 684 */
667struct xfrm_spi_skb_cb { 685struct xfrm_spi_skb_cb {
668 union { 686 struct xfrm_tunnel_skb_cb header;
669 struct inet_skb_parm h4;
670 struct inet6_skb_parm h6;
671 } header;
672 687
673 unsigned int daddroff; 688 unsigned int daddroff;
674 unsigned int family; 689 unsigned int family;
@@ -1347,18 +1362,34 @@ struct xfrm_algo_desc {
1347 struct sadb_alg desc; 1362 struct sadb_alg desc;
1348}; 1363};
1349 1364
1350/* XFRM tunnel handlers. */ 1365/* XFRM protocol handlers. */
1351struct xfrm_tunnel { 1366struct xfrm4_protocol {
1352 int (*handler)(struct sk_buff *skb); 1367 int (*handler)(struct sk_buff *skb);
1368 int (*input_handler)(struct sk_buff *skb, int nexthdr, __be32 spi,
1369 int encap_type);
1370 int (*cb_handler)(struct sk_buff *skb, int err);
1353 int (*err_handler)(struct sk_buff *skb, u32 info); 1371 int (*err_handler)(struct sk_buff *skb, u32 info);
1354 1372
1355 struct xfrm_tunnel __rcu *next; 1373 struct xfrm4_protocol __rcu *next;
1374 int priority;
1375};
1376
1377struct xfrm6_protocol {
1378 int (*handler)(struct sk_buff *skb);
1379 int (*cb_handler)(struct sk_buff *skb, int err);
1380 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
1381 u8 type, u8 code, int offset, __be32 info);
1382
1383 struct xfrm6_protocol __rcu *next;
1356 int priority; 1384 int priority;
1357}; 1385};
1358 1386
1359struct xfrm_tunnel_notifier { 1387/* XFRM tunnel handlers. */
1388struct xfrm_tunnel {
1360 int (*handler)(struct sk_buff *skb); 1389 int (*handler)(struct sk_buff *skb);
1361 struct xfrm_tunnel_notifier __rcu *next; 1390 int (*err_handler)(struct sk_buff *skb, u32 info);
1391
1392 struct xfrm_tunnel __rcu *next;
1362 int priority; 1393 int priority;
1363}; 1394};
1364 1395
@@ -1375,11 +1406,14 @@ void xfrm4_init(void);
1375int xfrm_state_init(struct net *net); 1406int xfrm_state_init(struct net *net);
1376void xfrm_state_fini(struct net *net); 1407void xfrm_state_fini(struct net *net);
1377void xfrm4_state_init(void); 1408void xfrm4_state_init(void);
1409void xfrm4_protocol_init(void);
1378#ifdef CONFIG_XFRM 1410#ifdef CONFIG_XFRM
1379int xfrm6_init(void); 1411int xfrm6_init(void);
1380void xfrm6_fini(void); 1412void xfrm6_fini(void);
1381int xfrm6_state_init(void); 1413int xfrm6_state_init(void);
1382void xfrm6_state_fini(void); 1414void xfrm6_state_fini(void);
1415int xfrm6_protocol_init(void);
1416void xfrm6_protocol_fini(void);
1383#else 1417#else
1384static inline int xfrm6_init(void) 1418static inline int xfrm6_init(void)
1385{ 1419{
@@ -1405,7 +1439,8 @@ static inline void xfrm_sysctl_fini(struct net *net)
1405} 1439}
1406#endif 1440#endif
1407 1441
1408void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1442void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto,
1443 struct xfrm_address_filter *filter);
1409int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1444int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1410 int (*func)(struct xfrm_state *, int, void*), void *); 1445 int (*func)(struct xfrm_state *, int, void*), void *);
1411void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net); 1446void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net);
@@ -1497,20 +1532,22 @@ int xfrm4_rcv(struct sk_buff *skb);
1497 1532
1498static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 1533static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1499{ 1534{
1500 return xfrm4_rcv_encap(skb, nexthdr, spi, 0); 1535 XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
1536 XFRM_SPI_SKB_CB(skb)->family = AF_INET;
1537 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
1538 return xfrm_input(skb, nexthdr, spi, 0);
1501} 1539}
1502 1540
1503int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1541int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1504int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1542int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1505int xfrm4_output(struct sk_buff *skb); 1543int xfrm4_output(struct sock *sk, struct sk_buff *skb);
1506int xfrm4_output_finish(struct sk_buff *skb); 1544int xfrm4_output_finish(struct sk_buff *skb);
1545int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1546int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
1547int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
1507int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1548int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1508int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1549int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1509void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1550void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1510int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1511int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1512int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1513int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1514int xfrm6_extract_header(struct sk_buff *skb); 1551int xfrm6_extract_header(struct sk_buff *skb);
1515int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1552int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1516int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1553int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
@@ -1519,13 +1556,16 @@ int xfrm6_rcv(struct sk_buff *skb);
1519int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1556int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1520 xfrm_address_t *saddr, u8 proto); 1557 xfrm_address_t *saddr, u8 proto);
1521void xfrm6_local_error(struct sk_buff *skb, u32 mtu); 1558void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1559int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1560int xfrm6_protocol_register(struct xfrm6_protocol *handler, unsigned char protocol);
1561int xfrm6_protocol_deregister(struct xfrm6_protocol *handler, unsigned char protocol);
1522int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1562int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1523int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1563int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1524__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1564__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1525__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); 1565__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1526int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1566int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1527int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1567int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1528int xfrm6_output(struct sk_buff *skb); 1568int xfrm6_output(struct sock *sk, struct sk_buff *skb);
1529int xfrm6_output_finish(struct sk_buff *skb); 1569int xfrm6_output_finish(struct sk_buff *skb);
1530int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 1570int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
1531 u8 **prevhdr); 1571 u8 **prevhdr);
@@ -1646,6 +1686,20 @@ static inline int xfrm_aevent_is_on(struct net *net)
1646 rcu_read_unlock(); 1686 rcu_read_unlock();
1647 return ret; 1687 return ret;
1648} 1688}
1689
1690static inline int xfrm_acquire_is_on(struct net *net)
1691{
1692 struct sock *nlsk;
1693 int ret = 0;
1694
1695 rcu_read_lock();
1696 nlsk = rcu_dereference(net->xfrm.nlsk);
1697 if (nlsk)
1698 ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE);
1699 rcu_read_unlock();
1700
1701 return ret;
1702}
1649#endif 1703#endif
1650 1704
1651static inline int aead_len(struct xfrm_algo_aead *alg) 1705static inline int aead_len(struct xfrm_algo_aead *alg)
@@ -1748,4 +1802,24 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1748 return ret; 1802 return ret;
1749} 1803}
1750 1804
1805static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x,
1806 unsigned int family)
1807{
1808 bool tunnel = false;
1809
1810 switch(family) {
1811 case AF_INET:
1812 if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4)
1813 tunnel = true;
1814 break;
1815 case AF_INET6:
1816 if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6)
1817 tunnel = true;
1818 break;
1819 }
1820 if (tunnel && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL))
1821 return -EINVAL;
1822
1823 return 0;
1824}
1751#endif /* _NET_XFRM_H */ 1825#endif /* _NET_XFRM_H */