crypto/cnxk: move IPsec SA creation to common
[dpdk.git] / drivers / common / iavf / virtchnl.h
index 3a60faf..f123dae 100644 (file)
@@ -38,6 +38,8 @@
  * value in current and future projects
  */
 
+#include "virtchnl_inline_ipsec.h"
+
 /* Error Codes */
 enum virtchnl_status_code {
        VIRTCHNL_STATUS_SUCCESS                         = 0,
@@ -85,6 +87,10 @@ enum virtchnl_rx_hsplit {
        VIRTCHNL_RX_HSPLIT_SPLIT_SCTP    = 8,
 };
 
+enum virtchnl_bw_limit_type {
+       VIRTCHNL_BW_SHAPER = 0,
+};
+
 #define VIRTCHNL_ETH_LENGTH_OF_ADDRESS 6
 /* END GENERIC DEFINES */
 
@@ -129,7 +135,9 @@ enum virtchnl_ops {
        VIRTCHNL_OP_DISABLE_CHANNELS = 31,
        VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
        VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
-       /* opcodes 34, 35, 36, and 37 are reserved */
+       VIRTCHNL_OP_INLINE_IPSEC_CRYPTO = 34,
+       /* opcodes 35 and 36 are reserved */
+       VIRTCHNL_OP_DCF_CONFIG_BW = 37,
        VIRTCHNL_OP_DCF_VLAN_OFFLOAD = 38,
        VIRTCHNL_OP_DCF_CMD_DESC = 39,
        VIRTCHNL_OP_DCF_CMD_BUFF = 40,
@@ -141,7 +149,6 @@ enum virtchnl_ops {
        VIRTCHNL_OP_DEL_RSS_CFG = 46,
        VIRTCHNL_OP_ADD_FDIR_FILTER = 47,
        VIRTCHNL_OP_DEL_FDIR_FILTER = 48,
-       VIRTCHNL_OP_QUERY_FDIR_FILTER = 49,
        VIRTCHNL_OP_GET_MAX_RSS_QREGION = 50,
        VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS = 51,
        VIRTCHNL_OP_ADD_VLAN_V2 = 52,
@@ -152,9 +159,15 @@ enum virtchnl_ops {
        VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2 = 57,
        VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2 = 58,
        VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2 = 59,
+       VIRTCHNL_OP_1588_PTP_GET_CAPS = 60,
+       VIRTCHNL_OP_1588_PTP_GET_TIME = 61,
+       VIRTCHNL_OP_GET_QOS_CAPS = 66,
+       VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP = 67,
        VIRTCHNL_OP_ENABLE_QUEUES_V2 = 107,
        VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108,
        VIRTCHNL_OP_MAP_QUEUE_VECTOR = 111,
+       VIRTCHNL_OP_CONFIG_QUEUE_BW = 112,
+       VIRTCHNL_OP_CONFIG_QUANTA = 113,
        VIRTCHNL_OP_MAX,
 };
 
@@ -219,10 +232,12 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode)
                return "VIRTCHNL_OP_ADD_CLOUD_FILTER";
        case VIRTCHNL_OP_DEL_CLOUD_FILTER:
                return "VIRTCHNL_OP_DEL_CLOUD_FILTER";
+       case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO:
+               return "VIRTCHNL_OP_INLINE_IPSEC_CRYPTO";
        case VIRTCHNL_OP_DCF_CMD_DESC:
                return "VIRTCHNL_OP_DCF_CMD_DESC";
        case VIRTCHNL_OP_DCF_CMD_BUFF:
-               return "VIRTCHHNL_OP_DCF_CMD_BUFF";
+               return "VIRTCHNL_OP_DCF_CMD_BUFF";
        case VIRTCHNL_OP_DCF_DISABLE:
                return "VIRTCHNL_OP_DCF_DISABLE";
        case VIRTCHNL_OP_DCF_GET_VSI_MAP:
@@ -237,8 +252,6 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode)
                return "VIRTCHNL_OP_ADD_FDIR_FILTER";
        case VIRTCHNL_OP_DEL_FDIR_FILTER:
                return "VIRTCHNL_OP_DEL_FDIR_FILTER";
-       case VIRTCHNL_OP_QUERY_FDIR_FILTER:
-               return "VIRTCHNL_OP_QUERY_FDIR_FILTER";
        case VIRTCHNL_OP_GET_MAX_RSS_QREGION:
                return "VIRTCHNL_OP_GET_MAX_RSS_QREGION";
        case VIRTCHNL_OP_ENABLE_QUEUES_V2:
@@ -265,6 +278,10 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode)
                return "VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2";
        case VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2:
                return "VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2";
