From patchwork Thu Jan 28 21:25:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 788009F9A0 for ; Thu, 28 Jan 2016 21:41:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B7E72020F for ; Thu, 28 Jan 2016 21:41:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8B48202C8 for ; Thu, 28 Jan 2016 21:41:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOuIS-0001RC-W3; Thu, 28 Jan 2016 21:40:09 +0000 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOu7i-0005xq-JI for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:29:05 +0000 Received: by mail-pf0-x22e.google.com with SMTP id o185so25027778pfb.1 for ; Thu, 28 Jan 2016 13:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qg6N6AcFttY+HyCzH8E/Aa8oEpZqM9JSiAxrcMfs7BI=; b=yGZ5B01oTJmCiVItrvV42u1bU2A8ecBZOkn+ZRtP43PuTZvHEwXUrNjPXcJKMXrgT7 lOFdzOV+YLv6S0FcrGl0pJnaszmAJLpvHtAzOi63FFp4S4DOSUnYqHwFI8fXCVca87Y7 G0VUzhrHmWZUilomnlKQmf/nFVKJg/mNBU7pPy1qA4W26rtVJrts70nMa9Z4uEVkpn19 7QTmD+niRp687gTuLKSppm/NTJjDHRq024Tki/tE8wKDxKsqHtMFJPGSNYZewgSwDXgM cBGITj7+Uv7UY+bpprljnLQZ4CgQAPDXr/YNlgWbwiGqdC4S1zsnTDA7ou6Tgtw3ghJq Do0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qg6N6AcFttY+HyCzH8E/Aa8oEpZqM9JSiAxrcMfs7BI=; b=U1sZ82l5CvT8zR0iTJBjIa2ynevoGF/0r25GMN3Yz/45xwE8aH70xwnP7LjQIVozr8 wYPrWbOxgd24li4mSwwjFv2jTgFjPCZypZWHIoUca54K9LJ1bLj6CFfkMRcm7bTteP9k TFwOPgPvDAXIM7kRWDfhUyFx4tOsziqnpoJi7q2m12HsnWG/cX4FCah5w8QUjKpMN+EW toDSchZMpGjbVdut6hG1KoBvtSiiksHqDBERDQ2odpTrsh9nCc0ZldiMHs0HpRIVXAlv QPmM2weA2MkXG/M7+Qwqxosc/J2r5UUIfyYcR5VrZaVAV+mt3dTtyip4oe2wty3vxaQ4 ld6Q== X-Gm-Message-State: AG10YOQT+b8RZf6Y9dq5mHxqDOZXpNPjYieeuTXBpftx5GCrGuH5mRkwkKkeYOh9wIPxHg== X-Received: by 10.98.42.88 with SMTP id q85mr8030598pfq.1.1454016521846; Thu, 28 Jan 2016 13:28:41 -0800 (PST) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id c90sm18583190pfd.31.2016.01.28.13.28.40 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:41 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 20/40] net: fec: detect tx int lost Date: Thu, 28 Jan 2016 14:25:44 -0700 Message-Id: <1454016364-30985-21-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> References: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160128_132902_977052_42BB9B7C X-CRM114-Status: GOOD ( 12.54 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fabio.estevam@freescale.com, andrew@lunn.ch, linux@arm.linux.org.uk, Troy Kisky , laci@boundarydevices.com, l.stach@pengutronix.de, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, tremyfr@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a tx int is lost, no need to reset the fec. Just mark the event and call napi_schedule. Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 36 ++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 1225282..47df66e 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1091,14 +1091,48 @@ fec_stop(struct net_device *ndev) } } +uint txint_flags[] = {FEC_ENET_TXF_0, FEC_ENET_TXF_1, FEC_ENET_TXF_2}; static void fec_timeout(struct net_device *ndev) { struct fec_enet_private *fep = netdev_priv(ndev); + struct bufdesc *bdp; + unsigned short status; + int i; + uint events = 0; - fec_dump(ndev); + for (i = 0; i < fep->num_tx_queues; i++) { + struct fec_enet_priv_tx_q *txq = fep->tx_queue[i]; + int index; + struct sk_buff *skb = NULL; + + bdp = txq->dirty_tx; + while (1) { + bdp = fec_enet_get_nextdesc(bdp, &txq->bd); + if (bdp == txq->bd.cur) + break; + index = fec_enet_get_bd_index(bdp, &txq->bd); + skb = txq->tx_skbuff[index]; + if (skb) { + status = bdp->cbd_sc; + if ((status & BD_ENET_TX_READY) == 0) + events |= txint_flags[i]; + break; + } + } + } + if (events) { + fep->events |= events; + /* Disable the RX/TX interrupt */ + writel(FEC_NAPI_IMASK, fep->hwp + FEC_IMASK); + napi_schedule(&fep->napi); + netif_wake_queue(fep->netdev); + pr_err("%s: tx int lost\n", __func__); + return; + } + fec_dump(ndev); ndev->stats.tx_errors++; schedule_work(&fep->tx_timeout_work);