Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3970034ybi; Mon, 15 Jul 2019 01:46:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWcr1hB8K3ZIoVD9Pj5S9Io4eO04FKymiz7pqXFduwwVgYgJ3B7oB9tNx16i0kSYOT5fid X-Received: by 2002:a63:4e5f:: with SMTP id o31mr26217842pgl.49.1563180413229; Mon, 15 Jul 2019 01:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563180413; cv=none; d=google.com; s=arc-20160816; b=fNAZDVtzDoMxV3R/oBYjNZrF8o/+jy85mkHmtnqHXF8csivUN7PLivEqamd+vN0rRd YNbKD2XRxzoQ3GNVb/s7qlFVhHnal/6ijonto3ILi+NBJ+SFzOZ/Ox67GMHO3cil14Nq L2zw5YF7PFOMR+tDwcIyxLgC2HEoGxh8P+uhqbyNo3Otr3ES/sxyEk2g3K1HbEwbbRh0 Yqd/sHXy/Q2cvNPZN4cekWiWvloMTjQEX0X1R2LyA5oKyHJL839fmsRPCyc28t3Rw4WN mHgOt+jTF8UUfQ/B9qvIsmLfq0KMF/US4kQgebUjaN65khsZ8kaGJrkh6j2lE6iKih4r ncAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=5F84PSt9LHudl40W6z1KnxSZFDRFkI6WMVykQjvtD3M=; b=0bcj+kmQL9BsILF3if2t+Qhx7P9YsOKnvdM3DfODXuh3nXMQMTtwQuu1G6bYxthKcj bd9DsIKxdCxLi7OQlB4P+i0Fni+8HA9Wm5Ef/uNVrYCJA6OEE2eZapCM3QNhBg8ZKcMZ AKW7UP/2EREvWd1NQ5ItiUcGp//dgr/rR1s+UYP8luXCJQ+dWWeqPqqLlGQuNE+7ICuF i79zALKI7TzvZZoqgdQy3ZGXjA5Qrtf8QWIZh5DTkW4bq9qEIdR6l/jQSI2HUva0JUDu cBADcvplk6RWuxbHT3x3blmH3N+KFpqBUFMITi4TVM7tz+EGmKB6UUy+gwATK1FXjCNM 57qQ== 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 y187si16109799pgb.480.2019.07.15.01.46.34; Mon, 15 Jul 2019 01:46:53 -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 S1729498AbfGOIoF (ORCPT + 99 others); Mon, 15 Jul 2019 04:44:05 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:42510 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729207AbfGOIoF (ORCPT ); Mon, 15 Jul 2019 04:44:05 -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 1hmwaW-0005iC-10; Mon, 15 Jul 2019 08:44:00 +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] e1000e: Make speed detection on hotplugging cable more reliable Date: Mon, 15 Jul 2019 16:43:55 +0800 Message-Id: <20190715084355.9962-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 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 reports 10Mbps, renders the network rather slow. The issue has much lower fail rate after commit 59653e6497d1 ("e1000e: Make watchdog use delayed work"), which esssentially 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