+       case VIRTCHNL_OP_1588_PTP_GET_CAPS:
+               return "VIRTCHNL_OP_1588_PTP_GET_CAPS";
+       case VIRTCHNL_OP_1588_PTP_GET_TIME:
+               return "VIRTCHNL_OP_1588_PTP_GET_TIME";
        case VIRTCHNL_OP_MAX:
                return "VIRTCHNL_OP_MAX";
        default:
@@ -381,7 +398,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES         BIT(6)
 /* used to negotiate communicating link speeds in Mbps */
 #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED         BIT(7)
-       /* BIT(8) is reserved */
+#define VIRTCHNL_VF_OFFLOAD_INLINE_IPSEC_CRYPTO        BIT(8)
 #define VIRTCHNL_VF_LARGE_NUM_QPAIRS           BIT(9)
 #define VIRTCHNL_VF_OFFLOAD_CRC                        BIT(10)
 #define VIRTCHNL_VF_OFFLOAD_VLAN_V2            BIT(15)
@@ -398,8 +415,9 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
 #define VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC       BIT(26)
 #define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF         BIT(27)
 #define VIRTCHNL_VF_OFFLOAD_FDIR_PF            BIT(28)
+#define VIRTCHNL_VF_OFFLOAD_QOS                BIT(29)
 #define VIRTCHNL_VF_CAP_DCF                    BIT(30)
-       /* BIT(31) is reserved */
+#define VIRTCHNL_VF_CAP_PTP                    BIT(31)
 
 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
                               VIRTCHNL_VF_OFFLOAD_VLAN | \
@@ -486,6 +504,18 @@ enum virtchnl_rx_desc_id_bitmasks {
        /* 22 through 63 are reserved */
 };
 
+/* virtchnl_rxq_info_flags
+ *
+ * Definition of bits in the flags field of the virtchnl_rxq_info structure.
+ */
+enum virtchnl_rxq_info_flags {
+       /* If the VIRTCHNL_PTP_RX_TSTAMP bit of the flag field is set, this is
+        * a request to enable Rx timestamp. Other flag bits are currently
+        * reserved and they may be extended in the future.
+        */
+       VIRTCHNL_PTP_RX_TSTAMP = BIT(0),
+};
+
 /* 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.
@@ -514,7 +544,8 @@ struct virtchnl_rxq_info {
         * with VIRTCHNL_RXDID_1_32B_BASE.
         */
        u8 rxdid;
-       u8 pad1[2];
+       u8 flags; /* see virtchnl_rxq_info_flags */
+       u8 pad1;
        u64 dma_ring_addr;
 
        /* see enum virtchnl_rx_hsplit; deprecated with AVF 1.0 */
@@ -1285,6 +1316,14 @@ struct virtchnl_filter {
 
 VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
 
+struct virtchnl_shaper_bw {
+       /* Unit is Kbps */
+       u32 committed;
+       u32 peak;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_shaper_bw);
+
 /* VIRTCHNL_OP_DCF_GET_VSI_MAP
  * VF sends this message to get VSI mapping table.
  * PF responds with an indirect message containing VF's
@@ -1357,6 +1396,37 @@ struct virtchnl_dcf_vlan_offload {
 
 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_dcf_vlan_offload);
 
+struct virtchnl_dcf_bw_cfg {
+       u8 tc_num;
+#define VIRTCHNL_DCF_BW_CIR            BIT(0)
+#define VIRTCHNL_DCF_BW_PIR            BIT(1)
+       u8 bw_type;
+       u8 pad[2];
+       enum virtchnl_bw_limit_type type;
+       union {
+               struct virtchnl_shaper_bw shaper;
+               u8 pad2[32];
+       };
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_dcf_bw_cfg);
+
+/* VIRTCHNL_OP_DCF_CONFIG_BW
+ * VF send this message to set the bandwidth configuration of each
+ * TC with a specific vf id. The flag node_type is to indicate that
+ * this message is to configure VSI node or TC node bandwidth.
+ */
+struct virtchnl_dcf_bw_cfg_list {
+       u16 vf_id;
+       u8 num_elem;
+#define VIRTCHNL_DCF_TARGET_TC_BW      0
+#define VIRTCHNL_DCF_TARGET_VF_BW      1
+       u8 node_type;
+       struct virtchnl_dcf_bw_cfg cfg[1];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(44, virtchnl_dcf_bw_cfg_list);
+
 struct virtchnl_supported_rxdids {
        /* see enum virtchnl_rx_desc_id_bitmasks */
        u64 supported_rxdids;
@@ -1433,6 +1503,7 @@ enum virtchnl_vfr_states {
 };
 
 #define VIRTCHNL_MAX_NUM_PROTO_HDRS    32
+#define VIRTCHNL_MAX_SIZE_RAW_PACKET   1024
 #define PROTO_HDR_SHIFT                        5
 #define PROTO_HDR_FIELD_START(proto_hdr_type) \
                                        (proto_hdr_type << PROTO_HDR_SHIFT)
@@ -1504,6 +1575,7 @@ enum virtchnl_proto_hdr_type {
         */
        VIRTCHNL_PROTO_HDR_IPV4_FRAG,
        VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG,
+       VIRTCHNL_PROTO_HDR_GRE,
 };
 
 /* Protocol header field within a protocol header. */
@@ -1526,6 +1598,7 @@ enum virtchnl_proto_hdr_field {
        VIRTCHNL_PROTO_HDR_IPV4_DSCP,
        VIRTCHNL_PROTO_HDR_IPV4_TTL,
        VIRTCHNL_PROTO_HDR_IPV4_PROT,
+       VIRTCHNL_PROTO_HDR_IPV4_CHKSUM,
        /* IPV6 */
        VIRTCHNL_PROTO_HDR_IPV6_SRC =
                PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV6),
@@ -1550,14 +1623,17 @@ enum virtchnl_proto_hdr_field {
        VIRTCHNL_PROTO_HDR_TCP_SRC_PORT =
                PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_TCP),
        VIRTCHNL_PROTO_HDR_TCP_DST_PORT,
+       VIRTCHNL_PROTO_HDR_TCP_CHKSUM,
        /* UDP */
        VIRTCHNL_PROTO_HDR_UDP_SRC_PORT =
                PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_UDP),
        VIRTCHNL_PROTO_HDR_UDP_DST_PORT,
+       VIRTCHNL_PROTO_HDR_UDP_CHKSUM,
        /* SCTP */
        VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT =
                PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_SCTP),
        VIRTCHNL_PROTO_HDR_SCTP_DST_PORT,
+       VIRTCHNL_PROTO_HDR_SCTP_CHKSUM,
        /* GTPU_IP */
        VIRTCHNL_PROTO_HDR_GTPU_IP_TEID =
                PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_IP),
@@ -1594,6 +1670,15 @@ enum virtchnl_proto_hdr_field {
        /* IPv6 Extension Fragment */
        VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG_PKID =
                PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG),
+       /* GTPU_DWN/UP */
+       VIRTCHNL_PROTO_HDR_GTPU_DWN_QFI =
+               PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN),
+       VIRTCHNL_PROTO_HDR_GTPU_UP_QFI =
+               PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP),
+       /* L2TPv2 */
+       VIRTCHNL_PROTO_HDR_L2TPV2_SESS_ID =
+               PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_L2TPV2),
+       VIRTCHNL_PROTO_HDR_L2TPV2_LEN_SESS_ID,
 };
 
 struct virtchnl_proto_hdr {
@@ -1613,14 +1698,25 @@ VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr);
 struct virtchnl_proto_hdrs {
        u8 tunnel_level;
        /**
-        * specify where protocol header start from.
+        * specify where protocol header start from. must be 0 when sending a raw packet request.
         * 0 - from the outer layer
         * 1 - from the first inner layer
         * 2 - from the second inner layer
         * ....
-        **/
-       int count; /* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */
-       struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS];
+        */
+       int count;
+       /**
+        * number of proto layers, must < VIRTCHNL_MAX_NUM_PROTO_HDRS
+        * must be 0 for a raw packet request.
+        */
+       union {
+               struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS];
+               struct {
+                       u16 pkt_len;
+                       u8 spec[VIRTCHNL_MAX_SIZE_RAW_PACKET];
+                       u8 mask[VIRTCHNL_MAX_SIZE_RAW_PACKET];
+               } raw;
+       };
 };
 
 VIRTCHNL_CHECK_STRUCT_LEN(2312, virtchnl_proto_hdrs);
