1251876Speter/* SPDX-License-Identifier: BSD-3-Clause */
2251876Speter/*  Copyright (c) 2021, Intel Corporation
3251876Speter *  All rights reserved.
4251876Speter *
5251876Speter *  Redistribution and use in source and binary forms, with or without
6251876Speter *  modification, are permitted provided that the following conditions are met:
7251876Speter *
8251876Speter *   1. Redistributions of source code must retain the above copyright notice,
9251876Speter *      this list of conditions and the following disclaimer.
10251876Speter *
11251876Speter *   2. Redistributions in binary form must reproduce the above copyright
12251876Speter *      notice, this list of conditions and the following disclaimer in the
13251876Speter *      documentation and/or other materials provided with the distribution.
14251876Speter *
15251876Speter *   3. Neither the name of the Intel Corporation nor the names of its
16251876Speter *      contributors may be used to endorse or promote products derived from
17251876Speter *      this software without specific prior written permission.
18251876Speter *
19251876Speter *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20251876Speter *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21251876Speter *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22251876Speter *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23251876Speter *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24251876Speter *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25251876Speter *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26251876Speter *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27251876Speter *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28251876Speter *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29251876Speter *  POSSIBILITY OF SUCH DAMAGE.
30251876Speter */
31251876Speter
32251876Speter#ifndef _VIRTCHNL_H_
33251876Speter#define _VIRTCHNL_H_
34251876Speter
35251876Speter/* Description:
36251876Speter * This header file describes the VF-PF communication protocol used
37251876Speter * by the drivers for all devices starting from our 40G product line
38251876Speter *
39251876Speter * Admin queue buffer usage:
40251876Speter * desc->opcode is always aqc_opc_send_msg_to_pf
41251876Speter * flags, retval, datalen, and data addr are all used normally.
42251876Speter * The Firmware copies the cookie fields when sending messages between the
43251876Speter * PF and VF, but uses all other fields internally. Due to this limitation,
44251876Speter * we must send all messages as "indirect", i.e. using an external buffer.
45251876Speter *
46251876Speter * All the VSI indexes are relative to the VF. Each VF can have maximum of
47251876Speter * three VSIs. All the queue indexes are relative to the VSI.  Each VF can
48251876Speter * have a maximum of sixteen queues for all of its VSIs.
49251876Speter *
50251876Speter * The PF is required to return a status code in v_retval for all messages
51251876Speter * except RESET_VF, which does not require any response. The return value
52251876Speter * is of status_code type, defined in the shared type.h.
53251876Speter *
54251876Speter * In general, VF driver initialization should roughly follow the order of
55251876Speter * these opcodes. The VF driver must first validate the API version of the
56251876Speter * PF driver, then request a reset, then get resources, then configure
57251876Speter * queues and interrupts. After these operations are complete, the VF
58251876Speter * driver may start its queues, optionally add MAC and VLAN filters, and
59251876Speter * process traffic.
60251876Speter */
61251876Speter
62251876Speter/* START GENERIC DEFINES
63251876Speter * Need to ensure the following enums and defines hold the same meaning and
64251876Speter * value in current and future projects
65251876Speter */
66251876Speter
67251876Speter/* Error Codes */
68251876Speterenum virtchnl_status_code {
69251876Speter	VIRTCHNL_STATUS_SUCCESS				= 0,
70251876Speter	VIRTCHNL_STATUS_ERR_PARAM			= -5,
71251876Speter	VIRTCHNL_STATUS_ERR_NO_MEMORY			= -18,
72251876Speter	VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH		= -38,
73251876Speter	VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR		= -39,
74251876Speter	VIRTCHNL_STATUS_ERR_INVALID_VF_ID		= -40,
75251876Speter	VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR		= -53,
76251876Speter	VIRTCHNL_STATUS_ERR_NOT_SUPPORTED		= -64,
77251876Speter};
78251876Speter
79251876Speter/* Backward compatibility */
80251876Speter#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
81251876Speter#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
82251876Speter
83251876Speter#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT		0x0
84251876Speter#define VIRTCHNL_LINK_SPEED_100MB_SHIFT		0x1
85251876Speter#define VIRTCHNL_LINK_SPEED_1000MB_SHIFT	0x2
86251876Speter#define VIRTCHNL_LINK_SPEED_10GB_SHIFT		0x3
87251876Speter#define VIRTCHNL_LINK_SPEED_40GB_SHIFT		0x4
88251876Speter#define VIRTCHNL_LINK_SPEED_20GB_SHIFT		0x5
89251876Speter#define VIRTCHNL_LINK_SPEED_25GB_SHIFT		0x6
90251876Speter#define VIRTCHNL_LINK_SPEED_5GB_SHIFT		0x7
91251876Speter
92251876Speterenum virtchnl_link_speed {
93251876Speter	VIRTCHNL_LINK_SPEED_UNKNOWN	= 0,
94251876Speter	VIRTCHNL_LINK_SPEED_100MB	= BIT(VIRTCHNL_LINK_SPEED_100MB_SHIFT),
95251876Speter	VIRTCHNL_LINK_SPEED_1GB		= BIT(VIRTCHNL_LINK_SPEED_1000MB_SHIFT),
96251876Speter	VIRTCHNL_LINK_SPEED_10GB	= BIT(VIRTCHNL_LINK_SPEED_10GB_SHIFT),
97251876Speter	VIRTCHNL_LINK_SPEED_40GB	= BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
98251876Speter	VIRTCHNL_LINK_SPEED_20GB	= BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
99251876Speter	VIRTCHNL_LINK_SPEED_25GB	= BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
100251876Speter	VIRTCHNL_LINK_SPEED_2_5GB	= BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
101251876Speter	VIRTCHNL_LINK_SPEED_5GB		= BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
102251876Speter};
103251876Speter
104251876Speter/* for hsplit_0 field of Rx HMC context */
105251876Speter/* deprecated with AVF 1.0 */
106251876Speterenum virtchnl_rx_hsplit {
107251876Speter	VIRTCHNL_RX_HSPLIT_NO_SPLIT      = 0,
108251876Speter	VIRTCHNL_RX_HSPLIT_SPLIT_L2      = 1,
109251876Speter	VIRTCHNL_RX_HSPLIT_SPLIT_IP      = 2,
110251876Speter	VIRTCHNL_RX_HSPLIT_SPLIT_TCP_UDP = 4,
111251876Speter	VIRTCHNL_RX_HSPLIT_SPLIT_SCTP    = 8,
112251876Speter};
113251876Speter
114251876Speter#define VIRTCHNL_ETH_LENGTH_OF_ADDRESS	6
115251876Speter/* END GENERIC DEFINES */
116251876Speter
117251876Speter/* Opcodes for VF-PF communication. These are placed in the v_opcode field
118251876Speter * of the virtchnl_msg structure.
119251876Speter */
120251876Speterenum virtchnl_ops {
121251876Speter/* The PF sends status change events to VFs using
122251876Speter * the VIRTCHNL_OP_EVENT opcode.
123251876Speter * VFs send requests to the PF using the other ops.
124251876Speter * Use of "advanced opcode" features must be negotiated as part of capabilities
125251876Speter * exchange and are not considered part of base mode feature set.
126251876Speter */
127251876Speter	VIRTCHNL_OP_UNKNOWN = 0,
128251876Speter	VIRTCHNL_OP_VERSION = 1, /* must ALWAYS be 1 */
129251876Speter	VIRTCHNL_OP_RESET_VF = 2,
130251876Speter	VIRTCHNL_OP_GET_VF_RESOURCES = 3,
131251876Speter	VIRTCHNL_OP_CONFIG_TX_QUEUE = 4,
132251876Speter	VIRTCHNL_OP_CONFIG_RX_QUEUE = 5,
133251876Speter	VIRTCHNL_OP_CONFIG_VSI_QUEUES = 6,
134251876Speter	VIRTCHNL_OP_CONFIG_IRQ_MAP = 7,
135251876Speter	VIRTCHNL_OP_ENABLE_QUEUES = 8,
136251876Speter	VIRTCHNL_OP_DISABLE_QUEUES = 9,
137251876Speter	VIRTCHNL_OP_ADD_ETH_ADDR = 10,
138251876Speter	VIRTCHNL_OP_DEL_ETH_ADDR = 11,
139251876Speter	VIRTCHNL_OP_ADD_VLAN = 12,
140251876Speter	VIRTCHNL_OP_DEL_VLAN = 13,
141251876Speter	VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
142251876Speter	VIRTCHNL_OP_GET_STATS = 15,
143251876Speter	VIRTCHNL_OP_RSVD = 16,
144251876Speter	VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
145251876Speter	/* opcode 19 is reserved */
146251876Speter	VIRTCHNL_OP_IWARP = 20, /* advanced opcode */
147251876Speter	VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21, /* advanced opcode */
148251876Speter	VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22, /* advanced opcode */
149251876Speter	VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
150251876Speter	VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
151251876Speter	VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
152251876Speter	VIRTCHNL_OP_SET_RSS_HENA = 26,
153251876Speter	VIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,
154251876Speter	VIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28,
155251876Speter	VIRTCHNL_OP_REQUEST_QUEUES = 29,
156251876Speter	VIRTCHNL_OP_ENABLE_CHANNELS = 30,
157251876Speter	VIRTCHNL_OP_DISABLE_CHANNELS = 31,
158251876Speter	VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
159251876Speter	VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
160251876Speter	/* opcode 34 is reserved */
161251876Speter	/* opcodes 39, 40, 41, 42 and 43 are reserved */
162251876Speter	/* opcode 44, 45, 46, 47, 48 and 49 are reserved */
163251876Speter
164251876Speter};
165251876Speter
166251876Speter/* These macros are used to generate compilation errors if a structure/union
167251876Speter * is not exactly the correct length. It gives a divide by zero error if the
168251876Speter * structure/union is not of the correct size, otherwise it creates an enum
169251876Speter * that is never used.
170251876Speter */
171251876Speter#define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
172251876Speter	{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
173251876Speter#define VIRTCHNL_CHECK_UNION_LEN(n, X) enum virtchnl_static_asset_enum_##X \
174251876Speter	{ virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }
175251876Speter
176251876Speter/* Virtual channel message descriptor. This overlays the admin queue
177251876Speter * descriptor. All other data is passed in external buffers.
178251876Speter */
179251876Speter
180251876Speterstruct virtchnl_msg {
181251876Speter	u8 pad[8];			 /* AQ flags/opcode/len/retval fields */
182251876Speter	enum virtchnl_ops v_opcode; /* avoid confusion with desc->opcode */
183251876Speter	enum virtchnl_status_code v_retval;  /* ditto for desc->retval */
184251876Speter	u32 vfid;			 /* used by PF when sending to VF */
185251876Speter};
186251876Speter
187251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);
188251876Speter
189251876Speter/* Message descriptions and data structures. */
190251876Speter
191251876Speter/* VIRTCHNL_OP_VERSION
192251876Speter * VF posts its version number to the PF. PF responds with its version number
193251876Speter * in the same format, along with a return code.
194251876Speter * Reply from PF has its major/minor versions also in param0 and param1.
195251876Speter * If there is a major version mismatch, then the VF cannot operate.
196251876Speter * If there is a minor version mismatch, then the VF can operate but should
197251876Speter * add a warning to the system log.
198251876Speter *
199251876Speter * This enum element MUST always be specified as == 1, regardless of other
200251876Speter * changes in the API. The PF must always respond to this message without
201251876Speter * error regardless of version mismatch.
202251876Speter */
203251876Speter#define VIRTCHNL_VERSION_MAJOR		1
204251876Speter#define VIRTCHNL_VERSION_MINOR		1
205251876Speter#define VIRTCHNL_VERSION_MINOR_NO_VF_CAPS	0
206251876Speter
207251876Speterstruct virtchnl_version_info {
208251876Speter	u32 major;
209251876Speter	u32 minor;
210251876Speter};
211251876Speter
212251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_version_info);
213251876Speter
214251876Speter#define VF_IS_V10(_v) (((_v)->major == 1) && ((_v)->minor == 0))
215251876Speter#define VF_IS_V11(_ver) (((_ver)->major == 1) && ((_ver)->minor == 1))
216251876Speter
217251876Speter/* VIRTCHNL_OP_RESET_VF
218251876Speter * VF sends this request to PF with no parameters
219251876Speter * PF does NOT respond! VF driver must delay then poll VFGEN_RSTAT register
220251876Speter * until reset completion is indicated. The admin queue must be reinitialized
221251876Speter * after this operation.
222251876Speter *
223251876Speter * When reset is complete, PF must ensure that all queues in all VSIs associated
224251876Speter * with the VF are stopped, all queue configurations in the HMC are set to 0,
225251876Speter * and all MAC and VLAN filters (except the default MAC address) on all VSIs
226251876Speter * are cleared.
227251876Speter */
228251876Speter
229251876Speter/* VSI types that use VIRTCHNL interface for VF-PF communication. VSI_SRIOV
230251876Speter * vsi_type should always be 6 for backward compatibility. Add other fields
231251876Speter * as needed.
232251876Speter */
233251876Speterenum virtchnl_vsi_type {
234251876Speter	VIRTCHNL_VSI_TYPE_INVALID = 0,
235251876Speter	VIRTCHNL_VSI_SRIOV = 6,
236251876Speter};
237251876Speter
238251876Speter/* VIRTCHNL_OP_GET_VF_RESOURCES
239251876Speter * Version 1.0 VF sends this request to PF with no parameters
240251876Speter * Version 1.1 VF sends this request to PF with u32 bitmap of its capabilities
241251876Speter * PF responds with an indirect message containing
242251876Speter * virtchnl_vf_resource and one or more
243251876Speter * virtchnl_vsi_resource structures.
244251876Speter */
245251876Speter
246251876Speterstruct virtchnl_vsi_resource {
247251876Speter	u16 vsi_id;
248251876Speter	u16 num_queue_pairs;
249251876Speter	enum virtchnl_vsi_type vsi_type;
250251876Speter	u16 qset_handle;
251251876Speter	u8 default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
252251876Speter};
253251876Speter
254251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
255251876Speter
256251876Speter/* VF capability flags
257251876Speter * VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including
258251876Speter * TX/RX Checksum offloading and TSO for non-tunnelled packets.
259251876Speter */
260251876Speter#define VIRTCHNL_VF_OFFLOAD_L2			0x00000001
261251876Speter#define VIRTCHNL_VF_OFFLOAD_IWARP		0x00000002
262251876Speter#define VIRTCHNL_VF_OFFLOAD_RSVD		0x00000004
263251876Speter#define VIRTCHNL_VF_OFFLOAD_RSS_AQ		0x00000008
264251876Speter#define VIRTCHNL_VF_OFFLOAD_RSS_REG		0x00000010
265251876Speter#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR		0x00000020
266251876Speter#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES		0x00000040
267251876Speter#define VIRTCHNL_VF_OFFLOAD_CRC			0x00000080
268251876Speter#define VIRTCHNL_VF_OFFLOAD_VLAN		0x00010000
269251876Speter#define VIRTCHNL_VF_OFFLOAD_RX_POLLING		0x00020000
270251876Speter#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
271251876Speter#define VIRTCHNL_VF_OFFLOAD_RSS_PF		0X00080000
272251876Speter#define VIRTCHNL_VF_OFFLOAD_ENCAP		0X00100000
273251876Speter#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM		0X00200000
274251876Speter#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM	0X00400000
275251876Speter#define VIRTCHNL_VF_OFFLOAD_ADQ			0X00800000
276251876Speter#define VIRTCHNL_VF_OFFLOAD_ADQ_V2		0X01000000
277251876Speter#define VIRTCHNL_VF_OFFLOAD_USO			0X02000000
278251876Speter	/* 0X40000000 is reserved */
279251876Speter	/* 0X04000000, 0X08000000 and 0X10000000 are reserved */
280251876Speter	/* 0X80000000 is reserved */
281251876Speter
282251876Speter/* Define below the capability flags that are not offloads */
283251876Speter#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED		0x00000080
284251876Speter#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
285251876Speter			       VIRTCHNL_VF_OFFLOAD_VLAN | \
286251876Speter			       VIRTCHNL_VF_OFFLOAD_RSS_PF)
287251876Speter
288251876Speterstruct virtchnl_vf_resource {
289251876Speter	u16 num_vsis;
290251876Speter	u16 num_queue_pairs;
291251876Speter	u16 max_vectors;
292251876Speter	u16 max_mtu;
293251876Speter
294251876Speter	u32 vf_cap_flags;
295251876Speter	u32 rss_key_size;
296251876Speter	u32 rss_lut_size;
297251876Speter
298251876Speter	struct virtchnl_vsi_resource vsi_res[1];
299251876Speter};
300251876Speter
301251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_vf_resource);
302251876Speter
303251876Speter/* VIRTCHNL_OP_CONFIG_TX_QUEUE
304251876Speter * VF sends this message to set up parameters for one TX queue.
305251876Speter * External data buffer contains one instance of virtchnl_txq_info.
306251876Speter * PF configures requested queue and returns a status code.
307251876Speter */
308251876Speter
309251876Speter/* Tx queue config info */
310251876Speterstruct virtchnl_txq_info {
311251876Speter	u16 vsi_id;
312251876Speter	u16 queue_id;
313251876Speter	u16 ring_len;		/* number of descriptors, multiple of 8 */
314251876Speter	u16 headwb_enabled; /* deprecated with AVF 1.0 */
315251876Speter	u64 dma_ring_addr;
316251876Speter	u64 dma_headwb_addr; /* deprecated with AVF 1.0 */
317251876Speter};
318251876Speter
319251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
320251876Speter
321251876Speter/* VIRTCHNL_OP_CONFIG_RX_QUEUE
322251876Speter * VF sends this message to set up parameters for one RX queue.
323251876Speter * External data buffer contains one instance of virtchnl_rxq_info.
324251876Speter * PF configures requested queue and returns a status code. The
325251876Speter * crc_disable flag disables CRC stripping on the VF. Setting
326251876Speter * the crc_disable flag to 1 will disable CRC stripping for each
327251876Speter * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC
328251876Speter * offload must have been set prior to sending this info or the PF
329251876Speter * will ignore the request. This flag should be set the same for
330251876Speter * all of the queues for a VF.
331251876Speter */
332251876Speter
333251876Speter/* Rx queue config info */
334251876Speterstruct virtchnl_rxq_info {
335251876Speter	u16 vsi_id;
336251876Speter	u16 queue_id;
337251876Speter	u32 ring_len;		/* number of descriptors, multiple of 32 */
338251876Speter	u16 hdr_size;
339251876Speter	u16 splithdr_enabled; /* deprecated with AVF 1.0 */
340251876Speter	u32 databuffer_size;
341251876Speter	u32 max_pkt_size;
342251876Speter	u8 crc_disable;
343251876Speter	u8 pad1[3];
344251876Speter	u64 dma_ring_addr;
345251876Speter	enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
346251876Speter	u32 pad2;
347251876Speter};
348251876Speter
349251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);
350251876Speter
351251876Speter/* VIRTCHNL_OP_CONFIG_VSI_QUEUES
352251876Speter * VF sends this message to set parameters for active TX and RX queues
353251876Speter * associated with the specified VSI.
354251876Speter * PF configures queues and returns status.
355251876Speter * If the number of queues specified is greater than the number of queues
356251876Speter * associated with the VSI, an error is returned and no queues are configured.
357251876Speter * NOTE: The VF is not required to configure all queues in a single request.
358251876Speter * It may send multiple messages. PF drivers must correctly handle all VF
359251876Speter * requests.
360251876Speter */
361251876Speterstruct virtchnl_queue_pair_info {
362251876Speter	/* NOTE: vsi_id and queue_id should be identical for both queues. */
363251876Speter	struct virtchnl_txq_info txq;
364251876Speter	struct virtchnl_rxq_info rxq;
365251876Speter};
366251876Speter
367251876SpeterVIRTCHNL_CHECK_STRUCT_LEN(64, virtchnl_queue_pair_info);
368251876Speter
369struct virtchnl_vsi_queue_config_info {
370	u16 vsi_id;
371	u16 num_queue_pairs;
372	u32 pad;
373	struct virtchnl_queue_pair_info qpair[1];
374};
375
376VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);
377
378/* VIRTCHNL_OP_REQUEST_QUEUES
379 * VF sends this message to request the PF to allocate additional queues to
380 * this VF.  Each VF gets a guaranteed number of queues on init but asking for
381 * additional queues must be negotiated.  This is a best effort request as it
382 * is possible the PF does not have enough queues left to support the request.
383 * If the PF cannot support the number requested it will respond with the
384 * maximum number it is able to support.  If the request is successful, PF will
385 * then reset the VF to institute required changes.
386 */
387
388/* VF resource request */
389struct virtchnl_vf_res_request {
390	u16 num_queue_pairs;
391};
392
393/* VIRTCHNL_OP_CONFIG_IRQ_MAP
394 * VF uses this message to map vectors to queues.
395 * The rxq_map and txq_map fields are bitmaps used to indicate which queues
396 * are to be associated with the specified vector.
397 * The "other" causes are always mapped to vector 0. The VF may not request
398 * that vector 0 be used for traffic.
399 * PF configures interrupt mapping and returns status.
400 * NOTE: due to hardware requirements, all active queues (both TX and RX)
401 * should be mapped to interrupts, even if the driver intends to operate
402 * only in polling mode. In this case the interrupt may be disabled, but
403 * the ITR timer will still run to trigger writebacks.
404 */
405struct virtchnl_vector_map {
406	u16 vsi_id;
407	u16 vector_id;
408	u16 rxq_map;
409	u16 txq_map;
410	u16 rxitr_idx;
411	u16 txitr_idx;
412};
413
414VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_vector_map);
415
416struct virtchnl_irq_map_info {
417	u16 num_vectors;
418	struct virtchnl_vector_map vecmap[1];
419};
420
421VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);
422
423/* VIRTCHNL_OP_ENABLE_QUEUES
424 * VIRTCHNL_OP_DISABLE_QUEUES
425 * VF sends these message to enable or disable TX/RX queue pairs.
426 * The queues fields are bitmaps indicating which queues to act upon.
427 * (Currently, we only support 16 queues per VF, but we make the field
428 * u32 to allow for expansion.)
429 * PF performs requested action and returns status.
430 * NOTE: The VF is not required to enable/disable all queues in a single
431 * request. It may send multiple messages.
432 * PF drivers must correctly handle all VF requests.
433 */
434struct virtchnl_queue_select {
435	u16 vsi_id;
436	u16 pad;
437	u32 rx_queues;
438	u32 tx_queues;
439};
440
441VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_select);
442
443/* VIRTCHNL_OP_ADD_ETH_ADDR
444 * VF sends this message in order to add one or more unicast or multicast
445 * address filters for the specified VSI.
446 * PF adds the filters and returns status.
447 */
448
449/* VIRTCHNL_OP_DEL_ETH_ADDR
450 * VF sends this message in order to remove one or more unicast or multicast
451 * filters for the specified VSI.
452 * PF removes the filters and returns status.
453 */
454
455struct virtchnl_ether_addr {
456	u8 addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
457	u8 pad[2];
458};
459
460VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_ether_addr);
461
462struct virtchnl_ether_addr_list {
463	u16 vsi_id;
464	u16 num_elements;
465	struct virtchnl_ether_addr list[1];
466};
467
468VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_ether_addr_list);
469
470/* VIRTCHNL_OP_ADD_VLAN
471 * VF sends this message to add one or more VLAN tag filters for receives.
472 * PF adds the filters and returns status.
473 * If a port VLAN is configured by the PF, this operation will return an
474 * error to the VF.
475 */
476
477/* VIRTCHNL_OP_DEL_VLAN
478 * VF sends this message to remove one or more VLAN tag filters for receives.
479 * PF removes the filters and returns status.
480 * If a port VLAN is configured by the PF, this operation will return an
481 * error to the VF.
482 */
483
484struct virtchnl_vlan_filter_list {
485	u16 vsi_id;
486	u16 num_elements;
487	u16 vlan_id[1];
488};
489
490VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vlan_filter_list);
491
492/* VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE
493 * VF sends VSI id and flags.
494 * PF returns status code in retval.
495 * Note: we assume that broadcast accept mode is always enabled.
496 */
497struct virtchnl_promisc_info {
498	u16 vsi_id;
499	u16 flags;
500};
501
502VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_promisc_info);
503
504#define FLAG_VF_UNICAST_PROMISC	0x00000001
505#define FLAG_VF_MULTICAST_PROMISC	0x00000002
506
507/* VIRTCHNL_OP_GET_STATS
508 * VF sends this message to request stats for the selected VSI. VF uses
509 * the virtchnl_queue_select struct to specify the VSI. The queue_id
510 * field is ignored by the PF.
511 *
512 * PF replies with struct virtchnl_eth_stats in an external buffer.
513 */
514
515struct virtchnl_eth_stats {
516	u64 rx_bytes;			/* received bytes */
517	u64 rx_unicast;			/* received unicast pkts */
518	u64 rx_multicast;		/* received multicast pkts */
519	u64 rx_broadcast;		/* received broadcast pkts */
520	u64 rx_discards;
521	u64 rx_unknown_protocol;
522	u64 tx_bytes;			/* transmitted bytes */
523	u64 tx_unicast;			/* transmitted unicast pkts */
524	u64 tx_multicast;		/* transmitted multicast pkts */
525	u64 tx_broadcast;		/* transmitted broadcast pkts */
526	u64 tx_discards;
527	u64 tx_errors;
528};
529
530/* VIRTCHNL_OP_CONFIG_RSS_KEY
531 * VIRTCHNL_OP_CONFIG_RSS_LUT
532 * VF sends these messages to configure RSS. Only supported if both PF
533 * and VF drivers set the VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
534 * configuration negotiation. If this is the case, then the RSS fields in
535 * the VF resource struct are valid.
536 * Both the key and LUT are initialized to 0 by the PF, meaning that
537 * RSS is effectively disabled until set up by the VF.
538 */
539struct virtchnl_rss_key {
540	u16 vsi_id;
541	u16 key_len;
542	u8 key[1];         /* RSS hash key, packed bytes */
543};
544
545VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key);
546
547struct virtchnl_rss_lut {
548	u16 vsi_id;
549	u16 lut_entries;
550	u8 lut[1];        /* RSS lookup table */
551};
552
553VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut);
554
555/* VIRTCHNL_OP_GET_RSS_HENA_CAPS
556 * VIRTCHNL_OP_SET_RSS_HENA
557 * VF sends these messages to get and set the hash filter enable bits for RSS.
558 * By default, the PF sets these to all possible traffic types that the
559 * hardware supports. The VF can query this value if it wants to change the
560 * traffic types that are hashed by the hardware.
561 */
562struct virtchnl_rss_hena {
563	u64 hena;
564};
565
566VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
567
568/* This is used by PF driver to enforce how many channels can be supported.
569 * When ADQ_V2 capability is negotiated, it will allow 16 channels otherwise
570 * PF driver will allow only max 4 channels
571 */
572#define VIRTCHNL_MAX_ADQ_CHANNELS 4
573#define VIRTCHNL_MAX_ADQ_V2_CHANNELS 16
574
575/* VIRTCHNL_OP_ENABLE_CHANNELS
576 * VIRTCHNL_OP_DISABLE_CHANNELS
577 * VF sends these messages to enable or disable channels based on
578 * the user specified queue count and queue offset for each traffic class.
579 * This struct encompasses all the information that the PF needs from
580 * VF to create a channel.
581 */
582struct virtchnl_channel_info {
583	u16 count; /* number of queues in a channel */
584	u16 offset; /* queues in a channel start from 'offset' */
585	u32 pad;
586	u64 max_tx_rate;
587};
588
589VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_channel_info);
590
591struct virtchnl_tc_info {
592	u32	num_tc;
593	u32	pad;
594	struct	virtchnl_channel_info list[1];
595};
596
597VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
598
599/* VIRTCHNL_ADD_CLOUD_FILTER
600 * VIRTCHNL_DEL_CLOUD_FILTER
601 * VF sends these messages to add or delete a cloud filter based on the
602 * user specified match and action filters. These structures encompass
603 * all the information that the PF needs from the VF to add/delete a
604 * cloud filter.
605 */
606
607struct virtchnl_l4_spec {
608	u8	src_mac[ETH_ALEN];
609	u8	dst_mac[ETH_ALEN];
610	/* vlan_prio is part of this 16 bit field even from OS perspective
611	 * vlan_id:12 is actual vlan_id, then vlanid:bit14..12 is vlan_prio
612	 * in future, when decided to offload vlan_prio, pass that information
613	 * as part of the "vlan_id" field, Bit14..12
614	 */
615	__be16	vlan_id;
616	__be16	pad; /* reserved for future use */
617	__be32	src_ip[4];
618	__be32	dst_ip[4];
619	__be16	src_port;
620	__be16	dst_port;
621};
622
623VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec);
624
625union virtchnl_flow_spec {
626	struct	virtchnl_l4_spec tcp_spec;
627	u8	buffer[128]; /* reserved for future use */
628};
629
630VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec);
631
632enum virtchnl_action {
633	/* action types */
634	VIRTCHNL_ACTION_DROP = 0,
635	VIRTCHNL_ACTION_TC_REDIRECT,
636	VIRTCHNL_ACTION_PASSTHRU,
637	VIRTCHNL_ACTION_QUEUE,
638	VIRTCHNL_ACTION_Q_REGION,
639	VIRTCHNL_ACTION_MARK,
640	VIRTCHNL_ACTION_COUNT,
641};
642
643enum virtchnl_flow_type {
644	/* flow types */
645	VIRTCHNL_TCP_V4_FLOW = 0,
646	VIRTCHNL_TCP_V6_FLOW,
647	VIRTCHNL_UDP_V4_FLOW,
648	VIRTCHNL_UDP_V6_FLOW,
649};
650
651struct virtchnl_filter {
652	union	virtchnl_flow_spec data;
653	union	virtchnl_flow_spec mask;
654	enum	virtchnl_flow_type flow_type;
655	enum	virtchnl_action action;
656	u32	action_meta;
657	u8	field_flags;
658};
659
660VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
661
662/* VIRTCHNL_OP_EVENT
663 * PF sends this message to inform the VF driver of events that may affect it.
664 * No direct response is expected from the VF, though it may generate other
665 * messages in response to this one.
666 */
667enum virtchnl_event_codes {
668	VIRTCHNL_EVENT_UNKNOWN = 0,
669	VIRTCHNL_EVENT_LINK_CHANGE,
670	VIRTCHNL_EVENT_RESET_IMPENDING,
671	VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
672};
673
674#define PF_EVENT_SEVERITY_INFO		0
675#define PF_EVENT_SEVERITY_ATTENTION	1
676#define PF_EVENT_SEVERITY_ACTION_REQUIRED	2
677#define PF_EVENT_SEVERITY_CERTAIN_DOOM	255
678
679struct virtchnl_pf_event {
680	enum virtchnl_event_codes event;
681	union {
682		/* If the PF driver does not support the new speed reporting
683		 * capabilities then use link_event else use link_event_adv to
684		 * get the speed and link information. The ability to understand
685		 * new speeds is indicated by setting the capability flag
686		 * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter
687		 * in virtchnl_vf_resource struct and can be used to determine
688		 * which link event struct to use below.
689		 */
690		struct {
691			enum virtchnl_link_speed link_speed;
692			u8 link_status;
693		} link_event;
694		struct {
695			/* link_speed provided in Mbps */
696			u32 link_speed;
697			u8 link_status;
698		} link_event_adv;
699	} event_data;
700
701	int severity;
702};
703
704VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
705
706/* VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP
707 * VF uses this message to request PF to map IWARP vectors to IWARP queues.
708 * The request for this originates from the VF IWARP driver through
709 * a client interface between VF LAN and VF IWARP driver.
710 * A vector could have an AEQ and CEQ attached to it although
711 * there is a single AEQ per VF IWARP instance in which case
712 * most vectors will have an INVALID_IDX for aeq and valid idx for ceq.
713 * There will never be a case where there will be multiple CEQs attached
714 * to a single vector.
715 * PF configures interrupt mapping and returns status.
716 */
717struct virtchnl_iwarp_qv_info {
718	u32 v_idx; /* msix_vector */
719	u16 ceq_idx;
720	u16 aeq_idx;
721	u8 itr_idx;
722};
723
724VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
725
726struct virtchnl_iwarp_qvlist_info {
727	u32 num_vectors;
728	struct virtchnl_iwarp_qv_info qv_info[1];
729};
730
731VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
732
733/* Since VF messages are limited by u16 size, precalculate the maximum possible
734 * values of nested elements in virtchnl structures that virtual channel can
735 * possibly handle in a single message.
736 */
737enum virtchnl_vector_limits {
738	VIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX	=
739		((u16)(~0) - sizeof(struct virtchnl_vsi_queue_config_info)) /
740		sizeof(struct virtchnl_queue_pair_info),
741
742	VIRTCHNL_OP_CONFIG_IRQ_MAP_MAX		=
743		((u16)(~0) - sizeof(struct virtchnl_irq_map_info)) /
744		sizeof(struct virtchnl_vector_map),
745
746	VIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX	=
747		((u16)(~0) - sizeof(struct virtchnl_ether_addr_list)) /
748		sizeof(struct virtchnl_ether_addr),
749
750	VIRTCHNL_OP_ADD_DEL_VLAN_MAX		=
751		((u16)(~0) - sizeof(struct virtchnl_vlan_filter_list)) /
752		sizeof(u16),
753
754	VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP_MAX	=
755		((u16)(~0) - sizeof(struct virtchnl_iwarp_qvlist_info)) /
756		sizeof(struct virtchnl_iwarp_qv_info),
757
758	VIRTCHNL_OP_ENABLE_CHANNELS_MAX		=
759		((u16)(~0) - sizeof(struct virtchnl_tc_info)) /
760		sizeof(struct virtchnl_channel_info),
761};
762
763/* VF reset states - these are written into the RSTAT register:
764 * VFGEN_RSTAT on the VF
765 * When the PF initiates a reset, it writes 0
766 * When the reset is complete, it writes 1
767 * When the PF detects that the VF has recovered, it writes 2
768 * VF checks this register periodically to determine if a reset has occurred,
769 * then polls it to know when the reset is complete.
770 * If either the PF or VF reads the register while the hardware
771 * is in a reset state, it will return DEADBEEF, which, when masked
772 * will result in 3.
773 */
774enum virtchnl_vfr_states {
775	VIRTCHNL_VFR_INPROGRESS = 0,
776	VIRTCHNL_VFR_COMPLETED,
777	VIRTCHNL_VFR_VFACTIVE,
778};
779
780/**
781 * virtchnl_vc_validate_vf_msg
782 * @ver: Virtchnl version info
783 * @v_opcode: Opcode for the message
784 * @msg: pointer to the msg buffer
785 * @msglen: msg length
786 *
787 * validate msg format against struct for each opcode
788 */
789static inline int
790virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
791			    u8 *msg, u16 msglen)
792{
793	bool err_msg_format = false;
794	u32 valid_len = 0;
795
796	/* Validate message length. */
797	switch (v_opcode) {
798	case VIRTCHNL_OP_VERSION:
799		valid_len = sizeof(struct virtchnl_version_info);
800		break;
801	case VIRTCHNL_OP_RESET_VF:
802		break;
803	case VIRTCHNL_OP_GET_VF_RESOURCES:
804		if (VF_IS_V11(ver))
805			valid_len = sizeof(u32);
806		break;
807	case VIRTCHNL_OP_CONFIG_TX_QUEUE:
808		valid_len = sizeof(struct virtchnl_txq_info);
809		break;
810	case VIRTCHNL_OP_CONFIG_RX_QUEUE:
811		valid_len = sizeof(struct virtchnl_rxq_info);
812		break;
813	case VIRTCHNL_OP_CONFIG_VSI_QUEUES:
814		valid_len = sizeof(struct virtchnl_vsi_queue_config_info);
815		if (msglen >= valid_len) {
816			struct virtchnl_vsi_queue_config_info *vqc =
817			    (struct virtchnl_vsi_queue_config_info *)msg;
818
819			if (vqc->num_queue_pairs == 0 || vqc->num_queue_pairs >
820			    VIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX) {
821				err_msg_format = true;
822				break;
823			}
824
825			valid_len += (vqc->num_queue_pairs *
826				      sizeof(struct
827					     virtchnl_queue_pair_info));
828		}
829		break;
830	case VIRTCHNL_OP_CONFIG_IRQ_MAP:
831		valid_len = sizeof(struct virtchnl_irq_map_info);
832		if (msglen >= valid_len) {
833			struct virtchnl_irq_map_info *vimi =
834			    (struct virtchnl_irq_map_info *)msg;
835
836			if (vimi->num_vectors == 0 || vimi->num_vectors >
837			    VIRTCHNL_OP_CONFIG_IRQ_MAP_MAX) {
838				err_msg_format = true;
839				break;
840			}
841
842			valid_len += (vimi->num_vectors *
843				      sizeof(struct virtchnl_vector_map));
844		}
845		break;
846	case VIRTCHNL_OP_ENABLE_QUEUES:
847	case VIRTCHNL_OP_DISABLE_QUEUES:
848		valid_len = sizeof(struct virtchnl_queue_select);
849		break;
850	case VIRTCHNL_OP_ADD_ETH_ADDR:
851	case VIRTCHNL_OP_DEL_ETH_ADDR:
852		valid_len = sizeof(struct virtchnl_ether_addr_list);
853		if (msglen >= valid_len) {
854			struct virtchnl_ether_addr_list *veal =
855			    (struct virtchnl_ether_addr_list *)msg;
856
857			if (veal->num_elements == 0 || veal->num_elements >
858			    VIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX) {
859				err_msg_format = true;
860				break;
861			}
862
863			valid_len += veal->num_elements *
864			    sizeof(struct virtchnl_ether_addr);
865		}
866		break;
867	case VIRTCHNL_OP_ADD_VLAN:
868	case VIRTCHNL_OP_DEL_VLAN:
869		valid_len = sizeof(struct virtchnl_vlan_filter_list);
870		if (msglen >= valid_len) {
871			struct virtchnl_vlan_filter_list *vfl =
872			    (struct virtchnl_vlan_filter_list *)msg;
873
874			if (vfl->num_elements == 0 || vfl->num_elements >
875			    VIRTCHNL_OP_ADD_DEL_VLAN_MAX) {
876				err_msg_format = true;
877				break;
878			}
879
880			valid_len += vfl->num_elements * sizeof(u16);
881		}
882		break;
883	case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
884		valid_len = sizeof(struct virtchnl_promisc_info);
885		break;
886	case VIRTCHNL_OP_GET_STATS:
887		valid_len = sizeof(struct virtchnl_queue_select);
888		break;
889	case VIRTCHNL_OP_IWARP:
890		/* These messages are opaque to us and will be validated in
891		 * the RDMA client code. We just need to check for nonzero
892		 * length. The firmware will enforce max length restrictions.
893		 */
894		if (msglen)
895			valid_len = msglen;
896		else
897			err_msg_format = true;
898		break;
899	case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP:
900		break;
901	case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:
902		valid_len = sizeof(struct virtchnl_iwarp_qvlist_info);
903		if (msglen >= valid_len) {
904			struct virtchnl_iwarp_qvlist_info *qv =
905				(struct virtchnl_iwarp_qvlist_info *)msg;
906
907			if (qv->num_vectors == 0 || qv->num_vectors >
908			    VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP_MAX) {
909				err_msg_format = true;
910				break;
911			}
912
913			valid_len += ((qv->num_vectors - 1) *
914				sizeof(struct virtchnl_iwarp_qv_info));
915		}
916		break;
917	case VIRTCHNL_OP_CONFIG_RSS_KEY:
918		valid_len = sizeof(struct virtchnl_rss_key);
919		if (msglen >= valid_len) {
920			struct virtchnl_rss_key *vrk =
921				(struct virtchnl_rss_key *)msg;
922
923			if (vrk->key_len == 0) {
924				/* zero length is allowed as input */
925				break;
926			}
927
928			valid_len += vrk->key_len - 1;
929		}
930		break;
931	case VIRTCHNL_OP_CONFIG_RSS_LUT:
932		valid_len = sizeof(struct virtchnl_rss_lut);
933		if (msglen >= valid_len) {
934			struct virtchnl_rss_lut *vrl =
935				(struct virtchnl_rss_lut *)msg;
936
937			if (vrl->lut_entries == 0) {
938				/* zero entries is allowed as input */
939				break;
940			}
941
942			valid_len += vrl->lut_entries - 1;
943		}
944		break;
945	case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
946		break;
947	case VIRTCHNL_OP_SET_RSS_HENA:
948		valid_len = sizeof(struct virtchnl_rss_hena);
949		break;
950	case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
951	case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
952		break;
953	case VIRTCHNL_OP_REQUEST_QUEUES:
954		valid_len = sizeof(struct virtchnl_vf_res_request);
955		break;
956	case VIRTCHNL_OP_ENABLE_CHANNELS:
957		valid_len = sizeof(struct virtchnl_tc_info);
958		if (msglen >= valid_len) {
959			struct virtchnl_tc_info *vti =
960				(struct virtchnl_tc_info *)msg;
961
962			if (vti->num_tc == 0 || vti->num_tc >
963			    VIRTCHNL_OP_ENABLE_CHANNELS_MAX) {
964				err_msg_format = true;
965				break;
966			}
967
968			valid_len += (vti->num_tc - 1) *
969				     sizeof(struct virtchnl_channel_info);
970		}
971		break;
972	case VIRTCHNL_OP_DISABLE_CHANNELS:
973		break;
974	case VIRTCHNL_OP_ADD_CLOUD_FILTER:
975	case VIRTCHNL_OP_DEL_CLOUD_FILTER:
976		valid_len = sizeof(struct virtchnl_filter);
977		break;
978	/* These are always errors coming from the VF. */
979	case VIRTCHNL_OP_EVENT:
980	case VIRTCHNL_OP_UNKNOWN:
981	default:
982		return VIRTCHNL_STATUS_ERR_PARAM;
983	}
984	/* few more checks */
985	if (err_msg_format || valid_len != msglen)
986		return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH;
987
988	return 0;
989}
990#endif /* _VIRTCHNL_H_ */
991