Skip to content

Commit

Permalink
Merge pull request #36 from kitakar5525/mwifiex-ps_mode/v5.5-surface-…
Browse files Browse the repository at this point in the history
…devel

v5.5: mwifiex: disable ps_mode by default
  • Loading branch information
qzed authored Feb 28, 2020
2 parents 5ea8e5a + 49f2674 commit 5337024
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
26 changes: 26 additions & 0 deletions drivers/net/wireless/marvell/mwifiex/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
static char *reg_alpha2;
module_param(reg_alpha2, charp, 0);

static bool allow_ps_mode;
module_param(allow_ps_mode, bool, 0444);
MODULE_PARM_DESC(allow_ps_mode,
"allow WiFi power management to be enabled. (default: disallowed)");

static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = {
{
.max = 3, .types = BIT(NL80211_IFTYPE_STATION) |
Expand Down Expand Up @@ -439,6 +444,27 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,

ps_mode = enabled;

/* Allow ps_mode to be enabled only when allow_ps_mode is set
* (but always allow ps_mode to be disabled in case it gets enabled
* for unknown reason and you want to disable it) */
if (ps_mode && !allow_ps_mode) {
dev_info(priv->adapter->dev,
"Request to enable ps_mode received but it's disallowed "
"by module parameter. Rejecting the request.\n");

/* Return negative value to inform userspace tools that setting
* power_save to be enabled is not permitted. */
return -1;
}

if (ps_mode)
dev_warn(priv->adapter->dev,
"WARN: Request to enable ps_mode received. Enabling it. "
"Disable it if you encounter connection instability.\n");
else
dev_info(priv->adapter->dev,
"Request to disable ps_mode received. Disabling it.\n");

return mwifiex_drv_set_power(priv, &ps_mode);
}

Expand Down
11 changes: 0 additions & 11 deletions drivers/net/wireless/marvell/mwifiex/sta_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2338,17 +2338,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
if (ret)
return -1;

if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
/* Enable IEEE PS by default */
priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
ret = mwifiex_send_cmd(priv,
HostCmd_CMD_802_11_PS_MODE_ENH,
EN_AUTO_PS, BITMAP_STA_PS, NULL,
true);
if (ret)
return -1;
}

if (drcs) {
adapter->drcs_enabled = true;
if (ISSUPP_DRCS_ENABLED(adapter->fw_cap_info))
Expand Down

0 comments on commit 5337024

Please sign in to comment.