get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/63530/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 63530,
    "url": "http://patches.dpdk.org/api/patches/63530/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191203070318.39620-9-qi.z.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20191203070318.39620-9-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191203070318.39620-9-qi.z.zhang@intel.com",
    "date": "2019-12-03T07:03:09",
    "name": "[08/17] net/iavf/base: update virtual channel",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "81a0121d81070c316f80ea64deb451d96e48064f",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 31221,
        "url": "http://patches.dpdk.org/api/users/31221/?format=api",
        "username": "yexl",
        "first_name": "xiaolong",
        "last_name": "ye",
        "email": "xiaolong.ye@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191203070318.39620-9-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 7716,
            "url": "http://patches.dpdk.org/api/series/7716/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7716",
            "date": "2019-12-03T07:03:01",
            "name": "iavf base code update",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/7716/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/63530/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/63530/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id AF7F6A04B5;\n\tTue,  3 Dec 2019 08:01:45 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 048681BF92;\n\tTue,  3 Dec 2019 08:00:34 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by dpdk.org (Postfix) with ESMTP id 7BD4D1BF83\n for <dev@dpdk.org>; Tue,  3 Dec 2019 08:00:28 +0100 (CET)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 02 Dec 2019 23:00:27 -0800",
            "from dpdk51.sh.intel.com ([10.67.110.245])\n by fmsmga005.fm.intel.com with ESMTP; 02 Dec 2019 23:00:26 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.69,272,1571727600\"; d=\"scan'208\";a=\"410729709\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "xiaolong.ye@intel.com",
        "Cc": "haiyue.wang@intel.com, dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,\n Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>",
        "Date": "Tue,  3 Dec 2019 15:03:09 +0800",
        "Message-Id": "<20191203070318.39620-9-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20191203070318.39620-1-qi.z.zhang@intel.com>",
        "References": "<20191203070318.39620-1-qi.z.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 08/17] net/iavf/base: update virtual channel",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Update virtual channel API to align with latest spec.\n\nSigned-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n drivers/net/iavf/base/virtchnl.h | 343 ++++++++++++++++++++++++++-------------\n 1 file changed, 232 insertions(+), 111 deletions(-)",
    "diff": "diff --git a/drivers/net/iavf/base/virtchnl.h b/drivers/net/iavf/base/virtchnl.h\nindex 50f7c8e49..1604f19e3 100644\n--- a/drivers/net/iavf/base/virtchnl.h\n+++ b/drivers/net/iavf/base/virtchnl.h\n@@ -40,19 +40,27 @@\n /* Error Codes */\n enum virtchnl_status_code {\n \tVIRTCHNL_STATUS_SUCCESS\t\t\t\t= 0,\n-\tVIRTCHNL_ERR_PARAM\t\t\t\t= -5,\n+\tVIRTCHNL_STATUS_ERR_PARAM\t\t\t= -5,\n+\tVIRTCHNL_STATUS_ERR_NO_MEMORY\t\t\t= -18,\n \tVIRTCHNL_STATUS_ERR_OPCODE_MISMATCH\t\t= -38,\n \tVIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR\t\t= -39,\n \tVIRTCHNL_STATUS_ERR_INVALID_VF_ID\t\t= -40,\n-\tVIRTCHNL_STATUS_NOT_SUPPORTED\t\t\t= -64,\n+\tVIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR\t\t= -53,\n+\tVIRTCHNL_STATUS_ERR_NOT_SUPPORTED\t\t= -64,\n };\n \n+/* Backward compatibility */\n+#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM\n+#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED\n+\n+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT\t\t0x0\n #define VIRTCHNL_LINK_SPEED_100MB_SHIFT\t\t0x1\n #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT\t0x2\n #define VIRTCHNL_LINK_SPEED_10GB_SHIFT\t\t0x3\n #define VIRTCHNL_LINK_SPEED_40GB_SHIFT\t\t0x4\n #define VIRTCHNL_LINK_SPEED_20GB_SHIFT\t\t0x5\n #define VIRTCHNL_LINK_SPEED_25GB_SHIFT\t\t0x6\n+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT\t\t0x7\n \n enum virtchnl_link_speed {\n \tVIRTCHNL_LINK_SPEED_UNKNOWN\t= 0,\n@@ -62,6 +70,8 @@ enum virtchnl_link_speed {\n \tVIRTCHNL_LINK_SPEED_40GB\t= BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),\n \tVIRTCHNL_LINK_SPEED_20GB\t= BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),\n \tVIRTCHNL_LINK_SPEED_25GB\t= BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),\n+\tVIRTCHNL_LINK_SPEED_2_5GB\t= BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),\n+\tVIRTCHNL_LINK_SPEED_5GB\t\t= BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),\n };\n \n /* for hsplit_0 field of Rx HMC context */\n@@ -105,14 +115,8 @@ enum virtchnl_ops {\n \tVIRTCHNL_OP_GET_STATS = 15,\n \tVIRTCHNL_OP_RSVD = 16,\n \tVIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */\n-#ifdef VIRTCHNL_SOL_VF_SUPPORT\n-\tVIRTCHNL_OP_GET_ADDNL_SOL_CONFIG = 19,\n-#endif\n-#ifdef VIRTCHNL_IWARP\n-\tVIRTCHNL_OP_IWARP = 20, /* advanced opcode */\n-\tVIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21, /* advanced opcode */\n-\tVIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22, /* advanced opcode */\n-#endif\n+\t/* opcode 19 is reserved */\n+\t/* opcodes 20, 21, and 22 are reserved */\n \tVIRTCHNL_OP_CONFIG_RSS_KEY = 23,\n \tVIRTCHNL_OP_CONFIG_RSS_LUT = 24,\n \tVIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,\n@@ -120,16 +124,22 @@ enum virtchnl_ops {\n \tVIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,\n \tVIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28,\n \tVIRTCHNL_OP_REQUEST_QUEUES = 29,\n-\n+\tVIRTCHNL_OP_ENABLE_CHANNELS = 30,\n+\tVIRTCHNL_OP_DISABLE_CHANNELS = 31,\n+\tVIRTCHNL_OP_ADD_CLOUD_FILTER = 32,\n+\tVIRTCHNL_OP_DEL_CLOUD_FILTER = 33,\n+\t/* opcodes 34, 35, 36, 37 and 38 are reserved */\n };\n \n-/* This macro is used to generate a compilation error if a structure\n+/* These macros are used to generate compilation errors if a structure/union\n  * is not exactly the correct length. It gives a divide by zero error if the\n- * structure is not of the correct size, otherwise it creates an enum that is\n- * never used.\n+ * structure/union is not of the correct size, otherwise it creates an enum\n+ * that is never used.\n  */\n #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \\\n-\t{virtchnl_static_assert_##X = (n) / ((sizeof(struct X) == (n)) ? 1 : 0)}\n+\t{ virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }\n+#define VIRTCHNL_CHECK_UNION_LEN(n, X) enum virtchnl_static_asset_enum_##X \\\n+\t{ virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }\n \n /* Virtual channel message descriptor. This overlays the admin queue\n  * descriptor. All other data is passed in external buffers.\n@@ -144,7 +154,7 @@ struct virtchnl_msg {\n \n VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);\n \n-/* Message descriptions and data structures.*/\n+/* Message descriptions and data structures. */\n \n /* VIRTCHNL_OP_VERSION\n  * VF posts its version number to the PF. PF responds with its version number\n@@ -222,6 +232,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);\n #define VIRTCHNL_VF_OFFLOAD_RSS_REG\t\t0x00000010\n #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR\t\t0x00000020\n #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES\t\t0x00000040\n+#define VIRTCHNL_VF_OFFLOAD_CRC\t\t\t0x00000080\n #define VIRTCHNL_VF_OFFLOAD_VLAN\t\t0x00010000\n #define VIRTCHNL_VF_OFFLOAD_RX_POLLING\t\t0x00020000\n #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2\t0x00040000\n@@ -229,9 +240,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);\n #define VIRTCHNL_VF_OFFLOAD_ENCAP\t\t0X00100000\n #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM\t\t0X00200000\n #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM\t0X00400000\n-/* Define below the capability flags that are not offloads */\n-#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED          0x00000080\n+#define VIRTCHNL_VF_OFFLOAD_ADQ\t\t\t0X00800000\n+#define VIRTCHNL_VF_OFFLOAD_ADQ_V2\t\t0X01000000\n+#define VIRTCHNL_VF_OFFLOAD_USO\t\t\t0X02000000\n+\t/* 0X80000000 is reserved */\n \n+/* Define below the capability flags that are not offloads */\n+#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED\t\t0x00000080\n #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \\\n \t\t\t       VIRTCHNL_VF_OFFLOAD_VLAN | \\\n \t\t\t       VIRTCHNL_VF_OFFLOAD_RSS_PF)\n@@ -262,9 +277,9 @@ struct virtchnl_txq_info {\n \tu16 vsi_id;\n \tu16 queue_id;\n \tu16 ring_len;\t\t/* number of descriptors, multiple of 8 */\n-\tu16 headwb_enabled; /* deprecated with IAVF 1.0 */\n+\tu16 headwb_enabled; /* deprecated with AVF 1.0 */\n \tu64 dma_ring_addr;\n-\tu64 dma_headwb_addr; /* deprecated with IAVF 1.0 */\n+\tu64 dma_headwb_addr; /* deprecated with AVF 1.0 */\n };\n \n VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);\n@@ -272,7 +287,13 @@ VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);\n /* VIRTCHNL_OP_CONFIG_RX_QUEUE\n  * VF sends this message to set up parameters for one RX queue.\n  * External data buffer contains one instance of virtchnl_rxq_info.\n- * PF configures requested queue and returns a status code.\n+ * PF configures requested queue and returns a status code. The\n+ * crc_disable flag disables CRC stripping on the VF. Setting\n+ * the crc_disable flag to 1 will disable CRC stripping for each\n+ * queue in the VF where the flag is set. The VIRTCHNL_VF_OFFLOAD_CRC\n+ * offload must have been set prior to sending this info or the PF\n+ * will ignore the request. This flag should be set the same for\n+ * all of the queues for a VF.\n  */\n \n /* Rx queue config info */\n@@ -281,23 +302,27 @@ struct virtchnl_rxq_info {\n \tu16 queue_id;\n \tu32 ring_len;\t\t/* number of descriptors, multiple of 32 */\n \tu16 hdr_size;\n-\tu16 splithdr_enabled; /* deprecated with IAVF 1.0 */\n+\tu16 splithdr_enabled; /* deprecated with AVF 1.0 */\n \tu32 databuffer_size;\n \tu32 max_pkt_size;\n-\tu32 pad1;\n+\tu8 crc_disable;\n+\tu8 pad1[3];\n \tu64 dma_ring_addr;\n-\tenum virtchnl_rx_hsplit rx_split_pos; /* deprecated with IAVF 1.0 */\n+\tenum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */\n \tu32 pad2;\n };\n \n VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);\n \n /* VIRTCHNL_OP_CONFIG_VSI_QUEUES\n- * VF sends this message to set parameters for all active TX and RX queues\n+ * VF sends this message to set parameters for active TX and RX queues\n  * associated with the specified VSI.\n  * PF configures queues and returns status.\n  * If the number of queues specified is greater than the number of queues\n  * associated with the VSI, an error is returned and no queues are configured.\n+ * NOTE: The VF is not required to configure all queues in a single request.\n+ * It may send multiple messages. PF drivers must correctly handle all VF\n+ * requests.\n  */\n struct virtchnl_queue_pair_info {\n \t/* NOTE: vsi_id and queue_id should be identical for both queues. */\n@@ -335,8 +360,13 @@ struct virtchnl_vf_res_request {\n  * VF uses this message to map vectors to queues.\n  * The rxq_map and txq_map fields are bitmaps used to indicate which queues\n  * are to be associated with the specified vector.\n- * The \"other\" causes are always mapped to vector 0.\n+ * The \"other\" causes are always mapped to vector 0. The VF may not request\n+ * that vector 0 be used for traffic.\n  * PF configures interrupt mapping and returns status.\n+ * NOTE: due to hardware requirements, all active queues (both TX and RX)\n+ * should be mapped to interrupts, even if the driver intends to operate\n+ * only in polling mode. In this case the interrupt may be disabled, but\n+ * the ITR timer will still run to trigger writebacks.\n  */\n struct virtchnl_vector_map {\n \tu16 vsi_id;\n@@ -363,6 +393,9 @@ VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);\n  * (Currently, we only support 16 queues per VF, but we make the field\n  * u32 to allow for expansion.)\n  * PF performs requested action and returns status.\n+ * NOTE: The VF is not required to enable/disable all queues in a single\n+ * request. It may send multiple messages.\n+ * PF drivers must correctly handle all VF requests.\n  */\n struct virtchnl_queue_select {\n \tu16 vsi_id;\n@@ -400,23 +433,6 @@ struct virtchnl_ether_addr_list {\n \n VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_ether_addr_list);\n \n-#ifdef VIRTCHNL_SOL_VF_SUPPORT\n-/* VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG\n- * VF sends this message to get the default MTU and list of additional ethernet\n- * addresses it is allowed to use.\n- * PF responds with an indirect message containing\n- * virtchnl_addnl_solaris_config with zero or more\n- * virtchnl_ether_addr structures.\n- *\n- * It is expected that this operation will only ever be needed for Solaris VFs\n- * running under a Solaris PF.\n- */\n-struct virtchnl_addnl_solaris_config {\n-\tu16 default_mtu;\n-\tstruct virtchnl_ether_addr_list al;\n-};\n-\n-#endif\n /* VIRTCHNL_OP_ADD_VLAN\n  * VF sends this message to add one or more VLAN tag filters for receives.\n  * PF adds the filters and returns status.\n@@ -469,7 +485,7 @@ struct virtchnl_eth_stats {\n \tu64 rx_broadcast;\t\t/* received broadcast pkts */\n \tu64 rx_discards;\n \tu64 rx_unknown_protocol;\n-\tu64 tx_bytes;\t\t\t/* transmitted bytes*/\n+\tu64 tx_bytes;\t\t\t/* transmitted bytes */\n \tu64 tx_unicast;\t\t\t/* transmitted unicast pkts */\n \tu64 tx_multicast;\t\t/* transmitted multicast pkts */\n \tu64 tx_broadcast;\t\t/* transmitted broadcast pkts */\n@@ -515,6 +531,95 @@ struct virtchnl_rss_hena {\n \n VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);\n \n+/* This is used by PF driver to enforce how many channels can be supported.\n+ * When ADQ_V2 capability is negotiated, it will allow 16 channels otherwise\n+ * PF driver will allow only max 4 channels\n+ */\n+#define VIRTCHNL_MAX_ADQ_CHANNELS 4\n+#define VIRTCHNL_MAX_ADQ_V2_CHANNELS 16\n+\n+/* VIRTCHNL_OP_ENABLE_CHANNELS\n+ * VIRTCHNL_OP_DISABLE_CHANNELS\n+ * VF sends these messages to enable or disable channels based on\n+ * the user specified queue count and queue offset for each traffic class.\n+ * This struct encompasses all the information that the PF needs from\n+ * VF to create a channel.\n+ */\n+struct virtchnl_channel_info {\n+\tu16 count; /* number of queues in a channel */\n+\tu16 offset; /* queues in a channel start from 'offset' */\n+\tu32 pad;\n+\tu64 max_tx_rate;\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_channel_info);\n+\n+struct virtchnl_tc_info {\n+\tu32\tnum_tc;\n+\tu32\tpad;\n+\tstruct\tvirtchnl_channel_info list[1];\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);\n+\n+/* VIRTCHNL_ADD_CLOUD_FILTER\n+ * VIRTCHNL_DEL_CLOUD_FILTER\n+ * VF sends these messages to add or delete a cloud filter based on the\n+ * user specified match and action filters. These structures encompass\n+ * all the information that the PF needs from the VF to add/delete a\n+ * cloud filter.\n+ */\n+\n+struct virtchnl_l4_spec {\n+\tu8\tsrc_mac[ETH_ALEN];\n+\tu8\tdst_mac[ETH_ALEN];\n+\t/* vlan_prio is part of this 16 bit field even from OS perspective\n+\t * vlan_id:12 is actual vlan_id, then vlanid:bit14..12 is vlan_prio\n+\t * in future, when decided to offload vlan_prio, pass that information\n+\t * as part of the \"vlan_id\" field, Bit14..12\n+\t */\n+\t__be16\tvlan_id;\n+\t__be16\tpad; /* reserved for future use */\n+\t__be32\tsrc_ip[4];\n+\t__be32\tdst_ip[4];\n+\t__be16\tsrc_port;\n+\t__be16\tdst_port;\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec);\n+\n+union virtchnl_flow_spec {\n+\tstruct\tvirtchnl_l4_spec tcp_spec;\n+\tu8\tbuffer[128]; /* reserved for future use */\n+};\n+\n+VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec);\n+\n+enum virtchnl_action {\n+\t/* action types */\n+\tVIRTCHNL_ACTION_DROP = 0,\n+\tVIRTCHNL_ACTION_TC_REDIRECT,\n+};\n+\n+enum virtchnl_flow_type {\n+\t/* flow types */\n+\tVIRTCHNL_TCP_V4_FLOW = 0,\n+\tVIRTCHNL_TCP_V6_FLOW,\n+\tVIRTCHNL_UDP_V4_FLOW,\n+\tVIRTCHNL_UDP_V6_FLOW,\n+};\n+\n+struct virtchnl_filter {\n+\tunion\tvirtchnl_flow_spec data;\n+\tunion\tvirtchnl_flow_spec mask;\n+\tenum\tvirtchnl_flow_type flow_type;\n+\tenum\tvirtchnl_action action;\n+\tu32\taction_meta;\n+\tu8\tfield_flags;\n+};\n+\n+VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);\n+\n /* VIRTCHNL_OP_EVENT\n  * PF sends this message to inform the VF driver of events that may affect it.\n  * No direct response is expected from the VF, though it may generate other\n@@ -559,44 +664,33 @@ struct virtchnl_pf_event {\n \n VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);\n \n-#ifdef VIRTCHNL_IWARP\n-\n-/* VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP\n- * VF uses this message to request PF to map IWARP vectors to IWARP queues.\n- * The request for this originates from the VF IWARP driver through\n- * a client interface between VF LAN and VF IWARP driver.\n- * A vector could have an AEQ and CEQ attached to it although\n- * there is a single AEQ per VF IWARP instance in which case\n- * most vectors will have an INVALID_IDX for aeq and valid idx for ceq.\n- * There will never be a case where there will be multiple CEQs attached\n- * to a single vector.\n- * PF configures interrupt mapping and returns status.\n- */\n \n-/* HW does not define a type value for AEQ; only for RX/TX and CEQ.\n- * In order for us to keep the interface simple, SW will define a\n- * unique type value for AEQ.\n+/* Since VF messages are limited by u16 size, precalculate the maximum possible\n+ * values of nested elements in virtchnl structures that virtual channel can\n+ * possibly handle in a single message.\n  */\n-#define QUEUE_TYPE_PE_AEQ  0x80\n-#define QUEUE_INVALID_IDX  0xFFFF\n+enum virtchnl_vector_limits {\n+\tVIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX\t=\n+\t\t((u16)(~0) - sizeof(struct virtchnl_vsi_queue_config_info)) /\n+\t\tsizeof(struct virtchnl_queue_pair_info),\n \n-struct virtchnl_iwarp_qv_info {\n-\tu32 v_idx; /* msix_vector */\n-\tu16 ceq_idx;\n-\tu16 aeq_idx;\n-\tu8 itr_idx;\n-};\n+\tVIRTCHNL_OP_CONFIG_IRQ_MAP_MAX\t\t=\n+\t\t((u16)(~0) - sizeof(struct virtchnl_irq_map_info)) /\n+\t\tsizeof(struct virtchnl_vector_map),\n \n-VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);\n+\tVIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX\t=\n+\t\t((u16)(~0) - sizeof(struct virtchnl_ether_addr_list)) /\n+\t\tsizeof(struct virtchnl_ether_addr),\n \n-struct virtchnl_iwarp_qvlist_info {\n-\tu32 num_vectors;\n-\tstruct virtchnl_iwarp_qv_info qv_info[1];\n-};\n+\tVIRTCHNL_OP_ADD_DEL_VLAN_MAX\t\t=\n+\t\t((u16)(~0) - sizeof(struct virtchnl_vlan_filter_list)) /\n+\t\tsizeof(u16),\n \n-VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);\n \n-#endif\n+\tVIRTCHNL_OP_ENABLE_CHANNELS_MAX\t\t=\n+\t\t((u16)(~0) - sizeof(struct virtchnl_tc_info)) /\n+\t\tsizeof(struct virtchnl_channel_info),\n+};\n \n /* VF reset states - these are written into the RSTAT register:\n  * VFGEN_RSTAT on the VF\n@@ -653,11 +747,16 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \t\tif (msglen >= valid_len) {\n \t\t\tstruct virtchnl_vsi_queue_config_info *vqc =\n \t\t\t    (struct virtchnl_vsi_queue_config_info *)msg;\n+\n+\t\t\tif (vqc->num_queue_pairs == 0 || vqc->num_queue_pairs >\n+\t\t\t    VIRTCHNL_OP_CONFIG_VSI_QUEUES_MAX) {\n+\t\t\t\terr_msg_format = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tvalid_len += (vqc->num_queue_pairs *\n \t\t\t\t      sizeof(struct\n \t\t\t\t\t     virtchnl_queue_pair_info));\n-\t\t\tif (vqc->num_queue_pairs == 0)\n-\t\t\t\terr_msg_format = true;\n \t\t}\n \t\tbreak;\n \tcase VIRTCHNL_OP_CONFIG_IRQ_MAP:\n@@ -665,10 +764,15 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \t\tif (msglen >= valid_len) {\n \t\t\tstruct virtchnl_irq_map_info *vimi =\n \t\t\t    (struct virtchnl_irq_map_info *)msg;\n+\n+\t\t\tif (vimi->num_vectors == 0 || vimi->num_vectors >\n+\t\t\t    VIRTCHNL_OP_CONFIG_IRQ_MAP_MAX) {\n+\t\t\t\terr_msg_format = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tvalid_len += (vimi->num_vectors *\n \t\t\t\t      sizeof(struct virtchnl_vector_map));\n-\t\t\tif (vimi->num_vectors == 0)\n-\t\t\t\terr_msg_format = true;\n \t\t}\n \t\tbreak;\n \tcase VIRTCHNL_OP_ENABLE_QUEUES:\n@@ -681,10 +785,15 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \t\tif (msglen >= valid_len) {\n \t\t\tstruct virtchnl_ether_addr_list *veal =\n \t\t\t    (struct virtchnl_ether_addr_list *)msg;\n+\n+\t\t\tif (veal->num_elements == 0 || veal->num_elements >\n+\t\t\t    VIRTCHNL_OP_ADD_DEL_ETH_ADDR_MAX) {\n+\t\t\t\terr_msg_format = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tvalid_len += veal->num_elements *\n \t\t\t    sizeof(struct virtchnl_ether_addr);\n-\t\t\tif (veal->num_elements == 0)\n-\t\t\t\terr_msg_format = true;\n \t\t}\n \t\tbreak;\n \tcase VIRTCHNL_OP_ADD_VLAN:\n@@ -693,9 +802,14 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \t\tif (msglen >= valid_len) {\n \t\t\tstruct virtchnl_vlan_filter_list *vfl =\n \t\t\t    (struct virtchnl_vlan_filter_list *)msg;\n-\t\t\tvalid_len += vfl->num_elements * sizeof(u16);\n-\t\t\tif (vfl->num_elements == 0)\n+\n+\t\t\tif (vfl->num_elements == 0 || vfl->num_elements >\n+\t\t\t    VIRTCHNL_OP_ADD_DEL_VLAN_MAX) {\n \t\t\t\terr_msg_format = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tvalid_len += vfl->num_elements * sizeof(u16);\n \t\t}\n \t\tbreak;\n \tcase VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:\n@@ -704,38 +818,17 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \tcase VIRTCHNL_OP_GET_STATS:\n \t\tvalid_len = sizeof(struct virtchnl_queue_select);\n \t\tbreak;\n-#ifdef VIRTCHNL_IWARP\n-\tcase VIRTCHNL_OP_IWARP:\n-\t\t/* These messages are opaque to us and will be validated in\n-\t\t * the RDMA client code. We just need to check for nonzero\n-\t\t * length. The firmware will enforce max length restrictions.\n-\t\t */\n-\t\tif (msglen)\n-\t\t\tvalid_len = msglen;\n-\t\telse\n-\t\t\terr_msg_format = true;\n-\t\tbreak;\n-\tcase VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP:\n-\t\tbreak;\n-\tcase VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:\n-\t\tvalid_len = sizeof(struct virtchnl_iwarp_qvlist_info);\n-\t\tif (msglen >= valid_len) {\n-\t\t\tstruct virtchnl_iwarp_qvlist_info *qv =\n-\t\t\t\t(struct virtchnl_iwarp_qvlist_info *)msg;\n-\t\t\tif (qv->num_vectors == 0) {\n-\t\t\t\terr_msg_format = true;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tvalid_len += ((qv->num_vectors - 1) *\n-\t\t\t\tsizeof(struct virtchnl_iwarp_qv_info));\n-\t\t}\n-\t\tbreak;\n-#endif\n \tcase VIRTCHNL_OP_CONFIG_RSS_KEY:\n \t\tvalid_len = sizeof(struct virtchnl_rss_key);\n \t\tif (msglen >= valid_len) {\n \t\t\tstruct virtchnl_rss_key *vrk =\n \t\t\t\t(struct virtchnl_rss_key *)msg;\n+\n+\t\t\tif (vrk->key_len == 0) {\n+\t\t\t\t/* zero length is allowed as input */\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tvalid_len += vrk->key_len - 1;\n \t\t}\n \t\tbreak;\n@@ -744,6 +837,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \t\tif (msglen >= valid_len) {\n \t\t\tstruct virtchnl_rss_lut *vrl =\n \t\t\t\t(struct virtchnl_rss_lut *)msg;\n+\n+\t\t\tif (vrl->lut_entries == 0) {\n+\t\t\t\t/* zero entries is allowed as input */\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tvalid_len += vrl->lut_entries - 1;\n \t\t}\n \t\tbreak;\n@@ -758,11 +857,33 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,\n \tcase VIRTCHNL_OP_REQUEST_QUEUES:\n \t\tvalid_len = sizeof(struct virtchnl_vf_res_request);\n \t\tbreak;\n+\tcase VIRTCHNL_OP_ENABLE_CHANNELS:\n+\t\tvalid_len = sizeof(struct virtchnl_tc_info);\n+\t\tif (msglen >= valid_len) {\n+\t\t\tstruct virtchnl_tc_info *vti =\n+\t\t\t\t(struct virtchnl_tc_info *)msg;\n+\n+\t\t\tif (vti->num_tc == 0 || vti->num_tc >\n+\t\t\t    VIRTCHNL_OP_ENABLE_CHANNELS_MAX) {\n+\t\t\t\terr_msg_format = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tvalid_len += (vti->num_tc - 1) *\n+\t\t\t\t     sizeof(struct virtchnl_channel_info);\n+\t\t}\n+\t\tbreak;\n+\tcase VIRTCHNL_OP_DISABLE_CHANNELS:\n+\t\tbreak;\n+\tcase VIRTCHNL_OP_ADD_CLOUD_FILTER:\n+\tcase VIRTCHNL_OP_DEL_CLOUD_FILTER:\n+\t\tvalid_len = sizeof(struct virtchnl_filter);\n+\t\tbreak;\n \t/* These are always errors coming from the VF. */\n \tcase VIRTCHNL_OP_EVENT:\n \tcase VIRTCHNL_OP_UNKNOWN:\n \tdefault:\n-\t\treturn VIRTCHNL_ERR_PARAM;\n+\t\treturn VIRTCHNL_STATUS_ERR_PARAM;\n \t}\n \t/* few more checks */\n \tif (err_msg_format || valid_len != msglen)\n",
    "prefixes": [
        "08/17"
    ]
}