Loading...
1/*******************************************************************************
2 *
3 * Intel Ethernet Controller XL710 Family Linux 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 _I40E_VIRTCHNL_H_
28#define _I40E_VIRTCHNL_H_
29
30#include "i40e_type.h"
31
32/* Description:
33 * This header file describes the VF-PF communication protocol used
34 * by the various i40e drivers.
35 *
36 * Admin queue buffer usage:
37 * desc->opcode is always i40e_aqc_opc_send_msg_to_pf
38 * flags, retval, datalen, and data addr are all used normally.
39 * Firmware copies the cookie fields when sending messages between the PF and
40 * VF, but uses all other fields internally. Due to this limitation, we
41 * must send all messages as "indirect", i.e. using an external buffer.
42 *
43 * All the vsi indexes are relative to the VF. Each VF can have maximum of
44 * three VSIs. All the queue indexes are relative to the VSI. Each VF can
45 * have a maximum of sixteen queues for all of its VSIs.
46 *
47 * The PF is required to return a status code in v_retval for all messages
48 * except RESET_VF, which does not require any response. The return value is of
49 * i40e_status_code type, defined in the i40e_type.h.
50 *
51 * In general, VF driver initialization should roughly follow the order of these
52 * opcodes. The VF driver must first validate the API version of the PF driver,
53 * then request a reset, then get resources, then configure queues and
54 * interrupts. After these operations are complete, the VF driver may start
55 * its queues, optionally add MAC and VLAN filters, and process traffic.
56 */
57
58/* Opcodes for VF-PF communication. These are placed in the v_opcode field
59 * of the virtchnl_msg structure.
60 */
61enum i40e_virtchnl_ops {
62/* The PF sends status change events to VFs using
63 * the I40E_VIRTCHNL_OP_EVENT opcode.
64 * VFs send requests to the PF using the other ops.
65 */
66 I40E_VIRTCHNL_OP_UNKNOWN = 0,
67 I40E_VIRTCHNL_OP_VERSION = 1, /* must ALWAYS be 1 */
68 I40E_VIRTCHNL_OP_RESET_VF = 2,
69 I40E_VIRTCHNL_OP_GET_VF_RESOURCES = 3,
70 I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE = 4,
71 I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE = 5,
72 I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES = 6,
73 I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP = 7,
74 I40E_VIRTCHNL_OP_ENABLE_QUEUES = 8,
75 I40E_VIRTCHNL_OP_DISABLE_QUEUES = 9,
76 I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS = 10,
77 I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS = 11,
78 I40E_VIRTCHNL_OP_ADD_VLAN = 12,
79 I40E_VIRTCHNL_OP_DEL_VLAN = 13,
80 I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
81 I40E_VIRTCHNL_OP_GET_STATS = 15,
82 I40E_VIRTCHNL_OP_FCOE = 16,
83 I40E_VIRTCHNL_OP_EVENT = 17,
84 I40E_VIRTCHNL_OP_IWARP = 20,
85 I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21,
86 I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22,
87};
88
89/* Virtual channel message descriptor. This overlays the admin queue
90 * descriptor. All other data is passed in external buffers.
91 */
92
93struct i40e_virtchnl_msg {
94 u8 pad[8]; /* AQ flags/opcode/len/retval fields */
95 enum i40e_virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
96 i40e_status v_retval; /* ditto for desc->retval */
97 u32 vfid; /* used by PF when sending to VF */
98};
99
100/* Message descriptions and data structures.*/
101
102/* I40E_VIRTCHNL_OP_VERSION
103 * VF posts its version number to the PF. PF responds with its version number
104 * in the same format, along with a return code.
105 * Reply from PF has its major/minor versions also in param0 and param1.
106 * If there is a major version mismatch, then the VF cannot operate.
107 * If there is a minor version mismatch, then the VF can operate but should
108 * add a warning to the system log.
109 *
110 * This enum element MUST always be specified as == 1, regardless of other
111 * changes in the API. The PF must always respond to this message without
112 * error regardless of version mismatch.
113 */
114#define I40E_VIRTCHNL_VERSION_MAJOR 1
115#define I40E_VIRTCHNL_VERSION_MINOR 1
116#define I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0
117
118struct i40e_virtchnl_version_info {
119 u32 major;
120 u32 minor;
121};
122
123/* I40E_VIRTCHNL_OP_RESET_VF
124 * VF sends this request to PF with no parameters
125 * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
126 * until reset completion is indicated. The admin queue must be reinitialized
127 * after this operation.
128 *
129 * When reset is complete, PF must ensure that all queues in all VSIs associated
130 * with the VF are stopped, all queue configurations in the HMC are set to 0,
131 * and all MAC and VLAN filters (except the default MAC address) on all VSIs
132 * are cleared.
133 */
134
135/* I40E_VIRTCHNL_OP_GET_VF_RESOURCES
136 * Version 1.0 VF sends this request to PF with no parameters
137 * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities
138 * PF responds with an indirect message containing
139 * i40e_virtchnl_vf_resource and one or more
140 * i40e_virtchnl_vsi_resource structures.
141 */
142
143struct i40e_virtchnl_vsi_resource {
144 u16 vsi_id;
145 u16 num_queue_pairs;
146 enum i40e_vsi_type vsi_type;
147 u16 qset_handle;
148 u8 default_mac_addr[ETH_ALEN];
149};
150/* VF offload flags */
151#define I40E_VIRTCHNL_VF_OFFLOAD_L2 0x00000001
152#define I40E_VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
153#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x00000004
154#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
155#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
156#define I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
157#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
158#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
159#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
160
161struct i40e_virtchnl_vf_resource {
162 u16 num_vsis;
163 u16 num_queue_pairs;
164 u16 max_vectors;
165 u16 max_mtu;
166
167 u32 vf_offload_flags;
168 u32 max_fcoe_contexts;
169 u32 max_fcoe_filters;
170
171 struct i40e_virtchnl_vsi_resource vsi_res[1];
172};
173
174/* I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE
175 * VF sends this message to set up parameters for one TX queue.
176 * External data buffer contains one instance of i40e_virtchnl_txq_info.
177 * PF configures requested queue and returns a status code.
178 */
179
180/* Tx queue config info */
181struct i40e_virtchnl_txq_info {
182 u16 vsi_id;
183 u16 queue_id;
184 u16 ring_len; /* number of descriptors, multiple of 8 */
185 u16 headwb_enabled;
186 u64 dma_ring_addr;
187 u64 dma_headwb_addr;
188};
189
190/* I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE
191 * VF sends this message to set up parameters for one RX queue.
192 * External data buffer contains one instance of i40e_virtchnl_rxq_info.
193 * PF configures requested queue and returns a status code.
194 */
195
196/* Rx queue config info */
197struct i40e_virtchnl_rxq_info {
198 u16 vsi_id;
199 u16 queue_id;
200 u32 ring_len; /* number of descriptors, multiple of 32 */
201 u16 hdr_size;
202 u16 splithdr_enabled;
203 u32 databuffer_size;
204 u32 max_pkt_size;
205 u64 dma_ring_addr;
206 enum i40e_hmc_obj_rx_hsplit_0 rx_split_pos;
207};
208
209/* I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES
210 * VF sends this message to set parameters for all active TX and RX queues
211 * associated with the specified VSI.
212 * PF configures queues and returns status.
213 * If the number of queues specified is greater than the number of queues
214 * associated with the VSI, an error is returned and no queues are configured.
215 */
216struct i40e_virtchnl_queue_pair_info {
217 /* NOTE: vsi_id and queue_id should be identical for both queues. */
218 struct i40e_virtchnl_txq_info txq;
219 struct i40e_virtchnl_rxq_info rxq;
220};
221
222struct i40e_virtchnl_vsi_queue_config_info {
223 u16 vsi_id;
224 u16 num_queue_pairs;
225 struct i40e_virtchnl_queue_pair_info qpair[1];
226};
227
228/* I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP
229 * VF uses this message to map vectors to queues.
230 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
231 * are to be associated with the specified vector.
232 * The "other" causes are always mapped to vector 0.
233 * PF configures interrupt mapping and returns status.
234 */
235struct i40e_virtchnl_vector_map {
236 u16 vsi_id;
237 u16 vector_id;
238 u16 rxq_map;
239 u16 txq_map;
240 u16 rxitr_idx;
241 u16 txitr_idx;
242};
243
244struct i40e_virtchnl_irq_map_info {
245 u16 num_vectors;
246 struct i40e_virtchnl_vector_map vecmap[1];
247};
248
249/* I40E_VIRTCHNL_OP_ENABLE_QUEUES
250 * I40E_VIRTCHNL_OP_DISABLE_QUEUES
251 * VF sends these message to enable or disable TX/RX queue pairs.
252 * The queues fields are bitmaps indicating which queues to act upon.
253 * (Currently, we only support 16 queues per VF, but we make the field
254 * u32 to allow for expansion.)
255 * PF performs requested action and returns status.
256 */
257struct i40e_virtchnl_queue_select {
258 u16 vsi_id;
259 u16 pad;
260 u32 rx_queues;
261 u32 tx_queues;
262};
263
264/* I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS
265 * VF sends this message in order to add one or more unicast or multicast
266 * address filters for the specified VSI.
267 * PF adds the filters and returns status.
268 */
269
270/* I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS
271 * VF sends this message in order to remove one or more unicast or multicast
272 * filters for the specified VSI.
273 * PF removes the filters and returns status.
274 */
275
276struct i40e_virtchnl_ether_addr {
277 u8 addr[ETH_ALEN];
278 u8 pad[2];
279};
280
281struct i40e_virtchnl_ether_addr_list {
282 u16 vsi_id;
283 u16 num_elements;
284 struct i40e_virtchnl_ether_addr list[1];
285};
286
287/* I40E_VIRTCHNL_OP_ADD_VLAN
288 * VF sends this message to add one or more VLAN tag filters for receives.
289 * PF adds the filters and returns status.
290 * If a port VLAN is configured by the PF, this operation will return an
291 * error to the VF.
292 */
293
294/* I40E_VIRTCHNL_OP_DEL_VLAN
295 * VF sends this message to remove one or more VLAN tag filters for receives.
296 * PF removes the filters and returns status.
297 * If a port VLAN is configured by the PF, this operation will return an
298 * error to the VF.
299 */
300
301struct i40e_virtchnl_vlan_filter_list {
302 u16 vsi_id;
303 u16 num_elements;
304 u16 vlan_id[1];
305};
306
307/* I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
308 * VF sends VSI id and flags.
309 * PF returns status code in retval.
310 * Note: we assume that broadcast accept mode is always enabled.
311 */
312struct i40e_virtchnl_promisc_info {
313 u16 vsi_id;
314 u16 flags;
315};
316
317#define I40E_FLAG_VF_UNICAST_PROMISC 0x00000001
318#define I40E_FLAG_VF_MULTICAST_PROMISC 0x00000002
319
320/* I40E_VIRTCHNL_OP_GET_STATS
321 * VF sends this message to request stats for the selected VSI. VF uses
322 * the i40e_virtchnl_queue_select struct to specify the VSI. The queue_id
323 * field is ignored by the PF.
324 *
325 * PF replies with struct i40e_eth_stats in an external buffer.
326 */
327
328/* I40E_VIRTCHNL_OP_EVENT
329 * PF sends this message to inform the VF driver of events that may affect it.
330 * No direct response is expected from the VF, though it may generate other
331 * messages in response to this one.
332 */
333enum i40e_virtchnl_event_codes {
334 I40E_VIRTCHNL_EVENT_UNKNOWN = 0,
335 I40E_VIRTCHNL_EVENT_LINK_CHANGE,
336 I40E_VIRTCHNL_EVENT_RESET_IMPENDING,
337 I40E_VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
338};
339#define I40E_PF_EVENT_SEVERITY_INFO 0
340#define I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM 255
341
342struct i40e_virtchnl_pf_event {
343 enum i40e_virtchnl_event_codes event;
344 union {
345 struct {
346 enum i40e_aq_link_speed link_speed;
347 bool link_status;
348 } link_event;
349 } event_data;
350
351 int severity;
352};
353
354/* I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
355 * VF uses this message to request PF to map IWARP vectors to IWARP queues.
356 * The request for this originates from the VF IWARP driver through
357 * a client interface between VF LAN and VF IWARP driver.
358 * A vector could have an AEQ and CEQ attached to it although
359 * there is a single AEQ per VF IWARP instance in which case
360 * most vectors will have an INVALID_IDX for aeq and valid idx for ceq.
361 * There will never be a case where there will be multiple CEQs attached
362 * to a single vector.
363 * PF configures interrupt mapping and returns status.
364 */
365
366/* HW does not define a type value for AEQ; only for RX/TX and CEQ.
367 * In order for us to keep the interface simple, SW will define a
368 * unique type value for AEQ.
369*/
370#define I40E_QUEUE_TYPE_PE_AEQ 0x80
371#define I40E_QUEUE_INVALID_IDX 0xFFFF
372
373struct i40e_virtchnl_iwarp_qv_info {
374 u32 v_idx; /* msix_vector */
375 u16 ceq_idx;
376 u16 aeq_idx;
377 u8 itr_idx;
378};
379
380struct i40e_virtchnl_iwarp_qvlist_info {
381 u32 num_vectors;
382 struct i40e_virtchnl_iwarp_qv_info qv_info[1];
383};
384
385/* VF reset states - these are written into the RSTAT register:
386 * I40E_VFGEN_RSTAT1 on the PF
387 * I40E_VFGEN_RSTAT on the VF
388 * When the PF initiates a reset, it writes 0
389 * When the reset is complete, it writes 1
390 * When the PF detects that the VF has recovered, it writes 2
391 * VF checks this register periodically to determine if a reset has occurred,
392 * then polls it to know when the reset is complete.
393 * If either the PF or VF reads the register while the hardware
394 * is in a reset state, it will return DEADBEEF, which, when masked
395 * will result in 3.
396 */
397enum i40e_vfr_states {
398 I40E_VFR_INPROGRESS = 0,
399 I40E_VFR_COMPLETED,
400 I40E_VFR_VFACTIVE,
401 I40E_VFR_UNKNOWN,
402};
403
404#endif /* _I40E_VIRTCHNL_H_ */
1/*******************************************************************************
2 *
3 * Intel Ethernet Controller XL710 Family Linux 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 _I40E_VIRTCHNL_H_
28#define _I40E_VIRTCHNL_H_
29
30#include "i40e_type.h"
31
32/* Description:
33 * This header file describes the VF-PF communication protocol used
34 * by the various i40e drivers.
35 *
36 * Admin queue buffer usage:
37 * desc->opcode is always i40e_aqc_opc_send_msg_to_pf
38 * flags, retval, datalen, and data addr are all used normally.
39 * Firmware copies the cookie fields when sending messages between the PF and
40 * VF, but uses all other fields internally. Due to this limitation, we
41 * must send all messages as "indirect", i.e. using an external buffer.
42 *
43 * All the vsi indexes are relative to the VF. Each VF can have maximum of
44 * three VSIs. All the queue indexes are relative to the VSI. Each VF can
45 * have a maximum of sixteen queues for all of its VSIs.
46 *
47 * The PF is required to return a status code in v_retval for all messages
48 * except RESET_VF, which does not require any response. The return value is of
49 * i40e_status_code type, defined in the i40e_type.h.
50 *
51 * In general, VF driver initialization should roughly follow the order of these
52 * opcodes. The VF driver must first validate the API version of the PF driver,
53 * then request a reset, then get resources, then configure queues and
54 * interrupts. After these operations are complete, the VF driver may start
55 * its queues, optionally add MAC and VLAN filters, and process traffic.
56 */
57
58/* Opcodes for VF-PF communication. These are placed in the v_opcode field
59 * of the virtchnl_msg structure.
60 */
61enum i40e_virtchnl_ops {
62/* VF sends req. to pf for the following
63 * ops.
64 */
65 I40E_VIRTCHNL_OP_UNKNOWN = 0,
66 I40E_VIRTCHNL_OP_VERSION = 1, /* must ALWAYS be 1 */
67 I40E_VIRTCHNL_OP_RESET_VF,
68 I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
69 I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE,
70 I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE,
71 I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
72 I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
73 I40E_VIRTCHNL_OP_ENABLE_QUEUES,
74 I40E_VIRTCHNL_OP_DISABLE_QUEUES,
75 I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
76 I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
77 I40E_VIRTCHNL_OP_ADD_VLAN,
78 I40E_VIRTCHNL_OP_DEL_VLAN,
79 I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
80 I40E_VIRTCHNL_OP_GET_STATS,
81 I40E_VIRTCHNL_OP_FCOE,
82/* PF sends status change events to vfs using
83 * the following op.
84 */
85 I40E_VIRTCHNL_OP_EVENT,
86};
87
88/* Virtual channel message descriptor. This overlays the admin queue
89 * descriptor. All other data is passed in external buffers.
90 */
91
92struct i40e_virtchnl_msg {
93 u8 pad[8]; /* AQ flags/opcode/len/retval fields */
94 enum i40e_virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
95 i40e_status v_retval; /* ditto for desc->retval */
96 u32 vfid; /* used by PF when sending to VF */
97};
98
99/* Message descriptions and data structures.*/
100
101/* I40E_VIRTCHNL_OP_VERSION
102 * VF posts its version number to the PF. PF responds with its version number
103 * in the same format, along with a return code.
104 * Reply from PF has its major/minor versions also in param0 and param1.
105 * If there is a major version mismatch, then the VF cannot operate.
106 * If there is a minor version mismatch, then the VF can operate but should
107 * add a warning to the system log.
108 *
109 * This enum element MUST always be specified as == 1, regardless of other
110 * changes in the API. The PF must always respond to this message without
111 * error regardless of version mismatch.
112 */
113#define I40E_VIRTCHNL_VERSION_MAJOR 1
114#define I40E_VIRTCHNL_VERSION_MINOR 0
115struct i40e_virtchnl_version_info {
116 u32 major;
117 u32 minor;
118};
119
120/* I40E_VIRTCHNL_OP_RESET_VF
121 * VF sends this request to PF with no parameters
122 * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
123 * until reset completion is indicated. The admin queue must be reinitialized
124 * after this operation.
125 *
126 * When reset is complete, PF must ensure that all queues in all VSIs associated
127 * with the VF are stopped, all queue configurations in the HMC are set to 0,
128 * and all MAC and VLAN filters (except the default MAC address) on all VSIs
129 * are cleared.
130 */
131
132/* I40E_VIRTCHNL_OP_GET_VF_RESOURCES
133 * VF sends this request to PF with no parameters
134 * PF responds with an indirect message containing
135 * i40e_virtchnl_vf_resource and one or more
136 * i40e_virtchnl_vsi_resource structures.
137 */
138
139struct i40e_virtchnl_vsi_resource {
140 u16 vsi_id;
141 u16 num_queue_pairs;
142 enum i40e_vsi_type vsi_type;
143 u16 qset_handle;
144 u8 default_mac_addr[ETH_ALEN];
145};
146/* VF offload flags */
147#define I40E_VIRTCHNL_VF_OFFLOAD_L2 0x00000001
148#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x00000004
149#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
150
151struct i40e_virtchnl_vf_resource {
152 u16 num_vsis;
153 u16 num_queue_pairs;
154 u16 max_vectors;
155 u16 max_mtu;
156
157 u32 vf_offload_flags;
158 u32 max_fcoe_contexts;
159 u32 max_fcoe_filters;
160
161 struct i40e_virtchnl_vsi_resource vsi_res[1];
162};
163
164/* I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE
165 * VF sends this message to set up parameters for one TX queue.
166 * External data buffer contains one instance of i40e_virtchnl_txq_info.
167 * PF configures requested queue and returns a status code.
168 */
169
170/* Tx queue config info */
171struct i40e_virtchnl_txq_info {
172 u16 vsi_id;
173 u16 queue_id;
174 u16 ring_len; /* number of descriptors, multiple of 8 */
175 u16 headwb_enabled;
176 u64 dma_ring_addr;
177 u64 dma_headwb_addr;
178};
179
180/* I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE
181 * VF sends this message to set up parameters for one RX queue.
182 * External data buffer contains one instance of i40e_virtchnl_rxq_info.
183 * PF configures requested queue and returns a status code.
184 */
185
186/* Rx queue config info */
187struct i40e_virtchnl_rxq_info {
188 u16 vsi_id;
189 u16 queue_id;
190 u32 ring_len; /* number of descriptors, multiple of 32 */
191 u16 hdr_size;
192 u16 splithdr_enabled;
193 u32 databuffer_size;
194 u32 max_pkt_size;
195 u64 dma_ring_addr;
196 enum i40e_hmc_obj_rx_hsplit_0 rx_split_pos;
197};
198
199/* I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES
200 * VF sends this message to set parameters for all active TX and RX queues
201 * associated with the specified VSI.
202 * PF configures queues and returns status.
203 * If the number of queues specified is greater than the number of queues
204 * associated with the VSI, an error is returned and no queues are configured.
205 */
206struct i40e_virtchnl_queue_pair_info {
207 /* NOTE: vsi_id and queue_id should be identical for both queues. */
208 struct i40e_virtchnl_txq_info txq;
209 struct i40e_virtchnl_rxq_info rxq;
210};
211
212struct i40e_virtchnl_vsi_queue_config_info {
213 u16 vsi_id;
214 u16 num_queue_pairs;
215 struct i40e_virtchnl_queue_pair_info qpair[1];
216};
217
218/* I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP
219 * VF uses this message to map vectors to queues.
220 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
221 * are to be associated with the specified vector.
222 * The "other" causes are always mapped to vector 0.
223 * PF configures interrupt mapping and returns status.
224 */
225struct i40e_virtchnl_vector_map {
226 u16 vsi_id;
227 u16 vector_id;
228 u16 rxq_map;
229 u16 txq_map;
230 u16 rxitr_idx;
231 u16 txitr_idx;
232};
233
234struct i40e_virtchnl_irq_map_info {
235 u16 num_vectors;
236 struct i40e_virtchnl_vector_map vecmap[1];
237};
238
239/* I40E_VIRTCHNL_OP_ENABLE_QUEUES
240 * I40E_VIRTCHNL_OP_DISABLE_QUEUES
241 * VF sends these message to enable or disable TX/RX queue pairs.
242 * The queues fields are bitmaps indicating which queues to act upon.
243 * (Currently, we only support 16 queues per VF, but we make the field
244 * u32 to allow for expansion.)
245 * PF performs requested action and returns status.
246 */
247struct i40e_virtchnl_queue_select {
248 u16 vsi_id;
249 u16 pad;
250 u32 rx_queues;
251 u32 tx_queues;
252};
253
254/* I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS
255 * VF sends this message in order to add one or more unicast or multicast
256 * address filters for the specified VSI.
257 * PF adds the filters and returns status.
258 */
259
260/* I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS
261 * VF sends this message in order to remove one or more unicast or multicast
262 * filters for the specified VSI.
263 * PF removes the filters and returns status.
264 */
265
266struct i40e_virtchnl_ether_addr {
267 u8 addr[ETH_ALEN];
268 u8 pad[2];
269};
270
271struct i40e_virtchnl_ether_addr_list {
272 u16 vsi_id;
273 u16 num_elements;
274 struct i40e_virtchnl_ether_addr list[1];
275};
276
277/* I40E_VIRTCHNL_OP_ADD_VLAN
278 * VF sends this message to add one or more VLAN tag filters for receives.
279 * PF adds the filters and returns status.
280 * If a port VLAN is configured by the PF, this operation will return an
281 * error to the VF.
282 */
283
284/* I40E_VIRTCHNL_OP_DEL_VLAN
285 * VF sends this message to remove one or more VLAN tag filters for receives.
286 * PF removes the filters and returns status.
287 * If a port VLAN is configured by the PF, this operation will return an
288 * error to the VF.
289 */
290
291struct i40e_virtchnl_vlan_filter_list {
292 u16 vsi_id;
293 u16 num_elements;
294 u16 vlan_id[1];
295};
296
297/* I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
298 * VF sends VSI id and flags.
299 * PF returns status code in retval.
300 * Note: we assume that broadcast accept mode is always enabled.
301 */
302struct i40e_virtchnl_promisc_info {
303 u16 vsi_id;
304 u16 flags;
305};
306
307#define I40E_FLAG_VF_UNICAST_PROMISC 0x00000001
308#define I40E_FLAG_VF_MULTICAST_PROMISC 0x00000002
309
310/* I40E_VIRTCHNL_OP_GET_STATS
311 * VF sends this message to request stats for the selected VSI. VF uses
312 * the i40e_virtchnl_queue_select struct to specify the VSI. The queue_id
313 * field is ignored by the PF.
314 *
315 * PF replies with struct i40e_eth_stats in an external buffer.
316 */
317
318/* I40E_VIRTCHNL_OP_EVENT
319 * PF sends this message to inform the VF driver of events that may affect it.
320 * No direct response is expected from the VF, though it may generate other
321 * messages in response to this one.
322 */
323enum i40e_virtchnl_event_codes {
324 I40E_VIRTCHNL_EVENT_UNKNOWN = 0,
325 I40E_VIRTCHNL_EVENT_LINK_CHANGE,
326 I40E_VIRTCHNL_EVENT_RESET_IMPENDING,
327 I40E_VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
328};
329#define I40E_PF_EVENT_SEVERITY_INFO 0
330#define I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM 255
331
332struct i40e_virtchnl_pf_event {
333 enum i40e_virtchnl_event_codes event;
334 union {
335 struct {
336 enum i40e_aq_link_speed link_speed;
337 bool link_status;
338 } link_event;
339 } event_data;
340
341 int severity;
342};
343
344/* The following are TBD, not necessary for LAN functionality.
345 * I40E_VIRTCHNL_OP_FCOE
346 */
347
348/* VF reset states - these are written into the RSTAT register:
349 * I40E_VFGEN_RSTAT1 on the PF
350 * I40E_VFGEN_RSTAT on the VF
351 * When the PF initiates a reset, it writes 0
352 * When the reset is complete, it writes 1
353 * When the PF detects that the VF has recovered, it writes 2
354 * VF checks this register periodically to determine if a reset has occurred,
355 * then polls it to know when the reset is complete.
356 * If either the PF or VF reads the register while the hardware
357 * is in a reset state, it will return DEADBEEF, which, when masked
358 * will result in 3.
359 */
360enum i40e_vfr_states {
361 I40E_VFR_INPROGRESS = 0,
362 I40E_VFR_COMPLETED,
363 I40E_VFR_VFACTIVE,
364 I40E_VFR_UNKNOWN,
365};
366
367#endif /* _I40E_VIRTCHNL_H_ */