mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
wifi: iwlwifi: mvm: clean up duplicated defines
VHT, HE and EHT rates use the same bits for NSS, so no need for defines per PHY version. Also use spatch to replace bit manipulation with FIELD_GET: @@ identifier rate; @@ -((rate & RATE_MCS_NSS_MSK) >> RATE_MCS_NSS_POS) +FIELD_GET(RATE_MCS_NSS_MSK, rate) Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230305124407.167ed9477aa8.Ibd8e71d31896e8d8f067ce4e3a6e9a0e86c78f3f@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
beddcdc489
commit
774302d2d3
5 changed files with 13 additions and 24 deletions
|
@ -373,9 +373,6 @@ enum {
|
|||
|
||||
/* Bit 4-5: (0) SISO, (1) MIMO2 (2) MIMO3 */
|
||||
#define RATE_VHT_MCS_RATE_CODE_MSK 0xf
|
||||
#define RATE_VHT_MCS_NSS_POS 4
|
||||
#define RATE_VHT_MCS_NSS_MSK (3 << RATE_VHT_MCS_NSS_POS)
|
||||
#define RATE_VHT_MCS_MIMO2_MSK BIT(RATE_VHT_MCS_NSS_POS)
|
||||
|
||||
/*
|
||||
* Legacy OFDM rate format for bits 7:0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*/
|
||||
|
||||
#include <net/mac80211.h>
|
||||
|
@ -126,7 +126,7 @@ u32 iwl_new_rate_from_v1(u32 rate_v1)
|
|||
rate_v1 & RATE_MCS_HE_MSK_V1) {
|
||||
rate_v2 |= rate_v1 & RATE_VHT_MCS_RATE_CODE_MSK;
|
||||
|
||||
rate_v2 |= rate_v1 & RATE_VHT_MCS_MIMO2_MSK;
|
||||
rate_v2 |= rate_v1 & RATE_MCS_NSS_MSK;
|
||||
|
||||
if (rate_v1 & RATE_MCS_HE_MSK_V1) {
|
||||
u32 he_type_bits = rate_v1 & RATE_MCS_HE_TYPE_MSK_V1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2005 - 2014, 2018 - 2021 Intel Corporation. All rights reserved.
|
||||
* Copyright(c) 2005 - 2014, 2018 - 2022 Intel Corporation. All rights reserved.
|
||||
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
|
||||
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
|
||||
*****************************************************************************/
|
||||
|
@ -895,8 +895,7 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
|
|||
WARN_ON_ONCE(1);
|
||||
}
|
||||
} else if (ucode_rate & RATE_MCS_VHT_MSK_V1) {
|
||||
nss = ((ucode_rate & RATE_VHT_MCS_NSS_MSK) >>
|
||||
RATE_VHT_MCS_NSS_POS) + 1;
|
||||
nss = FIELD_GET(RATE_MCS_NSS_MSK, ucode_rate) + 1;
|
||||
|
||||
if (nss == 1) {
|
||||
rate->type = LQ_VHT_SISO;
|
||||
|
@ -910,8 +909,7 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
|
|||
WARN_ON_ONCE(1);
|
||||
}
|
||||
} else if (ucode_rate & RATE_MCS_HE_MSK_V1) {
|
||||
nss = ((ucode_rate & RATE_VHT_MCS_NSS_MSK) >>
|
||||
RATE_VHT_MCS_NSS_POS) + 1;
|
||||
nss = FIELD_GET(RATE_MCS_NSS_MSK, ucode_rate) + 1;
|
||||
|
||||
if (nss == 1) {
|
||||
rate->type = LQ_HE_SISO;
|
||||
|
@ -2885,8 +2883,7 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
|
|||
nss = ((rate & RATE_HT_MCS_NSS_MSK_V1) >> RATE_HT_MCS_NSS_POS_V1) + 1;
|
||||
} else if (rate & RATE_MCS_VHT_MSK_V1) {
|
||||
mvm->drv_rx_stats.vht_frames++;
|
||||
nss = ((rate & RATE_VHT_MCS_NSS_MSK) >>
|
||||
RATE_VHT_MCS_NSS_POS) + 1;
|
||||
nss = FIELD_GET(RATE_MCS_NSS_MSK, rate) + 1;
|
||||
} else {
|
||||
mvm->drv_rx_stats.legacy_frames++;
|
||||
}
|
||||
|
@ -3665,8 +3662,7 @@ int rs_pretty_print_rate_v1(char *buf, int bufsz, const u32 rate)
|
|||
if (rate & RATE_MCS_VHT_MSK_V1) {
|
||||
type = "VHT";
|
||||
mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
|
||||
nss = ((rate & RATE_VHT_MCS_NSS_MSK)
|
||||
>> RATE_VHT_MCS_NSS_POS) + 1;
|
||||
nss = FIELD_GET(RATE_MCS_NSS_MSK, rate) + 1;
|
||||
} else if (rate & RATE_MCS_HT_MSK_V1) {
|
||||
type = "HT";
|
||||
mcs = rate & RATE_HT_MCS_INDEX_MSK_V1;
|
||||
|
@ -3675,8 +3671,7 @@ int rs_pretty_print_rate_v1(char *buf, int bufsz, const u32 rate)
|
|||
} else if (rate & RATE_MCS_HE_MSK_V1) {
|
||||
type = "HE";
|
||||
mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
|
||||
nss = ((rate & RATE_VHT_MCS_NSS_MSK)
|
||||
>> RATE_VHT_MCS_NSS_POS) + 1;
|
||||
nss = FIELD_GET(RATE_MCS_NSS_MSK, rate) + 1;
|
||||
} else {
|
||||
type = "Unknown"; /* shouldn't happen */
|
||||
}
|
||||
|
|
|
@ -253,8 +253,7 @@ static void iwl_mvm_rx_handle_tcm(struct iwl_mvm *mvm,
|
|||
ARRAY_SIZE(thresh_tpt)))
|
||||
return;
|
||||
thr = thresh_tpt[rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK];
|
||||
thr *= 1 + ((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>
|
||||
RATE_VHT_MCS_NSS_POS);
|
||||
thr *= 1 + FIELD_GET(RATE_MCS_NSS_MSK, rate_n_flags);
|
||||
}
|
||||
|
||||
thr <<= ((rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK_V1) >>
|
||||
|
@ -500,8 +499,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
|
|||
u8 stbc = (rate_n_flags & RATE_MCS_STBC_MSK) >>
|
||||
RATE_MCS_STBC_POS;
|
||||
rx_status->nss =
|
||||
((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>
|
||||
RATE_VHT_MCS_NSS_POS) + 1;
|
||||
FIELD_GET(RATE_MCS_NSS_MSK, rate_n_flags) + 1;
|
||||
rx_status->rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK;
|
||||
rx_status->encoding = RX_ENC_VHT;
|
||||
rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT;
|
||||
|
|
|
@ -1396,8 +1396,8 @@ void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
|
|||
r->idx = rate;
|
||||
} else if (format == RATE_MCS_VHT_MSK) {
|
||||
ieee80211_rate_set_vht(r, rate,
|
||||
((rate_n_flags & RATE_MCS_NSS_MSK) >>
|
||||
RATE_MCS_NSS_POS) + 1);
|
||||
FIELD_GET(RATE_MCS_NSS_MSK,
|
||||
rate_n_flags) + 1);
|
||||
r->flags |= IEEE80211_TX_RC_VHT_MCS;
|
||||
} else if (format == RATE_MCS_HE_MSK) {
|
||||
/* mac80211 cannot do this without ieee80211_tx_status_ext()
|
||||
|
@ -1428,8 +1428,7 @@ void iwl_mvm_hwrate_to_tx_rate_v1(u32 rate_n_flags,
|
|||
} else if (rate_n_flags & RATE_MCS_VHT_MSK_V1) {
|
||||
ieee80211_rate_set_vht(
|
||||
r, rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK,
|
||||
((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>
|
||||
RATE_VHT_MCS_NSS_POS) + 1);
|
||||
FIELD_GET(RATE_MCS_NSS_MSK, rate_n_flags) + 1);
|
||||
r->flags |= IEEE80211_TX_RC_VHT_MCS;
|
||||
} else {
|
||||
r->idx = iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags,
|
||||
|
|
Loading…
Reference in a new issue