wifi: rtw89: check DLE FIFO size with reserved size

For SCC mode, some FIFO are reserved, so compare the quantity after minus
the reserved size.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220927062611.30484-9-pkshih@realtek.com
This commit is contained in:
Ping-Ke Shih 2022-09-27 14:26:10 +08:00 committed by Kalle Valo
parent 75f1ed29e4
commit 5f8c35b932
5 changed files with 20 additions and 2 deletions

View file

@ -2612,6 +2612,7 @@ struct rtw89_chip_info {
const struct rtw89_chip_ops *ops; const struct rtw89_chip_ops *ops;
const char *fw_name; const char *fw_name;
u32 fifo_size; u32 fifo_size;
u32 dle_scc_rsvd_size;
u16 max_amsdu_limit; u16 max_amsdu_limit;
bool dis_2g_40m_ul_ofdma; bool dis_2g_40m_ul_ofdma;
u32 rsvd_ple_ofst; u32 rsvd_ple_ofst;

View file

@ -1324,6 +1324,17 @@ static inline u32 dle_used_size(const struct rtw89_dle_size *wde,
ple->pge_size * (ple->lnk_pge_num + ple->unlnk_pge_num); ple->pge_size * (ple->lnk_pge_num + ple->unlnk_pge_num);
} }
static u32 dle_expected_used_size(struct rtw89_dev *rtwdev,
enum rtw89_qta_mode mode)
{
u32 size = rtwdev->chip->fifo_size;
if (mode == RTW89_QTA_SCC)
size -= rtwdev->chip->dle_scc_rsvd_size;
return size;
}
static void dle_func_en(struct rtw89_dev *rtwdev, bool enable) static void dle_func_en(struct rtw89_dev *rtwdev, bool enable)
{ {
if (enable) if (enable)
@ -1491,7 +1502,8 @@ static int dle_init(struct rtw89_dev *rtwdev, enum rtw89_qta_mode mode,
ext_wde_min_qt_wcpu = ext_cfg->wde_min_qt->wcpu; ext_wde_min_qt_wcpu = ext_cfg->wde_min_qt->wcpu;
} }
if (dle_used_size(cfg->wde_size, cfg->ple_size) != rtwdev->chip->fifo_size) { if (dle_used_size(cfg->wde_size, cfg->ple_size) !=
dle_expected_used_size(rtwdev, mode)) {
rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n"); rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
ret = -EINVAL; ret = -EINVAL;
goto error; goto error;
@ -2604,7 +2616,8 @@ static int dle_quota_change(struct rtw89_dev *rtwdev, enum rtw89_qta_mode mode)
return -EINVAL; return -EINVAL;
} }
if (dle_used_size(cfg->wde_size, cfg->ple_size) != rtwdev->chip->fifo_size) { if (dle_used_size(cfg->wde_size, cfg->ple_size) !=
dle_expected_used_size(rtwdev, mode)) {
rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n"); rtw89_err(rtwdev, "[ERR]wd/dle mem cfg\n");
return -EINVAL; return -EINVAL;
} }

View file

@ -2190,6 +2190,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
.ops = &rtw8852a_chip_ops, .ops = &rtw8852a_chip_ops,
.fw_name = "rtw89/rtw8852a_fw.bin", .fw_name = "rtw89/rtw8852a_fw.bin",
.fifo_size = 458752, .fifo_size = 458752,
.dle_scc_rsvd_size = 0,
.max_amsdu_limit = 3500, .max_amsdu_limit = 3500,
.dis_2g_40m_ul_ofdma = true, .dis_2g_40m_ul_ofdma = true,
.rsvd_ple_ofst = 0x6f800, .rsvd_ple_ofst = 0x6f800,

View file

@ -66,6 +66,8 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
const struct rtw89_chip_info rtw8852b_chip_info = { const struct rtw89_chip_info rtw8852b_chip_info = {
.chip_id = RTL8852B, .chip_id = RTL8852B,
.fifo_size = 196608,
.dle_scc_rsvd_size = 98304,
.dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) | .dma_ch_mask = BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) | BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI), BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),

View file

@ -3039,6 +3039,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
.ops = &rtw8852c_chip_ops, .ops = &rtw8852c_chip_ops,
.fw_name = "rtw89/rtw8852c_fw.bin", .fw_name = "rtw89/rtw8852c_fw.bin",
.fifo_size = 458752, .fifo_size = 458752,
.dle_scc_rsvd_size = 0,
.max_amsdu_limit = 8000, .max_amsdu_limit = 8000,
.dis_2g_40m_ul_ofdma = false, .dis_2g_40m_ul_ofdma = false,
.rsvd_ple_ofst = 0x6f800, .rsvd_ple_ofst = 0x6f800,