Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2200878imm; Mon, 28 May 2018 03:49:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrq5V8To28b1leBuoTFRoyUdSKhcRZ/Tv3PdydXLyAfxXCvEX4YopMxfIGsuMpCRPkKTH7g X-Received: by 2002:a63:4202:: with SMTP id p2-v6mr10236452pga.137.1527504580971; Mon, 28 May 2018 03:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527504580; cv=none; d=google.com; s=arc-20160816; b=MSzXIzDsLOo3dTrjbbOPCjwsJvI/O1+G9ow4rWHigAGhHS36/37Al2V7eEAnvkfgJK fiFa1nRgAjHX5vWZp2CQxn2y1ALT2wt4v3KlyS0tkFHI/rPQCHGzitIwiSzP6BopFnIf CE5CgiKSceWw+7/LTuhMgS4pwiZofRPeVdkeEC0iFOwfjFanZkNDBUWCgaM63qlWrKl1 RbYDX7E46x2joow7MSm8AxcBjbT+joT8tLMoCXvC/Xr+5m1ISWDXOnH5ugTvPAlPyWk5 3ZuiVmf4ntv5fiVNBkRmpdRK/rejpoGJJHT8QKsotTn3QE27XXWwJDG/5/tyKmW+gY27 MpGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=V9nfglZPMjG8LkX5sWb0+uIuy9CoERansBBcgOfw0po=; b=MJD86GaAE9m4lLRjSVEX6NLmjReuCvzvkO0zsSdv1ijlH21vPDqszypTY6gHl6MXSX OKes0AI7YvJve4Tb1HNOYLweCI6Vf1tmEcBSK84UMBmesajxIAikIY3zs2Ga5ikA3HJ0 QqIFVOc3DL9oJTh4jeu6X2S7AWmKOvzwQcjL8WAVs79UqPIApCHgdoqZiMJx0Lu5daz3 amqFtqqB9yOBAlY/5GqiGcDyqu19jKoiKiC8Pa1U1vCaGhtm6gjtP7NTnCktbjNo1tDq fXJXtbM5iF1bHgsJHOU2/nHnr8UMpiBcv3e7NOeW19f1ocmHOlQl+3o01B00G1KT+nu2 F5Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dLt6oqx+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f89-v6si2950845pff.208.2018.05.28.03.49.26; Mon, 28 May 2018 03:49:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dLt6oqx+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163478AbeE1KtI (ORCPT + 99 others); Mon, 28 May 2018 06:49:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:38684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163433AbeE1Ksx (ORCPT ); Mon, 28 May 2018 06:48:53 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75A3C20844; Mon, 28 May 2018 10:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504532; bh=HOCMDEl+mPgGx9f/ocxrfT5TFzbW3xvd4/J1QMY/Ymk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dLt6oqx+N9+HFSC6MbuxicROp/8WGVogy0fzXzSZpVgppDNU3wlRzO+RW+khAVs7c kYgpMxXkMv4/foVKabW6/FO4beZisflA3YpnzvHM+k44r1+TPrz7pScH8eu16IB+rk x4wtkhRQNaHk9f2YW1tPoZIthehXHe9goexlhhlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Manoil , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 171/496] gianfar: Fix Rx byte accounting for ndev stats Date: Mon, 28 May 2018 11:59:16 +0200 Message-Id: <20180528100327.076610887@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Claudiu Manoil [ Upstream commit 590399ddf9561f2ed0839311c8ae1be21597ba68 ] Don't include in the Rx bytecount of the packet sent up the stack: the FCB (frame control block), and the padding bytes inserted by the controller into the frame payload, nor the FCS. All these are being pulled out of the skb by gfar_process_frame(). This issue is old, likely from the driver's beginnings, however it was amplified by recent: commit d903ec77118c ("gianfar: simplify FCS handling and fix memory leak") which basically added the FCS to the Rx bytecount, and so brought this to my attention. Signed-off-by: Claudiu Manoil Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/gianfar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -3072,9 +3072,6 @@ static void gfar_process_frame(struct ne if (ndev->features & NETIF_F_RXCSUM) gfar_rx_checksum(skb, fcb); - /* Tell the skb what kind of packet this is */ - skb->protocol = eth_type_trans(skb, ndev); - /* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here. * Even if vlan rx accel is disabled, on some chips * RXFCB_VLN is pseudo randomly set. @@ -3145,13 +3142,15 @@ int gfar_clean_rx_ring(struct gfar_priv_ continue; } + gfar_process_frame(ndev, skb); + /* Increment the number of packets */ total_pkts++; total_bytes += skb->len; skb_record_rx_queue(skb, rx_queue->qindex); - gfar_process_frame(ndev, skb); + skb->protocol = eth_type_trans(skb, ndev); /* Send the packet up the stack */ napi_gro_receive(&rx_queue->grp->napi_rx, skb);