Skip to content

Commit 5337024

Browse files
authored
Merge pull request #36 from kitakar5525/mwifiex-ps_mode/v5.5-surface-devel
v5.5: mwifiex: disable ps_mode by default
2 parents 5ea8e5a + 49f2674 commit 5337024

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
static char *reg_alpha2;
2626
module_param(reg_alpha2, charp, 0);
2727

28+
static bool allow_ps_mode;
29+
module_param(allow_ps_mode, bool, 0444);
30+
MODULE_PARM_DESC(allow_ps_mode,
31+
"allow WiFi power management to be enabled. (default: disallowed)");
32+
2833
static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = {
2934
{
3035
.max = 3, .types = BIT(NL80211_IFTYPE_STATION) |
@@ -439,6 +444,27 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
439444

440445
ps_mode = enabled;
441446

447+
/* Allow ps_mode to be enabled only when allow_ps_mode is set
448+
* (but always allow ps_mode to be disabled in case it gets enabled
449+
* for unknown reason and you want to disable it) */
450+
if (ps_mode && !allow_ps_mode) {
451+
dev_info(priv->adapter->dev,
452+
"Request to enable ps_mode received but it's disallowed "
453+
"by module parameter. Rejecting the request.\n");
454+
455+
/* Return negative value to inform userspace tools that setting
456+
* power_save to be enabled is not permitted. */
457+
return -1;
458+
}
459+
460+
if (ps_mode)
461+
dev_warn(priv->adapter->dev,
462+
"WARN: Request to enable ps_mode received. Enabling it. "
463+
"Disable it if you encounter connection instability.\n");
464+
else
465+
dev_info(priv->adapter->dev,
466+
"Request to disable ps_mode received. Disabling it.\n");
467+
442468
return mwifiex_drv_set_power(priv, &ps_mode);
443469
}
444470

drivers/net/wireless/marvell/mwifiex/sta_cmd.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,17 +2338,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
23382338
if (ret)
23392339
return -1;
23402340

2341-
if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
2342-
/* Enable IEEE PS by default */
2343-
priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
2344-
ret = mwifiex_send_cmd(priv,
2345-
HostCmd_CMD_802_11_PS_MODE_ENH,
2346-
EN_AUTO_PS, BITMAP_STA_PS, NULL,
2347-
true);
2348-
if (ret)
2349-
return -1;
2350-
}
2351-
23522341
if (drcs) {
23532342
adapter->drcs_enabled = true;
23542343
if (ISSUPP_DRCS_ENABLED(adapter->fw_cap_info))

0 commit comments

Comments
 (0)