aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/usb/asix_common.c2
-rw-r--r--drivers/net/usb/cdc_ncm.c3
-rw-r--r--drivers/net/usb/sr9800.c1
-rw-r--r--drivers/net/usb/usbnet.c5
-rw-r--r--include/linux/usb/usbnet.h12
5 files changed, 20 insertions, 3 deletions
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 5c55f11572ba..724a9b50df7a 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -188,6 +188,8 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
188 memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); 188 memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
189 skb_put(skb, sizeof(padbytes)); 189 skb_put(skb, sizeof(padbytes));
190 } 190 }
191
192 usbnet_set_skb_tx_stats(skb, 1);
191 return skb; 193 return skb;
192} 194}
193 195
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 80a844e0ae03..70cbea551139 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1172,7 +1172,6 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1172 1172
1173 /* return skb */ 1173 /* return skb */
1174 ctx->tx_curr_skb = NULL; 1174 ctx->tx_curr_skb = NULL;
1175 dev->net->stats.tx_packets += ctx->tx_curr_frame_num;
1176 1175
1177 /* keep private stats: framing overhead and number of NTBs */ 1176 /* keep private stats: framing overhead and number of NTBs */
1178 ctx->tx_overhead += skb_out->len - ctx->tx_curr_frame_payload; 1177 ctx->tx_overhead += skb_out->len - ctx->tx_curr_frame_payload;
@@ -1184,6 +1183,8 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1184 */ 1183 */
1185 dev->net->stats.tx_bytes -= skb_out->len - ctx->tx_curr_frame_payload; 1184 dev->net->stats.tx_bytes -= skb_out->len - ctx->tx_curr_frame_payload;
1186 1185
1186 usbnet_set_skb_tx_stats(skb_out, n);
1187
1187 return skb_out; 1188 return skb_out;
1188 1189
1189exit_no_skb: 1190exit_no_skb:
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index b94a0fbb8b3b..7650cdc8fe6b 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -144,6 +144,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
144 skb_put(skb, sizeof(padbytes)); 144 skb_put(skb, sizeof(padbytes));
145 } 145 }
146 146
147 usbnet_set_skb_tx_stats(skb, 1);
147 return skb; 148 return skb;
148} 149}
149 150
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 449835f4331e..0f3ff285f6a1 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1188,8 +1188,7 @@ static void tx_complete (struct urb *urb)
1188 struct usbnet *dev = entry->dev; 1188 struct usbnet *dev = entry->dev;
1189 1189
1190 if (urb->status == 0) { 1190 if (urb->status == 0) {
1191 if (!(dev->driver_info->flags & FLAG_MULTI_PACKET)) 1191 dev->net->stats.tx_packets += entry->packets;
1192 dev->net->stats.tx_packets++;
1193 dev->net->stats.tx_bytes += entry->length; 1192 dev->net->stats.tx_bytes += entry->length;
1194 } else { 1193 } else {
1195 dev->net->stats.tx_errors++; 1194 dev->net->stats.tx_errors++;
@@ -1348,6 +1347,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1348 urb->transfer_flags |= URB_ZERO_PACKET; 1347 urb->transfer_flags |= URB_ZERO_PACKET;
1349 } 1348 }
1350 entry->length = urb->transfer_buffer_length = length; 1349 entry->length = urb->transfer_buffer_length = length;
1350 if (!(info->flags & FLAG_MULTI_PACKET))
1351 usbnet_set_skb_tx_stats(skb, 1);
1351 1352
1352 spin_lock_irqsave(&dev->txq.lock, flags); 1353 spin_lock_irqsave(&dev->txq.lock, flags);
1353 retval = usb_autopm_get_interface_async(dev->intf); 1354 retval = usb_autopm_get_interface_async(dev->intf);
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 */
237static inline void
238usbnet_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
233extern int usbnet_open(struct net_device *net); 245extern int usbnet_open(struct net_device *net);
234extern int usbnet_stop(struct net_device *net); 246extern int usbnet_stop(struct net_device *net);
235extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, 247extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,