Skip to content

Commit

Permalink
usbnet: ratelimit kevent may have been dropped warnings
Browse files Browse the repository at this point in the history
when something goes wrong, a flood of these messages can be
generated by usbnet (thousands per second).  This doesn't
generally *help* the condition so this patch ratelimits the
rate of their generation.

There's an underlying problem in usbnet's kevent deferral
mechanism which needs fixing, specifically that events *can*
get dropped and not handled.  This patch doesn't address this,
but just mitigates fallout caused by the current implemention.

Signed-off-by: Steve Glendinning <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
steveglen authored and davem330 committed Nov 9, 2012
1 parent 60713a0 commit 9532021
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/usb/usbnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,12 @@ static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,
void usbnet_defer_kevent (struct usbnet *dev, int work)
{
set_bit (work, &dev->flags);
if (!schedule_work (&dev->kevent))
netdev_err(dev->net, "kevent %d may have been dropped\n", work);
else
if (!schedule_work (&dev->kevent)) {
if (net_ratelimit())
netdev_err(dev->net, "kevent %d may have been dropped\n", work);
} else {
netdev_dbg(dev->net, "kevent %d scheduled\n", work);
}
}
EXPORT_SYMBOL_GPL(usbnet_defer_kevent);

Expand Down

0 comments on commit 9532021

Please sign in to comment.