Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/652868/?format=api
{ "id": 652868, "url": "http://patchwork.ozlabs.org/api/patches/652868/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1469557535-63429-2-git-send-email-jarod@redhat.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": "<1469557535-63429-2-git-send-email-jarod@redhat.com>", "list_archive_url": null, "date": "2016-07-26T18:25:34", "name": "[net-next,v3,1/2] e1000e: factor out systim sanitization", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e075c74106525db54c90a3f4f16388de1aaf66c9", "submitter": { "id": 1153, "url": "http://patchwork.ozlabs.org/api/people/1153/?format=api", "name": "Jarod Wilson", "email": "jarod@redhat.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/1469557535-63429-2-git-send-email-jarod@redhat.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/652868/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/652868/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rzRQ94hGSz9t18\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Jul 2016 04:25:53 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id D060A30EA7;\n\tTue, 26 Jul 2016 18:25:51 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id zrbDhxK4nHJA; Tue, 26 Jul 2016 18:25:49 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 85CD030CC4;\n\tTue, 26 Jul 2016 18:25:47 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 463D71C0DFE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 26 Jul 2016 18:25:46 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 42704862F0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 26 Jul 2016 18:25:46 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 1LmaN6PS7pbU for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 26 Jul 2016 18:25:45 +0000 (UTC)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 05D8186371\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 26 Jul 2016 18:25:44 +0000 (UTC)", "from int-mx11.intmail.prod.int.phx2.redhat.com\n\t(int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 3926A800B0;\n\tTue, 26 Jul 2016 18:25:44 +0000 (UTC)", "from hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com\n\t(hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com [10.16.184.47])\n\tby int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with\n\tESMTP id u6QIPge2006239; Tue, 26 Jul 2016 14:25:43 -0400" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": [ "domain auto-whitelisted by SQLgrey-1.7.6", "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]); Tue, 26 Jul 2016 18:25:44 +0000 (UTC)" ], "From": "Jarod Wilson <jarod@redhat.com>", "To": "linux-kernel@vger.kernel.org", "Date": "Tue, 26 Jul 2016 14:25:34 -0400", "Message-Id": "<1469557535-63429-2-git-send-email-jarod@redhat.com>", "In-Reply-To": "<1469557535-63429-1-git-send-email-jarod@redhat.com>", "References": "<1469292274-59237-1-git-send-email-jarod@redhat.com>\n\t<1469557535-63429-1-git-send-email-jarod@redhat.com>", "X-Scanned-By": "MIMEDefang 2.68 on 10.5.11.24", "Cc": "netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org", "Subject": "[Intel-wired-lan] [PATCH net-next v3 1/2] e1000e: factor out systim\n\tsanitization", "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>", "MIME-Version": "1.0", "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 is prepatory work for an expanding list of adapter families that have\noccasional ~10 hour clock jumps when being used for PTP. Factor out the\nsanitization function and convert to using a feature (bug) flag, per\nsuggestion from Jesse Brandeburg.\n\nLittering functional code with device-specific checks is much messier than\nsimply checking a flag, and having device-specific init set flags as needed.\nThere are probably a number of other cases in the e1000e code that\ncould/should be converted similarly.\n\nSuggested-by: Jesse Brandeburg <jesse.brandeburg@intel.com>\nCC: Jesse Brandeburg <jesse.brandeburg@intel.com>\nCC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>\nCC: intel-wired-lan@lists.osuosl.org\nCC: netdev@vger.kernel.org\nSigned-off-by: Jarod Wilson <jarod@redhat.com>\n---\n drivers/net/ethernet/intel/e1000e/82571.c | 6 ++-\n drivers/net/ethernet/intel/e1000e/e1000.h | 1 +\n drivers/net/ethernet/intel/e1000e/netdev.c | 66 ++++++++++++++++++------------\n 3 files changed, 44 insertions(+), 29 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c\nindex 7fd4d54..6b03c85 100644\n--- a/drivers/net/ethernet/intel/e1000e/82571.c\n+++ b/drivers/net/ethernet/intel/e1000e/82571.c\n@@ -2032,7 +2032,8 @@ const struct e1000_info e1000_82574_info = {\n \t\t\t\t | FLAG2_DISABLE_ASPM_L0S\n \t\t\t\t | FLAG2_DISABLE_ASPM_L1\n \t\t\t\t | FLAG2_NO_DISABLE_RX\n-\t\t\t\t | FLAG2_DMA_BURST,\n+\t\t\t\t | FLAG2_DMA_BURST\n+\t\t\t\t | FLAG2_CHECK_SYSTIM_OVERFLOW,\n \t.pba\t\t\t= 32,\n \t.max_hw_frame_size\t= DEFAULT_JUMBO,\n \t.get_variants\t\t= e1000_get_variants_82571,\n@@ -2053,7 +2054,8 @@ const struct e1000_info e1000_82583_info = {\n \t\t\t\t | FLAG_HAS_CTRLEXT_ON_LOAD,\n \t.flags2\t\t\t= FLAG2_DISABLE_ASPM_L0S\n \t\t\t\t | FLAG2_DISABLE_ASPM_L1\n-\t\t\t\t | FLAG2_NO_DISABLE_RX,\n+\t\t\t\t | FLAG2_NO_DISABLE_RX\n+\t\t\t\t | FLAG2_CHECK_SYSTIM_OVERFLOW,\n \t.pba\t\t\t= 32,\n \t.max_hw_frame_size\t= DEFAULT_JUMBO,\n \t.get_variants\t\t= e1000_get_variants_82571,\ndiff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h\nindex ef96cd1..879cca4 100644\n--- a/drivers/net/ethernet/intel/e1000e/e1000.h\n+++ b/drivers/net/ethernet/intel/e1000e/e1000.h\n@@ -452,6 +452,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);\n #define FLAG2_PCIM2PCI_ARBITER_WA BIT(11)\n #define FLAG2_DFLT_CRC_STRIPPING BIT(12)\n #define FLAG2_CHECK_RX_HWTSTAMP BIT(13)\n+#define FLAG2_CHECK_SYSTIM_OVERFLOW BIT(14)\n \n #define E1000_RX_DESC_PS(R, i)\t \\\n \t(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))\ndiff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c\nindex 41f32c0..1b2df11 100644\n--- a/drivers/net/ethernet/intel/e1000e/netdev.c\n+++ b/drivers/net/ethernet/intel/e1000e/netdev.c\n@@ -4303,6 +4303,42 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter)\n }\n \n /**\n+ * e1000e_sanitize_systim - sanitize raw cycle counter reads\n+ * @hw: pointer to the HW structure\n+ * @systim: cycle_t value read, sanitized and returned\n+ *\n+ * Errata for 82574/82583 possible bad bits read from SYSTIMH/L:\n+ * check to see that the time is incrementing at a reasonable\n+ * rate and is a multiple of incvalue.\n+ **/\n+static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)\n+{\n+\tu64 time_delta, rem, temp;\n+\tcycle_t systim_next;\n+\tu32 incvalue;\n+\tint i;\n+\n+\tincvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;\n+\tfor (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {\n+\t\t/* latch SYSTIMH on read of SYSTIML */\n+\t\tsystim_next = (cycle_t)er32(SYSTIML);\n+\t\tsystim_next |= (cycle_t)er32(SYSTIMH) << 32;\n+\n+\t\ttime_delta = systim_next - systim;\n+\t\ttemp = time_delta;\n+\t\t/* VMWare users have seen incvalue of zero, don't div / 0 */\n+\t\trem = incvalue ? do_div(temp, incvalue) : (time_delta != 0);\n+\n+\t\tsystim = systim_next;\n+\n+\t\tif ((time_delta < E1000_82574_SYSTIM_EPSILON) && (rem == 0))\n+\t\t\tbreak;\n+\t}\n+\n+\treturn systim;\n+}\n+\n+/**\n * e1000e_cyclecounter_read - read raw cycle counter (used by time counter)\n * @cc: cyclecounter structure\n **/\n@@ -4312,7 +4348,7 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)\n \t\t\t\t\t\t cc);\n \tstruct e1000_hw *hw = &adapter->hw;\n \tu32 systimel, systimeh;\n-\tcycle_t systim, systim_next;\n+\tcycle_t systim;\n \t/* SYSTIMH latching upon SYSTIML read does not work well.\n \t * This means that if SYSTIML overflows after we read it but before\n \t * we read SYSTIMH, the value of SYSTIMH has been incremented and we\n@@ -4335,33 +4371,9 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)\n \tsystim = (cycle_t)systimel;\n \tsystim |= (cycle_t)systimeh << 32;\n \n-\tif ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {\n-\t\tu64 time_delta, rem, temp;\n-\t\tu32 incvalue;\n-\t\tint i;\n-\n-\t\t/* errata for 82574/82583 possible bad bits read from SYSTIMH/L\n-\t\t * check to see that the time is incrementing at a reasonable\n-\t\t * rate and is a multiple of incvalue\n-\t\t */\n-\t\tincvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;\n-\t\tfor (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {\n-\t\t\t/* latch SYSTIMH on read of SYSTIML */\n-\t\t\tsystim_next = (cycle_t)er32(SYSTIML);\n-\t\t\tsystim_next |= (cycle_t)er32(SYSTIMH) << 32;\n-\n-\t\t\ttime_delta = systim_next - systim;\n-\t\t\ttemp = time_delta;\n-\t\t\t/* VMWare users have seen incvalue of zero, don't div / 0 */\n-\t\t\trem = incvalue ? do_div(temp, incvalue) : (time_delta != 0);\n-\n-\t\t\tsystim = systim_next;\n+\tif (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW)\n+\t\tsystim = e1000e_sanitize_systim(hw, systim);\n \n-\t\t\tif ((time_delta < E1000_82574_SYSTIM_EPSILON) &&\n-\t\t\t (rem == 0))\n-\t\t\t\tbreak;\n-\t\t}\n-\t}\n \treturn systim;\n }\n \n", "prefixes": [ "net-next", "v3", "1/2" ] }