net/iavf: enable interrupt polling
[dpdk.git] / drivers / net / i40e / base / virtchnl.h
index c677d0e..648072f 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2018
+ * Copyright(c) 2001-2020 Intel Corporation
  */
 
 #ifndef _VIRTCHNL_H_
@@ -53,12 +53,14 @@ enum virtchnl_status_code {
 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
 
+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT                0x0
 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT                0x1
 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT       0x2
 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT         0x3
 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT         0x4
 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT         0x5
 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT         0x6
+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT          0x7
 
 enum virtchnl_link_speed {
        VIRTCHNL_LINK_SPEED_UNKNOWN     = 0,
@@ -68,6 +70,8 @@ enum virtchnl_link_speed {
        VIRTCHNL_LINK_SPEED_40GB        = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
        VIRTCHNL_LINK_SPEED_20GB        = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
        VIRTCHNL_LINK_SPEED_25GB        = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
+       VIRTCHNL_LINK_SPEED_2_5GB       = BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
+       VIRTCHNL_LINK_SPEED_5GB         = BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
 };
 
 /* for hsplit_0 field of Rx HMC context */
@@ -228,6 +232,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RSS_REG            0x00000010
 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR          0x00000020
 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES         0x00000040
+#define VIRTCHNL_VF_OFFLOAD_CRC                        0x00000080
 #define VIRTCHNL_VF_OFFLOAD_VLAN               0x00010000
 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING         0x00020000
 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2      0x00040000
@@ -235,7 +240,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_ENCAP              0X00100000
 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM         0X00200000
 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM      0X00400000
-
+/* Define below the capability flags that are not offloads */
+#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED         0x00000080
 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
                               VIRTCHNL_VF_OFFLOAD_VLAN | \
                               VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -276,7 +282,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
 /* VIRTCHNL_OP_CONFIG_RX_QUEUE
  * VF sends this message to set up parameters for one RX queue.
  * External data buffer contains one instance of virtchnl_rxq_info.
- * PF configures requested queue and returns a status code.
+ * PF configures requested queue and returns a status code. The
+ * crc_disable flag disables CRC stripping on the VF. Setting
+ * the crc_disable flag to 1 will disable CRC stripping for each
+ * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC
+ * offload must have been set prior to sending this info or the PF
+ * will ignore the request. This flag should be set the same for
+ * all of the queues for a VF.
  */
 
 /* Rx queue config info */
@@ -288,7 +300,8 @@ struct virtchnl_rxq_info {
        u16 splithdr_enabled; /* deprecated with AVF 1.0 */
        u32 databuffer_size;
        u32 max_pkt_size;
-       u32 pad1;
+       u8 crc_disable;
+       u8 pad1[3];
        u64 dma_ring_addr;
        enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
        u32 pad2;
@@ -389,9 +402,36 @@ VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_select);
  * PF removes the filters and returns status.
  */
 
+/* VIRTCHNL_ETHER_ADDR_LEGACY
+ * Prior to adding the @type member to virtchnl_ether_addr, there were 2 pad
+ * bytes. Moving forward all VF drivers should not set type to
+ * VIRTCHNL_ETHER_ADDR_LEGACY. This is only here to not break previous/legacy
+ * behavior. The control plane function (i.e. PF) can use a best effort method
+ * of tracking the primary/device unicast in this case, but there is no
+ * guarantee and functionality depends on the implementation of the PF.
+ */
+
+/* VIRTCHNL_ETHER_ADDR_PRIMARY
+ * All VF drivers should set @type to VIRTCHNL_ETHER_ADDR_PRIMARY for the
+ * primary/device unicast MAC address filter for VIRTCHNL_OP_ADD_ETH_ADDR and
+ * VIRTCHNL_OP_DEL_ETH_ADDR. This allows for the underlying control plane
+ * function (i.e. PF) to accurately track and use this MAC address for
+ * displaying on the host and for VM/function reset.
+ */
+
+/* VIRTCHNL_ETHER_ADDR_EXTRA
+ * All VF drivers should set @type to VIRTCHNL_ETHER_ADDR_EXTRA for any extra
+ * unicast and/or multicast filters that are being added/deleted via
+ * VIRTCHNL_OP_DEL_ETH_ADDR/VIRTCHNL_OP_ADD_ETH_ADDR respectively.
+ */
 struct virtchnl_ether_addr {
        u8 addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
-       u8 pad[2];
+       u8 type;
+#define VIRTCHNL_ETHER_ADDR_LEGACY     0
+#define VIRTCHNL_ETHER_ADDR_PRIMARY    1
+#define VIRTCHNL_ETHER_ADDR_EXTRA      2
+#define VIRTCHNL_ETHER_ADDR_TYPE_MASK  3 /* first two bits of type are valid */
+       u8 pad;
 };
 
 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_ether_addr);
@@ -524,10 +564,23 @@ enum virtchnl_event_codes {
 struct virtchnl_pf_event {
        enum virtchnl_event_codes event;
        union {
+               /* If the PF driver does not support the new speed reporting
+                * capabilities then use link_event else use link_event_adv to
+                * get the speed and link information. The ability to understand
+                * new speeds is indicated by setting the capability flag
+                * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter
+                * in virtchnl_vf_resource struct and can be used to determine
+                * which link event struct to use below.
+                */
                struct {
                        enum virtchnl_link_speed link_speed;
                        bool link_status;
                } link_event;
+               struct {
+                       /* link_speed provided in Mbps */
+                       u32 link_speed;
+                       u8 link_status;
+               } link_event_adv;
        } event_data;
 
        int severity;