__le16 max_tx_op;
} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_4 */
-/**
- * struct iwl_tlc_config_cmd_v5 - 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_v5 {
- 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;
- __le32 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_5 */
-
/**
* struct iwl_tlc_config_cmd - TLC configuration
* @sta_mask: station mask (in NAN we can have multiple logical stations of
}
}
-static int iwl_mld_convert_tlc_cmd_to_v5(struct iwl_tlc_config_cmd *cmd,
- struct iwl_tlc_config_cmd_v5 *cmd_v5)
-{
- if (WARN_ON_ONCE(hweight32(le32_to_cpu(cmd->sta_mask)) != 1))
- return -EINVAL;
-
- /* Convert sta_mask to sta_id */
- cmd_v5->sta_id = __ffs(le32_to_cpu(cmd->sta_mask));
-
- /* Copy all the rest */
- cmd_v5->max_ch_width = cmd->max_ch_width;
- cmd_v5->mode = cmd->mode;
- cmd_v5->chains = cmd->chains;
- cmd_v5->sgi_ch_width_supp = cmd->sgi_ch_width_supp;
- cmd_v5->flags = cmd->flags;
- cmd_v5->non_ht_rates = cmd->non_ht_rates;
-
- BUILD_BUG_ON(sizeof(cmd_v5->ht_rates) != sizeof(cmd->ht_rates));
- memcpy(cmd_v5->ht_rates, cmd->ht_rates, sizeof(cmd->ht_rates));
-
- cmd_v5->max_mpdu_len = cmd->max_mpdu_len;
- cmd_v5->max_tx_op = cmd->max_tx_op;
-
- return 0;
-}
-
-static int iwl_mld_convert_tlc_cmd_to_v4(struct iwl_tlc_config_cmd *cmd,
- struct iwl_tlc_config_cmd_v4 *cmd_v4)
-{
- if (WARN_ON_ONCE(hweight32(le32_to_cpu(cmd->sta_mask)) != 1))
- return -EINVAL;
-
- /* Convert sta_mask to sta_id */
- cmd_v4->sta_id = __ffs(le32_to_cpu(cmd->sta_mask));
-
- /* Copy everything until ht_rates */
- cmd_v4->max_ch_width = cmd->max_ch_width;
- cmd_v4->mode = cmd->mode;
- cmd_v4->chains = cmd->chains;
- cmd_v4->sgi_ch_width_supp = cmd->sgi_ch_width_supp;
- cmd_v4->flags = cmd->flags;
- cmd_v4->non_ht_rates = cmd->non_ht_rates;
-
- /* Convert ht_rates from __le32 to __le16 */
- BUILD_BUG_ON(ARRAY_SIZE(cmd_v4->ht_rates) != ARRAY_SIZE(cmd->ht_rates));
- BUILD_BUG_ON(ARRAY_SIZE(cmd_v4->ht_rates[0]) != ARRAY_SIZE(cmd->ht_rates[0]));
-
- for (int nss = 0; nss < ARRAY_SIZE(cmd->ht_rates); nss++)
- for (int bw = 0; bw < ARRAY_SIZE(cmd->ht_rates[nss]); bw++)
- cmd_v4->ht_rates[nss][bw] =
- cpu_to_le16(le32_to_cpu(cmd->ht_rates[nss][bw]));
-
- /* Copy the rest */
- cmd_v4->max_mpdu_len = cmd->max_mpdu_len;
- cmd_v4->max_tx_op = cmd->max_tx_op;
-
- return 0;
-}
-
static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld,
struct ieee80211_vif *vif,
struct iwl_mld_sta *mld_sta,
};
u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, TLC_MNG_CONFIG_CMD);
u8 cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 0);
- struct iwl_tlc_config_cmd_v5 cmd_v5 = {};
- struct iwl_tlc_config_cmd_v4 cmd_v4 = {};
void *cmd_ptr;
u8 cmd_size;
int ret;
if (cmd_ver == 6) {
cmd_ptr = &cmd;
cmd_size = sizeof(cmd);
- } else if (cmd_ver == 5) {
- /* TODO: remove support once FW moves to version 6 */
- ret = iwl_mld_convert_tlc_cmd_to_v5(&cmd, &cmd_v5);
- if (ret)
- return;
- cmd_ptr = &cmd_v5;
- cmd_size = sizeof(cmd_v5);
- } else if (cmd_ver == 4) {
- ret = iwl_mld_convert_tlc_cmd_to_v4(&cmd, &cmd_v4);
- if (ret)
- return;
- cmd_ptr = &cmd_v4;
- cmd_size = sizeof(cmd_v4);
} else {
IWL_ERR(mld, "Unsupported TLC config cmd version %d\n",
cmd_ver);