Skip to content

Commit bf414b3

Browse files
bmorkdavem330
authored andcommitted
net: usbnet: fix tx_dropped statistics
It is normal for minidrivers accumulating frames to return NULL from their tx_fixup function. We do not want to count this as a drop, or log any debug messages. A different exit path is therefore chosen for such drivers, skipping the debug message and the tx_dropped increment. The test for accumulating drivers was however completely bogus, making the exit path selection depend on whether the user had enabled tx_err logging or not. This would arbitrarily mess up accounting for both accumulating and non-accumulating minidrivers, and would result in unwanted debug messages for the accumulating drivers. Fix by testing for FLAG_MULTI_PACKET instead, which probably was the intention from the beginning. This usage match the documented behaviour of this flag: Indicates to usbnet, that USB driver accumulates multiple IP packets. Affects statistic (counters) and short packet handling. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5f1e942 commit bf414b3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/net/usb/usbnet.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,13 +1125,11 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
11251125
if (info->tx_fixup) {
11261126
skb = info->tx_fixup (dev, skb, GFP_ATOMIC);
11271127
if (!skb) {
1128-
if (netif_msg_tx_err(dev)) {
1129-
netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");
1130-
goto drop;
1131-
} else {
1132-
/* cdc_ncm collected packet; waits for more */
1128+
/* packet collected; minidriver waiting for more */
1129+
if (info->flags & FLAG_MULTI_PACKET)
11331130
goto not_drop;
1134-
}
1131+
netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");
1132+
goto drop;
11351133
}
11361134
}
11371135
length = skb->len;

0 commit comments

Comments
 (0)