2014-06-07 02:48:16

by Bing Zhao

[permalink] [raw]
Subject: [PATCH 1/3] mwifiex: support wowlan magic-packet encapsulated as UDP packet

From: Zhiyuan Yang <[email protected]>

When magic-packet is generated as a UDP packet the offset should
be 20+8 more bytes to cover IPv4 header and UDP header. So the
total offset become 56.
Add a new MEF entry to support both magic-packet patterns
generated by different tools.

Cc: Andreas Fenkart <[email protected]>
Signed-off-by: Zhiyuan Yang <[email protected]>
Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Bing Zhao <[email protected]>
---
drivers/net/wireless/mwifiex/cfg80211.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index e95dec9..9afac2b 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2483,6 +2483,16 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
mef_entry->filter[filt_num].filt_type = TYPE_EQ;
if (filt_num)
mef_entry->filter[filt_num].filt_action = TYPE_OR;
+
+ filt_num++;
+ mef_entry->filter[filt_num].repeat = 16;
+ memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr,
+ ETH_ALEN);
+ mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
+ ETH_ALEN;
+ mef_entry->filter[filt_num].offset = 56;
+ mef_entry->filter[filt_num].filt_type = TYPE_EQ;
+ mef_entry->filter[filt_num].filt_action = TYPE_OR;
}

if (!mef_cfg.criteria)
--
1.8.2.3



2014-06-09 12:44:07

by Andreas Fenkart

[permalink] [raw]
Subject: Re: [PATCH 1/3] mwifiex: support wowlan magic-packet encapsulated as UDP packet

H Bing,

lgtm,

one question about the followup patch,
http://www.spinics.net/lists/linux-wireless/msg123503.html

how will mac events be supported in the future?
ethtool wol p - Wake on phy activity

Guess they can't be modeled with patterns

/Andreas

2014-06-07 4:47 GMT+02:00 Bing Zhao <[email protected]>:
> From: Zhiyuan Yang <[email protected]>
>
> When magic-packet is generated as a UDP packet the offset should
> be 20+8 more bytes to cover IPv4 header and UDP header. So the
> total offset become 56.
> Add a new MEF entry to support both magic-packet patterns
> generated by different tools.
>
> Cc: Andreas Fenkart <[email protected]>
> Signed-off-by: Zhiyuan Yang <[email protected]>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> Signed-off-by: Bing Zhao <[email protected]>
> ---
> drivers/net/wireless/mwifiex/cfg80211.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
> index e95dec9..9afac2b 100644
> --- a/drivers/net/wireless/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/mwifiex/cfg80211.c
> @@ -2483,6 +2483,16 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
> mef_entry->filter[filt_num].filt_type = TYPE_EQ;
> if (filt_num)
> mef_entry->filter[filt_num].filt_action = TYPE_OR;
> +
> + filt_num++;
> + mef_entry->filter[filt_num].repeat = 16;
> + memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr,
> + ETH_ALEN);
> + mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
> + ETH_ALEN;
> + mef_entry->filter[filt_num].offset = 56;
> + mef_entry->filter[filt_num].filt_type = TYPE_EQ;
> + mef_entry->filter[filt_num].filt_action = TYPE_OR;
> }
>
> if (!mef_cfg.criteria)
> --
> 1.8.2.3
>

2014-06-07 02:48:05

by Bing Zhao

[permalink] [raw]
Subject: [PATCH 3/3] mwifiex: wowlan: do not disconnect on suspend

For users who do not need wowlan, load mwifiex.ko with
disconnect_on_suspend = 1; or iw phy0 wowlan disable.

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

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 536c14a..2295263 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -26,7 +26,7 @@
#include "11n.h"
#include "cfg80211.h"

-static int disconnect_on_suspend = 1;
+static int disconnect_on_suspend;
module_param(disconnect_on_suspend, int, 0644);

