> -----Original Message----- > From: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > Sent: Sunday, October 23, 2022 5:24 AM > To: linux-wireless@xxxxxxxxxxxxxxx > Subject: How to use the rate control in mac80211? > > Hi! > > What does a driver (rtl8xxxu) need to do to make the rate control work? > > I thought it's like this: > 1) don't set HAS_RATE_CONTROL > 2) tell the chip to use the rate from tx_info->control.rates[0] > 3) report if the frame was acked or not > > But it's not that easy. I'm always getting MCS0. Currently rtl8xxxu > doesn't ask the chip for TX reports and always sets IEEE80211_TX_STAT_ACK. > I thought this would get me MCS7 for all data frames, but it doesn't. I don't dig rate control of mac80211, but I think it is hard to support this by Realtek chip, because the item 3 you listed. Realtek WiFi chip only reports TX status for specific packets, because bus bandwidth is limited, so reduce these reports to have better performance. And, firmware has implemented rate control called rate adaptive (RA), and using firmware RA is expected. If you really want to control rate by driver, you can refer to implementation of management frame below: if (ieee80211_is_mgmt(hdr->frame_control)) { tx_desc->txdw5 = cpu_to_le32(rate); tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE); tx_desc->txdw5 |= cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT); tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE); } Another thing is that retry rate is decided by hardware by another register settings, but I'm not familiar with them, because I always use RA mentioned above. Maybe, you still can use *default* settings of retry rate that could work but not always good in all situations. Ping-Ke