Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: > On 01/08/2025 23:51, Bitterblue Smith wrote: > > It seems RTL8852CU can only use TX channels 0, 2, and 8 (for band 0), > > otherwise the chip stops working after downloading at maximum speed > > for a few seconds. > > > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > > --- > > v2: > > - No change, messed up sending v1. > > --- > > drivers/net/wireless/realtek/rtw89/txrx.h | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/drivers/net/wireless/realtek/rtw89/txrx.h b/drivers/net/wireless/realtek/rtw89/txrx.h > > index ec01bfc363da..318fd0ac8726 100644 > > --- a/drivers/net/wireless/realtek/rtw89/txrx.h > > +++ b/drivers/net/wireless/realtek/rtw89/txrx.h > > @@ -734,6 +734,25 @@ rtw89_core_get_qsel_mgmt(struct rtw89_dev *rtwdev, struct rtw89_core_tx_request > > > > static inline u8 rtw89_core_get_ch_dma(struct rtw89_dev *rtwdev, u8 qsel) > > { > > + if (rtwdev->hci.type == RTW89_HCI_TYPE_USB && > > + rtwdev->chip->chip_id == RTL8852C) { > > + switch (qsel) { > > + default: > > + rtw89_warn(rtwdev, "Cannot map qsel to dma: %d\n", > > + qsel); > > + fallthrough; > > + case RTW89_TX_QSEL_BE_0: > > + case RTW89_TX_QSEL_VO_0: > > + return RTW89_TXCH_ACH0; > > + case RTW89_TX_QSEL_BK_0: > > + case RTW89_TX_QSEL_VI_0: > > + return RTW89_TXCH_ACH2; > > + case RTW89_TX_QSEL_B0_MGMT: > > + case RTW89_TX_QSEL_B0_HI: > > + return RTW89_TXCH_CH8; > > + } > > + } > > + > > switch (qsel) { > > default: > > rtw89_warn(rtwdev, "Cannot map qsel to dma: %d\n", qsel); > > I see now that RTL8922AU needs the same change. And same in patch 2/11 > as well. The coming chip RTL8922DE uses different mapping rule, so I add a new chip_ops: --- a/core.h +++ b/core.h @@ -4072,6 +4072,7 @@ struct rtw89_chip_ops { void (*fill_txdesc_fwcmd)(struct rtw89_dev *rtwdev, struct rtw89_tx_desc_info *desc_info, void *txdesc); + u8 (*get_ch_dma)(struct rtw89_dev *rtwdev, u8 qsel); int (*cfg_ctrl_path)(struct rtw89_dev *rtwdev, bool wl); int (*mac_cfg_gnt)(struct rtw89_dev *rtwdev, const struct rtw89_mac_ax_coex_gnt *gnt_cfg); @@ -7428,6 +7429,14 @@ void rtw89_chip_fill_txdesc_fwcmd(struct rtw89_dev *rtwdev, chip->ops->fill_txdesc_fwcmd(rtwdev, desc_info, txdesc); } +static inline +u8 rtw89_chip_get_ch_dma(struct rtw89_dev *rtwdev, u8 qsel) +{ + const struct rtw89_chip_info *chip = rtwdev->chip; + + return chip->ops->get_ch_dma(rtwdev, qsel); +} + static inline void rtw89_chip_mac_cfg_gnt(struct rtw89_dev *rtwdev, const struct rtw89_mac_ax_coex_gnt *gnt_cfg) Also the rtw89_core_get_ch_dma() is moved to core.c, and add rtw89_core_get_ch_dma_v1() for RTL8922DE. However, USB can use different mapping rule, so we should extend the size to RTW89_HCI_TYPE_NUM. Then, return chip->ops->get_ch_dma[rtwdev->hci.type](rtwdev, qsel); If you want my patch as first patch of this patchset, I can share it as RFC. Since this is called in data path, I'd like to avoid if-condition to save a little execution time.