Commit 468133c5 authored by Maithili Hinge's avatar Maithili Hinge Committed by Kalle Valo

mwifiex: Move code for wowlan magic-packet and patterns to a function

This patch moves code for wowlan magic-packet and patterns to a function
mwifiex_set_mef_filter.
Signed-off-by: default avatarMaithili Hinge <maithili@marvell.com>
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent ca5b20e6
...@@ -2425,30 +2425,16 @@ mwifiex_is_pattern_supported(struct cfg80211_pkt_pattern *pat, s8 *byte_seq, ...@@ -2425,30 +2425,16 @@ mwifiex_is_pattern_supported(struct cfg80211_pkt_pattern *pat, s8 *byte_seq,
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, static int mwifiex_set_mef_filter(struct mwifiex_private *priv,
struct cfg80211_wowlan *wowlan) struct cfg80211_wowlan *wowlan)
{ {
struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); int i, filt_num = 0, ret = 0;
struct mwifiex_ds_mef_cfg mef_cfg;
struct mwifiex_mef_entry *mef_entry;
int i, filt_num = 0, ret;
bool first_pat = true; bool first_pat = true;
u8 byte_seq[MWIFIEX_MEF_MAX_BYTESEQ + 1]; u8 byte_seq[MWIFIEX_MEF_MAX_BYTESEQ + 1];
const u8 ipv4_mc_mac[] = {0x33, 0x33}; const u8 ipv4_mc_mac[] = {0x33, 0x33};
const u8 ipv6_mc_mac[] = {0x01, 0x00, 0x5e}; const u8 ipv6_mc_mac[] = {0x01, 0x00, 0x5e};
struct mwifiex_private *priv = struct mwifiex_ds_mef_cfg mef_cfg;
mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); struct mwifiex_mef_entry *mef_entry;
if (!wowlan) {
dev_warn(adapter->dev, "None of the WOWLAN triggers enabled\n");
return 0;
}
if (!priv->media_connected) {
dev_warn(adapter->dev,
"Can not configure WOWLAN in disconnected state\n");
return 0;
}
mef_entry = kzalloc(sizeof(*mef_entry), GFP_KERNEL); mef_entry = kzalloc(sizeof(*mef_entry), GFP_KERNEL);
if (!mef_entry) if (!mef_entry)
...@@ -2465,7 +2451,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, ...@@ -2465,7 +2451,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
if (!mwifiex_is_pattern_supported(&wowlan->patterns[i], if (!mwifiex_is_pattern_supported(&wowlan->patterns[i],
byte_seq, byte_seq,
MWIFIEX_MEF_MAX_BYTESEQ)) { MWIFIEX_MEF_MAX_BYTESEQ)) {
wiphy_err(wiphy, "Pattern not supported\n"); dev_err(priv->adapter->dev, "Pattern not supported\n");
kfree(mef_entry); kfree(mef_entry);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -2537,6 +2523,36 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, ...@@ -2537,6 +2523,36 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
return ret; return ret;
} }
static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
struct cfg80211_wowlan *wowlan)
{
struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
int ret = 0;
struct mwifiex_private *priv =
mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
if (!wowlan) {
dev_warn(adapter->dev, "None of the WOWLAN triggers enabled\n");
return 0;
}
if (!priv->media_connected) {
dev_warn(adapter->dev,
"Can not configure WOWLAN in disconnected state\n");
return 0;
}
if (wowlan->n_patterns || wowlan->magic_pkt) {
ret = mwifiex_set_mef_filter(priv, wowlan);
if (ret) {
dev_err(adapter->dev, "Failed to set MEF filter\n");
return ret;
}
}
return ret;
}
static int mwifiex_cfg80211_resume(struct wiphy *wiphy) static int mwifiex_cfg80211_resume(struct wiphy *wiphy)
{ {
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment