Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4199604ybi; Mon, 15 Jul 2019 05:26:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcid5lp4A65RuBKTAVHE3jyjnpIjvIDDn74dmw31GRPpTcCnDU9g6gjwwjvG26DQhGzlj8 X-Received: by 2002:a17:90a:2305:: with SMTP id f5mr30561997pje.128.1563193607857; Mon, 15 Jul 2019 05:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563193607; cv=none; d=google.com; s=arc-20160816; b=vw0YupxpQXgoVvpSiKgs7Q6g0u61cdYda9rp5OctWFPe8kBoSdbKf8crNos+a9iYHg TgpTZH5JpVmAMzc/g9CM+qnINv3+nqifL6M1YQlI9KWQStuD8sR/CpdNrxpAcJjoLTAQ 0MFGBskfc7PoDHE1vserM1FYrcryL5Ax8F+w12g1bUB6tOhqMqy89q77WarTBFZP2eor iEUB02bxCWtZ+DwnS8H0axsvA0qXQ+VrmYNKucWHTXL4GY1VMVZDQPa/rcyiW3GyGmr2 QZaAnqMk+snj0n8Wafo75vh+wEwVVQ+nRJZOO/rgQEg1IomWWW9Demc1CSlb2BAEPwwb 3IQw== 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; bh=9dbjqfV0I8NjxP9MfGv7ZOSrjTJ0H8DoyCnzhEfZCuk=; b=Oza7RileZcK/H8tuwmSNYGsXAOEwMjgn2n3EssHpebmc7/9JxH1RiV0rGH6GVZC02m VirXWm8zhiZnz4Eqheez0GPgtk0e1DxIVRNJ9wS+yQaQiA92zYIuHJ/xm3+7n/l0db+7 SxSvBlciv8j93Ri6x2vYIzE5cA71MFMqFImWjqNs+zJuL0OfBf3UgCTamvQi5iuxMifX zwS2VCVbhGMbAeyFbB/wSLhlAtrzOEaw7z64Zx0JhnSHQ/7X+jzm9a7Bx32eCmr3eMd8 fTHGMuu4LyyncNfZDlW0rtkIMmGUyCXHDOwkQitoixwQILz968xX1OrhhH+jn7qeMNwE l2nA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si15246445plb.41.2019.07.15.05.26.29; Mon, 15 Jul 2019 05:26:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729990AbfGOM0K (ORCPT + 99 others); Mon, 15 Jul 2019 08:26:10 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:46840 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728933AbfGOM0J (ORCPT ); Mon, 15 Jul 2019 08:26:09 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hn03R-0004qz-1F; Mon, 15 Jul 2019 12:26:05 +0000 From: Kai-Heng Feng To: jeffrey.t.kirsher@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: [PATCH v2] e1000e: Make speed detection on hotplugging cable more reliable Date: Mon, 15 Jul 2019 20:25:55 +0800 Message-Id: <20190715122555.11922-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190715084355.9962-1-kai.heng.feng@canonical.com> References: <20190715084355.9962-1-kai.heng.feng@canonical.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After hotplugging an 1Gbps ethernet cable with 1Gbps link partner, the MII_BMSR may report 10Mbps, renders the network rather slow. The issue has much lower fail rate after commit 59653e6497d1 ("e1000e: Make watchdog use delayed work"), which essentially introduces some delay before running the watchdog task. But there's still a chance that the hotplugging event and the queued watchdog task gets run at the same time, then the original issue can be observed once again. So let's use mod_delayed_work() to add a deterministic 1 second delay before running watchdog task, after an interrupt. Signed-off-by: Kai-Heng Feng --- drivers/net/ethernet/intel/e1000e/netdev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e4baa13b3cda..c83bf5349d53 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -1780,8 +1780,8 @@ static irqreturn_t e1000_intr_msi(int __always_unused irq, void *data) } /* guard against interrupt when we're going down */ if (!test_bit(__E1000_DOWN, &adapter->state)) - queue_delayed_work(adapter->e1000_workqueue, - &adapter->watchdog_task, 1); + mod_delayed_work(adapter->e1000_workqueue, + &adapter->watchdog_task, HZ); } /* Reset on uncorrectable ECC error */ @@ -1861,8 +1861,8 @@ static irqreturn_t e1000_intr(int __always_unused irq, void *data) } /* guard against interrupt when we're going down */ if (!test_bit(__E1000_DOWN, &adapter->state)) - queue_delayed_work(adapter->e1000_workqueue, - &adapter->watchdog_task, 1); + mod_delayed_work(adapter->e1000_workqueue, + &adapter->watchdog_task, HZ); } /* Reset on uncorrectable ECC error */ @@ -1907,8 +1907,8 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data) hw->mac.get_link_status = true; /* guard against interrupt when we're going down */ if (!test_bit(__E1000_DOWN, &adapter->state)) - queue_delayed_work(adapter->e1000_workqueue, - &adapter->watchdog_task, 1); + mod_delayed_work(adapter->e1000_workqueue, + &adapter->watchdog_task, HZ); } if (!test_bit(__E1000_DOWN, &adapter->state)) -- 2.17.1