get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 110471,
    "url": "http://patches.dpdk.org/api/patches/110471/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220429091958.3103384-13-kevinx.liu@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": "<20220429091958.3103384-13-kevinx.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220429091958.3103384-13-kevinx.liu@intel.com",
    "date": "2022-04-29T09:19:58",
    "name": "[v7,12/12] net/ice: support DCF new VLAN capabilities",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "78e5da054646c6a6b2a7f935ee736025f4f2a32f",
    "submitter": {
        "id": 2440,
        "url": "http://patches.dpdk.org/api/people/2440/?format=api",
        "name": "Kevin Liu",
        "email": "kevinx.liu@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220429091958.3103384-13-kevinx.liu@intel.com/mbox/",
    "series": [
        {
            "id": 22721,
            "url": "http://patches.dpdk.org/api/series/22721/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22721",
            "date": "2022-04-29T09:19:46",
            "name": "complete common VF features for DCF",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/22721/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/110471/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/110471/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 021F2A0093;\n\tFri, 29 Apr 2022 03:23:43 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6A8D142856;\n\tFri, 29 Apr 2022 03:23:17 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id AA70742851\n for <dev@dpdk.org>; Fri, 29 Apr 2022 03:23:12 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Apr 2022 18:23:11 -0700",
            "from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195])\n by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Apr 2022 18:22:45 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1651195392; x=1682731392;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=ucXosylVqNNOcAf6nPWvXAdwRVkM6vIvGkRX9rHBHpM=;\n b=MCbHSewXS4GeeI0NS7AcNN4d0grDwMFKFDBDhE7XjtmDd2XW6qiqY++r\n CSX8A+4u92qhIAUNeQhsFe3bFS+E6aPaOrHsKcTezWv9hYqi4kiE4tRqt\n JTUBhkM1u/1yKNMHsMPRUurqRKDrdMM1gI6layNy03FN9MRx9X7DvbWhX\n bWdvPQ7aBxhbQOYPcIjTfVgP2cguEJexX06LjkGr/3bJzReUQfoWcjaTC\n AprzAyRYD6WXSWLkNJ8yLfmTppbwEyxsl9YsiI0UityvtuhnhiL/yK5Ve\n tLKPBhh57OplDi3PDTBFF5GVr4xkksaKbPn/fP9FhmBAZvEDW9AGP18sB g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10331\"; a=\"248419766\"",
            "E=Sophos;i=\"5.91,296,1647327600\"; d=\"scan'208\";a=\"248419766\"",
            "E=Sophos;i=\"5.91,296,1647327600\"; d=\"scan'208\";a=\"581768153\""
        ],
        "From": "Kevin Liu <kevinx.liu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com,\n Alvin Zhang <alvinx.zhang@intel.com>, Kevin Liu <kevinx.liu@intel.com>",
        "Subject": "[PATCH v7 12/12] net/ice: support DCF new VLAN capabilities",
        "Date": "Fri, 29 Apr 2022 09:19:58 +0000",
        "Message-Id": "<20220429091958.3103384-13-kevinx.liu@intel.com>",
        "X-Mailer": "git-send-email 2.33.1",
        "In-Reply-To": "<20220429091958.3103384-1-kevinx.liu@intel.com>",
        "References": "<20220427181301.1414196-1-kevinx.liu@intel.com>\n <20220429091958.3103384-1-kevinx.liu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "From: Alvin Zhang <alvinx.zhang@intel.com>\n\nThe new VLAN virtchnl opcodes introduce new capabilities like VLAN\nfiltering, stripping and insertion.\n\nThe DCF needs to query the VLAN capabilities based on current device\nconfiguration firstly.\n\nDCF is able to configure inner VLAN filter when port VLAN is enabled\nbase on negotiation; and DCF is able to configure outer VLAN (0x8100)\nif port VLAN is disabled to be compatible with legacy mode.\n\nWhen port VLAN is updated by DCF, the DCF needs to reset to query the\nnew VLAN capabilities.\n\nSigned-off-by: Alvin Zhang <alvinx.zhang@intel.com>\nSigned-off-by: Kevin Liu <kevinx.liu@intel.com>\n---\n drivers/net/ice/ice_dcf.c        |  27 +++++\n drivers/net/ice/ice_dcf.h        |   1 +\n drivers/net/ice/ice_dcf_ethdev.c | 171 ++++++++++++++++++++++++++++---\n 3 files changed, 182 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c\nindex 55ae68c456..885d58c0f4 100644\n--- a/drivers/net/ice/ice_dcf.c\n+++ b/drivers/net/ice/ice_dcf.c\n@@ -587,6 +587,29 @@ ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)\n \treturn 0;\n }\n \n+static int\n+dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw)\n+{\n+\tstruct virtchnl_vlan_caps vlan_v2_caps;\n+\tstruct dcf_virtchnl_cmd args;\n+\tint ret;\n+\n+\tmemset(&args, 0, sizeof(args));\n+\targs.v_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;\n+\targs.rsp_msgbuf = (uint8_t *)&vlan_v2_caps;\n+\targs.rsp_buflen = sizeof(vlan_v2_caps);\n+\n+\tret = ice_dcf_execute_virtchnl_cmd(hw, &args);\n+\tif (ret) {\n+\t\tPMD_DRV_LOG(ERR,\n+\t\t\t    \"Failed to execute command of VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS\");\n+\t\treturn ret;\n+\t}\n+\n+\trte_memcpy(&hw->vlan_v2_caps, &vlan_v2_caps, sizeof(vlan_v2_caps));\n+\treturn 0;\n+}\n+\n int\n ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)\n {\n@@ -701,6 +724,10 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)\n \trte_intr_enable(pci_dev->intr_handle);\n \tice_dcf_enable_irq0(hw);\n \n+\tif ((hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) &&\n+\t    dcf_get_vlan_offload_caps_v2(hw))\n+\t\tgoto err_rss;\n+\n \treturn 0;\n \n err_rss:\ndiff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h\nindex 44a61404c3..7f42ebabe9 100644\n--- a/drivers/net/ice/ice_dcf.h\n+++ b/drivers/net/ice/ice_dcf.h\n@@ -129,6 +129,7 @@ struct ice_dcf_hw {\n \tuint16_t nb_msix;\n \tuint16_t rxq_map[16];\n \tstruct virtchnl_eth_stats eth_stats_offset;\n+\tstruct virtchnl_vlan_caps vlan_v2_caps;\n \n \t/* Link status */\n \tbool link_up;\ndiff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c\nindex 236c0395e0..8005eb2ab8 100644\n--- a/drivers/net/ice/ice_dcf_ethdev.c\n+++ b/drivers/net/ice/ice_dcf_ethdev.c\n@@ -1050,6 +1050,46 @@ dcf_dev_set_default_mac_addr(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n+static int\n+dcf_add_del_vlan_v2(struct ice_dcf_hw *hw, uint16_t vlanid, bool add)\n+{\n+\tstruct virtchnl_vlan_supported_caps *supported_caps =\n+\t\t\t&hw->vlan_v2_caps.filtering.filtering_support;\n+\tstruct virtchnl_vlan *vlan_setting;\n+\tstruct virtchnl_vlan_filter_list_v2 vlan_filter;\n+\tstruct dcf_virtchnl_cmd args;\n+\tuint32_t filtering_caps;\n+\tint err;\n+\n+\tif (supported_caps->outer) {\n+\t\tfiltering_caps = supported_caps->outer;\n+\t\tvlan_setting = &vlan_filter.filters[0].outer;\n+\t} else {\n+\t\tfiltering_caps = supported_caps->inner;\n+\t\tvlan_setting = &vlan_filter.filters[0].inner;\n+\t}\n+\n+\tif (!(filtering_caps & VIRTCHNL_VLAN_ETHERTYPE_8100))\n+\t\treturn -ENOTSUP;\n+\n+\tmemset(&vlan_filter, 0, sizeof(vlan_filter));\n+\tvlan_filter.vport_id = hw->vsi_res->vsi_id;\n+\tvlan_filter.num_elements = 1;\n+\tvlan_setting->tpid = RTE_ETHER_TYPE_VLAN;\n+\tvlan_setting->tci = vlanid;\n+\n+\tmemset(&args, 0, sizeof(args));\n+\targs.v_op = add ? VIRTCHNL_OP_ADD_VLAN_V2 : VIRTCHNL_OP_DEL_VLAN_V2;\n+\targs.req_msg = (uint8_t *)&vlan_filter;\n+\targs.req_msglen = sizeof(vlan_filter);\n+\terr = ice_dcf_execute_virtchnl_cmd(hw, &args);\n+\tif (err)\n+\t\tPMD_DRV_LOG(ERR, \"fail to execute command %s\",\n+\t\t\t    add ? \"OP_ADD_VLAN_V2\" :  \"OP_DEL_VLAN_V2\");\n+\n+\treturn err;\n+}\n+\n static int\n dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add)\n {\n@@ -1076,6 +1116,116 @@ dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add)\n \treturn err;\n }\n \n+static int\n+dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n+{\n+\tstruct ice_dcf_adapter *adapter = dev->data->dev_private;\n+\tstruct ice_dcf_hw *hw = &adapter->real_hw;\n+\tint err;\n+\n+\tif (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {\n+\t\terr = dcf_add_del_vlan_v2(hw, vlan_id, on);\n+\t\tif (err)\n+\t\t\treturn -EIO;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))\n+\t\treturn -ENOTSUP;\n+\n+\terr = dcf_add_del_vlan(hw, vlan_id, on);\n+\tif (err)\n+\t\treturn -EIO;\n+\treturn 0;\n+}\n+\n+static void\n+dcf_iterate_vlan_filters_v2(struct rte_eth_dev *dev, bool enable)\n+{\n+\tstruct rte_vlan_filter_conf *vfc = &dev->data->vlan_filter_conf;\n+\tstruct ice_dcf_adapter *adapter = dev->data->dev_private;\n+\tstruct ice_dcf_hw *hw = &adapter->real_hw;\n+\tuint32_t i, j;\n+\tuint64_t ids;\n+\n+\tfor (i = 0; i < RTE_DIM(vfc->ids); i++) {\n+\t\tif (vfc->ids[i] == 0)\n+\t\t\tcontinue;\n+\n+\t\tids = vfc->ids[i];\n+\t\tfor (j = 0; ids != 0 && j < 64; j++, ids >>= 1) {\n+\t\t\tif (ids & 1)\n+\t\t\t\tdcf_add_del_vlan_v2(hw, 64 * i + j, enable);\n+\t\t}\n+\t}\n+}\n+\n+static int\n+dcf_config_vlan_strip_v2(struct ice_dcf_hw *hw, bool enable)\n+{\n+\tstruct virtchnl_vlan_supported_caps *stripping_caps =\n+\t\t\t&hw->vlan_v2_caps.offloads.stripping_support;\n+\tstruct virtchnl_vlan_setting vlan_strip;\n+\tstruct dcf_virtchnl_cmd args;\n+\tuint32_t *ethertype;\n+\tint ret;\n+\n+\tif ((stripping_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) &&\n+\t    (stripping_caps->outer & VIRTCHNL_VLAN_TOGGLE))\n+\t\tethertype = &vlan_strip.outer_ethertype_setting;\n+\telse if ((stripping_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) &&\n+\t\t (stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE))\n+\t\tethertype = &vlan_strip.inner_ethertype_setting;\n+\telse\n+\t\treturn -ENOTSUP;\n+\n+\tmemset(&vlan_strip, 0, sizeof(vlan_strip));\n+\tvlan_strip.vport_id = hw->vsi_res->vsi_id;\n+\t*ethertype = VIRTCHNL_VLAN_ETHERTYPE_8100;\n+\n+\tmemset(&args, 0, sizeof(args));\n+\targs.v_op = enable ? VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2 :\n+\t\t\t    VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2;\n+\targs.req_msg = (uint8_t *)&vlan_strip;\n+\targs.req_msglen = sizeof(vlan_strip);\n+\tret = ice_dcf_execute_virtchnl_cmd(hw, &args);\n+\tif (ret)\n+\t\tPMD_DRV_LOG(ERR, \"fail to execute command %s\",\n+\t\t\t    enable ? \"VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2\" :\n+\t\t\t\t     \"VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2\");\n+\n+\treturn ret;\n+}\n+\n+static int\n+dcf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask)\n+{\n+\tstruct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;\n+\tstruct ice_dcf_adapter *adapter = dev->data->dev_private;\n+\tstruct ice_dcf_hw *hw = &adapter->real_hw;\n+\tbool enable;\n+\tint err;\n+\n+\tif (mask & RTE_ETH_VLAN_FILTER_MASK) {\n+\t\tenable = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER);\n+\n+\t\tdcf_iterate_vlan_filters_v2(dev, enable);\n+\t}\n+\n+\tif (mask & RTE_ETH_VLAN_STRIP_MASK) {\n+\t\tenable = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP);\n+\n+\t\terr = dcf_config_vlan_strip_v2(hw, enable);\n+\t\t/* If not support, the stripping is already disabled by PF */\n+\t\tif (err == -ENOTSUP && !enable)\n+\t\t\terr = 0;\n+\t\tif (err)\n+\t\t\treturn -EIO;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n dcf_enable_vlan_strip(struct ice_dcf_hw *hw)\n {\n@@ -1108,30 +1258,17 @@ dcf_disable_vlan_strip(struct ice_dcf_hw *hw)\n \treturn ret;\n }\n \n-static int\n-dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n-{\n-\tstruct ice_dcf_adapter *adapter = dev->data->dev_private;\n-\tstruct ice_dcf_hw *hw = &adapter->real_hw;\n-\tint err;\n-\n-\tif (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))\n-\t\treturn -ENOTSUP;\n-\n-\terr = dcf_add_del_vlan(hw, vlan_id, on);\n-\tif (err)\n-\t\treturn -EIO;\n-\treturn 0;\n-}\n-\n static int\n dcf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)\n {\n+\tstruct rte_eth_conf *dev_conf = &dev->data->dev_conf;\n \tstruct ice_dcf_adapter *adapter = dev->data->dev_private;\n \tstruct ice_dcf_hw *hw = &adapter->real_hw;\n-\tstruct rte_eth_conf *dev_conf = &dev->data->dev_conf;\n \tint err;\n \n+\tif (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2)\n+\t\treturn dcf_dev_vlan_offload_set_v2(dev, mask);\n+\n \tif (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))\n \t\treturn -ENOTSUP;\n \n",
    "prefixes": [
        "v7",
        "12/12"
    ]
}