get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 109643,
    "url": "http://patchwork.dpdk.org/api/patches/109643/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20220413160932.2074781-10-kevinx.liu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20220413160932.2074781-10-kevinx.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220413160932.2074781-10-kevinx.liu@intel.com",
    "date": "2022-04-13T16:09:08",
    "name": "[v2,09/33] net/ice: support DCF new VLAN capabilities",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "78e5da054646c6a6b2a7f935ee736025f4f2a32f",
    "submitter": {
        "id": 2440,
        "url": "http://patchwork.dpdk.org/api/people/2440/?format=api",
        "name": "Kevin Liu",
        "email": "kevinx.liu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20220413160932.2074781-10-kevinx.liu@intel.com/mbox/",
    "series": [
        {
            "id": 22497,
            "url": "http://patchwork.dpdk.org/api/series/22497/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=22497",
            "date": "2022-04-13T16:08:59",
            "name": "support full function of DCF",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/22497/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/109643/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/109643/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 812ACA0508;\n\tWed, 13 Apr 2022 10:11:45 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 64A6642827;\n\tWed, 13 Apr 2022 10:11:07 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id E1D794281E\n for <dev@dpdk.org>; Wed, 13 Apr 2022 10:11:04 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Apr 2022 01:11:03 -0700",
            "from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195])\n by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Apr 2022 01:11:01 -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=1649837465; x=1681373465;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=czQYGmqdwsiJjeNH0C2rD08JOg7Y4c6jT9LjqLzrkTE=;\n b=QV7IMhd6unTLIiTJuOsKJLMf1DRyMtBpaN9zxEEpkq861nezpH/2amkJ\n KK9TXmrgntlpAWyvPlVGaIAeCxf8kOzMdaZ+BGx1GrxS26Jd6ym4Emg/S\n M81nrcf0LUZUiy85IlkgkDPhhgPm9zCQ67cBUC5RE1rA9JKK4NpHI4jN+\n sgo+tDEGmoiY7uTgX2aqtwCCJcThuawmpMxSf63Xuix1vu0IadPnRisQW\n bgHmWwtsyZUVSR5zqMvehkF8i8yk2I1tcx3qX61KbZJOv0Ae4pMTGQ8Gj\n hTIxk9uRV16678KyiMUf2evP6z/JC6zEG+XRIqtjTHlkdC9hsWJrE2ME4 g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10315\"; a=\"243189106\"",
            "E=Sophos;i=\"5.90,256,1643702400\"; d=\"scan'208\";a=\"243189106\"",
            "E=Sophos;i=\"5.90,256,1643702400\"; d=\"scan'208\";a=\"526847593\""
        ],
        "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 v2 09/33] net/ice: support DCF new VLAN capabilities",
        "Date": "Wed, 13 Apr 2022 16:09:08 +0000",
        "Message-Id": "<20220413160932.2074781-10-kevinx.liu@intel.com>",
        "X-Mailer": "git-send-email 2.33.1",
        "In-Reply-To": "<20220413160932.2074781-1-kevinx.liu@intel.com>",
        "References": "<20220407105706.18889-1-kevinx.liu@intel.com>\n <20220413160932.2074781-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 78df202a77..32e6031bd9 100644\n--- a/drivers/net/ice/ice_dcf.h\n+++ b/drivers/net/ice/ice_dcf.h\n@@ -107,6 +107,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 e58cdf47d2..d4bfa182a4 100644\n--- a/drivers/net/ice/ice_dcf_ethdev.c\n+++ b/drivers/net/ice/ice_dcf_ethdev.c\n@@ -1026,6 +1026,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@@ -1052,6 +1092,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@@ -1084,30 +1234,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": [
        "v2",
        "09/33"
    ]
}