aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2013-01-29 04:48:30 -0500
committerJiri Kosina <jkosina@suse.cz>2013-01-29 04:48:30 -0500
commit617677295b53a40d0e54aac4cbbc216ffbc755dd (patch)
tree51b9e87213243ed5efff252c8e8d8fec4eebc588 /include/net
parent5c8d1b68e01a144813e38795fe6dbe7ebb506131 (diff)
parent6abb7c25775b7fb2225ad0508236d63ca710e65f (diff)
Merge branch 'master' into for-next
Conflicts: drivers/devfreq/exynos4_bus.c Sync with Linus' tree to be able to apply patches that are against newer code (mvneta).
Diffstat (limited to 'include/net')
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/af_unix.h1
-rw-r--r--include/net/bluetooth/a2mp.h24
-rw-r--r--include/net/bluetooth/amp.h54
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/bluetooth/hci.h69
-rw-r--r--include/net/bluetooth/hci_core.h123
-rw-r--r--include/net/bluetooth/l2cap.h50
-rw-r--r--include/net/cfg80211.h315
-rw-r--r--include/net/cls_cgroup.h6
-rw-r--r--include/net/gro_cells.h14
-rw-r--r--include/net/ieee80211_radiotap.h24
-rw-r--r--include/net/inet_connection_sock.h1
-rw-r--r--include/net/inet_hashtables.h50
-rw-r--r--include/net/inet_sock.h8
-rw-r--r--include/net/inet_timewait_sock.h7
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip6_checksum.h35
-rw-r--r--include/net/ip6_fib.h20
-rw-r--r--include/net/ip6_route.h3
-rw-r--r--include/net/ip_vs.h195
-rw-r--r--include/net/ipip.h40
-rw-r--r--include/net/ipv6.h19
-rw-r--r--include/net/mac80211.h275
-rw-r--r--include/net/ndisc.h22
-rw-r--r--include/net/net_namespace.h26
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/netfilter/nf_nat.h15
-rw-r--r--include/net/netfilter/nf_queue.h8
-rw-r--r--include/net/netns/conntrack.h1
-rw-r--r--include/net/netns/sctp.h3
-rw-r--r--include/net/netns/x_tables.h1
-rw-r--r--include/net/netprio_cgroup.h11
-rw-r--r--include/net/nfc/hci.h21
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/protocol.h31
-rw-r--r--include/net/request_sock.h12
-rw-r--r--include/net/route.h9
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h7
-rw-r--r--include/net/sctp/command.h38
-rw-r--r--include/net/sctp/constants.h8
-rw-r--r--include/net/sctp/sctp.h12
-rw-r--r--include/net/sctp/sm.h2
-rw-r--r--include/net/sctp/structs.h39
-rw-r--r--include/net/sctp/ulpqueue.h2
-rw-r--r--include/net/sctp/user.h27
-rw-r--r--include/net/sock.h30
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/net/xfrm.h2
51 files changed, 1347 insertions, 329 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 9e63e76b20e7..df4ef9453384 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -172,6 +172,9 @@ extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
172extern int register_inet6addr_notifier(struct notifier_block *nb); 172extern int register_inet6addr_notifier(struct notifier_block *nb);
173extern int unregister_inet6addr_notifier(struct notifier_block *nb); 173extern int unregister_inet6addr_notifier(struct notifier_block *nb);
174 174
175extern void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
176 struct ipv6_devconf *devconf);
177
175/** 178/**
176 * __in6_dev_get - get inet6_dev pointer from netdevice 179 * __in6_dev_get - get inet6_dev pointer from netdevice
177 * @dev: network device 180 * @dev: network device
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b5f8988e4283..0a996a3517ed 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -53,7 +53,6 @@ struct unix_sock {
53 struct path path; 53 struct path path;
54 struct mutex readlock; 54 struct mutex readlock;
55 struct sock *peer; 55 struct sock *peer;
56 struct sock *other;
57 struct list_head link; 56 struct list_head link;
58 atomic_long_t inflight; 57 atomic_long_t inflight;
59 spinlock_t lock; 58 spinlock_t lock;
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index 6a76e0a0705e..42f21766c538 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -19,13 +19,25 @@
19 19
20#define A2MP_FEAT_EXT 0x8000 20#define A2MP_FEAT_EXT 0x8000
21 21
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL,
26};
27
22struct amp_mgr { 28struct amp_mgr {
29 struct list_head list;
23 struct l2cap_conn *l2cap_conn; 30 struct l2cap_conn *l2cap_conn;
24 struct l2cap_chan *a2mp_chan; 31 struct l2cap_chan *a2mp_chan;
32 struct l2cap_chan *bredr_chan;
25 struct kref kref; 33 struct kref kref;
26 __u8 ident; 34 __u8 ident;
27 __u8 handle; 35 __u8 handle;
36 enum amp_mgr_state state;
28 unsigned long flags; 37 unsigned long flags;
38
39 struct list_head amp_ctrls;
40 struct mutex amp_ctrls_lock;
29}; 41};
30 42
31struct a2mp_cmd { 43struct a2mp_cmd {
@@ -118,9 +130,19 @@ struct a2mp_physlink_rsp {
118#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05 130#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
119#define A2MP_STATUS_SECURITY_VIOLATION 0x06 131#define A2MP_STATUS_SECURITY_VIOLATION 0x06
120 132
121void amp_mgr_get(struct amp_mgr *mgr); 133extern struct list_head amp_mgr_list;
134extern struct mutex amp_mgr_list_lock;
135
136struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
122int amp_mgr_put(struct amp_mgr *mgr); 137int amp_mgr_put(struct amp_mgr *mgr);
138u8 __next_ident(struct amp_mgr *mgr);
123struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, 139struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
124 struct sk_buff *skb); 140 struct sk_buff *skb);
141struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
142void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
143void a2mp_discover_amp(struct l2cap_chan *chan);
144void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
145void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
146void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
125 147
126#endif /* __A2MP_H */ 148#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
new file mode 100644
index 000000000000..7ea3db77ba89
--- /dev/null
+++ b/include/net/bluetooth/amp.h
@@ -0,0 +1,54 @@
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#ifndef __AMP_H
15#define __AMP_H
16
17struct amp_ctrl {
18 struct list_head list;
19 struct kref kref;
20 __u8 id;
21 __u16 assoc_len_so_far;
22 __u16 assoc_rem_len;
23 __u16 assoc_len;
24 __u8 *assoc;
25};
26
27int amp_ctrl_put(struct amp_ctrl *ctrl);
28void amp_ctrl_get(struct amp_ctrl *ctrl);
29struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
30struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id, bool out);
35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37
38void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
42 struct hci_conn *hcon);
43void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
44 struct hci_conn *hcon);
45void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon);
50void amp_create_logical_link(struct l2cap_chan *chan);
51void amp_disconnect_logical_link(struct hci_chan *hchan);
52void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
53
54#endif /* __AMP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ede036977ae8..2554b3f5222a 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -180,7 +180,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
180} 180}
181 181
182void baswap(bdaddr_t *dst, bdaddr_t *src); 182void baswap(bdaddr_t *dst, bdaddr_t *src);
183char *batostr(bdaddr_t *ba);
184 183
185/* Common socket structures and functions */ 184/* Common socket structures and functions */
186 185
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 76b2b6bdcf36..45eee08157bb 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -33,6 +33,8 @@
33#define HCI_LINK_KEY_SIZE 16 33#define HCI_LINK_KEY_SIZE 16
34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE)
35 35
36#define HCI_MAX_AMP_ASSOC_SIZE 672
37
36/* HCI dev events */ 38/* HCI dev events */
37#define HCI_DEV_REG 1 39#define HCI_DEV_REG 1
38#define HCI_DEV_UNREG 2 40#define HCI_DEV_UNREG 2
@@ -113,6 +115,7 @@ enum {
113 HCI_SSP_ENABLED, 115 HCI_SSP_ENABLED,
114 HCI_HS_ENABLED, 116 HCI_HS_ENABLED,
115 HCI_LE_ENABLED, 117 HCI_LE_ENABLED,
118 HCI_LE_PERIPHERAL,
116 HCI_CONNECTABLE, 119 HCI_CONNECTABLE,
117 HCI_DISCOVERABLE, 120 HCI_DISCOVERABLE,
118 HCI_LINK_SECURITY, 121 HCI_LINK_SECURITY,
@@ -151,7 +154,7 @@ enum {
151#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 154#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
152#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 155#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
153#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ 156#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */
154#define HCI_CMD_TIMEOUT msecs_to_jiffies(1000) /* 1 second */ 157#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
155#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 158#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
156#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 159#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
157 160
@@ -196,6 +199,7 @@ enum {
196#define ACL_START_NO_FLUSH 0x00 199#define ACL_START_NO_FLUSH 0x00
197#define ACL_CONT 0x01 200#define ACL_CONT 0x01
198#define ACL_START 0x02 201#define ACL_START 0x02
202#define ACL_COMPLETE 0x03
199#define ACL_ACTIVE_BCAST 0x04 203#define ACL_ACTIVE_BCAST 0x04
200#define ACL_PICO_BCAST 0x08 204#define ACL_PICO_BCAST 0x08
201 205
@@ -205,6 +209,7 @@ enum {
205#define ESCO_LINK 0x02 209#define ESCO_LINK 0x02
206/* Low Energy links do not have defined link type. Use invented one */ 210/* Low Energy links do not have defined link type. Use invented one */
207#define LE_LINK 0x80 211#define LE_LINK 0x80
212#define AMP_LINK 0x81
208 213
209/* LMP features */ 214/* LMP features */
210#define LMP_3SLOT 0x01 215#define LMP_3SLOT 0x01
@@ -314,6 +319,9 @@ enum {
314#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 319#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
315#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 320#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
316 321
322/* The core spec defines 127 as the "not available" value */
323#define HCI_TX_POWER_INVALID 127
324
317/* Extended Inquiry Response field types */ 325/* Extended Inquiry Response field types */
318#define EIR_FLAGS 0x01 /* flags */ 326#define EIR_FLAGS 0x01 /* flags */
319#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 327#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
@@ -330,6 +338,13 @@ enum {
330#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ 338#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
331#define EIR_DEVICE_ID 0x10 /* device ID */ 339#define EIR_DEVICE_ID 0x10 /* device ID */
332 340
341/* Low Energy Advertising Flags */
342#define LE_AD_LIMITED 0x01 /* Limited Discoverable */
343#define LE_AD_GENERAL 0x02 /* General Discoverable */
344#define LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */
345#define LE_AD_SIM_LE_BREDR_CTRL 0x08 /* Simultaneous LE & BR/EDR Controller */
346#define LE_AD_SIM_LE_BREDR_HOST 0x10 /* Simultaneous LE & BR/EDR Host */
347
333/* ----- HCI Commands ---- */ 348/* ----- HCI Commands ---- */
334#define HCI_OP_NOP 0x0000 349#define HCI_OP_NOP 0x0000
335 350
@@ -556,12 +571,46 @@ struct hci_cp_accept_phy_link {
556 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 571 __u8 key[HCI_AMP_LINK_KEY_SIZE];
557} __packed; 572} __packed;
558 573
559#define HCI_OP_DISCONN_PHY_LINK 0x0437 574#define HCI_OP_DISCONN_PHY_LINK 0x0437
560struct hci_cp_disconn_phy_link { 575struct hci_cp_disconn_phy_link {
561 __u8 phy_handle; 576 __u8 phy_handle;
562 __u8 reason; 577 __u8 reason;
563} __packed; 578} __packed;
564 579
580struct ext_flow_spec {
581 __u8 id;
582 __u8 stype;
583 __le16 msdu;
584 __le32 sdu_itime;
585 __le32 acc_lat;
586 __le32 flush_to;
587} __packed;
588
589#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
590#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
591struct hci_cp_create_accept_logical_link {
592 __u8 phy_handle;
593 struct ext_flow_spec tx_flow_spec;
594 struct ext_flow_spec rx_flow_spec;
595} __packed;
596
597#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
598struct hci_cp_disconn_logical_link {
599 __le16 log_handle;
600} __packed;
601
602#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
603struct hci_cp_logical_link_cancel {
604 __u8 phy_handle;
605 __u8 flow_spec_id;
606} __packed;
607
608struct hci_rp_logical_link_cancel {
609 __u8 status;
610 __u8 phy_handle;
611 __u8 flow_spec_id;
612} __packed;
613
565#define HCI_OP_SNIFF_MODE 0x0803 614#define HCI_OP_SNIFF_MODE 0x0803
566struct hci_cp_sniff_mode { 615struct hci_cp_sniff_mode {
567 __le16 handle; 616 __le16 handle;
@@ -894,6 +943,22 @@ struct hci_rp_le_read_buffer_size {
894 __u8 le_max_pkt; 943 __u8 le_max_pkt;
895} __packed; 944} __packed;
896 945
946#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
947struct hci_rp_le_read_adv_tx_power {
948 __u8 status;
949 __s8 tx_power;
950} __packed;
951
952#define HCI_MAX_AD_LENGTH 31
953
954#define HCI_OP_LE_SET_ADV_DATA 0x2008
955struct hci_cp_le_set_adv_data {
956 __u8 length;
957 __u8 data[HCI_MAX_AD_LENGTH];
958} __packed;
959
960#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
961
897#define HCI_OP_LE_SET_SCAN_PARAM 0x200b 962#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
898struct hci_cp_le_set_scan_param { 963struct hci_cp_le_set_scan_param {
899 __u8 type; 964 __u8 type;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e7d454609881..014a2eaa5389 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -73,6 +73,7 @@ struct discovery_state {
73struct hci_conn_hash { 73struct hci_conn_hash {
74 struct list_head list; 74 struct list_head list;
75 unsigned int acl_num; 75 unsigned int acl_num;
76 unsigned int amp_num;
76 unsigned int sco_num; 77 unsigned int sco_num;
77 unsigned int le_num; 78 unsigned int le_num;
78}; 79};
@@ -124,6 +125,14 @@ struct le_scan_params {
124 125
125#define HCI_MAX_SHORT_NAME_LENGTH 10 126#define HCI_MAX_SHORT_NAME_LENGTH 10
126 127
128struct amp_assoc {
129 __u16 len;
130 __u16 offset;
131 __u16 rem_len;
132 __u16 len_so_far;
133 __u8 data[HCI_MAX_AMP_ASSOC_SIZE];
134};
135
127#define NUM_REASSEMBLY 4 136#define NUM_REASSEMBLY 4
128struct hci_dev { 137struct hci_dev {
129 struct list_head list; 138 struct list_head list;
@@ -177,6 +186,8 @@ struct hci_dev {
177 __u32 amp_max_flush_to; 186 __u32 amp_max_flush_to;
178 __u32 amp_be_flush_to; 187 __u32 amp_be_flush_to;
179 188
189 struct amp_assoc loc_assoc;
190
180 __u8 flow_ctl_mode; 191 __u8 flow_ctl_mode;
181 192
182 unsigned int auto_accept_delay; 193 unsigned int auto_accept_delay;
@@ -252,8 +263,6 @@ struct hci_dev {
252 263
253 struct sk_buff_head driver_init; 264 struct sk_buff_head driver_init;
254 265
255 void *core_data;
256
257 atomic_t promisc; 266 atomic_t promisc;
258 267
259 struct dentry *debugfs; 268 struct dentry *debugfs;
@@ -269,6 +278,10 @@ struct hci_dev {
269 struct work_struct le_scan; 278 struct work_struct le_scan;
270 struct le_scan_params le_scan_params; 279 struct le_scan_params le_scan_params;
271 280
281 __s8 adv_tx_power;
282 __u8 adv_data[HCI_MAX_AD_LENGTH];
283 __u8 adv_data_len;
284
272 int (*open)(struct hci_dev *hdev); 285 int (*open)(struct hci_dev *hdev);
273 int (*close)(struct hci_dev *hdev); 286 int (*close)(struct hci_dev *hdev);
274 int (*flush)(struct hci_dev *hdev); 287 int (*flush)(struct hci_dev *hdev);
@@ -277,6 +290,8 @@ struct hci_dev {
277 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 290 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
278}; 291};
279 292
293#define HCI_PHY_HANDLE(handle) (handle & 0xff)
294
280struct hci_conn { 295struct hci_conn {
281 struct list_head list; 296 struct list_head list;
282 297
@@ -310,6 +325,7 @@ struct hci_conn {
310 325
311 __u8 remote_cap; 326 __u8 remote_cap;
312 __u8 remote_auth; 327 __u8 remote_auth;
328 __u8 remote_id;
313 bool flush_key; 329 bool flush_key;
314 330
315 unsigned int sent; 331 unsigned int sent;
@@ -339,10 +355,11 @@ struct hci_conn {
339 355
340struct hci_chan { 356struct hci_chan {
341 struct list_head list; 357 struct list_head list;
342 358 __u16 handle;
343 struct hci_conn *conn; 359 struct hci_conn *conn;
344 struct sk_buff_head data_q; 360 struct sk_buff_head data_q;
345 unsigned int sent; 361 unsigned int sent;
362 __u8 state;
346}; 363};
347 364
348extern struct list_head hci_dev_list; 365extern struct list_head hci_dev_list;
@@ -359,7 +376,7 @@ extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
359extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 376extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
360 u16 flags); 377 u16 flags);
361 378
362extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 379extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
363extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); 380extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
364extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 381extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
365extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); 382extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
@@ -438,6 +455,9 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
438 case ACL_LINK: 455 case ACL_LINK:
439 h->acl_num++; 456 h->acl_num++;
440 break; 457 break;
458 case AMP_LINK:
459 h->amp_num++;
460 break;
441 case LE_LINK: 461 case LE_LINK:
442 h->le_num++; 462 h->le_num++;
443 break; 463 break;
@@ -459,6 +479,9 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
459 case ACL_LINK: 479 case ACL_LINK:
460 h->acl_num--; 480 h->acl_num--;
461 break; 481 break;
482 case AMP_LINK:
483 h->amp_num--;
484 break;
462 case LE_LINK: 485 case LE_LINK:
463 h->le_num--; 486 h->le_num--;
464 break; 487 break;
@@ -475,6 +498,8 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
475 switch (type) { 498 switch (type) {
476 case ACL_LINK: 499 case ACL_LINK:
477 return h->acl_num; 500 return h->acl_num;
501 case AMP_LINK:
502 return h->amp_num;
478 case LE_LINK: 503 case LE_LINK:
479 return h->le_num; 504 return h->le_num;
480 case SCO_LINK: 505 case SCO_LINK:
@@ -552,10 +577,12 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
552int hci_conn_del(struct hci_conn *conn); 577int hci_conn_del(struct hci_conn *conn);
553void hci_conn_hash_flush(struct hci_dev *hdev); 578void hci_conn_hash_flush(struct hci_dev *hdev);
554void hci_conn_check_pending(struct hci_dev *hdev); 579void hci_conn_check_pending(struct hci_dev *hdev);
580void hci_conn_accept(struct hci_conn *conn, int mask);
555 581
556struct hci_chan *hci_chan_create(struct hci_conn *conn); 582struct hci_chan *hci_chan_create(struct hci_conn *conn);
557void hci_chan_del(struct hci_chan *chan); 583void hci_chan_del(struct hci_chan *chan);
558void hci_chan_list_flush(struct hci_conn *conn); 584void hci_chan_list_flush(struct hci_conn *conn);
585struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
559 586
560struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 587struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
561 __u8 dst_type, __u8 sec_level, __u8 auth_type); 588 __u8 dst_type, __u8 sec_level, __u8 auth_type);
@@ -584,7 +611,10 @@ static inline void hci_conn_put(struct hci_conn *conn)
584 611
585 if (atomic_dec_and_test(&conn->refcnt)) { 612 if (atomic_dec_and_test(&conn->refcnt)) {
586 unsigned long timeo; 613 unsigned long timeo;
587 if (conn->type == ACL_LINK || conn->type == LE_LINK) { 614
615 switch (conn->type) {
616 case ACL_LINK:
617 case LE_LINK:
588 del_timer(&conn->idle_timer); 618 del_timer(&conn->idle_timer);
589 if (conn->state == BT_CONNECTED) { 619 if (conn->state == BT_CONNECTED) {
590 timeo = conn->disc_timeout; 620 timeo = conn->disc_timeout;
@@ -593,12 +623,20 @@ static inline void hci_conn_put(struct hci_conn *conn)
593 } else { 623 } else {
594 timeo = msecs_to_jiffies(10); 624 timeo = msecs_to_jiffies(10);
595 } 625 }
596 } else { 626 break;
627
628 case AMP_LINK:
629 timeo = conn->disc_timeout;
630 break;
631
632 default:
597 timeo = msecs_to_jiffies(10); 633 timeo = msecs_to_jiffies(10);
634 break;
598 } 635 }
636
599 cancel_delayed_work(&conn->disc_work); 637 cancel_delayed_work(&conn->disc_work);
600 queue_delayed_work(conn->hdev->workqueue, 638 queue_delayed_work(conn->hdev->workqueue,
601 &conn->disc_work, timeo); 639 &conn->disc_work, timeo);
602 } 640 }
603} 641}
604 642
@@ -650,7 +688,7 @@ static inline uint8_t __hci_num_ctrl(void)
650} 688}
651 689
652struct hci_dev *hci_dev_get(int index); 690struct hci_dev *hci_dev_get(int index);
653struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 691struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src);
654 692
655struct hci_dev *hci_alloc_dev(void); 693struct hci_dev *hci_alloc_dev(void);
656void hci_free_dev(struct hci_dev *hdev); 694void hci_free_dev(struct hci_dev *hdev);
@@ -699,6 +737,8 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
699 u8 *randomizer); 737 u8 *randomizer);
700int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 738int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
701 739
740int hci_update_ad(struct hci_dev *hdev);
741
702void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 742void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
703 743
704int hci_recv_frame(struct sk_buff *skb); 744int hci_recv_frame(struct sk_buff *skb);
@@ -715,22 +755,51 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
715#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) 755#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
716 756
717/* ----- LMP capabilities ----- */ 757/* ----- LMP capabilities ----- */
718#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
719#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) 758#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT)
759#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
760#define lmp_hold_capable(dev) ((dev)->features[0] & LMP_HOLD)
720#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) 761#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF)
721#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 762#define lmp_park_capable(dev) ((dev)->features[1] & LMP_PARK)
763#define lmp_inq_rssi_capable(dev) ((dev)->features[3] & LMP_RSSI_INQ)
722#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 764#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
765#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR))
766#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
767#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
768#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC)
769#define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ)
770#define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR)
723#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 771#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
724#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 772#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
725#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 773#define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO)
726#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) 774#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[7] & LMP_INQ_TX_PWR)
775#define lmp_ext_feat_capable(dev) ((dev)->features[7] & LMP_EXTFEATURES)
727 776
728/* ----- Extended LMP capabilities ----- */ 777/* ----- Extended LMP capabilities ----- */
729#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 778#define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP)
779#define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE)
780#define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR)
781
782/* returns true if at least one AMP active */
783static inline bool hci_amp_capable(void)
784{
785 struct hci_dev *hdev;
786 bool ret = false;
787
788 read_lock(&hci_dev_list_lock);
789 list_for_each_entry(hdev, &hci_dev_list, list)
790 if (hdev->amp_type == HCI_AMP &&
791 test_bit(HCI_UP, &hdev->flags))
792 ret = true;
793 read_unlock(&hci_dev_list_lock);
794
795 return ret;
796}
730 797
731/* ----- HCI protocols ----- */ 798/* ----- HCI protocols ----- */
799#define HCI_PROTO_DEFER 0x01
800
732static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, 801static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
733 __u8 type) 802 __u8 type, __u8 *flags)
734{ 803{
735 switch (type) { 804 switch (type) {
736 case ACL_LINK: 805 case ACL_LINK:
@@ -738,7 +807,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
738 807
739 case SCO_LINK: 808 case SCO_LINK:
740 case ESCO_LINK: 809 case ESCO_LINK:
741 return sco_connect_ind(hdev, bdaddr); 810 return sco_connect_ind(hdev, bdaddr, flags);
742 811
743 default: 812 default:
744 BT_ERR("unknown link type %d", type); 813 BT_ERR("unknown link type %d", type);
@@ -789,6 +858,10 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
789 sco_disconn_cfm(conn, reason); 858 sco_disconn_cfm(conn, reason);
790 break; 859 break;
791 860
861 /* L2CAP would be handled for BREDR chan */
862 case AMP_LINK:
863 break;
864
792 default: 865 default:
793 BT_ERR("unknown link type %d", conn->type); 866 BT_ERR("unknown link type %d", conn->type);
794 break; 867 break;
@@ -841,7 +914,7 @@ struct hci_cb {
841 914
842static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 915static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
843{ 916{
844 struct list_head *p; 917 struct hci_cb *cb;
845 __u8 encrypt; 918 __u8 encrypt;
846 919
847 hci_proto_auth_cfm(conn, status); 920 hci_proto_auth_cfm(conn, status);
@@ -852,8 +925,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
852 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 925 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
853 926
854 read_lock(&hci_cb_list_lock); 927 read_lock(&hci_cb_list_lock);
855 list_for_each(p, &hci_cb_list) { 928 list_for_each_entry(cb, &hci_cb_list, list) {
856 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
857 if (cb->security_cfm) 929 if (cb->security_cfm)
858 cb->security_cfm(conn, status, encrypt); 930 cb->security_cfm(conn, status, encrypt);
859 } 931 }
@@ -863,7 +935,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
863static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, 935static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
864 __u8 encrypt) 936 __u8 encrypt)
865{ 937{
866 struct list_head *p; 938 struct hci_cb *cb;
867 939
868 if (conn->sec_level == BT_SECURITY_SDP) 940 if (conn->sec_level == BT_SECURITY_SDP)
869 conn->sec_level = BT_SECURITY_LOW; 941 conn->sec_level = BT_SECURITY_LOW;
@@ -874,8 +946,7 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
874 hci_proto_encrypt_cfm(conn, status, encrypt); 946 hci_proto_encrypt_cfm(conn, status, encrypt);
875 947
876 read_lock(&hci_cb_list_lock); 948 read_lock(&hci_cb_list_lock);
877 list_for_each(p, &hci_cb_list) { 949 list_for_each_entry(cb, &hci_cb_list, list) {
878 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
879 if (cb->security_cfm) 950 if (cb->security_cfm)
880 cb->security_cfm(conn, status, encrypt); 951 cb->security_cfm(conn, status, encrypt);
881 } 952 }
@@ -884,11 +955,10 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
884 955
885static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) 956static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
886{ 957{
887 struct list_head *p; 958 struct hci_cb *cb;
888 959
889 read_lock(&hci_cb_list_lock); 960 read_lock(&hci_cb_list_lock);
890 list_for_each(p, &hci_cb_list) { 961 list_for_each_entry(cb, &hci_cb_list, list) {
891 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
892 if (cb->key_change_cfm) 962 if (cb->key_change_cfm)
893 cb->key_change_cfm(conn, status); 963 cb->key_change_cfm(conn, status);
894 } 964 }
@@ -898,11 +968,10 @@ static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
898static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, 968static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
899 __u8 role) 969 __u8 role)
900{ 970{
901 struct list_head *p; 971 struct hci_cb *cb;
902 972
903 read_lock(&hci_cb_list_lock); 973 read_lock(&hci_cb_list_lock);
904 list_for_each(p, &hci_cb_list) { 974 list_for_each_entry(cb, &hci_cb_list, list) {
905 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
906 if (cb->role_switch_cfm) 975 if (cb->role_switch_cfm)
907 cb->role_switch_cfm(conn, status, role); 976 cb->role_switch_cfm(conn, status, role);
908 } 977 }
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7ed8e356425a..7588ef44ebaf 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -32,13 +32,14 @@
32/* L2CAP defaults */ 32/* L2CAP defaults */
33#define L2CAP_DEFAULT_MTU 672 33#define L2CAP_DEFAULT_MTU 672
34#define L2CAP_DEFAULT_MIN_MTU 48 34#define L2CAP_DEFAULT_MIN_MTU 48
35#define L2CAP_DEFAULT_FLUSH_TO 0xffff 35#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
36#define L2CAP_EFS_DEFAULT_FLUSH_TO 0xFFFFFFFF
36#define L2CAP_DEFAULT_TX_WINDOW 63 37#define L2CAP_DEFAULT_TX_WINDOW 63
37#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF 38#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
38#define L2CAP_DEFAULT_MAX_TX 3 39#define L2CAP_DEFAULT_MAX_TX 3
39#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ 40#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 41#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 42#define L2CAP_DEFAULT_MAX_PDU_SIZE 1492 /* Sized for AMP packet */
42#define L2CAP_DEFAULT_ACK_TO 200 43#define L2CAP_DEFAULT_ACK_TO 200
43#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF 44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
44#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
@@ -51,6 +52,8 @@
51#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000) 52#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
52#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) 53#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
53#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) 54#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
55#define L2CAP_MOVE_TIMEOUT msecs_to_jiffies(4000)
56#define L2CAP_MOVE_ERTX_TIMEOUT msecs_to_jiffies(60000)
54 57
55#define L2CAP_A2MP_DEFAULT_MTU 670 58#define L2CAP_A2MP_DEFAULT_MTU 670
56 59
@@ -433,6 +436,8 @@ struct l2cap_chan {
433 struct sock *sk; 436 struct sock *sk;
434 437
435 struct l2cap_conn *conn; 438 struct l2cap_conn *conn;
439 struct hci_conn *hs_hcon;
440 struct hci_chan *hs_hchan;
436 struct kref kref; 441 struct kref kref;
437 442
438 __u8 state; 443 __u8 state;
@@ -476,6 +481,12 @@ struct l2cap_chan {
476 unsigned long conn_state; 481 unsigned long conn_state;
477 unsigned long flags; 482 unsigned long flags;
478 483
484 __u8 remote_amp_id;
485 __u8 local_amp_id;
486 __u8 move_id;
487 __u8 move_state;
488 __u8 move_role;
489
479 __u16 next_tx_seq; 490 __u16 next_tx_seq;
480 __u16 expected_ack_seq; 491 __u16 expected_ack_seq;
481 __u16 expected_tx_seq; 492 __u16 expected_tx_seq;
@@ -538,6 +549,7 @@ struct l2cap_ops {
538 void (*state_change) (struct l2cap_chan *chan, 549 void (*state_change) (struct l2cap_chan *chan,
539 int state); 550 int state);
540 void (*ready) (struct l2cap_chan *chan); 551 void (*ready) (struct l2cap_chan *chan);
552 void (*defer) (struct l2cap_chan *chan);
541 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 553 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
542 unsigned long len, int nb); 554 unsigned long len, int nb);
543}; 555};
@@ -599,7 +611,7 @@ enum {
599 CONF_MTU_DONE, 611 CONF_MTU_DONE,
600 CONF_MODE_DONE, 612 CONF_MODE_DONE,
601 CONF_CONNECT_PEND, 613 CONF_CONNECT_PEND,
602 CONF_NO_FCS_RECV, 614 CONF_RECV_NO_FCS,
603 CONF_STATE2_DEVICE, 615 CONF_STATE2_DEVICE,
604 CONF_EWS_RECV, 616 CONF_EWS_RECV,
605 CONF_LOC_CONF_PEND, 617 CONF_LOC_CONF_PEND,
@@ -640,6 +652,9 @@ enum {
640enum { 652enum {
641 L2CAP_RX_STATE_RECV, 653 L2CAP_RX_STATE_RECV,
642 L2CAP_RX_STATE_SREJ_SENT, 654 L2CAP_RX_STATE_SREJ_SENT,
655 L2CAP_RX_STATE_MOVE,
656 L2CAP_RX_STATE_WAIT_P,
657 L2CAP_RX_STATE_WAIT_F,
643}; 658};
644 659
645enum { 660enum {
@@ -670,6 +685,25 @@ enum {
670 L2CAP_EV_RECV_FRAME, 685 L2CAP_EV_RECV_FRAME,
671}; 686};
672 687
688enum {
689 L2CAP_MOVE_ROLE_NONE,
690 L2CAP_MOVE_ROLE_INITIATOR,
691 L2CAP_MOVE_ROLE_RESPONDER,
692};
693
694enum {
695 L2CAP_MOVE_STABLE,
696 L2CAP_MOVE_WAIT_REQ,
697 L2CAP_MOVE_WAIT_RSP,
698 L2CAP_MOVE_WAIT_RSP_SUCCESS,
699 L2CAP_MOVE_WAIT_CONFIRM,
700 L2CAP_MOVE_WAIT_CONFIRM_RSP,
701 L2CAP_MOVE_WAIT_LOGICAL_COMP,
702 L2CAP_MOVE_WAIT_LOGICAL_CFM,
703 L2CAP_MOVE_WAIT_LOCAL_BUSY,
704 L2CAP_MOVE_WAIT_PREPARE,
705};
706
673void l2cap_chan_hold(struct l2cap_chan *c); 707void l2cap_chan_hold(struct l2cap_chan *c);
674void l2cap_chan_put(struct l2cap_chan *c); 708void l2cap_chan_put(struct l2cap_chan *c);
675 709
@@ -745,6 +779,10 @@ static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
745{ 779{
746} 780}
747 781
782static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
783{
784}
785
748extern bool disable_ertm; 786extern bool disable_ertm;
749 787
750int l2cap_init_sockets(void); 788int l2cap_init_sockets(void);
@@ -767,6 +805,12 @@ int l2cap_chan_check_security(struct l2cap_chan *chan);
767void l2cap_chan_set_defaults(struct l2cap_chan *chan); 805void l2cap_chan_set_defaults(struct l2cap_chan *chan);
768int l2cap_ertm_init(struct l2cap_chan *chan); 806int l2cap_ertm_init(struct l2cap_chan *chan);
769void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 807void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
808void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
770void l2cap_chan_del(struct l2cap_chan *chan, int err); 809void l2cap_chan_del(struct l2cap_chan *chan, int err);
810void l2cap_send_conn_req(struct l2cap_chan *chan);
811void l2cap_move_start(struct l2cap_chan *chan);
812void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
813 u8 status);
814void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
771 815
772#endif /* __L2CAP_H */ 816#endif /* __L2CAP_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f8cd4cf3fad8..8e6a6b73b9c9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -58,6 +58,8 @@
58 * structures here describe these capabilities in detail. 58 * structures here describe these capabilities in detail.
59 */ 59 */
60 60
61struct wiphy;
62
61/* 63/*
62 * wireless hardware capability structures 64 * wireless hardware capability structures
63 */ 65 */
@@ -306,6 +308,104 @@ struct key_params {
306}; 308};
307 309
308/** 310/**
311 * struct cfg80211_chan_def - channel definition
312 * @chan: the (control) channel
313 * @width: channel width
314 * @center_freq1: center frequency of first segment
315 * @center_freq2: center frequency of second segment
316 * (only with 80+80 MHz)
317 */
318struct cfg80211_chan_def {
319 struct ieee80211_channel *chan;
320 enum nl80211_chan_width width;
321 u32 center_freq1;
322 u32 center_freq2;
323};
324
325/**
326 * cfg80211_get_chandef_type - return old channel type from chandef
327 * @chandef: the channel definition
328 *
329 * Returns the old channel type (NOHT, HT20, HT40+/-) from a given
330 * chandef, which must have a bandwidth allowing this conversion.
331 */
332static inline enum nl80211_channel_type
333cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
334{
335 switch (chandef->width) {
336 case NL80211_CHAN_WIDTH_20_NOHT:
337 return NL80211_CHAN_NO_HT;
338 case NL80211_CHAN_WIDTH_20:
339 return NL80211_CHAN_HT20;
340 case NL80211_CHAN_WIDTH_40:
341 if (chandef->center_freq1 > chandef->chan->center_freq)
342 return NL80211_CHAN_HT40PLUS;
343 return NL80211_CHAN_HT40MINUS;
344 default:
345 WARN_ON(1);
346 return NL80211_CHAN_NO_HT;
347 }
348}
349
350/**
351 * cfg80211_chandef_create - create channel definition using channel type
352 * @chandef: the channel definition struct to fill
353 * @channel: the control channel
354 * @chantype: the channel type
355 *
356 * Given a channel type, create a channel definition.
357 */
358void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
359 struct ieee80211_channel *channel,
360 enum nl80211_channel_type chantype);
361
362/**
363 * cfg80211_chandef_identical - check if two channel definitions are identical
364 * @chandef1: first channel definition
365 * @chandef2: second channel definition
366 *
367 * Returns %true if the channels defined by the channel definitions are
368 * identical, %false otherwise.
369 */
370static inline bool
371cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
372 const struct cfg80211_chan_def *chandef2)
373{
374 return (chandef1->chan == chandef2->chan &&
375 chandef1->width == chandef2->width &&
376 chandef1->center_freq1 == chandef2->center_freq1 &&
377 chandef1->center_freq2 == chandef2->center_freq2);
378}
379
380/**
381 * cfg80211_chandef_compatible - check if two channel definitions are compatible
382 * @chandef1: first channel definition
383 * @chandef2: second channel definition
384 *
385 * Returns %NULL if the given channel definitions are incompatible,
386 * chandef1 or chandef2 otherwise.
387 */
388const struct cfg80211_chan_def *
389cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
390 const struct cfg80211_chan_def *chandef2);
391
392/**
393 * cfg80211_chandef_valid - check if a channel definition is valid
394 * @chandef: the channel definition to check
395 */
396bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
397
398/**
399 * cfg80211_chandef_usable - check if secondary channels can be used
400 * @wiphy: the wiphy to validate against
401 * @chandef: the channel definition to check
402 * @prohibited_flags: the regulatory chanenl flags that must not be set
403 */
404bool cfg80211_chandef_usable(struct wiphy *wiphy,
405 const struct cfg80211_chan_def *chandef,
406 u32 prohibited_flags);
407
408/**
309 * enum survey_info_flags - survey information flags 409 * enum survey_info_flags - survey information flags
310 * 410 *
311 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 411 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
@@ -426,8 +526,7 @@ struct cfg80211_beacon_data {
426 * 526 *
427 * Used to configure an AP interface. 527 * Used to configure an AP interface.
428 * 528 *
429 * @channel: the channel to start the AP on 529 * @chandef: defines the channel to use
430 * @channel_type: the channel type to use
431 * @beacon: beacon data 530 * @beacon: beacon data
432 * @beacon_interval: beacon interval 531 * @beacon_interval: beacon interval
433 * @dtim_period: DTIM period 532 * @dtim_period: DTIM period
@@ -439,10 +538,11 @@ struct cfg80211_beacon_data {
439 * @privacy: the BSS uses privacy 538 * @privacy: the BSS uses privacy
440 * @auth_type: Authentication type (algorithm) 539 * @auth_type: Authentication type (algorithm)
441 * @inactivity_timeout: time in seconds to determine station's inactivity. 540 * @inactivity_timeout: time in seconds to determine station's inactivity.
541 * @p2p_ctwindow: P2P CT Window
542 * @p2p_opp_ps: P2P opportunistic PS
442 */ 543 */
443struct cfg80211_ap_settings { 544struct cfg80211_ap_settings {
444 struct ieee80211_channel *channel; 545 struct cfg80211_chan_def chandef;
445 enum nl80211_channel_type channel_type;
446 546
447 struct cfg80211_beacon_data beacon; 547 struct cfg80211_beacon_data beacon;
448 548
@@ -454,6 +554,8 @@ struct cfg80211_ap_settings {
454 bool privacy; 554 bool privacy;
455 enum nl80211_auth_type auth_type; 555 enum nl80211_auth_type auth_type;
456 int inactivity_timeout; 556 int inactivity_timeout;
557 u8 p2p_ctwindow;
558 bool p2p_opp_ps;
457}; 559};
458 560
459/** 561/**
@@ -498,6 +600,7 @@ enum station_parameters_apply_mask {
498 * @plink_action: plink action to take 600 * @plink_action: plink action to take
499 * @plink_state: set the peer link state for a station 601 * @plink_state: set the peer link state for a station
500 * @ht_capa: HT capabilities of station 602 * @ht_capa: HT capabilities of station
603 * @vht_capa: VHT capabilities of station
501 * @uapsd_queues: bitmap of queues configured for uapsd. same format 604 * @uapsd_queues: bitmap of queues configured for uapsd. same format
502 * as the AC bitmap in the QoS info field 605 * as the AC bitmap in the QoS info field
503 * @max_sp: max Service Period. same format as the MAX_SP in the 606 * @max_sp: max Service Period. same format as the MAX_SP in the
@@ -517,6 +620,7 @@ struct station_parameters {
517 u8 plink_action; 620 u8 plink_action;
518 u8 plink_state; 621 u8 plink_state;
519 struct ieee80211_ht_cap *ht_capa; 622 struct ieee80211_ht_cap *ht_capa;
623 struct ieee80211_vht_cap *vht_capa;
520 u8 uapsd_queues; 624 u8 uapsd_queues;
521 u8 max_sp; 625 u8 max_sp;
522}; 626};
@@ -580,16 +684,24 @@ enum station_info_flags {
580 * Used by the driver to indicate the specific rate transmission 684 * Used by the driver to indicate the specific rate transmission
581 * type for 802.11n transmissions. 685 * type for 802.11n transmissions.
582 * 686 *
583 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 687 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
584 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 688 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
689 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
690 * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
691 * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
692 * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
585 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 693 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
586 * @RATE_INFO_FLAGS_60G: 60gHz MCS 694 * @RATE_INFO_FLAGS_60G: 60GHz MCS
587 */ 695 */
588enum rate_info_flags { 696enum rate_info_flags {
589 RATE_INFO_FLAGS_MCS = 1<<0, 697 RATE_INFO_FLAGS_MCS = BIT(0),
590 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 698 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
591 RATE_INFO_FLAGS_SHORT_GI = 1<<2, 699 RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2),
592 RATE_INFO_FLAGS_60G = 1<<3, 700 RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3),
701 RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4),
702 RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5),
703 RATE_INFO_FLAGS_SHORT_GI = BIT(6),
704 RATE_INFO_FLAGS_60G = BIT(7),
593}; 705};
594 706
595/** 707/**
@@ -600,11 +712,13 @@ enum rate_info_flags {
600 * @flags: bitflag of flags from &enum rate_info_flags 712 * @flags: bitflag of flags from &enum rate_info_flags
601 * @mcs: mcs index if struct describes a 802.11n bitrate 713 * @mcs: mcs index if struct describes a 802.11n bitrate
602 * @legacy: bitrate in 100kbit/s for 802.11abg 714 * @legacy: bitrate in 100kbit/s for 802.11abg
715 * @nss: number of streams (VHT only)
603 */ 716 */
604struct rate_info { 717struct rate_info {
605 u8 flags; 718 u8 flags;
606 u8 mcs; 719 u8 mcs;
607 u16 legacy; 720 u16 legacy;
721 u8 nss;
608}; 722};
609 723
610/** 724/**
@@ -803,6 +917,8 @@ struct mpath_info {
803 * @ap_isolate: do not forward packets between connected stations 917 * @ap_isolate: do not forward packets between connected stations
804 * @ht_opmode: HT Operation mode 918 * @ht_opmode: HT Operation mode
805 * (u16 = opmode, -1 = do not change) 919 * (u16 = opmode, -1 = do not change)
920 * @p2p_ctwindow: P2P CT Window (-1 = no change)
921 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
806 */ 922 */
807struct bss_parameters { 923struct bss_parameters {
808 int use_cts_prot; 924 int use_cts_prot;
@@ -812,6 +928,7 @@ struct bss_parameters {
812 u8 basic_rates_len; 928 u8 basic_rates_len;
813 int ap_isolate; 929 int ap_isolate;
814 int ht_opmode; 930 int ht_opmode;
931 s8 p2p_ctwindow, p2p_opp_ps;
815}; 932};
816 933
817/** 934/**
@@ -907,8 +1024,7 @@ struct mesh_config {
907 1024
908/** 1025/**
909 * struct mesh_setup - 802.11s mesh setup configuration 1026 * struct mesh_setup - 802.11s mesh setup configuration
910 * @channel: the channel to start the mesh network on 1027 * @chandef: defines the channel to use
911 * @channel_type: the channel type to use
912 * @mesh_id: the mesh ID 1028 * @mesh_id: the mesh ID
913 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1029 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
914 * @sync_method: which synchronization method to use 1030 * @sync_method: which synchronization method to use
@@ -923,8 +1039,7 @@ struct mesh_config {
923 * These parameters are fixed when the mesh is created. 1039 * These parameters are fixed when the mesh is created.
924 */ 1040 */
925struct mesh_setup { 1041struct mesh_setup {
926 struct ieee80211_channel *channel; 1042 struct cfg80211_chan_def chandef;
927 enum nl80211_channel_type channel_type;
928 const u8 *mesh_id; 1043 const u8 *mesh_id;
929 u8 mesh_id_len; 1044 u8 mesh_id_len;
930 u8 sync_method; 1045 u8 sync_method;
@@ -955,9 +1070,6 @@ struct ieee80211_txq_params {
955 u8 aifs; 1070 u8 aifs;
956}; 1071};
957 1072
958/* from net/wireless.h */
959struct wiphy;
960
961/** 1073/**
962 * DOC: Scanning and BSS list handling 1074 * DOC: Scanning and BSS list handling
963 * 1075 *
@@ -1000,8 +1112,10 @@ struct cfg80211_ssid {
1000 * @n_channels: total number of channels to scan 1112 * @n_channels: total number of channels to scan
1001 * @ie: optional information element(s) to add into Probe Request or %NULL 1113 * @ie: optional information element(s) to add into Probe Request or %NULL
1002 * @ie_len: length of ie in octets 1114 * @ie_len: length of ie in octets
1115 * @flags: bit field of flags controlling operation
1003 * @rates: bitmap of rates to advertise for each band 1116 * @rates: bitmap of rates to advertise for each band
1004 * @wiphy: the wiphy this was for 1117 * @wiphy: the wiphy this was for
1118 * @scan_start: time (in jiffies) when the scan started
1005 * @wdev: the wireless device to scan for 1119 * @wdev: the wireless device to scan for
1006 * @aborted: (internal) scan request was notified as aborted 1120 * @aborted: (internal) scan request was notified as aborted
1007 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1121 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
@@ -1012,6 +1126,7 @@ struct cfg80211_scan_request {
1012 u32 n_channels; 1126 u32 n_channels;
1013 const u8 *ie; 1127 const u8 *ie;
1014 size_t ie_len; 1128 size_t ie_len;
1129 u32 flags;
1015 1130
1016 u32 rates[IEEE80211_NUM_BANDS]; 1131 u32 rates[IEEE80211_NUM_BANDS];
1017 1132
@@ -1019,6 +1134,7 @@ struct cfg80211_scan_request {
1019 1134
1020 /* internal */ 1135 /* internal */
1021 struct wiphy *wiphy; 1136 struct wiphy *wiphy;
1137 unsigned long scan_start;
1022 bool aborted; 1138 bool aborted;
1023 bool no_cck; 1139 bool no_cck;
1024 1140
@@ -1044,6 +1160,7 @@ struct cfg80211_match_set {
1044 * @interval: interval between each scheduled scan cycle 1160 * @interval: interval between each scheduled scan cycle
1045 * @ie: optional information element(s) to add into Probe Request or %NULL 1161 * @ie: optional information element(s) to add into Probe Request or %NULL
1046 * @ie_len: length of ie in octets 1162 * @ie_len: length of ie in octets
1163 * @flags: bit field of flags controlling operation
1047 * @match_sets: sets of parameters to be matched for a scan result 1164 * @match_sets: sets of parameters to be matched for a scan result
1048 * entry to be considered valid and to be passed to the host 1165 * entry to be considered valid and to be passed to the host
1049 * (others are filtered out). 1166 * (others are filtered out).
@@ -1061,6 +1178,7 @@ struct cfg80211_sched_scan_request {
1061 u32 interval; 1178 u32 interval;
1062 const u8 *ie; 1179 const u8 *ie;
1063 size_t ie_len; 1180 size_t ie_len;
1181 u32 flags;
1064 struct cfg80211_match_set *match_sets; 1182 struct cfg80211_match_set *match_sets;
1065 int n_match_sets; 1183 int n_match_sets;
1066 s32 rssi_thold; 1184 s32 rssi_thold;
@@ -1068,6 +1186,7 @@ struct cfg80211_sched_scan_request {
1068 /* internal */ 1186 /* internal */
1069 struct wiphy *wiphy; 1187 struct wiphy *wiphy;
1070 struct net_device *dev; 1188 struct net_device *dev;
1189 unsigned long scan_start;
1071 1190
1072 /* keep last */ 1191 /* keep last */
1073 struct ieee80211_channel *channels[0]; 1192 struct ieee80211_channel *channels[0];
@@ -1087,6 +1206,18 @@ enum cfg80211_signal_type {
1087}; 1206};
1088 1207
1089/** 1208/**
1209 * struct cfg80211_bss_ie_data - BSS entry IE data
1210 * @rcu_head: internal use, for freeing
1211 * @len: length of the IEs
1212 * @data: IE data
1213 */
1214struct cfg80211_bss_ies {
1215 struct rcu_head rcu_head;
1216 int len;
1217 u8 data[];
1218};
1219
1220/**
1090 * struct cfg80211_bss - BSS description 1221 * struct cfg80211_bss - BSS description
1091 * 1222 *
1092 * This structure describes a BSS (which may also be a mesh network) 1223 * This structure describes a BSS (which may also be a mesh network)
@@ -1097,36 +1228,34 @@ enum cfg80211_signal_type {
1097 * @tsf: timestamp of last received update 1228 * @tsf: timestamp of last received update
1098 * @beacon_interval: the beacon interval as from the frame 1229 * @beacon_interval: the beacon interval as from the frame
1099 * @capability: the capability field in host byte order 1230 * @capability: the capability field in host byte order
1100 * @information_elements: the information elements (Note that there 1231 * @ies: the information elements (Note that there
1101 * is no guarantee that these are well-formed!); this is a pointer to 1232 * is no guarantee that these are well-formed!); this is a pointer to
1102 * either the beacon_ies or proberesp_ies depending on whether Probe 1233 * either the beacon_ies or proberesp_ies depending on whether Probe
1103 * Response frame has been received 1234 * Response frame has been received
1104 * @len_information_elements: total length of the information elements
1105 * @beacon_ies: the information elements from the last Beacon frame 1235 * @beacon_ies: the information elements from the last Beacon frame
1106 * @len_beacon_ies: total length of the beacon_ies
1107 * @proberesp_ies: the information elements from the last Probe Response frame 1236 * @proberesp_ies: the information elements from the last Probe Response frame
1108 * @len_proberesp_ies: total length of the proberesp_ies
1109 * @signal: signal strength value (type depends on the wiphy's signal_type) 1237 * @signal: signal strength value (type depends on the wiphy's signal_type)
1110 * @free_priv: function pointer to free private data 1238 * @free_priv: function pointer to free private data
1111 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 1239 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
1112 */ 1240 */
1113struct cfg80211_bss { 1241struct cfg80211_bss {
1242 u64 tsf;
1243
1114 struct ieee80211_channel *channel; 1244 struct ieee80211_channel *channel;
1115 1245
1116 u8 bssid[ETH_ALEN]; 1246 const struct cfg80211_bss_ies __rcu *ies;
1117 u64 tsf; 1247 const struct cfg80211_bss_ies __rcu *beacon_ies;
1248 const struct cfg80211_bss_ies __rcu *proberesp_ies;
1249
1250 void (*free_priv)(struct cfg80211_bss *bss);
1251
1252 s32 signal;
1253
1118 u16 beacon_interval; 1254 u16 beacon_interval;
1119 u16 capability; 1255 u16 capability;
1120 u8 *information_elements;
1121 size_t len_information_elements;
1122 u8 *beacon_ies;
1123 size_t len_beacon_ies;
1124 u8 *proberesp_ies;
1125 size_t len_proberesp_ies;
1126 1256
1127 s32 signal; 1257 u8 bssid[ETH_ALEN];
1128 1258
1129 void (*free_priv)(struct cfg80211_bss *bss);
1130 u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 1259 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
1131}; 1260};
1132 1261
@@ -1134,6 +1263,9 @@ struct cfg80211_bss {
1134 * ieee80211_bss_get_ie - find IE with given ID 1263 * ieee80211_bss_get_ie - find IE with given ID
1135 * @bss: the bss to search 1264 * @bss: the bss to search
1136 * @ie: the IE ID 1265 * @ie: the IE ID
1266 *
1267 * Note that the return value is an RCU-protected pointer, so
1268 * rcu_read_lock() must be held when calling this function.
1137 * Returns %NULL if not found. 1269 * Returns %NULL if not found.
1138 */ 1270 */
1139const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1271const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
@@ -1152,6 +1284,9 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1152 * @key_len: length of WEP key for shared key authentication 1284 * @key_len: length of WEP key for shared key authentication
1153 * @key_idx: index of WEP key for shared key authentication 1285 * @key_idx: index of WEP key for shared key authentication
1154 * @key: WEP key for shared key authentication 1286 * @key: WEP key for shared key authentication
1287 * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1288 * Authentication transaction sequence number field.
1289 * @sae_data_len: Length of sae_data buffer in octets
1155 */ 1290 */
1156struct cfg80211_auth_request { 1291struct cfg80211_auth_request {
1157 struct cfg80211_bss *bss; 1292 struct cfg80211_bss *bss;
@@ -1160,6 +1295,8 @@ struct cfg80211_auth_request {
1160 enum nl80211_auth_type auth_type; 1295 enum nl80211_auth_type auth_type;
1161 const u8 *key; 1296 const u8 *key;
1162 u8 key_len, key_idx; 1297 u8 key_len, key_idx;
1298 const u8 *sae_data;
1299 size_t sae_data_len;
1163}; 1300};
1164 1301
1165/** 1302/**
@@ -1252,8 +1389,7 @@ struct cfg80211_disassoc_request {
1252 * @ssid_len: The length of the SSID, will always be non-zero. 1389 * @ssid_len: The length of the SSID, will always be non-zero.
1253 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 1390 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
1254 * search for IBSSs with a different BSSID. 1391 * search for IBSSs with a different BSSID.
1255 * @channel: The channel to use if no IBSS can be found to join. 1392 * @chandef: defines the channel to use if no other IBSS to join can be found
1256 * @channel_type: channel type (HT mode)
1257 * @channel_fixed: The channel should be fixed -- do not search for 1393 * @channel_fixed: The channel should be fixed -- do not search for
1258 * IBSSs to join on other channels. 1394 * IBSSs to join on other channels.
1259 * @ie: information element(s) to include in the beacon 1395 * @ie: information element(s) to include in the beacon
@@ -1271,8 +1407,7 @@ struct cfg80211_disassoc_request {
1271struct cfg80211_ibss_params { 1407struct cfg80211_ibss_params {
1272 u8 *ssid; 1408 u8 *ssid;
1273 u8 *bssid; 1409 u8 *bssid;
1274 struct ieee80211_channel *channel; 1410 struct cfg80211_chan_def chandef;
1275 enum nl80211_channel_type channel_type;
1276 u8 *ie; 1411 u8 *ie;
1277 u8 ssid_len, ie_len; 1412 u8 ssid_len, ie_len;
1278 u16 beacon_interval; 1413 u16 beacon_interval;
@@ -1531,13 +1666,19 @@ struct cfg80211_gtk_rekey_data {
1531 * to a merge. 1666 * to a merge.
1532 * @leave_ibss: Leave the IBSS. 1667 * @leave_ibss: Leave the IBSS.
1533 * 1668 *
1669 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1670 * MESH mode)
1671 *
1534 * @set_wiphy_params: Notify that wiphy parameters have changed; 1672 * @set_wiphy_params: Notify that wiphy parameters have changed;
1535 * @changed bitfield (see &enum wiphy_params_flags) describes which values 1673 * @changed bitfield (see &enum wiphy_params_flags) describes which values
1536 * have changed. The actual parameter values are available in 1674 * have changed. The actual parameter values are available in
1537 * struct wiphy. If returning an error, no value should be changed. 1675 * struct wiphy. If returning an error, no value should be changed.
1538 * 1676 *
1539 * @set_tx_power: set the transmit power according to the parameters, 1677 * @set_tx_power: set the transmit power according to the parameters,
1540 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). 1678 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
1679 * wdev may be %NULL if power was set for the wiphy, and will
1680 * always be %NULL unless the driver supports per-vif TX power
1681 * (as advertised by the nl80211 feature flag.)
1541 * @get_tx_power: store the current TX power into the dbm variable; 1682 * @get_tx_power: store the current TX power into the dbm variable;
1542 * return 0 if successful 1683 * return 0 if successful
1543 * 1684 *
@@ -1708,8 +1849,7 @@ struct cfg80211_ops {
1708 struct ieee80211_channel *chan); 1849 struct ieee80211_channel *chan);
1709 1850
1710 int (*set_monitor_channel)(struct wiphy *wiphy, 1851 int (*set_monitor_channel)(struct wiphy *wiphy,
1711 struct ieee80211_channel *chan, 1852 struct cfg80211_chan_def *chandef);
1712 enum nl80211_channel_type channel_type);
1713 1853
1714 int (*scan)(struct wiphy *wiphy, 1854 int (*scan)(struct wiphy *wiphy,
1715 struct cfg80211_scan_request *request); 1855 struct cfg80211_scan_request *request);
@@ -1732,11 +1872,15 @@ struct cfg80211_ops {
1732 struct cfg80211_ibss_params *params); 1872 struct cfg80211_ibss_params *params);
1733 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1873 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1734 1874
1875 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
1876 int rate[IEEE80211_NUM_BANDS]);
1877
1735 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 1878 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
1736 1879
1737 int (*set_tx_power)(struct wiphy *wiphy, 1880 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1738 enum nl80211_tx_power_setting type, int mbm); 1881 enum nl80211_tx_power_setting type, int mbm);
1739 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1882 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1883 int *dbm);
1740 1884
1741 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1885 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1742 const u8 *addr); 1886 const u8 *addr);
@@ -1767,7 +1911,6 @@ struct cfg80211_ops {
1767 int (*remain_on_channel)(struct wiphy *wiphy, 1911 int (*remain_on_channel)(struct wiphy *wiphy,
1768 struct wireless_dev *wdev, 1912 struct wireless_dev *wdev,
1769 struct ieee80211_channel *chan, 1913 struct ieee80211_channel *chan,
1770 enum nl80211_channel_type channel_type,
1771 unsigned int duration, 1914 unsigned int duration,
1772 u64 *cookie); 1915 u64 *cookie);
1773 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 1916 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
@@ -1776,10 +1919,8 @@ struct cfg80211_ops {
1776 1919
1777 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 1920 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1778 struct ieee80211_channel *chan, bool offchan, 1921 struct ieee80211_channel *chan, bool offchan,
1779 enum nl80211_channel_type channel_type, 1922 unsigned int wait, const u8 *buf, size_t len,
1780 bool channel_type_valid, unsigned int wait, 1923 bool no_cck, bool dont_wait_for_ack, u64 *cookie);
1781 const u8 *buf, size_t len, bool no_cck,
1782 bool dont_wait_for_ack, u64 *cookie);
1783 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1924 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1784 struct wireless_dev *wdev, 1925 struct wireless_dev *wdev,
1785 u64 cookie); 1926 u64 cookie);
@@ -1834,10 +1975,9 @@ struct cfg80211_ops {
1834 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev, 1975 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1835 u32 sset, u8 *data); 1976 u32 sset, u8 *data);
1836 1977
1837 struct ieee80211_channel * 1978 int (*get_channel)(struct wiphy *wiphy,
1838 (*get_channel)(struct wiphy *wiphy,
1839 struct wireless_dev *wdev, 1979 struct wireless_dev *wdev,
1840 enum nl80211_channel_type *type); 1980 struct cfg80211_chan_def *chandef);
1841 1981
1842 int (*start_p2p_device)(struct wiphy *wiphy, 1982 int (*start_p2p_device)(struct wiphy *wiphy,
1843 struct wireless_dev *wdev); 1983 struct wireless_dev *wdev);
@@ -2445,8 +2585,7 @@ struct wireless_dev {
2445 spinlock_t event_lock; 2585 spinlock_t event_lock;
2446 2586
2447 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2587 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2448 struct ieee80211_channel *preset_chan; 2588 struct cfg80211_chan_def preset_chandef;
2449 enum nl80211_channel_type preset_chantype;
2450 2589
2451 /* for AP and mesh channel tracking */ 2590 /* for AP and mesh channel tracking */
2452 struct ieee80211_channel *channel; 2591 struct ieee80211_channel *channel;
@@ -2652,6 +2791,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2652unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 2791unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2653 2792
2654/** 2793/**
2794 * ieee80211_get_mesh_hdrlen - get mesh extension header length
2795 * @meshhdr: the mesh extension header, only the flags field
2796 * (first byte) will be accessed
2797 * Returns the length of the extension header, which is always at
2798 * least 6 bytes and at most 18 if address 5 and 6 are present.
2799 */
2800unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
2801
2802/**
2655 * DOC: Data path helpers 2803 * DOC: Data path helpers
2656 * 2804 *
2657 * In addition to generic utilities, cfg80211 also offers 2805 * In addition to generic utilities, cfg80211 also offers
@@ -3317,14 +3465,12 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3317 * @wdev: wireless device 3465 * @wdev: wireless device
3318 * @cookie: the request cookie 3466 * @cookie: the request cookie
3319 * @chan: The current channel (from remain_on_channel request) 3467 * @chan: The current channel (from remain_on_channel request)
3320 * @channel_type: Channel type
3321 * @duration: Duration in milliseconds that the driver intents to remain on the 3468 * @duration: Duration in milliseconds that the driver intents to remain on the
3322 * channel 3469 * channel
3323 * @gfp: allocation flags 3470 * @gfp: allocation flags
3324 */ 3471 */
3325void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 3472void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3326 struct ieee80211_channel *chan, 3473 struct ieee80211_channel *chan,
3327 enum nl80211_channel_type channel_type,
3328 unsigned int duration, gfp_t gfp); 3474 unsigned int duration, gfp_t gfp);
3329 3475
3330/** 3476/**
@@ -3332,12 +3478,10 @@ void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3332 * @wdev: wireless device 3478 * @wdev: wireless device
3333 * @cookie: the request cookie 3479 * @cookie: the request cookie
3334 * @chan: The current channel (from remain_on_channel request) 3480 * @chan: The current channel (from remain_on_channel request)
3335 * @channel_type: Channel type
3336 * @gfp: allocation flags 3481 * @gfp: allocation flags
3337 */ 3482 */
3338void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 3483void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
3339 struct ieee80211_channel *chan, 3484 struct ieee80211_channel *chan,
3340 enum nl80211_channel_type channel_type,
3341 gfp_t gfp); 3485 gfp_t gfp);
3342 3486
3343 3487
@@ -3527,7 +3671,6 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3527 * @len: length of the frame 3671 * @len: length of the frame
3528 * @freq: frequency the frame was received on 3672 * @freq: frequency the frame was received on
3529 * @sig_dbm: signal strength in mBm, or 0 if unknown 3673 * @sig_dbm: signal strength in mBm, or 0 if unknown
3530 * @gfp: allocation flags
3531 * 3674 *
3532 * Use this function to report to userspace when a beacon was 3675 * Use this function to report to userspace when a beacon was
3533 * received. It is not useful to call this when there is no 3676 * received. It is not useful to call this when there is no
@@ -3535,31 +3678,47 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3535 */ 3678 */
3536void cfg80211_report_obss_beacon(struct wiphy *wiphy, 3679void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3537 const u8 *frame, size_t len, 3680 const u8 *frame, size_t len,
3538 int freq, int sig_dbm, gfp_t gfp); 3681 int freq, int sig_dbm);
3539 3682
3540/** 3683/**
3541 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3684 * cfg80211_reg_can_beacon - check if beaconing is allowed
3542 * @wiphy: the wiphy 3685 * @wiphy: the wiphy
3543 * @chan: main channel 3686 * @chandef: the channel definition
3544 * @channel_type: HT mode
3545 * 3687 *
3546 * This function returns true if there is no secondary channel or the secondary 3688 * This function returns true if there is no secondary channel or the secondary
3547 * channel can be used for beaconing (i.e. is not a radar channel etc.) 3689 * channel(s) can be used for beaconing (i.e. is not a radar channel etc.)
3548 */ 3690 */
3549bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, 3691bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3550 struct ieee80211_channel *chan, 3692 struct cfg80211_chan_def *chandef);
3551 enum nl80211_channel_type channel_type);
3552 3693
3553/* 3694/*
3554 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 3695 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
3555 * @dev: the device which switched channels 3696 * @dev: the device which switched channels
3556 * @freq: new channel frequency (in MHz) 3697 * @chandef: the new channel definition
3557 * @type: channel type
3558 * 3698 *
3559 * Acquires wdev_lock, so must only be called from sleepable driver context! 3699 * Acquires wdev_lock, so must only be called from sleepable driver context!
3560 */ 3700 */
3561void cfg80211_ch_switch_notify(struct net_device *dev, int freq, 3701void cfg80211_ch_switch_notify(struct net_device *dev,
3562 enum nl80211_channel_type type); 3702 struct cfg80211_chan_def *chandef);
3703
3704/*
3705 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
3706 * @dev: the device on which the operation is requested
3707 * @peer: the MAC address of the peer device
3708 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
3709 * NL80211_TDLS_TEARDOWN)
3710 * @reason_code: the reason code for teardown request
3711 * @gfp: allocation flags
3712 *
3713 * This function is used to request userspace to perform TDLS operation that
3714 * requires knowledge of keys, i.e., link setup or teardown when the AP
3715 * connection uses encryption. This is optional mechanism for the driver to use
3716 * if it can automatically determine when a TDLS link could be useful (e.g.,
3717 * based on traffic and signal strength for a peer).
3718 */
3719void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
3720 enum nl80211_tdls_operation oper,
3721 u16 reason_code, gfp_t gfp);
3563 3722
3564/* 3723/*
3565 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 3724 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
@@ -3585,6 +3744,26 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);
3585 */ 3744 */
3586void cfg80211_unregister_wdev(struct wireless_dev *wdev); 3745void cfg80211_unregister_wdev(struct wireless_dev *wdev);
3587 3746
3747/**
3748 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
3749 * @ies: the input IE buffer
3750 * @len: the input length
3751 * @attr: the attribute ID to find
3752 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
3753 * if the function is only called to get the needed buffer size
3754 * @bufsize: size of the output buffer
3755 *
3756 * The function finds a given P2P attribute in the (vendor) IEs and
3757 * copies its contents to the given buffer.
3758 *
3759 * The return value is a negative error code (-%EILSEQ or -%ENOENT) if
3760 * the data is malformed or the attribute can't be found (respectively),
3761 * or the length of the found attribute (which can be zero).
3762 */
3763int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
3764 enum ieee80211_p2p_attr_id attr,
3765 u8 *buf, unsigned int bufsize);
3766
3588/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3767/* Logging, debugging and troubleshooting/diagnostic helpers. */
3589 3768
3590/* wiphy_printk helpers, similar to dev_printk */ 3769/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index b6a6eeb3905f..2581638f4a3d 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,12 +24,12 @@ struct cgroup_cls_state
24 u32 classid; 24 u32 classid;
25}; 25};
26 26
27extern void sock_update_classid(struct sock *sk); 27extern void sock_update_classid(struct sock *sk, struct task_struct *task);
28 28
29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) 29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
30static inline u32 task_cls_classid(struct task_struct *p) 30static inline u32 task_cls_classid(struct task_struct *p)
31{ 31{
32 int classid; 32 u32 classid;
33 33
34 if (in_interrupt()) 34 if (in_interrupt())
35 return 0; 35 return 0;
@@ -61,7 +61,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
61} 61}
62#endif 62#endif
63#else /* !CGROUP_NET_CLS_CGROUP */ 63#else /* !CGROUP_NET_CLS_CGROUP */
64static inline void sock_update_classid(struct sock *sk) 64static inline void sock_update_classid(struct sock *sk, struct task_struct *task)
65{ 65{
66} 66}
67 67
diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h
index 4fd8a4b4b7ee..e5062c955ea6 100644
--- a/include/net/gro_cells.h
+++ b/include/net/gro_cells.h
@@ -17,7 +17,6 @@ struct gro_cells {
17 17
18static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb) 18static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
19{ 19{
20 unsigned long flags;
21 struct gro_cell *cell = gcells->cells; 20 struct gro_cell *cell = gcells->cells;
22 struct net_device *dev = skb->dev; 21 struct net_device *dev = skb->dev;
23 22
@@ -35,32 +34,37 @@ static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *s
35 return; 34 return;
36 } 35 }
37 36
38 spin_lock_irqsave(&cell->napi_skbs.lock, flags); 37 /* We run in BH context */
38 spin_lock(&cell->napi_skbs.lock);
39 39
40 __skb_queue_tail(&cell->napi_skbs, skb); 40 __skb_queue_tail(&cell->napi_skbs, skb);
41 if (skb_queue_len(&cell->napi_skbs) == 1) 41 if (skb_queue_len(&cell->napi_skbs) == 1)
42 napi_schedule(&cell->napi); 42 napi_schedule(&cell->napi);
43 43
44 spin_unlock_irqrestore(&cell->napi_skbs.lock, flags); 44 spin_unlock(&cell->napi_skbs.lock);
45} 45}
46 46
47/* called unser BH context */
47static inline int gro_cell_poll(struct napi_struct *napi, int budget) 48static inline int gro_cell_poll(struct napi_struct *napi, int budget)
48{ 49{
49 struct gro_cell *cell = container_of(napi, struct gro_cell, napi); 50 struct gro_cell *cell = container_of(napi, struct gro_cell, napi);
50 struct sk_buff *skb; 51 struct sk_buff *skb;
51 int work_done = 0; 52 int work_done = 0;
52 53
54 spin_lock(&cell->napi_skbs.lock);
53 while (work_done < budget) { 55 while (work_done < budget) {
54 skb = skb_dequeue(&cell->napi_skbs); 56 skb = __skb_dequeue(&cell->napi_skbs);
55 if (!skb) 57 if (!skb)
56 break; 58 break;
57 59 spin_unlock(&cell->napi_skbs.lock);
58 napi_gro_receive(napi, skb); 60 napi_gro_receive(napi, skb);
59 work_done++; 61 work_done++;
62 spin_lock(&cell->napi_skbs.lock);
60 } 63 }
61 64
62 if (work_done < budget) 65 if (work_done < budget)
63 napi_complete(napi); 66 napi_complete(napi);
67 spin_unlock(&cell->napi_skbs.lock);
64 return work_done; 68 return work_done;
65} 69}
66 70
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 7f0df133d119..c3999632e616 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -186,6 +186,10 @@ struct ieee80211_radiotap_header {
186 * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless 186 * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless
187 * 187 *
188 * Contains the AMPDU information for the subframe. 188 * Contains the AMPDU information for the subframe.
189 *
190 * IEEE80211_RADIOTAP_VHT u16, u8, u8, u8[4], u8, u8, u16
191 *
192 * Contains VHT information about this frame.
189 */ 193 */
190enum ieee80211_radiotap_type { 194enum ieee80211_radiotap_type {
191 IEEE80211_RADIOTAP_TSFT = 0, 195 IEEE80211_RADIOTAP_TSFT = 0,
@@ -209,6 +213,7 @@ enum ieee80211_radiotap_type {
209 213
210 IEEE80211_RADIOTAP_MCS = 19, 214 IEEE80211_RADIOTAP_MCS = 19,
211 IEEE80211_RADIOTAP_AMPDU_STATUS = 20, 215 IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
216 IEEE80211_RADIOTAP_VHT = 21,
212 217
213 /* valid in every it_present bitmap, even vendor namespaces */ 218 /* valid in every it_present bitmap, even vendor namespaces */
214 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, 219 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
@@ -282,6 +287,25 @@ enum ieee80211_radiotap_type {
282#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 287#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010
283#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020 288#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020
284 289
290/* For IEEE80211_RADIOTAP_VHT */
291#define IEEE80211_RADIOTAP_VHT_KNOWN_STBC 0x0001
292#define IEEE80211_RADIOTAP_VHT_KNOWN_TXOP_PS_NA 0x0002
293#define IEEE80211_RADIOTAP_VHT_KNOWN_GI 0x0004
294#define IEEE80211_RADIOTAP_VHT_KNOWN_SGI_NSYM_DIS 0x0008
295#define IEEE80211_RADIOTAP_VHT_KNOWN_LDPC_EXTRA_OFDM_SYM 0x0010
296#define IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED 0x0020
297#define IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH 0x0040
298#define IEEE80211_RADIOTAP_VHT_KNOWN_GROUP_ID 0x0080
299#define IEEE80211_RADIOTAP_VHT_KNOWN_PARTIAL_AID 0x0100
300
301#define IEEE80211_RADIOTAP_VHT_FLAG_STBC 0x01
302#define IEEE80211_RADIOTAP_VHT_FLAG_TXOP_PS_NA 0x02
303#define IEEE80211_RADIOTAP_VHT_FLAG_SGI 0x04
304#define IEEE80211_RADIOTAP_VHT_FLAG_SGI_NSYM_M10_9 0x08
305#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10
306#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20
307
308
285/* helpers */ 309/* helpers */
286static inline int ieee80211_get_radiotap_len(unsigned char *data) 310static inline int ieee80211_get_radiotap_len(unsigned char *data)
287{ 311{
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index ba1d3615acbb..183292722f6e 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -318,6 +318,7 @@ extern void inet_csk_reqsk_queue_prune(struct sock *parent,
318 const unsigned long max_rto); 318 const unsigned long max_rto);
319 319
320extern void inet_csk_destroy_sock(struct sock *sk); 320extern void inet_csk_destroy_sock(struct sock *sk);
321extern void inet_csk_prepare_forced_close(struct sock *sk);
321 322
322/* 323/*
323 * LISTEN is a special case for poll.. 324 * LISTEN is a special case for poll..
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 54be0287eb98..67a8fa098e3a 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -277,7 +277,6 @@ static inline struct sock *inet_lookup_listener(struct net *net,
277 On 64bit targets we combine comparisons with pair of adjacent __be32 277 On 64bit targets we combine comparisons with pair of adjacent __be32
278 fields in the same way. 278 fields in the same way.
279*/ 279*/
280typedef __u32 __bitwise __portpair;
281#ifdef __BIG_ENDIAN 280#ifdef __BIG_ENDIAN
282#define INET_COMBINED_PORTS(__sport, __dport) \ 281#define INET_COMBINED_PORTS(__sport, __dport) \
283 ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport))) 282 ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
@@ -287,7 +286,6 @@ typedef __u32 __bitwise __portpair;
287#endif 286#endif
288 287
289#if (BITS_PER_LONG == 64) 288#if (BITS_PER_LONG == 64)
290typedef __u64 __bitwise __addrpair;
291#ifdef __BIG_ENDIAN 289#ifdef __BIG_ENDIAN
292#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 290#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
293 const __addrpair __name = (__force __addrpair) ( \ 291 const __addrpair __name = (__force __addrpair) ( \
@@ -299,30 +297,34 @@ typedef __u64 __bitwise __addrpair;
299 (((__force __u64)(__be32)(__daddr)) << 32) | \ 297 (((__force __u64)(__be32)(__daddr)) << 32) | \
300 ((__force __u64)(__be32)(__saddr))); 298 ((__force __u64)(__be32)(__saddr)));
301#endif /* __BIG_ENDIAN */ 299#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 300#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
303 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 301 ((inet_sk(__sk)->inet_portpair == (__ports)) && \
304 ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie)) && \ 302 (inet_sk(__sk)->inet_addrpair == (__cookie)) && \
305 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ 303 (!(__sk)->sk_bound_dev_if || \
306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 304 ((__sk)->sk_bound_dev_if == (__dif))) && \
307#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 305 net_eq(sock_net(__sk), (__net)))
308 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 306#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif)\
309 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 307 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
310 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 308 (inet_twsk(__sk)->tw_addrpair == (__cookie)) && \
311 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 309 (!(__sk)->sk_bound_dev_if || \
310 ((__sk)->sk_bound_dev_if == (__dif))) && \
311 net_eq(sock_net(__sk), (__net)))
312#else /* 32-bit arch */ 312#else /* 32-bit arch */
313#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 313#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
314#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 314#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
315 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 315 ((inet_sk(__sk)->inet_portpair == (__ports)) && \
316 (inet_sk(__sk)->inet_daddr == (__saddr)) && \ 316 (inet_sk(__sk)->inet_daddr == (__saddr)) && \
317 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ 317 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \
318 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ 318 (!(__sk)->sk_bound_dev_if || \
319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 319 ((__sk)->sk_bound_dev_if == (__dif))) && \
320#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 320 net_eq(sock_net(__sk), (__net)))
321 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 321#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
322 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 322 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
323 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 323 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
324 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 324 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 325 (!(__sk)->sk_bound_dev_if || \
326 ((__sk)->sk_bound_dev_if == (__dif))) && \
327 net_eq(sock_net(__sk), (__net)))
326#endif /* 64-bit arch */ 328#endif /* 64-bit arch */
327 329
328/* 330/*
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 256c1ed2d69a..a4196cbc84ec 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -144,9 +144,11 @@ struct inet_sock {
144 /* Socket demultiplex comparisons on incoming packets. */ 144 /* Socket demultiplex comparisons on incoming packets. */
145#define inet_daddr sk.__sk_common.skc_daddr 145#define inet_daddr sk.__sk_common.skc_daddr
146#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr 146#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
147#define inet_addrpair sk.__sk_common.skc_addrpair
148#define inet_dport sk.__sk_common.skc_dport
149#define inet_num sk.__sk_common.skc_num
150#define inet_portpair sk.__sk_common.skc_portpair
147 151
148 __be16 inet_dport;
149 __u16 inet_num;
150 __be32 inet_saddr; 152 __be32 inet_saddr;
151 __s16 uc_ttl; 153 __s16 uc_ttl;
152 __u16 cmsg_flags; 154 __u16 cmsg_flags;
@@ -154,6 +156,7 @@ struct inet_sock {
154 __u16 inet_id; 156 __u16 inet_id;
155 157
156 struct ip_options_rcu __rcu *inet_opt; 158 struct ip_options_rcu __rcu *inet_opt;
159 int rx_dst_ifindex;
157 __u8 tos; 160 __u8 tos;
158 __u8 min_ttl; 161 __u8 min_ttl;
159 __u8 mc_ttl; 162 __u8 mc_ttl;
@@ -170,7 +173,6 @@ struct inet_sock {
170 int uc_index; 173 int uc_index;
171 int mc_index; 174 int mc_index;
172 __be32 mc_addr; 175 __be32 mc_addr;
173 int rx_dst_ifindex;
174 struct ip_mc_socklist __rcu *mc_list; 176 struct ip_mc_socklist __rcu *mc_list;
175 struct inet_cork_full cork; 177 struct inet_cork_full cork;
176}; 178};
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index ba52c830a7a5..7d658d577368 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -112,6 +112,11 @@ struct inet_timewait_sock {
112#define tw_net __tw_common.skc_net 112#define tw_net __tw_common.skc_net
113#define tw_daddr __tw_common.skc_daddr 113#define tw_daddr __tw_common.skc_daddr
114#define tw_rcv_saddr __tw_common.skc_rcv_saddr 114#define tw_rcv_saddr __tw_common.skc_rcv_saddr
115#define tw_addrpair __tw_common.skc_addrpair
116#define tw_dport __tw_common.skc_dport
117#define tw_num __tw_common.skc_num
118#define tw_portpair __tw_common.skc_portpair
119
115 int tw_timeout; 120 int tw_timeout;
116 volatile unsigned char tw_substate; 121 volatile unsigned char tw_substate;
117 unsigned char tw_rcv_wscale; 122 unsigned char tw_rcv_wscale;
@@ -119,8 +124,6 @@ struct inet_timewait_sock {
119 /* Socket demultiplex comparisons on incoming packets. */ 124 /* Socket demultiplex comparisons on incoming packets. */
120 /* these three are in inet_sock */ 125 /* these three are in inet_sock */
121 __be16 tw_sport; 126 __be16 tw_sport;
122 __be16 tw_dport;
123 __u16 tw_num;
124 kmemcheck_bitfield_begin(flags); 127 kmemcheck_bitfield_begin(flags);
125 /* And these are ours. */ 128 /* And these are ours. */
126 unsigned int tw_ipv6only : 1, 129 unsigned int tw_ipv6only : 1,
diff --git a/include/net/ip.h b/include/net/ip.h
index 0707fb9551aa..a68f838a132c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -143,6 +143,8 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
143extern int ip4_datagram_connect(struct sock *sk, 143extern int ip4_datagram_connect(struct sock *sk,
144 struct sockaddr *uaddr, int addr_len); 144 struct sockaddr *uaddr, int addr_len);
145 145
146extern void ip4_datagram_release_cb(struct sock *sk);
147
146struct ip_reply_arg { 148struct ip_reply_arg {
147 struct kvec iov[1]; 149 struct kvec iov[1];
148 int flags; 150 int flags;
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index bc1b0fda2b04..652d3d309357 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -31,6 +31,8 @@
31#include <net/ip.h> 31#include <net/ip.h>
32#include <asm/checksum.h> 32#include <asm/checksum.h>
33#include <linux/in6.h> 33#include <linux/in6.h>
34#include <linux/tcp.h>
35#include <linux/ipv6.h>
34 36
35#ifndef _HAVE_ARCH_IPV6_CSUM 37#ifndef _HAVE_ARCH_IPV6_CSUM
36 38
@@ -91,4 +93,37 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
91} 93}
92 94
93#endif 95#endif
96
97static __inline__ __sum16 tcp_v6_check(int len,
98 const struct in6_addr *saddr,
99 const struct in6_addr *daddr,
100 __wsum base)
101{
102 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
103}
104
105static inline void __tcp_v6_send_check(struct sk_buff *skb,
106 const struct in6_addr *saddr,
107 const struct in6_addr *daddr)
108{
109 struct tcphdr *th = tcp_hdr(skb);
110
111 if (skb->ip_summed == CHECKSUM_PARTIAL) {
112 th->check = ~tcp_v6_check(skb->len, saddr, daddr, 0);
113 skb->csum_start = skb_transport_header(skb) - skb->head;
114 skb->csum_offset = offsetof(struct tcphdr, check);
115 } else {
116 th->check = tcp_v6_check(skb->len, saddr, daddr,
117 csum_partial(th, th->doff << 2,
118 skb->csum));
119 }
120}
121
122static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
123{
124 struct ipv6_pinfo *np = inet6_sk(sk);
125
126 __tcp_v6_send_check(skb, &np->saddr, &np->daddr);
127}
128
94#endif 129#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 8a2a203eb15d..fdc48a94a063 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -47,6 +47,8 @@ struct fib6_config {
47 unsigned long fc_expires; 47 unsigned long fc_expires;
48 struct nlattr *fc_mx; 48 struct nlattr *fc_mx;
49 int fc_mx_len; 49 int fc_mx_len;
50 int fc_mp_len;
51 struct nlattr *fc_mp;
50 52
51 struct nl_info fc_nlinfo; 53 struct nl_info fc_nlinfo;
52}; 54};
@@ -99,6 +101,14 @@ struct rt6_info {
99 101
100 struct in6_addr rt6i_gateway; 102 struct in6_addr rt6i_gateway;
101 103
104 /* Multipath routes:
105 * siblings is a list of rt6_info that have the the same metric/weight,
106 * destination, but not the same gateway. nsiblings is just a cache
107 * to speed up lookup.
108 */
109 struct list_head rt6i_siblings;
110 unsigned int rt6i_nsiblings;
111
102 atomic_t rt6i_ref; 112 atomic_t rt6i_ref;
103 113
104 /* These are in a separate cache line. */ 114 /* These are in a separate cache line. */
@@ -107,7 +117,6 @@ struct rt6_info {
107 struct rt6key rt6i_src; 117 struct rt6key rt6i_src;
108 struct rt6key rt6i_prefsrc; 118 struct rt6key rt6i_prefsrc;
109 u32 rt6i_metric; 119 u32 rt6i_metric;
110 u32 rt6i_peer_genid;
111 120
112 struct inet6_dev *rt6i_idev; 121 struct inet6_dev *rt6i_idev;
113 unsigned long _rt6i_peer; 122 unsigned long _rt6i_peer;
@@ -203,6 +212,15 @@ static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
203 dst_hold(new); 212 dst_hold(new);
204} 213}
205 214
215static inline void ip6_rt_put(struct rt6_info *rt)
216{
217 /* dst_release() accepts a NULL parameter.
218 * We rely on dst being first structure in struct rt6_info
219 */
220 BUILD_BUG_ON(offsetof(struct rt6_info, dst) != 0);
221 dst_release(&rt->dst);
222}
223
206struct fib6_walker_t { 224struct fib6_walker_t {
207 struct list_head lh; 225 struct list_head lh;
208 struct fib6_node *root, *node; 226 struct fib6_node *root, *node;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5fa2af00634a..27d83183e615 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -1,9 +1,6 @@
1#ifndef _NET_IP6_ROUTE_H 1#ifndef _NET_IP6_ROUTE_H
2#define _NET_IP6_ROUTE_H 2#define _NET_IP6_ROUTE_H
3 3
4#define IP6_RT_PRIO_USER 1024
5#define IP6_RT_PRIO_ADDRCONF 256
6
7struct route_info { 4struct route_info {
8 __u8 type; 5 __u8 type;
9 __u8 length; 6 __u8 length;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ee75ccdf5188..68c69d54d392 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -22,7 +22,10 @@
22#include <linux/ip.h> 22#include <linux/ip.h>
23#include <linux/ipv6.h> /* for struct ipv6hdr */ 23#include <linux/ipv6.h> /* for struct ipv6hdr */
24#include <net/ipv6.h> 24#include <net/ipv6.h>
25#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 25#if IS_ENABLED(CONFIG_IP_VS_IPV6)
26#include <linux/netfilter_ipv6/ip6_tables.h>
27#endif
28#if IS_ENABLED(CONFIG_NF_CONNTRACK)
26#include <net/netfilter/nf_conntrack.h> 29#include <net/netfilter/nf_conntrack.h>
27#endif 30#endif
28#include <net/net_namespace.h> /* Netw namespace */ 31#include <net/net_namespace.h> /* Netw namespace */
@@ -103,30 +106,117 @@ static inline struct net *seq_file_single_net(struct seq_file *seq)
103/* Connections' size value needed by ip_vs_ctl.c */ 106/* Connections' size value needed by ip_vs_ctl.c */
104extern int ip_vs_conn_tab_size; 107extern int ip_vs_conn_tab_size;
105 108
106
107struct ip_vs_iphdr { 109struct ip_vs_iphdr {
108 int len; 110 __u32 len; /* IPv4 simply where L4 starts
109 __u8 protocol; 111 IPv6 where L4 Transport Header starts */
112 __u32 thoff_reasm; /* Transport Header Offset in nfct_reasm skb */
113 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
114 __s16 protocol;
115 __s32 flags;
110 union nf_inet_addr saddr; 116 union nf_inet_addr saddr;
111 union nf_inet_addr daddr; 117 union nf_inet_addr daddr;
112}; 118};
113 119
120/* Dependency to module: nf_defrag_ipv6 */
121#if defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
122static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
123{
124 return skb->nfct_reasm;
125}
126static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
127 int len, void *buffer,
128 const struct ip_vs_iphdr *ipvsh)
129{
130 if (unlikely(ipvsh->fragoffs && skb_nfct_reasm(skb)))
131 return skb_header_pointer(skb_nfct_reasm(skb),
132 ipvsh->thoff_reasm, len, buffer);
133
134 return skb_header_pointer(skb, offset, len, buffer);
135}
136#else
137static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
138{
139 return NULL;
140}
141static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
142 int len, void *buffer,
143 const struct ip_vs_iphdr *ipvsh)
144{
145 return skb_header_pointer(skb, offset, len, buffer);
146}
147#endif
148
114static inline void 149static inline void
115ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr) 150ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr)
151{
152 const struct iphdr *iph = nh;
153
154 iphdr->len = iph->ihl * 4;
155 iphdr->fragoffs = 0;
156 iphdr->protocol = iph->protocol;
157 iphdr->saddr.ip = iph->saddr;
158 iphdr->daddr.ip = iph->daddr;
159}
160
161/* This function handles filling *ip_vs_iphdr, both for IPv4 and IPv6.
162 * IPv6 requires some extra work, as finding proper header position,
163 * depend on the IPv6 extension headers.
164 */
165static inline void
166ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
116{ 167{
117#ifdef CONFIG_IP_VS_IPV6 168#ifdef CONFIG_IP_VS_IPV6
118 if (af == AF_INET6) { 169 if (af == AF_INET6) {
119 const struct ipv6hdr *iph = nh; 170 const struct ipv6hdr *iph =
120 iphdr->len = sizeof(struct ipv6hdr); 171 (struct ipv6hdr *)skb_network_header(skb);
121 iphdr->protocol = iph->nexthdr;
122 iphdr->saddr.in6 = iph->saddr; 172 iphdr->saddr.in6 = iph->saddr;
123 iphdr->daddr.in6 = iph->daddr; 173 iphdr->daddr.in6 = iph->daddr;
174 /* ipv6_find_hdr() updates len, flags, thoff_reasm */
175 iphdr->thoff_reasm = 0;
176 iphdr->len = 0;
177 iphdr->flags = 0;
178 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
179 &iphdr->fragoffs,
180 &iphdr->flags);
181 /* get proto from re-assembled packet and it's offset */
182 if (skb_nfct_reasm(skb))
183 iphdr->protocol = ipv6_find_hdr(skb_nfct_reasm(skb),
184 &iphdr->thoff_reasm,
185 -1, NULL, NULL);
186
124 } else 187 } else
125#endif 188#endif
126 { 189 {
127 const struct iphdr *iph = nh; 190 const struct iphdr *iph =
128 iphdr->len = iph->ihl * 4; 191 (struct iphdr *)skb_network_header(skb);
129 iphdr->protocol = iph->protocol; 192 iphdr->len = iph->ihl * 4;
193 iphdr->fragoffs = 0;
194 iphdr->protocol = iph->protocol;
195 iphdr->saddr.ip = iph->saddr;
196 iphdr->daddr.ip = iph->daddr;
197 }
198}
199
200/* This function is a faster version of ip_vs_fill_iph_skb().
201 * Where we only populate {s,d}addr (and avoid calling ipv6_find_hdr()).
202 * This is used by the some of the ip_vs_*_schedule() functions.
203 * (Mostly done to avoid ABI breakage of external schedulers)
204 */
205static inline void
206ip_vs_fill_iph_addr_only(int af, const struct sk_buff *skb,
207 struct ip_vs_iphdr *iphdr)
208{
209#ifdef CONFIG_IP_VS_IPV6
210 if (af == AF_INET6) {
211 const struct ipv6hdr *iph =
212 (struct ipv6hdr *)skb_network_header(skb);
213 iphdr->saddr.in6 = iph->saddr;
214 iphdr->daddr.in6 = iph->daddr;
215 } else
216#endif
217 {
218 const struct iphdr *iph =
219 (struct iphdr *)skb_network_header(skb);
130 iphdr->saddr.ip = iph->saddr; 220 iphdr->saddr.ip = iph->saddr;
131 iphdr->daddr.ip = iph->daddr; 221 iphdr->daddr.ip = iph->daddr;
132 } 222 }
@@ -165,7 +255,7 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
165 int len; 255 int len;
166#ifdef CONFIG_IP_VS_IPV6 256#ifdef CONFIG_IP_VS_IPV6
167 if (af == AF_INET6) 257 if (af == AF_INET6)
168 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6]", 258 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6c]",
169 &addr->in6) + 1; 259 &addr->in6) + 1;
170 else 260 else
171#endif 261#endif
@@ -398,27 +488,26 @@ struct ip_vs_protocol {
398 488
399 int (*conn_schedule)(int af, struct sk_buff *skb, 489 int (*conn_schedule)(int af, struct sk_buff *skb,
400 struct ip_vs_proto_data *pd, 490 struct ip_vs_proto_data *pd,
401 int *verdict, struct ip_vs_conn **cpp); 491 int *verdict, struct ip_vs_conn **cpp,
492 struct ip_vs_iphdr *iph);
402 493
403 struct ip_vs_conn * 494 struct ip_vs_conn *
404 (*conn_in_get)(int af, 495 (*conn_in_get)(int af,
405 const struct sk_buff *skb, 496 const struct sk_buff *skb,
406 const struct ip_vs_iphdr *iph, 497 const struct ip_vs_iphdr *iph,
407 unsigned int proto_off,
408 int inverse); 498 int inverse);
409 499
410 struct ip_vs_conn * 500 struct ip_vs_conn *
411 (*conn_out_get)(int af, 501 (*conn_out_get)(int af,
412 const struct sk_buff *skb, 502 const struct sk_buff *skb,
413 const struct ip_vs_iphdr *iph, 503 const struct ip_vs_iphdr *iph,
414 unsigned int proto_off,
415 int inverse); 504 int inverse);
416 505
417 int (*snat_handler)(struct sk_buff *skb, 506 int (*snat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
418 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 507 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph);
419 508
420 int (*dnat_handler)(struct sk_buff *skb, 509 int (*dnat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
421 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 510 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph);
422 511
423 int (*csum_check)(int af, struct sk_buff *skb, 512 int (*csum_check)(int af, struct sk_buff *skb,
424 struct ip_vs_protocol *pp); 513 struct ip_vs_protocol *pp);
@@ -518,7 +607,7 @@ struct ip_vs_conn {
518 NF_ACCEPT can be returned when destination is local. 607 NF_ACCEPT can be returned when destination is local.
519 */ 608 */
520 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, 609 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
521 struct ip_vs_protocol *pp); 610 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
522 611
523 /* Note: we can group the following members into a structure, 612 /* Note: we can group the following members into a structure,
524 in order to save more space, and the following members are 613 in order to save more space, and the following members are
@@ -769,13 +858,11 @@ struct ip_vs_app {
769 858
770 struct ip_vs_conn * 859 struct ip_vs_conn *
771 (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app, 860 (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app,
772 const struct iphdr *iph, unsigned int proto_off, 861 const struct iphdr *iph, int inverse);
773 int inverse);
774 862
775 struct ip_vs_conn * 863 struct ip_vs_conn *
776 (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app, 864 (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app,
777 const struct iphdr *iph, unsigned int proto_off, 865 const struct iphdr *iph, int inverse);
778 int inverse);
779 866
780 int (*state_transition)(struct ip_vs_conn *cp, int direction, 867 int (*state_transition)(struct ip_vs_conn *cp, int direction,
781 const struct sk_buff *skb, 868 const struct sk_buff *skb,
@@ -1074,14 +1161,12 @@ struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
1074 1161
1075struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, 1162struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
1076 const struct ip_vs_iphdr *iph, 1163 const struct ip_vs_iphdr *iph,
1077 unsigned int proto_off,
1078 int inverse); 1164 int inverse);
1079 1165
1080struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); 1166struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
1081 1167
1082struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, 1168struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
1083 const struct ip_vs_iphdr *iph, 1169 const struct ip_vs_iphdr *iph,
1084 unsigned int proto_off,
1085 int inverse); 1170 int inverse);
1086 1171
1087/* put back the conn without restarting its timer */ 1172/* put back the conn without restarting its timer */
@@ -1254,9 +1339,10 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1254extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1339extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1255extern struct ip_vs_conn * 1340extern struct ip_vs_conn *
1256ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1341ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1257 struct ip_vs_proto_data *pd, int *ignored); 1342 struct ip_vs_proto_data *pd, int *ignored,
1343 struct ip_vs_iphdr *iph);
1258extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1344extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1259 struct ip_vs_proto_data *pd); 1345 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1260 1346
1261extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1347extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1262 1348
@@ -1315,33 +1401,38 @@ extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1315/* 1401/*
1316 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1402 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1317 */ 1403 */
1318extern int ip_vs_null_xmit 1404extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1319(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1405 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1320extern int ip_vs_bypass_xmit 1406extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1321(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1407 struct ip_vs_protocol *pp,
1322extern int ip_vs_nat_xmit 1408 struct ip_vs_iphdr *iph);
1323(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1409extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1324extern int ip_vs_tunnel_xmit 1410 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1325(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1411extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1326extern int ip_vs_dr_xmit 1412 struct ip_vs_protocol *pp,
1327(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1413 struct ip_vs_iphdr *iph);
1328extern int ip_vs_icmp_xmit 1414extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1329(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, 1415 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1330 int offset, unsigned int hooknum); 1416extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1417 struct ip_vs_protocol *pp, int offset,
1418 unsigned int hooknum, struct ip_vs_iphdr *iph);
1331extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 1419extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
1332 1420
1333#ifdef CONFIG_IP_VS_IPV6 1421#ifdef CONFIG_IP_VS_IPV6
1334extern int ip_vs_bypass_xmit_v6 1422extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1335(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1423 struct ip_vs_protocol *pp,
1336extern int ip_vs_nat_xmit_v6 1424 struct ip_vs_iphdr *iph);
1337(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1425extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1338extern int ip_vs_tunnel_xmit_v6 1426 struct ip_vs_protocol *pp,
1339(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1427 struct ip_vs_iphdr *iph);
1340extern int ip_vs_dr_xmit_v6 1428extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1341(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1429 struct ip_vs_protocol *pp,
1342extern int ip_vs_icmp_xmit_v6 1430 struct ip_vs_iphdr *iph);
1343(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, 1431extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1344 int offset, unsigned int hooknum); 1432 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1433extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1434 struct ip_vs_protocol *pp, int offset,
1435 unsigned int hooknum, struct ip_vs_iphdr *iph);
1345#endif 1436#endif
1346 1437
1347#ifdef CONFIG_SYSCTL 1438#ifdef CONFIG_SYSCTL
diff --git a/include/net/ipip.h b/include/net/ipip.h
index ddc077c51f32..21947cf4fa46 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -48,25 +48,27 @@ struct ip_tunnel_prl_entry {
48 struct rcu_head rcu_head; 48 struct rcu_head rcu_head;
49}; 49};
50 50
51#define __IPTUNNEL_XMIT(stats1, stats2) do { \ 51static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
52 int err; \ 52{
53 int pkt_len = skb->len - skb_transport_offset(skb); \ 53 int err;
54 \ 54 struct iphdr *iph = ip_hdr(skb);
55 skb->ip_summed = CHECKSUM_NONE; \ 55 int pkt_len = skb->len - skb_transport_offset(skb);
56 ip_select_ident(iph, &rt->dst, NULL); \ 56 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
57 \
58 err = ip_local_out(skb); \
59 if (likely(net_xmit_eval(err) == 0)) { \
60 u64_stats_update_begin(&(stats1)->syncp); \
61 (stats1)->tx_bytes += pkt_len; \
62 (stats1)->tx_packets++; \
63 u64_stats_update_end(&(stats1)->syncp); \
64 } else { \
65 (stats2)->tx_errors++; \
66 (stats2)->tx_aborted_errors++; \
67 } \
68} while (0)
69 57
70#define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats) 58 nf_reset(skb);
59 skb->ip_summed = CHECKSUM_NONE;
60 ip_select_ident(iph, skb_dst(skb), NULL);
61
62 err = ip_local_out(skb);
63 if (likely(net_xmit_eval(err) == 0)) {
64 u64_stats_update_begin(&tstats->syncp);
65 tstats->tx_bytes += pkt_len;
66 tstats->tx_packets++;
67 u64_stats_update_end(&tstats->syncp);
68 } else {
69 dev->stats.tx_errors++;
70 dev->stats.tx_aborted_errors++;
71 }
72}
71 73
72#endif 74#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 979bf6c13141..5af66b26ebdd 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -271,6 +271,15 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
271 271
272extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 272extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
273 273
274static inline bool ipv6_accept_ra(struct inet6_dev *idev)
275{
276 /* If forwarding is enabled, RA are not accepted unless the special
277 * hybrid mode (accept_ra=2) is enabled.
278 */
279 return idev->cnf.forwarding ? idev->cnf.accept_ra == 2 :
280 idev->cnf.accept_ra;
281}
282
274#if IS_ENABLED(CONFIG_IPV6) 283#if IS_ENABLED(CONFIG_IPV6)
275static inline int ip6_frag_nqueues(struct net *net) 284static inline int ip6_frag_nqueues(struct net *net)
276{ 285{
@@ -630,6 +639,16 @@ extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
630 639
631extern bool ipv6_ext_hdr(u8 nexthdr); 640extern bool ipv6_ext_hdr(u8 nexthdr);
632 641
642enum {
643 IP6_FH_F_FRAG = (1 << 0),
644 IP6_FH_F_AUTH = (1 << 1),
645 IP6_FH_F_SKIP_RH = (1 << 2),
646};
647
648/* find specified header and get offset to it */
649extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
650 int target, unsigned short *fragoff, int *fragflg);
651
633extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 652extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
634 653
635extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, 654extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 82558c8decf8..ee50c5eba50c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -144,6 +144,39 @@ struct ieee80211_low_level_stats {
144}; 144};
145 145
146/** 146/**
147 * enum ieee80211_chanctx_change - change flag for channel context
148 * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
149 * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
150 */
151enum ieee80211_chanctx_change {
152 IEEE80211_CHANCTX_CHANGE_WIDTH = BIT(0),
153 IEEE80211_CHANCTX_CHANGE_RX_CHAINS = BIT(1),
154};
155
156/**
157 * struct ieee80211_chanctx_conf - channel context that vifs may be tuned to
158 *
159 * This is the driver-visible part. The ieee80211_chanctx
160 * that contains it is visible in mac80211 only.
161 *
162 * @def: the channel definition
163 * @rx_chains_static: The number of RX chains that must always be
164 * active on the channel to receive MIMO transmissions
165 * @rx_chains_dynamic: The number of RX chains that must be enabled
166 * after RTS/CTS handshake to receive SMPS MIMO transmissions;
167 * this will always be >= @rx_chains_static.
168 * @drv_priv: data area for driver use, will always be aligned to
169 * sizeof(void *), size is determined in hw information.
170 */
171struct ieee80211_chanctx_conf {
172 struct cfg80211_chan_def def;
173
174 u8 rx_chains_static, rx_chains_dynamic;
175
176 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
177};
178
179/**
147 * enum ieee80211_bss_change - BSS change notification flags 180 * enum ieee80211_bss_change - BSS change notification flags
148 * 181 *
149 * These flags are used with the bss_info_changed() callback 182 * These flags are used with the bss_info_changed() callback
@@ -172,6 +205,9 @@ struct ieee80211_low_level_stats {
172 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 205 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)
173 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) 206 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
174 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) 207 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
208 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
209 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
210 * changed (currently only in P2P client mode, GO mode will be later)
175 */ 211 */
176enum ieee80211_bss_change { 212enum ieee80211_bss_change {
177 BSS_CHANGED_ASSOC = 1<<0, 213 BSS_CHANGED_ASSOC = 1<<0,
@@ -192,6 +228,8 @@ enum ieee80211_bss_change {
192 BSS_CHANGED_SSID = 1<<15, 228 BSS_CHANGED_SSID = 1<<15,
193 BSS_CHANGED_AP_PROBE_RESP = 1<<16, 229 BSS_CHANGED_AP_PROBE_RESP = 1<<16,
194 BSS_CHANGED_PS = 1<<17, 230 BSS_CHANGED_PS = 1<<17,
231 BSS_CHANGED_TXPOWER = 1<<18,
232 BSS_CHANGED_P2P_PS = 1<<19,
195 233
196 /* when adding here, make sure to change ieee80211_reconfig */ 234 /* when adding here, make sure to change ieee80211_reconfig */
197}; 235};
@@ -223,6 +261,7 @@ enum ieee80211_rssi_event {
223 * @assoc: association status 261 * @assoc: association status
224 * @ibss_joined: indicates whether this station is part of an IBSS 262 * @ibss_joined: indicates whether this station is part of an IBSS
225 * or not 263 * or not
264 * @ibss_creator: indicates if a new IBSS network is being created
226 * @aid: association ID number, valid only when @assoc is true 265 * @aid: association ID number, valid only when @assoc is true
227 * @use_cts_prot: use CTS protection 266 * @use_cts_prot: use CTS protection
228 * @use_short_preamble: use 802.11b short preamble; 267 * @use_short_preamble: use 802.11b short preamble;
@@ -247,9 +286,8 @@ enum ieee80211_rssi_event {
247 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 286 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
248 * @bssid: The BSSID for this BSS 287 * @bssid: The BSSID for this BSS
249 * @enable_beacon: whether beaconing should be enabled or not 288 * @enable_beacon: whether beaconing should be enabled or not
250 * @channel_type: Channel type for this BSS -- the hardware might be 289 * @chandef: Channel definition for this BSS -- the hardware might be
251 * configured for HT40+ while this BSS only uses no-HT, for 290 * configured a higher bandwidth than this BSS uses, for example.
252 * example.
253 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation. 291 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
254 * This field is only valid when the channel type is one of the HT types. 292 * This field is only valid when the channel type is one of the HT types.
255 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value 293 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
@@ -273,11 +311,15 @@ enum ieee80211_rssi_event {
273 * @ssid: The SSID of the current vif. Only valid in AP-mode. 311 * @ssid: The SSID of the current vif. Only valid in AP-mode.
274 * @ssid_len: Length of SSID given in @ssid. 312 * @ssid_len: Length of SSID given in @ssid.
275 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. 313 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
314 * @txpower: TX power in dBm
315 * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces
316 * @p2p_oppps: P2P opportunistic PS is enabled
276 */ 317 */
277struct ieee80211_bss_conf { 318struct ieee80211_bss_conf {
278 const u8 *bssid; 319 const u8 *bssid;
279 /* association related data */ 320 /* association related data */
280 bool assoc, ibss_joined; 321 bool assoc, ibss_joined;
322 bool ibss_creator;
281 u16 aid; 323 u16 aid;
282 /* erp related data */ 324 /* erp related data */
283 bool use_cts_prot; 325 bool use_cts_prot;
@@ -294,7 +336,7 @@ struct ieee80211_bss_conf {
294 u16 ht_operation_mode; 336 u16 ht_operation_mode;
295 s32 cqm_rssi_thold; 337 s32 cqm_rssi_thold;
296 u32 cqm_rssi_hyst; 338 u32 cqm_rssi_hyst;
297 enum nl80211_channel_type channel_type; 339 struct cfg80211_chan_def chandef;
298 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; 340 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
299 u8 arp_addr_cnt; 341 u8 arp_addr_cnt;
300 bool arp_filter_enabled; 342 bool arp_filter_enabled;
@@ -304,6 +346,9 @@ struct ieee80211_bss_conf {
304 u8 ssid[IEEE80211_MAX_SSID_LEN]; 346 u8 ssid[IEEE80211_MAX_SSID_LEN];
305 size_t ssid_len; 347 size_t ssid_len;
306 bool hidden_ssid; 348 bool hidden_ssid;
349 int txpower;
350 u8 p2p_ctwindow;
351 bool p2p_oppps;
307}; 352};
308 353
309/** 354/**
@@ -454,9 +499,14 @@ enum mac80211_tx_control_flags {
454 * This is set if the current BSS requires ERP protection. 499 * This is set if the current BSS requires ERP protection.
455 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble. 500 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
456 * @IEEE80211_TX_RC_MCS: HT rate. 501 * @IEEE80211_TX_RC_MCS: HT rate.
502 * @IEEE80211_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is split
503 * into a higher 4 bits (Nss) and lower 4 bits (MCS number)
457 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in 504 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
458 * Greenfield mode. 505 * Greenfield mode.
459 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz. 506 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
507 * @IEEE80211_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
508 * @IEEE80211_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
509 * (80+80 isn't supported yet)
460 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the 510 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
461 * adjacent 20 MHz channels, if the current channel type is 511 * adjacent 20 MHz channels, if the current channel type is
462 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS. 512 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
@@ -467,12 +517,15 @@ enum mac80211_rate_control_flags {
467 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 517 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
468 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2), 518 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
469 519
470 /* rate index is an MCS rate number instead of an index */ 520 /* rate index is an HT/VHT MCS instead of an index */
471 IEEE80211_TX_RC_MCS = BIT(3), 521 IEEE80211_TX_RC_MCS = BIT(3),
472 IEEE80211_TX_RC_GREEN_FIELD = BIT(4), 522 IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
473 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5), 523 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
474 IEEE80211_TX_RC_DUP_DATA = BIT(6), 524 IEEE80211_TX_RC_DUP_DATA = BIT(6),
475 IEEE80211_TX_RC_SHORT_GI = BIT(7), 525 IEEE80211_TX_RC_SHORT_GI = BIT(7),
526 IEEE80211_TX_RC_VHT_MCS = BIT(8),
527 IEEE80211_TX_RC_80_MHZ_WIDTH = BIT(9),
528 IEEE80211_TX_RC_160_MHZ_WIDTH = BIT(10),
476}; 529};
477 530
478 531
@@ -515,10 +568,32 @@ enum mac80211_rate_control_flags {
515 */ 568 */
516struct ieee80211_tx_rate { 569struct ieee80211_tx_rate {
517 s8 idx; 570 s8 idx;
518 u8 count; 571 u16 count:5,
519 u8 flags; 572 flags:11;
520} __packed; 573} __packed;
521 574
575#define IEEE80211_MAX_TX_RETRY 31
576
577static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
578 u8 mcs, u8 nss)
579{
580 WARN_ON(mcs & ~0xF);
581 WARN_ON(nss & ~0x7);
582 rate->idx = (nss << 4) | mcs;
583}
584
585static inline u8
586ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
587{
588 return rate->idx & 0xF;
589}
590
591static inline u8
592ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
593{
594 return rate->idx >> 4;
595}
596
522/** 597/**
523 * struct ieee80211_tx_info - skb transmit information 598 * struct ieee80211_tx_info - skb transmit information
524 * 599 *
@@ -663,13 +738,20 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
663 * the frame. 738 * the frame.
664 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on 739 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
665 * the frame. 740 * the frame.
666 * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime 741 * @RX_FLAG_MACTIME_START: The timestamp passed in the RX status (@mactime
667 * field) is valid and contains the time the first symbol of the MPDU 742 * field) is valid and contains the time the first symbol of the MPDU
668 * was received. This is useful in monitor mode and for proper IBSS 743 * was received. This is useful in monitor mode and for proper IBSS
669 * merging. 744 * merging.
745 * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
746 * field) is valid and contains the time the last symbol of the MPDU
747 * (including FCS) was received.
670 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 748 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
671 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 749 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
750 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
672 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 751 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
752 * @RX_FLAG_80MHZ: 80 MHz was used
753 * @RX_FLAG_80P80MHZ: 80+80 MHz was used
754 * @RX_FLAG_160MHZ: 160 MHz was used
673 * @RX_FLAG_SHORT_GI: Short guard interval was used 755 * @RX_FLAG_SHORT_GI: Short guard interval was used
674 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 756 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
675 * Valid only for data frames (mainly A-MPDU) 757 * Valid only for data frames (mainly A-MPDU)
@@ -697,7 +779,7 @@ enum mac80211_rx_flags {
697 RX_FLAG_IV_STRIPPED = BIT(4), 779 RX_FLAG_IV_STRIPPED = BIT(4),
698 RX_FLAG_FAILED_FCS_CRC = BIT(5), 780 RX_FLAG_FAILED_FCS_CRC = BIT(5),
699 RX_FLAG_FAILED_PLCP_CRC = BIT(6), 781 RX_FLAG_FAILED_PLCP_CRC = BIT(6),
700 RX_FLAG_MACTIME_MPDU = BIT(7), 782 RX_FLAG_MACTIME_START = BIT(7),
701 RX_FLAG_SHORTPRE = BIT(8), 783 RX_FLAG_SHORTPRE = BIT(8),
702 RX_FLAG_HT = BIT(9), 784 RX_FLAG_HT = BIT(9),
703 RX_FLAG_40MHZ = BIT(10), 785 RX_FLAG_40MHZ = BIT(10),
@@ -711,6 +793,11 @@ enum mac80211_rx_flags {
711 RX_FLAG_AMPDU_IS_LAST = BIT(18), 793 RX_FLAG_AMPDU_IS_LAST = BIT(18),
712 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), 794 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19),
713 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), 795 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20),
796 RX_FLAG_MACTIME_END = BIT(21),
797 RX_FLAG_VHT = BIT(22),
798 RX_FLAG_80MHZ = BIT(23),
799 RX_FLAG_80P80MHZ = BIT(24),
800 RX_FLAG_160MHZ = BIT(25),
714}; 801};
715 802
716/** 803/**
@@ -731,25 +818,39 @@ enum mac80211_rx_flags {
731 * @IEEE80211_HW_SIGNAL_* 818 * @IEEE80211_HW_SIGNAL_*
732 * @antenna: antenna used 819 * @antenna: antenna used
733 * @rate_idx: index of data rate into band's supported rates or MCS index if 820 * @rate_idx: index of data rate into band's supported rates or MCS index if
734 * HT rates are use (RX_FLAG_HT) 821 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
822 * @vht_nss: number of streams (VHT only)
735 * @flag: %RX_FLAG_* 823 * @flag: %RX_FLAG_*
736 * @rx_flags: internal RX flags for mac80211 824 * @rx_flags: internal RX flags for mac80211
737 * @ampdu_reference: A-MPDU reference number, must be a different value for 825 * @ampdu_reference: A-MPDU reference number, must be a different value for
738 * each A-MPDU but the same for each subframe within one A-MPDU 826 * each A-MPDU but the same for each subframe within one A-MPDU
739 * @ampdu_delimiter_crc: A-MPDU delimiter CRC 827 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
828 * @vendor_radiotap_bitmap: radiotap vendor namespace presence bitmap
829 * @vendor_radiotap_len: radiotap vendor namespace length
830 * @vendor_radiotap_align: radiotap vendor namespace alignment. Note
831 * that the actual data must be at the start of the SKB data
832 * already.
833 * @vendor_radiotap_oui: radiotap vendor namespace OUI
834 * @vendor_radiotap_subns: radiotap vendor sub namespace
740 */ 835 */
741struct ieee80211_rx_status { 836struct ieee80211_rx_status {
742 u64 mactime; 837 u64 mactime;
743 u32 device_timestamp; 838 u32 device_timestamp;
744 u32 ampdu_reference; 839 u32 ampdu_reference;
745 u32 flag; 840 u32 flag;
841 u32 vendor_radiotap_bitmap;
842 u16 vendor_radiotap_len;
746 u16 freq; 843 u16 freq;
747 u8 rate_idx; 844 u8 rate_idx;
845 u8 vht_nss;
748 u8 rx_flags; 846 u8 rx_flags;
749 u8 band; 847 u8 band;
750 u8 antenna; 848 u8 antenna;
751 s8 signal; 849 s8 signal;
752 u8 ampdu_delimiter_crc; 850 u8 ampdu_delimiter_crc;
851 u8 vendor_radiotap_align;
852 u8 vendor_radiotap_oui[3];
853 u8 vendor_radiotap_subns;
753}; 854};
754 855
755/** 856/**
@@ -794,6 +895,8 @@ enum ieee80211_conf_flags {
794 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 895 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
795 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 896 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
796 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed 897 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
898 * Note that this is only valid if channel contexts are not used,
899 * otherwise each channel context has the number of chains listed.
797 */ 900 */
798enum ieee80211_conf_changed { 901enum ieee80211_conf_changed {
799 IEEE80211_CONF_CHANGE_SMPS = BIT(1), 902 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
@@ -845,7 +948,8 @@ enum ieee80211_smps_mode {
845 * powersave documentation below. This variable is valid only when 948 * powersave documentation below. This variable is valid only when
846 * the CONF_PS flag is set. 949 * the CONF_PS flag is set.
847 * 950 *
848 * @power_level: requested transmit power (in dBm) 951 * @power_level: requested transmit power (in dBm), backward compatibility
952 * value only that is set to the minimum of all interfaces
849 * 953 *
850 * @channel: the channel to tune to 954 * @channel: the channel to tune to
851 * @channel_type: the channel (HT) type 955 * @channel_type: the channel (HT) type
@@ -859,7 +963,9 @@ enum ieee80211_smps_mode {
859 * 963 *
860 * @smps_mode: spatial multiplexing powersave mode; note that 964 * @smps_mode: spatial multiplexing powersave mode; note that
861 * %IEEE80211_SMPS_STATIC is used when the device is not 965 * %IEEE80211_SMPS_STATIC is used when the device is not
862 * configured for an HT channel 966 * configured for an HT channel.
967 * Note that this is only valid if channel contexts are not used,
968 * otherwise each channel context has the number of chains listed.
863 */ 969 */
864struct ieee80211_conf { 970struct ieee80211_conf {
865 u32 flags; 971 u32 flags;
@@ -931,6 +1037,11 @@ enum ieee80211_vif_flags {
931 * at runtime, mac80211 will never touch this field 1037 * at runtime, mac80211 will never touch this field
932 * @hw_queue: hardware queue for each AC 1038 * @hw_queue: hardware queue for each AC
933 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only 1039 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
1040 * @chanctx_conf: The channel context this interface is assigned to, or %NULL
1041 * when it is not assigned. This pointer is RCU-protected due to the TX
1042 * path needing to access it; even though the netdev carrier will always
1043 * be off when it is %NULL there can still be races and packets could be
1044 * processed after it switches back to %NULL.
934 * @drv_priv: data area for driver use, will always be aligned to 1045 * @drv_priv: data area for driver use, will always be aligned to
935 * sizeof(void *). 1046 * sizeof(void *).
936 */ 1047 */
@@ -943,6 +1054,8 @@ struct ieee80211_vif {
943 u8 cab_queue; 1054 u8 cab_queue;
944 u8 hw_queue[IEEE80211_NUM_ACS]; 1055 u8 hw_queue[IEEE80211_NUM_ACS];
945 1056
1057 struct ieee80211_chanctx_conf __rcu *chanctx_conf;
1058
946 u32 driver_flags; 1059 u32 driver_flags;
947 1060
948 /* must be last */ 1061 /* must be last */
@@ -1076,6 +1189,8 @@ enum ieee80211_sta_state {
1076 * @aid: AID we assigned to the station if we're an AP 1189 * @aid: AID we assigned to the station if we're an AP
1077 * @supp_rates: Bitmap of supported rates (per band) 1190 * @supp_rates: Bitmap of supported rates (per band)
1078 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities 1191 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities
1192 * @vht_cap: VHT capabilities of this STA; Not restricting any capabilities
1193 * of remote STA. Taking as is.
1079 * @wme: indicates whether the STA supports WME. Only valid during AP-mode. 1194 * @wme: indicates whether the STA supports WME. Only valid during AP-mode.
1080 * @drv_priv: data area for driver use, will always be aligned to 1195 * @drv_priv: data area for driver use, will always be aligned to
1081 * sizeof(void *), size is determined in hw information. 1196 * sizeof(void *), size is determined in hw information.
@@ -1088,6 +1203,7 @@ struct ieee80211_sta {
1088 u8 addr[ETH_ALEN]; 1203 u8 addr[ETH_ALEN];
1089 u16 aid; 1204 u16 aid;
1090 struct ieee80211_sta_ht_cap ht_cap; 1205 struct ieee80211_sta_ht_cap ht_cap;
1206 struct ieee80211_sta_vht_cap vht_cap;
1091 bool wme; 1207 bool wme;
1092 u8 uapsd_queues; 1208 u8 uapsd_queues;
1093 u8 max_sp; 1209 u8 max_sp;
@@ -1253,6 +1369,10 @@ struct ieee80211_tx_control {
1253 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any 1369 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1254 * P2P Interface. This will be honoured even if more than one interface 1370 * P2P Interface. This will be honoured even if more than one interface
1255 * is supported. 1371 * is supported.
1372 *
1373 * @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session
1374 * should be tear down once BAR frame will not be acked.
1375 *
1256 */ 1376 */
1257enum ieee80211_hw_flags { 1377enum ieee80211_hw_flags {
1258 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1378 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1281,6 +1401,7 @@ enum ieee80211_hw_flags {
1281 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1401 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1282 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, 1402 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1283 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1403 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1404 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL = 1<<26,
1284}; 1405};
1285 1406
1286/** 1407/**
@@ -1325,6 +1446,8 @@ enum ieee80211_hw_flags {
1325 * within &struct ieee80211_vif. 1446 * within &struct ieee80211_vif.
1326 * @sta_data_size: size (in bytes) of the drv_priv data area 1447 * @sta_data_size: size (in bytes) of the drv_priv data area
1327 * within &struct ieee80211_sta. 1448 * within &struct ieee80211_sta.
1449 * @chanctx_data_size: size (in bytes) of the drv_priv data area
1450 * within &struct ieee80211_chanctx_conf.
1328 * 1451 *
1329 * @max_rates: maximum number of alternate rate retry stages the hw 1452 * @max_rates: maximum number of alternate rate retry stages the hw
1330 * can handle. 1453 * can handle.
@@ -1355,6 +1478,10 @@ enum ieee80211_hw_flags {
1355 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only 1478 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
1356 * adding _BW is supported today. 1479 * adding _BW is supported today.
1357 * 1480 *
1481 * @radiotap_vht_details: lists which VHT MCS information the HW reports,
1482 * the default is _GI | _BANDWIDTH.
1483 * Use the %IEEE80211_RADIOTAP_VHT_KNOWN_* values.
1484 *
1358 * @netdev_features: netdev features to be set in each netdev created 1485 * @netdev_features: netdev features to be set in each netdev created
1359 * from this HW. Note only HW checksum features are currently 1486 * from this HW. Note only HW checksum features are currently
1360 * compatible with mac80211. Other feature bits will be rejected. 1487 * compatible with mac80211. Other feature bits will be rejected.
@@ -1369,6 +1496,7 @@ struct ieee80211_hw {
1369 int channel_change_time; 1496 int channel_change_time;
1370 int vif_data_size; 1497 int vif_data_size;
1371 int sta_data_size; 1498 int sta_data_size;
1499 int chanctx_data_size;
1372 int napi_weight; 1500 int napi_weight;
1373 u16 queues; 1501 u16 queues;
1374 u16 max_listen_interval; 1502 u16 max_listen_interval;
@@ -1380,6 +1508,7 @@ struct ieee80211_hw {
1380 u8 max_tx_aggregation_subframes; 1508 u8 max_tx_aggregation_subframes;
1381 u8 offchannel_tx_hw_queue; 1509 u8 offchannel_tx_hw_queue;
1382 u8 radiotap_mcs_details; 1510 u8 radiotap_mcs_details;
1511 u16 radiotap_vht_details;
1383 netdev_features_t netdev_features; 1512 netdev_features_t netdev_features;
1384}; 1513};
1385 1514
@@ -2126,6 +2255,14 @@ enum ieee80211_rate_control_changed {
2126 * @sta_remove: Notifies low level driver about removal of an associated 2255 * @sta_remove: Notifies low level driver about removal of an associated
2127 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. 2256 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
2128 * 2257 *
2258 * @sta_add_debugfs: Drivers can use this callback to add debugfs files
2259 * when a station is added to mac80211's station list. This callback
2260 * and @sta_remove_debugfs should be within a CONFIG_MAC80211_DEBUGFS
2261 * conditional. This callback can sleep.
2262 *
2263 * @sta_remove_debugfs: Remove the debugfs files which were added using
2264 * @sta_add_debugfs. This callback can sleep.
2265 *
2129 * @sta_notify: Notifies low level driver about power state transition of an 2266 * @sta_notify: Notifies low level driver about power state transition of an
2130 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating 2267 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
2131 * in AP mode, this callback will not be called when the flag 2268 * in AP mode, this callback will not be called when the flag
@@ -2317,6 +2454,27 @@ enum ieee80211_rate_control_changed {
2317 * The callback will be called before each transmission and upon return 2454 * The callback will be called before each transmission and upon return
2318 * mac80211 will transmit the frame right away. 2455 * mac80211 will transmit the frame right away.
2319 * The callback is optional and can (should!) sleep. 2456 * The callback is optional and can (should!) sleep.
2457 *
2458 * @add_chanctx: Notifies device driver about new channel context creation.
2459 * @remove_chanctx: Notifies device driver about channel context destruction.
2460 * @change_chanctx: Notifies device driver about channel context changes that
2461 * may happen when combining different virtual interfaces on the same
2462 * channel context with different settings
2463 * @assign_vif_chanctx: Notifies device driver about channel context being bound
2464 * to vif. Possible use is for hw queue remapping.
2465 * @unassign_vif_chanctx: Notifies device driver about channel context being
2466 * unbound from vif.
2467 * @start_ap: Start operation on the AP interface, this is called after all the
2468 * information in bss_conf is set and beacon can be retrieved. A channel
2469 * context is bound before this is called. Note that if the driver uses
2470 * software scan or ROC, this (and @stop_ap) isn't called when the AP is
2471 * just "paused" for scanning/ROC, which is indicated by the beacon being
2472 * disabled/enabled via @bss_info_changed.
2473 * @stop_ap: Stop operation on the AP interface.
2474 *
2475 * @restart_complete: Called after a call to ieee80211_restart_hw(), when the
2476 * reconfiguration has completed. This can help the driver implement the
2477 * reconfiguration step. This callback may sleep.
2320 */ 2478 */
2321struct ieee80211_ops { 2479struct ieee80211_ops {
2322 void (*tx)(struct ieee80211_hw *hw, 2480 void (*tx)(struct ieee80211_hw *hw,
@@ -2342,6 +2500,9 @@ struct ieee80211_ops {
2342 struct ieee80211_bss_conf *info, 2500 struct ieee80211_bss_conf *info,
2343 u32 changed); 2501 u32 changed);
2344 2502
2503 int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2504 void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2505
2345 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 2506 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
2346 struct netdev_hw_addr_list *mc_list); 2507 struct netdev_hw_addr_list *mc_list);
2347 void (*configure_filter)(struct ieee80211_hw *hw, 2508 void (*configure_filter)(struct ieee80211_hw *hw,
@@ -2383,6 +2544,16 @@ struct ieee80211_ops {
2383 struct ieee80211_sta *sta); 2544 struct ieee80211_sta *sta);
2384 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2545 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2385 struct ieee80211_sta *sta); 2546 struct ieee80211_sta *sta);
2547#ifdef CONFIG_MAC80211_DEBUGFS
2548 void (*sta_add_debugfs)(struct ieee80211_hw *hw,
2549 struct ieee80211_vif *vif,
2550 struct ieee80211_sta *sta,
2551 struct dentry *dir);
2552 void (*sta_remove_debugfs)(struct ieee80211_hw *hw,
2553 struct ieee80211_vif *vif,
2554 struct ieee80211_sta *sta,
2555 struct dentry *dir);
2556#endif
2386 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2557 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2387 enum sta_notify_cmd, struct ieee80211_sta *sta); 2558 enum sta_notify_cmd, struct ieee80211_sta *sta);
2388 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2559 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -2424,8 +2595,8 @@ struct ieee80211_ops {
2424 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 2595 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
2425 2596
2426 int (*remain_on_channel)(struct ieee80211_hw *hw, 2597 int (*remain_on_channel)(struct ieee80211_hw *hw,
2598 struct ieee80211_vif *vif,
2427 struct ieee80211_channel *chan, 2599 struct ieee80211_channel *chan,
2428 enum nl80211_channel_type channel_type,
2429 int duration); 2600 int duration);
2430 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); 2601 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
2431 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); 2602 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
@@ -2461,6 +2632,22 @@ struct ieee80211_ops {
2461 2632
2462 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 2633 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2463 struct ieee80211_vif *vif); 2634 struct ieee80211_vif *vif);
2635
2636 int (*add_chanctx)(struct ieee80211_hw *hw,
2637 struct ieee80211_chanctx_conf *ctx);
2638 void (*remove_chanctx)(struct ieee80211_hw *hw,
2639 struct ieee80211_chanctx_conf *ctx);
2640 void (*change_chanctx)(struct ieee80211_hw *hw,
2641 struct ieee80211_chanctx_conf *ctx,
2642 u32 changed);
2643 int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
2644 struct ieee80211_vif *vif,
2645 struct ieee80211_chanctx_conf *ctx);
2646 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
2647 struct ieee80211_vif *vif,
2648 struct ieee80211_chanctx_conf *ctx);
2649
2650 void (*restart_complete)(struct ieee80211_hw *hw);
2464}; 2651};
2465 2652
2466/** 2653/**
@@ -2962,8 +3149,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2962 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3149 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2963 * @ssid: SSID buffer 3150 * @ssid: SSID buffer
2964 * @ssid_len: length of SSID 3151 * @ssid_len: length of SSID
2965 * @ie: buffer containing all IEs except SSID for the template 3152 * @tailroom: tailroom to reserve at end of SKB for IEs
2966 * @ie_len: length of the IE buffer
2967 * 3153 *
2968 * Creates a Probe Request template which can, for example, be uploaded to 3154 * Creates a Probe Request template which can, for example, be uploaded to
2969 * hardware. 3155 * hardware.
@@ -2971,7 +3157,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2971struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3157struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2972 struct ieee80211_vif *vif, 3158 struct ieee80211_vif *vif,
2973 const u8 *ssid, size_t ssid_len, 3159 const u8 *ssid, size_t ssid_len,
2974 const u8 *ie, size_t ie_len); 3160 size_t tailroom);
2975 3161
2976/** 3162/**
2977 * ieee80211_rts_get - RTS frame generation function 3163 * ieee80211_rts_get - RTS frame generation function
@@ -3145,6 +3331,19 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
3145 struct sk_buff *skb, u8 *p2k); 3331 struct sk_buff *skb, u8 *p2k);
3146 3332
3147/** 3333/**
3334 * ieee80211_aes_cmac_calculate_k1_k2 - calculate the AES-CMAC sub keys
3335 *
3336 * This function computes the two AES-CMAC sub-keys, based on the
3337 * previously installed master key.
3338 *
3339 * @keyconf: the parameter passed with the set key
3340 * @k1: a buffer to be filled with the 1st sub-key
3341 * @k2: a buffer to be filled with the 2nd sub-key
3342 */
3343void ieee80211_aes_cmac_calculate_k1_k2(struct ieee80211_key_conf *keyconf,
3344 u8 *k1, u8 *k2);
3345
3346/**
3148 * struct ieee80211_key_seq - key sequence counter 3347 * struct ieee80211_key_seq - key sequence counter
3149 * 3348 *
3150 * @tkip: TKIP data, containing IV32 and IV16 in host byte order 3349 * @tkip: TKIP data, containing IV32 and IV16 in host byte order
@@ -3294,6 +3493,21 @@ void ieee80211_sched_scan_results(struct ieee80211_hw *hw);
3294void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); 3493void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
3295 3494
3296/** 3495/**
3496 * enum ieee80211_interface_iteration_flags - interface iteration flags
3497 * @IEEE80211_IFACE_ITER_NORMAL: Iterate over all interfaces that have
3498 * been added to the driver; However, note that during hardware
3499 * reconfiguration (after restart_hw) it will iterate over a new
3500 * interface and over all the existing interfaces even if they
3501 * haven't been re-added to the driver yet.
3502 * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
3503 * interfaces, even if they haven't been re-added to the driver yet.
3504 */
3505enum ieee80211_interface_iteration_flags {
3506 IEEE80211_IFACE_ITER_NORMAL = 0,
3507 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0),
3508};
3509
3510/**
3297 * ieee80211_iterate_active_interfaces - iterate active interfaces 3511 * ieee80211_iterate_active_interfaces - iterate active interfaces
3298 * 3512 *
3299 * This function iterates over the interfaces associated with a given 3513 * This function iterates over the interfaces associated with a given
@@ -3301,13 +3515,15 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
3301 * This function allows the iterator function to sleep, when the iterator 3515 * This function allows the iterator function to sleep, when the iterator
3302 * function is atomic @ieee80211_iterate_active_interfaces_atomic can 3516 * function is atomic @ieee80211_iterate_active_interfaces_atomic can
3303 * be used. 3517 * be used.
3304 * Does not iterate over a new interface during add_interface() 3518 * Does not iterate over a new interface during add_interface().
3305 * 3519 *
3306 * @hw: the hardware struct of which the interfaces should be iterated over 3520 * @hw: the hardware struct of which the interfaces should be iterated over
3521 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
3307 * @iterator: the iterator function to call 3522 * @iterator: the iterator function to call
3308 * @data: first argument of the iterator function 3523 * @data: first argument of the iterator function
3309 */ 3524 */
3310void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 3525void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
3526 u32 iter_flags,
3311 void (*iterator)(void *data, u8 *mac, 3527 void (*iterator)(void *data, u8 *mac,
3312 struct ieee80211_vif *vif), 3528 struct ieee80211_vif *vif),
3313 void *data); 3529 void *data);
@@ -3319,13 +3535,15 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
3319 * hardware that are currently active and calls the callback for them. 3535 * hardware that are currently active and calls the callback for them.
3320 * This function requires the iterator callback function to be atomic, 3536 * This function requires the iterator callback function to be atomic,
3321 * if that is not desired, use @ieee80211_iterate_active_interfaces instead. 3537 * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
3322 * Does not iterate over a new interface during add_interface() 3538 * Does not iterate over a new interface during add_interface().
3323 * 3539 *
3324 * @hw: the hardware struct of which the interfaces should be iterated over 3540 * @hw: the hardware struct of which the interfaces should be iterated over
3541 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
3325 * @iterator: the iterator function to call, cannot sleep 3542 * @iterator: the iterator function to call, cannot sleep
3326 * @data: first argument of the iterator function 3543 * @data: first argument of the iterator function
3327 */ 3544 */
3328void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, 3545void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
3546 u32 iter_flags,
3329 void (*iterator)(void *data, 3547 void (*iterator)(void *data,
3330 u8 *mac, 3548 u8 *mac,
3331 struct ieee80211_vif *vif), 3549 struct ieee80211_vif *vif),
@@ -3524,6 +3742,27 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw,
3524 void *iter_data); 3742 void *iter_data);
3525 3743
3526/** 3744/**
3745 * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
3746 * @hw: pointre obtained from ieee80211_alloc_hw().
3747 * @iter: iterator function
3748 * @iter_data: data passed to iterator function
3749 *
3750 * Iterate all active channel contexts. This function is atomic and
3751 * doesn't acquire any locks internally that might be held in other
3752 * places while calling into the driver.
3753 *
3754 * The iterator will not find a context that's being added (during
3755 * the driver callback to add it) but will find it while it's being
3756 * removed.
3757 */
3758void ieee80211_iter_chan_contexts_atomic(
3759 struct ieee80211_hw *hw,
3760 void (*iter)(struct ieee80211_hw *hw,
3761 struct ieee80211_chanctx_conf *chanctx_conf,
3762 void *data),
3763 void *iter_data);
3764
3765/**
3527 * ieee80211_ap_probereq_get - retrieve a Probe Request template 3766 * ieee80211_ap_probereq_get - retrieve a Probe Request template
3528 * @hw: pointer obtained from ieee80211_alloc_hw(). 3767 * @hw: pointer obtained from ieee80211_alloc_hw().
3529 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3768 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 980d263765cf..23b3a7c58783 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -78,6 +78,13 @@ struct ra_msg {
78 __be32 retrans_timer; 78 __be32 retrans_timer;
79}; 79};
80 80
81struct rd_msg {
82 struct icmp6hdr icmph;
83 struct in6_addr target;
84 struct in6_addr dest;
85 __u8 opt[0];
86};
87
81struct nd_opt_hdr { 88struct nd_opt_hdr {
82 __u8 nd_opt_type; 89 __u8 nd_opt_type;
83 __u8 nd_opt_len; 90 __u8 nd_opt_len;
@@ -190,21 +197,6 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
190extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 197extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
191 struct net_device *dev, int dir); 198 struct net_device *dev, int dir);
192 199
193extern struct sk_buff *ndisc_build_skb(struct net_device *dev,
194 const struct in6_addr *daddr,
195 const struct in6_addr *saddr,
196 struct icmp6hdr *icmp6h,
197 const struct in6_addr *target,
198 int llinfo);
199
200extern void ndisc_send_skb(struct sk_buff *skb,
201 struct net_device *dev,
202 struct neighbour *neigh,
203 const struct in6_addr *daddr,
204 const struct in6_addr *saddr,
205 struct icmp6hdr *icmp6h);
206
207
208 200
209/* 201/*
210 * IGMP 202 * IGMP
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 95e646641184..de644bcd8613 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -23,6 +23,7 @@
23#endif 23#endif
24#include <net/netns/xfrm.h> 24#include <net/netns/xfrm.h>
25 25
26struct user_namespace;
26struct proc_dir_entry; 27struct proc_dir_entry;
27struct net_device; 28struct net_device;
28struct sock; 29struct sock;
@@ -53,6 +54,10 @@ struct net {
53 struct list_head cleanup_list; /* namespaces on death row */ 54 struct list_head cleanup_list; /* namespaces on death row */
54 struct list_head exit_list; /* Use only net_mutex */ 55 struct list_head exit_list; /* Use only net_mutex */
55 56
57 struct user_namespace *user_ns; /* Owning user namespace */
58
59 unsigned int proc_inum;
60
56 struct proc_dir_entry *proc_net; 61 struct proc_dir_entry *proc_net;
57 struct proc_dir_entry *proc_net_stat; 62 struct proc_dir_entry *proc_net_stat;
58 63
@@ -126,16 +131,21 @@ struct net {
126/* Init's network namespace */ 131/* Init's network namespace */
127extern struct net init_net; 132extern struct net init_net;
128 133
129#ifdef CONFIG_NET 134#ifdef CONFIG_NET_NS
130extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); 135extern struct net *copy_net_ns(unsigned long flags,
131 136 struct user_namespace *user_ns, struct net *old_net);
132#else /* CONFIG_NET */ 137
133static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) 138#else /* CONFIG_NET_NS */
139#include <linux/sched.h>
140#include <linux/nsproxy.h>
141static inline struct net *copy_net_ns(unsigned long flags,
142 struct user_namespace *user_ns, struct net *old_net)
134{ 143{
135 /* There is nothing to copy so this is a noop */ 144 if (flags & CLONE_NEWNET)
136 return net_ns; 145 return ERR_PTR(-EINVAL);
146 return old_net;
137} 147}
138#endif /* CONFIG_NET */ 148#endif /* CONFIG_NET_NS */
139 149
140 150
141extern struct list_head net_namespace_list; 151extern struct list_head net_namespace_list;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index f1494feba79f..caca0c4d6b4b 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -182,7 +182,7 @@ __nf_conntrack_find(struct net *net, u16 zone,
182 182
183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct); 183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184extern void nf_ct_delete_from_lists(struct nf_conn *ct); 184extern void nf_ct_delete_from_lists(struct nf_conn *ct);
185extern void nf_ct_insert_dying_list(struct nf_conn *ct); 185extern void nf_ct_dying_timeout(struct nf_conn *ct);
186 186
187extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); 187extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report);
188 188
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index d8f5b9f52169..e98aeb3da033 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -31,6 +31,8 @@ extern void nf_conntrack_cleanup(struct net *net);
31extern int nf_conntrack_proto_init(struct net *net); 31extern int nf_conntrack_proto_init(struct net *net);
32extern void nf_conntrack_proto_fini(struct net *net); 32extern void nf_conntrack_proto_fini(struct net *net);
33 33
34extern void nf_conntrack_cleanup_end(void);
35
34extern bool 36extern bool
35nf_ct_get_tuple(const struct sk_buff *skb, 37nf_ct_get_tuple(const struct sk_buff *skb,
36 unsigned int nhoff, 38 unsigned int nhoff,
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index bd8eea720f2e..ad14a799fd2e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -68,4 +68,19 @@ static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
68#endif 68#endif
69} 69}
70 70
71static inline bool nf_nat_oif_changed(unsigned int hooknum,
72 enum ip_conntrack_info ctinfo,
73 struct nf_conn_nat *nat,
74 const struct net_device *out)
75{
76#if IS_ENABLED(CONFIG_IP_NF_TARGET_MASQUERADE) || \
77 IS_ENABLED(CONFIG_IP6_NF_TARGET_MASQUERADE)
78 return nat->masq_index && hooknum == NF_INET_POST_ROUTING &&
79 CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL &&
80 nat->masq_index != out->ifindex;
81#else
82 return false;
83#endif
84}
85
71#endif 86#endif
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index 252fd1010b77..fb1c0be38b6d 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -21,14 +21,10 @@ struct nf_queue_entry {
21struct nf_queue_handler { 21struct nf_queue_handler {
22 int (*outfn)(struct nf_queue_entry *entry, 22 int (*outfn)(struct nf_queue_entry *entry,
23 unsigned int queuenum); 23 unsigned int queuenum);
24 char *name;
25}; 24};
26 25
27extern int nf_register_queue_handler(u_int8_t pf, 26void nf_register_queue_handler(const struct nf_queue_handler *qh);
28 const struct nf_queue_handler *qh); 27void nf_unregister_queue_handler(void);
29extern int nf_unregister_queue_handler(u_int8_t pf,
30 const struct nf_queue_handler *qh);
31extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
32extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 28extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
33 29
34#endif /* _NF_QUEUE_H */ 30#endif /* _NF_QUEUE_H */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index a1d83cc8bf85..923cb20051ed 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -71,6 +71,7 @@ struct netns_ct {
71 struct hlist_head *expect_hash; 71 struct hlist_head *expect_hash;
72 struct hlist_nulls_head unconfirmed; 72 struct hlist_nulls_head unconfirmed;
73 struct hlist_nulls_head dying; 73 struct hlist_nulls_head dying;
74 struct hlist_nulls_head tmpl;
74 struct ip_conntrack_stat __percpu *stat; 75 struct ip_conntrack_stat __percpu *stat;
75 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 76 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
76 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 77 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index 5e5eb1f9f14b..3573a81815ad 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -62,6 +62,9 @@ struct netns_sctp {
62 /* Whether Cookie Preservative is enabled(1) or not(0) */ 62 /* Whether Cookie Preservative is enabled(1) or not(0) */
63 int cookie_preserve_enable; 63 int cookie_preserve_enable;
64 64
65 /* The namespace default hmac alg */
66 char *sctp_hmac_alg;
67
65 /* Valid.Cookie.Life - 60 seconds */ 68 /* Valid.Cookie.Life - 60 seconds */
66 unsigned int valid_cookie_life; 69 unsigned int valid_cookie_life;
67 70
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 591db7d657a3..c24060ee411e 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -8,6 +8,7 @@ struct ebt_table;
8 8
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 bool notrack_deprecated_warning;
11#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ 12#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
12 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) 13 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
13 struct ebt_table *broute_table; 14 struct ebt_table *broute_table;
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 2760f4f4ae9b..1d04b6f0fbd4 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -27,7 +27,6 @@ struct netprio_map {
27 27
28struct cgroup_netprio_state { 28struct cgroup_netprio_state {
29 struct cgroup_subsys_state css; 29 struct cgroup_subsys_state css;
30 u32 prioidx;
31}; 30};
32 31
33extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); 32extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
@@ -36,13 +35,12 @@ extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
36 35
37static inline u32 task_netprioidx(struct task_struct *p) 36static inline u32 task_netprioidx(struct task_struct *p)
38{ 37{
39 struct cgroup_netprio_state *state; 38 struct cgroup_subsys_state *css;
40 u32 idx; 39 u32 idx;
41 40
42 rcu_read_lock(); 41 rcu_read_lock();
43 state = container_of(task_subsys_state(p, net_prio_subsys_id), 42 css = task_subsys_state(p, net_prio_subsys_id);
44 struct cgroup_netprio_state, css); 43 idx = css->cgroup->id;
45 idx = state->prioidx;
46 rcu_read_unlock(); 44 rcu_read_unlock();
47 return idx; 45 return idx;
48} 46}
@@ -57,8 +55,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
57 rcu_read_lock(); 55 rcu_read_lock();
58 css = task_subsys_state(p, net_prio_subsys_id); 56 css = task_subsys_state(p, net_prio_subsys_id);
59 if (css) 57 if (css)
60 idx = container_of(css, 58 idx = css->cgroup->id;
61 struct cgroup_netprio_state, css)->prioidx;
62 rcu_read_unlock(); 59 rcu_read_unlock();
63 return idx; 60 return idx;
64} 61}
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index e900072950cb..671953e11575 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -24,6 +24,12 @@
24 24
25#include <net/nfc/nfc.h> 25#include <net/nfc/nfc.h>
26 26
27struct nfc_phy_ops {
28 int (*write)(void *dev_id, struct sk_buff *skb);
29 int (*enable)(void *dev_id);
30 void (*disable)(void *dev_id);
31};
32
27struct nfc_hci_dev; 33struct nfc_hci_dev;
28 34
29struct nfc_hci_ops { 35struct nfc_hci_ops {
@@ -38,15 +44,21 @@ struct nfc_hci_ops {
38 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); 44 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
39 int (*start_poll) (struct nfc_hci_dev *hdev, 45 int (*start_poll) (struct nfc_hci_dev *hdev,
40 u32 im_protocols, u32 tm_protocols); 46 u32 im_protocols, u32 tm_protocols);
47 int (*dep_link_up)(struct nfc_hci_dev *hdev, struct nfc_target *target,
48 u8 comm_mode, u8 *gb, size_t gb_len);
49 int (*dep_link_down)(struct nfc_hci_dev *hdev);
41 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate, 50 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
42 struct nfc_target *target); 51 struct nfc_target *target);
43 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, 52 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
44 struct nfc_target *target); 53 struct nfc_target *target);
45 int (*data_exchange) (struct nfc_hci_dev *hdev, 54 int (*im_transceive) (struct nfc_hci_dev *hdev,
46 struct nfc_target *target, struct sk_buff *skb, 55 struct nfc_target *target, struct sk_buff *skb,
47 data_exchange_cb_t cb, void *cb_context); 56 data_exchange_cb_t cb, void *cb_context);
57 int (*tm_send)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
48 int (*check_presence)(struct nfc_hci_dev *hdev, 58 int (*check_presence)(struct nfc_hci_dev *hdev,
49 struct nfc_target *target); 59 struct nfc_target *target);
60 void (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
61 struct sk_buff *skb);
50}; 62};
51 63
52/* Pipes */ 64/* Pipes */
@@ -114,6 +126,9 @@ struct nfc_hci_dev {
114 int async_cb_type; 126 int async_cb_type;
115 data_exchange_cb_t async_cb; 127 data_exchange_cb_t async_cb;
116 void *async_cb_context; 128 void *async_cb_context;
129
130 u8 *gb;
131 size_t gb_len;
117}; 132};
118 133
119/* hci device allocation */ 134/* hci device allocation */
@@ -134,6 +149,8 @@ void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
134 149
135void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err); 150void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err);
136 151
152int nfc_hci_result_to_errno(u8 result);
153
137/* Host IDs */ 154/* Host IDs */
138#define NFC_HCI_HOST_CONTROLLER_ID 0x00 155#define NFC_HCI_HOST_CONTROLLER_ID 0x00
139#define NFC_HCI_TERMINAL_HOST_ID 0x01 156#define NFC_HCI_TERMINAL_HOST_ID 0x01
@@ -219,5 +236,7 @@ int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
219 const u8 *param, size_t param_len); 236 const u8 *param, size_t param_len);
220int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, 237int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
221 const u8 *param, size_t param_len); 238 const u8 *param, size_t param_len);
239int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate);
240u32 nfc_hci_sak_to_protocol(u8 sak);
222 241
223#endif /* __NET_HCI_H */ 242#endif /* __NET_HCI_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index f05b10682c9d..fce80b2f9be7 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -95,7 +95,7 @@ struct nfc_genl_data {
95}; 95};
96 96
97struct nfc_dev { 97struct nfc_dev {
98 unsigned int idx; 98 int idx;
99 u32 target_next_idx; 99 u32 target_next_idx;
100 struct nfc_target *targets; 100 struct nfc_target *targets;
101 int n_targets; 101 int n_targets;
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 929528c73fe8..047c0476c0a0 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -25,9 +25,11 @@
25#define _PROTOCOL_H 25#define _PROTOCOL_H
26 26
27#include <linux/in6.h> 27#include <linux/in6.h>
28#include <linux/skbuff.h>
28#if IS_ENABLED(CONFIG_IPV6) 29#if IS_ENABLED(CONFIG_IPV6)
29#include <linux/ipv6.h> 30#include <linux/ipv6.h>
30#endif 31#endif
32#include <linux/netdevice.h>
31 33
32/* This is one larger than the largest protocol value that can be 34/* This is one larger than the largest protocol value that can be
33 * found in an ipv4 or ipv6 header. Since in both cases the protocol 35 * found in an ipv4 or ipv6 header. Since in both cases the protocol
@@ -40,12 +42,6 @@ struct net_protocol {
40 void (*early_demux)(struct sk_buff *skb); 42 void (*early_demux)(struct sk_buff *skb);
41 int (*handler)(struct sk_buff *skb); 43 int (*handler)(struct sk_buff *skb);
42 void (*err_handler)(struct sk_buff *skb, u32 info); 44 void (*err_handler)(struct sk_buff *skb, u32 info);
43 int (*gso_send_check)(struct sk_buff *skb);
44 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
45 netdev_features_t features);
46 struct sk_buff **(*gro_receive)(struct sk_buff **head,
47 struct sk_buff *skb);
48 int (*gro_complete)(struct sk_buff *skb);
49 unsigned int no_policy:1, 45 unsigned int no_policy:1,
50 netns_ok:1; 46 netns_ok:1;
51}; 47};
@@ -60,23 +56,20 @@ struct inet6_protocol {
60 struct inet6_skb_parm *opt, 56 struct inet6_skb_parm *opt,
61 u8 type, u8 code, int offset, 57 u8 type, u8 code, int offset,
62 __be32 info); 58 __be32 info);
63
64 int (*gso_send_check)(struct sk_buff *skb);
65 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
66 netdev_features_t features);
67 struct sk_buff **(*gro_receive)(struct sk_buff **head,
68 struct sk_buff *skb);
69 int (*gro_complete)(struct sk_buff *skb);
70
71 unsigned int flags; /* INET6_PROTO_xxx */ 59 unsigned int flags; /* INET6_PROTO_xxx */
72}; 60};
73 61
74#define INET6_PROTO_NOPOLICY 0x1 62#define INET6_PROTO_NOPOLICY 0x1
75#define INET6_PROTO_FINAL 0x2 63#define INET6_PROTO_FINAL 0x2
76/* This should be set for any extension header which is compatible with GSO. */
77#define INET6_PROTO_GSO_EXTHDR 0x4
78#endif 64#endif
79 65
66struct net_offload {
67 struct offload_callbacks callbacks;
68 unsigned int flags; /* Flags used by IPv6 for now */
69};
70/* This should be set for any extension header which is compatible with GSO. */
71#define INET6_PROTO_GSO_EXTHDR 0x1
72
80/* This is used to register socket interfaces for IP protocols. */ 73/* This is used to register socket interfaces for IP protocols. */
81struct inet_protosw { 74struct inet_protosw {
82 struct list_head list; 75 struct list_head list;
@@ -96,6 +89,8 @@ struct inet_protosw {
96#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ 89#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
97 90
98extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS]; 91extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS];
92extern const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS];
93extern const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS];
99 94
100#if IS_ENABLED(CONFIG_IPV6) 95#if IS_ENABLED(CONFIG_IPV6)
101extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS]; 96extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
@@ -103,6 +98,8 @@ extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
103 98
104extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); 99extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
105extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num); 100extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
101extern int inet_add_offload(const struct net_offload *prot, unsigned char num);
102extern int inet_del_offload(const struct net_offload *prot, unsigned char num);
106extern void inet_register_protosw(struct inet_protosw *p); 103extern void inet_register_protosw(struct inet_protosw *p);
107extern void inet_unregister_protosw(struct inet_protosw *p); 104extern void inet_unregister_protosw(struct inet_protosw *p);
108 105
@@ -112,5 +109,7 @@ extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char n
112extern int inet6_register_protosw(struct inet_protosw *p); 109extern int inet6_register_protosw(struct inet_protosw *p);
113extern void inet6_unregister_protosw(struct inet_protosw *p); 110extern void inet6_unregister_protosw(struct inet_protosw *p);
114#endif 111#endif
112extern int inet6_add_offload(const struct net_offload *prot, unsigned char num);
113extern int inet6_del_offload(const struct net_offload *prot, unsigned char num);
115 114
116#endif /* _PROTOCOL_H */ 115#endif /* _PROTOCOL_H */
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b01d8dd9ee7c..a51dbd17c2de 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -49,13 +49,16 @@ struct request_sock_ops {
49 struct request_sock *req); 49 struct request_sock *req);
50}; 50};
51 51
52extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
53
52/* struct request_sock - mini sock to represent a connection request 54/* struct request_sock - mini sock to represent a connection request
53 */ 55 */
54struct request_sock { 56struct request_sock {
55 struct request_sock *dl_next; /* Must be first member! */ 57 struct request_sock *dl_next; /* Must be first member! */
56 u16 mss; 58 u16 mss;
57 u8 retrans; 59 u8 num_retrans; /* number of retransmits */
58 u8 cookie_ts; /* syncookie: encode tcpopts in timestamp */ 60 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
61 u8 num_timeout:7; /* number of timeouts */
59 /* The following two fields can be easily recomputed I think -AK */ 62 /* The following two fields can be easily recomputed I think -AK */
60 u32 window_clamp; /* window clamp at creation time */ 63 u32 window_clamp; /* window clamp at creation time */
61 u32 rcv_wnd; /* rcv_wnd offered first time */ 64 u32 rcv_wnd; /* rcv_wnd offered first time */
@@ -231,7 +234,7 @@ static inline int reqsk_queue_removed(struct request_sock_queue *queue,
231{ 234{
232 struct listen_sock *lopt = queue->listen_opt; 235 struct listen_sock *lopt = queue->listen_opt;
233 236
234 if (req->retrans == 0) 237 if (req->num_timeout == 0)
235 --lopt->qlen_young; 238 --lopt->qlen_young;
236 239
237 return --lopt->qlen; 240 return --lopt->qlen;
@@ -269,7 +272,8 @@ static inline void reqsk_queue_hash_req(struct request_sock_queue *queue,
269 struct listen_sock *lopt = queue->listen_opt; 272 struct listen_sock *lopt = queue->listen_opt;
270 273
271 req->expires = jiffies + timeout; 274 req->expires = jiffies + timeout;
272 req->retrans = 0; 275 req->num_retrans = 0;
276 req->num_timeout = 0;
273 req->sk = NULL; 277 req->sk = NULL;
274 req->dl_next = lopt->syn_table[hash]; 278 req->dl_next = lopt->syn_table[hash];
275 279
diff --git a/include/net/route.h b/include/net/route.h
index bc40b633a5c4..2ea40c1b5e00 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -198,10 +198,13 @@ struct in_ifaddr;
198extern void fib_add_ifaddr(struct in_ifaddr *); 198extern void fib_add_ifaddr(struct in_ifaddr *);
199extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); 199extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
200 200
201static inline void ip_rt_put(struct rtable * rt) 201static inline void ip_rt_put(struct rtable *rt)
202{ 202{
203 if (rt) 203 /* dst_release() accepts a NULL parameter.
204 dst_release(&rt->dst); 204 * We rely on dst being first structure in struct rtable
205 */
206 BUILD_BUG_ON(offsetof(struct rtable, dst) != 0);
207 dst_release(&rt->dst);
205} 208}
206 209
207#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) 210#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 6b00c4fc4291..5a15fabd6a75 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -125,7 +125,7 @@ extern void rtnl_af_unregister(struct rtnl_af_ops *ops);
125 125
126 126
127extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 127extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
128extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net, 128extern struct net_device *rtnl_create_link(struct net *net,
129 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]); 129 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
130extern int rtnl_configure_link(struct net_device *dev, 130extern int rtnl_configure_link(struct net_device *dev,
131 const struct ifinfomsg *ifm); 131 const struct ifinfomsg *ifm);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 4616f468d599..1540f9c2fcf4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -50,6 +50,13 @@ struct Qdisc {
50#define TCQ_F_INGRESS 2 50#define TCQ_F_INGRESS 2
51#define TCQ_F_CAN_BYPASS 4 51#define TCQ_F_CAN_BYPASS 4
52#define TCQ_F_MQROOT 8 52#define TCQ_F_MQROOT 8
53#define TCQ_F_ONETXQUEUE 0x10 /* dequeue_skb() can assume all skbs are for
54 * q->dev_queue : It can test
55 * netif_xmit_frozen_or_stopped() before
56 * dequeueing next packet.
57 * Its true for MQ/MQPRIO slaves, or non
58 * multiqueue device.
59 */
53#define TCQ_F_WARN_NONWC (1 << 16) 60#define TCQ_F_WARN_NONWC (1 << 16)
54 int padded; 61 int padded;
55 const struct Qdisc_ops *ops; 62 const struct Qdisc_ops *ops;
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 712b3bebeda7..35247271e557 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -130,8 +130,6 @@ typedef union {
130 __be16 err; 130 __be16 err;
131 sctp_state_t state; 131 sctp_state_t state;
132 sctp_event_timeout_t to; 132 sctp_event_timeout_t to;
133 unsigned long zero;
134 void *ptr;
135 struct sctp_chunk *chunk; 133 struct sctp_chunk *chunk;
136 struct sctp_association *asoc; 134 struct sctp_association *asoc;
137 struct sctp_transport *transport; 135 struct sctp_transport *transport;
@@ -154,23 +152,15 @@ typedef union {
154 * which takes an __s32 and returns a sctp_arg_t containing the 152 * which takes an __s32 and returns a sctp_arg_t containing the
155 * __s32. So, after foo = SCTP_I32(arg), foo.i32 == arg. 153 * __s32. So, after foo = SCTP_I32(arg), foo.i32 == arg.
156 */ 154 */
157static inline sctp_arg_t SCTP_NULL(void)
158{
159 sctp_arg_t retval; retval.ptr = NULL; return retval;
160}
161static inline sctp_arg_t SCTP_NOFORCE(void)
162{
163 sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 0; return retval;
164}
165static inline sctp_arg_t SCTP_FORCE(void)
166{
167 sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 1; return retval;
168}
169 155
170#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \ 156#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \
171static inline sctp_arg_t \ 157static inline sctp_arg_t \
172SCTP_## name (type arg) \ 158SCTP_## name (type arg) \
173{ sctp_arg_t retval = {.zero = 0UL}; retval.elt = arg; return retval; } 159{ sctp_arg_t retval;\
160 memset(&retval, 0, sizeof(sctp_arg_t));\
161 retval.elt = arg;\
162 return retval;\
163}
174 164
175SCTP_ARG_CONSTRUCTOR(I32, __s32, i32) 165SCTP_ARG_CONSTRUCTOR(I32, __s32, i32)
176SCTP_ARG_CONSTRUCTOR(U32, __u32, u32) 166SCTP_ARG_CONSTRUCTOR(U32, __u32, u32)
@@ -181,7 +171,6 @@ SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
181SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */ 171SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */
182SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 172SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
183SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 173SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
184SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
185SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) 174SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
186SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) 175SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc)
187SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport) 176SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport)
@@ -192,6 +181,23 @@ SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet)
192SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) 181SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh)
193SCTP_ARG_CONSTRUCTOR(DATAMSG, struct sctp_datamsg *, msg) 182SCTP_ARG_CONSTRUCTOR(DATAMSG, struct sctp_datamsg *, msg)
194 183
184static inline sctp_arg_t SCTP_FORCE(void)
185{
186 return SCTP_I32(1);
187}
188
189static inline sctp_arg_t SCTP_NOFORCE(void)
190{
191 return SCTP_I32(0);
192}
193
194static inline sctp_arg_t SCTP_NULL(void)
195{
196 sctp_arg_t retval;
197 memset(&retval, 0, sizeof(sctp_arg_t));
198 return retval;
199}
200
195typedef struct { 201typedef struct {
196 sctp_arg_t obj; 202 sctp_arg_t obj;
197 sctp_verb_t verb; 203 sctp_verb_t verb;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index d053d2e99876..c29707d654c0 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -312,14 +312,6 @@ enum { SCTP_MAX_GABS = 16 };
312 * functions simpler to write. 312 * functions simpler to write.
313 */ 313 */
314 314
315#if defined (CONFIG_SCTP_HMAC_MD5)
316#define SCTP_COOKIE_HMAC_ALG "hmac(md5)"
317#elif defined (CONFIG_SCTP_HMAC_SHA1)
318#define SCTP_COOKIE_HMAC_ALG "hmac(sha1)"
319#else
320#define SCTP_COOKIE_HMAC_ALG NULL
321#endif
322
323/* These return values describe the success or failure of a number of 315/* These return values describe the success or failure of a number of
324 * routines which form the lower interface to SCTP_outqueue. 316 * routines which form the lower interface to SCTP_outqueue.
325 */ 317 */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 9c6414f553f9..7fdf298a47ef 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -272,6 +272,18 @@ struct sctp_mib {
272 unsigned long mibs[SCTP_MIB_MAX]; 272 unsigned long mibs[SCTP_MIB_MAX];
273}; 273};
274 274
275/* helper function to track stats about max rto and related transport */
276static inline void sctp_max_rto(struct sctp_association *asoc,
277 struct sctp_transport *trans)
278{
279 if (asoc->stats.max_obs_rto < (__u64)trans->rto) {
280 asoc->stats.max_obs_rto = trans->rto;
281 memset(&asoc->stats.obs_rto_ipaddr, 0,
282 sizeof(struct sockaddr_storage));
283 memcpy(&asoc->stats.obs_rto_ipaddr, &trans->ipaddr,
284 trans->af_specific->sockaddr_len);
285 }
286}
275 287
276/* Print debugging messages. */ 288/* Print debugging messages. */
277#if SCTP_DEBUG 289#if SCTP_DEBUG
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index b5887e1677e4..2a82d1384706 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -234,6 +234,8 @@ struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
234struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *, 234struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *,
235 const struct sctp_chunk *, 235 const struct sctp_chunk *,
236 struct sctp_paramhdr *); 236 struct sctp_paramhdr *);
237struct sctp_chunk *sctp_make_violation_max_retrans(const struct sctp_association *,
238 const struct sctp_chunk *);
237struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, 239struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *,
238 const struct sctp_transport *); 240 const struct sctp_transport *);
239struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *, 241struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 64158aa1bb5f..fdeb85a970fc 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -177,6 +177,7 @@ struct sctp_sock {
177 177
178 /* Access to HMAC transform. */ 178 /* Access to HMAC transform. */
179 struct crypto_hash *hmac; 179 struct crypto_hash *hmac;
180 char *sctp_hmac_alg;
180 181
181 /* What is our base endpointer? */ 182 /* What is our base endpointer? */
182 struct sctp_endpoint *ep; 183 struct sctp_endpoint *ep;
@@ -948,6 +949,8 @@ struct sctp_transport {
948 949
949 /* 64-bit random number sent with heartbeat. */ 950 /* 64-bit random number sent with heartbeat. */
950 __u64 hb_nonce; 951 __u64 hb_nonce;
952
953 struct rcu_head rcu;
951}; 954};
952 955
953struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *, 956struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
@@ -1311,6 +1314,40 @@ struct sctp_inithdr_host {
1311 __u32 initial_tsn; 1314 __u32 initial_tsn;
1312}; 1315};
1313 1316
1317/* SCTP_GET_ASSOC_STATS counters */
1318struct sctp_priv_assoc_stats {
1319 /* Maximum observed rto in the association during subsequent
1320 * observations. Value is set to 0 if no RTO measurement took place
1321 * The transport where the max_rto was observed is returned in
1322 * obs_rto_ipaddr
1323 */
1324 struct sockaddr_storage obs_rto_ipaddr;
1325 __u64 max_obs_rto;
1326 /* Total In and Out SACKs received and sent */
1327 __u64 isacks;
1328 __u64 osacks;
1329 /* Total In and Out packets received and sent */
1330 __u64 opackets;
1331 __u64 ipackets;
1332 /* Total retransmitted chunks */
1333 __u64 rtxchunks;
1334 /* TSN received > next expected */
1335 __u64 outofseqtsns;
1336 /* Duplicate Chunks received */
1337 __u64 idupchunks;
1338 /* Gap Ack Blocks received */
1339 __u64 gapcnt;
1340 /* Unordered data chunks sent and received */
1341 __u64 ouodchunks;
1342 __u64 iuodchunks;
1343 /* Ordered data chunks sent and received */
1344 __u64 oodchunks;
1345 __u64 iodchunks;
1346 /* Control chunks sent and received */
1347 __u64 octrlchunks;
1348 __u64 ictrlchunks;
1349};
1350
1314/* RFC2960 1351/* RFC2960
1315 * 1352 *
1316 * 12. Recommended Transmission Control Block (TCB) Parameters 1353 * 12. Recommended Transmission Control Block (TCB) Parameters
@@ -1829,6 +1866,8 @@ struct sctp_association {
1829 1866
1830 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */ 1867 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
1831 temp:1; /* Is it a temporary association? */ 1868 temp:1; /* Is it a temporary association? */
1869
1870 struct sctp_priv_assoc_stats stats;
1832}; 1871};
1833 1872
1834 1873
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index 2e5ee0d8458d..ff1b8ba73ab1 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -72,7 +72,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
72void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); 72void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
73 73
74/* Perform partial delivery. */ 74/* Perform partial delivery. */
75void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); 75void sctp_ulpq_partial_delivery(struct sctp_ulpq *, gfp_t);
76 76
77/* Abort the partial delivery. */ 77/* Abort the partial delivery. */
78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); 78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 1b02d7ad453b..9a0ae091366d 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -107,6 +107,7 @@ typedef __s32 sctp_assoc_t;
107#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ 107#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */
108#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ 108#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
109#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ 109#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
110#define SCTP_GET_ASSOC_STATS 112 /* Read only */
110 111
111/* 112/*
112 * 5.2.1 SCTP Initiation Structure (SCTP_INIT) 113 * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
@@ -719,6 +720,32 @@ struct sctp_getaddrs {
719 __u8 addrs[0]; /*output, variable size*/ 720 __u8 addrs[0]; /*output, variable size*/
720}; 721};
721 722
723/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
724 * association stats. All stats are counts except sas_maxrto and
725 * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
726 * the last call. Will return 0 when RTO was not update since last call
727 */
728struct sctp_assoc_stats {
729 sctp_assoc_t sas_assoc_id; /* Input */
730 /* Transport of observed max RTO */
731 struct sockaddr_storage sas_obs_rto_ipaddr;
732 __u64 sas_maxrto; /* Maximum Observed RTO for period */
733 __u64 sas_isacks; /* SACKs received */
734 __u64 sas_osacks; /* SACKs sent */
735 __u64 sas_opackets; /* Packets sent */
736 __u64 sas_ipackets; /* Packets received */
737 __u64 sas_rtxchunks; /* Retransmitted Chunks */
738 __u64 sas_outofseqtsns;/* TSN received > next expected */
739 __u64 sas_idupchunks; /* Dups received (ordered+unordered) */
740 __u64 sas_gapcnt; /* Gap Acknowledgements Received */
741 __u64 sas_ouodchunks; /* Unordered data chunks sent */
742 __u64 sas_iuodchunks; /* Unordered data chunks received */
743 __u64 sas_oodchunks; /* Ordered data chunks sent */
744 __u64 sas_iodchunks; /* Ordered data chunks received */
745 __u64 sas_octrlchunks; /* Control chunks sent */
746 __u64 sas_ictrlchunks; /* Control chunks received */
747};
748
722/* These are bit fields for msghdr->msg_flags. See section 5.1. */ 749/* These are bit fields for msghdr->msg_flags. See section 5.1. */
723/* On user space Linux, these live in <bits/socket.h> as an enum. */ 750/* On user space Linux, these live in <bits/socket.h> as an enum. */
724enum sctp_msg_flags { 751enum sctp_msg_flags {
diff --git a/include/net/sock.h b/include/net/sock.h
index a95e0756e56e..182ca99405ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -126,12 +126,17 @@ struct sock;
126struct proto; 126struct proto;
127struct net; 127struct net;
128 128
129typedef __u32 __bitwise __portpair;
130typedef __u64 __bitwise __addrpair;
131
129/** 132/**
130 * struct sock_common - minimal network layer representation of sockets 133 * struct sock_common - minimal network layer representation of sockets
131 * @skc_daddr: Foreign IPv4 addr 134 * @skc_daddr: Foreign IPv4 addr
132 * @skc_rcv_saddr: Bound local IPv4 addr 135 * @skc_rcv_saddr: Bound local IPv4 addr
133 * @skc_hash: hash value used with various protocol lookup tables 136 * @skc_hash: hash value used with various protocol lookup tables
134 * @skc_u16hashes: two u16 hash values used by UDP lookup tables 137 * @skc_u16hashes: two u16 hash values used by UDP lookup tables
138 * @skc_dport: placeholder for inet_dport/tw_dport
139 * @skc_num: placeholder for inet_num/tw_num
135 * @skc_family: network address family 140 * @skc_family: network address family
136 * @skc_state: Connection state 141 * @skc_state: Connection state
137 * @skc_reuse: %SO_REUSEADDR setting 142 * @skc_reuse: %SO_REUSEADDR setting
@@ -149,16 +154,29 @@ struct net;
149 * for struct sock and struct inet_timewait_sock. 154 * for struct sock and struct inet_timewait_sock.
150 */ 155 */
151struct sock_common { 156struct sock_common {
152 /* skc_daddr and skc_rcv_saddr must be grouped : 157 /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned
153 * cf INET_MATCH() and INET_TW_MATCH() 158 * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH()
154 */ 159 */
155 __be32 skc_daddr; 160 union {
156 __be32 skc_rcv_saddr; 161 __addrpair skc_addrpair;
157 162 struct {
163 __be32 skc_daddr;
164 __be32 skc_rcv_saddr;
165 };
166 };
158 union { 167 union {
159 unsigned int skc_hash; 168 unsigned int skc_hash;
160 __u16 skc_u16hashes[2]; 169 __u16 skc_u16hashes[2];
161 }; 170 };
171 /* skc_dport && skc_num must be grouped as well */
172 union {
173 __portpair skc_portpair;
174 struct {
175 __be16 skc_dport;
176 __u16 skc_num;
177 };
178 };
179
162 unsigned short skc_family; 180 unsigned short skc_family;
163 volatile unsigned char skc_state; 181 volatile unsigned char skc_state;
164 unsigned char skc_reuse; 182 unsigned char skc_reuse;
@@ -349,7 +367,7 @@ struct sock {
349 unsigned short sk_ack_backlog; 367 unsigned short sk_ack_backlog;
350 unsigned short sk_max_ack_backlog; 368 unsigned short sk_max_ack_backlog;
351 __u32 sk_priority; 369 __u32 sk_priority;
352#ifdef CONFIG_CGROUPS 370#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
353 __u32 sk_cgrp_prioidx; 371 __u32 sk_cgrp_prioidx;
354#endif 372#endif
355 struct pid *sk_peer_pid; 373 struct pid *sk_peer_pid;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6feeccd83dd7..aed42c785153 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -369,7 +369,6 @@ extern void tcp_shutdown (struct sock *sk, int how);
369extern void tcp_v4_early_demux(struct sk_buff *skb); 369extern void tcp_v4_early_demux(struct sk_buff *skb);
370extern int tcp_v4_rcv(struct sk_buff *skb); 370extern int tcp_v4_rcv(struct sk_buff *skb);
371 371
372extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
373extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 372extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
374extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 373extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
375 size_t size); 374 size_t size);
@@ -525,6 +524,7 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
525extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 524extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
526 int nonagle); 525 int nonagle);
527extern bool tcp_may_send_now(struct sock *sk); 526extern bool tcp_may_send_now(struct sock *sk);
527extern int __tcp_retransmit_skb(struct sock *, struct sk_buff *);
528extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 528extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
529extern void tcp_retransmit_timer(struct sock *sk); 529extern void tcp_retransmit_timer(struct sock *sk);
530extern void tcp_xmit_retransmit_queue(struct sock *); 530extern void tcp_xmit_retransmit_queue(struct sock *);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 6f0ba01afe73..63445ede48bb 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1351,7 +1351,7 @@ struct xfrm6_tunnel {
1351}; 1351};
1352 1352
1353extern void xfrm_init(void); 1353extern void xfrm_init(void);
1354extern void xfrm4_init(int rt_hash_size); 1354extern void xfrm4_init(void);
1355extern int xfrm_state_init(struct net *net); 1355extern int xfrm_state_init(struct net *net);
1356extern void xfrm_state_fini(struct net *net); 1356extern void xfrm_state_fini(struct net *net);
1357extern void xfrm4_state_init(void); 1357extern void xfrm4_state_init(void);