2014-01-10 08:48:53

by Andreas Fenkart

[permalink] [raw]
Subject: mwifiex wowlan not working

Hi,

I'm experimenting with wowlan as described here:
http://www.spinics.net/lists/linux-wireless/msg104402.html

It's indeed very powerfu, I'm just fighting with a few minor things see below

these work nice:

wake-on ARP request for <ip addr>:
iw phy0 wowlan enable patterns ff:ff:ff:ff:ff:ff 20+08:06 46+<ip addr in hex>
sudo arping -c 3 <ip addr>

wake on multicast packet
iw phy0 wowlan enable patterns 33:33 <ipv4>
iw phy0 wowlan enable patterns 01:00:5e <ipv6>
sudo /etc/init.d/avahi-daemon restart

these fail:

iw phy0 wowlan enable magic-packet
etherwake -i wlan0 5C:F8:A1:15:1B:0B
wakeonlan 5C:F8:A1:15:1B:0B

wake-on RX packets with TCP destination port 22
iw phy0 wowlan enable patterns 44+16
<hit random keys in ssh session, established before sleep>

any hints on that

kind regards

andreas

---

wlan0 Link encap:Ethernet HWaddr 5C:F8:A1:15:1B:0B
inet addr:192.168.11.219 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::5ef8:a1ff:fe15:1b0b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:26 errors:8 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1478 (1.4 KiB) TX bytes:6535 (6.3 KiB)

driver_version = mwifiex 1.0 (14.66.9.p96)


2014-01-13 12:58:48

by Andreas Fenkart

[permalink] [raw]
Subject: Re: mwifiex wowlan not working

Hi Amitkumar,

2014/1/10 Amitkumar Karwar <[email protected]>:
>> these fail:
>>
>> iw phy0 wowlan enable magic-packet
>> etherwake -i wlan0 5C:F8:A1:15:1B:0B
>> wakeonlan 5C:F8:A1:15:1B:0B
>>
>
> It works for magic-packet, only if the packet contains device's(Marvell) MAC address and received through wireless interface.

The module is from Murata, will magic packet wakeup work with those?
http://hwaddress.com/?q=5C%3AF8%3AA1%3A15%3A1B%3A0B

> Are you generating magic packet on different device connected wirelessly?
> Is 5C:F8:A1:15:1B:0B MAC of Marvell device?
>
>> wake-on RX packets with TCP destination port 22
>> iw phy0 wowlan enable patterns 44+16
>> <hit random keys in ssh session, established before sleep>
>
> This could be a setup issue. Connection might have lost.
> Can you please confirm using TCPDUMP,sniffer etc. if TCP packets are actually transmitted by remote device?

I attached two pcap files. I'm using a router with openwrt flashed to it.

[magic packet]
I issue the command on the router, and check on the target that the
packet arrives:

router# etherwake -i wlan1 5C:F8:A1:15:1B:0B
target# tcpdump -i wlan0 -w magic-packet.pcap

After seeing that magic packet arrive, I send the target
to sleep and send the magic-packet again

[ssh-packet-while sleep]
I open up an ssh session from host via router to the the target.
I sniff on the router for outgoing packets to target

host# ssh root@target
target# iw phy0 wowlan enable patterns 44+16
target# echo mem > /sys/power/state
router# tcpdump -i wlan1 dst 192.168.11.219 -w ssh-pkt-while-sleeping.pcap


>
> Regards,
> Amitkumar Karwar

/Andreas


Attachments:
ssh-pkt-while-sleeping.pcap (1.15 kB)
magic-packet.pcap (420.00 B)
Download all attachments

2014-01-18 04:38:46

by Bing Zhao

[permalink] [raw]
Subject: RE: [PATCH] mwifiex: fix wakeup on magic packet

Hi Andreas,

> 8 bytes preamble
> 14 bytes src/dst/eth_type
> 6 bytes 0xff:0xff..
>
> http://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet
> http://en.wikipedia.org/wiki/EtherType
>
> This will fail if we VLAN or the magic packet is encapsulated
> as a UDP packet...
>
> Signed-off-by: Andreas Fenkart <[email protected]>

Thanks for your patch.

Acked-by: Bing Zhao <[email protected]>

Regards,
Bing

