Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96595/?format=api
http://patches.dpdk.org/api/patches/96595/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210803083817.1243796-17-wenjun1.wu@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": "<20210803083817.1243796-17-wenjun1.wu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210803083817.1243796-17-wenjun1.wu@intel.com", "date": "2021-08-03T08:38:11", "name": "[16/22] net/ice: fix VLAN strip for double VLAN", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "997cae54585e41113945a3c34c89e5c5d4660bfa", "submitter": { "id": 2083, "url": "http://patches.dpdk.org/api/people/2083/?format=api", "name": "Wenjun Wu", "email": "wenjun1.wu@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/20210803083817.1243796-17-wenjun1.wu@intel.com/mbox/", "series": [ { "id": 18158, "url": "http://patches.dpdk.org/api/series/18158/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18158", "date": "2021-08-03T08:37:55", "name": "backport feature support to DPDK 20.11", "version": 1, "mbox": "http://patches.dpdk.org/series/18158/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/96595/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/96595/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 AAFC1A0C41;\n\tTue, 3 Aug 2021 10:58:51 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7E38741216;\n\tTue, 3 Aug 2021 10:57:32 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 9B47A411D5\n for <dev@dpdk.org>; Tue, 3 Aug 2021 10:57:16 +0200 (CEST)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 03 Aug 2021 01:57:08 -0700", "from wuwenjun.sh.intel.com ([10.67.110.197])\n by fmsmga008.fm.intel.com with ESMTP; 03 Aug 2021 01:57:07 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10064\"; a=\"211764413\"", "E=Sophos;i=\"5.84,291,1620716400\"; d=\"scan'208\";a=\"211764413\"", "E=Sophos;i=\"5.84,291,1620716400\"; d=\"scan'208\";a=\"479396674\"" ], "X-ExtLoop1": "1", "From": "Wenjun Wu <wenjun1.wu@intel.com>", "To": "dev@dpdk.org", "Date": "Tue, 3 Aug 2021 16:38:11 +0800", "Message-Id": "<20210803083817.1243796-17-wenjun1.wu@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20210803083817.1243796-1-wenjun1.wu@intel.com>", "References": "<20210803083817.1243796-1-wenjun1.wu@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 16/22] net/ice: fix VLAN strip for double VLAN", "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": "From: Haiyue Wang <haiyue.wang@intel.com>\n\n[ upstream commit 8ac4307504bed19ce68b39bc2703975ee0b9ab81 ]\n\nVLAN strip was failing for double VLAN because of hardware\nconfiguration, resulting mbuf not having the vlan_tci information.\n\nAdjusted the strip setting according to current VLAN mode to fix the\nVLAN strip.\n\nFixes: 14e7a4b37b4f (\"net/ice/base: support configuring device in double VLAN mode\")\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\nAcked-by: Qiming Yang <qiming.yang@intel.com>\n---\n drivers/net/ice/ice_ethdev.c | 297 +++++++++++++++--------------------\n 1 file changed, 131 insertions(+), 166 deletions(-)", "diff": "diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c\nindex 9ce0280726..1d7e5ffbc4 100644\n--- a/drivers/net/ice/ice_ethdev.c\n+++ b/drivers/net/ice/ice_ethdev.c\n@@ -70,8 +70,6 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {\n \t\t.ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask },\n };\n \n-#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100\n-\n #define ICE_OS_DEFAULT_PKG_NAME\t\t\"ICE OS Default Package\"\n #define ICE_COMMS_PKG_NAME\t\t\t\"ICE COMMS Package\"\n #define ICE_MAX_RES_DESC_NUM 1024\n@@ -1119,127 +1117,6 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi)\n \treturn ret;\n }\n \n-static int\n-ice_vsi_config_qinq_insertion(struct ice_vsi *vsi, bool on)\n-{\n-\tstruct ice_hw *hw = ICE_VSI_TO_HW(vsi);\n-\tstruct ice_vsi_ctx ctxt;\n-\tuint8_t qinq_flags;\n-\tint ret = 0;\n-\n-\t/* Check if it has been already on or off */\n-\tif (vsi->info.valid_sections &\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) {\n-\t\tif (on) {\n-\t\t\tif ((vsi->info.outer_vlan_flags &\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) ==\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST)\n-\t\t\t\treturn 0; /* already on */\n-\t\t} else {\n-\t\t\tif (!(vsi->info.outer_vlan_flags &\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST))\n-\t\t\t\treturn 0; /* already off */\n-\t\t}\n-\t}\n-\n-\tif (on)\n-\t\tqinq_flags = ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST;\n-\telse\n-\t\tqinq_flags = 0;\n-\t/* clear global insertion and use per packet insertion */\n-\tvsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT);\n-\tvsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST);\n-\tvsi->info.outer_vlan_flags |= qinq_flags;\n-\t/* use default vlan type 0x8100 */\n-\tvsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M);\n-\tvsi->info.outer_vlan_flags |= ICE_DFLT_OUTER_TAG_TYPE <<\n-\t\t\t\t ICE_AQ_VSI_OUTER_TAG_TYPE_S;\n-\t(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));\n-\tctxt.info.valid_sections =\n-\t\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);\n-\tctxt.vsi_num = vsi->vsi_id;\n-\tret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n-\tif (ret) {\n-\t\tPMD_DRV_LOG(INFO,\n-\t\t\t \"Update VSI failed to %s qinq stripping\",\n-\t\t\t on ? \"enable\" : \"disable\");\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tvsi->info.valid_sections |=\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);\n-\n-\treturn ret;\n-}\n-\n-static int\n-ice_vsi_config_qinq_stripping(struct ice_vsi *vsi, bool on)\n-{\n-\tstruct ice_hw *hw = ICE_VSI_TO_HW(vsi);\n-\tstruct ice_vsi_ctx ctxt;\n-\tuint8_t qinq_flags;\n-\tint ret = 0;\n-\n-\t/* Check if it has been already on or off */\n-\tif (vsi->info.valid_sections &\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) {\n-\t\tif (on) {\n-\t\t\tif ((vsi->info.outer_vlan_flags &\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_EMODE_M) ==\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW)\n-\t\t\t\treturn 0; /* already on */\n-\t\t} else {\n-\t\t\tif ((vsi->info.outer_vlan_flags &\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_EMODE_M) ==\n-\t\t\t ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH)\n-\t\t\t\treturn 0; /* already off */\n-\t\t}\n-\t}\n-\n-\tif (on)\n-\t\tqinq_flags = ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW;\n-\telse\n-\t\tqinq_flags = ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH;\n-\tvsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M);\n-\tvsi->info.outer_vlan_flags |= qinq_flags;\n-\t/* use default vlan type 0x8100 */\n-\tvsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M);\n-\tvsi->info.outer_vlan_flags |= ICE_DFLT_OUTER_TAG_TYPE <<\n-\t\t\t\t ICE_AQ_VSI_OUTER_TAG_TYPE_S;\n-\t(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));\n-\tctxt.info.valid_sections =\n-\t\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);\n-\tctxt.vsi_num = vsi->vsi_id;\n-\tret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n-\tif (ret) {\n-\t\tPMD_DRV_LOG(INFO,\n-\t\t\t \"Update VSI failed to %s qinq stripping\",\n-\t\t\t on ? \"enable\" : \"disable\");\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tvsi->info.valid_sections |=\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);\n-\n-\treturn ret;\n-}\n-\n-static int\n-ice_vsi_config_double_vlan(struct ice_vsi *vsi, int on)\n-{\n-\tint ret;\n-\n-\tret = ice_vsi_config_qinq_stripping(vsi, on);\n-\tif (ret)\n-\t\tPMD_DRV_LOG(ERR, \"Fail to set qinq stripping - %d\", ret);\n-\n-\tret = ice_vsi_config_qinq_insertion(vsi, on);\n-\tif (ret)\n-\t\tPMD_DRV_LOG(ERR, \"Fail to set qinq insertion - %d\", ret);\n-\n-\treturn ret;\n-}\n-\n /* Enable IRQ0 */\n static void\n ice_pf_enable_irq0(struct ice_hw *hw)\n@@ -2226,9 +2103,6 @@ ice_dev_init(struct rte_eth_dev *dev)\n \n \tvsi = pf->main_vsi;\n \n-\t/* Disable double vlan by default */\n-\tice_vsi_config_double_vlan(vsi, false);\n-\n \tret = ice_aq_stop_lldp(hw, true, false, NULL);\n \tif (ret != ICE_SUCCESS)\n \t\tPMD_INIT_LOG(DEBUG, \"lldp has already stopped\\n\");\n@@ -4112,49 +3986,147 @@ ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool on)\n \treturn 0;\n }\n \n+/* Manage VLAN stripping for the VSI for Rx */\n static int\n-ice_vsi_config_vlan_stripping(struct ice_vsi *vsi, bool on)\n+ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)\n {\n \tstruct ice_hw *hw = ICE_VSI_TO_HW(vsi);\n \tstruct ice_vsi_ctx ctxt;\n-\tuint8_t vlan_flags;\n-\tint ret = 0;\n+\tenum ice_status status;\n+\tint err = 0;\n \n-\t/* Check if it has been already on or off */\n-\tif (vsi->info.valid_sections &\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID)) {\n-\t\tif (on) {\n-\t\t\tif ((vsi->info.inner_vlan_flags &\n-\t\t\t ICE_AQ_VSI_INNER_VLAN_EMODE_M) ==\n-\t\t\t ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH)\n-\t\t\t\treturn 0; /* already on */\n-\t\t} else {\n-\t\t\tif ((vsi->info.inner_vlan_flags &\n-\t\t\t ICE_AQ_VSI_INNER_VLAN_EMODE_M) ==\n-\t\t\t ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING)\n-\t\t\t\treturn 0; /* already off */\n-\t\t}\n-\t}\n+\t/* do not allow modifying VLAN stripping when a port VLAN is configured\n+\t * on this VSI\n+\t */\n+\tif (vsi->info.port_based_inner_vlan)\n+\t\treturn 0;\n \n-\tif (on)\n-\t\tvlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH;\n+\tmemset(&ctxt, 0, sizeof(ctxt));\n+\n+\tif (ena)\n+\t\t/* Strip VLAN tag from Rx packet and put it in the desc */\n+\t\tctxt.info.inner_vlan_flags =\n+\t\t\t\t\tICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH;\n \telse\n-\t\tvlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;\n-\tvsi->info.inner_vlan_flags &= ~(ICE_AQ_VSI_INNER_VLAN_EMODE_M);\n-\tvsi->info.inner_vlan_flags |= vlan_flags;\n-\t(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));\n+\t\t/* Disable stripping. Leave tag in packet */\n+\t\tctxt.info.inner_vlan_flags =\n+\t\t\t\t\tICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;\n+\n+\t/* Allow all packets untagged/tagged */\n+\tctxt.info.inner_vlan_flags |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;\n+\n+\tctxt.info.valid_sections = rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);\n+\n+\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tif (status) {\n+\t\tPMD_DRV_LOG(ERR, \"Update VSI failed to %s vlan stripping\",\n+\t\t\t ena ? \"enable\" : \"disable\");\n+\t\terr = -EIO;\n+\t} else {\n+\t\tvsi->info.inner_vlan_flags = ctxt.info.inner_vlan_flags;\n+\t}\n+\n+\treturn err;\n+}\n+\n+static int\n+ice_vsi_ena_inner_stripping(struct ice_vsi *vsi)\n+{\n+\treturn ice_vsi_manage_vlan_stripping(vsi, true);\n+}\n+\n+static int\n+ice_vsi_dis_inner_stripping(struct ice_vsi *vsi)\n+{\n+\treturn ice_vsi_manage_vlan_stripping(vsi, false);\n+}\n+\n+static int ice_vsi_ena_outer_stripping(struct ice_vsi *vsi)\n+{\n+\tstruct ice_hw *hw = ICE_VSI_TO_HW(vsi);\n+\tstruct ice_vsi_ctx ctxt;\n+\tenum ice_status status;\n+\tint err = 0;\n+\n+\t/* do not allow modifying VLAN stripping when a port VLAN is configured\n+\t * on this VSI\n+\t */\n+\tif (vsi->info.port_based_outer_vlan)\n+\t\treturn 0;\n+\n+\tmemset(&ctxt, 0, sizeof(ctxt));\n+\n \tctxt.info.valid_sections =\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);\n-\tctxt.vsi_num = vsi->vsi_id;\n-\tret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n-\tif (ret) {\n-\t\tPMD_DRV_LOG(INFO, \"Update VSI failed to %s vlan stripping\",\n-\t\t\t on ? \"enable\" : \"disable\");\n-\t\treturn -EINVAL;\n+\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);\n+\t/* clear current outer VLAN strip settings */\n+\tctxt.info.outer_vlan_flags = vsi->info.outer_vlan_flags &\n+\t\t~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M | ICE_AQ_VSI_OUTER_TAG_TYPE_M);\n+\tctxt.info.outer_vlan_flags |=\n+\t\t(ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH <<\n+\t\t ICE_AQ_VSI_OUTER_VLAN_EMODE_S) |\n+\t\t(ICE_AQ_VSI_OUTER_TAG_VLAN_8100 <<\n+\t\t ICE_AQ_VSI_OUTER_TAG_TYPE_S);\n+\n+\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tif (status) {\n+\t\tPMD_DRV_LOG(ERR, \"Update VSI failed to enable outer VLAN stripping\");\n+\t\terr = -EIO;\n+\t} else {\n+\t\tvsi->info.outer_vlan_flags = ctxt.info.outer_vlan_flags;\n \t}\n \n-\tvsi->info.valid_sections |=\n-\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID);\n+\treturn err;\n+}\n+\n+static int\n+ice_vsi_dis_outer_stripping(struct ice_vsi *vsi)\n+{\n+\tstruct ice_hw *hw = ICE_VSI_TO_HW(vsi);\n+\tstruct ice_vsi_ctx ctxt;\n+\tenum ice_status status;\n+\tint err = 0;\n+\n+\tif (vsi->info.port_based_outer_vlan)\n+\t\treturn 0;\n+\n+\tmemset(&ctxt, 0, sizeof(ctxt));\n+\n+\tctxt.info.valid_sections =\n+\t\trte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID);\n+\t/* clear current outer VLAN strip settings */\n+\tctxt.info.outer_vlan_flags = vsi->info.outer_vlan_flags &\n+\t\t~ICE_AQ_VSI_OUTER_VLAN_EMODE_M;\n+\tctxt.info.outer_vlan_flags |= ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING <<\n+\t\tICE_AQ_VSI_OUTER_VLAN_EMODE_S;\n+\n+\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tif (status) {\n+\t\tPMD_DRV_LOG(ERR, \"Update VSI failed to disable outer VLAN stripping\");\n+\t\terr = -EIO;\n+\t} else {\n+\t\tvsi->info.outer_vlan_flags = ctxt.info.outer_vlan_flags;\n+\t}\n+\n+\treturn err;\n+}\n+\n+static int\n+ice_vsi_config_vlan_stripping(struct ice_vsi *vsi, bool ena)\n+{\n+\tstruct ice_hw *hw = ICE_VSI_TO_HW(vsi);\n+\tint ret;\n+\n+\tif (ice_is_dvm_ena(hw)) {\n+\t\tif (ena)\n+\t\t\tret = ice_vsi_ena_outer_stripping(vsi);\n+\t\telse\n+\t\t\tret = ice_vsi_dis_outer_stripping(vsi);\n+\t} else {\n+\t\tif (ena)\n+\t\t\tret = ice_vsi_ena_inner_stripping(vsi);\n+\t\telse\n+\t\t\tret = ice_vsi_dis_inner_stripping(vsi);\n+\t}\n \n \treturn ret;\n }\n@@ -4181,13 +4153,6 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)\n \t\t\tice_vsi_config_vlan_stripping(vsi, false);\n \t}\n \n-\tif (mask & ETH_VLAN_EXTEND_MASK) {\n-\t\tif (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)\n-\t\t\tice_vsi_config_double_vlan(vsi, true);\n-\t\telse\n-\t\t\tice_vsi_config_double_vlan(vsi, false);\n-\t}\n-\n \treturn 0;\n }\n \n", "prefixes": [ "16/22" ] }{ "id": 96595, "url": "