diff options
author | Ming Lei <ming.lei@canonical.com> | 2013-04-11 00:40:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-11 15:57:16 -0400 |
commit | ac64995da872c8ae6f74a5556fdad565829985b0 (patch) | |
tree | 31f97306b10b4b78dafac1a383b76189c5f81017 | |
parent | 763eff57de893a27f8f18855f17033c92598c423 (diff) |
usbnet: introduce usbnet_link_change API
This patch introduces the API of usbnet_link_change, so that
usbnet can handle link change centrally, which may help to
implement killing traffic URBs for saving USB bus bandwidth
and host controller power.
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/usbnet.c | 13 | ||||
-rw-r--r-- | include/linux/usb/usbnet.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 51f3192f3931..40e4237b0a3a 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1653,6 +1653,19 @@ int usbnet_manage_power(struct usbnet *dev, int on) | |||
1653 | } | 1653 | } |
1654 | EXPORT_SYMBOL(usbnet_manage_power); | 1654 | EXPORT_SYMBOL(usbnet_manage_power); |
1655 | 1655 | ||
1656 | void usbnet_link_change(struct usbnet *dev, bool link, bool need_reset) | ||
1657 | { | ||
1658 | /* update link after link is reseted */ | ||
1659 | if (link && !need_reset) | ||
1660 | netif_carrier_on(dev->net); | ||
1661 | else | ||
1662 | netif_carrier_off(dev->net); | ||
1663 | |||
1664 | if (need_reset && link) | ||
1665 | usbnet_defer_kevent(dev, EVENT_LINK_RESET); | ||
1666 | } | ||
1667 | EXPORT_SYMBOL(usbnet_link_change); | ||
1668 | |||
1656 | /*-------------------------------------------------------------------------*/ | 1669 | /*-------------------------------------------------------------------------*/ |
1657 | static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, | 1670 | static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, |
1658 | u16 value, u16 index, void *data, u16 size) | 1671 | u16 value, u16 index, void *data, u16 size) |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 0e5ac93bab10..eb021b8f53bd 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -245,5 +245,6 @@ extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); | |||
245 | extern int usbnet_nway_reset(struct net_device *net); | 245 | extern int usbnet_nway_reset(struct net_device *net); |
246 | 246 | ||
247 | extern int usbnet_manage_power(struct usbnet *, int); | 247 | extern int usbnet_manage_power(struct usbnet *, int); |
248 | extern void usbnet_link_change(struct usbnet *, bool, bool); | ||
248 | 249 | ||
249 | #endif /* __LINUX_USB_USBNET_H */ | 250 | #endif /* __LINUX_USB_USBNET_H */ |