netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Wake on LAN for USB ethernet?
@ 2013-01-18  0:12 Sarah Sharp
  2013-01-18  2:39 ` Ming Lei
  0 siblings, 1 reply; 4+ messages in thread
From: Sarah Sharp @ 2013-01-18  0:12 UTC (permalink / raw)
  To: linux-usb, netdev, Petko Manolov; +Cc: Alan Stern, Greg KH, Oliver Neukum

[-- Attachment #1: Type: text/plain, Size: 1728 bytes --]

Is it reasonable to expect that Wake on LAN works if the target box is
connected via a USB-to-ethernet adapter?

One of my validation testers has a USB ethernet device that successfully
wakes up Windows from hibernate (S4), but it doesn't work under Linux.
Wake on LAN works fine with the hardwired ethernet port.  USB remote
wakeup from S3/S4 works fine with a USB keyboard.

So I need to figure out if it's an issue with the kernel, their test
suite, or the USB host controller.


I've experimented with USB ethernet devices with the pegasus driver with
no success.  Here's what I've tried:

1. Connect the USB to ethernet adapter to the rootport under the xHCI
(USB 3.0) host controller. (lsusb for the two devices I've tried is
attached)

2. Enable remote wakeup for all devices (including the PCI host) by
echoing 'enabled' to power/wakeup. (script for that attached)

3. Use ethtool to turn on WOL:
   sudo ethtool -s ethX wol g

4. Find the MAC address by running ifconfig and looking at the HWaddr
field.

5. Verify with wireshark that I can see the Magic WOL packet when I run
this command on another machine:
   sudo etherwake -i ethX macaddr

6. Suspend or hibernate the target machine, and then send the Magic WOL
packet from a second machine.


Am I missing any steps in testing this?  Does WOL just not work for USB
ethernet devices under Linux?  Perhaps just the pegasus driver doesn't
support WOL?

Note that I can't currently test USB remote wakeup for any devices under
the EHCI host controller on my Lenovo x230.  For some reason, whenever I
enable remote wakeup for the rate matching hub under the EHCI host, the
system will immediately resume when I attempt to suspend it.  Don't know
why yet.

Sarah Sharp

[-- Attachment #2: enable-usb-remote-wakeup.sh --]
[-- Type: application/x-sh, Size: 285 bytes --]

[-- Attachment #3: belkin-pegasus-lsusb.txt --]
[-- Type: text/plain, Size: 2418 bytes --]


Bus 003 Device 013: ID 050d:0121 Belkin Components F5D5050 100Mbps Ethernet
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x050d Belkin Components
  idProduct          0x0121 F5D5050 100Mbps Ethernet
  bcdDevice            1.01
  iManufacturer           1 ADMtek
  iProduct                2 USB To LAN Converter
  iSerial                 3 0001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              160mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

[-- Attachment #4: smc-pegasus-lsusb.txt --]
[-- Type: text/plain, Size: 2391 bytes --]


Bus 003 Device 012: ID 07a6:8513 ADMtek, Inc. AN8513 Ethernet
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass         0 
  bDeviceProtocol       255 
  bMaxPacketSize0         8
  idVendor           0x07a6 ADMtek, Inc.
  idProduct          0x8513 AN8513 Ethernet
  bcdDevice            2.01
  iManufacturer           1 USB
  iProduct                2 SMC2208USB/ETH
  iSerial                 3 33D0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              160mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      1 
      bInterfaceProtocol    255 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wake on LAN for USB ethernet?
  2013-01-18  0:12 Wake on LAN for USB ethernet? Sarah Sharp
@ 2013-01-18  2:39 ` Ming Lei
  2013-01-18  8:53   ` Petko Manolov
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lei @ 2013-01-18  2:39 UTC (permalink / raw)
  To: Sarah Sharp
  Cc: linux-usb, netdev, Petko Manolov, Alan Stern, Greg KH,
	Oliver Neukum

On Fri, Jan 18, 2013 at 8:12 AM, Sarah Sharp
<sarah.a.sharp@linux.intel.com> wrote:
> Is it reasonable to expect that Wake on LAN works if the target box is
> connected via a USB-to-ethernet adapter?

It is surely reasonable, and seems SMSC75xx or SMSC95xx can
bring system out of suspend.

>
> One of my validation testers has a USB ethernet device that successfully
> wakes up Windows from hibernate (S4), but it doesn't work under Linux.
> Wake on LAN works fine with the hardwired ethernet port.  USB remote
> wakeup from S3/S4 works fine with a USB keyboard.
>
> So I need to figure out if it's an issue with the kernel, their test
> suite, or the USB host controller.
>
>
> I've experimented with USB ethernet devices with the pegasus driver with
> no success.  Here's what I've tried:
>
> 1. Connect the USB to ethernet adapter to the rootport under the xHCI
> (USB 3.0) host controller. (lsusb for the two devices I've tried is
> attached)
>
> 2. Enable remote wakeup for all devices (including the PCI host) by
> echoing 'enabled' to power/wakeup. (script for that attached)
>
> 3. Use ethtool to turn on WOL:
>    sudo ethtool -s ethX wol g

Could you check here if the attribute 'power/wakeup' of the USB device
has been enabled?  If so, and step 6 still can't wakeup system, the
problem may be in the set_wol stetting on hardware of the driver since
your USB wakeup works.

Also, the wakeup enabling is missed in the pegasus_set_wol(), and
the below patch is needed:

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index a0b5807..d5304f1 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1096,6 +1096,7 @@ pegasus_set_wol(struct net_device *dev, struct
ethtool_wolinfo *wol)
 {
 	pegasus_t	*pegasus = netdev_priv(dev);
 	u8		reg78 = 0x04;
+	int		ret;

 	if (wol->wolopts & ~WOL_SUPPORTED)
 		return -EINVAL;
@@ -1110,7 +1111,11 @@ pegasus_set_wol(struct net_device *dev, struct
ethtool_wolinfo *wol)
 	else
 		pegasus->eth_regs[0] &= ~0x10;
 	pegasus->wolopts = wol->wolopts;
-	return set_register(pegasus, WakeupControl, reg78);
+
+	ret = set_register(pegasus, WakeupControl, reg78);
+	if (!ret)
+		ret = device_set_wakeup_enable(&pegasus->usb->dev, 1);
+	return ret;
 }

 static inline void pegasus_reset_wol(struct net_device *dev)


>
> 4. Find the MAC address by running ifconfig and looking at the HWaddr
> field.
>
> 5. Verify with wireshark that I can see the Magic WOL packet when I run
> this command on another machine:
>    sudo etherwake -i ethX macaddr
>
> 6. Suspend or hibernate the target machine, and then send the Magic WOL
> packet from a second machine.
>
>
> Am I missing any steps in testing this?  Does WOL just not work for USB
> ethernet devices under Linux?  Perhaps just the pegasus driver doesn't
> support WOL?

Probably the set_wol of pegasus is broken if wakeup has been enabled
on the USB device.

Thanks,
--
Ming Lei

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Wake on LAN for USB ethernet?
  2013-01-18  2:39 ` Ming Lei
