]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usbnet: Fix tx_bytes statistic running backward in cdc_ncm
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Wed, 25 Mar 2015 20:41:33 +0000 (21:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2015 08:23:44 +0000 (10:23 +0200)
commitf1cb2a0f6b8cdc07fa540d53a00e93bac7118640
tree7212eee941d63a3de41c6845bd24c0e6ff09f827
parent3d206780d1e55e2b4660fa57e907d4fc0705e3cd
usbnet: Fix tx_bytes statistic running backward in cdc_ncm

[ Upstream commit 7a1e890e2168e33fb62d84528e996b8b4b478fea ]

cdc_ncm disagrees with usbnet about how much framing overhead should
be counted in the tx_bytes statistics, and tries 'fix' this by
decrementing tx_bytes on the transmit path.  But statistics must never
be decremented except due to roll-over; this will thoroughly confuse
user-space.  Also, tx_bytes is only incremented by usbnet in the
completion path.

Fix this by requiring drivers that set FLAG_MULTI_FRAME to set a
tx_bytes delta along with the tx_packets count.

Fixes: beeecd42c3b4 ("net: cdc_ncm/cdc_mbim: adding NCM protocol statistics")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/asix_common.c
drivers/net/usb/cdc_ncm.c
drivers/net/usb/sr9800.c
drivers/net/usb/usbnet.c
include/linux/usb/usbnet.h