USB autosuspend for cdc-ether
Subsystems (6)
PATCH 1/1 USB autosuspend for cdc-ether
Hi David,
here's a new, tested version of autosuspend for cdc-ether with a few glitches fixed. I think it addresses everything you mentioned. Could you provide some feedback about what's wrong with it or an acknowledgement?
Regards
Oliver
commit cb0634eee6f96fb24044c961d7dffefed7b6457e
Author: Oliver Neukum <[email protected]> Date: Mon Nov 23 16:04:45 2009 +0100
usb:cdc-ether:implement power management for online devices
This implements USB autosuspend for cdc-ether devices that support remote wakeup while they are online. For reception remote wakeup and the last busy functionality of usbcore is used.
Transmission is done with an anchor for deferred transmission and the async pm methods of usbcore.
For devices that don't do remote wakeup power management while offline is provided for.
drivers/net/usb/cdc_ether.c +8 -0
@@ -411,6 +411,12 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)return 0 ; } +static int cdc_manage_power (struct usbnet *dev,int on) +{ + dev->intf->needs_remote_wakeup = on; +return 0 ; +} +static const struct driver_info cdc_info = { .description ="CDC Ethernet Device" , .flags =FLAG_ETHER ,
@@ -418,6 +424,7 @@ static const struct driver_info cdc_info = { .bind = cdc_bind, .unbind = usbnet_cdc_unbind, .status = cdc_status, + .manage_power = cdc_manage_power, };/*-------------------------------------------------------------------------*/
@@ -610,6 +617,7 @@ static struct usb_driver cdc_driver = { .disconnect = usbnet_disconnect, .suspend = usbnet_suspend, .resume = usbnet_resume, + .supports_autosuspend = 1, };
drivers/net/usb/usbnet.c +123 -29
286 lines not on this page · raw message
include/linux/usb/usbnet.h +6 -0
@@ -55,6 +55,7 @@ struct usbnet {struct sk_buff_head done;struct sk_buff_head rxq_pause;struct urb *interrupt; +struct usb_anchor deferred;struct tasklet_struct bh;struct work_struct kevent;
@@ -65,6 +66,8 @@ struct usbnet {# define EVENT_STS_SPLIT 3# define EVENT_LINK_RESET 4# define EVENT_RX_PAUSED 5 +# define EVENT_DEV_WAKING 6 +# define EVENT_DEV_ASLEEP 7 };static inline struct usb_driver *driver_of (struct usb_interface *intf)
@@ -107,6 +110,9 @@ struct driver_info {/* see if peer is connected ... can sleep */ int (*check_connect)(struct usbnet *); +/* (dis)activate runtime power management */ +int (*manage_power)(struct usbnet *,int ); +/* for status polling */ void (*status)(struct usbnet *,struct urb *);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Oliver,
Interesting patch, I'm going to try and add support for this to smsc95xx.
A few things I noticed:
drivers/net/usb/usbnet.c kevent (struct work_struct *work) · line 971
Quoted 12 lines
drivers/net/usb/usbnet.c +4
-0@@ -929,7 +961,11 @@ kevent (struct work_struct *work)int retval =0 ;clear_bit (EVENT_LINK_RESET , &dev->flags); + status =usb_autopm_get_interface (dev->intf); +if (status <0 ) + goto skip_reset;if (info->link_reset && (retval = info->link_reset (dev)) <0 ) { +skip_reset: devinfo(dev, "link reset failed (%d) usbnet usb-%s-%s, %s", retval, dev->udev->bus->bus_name, dev->udev->devpath,
on EVENT_LINK_RESET you call usb_autopm_get_interface with no matching usb_autopm_put_interface, so you leak 1 reference count and the device never autosuspends.
drivers/net/usb/usbnet.c static void tx_complete (struct urb *urb) · line 1000
Quoted 9 lines
drivers/net/usb/usbnet.c +1
-1@@ -958,7 +994,7 @@ static void tx_complete (struct urb *urb)switch (urb->status) {case -EPIPE : -usbnet_defer_kevent (dev,EVENT_TX_HALT ); +usbnet_defer_kevent (dev,EVENT_TX_HALT );break ;/* software-driven interface shutdown */
The only change here is the addition of trailing whitespace (which both checkpatch.pl and git complain about). You should run your patch through scripts/checkpatch.pl and fix these up.
--
Steve
A message that is not in the archive (sent off-list or not yet received): OFCBC12A15.7006C53A-ON80257678.00524557-80257678.005373C0-sdUf+H5yV5I@public.gmane.org
Am Dienstag, 24. November 2009 16:11:28 schrieb [email protected]:
Quoted 5 lines
Interesting patch, I'm going to try and add support for this to smsc95xx.
A few things I noticed:
Hi,
this version should fix what you mentioned.
Regards
Oliver
--
drivers/net/usb/cdc_ether.c +8 -0
@@ -411,6 +411,12 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)return 0 ; } +static int cdc_manage_power (struct usbnet *dev,int on) +{ + dev->intf->needs_remote_wakeup = on; +return 0 ; +} +static const struct driver_info cdc_info = { .description ="CDC Ethernet Device" , .flags =FLAG_ETHER ,
@@ -418,6 +424,7 @@ static const struct driver_info cdc_info = { .bind = cdc_bind, .unbind = usbnet_cdc_unbind, .status = cdc_status, + .manage_power = cdc_manage_power, };/*-------------------------------------------------------------------------*/
@@ -610,6 +617,7 @@ static struct usb_driver cdc_driver = { .disconnect = usbnet_disconnect, .suspend = usbnet_suspend, .resume = usbnet_resume, + .supports_autosuspend = 1, };
drivers/net/usb/usbnet.c +125 -28
285 lines not on this page · raw message
include/linux/usb/usbnet.h +6 -0
@@ -55,6 +55,7 @@ struct usbnet {struct sk_buff_head done;struct sk_buff_head rxq_pause;struct urb *interrupt; +struct usb_anchor deferred;struct tasklet_struct bh;struct work_struct kevent;
@@ -65,6 +66,8 @@ struct usbnet {# define EVENT_STS_SPLIT 3# define EVENT_LINK_RESET 4# define EVENT_RX_PAUSED 5 +# define EVENT_DEV_WAKING 6 +# define EVENT_DEV_ASLEEP 7 };static inline struct usb_driver *driver_of (struct usb_interface *intf)
@@ -107,6 +110,9 @@ struct driver_info {/* see if peer is connected ... can sleep */ int (*check_connect)(struct usbnet *); +/* (dis)activate runtime power management */ +int (*manage_power)(struct usbnet *,int ); +/* for status polling */ void (*status)(struct usbnet *,struct urb *);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 200911250939.33127.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org
Oliver Neukum <[email protected]> wrote on 25/11/2009 08:39:33:
Quoted 3 lines
Hi,
this version should fix what you mentioned.
Thanks, it does.
checkpatch.pl still shows 31 errors though, mostly trailing whitespace, and the patch doesn't cleanly apply to net-next-2.6. Two hunks fail to apply in cdc_ether.c.
Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): OF4FE9C59B.DA63AAE2-ON80257679.0046C1C2-80257679.004A1287-sdUf+H5yV5I@public.gmane.org
Am Mittwoch, 25. November 2009 14:29:00 schrieb [email protected]:
Quoted 10 lines
Oliver Neukum <[email protected]> wrote on 25/11/2009 08:39:33:
Quoted 3 lines
Hi,
this version should fix what you mentioned.
Thanks, it does.
checkpatch.pl still shows 31 errors though, mostly trailing whitespace, and the patch doesn't cleanly apply to net-next-2.6. Two hunks fail to apply in
cdc_ether.c.
Here we go again. The script complains still a bt but that's necessary to keep a uniform style. Happy with this version?
Against net-next-2.6.
Regards
Oliver
--
commit ab6d67f2f64f087c15c9899447cc297f7fd2e7b2
Author: Oliver Neukum <[email protected]> Date: Wed Nov 25 16:45:58 2009 +0100
usbnet & cdc-ether: autosuspend for online devices
using remote wakeup and delayed transmission to allow online device to go into usb autosuspend minimal alternate support for devices that don't support remote wakeup
drivers/net/usb/cdc_ether.c +8 -0
@@ -411,6 +411,12 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)return 0 ; } +static int cdc_manage_power (struct usbnet *dev,int on) +{ + dev->intf->needs_remote_wakeup = on; +return 0 ; +} +static const struct driver_info cdc_info = { .description ="CDC Ethernet Device" , .flags =FLAG_ETHER ,
@@ -418,6 +424,7 @@ static const struct driver_info cdc_info = { .bind = cdc_bind, .unbind = usbnet_cdc_unbind, .status = cdc_status, + .manage_power = cdc_manage_power, };static const struct driver_info mbm_info = {
@@ -578,6 +585,7 @@ static struct usb_driver cdc_driver = { .disconnect = usbnet_disconnect, .suspend = usbnet_suspend, .resume = usbnet_resume, + .supports_autosuspend = 1, };
drivers/net/usb/usbnet.c +126 -29
287 lines not on this page · raw message
include/linux/usb/usbnet.h +6 -0
@@ -55,6 +55,7 @@ struct usbnet {struct sk_buff_head done;struct sk_buff_head rxq_pause;struct urb *interrupt; +struct usb_anchor deferred;struct tasklet_struct bh;struct work_struct kevent;
@@ -65,6 +66,8 @@ struct usbnet {# define EVENT_STS_SPLIT 3# define EVENT_LINK_RESET 4# define EVENT_RX_PAUSED 5 +# define EVENT_DEV_WAKING 6 +# define EVENT_DEV_ASLEEP 7 };static inline struct usb_driver *driver_of (struct usb_interface *intf)
@@ -108,6 +111,9 @@ struct driver_info {/* see if peer is connected ... can sleep */ int (*check_connect)(struct usbnet *); +/* (dis)activate runtime power management */ +int (*manage_power)(struct usbnet *,int ); +/* for status polling */ void (*status)(struct usbnet *,struct urb *);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html