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

Commit 0294d9ee authored by Emmanuel Grumbach's avatar Emmanuel Grumbach
Browse files

iwlwifi: mvm: let the firmware configure the scheduler



A new host command can be used to configure the scheduler
instead of accessing the scheduler's registers from the
driver. This is easier and less error prone since accessing
the hardware at certain moments can lead to races with the
firmware.
Prefer to use the host command whenever it is available.

Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 3cae0734
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -244,6 +244,8 @@ enum iwl_ucode_tlv_flag {
 * @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command,
 *	regardless of the band or the number of the probes. FW will calculate
 *	the actual dwell time.
 * @IWL_UCODE_TLV_API_SCD_CFG: This firmware can configure the scheduler
 *	through the dedicated host command.
 */
enum iwl_ucode_tlv_api {
	IWL_UCODE_TLV_API_BT_COEX_SPLIT         = BIT(3),
@@ -252,6 +254,7 @@ enum iwl_ucode_tlv_api {
	IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF	= BIT(7),
	IWL_UCODE_TLV_API_FRAGMENTED_SCAN	= BIT(8),
	IWL_UCODE_TLV_API_BASIC_DWELL		= BIT(13),
	IWL_UCODE_TLV_API_SCD_CFG		= BIT(15),
};

/**
+39 −0
Original line number Diff line number Diff line
@@ -592,4 +592,43 @@ static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm_tx_resp *tx_resp)
			    tx_resp->frame_count) & 0xfff;
}

/**
 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command
 * @token:
 * @sta_id: station id
 * @tid:
 * @scd_queue: scheduler queue to confiug
 * @enable: 1 queue enable, 0 queue disable
 * @aggregate: 1 aggregated queue, 0 otherwise
 * @tx_fifo: %enum iwl_mvm_tx_fifo
 * @window: BA window size
 * @ssn: SSN for the BA agreement
 */
struct iwl_scd_txq_cfg_cmd {
	u8 token;
	u8 sta_id;
	u8 tid;
	u8 scd_queue;
	u8 enable;
	u8 aggregate;
	u8 tx_fifo;
	u8 window;
	__le16 ssn;
	__le16 reserved;
} __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */

/**
 * struct iwl_scd_txq_cfg_rsp
 * @token: taken from the command
 * @sta_id: station id from the command
 * @tid: tid from the command
 * @scd_queue: scd_queue from the command
 */
struct iwl_scd_txq_cfg_rsp {
	u8 token;
	u8 sta_id;
	u8 tid;
	u8 scd_queue;
} __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */

#endif /* __fw_api_tx_h__ */
+0 −57
Original line number Diff line number Diff line
@@ -1680,63 +1680,6 @@ struct iwl_dts_measurement_notif {
	__le32 voltage;
} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S */

/**
 * enum iwl_scd_control - scheduler config command control flags
 * @IWL_SCD_CONTROL_RM_TID: remove TID from this queue
 * @IWL_SCD_CONTROL_SET_SSN: use the SSN and program it into HW
 */
enum iwl_scd_control {
	IWL_SCD_CONTROL_RM_TID	= BIT(4),
	IWL_SCD_CONTROL_SET_SSN	= BIT(5),
};

/**
 * enum iwl_scd_flags - scheduler config command flags
 * @IWL_SCD_FLAGS_SHARE_TID: multiple TIDs map to this queue
 * @IWL_SCD_FLAGS_SHARE_RA: multiple RAs map to this queue
 * @IWL_SCD_FLAGS_DQA_ENABLED: DQA is enabled
 */
enum iwl_scd_flags {
	IWL_SCD_FLAGS_SHARE_TID		= BIT(0),
	IWL_SCD_FLAGS_SHARE_RA		= BIT(1),
	IWL_SCD_FLAGS_DQA_ENABLED	= BIT(2),
};

#define IWL_SCDQ_INVALID_STA	0xff

/**
 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command
 * @token:	dialog token addba - unused legacy
 * @sta_id:	station id 4-bit
 * @tid:	TID 0..7
 * @scd_queue:	TFD queue num 0 .. 31
 * @enable:	1 queue enable, 0 queue disable
 * @aggregate:	1 aggregated queue, 0 otherwise
 * @tx_fifo:	tx fifo num 0..7
 * @window:	up to 64
 * @ssn:	starting seq num 12-bit
 * @control:	command control flags
 * @flags:	flags - see &enum iwl_scd_flags
 *
 * Note that every time the command is sent, all parameters must
 * be filled with the exception of
 *  - the SSN, which is only used with @IWL_SCD_CONTROL_SET_SSN
 *  - the window, which is only relevant when starting aggregation
 */
struct iwl_scd_txq_cfg_cmd {
	u8 token;
	u8 sta_id;
	u8 tid;
	u8 scd_queue;
	u8 enable;
	u8 aggregate;
	u8 tx_fifo;
	u8 window;
	__le16 ssn;
	u8 control;
	u8 flags;
} __packed;

/***********************************
 * TDLS API
 ***********************************/
+3 −3
Original line number Diff line number Diff line
@@ -496,14 +496,14 @@ void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif)

	switch (vif->type) {
	case NL80211_IFTYPE_P2P_DEVICE:
		iwl_mvm_disable_txq(mvm, IWL_MVM_OFFCHANNEL_QUEUE);
		iwl_mvm_disable_txq(mvm, IWL_MVM_OFFCHANNEL_QUEUE, 0);
		break;
	case NL80211_IFTYPE_AP:
		iwl_mvm_disable_txq(mvm, vif->cab_queue);
		iwl_mvm_disable_txq(mvm, vif->cab_queue, 0);
		/* fall through */
	default:
		for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
			iwl_mvm_disable_txq(mvm, vif->hw_queue[ac]);
			iwl_mvm_disable_txq(mvm, vif->hw_queue[ac], 0);
	}
}

+3 −3
Original line number Diff line number Diff line
@@ -858,9 +858,9 @@ static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm *mvm)
	       (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_D0I3_SUPPORT);
}

static inline bool iwl_mvm_is_dqa_supported(struct iwl_mvm *mvm)
static inline bool iwl_mvm_is_scd_cfg_supported(struct iwl_mvm *mvm)
{
	return mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_DQA_SUPPORT;
	return mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_API_SCD_CFG;
}

extern const u8 iwl_mvm_ac_to_tx_fifo[];
@@ -1298,7 +1298,7 @@ static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
/* hw scheduler queue config */
void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, u16 ssn,
			const struct iwl_trans_txq_scd_cfg *cfg);
void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue);
void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, u8 flags);

static inline void iwl_mvm_enable_ac_txq(struct iwl_mvm *mvm, int queue,
					 u8 fifo)
Loading