Commit 5f8c35b9 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

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: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220927062611.30484-9-pkshih@realtek.com
parent 75f1ed29
...@@ -2612,6 +2612,7 @@ struct rtw89_chip_info { ...@@ -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;
......
...@@ -1324,6 +1324,17 @@ static inline u32 dle_used_size(const struct rtw89_dle_size *wde, ...@@ -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, ...@@ -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) ...@@ -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;
} }
......
...@@ -2190,6 +2190,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = { ...@@ -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,
......
...@@ -66,6 +66,8 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = { ...@@ -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),
......
...@@ -3039,6 +3039,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = { ...@@ -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,
......
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