diff mbox series

[v2] wifi: rtw88: usb: Further limit the TX aggregation

Message ID dfb019b6-4285-4381-86d2-d85409abee4b@gmail.com
State New
Headers show
Series [v2] wifi: rtw88: usb: Further limit the TX aggregation | expand

Commit Message

Bitterblue Smith June 10, 2024, 5:27 p.m. UTC
Currently the number of frames sent to the chip in a single USB Request
Block is limited only by the size of the TX buffer, which is 20 KiB.
Testing reveals that as many as 13 frames get aggregated. This is more
than what any of the chips would like to receive. RTL8822CU, RTL8822BU,
and RTL8821CU want at most 3 frames, and RTL8723DU wants only 1 frame
per URB.

RTL8723DU in particular reliably malfunctions during a speed test. All
traffic seems to stop. Pinging the AP no longer works.

Fix this problem by limiting the number of frames sent to the chip in a
single URB according to what each chip likes.

Also configure RTL8822CU, RTL8822BU, and RTL8821CU to expect 3 frames
per URB.

RTL8703B may or may not be found in USB devices. Declare that it wants
only 1 frame per URB, just in case.

Also, since we're touching these, initialise the members of
rtw{8703b,8723d,8821c,8822b,8822c}_hw_spec in the same order they are
declared.

Tested with RTL8723DU and RTL8811CU.

Cc: stable@vger.kernel.org
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
 - Use rtw_write8_mask and GENMASK.
 - Initialise the members of rtw{8703b,8723d,8821c,8822b,8822c}_hw_spec
   in the same order they are declared.
