Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2456343imm; Mon, 28 May 2018 08:24:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLvh5XPtEb4Pa3fG5Z5Ja7N1qXMwHPzIZNxAewrgLGWp1OkozMv48UgmVFWdau0i3gAIVfX X-Received: by 2002:a62:fc8d:: with SMTP id e135-v6mr8936410pfh.208.1527521078288; Mon, 28 May 2018 08:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527521078; cv=none; d=google.com; s=arc-20160816; b=UX7bahAJ6lQanpOZQrIFuoQJOgX07+/4a8E3FIhj1uNPzhjIDsuqZ+gmnFJbC+UXUc 5WmWx6k6ZEf+BpAL6SN+WcNuHVgxRRRETGy+aEf/T74pBOLj/9XB/BkdjepFUBaA4s5W LiZE8nnp67mpPLh4C0aQUdAKpO7MsVARg75QXoUfi3/DxyyqhlaEIC3Cy3jeSt6btIgn wEtEzR4OJ+2cUMhR9BYXUCj4zvdUCJunLBAVLOjEqf+C0v6SAPP6wUOWcPorlP8oVcRT zvuhN9uetFwC8a5mrUf3eRWASCQSqutjfbS5/J6Fva4RpN4ofmkvzr8B8nFs2airxvNm o6ZA== 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=y/GESPFcpffiEMqJWZoHal2GjjF+LP5kuYWb1c9rqWo=; b=Kj1HqM3FY6TiVXhefA47BA1lbOfi6dJqTue1LP5r0JrtjkAsM0DZycEKJq/IJFeRKp Zx1l4god9srlFeeMtRU7ooC750rrDBGUk1ah1+DyRxngU84ltpTT9lceM13/QrEHE38f xGtNN10RIyDkteqdzFGrRpOO5Sp0C/gXOh/7eridqnd0xD99QvnP1bLwuNO/F0159CGT maO5ADh51Orb+hbfzcv+fb9Dl+uYZItKSS+LnGvgsd2YaOkx7c5mMn5VyQM586Q6neBi 3UyNEOCIf4bwcE/+D0UIg0cXJ8VWX8S7oJTKrdLL1R9uJJtLCUTkXJA/s6BRPthn3IrV i30A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qDL79YhX; 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 l4-v6si30460117plb.213.2018.05.28.08.24.23; Mon, 28 May 2018 08:24:38 -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=qDL79YhX; 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 S1033248AbeE1KU4 (ORCPT + 99 others); Mon, 28 May 2018 06:20:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033218AbeE1KUq (ORCPT ); Mon, 28 May 2018 06:20:46 -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 99D3E20899; Mon, 28 May 2018 10:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502846; bh=tmhaBRt+L2yFy+BwG0mQajJlSf8TJkHCGE9VDMQ8VUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDL79YhXYh+mZ8nrQ56rGpNC0NsPejDQBqJKLVyhiSb5b0D4uT5fhYNYv+BCXfCEf HvbVpn/LuNvcnkASt8cWXWWwIvKpTJBwKBoBFo72C0OOOaz12AUQ7ExzFvWV/00Lmu FPtTfz6jtc1Y52/c9lSXdRREhIHY5REjPy52TUK4= 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.4 117/268] gianfar: Fix Rx byte accounting for ndev stats Date: Mon, 28 May 2018 12:01:31 +0200 Message-Id: <20180528100215.377943044@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100202.045206534@linuxfoundation.org> References: <20180528100202.045206534@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.4-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 @@ -3053,9 +3053,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. @@ -3126,13 +3123,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);