From: Paul Greenwalt <[email protected]>

Add the VF capability flag VIRTCHNL_VF_OFFLOAD_TXTIME to negotiate VF ETF
support between the PF and VF driver.

As the flag is beyond bit 31 of the legacy vf_cap_flags field, it is
negotiated through the extended capability message VIRTCHNL_OP_GET_VF_CAPS2
(struct virtchnl_vf_caps2), which is gated by the VIRTCHNL_VF_CAPS2 flag
in vf_cap_flags.

Signed-off-by: Paul Greenwalt <[email protected]>
Signed-off-by: Soumyadeep Hore <[email protected]>
---
 drivers/net/intel/iavf/base/virtchnl.h | 30 ++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/intel/iavf/base/virtchnl.h 
b/drivers/net/intel/iavf/base/virtchnl.h
index 513e4b5d52..f3f1965f00 100644
--- a/drivers/net/intel/iavf/base/virtchnl.h
+++ b/drivers/net/intel/iavf/base/virtchnl.h
@@ -195,6 +195,7 @@ enum virtchnl_ops {
        VIRTCHNL_OP_HQOS_ELEMS_DEL = 133,
        VIRTCHNL_OP_HQOS_ELEMS_MOVE = 134,
        VIRTCHNL_OP_HQOS_ELEMS_CONF = 135,
+       VIRTCHNL_OP_GET_VF_CAPS2 = 136,
        VIRTCHNL_OP_MAX,
 };
 
@@ -361,6 +362,8 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops 
v_opcode)
                return "VIRTCHNL_OP_HQOS_ELEMS_MOVE";
        case VIRTCHNL_OP_HQOS_ELEMS_CONF:
                return "VIRTCHNL_OP_HQOS_ELEMS_CONF";
+       case VIRTCHNL_OP_GET_VF_CAPS2:
+               return "VIRTCHNL_OP_GET_VF_CAPS2";
        case VIRTCHNL_OP_MAX:
                return "VIRTCHNL_OP_MAX";
        default:
@@ -471,6 +474,10 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_L2                 BIT(0)
 #define VIRTCHNL_VF_OFFLOAD_IWARP              BIT(1)
 #define VIRTCHNL_VF_OFFLOAD_RSVD               BIT(2)
+/* If set in vf_cap_flags, the VF and PF support the extended capability
+ * negotiation via VIRTCHNL_OP_GET_VF_CAPS2 (shares bit 2 with RSVD).
+ */
+#define VIRTCHNL_VF_CAPS2                      BIT(2)
 #define VIRTCHNL_VF_OFFLOAD_RSS_AQ             BIT(3)
 #define VIRTCHNL_VF_OFFLOAD_RSS_REG            BIT(4)
 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR          BIT(5)
@@ -501,6 +508,14 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_CAP_DCF                    BIT(30)
 #define VIRTCHNL_VF_CAP_PTP                    BIT(31)
 
+/* Extended VF capability flags negotiated via VIRTCHNL_OP_GET_VF_CAPS2.
+ * These are bit positions in the extended capability bitmap (which includes
+ * the original 32 bits at the same positions), not bits within the 32-bit
+ * vf_cap_flags field. Flags greater than 31 are only available via caps2.
+ */
+#define VIRTCHNL_VF_OFFLOAD_TXTIME             32
+#define VIRTCHNL_VF_CAPS_MAX                   33
+
 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
                               VIRTCHNL_VF_OFFLOAD_VLAN | \
                               VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -520,6 +535,21 @@ struct virtchnl_vf_resource {
 
 VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_vf_resource);
 
+/* VIRTCHNL_OP_GET_VF_CAPS2
+ * Generic extended capability flags. The VF sends this message to negotiate an
+ * extended set of capability flags if VIRTCHNL_VF_CAPS2 is set in
+ * virtchnl_vf_resource::vf_cap_flags. On send, the VF sets what capabilities 
it
+ * requests; on reply, the PF indicates what has been enabled for the VF. The
+ * bitmap includes the original 32 vf_cap_flags bits at the same positions, 
plus
+ * flags that do not fit there (e.g. VIRTCHNL_VF_OFFLOAD_TXTIME).
+ */
+struct virtchnl_vf_caps2 {
+       u32 flags_len;
+       u32 vf_cap_flags[];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_vf_caps2);
+
 /* VIRTCHNL_OP_CONFIG_TX_QUEUE
  * VF sends this message to set up parameters for one TX queue.
  * External data buffer contains one instance of virtchnl_txq_info.
-- 
2.43.0

Reply via email to