Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1227510/?format=api
{ "id": 1227510, "url": "http://patchwork.ozlabs.org/api/patches/1227510/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200122152138.41585-1-anthony.l.nguyen@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20200122152138.41585-1-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2020-01-22T15:21:24", "name": "[S38,01/15] ice: Add initial support for QinQ", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f4302db6faf185db98810abf3d2a0181645975b2", "submitter": { "id": 68875, "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api", "name": "Tony Nguyen", "email": "anthony.l.nguyen@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200122152138.41585-1-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 154777, "url": "http://patchwork.ozlabs.org/api/series/154777/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=154777", "date": "2020-01-22T15:21:26", "name": "[S38,01/15] ice: Add initial support for QinQ", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/154777/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1227510/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1227510/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.138;\n\thelo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4832Ls64Hmz9sR0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 23 Jan 2020 10:54:29 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 612EC86ED5;\n\tWed, 22 Jan 2020 23:54:28 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id QV5eDNzX1DbV; Wed, 22 Jan 2020 23:54:25 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 07D4781EAA;\n\tWed, 22 Jan 2020 23:54:25 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5565E1BF977\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:23 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 4B71C834A3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:23 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id hUoZP8xLHv2o for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:22 +0000 (UTC)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 586A181A29\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 22 Jan 2020 23:54:22 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t22 Jan 2020 15:54:21 -0800", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga002.fm.intel.com with ESMTP; 22 Jan 2020 15:54:21 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.70,351,1574150400\"; d=\"scan'208\";a=\"259651609\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 22 Jan 2020 07:21:24 -0800", "Message-Id": "<20200122152138.41585-1-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S38 01/15] ice: Add initial support for\n\tQinQ", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Brett Creeley <brett.creeley@intel.com>\n\nAllow support for S-Tag + C-Tag VLAN traffic by disabling pruning when\nthere are no 0x8100 VLAN interfaces currently created on top of the PF.\nWhen an 0x8100 VLAN interface is configured, enable pruning and only\nsupport single and double C-Tag VLAN traffic. If all of the 0x8100\ninterfaces that were created on top of the PF are removed via\nethtool -K <iface> rx-vlan-filter off or via ip tools, then disable\npruning and allow S-Tag + C-Tag traffic again.\n\nAdd VLAN 0 filter by default for the PF. This is because a bridge\nsets the default_pvid to 1, sends the request down to\nice_vlan_rx_add_vid(), and we never get the request to add VLAN 0 via\nthe 8021q module which causes all untagged traffic to be dropped.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_lib.c | 43 +++++++++++++++++--\n drivers/net/ethernet/intel/ice/ice_lib.h | 2 +\n drivers/net/ethernet/intel/ice/ice_main.c | 21 ++++++---\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 14 +++---\n 4 files changed, 63 insertions(+), 17 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 3c9353d7b0ed..3d851ac489cf 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -1383,7 +1383,9 @@ int ice_vsi_add_vlan(struct ice_vsi *vsi, u16 vid)\n \tlist_add(&tmp->list_entry, &tmp_add_list);\n \n \tstatus = ice_add_vlan(&pf->hw, &tmp_add_list);\n-\tif (status) {\n+\tif (!status) {\n+\t\tvsi->num_vlan++;\n+\t} else {\n \t\terr = -ENODEV;\n \t\tdev_err(dev, \"Failure Adding VLAN %d on VSI %i\\n\", vid,\n \t\t\tvsi->vsi_num);\n@@ -1425,10 +1427,12 @@ int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)\n \tlist_add(&list->list_entry, &tmp_add_list);\n \n \tstatus = ice_remove_vlan(&pf->hw, &tmp_add_list);\n-\tif (status == ICE_ERR_DOES_NOT_EXIST) {\n+\tif (!status) {\n+\t\tvsi->num_vlan--;\n+\t} else if (status == ICE_ERR_DOES_NOT_EXIST) {\n \t\tdev_dbg(dev, \"Failed to remove VLAN %d on VSI %i, it does not exist, status: %d\\n\",\n \t\t\tvid, vsi->vsi_num, status);\n-\t} else if (status) {\n+\t} else {\n \t\tdev_err(dev, \"Error removing VLAN %d on vsi %i error: %d\\n\",\n \t\t\tvid, vsi->vsi_num, status);\n \t\terr = -EIO;\n@@ -1790,6 +1794,26 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi)\n \treturn ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings);\n }\n \n+/**\n+ * ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not\n+ * @vsi: VSI to check whether or not VLAN pruning is enabled.\n+ *\n+ * returns true if Rx VLAN pruning and Tx VLAN anti-spoof is enabled and false\n+ * otherwise.\n+ */\n+bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi)\n+{\n+\tu8 rx_pruning = ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\tu8 tx_pruning = ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n+\t\tICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;\n+\n+\tif (!vsi)\n+\t\treturn false;\n+\n+\treturn ((vsi->info.sw_flags2 & rx_pruning) &&\n+\t\t(vsi->info.sec_flags & tx_pruning));\n+}\n+\n /**\n * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI\n * @vsi: VSI to enable or disable VLAN pruning on\n@@ -2060,6 +2084,17 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,\n \t\tif (ret)\n \t\t\tgoto unroll_vector_base;\n \n+\t\t/* Always add VLAN ID 0 switch rule by default. This is needed\n+\t\t * in order to allow all untagged and 0 tagged priority traffic\n+\t\t * if Rx VLAN pruning is enabled. Also there are cases where we\n+\t\t * don't get the call to add VLAN 0 via ice_vlan_rx_add_vid()\n+\t\t * so this handles those cases (i.e. adding the PF to a bridge\n+\t\t * without the 8021q module loaded).\n+\t\t */\n+\t\tret = ice_vsi_add_vlan(vsi, 0);\n+\t\tif (ret)\n+\t\t\tgoto unroll_clear_rings;\n+\n \t\tice_vsi_map_rings_to_vectors(vsi);\n \n \t\t/* Do not exit if configuring RSS had an issue, at least\n@@ -2139,6 +2174,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,\n \n \treturn vsi;\n \n+unroll_clear_rings:\n+\tice_vsi_clear_rings(vsi);\n unroll_vector_base:\n \t/* reclaim SW interrupts back to the common pool */\n \tice_free_res(pf->irq_tracker, vsi->base_vector, vsi->idx);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex 002fdbdade4f..b1e131c44e52 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -44,6 +44,8 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi);\n \n int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi);\n \n+bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi);\n+\n int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc);\n \n void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 1bf6d21c38e4..4f20add0c5e3 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -2467,16 +2467,19 @@ ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto,\n \tif (vsi->info.pvid)\n \t\treturn -EINVAL;\n \n-\t/* Enable VLAN pruning when VLAN 0 is added */\n-\tif (unlikely(!vid)) {\n+\t/* VLAN 0 is added by default during load/reset */\n+\tif (!vid)\n+\t\treturn 0;\n+\n+\t/* Enable VLAN pruning when a VLAN other than 0 is added */\n+\tif (!ice_vsi_is_vlan_pruning_ena(vsi)) {\n \t\tret = ice_cfg_vlan_pruning(vsi, true, false);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n \n-\t/* Add all VLAN IDs including 0 to the switch filter. VLAN ID 0 is\n-\t * needed to continue allowing all untagged packets since VLAN prune\n-\t * list is applied to all packets by the switch\n+\t/* Add a switch rule for this VLAN ID so its corresponding VLAN tagged\n+\t * packets aren't pruned by the device's internal switch on Rx\n \t */\n \tret = ice_vsi_add_vlan(vsi, vid);\n \tif (!ret) {\n@@ -2506,6 +2509,10 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,\n \tif (vsi->info.pvid)\n \t\treturn -EINVAL;\n \n+\t/* don't allow removal of VLAN 0 */\n+\tif (!vid)\n+\t\treturn 0;\n+\n \t/* Make sure ice_vsi_kill_vlan is successful before updating VLAN\n \t * information\n \t */\n@@ -2513,8 +2520,8 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Disable VLAN pruning when VLAN 0 is removed */\n-\tif (unlikely(!vid))\n+\t/* Disable pruning when VLAN 0 is the only VLAN rule */\n+\tif (vsi->num_vlan == 1 && ice_vsi_is_vlan_pruning_ena(vsi))\n \t\tret = ice_cfg_vlan_pruning(vsi, false, false);\n \n \tvsi->vlan_ena = false;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex 1874bfa65796..8230a58a9b19 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -2843,9 +2843,9 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)\n \t\t\t\tgoto error_param;\n \t\t\t}\n \n-\t\t\tvsi->num_vlan++;\n-\t\t\t/* Enable VLAN pruning when VLAN is added */\n-\t\t\tif (!vlan_promisc) {\n+\t\t\t/* Enable VLAN pruning when non-zero VLAN is added */\n+\t\t\tif (!vlan_promisc && vid &&\n+\t\t\t !ice_vsi_is_vlan_pruning_ena(vsi)) {\n \t\t\t\tstatus = ice_cfg_vlan_pruning(vsi, true, false);\n \t\t\t\tif (status) {\n \t\t\t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n@@ -2853,7 +2853,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)\n \t\t\t\t\t\tvid, status);\n \t\t\t\t\tgoto error_param;\n \t\t\t\t}\n-\t\t\t} else {\n+\t\t\t} else if (vlan_promisc) {\n \t\t\t\t/* Enable Ucast/Mcast VLAN promiscuous mode */\n \t\t\t\tpromisc_m = ICE_PROMISC_VLAN_TX |\n \t\t\t\t\t ICE_PROMISC_VLAN_RX;\n@@ -2897,9 +2897,9 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)\n \t\t\t\tgoto error_param;\n \t\t\t}\n \n-\t\t\tvsi->num_vlan--;\n-\t\t\t/* Disable VLAN pruning when the last VLAN is removed */\n-\t\t\tif (!vsi->num_vlan)\n+\t\t\t/* Disable VLAN pruning when only VLAN 0 is left */\n+\t\t\tif (vsi->num_vlan == 1 &&\n+\t\t\t ice_vsi_is_vlan_pruning_ena(vsi))\n \t\t\t\tice_cfg_vlan_pruning(vsi, false, false);\n \n \t\t\t/* Disable Unicast/Multicast VLAN promiscuous mode */\n", "prefixes": [ "S38", "01/15" ] }