x86/mm/pat: Don't report PAT on CPUs that don't support it
[linux/fpc-iii.git] / drivers / net / ethernet / intel / i40evf / i40e_virtchnl.h
blobd38a2b2aea2b20d2b0bbf9700c90578ba9fc0197
1 /*******************************************************************************
3 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4 * Copyright(c) 2013 - 2014 Intel Corporation.
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.
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.
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/>.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
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
25 ******************************************************************************/
27 #ifndef _I40E_VIRTCHNL_H_
28 #define _I40E_VIRTCHNL_H_
30 #include "i40e_type.h"
32 /* Description:
33 * This header file describes the VF-PF communication protocol used
34 * by the various i40e drivers.
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.
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.
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.
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.
58 /* Opcodes for VF-PF communication. These are placed in the v_opcode field
59 * of the virtchnl_msg structure.
61 enum 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.
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, /* must ALWAYS be 17 */
84 I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21,
85 I40E_VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
86 I40E_VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
87 I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
88 I40E_VIRTCHNL_OP_SET_RSS_HENA = 26,
92 /* Virtual channel message descriptor. This overlays the admin queue
93 * descriptor. All other data is passed in external buffers.
96 struct i40e_virtchnl_msg {
97 u8 pad[8]; /* AQ flags/opcode/len/retval fields */
98 enum i40e_virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
99 i40e_status v_retval; /* ditto for desc->retval */
100 u32 vfid; /* used by PF when sending to VF */
103 /* Message descriptions and data structures.*/
105 /* I40E_VIRTCHNL_OP_VERSION
106 * VF posts its version number to the PF. PF responds with its version number
107 * in the same format, along with a return code.
108 * Reply from PF has its major/minor versions also in param0 and param1.
109 * If there is a major version mismatch, then the VF cannot operate.
110 * If there is a minor version mismatch, then the VF can operate but should
111 * add a warning to the system log.
113 * This enum element MUST always be specified as == 1, regardless of other
114 * changes in the API. The PF must always respond to this message without
115 * error regardless of version mismatch.
117 #define I40E_VIRTCHNL_VERSION_MAJOR 1
118 #define I40E_VIRTCHNL_VERSION_MINOR 1
119 #define I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0
121 struct i40e_virtchnl_version_info {
122 u32 major;
123 u32 minor;
126 /* I40E_VIRTCHNL_OP_RESET_VF
127 * VF sends this request to PF with no parameters
128 * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
129 * until reset completion is indicated. The admin queue must be reinitialized
130 * after this operation.
132 * When reset is complete, PF must ensure that all queues in all VSIs associated
133 * with the VF are stopped, all queue configurations in the HMC are set to 0,
134 * and all MAC and VLAN filters (except the default MAC address) on all VSIs
135 * are cleared.
138 /* I40E_VIRTCHNL_OP_GET_VF_RESOURCES
139 * Version 1.0 VF sends this request to PF with no parameters
140 * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities
141 * PF responds with an indirect message containing
142 * i40e_virtchnl_vf_resource and one or more
143 * i40e_virtchnl_vsi_resource structures.
146 struct i40e_virtchnl_vsi_resource {
147 u16 vsi_id;
148 u16 num_queue_pairs;
149 enum i40e_vsi_type vsi_type;
150 u16 qset_handle;
151 u8 default_mac_addr[ETH_ALEN];
153 /* VF offload flags */
154 #define I40E_VIRTCHNL_VF_OFFLOAD_L2 0x00000001
155 #define I40E_VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
156 #define I40E_VIRTCHNL_VF_OFFLOAD_FCOE 0x00000004
157 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
158 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
159 #define I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
160 #define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
161 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
162 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
163 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
164 #define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00100000
166 #define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \
167 I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \
168 I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF)
170 struct i40e_virtchnl_vf_resource {
171 u16 num_vsis;
172 u16 num_queue_pairs;
173 u16 max_vectors;
174 u16 max_mtu;
176 u32 vf_offload_flags;
177 u32 rss_key_size;
178 u32 rss_lut_size;
180 struct i40e_virtchnl_vsi_resource vsi_res[1];
183 /* I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE
184 * VF sends this message to set up parameters for one TX queue.
185 * External data buffer contains one instance of i40e_virtchnl_txq_info.
186 * PF configures requested queue and returns a status code.
189 /* Tx queue config info */
190 struct i40e_virtchnl_txq_info {
191 u16 vsi_id;
192 u16 queue_id;
193 u16 ring_len; /* number of descriptors, multiple of 8 */
194 u16 headwb_enabled;
195 u64 dma_ring_addr;
196 u64 dma_headwb_addr;
199 /* I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE
200 * VF sends this message to set up parameters for one RX queue.
201 * External data buffer contains one instance of i40e_virtchnl_rxq_info.
202 * PF configures requested queue and returns a status code.
205 /* Rx queue config info */
206 struct i40e_virtchnl_rxq_info {
207 u16 vsi_id;
208 u16 queue_id;
209 u32 ring_len; /* number of descriptors, multiple of 32 */
210 u16 hdr_size;
211 u16 splithdr_enabled;
212 u32 databuffer_size;
213 u32 max_pkt_size;
214 u64 dma_ring_addr;
215 enum i40e_hmc_obj_rx_hsplit_0 rx_split_pos;
218 /* I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES
219 * VF sends this message to set parameters for all active TX and RX queues
220 * associated with the specified VSI.
221 * PF configures queues and returns status.
222 * If the number of queues specified is greater than the number of queues
223 * associated with the VSI, an error is returned and no queues are configured.
225 struct i40e_virtchnl_queue_pair_info {
226 /* NOTE: vsi_id and queue_id should be identical for both queues. */
227 struct i40e_virtchnl_txq_info txq;
228 struct i40e_virtchnl_rxq_info rxq;
231 struct i40e_virtchnl_vsi_queue_config_info {
232 u16 vsi_id;
233 u16 num_queue_pairs;
234 struct i40e_virtchnl_queue_pair_info qpair[1];
237 /* I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP
238 * VF uses this message to map vectors to queues.
239 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
240 * are to be associated with the specified vector.
241 * The "other" causes are always mapped to vector 0.
242 * PF configures interrupt mapping and returns status.
244 struct i40e_virtchnl_vector_map {
245 u16 vsi_id;
246 u16 vector_id;
247 u16 rxq_map;
248 u16 txq_map;
249 u16 rxitr_idx;
250 u16 txitr_idx;
253 struct i40e_virtchnl_irq_map_info {
254 u16 num_vectors;
255 struct i40e_virtchnl_vector_map vecmap[1];
258 /* I40E_VIRTCHNL_OP_ENABLE_QUEUES
259 * I40E_VIRTCHNL_OP_DISABLE_QUEUES
260 * VF sends these message to enable or disable TX/RX queue pairs.
261 * The queues fields are bitmaps indicating which queues to act upon.
262 * (Currently, we only support 16 queues per VF, but we make the field
263 * u32 to allow for expansion.)
264 * PF performs requested action and returns status.
266 struct i40e_virtchnl_queue_select {
267 u16 vsi_id;
268 u16 pad;
269 u32 rx_queues;
270 u32 tx_queues;
273 /* I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS
274 * VF sends this message in order to add one or more unicast or multicast
275 * address filters for the specified VSI.
276 * PF adds the filters and returns status.
279 /* I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS
280 * VF sends this message in order to remove one or more unicast or multicast
281 * filters for the specified VSI.
282 * PF removes the filters and returns status.
285 struct i40e_virtchnl_ether_addr {
286 u8 addr[ETH_ALEN];
287 u8 pad[2];
290 struct i40e_virtchnl_ether_addr_list {
291 u16 vsi_id;
292 u16 num_elements;
293 struct i40e_virtchnl_ether_addr list[1];
296 /* I40E_VIRTCHNL_OP_ADD_VLAN
297 * VF sends this message to add one or more VLAN tag filters for receives.
298 * PF adds the filters and returns status.
299 * If a port VLAN is configured by the PF, this operation will return an
300 * error to the VF.
303 /* I40E_VIRTCHNL_OP_DEL_VLAN
304 * VF sends this message to remove one or more VLAN tag filters for receives.
305 * PF removes the filters and returns status.
306 * If a port VLAN is configured by the PF, this operation will return an
307 * error to the VF.
310 struct i40e_virtchnl_vlan_filter_list {
311 u16 vsi_id;
312 u16 num_elements;
313 u16 vlan_id[1];
316 /* I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
317 * VF sends VSI id and flags.
318 * PF returns status code in retval.
319 * Note: we assume that broadcast accept mode is always enabled.
321 struct i40e_virtchnl_promisc_info {
322 u16 vsi_id;
323 u16 flags;
326 #define I40E_FLAG_VF_UNICAST_PROMISC 0x00000001
327 #define I40E_FLAG_VF_MULTICAST_PROMISC 0x00000002
329 /* I40E_VIRTCHNL_OP_GET_STATS
330 * VF sends this message to request stats for the selected VSI. VF uses
331 * the i40e_virtchnl_queue_select struct to specify the VSI. The queue_id
332 * field is ignored by the PF.
334 * PF replies with struct i40e_eth_stats in an external buffer.
337 /* I40E_VIRTCHNL_OP_CONFIG_RSS_KEY
338 * I40E_VIRTCHNL_OP_CONFIG_RSS_LUT
339 * VF sends these messages to configure RSS. Only supported if both PF
340 * and VF drivers set the I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
341 * configuration negotiation. If this is the case, then the RSS fields in
342 * the VF resource struct are valid.
343 * Both the key and LUT are initialized to 0 by the PF, meaning that
344 * RSS is effectively disabled until set up by the VF.
346 struct i40e_virtchnl_rss_key {
347 u16 vsi_id;
348 u16 key_len;
349 u8 key[1]; /* RSS hash key, packed bytes */
352 struct i40e_virtchnl_rss_lut {
353 u16 vsi_id;
354 u16 lut_entries;
355 u8 lut[1]; /* RSS lookup table*/
358 /* I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS
359 * I40E_VIRTCHNL_OP_SET_RSS_HENA
360 * VF sends these messages to get and set the hash filter enable bits for RSS.
361 * By default, the PF sets these to all possible traffic types that the
362 * hardware supports. The VF can query this value if it wants to change the
363 * traffic types that are hashed by the hardware.
364 * Traffic types are defined in the i40e_filter_pctype enum in i40e_type.h
366 struct i40e_virtchnl_rss_hena {
367 u64 hena;
370 /* I40E_VIRTCHNL_OP_EVENT
371 * PF sends this message to inform the VF driver of events that may affect it.
372 * No direct response is expected from the VF, though it may generate other
373 * messages in response to this one.
375 enum i40e_virtchnl_event_codes {
376 I40E_VIRTCHNL_EVENT_UNKNOWN = 0,
377 I40E_VIRTCHNL_EVENT_LINK_CHANGE,
378 I40E_VIRTCHNL_EVENT_RESET_IMPENDING,
379 I40E_VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
381 #define I40E_PF_EVENT_SEVERITY_INFO 0
382 #define I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM 255
384 struct i40e_virtchnl_pf_event {
385 enum i40e_virtchnl_event_codes event;
386 union {
387 struct {
388 enum i40e_aq_link_speed link_speed;
389 bool link_status;
390 } link_event;
391 } event_data;
393 int severity;
396 /* VF reset states - these are written into the RSTAT register:
397 * I40E_VFGEN_RSTAT1 on the PF
398 * I40E_VFGEN_RSTAT on the VF
399 * When the PF initiates a reset, it writes 0
400 * When the reset is complete, it writes 1
401 * When the PF detects that the VF has recovered, it writes 2
402 * VF checks this register periodically to determine if a reset has occurred,
403 * then polls it to know when the reset is complete.
404 * If either the PF or VF reads the register while the hardware
405 * is in a reset state, it will return DEADBEEF, which, when masked
406 * will result in 3.
408 enum i40e_vfr_states {
409 I40E_VFR_INPROGRESS = 0,
410 I40E_VFR_COMPLETED,
411 I40E_VFR_VFACTIVE,
412 I40E_VFR_UNKNOWN,
415 #endif /* _I40E_VIRTCHNL_H_ */