get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87747,
    "url": "http://patchwork.dpdk.org/api/patches/87747/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210204125029.14138-1-haiyue.wang@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": "<20210204125029.14138-1-haiyue.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210204125029.14138-1-haiyue.wang@intel.com",
    "date": "2021-02-04T12:50:29",
    "name": "[v2] net/ice: fix VLAN 0 adding based on VLAN mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "28cf94173739cad758be078eb53628279388a9d6",
    "submitter": {
        "id": 1044,
        "url": "http://patchwork.dpdk.org/api/people/1044/?format=api",
        "name": "Wang, Haiyue",
        "email": "haiyue.wang@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patchwork.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210204125029.14138-1-haiyue.wang@intel.com/mbox/",
    "series": [
        {
            "id": 15168,
            "url": "http://patchwork.dpdk.org/api/series/15168/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=15168",
            "date": "2021-02-04T12:50:29",
            "name": "[v2] net/ice: fix VLAN 0 adding based on VLAN mode",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/15168/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/87747/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/87747/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 7CCAAA0524;\n\tThu,  4 Feb 2021 14:07:03 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EB6A32405EF;\n\tThu,  4 Feb 2021 14:07:02 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id C978824058E\n for <dev@dpdk.org>; Thu,  4 Feb 2021 14:07:00 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 Feb 2021 05:06:59 -0800",
            "from npg-dpdk-haiyue-1.sh.intel.com ([10.67.118.220])\n by fmsmga008.fm.intel.com with ESMTP; 04 Feb 2021 05:06:57 -0800"
        ],
        "IronPort-SDR": [
            "\n efyfBSweTDjzX1FCDzJ5DX4Sk2cHlwH89EL0JSaOZFh3ZddafjTsTBxp5ADFa89o9EZSVBxKDv\n zT9FgGW5okoA==",
            "\n LFHo4l9YHupyiGTOjM7CY6jXKL/b8CK05tQogdVxonvYEJgWAsQQolSPcMB3nLxX2WQnLslUIx\n gSeTw8TGya/w=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9884\"; a=\"200223239\"",
            "E=Sophos;i=\"5.79,400,1602572400\"; d=\"scan'208\";a=\"200223239\"",
            "E=Sophos;i=\"5.79,400,1602572400\"; d=\"scan'208\";a=\"372658111\""
        ],
        "X-ExtLoop1": "1",
        "From": "Haiyue Wang <haiyue.wang@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qiming.yang@intel.com, qi.z.zhang@intel.com,\n Haiyue Wang <haiyue.wang@intel.com>,\n Brett Creeley <brett.creeley@intel.com>",
        "Date": "Thu,  4 Feb 2021 20:50:29 +0800",
        "Message-Id": "<20210204125029.14138-1-haiyue.wang@intel.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20210204122217.13707-1-haiyue.wang@intel.com>",
        "References": "<20210204122217.13707-1-haiyue.wang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2] net/ice: fix VLAN 0 adding based on VLAN mode",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "In Single VLAN Mode, single VLAN filters via ICE_SW_LKUP_VLAN are based\non the inner VLAN ID, so the VLAN TPID (i.e. 0x8100 or 0x888a8) doesn't\nmatter.\n\nIn Double VLAN Mode, outer/single VLAN filters via ICE_SW_LKUP_VLAN are\nbased on the outer/single VLAN ID + VLAN TPID.\n\nFor both modes, adding a VLAN 0 + no VLAN TPID filter to handle untagged\ntraffic when VLAN pruning is enabled. Also, this handles VLAN 0 priority\ntagged traffic in Single VLAN Mode, since the VLAN TPID is not part of\nfiltering.\n\nIf Double VLAN Mode is enabled then an explicit VLAN 0 + VLAN TPID filter\nneeds to be added to allow VLAN 0 priority tagged traffic in DVM, since\nthe VLAN TPID is part of filtering.\n\nFixes: 14e7a4b37b4f (\"net/ice/base: support configuring device in double VLAN mode\")\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\n---\nv2: Change the log level from ERR to DEBUG, since this is not fatal\nerror.\n---\n drivers/net/ice/ice_ethdev.c | 136 +++++++++++++++++++++++++++++------\n drivers/net/ice/ice_ethdev.h |  10 ++-\n 2 files changed, 123 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c\nindex cb2c0cf449..dfd99ace94 100644\n--- a/drivers/net/ice/ice_ethdev.c\n+++ b/drivers/net/ice/ice_ethdev.c\n@@ -948,12 +948,13 @@ ice_remove_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr)\n \n /* Find out specific VLAN filter */\n static struct ice_vlan_filter *\n-ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n+ice_find_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan)\n {\n \tstruct ice_vlan_filter *f;\n \n \tTAILQ_FOREACH(f, &vsi->vlan_list, next) {\n-\t\tif (vlan_id == f->vlan_info.vlan_id)\n+\t\tif (vlan->tpid == f->vlan_info.vlan.tpid &&\n+\t\t    vlan->vid == f->vlan_info.vlan.vid)\n \t\t\treturn f;\n \t}\n \n@@ -961,7 +962,7 @@ ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n }\n \n static int\n-ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n+ice_add_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan)\n {\n \tstruct ice_fltr_list_entry *v_list_itr = NULL;\n \tstruct ice_vlan_filter *f;\n@@ -969,13 +970,13 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n \tstruct ice_hw *hw;\n \tint ret = 0;\n \n-\tif (!vsi || vlan_id > RTE_ETHER_MAX_VLAN_ID)\n+\tif (!vsi || vlan->vid > RTE_ETHER_MAX_VLAN_ID)\n \t\treturn -EINVAL;\n \n \thw = ICE_VSI_TO_HW(vsi);\n \n \t/* If it's added and configured, return. */\n-\tf = ice_find_vlan_filter(vsi, vlan_id);\n+\tf = ice_find_vlan_filter(vsi, vlan);\n \tif (f) {\n \t\tPMD_DRV_LOG(INFO, \"This VLAN filter already exists.\");\n \t\treturn 0;\n@@ -992,7 +993,9 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n \t\tret = -ENOMEM;\n \t\tgoto DONE;\n \t}\n-\tv_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id;\n+\tv_list_itr->fltr_info.l_data.vlan.vlan_id = vlan->vid;\n+\tv_list_itr->fltr_info.l_data.vlan.tpid = vlan->tpid;\n+\tv_list_itr->fltr_info.l_data.vlan.tpid_valid = true;\n \tv_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI;\n \tv_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI;\n \tv_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_VLAN;\n@@ -1016,7 +1019,8 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n \t\tret = -ENOMEM;\n \t\tgoto DONE;\n \t}\n-\tf->vlan_info.vlan_id = vlan_id;\n+\tf->vlan_info.vlan.tpid = vlan->tpid;\n+\tf->vlan_info.vlan.vid = vlan->vid;\n \tTAILQ_INSERT_TAIL(&vsi->vlan_list, f, next);\n \tvsi->vlan_num++;\n \n@@ -1028,7 +1032,7 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n }\n \n static int\n-ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n+ice_remove_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan)\n {\n \tstruct ice_fltr_list_entry *v_list_itr = NULL;\n \tstruct ice_vlan_filter *f;\n@@ -1036,17 +1040,13 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n \tstruct ice_hw *hw;\n \tint ret = 0;\n \n-\t/**\n-\t * Vlan 0 is the generic filter for untagged packets\n-\t * and can't be removed.\n-\t */\n-\tif (!vsi || vlan_id == 0 || vlan_id > RTE_ETHER_MAX_VLAN_ID)\n+\tif (!vsi || vlan->vid > RTE_ETHER_MAX_VLAN_ID)\n \t\treturn -EINVAL;\n \n \thw = ICE_VSI_TO_HW(vsi);\n \n \t/* Can't find it, return an error */\n-\tf = ice_find_vlan_filter(vsi, vlan_id);\n+\tf = ice_find_vlan_filter(vsi, vlan);\n \tif (!f)\n \t\treturn -EINVAL;\n \n@@ -1059,7 +1059,9 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id)\n \t\tgoto DONE;\n \t}\n \n-\tv_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id;\n+\tv_list_itr->fltr_info.l_data.vlan.vlan_id = vlan->vid;\n+\tv_list_itr->fltr_info.l_data.vlan.tpid = vlan->tpid;\n+\tv_list_itr->fltr_info.l_data.vlan.tpid_valid = true;\n \tv_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI;\n \tv_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI;\n \tv_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_VLAN;\n@@ -1109,7 +1111,7 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi)\n \t\treturn 0;\n \n \tTAILQ_FOREACH(v_f, &vsi->vlan_list, next) {\n-\t\tret = ice_remove_vlan_filter(vsi, v_f->vlan_info.vlan_id);\n+\t\tret = ice_remove_vlan_filter(vsi, &v_f->vlan_info.vlan);\n \t\tif (ret != ICE_SUCCESS) {\n \t\t\tret = -EINVAL;\n \t\t\tgoto DONE;\n@@ -1466,6 +1468,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)\n \t\tvsi_ctx.info.inner_vlan_flags |= ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;\n \t\tvsi_ctx.info.q_opt_rss = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF |\n \t\t\t\t\t ICE_AQ_VSI_Q_OPT_RSS_TPLZ;\n+\t\tif (ice_is_dvm_ena(hw)) {\n+\t\t\tvsi_ctx.info.outer_vlan_flags =\n+\t\t\t\t(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL <<\n+\t\t\t\t ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) &\n+\t\t\t\tICE_AQ_VSI_OUTER_VLAN_TX_MODE_M;\n+\t\t\tvsi_ctx.info.outer_vlan_flags |=\n+\t\t\t\t(ICE_AQ_VSI_OUTER_TAG_VLAN_8100 <<\n+\t\t\t\t ICE_AQ_VSI_OUTER_TAG_TYPE_S) &\n+\t\t\t\tICE_AQ_VSI_OUTER_TAG_TYPE_M;\n+\t\t}\n \n \t\t/* FDIR */\n \t\tcfg = ICE_AQ_VSI_PROP_SECURITY_VALID |\n@@ -1693,10 +1705,11 @@ ice_load_pkg_type(struct ice_hw *hw)\n \telse\n \t\tpackage_type = ICE_PKG_TYPE_UNKNOWN;\n \n-\tPMD_INIT_LOG(NOTICE, \"Active package is: %d.%d.%d.%d, %s\",\n+\tPMD_INIT_LOG(NOTICE, \"Active package is: %d.%d.%d.%d, %s (%s VLAN mode)\",\n \t\thw->active_pkg_ver.major, hw->active_pkg_ver.minor,\n \t\thw->active_pkg_ver.update, hw->active_pkg_ver.draft,\n-\t\thw->active_pkg_name);\n+\t\thw->active_pkg_name,\n+\t\tice_is_dvm_ena(hw) ? \"double\" : \"single\");\n \n \treturn package_type;\n }\n@@ -3891,19 +3904,27 @@ static int\n ice_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n {\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\tstruct ice_vlan vlan = ICE_VLAN(RTE_ETHER_TYPE_VLAN, vlan_id);\n \tstruct ice_vsi *vsi = pf->main_vsi;\n \tint ret;\n \n \tPMD_INIT_FUNC_TRACE();\n \n+\t/**\n+\t * Vlan 0 is the generic filter for untagged packets\n+\t * and can't be removed or added by user.\n+\t */\n+\tif (vlan_id == 0)\n+\t\treturn 0;\n+\n \tif (on) {\n-\t\tret = ice_add_vlan_filter(vsi, vlan_id);\n+\t\tret = ice_add_vlan_filter(vsi, &vlan);\n \t\tif (ret < 0) {\n \t\t\tPMD_DRV_LOG(ERR, \"Failed to add vlan filter\");\n \t\t\treturn -EINVAL;\n \t\t}\n \t} else {\n-\t\tret = ice_remove_vlan_filter(vsi, vlan_id);\n+\t\tret = ice_remove_vlan_filter(vsi, &vlan);\n \t\tif (ret < 0) {\n \t\t\tPMD_DRV_LOG(ERR, \"Failed to remove vlan filter\");\n \t\t\treturn -EINVAL;\n@@ -3913,6 +3934,77 @@ ice_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n \treturn 0;\n }\n \n+/* In Single VLAN Mode (SVM), single VLAN filters via ICE_SW_LKUP_VLAN are\n+ * based on the inner VLAN ID, so the VLAN TPID (i.e. 0x8100 or 0x888a8)\n+ * doesn't matter. In Double VLAN Mode (DVM), outer/single VLAN filters via\n+ * ICE_SW_LKUP_VLAN are based on the outer/single VLAN ID + VLAN TPID.\n+ *\n+ * For both modes add a VLAN 0 + no VLAN TPID filter to handle untagged traffic\n+ * when VLAN pruning is enabled. Also, this handles VLAN 0 priority tagged\n+ * traffic in SVM, since the VLAN TPID isn't part of filtering.\n+ *\n+ * If DVM is enabled then an explicit VLAN 0 + VLAN TPID filter needs to be\n+ * added to allow VLAN 0 priority tagged traffic in DVM, since the VLAN TPID is\n+ * part of filtering.\n+ */\n+static int\n+ice_vsi_add_vlan_zero(struct ice_vsi *vsi)\n+{\n+\tstruct ice_vlan vlan;\n+\tint err;\n+\n+\tvlan = ICE_VLAN(0, 0);\n+\terr = ice_add_vlan_filter(vsi, &vlan);\n+\tif (err) {\n+\t\tPMD_DRV_LOG(DEBUG, \"Failed to add VLAN ID 0\");\n+\t\treturn err;\n+\t}\n+\n+\t/* in SVM both VLAN 0 filters are identical */\n+\tif (!ice_is_dvm_ena(&vsi->adapter->hw))\n+\t\treturn 0;\n+\n+\tvlan = ICE_VLAN(RTE_ETHER_TYPE_VLAN, 0);\n+\terr = ice_add_vlan_filter(vsi, &vlan);\n+\tif (err) {\n+\t\tPMD_DRV_LOG(DEBUG, \"Failed to add VLAN ID 0 in double VLAN mode\");\n+\t\treturn err;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * Delete the VLAN 0 filters in the same manner that they were added in\n+ * ice_vsi_add_vlan_zero.\n+ */\n+static int\n+ice_vsi_del_vlan_zero(struct ice_vsi *vsi)\n+{\n+\tstruct ice_vlan vlan;\n+\tint err;\n+\n+\tvlan = ICE_VLAN(0, 0);\n+\terr = ice_remove_vlan_filter(vsi, &vlan);\n+\tif (err) {\n+\t\tPMD_DRV_LOG(DEBUG, \"Failed to remove VLAN ID 0\");\n+\t\treturn err;\n+\t}\n+\n+\t/* in SVM both VLAN 0 filters are identical */\n+\tif (!ice_is_dvm_ena(&vsi->adapter->hw))\n+\t\treturn 0;\n+\n+\tvlan = ICE_VLAN(RTE_ETHER_TYPE_VLAN, 0);\n+\terr = ice_remove_vlan_filter(vsi, &vlan);\n+\tif (err) {\n+\t\tPMD_DRV_LOG(DEBUG, \"Failed to remove VLAN ID 0 in double VLAN mode\");\n+\t\treturn err;\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* Configure vlan filter on or off */\n static int\n ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool on)\n@@ -3953,9 +4045,9 @@ ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool on)\n \n \t/* consist with other drivers, allow untagged packet when vlan filter on */\n \tif (on)\n-\t\tret = ice_add_vlan_filter(vsi, 0);\n+\t\tret = ice_vsi_add_vlan_zero(vsi);\n \telse\n-\t\tret = ice_remove_vlan_filter(vsi, 0);\n+\t\tret = ice_vsi_del_vlan_zero(vsi);\n \n \treturn 0;\n }\ndiff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h\nindex 7e9cbd2e9a..7a7a5d5bfb 100644\n--- a/drivers/net/ice/ice_ethdev.h\n+++ b/drivers/net/ice/ice_ethdev.h\n@@ -167,11 +167,19 @@ struct ice_mac_filter {\n \tstruct ice_mac_filter_info mac_info;\n };\n \n+struct ice_vlan {\n+\tuint16_t tpid;\n+\tuint16_t vid;\n+};\n+\n+#define ICE_VLAN(tpid, vid) \\\n+\t((struct ice_vlan){ tpid, vid })\n+\n /**\n  * VLAN filter structure\n  */\n struct ice_vlan_filter_info {\n-\tuint16_t vlan_id;\n+\tstruct ice_vlan vlan;\n };\n \n TAILQ_HEAD(ice_vlan_filter_list, ice_vlan_filter);\n",
    "prefixes": [
        "v2"
    ]
}