On 20/09/2024 05:21, Ping-Ke Shih wrote: > Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: >> rtw8703b_query_rx_desc(), rtw8723d_query_rx_desc(), >> rtw8821c_query_rx_desc(), rtw8822b_query_rx_desc(), and >> rtw8822c_query_rx_desc() are almost identical, so replace them all with >> a single function, rtw_rx_query_rx_desc(). >> >> Also, access the RX descriptor using a struct with __le32 members and >> le32_get_bits(). > > I have tested this patch with RTL8723DE and RTL8822CE, and looks good. > Please also describe which chips you tested. > > [...] > >> - >> - pkt_stat->drv_info_sz *= RX_DRV_INFO_SZ_UNIT_8703B; > > For now, RX_DRV_INFO_SZ_UNIT_8703B isn't used anymore. We can remove it. > > [...] > >> + .query_phy_status = query_phy_status, > > All existing chips use the same callback. Will it be different for coming chips? > Yes, it will be different for the upcoming chips. (The existing chips also use different code, only the function name is the same.) > [...] > >> + >> +void rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc8, > > If you use 'void *' as type of rx_desc8, we can avoid most casting. > > >> + struct rtw_rx_pkt_stat *pkt_stat, >> + struct ieee80211_rx_status *rx_status) >> +{ >> + struct rtw_rx_desc *rx_desc = (struct rtw_rx_desc *)rx_desc8; > > like here. > >> + >> + phy_status = rx_desc8 + desc_sz + pkt_stat->shift; >> + hdr = (struct ieee80211_hdr *)(phy_status + pkt_stat->drv_info_sz); > > and here. > > >