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

Commit 51498cf6 authored by Alexander Bondar's avatar Alexander Bondar Committed by Emmanuel Grumbach
Browse files

iwlwifi: mvm: Enable power save on a single P2P client interface



Enable power save on P2P client interface only if it is the
only bound interface.
Avoid using uAPSD if P2P client is associated to GO that uses
opportunistic power save. This is due to current FW limitation.

Signed-off-by: default avatarAlexander Bondar <alexander.bondar@intel.com>
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 92d85562
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@
 * @IWL_UCODE_TLV_FLAGS_STA_KEY_CMD: new ADD_STA and ADD_STA_KEY command API
 * @IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD: support device wide power command
 *	containing CAM (Continuous Active Mode) indication.
 * @IWL_UCODE_TLV_FLAGS_P2P_PS: P2P client power save is supported (only on a
 *	single bound interface).
 */
enum iwl_ucode_tlv_flag {
	IWL_UCODE_TLV_FLAGS_PAN			= BIT(0),
@@ -113,6 +115,7 @@ enum iwl_ucode_tlv_flag {
	IWL_UCODE_TLV_FLAGS_SCHED_SCAN		= BIT(17),
	IWL_UCODE_TLV_FLAGS_STA_KEY_CMD		= BIT(19),
	IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD	= BIT(20),
	IWL_UCODE_TLV_FLAGS_P2P_PS		= BIT(21),
	IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT	= BIT(24),
};

+2 −1
Original line number Diff line number Diff line
@@ -861,7 +861,8 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
		 */
		iwl_mvm_remove_time_event(mvm, mvmvif,
					  &mvmvif->time_event_data);
	} else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_QOS)) {
	} else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS |
			      BSS_CHANGED_QOS)) {
		ret = iwl_mvm_power_update_mode(mvm, vif);
		if (ret)
			IWL_ERR(mvm, "failed to update power mode\n");
+19 −3
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
	bool radar_detect = false;
	struct iwl_mvm_vif *mvmvif __maybe_unused =
		iwl_mvm_vif_from_mac80211(vif);
	bool allow_uapsd = true;

	cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
							    mvmvif->color));
@@ -354,8 +355,19 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
			cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT);
	}

	if (memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid,
	if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid,
		    ETH_ALEN))
		allow_uapsd = false;
	/*
	 * Avoid using uAPSD if P2P client is associated to GO that uses
	 * opportunistic power save. This is due to current FW limitation.
	 */
	if (vif->p2p &&
	    vif->bss_conf.p2p_noa_attr.oppps_ctwindow &
	    IEEE80211_P2P_OPPPS_ENABLE_BIT)
		allow_uapsd = false;

	if (allow_uapsd)
		iwl_mvm_power_configure_uapsd(mvm, vif, cmd);

#ifdef CONFIG_IWLWIFI_DEBUGFS
@@ -404,7 +416,11 @@ static int iwl_mvm_power_mac_update_mode(struct iwl_mvm *mvm,
	bool ba_enable;
	struct iwl_mac_power_cmd cmd = {};

	if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
	if (vif->type != NL80211_IFTYPE_STATION)
		return 0;

	if (vif->p2p &&
	    !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS))
		return 0;

	iwl_mvm_power_build_cmd(mvm, vif, &cmd);