From patchwork Wed Apr 6 02:25:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8757711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E7A3CC0553 for ; Wed, 6 Apr 2016 02:36:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D564202A1 for ; Wed, 6 Apr 2016 02:36:33 +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 333C520295 for ; Wed, 6 Apr 2016 02:36:32 +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 1andJ0-0006Bn-HI; Wed, 06 Apr 2016 02:34:54 +0000 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1andD9-0007jp-8Q for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2016 02:28:52 +0000 Received: by mail-pf0-x230.google.com with SMTP id n1so23145157pfn.2 for ; Tue, 05 Apr 2016 19:28:30 -0700 (PDT) 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=fAMBf9aBMoj02ZSQMGxeqDyZOHn7nfA2Gu43rrnFjFw=; b=wY1P69QGrdLGOuwfJmvrpwChvcp2uovexpmfE7nBy7n7emi629D+7g4R6kLBr4XGMa ZIaZnHyu9iX9c2D8nwpFp9UTL8U1ljsVOzfMVVofGCDH249wTlVEz3wGHLLk6SxXv3LP +C3k2EAB7AW5igdoZviwS7WGU6C7p27RL0tD3s2zinoSS8Fb4PXIoHLE11fVRgY0LtvB GlIiN7E0ySXs5eYpnxICvTHFo+thnpjb0ForN8n3s+2tKNHXiVo47X9tqFDFOrk25gzP dt9RmZj+t9K8PflER0dokQl/m7Ct1K/qcSKNDVdM/p4PQf2mLZWTXrZfbcMzHkzvb4y0 E1tQ== 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=fAMBf9aBMoj02ZSQMGxeqDyZOHn7nfA2Gu43rrnFjFw=; b=T3F/ysKiRUB8LBtE6YLlyXzPXtrYCxgzC9cVkZxEzy6RaRl31lJpMFOSJxSObWtBVF PeW14Lwf9Yd3O0A7l2tSwe3rjWHToKHJNKjVhUWeUCRBMexN+RbUyhfL1nTh0wRFc5Qm uQGeiSX1rkme6LYi390LTg+hNSLoqGnFX5vW4EmmBKwM2F1OKlvPPh1L91ELUbk7WFdD PcBQU7O20gAWgJp1m1KcyJ3MrhpywWxsdnZYYUj8HAy1iRDNkqi7HLvHPsSWEDaECpQv js2wRsIzhXb4hhq7hO7azwD+42XxlrFIn/q8F19VV2fosO16zkgibiDcNuKtHQlRXBud RhEw== X-Gm-Message-State: AD7BkJJ073I8uja+fXH5Y3ArGez2Zponk8cudC1VKOOYdJBw6PCK9JtoitmFrJSeU3k+QQ== X-Received: by 10.98.32.218 with SMTP id m87mr34632438pfj.48.1459909710486; Tue, 05 Apr 2016 19:28:30 -0700 (PDT) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id l14sm528682pfi.23.2016.04.05.19.28.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2016 19:28:30 -0700 (PDT) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, fugang.duan@nxp.com, lznuaa@gmail.com Subject: [PATCH net-next V3 13/16] net: fec: detect tx int lost Date: Tue, 5 Apr 2016 19:25:59 -0700 Message-Id: <1459909562-22865-14-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> References: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160405_192851_600789_8833B5A3 X-CRM114-Status: GOOD ( 12.67 ) 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: andrew@lunn.ch, stillcompiling@gmail.com, arnd@arndb.de, sergei.shtylyov@cogentembedded.com, Troy Kisky , gerg@uclinux.org, fabio.estevam@nxp.com, johannes@sipsolutions.net, l.stach@pengutronix.de, 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=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 --- v3: no change --- drivers/net/ethernet/freescale/fec_main.c | 38 ++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index be875fd..445443d 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1094,14 +1094,50 @@ fec_stop(struct net_device *ndev) } } +static const 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 = fec16_to_cpu(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);