@@ -1677,20 +1773,6 @@ struct virtchnl_fdir_rule {
 
 VIRTCHNL_CHECK_STRUCT_LEN(2604, virtchnl_fdir_rule);
 
-/* query information to retrieve fdir rule counters.
- * PF will fill out this structure to reset counter.
- */
-struct virtchnl_fdir_query_info {
-       u32 match_packets_valid:1;
-       u32 match_bytes_valid:1;
-       u32 reserved:30;  /* Reserved, must be zero. */
-       u32 pad;
-       u64 matched_packets; /* Number of packets for this rule. */
-       u64 matched_bytes;   /* Number of bytes through this rule. */
-};
-
-VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_fdir_query_info);
-
 /* Status returned to VF after VF requests FDIR commands
  * VIRTCHNL_FDIR_SUCCESS
  * VF FDIR related request is successfully done by PF
@@ -1767,24 +1849,79 @@ struct virtchnl_fdir_del {
 
 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_fdir_del);
 
-/* VIRTCHNL_OP_QUERY_FDIR_FILTER
- * VF sends this request to PF by filling out vsi_id,
- * flow_id and reset_counter. PF will return query_info
- * and query_status to VF.
+/* VIRTCHNL_OP_GET_QOS_CAPS
+ * VF sends this message to get its QoS Caps, such as
+ * TC number, Arbiter and Bandwidth.
  */
