Commit ae4c1bb0 authored by Mordechay Goodstein's avatar Mordechay Goodstein Committed by Luca Coelho

iwlwifi: rs: add support for TLC config command ver 4

The new version enables support for EHT mode configurations.

The name of IWL_TLC_HT_BW_NONE_160 change to IWL_TLC_MCS_PER_BW_80
to make the difference from 80 bandwidth (non 160), and the new bandwidth
320 which is also non 160.
Signed-off-by: default avatarMordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211210090244.7d1a57f3df1b.Ibc01dde2b064329ad5f5bcefa83d1998d557cbdb@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 5c3310c2
...@@ -116,9 +116,20 @@ enum IWL_TLC_MNG_NSS { ...@@ -116,9 +116,20 @@ enum IWL_TLC_MNG_NSS {
IWL_TLC_NSS_MAX IWL_TLC_NSS_MAX
}; };
enum IWL_TLC_HT_BW_RATES { /**
IWL_TLC_HT_BW_NONE_160, * enum IWL_TLC_MCS_PER_BW - mcs index per BW
IWL_TLC_HT_BW_160, * @IWL_TLC_MCS_PER_BW_80: mcs for bw - 20Hhz, 40Hhz, 80Hhz
* @IWL_TLC_MCS_PER_BW_160: mcs for bw - 160Mhz
* @IWL_TLC_MCS_PER_BW_320: mcs for bw - 320Mhz
* @IWL_TLC_MCS_PER_BW_NUM_V3: number of entries up to version 3
* @IWL_TLC_MCS_PER_BW_NUM_V4: number of entries from version 4
*/
enum IWL_TLC_MCS_PER_BW {
IWL_TLC_MCS_PER_BW_80,
IWL_TLC_MCS_PER_BW_160,
IWL_TLC_MCS_PER_BW_320,
IWL_TLC_MCS_PER_BW_NUM_V3 = IWL_TLC_MCS_PER_BW_160 + 1,
IWL_TLC_MCS_PER_BW_NUM_V4 = IWL_TLC_MCS_PER_BW_320 + 1,
}; };
/** /**
...@@ -131,8 +142,8 @@ enum IWL_TLC_HT_BW_RATES { ...@@ -131,8 +142,8 @@ enum IWL_TLC_HT_BW_RATES {
* @amsdu: TX amsdu is supported * @amsdu: TX amsdu is supported
* @flags: bitmask of &enum iwl_tlc_mng_cfg_flags * @flags: bitmask of &enum iwl_tlc_mng_cfg_flags
* @non_ht_rates: bitmap of supported legacy rates * @non_ht_rates: bitmap of supported legacy rates
* @ht_rates: bitmap of &enum iwl_tlc_mng_ht_rates, per <nss, channel-width> * @ht_rates: bitmap of &enum iwl_tlc_mng_ht_rates, per &enum IWL_TLC_MCS_PER_BW
* pair (0 - 80mhz width and below, 1 - 160mhz). * <nss, channel-width> pair (0 - 80mhz width and below, 1 - 160mhz).
* @max_mpdu_len: max MPDU length, in bytes * @max_mpdu_len: max MPDU length, in bytes
* @sgi_ch_width_supp: bitmap of SGI support per channel width * @sgi_ch_width_supp: bitmap of SGI support per channel width
* use BIT(@enum iwl_tlc_mng_cfg_cw) * use BIT(@enum iwl_tlc_mng_cfg_cw)
...@@ -140,7 +151,7 @@ enum IWL_TLC_HT_BW_RATES { ...@@ -140,7 +151,7 @@ enum IWL_TLC_HT_BW_RATES {
* @max_tx_op: max TXOP in uSecs for all AC (BK, BE, VO, VI), * @max_tx_op: max TXOP in uSecs for all AC (BK, BE, VO, VI),
* set zero for no limit. * set zero for no limit.
*/ */
struct iwl_tlc_config_cmd { struct iwl_tlc_config_cmd_v3 {
u8 sta_id; u8 sta_id;
u8 reserved1[3]; u8 reserved1[3];
u8 max_ch_width; u8 max_ch_width;
...@@ -149,13 +160,44 @@ struct iwl_tlc_config_cmd { ...@@ -149,13 +160,44 @@ struct iwl_tlc_config_cmd {
u8 amsdu; u8 amsdu;
__le16 flags; __le16 flags;
__le16 non_ht_rates; __le16 non_ht_rates;
__le16 ht_rates[IWL_TLC_NSS_MAX][2]; __le16 ht_rates[IWL_TLC_NSS_MAX][IWL_TLC_MCS_PER_BW_NUM_V3];
__le16 max_mpdu_len; __le16 max_mpdu_len;
u8 sgi_ch_width_supp; u8 sgi_ch_width_supp;
u8 reserved2; u8 reserved2;
__le32 max_tx_op; __le32 max_tx_op;
} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_3 */ } __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_3 */
/**
* struct tlc_config_cmd - TLC configuration
* @sta_id: station id
* @reserved1: reserved
* @max_ch_width: max supported channel width from &enum iwl_tlc_mng_cfg_cw
* @mode: &enum iwl_tlc_mng_cfg_mode
* @chains: bitmask of &enum iwl_tlc_mng_cfg_chains
* @sgi_ch_width_supp: bitmap of SGI support per channel width
* use BIT(&enum iwl_tlc_mng_cfg_cw)
* @flags: bitmask of &enum iwl_tlc_mng_cfg_flags
* @non_ht_rates: bitmap of supported legacy rates
* @ht_rates: bitmap of &enum iwl_tlc_mng_ht_rates, per <nss, channel-width>
* pair (0 - 80mhz width and below, 1 - 160mhz, 2 - 320mhz).
* @max_mpdu_len: max MPDU length, in bytes
* @max_tx_op: max TXOP in uSecs for all AC (BK, BE, VO, VI),
* set zero for no limit.
*/
struct iwl_tlc_config_cmd_v4 {
u8 sta_id;
u8 reserved1[3];
u8 max_ch_width;
u8 mode;
u8 chains;
u8 sgi_ch_width_supp;
__le16 flags;
__le16 non_ht_rates;
__le16 ht_rates[IWL_TLC_NSS_MAX][IWL_TLC_MCS_PER_BW_NUM_V4];
__le16 max_mpdu_len;
__le16 max_tx_op;
} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_4 */
/** /**
* enum iwl_tlc_update_flags - updated fields * enum iwl_tlc_update_flags - updated fields
* @IWL_TLC_NOTIF_FLAG_RATE: last initial rate update * @IWL_TLC_NOTIF_FLAG_RATE: last initial rate update
......
...@@ -129,7 +129,7 @@ int rs_fw_vht_highest_rx_mcs_index(const struct ieee80211_sta_vht_cap *vht_cap, ...@@ -129,7 +129,7 @@ int rs_fw_vht_highest_rx_mcs_index(const struct ieee80211_sta_vht_cap *vht_cap,
static void static void
rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta, rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
const struct ieee80211_sta_vht_cap *vht_cap, const struct ieee80211_sta_vht_cap *vht_cap,
struct iwl_tlc_config_cmd *cmd) struct iwl_tlc_config_cmd_v4 *cmd)
{ {
u16 supp; u16 supp;
int i, highest_mcs; int i, highest_mcs;
...@@ -154,7 +154,7 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta, ...@@ -154,7 +154,7 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
if (sta->bandwidth == IEEE80211_STA_RX_BW_20) if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9); supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9);
cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = cpu_to_le16(supp); cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] = cpu_to_le16(supp);
/* /*
* Check if VHT extended NSS indicates that the bandwidth/NSS * Check if VHT extended NSS indicates that the bandwidth/NSS
* configuration is supported - only for MCS 0 since we already * configuration is supported - only for MCS 0 since we already
...@@ -164,8 +164,8 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta, ...@@ -164,8 +164,8 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
ieee80211_get_vht_max_nss(&ieee_vht_cap, ieee80211_get_vht_max_nss(&ieee_vht_cap,
IEEE80211_VHT_CHANWIDTH_160MHZ, IEEE80211_VHT_CHANWIDTH_160MHZ,
0, true, nss) >= nss) 0, true, nss) >= nss)
cmd->ht_rates[i][IWL_TLC_HT_BW_160] = cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_160] =
cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160]; cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80];
} }
} }
...@@ -189,7 +189,7 @@ static u16 rs_fw_he_ieee80211_mcs_to_rs_mcs(u16 mcs) ...@@ -189,7 +189,7 @@ static u16 rs_fw_he_ieee80211_mcs_to_rs_mcs(u16 mcs)
static void static void
rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta, rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
struct ieee80211_supported_band *sband, struct ieee80211_supported_band *sband,
struct iwl_tlc_config_cmd *cmd) struct iwl_tlc_config_cmd_v4 *cmd)
{ {
const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
u16 mcs_160 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); u16 mcs_160 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160);
...@@ -219,7 +219,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta, ...@@ -219,7 +219,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
} }
if (_mcs_80 > _tx_mcs_80) if (_mcs_80 > _tx_mcs_80)
_mcs_80 = _tx_mcs_80; _mcs_80 = _tx_mcs_80;
cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] =
cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_80)); cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_80));
/* If one side doesn't support - mark both as not supporting */ /* If one side doesn't support - mark both as not supporting */
...@@ -230,14 +230,14 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta, ...@@ -230,14 +230,14 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
} }
if (_mcs_160 > _tx_mcs_160) if (_mcs_160 > _tx_mcs_160)
_mcs_160 = _tx_mcs_160; _mcs_160 = _tx_mcs_160;
cmd->ht_rates[i][IWL_TLC_HT_BW_160] = cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_160] =
cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_160)); cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_160));
} }
} }
static void rs_fw_set_supp_rates(struct ieee80211_sta *sta, static void rs_fw_set_supp_rates(struct ieee80211_sta *sta,
struct ieee80211_supported_band *sband, struct ieee80211_supported_band *sband,
struct iwl_tlc_config_cmd *cmd) struct iwl_tlc_config_cmd_v4 *cmd)
{ {
int i; int i;
u16 supp = 0; u16 supp = 0;
...@@ -263,15 +263,15 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta, ...@@ -263,15 +263,15 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta,
rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd); rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd);
} else if (ht_cap->ht_supported) { } else if (ht_cap->ht_supported) {
cmd->mode = IWL_TLC_MNG_MODE_HT; cmd->mode = IWL_TLC_MNG_MODE_HT;
cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_HT_BW_NONE_160] = cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_MCS_PER_BW_80] =
cpu_to_le16(ht_cap->mcs.rx_mask[0]); cpu_to_le16(ht_cap->mcs.rx_mask[0]);
/* the station support only a single receive chain */ /* the station support only a single receive chain */
if (sta->smps_mode == IEEE80211_SMPS_STATIC) if (sta->smps_mode == IEEE80211_SMPS_STATIC)
cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_HT_BW_NONE_160] = cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_MCS_PER_BW_80] =
0; 0;
else else
cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_HT_BW_NONE_160] = cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_MCS_PER_BW_80] =
cpu_to_le16(ht_cap->mcs.rx_mask[1]); cpu_to_le16(ht_cap->mcs.rx_mask[1]);
} }
} }
...@@ -423,23 +423,18 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -423,23 +423,18 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
u32 cmd_id = iwl_cmd_id(TLC_MNG_CONFIG_CMD, DATA_PATH_GROUP, 0); u32 cmd_id = iwl_cmd_id(TLC_MNG_CONFIG_CMD, DATA_PATH_GROUP, 0);
struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; struct ieee80211_supported_band *sband = hw->wiphy->bands[band];
u16 max_amsdu_len = rs_fw_get_max_amsdu_len(sta); u16 max_amsdu_len = rs_fw_get_max_amsdu_len(sta);
struct iwl_tlc_config_cmd cfg_cmd = { struct iwl_tlc_config_cmd_v4 cfg_cmd = {
.sta_id = mvmsta->sta_id, .sta_id = mvmsta->sta_id,
.max_ch_width = update ? .max_ch_width = update ?
rs_fw_bw_from_sta_bw(sta) : RATE_MCS_CHAN_WIDTH_20, rs_fw_bw_from_sta_bw(sta) : RATE_MCS_CHAN_WIDTH_20,
.flags = cpu_to_le16(rs_fw_get_config_flags(mvm, sta, sband)), .flags = cpu_to_le16(rs_fw_get_config_flags(mvm, sta, sband)),
.chains = rs_fw_set_active_chains(iwl_mvm_get_valid_tx_ant(mvm)), .chains = rs_fw_set_active_chains(iwl_mvm_get_valid_tx_ant(mvm)),
.sgi_ch_width_supp = rs_fw_sgi_cw_support(sta), .sgi_ch_width_supp = rs_fw_sgi_cw_support(sta),
.max_mpdu_len = cpu_to_le16(max_amsdu_len), .max_mpdu_len = iwl_mvm_is_csum_supported(mvm) ?
.amsdu = iwl_mvm_is_csum_supported(mvm), cpu_to_le16(max_amsdu_len) : 0,
}; };
int ret; int ret;
u16 cmd_size = sizeof(cfg_cmd); int cmd_ver;
/* In old versions of the API the struct is 4 bytes smaller */
if (iwl_fw_lookup_cmd_ver(mvm->fw, DATA_PATH_GROUP,
TLC_MNG_CONFIG_CMD, 0) < 3)
cmd_size -= 4;
memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers)); memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
...@@ -454,8 +449,41 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -454,8 +449,41 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
*/ */
sta->max_amsdu_len = max_amsdu_len; sta->max_amsdu_len = max_amsdu_len;
ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC, cmd_size, cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, DATA_PATH_GROUP,
&cfg_cmd); TLC_MNG_CONFIG_CMD, 0);
if (cmd_ver == 4) {
ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC,
sizeof(cfg_cmd), &cfg_cmd);
} else if (cmd_ver < 4) {
struct iwl_tlc_config_cmd_v3 cfg_cmd_v3 = {
.sta_id = cfg_cmd.sta_id,
.max_ch_width = cfg_cmd.max_ch_width,
.mode = cfg_cmd.mode,
.chains = cfg_cmd.chains,
.amsdu = !!cfg_cmd.max_mpdu_len,
.flags = cfg_cmd.flags,
.non_ht_rates = cfg_cmd.non_ht_rates,
.ht_rates[0][0] = cfg_cmd.ht_rates[0][0],
.ht_rates[0][1] = cfg_cmd.ht_rates[0][1],
.ht_rates[1][0] = cfg_cmd.ht_rates[1][0],
.ht_rates[1][1] = cfg_cmd.ht_rates[1][1],
.sgi_ch_width_supp = cfg_cmd.sgi_ch_width_supp,
.max_mpdu_len = cfg_cmd.max_mpdu_len,
};
u16 cmd_size = sizeof(cfg_cmd_v3);
/* In old versions of the API the struct is 4 bytes smaller */
if (iwl_fw_lookup_cmd_ver(mvm->fw, DATA_PATH_GROUP,
TLC_MNG_CONFIG_CMD, 0) < 3)
cmd_size -= 4;
ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC, cmd_size,
&cfg_cmd_v3);
} else {
ret = -EINVAL;
}
if (ret) if (ret)
IWL_ERR(mvm, "Failed to send rate scale config (%d)\n", ret); IWL_ERR(mvm, "Failed to send rate scale config (%d)\n", ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment