Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3575206imu; Mon, 14 Jan 2019 05:31:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN6nQQ7uOl33yGzq22B/MUFu4ZRjjbAfyYNMRNntLKVf0o1CQbUZszJUz4nYNJPubBW5Z8De X-Received: by 2002:a17:902:9691:: with SMTP id n17mr26143269plp.9.1547472706870; Mon, 14 Jan 2019 05:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547472706; cv=none; d=google.com; s=arc-20160816; b=ZCIPPrc6nbQRJIITmJHsy3KKwlN5eASsi6SEkIFyJMwxJX8EesEiOeZbC6pfvFU9/t xl3buOs+aeXdbiikLnxQOpV/Ze4MSHba5zx3DlteaBc+o+AdInAGKYzkjvHMdbpgcqrJ wDL2HWz1pjxYwRMauniOPbM2YqiytICT4eajN2eCmbxvYczvcIz5ZwZPRnTXTNJ0HlTS ivmj/srPFevL/6D30uYj1KTGNuN4P4l96OTBopME7Qs/S+s0N7QQvDqRF8QdzHx7zzGd zmHm6tWTyqqrnQFPza5bcjkEjEJgsgZkOnu7pdn8EsYEqJcEBdVe4TAh9XKGGoEK23Lc MPMg== 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 :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=al6g5gqxBiHQ2kuARC6LcE3oO3x9nXYk4BzV7QhwKvc=; b=rinyBVg38fBfB5njTveP8oKJH6J2OxB1l7sOPRVV6xQ1n1rKWgXpW3+HYNnpdPJBEi XGtwhWCeCVYn0msUONdj9yKWaby+AmYN18qt2nNi3HmTcnh+pvrv7a+stYOvuXhzjOCQ CCvUG2zx0EZ8OWZX0tKcRczP1S0WYcMAsJOliaGzsgGjsuJzG6+mu8tDhN1+cKPZHyD9 S89XwmLe0PNHTW1qeXPWMOULPvfUlwCE+YvC2S15tUG85z5IXIX4DWcMLg2hGa3JDYPE rMMLcE2gmDZHf81+mIcBk4M08qHT7322NI42REDAfRLOmO//TUexWQfz0xjPH6BFqjuy F4vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=yWfdocym; 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=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si348927pgh.224.2019.01.14.05.31.30; Mon, 14 Jan 2019 05:31:46 -0800 (PST) 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; dkim=pass header.i=@yandex-team.ru header.s=default header.b=yWfdocym; 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=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbfANN3h (ORCPT + 99 others); Mon, 14 Jan 2019 08:29:37 -0500 Received: from forwardcorp1g.cmail.yandex.net ([87.250.241.190]:46861 "EHLO forwardcorp1g.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbfANN3h (ORCPT ); Mon, 14 Jan 2019 08:29:37 -0500 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1g.cmail.yandex.net (Yandex) with ESMTP id 8D88421747; Mon, 14 Jan 2019 16:29:33 +0300 (MSK) Received: from smtpcorp1j.mail.yandex.net (smtpcorp1j.mail.yandex.net [2a02:6b8:0:1619::137]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id JxqI17tisr-TXRu19oa; Mon, 14 Jan 2019 16:29:33 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1547472573; bh=al6g5gqxBiHQ2kuARC6LcE3oO3x9nXYk4BzV7QhwKvc=; h=Subject:From:To:Cc:Date:Message-ID; b=yWfdocymMNEZ0tpxyHXXVtg0WaZ5zdYSNTcgAHgA2pG+sijTuhc9CaxrUAd2LJORz KqZFP16tm1Lv3D64SAhvIGeeEgvuJp5FXCq59+FWaCs14Lgs0+oOB+IYpMfBHtnac6 zoVrCKyEQWmHwXIYLPqACv8EjI8N43MrQGnXbl/I= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:ddac:7ad6:150c:c9b3]) by smtpcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xhEqFlmGfv-TXhiGHsP; Mon, 14 Jan 2019 16:29:33 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: [PATCH] e1000e: fix cyclic resets at link up with active tx From: Konstantin Khlebnikov To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Jeff Kirsher Cc: linux-kernel@vger.kernel.org, "David S. Miller" Date: Mon, 14 Jan 2019 16:29:30 +0300 Message-ID: <154747257030.250168.12931902291381446144.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm seeing series of e1000e resets (sometimes endless) at system boot if something generates tx traffic at this time. In my case this is netconsole who sends message "e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames" from e1000e itself. As result e1000_watchdog_task sees used tx buffer while carrier is off and start this reset cycle again. [ 17.794359] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None [ 17.794714] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready [ 22.936455] e1000e 0000:02:00.0 eth1: changing MTU from 1500 to 9000 [ 23.033336] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 26.102364] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None [ 27.174495] 8021q: 802.1Q VLAN Support v1.8 [ 27.174513] 8021q: adding VLAN 0 to HW filter on device eth1 [ 30.671724] cgroup: cgroup: disabling cgroup2 socket matching due to net_prio or net_cls activation [ 30.898564] netpoll: netconsole: local port 6666 [ 30.898566] netpoll: netconsole: local IPv6 address 2a02:6b8:0:80b:beae:c5ff:fe28:23f8 [ 30.898567] netpoll: netconsole: interface 'eth1' [ 30.898568] netpoll: netconsole: remote port 6666 [ 30.898568] netpoll: netconsole: remote IPv6 address 2a02:6b8:b000:605c:e61d:2dff:fe03:3790 [ 30.898569] netpoll: netconsole: remote ethernet address b0:a8:6e:f4:ff:c0 [ 30.917747] console [netcon0] enabled [ 30.917749] netconsole: network logging started [ 31.453353] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.185730] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.321840] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.465822] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.597423] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.745417] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.877356] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.005441] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.157376] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.289362] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.417441] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 37.790342] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None This patch flushes tx buffers only once when carrier is off rather than at each watchdog iteration. Signed-off-by: Konstantin Khlebnikov --- drivers/net/ethernet/intel/e1000e/netdev.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 189f231075c2..d10083beec83 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5309,8 +5309,13 @@ static void e1000_watchdog_task(struct work_struct *work) /* 8000ES2LAN requires a Rx packet buffer work-around * on link down event; reset the controller to flush * the Rx packet buffer. + * + * If the link is lost the controller stops DMA, but + * if there is queued Tx work it cannot be done. So + * reset the controller to flush the Tx packet buffers. */ - if (adapter->flags & FLAG_RX_NEEDS_RESTART) + if ((adapter->flags & FLAG_RX_NEEDS_RESTART) || + e1000_desc_unused(tx_ring) + 1 < tx_ring->count) adapter->flags |= FLAG_RESTART_NOW; else pm_schedule_suspend(netdev->dev.parent, @@ -5333,14 +5338,6 @@ static void e1000_watchdog_task(struct work_struct *work) adapter->gotc_old = adapter->stats.gotc; spin_unlock(&adapter->stats64_lock); - /* If the link is lost the controller stops DMA, but - * if there is queued Tx work it cannot be done. So - * reset the controller to flush the Tx packet buffers. - */ - if (!netif_carrier_ok(netdev) && - (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) - adapter->flags |= FLAG_RESTART_NOW; - /* If reset is necessary, do it outside of interrupt context. */ if (adapter->flags & FLAG_RESTART_NOW) { schedule_work(&adapter->reset_task);