-struct virtchnl_fdir_query {
-       u16 vsi_id;   /* INPUT */
-       u16 pad1[3];
-       u32 flow_id;  /* INPUT */
-       u32 reset_counter:1; /* INPUT */
-       struct virtchnl_fdir_query_info query_info; /* OUTPUT */
+struct virtchnl_qos_cap_elem {
+       u8 tc_num;
+       u8 tc_prio;
+#define VIRTCHNL_ABITER_STRICT      0
+#define VIRTCHNL_ABITER_ETS         2
+       u8 arbiter;
+#define VIRTCHNL_STRICT_WEIGHT      1
+       u8 weight;
+       enum virtchnl_bw_limit_type type;
+       union {
+               struct virtchnl_shaper_bw shaper;
+               u8 pad2[32];
+       };
+};
 
-       /* see enum virtchnl_fdir_prgm_status; OUTPUT */
-       s32 status;
-       u32 pad2;
+VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_qos_cap_elem);
+
+struct virtchnl_qos_cap_list {
+       u16 vsi_id;
+       u16 num_elem;
+       struct virtchnl_qos_cap_elem cap[1];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(44, virtchnl_qos_cap_list);
+
+/* VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP
+ * VF sends message virtchnl_queue_tc_mapping to set queue to tc
+ * mapping for all the Tx and Rx queues with a specified VSI, and
+ * would get response about bitmap of valid user priorities
+ * associated with queues.
+ */
+struct virtchnl_queue_tc_mapping {
+       u16 vsi_id;
+       u16 num_tc;
+       u16 num_queue_pairs;
+       u8 pad[2];
+       union {
+               struct {
+                       u16 start_queue_id;
+                       u16 queue_count;
+               } req;
+               struct {
+#define VIRTCHNL_USER_PRIO_TYPE_UP     0
+#define VIRTCHNL_USER_PRIO_TYPE_DSCP   1
+                       u16 prio_type;
+                       u16 valid_prio_bitmap;
+               } resp;
+       } tc[1];
 };
 
-VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_fdir_query);
+VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_tc_mapping);
+
+/* VIRTCHNL_OP_CONFIG_QUEUE_BW */
+struct virtchnl_queue_bw {
+       u16 queue_id;
+       u8 tc;
+       u8 pad;
+       struct virtchnl_shaper_bw shaper;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_bw);
+
+struct virtchnl_queues_bw_cfg {
+       u16 vsi_id;
+       u16 num_queues;
+       struct virtchnl_queue_bw cfg[1];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_queues_bw_cfg);
 
 /* TX and RX queue types are valid in legacy as well as split queue models.
  * With Split Queue model, 2 additional types are introduced - TX_COMPLETION
@@ -1891,6 +2028,45 @@ struct virtchnl_queue_vector_maps {
 
 VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_queue_vector_maps);
 
+struct virtchnl_quanta_cfg {
+       u16 quanta_size;
+       struct virtchnl_queue_chunk queue_select;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_quanta_cfg);
+
+#define VIRTCHNL_1588_PTP_CAP_RX_TSTAMP                BIT(1)
+#define VIRTCHNL_1588_PTP_CAP_READ_PHC         BIT(2)
+
+struct virtchnl_phc_regs {
+       u32 clock_hi;
+       u32 clock_lo;
+       u8 pcie_region;
+       u8 rsvd[15];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_phc_regs);
+
+struct virtchnl_ptp_caps {
+       struct virtchnl_phc_regs phc_regs;
+       u32 caps;
+       s32 max_adj;
+       u8 tx_tstamp_idx;
+       u8 n_ext_ts;
+       u8 n_per_out;
+       u8 n_pins;
+       u8 tx_tstamp_format;
+       u8 rsvd[11];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_ptp_caps);
+
+struct virtchnl_phc_time {
+       u64 time;
+       u8 rsvd[8];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_phc_time);
 
 /* Since VF messages are limited by u16 size, precalculate the maximum possible
  * values of nested elements in virtchnl structures that virtual channel can
@@ -2117,6 +2293,19 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
        case VIRTCHNL_OP_DCF_GET_VSI_MAP:
        case VIRTCHNL_OP_DCF_GET_PKG_INFO:
                break;
+       case VIRTCHNL_OP_DCF_CONFIG_BW:
+               valid_len = sizeof(struct virtchnl_dcf_bw_cfg_list);
+               if (msglen >= valid_len) {
+                       struct virtchnl_dcf_bw_cfg_list *cfg_list =
+                               (struct virtchnl_dcf_bw_cfg_list *)msg;
+                       if (cfg_list->num_elem == 0) {
+                               err_msg_format = true;
+                               break;
+                       }
+                       valid_len += (cfg_list->num_elem - 1) *
+                                        sizeof(struct virtchnl_dcf_bw_cfg);
+               }
+               break;
        case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
                break;
        case VIRTCHNL_OP_ADD_RSS_CFG:
@@ -2129,8 +2318,45 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
        case VIRTCHNL_OP_DEL_FDIR_FILTER:
                valid_len = sizeof(struct virtchnl_fdir_del);
                break;
-       case VIRTCHNL_OP_QUERY_FDIR_FILTER:
-               valid_len = sizeof(struct virtchnl_fdir_query);
+       case VIRTCHNL_OP_GET_QOS_CAPS:
+               break;
+       case VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP:
+               valid_len = sizeof(struct virtchnl_queue_tc_mapping);
+               if (msglen >= valid_len) {
+                       struct virtchnl_queue_tc_mapping *q_tc =
+                               (struct virtchnl_queue_tc_mapping *)msg;
+                       if (q_tc->num_tc == 0) {
+                               err_msg_format = true;
+                               break;
+                       }
+                       valid_len += (q_tc->num_tc - 1) *
+                                        sizeof(q_tc->tc[0]);
+               }
+               break;
+       case VIRTCHNL_OP_CONFIG_QUEUE_BW:
+               valid_len = sizeof(struct virtchnl_queues_bw_cfg);
+               if (msglen >= valid_len) {
+                       struct virtchnl_queues_bw_cfg *q_bw =
+                               (struct virtchnl_queues_bw_cfg *)msg;
+                       if (q_bw->num_queues == 0) {
+                               err_msg_format = true;
+                               break;
+                       }
+                       valid_len += (q_bw->num_queues - 1) *
+                                        sizeof(q_bw->cfg[0]);
+               }
+               break;
+       case VIRTCHNL_OP_CONFIG_QUANTA:
+               valid_len = sizeof(struct virtchnl_quanta_cfg);
+               if (msglen >= valid_len) {
+                       struct virtchnl_quanta_cfg *q_quanta =
+                               (struct virtchnl_quanta_cfg *)msg;
+                       if (q_quanta->quanta_size == 0 ||
+                           q_quanta->queue_select.num_queues == 0) {
+                               err_msg_format = true;
+                               break;
+                       }
+               }
                break;
        case VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS:
                break;
@@ -2159,6 +2385,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
        case VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2:
                valid_len = sizeof(struct virtchnl_vlan_setting);
                break;
+       case VIRTCHNL_OP_1588_PTP_GET_CAPS:
+               valid_len = sizeof(struct virtchnl_ptp_caps);
+               break;
+       case VIRTCHNL_OP_1588_PTP_GET_TIME:
+               valid_len = sizeof(struct virtchnl_phc_time);
+               break;
        case VIRTCHNL_OP_ENABLE_QUEUES_V2:
        case VIRTCHNL_OP_DISABLE_QUEUES_V2:
                valid_len = sizeof(struct virtchnl_del_ena_dis_queues);
@@ -2188,6 +2420,14 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
                                      sizeof(struct virtchnl_queue_vector);
                }
                break;
+
+       case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO:
+       {
+               struct inline_ipsec_msg *iim = (struct inline_ipsec_msg *)msg;
+               valid_len =
+                       virtchnl_inline_ipsec_val_msg_len(iim->ipsec_opcode);
+               break;
+       }
        /* These are always errors coming from the VF. */
        case VIRTCHNL_OP_EVENT:
        case VIRTCHNL_OP_UNKNOWN: