diff options
| author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2015-02-26 14:34:37 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-02-28 14:27:21 -0500 |
| commit | 6588af614e7b79294fbcd4a666a7422c0c854e80 (patch) | |
| tree | 54003284999080b9cb44e1aec0a1d078d7d78e16 /include/linux/usb | |
| parent | 721a57a02dfc81b6d63b93b8ca23be3004b61515 (diff) | |
usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers
Currently the usbnet core does not update the tx_packets statistic for
drivers with FLAG_MULTI_PACKET and there is no hook in the TX
completion path where they could do this.
cdc_ncm and dependent drivers are bumping tx_packets stat on the
transmit path while asix and sr9800 aren't updating it at all.
Add a packet count in struct skb_data so these drivers can fill it
in, initialise it to 1 for other drivers, and add the packet count
to the tx_packets statistic on completion.
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Tested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/usbnet.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index d9a4905e01d0..ff3fb2bd0e90 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -228,8 +228,20 @@ struct skb_data { /* skb->cb is one of these */ | |||
| 228 | struct usbnet *dev; | 228 | struct usbnet *dev; |
| 229 | enum skb_state state; | 229 | enum skb_state state; |
| 230 | size_t length; | 230 | size_t length; |
| 231 | unsigned long packets; | ||
| 231 | }; | 232 | }; |
| 232 | 233 | ||
| 234 | /* Drivers that set FLAG_MULTI_PACKET must call this in their | ||
| 235 | * tx_fixup method before returning an skb. | ||
| 236 | */ | ||
| 237 | static inline void | ||
| 238 | usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets) | ||
| 239 | { | ||
| 240 | struct skb_data *entry = (struct skb_data *) skb->cb; | ||
| 241 | |||
| 242 | entry->packets = packets; | ||
| 243 | } | ||
| 244 | |||
| 233 | extern int usbnet_open(struct net_device *net); | 245 | extern int usbnet_open(struct net_device *net); |
| 234 | extern int usbnet_stop(struct net_device *net); | 246 | extern int usbnet_stop(struct net_device *net); |
| 235 | extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, | 247 | extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, |
