hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/avf/virtchnl.h
....@@ -1,22 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*******************************************************************************
23 *
34 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
45 * Copyright(c) 2013 - 2014 Intel Corporation.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms and conditions of the GNU General Public License,
8
- * version 2, as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
14
- *
15
- * 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/>.
17
- *
18
- * The full GNU General Public License is included in this distribution in
19
- * the file called "COPYING".
206 *
217 * Contact Information:
228 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
....@@ -62,19 +48,27 @@
6248 /* Error Codes */
6349 enum virtchnl_status_code {
6450 VIRTCHNL_STATUS_SUCCESS = 0,
65
- VIRTCHNL_ERR_PARAM = -5,
51
+ VIRTCHNL_STATUS_ERR_PARAM = -5,
52
+ VIRTCHNL_STATUS_ERR_NO_MEMORY = -18,
6653 VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
6754 VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
6855 VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
69
- VIRTCHNL_STATUS_NOT_SUPPORTED = -64,
56
+ VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53,
57
+ VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64,
7058 };
7159
60
+/* Backward compatibility */
61
+#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
62
+#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
63
+
64
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT 0x0
7265 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1
7366 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2
7467 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3
7568 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4
7669 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5
7770 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6
71
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7
7872
7973 enum virtchnl_link_speed {
8074 VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
....@@ -84,6 +78,8 @@
8478 VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
8579 VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
8680 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),
8783 };
8884
8985 /* for hsplit_0 field of Rx HMC context */
....@@ -165,7 +161,7 @@
165161
166162 VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);
167163
168
-/* Message descriptions and data structures.*/
164
+/* Message descriptions and data structures. */
169165
170166 /* VIRTCHNL_OP_VERSION
171167 * VF posts its version number to the PF. PF responds with its version number
....@@ -252,6 +248,8 @@
252248 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
253249 #define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000
254250
251
+/* Define below the capability flags that are not offloads */
252
+#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080
255253 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
256254 VIRTCHNL_VF_OFFLOAD_VLAN | \
257255 VIRTCHNL_VF_OFFLOAD_RSS_PF)
....@@ -334,6 +332,8 @@
334332 struct virtchnl_queue_pair_info qpair[1];
335333 };
336334
335
+VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);
336
+
337337 /* VIRTCHNL_OP_REQUEST_QUEUES
338338 * VF sends this message to request the PF to allocate additional queues to
339339 * this VF. Each VF gets a guaranteed number of queues on init but asking for
....@@ -348,8 +348,6 @@
348348 struct virtchnl_vf_res_request {
349349 u16 num_queue_pairs;
350350 };
351
-
352
-VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);
353351
354352 /* VIRTCHNL_OP_CONFIG_IRQ_MAP
355353 * VF uses this message to map vectors to queues.
....@@ -573,7 +571,8 @@
573571 enum virtchnl_flow_type flow_type;
574572 enum virtchnl_action action;
575573 u32 action_meta;
576
- __u8 field_flags;
574
+ u8 field_flags;
575
+ u8 pad[3];
577576 };
578577
579578 VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
....@@ -596,10 +595,24 @@
596595 struct virtchnl_pf_event {
597596 enum virtchnl_event_codes event;
598597 union {
598
+ /* If the PF driver does not support the new speed reporting
599
+ * capabilities then use link_event else use link_event_adv to
600
+ * get the speed and link information. The ability to understand
601
+ * new speeds is indicated by setting the capability flag
602
+ * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter
603
+ * in virtchnl_vf_resource struct and can be used to determine
604
+ * which link event struct to use below.
605
+ */
599606 struct {
600607 enum virtchnl_link_speed link_speed;
601608 bool link_status;
602609 } link_event;
610
+ struct {
611
+ /* link_speed provided in Mbps */
612
+ u32 link_speed;
613
+ u8 link_status;
614
+ u8 pad[3];
615
+ } link_event_adv;
603616 } event_data;
604617
605618 int severity;
....@@ -624,6 +637,7 @@
624637 u16 ceq_idx;
625638 u16 aeq_idx;
626639 u8 itr_idx;
640
+ u8 pad[3];
627641 };
628642
629643 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
....@@ -816,7 +830,7 @@
816830 case VIRTCHNL_OP_EVENT:
817831 case VIRTCHNL_OP_UNKNOWN:
818832 default:
819
- return VIRTCHNL_ERR_PARAM;
833
+ return VIRTCHNL_STATUS_ERR_PARAM;
820834 }
821835 /* few more checks */
822836 if (err_msg_format || valid_len != msglen)