wifi: iwlwifi: cfg: unify num_rbds config

This should depend on both the RF (VHT/HE/EHT support) and
the MAC (<=22000 can put multiple frames into one buffer),
so unify the config in the struct iwl_cfg to just have it
sized according to the RF, and then double it for all the
MACs starting from AX210 (So/Ty).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250509104454.2582160-3-miriam.rachel.korenblit@intel.com
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
This commit is contained in:
Johannes Berg
2025-05-09 13:44:41 +03:00
committed by Miri Korenblit
parent 03e433545c
commit b8eee90f0b
12 changed files with 39 additions and 54 deletions

View File

@@ -131,16 +131,6 @@ const struct iwl_mac_cfg iwl_qu_long_latency_mac_cfg = {
.ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
};
/*
* If the device doesn't support HE, no need to have that many buffers.
* 22000 devices can split multiple frames into a single RB, so fewer are
* needed; AX210 cannot (but use smaller RBs by default) - these sizes
* were picked according to 8 MSDUs inside 256 A-MSDUs in an A-MPDU, with
* additional overhead to account for processing time.
*/
#define IWL_NUM_RBDS_NON_HE 512
#define IWL_NUM_RBDS_22000_HE 2048
/*
* All JF radio modules are part of the 9000 series, but the MAC part
* looks more like 22000. That's why this device is here, but called
@@ -182,17 +172,17 @@ const char iwl_ax201_killer_1650i_name[] =
const struct iwl_cfg iwl_qu_hr1 = {
IWL_DEVICE_22500,
.tx_with_siso_diversity = true,
.num_rbds = IWL_NUM_RBDS_22000_HE,
.num_rbds = IWL_NUM_RBDS_HE,
};
const struct iwl_cfg iwl_qu_hr = {
IWL_DEVICE_22500,
.num_rbds = IWL_NUM_RBDS_22000_HE,
.num_rbds = IWL_NUM_RBDS_HE,
};
const struct iwl_cfg iwl_qu_hr_80mhz = {
IWL_DEVICE_22500,
.num_rbds = IWL_NUM_RBDS_22000_HE,
.num_rbds = IWL_NUM_RBDS_HE,
.bw_limit = 80,
};

View File

@@ -105,7 +105,7 @@ static const struct iwl_tt_params iwl9000_tt_params = {
.dccm2_offset = IWL9000_DCCM2_OFFSET, \
.dccm2_len = IWL9000_DCCM2_LEN, \
.thermal_params = &iwl9000_tt_params, \
.num_rbds = 512, \
.num_rbds = IWL_NUM_RBDS_NON_HE, \
.vht_mu_mimo_supported = true, \
.nvm_type = IWL_NVM_EXT, \
.ht_params = { \

View File

@@ -141,16 +141,6 @@ const struct iwl_mac_cfg iwl_so_long_latency_imr_mac_cfg = {
.imr_enabled = true,
};
/*
* If the device doesn't support HE, no need to have that many buffers.
* AX210 devices can split multiple frames into a single RB, so fewer are
* needed; AX210 cannot (but use smaller RBs by default) - these sizes
* were picked according to 8 MSDUs inside 256 A-MSDUs in an A-MPDU, with
* additional overhead to account for processing time.
*/
#define IWL_NUM_RBDS_NON_HE 512
#define IWL_NUM_RBDS_AX210_HE 4096
const struct iwl_mac_cfg iwl_ma_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_AX210,
.base = &iwl_ax210_base,
@@ -193,17 +183,17 @@ const char iwl_ax210_name[] = "Intel(R) Wi-Fi 6 AX210 160MHz";
const struct iwl_cfg iwl_cfg_ma = {
.uhb_supported = true,
IWL_DEVICE_AX210,
.num_rbds = IWL_NUM_RBDS_AX210_HE,
.num_rbds = IWL_NUM_RBDS_HE,
};
const struct iwl_cfg iwl_cfg_so_a0_hr_a0 = {
IWL_DEVICE_AX210,
.num_rbds = IWL_NUM_RBDS_AX210_HE,
.num_rbds = IWL_NUM_RBDS_HE,
};
const struct iwl_cfg iwl_cfg_so_a0_hr_a0_80mhz = {
IWL_DEVICE_AX210,
.num_rbds = IWL_NUM_RBDS_AX210_HE,
.num_rbds = IWL_NUM_RBDS_HE,
.bw_limit = 80,
};

View File

