summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2015-03-25 21:41:33 +0100
committerSasha Levin <sasha.levin@oracle.com>2015-04-27 17:13:42 -0400
commite083cde25c210e1960a3fbfe71c9ada4f9148a26 (patch)
tree65f27b5c4c833c20aceb4baa976978a18580c8c2 /include
parentd0f6e5cf80894ada0f9143be5e4a0d24a803c3f0 (diff)
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: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/usbnet.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index ff3fb2bd0e90..6e0ce8c7b8cb 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -227,7 +227,7 @@ struct skb_data { /* skb->cb is one of these */
struct urb *urb;
struct usbnet *dev;
enum skb_state state;
- size_t length;
+ long length;
unsigned long packets;
};
@@ -235,11 +235,13 @@ struct skb_data { /* skb->cb is one of these */
* tx_fixup method before returning an skb.
*/
static inline void
-usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets)
+usbnet_set_skb_tx_stats(struct sk_buff *skb,
+ unsigned long packets, long bytes_delta)
{
struct skb_data *entry = (struct skb_data *) skb->cb;
entry->packets = packets;
+ entry->length = bytes_delta;
}
extern int usbnet_open(struct net_device *net);