aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-05 15:31:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-05 15:31:59 -0400
commit5518b69b76680a4f2df96b1deca260059db0c2de (patch)
treef33cd1519c8efb4590500f2f9617400be233238c /include/linux
parent8ad06e56dcbc1984ef0ff8f6e3c19982c5809f73 (diff)
parent0e72582270c07850b92cac351c8b97d4f9c123b9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Reasonably busy this cycle, but perhaps not as busy as in the 4.12 merge window: 1) Several optimizations for UDP processing under high load from Paolo Abeni. 2) Support pacing internally in TCP when using the sch_fq packet scheduler for this is not practical. From Eric Dumazet. 3) Support mutliple filter chains per qdisc, from Jiri Pirko. 4) Move to 1ms TCP timestamp clock, from Eric Dumazet. 5) Add batch dequeueing to vhost_net, from Jason Wang. 6) Flesh out more completely SCTP checksum offload support, from Davide Caratti. 7) More plumbing of extended netlink ACKs, from David Ahern, Pablo Neira Ayuso, and Matthias Schiffer. 8) Add devlink support to nfp driver, from Simon Horman. 9) Add RTM_F_FIB_MATCH flag to RTM_GETROUTE queries, from Roopa Prabhu. 10) Add stack depth tracking to BPF verifier and use this information in the various eBPF JITs. From Alexei Starovoitov. 11) Support XDP on qed device VFs, from Yuval Mintz. 12) Introduce BPF PROG ID for better introspection of installed BPF programs. From Martin KaFai Lau. 13) Add bpf_set_hash helper for TC bpf programs, from Daniel Borkmann. 14) For loads, allow narrower accesses in bpf verifier checking, from Yonghong Song. 15) Support MIPS in the BPF selftests and samples infrastructure, the MIPS eBPF JIT will be merged in via the MIPS GIT tree. From David Daney. 16) Support kernel based TLS, from Dave Watson and others. 17) Remove completely DST garbage collection, from Wei Wang. 18) Allow installing TCP MD5 rules using prefixes, from Ivan Delalande. 19) Add XDP support to Intel i40e driver, from Björn Töpel 20) Add support for TC flower offload in nfp driver, from Simon Horman, Pieter Jansen van Vuuren, Benjamin LaHaise, Jakub Kicinski, and Bert van Leeuwen. 21) IPSEC offloading support in mlx5, from Ilan Tayari. 22) Add HW PTP support to macb driver, from Rafal Ozieblo. 23) Networking refcount_t conversions, From Elena Reshetova. 24) Add sock_ops support to BPF, from Lawrence Brako. This is useful for tuning the TCP sockopt settings of a group of applications, currently via CGROUPs" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1899 commits) net: phy: dp83867: add workaround for incorrect RX_CTRL pin strap dt-bindings: phy: dp83867: provide a workaround for incorrect RX_CTRL pin strap cxgb4: Support for get_ts_info ethtool method cxgb4: Add PTP Hardware Clock (PHC) support cxgb4: time stamping interface for PTP nfp: default to chained metadata prepend format nfp: remove legacy MAC address lookup nfp: improve order of interfaces in breakout mode net: macb: remove extraneous return when MACB_EXT_DESC is defined bpf: add missing break in for the TCP_BPF_SNDCWND_CLAMP case bpf: fix return in load_bpf_file mpls: fix rtm policy in mpls_getroute net, ax25: convert ax25_cb.refcount from atomic_t to refcount_t net, ax25: convert ax25_route.refcount from atomic_t to refcount_t net, ax25: convert ax25_uid_assoc.refcount from atomic_t to refcount_t net, sctp: convert sctp_ep_common.refcnt from atomic_t to refcount_t net, sctp: convert sctp_transport.refcnt from atomic_t to refcount_t net, sctp: convert sctp_chunk.refcnt from atomic_t to refcount_t net, sctp: convert sctp_datamsg.refcnt from atomic_t to refcount_t net, sctp: convert sctp_auth_bytes.refcnt from atomic_t to refcount_t ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/atmdev.h9
-rw-r--r--include/linux/avf/virtchnl.h701
-rw-r--r--include/linux/bpf-cgroup.h18
-rw-r--r--include/linux/bpf.h24
-rw-r--r--include/linux/bpf_types.h1
-rw-r--r--include/linux/bpf_verifier.h2
-rw-r--r--include/linux/filter.h62
-rw-r--r--include/linux/ieee80211.h39
-rw-r--r--include/linux/if_bridge.h14
-rw-r--r--include/linux/if_tap.h5
-rw-r--r--include/linux/if_team.h2
-rw-r--r--include/linux/if_tun.h5
-rw-r--r--include/linux/if_vlan.h2
-rw-r--r--include/linux/igmp.h3
-rw-r--r--include/linux/inetdevice.h18
-rw-r--r--include/linux/mISDNif.h2
-rw-r--r--include/linux/micrel_phy.h2
-rw-r--r--include/linux/mii.h2
-rw-r--r--include/linux/mlx5/device.h12
-rw-r--r--include/linux/mlx5/driver.h37
-rw-r--r--include/linux/mlx5/mlx5_ifc.h199
-rw-r--r--include/linux/mlx5/mlx5_ifc_fpga.h432
-rw-r--r--include/linux/mlx5/port.h13
-rw-r--r--include/linux/mlx5/qp.h16
-rw-r--r--include/linux/netdevice.h36
-rw-r--r--include/linux/netfilter/nfnetlink.h10
-rw-r--r--include/linux/netfilter_bridge/ebtables.h2
-rw-r--r--include/linux/netlink.h15
-rw-r--r--include/linux/netpoll.h3
-rw-r--r--include/linux/of_mdio.h24
-rw-r--r--include/linux/perf_event.h7
-rw-r--r--include/linux/phy.h58
-rw-r--r--include/linux/platform_data/microchip-ksz.h29
-rw-r--r--include/linux/platform_data/nfcmrvl.h2
-rw-r--r--include/linux/platform_data/st-nci.h31
-rw-r--r--include/linux/ptr_ring.h120
-rw-r--r--include/linux/qed/common_hsi.h213
-rw-r--r--include/linux/qed/eth_common.h3
-rw-r--r--include/linux/qed/fcoe_common.h1
-rw-r--r--include/linux/qed/iscsi_common.h91
-rw-r--r--include/linux/qed/iwarp_common.h53
-rw-r--r--include/linux/qed/qed_chain.h7
-rw-r--r--include/linux/qed/qed_eth_if.h6
-rw-r--r--include/linux/qed/qed_fcoe_if.h5
-rw-r--r--include/linux/qed/qed_if.h72
-rw-r--r--include/linux/qed/qed_iscsi_if.h7
-rw-r--r--include/linux/qed/qed_ll2_if.h129
-rw-r--r--include/linux/qed/qed_rdma_if.h (renamed from include/linux/qed/qed_roce_if.h)198
-rw-r--r--include/linux/qed/qede_rdma.h (renamed from include/linux/qed/qede_roce.h)42
-rw-r--r--include/linux/qed/rdma_common.h2
-rw-r--r--include/linux/qed/roce_common.h2
-rw-r--r--include/linux/qed/tcp_common.h5
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/rxrpc.h25
-rw-r--r--include/linux/sctp.h118
-rw-r--r--include/linux/skb_array.h31
-rw-r--r--include/linux/skbuff.h265
-rw-r--r--include/linux/socket.h1
-rw-r--r--include/linux/stmmac.h2
-rw-r--r--include/linux/sunrpc/auth_gss.h3
-rw-r--r--include/linux/tcp.h24
-rw-r--r--include/linux/udp.h3
-rw-r--r--include/linux/usb/cdc_ncm.h3
63 files changed, 2708 insertions, 563 deletions
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index c1da539f5e28..0ec9bdb1cc9f 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -11,6 +11,7 @@
11#include <linux/uio.h> 11#include <linux/uio.h>
12#include <net/sock.h> 12#include <net/sock.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <linux/refcount.h>
14#include <uapi/linux/atmdev.h> 15#include <uapi/linux/atmdev.h>
15 16
16#ifdef CONFIG_PROC_FS 17#ifdef CONFIG_PROC_FS
@@ -158,7 +159,7 @@ struct atm_dev {
158 struct k_atm_dev_stats stats; /* statistics */ 159 struct k_atm_dev_stats stats; /* statistics */
159 char signal; /* signal status (ATM_PHY_SIG_*) */ 160 char signal; /* signal status (ATM_PHY_SIG_*) */
160 int link_rate; /* link rate (default: OC3) */ 161 int link_rate; /* link rate (default: OC3) */
161 atomic_t refcnt; /* reference count */ 162 refcount_t refcnt; /* reference count */
162 spinlock_t lock; /* protect internal members */ 163 spinlock_t lock; /* protect internal members */
163#ifdef CONFIG_PROC_FS 164#ifdef CONFIG_PROC_FS
164 struct proc_dir_entry *proc_entry; /* proc entry */ 165 struct proc_dir_entry *proc_entry; /* proc entry */
@@ -254,20 +255,20 @@ static inline void atm_return(struct atm_vcc *vcc,int truesize)
254 255
255static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size) 256static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
256{ 257{
257 return (size + atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) < 258 return (size + refcount_read(&sk_atm(vcc)->sk_wmem_alloc)) <
258 sk_atm(vcc)->sk_sndbuf; 259 sk_atm(vcc)->sk_sndbuf;
259} 260}
260 261
261 262
262static inline void atm_dev_hold(struct atm_dev *dev) 263static inline void atm_dev_hold(struct atm_dev *dev)
263{ 264{
264 atomic_inc(&dev->refcnt); 265 refcount_inc(&dev->refcnt);
265} 266}
266 267
267 268
268static inline void atm_dev_put(struct atm_dev *dev) 269static inline void atm_dev_put(struct atm_dev *dev)
269{ 270{
270 if (atomic_dec_and_test(&dev->refcnt)) { 271 if (refcount_dec_and_test(&dev->refcnt)) {
271 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); 272 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
272 if (dev->ops->dev_close) 273 if (dev->ops->dev_close)
273 dev->ops->dev_close(dev); 274 dev->ops->dev_close(dev);
diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h
new file mode 100644
index 000000000000..c893b9520a67
--- /dev/null
+++ b/include/linux/avf/virtchnl.h
@@ -0,0 +1,701 @@
1/*******************************************************************************
2 *
3 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4 * Copyright(c) 2013 - 2014 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
21 * Contact Information:
22 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24 *
25 ******************************************************************************/
26
27#ifndef _VIRTCHNL_H_
28#define _VIRTCHNL_H_
29
30/* Description:
31 * This header file describes the VF-PF communication protocol used
32 * by the drivers for all devices starting from our 40G product line
33 *
34 * Admin queue buffer usage:
35 * desc->opcode is always aqc_opc_send_msg_to_pf
36 * flags, retval, datalen, and data addr are all used normally.
37 * The Firmware copies the cookie fields when sending messages between the
38 * PF and VF, but uses all other fields internally. Due to this limitation,
39 * we must send all messages as "indirect", i.e. using an external buffer.
40 *
41 * All the VSI indexes are relative to the VF. Each VF can have maximum of
42 * three VSIs. All the queue indexes are relative to the VSI. Each VF can
43 * have a maximum of sixteen queues for all of its VSIs.
44 *
45 * The PF is required to return a status code in v_retval for all messages
46 * except RESET_VF, which does not require any response. The return value
47 * is of status_code type, defined in the shared type.h.
48 *
49 * In general, VF driver initialization should roughly follow the order of
50 * these opcodes. The VF driver must first validate the API version of the
51 * PF driver, then request a reset, then get resources, then configure
52 * queues and interrupts. After these operations are complete, the VF
53 * driver may start its queues, optionally add MAC and VLAN filters, and
54 * process traffic.
55 */
56
57/* START GENERIC DEFINES
58 * Need to ensure the following enums and defines hold the same meaning and
59 * value in current and future projects
60 */
61
62/* Error Codes */
63enum virtchnl_status_code {
64 VIRTCHNL_STATUS_SUCCESS = 0,
65 VIRTCHNL_ERR_PARAM = -5,
66 VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
67 VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
68 VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
69 VIRTCHNL_STATUS_NOT_SUPPORTED = -64,
70};
71
72#define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1
73#define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2
74#define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3
75#define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4
76#define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5
77#define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6
78
79enum virtchnl_link_speed {
80 VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
81 VIRTCHNL_LINK_SPEED_100MB = BIT(VIRTCHNL_LINK_SPEED_100MB_SHIFT),
82 VIRTCHNL_LINK_SPEED_1GB = BIT(VIRTCHNL_LINK_SPEED_1000MB_SHIFT),
83 VIRTCHNL_LINK_SPEED_10GB = BIT(VIRTCHNL_LINK_SPEED_10GB_SHIFT),
84 VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
85 VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
86 VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
87};
88
89/* for hsplit_0 field of Rx HMC context */
90/* deprecated with AVF 1.0 */
91enum virtchnl_rx_hsplit {
92 VIRTCHNL_RX_HSPLIT_NO_SPLIT = 0,
93 VIRTCHNL_RX_HSPLIT_SPLIT_L2 = 1,
94 VIRTCHNL_RX_HSPLIT_SPLIT_IP = 2,
95 VIRTCHNL_RX_HSPLIT_SPLIT_TCP_UDP = 4,
96 VIRTCHNL_RX_HSPLIT_SPLIT_SCTP = 8,
97};
98
99/* END GENERIC DEFINES */
100
101/* Opcodes for VF-PF communication. These are placed in the v_opcode field
102 * of the virtchnl_msg structure.
103 */
104enum virtchnl_ops {
105/* The PF sends status change events to VFs using
106 * the VIRTCHNL_OP_EVENT opcode.
107 * VFs send requests to the PF using the other ops.
108 * Use of "advanced opcode" features must be negotiated as part of capabilities
109 * exchange and are not considered part of base mode feature set.
110 */
111 VIRTCHNL_OP_UNKNOWN = 0,
112 VIRTCHNL_OP_VERSION = 1, /* must ALWAYS be 1 */
113 VIRTCHNL_OP_RESET_VF = 2,
114 VIRTCHNL_OP_GET_VF_RESOURCES = 3,
115 VIRTCHNL_OP_CONFIG_TX_QUEUE = 4,
116 VIRTCHNL_OP_CONFIG_RX_QUEUE = 5,
117 VIRTCHNL_OP_CONFIG_VSI_QUEUES = 6,
118 VIRTCHNL_OP_CONFIG_IRQ_MAP = 7,
119 VIRTCHNL_OP_ENABLE_QUEUES = 8,
120 VIRTCHNL_OP_DISABLE_QUEUES = 9,
121 VIRTCHNL_OP_ADD_ETH_ADDR = 10,
122 VIRTCHNL_OP_DEL_ETH_ADDR = 11,
123 VIRTCHNL_OP_ADD_VLAN = 12,
124 VIRTCHNL_OP_DEL_VLAN = 13,
125 VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
126 VIRTCHNL_OP_GET_STATS = 15,
127 VIRTCHNL_OP_RSVD = 16,
128 VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
129 VIRTCHNL_OP_IWARP = 20, /* advanced opcode */
130 VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21, /* advanced opcode */
131 VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22, /* advanced opcode */
132 VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
133 VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
134 VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
135 VIRTCHNL_OP_SET_RSS_HENA = 26,
136};
137
138/* This macro is used to generate a compilation error if a structure
139 * is not exactly the correct length. It gives a divide by zero error if the
140 * structure is not of the correct size, otherwise it creates an enum that is
141 * never used.
142 */
143#define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
144 { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
145
146/* Virtual channel message descriptor. This overlays the admin queue
147 * descriptor. All other data is passed in external buffers.
148 */
149
150struct virtchnl_msg {
151 u8 pad[8]; /* AQ flags/opcode/len/retval fields */
152 enum virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
153 enum virtchnl_status_code v_retval; /* ditto for desc->retval */
154 u32 vfid; /* used by PF when sending to VF */
155};
156
157VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);
158
159/* Message descriptions and data structures.*/
160
161/* VIRTCHNL_OP_VERSION
162 * VF posts its version number to the PF. PF responds with its version number
163 * in the same format, along with a return code.
164 * Reply from PF has its major/minor versions also in param0 and param1.
165 * If there is a major version mismatch, then the VF cannot operate.
166 * If there is a minor version mismatch, then the VF can operate but should
167 * add a warning to the system log.
168 *
169 * This enum element MUST always be specified as == 1, regardless of other
170 * changes in the API. The PF must always respond to this message without
171 * error regardless of version mismatch.
172 */
173#define VIRTCHNL_VERSION_MAJOR 1
174#define VIRTCHNL_VERSION_MINOR 1
175#define VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0
176
177struct virtchnl_version_info {
178 u32 major;
179 u32 minor;
180};
181
182VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_version_info);
183
184#define VF_IS_V10(_v) (((_v)->major == 1) && ((_v)->minor == 0))
185#define VF_IS_V11(_ver) (((_ver)->major == 1) && ((_ver)->minor == 1))
186
187/* VIRTCHNL_OP_RESET_VF
188 * VF sends this request to PF with no parameters
189 * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
190 * until reset completion is indicated. The admin queue must be reinitialized
191 * after this operation.
192 *
193 * When reset is complete, PF must ensure that all queues in all VSIs associated
194 * with the VF are stopped, all queue configurations in the HMC are set to 0,
195 * and all MAC and VLAN filters (except the default MAC address) on all VSIs
196 * are cleared.
197 */
198
199/* VSI types that use VIRTCHNL interface for VF-PF communication. VSI_SRIOV
200 * vsi_type should always be 6 for backward compatibility. Add other fields
201 * as needed.
202 */
203enum virtchnl_vsi_type {
204 VIRTCHNL_VSI_TYPE_INVALID = 0,
205 VIRTCHNL_VSI_SRIOV = 6,
206};
207
208/* VIRTCHNL_OP_GET_VF_RESOURCES
209 * Version 1.0 VF sends this request to PF with no parameters
210 * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities
211 * PF responds with an indirect message containing
212 * virtchnl_vf_resource and one or more
213 * virtchnl_vsi_resource structures.
214 */
215
216struct virtchnl_vsi_resource {
217 u16 vsi_id;
218 u16 num_queue_pairs;
219 enum virtchnl_vsi_type vsi_type;
220 u16 qset_handle;
221 u8 default_mac_addr[ETH_ALEN];
222};
223
224VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
225
226/* VF offload flags
227 * VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including
228 * TX/RX Checksum offloading and TSO for non-tunnelled packets.
229 */
230#define VIRTCHNL_VF_OFFLOAD_L2 0x00000001
231#define VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
232#define VIRTCHNL_VF_OFFLOAD_RSVD 0x00000004
233#define VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
234#define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
235#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
236#define VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
237#define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
238#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
239#define VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
240#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
241#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
242#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
243
244#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
245 VIRTCHNL_VF_OFFLOAD_VLAN | \
246 VIRTCHNL_VF_OFFLOAD_RSS_PF)
247
248struct virtchnl_vf_resource {
249 u16 num_vsis;
250 u16 num_queue_pairs;
251 u16 max_vectors;
252 u16 max_mtu;
253
254 u32 vf_offload_flags;
255 u32 rss_key_size;
256 u32 rss_lut_size;
257
258 struct virtchnl_vsi_resource vsi_res[1];
259};
260
261VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_vf_resource);
262
263/* VIRTCHNL_OP_CONFIG_TX_QUEUE
264 * VF sends this message to set up parameters for one TX queue.
265 * External data buffer contains one instance of virtchnl_txq_info.
266 * PF configures requested queue and returns a status code.
267 */
268
269/* Tx queue config info */
270struct virtchnl_txq_info {
271 u16 vsi_id;
272 u16 queue_id;
273 u16 ring_len; /* number of descriptors, multiple of 8 */
274 u16 headwb_enabled; /* deprecated with AVF 1.0 */
275 u64 dma_ring_addr;
276 u64 dma_headwb_addr; /* deprecated with AVF 1.0 */
277};
278
279VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
280
281/* VIRTCHNL_OP_CONFIG_RX_QUEUE
282 * VF sends this message to set up parameters for one RX queue.
283 * External data buffer contains one instance of virtchnl_rxq_info.
284 * PF configures requested queue and returns a status code.
285 */
286
287/* Rx queue config info */
288struct virtchnl_rxq_info {
289 u16 vsi_id;
290 u16 queue_id;
291 u32 ring_len; /* number of descriptors, multiple of 32 */
292 u16 hdr_size;
293 u16 splithdr_enabled; /* deprecated with AVF 1.0 */
294 u32 databuffer_size;
295 u32 max_pkt_size;
296 u32 pad1;
297 u64 dma_ring_addr;
298 enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
299 u32 pad2;
300};
301
302VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);
303
304/* VIRTCHNL_OP_CONFIG_VSI_QUEUES
305 * VF sends this message to set parameters for all active TX and RX queues
306 * associated with the specified VSI.
307 * PF configures queues and returns status.
308 * If the number of queues specified is greater than the number of queues
309 * associated with the VSI, an error is returned and no queues are configured.
310 */
311struct virtchnl_queue_pair_info {
312 /* NOTE: vsi_id and queue_id should be identical for both queues. */
313 struct virtchnl_txq_info txq;
314 struct virtchnl_rxq_info rxq;
315};
316
317VIRTCHNL_CHECK_STRUCT_LEN(64, virtchnl_queue_pair_info);
318
319struct virtchnl_vsi_queue_config_info {
320 u16 vsi_id;
321 u16 num_queue_pairs;
322 u32 pad;
323 struct virtchnl_queue_pair_info qpair[1];
324};
325
326VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);
327
328/* VIRTCHNL_OP_CONFIG_IRQ_MAP
329 * VF uses this message to map vectors to queues.
330 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
331 * are to be associated with the specified vector.
332 * The "other" causes are always mapped to vector 0.
333 * PF configures interrupt mapping and returns status.
334 */
335struct virtchnl_vector_map {
336 u16 vsi_id;
337 u16 vector_id;
338 u16 rxq_map;
339 u16 txq_map;
340 u16 rxitr_idx;
341 u16 txitr_idx;
342};
343
344VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_vector_map);
345
346struct virtchnl_irq_map_info {
347 u16 num_vectors;
348 struct virtchnl_vector_map vecmap[1];
349};
350
351VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);
352
353/* VIRTCHNL_OP_ENABLE_QUEUES
354 * VIRTCHNL_OP_DISABLE_QUEUES
355 * VF sends these message to enable or disable TX/RX queue pairs.
356 * The queues fields are bitmaps indicating which queues to act upon.
357 * (Currently, we only support 16 queues per VF, but we make the field
358 * u32 to allow for expansion.)
359 * PF performs requested action and returns status.
360 */
361struct virtchnl_queue_select {
362 u16 vsi_id;
363 u16 pad;
364 u32 rx_queues;
365 u32 tx_queues;
366};
367
368VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_select);
369
370/* VIRTCHNL_OP_ADD_ETH_ADDR
371 * VF sends this message in order to add one or more unicast or multicast
372 * address filters for the specified VSI.
373 * PF adds the filters and returns status.
374 */
375
376/* VIRTCHNL_OP_DEL_ETH_ADDR
377 * VF sends this message in order to remove one or more unicast or multicast
378 * filters for the specified VSI.
379 * PF removes the filters and returns status.
380 */
381
382struct virtchnl_ether_addr {
383 u8 addr[ETH_ALEN];
384 u8 pad[2];
385};
386
387VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_ether_addr);
388
389struct virtchnl_ether_addr_list {
390 u16 vsi_id;
391 u16 num_elements;
392 struct virtchnl_ether_addr list[1];
393};
394
395VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_ether_addr_list);
396
397/* VIRTCHNL_OP_ADD_VLAN
398 * VF sends this message to add one or more VLAN tag filters for receives.
399 * PF adds the filters and returns status.
400 * If a port VLAN is configured by the PF, this operation will return an
401 * error to the VF.
402 */
403
404/* VIRTCHNL_OP_DEL_VLAN
405 * VF sends this message to remove one or more VLAN tag filters for receives.
406 * PF removes the filters and returns status.
407 * If a port VLAN is configured by the PF, this operation will return an
408 * error to the VF.
409 */
410
411struct virtchnl_vlan_filter_list {
412 u16 vsi_id;
413 u16 num_elements;
414 u16 vlan_id[1];
415};
416
417VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vlan_filter_list);
418
419/* VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
420 * VF sends VSI id and flags.
421 * PF returns status code in retval.
422 * Note: we assume that broadcast accept mode is always enabled.
423 */
424struct virtchnl_promisc_info {
425 u16 vsi_id;
426 u16 flags;
427};
428
429VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_promisc_info);
430
431#define FLAG_VF_UNICAST_PROMISC 0x00000001
432#define FLAG_VF_MULTICAST_PROMISC 0x00000002
433
434/* VIRTCHNL_OP_GET_STATS
435 * VF sends this message to request stats for the selected VSI. VF uses
436 * the virtchnl_queue_select struct to specify the VSI. The queue_id
437 * field is ignored by the PF.
438 *
439 * PF replies with struct eth_stats in an external buffer.
440 */
441
442/* VIRTCHNL_OP_CONFIG_RSS_KEY
443 * VIRTCHNL_OP_CONFIG_RSS_LUT
444 * VF sends these messages to configure RSS. Only supported if both PF
445 * and VF drivers set the VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
446 * configuration negotiation. If this is the case, then the RSS fields in
447 * the VF resource struct are valid.
448 * Both the key and LUT are initialized to 0 by the PF, meaning that
449 * RSS is effectively disabled until set up by the VF.
450 */
451struct virtchnl_rss_key {
452 u16 vsi_id;
453 u16 key_len;
454 u8 key[1]; /* RSS hash key, packed bytes */
455};
456
457VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key);
458
459struct virtchnl_rss_lut {
460 u16 vsi_id;
461 u16 lut_entries;
462 u8 lut[1]; /* RSS lookup table*/
463};
464
465VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut);
466
467/* VIRTCHNL_OP_GET_RSS_HENA_CAPS
468 * VIRTCHNL_OP_SET_RSS_HENA
469 * VF sends these messages to get and set the hash filter enable bits for RSS.
470 * By default, the PF sets these to all possible traffic types that the
471 * hardware supports. The VF can query this value if it wants to change the
472 * traffic types that are hashed by the hardware.
473 */
474struct virtchnl_rss_hena {
475 u64 hena;
476};
477
478VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
479
480/* VIRTCHNL_OP_EVENT
481 * PF sends this message to inform the VF driver of events that may affect it.
482 * No direct response is expected from the VF, though it may generate other
483 * messages in response to this one.
484 */
485enum virtchnl_event_codes {
486 VIRTCHNL_EVENT_UNKNOWN = 0,
487 VIRTCHNL_EVENT_LINK_CHANGE,
488 VIRTCHNL_EVENT_RESET_IMPENDING,
489 VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
490};
491
492#define PF_EVENT_SEVERITY_INFO 0
493#define PF_EVENT_SEVERITY_CERTAIN_DOOM 255
494
495struct virtchnl_pf_event {
496 enum virtchnl_event_codes event;
497 union {
498 struct {
499 enum virtchnl_link_speed link_speed;
500 bool link_status;
501 } link_event;
502 } event_data;
503
504 int severity;
505};
506
507VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
508
509/* VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
510 * VF uses this message to request PF to map IWARP vectors to IWARP queues.
511 * The request for this originates from the VF IWARP driver through
512 * a client interface between VF LAN and VF IWARP driver.
513 * A vector could have an AEQ and CEQ attached to it although
514 * there is a single AEQ per VF IWARP instance in which case
515 * most vectors will have an INVALID_IDX for aeq and valid idx for ceq.
516 * There will never be a case where there will be multiple CEQs attached
517 * to a single vector.
518 * PF configures interrupt mapping and returns status.
519 */
520
521struct virtchnl_iwarp_qv_info {
522 u32 v_idx; /* msix_vector */
523 u16 ceq_idx;
524 u16 aeq_idx;
525 u8 itr_idx;
526};
527
528VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
529
530struct virtchnl_iwarp_qvlist_info {
531 u32 num_vectors;
532 struct virtchnl_iwarp_qv_info qv_info[1];
533};
534
535VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
536
537/* VF reset states - these are written into the RSTAT register:
538 * VFGEN_RSTAT on the VF
539 * When the PF initiates a reset, it writes 0
540 * When the reset is complete, it writes 1
541 * When the PF detects that the VF has recovered, it writes 2
542 * VF checks this register periodically to determine if a reset has occurred,
543 * then polls it to know when the reset is complete.
544 * If either the PF or VF reads the register while the hardware
545 * is in a reset state, it will return DEADBEEF, which, when masked
546 * will result in 3.
547 */
548enum virtchnl_vfr_states {
549 VIRTCHNL_VFR_INPROGRESS = 0,
550 VIRTCHNL_VFR_COMPLETED,
551 VIRTCHNL_VFR_VFACTIVE,
552};
553
554/**
555 * virtchnl_vc_validate_vf_msg
556 * @ver: Virtchnl version info
557 * @v_opcode: Opcode for the message
558 * @msg: pointer to the msg buffer
559 * @msglen: msg length
560 *
561 * validate msg format against struct for each opcode
562 */
563static inline int
564virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
565 u8 *msg, u16 msglen)
566{
567 bool err_msg_format = false;
568 int valid_len = 0;
569
570 /* Validate message length. */
571 switch (v_opcode) {
572 case VIRTCHNL_OP_VERSION:
573 valid_len = sizeof(struct virtchnl_version_info);
574 break;
575 case VIRTCHNL_OP_RESET_VF:
576 break;
577 case VIRTCHNL_OP_GET_VF_RESOURCES:
578 if (VF_IS_V11(ver))
579 valid_len = sizeof(u32);
580 break;
581 case VIRTCHNL_OP_CONFIG_TX_QUEUE:
582 valid_len = sizeof(struct virtchnl_txq_info);
583 break;
584 case VIRTCHNL_OP_CONFIG_RX_QUEUE:
585 valid_len = sizeof(struct virtchnl_rxq_info);
586 break;
587 case VIRTCHNL_OP_CONFIG_VSI_QUEUES:
588 valid_len = sizeof(struct virtchnl_vsi_queue_config_info);
589 if (msglen >= valid_len) {
590 struct virtchnl_vsi_queue_config_info *vqc =
591 (struct virtchnl_vsi_queue_config_info *)msg;
592 valid_len += (vqc->num_queue_pairs *
593 sizeof(struct
594 virtchnl_queue_pair_info));
595 if (vqc->num_queue_pairs == 0)
596 err_msg_format = true;
597 }
598 break;
599 case VIRTCHNL_OP_CONFIG_IRQ_MAP:
600 valid_len = sizeof(struct virtchnl_irq_map_info);
601 if (msglen >= valid_len) {
602 struct virtchnl_irq_map_info *vimi =
603 (struct virtchnl_irq_map_info *)msg;
604 valid_len += (vimi->num_vectors *
605 sizeof(struct virtchnl_vector_map));
606 if (vimi->num_vectors == 0)
607 err_msg_format = true;
608 }
609 break;
610 case VIRTCHNL_OP_ENABLE_QUEUES:
611 case VIRTCHNL_OP_DISABLE_QUEUES:
612 valid_len = sizeof(struct virtchnl_queue_select);
613 break;
614 case VIRTCHNL_OP_ADD_ETH_ADDR:
615 case VIRTCHNL_OP_DEL_ETH_ADDR:
616 valid_len = sizeof(struct virtchnl_ether_addr_list);
617 if (msglen >= valid_len) {
618 struct virtchnl_ether_addr_list *veal =
619 (struct virtchnl_ether_addr_list *)msg;
620 valid_len += veal->num_elements *
621 sizeof(struct virtchnl_ether_addr);
622 if (veal->num_elements == 0)
623 err_msg_format = true;
624 }
625 break;
626 case VIRTCHNL_OP_ADD_VLAN:
627 case VIRTCHNL_OP_DEL_VLAN:
628 valid_len = sizeof(struct virtchnl_vlan_filter_list);
629 if (msglen >= valid_len) {
630 struct virtchnl_vlan_filter_list *vfl =
631 (struct virtchnl_vlan_filter_list *)msg;
632 valid_len += vfl->num_elements * sizeof(u16);
633 if (vfl->num_elements == 0)
634 err_msg_format = true;
635 }
636 break;
637 case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
638 valid_len = sizeof(struct virtchnl_promisc_info);
639 break;
640 case VIRTCHNL_OP_GET_STATS:
641 valid_len = sizeof(struct virtchnl_queue_select);
642 break;
643 case VIRTCHNL_OP_IWARP:
644 /* These messages are opaque to us and will be validated in
645 * the RDMA client code. We just need to check for nonzero
646 * length. The firmware will enforce max length restrictions.
647 */
648 if (msglen)
649 valid_len = msglen;
650 else
651 err_msg_format = true;
652 break;
653 case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP:
654 break;
655 case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:
656 valid_len = sizeof(struct virtchnl_iwarp_qvlist_info);
657 if (msglen >= valid_len) {
658 struct virtchnl_iwarp_qvlist_info *qv =
659 (struct virtchnl_iwarp_qvlist_info *)msg;
660 if (qv->num_vectors == 0) {
661 err_msg_format = true;
662 break;
663 }
664 valid_len += ((qv->num_vectors - 1) *
665 sizeof(struct virtchnl_iwarp_qv_info));
666 }
667 break;
668 case VIRTCHNL_OP_CONFIG_RSS_KEY:
669 valid_len = sizeof(struct virtchnl_rss_key);
670 if (msglen >= valid_len) {
671 struct virtchnl_rss_key *vrk =
672 (struct virtchnl_rss_key *)msg;
673 valid_len += vrk->key_len - 1;
674 }
675 break;
676 case VIRTCHNL_OP_CONFIG_RSS_LUT:
677 valid_len = sizeof(struct virtchnl_rss_lut);
678 if (msglen >= valid_len) {
679 struct virtchnl_rss_lut *vrl =
680 (struct virtchnl_rss_lut *)msg;
681 valid_len += vrl->lut_entries - 1;
682 }
683 break;
684 case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
685 break;
686 case VIRTCHNL_OP_SET_RSS_HENA:
687 valid_len = sizeof(struct virtchnl_rss_hena);
688 break;
689 /* These are always errors coming from the VF. */
690 case VIRTCHNL_OP_EVENT:
691 case VIRTCHNL_OP_UNKNOWN:
692 default:
693 return VIRTCHNL_ERR_PARAM;
694 }
695 /* few more checks */
696 if ((valid_len != msglen) || (err_msg_format))
697 return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH;
698
699 return 0;
700}
701#endif /* _VIRTCHNL_H_ */
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index c970a25d2a49..360c082e885c 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -7,6 +7,7 @@
7struct sock; 7struct sock;
8struct cgroup; 8struct cgroup;
9struct sk_buff; 9struct sk_buff;
10struct bpf_sock_ops_kern;
10 11
11#ifdef CONFIG_CGROUP_BPF 12#ifdef CONFIG_CGROUP_BPF
12 13
@@ -42,6 +43,10 @@ int __cgroup_bpf_run_filter_skb(struct sock *sk,
42int __cgroup_bpf_run_filter_sk(struct sock *sk, 43int __cgroup_bpf_run_filter_sk(struct sock *sk,
43 enum bpf_attach_type type); 44 enum bpf_attach_type type);
44 45
46int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
47 struct bpf_sock_ops_kern *sock_ops,
48 enum bpf_attach_type type);
49
45/* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */ 50/* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */
46#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \ 51#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \
47({ \ 52({ \
@@ -75,6 +80,18 @@ int __cgroup_bpf_run_filter_sk(struct sock *sk,
75 __ret; \ 80 __ret; \
76}) 81})
77 82
83#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) \
84({ \
85 int __ret = 0; \
86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \
87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \
88 if (sk_fullsock(__sk)) \
89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \
90 sock_ops, \
91 BPF_CGROUP_SOCK_OPS); \
92 } \
93 __ret; \
94})
78#else 95#else
79 96
80struct cgroup_bpf {}; 97struct cgroup_bpf {};
@@ -85,6 +102,7 @@ static inline void cgroup_bpf_inherit(struct cgroup *cgrp,
85#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; }) 102#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; })
86#define BPF_CGROUP_RUN_PROG_INET_EGRESS(sk,skb) ({ 0; }) 103#define BPF_CGROUP_RUN_PROG_INET_EGRESS(sk,skb) ({ 0; })
87#define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) ({ 0; }) 104#define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) ({ 0; })
105#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
88 106
89#endif /* CONFIG_CGROUP_BPF */ 107#endif /* CONFIG_CGROUP_BPF */
90 108
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 6bb38d76faf4..b69e7a5869ff 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -36,6 +36,7 @@ struct bpf_map_ops {
36 int fd); 36 int fd);
37 void (*map_fd_put_ptr)(void *ptr); 37 void (*map_fd_put_ptr)(void *ptr);
38 u32 (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf); 38 u32 (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf);
39 u32 (*map_fd_sys_lookup_elem)(void *ptr);
39}; 40};
40 41
41struct bpf_map { 42struct bpf_map {
@@ -46,6 +47,7 @@ struct bpf_map {
46 u32 max_entries; 47 u32 max_entries;
47 u32 map_flags; 48 u32 map_flags;
48 u32 pages; 49 u32 pages;
50 u32 id;
49 struct user_struct *user; 51 struct user_struct *user;
50 const struct bpf_map_ops *ops; 52 const struct bpf_map_ops *ops;
51 struct work_struct work; 53 struct work_struct work;
@@ -148,6 +150,20 @@ enum bpf_reg_type {
148 150
149struct bpf_prog; 151struct bpf_prog;
150 152
153/* The information passed from prog-specific *_is_valid_access
154 * back to the verifier.
155 */
156struct bpf_insn_access_aux {
157 enum bpf_reg_type reg_type;
158 int ctx_field_size;
159};
160
161static inline void
162bpf_ctx_record_field_size(struct bpf_insn_access_aux *aux, u32 size)
163{
164 aux->ctx_field_size = size;
165}
166
151struct bpf_verifier_ops { 167struct bpf_verifier_ops {
152 /* return eBPF function prototype for verification */ 168 /* return eBPF function prototype for verification */
153 const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id); 169 const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id);
@@ -156,13 +172,13 @@ struct bpf_verifier_ops {
156 * with 'type' (read or write) is allowed 172 * with 'type' (read or write) is allowed
157 */ 173 */
158 bool (*is_valid_access)(int off, int size, enum bpf_access_type type, 174 bool (*is_valid_access)(int off, int size, enum bpf_access_type type,
159 enum bpf_reg_type *reg_type); 175 struct bpf_insn_access_aux *info);
160 int (*gen_prologue)(struct bpf_insn *insn, bool direct_write, 176 int (*gen_prologue)(struct bpf_insn *insn, bool direct_write,
161 const struct bpf_prog *prog); 177 const struct bpf_prog *prog);
162 u32 (*convert_ctx_access)(enum bpf_access_type type, 178 u32 (*convert_ctx_access)(enum bpf_access_type type,
163 const struct bpf_insn *src, 179 const struct bpf_insn *src,
164 struct bpf_insn *dst, 180 struct bpf_insn *dst,
165 struct bpf_prog *prog); 181 struct bpf_prog *prog, u32 *target_size);
166 int (*test_run)(struct bpf_prog *prog, const union bpf_attr *kattr, 182 int (*test_run)(struct bpf_prog *prog, const union bpf_attr *kattr,
167 union bpf_attr __user *uattr); 183 union bpf_attr __user *uattr);
168}; 184};
@@ -171,6 +187,8 @@ struct bpf_prog_aux {
171 atomic_t refcnt; 187 atomic_t refcnt;
172 u32 used_map_cnt; 188 u32 used_map_cnt;
173 u32 max_ctx_offset; 189 u32 max_ctx_offset;
190 u32 stack_depth;
191 u32 id;
174 struct latch_tree_node ksym_tnode; 192 struct latch_tree_node ksym_tnode;
175 struct list_head ksym_lnode; 193 struct list_head ksym_lnode;
176 const struct bpf_verifier_ops *ops; 194 const struct bpf_verifier_ops *ops;
@@ -276,9 +294,11 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value);
276 294
277int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file, 295int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file,
278 void *key, void *value, u64 map_flags); 296 void *key, void *value, u64 map_flags);
297int bpf_fd_array_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
279void bpf_fd_array_map_clear(struct bpf_map *map); 298void bpf_fd_array_map_clear(struct bpf_map *map);
280int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file, 299int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file,
281 void *key, void *value, u64 map_flags); 300 void *key, void *value, u64 map_flags);
301int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
282 302
283/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and 303/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and
284 * forced to use 'long' read/writes to try to atomically copy long counters. 304 * forced to use 'long' read/writes to try to atomically copy long counters.
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h
index 03bf223f18be..3d137c33d664 100644
--- a/include/linux/bpf_types.h
+++ b/include/linux/bpf_types.h
@@ -10,6 +10,7 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock_prog_ops)
10BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_inout_prog_ops) 10BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_inout_prog_ops)
11BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_inout_prog_ops) 11BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_inout_prog_ops)
12BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit_prog_ops) 12BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit_prog_ops)
13BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops_prog_ops)
13#endif 14#endif
14#ifdef CONFIG_BPF_EVENTS 15#ifdef CONFIG_BPF_EVENTS
15BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe_prog_ops) 16BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe_prog_ops)
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index d5093b52b485..621076f56251 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -73,6 +73,8 @@ struct bpf_insn_aux_data {
73 enum bpf_reg_type ptr_type; /* pointer type for load/store insns */ 73 enum bpf_reg_type ptr_type; /* pointer type for load/store insns */
74 struct bpf_map *map_ptr; /* pointer for call insn into lookup_elem */ 74 struct bpf_map *map_ptr; /* pointer for call insn into lookup_elem */
75 }; 75 };
76 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
77 int converted_op_size; /* the valid value width after perceived conversion */
76}; 78};
77 79
78#define MAX_USED_MAPS 64 /* max number of maps accessed by one eBPF program */ 80#define MAX_USED_MAPS 64 /* max number of maps accessed by one eBPF program */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 62d948f80730..f1fc9baa3509 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -57,6 +57,9 @@ struct bpf_prog_aux;
57#define BPF_REG_AX MAX_BPF_REG 57#define BPF_REG_AX MAX_BPF_REG
58#define MAX_BPF_JIT_REG (MAX_BPF_REG + 1) 58#define MAX_BPF_JIT_REG (MAX_BPF_REG + 1)
59 59
60/* unused opcode to mark special call to bpf_tail_call() helper */
61#define BPF_TAIL_CALL 0xf0
62
60/* As per nm, we expose JITed images as text (code) section for 63/* As per nm, we expose JITed images as text (code) section for
61 * kallsyms. That way, tools like perf can find it to match 64 * kallsyms. That way, tools like perf can find it to match
62 * addresses. 65 * addresses.
@@ -66,8 +69,6 @@ struct bpf_prog_aux;
66/* BPF program can access up to 512 bytes of stack space. */ 69/* BPF program can access up to 512 bytes of stack space. */
67#define MAX_BPF_STACK 512 70#define MAX_BPF_STACK 512
68 71
69#define BPF_TAG_SIZE 8
70
71/* Helper macros for filter block array initializers. */ 72/* Helper macros for filter block array initializers. */
72 73
73/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ 74/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
@@ -336,6 +337,22 @@ struct bpf_prog_aux;
336 bpf_size; \ 337 bpf_size; \
337}) 338})
338 339
340#define bpf_size_to_bytes(bpf_size) \
341({ \
342 int bytes = -EINVAL; \
343 \
344 if (bpf_size == BPF_B) \
345 bytes = sizeof(u8); \
346 else if (bpf_size == BPF_H) \
347 bytes = sizeof(u16); \
348 else if (bpf_size == BPF_W) \
349 bytes = sizeof(u32); \
350 else if (bpf_size == BPF_DW) \
351 bytes = sizeof(u64); \
352 \
353 bytes; \
354})
355
339#define BPF_SIZEOF(type) \ 356#define BPF_SIZEOF(type) \
340 ({ \ 357 ({ \
341 const int __size = bytes_to_bpf_size(sizeof(type)); \ 358 const int __size = bytes_to_bpf_size(sizeof(type)); \
@@ -350,6 +367,13 @@ struct bpf_prog_aux;
350 __size; \ 367 __size; \
351 }) 368 })
352 369
370#define BPF_LDST_BYTES(insn) \
371 ({ \
372 const int __size = bpf_size_to_bytes(BPF_SIZE(insn->code)); \
373 WARN_ON(__size < 0); \
374 __size; \
375 })
376
353#define __BPF_MAP_0(m, v, ...) v 377#define __BPF_MAP_0(m, v, ...) v
354#define __BPF_MAP_1(m, v, t, a, ...) m(t, a) 378#define __BPF_MAP_1(m, v, t, a, ...) m(t, a)
355#define __BPF_MAP_2(m, v, t, a, ...) m(t, a), __BPF_MAP_1(m, v, __VA_ARGS__) 379#define __BPF_MAP_2(m, v, t, a, ...) m(t, a), __BPF_MAP_1(m, v, __VA_ARGS__)
@@ -400,6 +424,18 @@ struct bpf_prog_aux;
400#define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__) 424#define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
401#define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__) 425#define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
402 426
427#define bpf_ctx_range(TYPE, MEMBER) \
428 offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1
429#define bpf_ctx_range_till(TYPE, MEMBER1, MEMBER2) \
430 offsetof(TYPE, MEMBER1) ... offsetofend(TYPE, MEMBER2) - 1
431
432#define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \
433 ({ \
434 BUILD_BUG_ON(FIELD_SIZEOF(TYPE, MEMBER) != (SIZE)); \
435 *(PTR_SIZE) = (SIZE); \
436 offsetof(TYPE, MEMBER); \
437 })
438
403#ifdef CONFIG_COMPAT 439#ifdef CONFIG_COMPAT
404/* A struct sock_filter is architecture independent. */ 440/* A struct sock_filter is architecture independent. */
405struct compat_sock_fprog { 441struct compat_sock_fprog {
@@ -429,6 +465,7 @@ struct bpf_prog {
429 kmemcheck_bitfield_end(meta); 465 kmemcheck_bitfield_end(meta);
430 enum bpf_prog_type type; /* Type of BPF program */ 466 enum bpf_prog_type type; /* Type of BPF program */
431 u32 len; /* Number of filter blocks */ 467 u32 len; /* Number of filter blocks */
468 u32 jited_len; /* Size of jited insns in bytes */
432 u8 tag[BPF_TAG_SIZE]; 469 u8 tag[BPF_TAG_SIZE];
433 struct bpf_prog_aux *aux; /* Auxiliary fields */ 470 struct bpf_prog_aux *aux; /* Auxiliary fields */
434 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 471 struct sock_fprog_kern *orig_prog; /* Original BPF program */
@@ -562,6 +599,18 @@ static inline bool bpf_prog_was_classic(const struct bpf_prog *prog)
562 return prog->type == BPF_PROG_TYPE_UNSPEC; 599 return prog->type == BPF_PROG_TYPE_UNSPEC;
563} 600}
564 601
602static inline bool
603bpf_ctx_narrow_access_ok(u32 off, u32 size, const u32 size_default)
604{
605 bool off_ok;
606#ifdef __LITTLE_ENDIAN
607 off_ok = (off & (size_default - 1)) == 0;
608#else
609 off_ok = (off & (size_default - 1)) + size == size_default;
610#endif
611 return off_ok && size <= size_default && (size & (size - 1)) == 0;
612}
613
565#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 614#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
566 615
567#ifdef CONFIG_ARCH_HAS_SET_MEMORY 616#ifdef CONFIG_ARCH_HAS_SET_MEMORY
@@ -896,4 +945,13 @@ static inline int bpf_tell_extensions(void)
896 return SKF_AD_MAX; 945 return SKF_AD_MAX;
897} 946}
898 947
948struct bpf_sock_ops_kern {
949 struct sock *sk;
950 u32 op;
951 union {
952 u32 reply;
953 u32 replylong[4];
954 };
955};
956
899#endif /* __LINUX_FILTER_H__ */ 957#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 69033353d0d1..55a604ad459f 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2113,10 +2113,43 @@ enum ieee80211_key_len {
2113 2113
2114#define PMK_MAX_LEN 48 2114#define PMK_MAX_LEN 48
2115 2115
2116/* Public action codes */ 2116/* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
2117enum ieee80211_pub_actioncode { 2117enum ieee80211_pub_actioncode {
2118 WLAN_PUB_ACTION_20_40_BSS_COEX = 0,
2119 WLAN_PUB_ACTION_DSE_ENABLEMENT = 1,
2120 WLAN_PUB_ACTION_DSE_DEENABLEMENT = 2,
2121 WLAN_PUB_ACTION_DSE_REG_LOC_ANN = 3,
2118 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, 2122 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
2123 WLAN_PUB_ACTION_DSE_MSMT_REQ = 5,
2124 WLAN_PUB_ACTION_DSE_MSMT_RESP = 6,
2125 WLAN_PUB_ACTION_MSMT_PILOT = 7,
2126 WLAN_PUB_ACTION_DSE_PC = 8,
2127 WLAN_PUB_ACTION_VENDOR_SPECIFIC = 9,
2128 WLAN_PUB_ACTION_GAS_INITIAL_REQ = 10,
2129 WLAN_PUB_ACTION_GAS_INITIAL_RESP = 11,
2130 WLAN_PUB_ACTION_GAS_COMEBACK_REQ = 12,
2131 WLAN_PUB_ACTION_GAS_COMEBACK_RESP = 13,
2119 WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, 2132 WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,
2133 WLAN_PUB_ACTION_LOC_TRACK_NOTI = 15,
2134 WLAN_PUB_ACTION_QAB_REQUEST_FRAME = 16,
2135 WLAN_PUB_ACTION_QAB_RESPONSE_FRAME = 17,
2136 WLAN_PUB_ACTION_QMF_POLICY = 18,
2137 WLAN_PUB_ACTION_QMF_POLICY_CHANGE = 19,
2138 WLAN_PUB_ACTION_QLOAD_REQUEST = 20,
2139 WLAN_PUB_ACTION_QLOAD_REPORT = 21,
2140 WLAN_PUB_ACTION_HCCA_TXOP_ADVERT = 22,
2141 WLAN_PUB_ACTION_HCCA_TXOP_RESPONSE = 23,
2142 WLAN_PUB_ACTION_PUBLIC_KEY = 24,
2143 WLAN_PUB_ACTION_CHANNEL_AVAIL_QUERY = 25,
2144 WLAN_PUB_ACTION_CHANNEL_SCHEDULE_MGMT = 26,
2145 WLAN_PUB_ACTION_CONTACT_VERI_SIGNAL = 27,
2146 WLAN_PUB_ACTION_GDD_ENABLEMENT_REQ = 28,
2147 WLAN_PUB_ACTION_GDD_ENABLEMENT_RESP = 29,
2148 WLAN_PUB_ACTION_NETWORK_CHANNEL_CONTROL = 30,
2149 WLAN_PUB_ACTION_WHITE_SPACE_MAP_ANN = 31,
2150 WLAN_PUB_ACTION_FTM_REQUEST = 32,
2151 WLAN_PUB_ACTION_FTM = 33,
2152 WLAN_PUB_ACTION_FILS_DISCOVERY = 34,
2120}; 2153};
2121 2154
2122/* TDLS action codes */ 2155/* TDLS action codes */
@@ -2400,7 +2433,11 @@ enum ieee80211_sa_query_action {
2400 2433
2401#define WLAN_MAX_KEY_LEN 32 2434#define WLAN_MAX_KEY_LEN 32
2402 2435
2436#define WLAN_PMK_NAME_LEN 16
2403#define WLAN_PMKID_LEN 16 2437#define WLAN_PMKID_LEN 16
2438#define WLAN_PMK_LEN_EAP_LEAP 16
2439#define WLAN_PMK_LEN 32
2440#define WLAN_PMK_LEN_SUITE_B_192 48
2404 2441
2405#define WLAN_OUI_WFA 0x506f9a 2442#define WLAN_OUI_WFA 0x506f9a
2406#define WLAN_OUI_TYPE_WFA_P2P 9 2443#define WLAN_OUI_TYPE_WFA_P2P 9
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 0c16866a7aac..3cd18ac0697f 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -62,6 +62,7 @@ int br_multicast_list_adjacent(struct net_device *dev,
62 struct list_head *br_ip_list); 62 struct list_head *br_ip_list);
63bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto); 63bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto);
64bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto); 64bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);
65bool br_multicast_enabled(const struct net_device *dev);
65#else 66#else
66static inline int br_multicast_list_adjacent(struct net_device *dev, 67static inline int br_multicast_list_adjacent(struct net_device *dev,
67 struct list_head *br_ip_list) 68 struct list_head *br_ip_list)
@@ -78,6 +79,19 @@ static inline bool br_multicast_has_querier_adjacent(struct net_device *dev,
78{ 79{
79 return false; 80 return false;
80} 81}
82static inline bool br_multicast_enabled(const struct net_device *dev)
83{
84 return false;
85}
86#endif
87
88#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING)
89bool br_vlan_enabled(const struct net_device *dev);
90#else
91static inline bool br_vlan_enabled(const struct net_device *dev)
92{
93 return false;
94}
81#endif 95#endif
82 96
83#endif 97#endif
diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h
index 3482c3c2037d..4837157da0dc 100644
--- a/include/linux/if_tap.h
+++ b/include/linux/if_tap.h
@@ -3,6 +3,7 @@
3 3
4#if IS_ENABLED(CONFIG_TAP) 4#if IS_ENABLED(CONFIG_TAP)
5struct socket *tap_get_socket(struct file *); 5struct socket *tap_get_socket(struct file *);
6struct skb_array *tap_get_skb_array(struct file *file);
6#else 7#else
7#include <linux/err.h> 8#include <linux/err.h>
8#include <linux/errno.h> 9#include <linux/errno.h>
@@ -12,6 +13,10 @@ static inline struct socket *tap_get_socket(struct file *f)
12{ 13{
13 return ERR_PTR(-EINVAL); 14 return ERR_PTR(-EINVAL);
14} 15}
16static inline struct skb_array *tap_get_skb_array(struct file *f)
17{
18 return ERR_PTR(-EINVAL);
19}
15#endif /* CONFIG_TAP */ 20#endif /* CONFIG_TAP */
16 21
17#include <net/sock.h> 22#include <net/sock.h>
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index c05216a8fbac..30294603526f 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -298,4 +298,6 @@ extern void team_mode_unregister(const struct team_mode *mode);
298#define TEAM_DEFAULT_NUM_TX_QUEUES 16 298#define TEAM_DEFAULT_NUM_TX_QUEUES 16
299#define TEAM_DEFAULT_NUM_RX_QUEUES 16 299#define TEAM_DEFAULT_NUM_RX_QUEUES 16
300 300
301#define MODULE_ALIAS_TEAM_MODE(kind) MODULE_ALIAS("team-mode-" kind)
302
301#endif /* _LINUX_IF_TEAM_H_ */ 303#endif /* _LINUX_IF_TEAM_H_ */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index ed6da2e6df90..bf9bdf42d577 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -19,6 +19,7 @@
19 19
20#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) 20#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
21struct socket *tun_get_socket(struct file *); 21struct socket *tun_get_socket(struct file *);
22struct skb_array *tun_get_skb_array(struct file *file);
22#else 23#else
23#include <linux/err.h> 24#include <linux/err.h>
24#include <linux/errno.h> 25#include <linux/errno.h>
@@ -28,5 +29,9 @@ static inline struct socket *tun_get_socket(struct file *f)
28{ 29{
29 return ERR_PTR(-EINVAL); 30 return ERR_PTR(-EINVAL);
30} 31}
32static inline struct skb_array *tun_get_skb_array(struct file *f)
33{
34 return ERR_PTR(-EINVAL);
35}
31#endif /* CONFIG_TUN */ 36#endif /* CONFIG_TUN */
32#endif /* __IF_TUN_H */ 37#endif /* __IF_TUN_H */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 283dc2f5364d..5e6a2d4dc366 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -318,7 +318,7 @@ static inline int __vlan_insert_tag(struct sk_buff *skb,
318 if (skb_cow_head(skb, VLAN_HLEN) < 0) 318 if (skb_cow_head(skb, VLAN_HLEN) < 0)
319 return -ENOMEM; 319 return -ENOMEM;
320 320
321 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 321 veth = skb_push(skb, VLAN_HLEN);
322 322
323 /* Move the mac addresses to the beginning of the new header. */ 323 /* Move the mac addresses to the beginning of the new header. */
324 memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); 324 memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 12f6fba6d21a..97caf1821de8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -18,6 +18,7 @@
18#include <linux/skbuff.h> 18#include <linux/skbuff.h>
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/in.h> 20#include <linux/in.h>
21#include <linux/refcount.h>
21#include <uapi/linux/igmp.h> 22#include <uapi/linux/igmp.h>
22 23
23static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb) 24static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
@@ -84,7 +85,7 @@ struct ip_mc_list {
84 struct ip_mc_list __rcu *next_hash; 85 struct ip_mc_list __rcu *next_hash;
85 struct timer_list timer; 86 struct timer_list timer;
86 int users; 87 int users;
87 atomic_t refcnt; 88 refcount_t refcnt;
88 spinlock_t lock; 89 spinlock_t lock;
89 char tm_running; 90 char tm_running;
90 char reporter; 91 char reporter;
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index a2e9d6ea1349..fb3f809e34e4 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -11,6 +11,7 @@
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/sysctl.h> 12#include <linux/sysctl.h>
13#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
14#include <linux/refcount.h>
14 15
15struct ipv4_devconf { 16struct ipv4_devconf {
16 void *sysctl; 17 void *sysctl;
@@ -22,7 +23,7 @@ struct ipv4_devconf {
22 23
23struct in_device { 24struct in_device {
24 struct net_device *dev; 25 struct net_device *dev;
25 atomic_t refcnt; 26 refcount_t refcnt;
26 int dead; 27 int dead;
27 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 28 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
28 29
@@ -150,8 +151,15 @@ struct in_ifaddr {
150 unsigned long ifa_tstamp; /* updated timestamp */ 151 unsigned long ifa_tstamp; /* updated timestamp */
151}; 152};
152 153
154struct in_validator_info {
155 __be32 ivi_addr;
156 struct in_device *ivi_dev;
157};
158
153int register_inetaddr_notifier(struct notifier_block *nb); 159int register_inetaddr_notifier(struct notifier_block *nb);
154int unregister_inetaddr_notifier(struct notifier_block *nb); 160int unregister_inetaddr_notifier(struct notifier_block *nb);
161int register_inetaddr_validator_notifier(struct notifier_block *nb);
162int unregister_inetaddr_validator_notifier(struct notifier_block *nb);
155 163
156void inet_netconf_notify_devconf(struct net *net, int event, int type, 164void inet_netconf_notify_devconf(struct net *net, int event, int type,
157 int ifindex, struct ipv4_devconf *devconf); 165 int ifindex, struct ipv4_devconf *devconf);
@@ -212,7 +220,7 @@ static inline struct in_device *in_dev_get(const struct net_device *dev)
212 rcu_read_lock(); 220 rcu_read_lock();
213 in_dev = __in_dev_get_rcu(dev); 221 in_dev = __in_dev_get_rcu(dev);
214 if (in_dev) 222 if (in_dev)
215 atomic_inc(&in_dev->refcnt); 223 refcount_inc(&in_dev->refcnt);
216 rcu_read_unlock(); 224 rcu_read_unlock();
217 return in_dev; 225 return in_dev;
218} 226}
@@ -233,12 +241,12 @@ void in_dev_finish_destroy(struct in_device *idev);
233 241
234static inline void in_dev_put(struct in_device *idev) 242static inline void in_dev_put(struct in_device *idev)
235{ 243{
236 if (atomic_dec_and_test(&idev->refcnt)) 244 if (refcount_dec_and_test(&idev->refcnt))
237 in_dev_finish_destroy(idev); 245 in_dev_finish_destroy(idev);
238} 246}
239 247
240#define __in_dev_put(idev) atomic_dec(&(idev)->refcnt) 248#define __in_dev_put(idev) refcount_dec(&(idev)->refcnt)
241#define in_dev_hold(idev) atomic_inc(&(idev)->refcnt) 249#define in_dev_hold(idev) refcount_inc(&(idev)->refcnt)
242 250
243#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
244 252
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index ac02c54520e9..a7330eb3ec64 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -554,7 +554,7 @@ _alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask)
554 if (!skb) 554 if (!skb)
555 return NULL; 555 return NULL;
556 if (len) 556 if (len)
557 memcpy(skb_put(skb, len), dp, len); 557 skb_put_data(skb, dp, len);
558 hh = mISDN_HEAD_P(skb); 558 hh = mISDN_HEAD_P(skb);
559 hh->prim = prim; 559 hh->prim = prim;
560 hh->id = id; 560 hh->id = id;
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index f541da68d1e7..472fa4d4ea62 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,6 +37,8 @@
37 37
38#define PHY_ID_KSZ8795 0x00221550 38#define PHY_ID_KSZ8795 0x00221550
39 39
40#define PHY_ID_KSZ9477 0x00221631
41
40/* struct phy_device dev_flags definitions */ 42/* struct phy_device dev_flags definitions */
41#define MICREL_PHY_50MHZ_CLK 0x00000001 43#define MICREL_PHY_50MHZ_CLK 0x00000001
42#define MICREL_PHY_FXEN 0x00000002 44#define MICREL_PHY_FXEN 0x00000002
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 1629a0c32679..e870bfa6abfe 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -31,7 +31,7 @@ struct mii_if_info {
31extern int mii_link_ok (struct mii_if_info *mii); 31extern int mii_link_ok (struct mii_if_info *mii);
32extern int mii_nway_restart (struct mii_if_info *mii); 32extern int mii_nway_restart (struct mii_if_info *mii);
33extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); 33extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
34extern int mii_ethtool_get_link_ksettings( 34extern void mii_ethtool_get_link_ksettings(
35 struct mii_if_info *mii, struct ethtool_link_ksettings *cmd); 35 struct mii_if_info *mii, struct ethtool_link_ksettings *cmd);
36extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); 36extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
37extern int mii_ethtool_set_link_ksettings( 37extern int mii_ethtool_set_link_ksettings(
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index a940ec6a046c..f31a0b5377e1 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -300,6 +300,8 @@ enum mlx5_event {
300 300
301 MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, 301 MLX5_EVENT_TYPE_PAGE_FAULT = 0xc,
302 MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd, 302 MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd,
303
304 MLX5_EVENT_TYPE_FPGA_ERROR = 0x20,
303}; 305};
304 306
305enum { 307enum {
@@ -973,6 +975,7 @@ enum mlx5_cap_type {
973 MLX5_CAP_RESERVED, 975 MLX5_CAP_RESERVED,
974 MLX5_CAP_VECTOR_CALC, 976 MLX5_CAP_VECTOR_CALC,
975 MLX5_CAP_QOS, 977 MLX5_CAP_QOS,
978 MLX5_CAP_FPGA,
976 /* NUM OF CAP Types */ 979 /* NUM OF CAP Types */
977 MLX5_CAP_NUM 980 MLX5_CAP_NUM
978}; 981};
@@ -1091,9 +1094,18 @@ enum mlx5_mcam_feature_groups {
1091#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ 1094#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \
1092 MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) 1095 MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld)
1093 1096
1097#define MLX5_CAP_MCAM_REG(mdev, reg) \
1098 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_access_reg_cap_mask.access_regs.reg)
1099
1094#define MLX5_CAP_MCAM_FEATURE(mdev, fld) \ 1100#define MLX5_CAP_MCAM_FEATURE(mdev, fld) \
1095 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) 1101 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld)
1096 1102
1103#define MLX5_CAP_FPGA(mdev, cap) \
1104 MLX5_GET(fpga_cap, (mdev)->caps.hca_cur[MLX5_CAP_FPGA], cap)
1105
1106#define MLX5_CAP64_FPGA(mdev, cap) \
1107 MLX5_GET64(fpga_cap, (mdev)->caps.hca_cur[MLX5_CAP_FPGA], cap)
1108
1097enum { 1109enum {
1098 MLX5_CMD_STAT_OK = 0x0, 1110 MLX5_CMD_STAT_OK = 0x0,
1099 MLX5_CMD_STAT_INT_ERR = 0x1, 1111 MLX5_CMD_STAT_INT_ERR = 0x1,
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 93273d9ea4d1..df6ce59a1f95 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -44,6 +44,7 @@
44#include <linux/workqueue.h> 44#include <linux/workqueue.h>
45#include <linux/mempool.h> 45#include <linux/mempool.h>
46#include <linux/interrupt.h> 46#include <linux/interrupt.h>
47#include <linux/idr.h>
47 48
48#include <linux/mlx5/device.h> 49#include <linux/mlx5/device.h>
49#include <linux/mlx5/doorbell.h> 50#include <linux/mlx5/doorbell.h>
@@ -108,6 +109,9 @@ enum {
108 MLX5_REG_QTCT = 0x400a, 109 MLX5_REG_QTCT = 0x400a,
109 MLX5_REG_DCBX_PARAM = 0x4020, 110 MLX5_REG_DCBX_PARAM = 0x4020,
110 MLX5_REG_DCBX_APP = 0x4021, 111 MLX5_REG_DCBX_APP = 0x4021,
112 MLX5_REG_FPGA_CAP = 0x4022,
113 MLX5_REG_FPGA_CTRL = 0x4023,
114 MLX5_REG_FPGA_ACCESS_REG = 0x4024,
111 MLX5_REG_PCAP = 0x5001, 115 MLX5_REG_PCAP = 0x5001,
112 MLX5_REG_PMTU = 0x5003, 116 MLX5_REG_PMTU = 0x5003,
113 MLX5_REG_PTYS = 0x5004, 117 MLX5_REG_PTYS = 0x5004,
@@ -129,6 +133,9 @@ enum {
129 MLX5_REG_MPCNT = 0x9051, 133 MLX5_REG_MPCNT = 0x9051,
130 MLX5_REG_MTPPS = 0x9053, 134 MLX5_REG_MTPPS = 0x9053,
131 MLX5_REG_MTPPSE = 0x9054, 135 MLX5_REG_MTPPSE = 0x9054,
136 MLX5_REG_MCQI = 0x9061,
137 MLX5_REG_MCC = 0x9062,
138 MLX5_REG_MCDA = 0x9063,
132 MLX5_REG_MCAM = 0x907f, 139 MLX5_REG_MCAM = 0x907f,
133}; 140};
134 141
@@ -732,6 +739,14 @@ struct mlx5e_resources {
732 struct mlx5_sq_bfreg bfreg; 739 struct mlx5_sq_bfreg bfreg;
733}; 740};
734 741
742#define MLX5_MAX_RESERVED_GIDS 8
743
744struct mlx5_rsvd_gids {
745 unsigned int start;
746 unsigned int count;
747 struct ida ida;
748};
749
735struct mlx5_core_dev { 750struct mlx5_core_dev {
736 struct pci_dev *pdev; 751 struct pci_dev *pdev;
737 /* sync pci state */ 752 /* sync pci state */
@@ -761,6 +776,13 @@ struct mlx5_core_dev {
761 atomic_t num_qps; 776 atomic_t num_qps;
762 u32 issi; 777 u32 issi;
763 struct mlx5e_resources mlx5e_res; 778 struct mlx5e_resources mlx5e_res;
779 struct {
780 struct mlx5_rsvd_gids reserved_gids;
781 atomic_t roce_en;
782 } roce;
783#ifdef CONFIG_MLX5_FPGA
784 struct mlx5_fpga_device *fpga;
785#endif
764#ifdef CONFIG_RFS_ACCEL 786#ifdef CONFIG_RFS_ACCEL
765 struct cpu_rmap *rmap; 787 struct cpu_rmap *rmap;
766#endif 788#endif
@@ -812,6 +834,7 @@ struct mlx5_cmd_work_ent {
812 u64 ts1; 834 u64 ts1;
813 u64 ts2; 835 u64 ts2;
814 u16 op; 836 u16 op;
837 bool polling;
815}; 838};
816 839
817struct mlx5_pas { 840struct mlx5_pas {
@@ -895,11 +918,6 @@ static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
895 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16; 918 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
896} 919}
897 920
898static inline void *mlx5_vzalloc(unsigned long size)
899{
900 return kvzalloc(size, GFP_KERNEL);
901}
902
903static inline u32 mlx5_base_mkey(const u32 key) 921static inline u32 mlx5_base_mkey(const u32 key)
904{ 922{
905 return key & 0xffffff00u; 923 return key & 0xffffff00u;
@@ -915,6 +933,8 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
915int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, 933int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
916 void *out, int out_size, mlx5_cmd_cbk_t callback, 934 void *out, int out_size, mlx5_cmd_cbk_t callback,
917 void *context); 935 void *context);
936int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,
937 void *out, int out_size);
918void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); 938void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome);
919 939
920int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type); 940int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type);
@@ -925,6 +945,8 @@ int mlx5_health_init(struct mlx5_core_dev *dev);
925void mlx5_start_health_poll(struct mlx5_core_dev *dev); 945void mlx5_start_health_poll(struct mlx5_core_dev *dev);
926void mlx5_stop_health_poll(struct mlx5_core_dev *dev); 946void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
927void mlx5_drain_health_wq(struct mlx5_core_dev *dev); 947void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
948void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
949void mlx5_drain_health_recovery(struct mlx5_core_dev *dev);
928int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, 950int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size,
929 struct mlx5_buf *buf, int node); 951 struct mlx5_buf *buf, int node);
930int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf); 952int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf);
@@ -1038,6 +1060,11 @@ int mlx5_alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg,
1038 bool map_wc, bool fast_path); 1060 bool map_wc, bool fast_path);
1039void mlx5_free_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg); 1061void mlx5_free_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg);
1040 1062
1063unsigned int mlx5_core_reserved_gids_count(struct mlx5_core_dev *dev);
1064int mlx5_core_roce_gid_set(struct mlx5_core_dev *dev, unsigned int index,
1065 u8 roce_version, u8 roce_l3_type, const u8 *gid,
1066 const u8 *mac, bool vlan, u16 vlan_id);
1067
1041static inline int fw_initializing(struct mlx5_core_dev *dev) 1068static inline int fw_initializing(struct mlx5_core_dev *dev)
1042{ 1069{
1043 return ioread32be(&dev->iseg->initializing) >> 31; 1070 return ioread32be(&dev->iseg->initializing) >> 31;
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index edafedb7b509..87869c04849a 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -32,6 +32,8 @@
32#ifndef MLX5_IFC_H 32#ifndef MLX5_IFC_H
33#define MLX5_IFC_H 33#define MLX5_IFC_H
34 34
35#include "mlx5_ifc_fpga.h"
36
35enum { 37enum {
36 MLX5_EVENT_TYPE_CODING_COMPLETION_EVENTS = 0x0, 38 MLX5_EVENT_TYPE_CODING_COMPLETION_EVENTS = 0x0,
37 MLX5_EVENT_TYPE_CODING_PATH_MIGRATED_SUCCEEDED = 0x1, 39 MLX5_EVENT_TYPE_CODING_PATH_MIGRATED_SUCCEEDED = 0x1,
@@ -56,7 +58,8 @@ enum {
56 MLX5_EVENT_TYPE_CODING_STALL_VL_EVENT = 0x1b, 58 MLX5_EVENT_TYPE_CODING_STALL_VL_EVENT = 0x1b,
57 MLX5_EVENT_TYPE_CODING_DROPPED_PACKET_LOGGED_EVENT = 0x1f, 59 MLX5_EVENT_TYPE_CODING_DROPPED_PACKET_LOGGED_EVENT = 0x1f,
58 MLX5_EVENT_TYPE_CODING_COMMAND_INTERFACE_COMPLETION = 0xa, 60 MLX5_EVENT_TYPE_CODING_COMMAND_INTERFACE_COMPLETION = 0xa,
59 MLX5_EVENT_TYPE_CODING_PAGE_REQUEST = 0xb 61 MLX5_EVENT_TYPE_CODING_PAGE_REQUEST = 0xb,
62 MLX5_EVENT_TYPE_CODING_FPGA_ERROR = 0x20,
60}; 63};
61 64
62enum { 65enum {
@@ -229,6 +232,11 @@ enum {
229 MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e, 232 MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e,
230 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940, 233 MLX5_CMD_OP_ALLOC_MODIFY_HEADER_CONTEXT = 0x940,
231 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941, 234 MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT = 0x941,
235 MLX5_CMD_OP_FPGA_CREATE_QP = 0x960,
236 MLX5_CMD_OP_FPGA_MODIFY_QP = 0x961,
237 MLX5_CMD_OP_FPGA_QUERY_QP = 0x962,
238 MLX5_CMD_OP_FPGA_DESTROY_QP = 0x963,
239 MLX5_CMD_OP_FPGA_QUERY_QP_COUNTERS = 0x964,
232 MLX5_CMD_OP_MAX 240 MLX5_CMD_OP_MAX
233}; 241};
234 242
@@ -240,7 +248,7 @@ struct mlx5_ifc_flow_table_fields_supported_bits {
240 u8 outer_first_prio[0x1]; 248 u8 outer_first_prio[0x1];
241 u8 outer_first_cfi[0x1]; 249 u8 outer_first_cfi[0x1];
242 u8 outer_first_vid[0x1]; 250 u8 outer_first_vid[0x1];
243 u8 reserved_at_7[0x1]; 251 u8 outer_ipv4_ttl[0x1];
244 u8 outer_second_prio[0x1]; 252 u8 outer_second_prio[0x1];
245 u8 outer_second_cfi[0x1]; 253 u8 outer_second_cfi[0x1];
246 u8 outer_second_vid[0x1]; 254 u8 outer_second_vid[0x1];
@@ -377,7 +385,8 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
377 u8 tcp_sport[0x10]; 385 u8 tcp_sport[0x10];
378 u8 tcp_dport[0x10]; 386 u8 tcp_dport[0x10];
379 387
380 u8 reserved_at_c0[0x20]; 388 u8 reserved_at_c0[0x18];
389 u8 ttl_hoplimit[0x8];
381 390
382 u8 udp_sport[0x10]; 391 u8 udp_sport[0x10];
383 u8 udp_dport[0x10]; 392 u8 udp_dport[0x10];
@@ -596,7 +605,10 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
596 u8 tunnel_statless_gre[0x1]; 605 u8 tunnel_statless_gre[0x1];
597 u8 tunnel_stateless_vxlan[0x1]; 606 u8 tunnel_stateless_vxlan[0x1];
598 607
599 u8 reserved_at_20[0x20]; 608 u8 swp[0x1];
609 u8 swp_csum[0x1];
610 u8 swp_lso[0x1];
611 u8 reserved_at_23[0x1d];
600 612
601 u8 reserved_at_40[0x10]; 613 u8 reserved_at_40[0x10];
602 u8 lro_min_mss_size[0x10]; 614 u8 lro_min_mss_size[0x10];
@@ -658,9 +670,9 @@ enum {
658struct mlx5_ifc_atomic_caps_bits { 670struct mlx5_ifc_atomic_caps_bits {
659 u8 reserved_at_0[0x40]; 671 u8 reserved_at_0[0x40];
660 672
661 u8 atomic_req_8B_endianess_mode[0x2]; 673 u8 atomic_req_8B_endianness_mode[0x2];
662 u8 reserved_at_42[0x4]; 674 u8 reserved_at_42[0x4];
663 u8 supported_atomic_req_8B_endianess_mode_1[0x1]; 675 u8 supported_atomic_req_8B_endianness_mode_1[0x1];
664 676
665 u8 reserved_at_47[0x19]; 677 u8 reserved_at_47[0x19];
666 678
@@ -798,7 +810,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
798 u8 max_indirection[0x8]; 810 u8 max_indirection[0x8];
799 u8 fixed_buffer_size[0x1]; 811 u8 fixed_buffer_size[0x1];
800 u8 log_max_mrw_sz[0x7]; 812 u8 log_max_mrw_sz[0x7];
801 u8 reserved_at_110[0x2]; 813 u8 force_teardown[0x1];
814 u8 reserved_at_111[0x1];
802 u8 log_max_bsf_list_size[0x6]; 815 u8 log_max_bsf_list_size[0x6];
803 u8 umr_extended_translation_offset[0x1]; 816 u8 umr_extended_translation_offset[0x1];
804 u8 null_mkey[0x1]; 817 u8 null_mkey[0x1];
@@ -819,7 +832,7 @@ struct mlx5_ifc_cmd_hca_cap_bits {
819 u8 cc_modify_allowed[0x1]; 832 u8 cc_modify_allowed[0x1];
820 u8 start_pad[0x1]; 833 u8 start_pad[0x1];
821 u8 cache_line_128byte[0x1]; 834 u8 cache_line_128byte[0x1];
822 u8 reserved_at_163[0xb]; 835 u8 reserved_at_165[0xb];
823 u8 gid_table_size[0x10]; 836 u8 gid_table_size[0x10];
824 837
825 u8 out_of_seq_cnt[0x1]; 838 u8 out_of_seq_cnt[0x1];
@@ -860,7 +873,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
860 u8 max_tc[0x4]; 873 u8 max_tc[0x4];
861 u8 reserved_at_1d0[0x1]; 874 u8 reserved_at_1d0[0x1];
862 u8 dcbx[0x1]; 875 u8 dcbx[0x1];
863 u8 reserved_at_1d2[0x4]; 876 u8 reserved_at_1d2[0x3];
877 u8 fpga[0x1];
864 u8 rol_s[0x1]; 878 u8 rol_s[0x1];
865 u8 rol_g[0x1]; 879 u8 rol_g[0x1];
866 u8 reserved_at_1d8[0x1]; 880 u8 reserved_at_1d8[0x1];
@@ -2194,6 +2208,7 @@ union mlx5_ifc_hca_cap_union_bits {
2194 struct mlx5_ifc_e_switch_cap_bits e_switch_cap; 2208 struct mlx5_ifc_e_switch_cap_bits e_switch_cap;
2195 struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap; 2209 struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap;
2196 struct mlx5_ifc_qos_cap_bits qos_cap; 2210 struct mlx5_ifc_qos_cap_bits qos_cap;
2211 struct mlx5_ifc_fpga_cap_bits fpga_cap;
2197 u8 reserved_at_0[0x8000]; 2212 u8 reserved_at_0[0x8000];
2198}; 2213};
2199 2214
@@ -2426,7 +2441,8 @@ struct mlx5_ifc_sqc_bits {
2426 u8 min_wqe_inline_mode[0x3]; 2441 u8 min_wqe_inline_mode[0x3];
2427 u8 state[0x4]; 2442 u8 state[0x4];
2428 u8 reg_umr[0x1]; 2443 u8 reg_umr[0x1];
2429 u8 reserved_at_d[0x13]; 2444 u8 allow_swp[0x1];
2445 u8 reserved_at_e[0x12];
2430 2446
2431 u8 reserved_at_20[0x8]; 2447 u8 reserved_at_20[0x8];
2432 u8 user_index[0x18]; 2448 u8 user_index[0x18];
@@ -3089,18 +3105,25 @@ struct mlx5_ifc_tsar_element_bits {
3089 u8 reserved_at_10[0x10]; 3105 u8 reserved_at_10[0x10];
3090}; 3106};
3091 3107
3108enum {
3109 MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_SUCCESS = 0x0,
3110 MLX5_TEARDOWN_HCA_OUT_FORCE_STATE_FAIL = 0x1,
3111};
3112
3092struct mlx5_ifc_teardown_hca_out_bits { 3113struct mlx5_ifc_teardown_hca_out_bits {
3093 u8 status[0x8]; 3114 u8 status[0x8];
3094 u8 reserved_at_8[0x18]; 3115 u8 reserved_at_8[0x18];
3095 3116
3096 u8 syndrome[0x20]; 3117 u8 syndrome[0x20];
3097 3118
3098 u8 reserved_at_40[0x40]; 3119 u8 reserved_at_40[0x3f];
3120
3121 u8 force_state[0x1];
3099}; 3122};
3100 3123
3101enum { 3124enum {
3102 MLX5_TEARDOWN_HCA_IN_PROFILE_GRACEFUL_CLOSE = 0x0, 3125 MLX5_TEARDOWN_HCA_IN_PROFILE_GRACEFUL_CLOSE = 0x0,
3103 MLX5_TEARDOWN_HCA_IN_PROFILE_PANIC_CLOSE = 0x1, 3126 MLX5_TEARDOWN_HCA_IN_PROFILE_FORCE_CLOSE = 0x1,
3104}; 3127};
3105 3128
3106struct mlx5_ifc_teardown_hca_in_bits { 3129struct mlx5_ifc_teardown_hca_in_bits {
@@ -4606,6 +4629,7 @@ enum {
4606 MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14, 4629 MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0 = 0x14,
4607 MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15, 4630 MLX5_ACTION_IN_FIELD_OUT_SIPV4 = 0x15,
4608 MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, 4631 MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16,
4632 MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47,
4609}; 4633};
4610 4634
4611struct mlx5_ifc_alloc_modify_header_context_out_bits { 4635struct mlx5_ifc_alloc_modify_header_context_out_bits {
@@ -6622,6 +6646,24 @@ struct mlx5_ifc_create_flow_table_out_bits {
6622 u8 reserved_at_60[0x20]; 6646 u8 reserved_at_60[0x20];
6623}; 6647};
6624 6648
6649struct mlx5_ifc_flow_table_context_bits {
6650 u8 encap_en[0x1];
6651 u8 decap_en[0x1];
6652 u8 reserved_at_2[0x2];
6653 u8 table_miss_action[0x4];
6654 u8 level[0x8];
6655 u8 reserved_at_10[0x8];
6656 u8 log_size[0x8];
6657
6658 u8 reserved_at_20[0x8];
6659 u8 table_miss_id[0x18];
6660
6661 u8 reserved_at_40[0x8];
6662 u8 lag_master_next_table_id[0x18];
6663
6664 u8 reserved_at_60[0xe0];
6665};
6666
6625struct mlx5_ifc_create_flow_table_in_bits { 6667struct mlx5_ifc_create_flow_table_in_bits {
6626 u8 opcode[0x10]; 6668 u8 opcode[0x10];
6627 u8 reserved_at_10[0x10]; 6669 u8 reserved_at_10[0x10];
@@ -6640,21 +6682,7 @@ struct mlx5_ifc_create_flow_table_in_bits {
6640 6682
6641 u8 reserved_at_a0[0x20]; 6683 u8 reserved_at_a0[0x20];
6642 6684
6643 u8 encap_en[0x1]; 6685 struct mlx5_ifc_flow_table_context_bits flow_table_context;
6644 u8 decap_en[0x1];
6645 u8 reserved_at_c2[0x2];
6646 u8 table_miss_mode[0x4];
6647 u8 level[0x8];
6648 u8 reserved_at_d0[0x8];
6649 u8 log_size[0x8];
6650
6651 u8 reserved_at_e0[0x8];
6652 u8 table_miss_id[0x18];
6653
6654 u8 reserved_at_100[0x8];
6655 u8 lag_master_next_table_id[0x18];
6656
6657 u8 reserved_at_120[0x80];
6658}; 6686};
6659 6687
6660struct mlx5_ifc_create_flow_group_out_bits { 6688struct mlx5_ifc_create_flow_group_out_bits {
@@ -7286,7 +7314,8 @@ struct mlx5_ifc_ptys_reg_bits {
7286 u8 ib_link_width_oper[0x10]; 7314 u8 ib_link_width_oper[0x10];
7287 u8 ib_proto_oper[0x10]; 7315 u8 ib_proto_oper[0x10];
7288 7316
7289 u8 reserved_at_160[0x20]; 7317 u8 reserved_at_160[0x1c];
7318 u8 connector_type[0x4];
7290 7319
7291 u8 eth_proto_lp_advertise[0x20]; 7320 u8 eth_proto_lp_advertise[0x20];
7292 7321
@@ -7689,8 +7718,10 @@ struct mlx5_ifc_peir_reg_bits {
7689}; 7718};
7690 7719
7691struct mlx5_ifc_pcam_enhanced_features_bits { 7720struct mlx5_ifc_pcam_enhanced_features_bits {
7692 u8 reserved_at_0[0x7e]; 7721 u8 reserved_at_0[0x7c];
7693 7722
7723 u8 ptys_connector_type[0x1];
7724 u8 reserved_at_7d[0x1];
7694 u8 ppcnt_discard_group[0x1]; 7725 u8 ppcnt_discard_group[0x1];
7695 u8 ppcnt_statistical_group[0x1]; 7726 u8 ppcnt_statistical_group[0x1];
7696}; 7727};
@@ -7723,6 +7754,18 @@ struct mlx5_ifc_mcam_enhanced_features_bits {
7723 u8 pcie_performance_group[0x1]; 7754 u8 pcie_performance_group[0x1];
7724}; 7755};
7725 7756
7757struct mlx5_ifc_mcam_access_reg_bits {
7758 u8 reserved_at_0[0x1c];
7759 u8 mcda[0x1];
7760 u8 mcc[0x1];
7761 u8 mcqi[0x1];
7762 u8 reserved_at_1f[0x1];
7763
7764 u8 regs_95_to_64[0x20];
7765 u8 regs_63_to_32[0x20];
7766 u8 regs_31_to_0[0x20];
7767};
7768
7726struct mlx5_ifc_mcam_reg_bits { 7769struct mlx5_ifc_mcam_reg_bits {
7727 u8 reserved_at_0[0x8]; 7770 u8 reserved_at_0[0x8];
7728 u8 feature_group[0x8]; 7771 u8 feature_group[0x8];
@@ -7732,6 +7775,7 @@ struct mlx5_ifc_mcam_reg_bits {
7732 u8 reserved_at_20[0x20]; 7775 u8 reserved_at_20[0x20];
7733 7776
7734 union { 7777 union {
7778 struct mlx5_ifc_mcam_access_reg_bits access_regs;
7735 u8 reserved_at_0[0x80]; 7779 u8 reserved_at_0[0x80];
7736 } mng_access_reg_cap_mask; 7780 } mng_access_reg_cap_mask;
7737 7781
@@ -8143,6 +8187,85 @@ struct mlx5_ifc_mtppse_reg_bits {
8143 u8 reserved_at_40[0x40]; 8187 u8 reserved_at_40[0x40];
8144}; 8188};
8145 8189
8190struct mlx5_ifc_mcqi_cap_bits {
8191 u8 supported_info_bitmask[0x20];
8192
8193 u8 component_size[0x20];
8194
8195 u8 max_component_size[0x20];
8196
8197 u8 log_mcda_word_size[0x4];
8198 u8 reserved_at_64[0xc];
8199 u8 mcda_max_write_size[0x10];
8200
8201 u8 rd_en[0x1];
8202 u8 reserved_at_81[0x1];
8203 u8 match_chip_id[0x1];
8204 u8 match_psid[0x1];
8205 u8 check_user_timestamp[0x1];
8206 u8 match_base_guid_mac[0x1];
8207 u8 reserved_at_86[0x1a];
8208};
8209
8210struct mlx5_ifc_mcqi_reg_bits {
8211 u8 read_pending_component[0x1];
8212 u8 reserved_at_1[0xf];
8213 u8 component_index[0x10];
8214
8215 u8 reserved_at_20[0x20];
8216
8217 u8 reserved_at_40[0x1b];
8218 u8 info_type[0x5];
8219
8220 u8 info_size[0x20];
8221
8222 u8 offset[0x20];
8223
8224 u8 reserved_at_a0[0x10];
8225 u8 data_size[0x10];
8226
8227 u8 data[0][0x20];
8228};
8229
8230struct mlx5_ifc_mcc_reg_bits {
8231 u8 reserved_at_0[0x4];
8232 u8 time_elapsed_since_last_cmd[0xc];
8233 u8 reserved_at_10[0x8];
8234 u8 instruction[0x8];
8235
8236 u8 reserved_at_20[0x10];
8237 u8 component_index[0x10];
8238
8239 u8 reserved_at_40[0x8];
8240 u8 update_handle[0x18];
8241
8242 u8 handle_owner_type[0x4];
8243 u8 handle_owner_host_id[0x4];
8244 u8 reserved_at_68[0x1];
8245 u8 control_progress[0x7];
8246 u8 error_code[0x8];
8247 u8 reserved_at_78[0x4];
8248 u8 control_state[0x4];
8249
8250 u8 component_size[0x20];
8251
8252 u8 reserved_at_a0[0x60];
8253};
8254
8255struct mlx5_ifc_mcda_reg_bits {
8256 u8 reserved_at_0[0x8];
8257 u8 update_handle[0x18];
8258
8259 u8 offset[0x20];
8260
8261 u8 reserved_at_40[0x10];
8262 u8 size[0x10];
8263
8264 u8 reserved_at_60[0x20];
8265
8266 u8 data[0][0x20];
8267};
8268
8146union mlx5_ifc_ports_control_registers_document_bits { 8269union mlx5_ifc_ports_control_registers_document_bits {
8147 struct mlx5_ifc_bufferx_reg_bits bufferx_reg; 8270 struct mlx5_ifc_bufferx_reg_bits bufferx_reg;
8148 struct mlx5_ifc_eth_2819_cntrs_grp_data_layout_bits eth_2819_cntrs_grp_data_layout; 8271 struct mlx5_ifc_eth_2819_cntrs_grp_data_layout_bits eth_2819_cntrs_grp_data_layout;
@@ -8190,6 +8313,12 @@ union mlx5_ifc_ports_control_registers_document_bits {
8190 struct mlx5_ifc_sltp_reg_bits sltp_reg; 8313 struct mlx5_ifc_sltp_reg_bits sltp_reg;
8191 struct mlx5_ifc_mtpps_reg_bits mtpps_reg; 8314 struct mlx5_ifc_mtpps_reg_bits mtpps_reg;
8192 struct mlx5_ifc_mtppse_reg_bits mtppse_reg; 8315 struct mlx5_ifc_mtppse_reg_bits mtppse_reg;
8316 struct mlx5_ifc_fpga_access_reg_bits fpga_access_reg;
8317 struct mlx5_ifc_fpga_ctrl_bits fpga_ctrl_bits;
8318 struct mlx5_ifc_fpga_cap_bits fpga_cap_bits;
8319 struct mlx5_ifc_mcqi_reg_bits mcqi_reg;
8320 struct mlx5_ifc_mcc_reg_bits mcc_reg;
8321 struct mlx5_ifc_mcda_reg_bits mcda_reg;
8193 u8 reserved_at_0[0x60e0]; 8322 u8 reserved_at_0[0x60e0];
8194}; 8323};
8195 8324
@@ -8270,17 +8399,7 @@ struct mlx5_ifc_modify_flow_table_in_bits {
8270 u8 reserved_at_a0[0x8]; 8399 u8 reserved_at_a0[0x8];
8271 u8 table_id[0x18]; 8400 u8 table_id[0x18];
8272 8401
8273 u8 reserved_at_c0[0x4]; 8402 struct mlx5_ifc_flow_table_context_bits flow_table_context;
8274 u8 table_miss_mode[0x4];
8275 u8 reserved_at_c8[0x18];
8276
8277 u8 reserved_at_e0[0x8];
8278 u8 table_miss_id[0x18];
8279
8280 u8 reserved_at_100[0x8];
8281 u8 lag_master_next_table_id[0x18];
8282
8283 u8 reserved_at_120[0x80];
8284}; 8403};
8285 8404
8286struct mlx5_ifc_ets_tcn_config_reg_bits { 8405struct mlx5_ifc_ets_tcn_config_reg_bits {
diff --git a/include/linux/mlx5/mlx5_ifc_fpga.h b/include/linux/mlx5/mlx5_ifc_fpga.h
new file mode 100644
index 000000000000..255a88d08078
--- /dev/null
+++ b/include/linux/mlx5/mlx5_ifc_fpga.h
@@ -0,0 +1,432 @@
1/*
2 * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32#ifndef MLX5_IFC_FPGA_H
33#define MLX5_IFC_FPGA_H
34
35enum {
36 MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9,
37};
38
39enum {
40 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2,
41};
42
43struct mlx5_ifc_fpga_shell_caps_bits {
44 u8 max_num_qps[0x10];
45 u8 reserved_at_10[0x8];
46 u8 total_rcv_credits[0x8];
47
48 u8 reserved_at_20[0xe];
49 u8 qp_type[0x2];
50 u8 reserved_at_30[0x5];
51 u8 rae[0x1];
52 u8 rwe[0x1];
53 u8 rre[0x1];
54 u8 reserved_at_38[0x4];
55 u8 dc[0x1];
56 u8 ud[0x1];
57 u8 uc[0x1];
58 u8 rc[0x1];
59
60 u8 reserved_at_40[0x1a];
61 u8 log_ddr_size[0x6];
62
63 u8 max_fpga_qp_msg_size[0x20];
64
65 u8 reserved_at_80[0x180];
66};
67
68struct mlx5_ifc_fpga_cap_bits {
69 u8 fpga_id[0x8];
70 u8 fpga_device[0x18];
71
72 u8 register_file_ver[0x20];
73
74 u8 fpga_ctrl_modify[0x1];
75 u8 reserved_at_41[0x5];
76 u8 access_reg_query_mode[0x2];
77 u8 reserved_at_48[0x6];
78 u8 access_reg_modify_mode[0x2];
79 u8 reserved_at_50[0x10];
80
81 u8 reserved_at_60[0x20];
82
83 u8 image_version[0x20];
84
85 u8 image_date[0x20];
86
87 u8 image_time[0x20];
88
89 u8 shell_version[0x20];
90
91 u8 reserved_at_100[0x80];
92
93 struct mlx5_ifc_fpga_shell_caps_bits shell_caps;
94
95 u8 reserved_at_380[0x8];
96 u8 ieee_vendor_id[0x18];
97
98 u8 sandbox_product_version[0x10];
99 u8 sandbox_product_id[0x10];
100
101 u8 sandbox_basic_caps[0x20];
102
103 u8 reserved_at_3e0[0x10];
104 u8 sandbox_extended_caps_len[0x10];
105
106 u8 sandbox_extended_caps_addr[0x40];
107
108 u8 fpga_ddr_start_addr[0x40];
109
110 u8 fpga_cr_space_start_addr[0x40];
111
112 u8 fpga_ddr_size[0x20];
113
114 u8 fpga_cr_space_size[0x20];
115
116 u8 reserved_at_500[0x300];
117};
118
119enum {
120 MLX5_FPGA_CTRL_OPERATION_LOAD = 0x1,
121 MLX5_FPGA_CTRL_OPERATION_RESET = 0x2,
122 MLX5_FPGA_CTRL_OPERATION_FLASH_SELECT = 0x3,
123 MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4,
124 MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5,
125 MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6,
126};
127
128struct mlx5_ifc_fpga_ctrl_bits {
129 u8 reserved_at_0[0x8];
130 u8 operation[0x8];
131 u8 reserved_at_10[0x8];
132 u8 status[0x8];
133
134 u8 reserved_at_20[0x8];
135 u8 flash_select_admin[0x8];
136 u8 reserved_at_30[0x8];
137 u8 flash_select_oper[0x8];
138
139 u8 reserved_at_40[0x40];
140};
141
142enum {
143 MLX5_FPGA_ERROR_EVENT_SYNDROME_CORRUPTED_DDR = 0x1,
144 MLX5_FPGA_ERROR_EVENT_SYNDROME_FLASH_TIMEOUT = 0x2,
145 MLX5_FPGA_ERROR_EVENT_SYNDROME_INTERNAL_LINK_ERROR = 0x3,
146 MLX5_FPGA_ERROR_EVENT_SYNDROME_WATCHDOG_FAILURE = 0x4,
147 MLX5_FPGA_ERROR_EVENT_SYNDROME_I2C_FAILURE = 0x5,
148 MLX5_FPGA_ERROR_EVENT_SYNDROME_IMAGE_CHANGED = 0x6,
149 MLX5_FPGA_ERROR_EVENT_SYNDROME_TEMPERATURE_CRITICAL = 0x7,
150};
151
152struct mlx5_ifc_fpga_error_event_bits {
153 u8 reserved_at_0[0x40];
154
155 u8 reserved_at_40[0x18];
156 u8 syndrome[0x8];
157
158 u8 reserved_at_60[0x80];
159};
160
161#define MLX5_FPGA_ACCESS_REG_SIZE_MAX 64
162
163struct mlx5_ifc_fpga_access_reg_bits {
164 u8 reserved_at_0[0x20];
165
166 u8 reserved_at_20[0x10];
167 u8 size[0x10];
168
169 u8 address[0x40];
170
171 u8 data[0][0x8];
172};
173
174enum mlx5_ifc_fpga_qp_state {
175 MLX5_FPGA_QPC_STATE_INIT = 0x0,
176 MLX5_FPGA_QPC_STATE_ACTIVE = 0x1,
177 MLX5_FPGA_QPC_STATE_ERROR = 0x2,
178};
179
180enum mlx5_ifc_fpga_qp_type {
181 MLX5_FPGA_QPC_QP_TYPE_SHELL_QP = 0x0,
182 MLX5_FPGA_QPC_QP_TYPE_SANDBOX_QP = 0x1,
183};
184
185enum mlx5_ifc_fpga_qp_service_type {
186 MLX5_FPGA_QPC_ST_RC = 0x0,
187};
188
189struct mlx5_ifc_fpga_qpc_bits {
190 u8 state[0x4];
191 u8 reserved_at_4[0x1b];
192 u8 qp_type[0x1];
193
194 u8 reserved_at_20[0x4];
195 u8 st[0x4];
196 u8 reserved_at_28[0x10];
197 u8 traffic_class[0x8];
198
199 u8 ether_type[0x10];
200 u8 prio[0x3];
201 u8 dei[0x1];
202 u8 vid[0xc];
203
204 u8 reserved_at_60[0x20];
205
206 u8 reserved_at_80[0x8];
207 u8 next_rcv_psn[0x18];
208
209 u8 reserved_at_a0[0x8];
210 u8 next_send_psn[0x18];
211
212 u8 reserved_at_c0[0x10];
213 u8 pkey[0x10];
214
215 u8 reserved_at_e0[0x8];
216 u8 remote_qpn[0x18];
217
218 u8 reserved_at_100[0x15];
219 u8 rnr_retry[0x3];
220 u8 reserved_at_118[0x5];
221 u8 retry_count[0x3];
222
223 u8 reserved_at_120[0x20];
224
225 u8 reserved_at_140[0x10];
226 u8 remote_mac_47_32[0x10];
227
228 u8 remote_mac_31_0[0x20];
229
230 u8 remote_ip[16][0x8];
231
232 u8 reserved_at_200[0x40];
233
234 u8 reserved_at_240[0x10];
235 u8 fpga_mac_47_32[0x10];
236
237 u8 fpga_mac_31_0[0x20];
238
239 u8 fpga_ip[16][0x8];
240};
241
242struct mlx5_ifc_fpga_create_qp_in_bits {
243 u8 opcode[0x10];
244 u8 reserved_at_10[0x10];
245
246 u8 reserved_at_20[0x10];
247 u8 op_mod[0x10];
248
249 u8 reserved_at_40[0x40];
250
251 struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
252};
253
254struct mlx5_ifc_fpga_create_qp_out_bits {
255 u8 status[0x8];
256 u8 reserved_at_8[0x18];
257
258 u8 syndrome[0x20];
259
260 u8 reserved_at_40[0x8];
261 u8 fpga_qpn[0x18];
262
263 u8 reserved_at_60[0x20];
264
265 struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
266};
267
268struct mlx5_ifc_fpga_modify_qp_in_bits {
269 u8 opcode[0x10];
270 u8 reserved_at_10[0x10];
271
272 u8 reserved_at_20[0x10];
273 u8 op_mod[0x10];
274
275 u8 reserved_at_40[0x8];
276 u8 fpga_qpn[0x18];
277
278 u8 field_select[0x20];
279
280 struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
281};
282
283struct mlx5_ifc_fpga_modify_qp_out_bits {
284 u8 status[0x8];
285 u8 reserved_at_8[0x18];
286
287 u8 syndrome[0x20];
288
289 u8 reserved_at_40[0x40];
290};
291
292struct mlx5_ifc_fpga_query_qp_in_bits {
293 u8 opcode[0x10];
294 u8 reserved_at_10[0x10];
295
296 u8 reserved_at_20[0x10];
297 u8 op_mod[0x10];
298
299 u8 reserved_at_40[0x8];
300 u8 fpga_qpn[0x18];
301
302 u8 reserved_at_60[0x20];
303};
304
305struct mlx5_ifc_fpga_query_qp_out_bits {
306 u8 status[0x8];
307 u8 reserved_at_8[0x18];
308
309 u8 syndrome[0x20];
310
311 u8 reserved_at_40[0x40];
312
313 struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
314};
315
316struct mlx5_ifc_fpga_query_qp_counters_in_bits {
317 u8 opcode[0x10];
318 u8 reserved_at_10[0x10];
319
320 u8 reserved_at_20[0x10];
321 u8 op_mod[0x10];
322
323 u8 clear[0x1];
324 u8 reserved_at_41[0x7];
325 u8 fpga_qpn[0x18];
326
327 u8 reserved_at_60[0x20];
328};
329
330struct mlx5_ifc_fpga_query_qp_counters_out_bits {
331 u8 status[0x8];
332 u8 reserved_at_8[0x18];
333
334 u8 syndrome[0x20];
335
336 u8 reserved_at_40[0x40];
337
338 u8 rx_ack_packets[0x40];
339
340 u8 rx_send_packets[0x40];
341
342 u8 tx_ack_packets[0x40];
343
344 u8 tx_send_packets[0x40];
345
346 u8 rx_total_drop[0x40];
347
348 u8 reserved_at_1c0[0x1c0];
349};
350
351struct mlx5_ifc_fpga_destroy_qp_in_bits {
352 u8 opcode[0x10];
353 u8 reserved_at_10[0x10];
354
355 u8 reserved_at_20[0x10];
356 u8 op_mod[0x10];
357
358 u8 reserved_at_40[0x8];
359 u8 fpga_qpn[0x18];
360
361 u8 reserved_at_60[0x20];
362};
363
364struct mlx5_ifc_fpga_destroy_qp_out_bits {
365 u8 status[0x8];
366 u8 reserved_at_8[0x18];
367
368 u8 syndrome[0x20];
369
370 u8 reserved_at_40[0x40];
371};
372
373struct mlx5_ifc_ipsec_extended_cap_bits {
374 u8 encapsulation[0x20];
375
376 u8 reserved_0[0x15];
377 u8 ipv4_fragment[0x1];
378 u8 ipv6[0x1];
379 u8 esn[0x1];
380 u8 lso[0x1];
381 u8 transport_and_tunnel_mode[0x1];
382 u8 tunnel_mode[0x1];
383 u8 transport_mode[0x1];
384 u8 ah_esp[0x1];
385 u8 esp[0x1];
386 u8 ah[0x1];
387 u8 ipv4_options[0x1];
388
389 u8 auth_alg[0x20];
390
391 u8 enc_alg[0x20];
392
393 u8 sa_cap[0x20];
394
395 u8 reserved_1[0x10];
396 u8 number_of_ipsec_counters[0x10];
397
398 u8 ipsec_counters_addr_low[0x20];
399 u8 ipsec_counters_addr_high[0x20];
400};
401
402struct mlx5_ifc_ipsec_counters_bits {
403 u8 dec_in_packets[0x40];
404
405 u8 dec_out_packets[0x40];
406
407 u8 dec_bypass_packets[0x40];
408
409 u8 enc_in_packets[0x40];
410
411 u8 enc_out_packets[0x40];
412
413 u8 enc_bypass_packets[0x40];
414
415 u8 drop_dec_packets[0x40];
416
417 u8 failed_auth_dec_packets[0x40];
418
419 u8 drop_enc_packets[0x40];
420
421 u8 success_add_sa[0x40];
422
423 u8 fail_add_sa[0x40];
424
425 u8 success_delete_sa[0x40];
426
427 u8 fail_delete_sa[0x40];
428
429 u8 dropped_cmd[0x40];
430};
431
432#endif /* MLX5_IFC_FPGA_H */
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h
index e527732fb31b..c57d4b7de3a8 100644
--- a/include/linux/mlx5/port.h
+++ b/include/linux/mlx5/port.h
@@ -92,6 +92,19 @@ enum mlx5e_link_mode {
92 MLX5E_LINK_MODES_NUMBER, 92 MLX5E_LINK_MODES_NUMBER,
93}; 93};
94 94
95enum mlx5e_connector_type {
96 MLX5E_PORT_UNKNOWN = 0,
97 MLX5E_PORT_NONE = 1,
98 MLX5E_PORT_TP = 2,
99 MLX5E_PORT_AUI = 3,
100 MLX5E_PORT_BNC = 4,
101 MLX5E_PORT_MII = 5,
102 MLX5E_PORT_FIBRE = 6,
103 MLX5E_PORT_DA = 7,
104 MLX5E_PORT_OTHER = 8,
105 MLX5E_CONNECTOR_TYPE_NUMBER,
106};
107
95#define MLX5E_PROT_MASK(link_mode) (1 << link_mode) 108#define MLX5E_PROT_MASK(link_mode) (1 << link_mode)
96 109
97#define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF 110#define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index bef80d0a0e30..6f41270d80c0 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -225,10 +225,20 @@ enum {
225 MLX5_ETH_WQE_INSERT_VLAN = 1 << 15, 225 MLX5_ETH_WQE_INSERT_VLAN = 1 << 15,
226}; 226};
227 227
228enum {
229 MLX5_ETH_WQE_SWP_INNER_L3_IPV6 = 1 << 0,
230 MLX5_ETH_WQE_SWP_INNER_L4_UDP = 1 << 1,
231 MLX5_ETH_WQE_SWP_OUTER_L3_IPV6 = 1 << 4,
232 MLX5_ETH_WQE_SWP_OUTER_L4_UDP = 1 << 5,
233};
234
228struct mlx5_wqe_eth_seg { 235struct mlx5_wqe_eth_seg {
229 u8 rsvd0[4]; 236 u8 swp_outer_l4_offset;
237 u8 swp_outer_l3_offset;
238 u8 swp_inner_l4_offset;
239 u8 swp_inner_l3_offset;
230 u8 cs_flags; 240 u8 cs_flags;
231 u8 rsvd1; 241 u8 swp_flags;
232 __be16 mss; 242 __be16 mss;
233 __be32 rsvd2; 243 __be32 rsvd2;
234 union { 244 union {
@@ -569,8 +579,6 @@ int mlx5_core_alloc_q_counter(struct mlx5_core_dev *dev, u16 *counter_id);
569int mlx5_core_dealloc_q_counter(struct mlx5_core_dev *dev, u16 counter_id); 579int mlx5_core_dealloc_q_counter(struct mlx5_core_dev *dev, u16 counter_id);
570int mlx5_core_query_q_counter(struct mlx5_core_dev *dev, u16 counter_id, 580int mlx5_core_query_q_counter(struct mlx5_core_dev *dev, u16 counter_id,
571 int reset, void *out, int out_size); 581 int reset, void *out, int out_size);
572int mlx5_core_query_out_of_buffer(struct mlx5_core_dev *dev, u16 counter_id,
573 u32 *out_of_buffer);
574 582
575static inline const char *mlx5_qp_type_str(int type) 583static inline const char *mlx5_qp_type_str(int type)
576{ 584{
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 24e88b33a06c..e48ee2eaaa3e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -807,8 +807,10 @@ enum xdp_netdev_command {
807 * when it is no longer used. 807 * when it is no longer used.
808 */ 808 */
809 XDP_SETUP_PROG, 809 XDP_SETUP_PROG,
810 XDP_SETUP_PROG_HW,
810 /* Check if a bpf program is set on the device. The callee should 811 /* Check if a bpf program is set on the device. The callee should
811 * return true if a program is currently attached and running. 812 * set @prog_attached to one of XDP_ATTACHED_* values, note that "true"
813 * is equivalent to XDP_ATTACHED_DRV.
812 */ 814 */
813 XDP_QUERY_PROG, 815 XDP_QUERY_PROG,
814}; 816};
@@ -820,11 +822,15 @@ struct netdev_xdp {
820 union { 822 union {
821 /* XDP_SETUP_PROG */ 823 /* XDP_SETUP_PROG */
822 struct { 824 struct {
825 u32 flags;
823 struct bpf_prog *prog; 826 struct bpf_prog *prog;
824 struct netlink_ext_ack *extack; 827 struct netlink_ext_ack *extack;
825 }; 828 };
826 /* XDP_QUERY_PROG */ 829 /* XDP_QUERY_PROG */
827 bool prog_attached; 830 struct {
831 u8 prog_attached;
832 u32 prog_id;
833 };
828 }; 834 };
829}; 835};
830 836
@@ -971,7 +977,7 @@ struct xfrmdev_ops {
971 * with PF and querying it may introduce a theoretical security risk. 977 * with PF and querying it may introduce a theoretical security risk.
972 * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting); 978 * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
973 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 979 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
974 * int (*ndo_setup_tc)(struct net_device *dev, u32 handle, 980 * int (*ndo_setup_tc)(struct net_device *dev, u32 handle, u32 chain_index,
975 * __be16 protocol, struct tc_to_netdev *tc); 981 * __be16 protocol, struct tc_to_netdev *tc);
976 * Called to setup any 'tc' scheduler, classifier or action on @dev. 982 * Called to setup any 'tc' scheduler, classifier or action on @dev.
977 * This is always called from the stack with the rtnl lock held and netif 983 * This is always called from the stack with the rtnl lock held and netif
@@ -1108,12 +1114,6 @@ struct xfrmdev_ops {
1108 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing 1114 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing
1109 * the station and priv is the structure returned by the add 1115 * the station and priv is the structure returned by the add
1110 * operation. 1116 * operation.
1111 * netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *skb,
1112 * struct net_device *dev,
1113 * void *priv);
1114 * Callback to use for xmit over the accelerated station. This
1115 * is used in place of ndo_start_xmit on accelerated net
1116 * devices.
1117 * int (*ndo_set_tx_maxrate)(struct net_device *dev, 1117 * int (*ndo_set_tx_maxrate)(struct net_device *dev,
1118 * int queue_index, u32 maxrate); 1118 * int queue_index, u32 maxrate);
1119 * Called when a user wants to set a max-rate limitation of specific 1119 * Called when a user wants to set a max-rate limitation of specific
@@ -1221,7 +1221,7 @@ struct net_device_ops {
1221 struct net_device *dev, 1221 struct net_device *dev,
1222 int vf, bool setting); 1222 int vf, bool setting);
1223 int (*ndo_setup_tc)(struct net_device *dev, 1223 int (*ndo_setup_tc)(struct net_device *dev,
1224 u32 handle, 1224 u32 handle, u32 chain_index,
1225 __be16 protocol, 1225 __be16 protocol,
1226 struct tc_to_netdev *tc); 1226 struct tc_to_netdev *tc);
1227#if IS_ENABLED(CONFIG_FCOE) 1227#if IS_ENABLED(CONFIG_FCOE)
@@ -1310,9 +1310,6 @@ struct net_device_ops {
1310 void (*ndo_dfwd_del_station)(struct net_device *pdev, 1310 void (*ndo_dfwd_del_station)(struct net_device *pdev,
1311 void *priv); 1311 void *priv);
1312 1312
1313 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb,
1314 struct net_device *dev,
1315 void *priv);
1316 int (*ndo_get_lock_subclass)(struct net_device *dev); 1313 int (*ndo_get_lock_subclass)(struct net_device *dev);
1317 int (*ndo_set_tx_maxrate)(struct net_device *dev, 1314 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1318 int queue_index, 1315 int queue_index,
@@ -1824,7 +1821,7 @@ struct net_device {
1824#ifdef CONFIG_NET_SCHED 1821#ifdef CONFIG_NET_SCHED
1825 DECLARE_HASHTABLE (qdisc_hash, 4); 1822 DECLARE_HASHTABLE (qdisc_hash, 4);
1826#endif 1823#endif
1827 unsigned long tx_queue_len; 1824 unsigned int tx_queue_len;
1828 spinlock_t tx_global_lock; 1825 spinlock_t tx_global_lock;
1829 int watchdog_timeo; 1826 int watchdog_timeo;
1830 1827
@@ -2457,6 +2454,7 @@ static inline int dev_recursion_level(void)
2457struct net_device *dev_get_by_index(struct net *net, int ifindex); 2454struct net_device *dev_get_by_index(struct net *net, int ifindex);
2458struct net_device *__dev_get_by_index(struct net *net, int ifindex); 2455struct net_device *__dev_get_by_index(struct net *net, int ifindex);
2459struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 2456struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
2457struct net_device *dev_get_by_napi_id(unsigned int napi_id);
2460int netdev_get_name(struct net *net, char *name, int ifindex); 2458int netdev_get_name(struct net *net, char *name, int ifindex);
2461int dev_restart(struct net_device *dev); 2459int dev_restart(struct net_device *dev);
2462int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); 2460int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
@@ -2574,9 +2572,7 @@ static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
2574 if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \ 2572 if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
2575 __ret = __skb_gro_checksum_validate_complete(skb, \ 2573 __ret = __skb_gro_checksum_validate_complete(skb, \
2576 compute_pseudo(skb, proto)); \ 2574 compute_pseudo(skb, proto)); \
2577 if (__ret) \ 2575 if (!__ret) \
2578 __skb_mark_checksum_bad(skb); \
2579 else \
2580 skb_gro_incr_csum_unnecessary(skb); \ 2576 skb_gro_incr_csum_unnecessary(skb); \
2581 __ret; \ 2577 __ret; \
2582}) 2578})
@@ -3304,7 +3300,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
3304typedef int (*xdp_op_t)(struct net_device *dev, struct netdev_xdp *xdp); 3300typedef int (*xdp_op_t)(struct net_device *dev, struct netdev_xdp *xdp);
3305int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, 3301int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
3306 int fd, u32 flags); 3302 int fd, u32 flags);
3307bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op); 3303u8 __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, u32 *prog_id);
3308 3304
3309int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 3305int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
3310int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 3306int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
@@ -3932,6 +3928,10 @@ void netdev_rss_key_fill(void *buffer, size_t len);
3932 3928
3933int dev_get_nest_level(struct net_device *dev); 3929int dev_get_nest_level(struct net_device *dev);
3934int skb_checksum_help(struct sk_buff *skb); 3930int skb_checksum_help(struct sk_buff *skb);
3931int skb_crc32c_csum_help(struct sk_buff *skb);
3932int skb_csum_hwoffload_help(struct sk_buff *skb,
3933 const netdev_features_t features);
3934
3935struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 3935struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
3936 netdev_features_t features, bool tx_path); 3936 netdev_features_t features, bool tx_path);
3937struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 3937struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 996711d8a7b4..41d04e9d088a 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -1,7 +1,6 @@
1#ifndef _NFNETLINK_H 1#ifndef _NFNETLINK_H
2#define _NFNETLINK_H 2#define _NFNETLINK_H
3 3
4
5#include <linux/netlink.h> 4#include <linux/netlink.h>
6#include <linux/capability.h> 5#include <linux/capability.h>
7#include <net/netlink.h> 6#include <net/netlink.h>
@@ -10,13 +9,16 @@
10struct nfnl_callback { 9struct nfnl_callback {
11 int (*call)(struct net *net, struct sock *nl, struct sk_buff *skb, 10 int (*call)(struct net *net, struct sock *nl, struct sk_buff *skb,
12 const struct nlmsghdr *nlh, 11 const struct nlmsghdr *nlh,
13 const struct nlattr * const cda[]); 12 const struct nlattr * const cda[],
13 struct netlink_ext_ack *extack);
14 int (*call_rcu)(struct net *net, struct sock *nl, struct sk_buff *skb, 14 int (*call_rcu)(struct net *net, struct sock *nl, struct sk_buff *skb,
15 const struct nlmsghdr *nlh, 15 const struct nlmsghdr *nlh,
16 const struct nlattr * const cda[]); 16 const struct nlattr * const cda[],
17 struct netlink_ext_ack *extack);
17 int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb, 18 int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb,
18 const struct nlmsghdr *nlh, 19 const struct nlmsghdr *nlh,
19 const struct nlattr * const cda[]); 20 const struct nlattr * const cda[],
21 struct netlink_ext_ack *extack);
20 const struct nla_policy *policy; /* netlink attribute policy */ 22 const struct nla_policy *policy; /* netlink attribute policy */
21 const u_int16_t attr_count; /* number of nlattr's */ 23 const u_int16_t attr_count; /* number of nlattr's */
22}; 24};
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index e0cbf17af780..2c2a5514b0df 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -122,8 +122,6 @@ extern unsigned int ebt_do_table(struct sk_buff *skb,
122#define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS)) 122#define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS))
123/* Clear the bit in the hook mask that tells if the rule is on a base chain */ 123/* Clear the bit in the hook mask that tells if the rule is on a base chain */
124#define CLEAR_BASE_CHAIN_BIT (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS)) 124#define CLEAR_BASE_CHAIN_BIT (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS))
125/* True if the target is not a standard target */
126#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)
127 125
128static inline bool ebt_invalid_target(int target) 126static inline bool ebt_invalid_target(int target)
129{ 127{
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 5fff5ba5964e..8664fd26eb5d 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -97,6 +97,21 @@ struct netlink_ext_ack {
97#define NL_SET_ERR_MSG_MOD(extack, msg) \ 97#define NL_SET_ERR_MSG_MOD(extack, msg) \
98 NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg) 98 NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg)
99 99
100#define NL_SET_BAD_ATTR(extack, attr) do { \
101 if ((extack)) \
102 (extack)->bad_attr = (attr); \
103} while (0)
104
105#define NL_SET_ERR_MSG_ATTR(extack, attr, msg) do { \
106 static const char __msg[] = (msg); \
107 struct netlink_ext_ack *__extack = (extack); \
108 \
109 if (__extack) { \
110 __extack->_msg = __msg; \
111 __extack->bad_attr = (attr); \
112 } \
113} while (0)
114
100extern void netlink_kernel_release(struct sock *sk); 115extern void netlink_kernel_release(struct sock *sk);
101extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); 116extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
102extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 117extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 1828900c9411..27c0aaa22cb0 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -11,6 +11,7 @@
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/refcount.h>
14 15
15union inet_addr { 16union inet_addr {
16 __u32 all[4]; 17 __u32 all[4];
@@ -34,7 +35,7 @@ struct netpoll {
34}; 35};
35 36
36struct netpoll_info { 37struct netpoll_info {
37 atomic_t refcnt; 38 refcount_t refcnt;
38 39
39 struct semaphore dev_lock; 40 struct semaphore dev_lock;
40 41
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index ba35ba520487..f5db93bcd069 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -27,11 +27,33 @@ struct phy_device *of_phy_attach(struct net_device *dev,
27 phy_interface_t iface); 27 phy_interface_t iface);
28 28
29extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 29extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
30extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
31extern int of_phy_register_fixed_link(struct device_node *np); 30extern int of_phy_register_fixed_link(struct device_node *np);
32extern void of_phy_deregister_fixed_link(struct device_node *np); 31extern void of_phy_deregister_fixed_link(struct device_node *np);
33extern bool of_phy_is_fixed_link(struct device_node *np); 32extern bool of_phy_is_fixed_link(struct device_node *np);
34 33
34
35static inline int of_mdio_parse_addr(struct device *dev,
36 const struct device_node *np)
37{
38 u32 addr;
39 int ret;
40
41 ret = of_property_read_u32(np, "reg", &addr);
42 if (ret < 0) {
43 dev_err(dev, "%s has invalid PHY address\n", np->full_name);
44 return ret;
45 }
46
47 /* A PHY must have a reg property in the range [0-31] */
48 if (addr >= PHY_MAX_ADDR) {
49 dev_err(dev, "%s PHY address %i is too large\n",
50 np->full_name, addr);
51 return -EINVAL;
52 }
53
54 return addr;
55}
56
35#else /* CONFIG_OF_MDIO */ 57#else /* CONFIG_OF_MDIO */
36static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 58static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
37{ 59{
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 7d6aa29094b2..a3b873fc59e4 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -898,7 +898,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr,
898 void *context); 898 void *context);
899extern void perf_pmu_migrate_context(struct pmu *pmu, 899extern void perf_pmu_migrate_context(struct pmu *pmu,
900 int src_cpu, int dst_cpu); 900 int src_cpu, int dst_cpu);
901extern u64 perf_event_read_local(struct perf_event *event); 901int perf_event_read_local(struct perf_event *event, u64 *value);
902extern u64 perf_event_read_value(struct perf_event *event, 902extern u64 perf_event_read_value(struct perf_event *event,
903 u64 *enabled, u64 *running); 903 u64 *enabled, u64 *running);
904 904
@@ -1303,7 +1303,10 @@ static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *
1303{ 1303{
1304 return ERR_PTR(-EINVAL); 1304 return ERR_PTR(-EINVAL);
1305} 1305}
1306static inline u64 perf_event_read_local(struct perf_event *event) { return -EINVAL; } 1306static inline int perf_event_read_local(struct perf_event *event, u64 *value)
1307{
1308 return -EINVAL;
1309}
1307static inline void perf_event_print_debug(void) { } 1310static inline void perf_event_print_debug(void) { }
1308static inline int perf_event_task_disable(void) { return -EINVAL; } 1311static inline int perf_event_task_disable(void) { return -EINVAL; }
1309static inline int perf_event_task_enable(void) { return -EINVAL; } 1312static inline int perf_event_task_enable(void) { return -EINVAL; }
diff --git a/include/linux/phy.h b/include/linux/phy.h
index e76e4adbc7c7..2a9567bb8186 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -58,13 +58,13 @@
58#define PHY_IGNORE_INTERRUPT -2 58#define PHY_IGNORE_INTERRUPT -2
59 59
60#define PHY_HAS_INTERRUPT 0x00000001 60#define PHY_HAS_INTERRUPT 0x00000001
61#define PHY_HAS_MAGICANEG 0x00000002 61#define PHY_IS_INTERNAL 0x00000002
62#define PHY_IS_INTERNAL 0x00000004
63#define MDIO_DEVICE_IS_PHY 0x80000000 62#define MDIO_DEVICE_IS_PHY 0x80000000
64 63
65/* Interface Mode definitions */ 64/* Interface Mode definitions */
66typedef enum { 65typedef enum {
67 PHY_INTERFACE_MODE_NA, 66 PHY_INTERFACE_MODE_NA,
67 PHY_INTERFACE_MODE_INTERNAL,
68 PHY_INTERFACE_MODE_MII, 68 PHY_INTERFACE_MODE_MII,
69 PHY_INTERFACE_MODE_GMII, 69 PHY_INTERFACE_MODE_GMII,
70 PHY_INTERFACE_MODE_SGMII, 70 PHY_INTERFACE_MODE_SGMII,
@@ -84,6 +84,9 @@ typedef enum {
84 PHY_INTERFACE_MODE_1000BASEX, 84 PHY_INTERFACE_MODE_1000BASEX,
85 PHY_INTERFACE_MODE_2500BASEX, 85 PHY_INTERFACE_MODE_2500BASEX,
86 PHY_INTERFACE_MODE_RXAUI, 86 PHY_INTERFACE_MODE_RXAUI,
87 PHY_INTERFACE_MODE_XAUI,
88 /* 10GBASE-KR, XFI, SFI - single lane 10G Serdes */
89 PHY_INTERFACE_MODE_10GKR,
87 PHY_INTERFACE_MODE_MAX, 90 PHY_INTERFACE_MODE_MAX,
88} phy_interface_t; 91} phy_interface_t;
89 92
@@ -112,6 +115,8 @@ static inline const char *phy_modes(phy_interface_t interface)
112 switch (interface) { 115 switch (interface) {
113 case PHY_INTERFACE_MODE_NA: 116 case PHY_INTERFACE_MODE_NA:
114 return ""; 117 return "";
118 case PHY_INTERFACE_MODE_INTERNAL:
119 return "internal";
115 case PHY_INTERFACE_MODE_MII: 120 case PHY_INTERFACE_MODE_MII:
116 return "mii"; 121 return "mii";
117 case PHY_INTERFACE_MODE_GMII: 122 case PHY_INTERFACE_MODE_GMII:
@@ -150,6 +155,10 @@ static inline const char *phy_modes(phy_interface_t interface)
150 return "2500base-x"; 155 return "2500base-x";
151 case PHY_INTERFACE_MODE_RXAUI: 156 case PHY_INTERFACE_MODE_RXAUI:
152 return "rxaui"; 157 return "rxaui";
158 case PHY_INTERFACE_MODE_XAUI:
159 return "xaui";
160 case PHY_INTERFACE_MODE_10GKR:
161 return "10gbase-kr";
153 default: 162 default:
154 return "unknown"; 163 return "unknown";
155 } 164 }
@@ -220,10 +229,8 @@ struct mii_bus {
220 229
221 /* GPIO reset pulse width in microseconds */ 230 /* GPIO reset pulse width in microseconds */
222 int reset_delay_us; 231 int reset_delay_us;
223 /* Number of reset GPIOs */ 232 /* RESET GPIO descriptor pointer */
224 int num_reset_gpios; 233 struct gpio_desc *reset_gpiod;
225 /* Array of RESET GPIO descriptors */
226 struct gpio_desc **reset_gpiod;
227}; 234};
228#define to_mii_bus(d) container_of(d, struct mii_bus, dev) 235#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
229 236
@@ -364,6 +371,8 @@ struct phy_c45_device_ids {
364 * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc. 371 * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc.
365 * has_fixups: Set to true if this phy has fixups/quirks. 372 * has_fixups: Set to true if this phy has fixups/quirks.
366 * suspended: Set to true if this phy has been suspended successfully. 373 * suspended: Set to true if this phy has been suspended successfully.
374 * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
375 * loopback_enabled: Set true if this phy has been loopbacked successfully.
367 * state: state of the PHY for management purposes 376 * state: state of the PHY for management purposes
368 * dev_flags: Device-specific flags used by the PHY driver. 377 * dev_flags: Device-specific flags used by the PHY driver.
369 * link_timeout: The number of timer firings to wait before the 378 * link_timeout: The number of timer firings to wait before the
@@ -400,6 +409,8 @@ struct phy_device {
400 bool is_pseudo_fixed_link; 409 bool is_pseudo_fixed_link;
401 bool has_fixups; 410 bool has_fixups;
402 bool suspended; 411 bool suspended;
412 bool sysfs_links;
413 bool loopback_enabled;
403 414
404 enum phy_state state; 415 enum phy_state state;
405 416
@@ -639,6 +650,7 @@ struct phy_driver {
639 int (*set_tunable)(struct phy_device *dev, 650 int (*set_tunable)(struct phy_device *dev,
640 struct ethtool_tunable *tuna, 651 struct ethtool_tunable *tuna,
641 const void *data); 652 const void *data);
653 int (*set_loopback)(struct phy_device *dev, bool enable);
642}; 654};
643#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ 655#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
644 struct phy_driver, mdiodrv) 656 struct phy_driver, mdiodrv)
@@ -717,14 +729,24 @@ static inline bool phy_is_internal(struct phy_device *phydev)
717} 729}
718 730
719/** 731/**
732 * phy_interface_mode_is_rgmii - Convenience function for testing if a
733 * PHY interface mode is RGMII (all variants)
734 * @mode: the phy_interface_t enum
735 */
736static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode)
737{
738 return mode >= PHY_INTERFACE_MODE_RGMII &&
739 mode <= PHY_INTERFACE_MODE_RGMII_TXID;
740};
741
742/**
720 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface 743 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
721 * is RGMII (all variants) 744 * is RGMII (all variants)
722 * @phydev: the phy_device struct 745 * @phydev: the phy_device struct
723 */ 746 */
724static inline bool phy_interface_is_rgmii(struct phy_device *phydev) 747static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
725{ 748{
726 return phydev->interface >= PHY_INTERFACE_MODE_RGMII && 749 return phy_interface_mode_is_rgmii(phydev->interface);
727 phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
728}; 750};
729 751
730/* 752/*
@@ -774,6 +796,7 @@ void phy_device_remove(struct phy_device *phydev);
774int phy_init_hw(struct phy_device *phydev); 796int phy_init_hw(struct phy_device *phydev);
775int phy_suspend(struct phy_device *phydev); 797int phy_suspend(struct phy_device *phydev);
776int phy_resume(struct phy_device *phydev); 798int phy_resume(struct phy_device *phydev);
799int phy_loopback(struct phy_device *phydev, bool enable);
777struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, 800struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,
778 phy_interface_t interface); 801 phy_interface_t interface);
779struct phy_device *phy_find_first(struct mii_bus *bus); 802struct phy_device *phy_find_first(struct mii_bus *bus);
@@ -793,6 +816,7 @@ int phy_start_aneg(struct phy_device *phydev);
793int phy_aneg_done(struct phy_device *phydev); 816int phy_aneg_done(struct phy_device *phydev);
794 817
795int phy_stop_interrupts(struct phy_device *phydev); 818int phy_stop_interrupts(struct phy_device *phydev);
819int phy_restart_aneg(struct phy_device *phydev);
796 820
797static inline int phy_read_status(struct phy_device *phydev) 821static inline int phy_read_status(struct phy_device *phydev)
798{ 822{
@@ -816,6 +840,8 @@ static inline const char *phydev_name(const struct phy_device *phydev)
816void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) 840void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
817 __printf(2, 3); 841 __printf(2, 3);
818void phy_attached_info(struct phy_device *phydev); 842void phy_attached_info(struct phy_device *phydev);
843
844/* Clause 22 PHY */
819int genphy_config_init(struct phy_device *phydev); 845int genphy_config_init(struct phy_device *phydev);
820int genphy_setup_forced(struct phy_device *phydev); 846int genphy_setup_forced(struct phy_device *phydev);
821int genphy_restart_aneg(struct phy_device *phydev); 847int genphy_restart_aneg(struct phy_device *phydev);
@@ -825,11 +851,22 @@ int genphy_update_link(struct phy_device *phydev);
825int genphy_read_status(struct phy_device *phydev); 851int genphy_read_status(struct phy_device *phydev);
826int genphy_suspend(struct phy_device *phydev); 852int genphy_suspend(struct phy_device *phydev);
827int genphy_resume(struct phy_device *phydev); 853int genphy_resume(struct phy_device *phydev);
854int genphy_loopback(struct phy_device *phydev, bool enable);
828int genphy_soft_reset(struct phy_device *phydev); 855int genphy_soft_reset(struct phy_device *phydev);
829static inline int genphy_no_soft_reset(struct phy_device *phydev) 856static inline int genphy_no_soft_reset(struct phy_device *phydev)
830{ 857{
831 return 0; 858 return 0;
832} 859}
860
861/* Clause 45 PHY */
862int genphy_c45_restart_aneg(struct phy_device *phydev);
863int genphy_c45_aneg_done(struct phy_device *phydev);
864int genphy_c45_read_link(struct phy_device *phydev, u32 mmd_mask);
865int genphy_c45_read_lpa(struct phy_device *phydev);
866int genphy_c45_read_pma(struct phy_device *phydev);
867int genphy_c45_pma_setup_forced(struct phy_device *phydev);
868int genphy_c45_an_disable_aneg(struct phy_device *phydev);
869
833void phy_driver_unregister(struct phy_driver *drv); 870void phy_driver_unregister(struct phy_driver *drv);
834void phy_drivers_unregister(struct phy_driver *drv, int n); 871void phy_drivers_unregister(struct phy_driver *drv, int n);
835int phy_driver_register(struct phy_driver *new_driver, struct module *owner); 872int phy_driver_register(struct phy_driver *new_driver, struct module *owner);
@@ -843,9 +880,8 @@ void phy_start_machine(struct phy_device *phydev);
843void phy_stop_machine(struct phy_device *phydev); 880void phy_stop_machine(struct phy_device *phydev);
844void phy_trigger_machine(struct phy_device *phydev, bool sync); 881void phy_trigger_machine(struct phy_device *phydev, bool sync);
845int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); 882int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
846int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); 883void phy_ethtool_ksettings_get(struct phy_device *phydev,
847int phy_ethtool_ksettings_get(struct phy_device *phydev, 884 struct ethtool_link_ksettings *cmd);
848 struct ethtool_link_ksettings *cmd);
849int phy_ethtool_ksettings_set(struct phy_device *phydev, 885int phy_ethtool_ksettings_set(struct phy_device *phydev,
850 const struct ethtool_link_ksettings *cmd); 886 const struct ethtool_link_ksettings *cmd);
851int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); 887int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
diff --git a/include/linux/platform_data/microchip-ksz.h b/include/linux/platform_data/microchip-ksz.h
new file mode 100644
index 000000000000..84789ca634aa
--- /dev/null
+++ b/include/linux/platform_data/microchip-ksz.h
@@ -0,0 +1,29 @@
1/*
2 * Microchip KSZ series switch platform data
3 *
4 * Copyright (C) 2017
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef __MICROCHIP_KSZ_H
20#define __MICROCHIP_KSZ_H
21
22#include <linux/kernel.h>
23
24struct ksz_platform_data {
25 u32 chip_id;
26 u16 enabled_ports;
27};
28
29#endif
diff --git a/include/linux/platform_data/nfcmrvl.h b/include/linux/platform_data/nfcmrvl.h
index a6f9d633f5be..9e75ac8d19be 100644
--- a/include/linux/platform_data/nfcmrvl.h
+++ b/include/linux/platform_data/nfcmrvl.h
@@ -23,7 +23,7 @@ struct nfcmrvl_platform_data {
23 */ 23 */
24 24
25 /* GPIO that is wired to RESET_N signal */ 25 /* GPIO that is wired to RESET_N signal */
26 unsigned int reset_n_io; 26 int reset_n_io;
27 /* Tell if transport is muxed in HCI one */ 27 /* Tell if transport is muxed in HCI one */
28 unsigned int hci_muxed; 28 unsigned int hci_muxed;
29 29
diff --git a/include/linux/platform_data/st-nci.h b/include/linux/platform_data/st-nci.h
deleted file mode 100644
index f6494b347c06..000000000000
--- a/include/linux/platform_data/st-nci.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Driver include for ST NCI NFC chip family.
3 *
4 * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef _ST_NCI_H_
20#define _ST_NCI_H_
21
22#define ST_NCI_DRIVER_NAME "st_nci"
23
24struct st_nci_nfc_platform_data {
25 unsigned int gpio_reset;
26 unsigned int irq_polarity;
27 bool is_ese_present;
28 bool is_uicc_present;
29};
30
31#endif /* _ST_NCI_H_ */
diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h
index 6b2e0dd88569..d8c97ec8a8e6 100644
--- a/include/linux/ptr_ring.h
+++ b/include/linux/ptr_ring.h
@@ -278,6 +278,22 @@ static inline void *__ptr_ring_consume(struct ptr_ring *r)
278 return ptr; 278 return ptr;
279} 279}
280 280
281static inline int __ptr_ring_consume_batched(struct ptr_ring *r,
282 void **array, int n)
283{
284 void *ptr;
285 int i;
286
287 for (i = 0; i < n; i++) {
288 ptr = __ptr_ring_consume(r);
289 if (!ptr)
290 break;
291 array[i] = ptr;
292 }
293
294 return i;
295}
296
281/* 297/*
282 * Note: resize (below) nests producer lock within consumer lock, so if you 298 * Note: resize (below) nests producer lock within consumer lock, so if you
283 * call this in interrupt or BH context, you must disable interrupts/BH when 299 * call this in interrupt or BH context, you must disable interrupts/BH when
@@ -328,6 +344,55 @@ static inline void *ptr_ring_consume_bh(struct ptr_ring *r)
328 return ptr; 344 return ptr;
329} 345}
330 346
347static inline int ptr_ring_consume_batched(struct ptr_ring *r,
348 void **array, int n)
349{
350 int ret;
351
352 spin_lock(&r->consumer_lock);
353 ret = __ptr_ring_consume_batched(r, array, n);
354 spin_unlock(&r->consumer_lock);
355
356 return ret;
357}
358
359static inline int ptr_ring_consume_batched_irq(struct ptr_ring *r,
360 void **array, int n)
361{
362 int ret;
363
364 spin_lock_irq(&r->consumer_lock);
365 ret = __ptr_ring_consume_batched(r, array, n);
366 spin_unlock_irq(&r->consumer_lock);
367
368 return ret;
369}
370
371static inline int ptr_ring_consume_batched_any(struct ptr_ring *r,
372 void **array, int n)
373{
374 unsigned long flags;
375 int ret;
376
377 spin_lock_irqsave(&r->consumer_lock, flags);
378 ret = __ptr_ring_consume_batched(r, array, n);
379 spin_unlock_irqrestore(&r->consumer_lock, flags);
380
381 return ret;
382}
383
384static inline int ptr_ring_consume_batched_bh(struct ptr_ring *r,
385 void **array, int n)
386{
387 int ret;
388
389 spin_lock_bh(&r->consumer_lock);
390 ret = __ptr_ring_consume_batched(r, array, n);
391 spin_unlock_bh(&r->consumer_lock);
392
393 return ret;
394}
395
331/* Cast to structure type and call a function without discarding from FIFO. 396/* Cast to structure type and call a function without discarding from FIFO.
332 * Function must return a value. 397 * Function must return a value.
333 * Callers must take consumer_lock. 398 * Callers must take consumer_lock.
@@ -403,6 +468,61 @@ static inline int ptr_ring_init(struct ptr_ring *r, int size, gfp_t gfp)
403 return 0; 468 return 0;
404} 469}
405 470
471/*
472 * Return entries into ring. Destroy entries that don't fit.
473 *
474 * Note: this is expected to be a rare slow path operation.
475 *
476 * Note: producer lock is nested within consumer lock, so if you
477 * resize you must make sure all uses nest correctly.
478 * In particular if you consume ring in interrupt or BH context, you must
479 * disable interrupts/BH when doing so.
480 */
481static inline void ptr_ring_unconsume(struct ptr_ring *r, void **batch, int n,
482 void (*destroy)(void *))
483{
484 unsigned long flags;
485 int head;
486
487 spin_lock_irqsave(&r->consumer_lock, flags);
488 spin_lock(&r->producer_lock);
489
490 if (!r->size)
491 goto done;
492
493 /*
494 * Clean out buffered entries (for simplicity). This way following code
495 * can test entries for NULL and if not assume they are valid.
496 */
497 head = r->consumer_head - 1;
498 while (likely(head >= r->consumer_tail))
499 r->queue[head--] = NULL;
500 r->consumer_tail = r->consumer_head;
501
502 /*
503 * Go over entries in batch, start moving head back and copy entries.
504 * Stop when we run into previously unconsumed entries.
505 */
506 while (n) {
507 head = r->consumer_head - 1;
508 if (head < 0)
509 head = r->size - 1;
510 if (r->queue[head]) {
511 /* This batch entry will have to be destroyed. */
512 goto done;
513 }
514 r->queue[head] = batch[--n];
515 r->consumer_tail = r->consumer_head = head;
516 }
517
518done:
519 /* Destroy all entries left in the batch. */
520 while (n)
521 destroy(batch[--n]);
522 spin_unlock(&r->producer_lock);
523 spin_unlock_irqrestore(&r->consumer_lock, flags);
524}
525
406static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue, 526static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue,
407 int size, gfp_t gfp, 527 int size, gfp_t gfp,
408 void (*destroy)(void *)) 528 void (*destroy)(void *))
diff --git a/include/linux/qed/common_hsi.h b/include/linux/qed/common_hsi.h
index fbab6e0514f0..39e2a2ac2471 100644
--- a/include/linux/qed/common_hsi.h
+++ b/include/linux/qed/common_hsi.h
@@ -38,6 +38,8 @@
38#include <linux/slab.h> 38#include <linux/slab.h>
39 39
40/* dma_addr_t manip */ 40/* dma_addr_t manip */
41#define PTR_LO(x) ((u32)(((uintptr_t)(x)) & 0xffffffff))
42#define PTR_HI(x) ((u32)((((uintptr_t)(x)) >> 16) >> 16))
41#define DMA_LO_LE(x) cpu_to_le32(lower_32_bits(x)) 43#define DMA_LO_LE(x) cpu_to_le32(lower_32_bits(x))
42#define DMA_HI_LE(x) cpu_to_le32(upper_32_bits(x)) 44#define DMA_HI_LE(x) cpu_to_le32(upper_32_bits(x))
43#define DMA_REGPAIR_LE(x, val) do { \ 45#define DMA_REGPAIR_LE(x, val) do { \
@@ -96,12 +98,12 @@
96 98
97#define CORE_SPQE_PAGE_SIZE_BYTES 4096 99#define CORE_SPQE_PAGE_SIZE_BYTES 4096
98 100
99#define MAX_NUM_LL2_RX_QUEUES 32 101#define MAX_NUM_LL2_RX_QUEUES 48
100#define MAX_NUM_LL2_TX_STATS_COUNTERS 32 102#define MAX_NUM_LL2_TX_STATS_COUNTERS 48
101 103
102#define FW_MAJOR_VERSION 8 104#define FW_MAJOR_VERSION 8
103#define FW_MINOR_VERSION 15 105#define FW_MINOR_VERSION 20
104#define FW_REVISION_VERSION 3 106#define FW_REVISION_VERSION 0
105#define FW_ENGINEERING_VERSION 0 107#define FW_ENGINEERING_VERSION 0
106 108
107/***********************/ 109/***********************/
@@ -181,6 +183,14 @@
181 183
182#define CDU_VF_FL_SEG_TYPE_OFFSET_REG_TYPE_SHIFT (12) 184#define CDU_VF_FL_SEG_TYPE_OFFSET_REG_TYPE_SHIFT (12)
183#define CDU_VF_FL_SEG_TYPE_OFFSET_REG_OFFSET_MASK (0xfff) 185#define CDU_VF_FL_SEG_TYPE_OFFSET_REG_OFFSET_MASK (0xfff)
186
187#define CDU_CONTEXT_VALIDATION_CFG_ENABLE_SHIFT (0)
188#define CDU_CONTEXT_VALIDATION_CFG_VALIDATION_TYPE_SHIFT (1)
189#define CDU_CONTEXT_VALIDATION_CFG_USE_TYPE (2)
190#define CDU_CONTEXT_VALIDATION_CFG_USE_REGION (3)
191#define CDU_CONTEXT_VALIDATION_CFG_USE_CID (4)
192#define CDU_CONTEXT_VALIDATION_CFG_USE_ACTIVE (5)
193
184/*****************/ 194/*****************/
185/* DQ CONSTANTS */ 195/* DQ CONSTANTS */
186/*****************/ 196/*****************/
@@ -457,7 +467,6 @@
457#define PXP_BAR_DQ 1 467#define PXP_BAR_DQ 1
458 468
459/* PTT and GTT */ 469/* PTT and GTT */
460#define PXP_NUM_PF_WINDOWS 12
461#define PXP_PER_PF_ENTRY_SIZE 8 470#define PXP_PER_PF_ENTRY_SIZE 8
462#define PXP_NUM_GLOBAL_WINDOWS 243 471#define PXP_NUM_GLOBAL_WINDOWS 243
463#define PXP_GLOBAL_ENTRY_SIZE 4 472#define PXP_GLOBAL_ENTRY_SIZE 4
@@ -482,6 +491,7 @@
482#define PXP_PF_ME_OPAQUE_ADDR 0x1f8 491#define PXP_PF_ME_OPAQUE_ADDR 0x1f8
483#define PXP_PF_ME_CONCRETE_ADDR 0x1fc 492#define PXP_PF_ME_CONCRETE_ADDR 0x1fc
484 493
494#define PXP_NUM_PF_WINDOWS 12
485#define PXP_EXTERNAL_BAR_PF_WINDOW_START 0x1000 495#define PXP_EXTERNAL_BAR_PF_WINDOW_START 0x1000
486#define PXP_EXTERNAL_BAR_PF_WINDOW_NUM PXP_NUM_PF_WINDOWS 496#define PXP_EXTERNAL_BAR_PF_WINDOW_NUM PXP_NUM_PF_WINDOWS
487#define PXP_EXTERNAL_BAR_PF_WINDOW_SINGLE_SIZE 0x1000 497#define PXP_EXTERNAL_BAR_PF_WINDOW_SINGLE_SIZE 0x1000
@@ -618,16 +628,21 @@
618/*****************/ 628/*****************/
619/* PRM CONSTANTS */ 629/* PRM CONSTANTS */
620/*****************/ 630/*****************/
621#define PRM_DMA_PAD_BYTES_NUM 2 631#define PRM_DMA_PAD_BYTES_NUM 2
622/******************/ 632/*****************/
623/* SDMs CONSTANTS */ 633/* SDMs CONSTANTS */
624/******************/ 634/*****************/
625#define SDM_OP_GEN_TRIG_NONE 0 635
626#define SDM_OP_GEN_TRIG_WAKE_THREAD 1 636#define SDM_OP_GEN_TRIG_NONE 0
627#define SDM_OP_GEN_TRIG_AGG_INT 2 637#define SDM_OP_GEN_TRIG_WAKE_THREAD 1
628#define SDM_OP_GEN_TRIG_LOADER 4 638#define SDM_OP_GEN_TRIG_AGG_INT 2
629#define SDM_OP_GEN_TRIG_INDICATE_ERROR 6 639#define SDM_OP_GEN_TRIG_LOADER 4
630#define SDM_OP_GEN_TRIG_RELEASE_THREAD 7 640#define SDM_OP_GEN_TRIG_INDICATE_ERROR 6
641#define SDM_OP_GEN_TRIG_INC_ORDER_CNT 9
642
643/********************/
644/* Completion types */
645/********************/
631 646
632#define SDM_COMP_TYPE_NONE 0 647#define SDM_COMP_TYPE_NONE 0
633#define SDM_COMP_TYPE_WAKE_THREAD 1 648#define SDM_COMP_TYPE_WAKE_THREAD 1
@@ -638,10 +653,11 @@
638#define SDM_COMP_TYPE_INDICATE_ERROR 6 653#define SDM_COMP_TYPE_INDICATE_ERROR 6
639#define SDM_COMP_TYPE_RELEASE_THREAD 7 654#define SDM_COMP_TYPE_RELEASE_THREAD 7
640#define SDM_COMP_TYPE_RAM 8 655#define SDM_COMP_TYPE_RAM 8
656#define SDM_COMP_TYPE_INC_ORDER_CNT 9
641 657
642/******************/ 658/*****************/
643/* PBF CONSTANTS */ 659/* PBF Constants */
644/******************/ 660/*****************/
645 661
646/* Number of PBF command queue lines. Each line is 32B. */ 662/* Number of PBF command queue lines. Each line is 32B. */
647#define PBF_MAX_CMD_LINES 3328 663#define PBF_MAX_CMD_LINES 3328
@@ -764,7 +780,7 @@ enum protocol_type {
764 PROTOCOLID_ROCE, 780 PROTOCOLID_ROCE,
765 PROTOCOLID_CORE, 781 PROTOCOLID_CORE,
766 PROTOCOLID_ETH, 782 PROTOCOLID_ETH,
767 PROTOCOLID_RESERVED4, 783 PROTOCOLID_IWARP,
768 PROTOCOLID_RESERVED5, 784 PROTOCOLID_RESERVED5,
769 PROTOCOLID_PREROCE, 785 PROTOCOLID_PREROCE,
770 PROTOCOLID_COMMON, 786 PROTOCOLID_COMMON,
@@ -861,7 +877,7 @@ enum db_dest {
861/* Enum of doorbell DPM types */ 877/* Enum of doorbell DPM types */
862enum db_dpm_type { 878enum db_dpm_type {
863 DPM_LEGACY, 879 DPM_LEGACY,
864 DPM_ROCE, 880 DPM_RDMA,
865 DPM_L2_INLINE, 881 DPM_L2_INLINE,
866 DPM_L2_BD, 882 DPM_L2_BD,
867 MAX_DB_DPM_TYPE 883 MAX_DB_DPM_TYPE
@@ -884,8 +900,8 @@ struct db_l2_dpm_data {
884#define DB_L2_DPM_DATA_RESERVED0_SHIFT 27 900#define DB_L2_DPM_DATA_RESERVED0_SHIFT 27
885#define DB_L2_DPM_DATA_SGE_NUM_MASK 0x7 901#define DB_L2_DPM_DATA_SGE_NUM_MASK 0x7
886#define DB_L2_DPM_DATA_SGE_NUM_SHIFT 28 902#define DB_L2_DPM_DATA_SGE_NUM_SHIFT 28
887#define DB_L2_DPM_DATA_RESERVED1_MASK 0x1 903#define DB_L2_DPM_DATA_GFS_SRC_EN_MASK 0x1
888#define DB_L2_DPM_DATA_RESERVED1_SHIFT 31 904#define DB_L2_DPM_DATA_GFS_SRC_EN_SHIFT 31
889}; 905};
890 906
891/* Structure for SGE in a DPM doorbell of type DPM_L2_BD */ 907/* Structure for SGE in a DPM doorbell of type DPM_L2_BD */
@@ -931,31 +947,33 @@ struct db_pwm_addr {
931}; 947};
932 948
933/* Parameters to RoCE firmware, passed in EDPM doorbell */ 949/* Parameters to RoCE firmware, passed in EDPM doorbell */
934struct db_roce_dpm_params { 950struct db_rdma_dpm_params {
935 __le32 params; 951 __le32 params;
936#define DB_ROCE_DPM_PARAMS_SIZE_MASK 0x3F 952#define DB_RDMA_DPM_PARAMS_SIZE_MASK 0x3F
937#define DB_ROCE_DPM_PARAMS_SIZE_SHIFT 0 953#define DB_RDMA_DPM_PARAMS_SIZE_SHIFT 0
938#define DB_ROCE_DPM_PARAMS_DPM_TYPE_MASK 0x3 954#define DB_RDMA_DPM_PARAMS_DPM_TYPE_MASK 0x3
939#define DB_ROCE_DPM_PARAMS_DPM_TYPE_SHIFT 6 955#define DB_RDMA_DPM_PARAMS_DPM_TYPE_SHIFT 6
940#define DB_ROCE_DPM_PARAMS_OPCODE_MASK 0xFF 956#define DB_RDMA_DPM_PARAMS_OPCODE_MASK 0xFF
941#define DB_ROCE_DPM_PARAMS_OPCODE_SHIFT 8 957#define DB_RDMA_DPM_PARAMS_OPCODE_SHIFT 8
942#define DB_ROCE_DPM_PARAMS_WQE_SIZE_MASK 0x7FF 958#define DB_RDMA_DPM_PARAMS_WQE_SIZE_MASK 0x7FF
943#define DB_ROCE_DPM_PARAMS_WQE_SIZE_SHIFT 16 959#define DB_RDMA_DPM_PARAMS_WQE_SIZE_SHIFT 16
944#define DB_ROCE_DPM_PARAMS_RESERVED0_MASK 0x1 960#define DB_RDMA_DPM_PARAMS_RESERVED0_MASK 0x1
945#define DB_ROCE_DPM_PARAMS_RESERVED0_SHIFT 27 961#define DB_RDMA_DPM_PARAMS_RESERVED0_SHIFT 27
946#define DB_ROCE_DPM_PARAMS_COMPLETION_FLG_MASK 0x1 962#define DB_RDMA_DPM_PARAMS_COMPLETION_FLG_MASK 0x1
947#define DB_ROCE_DPM_PARAMS_COMPLETION_FLG_SHIFT 28 963#define DB_RDMA_DPM_PARAMS_COMPLETION_FLG_SHIFT 28
948#define DB_ROCE_DPM_PARAMS_S_FLG_MASK 0x1 964#define DB_RDMA_DPM_PARAMS_S_FLG_MASK 0x1
949#define DB_ROCE_DPM_PARAMS_S_FLG_SHIFT 29 965#define DB_RDMA_DPM_PARAMS_S_FLG_SHIFT 29
950#define DB_ROCE_DPM_PARAMS_RESERVED1_MASK 0x3 966#define DB_RDMA_DPM_PARAMS_RESERVED1_MASK 0x1
951#define DB_ROCE_DPM_PARAMS_RESERVED1_SHIFT 30 967#define DB_RDMA_DPM_PARAMS_RESERVED1_SHIFT 30
968#define DB_RDMA_DPM_PARAMS_CONN_TYPE_IS_IWARP_MASK 0x1
969#define DB_RDMA_DPM_PARAMS_CONN_TYPE_IS_IWARP_SHIFT 31
952}; 970};
953 971
954/* Structure for doorbell data, in ROCE DPM mode, for 1st db in a DPM burst */ 972/* Structure for doorbell data, in ROCE DPM mode, for 1st db in a DPM burst */
955struct db_roce_dpm_data { 973struct db_rdma_dpm_data {
956 __le16 icid; 974 __le16 icid;
957 __le16 prod_val; 975 __le16 prod_val;
958 struct db_roce_dpm_params params; 976 struct db_rdma_dpm_params params;
959}; 977};
960 978
961/* Igu interrupt command */ 979/* Igu interrupt command */
@@ -1026,6 +1044,42 @@ struct parsing_and_err_flags {
1026#define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMERROR_SHIFT 15 1044#define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMERROR_SHIFT 15
1027}; 1045};
1028 1046
1047struct parsing_err_flags {
1048 __le16 flags;
1049#define PARSING_ERR_FLAGS_MAC_ERROR_MASK 0x1
1050#define PARSING_ERR_FLAGS_MAC_ERROR_SHIFT 0
1051#define PARSING_ERR_FLAGS_TRUNC_ERROR_MASK 0x1
1052#define PARSING_ERR_FLAGS_TRUNC_ERROR_SHIFT 1
1053#define PARSING_ERR_FLAGS_PKT_TOO_SMALL_MASK 0x1
1054#define PARSING_ERR_FLAGS_PKT_TOO_SMALL_SHIFT 2
1055#define PARSING_ERR_FLAGS_ANY_HDR_MISSING_TAG_MASK 0x1
1056#define PARSING_ERR_FLAGS_ANY_HDR_MISSING_TAG_SHIFT 3
1057#define PARSING_ERR_FLAGS_ANY_HDR_IP_VER_MISMTCH_MASK 0x1
1058#define PARSING_ERR_FLAGS_ANY_HDR_IP_VER_MISMTCH_SHIFT 4
1059#define PARSING_ERR_FLAGS_ANY_HDR_IP_V4_HDR_LEN_TOO_SMALL_MASK 0x1
1060#define PARSING_ERR_FLAGS_ANY_HDR_IP_V4_HDR_LEN_TOO_SMALL_SHIFT 5
1061#define PARSING_ERR_FLAGS_ANY_HDR_IP_BAD_TOTAL_LEN_MASK 0x1
1062#define PARSING_ERR_FLAGS_ANY_HDR_IP_BAD_TOTAL_LEN_SHIFT 6
1063#define PARSING_ERR_FLAGS_IP_V4_CHKSM_ERROR_MASK 0x1
1064#define PARSING_ERR_FLAGS_IP_V4_CHKSM_ERROR_SHIFT 7
1065#define PARSING_ERR_FLAGS_ANY_HDR_L4_IP_LEN_MISMTCH_MASK 0x1
1066#define PARSING_ERR_FLAGS_ANY_HDR_L4_IP_LEN_MISMTCH_SHIFT 8
1067#define PARSING_ERR_FLAGS_ZERO_UDP_IP_V6_CHKSM_MASK 0x1
1068#define PARSING_ERR_FLAGS_ZERO_UDP_IP_V6_CHKSM_SHIFT 9
1069#define PARSING_ERR_FLAGS_INNER_L4_CHKSM_ERROR_MASK 0x1
1070#define PARSING_ERR_FLAGS_INNER_L4_CHKSM_ERROR_SHIFT 10
1071#define PARSING_ERR_FLAGS_ANY_HDR_ZERO_TTL_OR_HOP_LIM_MASK 0x1
1072#define PARSING_ERR_FLAGS_ANY_HDR_ZERO_TTL_OR_HOP_LIM_SHIFT 11
1073#define PARSING_ERR_FLAGS_NON_8021Q_TAG_EXISTS_IN_BOTH_HDRS_MASK 0x1
1074#define PARSING_ERR_FLAGS_NON_8021Q_TAG_EXISTS_IN_BOTH_HDRS_SHIFT 12
1075#define PARSING_ERR_FLAGS_GENEVE_OPTION_OVERSIZED_MASK 0x1
1076#define PARSING_ERR_FLAGS_GENEVE_OPTION_OVERSIZED_SHIFT 13
1077#define PARSING_ERR_FLAGS_TUNNEL_IP_V4_CHKSM_ERROR_MASK 0x1
1078#define PARSING_ERR_FLAGS_TUNNEL_IP_V4_CHKSM_ERROR_SHIFT 14
1079#define PARSING_ERR_FLAGS_TUNNEL_L4_CHKSM_ERROR_MASK 0x1
1080#define PARSING_ERR_FLAGS_TUNNEL_L4_CHKSM_ERROR_SHIFT 15
1081};
1082
1029struct pb_context { 1083struct pb_context {
1030 __le32 crc[4]; 1084 __le32 crc[4];
1031}; 1085};
@@ -1288,39 +1342,56 @@ struct tdif_task_context {
1288 1342
1289struct timers_context { 1343struct timers_context {
1290 __le32 logical_client_0; 1344 __le32 logical_client_0;
1291#define TIMERS_CONTEXT_EXPIRATIONTIMELC0_MASK 0xFFFFFFF 1345#define TIMERS_CONTEXT_EXPIRATIONTIMELC0_MASK 0x7FFFFFF
1292#define TIMERS_CONTEXT_EXPIRATIONTIMELC0_SHIFT 0 1346#define TIMERS_CONTEXT_EXPIRATIONTIMELC0_SHIFT 0
1293#define TIMERS_CONTEXT_VALIDLC0_MASK 0x1 1347#define TIMERS_CONTEXT_RESERVED0_MASK 0x1
1294#define TIMERS_CONTEXT_VALIDLC0_SHIFT 28 1348#define TIMERS_CONTEXT_RESERVED0_SHIFT 27
1295#define TIMERS_CONTEXT_ACTIVELC0_MASK 0x1 1349#define TIMERS_CONTEXT_VALIDLC0_MASK 0x1
1296#define TIMERS_CONTEXT_ACTIVELC0_SHIFT 29 1350#define TIMERS_CONTEXT_VALIDLC0_SHIFT 28
1297#define TIMERS_CONTEXT_RESERVED0_MASK 0x3 1351#define TIMERS_CONTEXT_ACTIVELC0_MASK 0x1
1298#define TIMERS_CONTEXT_RESERVED0_SHIFT 30 1352#define TIMERS_CONTEXT_ACTIVELC0_SHIFT 29
1353#define TIMERS_CONTEXT_RESERVED1_MASK 0x3
1354#define TIMERS_CONTEXT_RESERVED1_SHIFT 30
1299 __le32 logical_client_1; 1355 __le32 logical_client_1;
1300#define TIMERS_CONTEXT_EXPIRATIONTIMELC1_MASK 0xFFFFFFF 1356#define TIMERS_CONTEXT_EXPIRATIONTIMELC1_MASK 0x7FFFFFF
1301#define TIMERS_CONTEXT_EXPIRATIONTIMELC1_SHIFT 0 1357#define TIMERS_CONTEXT_EXPIRATIONTIMELC1_SHIFT 0
1302#define TIMERS_CONTEXT_VALIDLC1_MASK 0x1 1358#define TIMERS_CONTEXT_RESERVED2_MASK 0x1
1303#define TIMERS_CONTEXT_VALIDLC1_SHIFT 28 1359#define TIMERS_CONTEXT_RESERVED2_SHIFT 27
1304#define TIMERS_CONTEXT_ACTIVELC1_MASK 0x1 1360#define TIMERS_CONTEXT_VALIDLC1_MASK 0x1
1305#define TIMERS_CONTEXT_ACTIVELC1_SHIFT 29 1361#define TIMERS_CONTEXT_VALIDLC1_SHIFT 28
1306#define TIMERS_CONTEXT_RESERVED1_MASK 0x3 1362#define TIMERS_CONTEXT_ACTIVELC1_MASK 0x1
1307#define TIMERS_CONTEXT_RESERVED1_SHIFT 30 1363#define TIMERS_CONTEXT_ACTIVELC1_SHIFT 29
1364#define TIMERS_CONTEXT_RESERVED3_MASK 0x3
1365#define TIMERS_CONTEXT_RESERVED3_SHIFT 30
1308 __le32 logical_client_2; 1366 __le32 logical_client_2;
1309#define TIMERS_CONTEXT_EXPIRATIONTIMELC2_MASK 0xFFFFFFF 1367#define TIMERS_CONTEXT_EXPIRATIONTIMELC2_MASK 0x7FFFFFF
1310#define TIMERS_CONTEXT_EXPIRATIONTIMELC2_SHIFT 0 1368#define TIMERS_CONTEXT_EXPIRATIONTIMELC2_SHIFT 0
1311#define TIMERS_CONTEXT_VALIDLC2_MASK 0x1 1369#define TIMERS_CONTEXT_RESERVED4_MASK 0x1
1312#define TIMERS_CONTEXT_VALIDLC2_SHIFT 28 1370#define TIMERS_CONTEXT_RESERVED4_SHIFT 27
1313#define TIMERS_CONTEXT_ACTIVELC2_MASK 0x1 1371#define TIMERS_CONTEXT_VALIDLC2_MASK 0x1
1314#define TIMERS_CONTEXT_ACTIVELC2_SHIFT 29 1372#define TIMERS_CONTEXT_VALIDLC2_SHIFT 28
1315#define TIMERS_CONTEXT_RESERVED2_MASK 0x3 1373#define TIMERS_CONTEXT_ACTIVELC2_MASK 0x1
1316#define TIMERS_CONTEXT_RESERVED2_SHIFT 30 1374#define TIMERS_CONTEXT_ACTIVELC2_SHIFT 29
1375#define TIMERS_CONTEXT_RESERVED5_MASK 0x3
1376#define TIMERS_CONTEXT_RESERVED5_SHIFT 30
1317 __le32 host_expiration_fields; 1377 __le32 host_expiration_fields;
1318#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALUE_MASK 0xFFFFFFF 1378#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALUE_MASK 0x7FFFFFF
1319#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALUE_SHIFT 0 1379#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALUE_SHIFT 0
1320#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALID_MASK 0x1 1380#define TIMERS_CONTEXT_RESERVED6_MASK 0x1
1321#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALID_SHIFT 28 1381#define TIMERS_CONTEXT_RESERVED6_SHIFT 27
1322#define TIMERS_CONTEXT_RESERVED3_MASK 0x7 1382#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALID_MASK 0x1
1323#define TIMERS_CONTEXT_RESERVED3_SHIFT 29 1383#define TIMERS_CONTEXT_HOSTEXPRIRATIONVALID_SHIFT 28
1384#define TIMERS_CONTEXT_RESERVED7_MASK 0x7
1385#define TIMERS_CONTEXT_RESERVED7_SHIFT 29
1324}; 1386};
1387
1388enum tunnel_next_protocol {
1389 e_unknown = 0,
1390 e_l2 = 1,
1391 e_ipv4 = 2,
1392 e_ipv6 = 3,
1393 MAX_TUNNEL_NEXT_PROTOCOL
1394};
1395
1325#endif /* __COMMON_HSI__ */ 1396#endif /* __COMMON_HSI__ */
1326#endif 1397#endif
diff --git a/include/linux/qed/eth_common.h b/include/linux/qed/eth_common.h
index 34d93eb5bfba..cb06e6e368e1 100644
--- a/include/linux/qed/eth_common.h
+++ b/include/linux/qed/eth_common.h
@@ -75,7 +75,8 @@
75 (ETH_NUM_STATISTIC_COUNTERS - 3 * MAX_NUM_VFS / 4) 75 (ETH_NUM_STATISTIC_COUNTERS - 3 * MAX_NUM_VFS / 4)
76 76
77/* Maximum number of buffers, used for RX packet placement */ 77/* Maximum number of buffers, used for RX packet placement */
78#define ETH_RX_MAX_BUFF_PER_PKT 5 78#define ETH_RX_MAX_BUFF_PER_PKT 5
79#define ETH_RX_BD_THRESHOLD 12
79 80
80/* num of MAC/VLAN filters */ 81/* num of MAC/VLAN filters */
81#define ETH_NUM_MAC_FILTERS 512 82#define ETH_NUM_MAC_FILTERS 512
diff --git a/include/linux/qed/fcoe_common.h b/include/linux/qed/fcoe_common.h
index 947a635d04bb..12fc9e788eea 100644
--- a/include/linux/qed/fcoe_common.h
+++ b/include/linux/qed/fcoe_common.h
@@ -13,7 +13,6 @@
13/*********************/ 13/*********************/
14 14
15#define FC_ABTS_REPLY_MAX_PAYLOAD_LEN 12 15#define FC_ABTS_REPLY_MAX_PAYLOAD_LEN 12
16#define FCOE_MAX_SIZE_FCP_DATA_SUPER (8600)
17 16
18struct fcoe_abts_pkt { 17struct fcoe_abts_pkt {
19 __le32 abts_rsp_fc_payload_lo; 18 __le32 abts_rsp_fc_payload_lo;
diff --git a/include/linux/qed/iscsi_common.h b/include/linux/qed/iscsi_common.h
index 69949f8e354b..85e086cba639 100644
--- a/include/linux/qed/iscsi_common.h
+++ b/include/linux/qed/iscsi_common.h
@@ -75,25 +75,13 @@
75#define ISCSI_TARGET_MODE 1 75#define ISCSI_TARGET_MODE 1
76 76
77/* iSCSI request op codes */ 77/* iSCSI request op codes */
78#define ISCSI_OPCODE_NOP_OUT_NO_IMM (0) 78#define ISCSI_OPCODE_NOP_OUT (0)
79#define ISCSI_OPCODE_NOP_OUT ( \ 79#define ISCSI_OPCODE_SCSI_CMD (1)
80 ISCSI_OPCODE_NOP_OUT_NO_IMM | 0x40) 80#define ISCSI_OPCODE_TMF_REQUEST (2)
81#define ISCSI_OPCODE_SCSI_CMD_NO_IMM (1) 81#define ISCSI_OPCODE_LOGIN_REQUEST (3)
82#define ISCSI_OPCODE_SCSI_CMD ( \ 82#define ISCSI_OPCODE_TEXT_REQUEST (4)
83 ISCSI_OPCODE_SCSI_CMD_NO_IMM | 0x40) 83#define ISCSI_OPCODE_DATA_OUT (5)
84#define ISCSI_OPCODE_TMF_REQUEST_NO_IMM (2) 84#define ISCSI_OPCODE_LOGOUT_REQUEST (6)
85#define ISCSI_OPCODE_TMF_REQUEST ( \
86 ISCSI_OPCODE_TMF_REQUEST_NO_IMM | 0x40)
87#define ISCSI_OPCODE_LOGIN_REQUEST_NO_IMM (3)
88#define ISCSI_OPCODE_LOGIN_REQUEST ( \
89 ISCSI_OPCODE_LOGIN_REQUEST_NO_IMM | 0x40)
90#define ISCSI_OPCODE_TEXT_REQUEST_NO_IMM (4)
91#define ISCSI_OPCODE_TEXT_REQUEST ( \
92 ISCSI_OPCODE_TEXT_REQUEST_NO_IMM | 0x40)
93#define ISCSI_OPCODE_DATA_OUT (5)
94#define ISCSI_OPCODE_LOGOUT_REQUEST_NO_IMM (6)
95#define ISCSI_OPCODE_LOGOUT_REQUEST ( \
96 ISCSI_OPCODE_LOGOUT_REQUEST_NO_IMM | 0x40)
97 85
98/* iSCSI response/messages op codes */ 86/* iSCSI response/messages op codes */
99#define ISCSI_OPCODE_NOP_IN (0x20) 87#define ISCSI_OPCODE_NOP_IN (0x20)
@@ -172,17 +160,23 @@ struct iscsi_async_msg_hdr {
172struct iscsi_cmd_hdr { 160struct iscsi_cmd_hdr {
173 __le16 reserved1; 161 __le16 reserved1;
174 u8 flags_attr; 162 u8 flags_attr;
175#define ISCSI_CMD_HDR_ATTR_MASK 0x7 163#define ISCSI_CMD_HDR_ATTR_MASK 0x7
176#define ISCSI_CMD_HDR_ATTR_SHIFT 0 164#define ISCSI_CMD_HDR_ATTR_SHIFT 0
177#define ISCSI_CMD_HDR_RSRV_MASK 0x3 165#define ISCSI_CMD_HDR_RSRV_MASK 0x3
178#define ISCSI_CMD_HDR_RSRV_SHIFT 3 166#define ISCSI_CMD_HDR_RSRV_SHIFT 3
179#define ISCSI_CMD_HDR_WRITE_MASK 0x1 167#define ISCSI_CMD_HDR_WRITE_MASK 0x1
180#define ISCSI_CMD_HDR_WRITE_SHIFT 5 168#define ISCSI_CMD_HDR_WRITE_SHIFT 5
181#define ISCSI_CMD_HDR_READ_MASK 0x1 169#define ISCSI_CMD_HDR_READ_MASK 0x1
182#define ISCSI_CMD_HDR_READ_SHIFT 6 170#define ISCSI_CMD_HDR_READ_SHIFT 6
183#define ISCSI_CMD_HDR_FINAL_MASK 0x1 171#define ISCSI_CMD_HDR_FINAL_MASK 0x1
184#define ISCSI_CMD_HDR_FINAL_SHIFT 7 172#define ISCSI_CMD_HDR_FINAL_SHIFT 7
185 u8 opcode; 173 u8 hdr_first_byte;
174#define ISCSI_CMD_HDR_OPCODE_MASK 0x3F
175#define ISCSI_CMD_HDR_OPCODE_SHIFT 0
176#define ISCSI_CMD_HDR_IMM_MASK 0x1
177#define ISCSI_CMD_HDR_IMM_SHIFT 6
178#define ISCSI_CMD_HDR_RSRV1_MASK 0x1
179#define ISCSI_CMD_HDR_RSRV1_SHIFT 7
186 __le32 hdr_second_dword; 180 __le32 hdr_second_dword;
187#define ISCSI_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 181#define ISCSI_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF
188#define ISCSI_CMD_HDR_DATA_SEG_LEN_SHIFT 0 182#define ISCSI_CMD_HDR_DATA_SEG_LEN_SHIFT 0
@@ -790,9 +784,9 @@ enum iscsi_error_types {
790 ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR, 784 ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR,
791 ISCSI_CONN_ERROR_DATA_OVERRUN, 785 ISCSI_CONN_ERROR_DATA_OVERRUN,
792 ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR, 786 ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR,
793 ISCSI_CONN_ERROR_TCP_SEG_PROC_URG_ERROR, 787 ISCSI_CONN_ERROR_IP_OPTIONS_ERROR,
794 ISCSI_CONN_ERROR_TCP_SEG_PROC_IP_OPTIONS_ERROR, 788 ISCSI_CONN_ERROR_PRS_ERRORS,
795 ISCSI_CONN_ERROR_TCP_SEG_PROC_CONNECT_INVALID_WS_OPTION, 789 ISCSI_CONN_ERROR_CONNECT_INVALID_TCP_OPTION,
796 ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR, 790 ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR,
797 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN, 791 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN,
798 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_TYPE, 792 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_TYPE,
@@ -1304,22 +1298,6 @@ struct ystorm_iscsi_stats_drv {
1304 struct regpair iscsi_tx_total_pdu_cnt; 1298 struct regpair iscsi_tx_total_pdu_cnt;
1305}; 1299};
1306 1300
1307struct iscsi_db_data {
1308 u8 params;
1309#define ISCSI_DB_DATA_DEST_MASK 0x3
1310#define ISCSI_DB_DATA_DEST_SHIFT 0
1311#define ISCSI_DB_DATA_AGG_CMD_MASK 0x3
1312#define ISCSI_DB_DATA_AGG_CMD_SHIFT 2
1313#define ISCSI_DB_DATA_BYPASS_EN_MASK 0x1
1314#define ISCSI_DB_DATA_BYPASS_EN_SHIFT 4
1315#define ISCSI_DB_DATA_RESERVED_MASK 0x1
1316#define ISCSI_DB_DATA_RESERVED_SHIFT 5
1317#define ISCSI_DB_DATA_AGG_VAL_SEL_MASK 0x3
1318#define ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT 6
1319 u8 agg_flags;
1320 __le16 sq_prod;
1321};
1322
1323struct tstorm_iscsi_task_ag_ctx { 1301struct tstorm_iscsi_task_ag_ctx {
1324 u8 byte0; 1302 u8 byte0;
1325 u8 byte1; 1303 u8 byte1;
@@ -1398,5 +1376,20 @@ struct tstorm_iscsi_task_ag_ctx {
1398 __le32 reg1; 1376 __le32 reg1;
1399 __le32 reg2; 1377 __le32 reg2;
1400}; 1378};
1379struct iscsi_db_data {
1380 u8 params;
1381#define ISCSI_DB_DATA_DEST_MASK 0x3
1382#define ISCSI_DB_DATA_DEST_SHIFT 0
1383#define ISCSI_DB_DATA_AGG_CMD_MASK 0x3
1384#define ISCSI_DB_DATA_AGG_CMD_SHIFT 2
1385#define ISCSI_DB_DATA_BYPASS_EN_MASK 0x1
1386#define ISCSI_DB_DATA_BYPASS_EN_SHIFT 4
1387#define ISCSI_DB_DATA_RESERVED_MASK 0x1
1388#define ISCSI_DB_DATA_RESERVED_SHIFT 5
1389#define ISCSI_DB_DATA_AGG_VAL_SEL_MASK 0x3
1390#define ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT 6
1391 u8 agg_flags;
1392 __le16 sq_prod;
1393};
1401 1394
1402#endif /* __ISCSI_COMMON__ */ 1395#endif /* __ISCSI_COMMON__ */
diff --git a/include/linux/qed/iwarp_common.h b/include/linux/qed/iwarp_common.h
new file mode 100644
index 000000000000..b8b3e1cfae90
--- /dev/null
+++ b/include/linux/qed/iwarp_common.h
@@ -0,0 +1,53 @@
1/* QLogic qed NIC Driver
2 * Copyright (c) 2015-2017 QLogic Corporation
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and /or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32#ifndef __IWARP_COMMON__
33#define __IWARP_COMMON__
34#include <linux/qed/rdma_common.h>
35/************************/
36/* IWARP FW CONSTANTS */
37/************************/
38
39#define IWARP_ACTIVE_MODE 0
40#define IWARP_PASSIVE_MODE 1
41
42#define IWARP_SHARED_QUEUE_PAGE_SIZE (0x8000)
43#define IWARP_SHARED_QUEUE_PAGE_RQ_PBL_OFFSET (0x4000)
44#define IWARP_SHARED_QUEUE_PAGE_RQ_PBL_MAX_SIZE (0x1000)
45#define IWARP_SHARED_QUEUE_PAGE_SQ_PBL_OFFSET (0x5000)
46#define IWARP_SHARED_QUEUE_PAGE_SQ_PBL_MAX_SIZE (0x3000)
47
48#define IWARP_REQ_MAX_INLINE_DATA_SIZE (128)
49#define IWARP_REQ_MAX_SINGLE_SQ_WQE_SIZE (176)
50
51#define IWARP_MAX_QPS (64 * 1024)
52
53#endif /* __IWARP_COMMON__ */
diff --git a/include/linux/qed/qed_chain.h b/include/linux/qed/qed_chain.h
index 5cd7a4608c9b..59ddf9af909e 100644
--- a/include/linux/qed/qed_chain.h
+++ b/include/linux/qed/qed_chain.h
@@ -80,6 +80,11 @@ struct qed_chain_pbl_u32 {
80 u32 cons_page_idx; 80 u32 cons_page_idx;
81}; 81};
82 82
83struct qed_chain_ext_pbl {
84 dma_addr_t p_pbl_phys;
85 void *p_pbl_virt;
86};
87
83struct qed_chain_u16 { 88struct qed_chain_u16 {
84 /* Cyclic index of next element to produce/consme */ 89 /* Cyclic index of next element to produce/consme */
85 u16 prod_idx; 90 u16 prod_idx;
@@ -155,6 +160,8 @@ struct qed_chain {
155 u32 size; 160 u32 size;
156 161
157 u8 intended_use; 162 u8 intended_use;
163
164 bool b_external_pbl;
158}; 165};
159 166
160#define QED_CHAIN_PBL_ENTRY_SIZE (8) 167#define QED_CHAIN_PBL_ENTRY_SIZE (8)
diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h
index d66d16a559e1..0eef0a2b1901 100644
--- a/include/linux/qed/qed_eth_if.h
+++ b/include/linux/qed/qed_eth_if.h
@@ -47,8 +47,7 @@ struct qed_queue_start_common_params {
47 /* Relative, but relevant only for PFs */ 47 /* Relative, but relevant only for PFs */
48 u8 stats_id; 48 u8 stats_id;
49 49
50 /* These are always absolute */ 50 struct qed_sb_info *p_sb;
51 u16 sb;
52 u8 sb_idx; 51 u8 sb_idx;
53}; 52};
54 53
@@ -74,6 +73,9 @@ struct qed_dev_eth_info {
74 73
75 /* Legacy VF - this affects the datapath, so qede has to know */ 74 /* Legacy VF - this affects the datapath, so qede has to know */
76 bool is_legacy; 75 bool is_legacy;
76
77 /* Might depend on available resources [in case of VF] */
78 bool xdp_supported;
77}; 79};
78 80
79struct qed_update_vport_rss_params { 81struct qed_update_vport_rss_params {
diff --git a/include/linux/qed/qed_fcoe_if.h b/include/linux/qed/qed_fcoe_if.h
index bd6bcb809415..1e015c50e6b8 100644
--- a/include/linux/qed/qed_fcoe_if.h
+++ b/include/linux/qed/qed_fcoe_if.h
@@ -24,6 +24,11 @@ struct qed_dev_fcoe_info {
24 24
25 void __iomem *primary_dbq_rq_addr; 25 void __iomem *primary_dbq_rq_addr;
26 void __iomem *secondary_bdq_rq_addr; 26 void __iomem *secondary_bdq_rq_addr;
27
28 u64 wwpn;
29 u64 wwnn;
30
31 u8 num_cqs;
27}; 32};
28 33
29struct qed_fcoe_params_offload { 34struct qed_fcoe_params_offload {
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index c70ac13a97e6..ef39c7f40ae6 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -156,6 +156,11 @@ struct qed_dcbx_get {
156 struct qed_dcbx_admin_params local; 156 struct qed_dcbx_admin_params local;
157}; 157};
158 158
159enum qed_nvm_images {
160 QED_NVM_IMAGE_ISCSI_CFG,
161 QED_NVM_IMAGE_FCOE_CFG,
162};
163
159enum qed_led_mode { 164enum qed_led_mode {
160 QED_LED_MODE_OFF, 165 QED_LED_MODE_OFF,
161 QED_LED_MODE_ON, 166 QED_LED_MODE_ON,
@@ -180,6 +185,10 @@ struct qed_eth_pf_params {
180 */ 185 */
181 u16 num_cons; 186 u16 num_cons;
182 187
188 /* per-VF number of CIDs */
189 u8 num_vf_cons;
190#define ETH_PF_PARAMS_VF_CONS_DEFAULT (32)
191
183 /* To enable arfs, previous to HW-init a positive number needs to be 192 /* To enable arfs, previous to HW-init a positive number needs to be
184 * set [as filters require allocated searcher ILT memory]. 193 * set [as filters require allocated searcher ILT memory].
185 * This will set the maximal number of configured steering-filters. 194 * This will set the maximal number of configured steering-filters.
@@ -328,6 +337,14 @@ struct qed_dev_info {
328 337
329 /* MFW version */ 338 /* MFW version */
330 u32 mfw_rev; 339 u32 mfw_rev;
340#define QED_MFW_VERSION_0_MASK 0x000000FF
341#define QED_MFW_VERSION_0_OFFSET 0
342#define QED_MFW_VERSION_1_MASK 0x0000FF00
343#define QED_MFW_VERSION_1_OFFSET 8
344#define QED_MFW_VERSION_2_MASK 0x00FF0000
345#define QED_MFW_VERSION_2_OFFSET 16
346#define QED_MFW_VERSION_3_MASK 0xFF000000
347#define QED_MFW_VERSION_3_OFFSET 24
331 348
332 u32 flash_size; 349 u32 flash_size;
333 u8 mf_mode; 350 u8 mf_mode;
@@ -337,12 +354,23 @@ struct qed_dev_info {
337 354
338 bool wol_support; 355 bool wol_support;
339 356
357 /* MBI version */
358 u32 mbi_version;
359#define QED_MBI_VERSION_0_MASK 0x000000FF
360#define QED_MBI_VERSION_0_OFFSET 0
361#define QED_MBI_VERSION_1_MASK 0x0000FF00
362#define QED_MBI_VERSION_1_OFFSET 8
363#define QED_MBI_VERSION_2_MASK 0x00FF0000
364#define QED_MBI_VERSION_2_OFFSET 16
365
340 enum qed_dev_type dev_type; 366 enum qed_dev_type dev_type;
341 367
342 /* Output parameters for qede */ 368 /* Output parameters for qede */
343 bool vxlan_enable; 369 bool vxlan_enable;
344 bool gre_enable; 370 bool gre_enable;
345 bool geneve_enable; 371 bool geneve_enable;
372
373 u8 abs_pf_id;
346}; 374};
347 375
348enum qed_sb_type { 376enum qed_sb_type {
@@ -503,9 +531,7 @@ struct qed_common_ops {
503 int (*set_power_state)(struct qed_dev *cdev, 531 int (*set_power_state)(struct qed_dev *cdev,
504 pci_power_t state); 532 pci_power_t state);
505 533
506 void (*set_id)(struct qed_dev *cdev, 534 void (*set_name) (struct qed_dev *cdev, char name[]);
507 char name[],
508 char ver_str[]);
509 535
510 /* Client drivers need to make this call before slowpath_start. 536 /* Client drivers need to make this call before slowpath_start.
511 * PF params required for the call before slowpath_start is 537 * PF params required for the call before slowpath_start is
@@ -608,12 +634,26 @@ struct qed_common_ops {
608 enum qed_chain_cnt_type cnt_type, 634 enum qed_chain_cnt_type cnt_type,
609 u32 num_elems, 635 u32 num_elems,
610 size_t elem_size, 636 size_t elem_size,
611 struct qed_chain *p_chain); 637 struct qed_chain *p_chain,
638 struct qed_chain_ext_pbl *ext_pbl);
612 639
613 void (*chain_free)(struct qed_dev *cdev, 640 void (*chain_free)(struct qed_dev *cdev,
614 struct qed_chain *p_chain); 641 struct qed_chain *p_chain);
615 642
616/** 643/**
644 * @brief nvm_get_image - reads an entire image from nvram
645 *
646 * @param cdev
647 * @param type - type of the request nvram image
648 * @param buf - preallocated buffer to fill with the image
649 * @param len - length of the allocated buffer
650 *
651 * @return 0 on success, error otherwise
652 */
653 int (*nvm_get_image)(struct qed_dev *cdev,
654 enum qed_nvm_images type, u8 *buf, u16 len);
655
656/**
617 * @brief get_coalesce - Get coalesce parameters in usec 657 * @brief get_coalesce - Get coalesce parameters in usec
618 * 658 *
619 * @param cdev 659 * @param cdev
@@ -700,11 +740,13 @@ struct qed_common_ops {
700 (((value) >> (name ## _SHIFT)) & name ## _MASK) 740 (((value) >> (name ## _SHIFT)) & name ## _MASK)
701 741
702/* Debug print definitions */ 742/* Debug print definitions */
703#define DP_ERR(cdev, fmt, ...) \ 743#define DP_ERR(cdev, fmt, ...) \
704 pr_err("[%s:%d(%s)]" fmt, \ 744 do { \
705 __func__, __LINE__, \ 745 pr_err("[%s:%d(%s)]" fmt, \
706 DP_NAME(cdev) ? DP_NAME(cdev) : "", \ 746 __func__, __LINE__, \
707 ## __VA_ARGS__) \ 747 DP_NAME(cdev) ? DP_NAME(cdev) : "", \
748 ## __VA_ARGS__); \
749 } while (0)
708 750
709#define DP_NOTICE(cdev, fmt, ...) \ 751#define DP_NOTICE(cdev, fmt, ...) \
710 do { \ 752 do { \
@@ -869,9 +911,15 @@ struct qed_eth_stats {
869#define TX_PI(tc) (RX_PI + 1 + tc) 911#define TX_PI(tc) (RX_PI + 1 + tc)
870 912
871struct qed_sb_cnt_info { 913struct qed_sb_cnt_info {
872 int sb_cnt; 914 /* Original, current, and free SBs for PF */
873 int sb_iov_cnt; 915 int orig;
874 int sb_free_blk; 916 int cnt;
917 int free_cnt;
918
919 /* Original, current and free SBS for child VFs */
920 int iov_orig;
921 int iov_cnt;
922 int free_cnt_iov;
875}; 923};
876 924
877static inline u16 qed_sb_update_sb_idx(struct qed_sb_info *sb_info) 925static inline u16 qed_sb_update_sb_idx(struct qed_sb_info *sb_info)
diff --git a/include/linux/qed/qed_iscsi_if.h b/include/linux/qed/qed_iscsi_if.h
index 3414649133d2..111e606a74c8 100644
--- a/include/linux/qed/qed_iscsi_if.h
+++ b/include/linux/qed/qed_iscsi_if.h
@@ -210,6 +210,11 @@ struct qed_iscsi_cb_ops {
210 * @param stats - pointer to struck that would be filled 210 * @param stats - pointer to struck that would be filled
211 * we stats 211 * we stats
212 * @return 0 on success, error otherwise. 212 * @return 0 on success, error otherwise.
213 * @change_mac Change MAC of interface
214 * @param cdev
215 * @param handle - the connection handle.
216 * @param mac - new MAC to configure.
217 * @return 0 on success, otherwise error value.
213 */ 218 */
214struct qed_iscsi_ops { 219struct qed_iscsi_ops {
215 const struct qed_common_ops *common; 220 const struct qed_common_ops *common;
@@ -248,6 +253,8 @@ struct qed_iscsi_ops {
248 253
249 int (*get_stats)(struct qed_dev *cdev, 254 int (*get_stats)(struct qed_dev *cdev,
250 struct qed_iscsi_stats *stats); 255 struct qed_iscsi_stats *stats);
256
257 int (*change_mac)(struct qed_dev *cdev, u32 handle, const u8 *mac);
251}; 258};
252 259
253const struct qed_iscsi_ops *qed_get_iscsi_ops(void); 260const struct qed_iscsi_ops *qed_get_iscsi_ops(void);
diff --git a/include/linux/qed/qed_ll2_if.h b/include/linux/qed/qed_ll2_if.h
index 4fb4666ea879..dd7a3b86bb9e 100644
--- a/include/linux/qed/qed_ll2_if.h
+++ b/include/linux/qed/qed_ll2_if.h
@@ -43,6 +43,36 @@
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/qed/qed_if.h> 44#include <linux/qed/qed_if.h>
45 45
46enum qed_ll2_conn_type {
47 QED_LL2_TYPE_FCOE,
48 QED_LL2_TYPE_ISCSI,
49 QED_LL2_TYPE_TEST,
50 QED_LL2_TYPE_OOO,
51 QED_LL2_TYPE_RESERVED2,
52 QED_LL2_TYPE_ROCE,
53 QED_LL2_TYPE_IWARP,
54 QED_LL2_TYPE_RESERVED3,
55 MAX_QED_LL2_RX_CONN_TYPE
56};
57
58enum qed_ll2_roce_flavor_type {
59 QED_LL2_ROCE,
60 QED_LL2_RROCE,
61 MAX_QED_LL2_ROCE_FLAVOR_TYPE
62};
63
64enum qed_ll2_tx_dest {
65 QED_LL2_TX_DEST_NW, /* Light L2 TX Destination to the Network */
66 QED_LL2_TX_DEST_LB, /* Light L2 TX Destination to the Loopback */
67 QED_LL2_TX_DEST_MAX
68};
69
70enum qed_ll2_error_handle {
71 QED_LL2_DROP_PACKET,
72 QED_LL2_DO_NOTHING,
73 QED_LL2_ASSERT,
74};
75
46struct qed_ll2_stats { 76struct qed_ll2_stats {
47 u64 gsi_invalid_hdr; 77 u64 gsi_invalid_hdr;
48 u64 gsi_invalid_pkt_length; 78 u64 gsi_invalid_pkt_length;
@@ -67,6 +97,105 @@ struct qed_ll2_stats {
67 u64 sent_bcast_pkts; 97 u64 sent_bcast_pkts;
68}; 98};
69 99
100struct qed_ll2_comp_rx_data {
101 void *cookie;
102 dma_addr_t rx_buf_addr;
103 u16 parse_flags;
104 u16 vlan;
105 bool b_last_packet;
106 u8 connection_handle;
107
108 union {
109 u16 packet_length;
110 u16 data_length;
111 } length;
112
113 u32 opaque_data_0;
114 u32 opaque_data_1;
115
116 /* GSI only */
117 u32 gid_dst[4];
118 u16 qp_id;
119
120 union {
121 u8 placement_offset;
122 u8 data_length_error;
123 } u;
124};
125
126typedef
127void (*qed_ll2_complete_rx_packet_cb)(void *cxt,
128 struct qed_ll2_comp_rx_data *data);
129
130typedef
131void (*qed_ll2_release_rx_packet_cb)(void *cxt,
132 u8 connection_handle,
133 void *cookie,
134 dma_addr_t rx_buf_addr,
135 bool b_last_packet);
136
137typedef
138void (*qed_ll2_complete_tx_packet_cb)(void *cxt,
139 u8 connection_handle,
140 void *cookie,
141 dma_addr_t first_frag_addr,
142 bool b_last_fragment,
143 bool b_last_packet);
144
145typedef
146void (*qed_ll2_release_tx_packet_cb)(void *cxt,
147 u8 connection_handle,
148 void *cookie,
149 dma_addr_t first_frag_addr,
150 bool b_last_fragment, bool b_last_packet);
151
152struct qed_ll2_cbs {
153 qed_ll2_complete_rx_packet_cb rx_comp_cb;
154 qed_ll2_release_rx_packet_cb rx_release_cb;
155 qed_ll2_complete_tx_packet_cb tx_comp_cb;
156 qed_ll2_release_tx_packet_cb tx_release_cb;
157 void *cookie;
158};
159
160struct qed_ll2_acquire_data_inputs {
161 enum qed_ll2_conn_type conn_type;
162 u16 mtu;
163 u16 rx_num_desc;
164 u16 rx_num_ooo_buffers;
165 u8 rx_drop_ttl0_flg;
166 u8 rx_vlan_removal_en;
167 u16 tx_num_desc;
168 u8 tx_max_bds_per_packet;
169 u8 tx_tc;
170 enum qed_ll2_tx_dest tx_dest;
171 enum qed_ll2_error_handle ai_err_packet_too_big;
172 enum qed_ll2_error_handle ai_err_no_buf;
173 u8 gsi_enable;
174};
175
176struct qed_ll2_acquire_data {
177 struct qed_ll2_acquire_data_inputs input;
178 const struct qed_ll2_cbs *cbs;
179
180 /* Output container for LL2 connection's handle */
181 u8 *p_connection_handle;
182};
183
184struct qed_ll2_tx_pkt_info {
185 void *cookie;
186 dma_addr_t first_frag;
187 enum qed_ll2_tx_dest tx_dest;
188 enum qed_ll2_roce_flavor_type qed_roce_flavor;
189 u16 vlan;
190 u16 l4_hdr_offset_w; /* from start of packet */
191 u16 first_frag_len;
192 u8 num_of_bds;
193 u8 bd_flags;
194 bool enable_ip_cksum;
195 bool enable_l4_cksum;
196 bool calc_ip_len;
197};
198
70#define QED_LL2_UNUSED_HANDLE (0xff) 199#define QED_LL2_UNUSED_HANDLE (0xff)
71 200
72struct qed_ll2_cb_ops { 201struct qed_ll2_cb_ops {
diff --git a/include/linux/qed/qed_roce_if.h b/include/linux/qed/qed_rdma_if.h
index cbb2ff0ce4bc..4dd72ba210f5 100644
--- a/include/linux/qed/qed_roce_if.h
+++ b/include/linux/qed/qed_rdma_if.h
@@ -29,13 +29,11 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 30 * SOFTWARE.
31 */ 31 */
32#ifndef _QED_ROCE_IF_H 32#ifndef _QED_RDMA_IF_H
33#define _QED_ROCE_IF_H 33#define _QED_RDMA_IF_H
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/list.h> 36#include <linux/list.h>
37#include <linux/mutex.h>
38#include <linux/pci.h>
39#include <linux/slab.h> 37#include <linux/slab.h>
40#include <linux/qed/qed_if.h> 38#include <linux/qed/qed_if.h>
41#include <linux/qed/qed_ll2_if.h> 39#include <linux/qed/qed_ll2_if.h>
@@ -472,6 +470,101 @@ struct qed_rdma_counters_out_params {
472#define QED_ROCE_TX_HEAD_FAILURE (1) 470#define QED_ROCE_TX_HEAD_FAILURE (1)
473#define QED_ROCE_TX_FRAG_FAILURE (2) 471#define QED_ROCE_TX_FRAG_FAILURE (2)
474 472
473enum qed_iwarp_event_type {
474 QED_IWARP_EVENT_MPA_REQUEST, /* Passive side request received */
475 QED_IWARP_EVENT_PASSIVE_COMPLETE, /* ack on mpa response */
476 QED_IWARP_EVENT_ACTIVE_COMPLETE, /* Active side reply received */
477 QED_IWARP_EVENT_DISCONNECT,
478 QED_IWARP_EVENT_CLOSE,
479 QED_IWARP_EVENT_IRQ_FULL,
480 QED_IWARP_EVENT_RQ_EMPTY,
481 QED_IWARP_EVENT_LLP_TIMEOUT,
482 QED_IWARP_EVENT_REMOTE_PROTECTION_ERROR,
483 QED_IWARP_EVENT_CQ_OVERFLOW,
484 QED_IWARP_EVENT_QP_CATASTROPHIC,
485 QED_IWARP_EVENT_ACTIVE_MPA_REPLY,
486 QED_IWARP_EVENT_LOCAL_ACCESS_ERROR,
487 QED_IWARP_EVENT_REMOTE_OPERATION_ERROR,
488 QED_IWARP_EVENT_TERMINATE_RECEIVED
489};
490
491enum qed_tcp_ip_version {
492 QED_TCP_IPV4,
493 QED_TCP_IPV6,
494};
495
496struct qed_iwarp_cm_info {
497 enum qed_tcp_ip_version ip_version;
498 u32 remote_ip[4];
499 u32 local_ip[4];
500 u16 remote_port;
501 u16 local_port;
502 u16 vlan;
503 u8 ord;
504 u8 ird;
505 u16 private_data_len;
506 const void *private_data;
507};
508
509struct qed_iwarp_cm_event_params {
510 enum qed_iwarp_event_type event;
511 const struct qed_iwarp_cm_info *cm_info;
512 void *ep_context; /* To be passed to accept call */
513 int status;
514};
515
516typedef int (*iwarp_event_handler) (void *context,
517 struct qed_iwarp_cm_event_params *event);
518
519struct qed_iwarp_connect_in {
520 iwarp_event_handler event_cb;
521 void *cb_context;
522 struct qed_rdma_qp *qp;
523 struct qed_iwarp_cm_info cm_info;
524 u16 mss;
525 u8 remote_mac_addr[ETH_ALEN];
526 u8 local_mac_addr[ETH_ALEN];
527};
528
529struct qed_iwarp_connect_out {
530 void *ep_context;
531};
532
533struct qed_iwarp_listen_in {
534 iwarp_event_handler event_cb;
535 void *cb_context; /* passed to event_cb */
536 u32 max_backlog;
537 enum qed_tcp_ip_version ip_version;
538 u32 ip_addr[4];
539 u16 port;
540 u16 vlan;
541};
542
543struct qed_iwarp_listen_out {
544 void *handle;
545};
546
547struct qed_iwarp_accept_in {
548 void *ep_context;
549 void *cb_context;
550 struct qed_rdma_qp *qp;
551 const void *private_data;
552 u16 private_data_len;
553 u8 ord;
554 u8 ird;
555};
556
557struct qed_iwarp_reject_in {
558 void *ep_context;
559 void *cb_context;
560 const void *private_data;
561 u16 private_data_len;
562};
563
564struct qed_iwarp_send_rtr_in {
565 void *ep_context;
566};
567
475struct qed_roce_ll2_header { 568struct qed_roce_ll2_header {
476 void *vaddr; 569 void *vaddr;
477 dma_addr_t baddr; 570 dma_addr_t baddr;
@@ -491,44 +584,9 @@ struct qed_roce_ll2_packet {
491 enum qed_roce_ll2_tx_dest tx_dest; 584 enum qed_roce_ll2_tx_dest tx_dest;
492}; 585};
493 586
494struct qed_roce_ll2_tx_params {
495 int reserved;
496};
497
498struct qed_roce_ll2_rx_params {
499 u16 vlan_id;
500 u8 smac[ETH_ALEN];
501 int rc;
502};
503
504struct qed_roce_ll2_cbs {
505 void (*tx_cb)(void *pdev, struct qed_roce_ll2_packet *pkt);
506
507 void (*rx_cb)(void *pdev, struct qed_roce_ll2_packet *pkt,
508 struct qed_roce_ll2_rx_params *params);
509};
510
511struct qed_roce_ll2_params {
512 u16 max_rx_buffers;
513 u16 max_tx_buffers;
514 u16 mtu;
515 u8 mac_address[ETH_ALEN];
516 struct qed_roce_ll2_cbs cbs;
517 void *cb_cookie;
518};
519
520struct qed_roce_ll2_info {
521 u8 handle;
522 struct qed_roce_ll2_cbs cbs;
523 u8 mac_address[ETH_ALEN];
524 void *cb_cookie;
525
526 /* Lock to protect ll2 */
527 struct mutex lock;
528};
529
530enum qed_rdma_type { 587enum qed_rdma_type {
531 QED_RDMA_TYPE_ROCE, 588 QED_RDMA_TYPE_ROCE,
589 QED_RDMA_TYPE_IWARP
532}; 590};
533 591
534struct qed_dev_rdma_info { 592struct qed_dev_rdma_info {
@@ -579,26 +637,58 @@ struct qed_rdma_ops {
579 int (*rdma_query_qp)(void *rdma_cxt, struct qed_rdma_qp *qp, 637 int (*rdma_query_qp)(void *rdma_cxt, struct qed_rdma_qp *qp,
580 struct qed_rdma_query_qp_out_params *oparams); 638 struct qed_rdma_query_qp_out_params *oparams);
581 int (*rdma_destroy_qp)(void *rdma_cxt, struct qed_rdma_qp *qp); 639 int (*rdma_destroy_qp)(void *rdma_cxt, struct qed_rdma_qp *qp);
640
582 int 641 int
583 (*rdma_register_tid)(void *rdma_cxt, 642 (*rdma_register_tid)(void *rdma_cxt,
584 struct qed_rdma_register_tid_in_params *iparams); 643 struct qed_rdma_register_tid_in_params *iparams);
644
585 int (*rdma_deregister_tid)(void *rdma_cxt, u32 itid); 645 int (*rdma_deregister_tid)(void *rdma_cxt, u32 itid);
586 int (*rdma_alloc_tid)(void *rdma_cxt, u32 *itid); 646 int (*rdma_alloc_tid)(void *rdma_cxt, u32 *itid);
587 void (*rdma_free_tid)(void *rdma_cxt, u32 itid); 647 void (*rdma_free_tid)(void *rdma_cxt, u32 itid);
588 int (*roce_ll2_start)(struct qed_dev *cdev, 648
589 struct qed_roce_ll2_params *params); 649 int (*ll2_acquire_connection)(void *rdma_cxt,
590 int (*roce_ll2_stop)(struct qed_dev *cdev); 650 struct qed_ll2_acquire_data *data);
591 int (*roce_ll2_tx)(struct qed_dev *cdev, 651
592 struct qed_roce_ll2_packet *packet, 652 int (*ll2_establish_connection)(void *rdma_cxt, u8 connection_handle);
593 struct qed_roce_ll2_tx_params *params); 653 int (*ll2_terminate_connection)(void *rdma_cxt, u8 connection_handle);
594 int (*roce_ll2_post_rx_buffer)(struct qed_dev *cdev, 654 void (*ll2_release_connection)(void *rdma_cxt, u8 connection_handle);
595 struct qed_roce_ll2_buffer *buf, 655
596 u64 cookie, u8 notify_fw); 656 int (*ll2_prepare_tx_packet)(void *rdma_cxt,
597 int (*roce_ll2_set_mac_filter)(struct qed_dev *cdev, 657 u8 connection_handle,
598 u8 *old_mac_address, 658 struct qed_ll2_tx_pkt_info *pkt,
599 u8 *new_mac_address); 659 bool notify_fw);
600 int (*roce_ll2_stats)(struct qed_dev *cdev, 660
601 struct qed_ll2_stats *stats); 661 int (*ll2_set_fragment_of_tx_packet)(void *rdma_cxt,
662 u8 connection_handle,
663 dma_addr_t addr,
664 u16 nbytes);
665 int (*ll2_post_rx_buffer)(void *rdma_cxt, u8 connection_handle,
666 dma_addr_t addr, u16 buf_len, void *cookie,
667 u8 notify_fw);
668 int (*ll2_get_stats)(void *rdma_cxt,
669 u8 connection_handle,
670 struct qed_ll2_stats *p_stats);
671 int (*ll2_set_mac_filter)(struct qed_dev *cdev,
672 u8 *old_mac_address, u8 *new_mac_address);
673
674 int (*iwarp_connect)(void *rdma_cxt,
675 struct qed_iwarp_connect_in *iparams,
676 struct qed_iwarp_connect_out *oparams);
677
678 int (*iwarp_create_listen)(void *rdma_cxt,
679 struct qed_iwarp_listen_in *iparams,
680 struct qed_iwarp_listen_out *oparams);
681
682 int (*iwarp_accept)(void *rdma_cxt,
683 struct qed_iwarp_accept_in *iparams);
684
685 int (*iwarp_reject)(void *rdma_cxt,
686 struct qed_iwarp_reject_in *iparams);
687
688 int (*iwarp_destroy_listen)(void *rdma_cxt, void *handle);
689
690 int (*iwarp_send_rtr)(void *rdma_cxt,
691 struct qed_iwarp_send_rtr_in *iparams);
602}; 692};
603 693
604const struct qed_rdma_ops *qed_get_rdma_ops(void); 694const struct qed_rdma_ops *qed_get_rdma_ops(void);
diff --git a/include/linux/qed/qede_roce.h b/include/linux/qed/qede_rdma.h
index 3b8dd551a98c..9904617a9730 100644
--- a/include/linux/qed/qede_roce.h
+++ b/include/linux/qed/qede_rdma.h
@@ -32,22 +32,27 @@
32#ifndef QEDE_ROCE_H 32#ifndef QEDE_ROCE_H
33#define QEDE_ROCE_H 33#define QEDE_ROCE_H
34 34
35#include <linux/pci.h>
36#include <linux/netdevice.h>
37#include <linux/types.h>
38#include <linux/workqueue.h>
39
35struct qedr_dev; 40struct qedr_dev;
36struct qed_dev; 41struct qed_dev;
37struct qede_dev; 42struct qede_dev;
38 43
39enum qede_roce_event { 44enum qede_rdma_event {
40 QEDE_UP, 45 QEDE_UP,
41 QEDE_DOWN, 46 QEDE_DOWN,
42 QEDE_CHANGE_ADDR, 47 QEDE_CHANGE_ADDR,
43 QEDE_CLOSE 48 QEDE_CLOSE
44}; 49};
45 50
46struct qede_roce_event_work { 51struct qede_rdma_event_work {
47 struct list_head list; 52 struct list_head list;
48 struct work_struct work; 53 struct work_struct work;
49 void *ptr; 54 void *ptr;
50 enum qede_roce_event event; 55 enum qede_rdma_event event;
51}; 56};
52 57
53struct qedr_driver { 58struct qedr_driver {
@@ -57,32 +62,33 @@ struct qedr_driver {
57 struct net_device *); 62 struct net_device *);
58 63
59 void (*remove)(struct qedr_dev *); 64 void (*remove)(struct qedr_dev *);
60 void (*notify)(struct qedr_dev *, enum qede_roce_event); 65 void (*notify)(struct qedr_dev *, enum qede_rdma_event);
61}; 66};
62 67
63/* APIs for RoCE driver to register callback handlers, 68/* APIs for RDMA driver to register callback handlers,
64 * which will be invoked when device is added, removed, ifup, ifdown 69 * which will be invoked when device is added, removed, ifup, ifdown
65 */ 70 */
66int qede_roce_register_driver(struct qedr_driver *drv); 71int qede_rdma_register_driver(struct qedr_driver *drv);
67void qede_roce_unregister_driver(struct qedr_driver *drv); 72void qede_rdma_unregister_driver(struct qedr_driver *drv);
68 73
69bool qede_roce_supported(struct qede_dev *dev); 74bool qede_rdma_supported(struct qede_dev *dev);
70 75
71#if IS_ENABLED(CONFIG_QED_RDMA) 76#if IS_ENABLED(CONFIG_QED_RDMA)
72int qede_roce_dev_add(struct qede_dev *dev); 77int qede_rdma_dev_add(struct qede_dev *dev);
73void qede_roce_dev_event_open(struct qede_dev *dev); 78void qede_rdma_dev_event_open(struct qede_dev *dev);
74void qede_roce_dev_event_close(struct qede_dev *dev); 79void qede_rdma_dev_event_close(struct qede_dev *dev);
75void qede_roce_dev_remove(struct qede_dev *dev); 80void qede_rdma_dev_remove(struct qede_dev *dev);
76void qede_roce_event_changeaddr(struct qede_dev *qedr); 81void qede_rdma_event_changeaddr(struct qede_dev *edr);
82
77#else 83#else
78static inline int qede_roce_dev_add(struct qede_dev *dev) 84static inline int qede_rdma_dev_add(struct qede_dev *dev)
79{ 85{
80 return 0; 86 return 0;
81} 87}
82 88
83static inline void qede_roce_dev_event_open(struct qede_dev *dev) {} 89static inline void qede_rdma_dev_event_open(struct qede_dev *dev) {}
84static inline void qede_roce_dev_event_close(struct qede_dev *dev) {} 90static inline void qede_rdma_dev_event_close(struct qede_dev *dev) {}
85static inline void qede_roce_dev_remove(struct qede_dev *dev) {} 91static inline void qede_rdma_dev_remove(struct qede_dev *dev) {}
86static inline void qede_roce_event_changeaddr(struct qede_dev *qedr) {} 92static inline void qede_rdma_event_changeaddr(struct qede_dev *edr) {}
87#endif 93#endif
88#endif 94#endif
diff --git a/include/linux/qed/rdma_common.h b/include/linux/qed/rdma_common.h
index 72c770f9f666..a9b3050f469c 100644
--- a/include/linux/qed/rdma_common.h
+++ b/include/linux/qed/rdma_common.h
@@ -42,7 +42,7 @@
42#define RDMA_MAX_SGE_PER_SQ_WQE (4) 42#define RDMA_MAX_SGE_PER_SQ_WQE (4)
43#define RDMA_MAX_SGE_PER_RQ_WQE (4) 43#define RDMA_MAX_SGE_PER_RQ_WQE (4)
44 44
45#define RDMA_MAX_DATA_SIZE_IN_WQE (0x7FFFFFFF) 45#define RDMA_MAX_DATA_SIZE_IN_WQE (0x80000000)
46 46
47#define RDMA_REQ_RD_ATOMIC_ELM_SIZE (0x50) 47#define RDMA_REQ_RD_ATOMIC_ELM_SIZE (0x50)
48#define RDMA_RESP_RD_ATOMIC_ELM_SIZE (0x20) 48#define RDMA_RESP_RD_ATOMIC_ELM_SIZE (0x20)
diff --git a/include/linux/qed/roce_common.h b/include/linux/qed/roce_common.h
index 866f063026de..fe6a33e45977 100644
--- a/include/linux/qed/roce_common.h
+++ b/include/linux/qed/roce_common.h
@@ -37,6 +37,8 @@
37#define ROCE_REQ_MAX_SINGLE_SQ_WQE_SIZE (288) 37#define ROCE_REQ_MAX_SINGLE_SQ_WQE_SIZE (288)
38 38
39#define ROCE_MAX_QPS (32 * 1024) 39#define ROCE_MAX_QPS (32 * 1024)
40#define ROCE_DCQCN_NP_MAX_QPS (64)
41#define ROCE_DCQCN_RP_MAX_QPS (64)
40 42
41enum roce_async_events_type { 43enum roce_async_events_type {
42 ROCE_ASYNC_EVENT_NONE = 0, 44 ROCE_ASYNC_EVENT_NONE = 0,
diff --git a/include/linux/qed/tcp_common.h b/include/linux/qed/tcp_common.h
index a5e843268f0e..dbf7a43c3e1f 100644
--- a/include/linux/qed/tcp_common.h
+++ b/include/linux/qed/tcp_common.h
@@ -111,7 +111,6 @@ struct tcp_offload_params {
111 __le32 snd_wnd; 111 __le32 snd_wnd;
112 __le32 rcv_wnd; 112 __le32 rcv_wnd;
113 __le32 snd_wl1; 113 __le32 snd_wl1;
114 __le32 ts_time;
115 __le32 ts_recent; 114 __le32 ts_recent;
116 __le32 ts_recent_age; 115 __le32 ts_recent_age;
117 __le32 total_rt; 116 __le32 total_rt;
@@ -122,7 +121,7 @@ struct tcp_offload_params {
122 u8 ka_probe_cnt; 121 u8 ka_probe_cnt;
123 u8 rt_cnt; 122 u8 rt_cnt;
124 __le16 rtt_var; 123 __le16 rtt_var;
125 __le16 reserved2; 124 __le16 fw_internal;
126 __le32 ka_timeout; 125 __le32 ka_timeout;
127 __le32 ka_interval; 126 __le32 ka_interval;
128 __le32 max_rt_time; 127 __le32 max_rt_time;
@@ -130,7 +129,7 @@ struct tcp_offload_params {
130 u8 snd_wnd_scale; 129 u8 snd_wnd_scale;
131 u8 ack_frequency; 130 u8 ack_frequency;
132 __le16 da_timeout_value; 131 __le16 da_timeout_value;
133 __le32 ts_ticks_per_second; 132 __le32 reserved3[2];
134}; 133};
135 134
136struct tcp_offload_params_opt2 { 135struct tcp_offload_params_opt2 {
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 57e54847b0b9..dea59c8eec54 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -18,7 +18,8 @@ extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
18 18
19void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags); 19void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags);
20struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev, 20struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
21 unsigned change, gfp_t flags); 21 unsigned change, u32 event,
22 gfp_t flags);
22void rtmsg_ifinfo_send(struct sk_buff *skb, struct net_device *dev, 23void rtmsg_ifinfo_send(struct sk_buff *skb, struct net_device *dev,
23 gfp_t flags); 24 gfp_t flags);
24 25
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
index c68307bc306f..7343f71783dc 100644
--- a/include/linux/rxrpc.h
+++ b/include/linux/rxrpc.h
@@ -37,6 +37,8 @@ struct sockaddr_rxrpc {
37#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */ 37#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */
38#define RXRPC_EXCLUSIVE_CONNECTION 3 /* Deprecated; use RXRPC_EXCLUSIVE_CALL instead */ 38#define RXRPC_EXCLUSIVE_CONNECTION 3 /* Deprecated; use RXRPC_EXCLUSIVE_CALL instead */
39#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */ 39#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */
40#define RXRPC_UPGRADEABLE_SERVICE 5 /* Upgrade service[0] -> service[1] */
41#define RXRPC_SUPPORTED_CMSG 6 /* Get highest supported control message type */
40 42
41/* 43/*
42 * RxRPC control messages 44 * RxRPC control messages
@@ -44,15 +46,20 @@ struct sockaddr_rxrpc {
44 * - terminal messages mean that a user call ID tag can be recycled 46 * - terminal messages mean that a user call ID tag can be recycled
45 * - s/r/- indicate whether these are applicable to sendmsg() and/or recvmsg() 47 * - s/r/- indicate whether these are applicable to sendmsg() and/or recvmsg()
46 */ 48 */
47#define RXRPC_USER_CALL_ID 1 /* sr: user call ID specifier */ 49enum rxrpc_cmsg_type {
48#define RXRPC_ABORT 2 /* sr: abort request / notification [terminal] */ 50 RXRPC_USER_CALL_ID = 1, /* sr: user call ID specifier */
49#define RXRPC_ACK 3 /* -r: [Service] RPC op final ACK received [terminal] */ 51 RXRPC_ABORT = 2, /* sr: abort request / notification [terminal] */
50#define RXRPC_NET_ERROR 5 /* -r: network error received [terminal] */ 52 RXRPC_ACK = 3, /* -r: [Service] RPC op final ACK received [terminal] */
51#define RXRPC_BUSY 6 /* -r: server busy received [terminal] */ 53 RXRPC_NET_ERROR = 5, /* -r: network error received [terminal] */
52#define RXRPC_LOCAL_ERROR 7 /* -r: local error generated [terminal] */ 54 RXRPC_BUSY = 6, /* -r: server busy received [terminal] */
53#define RXRPC_NEW_CALL 8 /* -r: [Service] new incoming call notification */ 55 RXRPC_LOCAL_ERROR = 7, /* -r: local error generated [terminal] */
54#define RXRPC_ACCEPT 9 /* s-: [Service] accept request */ 56 RXRPC_NEW_CALL = 8, /* -r: [Service] new incoming call notification */
55#define RXRPC_EXCLUSIVE_CALL 10 /* s-: Call should be on exclusive connection */ 57 RXRPC_ACCEPT = 9, /* s-: [Service] accept request */
58 RXRPC_EXCLUSIVE_CALL = 10, /* s-: Call should be on exclusive connection */
59 RXRPC_UPGRADE_SERVICE = 11, /* s-: Request service upgrade for client call */
60 RXRPC_TX_LENGTH = 12, /* s-: Total length of Tx data */
61 RXRPC__SUPPORTED
62};
56 63
57/* 64/*
58 * RxRPC security levels 65 * RxRPC security levels
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 7a4804c4a593..99e866487e2f 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -57,12 +57,12 @@
57#include <uapi/linux/sctp.h> 57#include <uapi/linux/sctp.h>
58 58
59/* Section 3.1. SCTP Common Header Format */ 59/* Section 3.1. SCTP Common Header Format */
60typedef struct sctphdr { 60struct sctphdr {
61 __be16 source; 61 __be16 source;
62 __be16 dest; 62 __be16 dest;
63 __be32 vtag; 63 __be32 vtag;
64 __le32 checksum; 64 __le32 checksum;
65} sctp_sctphdr_t; 65};
66 66
67static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) 67static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
68{ 68{
@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
70} 70}
71 71
72/* Section 3.2. Chunk Field Descriptions. */ 72/* Section 3.2. Chunk Field Descriptions. */
73typedef struct sctp_chunkhdr { 73struct sctp_chunkhdr {
74 __u8 type; 74 __u8 type;
75 __u8 flags; 75 __u8 flags;
76 __be16 length; 76 __be16 length;
77} sctp_chunkhdr_t; 77};
78 78
79 79
80/* Section 3.2. Chunk Type Values. 80/* Section 3.2. Chunk Type Values.
@@ -82,7 +82,7 @@ typedef struct sctp_chunkhdr {
82 * Value field. It takes a value from 0 to 254. The value of 255 is 82 * Value field. It takes a value from 0 to 254. The value of 255 is
83 * reserved for future use as an extension field. 83 * reserved for future use as an extension field.
84 */ 84 */
85typedef enum { 85enum sctp_cid {
86 SCTP_CID_DATA = 0, 86 SCTP_CID_DATA = 0,
87 SCTP_CID_INIT = 1, 87 SCTP_CID_INIT = 1,
88 SCTP_CID_INIT_ACK = 2, 88 SCTP_CID_INIT_ACK = 2,
@@ -109,7 +109,7 @@ typedef enum {
109 SCTP_CID_ASCONF = 0xC1, 109 SCTP_CID_ASCONF = 0xC1,
110 SCTP_CID_ASCONF_ACK = 0x80, 110 SCTP_CID_ASCONF_ACK = 0x80,
111 SCTP_CID_RECONF = 0x82, 111 SCTP_CID_RECONF = 0x82,
112} sctp_cid_t; /* enum */ 112}; /* enum */
113 113
114 114
115/* Section 3.2 115/* Section 3.2
@@ -117,12 +117,12 @@ typedef enum {
117 * the action that must be taken if the processing endpoint does not 117 * the action that must be taken if the processing endpoint does not
118 * recognize the Chunk Type. 118 * recognize the Chunk Type.
119 */ 119 */
120typedef enum { 120enum {
121 SCTP_CID_ACTION_DISCARD = 0x00, 121 SCTP_CID_ACTION_DISCARD = 0x00,
122 SCTP_CID_ACTION_DISCARD_ERR = 0x40, 122 SCTP_CID_ACTION_DISCARD_ERR = 0x40,
123 SCTP_CID_ACTION_SKIP = 0x80, 123 SCTP_CID_ACTION_SKIP = 0x80,
124 SCTP_CID_ACTION_SKIP_ERR = 0xc0, 124 SCTP_CID_ACTION_SKIP_ERR = 0xc0,
125} sctp_cid_action_t; 125};
126 126
127enum { SCTP_CID_ACTION_MASK = 0xc0, }; 127enum { SCTP_CID_ACTION_MASK = 0xc0, };
128 128
@@ -162,12 +162,12 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
162 * Section 3.2.1 Optional/Variable-length Parmaeter Format. 162 * Section 3.2.1 Optional/Variable-length Parmaeter Format.
163 */ 163 */
164 164
165typedef struct sctp_paramhdr { 165struct sctp_paramhdr {
166 __be16 type; 166 __be16 type;
167 __be16 length; 167 __be16 length;
168} sctp_paramhdr_t; 168};
169 169
170typedef enum { 170enum sctp_param {
171 171
172 /* RFC 2960 Section 3.3.5 */ 172 /* RFC 2960 Section 3.3.5 */
173 SCTP_PARAM_HEARTBEAT_INFO = cpu_to_be16(1), 173 SCTP_PARAM_HEARTBEAT_INFO = cpu_to_be16(1),
@@ -207,7 +207,7 @@ typedef enum {
207 SCTP_PARAM_RESET_RESPONSE = cpu_to_be16(0x0010), 207 SCTP_PARAM_RESET_RESPONSE = cpu_to_be16(0x0010),
208 SCTP_PARAM_RESET_ADD_OUT_STREAMS = cpu_to_be16(0x0011), 208 SCTP_PARAM_RESET_ADD_OUT_STREAMS = cpu_to_be16(0x0011),
209 SCTP_PARAM_RESET_ADD_IN_STREAMS = cpu_to_be16(0x0012), 209 SCTP_PARAM_RESET_ADD_IN_STREAMS = cpu_to_be16(0x0012),
210} sctp_param_t; /* enum */ 210}; /* enum */
211 211
212 212
213/* RFC 2960 Section 3.2.1 213/* RFC 2960 Section 3.2.1
@@ -216,29 +216,29 @@ typedef enum {
216 * not recognize the Parameter Type. 216 * not recognize the Parameter Type.
217 * 217 *
218 */ 218 */
219typedef enum { 219enum {
220 SCTP_PARAM_ACTION_DISCARD = cpu_to_be16(0x0000), 220 SCTP_PARAM_ACTION_DISCARD = cpu_to_be16(0x0000),
221 SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000), 221 SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
222 SCTP_PARAM_ACTION_SKIP = cpu_to_be16(0x8000), 222 SCTP_PARAM_ACTION_SKIP = cpu_to_be16(0x8000),
223 SCTP_PARAM_ACTION_SKIP_ERR = cpu_to_be16(0xc000), 223 SCTP_PARAM_ACTION_SKIP_ERR = cpu_to_be16(0xc000),
224} sctp_param_action_t; 224};
225 225
226enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), }; 226enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
227 227
228/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ 228/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
229 229
230typedef struct sctp_datahdr { 230struct sctp_datahdr {
231 __be32 tsn; 231 __be32 tsn;
232 __be16 stream; 232 __be16 stream;
233 __be16 ssn; 233 __be16 ssn;
234 __be32 ppid; 234 __be32 ppid;
235 __u8 payload[0]; 235 __u8 payload[0];
236} sctp_datahdr_t; 236};
237 237
238typedef struct sctp_data_chunk { 238struct sctp_data_chunk {
239 sctp_chunkhdr_t chunk_hdr; 239 struct sctp_chunkhdr chunk_hdr;
240 sctp_datahdr_t data_hdr; 240 struct sctp_datahdr data_hdr;
241} sctp_data_chunk_t; 241};
242 242
243/* DATA Chuck Specific Flags */ 243/* DATA Chuck Specific Flags */
244enum { 244enum {
@@ -257,54 +257,54 @@ enum { SCTP_DATA_FRAG_MASK = 0x03, };
257 * This chunk is used to initiate a SCTP association between two 257 * This chunk is used to initiate a SCTP association between two
258 * endpoints. 258 * endpoints.
259 */ 259 */
260typedef struct sctp_inithdr { 260struct sctp_inithdr {
261 __be32 init_tag; 261 __be32 init_tag;
262 __be32 a_rwnd; 262 __be32 a_rwnd;
263 __be16 num_outbound_streams; 263 __be16 num_outbound_streams;
264 __be16 num_inbound_streams; 264 __be16 num_inbound_streams;
265 __be32 initial_tsn; 265 __be32 initial_tsn;
266 __u8 params[0]; 266 __u8 params[0];
267} sctp_inithdr_t; 267};
268 268
269typedef struct sctp_init_chunk { 269struct sctp_init_chunk {
270 sctp_chunkhdr_t chunk_hdr; 270 struct sctp_chunkhdr chunk_hdr;
271 sctp_inithdr_t init_hdr; 271 struct sctp_inithdr init_hdr;
272} sctp_init_chunk_t; 272};
273 273
274 274
275/* Section 3.3.2.1. IPv4 Address Parameter (5) */ 275/* Section 3.3.2.1. IPv4 Address Parameter (5) */
276typedef struct sctp_ipv4addr_param { 276typedef struct sctp_ipv4addr_param {
277 sctp_paramhdr_t param_hdr; 277 struct sctp_paramhdr param_hdr;
278 struct in_addr addr; 278 struct in_addr addr;
279} sctp_ipv4addr_param_t; 279} sctp_ipv4addr_param_t;
280 280
281/* Section 3.3.2.1. IPv6 Address Parameter (6) */ 281/* Section 3.3.2.1. IPv6 Address Parameter (6) */
282typedef struct sctp_ipv6addr_param { 282typedef struct sctp_ipv6addr_param {
283 sctp_paramhdr_t param_hdr; 283 struct sctp_paramhdr param_hdr;
284 struct in6_addr addr; 284 struct in6_addr addr;
285} sctp_ipv6addr_param_t; 285} sctp_ipv6addr_param_t;
286 286
287/* Section 3.3.2.1 Cookie Preservative (9) */ 287/* Section 3.3.2.1 Cookie Preservative (9) */
288typedef struct sctp_cookie_preserve_param { 288typedef struct sctp_cookie_preserve_param {
289 sctp_paramhdr_t param_hdr; 289 struct sctp_paramhdr param_hdr;
290 __be32 lifespan_increment; 290 __be32 lifespan_increment;
291} sctp_cookie_preserve_param_t; 291} sctp_cookie_preserve_param_t;
292 292
293/* Section 3.3.2.1 Host Name Address (11) */ 293/* Section 3.3.2.1 Host Name Address (11) */
294typedef struct sctp_hostname_param { 294typedef struct sctp_hostname_param {
295 sctp_paramhdr_t param_hdr; 295 struct sctp_paramhdr param_hdr;
296 uint8_t hostname[0]; 296 uint8_t hostname[0];
297} sctp_hostname_param_t; 297} sctp_hostname_param_t;
298 298
299/* Section 3.3.2.1 Supported Address Types (12) */ 299/* Section 3.3.2.1 Supported Address Types (12) */
300typedef struct sctp_supported_addrs_param { 300typedef struct sctp_supported_addrs_param {
301 sctp_paramhdr_t param_hdr; 301 struct sctp_paramhdr param_hdr;
302 __be16 types[0]; 302 __be16 types[0];
303} sctp_supported_addrs_param_t; 303} sctp_supported_addrs_param_t;
304 304
305/* Appendix A. ECN Capable (32768) */ 305/* Appendix A. ECN Capable (32768) */
306typedef struct sctp_ecn_capable_param { 306typedef struct sctp_ecn_capable_param {
307 sctp_paramhdr_t param_hdr; 307 struct sctp_paramhdr param_hdr;
308} sctp_ecn_capable_param_t; 308} sctp_ecn_capable_param_t;
309 309
310/* ADDIP Section 3.2.6 Adaptation Layer Indication */ 310/* ADDIP Section 3.2.6 Adaptation Layer Indication */
@@ -321,19 +321,19 @@ typedef struct sctp_supported_ext_param {
321 321
322/* AUTH Section 3.1 Random */ 322/* AUTH Section 3.1 Random */
323typedef struct sctp_random_param { 323typedef struct sctp_random_param {
324 sctp_paramhdr_t param_hdr; 324 struct sctp_paramhdr param_hdr;
325 __u8 random_val[0]; 325 __u8 random_val[0];
326} sctp_random_param_t; 326} sctp_random_param_t;
327 327
328/* AUTH Section 3.2 Chunk List */ 328/* AUTH Section 3.2 Chunk List */
329typedef struct sctp_chunks_param { 329typedef struct sctp_chunks_param {
330 sctp_paramhdr_t param_hdr; 330 struct sctp_paramhdr param_hdr;
331 __u8 chunks[0]; 331 __u8 chunks[0];
332} sctp_chunks_param_t; 332} sctp_chunks_param_t;
333 333
334/* AUTH Section 3.3 HMAC Algorithm */ 334/* AUTH Section 3.3 HMAC Algorithm */
335typedef struct sctp_hmac_algo_param { 335typedef struct sctp_hmac_algo_param {
336 sctp_paramhdr_t param_hdr; 336 struct sctp_paramhdr param_hdr;
337 __be16 hmac_ids[0]; 337 __be16 hmac_ids[0];
338} sctp_hmac_algo_param_t; 338} sctp_hmac_algo_param_t;
339 339
@@ -341,18 +341,18 @@ typedef struct sctp_hmac_algo_param {
341 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP 341 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP
342 * association. 342 * association.
343 */ 343 */
344typedef sctp_init_chunk_t sctp_initack_chunk_t; 344typedef struct sctp_init_chunk sctp_initack_chunk_t;
345 345
346/* Section 3.3.3.1 State Cookie (7) */ 346/* Section 3.3.3.1 State Cookie (7) */
347typedef struct sctp_cookie_param { 347typedef struct sctp_cookie_param {
348 sctp_paramhdr_t p; 348 struct sctp_paramhdr p;
349 __u8 body[0]; 349 __u8 body[0];
350} sctp_cookie_param_t; 350} sctp_cookie_param_t;
351 351
352/* Section 3.3.3.1 Unrecognized Parameters (8) */ 352/* Section 3.3.3.1 Unrecognized Parameters (8) */
353typedef struct sctp_unrecognized_param { 353typedef struct sctp_unrecognized_param {
354 sctp_paramhdr_t param_hdr; 354 struct sctp_paramhdr param_hdr;
355 sctp_paramhdr_t unrecognized; 355 struct sctp_paramhdr unrecognized;
356} sctp_unrecognized_param_t; 356} sctp_unrecognized_param_t;
357 357
358 358
@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr {
386} sctp_sackhdr_t; 386} sctp_sackhdr_t;
387 387
388typedef struct sctp_sack_chunk { 388typedef struct sctp_sack_chunk {
389 sctp_chunkhdr_t chunk_hdr; 389 struct sctp_chunkhdr chunk_hdr;
390 sctp_sackhdr_t sack_hdr; 390 sctp_sackhdr_t sack_hdr;
391} sctp_sack_chunk_t; 391} sctp_sack_chunk_t;
392 392
@@ -399,11 +399,11 @@ typedef struct sctp_sack_chunk {
399 */ 399 */
400 400
401typedef struct sctp_heartbeathdr { 401typedef struct sctp_heartbeathdr {
402 sctp_paramhdr_t info; 402 struct sctp_paramhdr info;
403} sctp_heartbeathdr_t; 403} sctp_heartbeathdr_t;
404 404
405typedef struct sctp_heartbeat_chunk { 405typedef struct sctp_heartbeat_chunk {
406 sctp_chunkhdr_t chunk_hdr; 406 struct sctp_chunkhdr chunk_hdr;
407 sctp_heartbeathdr_t hb_hdr; 407 sctp_heartbeathdr_t hb_hdr;
408} sctp_heartbeat_chunk_t; 408} sctp_heartbeat_chunk_t;
409 409
@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk {
413 * chunk descriptor. 413 * chunk descriptor.
414 */ 414 */
415typedef struct sctp_abort_chunk { 415typedef struct sctp_abort_chunk {
416 sctp_chunkhdr_t uh; 416 struct sctp_chunkhdr uh;
417} sctp_abort_chunk_t; 417} sctp_abort_chunk_t;
418 418
419 419
@@ -425,8 +425,8 @@ typedef struct sctp_shutdownhdr {
425} sctp_shutdownhdr_t; 425} sctp_shutdownhdr_t;
426 426
427struct sctp_shutdown_chunk_t { 427struct sctp_shutdown_chunk_t {
428 sctp_chunkhdr_t chunk_hdr; 428 struct sctp_chunkhdr chunk_hdr;
429 sctp_shutdownhdr_t shutdown_hdr; 429 sctp_shutdownhdr_t shutdown_hdr;
430}; 430};
431 431
432/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ 432/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
@@ -438,8 +438,8 @@ typedef struct sctp_errhdr {
438} sctp_errhdr_t; 438} sctp_errhdr_t;
439 439
440typedef struct sctp_operr_chunk { 440typedef struct sctp_operr_chunk {
441 sctp_chunkhdr_t chunk_hdr; 441 struct sctp_chunkhdr chunk_hdr;
442 sctp_errhdr_t err_hdr; 442 sctp_errhdr_t err_hdr;
443} sctp_operr_chunk_t; 443} sctp_operr_chunk_t;
444 444
445/* RFC 2960 3.3.10 - Operation Error 445/* RFC 2960 3.3.10 - Operation Error
@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr {
528} sctp_ecnehdr_t; 528} sctp_ecnehdr_t;
529 529
530typedef struct sctp_ecne_chunk { 530typedef struct sctp_ecne_chunk {
531 sctp_chunkhdr_t chunk_hdr; 531 struct sctp_chunkhdr chunk_hdr;
532 sctp_ecnehdr_t ence_hdr; 532 sctp_ecnehdr_t ence_hdr;
533} sctp_ecne_chunk_t; 533} sctp_ecne_chunk_t;
534 534
@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr {
540} sctp_cwrhdr_t; 540} sctp_cwrhdr_t;
541 541
542typedef struct sctp_cwr_chunk { 542typedef struct sctp_cwr_chunk {
543 sctp_chunkhdr_t chunk_hdr; 543 struct sctp_chunkhdr chunk_hdr;
544 sctp_cwrhdr_t cwr_hdr; 544 sctp_cwrhdr_t cwr_hdr;
545} sctp_cwr_chunk_t; 545} sctp_cwr_chunk_t;
546 546
@@ -639,7 +639,7 @@ struct sctp_fwdtsn_chunk {
639 * report status of ASCONF processing. 639 * report status of ASCONF processing.
640 */ 640 */
641typedef struct sctp_addip_param { 641typedef struct sctp_addip_param {
642 sctp_paramhdr_t param_hdr; 642 struct sctp_paramhdr param_hdr;
643 __be32 crr_id; 643 __be32 crr_id;
644} sctp_addip_param_t; 644} sctp_addip_param_t;
645 645
@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr {
649} sctp_addiphdr_t; 649} sctp_addiphdr_t;
650 650
651typedef struct sctp_addip_chunk { 651typedef struct sctp_addip_chunk {
652 sctp_chunkhdr_t chunk_hdr; 652 struct sctp_chunkhdr chunk_hdr;
653 sctp_addiphdr_t addip_hdr; 653 sctp_addiphdr_t addip_hdr;
654} sctp_addip_chunk_t; 654} sctp_addip_chunk_t;
655 655
@@ -709,7 +709,7 @@ typedef struct sctp_authhdr {
709} sctp_authhdr_t; 709} sctp_authhdr_t;
710 710
711typedef struct sctp_auth_chunk { 711typedef struct sctp_auth_chunk {
712 sctp_chunkhdr_t chunk_hdr; 712 struct sctp_chunkhdr chunk_hdr;
713 sctp_authhdr_t auth_hdr; 713 sctp_authhdr_t auth_hdr;
714} sctp_auth_chunk_t; 714} sctp_auth_chunk_t;
715 715
@@ -719,12 +719,12 @@ struct sctp_infox {
719}; 719};
720 720
721struct sctp_reconf_chunk { 721struct sctp_reconf_chunk {
722 sctp_chunkhdr_t chunk_hdr; 722 struct sctp_chunkhdr chunk_hdr;
723 __u8 params[0]; 723 __u8 params[0];
724}; 724};
725 725
726struct sctp_strreset_outreq { 726struct sctp_strreset_outreq {
727 sctp_paramhdr_t param_hdr; 727 struct sctp_paramhdr param_hdr;
728 __u32 request_seq; 728 __u32 request_seq;
729 __u32 response_seq; 729 __u32 response_seq;
730 __u32 send_reset_at_tsn; 730 __u32 send_reset_at_tsn;
@@ -732,18 +732,18 @@ struct sctp_strreset_outreq {
732}; 732};
733 733
734struct sctp_strreset_inreq { 734struct sctp_strreset_inreq {
735 sctp_paramhdr_t param_hdr; 735 struct sctp_paramhdr param_hdr;
736 __u32 request_seq; 736 __u32 request_seq;
737 __u16 list_of_streams[0]; 737 __u16 list_of_streams[0];
738}; 738};
739 739
740struct sctp_strreset_tsnreq { 740struct sctp_strreset_tsnreq {
741 sctp_paramhdr_t param_hdr; 741 struct sctp_paramhdr param_hdr;
742 __u32 request_seq; 742 __u32 request_seq;
743}; 743};
744 744
745struct sctp_strreset_addstrm { 745struct sctp_strreset_addstrm {
746 sctp_paramhdr_t param_hdr; 746 struct sctp_paramhdr param_hdr;
747 __u32 request_seq; 747 __u32 request_seq;
748 __u16 number_of_streams; 748 __u16 number_of_streams;
749 __u16 reserved; 749 __u16 reserved;
@@ -760,13 +760,13 @@ enum {
760}; 760};
761 761
762struct sctp_strreset_resp { 762struct sctp_strreset_resp {
763 sctp_paramhdr_t param_hdr; 763 struct sctp_paramhdr param_hdr;
764 __u32 response_seq; 764 __u32 response_seq;
765 __u32 result; 765 __u32 result;
766}; 766};
767 767
768struct sctp_strreset_resptsn { 768struct sctp_strreset_resptsn {
769 sctp_paramhdr_t param_hdr; 769 struct sctp_paramhdr param_hdr;
770 __u32 response_seq; 770 __u32 response_seq;
771 __u32 result; 771 __u32 result;
772 __u32 senders_next_tsn; 772 __u32 senders_next_tsn;
diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h
index f4dfade428f0..35226cd4efb0 100644
--- a/include/linux/skb_array.h
+++ b/include/linux/skb_array.h
@@ -97,21 +97,46 @@ static inline struct sk_buff *skb_array_consume(struct skb_array *a)
97 return ptr_ring_consume(&a->ring); 97 return ptr_ring_consume(&a->ring);
98} 98}
99 99
100static inline int skb_array_consume_batched(struct skb_array *a,
101 struct sk_buff **array, int n)
102{
103 return ptr_ring_consume_batched(&a->ring, (void **)array, n);
104}
105
100static inline struct sk_buff *skb_array_consume_irq(struct skb_array *a) 106static inline struct sk_buff *skb_array_consume_irq(struct skb_array *a)
101{ 107{
102 return ptr_ring_consume_irq(&a->ring); 108 return ptr_ring_consume_irq(&a->ring);
103} 109}
104 110
111static inline int skb_array_consume_batched_irq(struct skb_array *a,
112 struct sk_buff **array, int n)
113{
114 return ptr_ring_consume_batched_irq(&a->ring, (void **)array, n);
115}
116
105static inline struct sk_buff *skb_array_consume_any(struct skb_array *a) 117static inline struct sk_buff *skb_array_consume_any(struct skb_array *a)
106{ 118{
107 return ptr_ring_consume_any(&a->ring); 119 return ptr_ring_consume_any(&a->ring);
108} 120}
109 121
122static inline int skb_array_consume_batched_any(struct skb_array *a,
123 struct sk_buff **array, int n)
124{
125 return ptr_ring_consume_batched_any(&a->ring, (void **)array, n);
126}
127
128
110static inline struct sk_buff *skb_array_consume_bh(struct skb_array *a) 129static inline struct sk_buff *skb_array_consume_bh(struct skb_array *a)
111{ 130{
112 return ptr_ring_consume_bh(&a->ring); 131 return ptr_ring_consume_bh(&a->ring);
113} 132}
114 133
134static inline int skb_array_consume_batched_bh(struct skb_array *a,
135 struct sk_buff **array, int n)
136{
137 return ptr_ring_consume_batched_bh(&a->ring, (void **)array, n);
138}
139
115static inline int __skb_array_len_with_tag(struct sk_buff *skb) 140static inline int __skb_array_len_with_tag(struct sk_buff *skb)
116{ 141{
117 if (likely(skb)) { 142 if (likely(skb)) {
@@ -156,6 +181,12 @@ static void __skb_array_destroy_skb(void *ptr)
156 kfree_skb(ptr); 181 kfree_skb(ptr);
157} 182}
158 183
184static inline void skb_array_unconsume(struct skb_array *a,
185 struct sk_buff **skbs, int n)
186{
187 ptr_ring_unconsume(&a->ring, (void **)skbs, n, __skb_array_destroy_skb);
188}
189
159static inline int skb_array_resize(struct skb_array *a, int size, gfp_t gfp) 190static inline int skb_array_resize(struct skb_array *a, int size, gfp_t gfp)
160{ 191{
161 return ptr_ring_resize(&a->ring, size, gfp, __skb_array_destroy_skb); 192 return ptr_ring_resize(&a->ring, size, gfp, __skb_array_destroy_skb);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 25b1659c832a..dbe29b6c9bd6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -109,6 +109,7 @@
109 * may perform further validation in this case. 109 * may perform further validation in this case.
110 * GRE: only if the checksum is present in the header. 110 * GRE: only if the checksum is present in the header.
111 * SCTP: indicates the CRC in SCTP header has been validated. 111 * SCTP: indicates the CRC in SCTP header has been validated.
112 * FCOE: indicates the CRC in FC frame has been validated.
112 * 113 *
113 * skb->csum_level indicates the number of consecutive checksums found in 114 * skb->csum_level indicates the number of consecutive checksums found in
114 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY. 115 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
@@ -126,8 +127,10 @@
126 * packet as seen by netif_rx() and fills out in skb->csum. Meaning, the 127 * packet as seen by netif_rx() and fills out in skb->csum. Meaning, the
127 * hardware doesn't need to parse L3/L4 headers to implement this. 128 * hardware doesn't need to parse L3/L4 headers to implement this.
128 * 129 *
129 * Note: Even if device supports only some protocols, but is able to produce 130 * Notes:
130 * skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY. 131 * - Even if device supports only some protocols, but is able to produce
132 * skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.
133 * - CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols.
131 * 134 *
132 * CHECKSUM_PARTIAL: 135 * CHECKSUM_PARTIAL:
133 * 136 *
@@ -162,14 +165,11 @@
162 * 165 *
163 * NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are being deprecated in favor of 166 * NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are being deprecated in favor of
164 * NETIF_F_HW_CSUM. New devices should use NETIF_F_HW_CSUM to indicate 167 * NETIF_F_HW_CSUM. New devices should use NETIF_F_HW_CSUM to indicate
165 * checksum offload capability. If a device has limited checksum capabilities 168 * checksum offload capability.
166 * (for instance can only perform NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM as 169 * skb_csum_hwoffload_help() can be called to resolve CHECKSUM_PARTIAL based
167 * described above) a helper function can be called to resolve 170 * on network device checksumming capabilities: if a packet does not match
168 * CHECKSUM_PARTIAL. The helper functions are skb_csum_off_chk*. The helper 171 * them, skb_checksum_help or skb_crc32c_help (depending on the value of
169 * function takes a spec argument that describes the protocol layer that is 172 * csum_not_inet, see item D.) is called to resolve the checksum.
170 * supported for checksum offload and can be called for each packet. If a
171 * packet does not match the specification for offload, skb_checksum_help
172 * is called to resolve the checksum.
173 * 173 *
174 * CHECKSUM_NONE: 174 * CHECKSUM_NONE:
175 * 175 *
@@ -189,11 +189,13 @@
189 * 189 *
190 * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of 190 * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of
191 * offloading the SCTP CRC in a packet. To perform this offload the stack 191 * offloading the SCTP CRC in a packet. To perform this offload the stack
192 * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset 192 * will set set csum_start and csum_offset accordingly, set ip_summed to
193 * accordingly. Note the there is no indication in the skbuff that the 193 * CHECKSUM_PARTIAL and set csum_not_inet to 1, to provide an indication in
194 * CHECKSUM_PARTIAL refers to an SCTP checksum, a driver that supports 194 * the skbuff that the CHECKSUM_PARTIAL refers to CRC32c.
195 * both IP checksum offload and SCTP CRC offload must verify which offload 195 * A driver that supports both IP checksum offload and SCTP CRC32c offload
196 * is configured for a packet presumably by inspecting packet headers. 196 * must verify which offload is configured for a packet by testing the
197 * value of skb->csum_not_inet; skb_crc32c_csum_help is provided to resolve
198 * CHECKSUM_PARTIAL on skbs where csum_not_inet is set to 1.
197 * 199 *
198 * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of 200 * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of
199 * offloading the FCOE CRC in a packet. To perform this offload the stack 201 * offloading the FCOE CRC in a packet. To perform this offload the stack
@@ -250,7 +252,7 @@ struct nf_conntrack {
250 252
251#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 253#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
252struct nf_bridge_info { 254struct nf_bridge_info {
253 atomic_t use; 255 refcount_t use;
254 enum { 256 enum {
255 BRNF_PROTO_UNCHANGED, 257 BRNF_PROTO_UNCHANGED,
256 BRNF_PROTO_8021Q, 258 BRNF_PROTO_8021Q,
@@ -506,66 +508,6 @@ typedef unsigned int sk_buff_data_t;
506typedef unsigned char *sk_buff_data_t; 508typedef unsigned char *sk_buff_data_t;
507#endif 509#endif
508 510
509/**
510 * struct skb_mstamp - multi resolution time stamps
511 * @stamp_us: timestamp in us resolution
512 * @stamp_jiffies: timestamp in jiffies
513 */
514struct skb_mstamp {
515 union {
516 u64 v64;
517 struct {
518 u32 stamp_us;
519 u32 stamp_jiffies;
520 };
521 };
522};
523
524/**
525 * skb_mstamp_get - get current timestamp
526 * @cl: place to store timestamps
527 */
528static inline void skb_mstamp_get(struct skb_mstamp *cl)
529{
530 u64 val = local_clock();
531
532 do_div(val, NSEC_PER_USEC);
533 cl->stamp_us = (u32)val;
534 cl->stamp_jiffies = (u32)jiffies;
535}
536
537/**
538 * skb_mstamp_delta - compute the difference in usec between two skb_mstamp
539 * @t1: pointer to newest sample
540 * @t0: pointer to oldest sample
541 */
542static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
543 const struct skb_mstamp *t0)
544{
545 s32 delta_us = t1->stamp_us - t0->stamp_us;
546 u32 delta_jiffies = t1->stamp_jiffies - t0->stamp_jiffies;
547
548 /* If delta_us is negative, this might be because interval is too big,
549 * or local_clock() drift is too big : fallback using jiffies.
550 */
551 if (delta_us <= 0 ||
552 delta_jiffies >= (INT_MAX / (USEC_PER_SEC / HZ)))
553
554 delta_us = jiffies_to_usecs(delta_jiffies);
555
556 return delta_us;
557}
558
559static inline bool skb_mstamp_after(const struct skb_mstamp *t1,
560 const struct skb_mstamp *t0)
561{
562 s32 diff = t1->stamp_jiffies - t0->stamp_jiffies;
563
564 if (!diff)
565 diff = t1->stamp_us - t0->stamp_us;
566 return diff > 0;
567}
568
569/** 511/**
570 * struct sk_buff - socket buffer 512 * struct sk_buff - socket buffer
571 * @next: Next buffer in list 513 * @next: Next buffer in list
@@ -616,6 +558,7 @@ static inline bool skb_mstamp_after(const struct skb_mstamp *t1,
616 * @wifi_acked_valid: wifi_acked was set 558 * @wifi_acked_valid: wifi_acked was set
617 * @wifi_acked: whether frame was acked on wifi or not 559 * @wifi_acked: whether frame was acked on wifi or not
618 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 560 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
561 * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL
619 * @dst_pending_confirm: need to confirm neighbour 562 * @dst_pending_confirm: need to confirm neighbour
620 * @napi_id: id of the NAPI struct this skb came from 563 * @napi_id: id of the NAPI struct this skb came from
621 * @secmark: security marking 564 * @secmark: security marking
@@ -646,7 +589,7 @@ struct sk_buff {
646 589
647 union { 590 union {
648 ktime_t tstamp; 591 ktime_t tstamp;
649 struct skb_mstamp skb_mstamp; 592 u64 skb_mstamp;
650 }; 593 };
651 }; 594 };
652 struct rb_node rbnode; /* used in netem & tcp stack */ 595 struct rb_node rbnode; /* used in netem & tcp stack */
@@ -744,7 +687,7 @@ struct sk_buff {
744 __u8 csum_valid:1; 687 __u8 csum_valid:1;
745 __u8 csum_complete_sw:1; 688 __u8 csum_complete_sw:1;
746 __u8 csum_level:2; 689 __u8 csum_level:2;
747 __u8 csum_bad:1; 690 __u8 csum_not_inet:1;
748 691
749 __u8 dst_pending_confirm:1; 692 __u8 dst_pending_confirm:1;
750#ifdef CONFIG_IPV6_NDISC_NODETYPE 693#ifdef CONFIG_IPV6_NDISC_NODETYPE
@@ -818,7 +761,7 @@ struct sk_buff {
818 unsigned char *head, 761 unsigned char *head,
819 *data; 762 *data;
820 unsigned int truesize; 763 unsigned int truesize;
821 atomic_t users; 764 refcount_t users;
822}; 765};
823 766
824#ifdef __KERNEL__ 767#ifdef __KERNEL__
@@ -915,10 +858,34 @@ static inline bool skb_pkt_type_ok(u32 ptype)
915 return ptype <= PACKET_OTHERHOST; 858 return ptype <= PACKET_OTHERHOST;
916} 859}
917 860
861static inline unsigned int skb_napi_id(const struct sk_buff *skb)
862{
863#ifdef CONFIG_NET_RX_BUSY_POLL
864 return skb->napi_id;
865#else
866 return 0;
867#endif
868}
869
870/* decrement the reference count and return true if we can free the skb */
871static inline bool skb_unref(struct sk_buff *skb)
872{
873 if (unlikely(!skb))
874 return false;
875 if (likely(refcount_read(&skb->users) == 1))
876 smp_rmb();
877 else if (likely(!refcount_dec_and_test(&skb->users)))
878 return false;
879
880 return true;
881}
882
883void skb_release_head_state(struct sk_buff *skb);
918void kfree_skb(struct sk_buff *skb); 884void kfree_skb(struct sk_buff *skb);
919void kfree_skb_list(struct sk_buff *segs); 885void kfree_skb_list(struct sk_buff *segs);
920void skb_tx_error(struct sk_buff *skb); 886void skb_tx_error(struct sk_buff *skb);
921void consume_skb(struct sk_buff *skb); 887void consume_skb(struct sk_buff *skb);
888void consume_stateless_skb(struct sk_buff *skb);
922void __kfree_skb(struct sk_buff *skb); 889void __kfree_skb(struct sk_buff *skb);
923extern struct kmem_cache *skbuff_head_cache; 890extern struct kmem_cache *skbuff_head_cache;
924 891
@@ -948,7 +915,7 @@ struct sk_buff_fclones {
948 915
949 struct sk_buff skb2; 916 struct sk_buff skb2;
950 917
951 atomic_t fclone_ref; 918 refcount_t fclone_ref;
952}; 919};
953 920
954/** 921/**
@@ -968,7 +935,7 @@ static inline bool skb_fclone_busy(const struct sock *sk,
968 fclones = container_of(skb, struct sk_buff_fclones, skb1); 935 fclones = container_of(skb, struct sk_buff_fclones, skb1);
969 936
970 return skb->fclone == SKB_FCLONE_ORIG && 937 return skb->fclone == SKB_FCLONE_ORIG &&
971 atomic_read(&fclones->fclone_ref) > 1 && 938 refcount_read(&fclones->fclone_ref) > 1 &&
972 fclones->skb2.sk == sk; 939 fclones->skb2.sk == sk;
973} 940}
974 941
@@ -1001,10 +968,10 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
1001 unsigned int headroom); 968 unsigned int headroom);
1002struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, 969struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
1003 int newtailroom, gfp_t priority); 970 int newtailroom, gfp_t priority);
1004int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg, 971int __must_check skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
1005 int offset, int len); 972 int offset, int len);
1006int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, 973int __must_check skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg,
1007 int len); 974 int offset, int len);
1008int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); 975int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
1009int skb_pad(struct sk_buff *skb, int pad); 976int skb_pad(struct sk_buff *skb, int pad);
1010#define dev_kfree_skb(a) consume_skb(a) 977#define dev_kfree_skb(a) consume_skb(a)
@@ -1316,7 +1283,7 @@ static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
1316 */ 1283 */
1317static inline struct sk_buff *skb_get(struct sk_buff *skb) 1284static inline struct sk_buff *skb_get(struct sk_buff *skb)
1318{ 1285{
1319 atomic_inc(&skb->users); 1286 refcount_inc(&skb->users);
1320 return skb; 1287 return skb;
1321} 1288}
1322 1289
@@ -1417,7 +1384,7 @@ static inline void __skb_header_release(struct sk_buff *skb)
1417 */ 1384 */
1418static inline int skb_shared(const struct sk_buff *skb) 1385static inline int skb_shared(const struct sk_buff *skb)
1419{ 1386{
1420 return atomic_read(&skb->users) != 1; 1387 return refcount_read(&skb->users) != 1;
1421} 1388}
1422 1389
1423/** 1390/**
@@ -1926,41 +1893,87 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1926/* 1893/*
1927 * Add data to an sk_buff 1894 * Add data to an sk_buff
1928 */ 1895 */
1929unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 1896void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
1930unsigned char *skb_put(struct sk_buff *skb, unsigned int len); 1897void *skb_put(struct sk_buff *skb, unsigned int len);
1931static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 1898static inline void *__skb_put(struct sk_buff *skb, unsigned int len)
1932{ 1899{
1933 unsigned char *tmp = skb_tail_pointer(skb); 1900 void *tmp = skb_tail_pointer(skb);
1934 SKB_LINEAR_ASSERT(skb); 1901 SKB_LINEAR_ASSERT(skb);
1935 skb->tail += len; 1902 skb->tail += len;
1936 skb->len += len; 1903 skb->len += len;
1937 return tmp; 1904 return tmp;
1938} 1905}
1939 1906
1940unsigned char *skb_push(struct sk_buff *skb, unsigned int len); 1907static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len)
1941static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) 1908{
1909 void *tmp = __skb_put(skb, len);
1910
1911 memset(tmp, 0, len);
1912 return tmp;
1913}
1914
1915static inline void *__skb_put_data(struct sk_buff *skb, const void *data,
1916 unsigned int len)
1917{
1918 void *tmp = __skb_put(skb, len);
1919
1920 memcpy(tmp, data, len);
1921 return tmp;
1922}
1923
1924static inline void __skb_put_u8(struct sk_buff *skb, u8 val)
1925{
1926 *(u8 *)__skb_put(skb, 1) = val;
1927}
1928
1929static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len)
1930{
1931 void *tmp = skb_put(skb, len);
1932
1933 memset(tmp, 0, len);
1934
1935 return tmp;
1936}
1937
1938static inline void *skb_put_data(struct sk_buff *skb, const void *data,
1939 unsigned int len)
1940{
1941 void *tmp = skb_put(skb, len);
1942
1943 memcpy(tmp, data, len);
1944
1945 return tmp;
1946}
1947
1948static inline void skb_put_u8(struct sk_buff *skb, u8 val)
1949{
1950 *(u8 *)skb_put(skb, 1) = val;
1951}
1952
1953void *skb_push(struct sk_buff *skb, unsigned int len);
1954static inline void *__skb_push(struct sk_buff *skb, unsigned int len)
1942{ 1955{
1943 skb->data -= len; 1956 skb->data -= len;
1944 skb->len += len; 1957 skb->len += len;
1945 return skb->data; 1958 return skb->data;
1946} 1959}
1947 1960
1948unsigned char *skb_pull(struct sk_buff *skb, unsigned int len); 1961void *skb_pull(struct sk_buff *skb, unsigned int len);
1949static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) 1962static inline void *__skb_pull(struct sk_buff *skb, unsigned int len)
1950{ 1963{
1951 skb->len -= len; 1964 skb->len -= len;
1952 BUG_ON(skb->len < skb->data_len); 1965 BUG_ON(skb->len < skb->data_len);
1953 return skb->data += len; 1966 return skb->data += len;
1954} 1967}
1955 1968
1956static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len) 1969static inline void *skb_pull_inline(struct sk_buff *skb, unsigned int len)
1957{ 1970{
1958 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); 1971 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
1959} 1972}
1960 1973
1961unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 1974void *__pskb_pull_tail(struct sk_buff *skb, int delta);
1962 1975
1963static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1976static inline void *__pskb_pull(struct sk_buff *skb, unsigned int len)
1964{ 1977{
1965 if (len > skb_headlen(skb) && 1978 if (len > skb_headlen(skb) &&
1966 !__pskb_pull_tail(skb, len - skb_headlen(skb))) 1979 !__pskb_pull_tail(skb, len - skb_headlen(skb)))
@@ -1969,7 +1982,7 @@ static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
1969 return skb->data += len; 1982 return skb->data += len;
1970} 1983}
1971 1984
1972static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len) 1985static inline void *pskb_pull(struct sk_buff *skb, unsigned int len)
1973{ 1986{
1974 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); 1987 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
1975} 1988}
@@ -2193,6 +2206,11 @@ static inline int skb_mac_offset(const struct sk_buff *skb)
2193 return skb_mac_header(skb) - skb->data; 2206 return skb_mac_header(skb) - skb->data;
2194} 2207}
2195 2208
2209static inline u32 skb_mac_header_len(const struct sk_buff *skb)
2210{
2211 return skb->network_header - skb->mac_header;
2212}
2213
2196static inline int skb_mac_header_was_set(const struct sk_buff *skb) 2214static inline int skb_mac_header_was_set(const struct sk_buff *skb)
2197{ 2215{
2198 return skb->mac_header != (typeof(skb->mac_header))~0U; 2216 return skb->mac_header != (typeof(skb->mac_header))~0U;
@@ -2952,7 +2970,7 @@ static inline void skb_postpush_rcsum(struct sk_buff *skb,
2952 __skb_postpush_rcsum(skb, start, len, 0); 2970 __skb_postpush_rcsum(skb, start, len, 0);
2953} 2971}
2954 2972
2955unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); 2973void *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2956 2974
2957/** 2975/**
2958 * skb_push_rcsum - push skb and update receive checksum 2976 * skb_push_rcsum - push skb and update receive checksum
@@ -2965,8 +2983,7 @@ unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2965 * that the checksum difference is zero (e.g., a valid IP header) 2983 * that the checksum difference is zero (e.g., a valid IP header)
2966 * or you are setting ip_summed to CHECKSUM_NONE. 2984 * or you are setting ip_summed to CHECKSUM_NONE.
2967 */ 2985 */
2968static inline unsigned char *skb_push_rcsum(struct sk_buff *skb, 2986static inline void *skb_push_rcsum(struct sk_buff *skb, unsigned int len)
2969 unsigned int len)
2970{ 2987{
2971 skb_push(skb, len); 2988 skb_push(skb, len);
2972 skb_postpush_rcsum(skb, skb->data, len); 2989 skb_postpush_rcsum(skb, skb->data, len);
@@ -3056,6 +3073,13 @@ static inline void skb_frag_list_init(struct sk_buff *skb)
3056 3073
3057int __skb_wait_for_more_packets(struct sock *sk, int *err, long *timeo_p, 3074int __skb_wait_for_more_packets(struct sock *sk, int *err, long *timeo_p,
3058 const struct sk_buff *skb); 3075 const struct sk_buff *skb);
3076struct sk_buff *__skb_try_recv_from_queue(struct sock *sk,
3077 struct sk_buff_head *queue,
3078 unsigned int flags,
3079 void (*destructor)(struct sock *sk,
3080 struct sk_buff *skb),
3081 int *peeked, int *off, int *err,
3082 struct sk_buff **last);
3059struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags, 3083struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned flags,
3060 void (*destructor)(struct sock *sk, 3084 void (*destructor)(struct sock *sk,
3061 struct sk_buff *skb), 3085 struct sk_buff *skb),
@@ -3129,6 +3153,8 @@ struct skb_checksum_ops {
3129 __wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len); 3153 __wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len);
3130}; 3154};
3131 3155
3156extern const struct skb_checksum_ops *crc32c_csum_stub __read_mostly;
3157
3132__wsum __skb_checksum(const struct sk_buff *skb, int offset, int len, 3158__wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
3133 __wsum csum, const struct skb_checksum_ops *ops); 3159 __wsum csum, const struct skb_checksum_ops *ops);
3134__wsum skb_checksum(const struct sk_buff *skb, int offset, int len, 3160__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
@@ -3298,13 +3324,6 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb,
3298void skb_tstamp_tx(struct sk_buff *orig_skb, 3324void skb_tstamp_tx(struct sk_buff *orig_skb,
3299 struct skb_shared_hwtstamps *hwtstamps); 3325 struct skb_shared_hwtstamps *hwtstamps);
3300 3326
3301static inline void sw_tx_timestamp(struct sk_buff *skb)
3302{
3303 if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP &&
3304 !(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS))
3305 skb_tstamp_tx(skb, NULL);
3306}
3307
3308/** 3327/**
3309 * skb_tx_timestamp() - Driver hook for transmit timestamping 3328 * skb_tx_timestamp() - Driver hook for transmit timestamping
3310 * 3329 *
@@ -3320,7 +3339,8 @@ static inline void sw_tx_timestamp(struct sk_buff *skb)
3320static inline void skb_tx_timestamp(struct sk_buff *skb) 3339static inline void skb_tx_timestamp(struct sk_buff *skb)
3321{ 3340{
3322 skb_clone_tx_timestamp(skb); 3341 skb_clone_tx_timestamp(skb);
3323 sw_tx_timestamp(skb); 3342 if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP)
3343 skb_tstamp_tx(skb, NULL);
3324} 3344}
3325 3345
3326/** 3346/**
@@ -3386,21 +3406,6 @@ static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
3386 } 3406 }
3387} 3407}
3388 3408
3389static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
3390{
3391 /* Mark current checksum as bad (typically called from GRO
3392 * path). In the case that ip_summed is CHECKSUM_NONE
3393 * this must be the first checksum encountered in the packet.
3394 * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
3395 * checksum after the last one validated. For UDP, a zero
3396 * checksum can not be marked as bad.
3397 */
3398
3399 if (skb->ip_summed == CHECKSUM_NONE ||
3400 skb->ip_summed == CHECKSUM_UNNECESSARY)
3401 skb->csum_bad = 1;
3402}
3403
3404/* Check if we need to perform checksum complete validation. 3409/* Check if we need to perform checksum complete validation.
3405 * 3410 *
3406 * Returns true if checksum complete is needed, false otherwise 3411 * Returns true if checksum complete is needed, false otherwise
@@ -3454,9 +3459,6 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
3454 skb->csum_valid = 1; 3459 skb->csum_valid = 1;
3455 return 0; 3460 return 0;
3456 } 3461 }
3457 } else if (skb->csum_bad) {
3458 /* ip_summed == CHECKSUM_NONE in this case */
3459 return (__force __sum16)1;
3460 } 3462 }
3461 3463
3462 skb->csum = psum; 3464 skb->csum = psum;
@@ -3516,8 +3518,7 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
3516 3518
3517static inline bool __skb_checksum_convert_check(struct sk_buff *skb) 3519static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
3518{ 3520{
3519 return (skb->ip_summed == CHECKSUM_NONE && 3521 return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid);
3520 skb->csum_valid && !skb->csum_bad);
3521} 3522}
3522 3523
3523static inline void __skb_checksum_convert(struct sk_buff *skb, 3524static inline void __skb_checksum_convert(struct sk_buff *skb,
@@ -3593,13 +3594,13 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
3593#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 3594#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
3594static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 3595static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
3595{ 3596{
3596 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) 3597 if (nf_bridge && refcount_dec_and_test(&nf_bridge->use))
3597 kfree(nf_bridge); 3598 kfree(nf_bridge);
3598} 3599}
3599static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge) 3600static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
3600{ 3601{
3601 if (nf_bridge) 3602 if (nf_bridge)
3602 atomic_inc(&nf_bridge->use); 3603 refcount_inc(&nf_bridge->use);
3603} 3604}
3604#endif /* CONFIG_BRIDGE_NETFILTER */ 3605#endif /* CONFIG_BRIDGE_NETFILTER */
3605static inline void nf_reset(struct sk_buff *skb) 3606static inline void nf_reset(struct sk_buff *skb)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 082027457825..8b13db5163cc 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -334,6 +334,7 @@ struct ucred {
334#define SOL_ALG 279 334#define SOL_ALG 279
335#define SOL_NFC 280 335#define SOL_NFC 280
336#define SOL_KCM 281 336#define SOL_KCM 281
337#define SOL_TLS 282
337 338
338/* IPX options */ 339/* IPX options */
339#define IPX_TYPE 1 340#define IPX_TYPE 1
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 3921cb9dfadb..108739ff9223 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -177,6 +177,7 @@ struct plat_stmmacenet_data {
177 void (*fix_mac_speed)(void *priv, unsigned int speed); 177 void (*fix_mac_speed)(void *priv, unsigned int speed);
178 int (*init)(struct platform_device *pdev, void *priv); 178 int (*init)(struct platform_device *pdev, void *priv);
179 void (*exit)(struct platform_device *pdev, void *priv); 179 void (*exit)(struct platform_device *pdev, void *priv);
180 struct mac_device_info *(*setup)(void *priv);
180 void *bsp_priv; 181 void *bsp_priv;
181 struct clk *stmmac_clk; 182 struct clk *stmmac_clk;
182 struct clk *pclk; 183 struct clk *pclk;
@@ -185,6 +186,7 @@ struct plat_stmmacenet_data {
185 struct reset_control *stmmac_rst; 186 struct reset_control *stmmac_rst;
186 struct stmmac_axi *axi; 187 struct stmmac_axi *axi;
187 int has_gmac4; 188 int has_gmac4;
189 bool has_sun8i;
188 bool tso_en; 190 bool tso_en;
189 int mac_port_sel_speed; 191 int mac_port_sel_speed;
190 bool en_tx_lpi_clockgating; 192 bool en_tx_lpi_clockgating;
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 36eebc451b41..cebdf8745901 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -13,6 +13,7 @@
13#define _LINUX_SUNRPC_AUTH_GSS_H 13#define _LINUX_SUNRPC_AUTH_GSS_H
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16#include <linux/refcount.h>
16#include <linux/sunrpc/auth.h> 17#include <linux/sunrpc/auth.h>
17#include <linux/sunrpc/svc.h> 18#include <linux/sunrpc/svc.h>
18#include <linux/sunrpc/gss_api.h> 19#include <linux/sunrpc/gss_api.h>
@@ -65,7 +66,7 @@ struct rpc_gss_init_res {
65 * the wire when communicating with a server. */ 66 * the wire when communicating with a server. */
66 67
67struct gss_cl_ctx { 68struct gss_cl_ctx {
68 atomic_t count; 69 refcount_t count;
69 enum rpc_gss_proc gc_proc; 70 enum rpc_gss_proc gc_proc;
70 u32 gc_seq; 71 u32 gc_seq;
71 spinlock_t gc_seq_lock; 72 spinlock_t gc_seq_lock;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index b6d5adcee8fc..542ca1ae02c4 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -123,7 +123,7 @@ struct tcp_request_sock_ops;
123struct tcp_request_sock { 123struct tcp_request_sock {
124 struct inet_request_sock req; 124 struct inet_request_sock req;
125 const struct tcp_request_sock_ops *af_specific; 125 const struct tcp_request_sock_ops *af_specific;
126 struct skb_mstamp snt_synack; /* first SYNACK sent time */ 126 u64 snt_synack; /* first SYNACK sent time */
127 bool tfo_listener; 127 bool tfo_listener;
128 u32 txhash; 128 u32 txhash;
129 u32 rcv_isn; 129 u32 rcv_isn;
@@ -211,7 +211,7 @@ struct tcp_sock {
211 211
212 /* Information of the most recently (s)acked skb */ 212 /* Information of the most recently (s)acked skb */
213 struct tcp_rack { 213 struct tcp_rack {
214 struct skb_mstamp mstamp; /* (Re)sent time of the skb */ 214 u64 mstamp; /* (Re)sent time of the skb */
215 u32 rtt_us; /* Associated RTT */ 215 u32 rtt_us; /* Associated RTT */
216 u32 end_seq; /* Ending TCP sequence of the skb */ 216 u32 end_seq; /* Ending TCP sequence of the skb */
217 u8 advanced; /* mstamp advanced since last lost marking */ 217 u8 advanced; /* mstamp advanced since last lost marking */
@@ -240,7 +240,7 @@ struct tcp_sock {
240 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 240 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
241 241
242/* RTT measurement */ 242/* RTT measurement */
243 struct skb_mstamp tcp_mstamp; /* most recent packet received/sent */ 243 u64 tcp_mstamp; /* most recent packet received/sent */
244 u32 srtt_us; /* smoothed round trip time << 3 in usecs */ 244 u32 srtt_us; /* smoothed round trip time << 3 in usecs */
245 u32 mdev_us; /* medium deviation */ 245 u32 mdev_us; /* medium deviation */
246 u32 mdev_max_us; /* maximal mdev for the last rtt period */ 246 u32 mdev_max_us; /* maximal mdev for the last rtt period */
@@ -280,8 +280,8 @@ struct tcp_sock {
280 u32 delivered; /* Total data packets delivered incl. rexmits */ 280 u32 delivered; /* Total data packets delivered incl. rexmits */
281 u32 lost; /* Total data packets lost incl. rexmits */ 281 u32 lost; /* Total data packets lost incl. rexmits */
282 u32 app_limited; /* limited until "delivered" reaches this val */ 282 u32 app_limited; /* limited until "delivered" reaches this val */
283 struct skb_mstamp first_tx_mstamp; /* start of window send phase */ 283 u64 first_tx_mstamp; /* start of window send phase */
284 struct skb_mstamp delivered_mstamp; /* time we reached "delivered" */ 284 u64 delivered_mstamp; /* time we reached "delivered" */
285 u32 rate_delivered; /* saved rate sample: packets delivered */ 285 u32 rate_delivered; /* saved rate sample: packets delivered */
286 u32 rate_interval_us; /* saved rate sample: time elapsed */ 286 u32 rate_interval_us; /* saved rate sample: time elapsed */
287 287
@@ -293,6 +293,8 @@ struct tcp_sock {
293 u32 sacked_out; /* SACK'd packets */ 293 u32 sacked_out; /* SACK'd packets */
294 u32 fackets_out; /* FACK'd packets */ 294 u32 fackets_out; /* FACK'd packets */
295 295
296 struct hrtimer pacing_timer;
297
296 /* from STCP, retrans queue hinting */ 298 /* from STCP, retrans queue hinting */
297 struct sk_buff* lost_skb_hint; 299 struct sk_buff* lost_skb_hint;
298 struct sk_buff *retransmit_skb_hint; 300 struct sk_buff *retransmit_skb_hint;
@@ -333,16 +335,16 @@ struct tcp_sock {
333 335
334/* Receiver side RTT estimation */ 336/* Receiver side RTT estimation */
335 struct { 337 struct {
336 u32 rtt_us; 338 u32 rtt_us;
337 u32 seq; 339 u32 seq;
338 struct skb_mstamp time; 340 u64 time;
339 } rcv_rtt_est; 341 } rcv_rtt_est;
340 342
341/* Receiver queue space */ 343/* Receiver queue space */
342 struct { 344 struct {
343 int space; 345 int space;
344 u32 seq; 346 u32 seq;
345 struct skb_mstamp time; 347 u64 time;
346 } rcvq_space; 348 } rcvq_space;
347 349
348/* TCP-specific MTU probe information. */ 350/* TCP-specific MTU probe information. */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 6cb4061a720d..eaea63bc79bb 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -80,6 +80,9 @@ struct udp_sock {
80 struct sk_buff *skb, 80 struct sk_buff *skb,
81 int nhoff); 81 int nhoff);
82 82
83 /* udp_recvmsg try to use this before splicing sk_receive_queue */
84 struct sk_buff_head reader_queue ____cacheline_aligned_in_smp;
85
83 /* This field is dirtied by udp_recvmsg() */ 86 /* This field is dirtied by udp_recvmsg() */
84 int forward_deficit; 87 int forward_deficit;
85}; 88};
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 00d232406f18..021f7a88f52c 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -117,6 +117,9 @@ struct cdc_ncm_ctx {
117 u32 tx_curr_frame_num; 117 u32 tx_curr_frame_num;
118 u32 rx_max; 118 u32 rx_max;
119 u32 tx_max; 119 u32 tx_max;
120 u32 tx_curr_size;
121 u32 tx_low_mem_max_cnt;
122 u32 tx_low_mem_val;
120 u32 max_datagram_size; 123 u32 max_datagram_size;
121 u16 tx_max_datagrams; 124 u16 tx_max_datagrams;
122 u16 tx_remainder; 125 u16 tx_remainder;