Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/599726/?format=api
{ "id": 599726, "url": "http://patchwork.ozlabs.org/api/patches/599726/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160318231114.25773.46384.stgit@localhost6.localdomain6/", "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": "<20160318231114.25773.46384.stgit@localhost6.localdomain6>", "list_archive_url": null, "date": "2016-03-18T23:11:14", "name": "[1/2] ixgbe: consolidate the configuration of spoof checking", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "5ba68f8f54dfdbb24a802ae8eadd2b97604aa8f0", "submitter": { "id": 1670, "url": "http://patchwork.ozlabs.org/api/people/1670/?format=api", "name": "Tantilov, Emil S", "email": "emil.s.tantilov@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/20160318231114.25773.46384.stgit@localhost6.localdomain6/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/599726/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/599726/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.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" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ozlabs.org (Postfix) with ESMTP id 3qRgvq4t93z9s8g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 19 Mar 2016 10:11:35 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id EE98FA5CB4;\n\tFri, 18 Mar 2016 23:11:34 +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 0eLsBb9KsCAw; Fri, 18 Mar 2016 23:11:32 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id B4EC8A5C7C;\n\tFri, 18 Mar 2016 23:11:32 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id EB4201BF9E4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 18 Mar 2016 23:11:30 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id E7E55A5C9E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 18 Mar 2016 23:11:30 +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 a5UgkDGWIoW5 for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 18 Mar 2016 23:11:30 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 0FDE7A5C91\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 18 Mar 2016 23:11:30 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP; 18 Mar 2016 16:11:29 -0700", "from estantil-desk3.jf.intel.com (HELO localhost6.localdomain6)\n\t([134.134.3.186])\n\tby fmsmga002.fm.intel.com with ESMTP; 18 Mar 2016 16:11:31 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.24,357,1455004800\"; d=\"scan'208\";a=\"940510345\"", "From": "Emil Tantilov <emil.s.tantilov@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 18 Mar 2016 16:11:14 -0700", "Message-ID": "<20160318231114.25773.46384.stgit@localhost6.localdomain6>", "In-Reply-To": "<20160318225046.25773.35723.stgit@localhost6.localdomain6>", "References": "<20160318225046.25773.35723.stgit@localhost6.localdomain6>", "User-Agent": "StGit/0.17.1-4-g4a0c1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH 1/2] ixgbe: consolidate the configuration\n\tof spoof checking", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Consolidate the logic behind configuring spoof checking:\n\n- move the setting of the MAC, VLAN and Ethertype spoof checking into\nixgbe_ndo_set_vf_spoofchk().\n\n- change ixgbe_set_mac_anti_spoofing() to set MAC spoofing per VF similar\nto the VLAN and Ethertype functions - this allows us to call the helper\nfunctions in ixgbe_ndo_set_vf_spoofchk() for all spoof check types and\nonly disable MAC spoof checking when creating MACVLAN.\n\nSigned-off-by: Emil Tantilov <emil.s.tantilov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 40 ++++++---------------\n drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 2 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 30 ++--------------\n drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 44 +++++++++++++++--------\n 4 files changed, 43 insertions(+), 73 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c\nindex ee43a38..0a49337 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c\n@@ -3300,43 +3300,25 @@ wwn_prefix_err:\n /**\n * ixgbe_set_mac_anti_spoofing - Enable/Disable MAC anti-spoofing\n * @hw: pointer to hardware structure\n- * @enable: enable or disable switch for anti-spoofing\n- * @pf: Physical Function pool - do not enable anti-spoofing for the PF\n+ * @enable: enable or disable switch for MAC anti-spoofing\n+ * @vf: Virtual Function pool - VF Pool to set for MAC anti-spoofing\n *\n **/\n-void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf)\n+void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)\n {\n-\tint j;\n-\tint pf_target_reg = pf >> 3;\n-\tint pf_target_shift = pf % 8;\n-\tu32 pfvfspoof = 0;\n+\tint vf_target_reg = vf >> 3;\n+\tint vf_target_shift = vf % 8;\n+\tu32 pfvfspoof;\n \n \tif (hw->mac.type == ixgbe_mac_82598EB)\n \t\treturn;\n \n+\tpfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg));\n \tif (enable)\n-\t\tpfvfspoof = IXGBE_SPOOF_MACAS_MASK;\n-\n-\t/*\n-\t * PFVFSPOOF register array is size 8 with 8 bits assigned to\n-\t * MAC anti-spoof enables in each register array element.\n-\t */\n-\tfor (j = 0; j < pf_target_reg; j++)\n-\t\tIXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof);\n-\n-\t/*\n-\t * The PF should be allowed to spoof so that it can support\n-\t * emulation mode NICs. Do not set the bits assigned to the PF\n-\t */\n-\tpfvfspoof &= (1 << pf_target_shift) - 1;\n-\tIXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof);\n-\n-\t/*\n-\t * Remaining pools belong to the PF so they do not need to have\n-\t * anti-spoofing enabled.\n-\t */\n-\tfor (j++; j < IXGBE_PFVFSPOOF_REG_COUNT; j++)\n-\t\tIXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), 0);\n+\t\tpfvfspoof |= BIT(vf_target_shift);\n+\telse\n+\t\tpfvfspoof &= ~BIT(vf_target_shift);\n+\tIXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof);\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h\nindex 6f8e6a5..6d4c260 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h\n@@ -106,7 +106,7 @@ s32 prot_autoc_write_generic(struct ixgbe_hw *hw, u32 reg_val, bool locked);\n \n s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);\n s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);\n-void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf);\n+void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf);\n void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf);\n s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps);\n s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 59b43ce..2547ce2 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -3754,34 +3754,10 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)\n \n \tIXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);\n \n-\n-\t/* Enable MAC Anti-Spoofing */\n-\thw->mac.ops.set_mac_anti_spoofing(hw, (adapter->num_vfs != 0),\n-\t\t\t\t\t adapter->num_vfs);\n-\n-\t/* Ensure LLDP and FC is set for Ethertype Antispoofing if we will be\n-\t * calling set_ethertype_anti_spoofing for each VF in loop below\n-\t */\n-\tif (hw->mac.ops.set_ethertype_anti_spoofing) {\n-\t\tIXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_LLDP),\n-\t\t\t\t(IXGBE_ETQF_FILTER_EN |\n-\t\t\t\t IXGBE_ETQF_TX_ANTISPOOF |\n-\t\t\t\t IXGBE_ETH_P_LLDP));\n-\n-\t\tIXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_FC),\n-\t\t\t\t(IXGBE_ETQF_FILTER_EN |\n-\t\t\t\t IXGBE_ETQF_TX_ANTISPOOF |\n-\t\t\t\t ETH_P_PAUSE));\n-\t}\n-\n-\t/* For VFs that have spoof checking turned off */\n \tfor (i = 0; i < adapter->num_vfs; i++) {\n-\t\tif (!adapter->vfinfo[i].spoofchk_enabled)\n-\t\t\tixgbe_ndo_set_vf_spoofchk(adapter->netdev, i, false);\n-\n-\t\t/* enable ethertype anti spoofing if hw supports it */\n-\t\tif (hw->mac.ops.set_ethertype_anti_spoofing)\n-\t\t\thw->mac.ops.set_ethertype_anti_spoofing(hw, true, i);\n+\t\t/* configure spoof checking */\n+\t\tixgbe_ndo_set_vf_spoofchk(adapter->netdev, i,\n+\t\t\t\t\t adapter->vfinfo[i].spoofchk_enabled);\n \n \t\t/* Enable/Disable RSS query feature */\n \t\tixgbe_ndo_set_vf_rss_query_en(adapter->netdev, i,\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\nindex adcf000..cb8b51b 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n@@ -964,8 +964,11 @@ static int ixgbe_set_vf_macvlan_msg(struct ixgbe_adapter *adapter,\n \t\t * If the VF is allowed to set MAC filters then turn off\n \t\t * anti-spoofing to avoid false positives.\n \t\t */\n-\t\tif (adapter->vfinfo[vf].spoofchk_enabled)\n-\t\t\tixgbe_ndo_set_vf_spoofchk(adapter->netdev, vf, false);\n+\t\tif (adapter->vfinfo[vf].spoofchk_enabled) {\n+\t\t\tstruct ixgbe_hw *hw = &adapter->hw;\n+\n+\t\t\thw->mac.ops.set_mac_anti_spoofing(hw, false, vf);\n+\t\t}\n \t}\n \n \terr = ixgbe_set_vf_macvlan(adapter, vf, index, new_mac);\n@@ -1525,29 +1528,38 @@ int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,\n int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)\n {\n \tstruct ixgbe_adapter *adapter = netdev_priv(netdev);\n-\tint vf_target_reg = vf >> 3;\n-\tint vf_target_shift = vf % 8;\n \tstruct ixgbe_hw *hw = &adapter->hw;\n-\tu32 regval;\n \n \tif (vf >= adapter->num_vfs)\n \t\treturn -EINVAL;\n \n \tadapter->vfinfo[vf].spoofchk_enabled = setting;\n \n-\tregval = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg));\n-\tregval &= ~(1 << vf_target_shift);\n-\tregval |= (setting << vf_target_shift);\n-\tIXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), regval);\n-\n-\tif (adapter->vfinfo[vf].vlan_count) {\n-\t\tvf_target_shift += IXGBE_SPOOF_VLANAS_SHIFT;\n-\t\tregval = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg));\n-\t\tregval &= ~(1 << vf_target_shift);\n-\t\tregval |= (setting << vf_target_shift);\n-\t\tIXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), regval);\n+\t/* configure MAC spoofing */\n+\thw->mac.ops.set_mac_anti_spoofing(hw, setting, vf);\n+\n+\t/* configure VLAN spoofing */\n+\tif (adapter->vfinfo[vf].vlan_count)\n+\t\thw->mac.ops.set_vlan_anti_spoofing(hw, setting, vf);\n+\n+\t/* Ensure LLDP and FC is set for Ethertype Antispoofing if we will be\n+\t * calling set_ethertype_anti_spoofing for each VF in loop below\n+\t */\n+\tif (hw->mac.ops.set_ethertype_anti_spoofing) {\n+\t\tIXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_LLDP),\n+\t\t\t\t(IXGBE_ETQF_FILTER_EN |\n+\t\t\t\t IXGBE_ETQF_TX_ANTISPOOF |\n+\t\t\t\t IXGBE_ETH_P_LLDP));\n+\n+\t\tIXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_FC),\n+\t\t\t\t(IXGBE_ETQF_FILTER_EN |\n+\t\t\t\t IXGBE_ETQF_TX_ANTISPOOF |\n+\t\t\t\t ETH_P_PAUSE));\n+\n+\t\thw->mac.ops.set_ethertype_anti_spoofing(hw, setting, vf);\n \t}\n \n+\n \treturn 0;\n }\n \n", "prefixes": [ "1/2" ] }