iwlwifi: define and use if iwl_mvm_has_tlc_offload
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 13 Dec 2017 09:38:48 +0000 (11:38 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 20 Dec 2017 16:28:25 +0000 (18:28 +0200)
This aligns the code with the existing pattern to check
if the firmware has a certain capability.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index 037dc4a..a7892c1 100644 (file)
@@ -1914,7 +1914,7 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
 {
        struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 
-       if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD))
+       if (iwl_mvm_has_tlc_offload(mvm))
                MVM_DEBUGFS_ADD_STA_FILE(rs_data, dir, S_IRUSR);
 
        return;
index 357380a..8aed40a 100644 (file)
@@ -421,7 +421,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
        ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
        ieee80211_hw_set(hw, NEEDS_UNIQUE_STA_ADDR);
 
-       if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD)) {
+       if (iwl_mvm_has_tlc_offload(mvm)) {
                ieee80211_hw_set(hw, TX_AMPDU_SETUP_IN_HW);
                ieee80211_hw_set(hw, HAS_RATE_CONTROL);
        }
@@ -460,7 +460,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
        /* this is the case for CCK frames, it's better (only 8) for OFDM */
        hw->radiotap_timestamp.accuracy = 22;
 
-       if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD))
+       if (!iwl_mvm_has_tlc_offload(mvm))
                hw->rate_control_algorithm = RS_NAME;
 
        hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES;
index 5ecba2b..2d28e08 100644 (file)
@@ -1278,6 +1278,12 @@ static inline bool iwl_mvm_has_quota_low_latency(struct iwl_mvm *mvm)
                          IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY);
 }
 
+static inline bool iwl_mvm_has_tlc_offload(const struct iwl_mvm *mvm)
+{
+       return fw_has_capa(&mvm->fw->ucode_capa,
+                          IWL_UCODE_TLV_CAPA_TLC_OFFLOAD);
+}
+
 static inline struct agg_tx_status *
 iwl_mvm_get_agg_status(struct iwl_mvm *mvm, void *tx_resp)
 {
index 56b3cf1..60abb00 100644 (file)
@@ -4052,7 +4052,7 @@ static const struct rate_control_ops rs_mvm_ops_drv = {
 void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
                          enum nl80211_band band, bool init)
 {
-       if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD))
+       if (iwl_mvm_has_tlc_offload(mvm))
                rs_fw_rate_init(mvm, sta, band);
        else
                rs_drv_rate_init(mvm, sta, band, init);
@@ -4096,7 +4096,7 @@ static int rs_drv_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
 int iwl_mvm_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
                          bool enable)
 {
-       if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD))
+       if (iwl_mvm_has_tlc_offload(mvm))
                return rs_fw_tx_protection(mvm, mvmsta, enable);
        else
                return rs_drv_tx_protection(mvm, mvmsta, enable);
index 9d33f7a..6b2674e 100644 (file)
@@ -1443,7 +1443,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
         * if rs is registered with mac80211, then "add station" will be handled
         * via the corresponding ops, otherwise need to notify rate scaling here
         */
-       if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD))
+       if (iwl_mvm_has_tlc_offload(mvm))
                iwl_mvm_rs_add_sta(mvm, mvm_sta);
 
 update_fw:
@@ -2586,8 +2586,7 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
         * When FW supports TLC_OFFLOAD, it also implements Tx aggregation
         * manager, so this function should never be called in this case.
         */
-       if (WARN_ON_ONCE(fw_has_capa(&mvm->fw->ucode_capa,
-                                    IWL_UCODE_TLV_CAPA_TLC_OFFLOAD)))
+       if (WARN_ON_ONCE(iwl_mvm_has_tlc_offload(mvm)))
                return -EINVAL;
 
        BUILD_BUG_ON((sizeof(mvmsta->agg_tids) * BITS_PER_BYTE)
index d31e963..dda77b3 100644 (file)
@@ -1718,8 +1718,7 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid,
                ba_info->band = chanctx_conf->def.chan->band;
                iwl_mvm_hwrate_to_tx_status(rate, ba_info);
 
-               if (!fw_has_capa(&mvm->fw->ucode_capa,
-                                IWL_UCODE_TLV_CAPA_TLC_OFFLOAD)) {
+               if (!iwl_mvm_has_tlc_offload(mvm)) {
                        IWL_DEBUG_TX_REPLY(mvm,
                                           "No reclaim. Update rs directly\n");
                        iwl_mvm_rs_tx_status(mvm, sta, tid, ba_info, false);
index 2fead5e..d65e1db 100644 (file)
@@ -912,8 +912,7 @@ int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init)
        };
 
        if (WARN_ON(lq->sta_id == IWL_MVM_INVALID_STA ||
-                   fw_has_capa(&mvm->fw->ucode_capa,
-                               IWL_UCODE_TLV_CAPA_TLC_OFFLOAD)))
+                   iwl_mvm_has_tlc_offload(mvm)))
                return -EINVAL;
 
        return iwl_mvm_send_cmd(mvm, &cmd);