---
 drivers/net/wireless/realtek/rtw88/mac.c      |  9 ++++
 drivers/net/wireless/realtek/rtw88/main.h     |  2 +
 drivers/net/wireless/realtek/rtw88/reg.h      |  1 +
 drivers/net/wireless/realtek/rtw88/rtw8703b.c | 21 ++++-----
 drivers/net/wireless/realtek/rtw88/rtw8723d.c | 38 ++++++++--------
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 38 ++++++++--------
 drivers/net/wireless/realtek/rtw88/rtw8822b.c | 39 ++++++++--------
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 45 ++++++++++---------
 drivers/net/wireless/realtek/rtw88/usb.c      |  4 +-
 9 files changed, 107 insertions(+), 90 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index 0dba8aae7716..564f5988ee82 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -1201,6 +1201,15 @@  static int __priority_queue_cfg(struct rtw_dev *rtwdev,
 	rtw_write16(rtwdev, REG_FIFOPAGE_CTRL_2 + 2, fifo->rsvd_boundary);
 	rtw_write16(rtwdev, REG_BCNQ1_BDNY_V1, fifo->rsvd_boundary);
 	rtw_write32(rtwdev, REG_RXFF_BNDY, chip->rxff_size - C2H_PKT_BUF - 1);
+
+	if (rtwdev->hci.type == RTW_HCI_TYPE_USB) {
+		rtw_write8_mask(rtwdev, REG_AUTO_LLT_V1, BIT_MASK_BLK_DESC_NUM,
+				chip->usb_tx_agg_desc_num);
+
+		rtw_write8(rtwdev, REG_AUTO_LLT_V1 + 3, chip->usb_tx_agg_desc_num);
+		rtw_write8_set(rtwdev, REG_TXDMA_OFFSET_CHK + 1, BIT(1));
+	}
+
 	rtw_write8_set(rtwdev, REG_AUTO_LLT_V1, BIT_AUTO_INIT_LLT_V1);
 
 	if (!check_hw_ready(rtwdev, REG_AUTO_LLT_V1, BIT_AUTO_INIT_LLT_V1, 0))
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 49894331f7b4..49a3fd4fb7dc 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -1197,6 +1197,8 @@  struct rtw_chip_info {
 	u16 fw_fifo_addr[RTW_FW_FIFO_MAX];
 	const struct rtw_fwcd_segs *fwcd_segs;
 
+	u8 usb_tx_agg_desc_num;
+
 	u8 default_1ss_tx_path;
 
 	bool path_div_supported;
diff --git a/drivers/net/wireless/realtek/rtw88/reg.h b/drivers/net/wireless/realtek/rtw88/reg.h
index b122f226924b..02ef9a77316b 100644
--- a/drivers/net/wireless/realtek/rtw88/reg.h
+++ b/drivers/net/wireless/realtek/rtw88/reg.h
@@ -270,6 +270,7 @@ 
 #define BIT_MASK_BCN_HEAD_1_V1	0xfff
 #define REG_AUTO_LLT_V1		0x0208
 #define BIT_AUTO_INIT_LLT_V1	BIT(0)
+#define BIT_MASK_BLK_DESC_NUM	GENMASK(7, 4)
 #define REG_DWBCN0_CTRL		0x0208
 #define BIT_BCN_VALID		BIT(16)
 #define REG_TXDMA_OFFSET_CHK	0x020C
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8703b.c b/drivers/net/wireless/realtek/rtw88/rtw8703b.c
index 8919f9e11f03..6a1d274ae1ca 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c
@@ -2013,6 +2013,7 @@  const struct rtw_chip_info rtw8703b_hw_spec = {
 	.tx_stbc = false,
 	.max_power_index = 0x3f,
 	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
+	.usb_tx_agg_desc_num = 1, /* Not sure if this chip has USB interface */
 
 	.path_div_supported = false,
 	.ht_supported = true,
@@ -2065,25 +2066,26 @@  const struct rtw_chip_info rtw8703b_hw_spec = {
 	.bt_rssi_type = COEX_BTRSSI_RATIO,
 	.ant_isolation = 15,
 	.rssi_tolerance = 2,
-	.bt_rssi_step = bt_rssi_step_8703b,
-	.wl_rssi_step = wl_rssi_step_8703b,
 	/* sant -> shared antenna, nsant -> non-shared antenna
 	 * Not sure if 8703b versions with non-shard antenna even exist.
 	 */
 	.table_sant_num = ARRAY_SIZE(table_sant_8703b),
-	.table_sant = table_sant_8703b,
 	.table_nsant_num = 0,
-	.table_nsant = NULL,
 	.tdma_sant_num = ARRAY_SIZE(tdma_sant_8703b),
-	.tdma_sant = tdma_sant_8703b,
 	.tdma_nsant_num = 0,
-	.tdma_nsant = NULL,
-	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8703b),
-	.wl_rf_para_tx = rf_para_tx_8703b,
-	.wl_rf_para_rx = rf_para_rx_8703b,
 	.bt_afh_span_bw20 = 0x20,
 	.bt_afh_span_bw40 = 0x30,
 	.afh_5g_num = ARRAY_SIZE(afh_5g_8703b),
+	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8703b),
+	.coex_info_hw_regs_num = 0,
+	.bt_rssi_step = bt_rssi_step_8703b,
+	.wl_rssi_step = wl_rssi_step_8703b,
+	.table_nsant = NULL,
+	.table_sant = table_sant_8703b,
+	.tdma_sant = tdma_sant_8703b,
+	.tdma_nsant = NULL,
+	.wl_rf_para_tx = rf_para_tx_8703b,
+	.wl_rf_para_rx = rf_para_rx_8703b,
 	.afh_5g = afh_5g_8703b,
 	/* REG_BTG_SEL doesn't seem to have a counterpart in the
 	 * vendor driver. Mathematically it's REG_PAD_CTRL1 + 3.
@@ -2096,7 +2098,6 @@  const struct rtw_chip_info rtw8703b_hw_spec = {
 	/* These registers are used to read (and print) from if
 	 * CONFIG_RTW88_DEBUGFS is enabled.
 	 */
-	.coex_info_hw_regs_num = 0,
 	.coex_info_hw_regs = NULL,
 };
 EXPORT_SYMBOL(rtw8703b_hw_spec);
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723d.c b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
index f8df4c84d39f..9249c5dc14a0 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
@@ -2164,22 +2164,25 @@  const struct rtw_chip_info rtw8723d_hw_spec = {
 	.txff_size = 32768,
 	.rxff_size = 16384,
 	.rsvd_drv_pg_num = 8,
-	.txgi_factor = 1,
-	.is_pwr_by_rate_dec = true,
-	.max_power_index = 0x3f,
-	.csi_buf_pg_num = 0,
 	.band = RTW_BAND_2G,
 	.page_size = TX_PAGE_SIZE,
+	.csi_buf_pg_num = 0,
 	.dig_min = 0x20,
+	.txgi_factor = 1,
+	.is_pwr_by_rate_dec = true,
+	.rx_ldpc = false,
+	.max_power_index = 0x3f,
+	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
+	.usb_tx_agg_desc_num = 1,
 	.ht_supported = true,
 	.vht_supported = false,
 	.lps_deep_mode_supported = 0,
 	.sys_func_en = 0xFD,
 	.pwr_on_seq = card_enable_flow_8723d,
 	.pwr_off_seq = card_disable_flow_8723d,
-	.page_table = page_table_8723d,
 	.rqpn_table = rqpn_table_8723d,
 	.prioq_addrs = &rtw8723x_common.prioq_addrs,
+	.page_table = page_table_8723d,
 	.intf_table = &phy_para_table_8723d,
 	.dig = rtw8723x_common.dig,
 	.dig_cck = rtw8723x_common.dig_cck,
@@ -2193,10 +2196,8 @@  const struct rtw_chip_info rtw8723d_hw_spec = {
 	.rf_tbl = {&rtw8723d_rf_a_tbl},
 	.rfe_defs = rtw8723d_rfe_defs,
 	.rfe_defs_size = ARRAY_SIZE(rtw8723d_rfe_defs),
-	.rx_ldpc = false,
-	.pwr_track_tbl = &rtw8723d_rtw_pwr_track_tbl,
 	.iqk_threshold = 8,
-	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
+	.pwr_track_tbl = &rtw8723d_rtw_pwr_track_tbl,
 	.max_scan_ie_len = IEEE80211_MAX_DATA_LEN,
 
 	.coex_para_ver = 0x2007022f,
@@ -2209,26 +2210,25 @@  const struct rtw_chip_info rtw8723d_hw_spec = {
 	.bt_rssi_type = COEX_BTRSSI_RATIO,
 	.ant_isolation = 15,
 	.rssi_tolerance = 2,
-	.wl_rssi_step = wl_rssi_step_8723d,
-	.bt_rssi_step = bt_rssi_step_8723d,
 	.table_sant_num = ARRAY_SIZE(table_sant_8723d),
-	.table_sant = table_sant_8723d,
 	.table_nsant_num = ARRAY_SIZE(table_nsant_8723d),
-	.table_nsant = table_nsant_8723d,
 	.tdma_sant_num = ARRAY_SIZE(tdma_sant_8723d),
-	.tdma_sant = tdma_sant_8723d,
 	.tdma_nsant_num = ARRAY_SIZE(tdma_nsant_8723d),
-	.tdma_nsant = tdma_nsant_8723d,
-	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8723d),
-	.wl_rf_para_tx = rf_para_tx_8723d,
-	.wl_rf_para_rx = rf_para_rx_8723d,
 	.bt_afh_span_bw20 = 0x20,
 	.bt_afh_span_bw40 = 0x30,
 	.afh_5g_num = ARRAY_SIZE(afh_5g_8723d),
+	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8723d),
+	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8723d),
+	.bt_rssi_step = bt_rssi_step_8723d,
+	.wl_rssi_step = wl_rssi_step_8723d,
+	.table_nsant = table_nsant_8723d,
+	.table_sant = table_sant_8723d,
+	.tdma_sant = tdma_sant_8723d,
+	.tdma_nsant = tdma_nsant_8723d,
+	.wl_rf_para_tx = rf_para_tx_8723d,
+	.wl_rf_para_rx = rf_para_rx_8723d,
 	.afh_5g = afh_5g_8723d,
 	.btg_reg = &btg_reg_8723d,
-
-	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8723d),
 	.coex_info_hw_regs = coex_info_hw_regs_8723d,
 };
 EXPORT_SYMBOL(rtw8723d_hw_spec);
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index fe5d8e188350..553c36c4ba3b 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -2001,22 +2001,25 @@  const struct rtw_chip_info rtw8821c_hw_spec = {
 	.txff_size = 65536,
 	.rxff_size = 16384,
 	.rsvd_drv_pg_num = 8,
-	.txgi_factor = 1,
-	.is_pwr_by_rate_dec = true,
-	.max_power_index = 0x3f,
-	.csi_buf_pg_num = 0,
 	.band = RTW_BAND_2G | RTW_BAND_5G,
 	.page_size = TX_PAGE_SIZE,
+	.csi_buf_pg_num = 0,
 	.dig_min = 0x1c,
+	.txgi_factor = 1,
+	.is_pwr_by_rate_dec = true,
+	.rx_ldpc = false,
+	.max_power_index = 0x3f,
+	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2,
+	.usb_tx_agg_desc_num = 3,
 	.ht_supported = true,
 	.vht_supported = true,
 	.lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK),
 	.sys_func_en = 0xD8,
 	.pwr_on_seq = card_enable_flow_8821c,
 	.pwr_off_seq = card_disable_flow_8821c,
