Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369197
b: refs/heads/master
c: 4b49f58
h: refs/heads/master
i:
  369195: 8f91fbf
v: v3
  • Loading branch information
Ming Lei authored and David S. Miller committed Apr 11, 2013
1 parent 5bfef8d commit f2c6824
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0162c55463057196346e7b53f83b5b53a47a32cc
refs/heads/master: 4b49f58fff00e6e9b24eaa31d4c6324393d76b0a
30 changes: 30 additions & 0 deletions trunk/drivers/net/usb/usbnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,27 @@ static const struct ethtool_ops usbnet_ethtool_ops = {

/*-------------------------------------------------------------------------*/

static void __handle_link_change(struct usbnet *dev)
{
if (!test_bit(EVENT_DEV_OPEN, &dev->flags))
return;

if (!netif_carrier_ok(dev->net)) {
/* kill URBs for reading packets to save bus bandwidth */
unlink_urbs(dev, &dev->rxq);

/*
* tx_timeout will unlink URBs for sending packets and
* tx queue is stopped by netcore after link becomes off
*/
} else {
/* submitting URBs for reading packets */
tasklet_schedule(&dev->bh);
}

clear_bit(EVENT_LINK_CHANGE, &dev->flags);
}

/* work that cannot be done in interrupt context uses keventd.
*
* NOTE: with 2.5 we could do more of this using completion callbacks,
Expand Down Expand Up @@ -1035,8 +1056,14 @@ kevent (struct work_struct *work)
} else {
usb_autopm_put_interface(dev->intf);
}

/* handle link change from link resetting */
__handle_link_change(dev);
}

if (test_bit (EVENT_LINK_CHANGE, &dev->flags))
__handle_link_change(dev);

if (dev->flags)
netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags);
}
Expand Down Expand Up @@ -1286,6 +1313,7 @@ static void usbnet_bh (unsigned long param)
// or are we maybe short a few urbs?
} else if (netif_running (dev->net) &&
netif_device_present (dev->net) &&
netif_carrier_ok(dev->net) &&
!timer_pending (&dev->delay) &&
!test_bit (EVENT_RX_HALT, &dev->flags)) {
int temp = dev->rxq.qlen;
Expand Down Expand Up @@ -1663,6 +1691,8 @@ void usbnet_link_change(struct usbnet *dev, bool link, bool need_reset)

if (need_reset && link)
usbnet_defer_kevent(dev, EVENT_LINK_RESET);
else
usbnet_defer_kevent(dev, EVENT_LINK_CHANGE);
}
EXPORT_SYMBOL(usbnet_link_change);

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/usb/usbnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct usbnet {
# define EVENT_DEVICE_REPORT_IDLE 8
# define EVENT_NO_RUNTIME_PM 9
# define EVENT_RX_KILL 10
# define EVENT_LINK_CHANGE 11
};

static inline struct usb_driver *driver_of(struct usb_interface *intf)
Expand Down

0 comments on commit f2c6824

Please sign in to comment.