r8152: fix tx packets accounting
authorEric Dumazet <edumazet@google.com>
Mon, 26 Feb 2018 03:12:10 +0000 (19:12 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:50:32 +0000 (07:50 +0200)
[ Upstream commit 4c27bf3c5b7434ccb9ab962301da661c26b467a4 ]

r8152 driver handles TSO packets (limited to ~16KB) quite well,
but pretends each TSO logical packet is a single packet on the wire.

There is also some error since headers are accounted once, but
error rate is small enough that we do not care.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/r8152.c

index 3cdfa2465e3f81259127b9b5936305cb80be23ed..d3d89b05f66e685cca1711035f82b12e30a5022c 100644 (file)
@@ -1693,7 +1693,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
 
                tx_data += len;
                agg->skb_len += len;
-               agg->skb_num++;
+               agg->skb_num += skb_shinfo(skb)->gso_segs ?: 1;
 
                dev_kfree_skb_any(skb);