Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89716344 authored by Alexander Bondar's avatar Alexander Bondar Committed by Johannes Berg
Browse files

iwlwifi: mvm: Add PBW snoozing enablement



The Performance Based Window snooze mechanism is based on uAPSD and is
used in low-medium traffic scenarios, in order to provide better power
performance while insuring low latency and jitter for the incoming traffic.
This patch enables PBW snoozing in case uAPSD is enabled and all ACs are
uAPSD trigger and delivery enabled.

Signed-off-by: default avatarAlexander Bondar <alexander.bondar@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent a20fd398
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -73,5 +73,8 @@
#define IWL_MVM_PS_HEAVY_RX_THLD_PACKETS	20
#define IWL_MVM_PS_HEAVY_TX_THLD_PERCENT	50
#define IWL_MVM_PS_HEAVY_RX_THLD_PERCENT	50
#define IWL_MVM_PS_SNOOZE_INTERVAL		25
#define IWL_MVM_PS_SNOOZE_WINDOW		50
#define IWL_MVM_WOWLAN_PS_SNOOZE_WINDOW		25

#endif /* __MVM_CONSTANTS_H */
+8 −0
Original line number Diff line number Diff line
@@ -352,6 +352,10 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm,
		IWL_DEBUG_POWER(mvm, "lprx_rssi_threshold=%d\n", val);
		dbgfs_pm->lprx_rssi_threshold = val;
		break;
	case MVM_DEBUGFS_PM_SNOOZE_ENABLE:
		IWL_DEBUG_POWER(mvm, "snooze_enable=%d\n", val);
		dbgfs_pm->snooze_ena = val;
		break;
	}
}

@@ -405,6 +409,10 @@ static ssize_t iwl_dbgfs_pm_params_write(struct file *file,
		    POWER_LPRX_RSSI_THRESHOLD_MIN)
			return -EINVAL;
		param = MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD;
	} else if (!strncmp("snooze_enable=", buf, 14)) {
		if (sscanf(buf + 14, "%d", &val) != 1)
			return -EINVAL;
		param = MVM_DEBUGFS_PM_SNOOZE_ENABLE;
	} else {
		return -EINVAL;
	}
+6 −2
Original line number Diff line number Diff line
@@ -155,8 +155,12 @@ struct iwl_powertable_cmd {
 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
 *			Default: 80dbm
 * @num_skip_dtim:	Number of DTIMs to skip if Skip over DTIM flag is set
 * @snooze_interval:	TBD
 * @snooze_window:	TBD
 * @snooze_interval:	Maximum time between attempts to retrieve buffered data
 *			from the AP [msec]
 * @snooze_window:	A window of time in which PBW snoozing insures that all
 *			packets received. It is also the minimum time from last
 *			received unicast RX packet, before client stops snoozing
 *			for data. [msec]
 * @snooze_step:	TBD
 * @qndp_tid:		TID client shall use for uAPSD QNDP triggers
 * @uapsd_ac_flags:	Set trigger-enabled and delivery-enabled indication for
+2 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ enum iwl_dbgfs_pm_mask {
	MVM_DEBUGFS_PM_DISABLE_POWER_OFF = BIT(5),
	MVM_DEBUGFS_PM_LPRX_ENA = BIT(6),
	MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7),
	MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8),
};

struct iwl_dbgfs_pm {
@@ -191,6 +192,7 @@ struct iwl_dbgfs_pm {
	bool disable_power_off;
	bool lprx_ena;
	u32 lprx_rssi_threshold;
	bool snooze_ena;
	int mask;
};

+35 −0
Original line number Diff line number Diff line
@@ -301,6 +301,20 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
			cpu_to_le32(IWL_MVM_UAPSD_RX_DATA_TIMEOUT);
		cmd->tx_data_timeout_uapsd =
			cpu_to_le32(IWL_MVM_UAPSD_TX_DATA_TIMEOUT);

		if (cmd->uapsd_ac_flags == (BIT(IEEE80211_AC_VO) |
					    BIT(IEEE80211_AC_VI) |
					    BIT(IEEE80211_AC_BE) |
					    BIT(IEEE80211_AC_BK))) {
			cmd->flags |= cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK);
			cmd->snooze_interval =
				cpu_to_le16(IWL_MVM_PS_SNOOZE_INTERVAL);
			cmd->snooze_window =
				(mvm->cur_ucode == IWL_UCODE_WOWLAN) ?
				cpu_to_le16(IWL_MVM_WOWLAN_PS_SNOOZE_WINDOW) :
				cpu_to_le16(IWL_MVM_PS_SNOOZE_WINDOW);
		}

		cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP;
		cmd->heavy_tx_thld_packets =
			IWL_MVM_PS_HEAVY_TX_THLD_PACKETS;
@@ -340,6 +354,14 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
	}
	if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD)
		cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold;
	if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SNOOZE_ENABLE) {
		if (mvmvif->dbgfs_pm.snooze_ena)
			cmd->flags |=
				cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK);
		else
			cmd->flags &=
				cpu_to_le16(~POWER_FLAGS_SNOOZE_ENA_MSK);
	}
#endif /* CONFIG_IWLWIFI_DEBUGFS */
}

@@ -475,6 +497,19 @@ static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm,
			pos += scnprintf(buf+pos, bufsz-pos,
					 "heavy_rx_thld_percentage = %d\n",
					 cmd.heavy_rx_thld_percentage);
			pos +=
			scnprintf(buf+pos, bufsz-pos, "snooze_enable = %d\n",
				  (cmd.flags &
				   cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) ?
				  1 : 0);
		}
		if (cmd.flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
			pos += scnprintf(buf+pos, bufsz-pos,
					 "snooze_interval = %d\n",
					 cmd.snooze_interval);
			pos += scnprintf(buf+pos, bufsz-pos,
					 "snooze_window = %d\n",
					 cmd.snooze_window);
		}
	}
	return pos;