Commit 2e838c6f authored by Mordechay Goodstein's avatar Mordechay Goodstein Committed by Luca Coelho

iwlwifi: mvm: name magic numbers with enum

It's hard to follow the numbers so rename it with enum
Signed-off-by: default avatarMordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent de645c93
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2017 Intel Deutschland GmbH * 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 * 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 * it under the terms of version 2 of the GNU General Public License as
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* *
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2017 Intel Deutschland GmbH * Copyright(c) 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation * Copyright(c) 2018 - 2019 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -166,8 +166,16 @@ enum iwl_tlc_mng_ht_rates { ...@@ -166,8 +166,16 @@ enum iwl_tlc_mng_ht_rates {
IWL_TLC_MNG_HT_RATE_MAX = IWL_TLC_MNG_HT_RATE_MCS11, IWL_TLC_MNG_HT_RATE_MAX = IWL_TLC_MNG_HT_RATE_MCS11,
}; };
/* Maximum supported tx antennas number */ enum IWL_TLC_MNG_NSS {
#define MAX_NSS 2 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 * struct tlc_config_cmd - TLC configuration
...@@ -195,7 +203,7 @@ struct iwl_tlc_config_cmd { ...@@ -195,7 +203,7 @@ struct iwl_tlc_config_cmd {
u8 amsdu; u8 amsdu;
__le16 flags; __le16 flags;
__le16 non_ht_rates; __le16 non_ht_rates;
__le16 ht_rates[MAX_NSS][2]; __le16 ht_rates[IWL_TLC_NSS_MAX][2];
__le16 max_mpdu_len; __le16 max_mpdu_len;
u8 sgi_ch_width_supp; u8 sgi_ch_width_supp;
u8 reserved2[1]; u8 reserved2[1];
......
...@@ -193,7 +193,7 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta, ...@@ -193,7 +193,7 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
int i, highest_mcs; int i, highest_mcs;
for (i = 0; i < sta->rx_nss; i++) { for (i = 0; i < sta->rx_nss; i++) {
if (i == MAX_NSS) if (i == IWL_TLC_NSS_MAX)
break; break;
highest_mcs = rs_fw_vht_highest_rx_mcs_index(vht_cap, i + 1); 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, ...@@ -204,9 +204,10 @@ 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][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) 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, ...@@ -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); le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160);
int i; 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_160 = (mcs_160 >> (2 * i)) & 0x3;
u16 _mcs_80 = (mcs_80 >> (2 * i)) & 0x3; u16 _mcs_80 = (mcs_80 >> (2 * i)) & 0x3;
u16 _tx_mcs_160 = (tx_mcs_160 >> (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, ...@@ -255,7 +256,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][0] = cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] =
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 */
...@@ -266,7 +267,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta, ...@@ -266,7 +267,7 @@ 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][1] = cmd->ht_rates[i][IWL_TLC_HT_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));
} }
} }
...@@ -300,8 +301,10 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta, ...@@ -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); 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[0][0] = cpu_to_le16(ht_cap->mcs.rx_mask[0]); cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_HT_BW_NONE_160] =
cmd->ht_rates[1][0] = cpu_to_le16(ht_cap->mcs.rx_mask[1]); 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]);
} }
} }
......
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