* [PATCH net] gianfar: Fix Rx byte accounting for ndev stats
@ 2018-02-27 15:33 Claudiu Manoil
2018-02-28 15:59 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Claudiu Manoil @ 2018-02-27 15:33 UTC (permalink / raw)
To: netdev; +Cc: David S . Miller, aspencer
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 <claudiu.manoil@nxp.com>
---
drivers/net/ethernet/freescale/gianfar.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index f5c87bd..f27f9ba 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -3063,9 +3063,6 @@ static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb)
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.
@@ -3136,13 +3133,15 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] gianfar: Fix Rx byte accounting for ndev stats
2018-02-27 15:33 [PATCH net] gianfar: Fix Rx byte accounting for ndev stats Claudiu Manoil
@ 2018-02-28 15:59 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-28 15:59 UTC (permalink / raw)
To: claudiu.manoil; +Cc: netdev, aspencer
From: Claudiu Manoil <claudiu.manoil@nxp.com>
Date: Tue, 27 Feb 2018 17:33:10 +0200
> 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 <claudiu.manoil@nxp.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-28 15:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27 15:33 [PATCH net] gianfar: Fix Rx byte accounting for ndev stats Claudiu Manoil
2018-02-28 15:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).