]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.104/gianfar-fix-rx-byte-accounting-for-ndev-stats.patch
Linux 4.9.167
[thirdparty/kernel/stable-queue.git] / releases / 4.9.104 / gianfar-fix-rx-byte-accounting-for-ndev-stats.patch
1 From foo@baz Sun May 27 17:33:38 CEST 2018
2 From: Claudiu Manoil <claudiu.manoil@nxp.com>
3 Date: Tue, 27 Feb 2018 17:33:10 +0200
4 Subject: gianfar: Fix Rx byte accounting for ndev stats
5
6 From: Claudiu Manoil <claudiu.manoil@nxp.com>
7
8 [ Upstream commit 590399ddf9561f2ed0839311c8ae1be21597ba68 ]
9
10 Don't include in the Rx bytecount of the packet sent up the stack:
11 the FCB (frame control block), and the padding bytes inserted by
12 the controller into the frame payload, nor the FCS. All these are
13 being pulled out of the skb by gfar_process_frame().
14 This issue is old, likely from the driver's beginnings, however
15 it was amplified by recent:
16 commit d903ec77118c ("gianfar: simplify FCS handling and fix memory leak")
17 which basically added the FCS to the Rx bytecount, and so brought
18 this to my attention.
19
20 Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
21 Signed-off-by: David S. Miller <davem@davemloft.net>
22 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 ---
25 drivers/net/ethernet/freescale/gianfar.c | 7 +++----
26 1 file changed, 3 insertions(+), 4 deletions(-)
27
28 --- a/drivers/net/ethernet/freescale/gianfar.c
29 +++ b/drivers/net/ethernet/freescale/gianfar.c
30 @@ -3075,9 +3075,6 @@ static void gfar_process_frame(struct ne
31 if (ndev->features & NETIF_F_RXCSUM)
32 gfar_rx_checksum(skb, fcb);
33
34 - /* Tell the skb what kind of packet this is */
35 - skb->protocol = eth_type_trans(skb, ndev);
36 -
37 /* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here.
38 * Even if vlan rx accel is disabled, on some chips
39 * RXFCB_VLN is pseudo randomly set.
40 @@ -3148,13 +3145,15 @@ int gfar_clean_rx_ring(struct gfar_priv_
41 continue;
42 }
43
44 + gfar_process_frame(ndev, skb);
45 +
46 /* Increment the number of packets */
47 total_pkts++;
48 total_bytes += skb->len;
49
50 skb_record_rx_queue(skb, rx_queue->qindex);
51
52 - gfar_process_frame(ndev, skb);
53 + skb->protocol = eth_type_trans(skb, ndev);
54
55 /* Send the packet up the stack */
56 napi_gro_receive(&rx_queue->grp->napi_rx, skb);