-	.page_table = page_table_8821c,
 	.rqpn_table = rqpn_table_8821c,
 	.prioq_addrs = &prioq_addrs_8821c,
+	.page_table = page_table_8821c,
 	.intf_table = &phy_para_table_8821c,
 	.dig = rtw8821c_dig,
 	.rf_base_addr = {0x2800, 0x2c00},
@@ -2028,12 +2031,10 @@  const struct rtw_chip_info rtw8821c_hw_spec = {
 	.rf_tbl = {&rtw8821c_rf_a_tbl},
 	.rfe_defs = rtw8821c_rfe_defs,
 	.rfe_defs_size = ARRAY_SIZE(rtw8821c_rfe_defs),
-	.rx_ldpc = false,
-	.pwr_track_tbl = &rtw8821c_rtw_pwr_track_tbl,
 	.iqk_threshold = 8,
+	.pwr_track_tbl = &rtw8821c_rtw_pwr_track_tbl,
 	.bfer_su_max_num = 2,
 	.bfer_mu_max_num = 1,
-	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2,
 	.max_scan_ie_len = IEEE80211_MAX_DATA_LEN,
 
 	.coex_para_ver = 0x19092746,
@@ -2046,25 +2047,24 @@  const struct rtw_chip_info rtw8821c_hw_spec = {
 	.bt_rssi_type = COEX_BTRSSI_RATIO,
 	.ant_isolation = 15,
 	.rssi_tolerance = 2,
-	.wl_rssi_step = wl_rssi_step_8821c,
-	.bt_rssi_step = bt_rssi_step_8821c,
 	.table_sant_num = ARRAY_SIZE(table_sant_8821c),
-	.table_sant = table_sant_8821c,
 	.table_nsant_num = ARRAY_SIZE(table_nsant_8821c),
-	.table_nsant = table_nsant_8821c,
 	.tdma_sant_num = ARRAY_SIZE(tdma_sant_8821c),
-	.tdma_sant = tdma_sant_8821c,
 	.tdma_nsant_num = ARRAY_SIZE(tdma_nsant_8821c),
-	.tdma_nsant = tdma_nsant_8821c,
-	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8821c),
-	.wl_rf_para_tx = rf_para_tx_8821c,
-	.wl_rf_para_rx = rf_para_rx_8821c,
 	.bt_afh_span_bw20 = 0x24,
 	.bt_afh_span_bw40 = 0x36,
 	.afh_5g_num = ARRAY_SIZE(afh_5g_8821c),
-	.afh_5g = afh_5g_8821c,
-
+	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8821c),
 	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8821c),
