]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
i40e: Fix configure TCs after initial DCB disable
[mirror_ubuntu-artful-kernel.git] / drivers / net / ethernet / intel / i40e / i40e_virtchnl.h
CommitLineData
5c3c48ac
JB
1/*******************************************************************************
2 *
3 * Intel Ethernet Controller XL710 Family Linux Driver
dc641b73 4 * Copyright(c) 2013 - 2014 Intel Corporation.
5c3c48ac
JB
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 *
dc641b73
GR
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/>.
5c3c48ac
JB
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 {
396642a6
NN
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.
5c3c48ac
JB
65 */
66 I40E_VIRTCHNL_OP_UNKNOWN = 0,
67 I40E_VIRTCHNL_OP_VERSION = 1, /* must ALWAYS be 1 */
396642a6
NN
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,
585954f8 83 I40E_VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
e3219ce6
ASJ
84 I40E_VIRTCHNL_OP_IWARP = 20,
85 I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21,
86 I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22,
585954f8
MW
87 I40E_VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
88 I40E_VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
89 I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
90 I40E_VIRTCHNL_OP_SET_RSS_HENA = 26,
91
5c3c48ac
JB
92};
93
94/* Virtual channel message descriptor. This overlays the admin queue
95 * descriptor. All other data is passed in external buffers.
96 */
97
98struct i40e_virtchnl_msg {
99 u8 pad[8]; /* AQ flags/opcode/len/retval fields */
100 enum i40e_virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
101 i40e_status v_retval; /* ditto for desc->retval */
102 u32 vfid; /* used by PF when sending to VF */
103};
104
105/* Message descriptions and data structures.*/
106
107/* I40E_VIRTCHNL_OP_VERSION
108 * VF posts its version number to the PF. PF responds with its version number
109 * in the same format, along with a return code.
110 * Reply from PF has its major/minor versions also in param0 and param1.
111 * If there is a major version mismatch, then the VF cannot operate.
112 * If there is a minor version mismatch, then the VF can operate but should
113 * add a warning to the system log.
114 *
115 * This enum element MUST always be specified as == 1, regardless of other
116 * changes in the API. The PF must always respond to this message without
117 * error regardless of version mismatch.
118 */
119#define I40E_VIRTCHNL_VERSION_MAJOR 1
1b53c2fb
MW
120#define I40E_VIRTCHNL_VERSION_MINOR 1
121#define I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0
122
5c3c48ac
JB
123struct i40e_virtchnl_version_info {
124 u32 major;
125 u32 minor;
126};
127
128/* I40E_VIRTCHNL_OP_RESET_VF
129 * VF sends this request to PF with no parameters
130 * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
131 * until reset completion is indicated. The admin queue must be reinitialized
132 * after this operation.
133 *
134 * When reset is complete, PF must ensure that all queues in all VSIs associated
135 * with the VF are stopped, all queue configurations in the HMC are set to 0,
136 * and all MAC and VLAN filters (except the default MAC address) on all VSIs
137 * are cleared.
138 */
139
140/* I40E_VIRTCHNL_OP_GET_VF_RESOURCES
1b53c2fb
MW
141 * Version 1.0 VF sends this request to PF with no parameters
142 * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities
5c3c48ac
JB
143 * PF responds with an indirect message containing
144 * i40e_virtchnl_vf_resource and one or more
145 * i40e_virtchnl_vsi_resource structures.
146 */
147
148struct i40e_virtchnl_vsi_resource {
149 u16 vsi_id;
150 u16 num_queue_pairs;
151 enum i40e_vsi_type vsi_type;
152 u16 qset_handle;
c02e0fd3 153 u8 default_mac_addr[ETH_ALEN];
5c3c48ac
JB
154};
155/* VF offload flags */
1b53c2fb
MW
156#define I40E_VIRTCHNL_VF_OFFLOAD_L2 0x00000001
157#define I40E_VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
158#define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x00000004
159#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
160#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
1f012279 161#define I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
1b53c2fb 162#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
b8262a6d 163#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
b9eacec3 164#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
585954f8 165#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
2199254c 166#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00100000
5c3c48ac
JB
167
168struct i40e_virtchnl_vf_resource {
169 u16 num_vsis;
170 u16 num_queue_pairs;
171 u16 max_vectors;
172 u16 max_mtu;
173
174 u32 vf_offload_flags;
585954f8
MW
175 u32 rss_key_size;
176 u32 rss_lut_size;
5c3c48ac
JB
177
178 struct i40e_virtchnl_vsi_resource vsi_res[1];
179};
180
181/* I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE
182 * VF sends this message to set up parameters for one TX queue.
183 * External data buffer contains one instance of i40e_virtchnl_txq_info.
184 * PF configures requested queue and returns a status code.
185 */
186
187/* Tx queue config info */
188struct i40e_virtchnl_txq_info {
189 u16 vsi_id;
190 u16 queue_id;
191 u16 ring_len; /* number of descriptors, multiple of 8 */
192 u16 headwb_enabled;
193 u64 dma_ring_addr;
194 u64 dma_headwb_addr;
195};
196
197/* I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE
198 * VF sends this message to set up parameters for one RX queue.
199 * External data buffer contains one instance of i40e_virtchnl_rxq_info.
200 * PF configures requested queue and returns a status code.
201 */
202
203/* Rx queue config info */
204struct i40e_virtchnl_rxq_info {
205 u16 vsi_id;
206 u16 queue_id;
207 u32 ring_len; /* number of descriptors, multiple of 32 */
208 u16 hdr_size;
209 u16 splithdr_enabled;
210 u32 databuffer_size;
211 u32 max_pkt_size;
212 u64 dma_ring_addr;
213 enum i40e_hmc_obj_rx_hsplit_0 rx_split_pos;
214};
215
216/* I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES
217 * VF sends this message to set parameters for all active TX and RX queues
218 * associated with the specified VSI.
219 * PF configures queues and returns status.
220 * If the number of queues specified is greater than the number of queues
221 * associated with the VSI, an error is returned and no queues are configured.
222 */
223struct i40e_virtchnl_queue_pair_info {
224 /* NOTE: vsi_id and queue_id should be identical for both queues. */
225 struct i40e_virtchnl_txq_info txq;
226 struct i40e_virtchnl_rxq_info rxq;
227};
228
229struct i40e_virtchnl_vsi_queue_config_info {
230 u16 vsi_id;
231 u16 num_queue_pairs;
232 struct i40e_virtchnl_queue_pair_info qpair[1];
233};
234
235/* I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP
236 * VF uses this message to map vectors to queues.
237 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
238 * are to be associated with the specified vector.
239 * The "other" causes are always mapped to vector 0.
240 * PF configures interrupt mapping and returns status.
241 */
242struct i40e_virtchnl_vector_map {
243 u16 vsi_id;
244 u16 vector_id;
245 u16 rxq_map;
246 u16 txq_map;
247 u16 rxitr_idx;
248 u16 txitr_idx;
249};
250
251struct i40e_virtchnl_irq_map_info {
252 u16 num_vectors;
253 struct i40e_virtchnl_vector_map vecmap[1];
254};
255
256/* I40E_VIRTCHNL_OP_ENABLE_QUEUES
257 * I40E_VIRTCHNL_OP_DISABLE_QUEUES
258 * VF sends these message to enable or disable TX/RX queue pairs.
259 * The queues fields are bitmaps indicating which queues to act upon.
260 * (Currently, we only support 16 queues per VF, but we make the field
261 * u32 to allow for expansion.)
262 * PF performs requested action and returns status.
263 */
264struct i40e_virtchnl_queue_select {
265 u16 vsi_id;
266 u16 pad;
267 u32 rx_queues;
268 u32 tx_queues;
269};
270
271/* I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS
272 * VF sends this message in order to add one or more unicast or multicast
273 * address filters for the specified VSI.
274 * PF adds the filters and returns status.
275 */
276
277/* I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS
278 * VF sends this message in order to remove one or more unicast or multicast
279 * filters for the specified VSI.
280 * PF removes the filters and returns status.
281 */
282
283struct i40e_virtchnl_ether_addr {
c02e0fd3 284 u8 addr[ETH_ALEN];
5c3c48ac
JB
285 u8 pad[2];
286};
287
288struct i40e_virtchnl_ether_addr_list {
289 u16 vsi_id;
290 u16 num_elements;
291 struct i40e_virtchnl_ether_addr list[1];
292};
293
294/* I40E_VIRTCHNL_OP_ADD_VLAN
295 * VF sends this message to add one or more VLAN tag filters for receives.
296 * PF adds 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
301/* I40E_VIRTCHNL_OP_DEL_VLAN
302 * VF sends this message to remove one or more VLAN tag filters for receives.
303 * PF removes the filters and returns status.
304 * If a port VLAN is configured by the PF, this operation will return an
305 * error to the VF.
306 */
307
308struct i40e_virtchnl_vlan_filter_list {
309 u16 vsi_id;
310 u16 num_elements;
311 u16 vlan_id[1];
312};
313
314/* I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
315 * VF sends VSI id and flags.
316 * PF returns status code in retval.
317 * Note: we assume that broadcast accept mode is always enabled.
318 */
319struct i40e_virtchnl_promisc_info {
320 u16 vsi_id;
321 u16 flags;
322};
323
324#define I40E_FLAG_VF_UNICAST_PROMISC 0x00000001
325#define I40E_FLAG_VF_MULTICAST_PROMISC 0x00000002
326
327/* I40E_VIRTCHNL_OP_GET_STATS
328 * VF sends this message to request stats for the selected VSI. VF uses
329 * the i40e_virtchnl_queue_select struct to specify the VSI. The queue_id
330 * field is ignored by the PF.
331 *
332 * PF replies with struct i40e_eth_stats in an external buffer.
333 */
334
585954f8
MW
335/* I40E_VIRTCHNL_OP_CONFIG_RSS_KEY
336 * I40E_VIRTCHNL_OP_CONFIG_RSS_LUT
337 * VF sends these messages to configure RSS. Only supported if both PF
338 * and VF drivers set the I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
339 * configuration negotiation. If this is the case, then the RSS fields in
340 * the VF resource struct are valid.
341 * Both the key and LUT are initialized to 0 by the PF, meaning that
342 * RSS is effectively disabled until set up by the VF.
343 */
344struct i40e_virtchnl_rss_key {
345 u16 vsi_id;
346 u16 key_len;
347 u8 key[1]; /* RSS hash key, packed bytes */
348};
349
350struct i40e_virtchnl_rss_lut {
351 u16 vsi_id;
352 u16 lut_entries;
353 u8 lut[1]; /* RSS lookup table*/
354};
355
356/* I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS
357 * I40E_VIRTCHNL_OP_SET_RSS_HENA
358 * VF sends these messages to get and set the hash filter enable bits for RSS.
359 * By default, the PF sets these to all possible traffic types that the
360 * hardware supports. The VF can query this value if it wants to change the
361 * traffic types that are hashed by the hardware.
362 * Traffic types are defined in the i40e_filter_pctype enum in i40e_type.h
363 */
364struct i40e_virtchnl_rss_hena {
365 u64 hena;
366};
367
5c3c48ac
JB
368/* I40E_VIRTCHNL_OP_EVENT
369 * PF sends this message to inform the VF driver of events that may affect it.
370 * No direct response is expected from the VF, though it may generate other
371 * messages in response to this one.
372 */
373enum i40e_virtchnl_event_codes {
374 I40E_VIRTCHNL_EVENT_UNKNOWN = 0,
375 I40E_VIRTCHNL_EVENT_LINK_CHANGE,
376 I40E_VIRTCHNL_EVENT_RESET_IMPENDING,
377 I40E_VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
378};
379#define I40E_PF_EVENT_SEVERITY_INFO 0
380#define I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM 255
381
382struct i40e_virtchnl_pf_event {
383 enum i40e_virtchnl_event_codes event;
384 union {
385 struct {
386 enum i40e_aq_link_speed link_speed;
387 bool link_status;
388 } link_event;
389 } event_data;
390
391 int severity;
392};
393
e3219ce6
ASJ
394/* I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
395 * VF uses this message to request PF to map IWARP vectors to IWARP queues.
396 * The request for this originates from the VF IWARP driver through
397 * a client interface between VF LAN and VF IWARP driver.
398 * A vector could have an AEQ and CEQ attached to it although
399 * there is a single AEQ per VF IWARP instance in which case
400 * most vectors will have an INVALID_IDX for aeq and valid idx for ceq.
401 * There will never be a case where there will be multiple CEQs attached
402 * to a single vector.
403 * PF configures interrupt mapping and returns status.
404 */
405
406/* HW does not define a type value for AEQ; only for RX/TX and CEQ.
407 * In order for us to keep the interface simple, SW will define a
408 * unique type value for AEQ.
409*/
410#define I40E_QUEUE_TYPE_PE_AEQ 0x80
411#define I40E_QUEUE_INVALID_IDX 0xFFFF
412
413struct i40e_virtchnl_iwarp_qv_info {
414 u32 v_idx; /* msix_vector */
415 u16 ceq_idx;
416 u16 aeq_idx;
417 u8 itr_idx;
418};
419
420struct i40e_virtchnl_iwarp_qvlist_info {
421 u32 num_vectors;
422 struct i40e_virtchnl_iwarp_qv_info qv_info[1];
423};
424
5c3c48ac
JB
425/* VF reset states - these are written into the RSTAT register:
426 * I40E_VFGEN_RSTAT1 on the PF
427 * I40E_VFGEN_RSTAT on the VF
428 * When the PF initiates a reset, it writes 0
429 * When the reset is complete, it writes 1
430 * When the PF detects that the VF has recovered, it writes 2
431 * VF checks this register periodically to determine if a reset has occurred,
432 * then polls it to know when the reset is complete.
433 * If either the PF or VF reads the register while the hardware
434 * is in a reset state, it will return DEADBEEF, which, when masked
435 * will result in 3.
436 */
437enum i40e_vfr_states {
438 I40E_VFR_INPROGRESS = 0,
439 I40E_VFR_COMPLETED,
440 I40E_VFR_VFACTIVE,
441 I40E_VFR_UNKNOWN,
442};
443
444#endif /* _I40E_VIRTCHNL_H_ */