1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*******************************************************************************
4 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
5 * Copyright(c) 2013 - 2014 Intel Corporation.
8 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
9 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
11 ******************************************************************************/
17 * This header file describes the VF-PF communication protocol used
18 * by the drivers for all devices starting from our 40G product line
20 * Admin queue buffer usage:
21 * desc->opcode is always aqc_opc_send_msg_to_pf
22 * flags, retval, datalen, and data addr are all used normally.
23 * The Firmware copies the cookie fields when sending messages between the
24 * PF and VF, but uses all other fields internally. Due to this limitation,
25 * we must send all messages as "indirect", i.e. using an external buffer.
27 * All the VSI indexes are relative to the VF. Each VF can have maximum of
28 * three VSIs. All the queue indexes are relative to the VSI. Each VF can
29 * have a maximum of sixteen queues for all of its VSIs.
31 * The PF is required to return a status code in v_retval for all messages
32 * except RESET_VF, which does not require any response. The return value
33 * is of status_code type, defined in the shared type.h.
35 * In general, VF driver initialization should roughly follow the order of
36 * these opcodes. The VF driver must first validate the API version of the
37 * PF driver, then request a reset, then get resources, then configure
38 * queues and interrupts. After these operations are complete, the VF
39 * driver may start its queues, optionally add MAC and VLAN filters, and
43 /* START GENERIC DEFINES
44 * Need to ensure the following enums and defines hold the same meaning and
45 * value in current and future projects
49 enum virtchnl_status_code {
50 VIRTCHNL_STATUS_SUCCESS = 0,
51 VIRTCHNL_STATUS_ERR_PARAM = -5,
52 VIRTCHNL_STATUS_ERR_NO_MEMORY = -18,
53 VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
54 VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
55 VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
56 VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53,
57 VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64,
60 /* Backward compatibility */
61 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
62 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
64 #define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT 0x0
65 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1
66 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2
67 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3
68 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4
69 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5
70 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6
71 #define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7
73 enum virtchnl_link_speed {
74 VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
75 VIRTCHNL_LINK_SPEED_100MB = BIT(VIRTCHNL_LINK_SPEED_100MB_SHIFT),
76 VIRTCHNL_LINK_SPEED_1GB = BIT(VIRTCHNL_LINK_SPEED_1000MB_SHIFT),
77 VIRTCHNL_LINK_SPEED_10GB = BIT(VIRTCHNL_LINK_SPEED_10GB_SHIFT),
78 VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
79 VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
80 VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
81 VIRTCHNL_LINK_SPEED_2_5GB = BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
82 VIRTCHNL_LINK_SPEED_5GB = BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
85 /* for hsplit_0 field of Rx HMC context */
86 /* deprecated with AVF 1.0 */
87 enum virtchnl_rx_hsplit {
88 VIRTCHNL_RX_HSPLIT_NO_SPLIT = 0,
89 VIRTCHNL_RX_HSPLIT_SPLIT_L2 = 1,
90 VIRTCHNL_RX_HSPLIT_SPLIT_IP = 2,
91 VIRTCHNL_RX_HSPLIT_SPLIT_TCP_UDP = 4,
92 VIRTCHNL_RX_HSPLIT_SPLIT_SCTP = 8,
95 /* END GENERIC DEFINES */
97 /* Opcodes for VF-PF communication. These are placed in the v_opcode field
98 * of the virtchnl_msg structure.
101 /* The PF sends status change events to VFs using
102 * the VIRTCHNL_OP_EVENT opcode.
103 * VFs send requests to the PF using the other ops.
104 * Use of "advanced opcode" features must be negotiated as part of capabilities
105 * exchange and are not considered part of base mode feature set.
107 VIRTCHNL_OP_UNKNOWN = 0,
108 VIRTCHNL_OP_VERSION = 1, /* must ALWAYS be 1 */
109 VIRTCHNL_OP_RESET_VF = 2,
110 VIRTCHNL_OP_GET_VF_RESOURCES = 3,
111 VIRTCHNL_OP_CONFIG_TX_QUEUE = 4,
112 VIRTCHNL_OP_CONFIG_RX_QUEUE = 5,
113 VIRTCHNL_OP_CONFIG_VSI_QUEUES = 6,
114 VIRTCHNL_OP_CONFIG_IRQ_MAP = 7,
115 VIRTCHNL_OP_ENABLE_QUEUES = 8,
116 VIRTCHNL_OP_DISABLE_QUEUES = 9,
117 VIRTCHNL_OP_ADD_ETH_ADDR = 10,
118 VIRTCHNL_OP_DEL_ETH_ADDR = 11,
119 VIRTCHNL_OP_ADD_VLAN = 12,
120 VIRTCHNL_OP_DEL_VLAN = 13,
121 VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
122 VIRTCHNL_OP_GET_STATS = 15,
123 VIRTCHNL_OP_RSVD = 16,
124 VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
125 VIRTCHNL_OP_IWARP = 20, /* advanced opcode */
126 VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21, /* advanced opcode */
127 VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22, /* advanced opcode */
128 VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
129 VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
130 VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
131 VIRTCHNL_OP_SET_RSS_HENA = 26,
132 VIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,
133 VIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28,
134 VIRTCHNL_OP_REQUEST_QUEUES = 29,
135 VIRTCHNL_OP_ENABLE_CHANNELS = 30,
136 VIRTCHNL_OP_DISABLE_CHANNELS = 31,
137 VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
138 VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
139 /* opcode 34 - 44 are reserved */
140 VIRTCHNL_OP_ADD_RSS_CFG = 45,
141 VIRTCHNL_OP_DEL_RSS_CFG = 46,
142 VIRTCHNL_OP_ADD_FDIR_FILTER = 47,
143 VIRTCHNL_OP_DEL_FDIR_FILTER = 48,
147 /* These macros are used to generate compilation errors if a structure/union
148 * is not exactly the correct length. It gives a divide by zero error if the
149 * structure/union is not of the correct size, otherwise it creates an enum
150 * that is never used.
152 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
153 { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
154 #define VIRTCHNL_CHECK_UNION_LEN(n, X) enum virtchnl_static_asset_enum_##X \
155 { virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }
157 /* Virtual channel message descriptor. This overlays the admin queue
158 * descriptor. All other data is passed in external buffers.
161 struct virtchnl_msg {
162 u8 pad[8]; /* AQ flags/opcode/len/retval fields */
163 enum virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
164 enum virtchnl_status_code v_retval; /* ditto for desc->retval */
165 u32 vfid; /* used by PF when sending to VF */
168 VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);
170 /* Message descriptions and data structures. */
172 /* VIRTCHNL_OP_VERSION
173 * VF posts its version number to the PF. PF responds with its version number
174 * in the same format, along with a return code.
175 * Reply from PF has its major/minor versions also in param0 and param1.
176 * If there is a major version mismatch, then the VF cannot operate.
177 * If there is a minor version mismatch, then the VF can operate but should
178 * add a warning to the system log.
180 * This enum element MUST always be specified as == 1, regardless of other
181 * changes in the API. The PF must always respond to this message without
182 * error regardless of version mismatch.
184 #define VIRTCHNL_VERSION_MAJOR 1
185 #define VIRTCHNL_VERSION_MINOR 1
186 #define VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0
188 struct virtchnl_version_info {
193 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_version_info);
195 #define VF_IS_V10(_v) (((_v)->major == 1) && ((_v)->minor == 0))
196 #define VF_IS_V11(_ver) (((_ver)->major == 1) && ((_ver)->minor == 1))
198 /* VIRTCHNL_OP_RESET_VF
199 * VF sends this request to PF with no parameters
200 * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
201 * until reset completion is indicated. The admin queue must be reinitialized
202 * after this operation.
204 * When reset is complete, PF must ensure that all queues in all VSIs associated
205 * with the VF are stopped, all queue configurations in the HMC are set to 0,
206 * and all MAC and VLAN filters (except the default MAC address) on all VSIs
210 /* VSI types that use VIRTCHNL interface for VF-PF communication. VSI_SRIOV
211 * vsi_type should always be 6 for backward compatibility. Add other fields
214 enum virtchnl_vsi_type {
215 VIRTCHNL_VSI_TYPE_INVALID = 0,
216 VIRTCHNL_VSI_SRIOV = 6,
219 /* VIRTCHNL_OP_GET_VF_RESOURCES
220 * Version 1.0 VF sends this request to PF with no parameters
221 * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities
222 * PF responds with an indirect message containing
223 * virtchnl_vf_resource and one or more
224 * virtchnl_vsi_resource structures.
227 struct virtchnl_vsi_resource {
230 enum virtchnl_vsi_type vsi_type;
232 u8 default_mac_addr[ETH_ALEN];
235 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
237 /* VF capability flags
238 * VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including
239 * TX/RX Checksum offloading and TSO for non-tunnelled packets.
241 #define VIRTCHNL_VF_OFFLOAD_L2 0x00000001
242 #define VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
243 #define VIRTCHNL_VF_OFFLOAD_RSVD 0x00000004
244 #define VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
245 #define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
246 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
247 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES 0x00000040
248 #define VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
249 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
250 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
251 #define VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
252 #define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
253 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
254 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
255 #define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000
256 #define VIRTCHNL_VF_OFFLOAD_USO 0X02000000
257 #define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF 0X08000000
258 #define VIRTCHNL_VF_OFFLOAD_FDIR_PF 0X10000000
260 /* Define below the capability flags that are not offloads */
261 #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080
262 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
263 VIRTCHNL_VF_OFFLOAD_VLAN | \
264 VIRTCHNL_VF_OFFLOAD_RSS_PF)
266 struct virtchnl_vf_resource {
276 struct virtchnl_vsi_resource vsi_res[1];
279 VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_vf_resource);
281 /* VIRTCHNL_OP_CONFIG_TX_QUEUE
282 * VF sends this message to set up parameters for one TX queue.
283 * External data buffer contains one instance of virtchnl_txq_info.
284 * PF configures requested queue and returns a status code.
287 /* Tx queue config info */
288 struct virtchnl_txq_info {
291 u16 ring_len; /* number of descriptors, multiple of 8 */
292 u16 headwb_enabled; /* deprecated with AVF 1.0 */
294 u64 dma_headwb_addr; /* deprecated with AVF 1.0 */
297 VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
299 /* VIRTCHNL_OP_CONFIG_RX_QUEUE
300 * VF sends this message to set up parameters for one RX queue.
301 * External data buffer contains one instance of virtchnl_rxq_info.
302 * PF configures requested queue and returns a status code.
305 /* Rx queue config info */
306 struct virtchnl_rxq_info {
309 u32 ring_len; /* number of descriptors, multiple of 32 */
311 u16 splithdr_enabled; /* deprecated with AVF 1.0 */
316 enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
320 VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);
322 /* VIRTCHNL_OP_CONFIG_VSI_QUEUES
323 * VF sends this message to set parameters for all active TX and RX queues
324 * associated with the specified VSI.
325 * PF configures queues and returns status.
326 * If the number of queues specified is greater than the number of queues
327 * associated with the VSI, an error is returned and no queues are configured.
329 struct virtchnl_queue_pair_info {
330 /* NOTE: vsi_id and queue_id should be identical for both queues. */
331 struct virtchnl_txq_info txq;
332 struct virtchnl_rxq_info rxq;
335 VIRTCHNL_CHECK_STRUCT_LEN(64, virtchnl_queue_pair_info);
337 struct virtchnl_vsi_queue_config_info {
341 struct virtchnl_queue_pair_info qpair[1];
344 VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);
346 /* VIRTCHNL_OP_REQUEST_QUEUES
347 * VF sends this message to request the PF to allocate additional queues to
348 * this VF. Each VF gets a guaranteed number of queues on init but asking for
349 * additional queues must be negotiated. This is a best effort request as it
350 * is possible the PF does not have enough queues left to support the request.
351 * If the PF cannot support the number requested it will respond with the
352 * maximum number it is able to support. If the request is successful, PF will
353 * then reset the VF to institute required changes.
356 /* VF resource request */
357 struct virtchnl_vf_res_request {
361 /* VIRTCHNL_OP_CONFIG_IRQ_MAP
362 * VF uses this message to map vectors to queues.
363 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
364 * are to be associated with the specified vector.
365 * The "other" causes are always mapped to vector 0.
366 * PF configures interrupt mapping and returns status.
368 struct virtchnl_vector_map {
377 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_vector_map);
379 struct virtchnl_irq_map_info {
381 struct virtchnl_vector_map vecmap[1];
384 VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);
386 /* VIRTCHNL_OP_ENABLE_QUEUES
387 * VIRTCHNL_OP_DISABLE_QUEUES
388 * VF sends these message to enable or disable TX/RX queue pairs.
389 * The queues fields are bitmaps indicating which queues to act upon.
390 * (Currently, we only support 16 queues per VF, but we make the field
391 * u32 to allow for expansion.)
392 * PF performs requested action and returns status.
394 struct virtchnl_queue_select {
401 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_select);
403 /* VIRTCHNL_OP_ADD_ETH_ADDR
404 * VF sends this message in order to add one or more unicast or multicast
405 * address filters for the specified VSI.
406 * PF adds the filters and returns status.
409 /* VIRTCHNL_OP_DEL_ETH_ADDR
410 * VF sends this message in order to remove one or more unicast or multicast
411 * filters for the specified VSI.
412 * PF removes the filters and returns status.
415 /* VIRTCHNL_ETHER_ADDR_LEGACY
416 * Prior to adding the @type member to virtchnl_ether_addr, there were 2 pad
417 * bytes. Moving forward all VF drivers should not set type to
418 * VIRTCHNL_ETHER_ADDR_LEGACY. This is only here to not break previous/legacy
419 * behavior. The control plane function (i.e. PF) can use a best effort method
420 * of tracking the primary/device unicast in this case, but there is no
421 * guarantee and functionality depends on the implementation of the PF.
424 /* VIRTCHNL_ETHER_ADDR_PRIMARY
425 * All VF drivers should set @type to VIRTCHNL_ETHER_ADDR_PRIMARY for the
426 * primary/device unicast MAC address filter for VIRTCHNL_OP_ADD_ETH_ADDR and
427 * VIRTCHNL_OP_DEL_ETH_ADDR. This allows for the underlying control plane
428 * function (i.e. PF) to accurately track and use this MAC address for
429 * displaying on the host and for VM/function reset.
432 /* VIRTCHNL_ETHER_ADDR_EXTRA
433 * All VF drivers should set @type to VIRTCHNL_ETHER_ADDR_EXTRA for any extra
434 * unicast and/or multicast filters that are being added/deleted via
435 * VIRTCHNL_OP_DEL_ETH_ADDR/VIRTCHNL_OP_ADD_ETH_ADDR respectively.
437 struct virtchnl_ether_addr {
440 #define VIRTCHNL_ETHER_ADDR_LEGACY 0
441 #define VIRTCHNL_ETHER_ADDR_PRIMARY 1
442 #define VIRTCHNL_ETHER_ADDR_EXTRA 2
443 #define VIRTCHNL_ETHER_ADDR_TYPE_MASK 3 /* first two bits of type are valid */
447 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_ether_addr);
449 struct virtchnl_ether_addr_list {
452 struct virtchnl_ether_addr list[1];
455 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_ether_addr_list);
457 /* VIRTCHNL_OP_ADD_VLAN
458 * VF sends this message to add one or more VLAN tag filters for receives.
459 * PF adds the filters and returns status.
460 * If a port VLAN is configured by the PF, this operation will return an
464 /* VIRTCHNL_OP_DEL_VLAN
465 * VF sends this message to remove one or more VLAN tag filters for receives.
466 * PF removes the filters and returns status.
467 * If a port VLAN is configured by the PF, this operation will return an
471 struct virtchnl_vlan_filter_list {
477 VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vlan_filter_list);
479 /* VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
480 * VF sends VSI id and flags.
481 * PF returns status code in retval.
482 * Note: we assume that broadcast accept mode is always enabled.
484 struct virtchnl_promisc_info {
489 VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_promisc_info);
491 #define FLAG_VF_UNICAST_PROMISC 0x00000001
492 #define FLAG_VF_MULTICAST_PROMISC 0x00000002
494 /* VIRTCHNL_OP_GET_STATS
495 * VF sends this message to request stats for the selected VSI. VF uses
496 * the virtchnl_queue_select struct to specify the VSI. The queue_id
497 * field is ignored by the PF.
499 * PF replies with struct eth_stats in an external buffer.
502 /* VIRTCHNL_OP_CONFIG_RSS_KEY
503 * VIRTCHNL_OP_CONFIG_RSS_LUT
504 * VF sends these messages to configure RSS. Only supported if both PF
505 * and VF drivers set the VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
506 * configuration negotiation. If this is the case, then the RSS fields in
507 * the VF resource struct are valid.
508 * Both the key and LUT are initialized to 0 by the PF, meaning that
509 * RSS is effectively disabled until set up by the VF.
511 struct virtchnl_rss_key {
514 u8 key[1]; /* RSS hash key, packed bytes */
517 VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key);
519 struct virtchnl_rss_lut {
522 u8 lut[1]; /* RSS lookup table */
525 VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut);
527 /* VIRTCHNL_OP_GET_RSS_HENA_CAPS
528 * VIRTCHNL_OP_SET_RSS_HENA
529 * VF sends these messages to get and set the hash filter enable bits for RSS.
530 * By default, the PF sets these to all possible traffic types that the
531 * hardware supports. The VF can query this value if it wants to change the
532 * traffic types that are hashed by the hardware.
534 struct virtchnl_rss_hena {
538 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
540 /* VIRTCHNL_OP_ENABLE_CHANNELS
541 * VIRTCHNL_OP_DISABLE_CHANNELS
542 * VF sends these messages to enable or disable channels based on
543 * the user specified queue count and queue offset for each traffic class.
544 * This struct encompasses all the information that the PF needs from
545 * VF to create a channel.
547 struct virtchnl_channel_info {
548 u16 count; /* number of queues in a channel */
549 u16 offset; /* queues in a channel start from 'offset' */
554 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_channel_info);
556 struct virtchnl_tc_info {
559 struct virtchnl_channel_info list[1];
562 VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
564 /* VIRTCHNL_ADD_CLOUD_FILTER
565 * VIRTCHNL_DEL_CLOUD_FILTER
566 * VF sends these messages to add or delete a cloud filter based on the
567 * user specified match and action filters. These structures encompass
568 * all the information that the PF needs from the VF to add/delete a
572 struct virtchnl_l4_spec {
573 u8 src_mac[ETH_ALEN];
574 u8 dst_mac[ETH_ALEN];
576 __be16 pad; /* reserved for future use */
583 VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec);
585 union virtchnl_flow_spec {
586 struct virtchnl_l4_spec tcp_spec;
587 u8 buffer[128]; /* reserved for future use */
590 VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec);
592 enum virtchnl_action {
594 VIRTCHNL_ACTION_DROP = 0,
595 VIRTCHNL_ACTION_TC_REDIRECT,
596 VIRTCHNL_ACTION_PASSTHRU,
597 VIRTCHNL_ACTION_QUEUE,
598 VIRTCHNL_ACTION_Q_REGION,
599 VIRTCHNL_ACTION_MARK,
600 VIRTCHNL_ACTION_COUNT,
603 enum virtchnl_flow_type {
605 VIRTCHNL_TCP_V4_FLOW = 0,
606 VIRTCHNL_TCP_V6_FLOW,
609 struct virtchnl_filter {
610 union virtchnl_flow_spec data;
611 union virtchnl_flow_spec mask;
612 enum virtchnl_flow_type flow_type;
613 enum virtchnl_action action;
619 VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
622 * PF sends this message to inform the VF driver of events that may affect it.
623 * No direct response is expected from the VF, though it may generate other
624 * messages in response to this one.
626 enum virtchnl_event_codes {
627 VIRTCHNL_EVENT_UNKNOWN = 0,
628 VIRTCHNL_EVENT_LINK_CHANGE,
629 VIRTCHNL_EVENT_RESET_IMPENDING,
630 VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
633 #define PF_EVENT_SEVERITY_INFO 0
634 #define PF_EVENT_SEVERITY_CERTAIN_DOOM 255
636 struct virtchnl_pf_event {
637 enum virtchnl_event_codes event;
639 /* If the PF driver does not support the new speed reporting
640 * capabilities then use link_event else use link_event_adv to
641 * get the speed and link information. The ability to understand
642 * new speeds is indicated by setting the capability flag
643 * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter
644 * in virtchnl_vf_resource struct and can be used to determine
645 * which link event struct to use below.
648 enum virtchnl_link_speed link_speed;
652 /* link_speed provided in Mbps */
662 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
664 /* VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
665 * VF uses this message to request PF to map IWARP vectors to IWARP queues.
666 * The request for this originates from the VF IWARP driver through
667 * a client interface between VF LAN and VF IWARP driver.
668 * A vector could have an AEQ and CEQ attached to it although
669 * there is a single AEQ per VF IWARP instance in which case
670 * most vectors will have an INVALID_IDX for aeq and valid idx for ceq.
671 * There will never be a case where there will be multiple CEQs attached
672 * to a single vector.
673 * PF configures interrupt mapping and returns status.
676 struct virtchnl_iwarp_qv_info {
677 u32 v_idx; /* msix_vector */
684 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
686 struct virtchnl_iwarp_qvlist_info {
688 struct virtchnl_iwarp_qv_info qv_info[1];
691 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
693 /* VF reset states - these are written into the RSTAT register:
694 * VFGEN_RSTAT on the VF
695 * When the PF initiates a reset, it writes 0
696 * When the reset is complete, it writes 1
697 * When the PF detects that the VF has recovered, it writes 2
698 * VF checks this register periodically to determine if a reset has occurred,
699 * then polls it to know when the reset is complete.
700 * If either the PF or VF reads the register while the hardware
701 * is in a reset state, it will return DEADBEEF, which, when masked
704 enum virtchnl_vfr_states {
705 VIRTCHNL_VFR_INPROGRESS = 0,
706 VIRTCHNL_VFR_COMPLETED,
707 VIRTCHNL_VFR_VFACTIVE,
710 /* Type of RSS algorithm */
711 enum virtchnl_rss_algorithm {
712 VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC = 0,
713 VIRTCHNL_RSS_ALG_R_ASYMMETRIC = 1,
714 VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC = 2,
715 VIRTCHNL_RSS_ALG_XOR_SYMMETRIC = 3,
718 #define VIRTCHNL_MAX_NUM_PROTO_HDRS 32
719 #define PROTO_HDR_SHIFT 5
720 #define PROTO_HDR_FIELD_START(proto_hdr_type) ((proto_hdr_type) << PROTO_HDR_SHIFT)
721 #define PROTO_HDR_FIELD_MASK ((1UL << PROTO_HDR_SHIFT) - 1)
723 /* VF use these macros to configure each protocol header.
724 * Specify which protocol headers and protocol header fields base on
725 * virtchnl_proto_hdr_type and virtchnl_proto_hdr_field.
726 * @param hdr: a struct of virtchnl_proto_hdr
727 * @param hdr_type: ETH/IPV4/TCP, etc
728 * @param field: SRC/DST/TEID/SPI, etc
730 #define VIRTCHNL_ADD_PROTO_HDR_FIELD(hdr, field) \
731 ((hdr)->field_selector |= BIT((field) & PROTO_HDR_FIELD_MASK))
732 #define VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr, field) \
733 ((hdr)->field_selector &= ~BIT((field) & PROTO_HDR_FIELD_MASK))
734 #define VIRTCHNL_TEST_PROTO_HDR_FIELD(hdr, val) \
735 ((hdr)->field_selector & BIT((val) & PROTO_HDR_FIELD_MASK))
736 #define VIRTCHNL_GET_PROTO_HDR_FIELD(hdr) ((hdr)->field_selector)
738 #define VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, hdr_type, field) \
739 (VIRTCHNL_ADD_PROTO_HDR_FIELD(hdr, \
740 VIRTCHNL_PROTO_HDR_ ## hdr_type ## _ ## field))
741 #define VIRTCHNL_DEL_PROTO_HDR_FIELD_BIT(hdr, hdr_type, field) \
742 (VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr, \
743 VIRTCHNL_PROTO_HDR_ ## hdr_type ## _ ## field))
745 #define VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, hdr_type) \
746 ((hdr)->type = VIRTCHNL_PROTO_HDR_ ## hdr_type)
747 #define VIRTCHNL_GET_PROTO_HDR_TYPE(hdr) \
748 (((hdr)->type) >> PROTO_HDR_SHIFT)
749 #define VIRTCHNL_TEST_PROTO_HDR_TYPE(hdr, val) \
750 ((hdr)->type == ((val) >> PROTO_HDR_SHIFT))
751 #define VIRTCHNL_TEST_PROTO_HDR(hdr, val) \
752 (VIRTCHNL_TEST_PROTO_HDR_TYPE((hdr), (val)) && \
753 VIRTCHNL_TEST_PROTO_HDR_FIELD((hdr), (val)))
755 /* Protocol header type within a packet segment. A segment consists of one or
756 * more protocol headers that make up a logical group of protocol headers. Each
757 * logical group of protocol headers encapsulates or is encapsulated using/by
758 * tunneling or encapsulation protocols for network virtualization.
760 enum virtchnl_proto_hdr_type {
761 VIRTCHNL_PROTO_HDR_NONE,
762 VIRTCHNL_PROTO_HDR_ETH,
763 VIRTCHNL_PROTO_HDR_S_VLAN,
764 VIRTCHNL_PROTO_HDR_C_VLAN,
765 VIRTCHNL_PROTO_HDR_IPV4,
766 VIRTCHNL_PROTO_HDR_IPV6,
767 VIRTCHNL_PROTO_HDR_TCP,
768 VIRTCHNL_PROTO_HDR_UDP,
769 VIRTCHNL_PROTO_HDR_SCTP,
770 VIRTCHNL_PROTO_HDR_GTPU_IP,
771 VIRTCHNL_PROTO_HDR_GTPU_EH,
772 VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN,
773 VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP,
774 VIRTCHNL_PROTO_HDR_PPPOE,
775 VIRTCHNL_PROTO_HDR_L2TPV3,
776 VIRTCHNL_PROTO_HDR_ESP,
777 VIRTCHNL_PROTO_HDR_AH,
778 VIRTCHNL_PROTO_HDR_PFCP,
781 /* Protocol header field within a protocol header. */
782 enum virtchnl_proto_hdr_field {
784 VIRTCHNL_PROTO_HDR_ETH_SRC =
785 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_ETH),
786 VIRTCHNL_PROTO_HDR_ETH_DST,
787 VIRTCHNL_PROTO_HDR_ETH_ETHERTYPE,
789 VIRTCHNL_PROTO_HDR_S_VLAN_ID =
790 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_S_VLAN),
792 VIRTCHNL_PROTO_HDR_C_VLAN_ID =
793 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_C_VLAN),
795 VIRTCHNL_PROTO_HDR_IPV4_SRC =
796 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV4),
797 VIRTCHNL_PROTO_HDR_IPV4_DST,
798 VIRTCHNL_PROTO_HDR_IPV4_DSCP,
799 VIRTCHNL_PROTO_HDR_IPV4_TTL,
800 VIRTCHNL_PROTO_HDR_IPV4_PROT,
802 VIRTCHNL_PROTO_HDR_IPV6_SRC =
803 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV6),
804 VIRTCHNL_PROTO_HDR_IPV6_DST,
805 VIRTCHNL_PROTO_HDR_IPV6_TC,
806 VIRTCHNL_PROTO_HDR_IPV6_HOP_LIMIT,
807 VIRTCHNL_PROTO_HDR_IPV6_PROT,
809 VIRTCHNL_PROTO_HDR_TCP_SRC_PORT =
810 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_TCP),
811 VIRTCHNL_PROTO_HDR_TCP_DST_PORT,
813 VIRTCHNL_PROTO_HDR_UDP_SRC_PORT =
814 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_UDP),
815 VIRTCHNL_PROTO_HDR_UDP_DST_PORT,
817 VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT =
818 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_SCTP),
819 VIRTCHNL_PROTO_HDR_SCTP_DST_PORT,
821 VIRTCHNL_PROTO_HDR_GTPU_IP_TEID =
822 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_IP),
824 VIRTCHNL_PROTO_HDR_GTPU_EH_PDU =
825 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH),
826 VIRTCHNL_PROTO_HDR_GTPU_EH_QFI,
828 VIRTCHNL_PROTO_HDR_PPPOE_SESS_ID =
829 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_PPPOE),
831 VIRTCHNL_PROTO_HDR_L2TPV3_SESS_ID =
832 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_L2TPV3),
834 VIRTCHNL_PROTO_HDR_ESP_SPI =
835 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_ESP),
837 VIRTCHNL_PROTO_HDR_AH_SPI =
838 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_AH),
840 VIRTCHNL_PROTO_HDR_PFCP_S_FIELD =
841 PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_PFCP),
842 VIRTCHNL_PROTO_HDR_PFCP_SEID,
845 struct virtchnl_proto_hdr {
846 enum virtchnl_proto_hdr_type type;
847 u32 field_selector; /* a bit mask to select field for header type */
850 * binary buffer in network order for specific header type.
851 * For example, if type = VIRTCHNL_PROTO_HDR_IPV4, a IPv4
852 * header is expected to be copied into the buffer.
856 VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr);
858 struct virtchnl_proto_hdrs {
862 * specify where protocol header start from.
863 * 0 - from the outer layer
864 * 1 - from the first inner layer
865 * 2 - from the second inner layer
868 int count; /* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */
869 struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS];
872 VIRTCHNL_CHECK_STRUCT_LEN(2312, virtchnl_proto_hdrs);
874 struct virtchnl_rss_cfg {
875 struct virtchnl_proto_hdrs proto_hdrs; /* protocol headers */
876 enum virtchnl_rss_algorithm rss_algorithm; /* RSS algorithm type */
877 u8 reserved[128]; /* reserve for future */
880 VIRTCHNL_CHECK_STRUCT_LEN(2444, virtchnl_rss_cfg);
882 /* action configuration for FDIR */
883 struct virtchnl_filter_action {
884 enum virtchnl_action type;
886 /* used for queue and qgroup action */
891 /* used for count action */
893 /* share counter ID with other flow rules */
895 u32 id; /* counter ID */
897 /* used for mark action */
903 VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_filter_action);
905 #define VIRTCHNL_MAX_NUM_ACTIONS 8
907 struct virtchnl_filter_action_set {
908 /* action number must be less then VIRTCHNL_MAX_NUM_ACTIONS */
910 struct virtchnl_filter_action actions[VIRTCHNL_MAX_NUM_ACTIONS];
913 VIRTCHNL_CHECK_STRUCT_LEN(292, virtchnl_filter_action_set);
915 /* pattern and action for FDIR rule */
916 struct virtchnl_fdir_rule {
917 struct virtchnl_proto_hdrs proto_hdrs;
918 struct virtchnl_filter_action_set action_set;
921 VIRTCHNL_CHECK_STRUCT_LEN(2604, virtchnl_fdir_rule);
923 /* Status returned to VF after VF requests FDIR commands
924 * VIRTCHNL_FDIR_SUCCESS
925 * VF FDIR related request is successfully done by PF
926 * The request can be OP_ADD/DEL.
928 * VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE
929 * OP_ADD_FDIR_FILTER request is failed due to no Hardware resource.
931 * VIRTCHNL_FDIR_FAILURE_RULE_EXIST
932 * OP_ADD_FDIR_FILTER request is failed due to the rule is already existed.
934 * VIRTCHNL_FDIR_FAILURE_RULE_CONFLICT
935 * OP_ADD_FDIR_FILTER request is failed due to conflict with existing rule.
937 * VIRTCHNL_FDIR_FAILURE_RULE_NONEXIST
938 * OP_DEL_FDIR_FILTER request is failed due to this rule doesn't exist.
940 * VIRTCHNL_FDIR_FAILURE_RULE_INVALID
941 * OP_ADD_FDIR_FILTER request is failed due to parameters validation
942 * or HW doesn't support.
944 * VIRTCHNL_FDIR_FAILURE_RULE_TIMEOUT
945 * OP_ADD/DEL_FDIR_FILTER request is failed due to timing out
948 enum virtchnl_fdir_prgm_status {
949 VIRTCHNL_FDIR_SUCCESS = 0,
950 VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE,
951 VIRTCHNL_FDIR_FAILURE_RULE_EXIST,
952 VIRTCHNL_FDIR_FAILURE_RULE_CONFLICT,
953 VIRTCHNL_FDIR_FAILURE_RULE_NONEXIST,
954 VIRTCHNL_FDIR_FAILURE_RULE_INVALID,
955 VIRTCHNL_FDIR_FAILURE_RULE_TIMEOUT,
958 /* VIRTCHNL_OP_ADD_FDIR_FILTER
959 * VF sends this request to PF by filling out vsi_id,
960 * validate_only and rule_cfg. PF will return flow_id
961 * if the request is successfully done and return add_status to VF.
963 struct virtchnl_fdir_add {
964 u16 vsi_id; /* INPUT */
966 * 1 for validating a fdir rule, 0 for creating a fdir rule.
967 * Validate and create share one ops: VIRTCHNL_OP_ADD_FDIR_FILTER.
969 u16 validate_only; /* INPUT */
970 u32 flow_id; /* OUTPUT */
971 struct virtchnl_fdir_rule rule_cfg; /* INPUT */
972 enum virtchnl_fdir_prgm_status status; /* OUTPUT */
975 VIRTCHNL_CHECK_STRUCT_LEN(2616, virtchnl_fdir_add);
977 /* VIRTCHNL_OP_DEL_FDIR_FILTER
978 * VF sends this request to PF by filling out vsi_id
979 * and flow_id. PF will return del_status to VF.
981 struct virtchnl_fdir_del {
982 u16 vsi_id; /* INPUT */
984 u32 flow_id; /* INPUT */
985 enum virtchnl_fdir_prgm_status status; /* OUTPUT */
988 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_fdir_del);
991 * virtchnl_vc_validate_vf_msg
992 * @ver: Virtchnl version info
993 * @v_opcode: Opcode for the message
994 * @msg: pointer to the msg buffer
995 * @msglen: msg length
997 * validate msg format against struct for each opcode
1000 virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
1001 u8 *msg, u16 msglen)
1003 bool err_msg_format = false;
1006 /* Validate message length. */
1008 case VIRTCHNL_OP_VERSION:
1009 valid_len = sizeof(struct virtchnl_version_info);
1011 case VIRTCHNL_OP_RESET_VF:
1013 case VIRTCHNL_OP_GET_VF_RESOURCES:
1015 valid_len = sizeof(u32);
1017 case VIRTCHNL_OP_CONFIG_TX_QUEUE:
1018 valid_len = sizeof(struct virtchnl_txq_info);
1020 case VIRTCHNL_OP_CONFIG_RX_QUEUE:
1021 valid_len = sizeof(struct virtchnl_rxq_info);
1023 case VIRTCHNL_OP_CONFIG_VSI_QUEUES:
1024 valid_len = sizeof(struct virtchnl_vsi_queue_config_info);
1025 if (msglen >= valid_len) {
1026 struct virtchnl_vsi_queue_config_info *vqc =
1027 (struct virtchnl_vsi_queue_config_info *)msg;
1028 valid_len += (vqc->num_queue_pairs *
1030 virtchnl_queue_pair_info));
1031 if (vqc->num_queue_pairs == 0)
1032 err_msg_format = true;
1035 case VIRTCHNL_OP_CONFIG_IRQ_MAP:
1036 valid_len = sizeof(struct virtchnl_irq_map_info);
1037 if (msglen >= valid_len) {
1038 struct virtchnl_irq_map_info *vimi =
1039 (struct virtchnl_irq_map_info *)msg;
1040 valid_len += (vimi->num_vectors *
1041 sizeof(struct virtchnl_vector_map));
1042 if (vimi->num_vectors == 0)
1043 err_msg_format = true;
1046 case VIRTCHNL_OP_ENABLE_QUEUES:
1047 case VIRTCHNL_OP_DISABLE_QUEUES:
1048 valid_len = sizeof(struct virtchnl_queue_select);
1050 case VIRTCHNL_OP_ADD_ETH_ADDR:
1051 case VIRTCHNL_OP_DEL_ETH_ADDR:
1052 valid_len = sizeof(struct virtchnl_ether_addr_list);
1053 if (msglen >= valid_len) {
1054 struct virtchnl_ether_addr_list *veal =
1055 (struct virtchnl_ether_addr_list *)msg;
1056 valid_len += veal->num_elements *
1057 sizeof(struct virtchnl_ether_addr);
1058 if (veal->num_elements == 0)
1059 err_msg_format = true;
1062 case VIRTCHNL_OP_ADD_VLAN:
1063 case VIRTCHNL_OP_DEL_VLAN:
1064 valid_len = sizeof(struct virtchnl_vlan_filter_list);
1065 if (msglen >= valid_len) {
1066 struct virtchnl_vlan_filter_list *vfl =
1067 (struct virtchnl_vlan_filter_list *)msg;
1068 valid_len += vfl->num_elements * sizeof(u16);
1069 if (vfl->num_elements == 0)
1070 err_msg_format = true;
1073 case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
1074 valid_len = sizeof(struct virtchnl_promisc_info);
1076 case VIRTCHNL_OP_GET_STATS:
1077 valid_len = sizeof(struct virtchnl_queue_select);
1079 case VIRTCHNL_OP_IWARP:
1080 /* These messages are opaque to us and will be validated in
1081 * the RDMA client code. We just need to check for nonzero
1082 * length. The firmware will enforce max length restrictions.
1087 err_msg_format = true;
1089 case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP:
1091 case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:
1092 valid_len = sizeof(struct virtchnl_iwarp_qvlist_info);
1093 if (msglen >= valid_len) {
1094 struct virtchnl_iwarp_qvlist_info *qv =
1095 (struct virtchnl_iwarp_qvlist_info *)msg;
1096 if (qv->num_vectors == 0) {
1097 err_msg_format = true;
1100 valid_len += ((qv->num_vectors - 1) *
1101 sizeof(struct virtchnl_iwarp_qv_info));
1104 case VIRTCHNL_OP_CONFIG_RSS_KEY:
1105 valid_len = sizeof(struct virtchnl_rss_key);
1106 if (msglen >= valid_len) {
1107 struct virtchnl_rss_key *vrk =
1108 (struct virtchnl_rss_key *)msg;
1109 valid_len += vrk->key_len - 1;
1112 case VIRTCHNL_OP_CONFIG_RSS_LUT:
1113 valid_len = sizeof(struct virtchnl_rss_lut);
1114 if (msglen >= valid_len) {
1115 struct virtchnl_rss_lut *vrl =
1116 (struct virtchnl_rss_lut *)msg;
1117 valid_len += vrl->lut_entries - 1;
1120 case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
1122 case VIRTCHNL_OP_SET_RSS_HENA:
1123 valid_len = sizeof(struct virtchnl_rss_hena);
1125 case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
1126 case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
1128 case VIRTCHNL_OP_REQUEST_QUEUES:
1129 valid_len = sizeof(struct virtchnl_vf_res_request);
1131 case VIRTCHNL_OP_ENABLE_CHANNELS:
1132 valid_len = sizeof(struct virtchnl_tc_info);
1133 if (msglen >= valid_len) {
1134 struct virtchnl_tc_info *vti =
1135 (struct virtchnl_tc_info *)msg;
1136 valid_len += (vti->num_tc - 1) *
1137 sizeof(struct virtchnl_channel_info);
1138 if (vti->num_tc == 0)
1139 err_msg_format = true;
1142 case VIRTCHNL_OP_DISABLE_CHANNELS:
1144 case VIRTCHNL_OP_ADD_CLOUD_FILTER:
1145 valid_len = sizeof(struct virtchnl_filter);
1147 case VIRTCHNL_OP_DEL_CLOUD_FILTER:
1148 valid_len = sizeof(struct virtchnl_filter);
1150 case VIRTCHNL_OP_ADD_RSS_CFG:
1151 case VIRTCHNL_OP_DEL_RSS_CFG:
1152 valid_len = sizeof(struct virtchnl_rss_cfg);
1154 case VIRTCHNL_OP_ADD_FDIR_FILTER:
1155 valid_len = sizeof(struct virtchnl_fdir_add);
1157 case VIRTCHNL_OP_DEL_FDIR_FILTER:
1158 valid_len = sizeof(struct virtchnl_fdir_del);
1160 /* These are always errors coming from the VF. */
1161 case VIRTCHNL_OP_EVENT:
1162 case VIRTCHNL_OP_UNKNOWN:
1164 return VIRTCHNL_STATUS_ERR_PARAM;
1166 /* few more checks */
1167 if (err_msg_format || valid_len != msglen)
1168 return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH;
1172 #endif /* _VIRTCHNL_H_ */