+	.bt_rssi_step = bt_rssi_step_8821c,
+	.wl_rssi_step = wl_rssi_step_8821c,
+	.table_nsant = table_nsant_8821c,
+	.table_sant = table_sant_8821c,
+	.tdma_sant = tdma_sant_8821c,
+	.tdma_nsant = tdma_nsant_8821c,
+	.wl_rf_para_tx = rf_para_tx_8821c,
+	.wl_rf_para_rx = rf_para_rx_8821c,
+	.afh_5g = afh_5g_8821c,
 	.coex_info_hw_regs = coex_info_hw_regs_8821c,
 };
 EXPORT_SYMBOL(rtw8821c_hw_spec);
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 3017a9760da8..442883d998aa 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -2541,22 +2541,26 @@  const struct rtw_chip_info rtw8822b_hw_spec = {
 	.rxff_size = 24576,
 	.fw_rxff_size = 12288,
 	.rsvd_drv_pg_num = 8,
-	.txgi_factor = 1,
-	.is_pwr_by_rate_dec = true,
-	.max_power_index = 0x3f,
-	.csi_buf_pg_num = 0,
 	.band = RTW_BAND_2G | RTW_BAND_5G,
 	.page_size = TX_PAGE_SIZE,
+	.csi_buf_pg_num = 0,
 	.dig_min = 0x1c,
+	.txgi_factor = 1,
+	.is_pwr_by_rate_dec = true,
+	.rx_ldpc = true,
+	.max_power_index = 0x3f,
+	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2,
+	.fw_fifo_addr = {0x780, 0x700, 0x780, 0x660, 0x650, 0x680},
+	.usb_tx_agg_desc_num = 3,
 	.ht_supported = true,
 	.vht_supported = true,
 	.lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK),
 	.sys_func_en = 0xDC,
 	.pwr_on_seq = card_enable_flow_8822b,
 	.pwr_off_seq = card_disable_flow_8822b,