@@ -106,12 +106,6 @@ static const struct iwl_family_base_params iwl_bz_base = {
.nvm_ver = IWL_BZ_NVM_VERSION, \
.nvm_type = IWL_NVM_EXT
/*
* This size was picked according to 8 MSDUs inside 512 A-MSDUs in an
* A-MPDU, with additional overhead to account for processing time.
*/
#define IWL_NUM_RBDS_BZ_EHT (512 * 16)
const struct iwl_mac_cfg iwl_bz_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_BZ,
.base = &iwl_bz_base,
@@ -142,13 +136,13 @@ const char iwl_mtp_name[] = "Intel(R) Wi-Fi 7 BE202 160MHz";
const struct iwl_cfg iwl_cfg_bz = {
.uhb_supported = true,
IWL_DEVICE_BZ,
.num_rbds = IWL_NUM_RBDS_BZ_EHT,
.num_rbds = IWL_NUM_RBDS_EHT,
};
const struct iwl_cfg iwl_cfg_bz_160mhz = {
.uhb_supported = true,
IWL_DEVICE_BZ,
.num_rbds = IWL_NUM_RBDS_BZ_EHT,
.num_rbds = IWL_NUM_RBDS_EHT,
.bw_limit = 160,
};

View File

@@ -93,7 +93,7 @@ static const struct iwl_family_base_params iwl_dr_base = {
.nvm_ver = IWL_DR_NVM_VERSION, \
.nvm_type = IWL_NVM_EXT, \
.uhb_supported = true, \
.num_rbds = IWL_NUM_RBDS_DR_EHT, \
.num_rbds = IWL_NUM_RBDS_EHT, \
.ht_params = { \
.stbc = true, \
.ldpc = true, \
@@ -101,12 +101,6 @@ static const struct iwl_family_base_params iwl_dr_base = {
BIT(NL80211_BAND_5GHZ), \
}
/*
* This size was picked according to 8 MSDUs inside 512 A-MSDUs in an
* A-MPDU, with additional overhead to account for processing time.
*/
#define IWL_NUM_RBDS_DR_EHT (512 * 16)
const struct iwl_mac_cfg iwl_dr_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_DR,
.base = &iwl_dr_base,

View File

@@ -100,7 +100,7 @@ static const struct iwl_family_base_params iwl_sc_base = {
.nvm_ver = IWL_SC_NVM_VERSION, \
.nvm_type = IWL_NVM_EXT, \
.uhb_supported = true, \
.num_rbds = IWL_NUM_RBDS_SC_EHT, \
.num_rbds = IWL_NUM_RBDS_EHT, \
.ht_params = { \
.stbc = true, \
.ldpc = true, \
@@ -108,12 +108,6 @@ static const struct iwl_family_base_params iwl_sc_base = {
BIT(NL80211_BAND_5GHZ), \
}
/*
* This size was picked according to 8 MSDUs inside 512 A-MSDUs in an
* A-MPDU, with additional overhead to account for processing time.
*/
#define IWL_NUM_RBDS_SC_EHT (512 * 16)
const struct iwl_mac_cfg iwl_sc_mac_cfg = {
.device_family = IWL_DEVICE_FAMILY_SC,
.base = &iwl_sc_base,

View File

@@ -342,6 +342,16 @@ struct iwl_mac_cfg {
imr_enabled:1;
};
/*
* These sizes were picked according to 8 MSDUs inside 64/256/612 A-MSDUs
* in an A-MPDU, with additional overhead to account for processing time.
* They will be doubled for MACs starting from So/Ty that don't support
* putting multiple frames into a single buffer.
*/
#define IWL_NUM_RBDS_NON_HE (64 * 8)
#define IWL_NUM_RBDS_HE (256 * 8)
#define IWL_NUM_RBDS_EHT (512 * 8)
/**
* struct iwl_cfg
* @fw_name_pre: Firmware filename prefix. The api version and extension

View File

@@ -1214,6 +1214,19 @@ static inline bool iwl_trans_is_hw_error_value(u32 val)
void iwl_trans_free_restart_list(void);
static inline u16 iwl_trans_get_num_rbds(struct iwl_trans *trans)
{
u16 result = trans->cfg->num_rbds;
/*
* Since AX210 family (So/Ty) the device cannot put mutliple
* frames into the same buffer, so double the value for them.
*/
if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
return 2 * result;
return result;
}
/*****************************************************
* PCIe handling
*****************************************************/

View File

@@ -256,7 +256,7 @@ int iwl_pcie_ctxt_info_gen3_alloc(struct iwl_trans *trans,
ctxt_info_gen3->mtr_size =
cpu_to_le16(TFD_QUEUE_CB_SIZE(cmdq_size));
ctxt_info_gen3->mcr_size =
cpu_to_le16(RX_QUEUE_CB_SIZE(trans->cfg->num_rbds));
cpu_to_le16(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)));
trans_pcie->ctxt_info_gen3 = ctxt_info_gen3;
trans_pcie->prph_info = prph_info;

View File

@@ -202,10 +202,10 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans,
rb_size = IWL_CTXT_INFO_RB_SIZE_4K;
}
WARN_ON(RX_QUEUE_CB_SIZE(trans->cfg->num_rbds) > 12);
WARN_ON(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)) > 12);
control_flags = IWL_CTXT_INFO_TFD_FORMAT_LONG;
control_flags |=
u32_encode_bits(RX_QUEUE_CB_SIZE(trans->cfg->num_rbds),
u32_encode_bits(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)),
IWL_CTXT_INFO_RB_CB_SIZE);
control_flags |= u32_encode_bits(rb_size, IWL_CTXT_INFO_RB_SIZE);
ctxt_info->control.control_flags = cpu_to_le32(control_flags);

View File

@@ -1864,7 +1864,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ret = -EINVAL;
goto out_free_trans;
}
trans_pcie->num_rx_bufs = iwl_trans->cfg->num_rbds;
trans_pcie->num_rx_bufs = iwl_trans_get_num_rbds(iwl_trans);
} else {
trans_pcie->num_rx_bufs = RX_QUEUE_SIZE;
}

View File

@@ -722,7 +722,7 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
spin_lock_init(&rxq->lock);
if (trans->mac_cfg->mq_rx_supported)
rxq->queue_size = trans->cfg->num_rbds;
rxq->queue_size = iwl_trans_get_num_rbds(trans);
else
rxq->queue_size = RX_QUEUE_SIZE;