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

Commit 09f1ee8c authored by Shaul Triebitz's avatar Shaul Triebitz Committed by Luca Coelho
Browse files

iwlwifi: mvm: send the low latency command



Recently a new command was added to the firmware
for setting a MAC's low-latency mode.  Use it.

Signed-off-by: default avatarShaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent dad3340f
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -67,6 +67,10 @@
 * enum iwl_mac_conf_subcmd_ids - mac configuration command IDs
 */
enum iwl_mac_conf_subcmd_ids {
	/**
	 * @LOW_LATENCY_CMD: &struct iwl_mac_low_latency_cmd
	 */
	LOW_LATENCY_CMD = 0x3,
	/**
	 * @CHANNEL_SWITCH_NOA_NOTIF: &struct iwl_channel_switch_noa_notif
	 */
@@ -82,4 +86,19 @@ struct iwl_channel_switch_noa_notif {
	__le32 id_and_color;
} __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */

/**
 * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode'
 *
 * @mac_id: MAC ID to whom to apply the low-latency configurations
 * @low_latency_rx: 1/0 to set/clear Rx low latency direction
 * @low_latency_tx: 1/0 to set/clear Tx low latency direction
 * @reserved: reserved for alignment purposes
 */
struct iwl_mac_low_latency_cmd {
	__le32 mac_id;
	u8 low_latency_rx;
	u8 low_latency_tx;
	__le16 reserved;
} __packed; /* MAC_LOW_LATENCY_API_S_VER_1 */

#endif /* __iwl_fw_api_mac_cfg_h__ */
+23 −1
Original line number Diff line number Diff line
@@ -1032,12 +1032,34 @@ int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
{
	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
	int res;
	bool low_latency;

	lockdep_assert_held(&mvm->mutex);

	if (iwl_mvm_vif_low_latency(mvmvif) == prev)
	low_latency = iwl_mvm_vif_low_latency(mvmvif);

	if (low_latency == prev)
		return 0;

	if (fw_has_capa(&mvm->fw->ucode_capa,
			IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA)) {
		struct iwl_mac_low_latency_cmd cmd = {
			.mac_id = cpu_to_le32(mvmvif->id)
		};

		if (low_latency) {
			/* currently we don't care about the direction */
			cmd.low_latency_rx = 1;
			cmd.low_latency_tx = 1;
		}
		res = iwl_mvm_send_cmd_pdu(mvm,
					   iwl_cmd_id(LOW_LATENCY_CMD,
						      MAC_CONF_GROUP, 0),
					   0, sizeof(cmd), &cmd);
		if (res)
			IWL_ERR(mvm, "Failed to send low latency command\n");
	}

	res = iwl_mvm_update_quotas(mvm, false, NULL);
	if (res)
		return res;