> ---
> drivers/net/wireless/mwifiex/cfg80211.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
> index aeaea0e..7e91587 100644
> --- a/drivers/net/wireless/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/mwifiex/cfg80211.c
> @@ -2438,7 +2438,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
> ETH_ALEN);
> mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
> ETH_ALEN;
> - mef_entry->filter[filt_num].offset = 14;
> + mef_entry->filter[filt_num].offset = 28;
> mef_entry->filter[filt_num].filt_type = TYPE_EQ;
> if (filt_num)
> mef_entry->filter[filt_num].filt_action = TYPE_OR;
> --
> 1.7.10.4


2014-01-18 04:41:47

by Bing Zhao

[permalink] [raw]
Subject: RE: mwifiex wowlan not working

SGkgQW5kcmVhcywNCg0KPiBPbmUgdGhpbmcgSSBub3RpY2VkLCB0aGVzZSB0cmlnZ2VycyBkb24n
dCB3b3JrIHVubGVzcyB5b3UgYWxzbw0KPiBlbmFibGUgYSB0cmlnZ2VyIHdpdGggaXcuIEFueSBp
ZGVhcyB3aHkgSSBuZWVkIHRvIHNldHVwIHdvd2xhbg0KPiB2aWEgYm90aCB0b29scyBpdyBhbmQg
ZXRodG9vbCBldmVuIGlmIG9ubHkgd2FudCBldGh0b29sIGZ1bmN0aW9ucz8NCj4gDQo+IGUuZy4N
Cj4gDQo+IDxmcmVzaCBib290ZWQgc3lzdGVtLCB3aWZpIGNvbm5lY3RlZD4NCj4gZXRodHRvb2wg
LXMgd2xhbjAgd29sIHUNCj4gZWNobyBtZW0gPiAvc3lzL3Bvd2VyL3N0YXRlDQo+IA0KPiAtPiBu
byB3YWtldXAgb24gcGluZyByZXF1ZXN0LCBJIHNlZSBJQ01QIHBhY2tldHMgd2l0aCB0Y3BkdW1w
DQo+IA0KPiBpdyBwaHkwIHdvd2xhbiBlbmFibGUgcGF0dGVybnMgZGU6YWQ6YmU6ZWYNCj4gZXRo
dHRvb2wgLXMgd2xhbjAgd29sIHUNCj4gZWNobyBtZW0gPiAvc3lzL3Bvd2VyL3N0YXRlDQo+IA0K
PiAtPiB3YWtldXAgb24gcGluZyByZXF1ZXN0IHdvcmtzDQo+IA0KPiBpdyBwaHkwIHdvd2xhbiBk
aXNhYmxlDQo+IA0KPiAtPiBubyBtb3JlIHdha2V1cCBvbiBwaW5nIHJlcXVlc3QNCj4gDQo+IGl3
IHBoeTAgd293bGFuIGVuYWJsZSBwYXR0ZXJucyBkZTphZDpiZTplZg0KPiANCj4gLT4gd29ya3Mg
YWdhaW4NCj4gDQo+IGl3IHBoeTAgd293bGFuIGRpc2FibGUNCj4gZXRodHRvb2wgLXMgd2xhbjAg
d29sIHUNCj4gDQo+IC0+IGRvZXNuJ3Qgd29yaw0KPiANCj4gaXcgcGh5MCB3b3dsYW4gZW5hYmxl
IHBhdHRlcm5zIGRlOmFkOmJlOmVmDQo+IA0KPiAtPiB3b3JrcyBhZ2Fpbg0KPiANCj4gQW55IGlk
ZWFzIG9uIHRoYXQ/DQoNClRoYW5rcyBmb3IgcmVwb3J0aW5nLiBXZSB3aWxsIGNoZWNrIG9uIHRo
aXMuDQoNClJlZ2FyZHMsDQpCaW5nDQoNCg==

2014-01-17 14:30:13

by Andreas Fenkart

[permalink] [raw]
Subject: [PATCH] mwifiex: fix wakeup on magic packet

8 bytes preamble
14 bytes src/dst/eth_type
6 bytes 0xff:0xff..

http://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet
http://en.wikipedia.org/wiki/EtherType

This will fail if we VLAN or the magic packet is encapsulated
as a UDP packet...

Signed-off-by: Andreas Fenkart <[email protected]>
---
drivers/net/wireless/mwifiex/cfg80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index aeaea0e..7e91587 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2438,7 +2438,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
ETH_ALEN);
mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
ETH_ALEN;
- mef_entry->filter[filt_num].offset = 14;
+ mef_entry->filter[filt_num].offset = 28;
mef_entry->filter[filt_num].filt_type = TYPE_EQ;
if (filt_num)
mef_entry->filter[filt_num].filt_action = TYPE_OR;
--
1.7.10.4


