From: "Georg Müller" <georgmueller@gmx.net>
To: mehmet.fide@gmail.com, Jes.Sorensen@gmail.com
Cc: rtl8821cerfe2@gmail.com, pkshih@realtek.com, hi@shreyan.sh,
mehmet.fide@screeningeagle.com, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Georg Müller" <georgmueller@gmx.net>
Subject: [RFC PATCH v4 3/5] wifi: rtl8xxxu: update max report mac id on station add / remove for 8188e chips
Date: Thu, 26 Nov 2026 11:57:40 +0100 [thread overview]
Message-ID: <20261126105742.1086282-4-georgmueller@gmx.net> (raw)
In-Reply-To: <20261126054350.2893087-1-mehmet.fide@gmail.com>
The 8188e only includes the mac ids below the value in
REG_TX_REPORT_CTRL + 1 in its type 2 TX report, which is used for the
software rate control. rtl8xxxu_init_device() sets it to 2, which only
covers the mac ids used in station mode.
In AP mode, every connected station gets its own mac id. Set the
register to the highest acquired mac id + 1 whenever a station is added
or removed, so the TX report contains the entries of all connected
stations.
Signed-off-by: Georg Müller <georgmueller@gmx.net>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 30 +++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index e3266ed9c302..4207e68ccde0 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -3886,6 +3886,15 @@ void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv)
rtl8xxxu_write8(priv, REG_RSV_CTRL, val8);
}
+static u8 rtl8xxxu_max_acquired_macid(struct rtl8xxxu_priv *priv)
+{
+ u8 macid;
+
+ macid = find_last_bit(priv->mac_id_map, RTL8XXXU_MAX_MAC_ID_NUM);
+
+ return macid;
+}
+
static u8 rtl8xxxu_acquire_macid(struct rtl8xxxu_priv *priv)
{
u8 macid;
@@ -7566,6 +7575,7 @@ static int rtl8xxxu_sta_add(struct ieee80211_hw *hw,
struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv;
struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv;
struct rtl8xxxu_priv *priv = hw->priv;
+ u8 max_mac_id;
mutex_lock(&priv->sta_mutex);
ewma_rssi_init(&sta_info->avg_rssi);
@@ -7577,6 +7587,18 @@ static int rtl8xxxu_sta_add(struct ieee80211_hw *hw,
return -ENOSPC;
}
+ if (priv->rtl_chip == RTL8188E &&
+ sta_info->macid >= RTL8188E_MAX_MAC_ID_NUM) {
+ rtl8xxxu_release_macid(priv, sta_info->macid);
+ mutex_unlock(&priv->sta_mutex);
+ return -ENOSPC;
+ }
+
+ if (priv->rtl_chip == RTL8188E) {
+ max_mac_id = rtl8xxxu_max_acquired_macid(priv);
+ rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL + 1, max_mac_id + 1);
+ }
+
rtl8xxxu_refresh_rate_mask(priv, 0, sta, true);
priv->fops->report_connect(priv, sta_info->macid, H2C_MACID_ROLE_STA, true);
} else {
@@ -7602,10 +7624,16 @@ static int rtl8xxxu_sta_remove(struct ieee80211_hw *hw,
{
struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv;
struct rtl8xxxu_priv *priv = hw->priv;
+ u8 max_mac_id;
mutex_lock(&priv->sta_mutex);
- if (vif->type == NL80211_IFTYPE_AP)
+ if (vif->type == NL80211_IFTYPE_AP) {
rtl8xxxu_release_macid(priv, sta_info->macid);
+ if (priv->rtl_chip == RTL8188E) {
+ max_mac_id = rtl8xxxu_max_acquired_macid(priv);
+ rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL + 1, max_mac_id + 1);
+ }
+ }
mutex_unlock(&priv->sta_mutex);
return 0;
--
2.56.1
next prev parent reply other threads:[~2026-11-26 10:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 13:53 [RFC PATCH v3 0/4] wifi: rtl8xxxu: implement AP mode for 8188EU Georg Müller
2026-03-13 13:53 ` [RFC PATCH v3 1/4] wifi: rtl8xxxu: move dynamic_tx_rpt_timing_counter from ra_info to priv Georg Müller
2026-03-16 6:17 ` Ping-Ke Shih
2026-03-16 9:30 ` Georg Müller
2026-03-17 2:52 ` Ping-Ke Shih
2026-03-13 13:53 ` [RFC PATCH v3 2/4] wifi: rtl8xxxu: handle rate control for 8188e a per mac_id Georg Müller
2026-03-16 6:35 ` Ping-Ke Shih
2026-03-16 9:41 ` Georg Müller
2026-03-13 13:53 ` [RFC PATCH v3 3/4] wifi: rtl8xxxu: update max report mac id on station add / remove for 8188e chips Georg Müller
2026-03-16 7:07 ` Ping-Ke Shih
2026-03-13 13:53 ` [RFC PATCH v3 4/4] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Georg Müller
2026-03-13 23:14 ` [RFC PATCH v3 0/4] wifi: rtl8xxxu: implement AP mode for 8188EU Bitterblue Smith
2026-03-27 13:58 ` Georg Müller
2026-11-25 16:06 ` Mehmet Fide
2026-11-25 20:37 ` Bitterblue Smith
2026-11-26 1:09 ` Georg Müller
2026-11-26 5:43 ` Mehmet Fide
2026-11-26 10:57 ` [RFC PATCH v4 0/5] " Georg Müller
2026-11-26 10:57 ` [RFC PATCH v4 1/5] wifi: rtl8xxxu: move dynamic_tx_rpt_timing_counter from ra_info to priv Georg Müller
2026-11-26 10:57 ` [RFC PATCH v4 2/5] wifi: rtl8xxxu: handle rate control per mac_id for 8188e Georg Müller
2026-11-26 10:57 ` Georg Müller [this message]
2026-11-26 10:57 ` [RFC PATCH v4 4/5] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Georg Müller
2026-11-26 10:57 ` [RFC PATCH v4 5/5] wifi: rtl8xxxu: set macid in TX descriptor for 8188e Georg Müller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126105742.1086282-4-georgmueller@gmx.net \
--to=georgmueller@gmx.net \
--cc=Jes.Sorensen@gmail.com \
--cc=hi@shreyan.sh \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mehmet.fide@gmail.com \
--cc=mehmet.fide@screeningeagle.com \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox