From patchwork Thu Jan 3 02:25:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1020158 X-Patchwork-Delegate: koen.vandeputte@ncentric.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RxV1GYAc"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43VWwx6w0Zz9s7h for ; Thu, 3 Jan 2019 13:25:35 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nf/MjQEN4hTSVJNGaq5GVLjP0k0QB5m6n5x/pWaoAjU=; b=RxV1GYAcyIyOrk 14kKAFrkkuC7prSOuxGqbIhUjE4euk8e2G0oxJbJlYClv+RTYVw2CBD0zBOyfg5F5WXIv5av9gEyL +L9sZkstYwh3LaOjb/xQ6Mg4efIWScSJyOH6gjou7F+sWt/KMYjISpTQO4kxNaFWnKYX0BogrvLxM odBp15zr7wr42bHMDZ1g0DDdOoNb0L7ayWBBzW6fGfKdXJ5FSZGQBQkgt7j0iK9k86gqD1qFY4JJF 54PqAjKZrxAmtkjfqdyik3sJT23bZFdC9gt//3B0WrqPyyGP4mHtNhUsJTArO7QT0AgY8uX3orTCD uDp9tM5MMpIDGBdlQjqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geshO-0002Tw-97; Thu, 03 Jan 2019 02:25:30 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geshK-0002TX-7i for openwrt-devel@lists.openwrt.org; Thu, 03 Jan 2019 02:25:28 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 1992E3E45; Thu, 3 Jan 2019 03:25:23 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 470bb859; Thu, 3 Jan 2019 03:20:08 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Thu, 3 Jan 2019 03:25:11 +0100 Message-Id: <1546482311-5046-1-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190102_182526_428587_23D3793C X-CRM114-Status: GOOD ( 10.05 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH] ath79: ag71xx: Fix tx queue timeouts during ifup X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org On ath79 and UBNT Bullet M XW (ar9342) I was experiencing weird issues during network setup[1] which I was able to reproduce easily with following commands: uci set network.lan.ipaddr='192.168.1.20' uci commit network ifup lan Which resulted after some time in: ... WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:461 dev_watchdog+0x16c/0x280 NETDEV WATCHDOG: eth0 (ag71xx): transmit queue 0 timed out ... Sometimes I wasn't able to use networking anymore, sometimes it was enough to just ifdown/ifup lan and network was backup. On ar71xx it was all working just fine. I've found out, that it was happening because ag71xx_poll() wasn't called, thus the TX queue wasn't emptied. The ag71xx_poll() is being called from napi hrtimer, which is enabled by napi_schedule() in ar71xx_interrupt(), but since no interrupts were ever fired again after ag71xx_stop() was called, it was always leading to tx queue timeouts: *** ag71xx_hard_start_xmit() eth0: packet injected into TX queue eth0: raw intr=00000001 TXPS POLL eth0: enable polling mode eth0: processing TX ring, flush=no eth0: disable polling mode, rx=1, tx=1,limit=32 ( `ifup lan done here` ) *** ag71xx_stop() *** ag71xx_open() *** ag71xx_hw_enable() IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready *** ag71xx_hard_start_xmit() eth0: packet injected into TX queue *** ag71xx_hard_start_xmit() eth0: packet injected into TX queue ... WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:320 dev_watchdog+0x164/0x274 So I've looked at ag71xx_stop() in ar71xx, added the missing bits to ath79 and fixed this issue. 1. https://github.com/openwrt/openwrt/pull/1635#issuecomment-448638246 Signed-off-by: Petr Štetiar --- .../ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 70ca024..32e1e2a 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -805,12 +805,20 @@ err: static int ag71xx_stop(struct net_device *dev) { + unsigned long flags; struct ag71xx *ag = netdev_priv(dev); netif_carrier_off(dev); phy_stop(ag->phy_dev); ag71xx_hw_disable(ag); + spin_lock_irqsave(&ag->lock, flags); + if (ag->link) { + ag->link = 0; + ag71xx_link_adjust(ag); + } + spin_unlock_irqrestore(&ag->lock, flags); + return 0; }