Skip to contentSkip to conversation

mwifiex wowlan not working

PATCH In review Andreas Fenkart 3 participants 8 messages Jan 10, 2014 – Jan 21, 2014 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

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)

#1 lore raw

Hi Andreas,

Quoted 7 lines

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?

Quoted 3 lines

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

#2 lore raw

Hi Amitkumar,

2014/1/10 Amitkumar Karwar <[email protected]>:

Quoted 8 lines
Quoted 6 lines

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

Quoted 9 lines

Are you generating magic packet on different device connected wirelessly? Is 5C:F8:A1:15:1B:0B MAC of Marvell device?

Quoted 3 lines

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

Quoted 3 lines

Regards,
Amitkumar Karwar

/Andreas

#3 lore raw
In reply to Andreas Fenkart

Hi,

2014/1/10 Andreas Fenkart <[email protected]>:

Quoted 5 lines

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

Quoted 2 lines

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

Quoted 1 line

<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?

#4 lore raw

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==

#5 lore raw
In reply to Andreas Fenkart

Hi Andreas,

Quoted 5 lines

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.

Quoted 6 lines

e.g.

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

Quoted 8 lines

-> 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

ethtool.c +4 -0
index bfb3990..789236d 100644
@@ -25,6 +25,8 @@ static void mwifiex_ethtool_get_wol(struct net_device *dev,
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 	u32 conditions = le32_to_cpu(priv->adapter->hs_cfg.conditions);
 
+	pr_info("Ethtool get hs_cfg.conditions=0x%x\n", priv->adapter->hs_cfg.conditions);
+
 	wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY;
 
 	if (conditions == HS_CFG_COND_DEF)
@@ -61,6 +63,8 @@ static int mwifiex_ethtool_set_wol(struct net_device *dev,
 		conditions |= HS_CFG_COND_DEF;
 	priv->adapter->hs_cfg.conditions = cpu_to_le32(conditions);
 
+	pr_info("Ethtool set hs_cfg.conditions=0x%x\n", priv->adapter->hs_cfg.conditions);
+
 	return 0;
 }
 
#6 lore raw

PATCH 1/1 mwifiex: fix wakeup on magic packet

In reply to Andreas Fenkart

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...

---
 drivers/net/wireless/mwifiex/cfg80211.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/cfg80211.c +1 -1
index aeaea0e..7e91587 100644
@@ -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;
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#7 lore raw

RE: [PATCH] mwifiex: fix wakeup on magic packet

Hi Andreas,

Quoted 11 lines

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...

Thanks for your patch.

Regards,
Bing

Quoted 19 lines
---
 drivers/net/wireless/mwifiex/cfg80211.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/cfg80211.c +1 -2
index aeaea0e..7e91587 100644
@@ -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