-	.page_table = page_table_8822b,
 	.rqpn_table = rqpn_table_8822b,
 	.prioq_addrs = &prioq_addrs_8822b,
+	.page_table = page_table_8822b,
 	.intf_table = &phy_para_table_8822b,
 	.dig = rtw8822b_dig,
 	.dig_cck = NULL,
@@ -2569,15 +2573,13 @@  const struct rtw_chip_info rtw8822b_hw_spec = {
 	.rf_tbl = {&rtw8822b_rf_a_tbl, &rtw8822b_rf_b_tbl},
 	.rfe_defs = rtw8822b_rfe_defs,
 	.rfe_defs_size = ARRAY_SIZE(rtw8822b_rfe_defs),
-	.pwr_track_tbl = &rtw8822b_rtw_pwr_track_tbl,
 	.iqk_threshold = 8,
+	.pwr_track_tbl = &rtw8822b_rtw_pwr_track_tbl,
 	.bfer_su_max_num = 2,
 	.bfer_mu_max_num = 1,
-	.rx_ldpc = true,
 	.edcca_th = rtw8822b_edcca_th,
 	.l2h_th_ini_cs = 10 + EDCCA_IGI_BASE,
 	.l2h_th_ini_ad = -14 + EDCCA_IGI_BASE,
-	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2,
 	.max_scan_ie_len = IEEE80211_MAX_DATA_LEN,
 
 	.coex_para_ver = 0x20070206,
@@ -2590,28 +2592,27 @@  const struct rtw_chip_info rtw8822b_hw_spec = {
 	.bt_rssi_type = COEX_BTRSSI_RATIO,
 	.ant_isolation = 15,
 	.rssi_tolerance = 2,
-	.wl_rssi_step = wl_rssi_step_8822b,
-	.bt_rssi_step = bt_rssi_step_8822b,
 	.table_sant_num = ARRAY_SIZE(table_sant_8822b),
-	.table_sant = table_sant_8822b,
 	.table_nsant_num = ARRAY_SIZE(table_nsant_8822b),
-	.table_nsant = table_nsant_8822b,
 	.tdma_sant_num = ARRAY_SIZE(tdma_sant_8822b),
-	.tdma_sant = tdma_sant_8822b,
 	.tdma_nsant_num = ARRAY_SIZE(tdma_nsant_8822b),
-	.tdma_nsant = tdma_nsant_8822b,
-	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8822b),
-	.wl_rf_para_tx = rf_para_tx_8822b,
-	.wl_rf_para_rx = rf_para_rx_8822b,
 	.bt_afh_span_bw20 = 0x24,
 	.bt_afh_span_bw40 = 0x36,
 	.afh_5g_num = ARRAY_SIZE(afh_5g_8822b),
+	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8822b),
+	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8822b),
+	.bt_rssi_step = bt_rssi_step_8822b,
+	.wl_rssi_step = wl_rssi_step_8822b,
+	.table_nsant = table_nsant_8822b,
+	.table_sant = table_sant_8822b,
+	.tdma_sant = tdma_sant_8822b,
+	.tdma_nsant = tdma_nsant_8822b,
+	.wl_rf_para_tx = rf_para_tx_8822b,
+	.wl_rf_para_rx = rf_para_rx_8822b,
 	.afh_5g = afh_5g_8822b,
 
