]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iwlwifi: mvm: name magic numbers with enum
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Wed, 29 May 2019 12:39:07 +0000 (15:39 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 6 Sep 2019 12:31:15 +0000 (15:31 +0300)
It's hard to follow the numbers so rename it with enum

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c

index 9eddc4dc2ae6f2db28e440714f7a7df0ddc83db2..4347be6491e985139cae42a77042c7c6065f4497 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -29,7 +29,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -166,8 +166,16 @@ enum iwl_tlc_mng_ht_rates {
        IWL_TLC_MNG_HT_RATE_MAX = IWL_TLC_MNG_HT_RATE_MCS11,
 };
 
-/* Maximum supported tx antennas number */
-#define MAX_NSS 2
+enum IWL_TLC_MNG_NSS {
+       IWL_TLC_NSS_1,
+       IWL_TLC_NSS_2,
+       IWL_TLC_NSS_MAX
+};
+
+enum IWL_TLC_HT_BW_RATES {
+       IWL_TLC_HT_BW_NONE_160,
+       IWL_TLC_HT_BW_160,
+};
 
 /**
  * struct tlc_config_cmd - TLC configuration
@@ -195,7 +203,7 @@ struct iwl_tlc_config_cmd {
        u8 amsdu;
        __le16 flags;
        __le16 non_ht_rates;
-       __le16 ht_rates[MAX_NSS][2];
+       __le16 ht_rates[IWL_TLC_NSS_MAX][2];
        __le16 max_mpdu_len;
        u8 sgi_ch_width_supp;
        u8 reserved2[1];
index 08b67812e94e523e1f196c42ce0b9c36ef83050d..8f50e2b121bd0899505bd86e2c659af2b98462c9 100644 (file)
@@ -193,7 +193,7 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
        int i, highest_mcs;
 
        for (i = 0; i < sta->rx_nss; i++) {
-               if (i == MAX_NSS)
+               if (i == IWL_TLC_NSS_MAX)
                        break;
 
                highest_mcs = rs_fw_vht_highest_rx_mcs_index(vht_cap, i + 1);
@@ -204,9 +204,10 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
                if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
                        supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9);
 
-               cmd->ht_rates[i][0] = cpu_to_le16(supp);
+               cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = cpu_to_le16(supp);
                if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
-                       cmd->ht_rates[i][1] = cmd->ht_rates[i][0];
+                       cmd->ht_rates[i][IWL_TLC_HT_BW_160] =
+                               cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160];
        }
 }
 
@@ -241,7 +242,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
                le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160);
        int i;
 
-       for (i = 0; i < sta->rx_nss && i < MAX_NSS; i++) {
+       for (i = 0; i < sta->rx_nss && i < IWL_TLC_NSS_MAX; i++) {
                u16 _mcs_160 = (mcs_160 >> (2 * i)) & 0x3;
                u16 _mcs_80 = (mcs_80 >> (2 * i)) & 0x3;
                u16 _tx_mcs_160 = (tx_mcs_160 >> (2 * i)) & 0x3;
@@ -255,7 +256,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
                }
                if (_mcs_80 > _tx_mcs_80)
                        _mcs_80 = _tx_mcs_80;
-               cmd->ht_rates[i][0] =
+               cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] =
                        cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_80));
 
                /* If one side doesn't support - mark both as not supporting */
@@ -266,7 +267,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
                }
                if (_mcs_160 > _tx_mcs_160)
                        _mcs_160 = _tx_mcs_160;
-               cmd->ht_rates[i][1] =
+               cmd->ht_rates[i][IWL_TLC_HT_BW_160] =
                        cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_160));
        }
 }
@@ -300,8 +301,10 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta,
                rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd);
        } else if (ht_cap->ht_supported) {
                cmd->mode = IWL_TLC_MNG_MODE_HT;
-               cmd->ht_rates[0][0] = cpu_to_le16(ht_cap->mcs.rx_mask[0]);
-               cmd->ht_rates[1][0] = cpu_to_le16(ht_cap->mcs.rx_mask[1]);
+               cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_HT_BW_NONE_160] =
+                       cpu_to_le16(ht_cap->mcs.rx_mask[0]);
+               cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_HT_BW_NONE_160] =
+                       cpu_to_le16(ht_cap->mcs.rx_mask[1]);
        }
 }