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