From patchwork Fri Feb 5 21:52: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: 8239861 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 53962BEEE5 for ; Fri, 5 Feb 2016 21:57:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79522203B8 for ; Fri, 5 Feb 2016 21:57:14 +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 971D1203B4 for ; Fri, 5 Feb 2016 21:57:13 +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 1aRoM2-0004X5-9x; Fri, 05 Feb 2016 21:55:50 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aRoLg-0004BU-Kg for linux-arm-kernel@lists.infradead.org; Fri, 05 Feb 2016 21:55:29 +0000 Received: by mail-pa0-x232.google.com with SMTP id ho8so40381557pac.2 for ; Fri, 05 Feb 2016 13:55:08 -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=yz5c4LLoHxWF3Kvc5J+GUfk7QAgL7hZD4h42VtVJ298=; b=c8UxhI6JSDlz9ewpI57rof+i9TC82O+pZoRmIC3Caf7t2VZ11NDD+6aUrLDBDyvjHK xwV1ufgKANxX63r5UslsQdttqOG9MsSyW4sICyGOjQPUBu1S3rp1H8r54vQ6wSIXqrOf ZhOx3dNO6suTJhf7XUBUmSqNQGBpaHDjPvamGzEIRR/fZhNO4ofM5i77XfUMtICPRInn Oev49QgJGD8BbSyX+DVgvl+lm/m6azKvCJz8OTwwXNUsIjzMhtwE6f7W5xyOmXHJhdl5 fOPaxMwat3P7EtDg/Jd8rTL7R3IDebGrA1pkl77U8P0RLnG0rXjjUgWHzX5bPPpn0O// JnSw== 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=yz5c4LLoHxWF3Kvc5J+GUfk7QAgL7hZD4h42VtVJ298=; b=NroPDf4qk0lUV34f0DAwF2gt7QRftRK4z8TcNRqHPdowr9kL/YUrqSrR7UTshTDH1O QbG3EJMoazt6hH8bPaSmxuhTt/lYKyYjc+hq7mabKTfL4yMawyeV47JZlvaAG71LbBae 5f1uTT87PTNOEEtYYp5WADixNlSKm5te0l6jxksVEajZk97z9AJcjPkryuriHIIkOQn4 mRZS2lMqD/mxaUd8q/GXHEwpM2xbf1PLIPGrFpcXXaSTcksur0la1aQMwaeSZ277Dopo USLituaUhDhhw3Os/43XIKjZs3yQdjiUsh5X5ZFuvAuEdkfj9p9zASqNEQ3qKt35AJGR DObQ== X-Gm-Message-State: AG10YOSSCLf4ok+O60pFYe4bbzuQaKO0H5qs7AexHZkNqQGE/lOeOPCm40wbGPtJcrLo5Q== X-Received: by 10.66.100.163 with SMTP id ez3mr23327793pab.5.1454709307934; Fri, 05 Feb 2016 13:55:07 -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 v75sm26628688pfa.39.2016.02.05.13.55.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Feb 2016 13:55:07 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next V2 2/8] net: fec: fix rx error counts Date: Fri, 5 Feb 2016 14:52:44 -0700 Message-Id: <1454709170-19527-3-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454709170-19527-1-git-send-email-troy.kisky@boundarydevices.com> References: <1454709170-19527-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160205_135528_810687_C3BEB5D5 X-CRM114-Status: GOOD ( 14.20 ) 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, arnd@arndb.de, Troy Kisky , laci@boundarydevices.com, johannes@sipsolutions.net, 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.4 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 On an overrun, the other flags are not valid, so don't check them. Also, don't pass bad frames up the stack. Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 36 +++++++++++++------------------ 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 3e5b24a..162fa59 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1408,37 +1408,31 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) break; pkt_received++; - /* Since we have allocated space to hold a complete frame, - * the last indicator should be set. - */ - if ((status & BD_ENET_RX_LAST) == 0) - netdev_err(ndev, "rcv is not +last\n"); - writel(FEC_ENET_RXF, fep->hwp + FEC_IEVENT); /* Check for errors. */ + status ^= BD_ENET_RX_LAST; if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO | - BD_ENET_RX_CR | BD_ENET_RX_OV)) { + BD_ENET_RX_CR | BD_ENET_RX_OV | BD_ENET_RX_LAST | + BD_ENET_RX_CL)) { ndev->stats.rx_errors++; - if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH)) { + if (status & BD_ENET_RX_OV) { + /* FIFO overrun */ + ndev->stats.rx_fifo_errors++; + goto rx_processing_done; + } + if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH + | BD_ENET_RX_LAST)) { /* Frame too long or too short. */ ndev->stats.rx_length_errors++; + if (status & BD_ENET_RX_LAST) + netdev_err(ndev, "rcv is not +last\n"); } - if (status & BD_ENET_RX_NO) /* Frame alignment */ - ndev->stats.rx_frame_errors++; if (status & BD_ENET_RX_CR) /* CRC Error */ ndev->stats.rx_crc_errors++; - if (status & BD_ENET_RX_OV) /* FIFO overrun */ - ndev->stats.rx_fifo_errors++; - } - - /* Report late collisions as a frame error. - * On this error, the BD is closed, but we don't know what we - * have in the buffer. So, just drop this frame on the floor. - */ - if (status & BD_ENET_RX_CL) { - ndev->stats.rx_errors++; - ndev->stats.rx_frame_errors++; + /* Report late collisions as a frame error. */ + if (status & (BD_ENET_RX_NO | BD_ENET_RX_CL)) + ndev->stats.rx_frame_errors++; goto rx_processing_done; }