iwlwifi: rs: align to new TLC config command API
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Thu, 8 Oct 2020 15:12:45 +0000 (18:12 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 8 Oct 2020 17:14:57 +0000 (20:14 +0300)
The new API adds 4 bytes at end of the struct.  We just need to make
sure that we don't break compatibility with old FWs.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008181047.bb31ce80fc55.I8a272d1da1334b1805761c0731e5d0c76ca2ef29@changeid
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c

index 73b839c..1ea54f6 100644 (file)
@@ -193,6 +193,8 @@ enum IWL_TLC_HT_BW_RATES {
  * @sgi_ch_width_supp: bitmap of SGI support per channel width
  *                    use BIT(@enum iwl_tlc_mng_cfg_cw)
  * @reserved2: reserved
+ * @max_tx_op: max TXOP in uSecs for all AC (BK, BE, VO, VI),
+ *            set zero for no limit.
  */
 struct iwl_tlc_config_cmd {
        u8 sta_id;
@@ -206,8 +208,9 @@ struct iwl_tlc_config_cmd {
        __le16 ht_rates[IWL_TLC_NSS_MAX][2];
        __le16 max_mpdu_len;
        u8 sgi_ch_width_supp;
-       u8 reserved2[1];
-} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_2 */
+       u8 reserved2;
+       __le32 max_tx_op;
+} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_3 */
 
 /**
  * enum iwl_tlc_update_flags - updated fields
index 0121232..e0e8090 100644 (file)
@@ -468,6 +468,12 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
                .amsdu = iwl_mvm_is_csum_supported(mvm),
        };
        int ret;
+       u16 cmd_size = sizeof(cfg_cmd);
+
+       /* 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));
 
@@ -482,7 +488,7 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
         */
        sta->max_amsdu_len = max_amsdu_len;
 
-       ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC, sizeof(cfg_cmd),
+       ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC, cmd_size,
                                   &cfg_cmd);
        if (ret)
                IWL_ERR(mvm, "Failed to send rate scale config (%d)\n", ret);