-	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8822b),
 	.coex_info_hw_regs = coex_info_hw_regs_8822b,
 
-	.fw_fifo_addr = {0x780, 0x700, 0x780, 0x660, 0x650, 0x680},
 };
 EXPORT_SYMBOL(rtw8822b_hw_spec);
 
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index cd965edc29ce..af90f7ba0c4b 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -5359,13 +5359,19 @@  const struct rtw_chip_info rtw8822c_hw_spec = {
 	.rxff_size = 24576,
 	.fw_rxff_size = 12288,
 	.rsvd_drv_pg_num = 16,
-	.txgi_factor = 2,
-	.is_pwr_by_rate_dec = false,
-	.max_power_index = 0x7f,
-	.csi_buf_pg_num = 50,
 	.band = RTW_BAND_2G | RTW_BAND_5G,
 	.page_size = TX_PAGE_SIZE,
+	.csi_buf_pg_num = 50,
 	.dig_min = 0x20,
+	.txgi_factor = 2,
+	.is_pwr_by_rate_dec = false,
+	.rx_ldpc = true,
+	.tx_stbc = true,
+	.max_power_index = 0x7f,
+	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2,
+	.fw_fifo_addr = {0x780, 0x700, 0x780, 0x660, 0x650, 0x680},
+	.fwcd_segs = &rtw8822c_fwcd_segs,
+	.usb_tx_agg_desc_num = 3,
 	.default_1ss_tx_path = BB_PATH_A,
 	.path_div_supported = true,
 	.ht_supported = true,
@@ -5374,9 +5380,9 @@  const struct rtw_chip_info rtw8822c_hw_spec = {
 	.sys_func_en = 0xD8,
 	.pwr_on_seq = card_enable_flow_8822c,
 	.pwr_off_seq = card_disable_flow_8822c,
-	.page_table = page_table_8822c,
 	.rqpn_table = rqpn_table_8822c,
 	.prioq_addrs = &prioq_addrs_8822c,
+	.page_table = page_table_8822c,
 	.intf_table = &phy_para_table_8822c,
 	.dig = rtw8822c_dig,
 	.dig_cck = NULL,
@@ -5386,23 +5392,20 @@  const struct rtw_chip_info rtw8822c_hw_spec = {
 	.mac_tbl = &rtw8822c_mac_tbl,
 	.agc_tbl = &rtw8822c_agc_tbl,
 	.bb_tbl = &rtw8822c_bb_tbl,
-	.rfk_init_tbl = &rtw8822c_array_mp_cal_init_tbl,
 	.rf_tbl = {&rtw8822c_rf_b_tbl, &rtw8822c_rf_a_tbl},
+	.rfk_init_tbl = &rtw8822c_array_mp_cal_init_tbl,
 	.rfe_defs = rtw8822c_rfe_defs,
 	.rfe_defs_size = ARRAY_SIZE(rtw8822c_rfe_defs),
 	.en_dis_dpd = true,
 	.dpd_ratemask = DIS_DPD_RATEALL,
-	.pwr_track_tbl = &rtw8822c_rtw_pwr_track_tbl,
 	.iqk_threshold = 8,
 	.lck_threshold = 8,
+	.pwr_track_tbl = &rtw8822c_rtw_pwr_track_tbl,
 	.bfer_su_max_num = 2,
 	.bfer_mu_max_num = 1,
-	.rx_ldpc = true,
-	.tx_stbc = true,
 	.edcca_th = rtw8822c_edcca_th,
 	.l2h_th_ini_cs = 60,
 	.l2h_th_ini_ad = 45,
-	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2,
 
 #ifdef CONFIG_PM
 	.wow_fw_name = "rtw88/rtw8822c_wow_fw.bin",
@@ -5420,29 +5423,27 @@  const struct rtw_chip_info rtw8822c_hw_spec = {
 	.bt_rssi_type = COEX_BTRSSI_DBM,
 	.ant_isolation = 15,
 	.rssi_tolerance = 2,
-	.wl_rssi_step = wl_rssi_step_8822c,
-	.bt_rssi_step = bt_rssi_step_8822c,
 	.table_sant_num = ARRAY_SIZE(table_sant_8822c),
-	.table_sant = table_sant_8822c,
 	.table_nsant_num = ARRAY_SIZE(table_nsant_8822c),
-	.table_nsant = table_nsant_8822c,
 	.tdma_sant_num = ARRAY_SIZE(tdma_sant_8822c),
-	.tdma_sant = tdma_sant_8822c,
 	.tdma_nsant_num = ARRAY_SIZE(tdma_nsant_8822c),
-	.tdma_nsant = tdma_nsant_8822c,
-	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8822c),
-	.wl_rf_para_tx = rf_para_tx_8822c,
-	.wl_rf_para_rx = rf_para_rx_8822c,
 	.bt_afh_span_bw20 = 0x24,
 	.bt_afh_span_bw40 = 0x36,
 	.afh_5g_num = ARRAY_SIZE(afh_5g_8822c),
+	.wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8822c),
+	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8822c),
+	.bt_rssi_step = bt_rssi_step_8822c,
+	.wl_rssi_step = wl_rssi_step_8822c,
+	.table_nsant = table_nsant_8822c,
+	.table_sant = table_sant_8822c,
+	.tdma_sant = tdma_sant_8822c,
+	.tdma_nsant = tdma_nsant_8822c,
+	.wl_rf_para_tx = rf_para_tx_8822c,
+	.wl_rf_para_rx = rf_para_rx_8822c,
 	.afh_5g = afh_5g_8822c,
 
-	.coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8822c),
 	.coex_info_hw_regs = coex_info_hw_regs_8822c,
 
-	.fw_fifo_addr = {0x780, 0x700, 0x780, 0x660, 0x650, 0x680},
-	.fwcd_segs = &rtw8822c_fwcd_segs,
 };
 EXPORT_SYMBOL(rtw8822c_hw_spec);
 
diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
index d204d138afe2..057c0ffbe944 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.c
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
@@ -379,7 +379,9 @@  static bool rtw_usb_tx_agg_skb(struct rtw_usb *rtwusb, struct sk_buff_head *list
 
 		skb_iter = skb_peek(list);
 
-		if (skb_iter && skb_iter->len + skb_head->len <= RTW_USB_MAX_XMITBUF_SZ)
+		if (skb_iter &&
+		    skb_iter->len + skb_head->len <= RTW_USB_MAX_XMITBUF_SZ &&
+		    agg_num < rtwdev->chip->usb_tx_agg_desc_num)
 			__skb_unlink(skb_iter, list);
 		else
 			skb_iter = NULL;