2014-01-21 10:29:39

by Amitkumar Karwar

[permalink] [raw]
Subject: RE: mwifiex wowlan not working


Hi Andreas,

>
> One thing I noticed, these triggers don't work unless you also
> enable a trigger with iw. Any ideas why I need to setup wowlan
> via both tools iw and ethtool even if only want ethtool functions?
>

"ethwool wol" configuration should work independently. This command just configures sleep condition (adapter->hs_cfg.conditions) which is used later when system suspends.

Can you please enable dynamic debug and collect logs with attached change?
1. CONFIG_DYNAMIC_DEBUG=y in kernel .config and rebuild the kernel
2. Load the driver.
3. echo "module mwifiex +p" > /sys/kernel/debug/dynamic_debug/control
4. echo "module mwifiex_usb +p" > /sys/kernel/debug/dynamic_debug/control
5. save the logs in dmesg after the test.

> e.g.
>
> <fresh booted system, wifi connected>
> ethttool -s wlan0 wol u
> echo mem > /sys/power/state
>
> -> no wakeup on ping request, I see ICMP packets with tcpdump
>
> iw phy0 wowlan enable patterns de:ad:be:ef
> ethttool -s wlan0 wol u
> echo mem > /sys/power/state
>
> -> wakeup on ping request works
>

I think, ethtool command is not taking an effect. Device waked up due to "iw wowlan" configuration.

Thanks,
Amitkumar Karwar


Attachments:
ethtool_dbg.diff (773.00 B)
ethtool_dbg.diff

2014-01-17 14:16:47

by Andreas Fenkart

[permalink] [raw]
Subject: Re: mwifiex wowlan not working

Hi,

2014/1/10 Andreas Fenkart <[email protected]>:
> these fail:
>
> iw phy0 wowlan enable magic-packet
> etherwake -i wlan0 5C:F8:A1:15:1B:0B
> wakeonlan 5C:F8:A1:15:1B:0B

see followup patch, looks like a bug

> wake-on RX packets with TCP destination port 22
> iw phy0 wowlan enable patterns 44+16

me bad here, should be: (mind the extr 0x00 after the offset)
iw phy0 wowlan enable patterns 44+00:16

> <hit random keys in ssh session, established before sleep>
works great! login through ssh, put it to sleep and wake it
up by hitting a random key. all from the same ssh shell. loving it

Also started to play around with ethtool:

http://permalink.gmane.org/gmane.linux.kernel.wireless.general/105122

One thing I noticed, these triggers don't work unless you also
enable a trigger with iw. Any ideas why I need to setup wowlan
via both tools iw and ethtool even if only want ethtool functions?

e.g.

<fresh booted system, wifi connected>
ethttool -s wlan0 wol u
echo mem > /sys/power/state

-> no wakeup on ping request, I see ICMP packets with tcpdump

iw phy0 wowlan enable patterns de:ad:be:ef
ethttool -s wlan0 wol u
echo mem > /sys/power/state

-> wakeup on ping request works

iw phy0 wowlan disable

-> no more wakeup on ping request

iw phy0 wowlan enable patterns de:ad:be:ef

-> works again

iw phy0 wowlan disable
ethttool -s wlan0 wol u

-> doesn't work

iw phy0 wowlan enable patterns de:ad:be:ef

-> works again

Any ideas on that?

2014-01-10 17:02:19

by Amitkumar Karwar

[permalink] [raw]
Subject: RE: mwifiex wowlan not working

Hi Andreas,

>
> these fail:
>
> iw phy0 wowlan enable magic-packet
> etherwake -i wlan0 5C:F8:A1:15:1B:0B
> wakeonlan 5C:F8:A1:15:1B:0B
>

It works for magic-packet, only if the packet contains device's(Marvell) MAC address and received through wireless interface.
Are you generating magic packet on different device connected wirelessly?
Is 5C:F8:A1:15:1B:0B MAC of Marvell device?

> wake-on RX packets with TCP destination port 22
> iw phy0 wowlan enable patterns 44+16
> <hit random keys in ssh session, established before sleep>

This could be a setup issue. Connection might have lost.
Can you please confirm using TCPDUMP,sniffer etc. if TCP packets are actually transmitted by remote device?

Regards,
Amitkumar Karwar