From patchwork Mon Nov 27 12:53:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 119700 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp241594qgn; Mon, 27 Nov 2017 05:08:37 -0800 (PST) X-Google-Smtp-Source: AGs4zMZEIz7AyZC2FvY7AKze2BEhsLpiI1rB7yn0W2WzQIGlt/rYRTt7MWne1wzqJufiprj7zbST X-Received: by 10.99.145.199 with SMTP id l190mr36645583pge.132.1511788117690; Mon, 27 Nov 2017 05:08:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511788117; cv=none; d=google.com; s=arc-20160816; b=j+NOeLHCRa+rrf4KLQiw4DdFcCAfT8vR271IAKBD6ccib/WRyGjJU8Z3XLNEvN+dgA SG19AQ7jf16e1ojZ4y0a0z+TpaFH5kwnjyTlzniGqWYnrBoExTrKCAXZoILD1fZVPsiW 3sDLhDb2WilAVR63hpyYwgW4SOpQVIxGMkjhLOTOFSx+4w7qDZnN5tWUxyu5tS4v/W5f rSMLKoNtHnx6QwTAI6u/jnoHTakg4UHgcqU08QduMkbirEiwj42NEKOpn5Z6bd/5NuEv l2YEfEEuVJa2oumIOCIyJQmQ4jSzHP3N0OaWx7BEKS2bSusIkeQTQt8noMSgqNQ9doNl Gw1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=n9j6tdPQ3scDBhKY/Sza9U9/nW8E91hUwx1qdrEZnuk=; b=TLAkZtFQKwswZ3kwHHtXcQ25pJ29Pbuj4y+gVFNyOX4zub6Rb8ZNBgeYMon+em3+io WYr3U1MiT3WTi3l0ZVu/Apnu6MCnVNDP0D5Bf5iEOs1FfW2SmprlrAn/mtYo/A+pArrh 7k0ImGBfsSzrQlbcK3k+ivlb5lU8/KbLpI1+izx8RtK3cQyW7SzwifIJMCUaFooKOKnV vUW0e6FY2Ly+BAiFjYKdts5sOoCDANERAsFL9k9DZSJ+5hF/VuWe4cBbsc4WUvd5LbuY 0ogC528k+xj962m+9WGclxP50j2Y15XDu0bog1+3zKb3HItQh0SS0X1diR+Rj5teu7Z8 OZNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QhTE7Ylh; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13si16025288pgo.335.2017.11.27.05.08.37; Mon, 27 Nov 2017 05:08:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QhTE7Ylh; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752475AbdK0NIg (ORCPT + 9 others); Mon, 27 Nov 2017 08:08:36 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:37708 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752327AbdK0Mxq (ORCPT ); Mon, 27 Nov 2017 07:53:46 -0500 Received: by mail-pf0-f193.google.com with SMTP id t69so17338676pfg.4 for ; Mon, 27 Nov 2017 04:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n9j6tdPQ3scDBhKY/Sza9U9/nW8E91hUwx1qdrEZnuk=; b=QhTE7YlhfOV/d3LLhkHBF2JfAN0lu32etzkV08epu8rjLh+0SUh6+NGhTQePk/WQ+j aMgZyiQI0a3gcgD28qtZCNH2Tx21It/Tyn8FtuyUQMb/uudrpJh1Jpr+nRMU2mwMMsDS HOKHu4n1lu+D/GIFr21PKpSn35r5crC1/9Dfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n9j6tdPQ3scDBhKY/Sza9U9/nW8E91hUwx1qdrEZnuk=; b=fMO5p92J0THnObpRG77caj1Yb8TimOWdU90yuIrgTsCY6UX8u8HtRwhW4oJSoMRgHd t76haAnGWrhG/dIcu2GSJq3uoyximc5jT4QG/oqA0P19G6G2BknuR6wov/9Us/iivVyq YtZk2IOMI4htKwGjLtbi69gH35uspfTywyrt+Z1CgN7CuDAFMybfnE+lu6MA2a0CUs2u ctLL4GBTgumkfX/8T4NqQoRSLrwmIVQcPD5GwLklimEOeD8DGFjB5Lk/ziBPi01dG9HW /xWe0tJDrl5eF13biSjaZc+QKfd5CCXssfAvxcUWh5fkY29XjUp2+DTyER/gr7zqFXLp F5Vw== X-Gm-Message-State: AJaThX5G9LGcwvmr5Ce8/Jfvks6J+TFvPyDj/i0gssMrnv39uVt+NZT/ dYylrVE7oi/O4faupj+rQJGNi71k0r4= X-Received: by 10.98.160.70 with SMTP id r67mr36547620pfe.153.1511787225491; Mon, 27 Nov 2017 04:53:45 -0800 (PST) Received: from localhost.localdomain ([106.51.17.194]) by smtp.gmail.com with ESMTPSA id i187sm51792658pfc.96.2017.11.27.04.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Nov 2017 04:53:44 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Benjamin Poirier , Sasha Neftin , Stable , Jeff Kirsher Subject: [PATCH for-4.14.y 1/5] e1000e: Fix error path in link detection Date: Mon, 27 Nov 2017 18:23:33 +0530 Message-Id: <1511787217-10987-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> References: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Benjamin Poirier commit c4c40e51f9c32c6dd8adf606624c930a1c4d9bbb upstream. In case of error from e1e_rphy(), the loop will exit early and "success" will be set to true erroneously. Signed-off-by: Benjamin Poirier Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Amit Pundir --- drivers/net/ethernet/intel/e1000e/phy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c index d78d47b41a71..86ff0969efb6 100644 --- a/drivers/net/ethernet/intel/e1000e/phy.c +++ b/drivers/net/ethernet/intel/e1000e/phy.c @@ -1744,6 +1744,7 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, s32 ret_val = 0; u16 i, phy_status; + *success = false; for (i = 0; i < iterations; i++) { /* Some PHYs require the MII_BMSR register to be read * twice due to the link bit being sticky. No harm doing @@ -1763,16 +1764,16 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, ret_val = e1e_rphy(hw, MII_BMSR, &phy_status); if (ret_val) break; - if (phy_status & BMSR_LSTATUS) + if (phy_status & BMSR_LSTATUS) { + *success = true; break; + } if (usec_interval >= 1000) msleep(usec_interval / 1000); else udelay(usec_interval); } - *success = (i < iterations); - return ret_val; } From patchwork Mon Nov 27 12:53:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 119699 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp240734qgn; Mon, 27 Nov 2017 05:08:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMaqSZ/cuCRc1FJZZtimCMtKV9FuWNncVaffcmx8Xra8+UyE1CVLNf6UwjEZNSPW2ojjDurD X-Received: by 10.98.82.3 with SMTP id g3mr37003847pfb.189.1511788083587; Mon, 27 Nov 2017 05:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511788083; cv=none; d=google.com; s=arc-20160816; b=tZW5zZZuqn3ADIprVFeB8vOX75NAauRR8HOzIJ94b0ek1D56HtIHoRlTfzt2tV1GGQ 4c28gtG/8WC40pTZNpS0lzSlMK90C1c07/Gr/vbOl8W0+650CV/fA2Xht0u/4EulT8R+ YxedwvxbZAwbnnAHeYemrYF8E+Ofbp2coW+ZORIXaxG/EflVNlU97mvlhknMWOJOWjd3 LYTMRg/ABJ6Wm4Q5tLYPRYX562EmD792C03Dsq0OCVFvwSHrHsJM912nDYDTB3139F84 bEC/rpe6jmUQ5apaGEk9x8uICO5GtuXKmWxgVmeAeLLldqdX+1gZNdbWLw40A62LjG0c EBmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MoYneZZK/xEg0zwwaqpKopAccKI2ZORma5krOQc8C8k=; b=VRTQa6AKH+NE5BKkB8+itvdyEhSZV088/XvMWkkqhueZVmPymDcizgr538BbEqKuQh vBGgH6klcH+iioghbevbVFdsGH5mpf8L7CKtKCkTmTQwg2Y2hWA/sHgG1sJWjPC5cWvE eigiBfsQgQlOQSomk4Qz8QSuTQKyG5772Yq3ZFkuHewm/ZHBMyVNUFA+Q1t1toMTF6Yn 5wPKW6EUIl9AIMJ4KVOiFcCJ6K51dMWd8GTi56X2ybLnxpavIgVz46YIkyrWBRKUIDXW LOubjVqE8Eo67fjGg9LXwx7QRF3jTbqmMXqzyeFo6JxVYeO8NItM3ZB/NzMh6g1dA71m v6ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XGE2Goqz; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si23013162pga.622.2017.11.27.05.08.03; Mon, 27 Nov 2017 05:08:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XGE2Goqz; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbdK0NIA (ORCPT + 9 others); Mon, 27 Nov 2017 08:08:00 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:45532 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbdK0Mxt (ORCPT ); Mon, 27 Nov 2017 07:53:49 -0500 Received: by mail-pg0-f66.google.com with SMTP id 207so18639746pgc.12 for ; Mon, 27 Nov 2017 04:53:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MoYneZZK/xEg0zwwaqpKopAccKI2ZORma5krOQc8C8k=; b=XGE2GoqzrEGwBzywMuAJ+7GFr4scHVIr/XsfepGO5eIcC8SxCfbekc0f7kAfbHtg5n ztw2cXIVAcvaYJKLnegcPZ9SCdaBerKy2uqpM9YFwm5Xy4v8xbGgX9qdjyswqBsTSt2y 4JzcAoD2y/oa4uRKc2qnJiXCAkaxIOPrNiHoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MoYneZZK/xEg0zwwaqpKopAccKI2ZORma5krOQc8C8k=; b=RYrrTzem9oQLEp7LjSeioFJrUWCkLdPTjmFrc+GhawNVHIVWE0WK3BM6D9Zbt23+Ny /fmlNkLsphfQUHL1FFSrItp6Z5JFZaYW9uWuzUKzZiCYXfYlOMf71rmfDTMZB79h63yF 3VhVKDI210k1rQgXPWeVM1TQJYDIco/VGWhUNu4V078LyNuXRMqPiwGHTxu+GXsYrDQn dk+NTM7Wqzqm33V9PU5WEZGW5INmnZlNeYVXbOO8fvCh5BOdKP5aa4cimPS4YjFdRTUo hQ2i6RBCOEuOQ1x0K5IOpfvgRXyxj9ga/ibA3rY5iVCg33kAArT8hPKws+E/NmBeIeyW TioA== X-Gm-Message-State: AJaThX4GaB6QFesBB21DkVC+otKlofTmHPOOLVztlPfjKqXWBPV7ewtf GezwujUDEx2sLMjp5xA9+0Hfcw== X-Received: by 10.98.30.198 with SMTP id e189mr22491523pfe.232.1511787228520; Mon, 27 Nov 2017 04:53:48 -0800 (PST) Received: from localhost.localdomain ([106.51.17.194]) by smtp.gmail.com with ESMTPSA id i187sm51792658pfc.96.2017.11.27.04.53.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Nov 2017 04:53:47 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Benjamin Poirier , Sasha Neftin , Stable , Jeff Kirsher Subject: [PATCH for-4.14.y 2/5] e1000e: Fix return value test Date: Mon, 27 Nov 2017 18:23:34 +0530 Message-Id: <1511787217-10987-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> References: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Benjamin Poirier commit d3509f8bc7b0560044c15f0e3ecfde1d9af757a6 upstream. All the helpers return -E1000_ERR_PHY. Signed-off-by: Benjamin Poirier Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Amit Pundir --- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 327dfe5bedc0..764a6bd958ac 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5099,7 +5099,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter) break; } - if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && + if ((ret_val == -E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && (er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { /* See e1000_kmrn_lock_loss_workaround_ich8lan() */ e_info("Gigabit has been disabled, downgrading speed\n"); From patchwork Mon Nov 27 12:53:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 119697 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp238991qgn; Mon, 27 Nov 2017 05:06:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMZHHZkwRIuKEMCwR874O9ghjz7pi0m1+0l+p5k6N+xidrdjvTOemNOqH33BqzttA9zLVYD4 X-Received: by 10.101.69.76 with SMTP id x12mr37162838pgr.284.1511788014929; Mon, 27 Nov 2017 05:06:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511788014; cv=none; d=google.com; s=arc-20160816; b=Y6M+iFrW3QtoXny0sHWSlMVUzj7L6LOMOHIIkrodBa39rdohAcdy3SDgj+oydsNQSD Zug+MxR3D0OqWR3W39rYzlg1bKkGDmRByYTtCxF7AeAmChu2fbkSylZd23Y61lOk/nlN eYx4H/NQ18uqaFkdrDeshnSu4NlJ1gcgIZpEo+2lskClRVQufgJlk1I87ixkJlyTJsYT kjU92aJ2dcdzl1YOAYnmEFjPkveKzttC0OBT1CHH6VtYNHFMDNxNe1C4vc30x4b+857o To/LUUUlGbsHO6k5jV5z8gthZaSxIB+anD2a3pa8RwbDsqldTMrUQZZtRD9UDvWbJcbU J0aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MKc1n8ZS+kEAshlU2knT7lz+dDP0vIpPr5FMb2GkavI=; b=ebOiKwkfp2AgsZ1pMZ98L5szSoMTs9fJ49ghDecATLNxWUdYm+g4PMMKGkzeRQ2DMO 1fxPCpaOAkGBPk2ipdcTuiiIu9W6J0VdiRTZhw6cauT6KeVkMlkC0NX/5hCrvd6Y5yem p7VbkFfJWCrvi/NLCpwFcnGgRIZE9K6619zomSlLIvZtbyYzH3so9rAUoXXh3oFvk5Vm p2UB4Zlo99DFq/MPvRyTw4vxQU8ORUcy9pvsKcCVj1FZDGcPB2utHWK/B5fhMl/rOrcE Il0j/ZoFMHqEVawkkb97ZfAZzV/TsnZEt6Og50sdWU0CKi2PPY8Z2nGNG5Po1sKs4Zm8 7JQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dgor6Sl5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si362610plx.33.2017.11.27.05.06.54; Mon, 27 Nov 2017 05:06:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dgor6Sl5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbdK0MyC (ORCPT + 9 others); Mon, 27 Nov 2017 07:54:02 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:44997 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752291AbdK0Mxw (ORCPT ); Mon, 27 Nov 2017 07:53:52 -0500 Received: by mail-pf0-f194.google.com with SMTP id r14so10813734pfl.11 for ; Mon, 27 Nov 2017 04:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MKc1n8ZS+kEAshlU2knT7lz+dDP0vIpPr5FMb2GkavI=; b=dgor6Sl5+n7GdJnmOvSGPuWSx/NyzXMl3qFv2EUmPdmIzO0ZbGu0D5Rgj8tm/SdSib cqMqAc9SRWMNtjdfoRLvpDPO/5ZurTvILwRUpB8rQfp0N0BcmmM6CIv5EkSmwaeh0m+G /DGe/RWX/53d+PS7t6FGW0s8+a940BBPA0Fvk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MKc1n8ZS+kEAshlU2knT7lz+dDP0vIpPr5FMb2GkavI=; b=kApo65HNWAsCSxZFbtwfe8lePr/0G4dTUrlhwYAkHOQTqVMPVGrvOHrHeOOoMjeE4U pyVTMAcIoScO/M+JXID4vf0AY4FeBgOjyhSa+rnwWi/+uEfHXwq22rtpzBEDuNpwo+b9 nZYYug/NTAjno1Glljo8W9ArDG4rYsEoFRIyMtJ+8EVPFY2J8rMTN009m+yy81zI16y7 eFys649cJJSr8kJcfQou+1Bg4MgJIFwGFC6lRgC7AjuKuKqSABX/nAj2a92W8DLliASX n2S9ETsDoVOyUJPxkXVNFWYEN/SMUXj2xFvacvrAMuEeOcpCZyzMUsuc2G+Jq+P/VlL5 adtg== X-Gm-Message-State: AJaThX5ObdHeAgQERapg5Zfdm1ZHDIBDf+U42Lf1aouQeXMYWk43seL2 BOY6E/ABkUeL0ZO14M/W8nYQyQ== X-Received: by 10.98.71.144 with SMTP id p16mr36266641pfi.15.1511787231564; Mon, 27 Nov 2017 04:53:51 -0800 (PST) Received: from localhost.localdomain ([106.51.17.194]) by smtp.gmail.com with ESMTPSA id i187sm51792658pfc.96.2017.11.27.04.53.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Nov 2017 04:53:50 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Benjamin Poirier , Sasha Neftin , Stable , Jeff Kirsher Subject: [PATCH for-4.14.y 3/5] e1000e: Separate signaling for link check/link up Date: Mon, 27 Nov 2017 18:23:35 +0530 Message-Id: <1511787217-10987-4-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> References: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Benjamin Poirier commit 19110cfbb34d4af0cdfe14cd243f3b09dc95b013 upstream. Lennart reported the following race condition: \ e1000_watchdog_task \ e1000e_has_link \ hw->mac.ops.check_for_link() === e1000e_check_for_copper_link /* link is up */ mac->get_link_status = false; /* interrupt */ \ e1000_msix_other hw->mac.get_link_status = true; link_active = !hw->mac.get_link_status /* link_active is false, wrongly */ This problem arises because the single flag get_link_status is used to signal two different states: link status needs checking and link status is down. Avoid the problem by using the return value of .check_for_link to signal the link status to e1000e_has_link(). Reported-by: Lennart Sorensen Signed-off-by: Benjamin Poirier Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Amit Pundir --- drivers/net/ethernet/intel/e1000e/mac.c | 11 ++++++++--- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c index b322011ec282..f457c5703d0c 100644 --- a/drivers/net/ethernet/intel/e1000e/mac.c +++ b/drivers/net/ethernet/intel/e1000e/mac.c @@ -410,6 +410,9 @@ void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw) * Checks to see of the link status of the hardware has changed. If a * change in link status has been detected, then we read the PHY registers * to get the current speed/duplex if link exists. + * + * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link + * up). **/ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) { @@ -423,7 +426,7 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) * Change or Rx Sequence Error interrupt. */ if (!mac->get_link_status) - return 0; + return 1; /* First we want to see if the MII Status Register reports * link. If so, then we want to get the current speed/duplex @@ -461,10 +464,12 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) * different link partner. */ ret_val = e1000e_config_fc_after_link_up(hw); - if (ret_val) + if (ret_val) { e_dbg("Error configuring flow control\n"); + return ret_val; + } - return ret_val; + return 1; } /** diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 764a6bd958ac..83071fe99323 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5081,7 +5081,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter) case e1000_media_type_copper: if (hw->mac.get_link_status) { ret_val = hw->mac.ops.check_for_link(hw); - link_active = !hw->mac.get_link_status; + link_active = ret_val > 0; } else { link_active = true; } From patchwork Mon Nov 27 12:53:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 119696 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp220836qgn; Mon, 27 Nov 2017 04:54:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMY6hJYHHZZwGmDmqGXDoqrsGJf2vPfFysurW+7CLLQ8c6CliGaRpeQutqFdEahIRiEOrSDv X-Received: by 10.101.64.71 with SMTP id h7mr25235414pgp.144.1511787243456; Mon, 27 Nov 2017 04:54:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511787243; cv=none; d=google.com; s=arc-20160816; b=OBD2kIKiyU7byUgBSOXa+YeSs4TFr7OY9ktpHogvO7rfbyIn5NZcUpuIkgamltxLnl jH/ZFz9zdiG7J/r8Z+kgNmfHdxDA+jqJVPH3kYjGbhSiBUBUp6pfuCTHi6M+uu6cPKUy tyNuptabRIuMqAQ+8tFOxaKDykpZzoqb6in+huvj5t13IX/KwF+xjO9dgl4G2cagD8pK 1wKdXKaF6TawZLVTchw8XEV5YqkPQ6U1vHHH/MHXvD+R0+abl0Khei+3XUwCQ5v86D7H q3rxyKo7R4YXLg6/JhfAfm1WAlFD8rpJrntc1Igh/4vZqLocF7CGDxeNbJPqarWVUmza Iqew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=uCVyQPms9afGojB1d+NXgUWjb9bPyZAoJYdHR62Ypos=; b=R4Ib6TetOEkTytY4CMt6v8+MvFZrkdhEkwPb/oe6T1oUD9uxFpn6kA789bAf65Zdiw Wbmp6sEJeyfX3KLemHGXcvB3EIqUjiBLLBG7viHFuLBmMBsVT4TjPx0s/5C9gary7tvG EqpWMIZuy00l58Xdd0VpspmaRPugnshvnajspi6b07mTDGkpVzYRuVejYUpIjKGiIh/6 8iwfklJz2wsbc13Rk3CJR0GWO/wApMRnn7Te/flaDzJPCl2AfeqLsHcmFjYYbi1oGPg+ LOxCd9iEBasl81rpzPL7blkLaannooIQKlweh6J+wsML5aD1D2J7vLkwuHG9AfIDauBM g2OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TNqoJ5ek; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si11333606pls.698.2017.11.27.04.54.03; Mon, 27 Nov 2017 04:54:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TNqoJ5ek; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752385AbdK0Mx6 (ORCPT + 9 others); Mon, 27 Nov 2017 07:53:58 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:41081 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752372AbdK0Mxz (ORCPT ); Mon, 27 Nov 2017 07:53:55 -0500 Received: by mail-pl0-f67.google.com with SMTP id u14so8424343plm.8 for ; Mon, 27 Nov 2017 04:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uCVyQPms9afGojB1d+NXgUWjb9bPyZAoJYdHR62Ypos=; b=TNqoJ5ekugFOd9LgtlS9sLvsqr4sHQ6Cwdnugdz1GuNU+K3a010tQ/UZksdyZ8zJcj ZfYp2z/skU7cVGMGYivHBkjZ0uqbSamXoAEsQnWq40hOsUGkv+ARa34JZpExYapGj/DL TOCQrIhoYDwJBftW6HUIupSkAsK9FomDhiCPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uCVyQPms9afGojB1d+NXgUWjb9bPyZAoJYdHR62Ypos=; b=FdnPyUhpoUetkfAUnuaMUYPZhfMgi8GQV2ejq6Fym7YwCyw+mawKFqXgJPwo52x82I 0CZtBB2GqW8OqirM2cnnNw3q6PlZccZu8v2IQK0GFYebFKi9dRYLRwHRqDdPrKOgJwqj lMNBC+OY1YUdURROG0O/RjhbT/b5xpTytLDB0/8eGb6wbjNQ82GQDdj1gLPu6jNsr6oD jbcEB86p8yGIuXq8G9B5Tw7HTRu7cRMj3sX7bJSuZFFeqczjHxAHbL4uEC1FKextmFJG ErjfbEjR7hi3xW+W9z3R+Tgo0UW/VaLKkJfaYVhTF1DcZpGCEhvWS6On1NbxCZmliS2/ 8CNg== X-Gm-Message-State: AJaThX7ivxVbDYqpwhG2FZcUFJ/0qkqfPAS+Opo+pFdOIYZTVg0gnugg JaszudpD0YX14C+FTg1mExR5TWLUyVM= X-Received: by 10.159.231.23 with SMTP id w23mr38948640plq.436.1511787234457; Mon, 27 Nov 2017 04:53:54 -0800 (PST) Received: from localhost.localdomain ([106.51.17.194]) by smtp.gmail.com with ESMTPSA id i187sm51792658pfc.96.2017.11.27.04.53.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Nov 2017 04:53:53 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Benjamin Poirier , Sasha Neftin , Stable , Jeff Kirsher Subject: [PATCH for-4.14.y 4/5] e1000e: Avoid receiver overrun interrupt bursts Date: Mon, 27 Nov 2017 18:23:36 +0530 Message-Id: <1511787217-10987-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> References: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Benjamin Poirier commit 4aea7a5c5e940c1723add439f4088844cd26196d upstream. When e1000e_poll() is not fast enough to keep up with incoming traffic, the adapter (when operating in msix mode) raises the Other interrupt to signal Receiver Overrun. This is a double problem because 1) at the moment e1000_msix_other() assumes that it is only called in case of Link Status Change and 2) if the condition persists, the interrupt is repeatedly raised again in quick succession. Ideally we would configure the Other interrupt to not be raised in case of receiver overrun but this doesn't seem possible on this adapter. Instead, we handle the first part of the problem by reverting to the practice of reading ICR in the other interrupt handler, like before commit 16ecba59bc33 ("e1000e: Do not read ICR in Other interrupt"). Thanks to commit 0a8047ac68e5 ("e1000e: Fix msi-x interrupt automask") which cleared IAME from CTRL_EXT, reading ICR doesn't interfere with RxQ0, TxQ0 interrupts anymore. We handle the second part of the problem by not re-enabling the Other interrupt right away when there is overrun. Instead, we wait until traffic subsides, napi polling mode is exited and interrupts are re-enabled. Reported-by: Lennart Sorensen Fixes: 16ecba59bc33 ("e1000e: Do not read ICR in Other interrupt") Signed-off-by: Benjamin Poirier Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Amit Pundir --- drivers/net/ethernet/intel/e1000e/defines.h | 1 + drivers/net/ethernet/intel/e1000e/netdev.c | 33 ++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h index 0641c0098738..afb7ebe20b24 100644 --- a/drivers/net/ethernet/intel/e1000e/defines.h +++ b/drivers/net/ethernet/intel/e1000e/defines.h @@ -398,6 +398,7 @@ #define E1000_ICR_LSC 0x00000004 /* Link Status Change */ #define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */ #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ +#define E1000_ICR_RXO 0x00000040 /* Receiver Overrun */ #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ #define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */ /* If this bit asserted, the driver should claim the interrupt */ diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 83071fe99323..99e5ef561f06 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -1910,14 +1910,30 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data) struct net_device *netdev = data; struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; + u32 icr; + bool enable = true; + + icr = er32(ICR); + if (icr & E1000_ICR_RXO) { + ew32(ICR, E1000_ICR_RXO); + enable = false; + /* napi poll will re-enable Other, make sure it runs */ + if (napi_schedule_prep(&adapter->napi)) { + adapter->total_rx_bytes = 0; + adapter->total_rx_packets = 0; + __napi_schedule(&adapter->napi); + } + } + if (icr & E1000_ICR_LSC) { + ew32(ICR, E1000_ICR_LSC); + hw->mac.get_link_status = true; + /* guard against interrupt when we're going down */ + if (!test_bit(__E1000_DOWN, &adapter->state)) + mod_timer(&adapter->watchdog_timer, jiffies + 1); + } - hw->mac.get_link_status = true; - - /* guard against interrupt when we're going down */ - if (!test_bit(__E1000_DOWN, &adapter->state)) { - mod_timer(&adapter->watchdog_timer, jiffies + 1); + if (enable && !test_bit(__E1000_DOWN, &adapter->state)) ew32(IMS, E1000_IMS_OTHER); - } return IRQ_HANDLED; } @@ -2687,7 +2703,8 @@ static int e1000e_poll(struct napi_struct *napi, int weight) napi_complete_done(napi, work_done); if (!test_bit(__E1000_DOWN, &adapter->state)) { if (adapter->msix_entries) - ew32(IMS, adapter->rx_ring->ims_val); + ew32(IMS, adapter->rx_ring->ims_val | + E1000_IMS_OTHER); else e1000_irq_enable(adapter); } @@ -4204,7 +4221,7 @@ static void e1000e_trigger_lsc(struct e1000_adapter *adapter) struct e1000_hw *hw = &adapter->hw; if (adapter->msix_entries) - ew32(ICS, E1000_ICS_OTHER); + ew32(ICS, E1000_ICS_LSC | E1000_ICS_OTHER); else ew32(ICS, E1000_ICS_LSC); } From patchwork Mon Nov 27 12:53:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 119698 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp239963qgn; Mon, 27 Nov 2017 05:07:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMZmgLocO2WHLwletx7tF6AajjLRWtJtdjwNuP2EwqZ5iLiNgYY/63Zl1rTx7xEpJfq5lAo6 X-Received: by 10.98.163.200 with SMTP id q69mr36080532pfl.21.1511788051733; Mon, 27 Nov 2017 05:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511788051; cv=none; d=google.com; s=arc-20160816; b=v9V1UpO+75Hpe5m5H8NzYco/0PO+nc7nHvIUhla6CiNVlN8AXIRrE9K4gzhcI6wNC1 czonKsC0Bri8oDtb5+EBWdpSias9Zt9p9Lu8KHvUSKhDMDiY9mXatfh6YFAJb/laN4Al VPkCeqx7JwStyfwZIQMKiDEmFhcSpZ3Abcn8xEEr/txQUY0N+iiFaXmAH/lSiKAXFNA2 4RFd9pNq1MWmueYpDxeRB23EXgyiffCMeW60oArQFXUIjD+8fZK053jy5SDJ2NE5p3ui lwYdop5gIDqxKf5ytTE4q3H96VjSg3pyu+6QqGbz6YhJJmYxAU6dYK7Oi9lY7ijKgQ42 CU4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=awdt1DfVn1228U/ID9G4pbA6CYN/RYjmEjQrRqsAyVM=; b=k2ebFYk35/Zz0vZoFaM81ugZWBZTvilpG3zFwRUq33O3XjV3mgVqzgj0q29MHljkJ5 mmMNd8VqK8T7Irmun6L6bXjuMXFvQNusbhe9OpH43t8G+114U9ZeumCDDn3E8+ZlRSoQ DNNWG4TEN9Mb2uxcArKtPK4IMszu7PEidH1FQx3h0QUnWIUNEV6ktbPvLPVS6P5wnOHM 9xpkQDXnS1LqGJfk7YkWEr63YrUDAzfE2FvC40KfCz4DOBrmmZwjBuCQBA9p4QrhGGzN +nTXIkch8fC26NYQQEAYQ9opvozGcstcOa0CzukimZM4ecG0mnTC9Vd2ZYyDTwNCidhN lxXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9wVNSsX; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67si6826703pla.648.2017.11.27.05.07.31; Mon, 27 Nov 2017 05:07:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9wVNSsX; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbdK0NH3 (ORCPT + 9 others); Mon, 27 Nov 2017 08:07:29 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:41618 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbdK0Mx6 (ORCPT ); Mon, 27 Nov 2017 07:53:58 -0500 Received: by mail-pg0-f66.google.com with SMTP id q7so6050748pgr.8 for ; Mon, 27 Nov 2017 04:53:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=awdt1DfVn1228U/ID9G4pbA6CYN/RYjmEjQrRqsAyVM=; b=N9wVNSsXI050RwXp7l0q2Ejce8d9WKfQeFfAuxsS8IAA/vmKuB8vcE5AvVu5agfniV qkHbm2MHm2terScn1YAufSsIy83hzZRTET7rt53DOJgi3PukiZjmwDJie4j3nlThapXx 8fCM//A6WCCqoS6jkD7UZpTPx9At+eeuH96b4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=awdt1DfVn1228U/ID9G4pbA6CYN/RYjmEjQrRqsAyVM=; b=Br2zDOMHrEjkSBjCIsUS5D4UhVk7DVTelnYkWa7HyPhHmsA2W+xgjFVDCTLiKSRgtd 0QxlHbqG/Qcl1gQ0RNDMMvmBEoIkeNBW1pVpX2TITOfxb/8TsQTYuzpgHy1wQA1GOsgh MF2smLEFxqv+bzPwDwpv7AwRpIn0cM8g8BBuNH21Wp/87cdEynczH3IH+jqsAY6k1x9K EhxUcy67Bb81221do5WlYZ39mohRwegG2P/+0bWcftl6VQH/63wDsMITX55LQT1EBeWC RISkSDZ97IxoD2pPGZogbW1yZQtVlLjV8zHy0isQKNiaSjohTnEkWDCf0L1h7V8oU767 YmtQ== X-Gm-Message-State: AJaThX5UN3jruDYxUuhlLKuTC+SmSpkGw9PvWGmk0vXUZyFihzYdl1jZ RWqI0UTVqpxo2Pa8qt+6944HDg== X-Received: by 10.101.81.68 with SMTP id g4mr3904203pgq.166.1511787237732; Mon, 27 Nov 2017 04:53:57 -0800 (PST) Received: from localhost.localdomain ([106.51.17.194]) by smtp.gmail.com with ESMTPSA id i187sm51792658pfc.96.2017.11.27.04.53.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Nov 2017 04:53:56 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Benjamin Poirier , Sasha Neftin , Stable , Jeff Kirsher Subject: [PATCH for-4.14.y 5/5] e1000e: fix buffer overrun while the I219 is processing DMA transactions Date: Mon, 27 Nov 2017 18:23:37 +0530 Message-Id: <1511787217-10987-6-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> References: <1511787217-10987-1-git-send-email-amit.pundir@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sasha Neftin commit b10effb92e272051dd1ec0d7be56bf9ca85ab927 upstream. IntelĀ® 100/200 Series Chipset platforms reduced the round-trip latency for the LAN Controller DMA accesses, causing in some high performance cases a buffer overrun while the I219 LAN Connected Device is processing the DMA transactions. I219LM and I219V devices can fall into unrecovered Tx hang under very stressfully UDP traffic and multiple reconnection of Ethernet cable. This Tx hang of the LAN Controller is only recovered if the system is rebooted. Slightly slow down DMA access by reducing the number of outstanding requests. This workaround could have an impact on TCP traffic performance on the platform. Disabling TSO eliminates performance loss for TCP traffic without a noticeable impact on CPU performance. Please, refer to I218/I219 specification update: https://www.intel.com/content/www/us/en/embedded/products/networking/ ethernet-connection-i218-family-documentation.html Signed-off-by: Sasha Neftin Reviewed-by: Dima Ruinskiy Reviewed-by: Raanan Avargil Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Amit Pundir --- drivers/net/ethernet/intel/e1000e/netdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 99e5ef561f06..c38b00c90f48 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -3021,8 +3021,8 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) hw->mac.ops.config_collision_dist(hw); - /* SPT and CNP Si errata workaround to avoid data corruption */ - if (hw->mac.type >= e1000_pch_spt) { + /* SPT and KBL Si errata workaround to avoid data corruption */ + if (hw->mac.type == e1000_pch_spt) { u32 reg_val; reg_val = er32(IOSFPC); @@ -3030,7 +3030,9 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) ew32(IOSFPC, reg_val); reg_val = er32(TARC(0)); - reg_val |= E1000_TARC0_CB_MULTIQ_3_REQ; + /* SPT and KBL Si errata workaround to avoid Tx hang */ + reg_val &= ~BIT(28); + reg_val |= BIT(29); ew32(TARC(0), reg_val); } }