Commit 4b0d341b authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtw89: correct setting of RX MPDU length

Set proper setting according to RX quota, and then it doesn't break buffer
due to size of received packet exceeding buffer 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/20220506120216.58567-3-pkshih@realtek.com
parent 0cd75e4f
......@@ -2005,6 +2005,7 @@ static int rmac_init(struct rtw89_dev *rtwdev, u8 mac_idx)
#define TRXCFG_RMAC_DATA_TO 15
#define RX_MAX_LEN_UNIT 512
#define PLD_RLS_MAX_PG 127
#define RX_SPEC_MAX_LEN (11454 + RX_MAX_LEN_UNIT)
int ret;
u32 reg, rx_max_len, rx_qta;
u16 val;
......@@ -2035,11 +2036,10 @@ static int rmac_init(struct rtw89_dev *rtwdev, u8 mac_idx)
rx_qta = rtwdev->mac.dle_info.c0_rx_qta;
else
rx_qta = rtwdev->mac.dle_info.c1_rx_qta;
rx_qta = rx_qta > PLD_RLS_MAX_PG ? PLD_RLS_MAX_PG : rx_qta;
rx_max_len = (rx_qta - 1) * rtwdev->mac.dle_info.ple_pg_size /
RX_MAX_LEN_UNIT;
rx_max_len = rx_max_len > B_AX_RX_MPDU_MAX_LEN_SIZE ?
B_AX_RX_MPDU_MAX_LEN_SIZE : rx_max_len;
rx_qta = min_t(u32, rx_qta, PLD_RLS_MAX_PG);
rx_max_len = rx_qta * rtwdev->mac.dle_info.ple_pg_size;
rx_max_len = min_t(u32, rx_max_len, RX_SPEC_MAX_LEN);
rx_max_len /= RX_MAX_LEN_UNIT;
rtw89_write32_mask(rtwdev, reg, B_AX_RX_MPDU_MAX_LEN_MASK, rx_max_len);
if (rtwdev->chip->chip_id == RTL8852A &&
......
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