Skip to contentSkip to conversation

usbnet & cdc-ether: Autosuspend for online devices

PATCH In review Oliver Neukum 2 participants 6 messages Dec 3, 2009 – Dec 4, 2009

Subsystems (6)
lore
Share & tools
lore

Oliver Neukum

author maintainer
#0 lore raw

PATCH 2/2 usbnet & cdc-ether: Autosuspend for online devices

Quoted 1 line

From 17b97d1c24a061843a8f707e80f23a7b0b7647df Mon Sep 17 00:00:00 2001

From: Oliver Neukum <[email protected]>
Date: Thu, 3 Dec 2009 22:08:12 +0100
Subject: [PATCH 2/2] 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 ++
 drivers/net/usb/usbnet.c    |  155 +++++++++++++++++++++++++++++++++++--------
 include/linux/usb/usbnet.h  |    6 ++
 3 files changed, 140 insertions(+), 29 deletions(-)
drivers/net/usb/cdc_ether.c +8 -0
index 075e33f..11f73dd 100644
@@ -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,
 };
 
 /*-------------------------------------------------------------------------*/
@@ -611,6 +618,7 @@ static struct usb_driver cdc_driver = {
 	.suspend =	usbnet_suspend,
 	.resume =	usbnet_resume,
 	.reset_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
index f814730..aa174df 100644
@@ -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 *);
 
Signature · 1 line
1.6.4.2
maintainer
#1 lore raw

From: Oliver Neukum <[email protected]>
Date: Thu, 3 Dec 2009 22:41:43 +0100

Quoted 11 lines

From 17b97d1c24a061843a8f707e80f23a7b0b7647df Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Thu, 3 Dec 2009 22:08:12 +0100
Subject: [PATCH 2/2] 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.

Same problem:

davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff bundle-737.mbox
Applying: cdc-ether:Implement reset_resume()
Applying: usbnet & cdc-ether: Autosuspend for online devices
error: patch failed: drivers/net/usb/cdc_ether.c:411
error: drivers/net/usb/cdc_ether.c: patch does not apply
error: patch failed: drivers/net/usb/usbnet.c:353
error: drivers/net/usb/usbnet.c: patch does not apply
Patch failed at 0002 usbnet & cdc-ether: Autosuspend for online devices
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
davem@sunset:~/src/GIT/net-next-2.6$ 

But this all might be due to some other changes I applied today and didn't push out yet to net-next-2.6, let me check on that for you.

author maintainer
#2 lore raw

Am Donnerstag, 3. Dezember 2009 22:45:32 schrieb David Miller:

Quoted 2 lines

But this all might be due to some other changes I applied today and didn't push out yet to net-next-2.6, let me check on that for you.

This is the top of my tree.

Regards
Oliver

commit 17b97d1c24a061843a8f707e80f23a7b0b7647df

Author: Oliver Neukum <[email protected]>
Date:   Thu Dec 3 22:08:12 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.

commit b215603d7bbe3907666d27ebcd6ae847dd4f3a03

Author: Oliver Neukum <[email protected]>
Date:   Thu Dec 3 22:02:11 2009 +0100

cdc-ether:Implement reset_resume()

Normal resume can do double duty as reset_resume() for this driver as it keeps no state in the device

commit 1f5865e73fb18834f52bd6e1d27bce86ff372089

Author: Shan Wei <[email protected]>
Date:   Wed Dec 2 15:39:04 2009 -0800

ip: update the description of rp_filter in ip-sysctl.txt

The commit 27fed4175acf81ddd91d9a4ee2fd298981f60295 (ip: fix logic of reverse path filter sysctl) has changed the logic of rp_filter. The document about rp_filter is out of date. Now, setting conf/all/rp_filte with 0 can also enable source validation.

Update the document according to the commit.

maintainer
#3 lore raw
In reply to David Miller

From: David Miller <[email protected]>
Date: Thu, 03 Dec 2009 13:45:32 -0800 (PST)

Quoted 2 lines

But this all might be due to some other changes I applied today and didn't push out yet to net-next-2.6, let me check on that for you.

I've resolved this, it was a conflict with Joe Perches's drivers/net coding style cleanups that went in today.

author maintainer
#4 lore raw

Am Freitag, 4. Dezember 2009 00:27:21 schrieb David Miller:

Quoted 8 lines

From: David Miller <[email protected]>
Date: Thu, 03 Dec 2009 13:45:32 -0800 (PST)

Quoted 2 lines

But this all might be due to some other changes I applied today and didn't push out yet to net-next-2.6, let me check on that for you.

I've resolved this, it was a conflict with Joe Perches's drivers/net coding style cleanups that went in today.

OK, so you don't need me to respin on a newer tree? I was doubting my own sanity.

Regards
Oliver

maintainer
#5 lore raw

From: Oliver Neukum <[email protected]>
Date: Fri, 4 Dec 2009 09:14:18 +0100

Quoted 11 lines

Am Freitag, 4. Dezember 2009 00:27:21 schrieb David Miller:

Quoted 8 lines

From: David Miller <[email protected]>
Date: Thu, 03 Dec 2009 13:45:32 -0800 (PST)

Quoted 2 lines

But this all might be due to some other changes I applied today and didn't push out yet to net-next-2.6, let me check on that for you.

I've resolved this, it was a conflict with Joe Perches's drivers/net coding style cleanups that went in today.

OK, so you don't need me to respin on a newer tree?

Nope.

Quoted 1 line

I was doubting my own sanity.

:-)