Skip to content

Commit 5098874

Browse files
oleremkuba-moo
authored andcommitted
net: usb: lan78xx: fix TX byte statistics for small packets
Account for hardware auto-padding in TX byte counters to reflect actual wire traffic. The LAN7850 hardware automatically pads undersized frames to the minimum Ethernet frame length (ETH_ZLEN, 60 bytes). However, the driver tracks the network statistics based on the unpadded socket buffer length. This results in the tx_bytes counter under-reporting the actual physical bytes placed on the Ethernet wire for small packets (like short ARP or ICMP requests). Use max_t() to ensure the transmission statistics accurately account for the hardware-generated padding. Fixes: d383216 ("lan78xx: Introduce Tx URB processing improvements") Cc: [email protected] Signed-off-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e4f774a commit 5098874

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/usb/lan78xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4178,7 +4178,7 @@ static struct skb_data *lan78xx_tx_buf_fill(struct lan78xx_net *dev,
41784178
}
41794179

41804180
tx_data += len;
4181-
entry->length += len;
4181+
entry->length += max_t(unsigned int, len, ETH_ZLEN);
41824182
entry->num_of_packet += skb_shinfo(skb)->gso_segs ?: 1;
41834183

41844184
dev_kfree_skb_any(skb);

0 commit comments

Comments
 (0)