/*
--
1.8.2.3


2014-06-07 02:48:03

by Bing Zhao

[permalink] [raw]
Subject: [PATCH 2/3] mwifiex: get rid of 'ethtool wol' code

From: Amitkumar Karwar <[email protected]>

"iw wowlan" command takes care all wake on wlan use cases.
So we will remove older configuration option through 'ethtool'
utility.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Bing Zhao <[email protected]>
---
drivers/net/wireless/mwifiex/Makefile | 1 -
drivers/net/wireless/mwifiex/cfg80211.c | 1 -
drivers/net/wireless/mwifiex/ethtool.c | 70 ---------------------------------
drivers/net/wireless/mwifiex/main.h | 2 -
4 files changed, 74 deletions(-)
delete mode 100644 drivers/net/wireless/mwifiex/ethtool.c

diff --git a/drivers/net/wireless/mwifiex/Makefile b/drivers/net/wireless/mwifiex/Makefile
index 2aa208f..855a376 100644
--- a/drivers/net/wireless/mwifiex/Makefile
+++ b/drivers/net/wireless/mwifiex/Makefile
@@ -39,7 +39,6 @@ mwifiex-y += sta_tx.o
mwifiex-y += sta_rx.o
mwifiex-y += uap_txrx.o
mwifiex-y += cfg80211.o
-mwifiex-y += ethtool.o
mwifiex-y += 11h.o
mwifiex-y += tdls.o
mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 9afac2b..a045f66 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2296,7 +2296,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
dev->watchdog_timeo = MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT;
dev->hard_header_len += MWIFIEX_MIN_DATA_HEADER_LEN;
- dev->ethtool_ops = &mwifiex_ethtool_ops;

mdev_priv = netdev_priv(dev);
*((unsigned long *) mdev_priv) = (unsigned long) priv;
diff --git a/drivers/net/wireless/mwifiex/ethtool.c b/drivers/net/wireless/mwifiex/ethtool.c
deleted file mode 100644
index bfb3990..0000000
--- a/drivers/net/wireless/mwifiex/ethtool.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Marvell Wireless LAN device driver: ethtool
- *
- * Copyright (C) 2013, Marvell International Ltd.
- *
- * This software file (the "File") is distributed by Marvell International
- * Ltd. under the terms of the GNU General Public License Version 2, June 1991
- * (the "License"). You may use, redistribute and/or modify this File in
- * accordance with the terms and conditions of the License, a copy of which
- * is available by writing to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
- * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
- *
- * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
- * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
- * this warranty disclaimer.
- */
-
-#include "main.h"
-
-static void mwifiex_ethtool_get_wol(struct net_device *dev,
- struct ethtool_wolinfo *wol)
-{
- struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
- u32 conditions = le32_to_cpu(priv->adapter->hs_cfg.conditions);
-
- wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY;
-
- if (conditions == HS_CFG_COND_DEF)
- return;
-
- if (conditions & HS_CFG_COND_UNICAST_DATA)
- wol->wolopts |= WAKE_UCAST;
- if (conditions & HS_CFG_COND_MULTICAST_DATA)
- wol->wolopts |= WAKE_MCAST;
- if (conditions & HS_CFG_COND_BROADCAST_DATA)
- wol->wolopts |= WAKE_BCAST;
- if (conditions & HS_CFG_COND_MAC_EVENT)
- wol->wolopts |= WAKE_PHY;
-}
-
-static int mwifiex_ethtool_set_wol(struct net_device *dev,
- struct ethtool_wolinfo *wol)
-{
- struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
- u32 conditions = 0;
-
- if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY))
- return -EOPNOTSUPP;
-
- if (wol->wolopts & WAKE_UCAST)
- conditions |= HS_CFG_COND_UNICAST_DATA;
- if (wol->wolopts & WAKE_MCAST)
- conditions |= HS_CFG_COND_MULTICAST_DATA;
- if (wol->wolopts & WAKE_BCAST)
- conditions |= HS_CFG_COND_BROADCAST_DATA;
- if (wol->wolopts & WAKE_PHY)
- conditions |= HS_CFG_COND_MAC_EVENT;
- if (wol->wolopts == 0)
- conditions |= HS_CFG_COND_DEF;
- priv->adapter->hs_cfg.conditions = cpu_to_le32(conditions);
-
- return 0;
-}
-
-const struct ethtool_ops mwifiex_ethtool_ops = {
- .get_wol = mwifiex_ethtool_get_wol,
- .set_wol = mwifiex_ethtool_set_wol,
-};
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 1398afa..d8f3bea 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -1215,8 +1215,6 @@ int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
struct device_node *node, const char *prefix);
void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);