@ 2013-01-18  8:53   ` Petko Manolov
       [not found]     ` <alpine.DEB.2.02.1301181047290.3637-dzx9CreErbMJK7zW1S5TsVaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Petko Manolov @ 2013-01-18  8:53 UTC (permalink / raw)
  To: Ming Lei
  Cc: Sarah Sharp, linux-usb, netdev, Petko Manolov, Alan Stern,
	Greg KH, Oliver Neukum

The code in the driver is based on the specs from ADMTek (later, 
Infineon).  Since i never suspend my machines this feature has not been 
tested by me.

However, if the proposed patch is the right thing to do i'd be happy to 
see it applied.


cheers,
Petko


On Fri, 18 Jan 2013, Ming Lei wrote:

> On Fri, Jan 18, 2013 at 8:12 AM, Sarah Sharp
> <sarah.a.sharp@linux.intel.com> wrote:
>> Is it reasonable to expect that Wake on LAN works if the target box is
>> connected via a USB-to-ethernet adapter?
>
> It is surely reasonable, and seems SMSC75xx or SMSC95xx can
> bring system out of suspend.
>
>>
>> One of my validation testers has a USB ethernet device that successfully
>> wakes up Windows from hibernate (S4), but it doesn't work under Linux.
>> Wake on LAN works fine with the hardwired ethernet port.  USB remote
>> wakeup from S3/S4 works fine with a USB keyboard.
>>
>> So I need to figure out if it's an issue with the kernel, their test
>> suite, or the USB host controller.
>>
>>
>> I've experimented with USB ethernet devices with the pegasus driver with
>> no success.  Here's what I've tried:
>>
>> 1. Connect the USB to ethernet adapter to the rootport under the xHCI
>> (USB 3.0) host controller. (lsusb for the two devices I've tried is
>> attached)
>>
>> 2. Enable remote wakeup for all devices (including the PCI host) by
>> echoing 'enabled' to power/wakeup. (script for that attached)
>>
>> 3. Use ethtool to turn on WOL:
>>    sudo ethtool -s ethX wol g
>
> Could you check here if the attribute 'power/wakeup' of the USB device
> has been enabled?  If so, and step 6 still can't wakeup system, the
> problem may be in the set_wol stetting on hardware of the driver since
> your USB wakeup works.
>
> Also, the wakeup enabling is missed in the pegasus_set_wol(), and
> the below patch is needed:
>
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index a0b5807..d5304f1 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
> @@ -1096,6 +1096,7 @@ pegasus_set_wol(struct net_device *dev, struct
> ethtool_wolinfo *wol)
> {
> 	pegasus_t	*pegasus = netdev_priv(dev);
> 	u8		reg78 = 0x04;
> +	int		ret;
>
> 	if (wol->wolopts & ~WOL_SUPPORTED)
> 		return -EINVAL;
> @@ -1110,7 +1111,11 @@ pegasus_set_wol(struct net_device *dev, struct
> ethtool_wolinfo *wol)
> 	else
> 		pegasus->eth_regs[0] &= ~0x10;
> 	pegasus->wolopts = wol->wolopts;
> -	return set_register(pegasus, WakeupControl, reg78);
> +
> +	ret = set_register(pegasus, WakeupControl, reg78);
> +	if (!ret)
> +		ret = device_set_wakeup_enable(&pegasus->usb->dev, 1);
> +	return ret;
> }
>
> static inline void pegasus_reset_wol(struct net_device *dev)
>
>
>>
>> 4. Find the MAC address by running ifconfig and looking at the HWaddr
>> field.
>>
>> 5. Verify with wireshark that I can see the Magic WOL packet when I run
>> this command on another machine:
>>    sudo etherwake -i ethX macaddr
>>
>> 6. Suspend or hibernate the target machine, and then send the Magic WOL
>> packet from a second machine.
>>
>>
>> Am I missing any steps in testing this?  Does WOL just not work for USB
>> ethernet devices under Linux?  Perhaps just the pegasus driver doesn't
>> support WOL?
>
> Probably the set_wol of pegasus is broken if wakeup has been enabled
> on the USB device.
>
> Thanks,
> --
> Ming Lei
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wake on LAN for USB ethernet?
       [not found]     ` <alpine.DEB.2.02.1301181047290.3637-dzx9CreErbMJK7zW1S5TsVaTQe2KTcn/@public.gmane.org>
@ 2013-01-18 12:57       ` Ming Lei
  0 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2013-01-18 12:57 UTC (permalink / raw)
  To: Petko Manolov
  Cc: Sarah Sharp, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Petko Manolov, Alan Stern, Greg KH,
	Oliver Neukum

On Fri, Jan 18, 2013 at 4:53 PM, Petko Manolov <petkan-nPnTwAqkgEqakBO8gow8eQ@public.gmane.org> wrote:
> The code in the driver is based on the specs from ADMTek (later, Infineon).
> Since i never suspend my machines this feature has not been tested by me.
>
> However, if the proposed patch is the right thing to do i'd be happy to see
> it applied.

I think it is the right thing, at least many network drivers do that, such as
smsc usbnet drivers and many of PCI ethernet drivers.

So I will prepare one formal version for merge.

Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-18 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18  0:12 Wake on LAN for USB ethernet? Sarah Sharp
2013-01-18  2:39 ` Ming Lei
2013-01-18  8:53   ` Petko Manolov
     [not found]     ` <alpine.DEB.2.02.1301181047290.3637-dzx9CreErbMJK7zW1S5TsVaTQe2KTcn/@public.gmane.org>
2013-01-18 12:57       ` Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).