[RFC PATCH v4 5/5] wifi: rtl8xxxu: set macid in TX descriptor for 8188e

From: Georg Müller

Date: Thu Nov 26 2026 - 05:58:31 EST


rtl8xxxu_fill_txdesc_v3() does not set the mac id in the TX descriptor,
so the hardware treats all frames as sent to mac id 0. The vendor driver
sets it in txdw1.

Set it, so that the TX report attributes the frames to the right
station and the per mac id rate control works in AP mode.

Signed-off-by: Georg Müller <georgmueller@xxxxxxx>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 4207e68ccde0..87526c051a31 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -5397,7 +5397,7 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
{
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
- struct rtl8xxxu_ra_info *ra = &priv->ra_info[macid];
+ struct rtl8xxxu_ra_info *ra;
u8 *qc = ieee80211_get_qos_ctl(hdr);
u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
u32 rate = 0;
@@ -5405,6 +5405,14 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,

seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));

+ /*
+ * For group addressed frames with a key, macid is the security CAM
+ * index, which can be beyond the end of ra_info.
+ */
+ ra = &priv->ra_info[macid < RTL8188E_MAX_MAC_ID_NUM ? macid : 0];
+
+ tx_desc->txdw1 |= cpu_to_le32(macid << TXDESC40_MACID_SHIFT);
+
if (ieee80211_is_data(hdr->frame_control)) {
rate = ra->decision_rate;
tx_desc->txdw5 = cpu_to_le32(rate);
--
2.56.1