From patchwork Thu Jan 28 21:25:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8153991 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 16E91BEEE5 for ; Thu, 28 Jan 2016 21:31:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 412DC20211 for ; Thu, 28 Jan 2016 21:31:13 +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 64BAC2013A for ; Thu, 28 Jan 2016 21:31:12 +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 1aOu8T-0006Vw-Cx; Thu, 28 Jan 2016 21:29:49 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOu7E-0005q6-QQ for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:28:34 +0000 Received: by mail-pa0-x229.google.com with SMTP id yy13so29095596pab.3 for ; Thu, 28 Jan 2016 13:28:12 -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=CR+QG7+Hnbr2Cb45RNiU22DGrYeZ/iVZKvF/eE4Yjuk=; b=PhRpWGL8esmH6vdacSs37HxiKIXqJ2dJXKbcotnSE9Z7+zjXT8JfX3xtg77Xk1zu9V jKkwHNbHtdZq5vuoqcMaALiqkjlyEDavD6ynZ242ClyXyAwVzYco0/pmih1rLCzOToDn j/zv6KSjE50Ed5TJMc/n7qka3TcG7OW74D+kuK9cvekyiTbGB0nRKLnzu4NWi5dDiyxM IbVEa2qx0YKYvLjAYNoS1JiuCGM0GbtLTyt/BnC5GAELndZa6wdVxGMaSz9opMbyjucz v+5AtOKSmBXOS0Qfio6xUouhf7oxJN2T/lnGyttaTlbe0grj28n9E0GvLn5sv8gj81MT Fcmg== 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=CR+QG7+Hnbr2Cb45RNiU22DGrYeZ/iVZKvF/eE4Yjuk=; b=V7CNDLWBz818BgET+eF+Y35hgX0AwGr8SmGH2Kcee5nHPmdwNVuIaqzehGXS5rW3PO DQzVzjxRUriCzp0EZhuH6Ee0Pn4Jz7oncTwQeIiIifiVIKdW+El4D2IZz5RAKUYypKNB en03RAMEjdR42mWChp6g/wixXbiZK6RdhXt34YI3Ey3a/1earan+9BMR/gxdt8j5Cdl1 auoIM2PICON2R3TpFpcLp+RyTjOpniXpuzm9Ey0y7gD/RzBwDdng/B8UGmxcxH35Lud5 6CwRqEBO2tocruk10fYLfWEmA4PHTceCO26jEbpyCzZBifBZ2uwS4ph6hgXZLLeHbKhR 1JYA== X-Gm-Message-State: AG10YOSLuUND7DQnr3Cev5GXR7pVwHcD8Noqza+nLHCpQJGOl2tDnsJKQvqfeqrhSCG13w== X-Received: by 10.66.237.102 with SMTP id vb6mr7837461pac.133.1454016492144; Thu, 28 Jan 2016 13:28:12 -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.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:11 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 02/40] net: fec: fix rx error counts Date: Thu, 28 Jan 2016 14:25:26 -0700 Message-Id: <1454016364-30985-3-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_132833_041308_911263FF X-CRM114-Status: GOOD ( 14.49 ) 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=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. 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 2c7c845..620834f 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1403,37 +1403,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; }