Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/564185/?format=api
{ "id": 564185, "url": "http://patchwork.ozlabs.org/api/patches/564185/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160107071030.13648.82290.stgit@localhost.localdomain/", "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": "<20160107071030.13648.82290.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2016-01-07T07:10:30", "name": "[next,02/11] igb: Refactor VFTA configuration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "1e4d4b9942ebd54d134b848d200cf45ab20c3c4b", "submitter": { "id": 67293, "url": "http://patchwork.ozlabs.org/api/people/67293/?format=api", "name": "Alexander Duyck", "email": "aduyck@mirantis.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/20160107071030.13648.82290.stgit@localhost.localdomain/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/564185/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/564185/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 CAD781402F0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 7 Jan 2016 18:18:17 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 236E38B019;\n\tThu, 7 Jan 2016 07:18:17 +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 MQJbGEsWaQBT; Thu, 7 Jan 2016 07:18:16 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 76DBB8A006;\n\tThu, 7 Jan 2016 07:18:16 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id F3EB31C09CE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 7 Jan 2016 07:18:14 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id ECCD78A00F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 7 Jan 2016 07:18:14 +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 EZ8TXTNxduhB for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 7 Jan 2016 07:18:13 +0000 (UTC)", "from mail-pa0-f42.google.com (mail-pa0-f42.google.com\n\t[209.85.220.42])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id B2F1F8A006\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 7 Jan 2016 07:18:13 +0000 (UTC)", "by mail-pa0-f42.google.com with SMTP id qh10so1319432pab.2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 06 Jan 2016 23:18:13 -0800 (PST)", "from localhost.localdomain\n\t(static-50-53-29-36.bvtn.or.frontiernet.net. [50.53.29.36])\n\tby smtp.gmail.com with ESMTPSA id\n\te14sm149602120pap.24.2016.01.06.23.10.31\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 06 Jan 2016 23:10:31 -0800 (PST)" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mirantis.com header.i=@mirantis.com\n\theader.b=MNQDh+ao; dkim-atps=neutral", "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com;\n\ts=google; \n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-type:content-transfer-encoding;\n\tbh=sGP+l3AVC3R9+ZCMxNp67RSsEsc8HE4+BjG+39XJw7w=;\n\tb=MNQDh+ao+9EVfdgDNJGzA3yMI3E3zzmDMyXc/mAXz0xXeZn28iniMI2h9cZb+0C6Pd\n\tVqEacDv5PbIpKq698jVbVqaHlLa3a9/srdKVpcQmQTucx1UduuluzLlPUdgHhE8PBBJK\n\twh+g++xXRhuph/RhIPbYsch971DPjFKIlcYLo=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-type\n\t:content-transfer-encoding;\n\tbh=sGP+l3AVC3R9+ZCMxNp67RSsEsc8HE4+BjG+39XJw7w=;\n\tb=cusDDb4BQl+btPhNFKaD+xxzaJIHTV1T5H4lEGP+K3uC0/UzdCjSAZxAvuFlC8e2HC\n\taP1tN73FrwA09WKQmKxjqFJnmi7Sly2VUHL2q2Qs06JjsjmDbC217TUFsCXdeIARCipI\n\t3K3tMjAhU9zr23bIak8sv9HWcLkNGzTR7gIltWCgVqaNVI2X+sfVI0smIYzehgdGBpaY\n\t2FDxLxlG9e9ahkup0mofJYYxd8cT4pi0ZJFwwux0tNv5QQfwnzL1mHUTaKjHDzksjnZa\n\tdlwfjCqHZPjYrQBO6lNkYpOz4wvYXAaeSUQJhOuoCY4vap9PscGCxtCuFymaGXlAoSCH\n\trr1w==", "X-Gm-Message-State": "ALoCoQnzwMTlu7FjkqpOEZ0SKGfVy2DPN6hYVEScgDdt6cK93NIb9LtNj+jnACzylK2PNxhjN7ooKC/FFrTEN5TceIqbkpE4JA==", "X-Received": "by 10.66.232.170 with SMTP id\n\ttp10mr148874428pac.38.1452150632189; \n\tWed, 06 Jan 2016 23:10:32 -0800 (PST)", "From": "Alexander Duyck <aduyck@mirantis.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 06 Jan 2016 23:10:30 -0800", "Message-ID": "<20160107071030.13648.82290.stgit@localhost.localdomain>", "In-Reply-To": "<20160107070850.13648.21033.stgit@localhost.localdomain>", "References": "<20160107070850.13648.21033.stgit@localhost.localdomain>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [next PATCH 02/11] igb: Refactor VFTA\n\tconfiguration", "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": "This patch starts the clean-up process on the VFTA configuration.\nSpecifically in this patch I attempt to address and simplify several items\nwhile also updating the code to bring it more inline with what is already\nin ixgbe.\n\nSigned-off-by: Alexander Duyck <aduyck@mirantis.com>\n---\n drivers/net/ethernet/intel/igb/e1000_82575.c | 37 ++++++++-\n drivers/net/ethernet/intel/igb/e1000_hw.h | 2 -\n drivers/net/ethernet/intel/igb/e1000_mac.c | 102 ++++++++------------------\n drivers/net/ethernet/intel/igb/e1000_mac.h | 2 -\n 4 files changed, 67 insertions(+), 76 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c\nindex adb33e2a0137..fff50523b440 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_82575.c\n+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c\n@@ -34,6 +34,7 @@\n #include \"e1000_mac.h\"\n #include \"e1000_82575.h\"\n #include \"e1000_i210.h\"\n+#include \"igb.h\"\n \n static s32 igb_get_invariants_82575(struct e1000_hw *);\n static s32 igb_acquire_phy_82575(struct e1000_hw *);\n@@ -71,6 +72,32 @@ static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw);\n static const u16 e1000_82580_rxpbs_table[] = {\n \t36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140 };\n \n+/* Due to a hw errata, if the host tries to configure the VFTA register\n+ * while performing queries from the BMC or DMA, then the VFTA in some\n+ * cases won't be written.\n+ */\n+\n+/**\n+ * igb_write_vfta_i350 - Write value to VLAN filter table\n+ * @hw: pointer to the HW structure\n+ * @offset: register offset in VLAN filter table\n+ * @value: register value written to VLAN filter table\n+ *\n+ * Writes value at the given offset in the register array which stores\n+ * the VLAN filter table.\n+ **/\n+static void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)\n+{\n+\tstruct igb_adapter *adapter = hw->back;\n+\tint i;\n+\n+\tfor (i = 10; i--;)\n+\t\tarray_wr32(E1000_VFTA, offset, value);\n+\n+\twrfl();\n+\tadapter->shadow_vfta[offset] = value;\n+}\n+\n /**\n * igb_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO\n * @hw: pointer to the HW structure\n@@ -429,6 +456,11 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw)\n \t\tmac->ops.release_swfw_sync = igb_release_swfw_sync_82575;\n \t}\n \n+\tif ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))\n+\t\tmac->ops.write_vfta = igb_write_vfta_i350;\n+\telse\n+\t\tmac->ops.write_vfta = igb_write_vfta;\n+\n \t/* Set if part includes ASF firmware */\n \tmac->asf_firmware_present = true;\n \t/* Set if manageability features are enabled. */\n@@ -1517,10 +1549,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)\n \n \t/* Disabling VLAN filtering */\n \thw_dbg(\"Initializing the IEEE VLAN\\n\");\n-\tif ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))\n-\t\tigb_clear_vfta_i350(hw);\n-\telse\n-\t\tigb_clear_vfta(hw);\n+\tigb_clear_vfta(hw);\n \n \t/* Setup the receive address */\n \tigb_init_rx_addrs(hw, rar_count);\ndiff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h\nindex 4034207eb5cc..f0c416e21d2c 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_hw.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h\n@@ -325,7 +325,7 @@ struct e1000_mac_operations {\n \ts32 (*get_thermal_sensor_data)(struct e1000_hw *);\n \ts32 (*init_thermal_sensor_thresh)(struct e1000_hw *);\n #endif\n-\n+\tvoid (*write_vfta)(struct e1000_hw *, u32, u32);\n };\n \n struct e1000_phy_operations {\ndiff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c\nindex 2a88595f956c..97f6fae48d1d 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_mac.c\n+++ b/drivers/net/ethernet/intel/igb/e1000_mac.c\n@@ -92,10 +92,8 @@ void igb_clear_vfta(struct e1000_hw *hw)\n {\n \tu32 offset;\n \n-\tfor (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {\n-\t\tarray_wr32(E1000_VFTA, offset, 0);\n-\t\twrfl();\n-\t}\n+\tfor (offset = E1000_VLAN_FILTER_TBL_SIZE; offset--;)\n+\t\thw->mac.ops.write_vfta(hw, offset, 0);\n }\n \n /**\n@@ -107,54 +105,14 @@ void igb_clear_vfta(struct e1000_hw *hw)\n * Writes value at the given offset in the register array which stores\n * the VLAN filter table.\n **/\n-static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)\n+void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)\n {\n+\tstruct igb_adapter *adapter = hw->back;\n+\n \tarray_wr32(E1000_VFTA, offset, value);\n \twrfl();\n-}\n-\n-/* Due to a hw errata, if the host tries to configure the VFTA register\n- * while performing queries from the BMC or DMA, then the VFTA in some\n- * cases won't be written.\n- */\n-\n-/**\n- * igb_clear_vfta_i350 - Clear VLAN filter table\n- * @hw: pointer to the HW structure\n- *\n- * Clears the register array which contains the VLAN filter table by\n- * setting all the values to 0.\n- **/\n-void igb_clear_vfta_i350(struct e1000_hw *hw)\n-{\n-\tu32 offset;\n-\tint i;\n-\n-\tfor (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {\n-\t\tfor (i = 0; i < 10; i++)\n-\t\t\tarray_wr32(E1000_VFTA, offset, 0);\n-\n-\t\twrfl();\n-\t}\n-}\n-\n-/**\n- * igb_write_vfta_i350 - Write value to VLAN filter table\n- * @hw: pointer to the HW structure\n- * @offset: register offset in VLAN filter table\n- * @value: register value written to VLAN filter table\n- *\n- * Writes value at the given offset in the register array which stores\n- * the VLAN filter table.\n- **/\n-static void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)\n-{\n-\tint i;\n \n-\tfor (i = 0; i < 10; i++)\n-\t\tarray_wr32(E1000_VFTA, offset, value);\n-\n-\twrfl();\n+\tadapter->shadow_vfta[offset] = value;\n }\n \n /**\n@@ -185,38 +143,42 @@ void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)\n /**\n * igb_vfta_set - enable or disable vlan in VLAN filter table\n * @hw: pointer to the HW structure\n- * @vid: VLAN id to add or remove\n- * @add: if true add filter, if false remove\n+ * @vlan: VLAN id to add or remove\n+ * @vlan_on: if true add filter, if false remove\n *\n * Sets or clears a bit in the VLAN filter table array based on VLAN id\n * and if we are adding or removing the filter\n **/\n-s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add)\n+s32 igb_vfta_set(struct e1000_hw *hw, u32 vlan, bool vlan_on)\n {\n-\tu32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK;\n-\tu32 mask = 1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK);\n-\tu32 vfta;\n \tstruct igb_adapter *adapter = hw->back;\n-\ts32 ret_val = 0;\n+\tu32 regidx, vfta_delta, vfta;\n+\n+\tif (vlan > 4095)\n+\t\treturn E1000_ERR_PARAM;\n+\n+\t/* Part 1\n+\t * The VFTA is a bitstring made up of 128 32-bit registers\n+\t * that enable the particular VLAN id, much like the MTA:\n+\t * bits[11-5]: which register\n+\t * bits[4-0]: which bit in the register\n+\t */\n+\tregidx = vlan / 32;\n+\tvfta_delta = 1 << (vlan % 32);\n+\tvfta = adapter->shadow_vfta[regidx];\n \n-\tvfta = adapter->shadow_vfta[index];\n+\t/* vfta_delta represents the difference between the current value\n+\t * of vfta and the value we want in the register. Since the diff\n+\t * is an XOR mask we can just update vfta using an XOR.\n+\t */\n+\tvfta_delta &= vlan_on ? ~vfta : vfta;\n+\tvfta ^= vfta_delta;\n \n \t/* bit was set/cleared before we started */\n-\tif ((!!(vfta & mask)) == add) {\n-\t\tret_val = -E1000_ERR_CONFIG;\n-\t} else {\n-\t\tif (add)\n-\t\t\tvfta |= mask;\n-\t\telse\n-\t\t\tvfta &= ~mask;\n-\t}\n-\tif ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))\n-\t\tigb_write_vfta_i350(hw, index, vfta);\n-\telse\n-\t\tigb_write_vfta(hw, index, vfta);\n-\tadapter->shadow_vfta[index] = vfta;\n+\tif (vfta_delta)\n+\t\thw->mac.ops.write_vfta(hw, regidx, vfta);\n \n-\treturn ret_val;\n+\treturn 0;\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/igb/e1000_mac.h b/drivers/net/ethernet/intel/igb/e1000_mac.h\nindex ea24961b0d70..4fbb953012d0 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_mac.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_mac.h\n@@ -56,7 +56,7 @@ s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,\n \n void igb_clear_hw_cntrs_base(struct e1000_hw *hw);\n void igb_clear_vfta(struct e1000_hw *hw);\n-void igb_clear_vfta_i350(struct e1000_hw *hw);\n+void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);\n s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add);\n void igb_config_collision_dist(struct e1000_hw *hw);\n void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);\n", "prefixes": [ "next", "02/11" ] }