-extern const struct ethtool_ops mwifiex_ethtool_ops;
-
void mwifiex_del_all_sta_list(struct mwifiex_private *priv);
void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac);
void
--
1.8.2.3


2014-06-10 15:42:18

by Bing Zhao

[permalink] [raw]
Subject: RE: [PATCH 2/3] mwifiex: get rid of 'ethtool wol' code

Hi John,

> From: Amitkumar Karwar <[email protected]>
>
> "iw wowlan" command takes care all wake on wlan use cases.
> So we will remove older configuration option through 'ethtool'
> utility.

Please drop this patch.
As Andreas Fenkart pointed out, "ethtool wol p" option isn't covered by "iw wowlan" command and some users may still need "ethtool wol p" feature.

The other two patches 1/3 and 3/3 are still valid.

Thanks,
Bing

>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> Signed-off-by: Bing Zhao <[email protected]>
> ---
> drivers/net/wireless/mwifiex/Makefile | 1 -
> drivers/net/wireless/mwifiex/cfg80211.c | 1 -
> drivers/net/wireless/mwifiex/ethtool.c | 70 ---------------------------------
> drivers/net/wireless/mwifiex/main.h | 2 -
> 4 files changed, 74 deletions(-)
> delete mode 100644 drivers/net/wireless/mwifiex/ethtool.c


2014-06-10 15:32:25

by Bing Zhao

[permalink] [raw]
Subject: RE: [PATCH 1/3] mwifiex: support wowlan magic-packet encapsulated as UDP packet

SGkgQW5kcmVhcywNCg0KPiBIIEJpbmcsDQo+IA0KPiBsZ3RtLA0KDQpUaGFua3MgZm9yIHlvdXIg
cmV2aWV3Lg0KDQo+IA0KPiBvbmUgcXVlc3Rpb24gYWJvdXQgdGhlIGZvbGxvd3VwIHBhdGNoLA0K
PiBodHRwOi8vd3d3LnNwaW5pY3MubmV0L2xpc3RzL2xpbnV4LXdpcmVsZXNzL21zZzEyMzUwMy5o
dG1sDQo+IA0KPiBob3cgd2lsbCBtYWMgZXZlbnRzIGJlIHN1cHBvcnRlZCBpbiB0aGUgZnV0dXJl
Pw0KPiBldGh0b29sIHdvbCBwICAtIFdha2Ugb24gcGh5IGFjdGl2aXR5DQo+IA0KPiBHdWVzcyB0
aGV5IGNhbid0IGJlIG1vZGVsZWQgd2l0aCBwYXR0ZXJucw0KDQpHb29kIGNhdGNoISBJJ3ZlIG92
ZXJsb29rZWQgdGhpcyAicGh5IGFjdGl2aXR5IiBjYXNlIHdoaWNoIGlzbid0IGNvbmZpZ3VyYWJs
ZSB2aWEgaXcgd293bGFuIGNvbW1hbmQuDQpJIHdpbGwgcmVwbHkgdG8gdGhlIHBhdGNoIGluIHRo
YXQgdGhyZWFkLg0KDQpUaGFua3MsDQpCaW5nDQoNCg==