xref: /openbmc/linux/drivers/net/ethernet/ibm/ibmvnic.h (revision d37cf9b63113f13d742713881ce691fc615d8b3b)
1d5bb994bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2032c5e82SThomas Falcon /**************************************************************************/
3032c5e82SThomas Falcon /*                                                                        */
4032c5e82SThomas Falcon /*  IBM System i and System p Virtual NIC Device Driver                   */
5032c5e82SThomas Falcon /*  Copyright (C) 2014 IBM Corp.                                          */
6032c5e82SThomas Falcon /*  Santiago Leon (santi_leon@yahoo.com)                                  */
7032c5e82SThomas Falcon /*  Thomas Falcon (tlfalcon@linux.vnet.ibm.com)                           */
8032c5e82SThomas Falcon /*  John Allen (jallen@linux.vnet.ibm.com)                                */
9032c5e82SThomas Falcon /*                                                                        */
10032c5e82SThomas Falcon /*                                                                        */
11032c5e82SThomas Falcon /* This module contains the implementation of a virtual ethernet device   */
12032c5e82SThomas Falcon /* for use with IBM i/pSeries LPAR Linux.  It utilizes the logical LAN    */
13032c5e82SThomas Falcon /* option of the RS/6000 Platform Architecture to interface with virtual */
14032c5e82SThomas Falcon /* ethernet NICs that are presented to the partition by the hypervisor.   */
15032c5e82SThomas Falcon /*                                                                        */
16032c5e82SThomas Falcon /**************************************************************************/
17032c5e82SThomas Falcon 
18032c5e82SThomas Falcon #define IBMVNIC_NAME		"ibmvnic"
199fa2f2ccSThomas Falcon #define IBMVNIC_DRIVER_VERSION	"1.0.1"
20032c5e82SThomas Falcon #define IBMVNIC_INVALID_MAP	-1
21b27507bbSJuliet Kim #define IBMVNIC_OPEN_FAILED	3
222a1bf511SJohn Allen 
23032c5e82SThomas Falcon /* basic structures plus 100 2k buffers */
24032c5e82SThomas Falcon #define IBMVNIC_IO_ENTITLEMENT_DEFAULT	610305
25032c5e82SThomas Falcon 
26032c5e82SThomas Falcon /* Initial module_parameters */
27032c5e82SThomas Falcon #define IBMVNIC_RX_WEIGHT		16
28032c5e82SThomas Falcon /* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
29032c5e82SThomas Falcon #define IBMVNIC_BUFFS_PER_POOL	100
30ad95a240SThomas Falcon #define IBMVNIC_MAX_QUEUES	16
3120b5ba1fSThomas Falcon #define IBMVNIC_MAX_QUEUE_SZ   4096
32a6f2fe5fSDany Madden #define IBMVNIC_MAX_IND_DESCS  16
33f019fb63SThomas Falcon #define IBMVNIC_IND_ARR_SZ	(IBMVNIC_MAX_IND_DESCS * 32)
34032c5e82SThomas Falcon 
35fdb06105SThomas Falcon #define IBMVNIC_TSO_BUF_SZ	65536
36fdb06105SThomas Falcon #define IBMVNIC_TSO_BUFS	64
3706b3e357SThomas Falcon #define IBMVNIC_TSO_POOL_MASK	0x80000000
38fdb06105SThomas Falcon 
39a75de820SSukadev Bhattiprolu /* A VNIC adapter has set of Rx and Tx pools (aka queues). Each Rx/Tx pool
40a75de820SSukadev Bhattiprolu  * has a set of buffers. The size of each buffer is determined by the MTU.
41a75de820SSukadev Bhattiprolu  *
42a75de820SSukadev Bhattiprolu  * Each Rx/Tx pool is also associated with a DMA region that is shared
43a75de820SSukadev Bhattiprolu  * with the "hardware" (VIOS) and used to send/receive packets. The DMA
44a75de820SSukadev Bhattiprolu  * region is also referred to as a Long Term Buffer or LTB.
45a75de820SSukadev Bhattiprolu  *
46a75de820SSukadev Bhattiprolu  * The size of the DMA region required for an Rx/Tx pool depends on the
47a75de820SSukadev Bhattiprolu  * number and size (MTU) of the buffers in the pool. At the max levels
48a75de820SSukadev Bhattiprolu  * of 4096 jumbo frames (MTU=9000) we will need about 9K*4K = 36MB plus
49a75de820SSukadev Bhattiprolu  * some padding.
50a75de820SSukadev Bhattiprolu  *
51a75de820SSukadev Bhattiprolu  * But the size of a single DMA region is limited by MAX_ORDER in the
52a75de820SSukadev Bhattiprolu  * kernel (about 16MB currently).  To support say 4K Jumbo frames, we
53a75de820SSukadev Bhattiprolu  * use a set of LTBs (struct ltb_set) per pool.
54a75de820SSukadev Bhattiprolu  *
55a75de820SSukadev Bhattiprolu  * IBMVNIC_ONE_LTB_MAX  - max size of each LTB supported by kernel
56a75de820SSukadev Bhattiprolu  * IBMVNIC_ONE_LTB_SIZE - current max size of each LTB in an ltb_set
57a75de820SSukadev Bhattiprolu  * (must be <= IBMVNIC_ONE_LTB_MAX)
58a75de820SSukadev Bhattiprolu  * IBMVNIC_LTB_SET_SIZE - current size of all LTBs in an ltb_set
59a75de820SSukadev Bhattiprolu  *
60a75de820SSukadev Bhattiprolu  * Each VNIC can have upto 16 Rx, 16 Tx and 16 TSO pools. The TSO pools
61a75de820SSukadev Bhattiprolu  * are of fixed length (IBMVNIC_TSO_BUF_SZ * IBMVNIC_TSO_BUFS) of 4MB.
62a75de820SSukadev Bhattiprolu  *
63a75de820SSukadev Bhattiprolu  * The Rx and Tx pools can have upto 4096 buffers. The max size of these
64a75de820SSukadev Bhattiprolu  * buffers is about 9588 (for jumbo frames, including IBMVNIC_BUFFER_HLEN).
65a75de820SSukadev Bhattiprolu  * So, setting the IBMVNIC_LTB_SET_SIZE for a pool to 4096 * 9588 ~= 38MB.
66a75de820SSukadev Bhattiprolu  *
67a75de820SSukadev Bhattiprolu  * There is a trade-off in setting IBMVNIC_ONE_LTB_SIZE. If it is large,
68a75de820SSukadev Bhattiprolu  * the allocation of the LTB can fail when system is low in memory. If
69a75de820SSukadev Bhattiprolu  * its too small, we would need several mappings for each of the Rx/
70a75de820SSukadev Bhattiprolu  * Tx/TSO pools but there is a limit of 255 mappings per vnic in the
71a75de820SSukadev Bhattiprolu  * VNIC protocol.
72a75de820SSukadev Bhattiprolu  *
73a75de820SSukadev Bhattiprolu  * So setting IBMVNIC_ONE_LTB_SIZE to 8MB. With IBMVNIC_LTB_SET_SIZE set
74a75de820SSukadev Bhattiprolu  * to 38MB, we will need 5 LTBs per Rx and Tx pool and 1 LTB per TSO
75a75de820SSukadev Bhattiprolu  * pool for the 4MB. Thus the 16 Rx and Tx queues require 32 * 5 = 160
76a75de820SSukadev Bhattiprolu  * plus 16 for the TSO pools for a total of 176 LTB mappings per VNIC.
77a75de820SSukadev Bhattiprolu  */
7823baf831SKirill A. Shutemov #define IBMVNIC_ONE_LTB_MAX	((u32)((1 << MAX_ORDER) * PAGE_SIZE))
79a75de820SSukadev Bhattiprolu #define IBMVNIC_ONE_LTB_SIZE	min((u32)(8 << 20), IBMVNIC_ONE_LTB_MAX)
80a75de820SSukadev Bhattiprolu #define IBMVNIC_LTB_SET_SIZE	(38 << 20)
81c26eba03SJohn Allen 
82a75de820SSukadev Bhattiprolu #define IBMVNIC_BUFFER_HLEN		500
837ed5b31fSJuliet Kim #define IBMVNIC_RESET_DELAY 100
847ed5b31fSJuliet Kim 
85032c5e82SThomas Falcon struct ibmvnic_login_buffer {
86032c5e82SThomas Falcon 	__be32 len;
87032c5e82SThomas Falcon 	__be32 version;
88032c5e82SThomas Falcon #define INITIAL_VERSION_LB 1
89032c5e82SThomas Falcon 	__be32 num_txcomp_subcrqs;
90032c5e82SThomas Falcon 	__be32 off_txcomp_subcrqs;
91032c5e82SThomas Falcon 	__be32 num_rxcomp_subcrqs;
92032c5e82SThomas Falcon 	__be32 off_rxcomp_subcrqs;
93032c5e82SThomas Falcon 	__be32 login_rsp_ioba;
94032c5e82SThomas Falcon 	__be32 login_rsp_len;
9537798d02SNathan Fontenot 	__be32 client_data_offset;
9637798d02SNathan Fontenot 	__be32 client_data_len;
97032c5e82SThomas Falcon } __packed __aligned(8);
98032c5e82SThomas Falcon 
99032c5e82SThomas Falcon struct ibmvnic_login_rsp_buffer {
100032c5e82SThomas Falcon 	__be32 len;
101032c5e82SThomas Falcon 	__be32 version;
102032c5e82SThomas Falcon #define INITIAL_VERSION_LRB 1
103032c5e82SThomas Falcon 	__be32 num_txsubm_subcrqs;
104032c5e82SThomas Falcon 	__be32 off_txsubm_subcrqs;
105032c5e82SThomas Falcon 	__be32 num_rxadd_subcrqs;
106032c5e82SThomas Falcon 	__be32 off_rxadd_subcrqs;
107032c5e82SThomas Falcon 	__be32 off_rxadd_buff_size;
108032c5e82SThomas Falcon 	__be32 num_supp_tx_desc;
109032c5e82SThomas Falcon 	__be32 off_supp_tx_desc;
110032c5e82SThomas Falcon } __packed __aligned(8);
111032c5e82SThomas Falcon 
112032c5e82SThomas Falcon struct ibmvnic_query_ip_offload_buffer {
113032c5e82SThomas Falcon 	__be32 len;
114032c5e82SThomas Falcon 	__be32 version;
115032c5e82SThomas Falcon #define INITIAL_VERSION_IOB 1
116032c5e82SThomas Falcon 	u8 ipv4_chksum;
117032c5e82SThomas Falcon 	u8 ipv6_chksum;
118032c5e82SThomas Falcon 	u8 tcp_ipv4_chksum;
119032c5e82SThomas Falcon 	u8 tcp_ipv6_chksum;
120032c5e82SThomas Falcon 	u8 udp_ipv4_chksum;
121032c5e82SThomas Falcon 	u8 udp_ipv6_chksum;
122032c5e82SThomas Falcon 	u8 large_tx_ipv4;
123032c5e82SThomas Falcon 	u8 large_tx_ipv6;
124032c5e82SThomas Falcon 	u8 large_rx_ipv4;
125032c5e82SThomas Falcon 	u8 large_rx_ipv6;
126032c5e82SThomas Falcon 	u8 reserved1[14];
127032c5e82SThomas Falcon 	__be16 max_ipv4_header_size;
128032c5e82SThomas Falcon 	__be16 max_ipv6_header_size;
129032c5e82SThomas Falcon 	__be16 max_tcp_header_size;
130032c5e82SThomas Falcon 	__be16 max_udp_header_size;
131032c5e82SThomas Falcon 	__be32 max_large_tx_size;
132032c5e82SThomas Falcon 	__be32 max_large_rx_size;
133032c5e82SThomas Falcon 	u8 reserved2[16];
134032c5e82SThomas Falcon 	u8 ipv6_extension_header;
135032c5e82SThomas Falcon #define IPV6_EH_NOT_SUPPORTED	0x00
136032c5e82SThomas Falcon #define IPV6_EH_SUPPORTED_LIM	0x01
137032c5e82SThomas Falcon #define IPV6_EH_SUPPORTED	0xFF
138032c5e82SThomas Falcon 	u8 tcp_pseudosum_req;
139032c5e82SThomas Falcon #define TCP_PS_NOT_REQUIRED	0x00
140032c5e82SThomas Falcon #define TCP_PS_REQUIRED		0x01
141032c5e82SThomas Falcon 	u8 reserved3[30];
142032c5e82SThomas Falcon 	__be16 num_ipv6_ext_headers;
143032c5e82SThomas Falcon 	__be32 off_ipv6_ext_headers;
144032c5e82SThomas Falcon 	u8 reserved4[154];
145032c5e82SThomas Falcon } __packed __aligned(8);
146032c5e82SThomas Falcon 
147032c5e82SThomas Falcon struct ibmvnic_control_ip_offload_buffer {
148032c5e82SThomas Falcon 	__be32 len;
149032c5e82SThomas Falcon 	__be32 version;
150032c5e82SThomas Falcon #define INITIAL_VERSION_IOB 1
151032c5e82SThomas Falcon 	u8 ipv4_chksum;
152032c5e82SThomas Falcon 	u8 ipv6_chksum;
153032c5e82SThomas Falcon 	u8 tcp_ipv4_chksum;
154032c5e82SThomas Falcon 	u8 tcp_ipv6_chksum;
155032c5e82SThomas Falcon 	u8 udp_ipv4_chksum;
156032c5e82SThomas Falcon 	u8 udp_ipv6_chksum;
157032c5e82SThomas Falcon 	u8 large_tx_ipv4;
158032c5e82SThomas Falcon 	u8 large_tx_ipv6;
159032c5e82SThomas Falcon 	u8 bad_packet_rx;
160032c5e82SThomas Falcon 	u8 large_rx_ipv4;
161032c5e82SThomas Falcon 	u8 large_rx_ipv6;
162032c5e82SThomas Falcon 	u8 reserved4[111];
163032c5e82SThomas Falcon } __packed __aligned(8);
164032c5e82SThomas Falcon 
165032c5e82SThomas Falcon struct ibmvnic_fw_component {
166032c5e82SThomas Falcon 	u8 name[48];
167032c5e82SThomas Falcon 	__be32 trace_buff_size;
168032c5e82SThomas Falcon 	u8 correlator;
169032c5e82SThomas Falcon 	u8 trace_level;
170032c5e82SThomas Falcon 	u8 parent_correlator;
171032c5e82SThomas Falcon 	u8 error_check_level;
172032c5e82SThomas Falcon 	u8 trace_on;
173032c5e82SThomas Falcon 	u8 reserved[7];
174032c5e82SThomas Falcon 	u8 description[192];
175032c5e82SThomas Falcon } __packed __aligned(8);
176032c5e82SThomas Falcon 
177032c5e82SThomas Falcon struct ibmvnic_fw_trace_entry {
178032c5e82SThomas Falcon 	__be32 trace_id;
179032c5e82SThomas Falcon 	u8 num_valid_data;
180032c5e82SThomas Falcon 	u8 reserved[3];
181032c5e82SThomas Falcon 	__be64 pmc_registers;
182032c5e82SThomas Falcon 	__be64 timebase;
183032c5e82SThomas Falcon 	__be64 trace_data[5];
184032c5e82SThomas Falcon } __packed __aligned(8);
185032c5e82SThomas Falcon 
186032c5e82SThomas Falcon struct ibmvnic_statistics {
187032c5e82SThomas Falcon 	__be32 version;
188032c5e82SThomas Falcon 	__be32 promiscuous;
189032c5e82SThomas Falcon 	__be64 rx_packets;
190032c5e82SThomas Falcon 	__be64 rx_bytes;
191032c5e82SThomas Falcon 	__be64 tx_packets;
192032c5e82SThomas Falcon 	__be64 tx_bytes;
193032c5e82SThomas Falcon 	__be64 ucast_tx_packets;
194032c5e82SThomas Falcon 	__be64 ucast_rx_packets;
195032c5e82SThomas Falcon 	__be64 mcast_tx_packets;
196032c5e82SThomas Falcon 	__be64 mcast_rx_packets;
197032c5e82SThomas Falcon 	__be64 bcast_tx_packets;
198032c5e82SThomas Falcon 	__be64 bcast_rx_packets;
199032c5e82SThomas Falcon 	__be64 align_errors;
200032c5e82SThomas Falcon 	__be64 fcs_errors;
201032c5e82SThomas Falcon 	__be64 single_collision_frames;
202032c5e82SThomas Falcon 	__be64 multi_collision_frames;
203032c5e82SThomas Falcon 	__be64 sqe_test_errors;
204032c5e82SThomas Falcon 	__be64 deferred_tx;
205032c5e82SThomas Falcon 	__be64 late_collisions;
206032c5e82SThomas Falcon 	__be64 excess_collisions;
207032c5e82SThomas Falcon 	__be64 internal_mac_tx_errors;
208032c5e82SThomas Falcon 	__be64 carrier_sense;
209032c5e82SThomas Falcon 	__be64 too_long_frames;
210032c5e82SThomas Falcon 	__be64 internal_mac_rx_errors;
211032c5e82SThomas Falcon 	u8 reserved[72];
212032c5e82SThomas Falcon } __packed __aligned(8);
213032c5e82SThomas Falcon 
2143d52b594SJohn Allen #define NUM_TX_STATS 3
2153d52b594SJohn Allen struct ibmvnic_tx_queue_stats {
216*da8c1f9dSNick Child 	u64 batched_packets;
217*da8c1f9dSNick Child 	u64 direct_packets;
2183d52b594SJohn Allen 	u64 bytes;
2193d52b594SJohn Allen 	u64 dropped_packets;
2203d52b594SJohn Allen };
2213d52b594SJohn Allen 
2223d52b594SJohn Allen #define NUM_RX_STATS 3
2233d52b594SJohn Allen struct ibmvnic_rx_queue_stats {
2243d52b594SJohn Allen 	u64 packets;
2253d52b594SJohn Allen 	u64 bytes;
2263d52b594SJohn Allen 	u64 interrupts;
2273d52b594SJohn Allen };
2283d52b594SJohn Allen 
229032c5e82SThomas Falcon struct ibmvnic_acl_buffer {
230032c5e82SThomas Falcon 	__be32 len;
231032c5e82SThomas Falcon 	__be32 version;
232032c5e82SThomas Falcon #define INITIAL_VERSION_IOB 1
233032c5e82SThomas Falcon 	u8 mac_acls_restrict;
234032c5e82SThomas Falcon 	u8 vlan_acls_restrict;
235032c5e82SThomas Falcon 	u8 reserved1[22];
236032c5e82SThomas Falcon 	__be32 num_mac_addrs;
237032c5e82SThomas Falcon 	__be32 offset_mac_addrs;
238032c5e82SThomas Falcon 	__be32 num_vlan_ids;
239032c5e82SThomas Falcon 	__be32 offset_vlan_ids;
240032c5e82SThomas Falcon 	u8 reserved2[80];
241032c5e82SThomas Falcon } __packed __aligned(8);
242032c5e82SThomas Falcon 
243032c5e82SThomas Falcon /* descriptors have been changed, how should this be defined?  1? 4? */
244032c5e82SThomas Falcon 
245032c5e82SThomas Falcon #define IBMVNIC_TX_DESC_VERSIONS 3
246032c5e82SThomas Falcon 
247032c5e82SThomas Falcon /* is this still needed? */
248032c5e82SThomas Falcon struct ibmvnic_tx_comp_desc {
249032c5e82SThomas Falcon 	u8 first;
250032c5e82SThomas Falcon 	u8 num_comps;
251032c5e82SThomas Falcon 	__be16 rcs[5];
252032c5e82SThomas Falcon 	__be32 correlators[5];
253032c5e82SThomas Falcon } __packed __aligned(8);
254032c5e82SThomas Falcon 
255032c5e82SThomas Falcon /* some flags that included in v0 descriptor, which is gone
256032c5e82SThomas Falcon  * only used for IBMVNIC_TCP_CHKSUM and IBMVNIC_UDP_CHKSUM
257032c5e82SThomas Falcon  * and only in some offload_flags variable that doesn't seem
258032c5e82SThomas Falcon  * to be used anywhere, can probably be removed?
259032c5e82SThomas Falcon  */
260032c5e82SThomas Falcon 
261032c5e82SThomas Falcon #define IBMVNIC_TCP_CHKSUM		0x20
262032c5e82SThomas Falcon #define IBMVNIC_UDP_CHKSUM		0x08
263032c5e82SThomas Falcon 
264032c5e82SThomas Falcon struct ibmvnic_tx_desc {
265032c5e82SThomas Falcon 	u8 first;
266032c5e82SThomas Falcon 	u8 type;
267032c5e82SThomas Falcon 
268032c5e82SThomas Falcon #define IBMVNIC_TX_DESC 0x10
269032c5e82SThomas Falcon 	u8 n_crq_elem;
270032c5e82SThomas Falcon 	u8 n_sge;
271032c5e82SThomas Falcon 	u8 flags1;
272032c5e82SThomas Falcon #define IBMVNIC_TX_COMP_NEEDED		0x80
273032c5e82SThomas Falcon #define IBMVNIC_TX_CHKSUM_OFFLOAD	0x40
274032c5e82SThomas Falcon #define IBMVNIC_TX_LSO			0x20
275032c5e82SThomas Falcon #define IBMVNIC_TX_PROT_TCP		0x10
276032c5e82SThomas Falcon #define IBMVNIC_TX_PROT_UDP		0x08
277032c5e82SThomas Falcon #define IBMVNIC_TX_PROT_IPV4		0x04
278032c5e82SThomas Falcon #define IBMVNIC_TX_PROT_IPV6		0x02
279032c5e82SThomas Falcon #define IBMVNIC_TX_VLAN_PRESENT		0x01
280032c5e82SThomas Falcon 	u8 flags2;
281032c5e82SThomas Falcon #define IBMVNIC_TX_VLAN_INSERT		0x80
282032c5e82SThomas Falcon 	__be16 mss;
283032c5e82SThomas Falcon 	u8 reserved[4];
284032c5e82SThomas Falcon 	__be32 correlator;
285032c5e82SThomas Falcon 	__be16 vlan_id;
286032c5e82SThomas Falcon 	__be16 dma_reg;
287032c5e82SThomas Falcon 	__be32 sge_len;
288032c5e82SThomas Falcon 	__be64 ioba;
289032c5e82SThomas Falcon } __packed __aligned(8);
290032c5e82SThomas Falcon 
291032c5e82SThomas Falcon struct ibmvnic_hdr_desc {
292032c5e82SThomas Falcon 	u8 first;
293032c5e82SThomas Falcon 	u8 type;
294032c5e82SThomas Falcon #define IBMVNIC_HDR_DESC		0x11
295032c5e82SThomas Falcon 	u8 len;
296032c5e82SThomas Falcon 	u8 l2_len;
297032c5e82SThomas Falcon 	__be16 l3_len;
298032c5e82SThomas Falcon 	u8 l4_len;
299032c5e82SThomas Falcon 	u8 flag;
300032c5e82SThomas Falcon 	u8 data[24];
301032c5e82SThomas Falcon } __packed __aligned(8);
302032c5e82SThomas Falcon 
303032c5e82SThomas Falcon struct ibmvnic_hdr_ext_desc {
304032c5e82SThomas Falcon 	u8 first;
305032c5e82SThomas Falcon 	u8 type;
306032c5e82SThomas Falcon #define IBMVNIC_HDR_EXT_DESC		0x12
307032c5e82SThomas Falcon 	u8 len;
308032c5e82SThomas Falcon 	u8 data[29];
309032c5e82SThomas Falcon } __packed __aligned(8);
310032c5e82SThomas Falcon 
311032c5e82SThomas Falcon struct ibmvnic_sge_desc {
312032c5e82SThomas Falcon 	u8 first;
313032c5e82SThomas Falcon 	u8 type;
314032c5e82SThomas Falcon #define IBMVNIC_SGE_DESC		0x30
315032c5e82SThomas Falcon 	__be16 sge1_dma_reg;
316032c5e82SThomas Falcon 	__be32 sge1_len;
317032c5e82SThomas Falcon 	__be64 sge1_ioba;
318032c5e82SThomas Falcon 	__be16 reserved;
319032c5e82SThomas Falcon 	__be16 sge2_dma_reg;
320032c5e82SThomas Falcon 	__be32 sge2_len;
321032c5e82SThomas Falcon 	__be64 sge2_ioba;
322032c5e82SThomas Falcon } __packed __aligned(8);
323032c5e82SThomas Falcon 
324032c5e82SThomas Falcon struct ibmvnic_rx_comp_desc {
325032c5e82SThomas Falcon 	u8 first;
326032c5e82SThomas Falcon 	u8 flags;
327032c5e82SThomas Falcon #define IBMVNIC_IP_CHKSUM_GOOD		0x80
328032c5e82SThomas Falcon #define IBMVNIC_TCP_UDP_CHKSUM_GOOD	0x40
329032c5e82SThomas Falcon #define IBMVNIC_END_FRAME			0x20
330032c5e82SThomas Falcon #define IBMVNIC_EXACT_MC			0x10
331032c5e82SThomas Falcon #define IBMVNIC_VLAN_STRIPPED			0x08
332032c5e82SThomas Falcon 	__be16 off_frame_data;
333032c5e82SThomas Falcon 	__be32 len;
334032c5e82SThomas Falcon 	__be64 correlator;
335032c5e82SThomas Falcon 	__be16 vlan_tci;
336032c5e82SThomas Falcon 	__be16 rc;
337032c5e82SThomas Falcon 	u8 reserved[12];
338032c5e82SThomas Falcon } __packed __aligned(8);
339032c5e82SThomas Falcon 
340032c5e82SThomas Falcon struct ibmvnic_generic_scrq {
341032c5e82SThomas Falcon 	u8 first;
342032c5e82SThomas Falcon 	u8 reserved[31];
343032c5e82SThomas Falcon } __packed __aligned(8);
344032c5e82SThomas Falcon 
345032c5e82SThomas Falcon struct ibmvnic_rx_buff_add_desc {
346032c5e82SThomas Falcon 	u8 first;
347032c5e82SThomas Falcon 	u8 reserved[7];
348032c5e82SThomas Falcon 	__be64 correlator;
349032c5e82SThomas Falcon 	__be32 ioba;
350032c5e82SThomas Falcon 	u8 map_id;
351032c5e82SThomas Falcon 	__be32 len:24;
352032c5e82SThomas Falcon 	u8 reserved2[8];
353032c5e82SThomas Falcon } __packed __aligned(8);
354032c5e82SThomas Falcon 
355032c5e82SThomas Falcon struct ibmvnic_rc {
356032c5e82SThomas Falcon 	u8 code; /* one of enum ibmvnic_rc_codes */
357032c5e82SThomas Falcon 	u8 detailed_data[3];
358032c5e82SThomas Falcon } __packed __aligned(4);
359032c5e82SThomas Falcon 
360032c5e82SThomas Falcon struct ibmvnic_generic_crq {
361032c5e82SThomas Falcon 	u8 first;
362032c5e82SThomas Falcon 	u8 cmd;
363032c5e82SThomas Falcon 	u8 params[10];
364032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
365032c5e82SThomas Falcon } __packed __aligned(8);
366032c5e82SThomas Falcon 
367032c5e82SThomas Falcon struct ibmvnic_version_exchange {
368032c5e82SThomas Falcon 	u8 first;
369032c5e82SThomas Falcon 	u8 cmd;
370032c5e82SThomas Falcon 	__be16 version;
371032c5e82SThomas Falcon #define IBMVNIC_INITIAL_VERSION 1
372032c5e82SThomas Falcon 	u8 reserved[8];
373032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
374032c5e82SThomas Falcon } __packed __aligned(8);
375032c5e82SThomas Falcon 
376032c5e82SThomas Falcon struct ibmvnic_capability {
377032c5e82SThomas Falcon 	u8 first;
378032c5e82SThomas Falcon 	u8 cmd;
379032c5e82SThomas Falcon 	__be16 capability; /* one of ibmvnic_capabilities */
380de89e854SThomas Falcon 	__be64 number;
381032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
382032c5e82SThomas Falcon } __packed __aligned(8);
383032c5e82SThomas Falcon 
384032c5e82SThomas Falcon struct ibmvnic_login {
385032c5e82SThomas Falcon 	u8 first;
386032c5e82SThomas Falcon 	u8 cmd;
387032c5e82SThomas Falcon 	u8 reserved[6];
388032c5e82SThomas Falcon 	__be32 ioba;
389032c5e82SThomas Falcon 	__be32 len;
390032c5e82SThomas Falcon } __packed __aligned(8);
391032c5e82SThomas Falcon 
392032c5e82SThomas Falcon struct ibmvnic_phys_parms {
393032c5e82SThomas Falcon 	u8 first;
394032c5e82SThomas Falcon 	u8 cmd;
395032c5e82SThomas Falcon 	u8 flags1;
396032c5e82SThomas Falcon #define IBMVNIC_EXTERNAL_LOOPBACK	0x80
397032c5e82SThomas Falcon #define IBMVNIC_INTERNAL_LOOPBACK	0x40
398032c5e82SThomas Falcon #define IBMVNIC_PROMISC		0x20
399032c5e82SThomas Falcon #define IBMVNIC_PHYS_LINK_ACTIVE	0x10
400032c5e82SThomas Falcon #define IBMVNIC_AUTONEG_DUPLEX	0x08
401032c5e82SThomas Falcon #define IBMVNIC_FULL_DUPLEX	0x04
402032c5e82SThomas Falcon #define IBMVNIC_HALF_DUPLEX	0x02
403032c5e82SThomas Falcon #define IBMVNIC_CAN_CHG_PHYS_PARMS	0x01
404032c5e82SThomas Falcon 	u8 flags2;
405032c5e82SThomas Falcon #define IBMVNIC_LOGICAL_LNK_ACTIVE 0x80
406032c5e82SThomas Falcon 	__be32 speed;
407f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_AUTONEG		0x80000000
408f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_10MBPS		0x40000000
409f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_100MBPS		0x20000000
410f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_1GBPS		0x10000000
411b9cd795bSLijun Pan #define IBMVNIC_10GBPS		0x08000000
412f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_40GBPS		0x04000000
413f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_100GBPS		0x02000000
414f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_25GBPS		0x01000000
415f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_50GBPS		0x00800000
416f8d6ae0dSMurilo Fossa Vicentini #define IBMVNIC_200GBPS		0x00400000
417032c5e82SThomas Falcon 	__be32 mtu;
418032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
419032c5e82SThomas Falcon } __packed __aligned(8);
420032c5e82SThomas Falcon 
421032c5e82SThomas Falcon struct ibmvnic_logical_link_state {
422032c5e82SThomas Falcon 	u8 first;
423032c5e82SThomas Falcon 	u8 cmd;
424032c5e82SThomas Falcon 	u8 link_state;
425032c5e82SThomas Falcon #define IBMVNIC_LOGICAL_LNK_DN 0x00
426032c5e82SThomas Falcon #define IBMVNIC_LOGICAL_LNK_UP 0x01
427032c5e82SThomas Falcon #define IBMVNIC_LOGICAL_LNK_QUERY 0xff
428032c5e82SThomas Falcon 	u8 reserved[9];
429032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
430032c5e82SThomas Falcon } __packed __aligned(8);
431032c5e82SThomas Falcon 
432032c5e82SThomas Falcon struct ibmvnic_query_ip_offload {
433032c5e82SThomas Falcon 	u8 first;
434032c5e82SThomas Falcon 	u8 cmd;
435032c5e82SThomas Falcon 	u8 reserved[2];
436032c5e82SThomas Falcon 	__be32 len;
437032c5e82SThomas Falcon 	__be32 ioba;
438032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
439032c5e82SThomas Falcon } __packed __aligned(8);
440032c5e82SThomas Falcon 
441032c5e82SThomas Falcon struct ibmvnic_control_ip_offload {
442032c5e82SThomas Falcon 	u8 first;
443032c5e82SThomas Falcon 	u8 cmd;
444032c5e82SThomas Falcon 	u8 reserved[2];
445032c5e82SThomas Falcon 	__be32 ioba;
446032c5e82SThomas Falcon 	__be32 len;
447032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
448032c5e82SThomas Falcon } __packed __aligned(8);
449032c5e82SThomas Falcon 
450032c5e82SThomas Falcon struct ibmvnic_request_statistics {
451032c5e82SThomas Falcon 	u8 first;
452032c5e82SThomas Falcon 	u8 cmd;
453032c5e82SThomas Falcon 	u8 flags;
454032c5e82SThomas Falcon #define IBMVNIC_PHYSICAL_PORT	0x80
455032c5e82SThomas Falcon 	u8 reserved1;
456032c5e82SThomas Falcon 	__be32 ioba;
457032c5e82SThomas Falcon 	__be32 len;
458032c5e82SThomas Falcon 	u8 reserved[4];
459032c5e82SThomas Falcon } __packed __aligned(8);
460032c5e82SThomas Falcon 
461032c5e82SThomas Falcon struct ibmvnic_error_indication {
462032c5e82SThomas Falcon 	u8 first;
463032c5e82SThomas Falcon 	u8 cmd;
464032c5e82SThomas Falcon 	u8 flags;
465032c5e82SThomas Falcon #define IBMVNIC_FATAL_ERROR	0x80
466032c5e82SThomas Falcon 	u8 reserved1;
467032c5e82SThomas Falcon 	__be32 error_id;
468032c5e82SThomas Falcon 	__be32 detail_error_sz;
469032c5e82SThomas Falcon 	__be16 error_cause;
470032c5e82SThomas Falcon 	u8 reserved2[2];
471032c5e82SThomas Falcon } __packed __aligned(8);
472032c5e82SThomas Falcon 
473032c5e82SThomas Falcon struct ibmvnic_link_state_indication {
474032c5e82SThomas Falcon 	u8 first;
475032c5e82SThomas Falcon 	u8 cmd;
476032c5e82SThomas Falcon 	u8 reserved1[2];
477032c5e82SThomas Falcon 	u8 phys_link_state;
478032c5e82SThomas Falcon 	u8 logical_link_state;
479032c5e82SThomas Falcon 	u8 reserved2[10];
480032c5e82SThomas Falcon } __packed __aligned(8);
481032c5e82SThomas Falcon 
482032c5e82SThomas Falcon struct ibmvnic_change_mac_addr {
483032c5e82SThomas Falcon 	u8 first;
484032c5e82SThomas Falcon 	u8 cmd;
485032c5e82SThomas Falcon 	u8 mac_addr[6];
486032c5e82SThomas Falcon 	u8 reserved[4];
487993a82b0SMurilo Fossa Vicentini 	struct ibmvnic_rc rc;
488032c5e82SThomas Falcon } __packed __aligned(8);
489032c5e82SThomas Falcon 
490032c5e82SThomas Falcon struct ibmvnic_multicast_ctrl {
491032c5e82SThomas Falcon 	u8 first;
492032c5e82SThomas Falcon 	u8 cmd;
493032c5e82SThomas Falcon 	u8 mac_addr[6];
494032c5e82SThomas Falcon 	u8 flags;
495032c5e82SThomas Falcon #define IBMVNIC_ENABLE_MC		0x80
496032c5e82SThomas Falcon #define IBMVNIC_DISABLE_MC		0x40
497032c5e82SThomas Falcon #define IBMVNIC_ENABLE_ALL		0x20
498032c5e82SThomas Falcon #define IBMVNIC_DISABLE_ALL	0x10
499032c5e82SThomas Falcon 	u8 reserved1;
500032c5e82SThomas Falcon 	__be16 reserved2; /* was num_enabled_mc_addr; */
501032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
502032c5e82SThomas Falcon } __packed __aligned(8);
503032c5e82SThomas Falcon 
5044e6759beSDesnes Augusto Nunes do Rosario struct ibmvnic_get_vpd_size {
5054e6759beSDesnes Augusto Nunes do Rosario 	u8 first;
5064e6759beSDesnes Augusto Nunes do Rosario 	u8 cmd;
5074e6759beSDesnes Augusto Nunes do Rosario 	u8 reserved[14];
5084e6759beSDesnes Augusto Nunes do Rosario } __packed __aligned(8);
5094e6759beSDesnes Augusto Nunes do Rosario 
510032c5e82SThomas Falcon struct ibmvnic_get_vpd_size_rsp {
511032c5e82SThomas Falcon 	u8 first;
512032c5e82SThomas Falcon 	u8 cmd;
513032c5e82SThomas Falcon 	u8 reserved[2];
514032c5e82SThomas Falcon 	__be64 len;
515032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
516032c5e82SThomas Falcon } __packed __aligned(8);
517032c5e82SThomas Falcon 
518032c5e82SThomas Falcon struct ibmvnic_get_vpd {
519032c5e82SThomas Falcon 	u8 first;
520032c5e82SThomas Falcon 	u8 cmd;
521032c5e82SThomas Falcon 	u8 reserved1[2];
522032c5e82SThomas Falcon 	__be32 ioba;
523032c5e82SThomas Falcon 	__be32 len;
524032c5e82SThomas Falcon 	u8 reserved[4];
525032c5e82SThomas Falcon } __packed __aligned(8);
526032c5e82SThomas Falcon 
5274e6759beSDesnes Augusto Nunes do Rosario struct ibmvnic_get_vpd_rsp {
5284e6759beSDesnes Augusto Nunes do Rosario 	u8 first;
5294e6759beSDesnes Augusto Nunes do Rosario 	u8 cmd;
5304e6759beSDesnes Augusto Nunes do Rosario 	u8 reserved[10];
5314e6759beSDesnes Augusto Nunes do Rosario 	struct ibmvnic_rc rc;
5324e6759beSDesnes Augusto Nunes do Rosario } __packed __aligned(8);
5334e6759beSDesnes Augusto Nunes do Rosario 
534032c5e82SThomas Falcon struct ibmvnic_acl_change_indication {
535032c5e82SThomas Falcon 	u8 first;
536032c5e82SThomas Falcon 	u8 cmd;
537032c5e82SThomas Falcon 	__be16 change_type;
538032c5e82SThomas Falcon #define IBMVNIC_MAC_ACL 0
539032c5e82SThomas Falcon #define IBMVNIC_VLAN_ACL 1
540032c5e82SThomas Falcon 	u8 reserved[12];
541032c5e82SThomas Falcon } __packed __aligned(8);
542032c5e82SThomas Falcon 
543032c5e82SThomas Falcon struct ibmvnic_acl_query {
544032c5e82SThomas Falcon 	u8 first;
545032c5e82SThomas Falcon 	u8 cmd;
546032c5e82SThomas Falcon 	u8 reserved1[2];
547032c5e82SThomas Falcon 	__be32 ioba;
548032c5e82SThomas Falcon 	__be32 len;
549032c5e82SThomas Falcon 	u8 reserved2[4];
550032c5e82SThomas Falcon } __packed __aligned(8);
551032c5e82SThomas Falcon 
552032c5e82SThomas Falcon struct ibmvnic_tune {
553032c5e82SThomas Falcon 	u8 first;
554032c5e82SThomas Falcon 	u8 cmd;
555032c5e82SThomas Falcon 	u8 reserved1[2];
556032c5e82SThomas Falcon 	__be32 ioba;
557032c5e82SThomas Falcon 	__be32 len;
558032c5e82SThomas Falcon 	u8 reserved2[4];
559032c5e82SThomas Falcon } __packed __aligned(8);
560032c5e82SThomas Falcon 
561032c5e82SThomas Falcon struct ibmvnic_request_map {
562032c5e82SThomas Falcon 	u8 first;
563032c5e82SThomas Falcon 	u8 cmd;
564032c5e82SThomas Falcon 	u8 reserved1;
565032c5e82SThomas Falcon 	u8 map_id;
566032c5e82SThomas Falcon 	__be32 ioba;
567032c5e82SThomas Falcon 	__be32 len;
568032c5e82SThomas Falcon 	u8 reserved2[4];
569032c5e82SThomas Falcon } __packed __aligned(8);
570032c5e82SThomas Falcon 
571032c5e82SThomas Falcon struct ibmvnic_request_map_rsp {
572032c5e82SThomas Falcon 	u8 first;
573032c5e82SThomas Falcon 	u8 cmd;
574032c5e82SThomas Falcon 	u8 reserved1;
575032c5e82SThomas Falcon 	u8 map_id;
576288ccb75SThomas Falcon 	u8 reserved2[8];
577032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
578032c5e82SThomas Falcon } __packed __aligned(8);
579032c5e82SThomas Falcon 
580032c5e82SThomas Falcon struct ibmvnic_request_unmap {
581032c5e82SThomas Falcon 	u8 first;
582032c5e82SThomas Falcon 	u8 cmd;
583032c5e82SThomas Falcon 	u8 reserved1;
584032c5e82SThomas Falcon 	u8 map_id;
585032c5e82SThomas Falcon 	u8 reserved2[12];
586032c5e82SThomas Falcon } __packed __aligned(8);
587032c5e82SThomas Falcon 
588032c5e82SThomas Falcon struct ibmvnic_request_unmap_rsp {
589032c5e82SThomas Falcon 	u8 first;
590032c5e82SThomas Falcon 	u8 cmd;
591032c5e82SThomas Falcon 	u8 reserved1;
592032c5e82SThomas Falcon 	u8 map_id;
593032c5e82SThomas Falcon 	u8 reserved2[8];
594032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
595032c5e82SThomas Falcon } __packed __aligned(8);
596032c5e82SThomas Falcon 
597032c5e82SThomas Falcon struct ibmvnic_query_map {
598032c5e82SThomas Falcon 	u8 first;
599032c5e82SThomas Falcon 	u8 cmd;
600032c5e82SThomas Falcon 	u8 reserved[14];
601032c5e82SThomas Falcon } __packed __aligned(8);
602032c5e82SThomas Falcon 
603032c5e82SThomas Falcon struct ibmvnic_query_map_rsp {
604032c5e82SThomas Falcon 	u8 first;
605032c5e82SThomas Falcon 	u8 cmd;
606032c5e82SThomas Falcon 	u8 reserved;
607032c5e82SThomas Falcon 	u8 page_size;
608032c5e82SThomas Falcon 	__be32 tot_pages;
609032c5e82SThomas Falcon 	__be32 free_pages;
610032c5e82SThomas Falcon 	struct ibmvnic_rc rc;
611032c5e82SThomas Falcon } __packed __aligned(8);
612032c5e82SThomas Falcon 
613032c5e82SThomas Falcon union ibmvnic_crq {
614032c5e82SThomas Falcon 	struct ibmvnic_generic_crq generic;
615032c5e82SThomas Falcon 	struct ibmvnic_version_exchange version_exchange;
616032c5e82SThomas Falcon 	struct ibmvnic_version_exchange version_exchange_rsp;
617032c5e82SThomas Falcon 	struct ibmvnic_capability query_capability;
618032c5e82SThomas Falcon 	struct ibmvnic_capability query_capability_rsp;
619032c5e82SThomas Falcon 	struct ibmvnic_capability request_capability;
620032c5e82SThomas Falcon 	struct ibmvnic_capability request_capability_rsp;
621032c5e82SThomas Falcon 	struct ibmvnic_login login;
622032c5e82SThomas Falcon 	struct ibmvnic_generic_crq login_rsp;
623032c5e82SThomas Falcon 	struct ibmvnic_phys_parms query_phys_parms;
624032c5e82SThomas Falcon 	struct ibmvnic_phys_parms query_phys_parms_rsp;
625032c5e82SThomas Falcon 	struct ibmvnic_phys_parms query_phys_capabilities;
626032c5e82SThomas Falcon 	struct ibmvnic_phys_parms query_phys_capabilities_rsp;
627032c5e82SThomas Falcon 	struct ibmvnic_phys_parms set_phys_parms;
628032c5e82SThomas Falcon 	struct ibmvnic_phys_parms set_phys_parms_rsp;
629032c5e82SThomas Falcon 	struct ibmvnic_logical_link_state logical_link_state;
630032c5e82SThomas Falcon 	struct ibmvnic_logical_link_state logical_link_state_rsp;
631032c5e82SThomas Falcon 	struct ibmvnic_query_ip_offload query_ip_offload;
632032c5e82SThomas Falcon 	struct ibmvnic_query_ip_offload query_ip_offload_rsp;
633032c5e82SThomas Falcon 	struct ibmvnic_control_ip_offload control_ip_offload;
634032c5e82SThomas Falcon 	struct ibmvnic_control_ip_offload control_ip_offload_rsp;
635032c5e82SThomas Falcon 	struct ibmvnic_request_statistics request_statistics;
636032c5e82SThomas Falcon 	struct ibmvnic_generic_crq request_statistics_rsp;
637032c5e82SThomas Falcon 	struct ibmvnic_error_indication error_indication;
638032c5e82SThomas Falcon 	struct ibmvnic_link_state_indication link_state_indication;
639032c5e82SThomas Falcon 	struct ibmvnic_change_mac_addr change_mac_addr;
640032c5e82SThomas Falcon 	struct ibmvnic_change_mac_addr change_mac_addr_rsp;
641032c5e82SThomas Falcon 	struct ibmvnic_multicast_ctrl multicast_ctrl;
642032c5e82SThomas Falcon 	struct ibmvnic_multicast_ctrl multicast_ctrl_rsp;
6434e6759beSDesnes Augusto Nunes do Rosario 	struct ibmvnic_get_vpd_size get_vpd_size;
644032c5e82SThomas Falcon 	struct ibmvnic_get_vpd_size_rsp get_vpd_size_rsp;
645032c5e82SThomas Falcon 	struct ibmvnic_get_vpd get_vpd;
6464e6759beSDesnes Augusto Nunes do Rosario 	struct ibmvnic_get_vpd_rsp get_vpd_rsp;
647032c5e82SThomas Falcon 	struct ibmvnic_acl_change_indication acl_change_indication;
648032c5e82SThomas Falcon 	struct ibmvnic_acl_query acl_query;
649032c5e82SThomas Falcon 	struct ibmvnic_generic_crq acl_query_rsp;
650032c5e82SThomas Falcon 	struct ibmvnic_tune tune;
651032c5e82SThomas Falcon 	struct ibmvnic_generic_crq tune_rsp;
652032c5e82SThomas Falcon 	struct ibmvnic_request_map request_map;
653032c5e82SThomas Falcon 	struct ibmvnic_request_map_rsp request_map_rsp;
654032c5e82SThomas Falcon 	struct ibmvnic_request_unmap request_unmap;
655032c5e82SThomas Falcon 	struct ibmvnic_request_unmap_rsp request_unmap_rsp;
656032c5e82SThomas Falcon 	struct ibmvnic_query_map query_map;
657032c5e82SThomas Falcon 	struct ibmvnic_query_map_rsp query_map_rsp;
658032c5e82SThomas Falcon };
659032c5e82SThomas Falcon 
660032c5e82SThomas Falcon enum ibmvnic_rc_codes {
661032c5e82SThomas Falcon 	SUCCESS = 0,
662032c5e82SThomas Falcon 	PARTIALSUCCESS = 1,
663032c5e82SThomas Falcon 	PERMISSION = 2,
664032c5e82SThomas Falcon 	NOMEMORY = 3,
665032c5e82SThomas Falcon 	PARAMETER = 4,
666032c5e82SThomas Falcon 	UNKNOWNCOMMAND = 5,
667032c5e82SThomas Falcon 	ABORTED = 6,
668032c5e82SThomas Falcon 	INVALIDSTATE = 7,
669032c5e82SThomas Falcon 	INVALIDIOBA = 8,
670032c5e82SThomas Falcon 	INVALIDLENGTH = 9,
671032c5e82SThomas Falcon 	UNSUPPORTEDOPTION = 10,
672032c5e82SThomas Falcon };
673032c5e82SThomas Falcon 
674032c5e82SThomas Falcon enum ibmvnic_capabilities {
675032c5e82SThomas Falcon 	MIN_TX_QUEUES = 1,
676032c5e82SThomas Falcon 	MIN_RX_QUEUES = 2,
677032c5e82SThomas Falcon 	MIN_RX_ADD_QUEUES = 3,
678032c5e82SThomas Falcon 	MAX_TX_QUEUES = 4,
679032c5e82SThomas Falcon 	MAX_RX_QUEUES = 5,
680032c5e82SThomas Falcon 	MAX_RX_ADD_QUEUES = 6,
681032c5e82SThomas Falcon 	REQ_TX_QUEUES = 7,
682032c5e82SThomas Falcon 	REQ_RX_QUEUES = 8,
683032c5e82SThomas Falcon 	REQ_RX_ADD_QUEUES = 9,
684032c5e82SThomas Falcon 	MIN_TX_ENTRIES_PER_SUBCRQ = 10,
685032c5e82SThomas Falcon 	MIN_RX_ADD_ENTRIES_PER_SUBCRQ = 11,
686032c5e82SThomas Falcon 	MAX_TX_ENTRIES_PER_SUBCRQ = 12,
687032c5e82SThomas Falcon 	MAX_RX_ADD_ENTRIES_PER_SUBCRQ = 13,
688032c5e82SThomas Falcon 	REQ_TX_ENTRIES_PER_SUBCRQ = 14,
689032c5e82SThomas Falcon 	REQ_RX_ADD_ENTRIES_PER_SUBCRQ = 15,
690032c5e82SThomas Falcon 	TCP_IP_OFFLOAD = 16,
691032c5e82SThomas Falcon 	PROMISC_REQUESTED = 17,
692032c5e82SThomas Falcon 	PROMISC_SUPPORTED = 18,
693032c5e82SThomas Falcon 	MIN_MTU = 19,
694032c5e82SThomas Falcon 	MAX_MTU = 20,
695032c5e82SThomas Falcon 	REQ_MTU = 21,
696032c5e82SThomas Falcon 	MAX_MULTICAST_FILTERS = 22,
697032c5e82SThomas Falcon 	VLAN_HEADER_INSERTION = 23,
6986052d5e2SMurilo Fossa Vicentini 	RX_VLAN_HEADER_INSERTION = 24,
699032c5e82SThomas Falcon 	MAX_TX_SG_ENTRIES = 25,
700032c5e82SThomas Falcon 	RX_SG_SUPPORTED = 26,
701032c5e82SThomas Falcon 	RX_SG_REQUESTED = 27,
702032c5e82SThomas Falcon 	OPT_TX_COMP_SUB_QUEUES = 28,
703032c5e82SThomas Falcon 	OPT_RX_COMP_QUEUES = 29,
704032c5e82SThomas Falcon 	OPT_RX_BUFADD_Q_PER_RX_COMP_Q = 30,
705032c5e82SThomas Falcon 	OPT_TX_ENTRIES_PER_SUBCRQ = 31,
706032c5e82SThomas Falcon 	OPT_RXBA_ENTRIES_PER_SUBCRQ = 32,
707032c5e82SThomas Falcon 	TX_RX_DESC_REQ = 33,
708032c5e82SThomas Falcon };
709032c5e82SThomas Falcon 
710032c5e82SThomas Falcon enum ibmvnic_error_cause {
711032c5e82SThomas Falcon 	ADAPTER_PROBLEM = 0,
712032c5e82SThomas Falcon 	BUS_PROBLEM = 1,
713032c5e82SThomas Falcon 	FW_PROBLEM = 2,
714032c5e82SThomas Falcon 	DD_PROBLEM = 3,
715032c5e82SThomas Falcon 	EEH_RECOVERY = 4,
716032c5e82SThomas Falcon 	FW_UPDATED = 5,
717032c5e82SThomas Falcon 	LOW_MEMORY = 6,
718032c5e82SThomas Falcon };
719032c5e82SThomas Falcon 
720032c5e82SThomas Falcon enum ibmvnic_commands {
721032c5e82SThomas Falcon 	VERSION_EXCHANGE = 0x01,
722032c5e82SThomas Falcon 	VERSION_EXCHANGE_RSP = 0x81,
723032c5e82SThomas Falcon 	QUERY_CAPABILITY = 0x02,
724032c5e82SThomas Falcon 	QUERY_CAPABILITY_RSP = 0x82,
725032c5e82SThomas Falcon 	REQUEST_CAPABILITY = 0x03,
726032c5e82SThomas Falcon 	REQUEST_CAPABILITY_RSP = 0x83,
727032c5e82SThomas Falcon 	LOGIN = 0x04,
728032c5e82SThomas Falcon 	LOGIN_RSP = 0x84,
729032c5e82SThomas Falcon 	QUERY_PHYS_PARMS = 0x05,
730032c5e82SThomas Falcon 	QUERY_PHYS_PARMS_RSP = 0x85,
731032c5e82SThomas Falcon 	QUERY_PHYS_CAPABILITIES = 0x06,
732032c5e82SThomas Falcon 	QUERY_PHYS_CAPABILITIES_RSP = 0x86,
733032c5e82SThomas Falcon 	SET_PHYS_PARMS = 0x07,
734032c5e82SThomas Falcon 	SET_PHYS_PARMS_RSP = 0x87,
735032c5e82SThomas Falcon 	ERROR_INDICATION = 0x08,
736032c5e82SThomas Falcon 	LOGICAL_LINK_STATE = 0x0C,
737032c5e82SThomas Falcon 	LOGICAL_LINK_STATE_RSP = 0x8C,
738032c5e82SThomas Falcon 	REQUEST_STATISTICS = 0x0D,
739032c5e82SThomas Falcon 	REQUEST_STATISTICS_RSP = 0x8D,
740032c5e82SThomas Falcon 	COLLECT_FW_TRACE = 0x11,
741032c5e82SThomas Falcon 	COLLECT_FW_TRACE_RSP = 0x91,
742032c5e82SThomas Falcon 	LINK_STATE_INDICATION = 0x12,
743032c5e82SThomas Falcon 	CHANGE_MAC_ADDR = 0x13,
744032c5e82SThomas Falcon 	CHANGE_MAC_ADDR_RSP = 0x93,
745032c5e82SThomas Falcon 	MULTICAST_CTRL = 0x14,
746032c5e82SThomas Falcon 	MULTICAST_CTRL_RSP = 0x94,
747032c5e82SThomas Falcon 	GET_VPD_SIZE = 0x15,
748032c5e82SThomas Falcon 	GET_VPD_SIZE_RSP = 0x95,
749032c5e82SThomas Falcon 	GET_VPD = 0x16,
750032c5e82SThomas Falcon 	GET_VPD_RSP = 0x96,
751032c5e82SThomas Falcon 	TUNE = 0x17,
752032c5e82SThomas Falcon 	TUNE_RSP = 0x97,
753032c5e82SThomas Falcon 	QUERY_IP_OFFLOAD = 0x18,
754032c5e82SThomas Falcon 	QUERY_IP_OFFLOAD_RSP = 0x98,
755032c5e82SThomas Falcon 	CONTROL_IP_OFFLOAD = 0x19,
756032c5e82SThomas Falcon 	CONTROL_IP_OFFLOAD_RSP = 0x99,
757032c5e82SThomas Falcon 	ACL_CHANGE_INDICATION = 0x1A,
758032c5e82SThomas Falcon 	ACL_QUERY = 0x1B,
759032c5e82SThomas Falcon 	ACL_QUERY_RSP = 0x9B,
760032c5e82SThomas Falcon 	QUERY_MAP = 0x1D,
761032c5e82SThomas Falcon 	QUERY_MAP_RSP = 0x9D,
762032c5e82SThomas Falcon 	REQUEST_MAP = 0x1E,
763032c5e82SThomas Falcon 	REQUEST_MAP_RSP = 0x9E,
764032c5e82SThomas Falcon 	REQUEST_UNMAP = 0x1F,
765032c5e82SThomas Falcon 	REQUEST_UNMAP_RSP = 0x9F,
766032c5e82SThomas Falcon 	VLAN_CTRL = 0x20,
767032c5e82SThomas Falcon 	VLAN_CTRL_RSP = 0xA0,
768032c5e82SThomas Falcon };
769032c5e82SThomas Falcon 
770032c5e82SThomas Falcon enum ibmvnic_crq_type {
771032c5e82SThomas Falcon 	IBMVNIC_CRQ_CMD			= 0x80,
772032c5e82SThomas Falcon 	IBMVNIC_CRQ_CMD_RSP		= 0x80,
773032c5e82SThomas Falcon 	IBMVNIC_CRQ_INIT_CMD		= 0xC0,
774032c5e82SThomas Falcon 	IBMVNIC_CRQ_INIT_RSP		= 0xC0,
775032c5e82SThomas Falcon 	IBMVNIC_CRQ_XPORT_EVENT		= 0xFF,
776032c5e82SThomas Falcon };
777032c5e82SThomas Falcon 
778032c5e82SThomas Falcon enum ibmvfc_crq_format {
779032c5e82SThomas Falcon 	IBMVNIC_CRQ_INIT                 = 0x01,
780032c5e82SThomas Falcon 	IBMVNIC_CRQ_INIT_COMPLETE        = 0x02,
781032c5e82SThomas Falcon 	IBMVNIC_PARTITION_MIGRATED       = 0x06,
782dfad09a6SThomas Falcon 	IBMVNIC_DEVICE_FAILOVER          = 0x08,
783032c5e82SThomas Falcon };
784032c5e82SThomas Falcon 
785032c5e82SThomas Falcon struct ibmvnic_crq_queue {
786032c5e82SThomas Falcon 	union ibmvnic_crq *msgs;
787032c5e82SThomas Falcon 	int size, cur;
788032c5e82SThomas Falcon 	dma_addr_t msg_token;
789a369d96cSLijun Pan 	/* Used for serialization of msgs, cur */
790032c5e82SThomas Falcon 	spinlock_t lock;
7915153698eSThomas Falcon 	bool active;
792e56e2515SMurilo Fossa Vicentini 	char name[32];
793032c5e82SThomas Falcon };
794032c5e82SThomas Falcon 
795032c5e82SThomas Falcon union sub_crq {
796032c5e82SThomas Falcon 	struct ibmvnic_generic_scrq generic;
797032c5e82SThomas Falcon 	struct ibmvnic_tx_comp_desc tx_comp;
798032c5e82SThomas Falcon 	struct ibmvnic_tx_desc v1;
799032c5e82SThomas Falcon 	struct ibmvnic_hdr_desc hdr;
800032c5e82SThomas Falcon 	struct ibmvnic_hdr_ext_desc hdr_ext;
801032c5e82SThomas Falcon 	struct ibmvnic_sge_desc sge;
802032c5e82SThomas Falcon 	struct ibmvnic_rx_comp_desc rx_comp;
803032c5e82SThomas Falcon 	struct ibmvnic_rx_buff_add_desc rx_add;
804032c5e82SThomas Falcon };
805032c5e82SThomas Falcon 
806f019fb63SThomas Falcon struct ibmvnic_ind_xmit_queue {
807f019fb63SThomas Falcon 	union sub_crq *indir_arr;
808f019fb63SThomas Falcon 	dma_addr_t indir_dma;
809f019fb63SThomas Falcon 	int index;
810f019fb63SThomas Falcon };
811f019fb63SThomas Falcon 
812032c5e82SThomas Falcon struct ibmvnic_sub_crq_queue {
813032c5e82SThomas Falcon 	union sub_crq *msgs;
814032c5e82SThomas Falcon 	int size, cur;
815032c5e82SThomas Falcon 	dma_addr_t msg_token;
816032c5e82SThomas Falcon 	unsigned long crq_num;
817032c5e82SThomas Falcon 	unsigned long hw_irq;
818032c5e82SThomas Falcon 	unsigned int irq;
819032c5e82SThomas Falcon 	unsigned int pool_index;
820032c5e82SThomas Falcon 	int scrq_num;
821a369d96cSLijun Pan 	/* Used for serialization of msgs, cur */
822032c5e82SThomas Falcon 	spinlock_t lock;
823032c5e82SThomas Falcon 	struct sk_buff *rx_skb_top;
824032c5e82SThomas Falcon 	struct ibmvnic_adapter *adapter;
825f019fb63SThomas Falcon 	struct ibmvnic_ind_xmit_queue ind_buf;
826142c0ac4SThomas Falcon 	atomic_t used;
827e56e2515SMurilo Fossa Vicentini 	char name[32];
828f3ae59c0SCristobal Forno 	u64 handle;
82944fbc1b6SNick Child 	cpumask_var_t affinity_mask;
8309a87c3fcSDwip N. Banerjee } ____cacheline_aligned;
831032c5e82SThomas Falcon 
832032c5e82SThomas Falcon struct ibmvnic_long_term_buff {
833032c5e82SThomas Falcon 	unsigned char *buff;
834032c5e82SThomas Falcon 	dma_addr_t addr;
835032c5e82SThomas Falcon 	u64 size;
836032c5e82SThomas Falcon 	u8 map_id;
837032c5e82SThomas Falcon };
838032c5e82SThomas Falcon 
839d6b45850SSukadev Bhattiprolu struct ibmvnic_ltb_set {
840d6b45850SSukadev Bhattiprolu 	int num_ltbs;
841d6b45850SSukadev Bhattiprolu 	struct ibmvnic_long_term_buff *ltbs;
842d6b45850SSukadev Bhattiprolu };
843d6b45850SSukadev Bhattiprolu 
844032c5e82SThomas Falcon struct ibmvnic_tx_buff {
845032c5e82SThomas Falcon 	struct sk_buff *skb;
846032c5e82SThomas Falcon 	int index;
847032c5e82SThomas Falcon 	int pool_index;
848ffc385b9SThomas Falcon 	int num_entries;
849032c5e82SThomas Falcon };
850032c5e82SThomas Falcon 
851032c5e82SThomas Falcon struct ibmvnic_tx_pool {
852032c5e82SThomas Falcon 	struct ibmvnic_tx_buff *tx_buff;
853032c5e82SThomas Falcon 	int *free_map;
854032c5e82SThomas Falcon 	int consumer_index;
855032c5e82SThomas Falcon 	int producer_index;
85693b1ebb3SSukadev Bhattiprolu 	struct ibmvnic_ltb_set ltb_set;
8574bd95a51SThomas Falcon 	int num_buffers;
8584bd95a51SThomas Falcon 	int buf_size;
8599a87c3fcSDwip N. Banerjee } ____cacheline_aligned;
860032c5e82SThomas Falcon 
861032c5e82SThomas Falcon struct ibmvnic_rx_buff {
862032c5e82SThomas Falcon 	struct sk_buff *skb;
863032c5e82SThomas Falcon 	dma_addr_t dma;
864032c5e82SThomas Falcon 	unsigned char *data;
865032c5e82SThomas Falcon 	int size;
866032c5e82SThomas Falcon 	int pool_index;
867032c5e82SThomas Falcon };
868032c5e82SThomas Falcon 
869032c5e82SThomas Falcon struct ibmvnic_rx_pool {
870032c5e82SThomas Falcon 	struct ibmvnic_rx_buff *rx_buff;
8710df7b9adSSukadev Bhattiprolu 	int size;			/* # of buffers in the pool */
872032c5e82SThomas Falcon 	int index;
873032c5e82SThomas Falcon 	int buff_size;
874032c5e82SThomas Falcon 	atomic_t available;
875032c5e82SThomas Falcon 	int *free_map;
876032c5e82SThomas Falcon 	int next_free;
877032c5e82SThomas Falcon 	int next_alloc;
878032c5e82SThomas Falcon 	int active;
879d6b45850SSukadev Bhattiprolu 	struct ibmvnic_ltb_set ltb_set;
8809a87c3fcSDwip N. Banerjee } ____cacheline_aligned;
881032c5e82SThomas Falcon 
8824e6759beSDesnes Augusto Nunes do Rosario struct ibmvnic_vpd {
8834e6759beSDesnes Augusto Nunes do Rosario 	unsigned char *buff;
8844e6759beSDesnes Augusto Nunes do Rosario 	dma_addr_t dma_addr;
8854e6759beSDesnes Augusto Nunes do Rosario 	u64 len;
8864e6759beSDesnes Augusto Nunes do Rosario };
8874e6759beSDesnes Augusto Nunes do Rosario 
88890c8014cSNathan Fontenot enum vnic_state {VNIC_PROBING = 1,
88990c8014cSNathan Fontenot 		 VNIC_PROBED,
89090c8014cSNathan Fontenot 		 VNIC_OPENING,
89190c8014cSNathan Fontenot 		 VNIC_OPEN,
89290c8014cSNathan Fontenot 		 VNIC_CLOSING,
89390c8014cSNathan Fontenot 		 VNIC_CLOSED,
89490c8014cSNathan Fontenot 		 VNIC_REMOVING,
89553f8b1b2SCristobal Forno 		 VNIC_REMOVED,
89653f8b1b2SCristobal Forno 		 VNIC_DOWN};
89790c8014cSNathan Fontenot 
898ed651a10SNathan Fontenot enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
899ed651a10SNathan Fontenot 			   VNIC_RESET_MOBILITY,
900ed651a10SNathan Fontenot 			   VNIC_RESET_FATAL,
9018cb31cfcSJohn Allen 			   VNIC_RESET_NON_FATAL,
902c26eba03SJohn Allen 			   VNIC_RESET_TIMEOUT,
90353f8b1b2SCristobal Forno 			   VNIC_RESET_CHANGE_PARAM,
90453f8b1b2SCristobal Forno 			   VNIC_RESET_PASSIVE_INIT};
905ed651a10SNathan Fontenot 
906ed651a10SNathan Fontenot struct ibmvnic_rwi {
907ed651a10SNathan Fontenot 	enum ibmvnic_reset_reason reset_reason;
908ed651a10SNathan Fontenot 	struct list_head list;
909ed651a10SNathan Fontenot };
910ed651a10SNathan Fontenot 
911c26eba03SJohn Allen struct ibmvnic_tunables {
912c26eba03SJohn Allen 	u64 rx_queues;
913c26eba03SJohn Allen 	u64 tx_queues;
914c26eba03SJohn Allen 	u64 rx_entries;
915c26eba03SJohn Allen 	u64 tx_entries;
916c26eba03SJohn Allen 	u64 mtu;
917c26eba03SJohn Allen };
918c26eba03SJohn Allen 
919032c5e82SThomas Falcon struct ibmvnic_adapter {
920032c5e82SThomas Falcon 	struct vio_dev *vdev;
921032c5e82SThomas Falcon 	struct net_device *netdev;
922032c5e82SThomas Falcon 	struct ibmvnic_crq_queue crq;
923032c5e82SThomas Falcon 	u8 mac_addr[ETH_ALEN];
924032c5e82SThomas Falcon 	struct ibmvnic_query_ip_offload_buffer ip_offload_buf;
925032c5e82SThomas Falcon 	dma_addr_t ip_offload_tok;
926032c5e82SThomas Falcon 	struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;
927032c5e82SThomas Falcon 	dma_addr_t ip_offload_ctrl_tok;
928032c5e82SThomas Falcon 	u32 msg_enable;
929032c5e82SThomas Falcon 
9304e6759beSDesnes Augusto Nunes do Rosario 	/* Vital Product Data (VPD) */
9314e6759beSDesnes Augusto Nunes do Rosario 	struct ibmvnic_vpd *vpd;
9324e6759beSDesnes Augusto Nunes do Rosario 	char fw_version[32];
9334e6759beSDesnes Augusto Nunes do Rosario 
934032c5e82SThomas Falcon 	/* Statistics */
935032c5e82SThomas Falcon 	struct ibmvnic_statistics stats;
936032c5e82SThomas Falcon 	dma_addr_t stats_token;
937032c5e82SThomas Falcon 	struct completion stats_done;
938032c5e82SThomas Falcon 	int replenish_no_mem;
939032c5e82SThomas Falcon 	int replenish_add_buff_success;
940032c5e82SThomas Falcon 	int replenish_add_buff_failure;
941032c5e82SThomas Falcon 	int replenish_task_cycles;
942032c5e82SThomas Falcon 	int tx_send_failed;
943032c5e82SThomas Falcon 	int tx_map_failed;
944032c5e82SThomas Falcon 
9453d52b594SJohn Allen 	struct ibmvnic_tx_queue_stats *tx_stats_buffers;
9463d52b594SJohn Allen 	struct ibmvnic_rx_queue_stats *rx_stats_buffers;
9473d52b594SJohn Allen 
948032c5e82SThomas Falcon 	int phys_link_state;
949032c5e82SThomas Falcon 	int logical_link_state;
950032c5e82SThomas Falcon 
951f8d6ae0dSMurilo Fossa Vicentini 	u32 speed;
952f8d6ae0dSMurilo Fossa Vicentini 	u8 duplex;
953f8d6ae0dSMurilo Fossa Vicentini 
954032c5e82SThomas Falcon 	/* login data */
955032c5e82SThomas Falcon 	struct ibmvnic_login_buffer *login_buf;
956032c5e82SThomas Falcon 	dma_addr_t login_buf_token;
957032c5e82SThomas Falcon 	int login_buf_sz;
958032c5e82SThomas Falcon 
959032c5e82SThomas Falcon 	struct ibmvnic_login_rsp_buffer *login_rsp_buf;
960032c5e82SThomas Falcon 	dma_addr_t login_rsp_buf_token;
961032c5e82SThomas Falcon 	int login_rsp_buf_sz;
962032c5e82SThomas Falcon 
963901e040aSThomas Falcon 	atomic_t running_cap_crqs;
964032c5e82SThomas Falcon 
9659a87c3fcSDwip N. Banerjee 	struct ibmvnic_sub_crq_queue **tx_scrq ____cacheline_aligned;
9669a87c3fcSDwip N. Banerjee 	struct ibmvnic_sub_crq_queue **rx_scrq ____cacheline_aligned;
967032c5e82SThomas Falcon 
968032c5e82SThomas Falcon 	/* rx structs */
969032c5e82SThomas Falcon 	struct napi_struct *napi;
970032c5e82SThomas Falcon 	struct ibmvnic_rx_pool *rx_pool;
971032c5e82SThomas Falcon 	u64 promisc;
972032c5e82SThomas Falcon 
973032c5e82SThomas Falcon 	struct ibmvnic_tx_pool *tx_pool;
9744bd95a51SThomas Falcon 	struct ibmvnic_tx_pool *tso_pool;
975fd98693cSSukadev Bhattiprolu 	struct completion probe_done;
976032c5e82SThomas Falcon 	struct completion init_done;
97753da09e9SNathan Fontenot 	int init_done_rc;
978032c5e82SThomas Falcon 
979032c5e82SThomas Falcon 	struct completion fw_done;
980ff25dcb9SThomas Falcon 	/* Used for serialization of device commands */
981ff25dcb9SThomas Falcon 	struct mutex fw_lock;
982f3be0cbcSThomas Falcon 	int fw_done_rc;
983032c5e82SThomas Falcon 
984c26eba03SJohn Allen 	struct completion reset_done;
985c26eba03SJohn Allen 	int reset_done_rc;
986c26eba03SJohn Allen 	bool wait_for_reset;
987c26eba03SJohn Allen 
98892125c3aSNick Child 	/* CPU hotplug instances for online & dead */
98992125c3aSNick Child 	struct hlist_node node;
99092125c3aSNick Child 	struct hlist_node node_dead;
99192125c3aSNick Child 
992032c5e82SThomas Falcon 	/* partner capabilities */
993032c5e82SThomas Falcon 	u64 min_tx_queues;
994032c5e82SThomas Falcon 	u64 min_rx_queues;
995032c5e82SThomas Falcon 	u64 min_rx_add_queues;
996032c5e82SThomas Falcon 	u64 max_tx_queues;
997032c5e82SThomas Falcon 	u64 max_rx_queues;
998032c5e82SThomas Falcon 	u64 max_rx_add_queues;
999032c5e82SThomas Falcon 	u64 req_tx_queues;
1000032c5e82SThomas Falcon 	u64 req_rx_queues;
1001032c5e82SThomas Falcon 	u64 req_rx_add_queues;
1002032c5e82SThomas Falcon 	u64 min_tx_entries_per_subcrq;
1003032c5e82SThomas Falcon 	u64 min_rx_add_entries_per_subcrq;
1004032c5e82SThomas Falcon 	u64 max_tx_entries_per_subcrq;
1005032c5e82SThomas Falcon 	u64 max_rx_add_entries_per_subcrq;
1006032c5e82SThomas Falcon 	u64 req_tx_entries_per_subcrq;
1007032c5e82SThomas Falcon 	u64 req_rx_add_entries_per_subcrq;
1008032c5e82SThomas Falcon 	u64 tcp_ip_offload;
1009032c5e82SThomas Falcon 	u64 promisc_requested;
1010032c5e82SThomas Falcon 	u64 promisc_supported;
1011032c5e82SThomas Falcon 	u64 min_mtu;
1012032c5e82SThomas Falcon 	u64 max_mtu;
1013032c5e82SThomas Falcon 	u64 req_mtu;
1014bbd80930SSukadev Bhattiprolu 	u64 prev_mtu;
1015032c5e82SThomas Falcon 	u64 max_multicast_filters;
1016032c5e82SThomas Falcon 	u64 vlan_header_insertion;
10176052d5e2SMurilo Fossa Vicentini 	u64 rx_vlan_header_insertion;
1018032c5e82SThomas Falcon 	u64 max_tx_sg_entries;
1019032c5e82SThomas Falcon 	u64 rx_sg_supported;
1020032c5e82SThomas Falcon 	u64 rx_sg_requested;
1021032c5e82SThomas Falcon 	u64 opt_tx_comp_sub_queues;
1022032c5e82SThomas Falcon 	u64 opt_rx_comp_queues;
1023032c5e82SThomas Falcon 	u64 opt_rx_bufadd_q_per_rx_comp_q;
1024032c5e82SThomas Falcon 	u64 opt_tx_entries_per_subcrq;
1025032c5e82SThomas Falcon 	u64 opt_rxba_entries_per_subcrq;
1026032c5e82SThomas Falcon 	__be64 tx_rx_desc_req;
1027129854f0SSukadev Bhattiprolu #define MAX_MAP_ID	255
1028129854f0SSukadev Bhattiprolu 	DECLARE_BITMAP(map_ids, MAX_MAP_ID);
102982e3be32SNathan Fontenot 	u32 num_active_rx_scrqs;
103082e3be32SNathan Fontenot 	u32 num_active_rx_pools;
103182e3be32SNathan Fontenot 	u32 num_active_rx_napi;
103282e3be32SNathan Fontenot 	u32 num_active_tx_scrqs;
103382e3be32SNathan Fontenot 	u32 num_active_tx_pools;
1034489de956SSukadev Bhattiprolu 
1035489de956SSukadev Bhattiprolu 	u32 prev_rx_pool_size;
1036bbd80930SSukadev Bhattiprolu 	u32 prev_tx_pool_size;
1037507ebe64SThomas Falcon 	u32 cur_rx_buf_sz;
1038489de956SSukadev Bhattiprolu 	u32 prev_rx_buf_sz;
103965dc6891SThomas Falcon 
10406c267b3dSThomas Falcon 	struct tasklet_struct tasklet;
104190c8014cSNathan Fontenot 	enum vnic_state state;
1042b646acd5SJakub Kicinski 	/* Used for serialization of state field. When taking both state
1043b646acd5SJakub Kicinski 	 * and rwi locks, take state lock first.
1044b646acd5SJakub Kicinski 	 */
1045a369d96cSLijun Pan 	spinlock_t state_lock;
1046ed651a10SNathan Fontenot 	enum ibmvnic_reset_reason reset_reason;
1047ed651a10SNathan Fontenot 	struct list_head rwi_list;
1048b646acd5SJakub Kicinski 	/* Used for serialization of rwi_list. When taking both state
1049b646acd5SJakub Kicinski 	 * and rwi locks, take state lock first
1050b646acd5SJakub Kicinski 	 */
1051a369d96cSLijun Pan 	spinlock_t rwi_lock;
1052ed651a10SNathan Fontenot 	struct work_struct ibmvnic_reset;
10537ed5b31fSJuliet Kim 	struct delayed_work ibmvnic_delayed_reset;
10547ed5b31fSJuliet Kim 	unsigned long resetting;
1055a86d5c68SDany Madden 	/* last device reset time */
1056a86d5c68SDany Madden 	unsigned long last_reset_time;
1057c26eba03SJohn Allen 
10584219196dSSukadev Bhattiprolu 	bool napi_enabled;
10594219196dSSukadev Bhattiprolu 	bool from_passive_init;
10604219196dSSukadev Bhattiprolu 	bool login_pending;
10614219196dSSukadev Bhattiprolu 	/* protected by rcu */
10624219196dSSukadev Bhattiprolu 	bool tx_queues_active;
10635a18e1e0SThomas Falcon 	bool failover_pending;
10642770a798SThomas Falcon 	bool force_reset_recovery;
1065c26eba03SJohn Allen 
1066c26eba03SJohn Allen 	struct ibmvnic_tunables desired;
1067c26eba03SJohn Allen 	struct ibmvnic_tunables fallback;
1068032c5e82SThomas Falcon };
1069