public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
@ 2026-03-12 14:21 Georg Müller
  2026-03-12 14:29 ` Georg Müller
  2026-03-12 15:58 ` Bitterblue Smith
  0 siblings, 2 replies; 8+ messages in thread
From: Georg Müller @ 2026-03-12 14:21 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-wireless, linux-kernel, Georg Müller

Allow devices with this driver to be used as a wireless access point.

I successfully tested this with a TP-Link TP-Link TL-WN725N adapter.

Experiments two years ago failed, but some other improvements to the
driver seemed to have resolved theses issues.

The max_macid_num is conservative. The old driver used 32 [1], some
other sources said 64. I have not enough adapters to test any of the
higher values. Given the usage of this chipset in nano dongles, I think
the 16 might be high enough.

Signed-off-by: Georg Müller <georgmueller@gmx.net>
---
 drivers/net/wireless/realtek/rtl8xxxu/8188e.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
index 766a7a7c7d28..c6aecb28d28b 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
@@ -1867,6 +1867,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = {
 	.init_reg_pkt_life_time = 1,
 	.gen2_thermal_meter = 1,
 	.max_sec_cam_num = 32,
+	.supports_ap = 1,
+	.max_macid_num = 16,
 	.adda_1t_init = 0x0b1b25a0,
 	.adda_1t_path_on = 0x0bdb25a0,
 	/*
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
  2026-03-12 14:21 [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Georg Müller
@ 2026-03-12 14:29 ` Georg Müller
  2026-03-12 15:58 ` Bitterblue Smith
  1 sibling, 0 replies; 8+ messages in thread
From: Georg Müller @ 2026-03-12 14:29 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-wireless, linux-kernel

Sorry, I missed the link:

Am 12.03.26 um 15:21 schrieb Georg Müller:
> The max_macid_num is conservative. The old driver used 32 [1], some
> other sources said 64. I have not enough adapters to test any of the
> higher values. Given the usage of this chipset in nano dongles, I think
> the 16 might be high enough.
> 

[1] https://github.com/lwfinger/rtl8188eu/blob/f5d1c8df2e2d8b217ea0113bf2cf3e37df8cb716/include/sta_info.h#L28

Link for max_macid_num = 64:
https://lore.kernel.org/linux-wireless/27e83382-4c84-1841-c428-d1e5143ea20c@gmail.com/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
  2026-03-12 14:21 [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Georg Müller
  2026-03-12 14:29 ` Georg Müller
@ 2026-03-12 15:58 ` Bitterblue Smith
  2026-03-12 16:08   ` Georg Müller
  1 sibling, 1 reply; 8+ messages in thread
From: Bitterblue Smith @ 2026-03-12 15:58 UTC (permalink / raw)
  To: Georg Müller, Jes.Sorensen; +Cc: linux-wireless, linux-kernel

On 12/03/2026 16:21, Georg Müller wrote:
> Allow devices with this driver to be used as a wireless access point.
> 
> I successfully tested this with a TP-Link TP-Link TL-WN725N adapter.
> 
> Experiments two years ago failed, but some other improvements to the
> driver seemed to have resolved theses issues.
> 

The rate control code still doesn't handle more than one station.
It's not going to work right.

It shouldn't be too complicated. The ra_info member of rtl8xxxu_priv
needs to become an array.

> The max_macid_num is conservative. The old driver used 32 [1], some
> other sources said 64. I have not enough adapters to test any of the
> higher values. Given the usage of this chipset in nano dongles, I think
> the 16 might be high enough.
> 
> Signed-off-by: Georg Müller <georgmueller@gmx.net>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/8188e.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
> index 766a7a7c7d28..c6aecb28d28b 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
> @@ -1867,6 +1867,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = {
>  	.init_reg_pkt_life_time = 1,
>  	.gen2_thermal_meter = 1,
>  	.max_sec_cam_num = 32,
> +	.supports_ap = 1,
> +	.max_macid_num = 16,
>  	.adda_1t_init = 0x0b1b25a0,
>  	.adda_1t_path_on = 0x0bdb25a0,
>  	/*


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
  2026-03-12 15:58 ` Bitterblue Smith
@ 2026-03-12 16:08   ` Georg Müller
  2026-03-12 17:06     ` Bitterblue Smith
  0 siblings, 1 reply; 8+ messages in thread
From: Georg Müller @ 2026-03-12 16:08 UTC (permalink / raw)
  To: Bitterblue Smith, Jes.Sorensen; +Cc: linux-wireless, linux-kernel


Am 12.03.26 um 16:58 schrieb Bitterblue Smith:
> On 12/03/2026 16:21, Georg Müller wrote:
>> Allow devices with this driver to be used as a wireless access point.
>>
>> I successfully tested this with a TP-Link TP-Link TL-WN725N adapter.
>>
>> Experiments two years ago failed, but some other improvements to the
>> driver seemed to have resolved theses issues.
>>
> 
> The rate control code still doesn't handle more than one station.
> It's not going to work right.
> 
> It shouldn't be too complicated. The ra_info member of rtl8xxxu_priv
> needs to become an array.

Ok, I have only tested it with one client in my setup.

So the ra_info array needs to of size max_macid_num?
Dynamically allocated or hard-coded in struct rtl8xxxu_priv (8188e seems
to be the only user of struct rtl8xxxu_ra_info)?

Best regards,
Georg


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
  2026-03-12 16:08   ` Georg Müller
@ 2026-03-12 17:06     ` Bitterblue Smith
  2026-03-12 20:58       ` [RFC PATCH] wifi: rtl8xxxu: handle rate control for 8188e a per mac_id Georg Müller
  2026-03-12 22:20       ` [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Bitterblue Smith
  0 siblings, 2 replies; 8+ messages in thread
From: Bitterblue Smith @ 2026-03-12 17:06 UTC (permalink / raw)
  To: Georg Müller, Jes.Sorensen; +Cc: linux-wireless, linux-kernel

On 12/03/2026 18:08, Georg Müller wrote:
> 
> Am 12.03.26 um 16:58 schrieb Bitterblue Smith:
>> On 12/03/2026 16:21, Georg Müller wrote:
>>> Allow devices with this driver to be used as a wireless access point.
>>>
>>> I successfully tested this with a TP-Link TP-Link TL-WN725N adapter.
>>>
>>> Experiments two years ago failed, but some other improvements to the
>>> driver seemed to have resolved theses issues.
>>>
>>
>> The rate control code still doesn't handle more than one station.
>> It's not going to work right.
>>
>> It shouldn't be too complicated. The ra_info member of rtl8xxxu_priv
>> needs to become an array.
> 
> Ok, I have only tested it with one client in my setup.
> 
> So the ra_info array needs to of size max_macid_num?
> Dynamically allocated or hard-coded in struct rtl8xxxu_priv (8188e seems
> to be the only user of struct rtl8xxxu_ra_info)?
> 

Yes. :)

Also, if I remember correctly, there was a member of rtl8xxxu_ra_info
that needs to be moved to rtl8xxxu_priv, because it's a global thing,
not per macid.

> Best regards,
> Georg
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [RFC PATCH] wifi: rtl8xxxu: handle rate control for 8188e a per mac_id
  2026-03-12 17:06     ` Bitterblue Smith
@ 2026-03-12 20:58       ` Georg Müller
  2026-03-12 22:20       ` [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Bitterblue Smith
  1 sibling, 0 replies; 8+ messages in thread
From: Georg Müller @ 2026-03-12 20:58 UTC (permalink / raw)
  To: Jes.Sorensen, rtl8821cerfe2
  Cc: linux-wireless, linux-kernel, Georg Müller

convert member ra_info to an array with one entry per mac id. This
allows having different rate control settings per connected station
in ap mode.

The max_macid_num is conservative. The old driver used 32 [1], some
other sources said 64 [2]. I have not enough adapters to test any of the
higher values. Given the usage of this chipset in nano dongles, I think
the 16 might be high enough.


I am a bit unsure about the handling in of priv->vifs in
rtl8188e_handle_ra_tx_report2():

The comment says "We only use macid 0" with the remark of not handling
AP mode, but priv->vifs has only two entries (no the number of mac_ids),
so I don't know the relation between them.


[1] https://github.com/lwfinger/rtl8188eu/blob/f5d1c8df2e2d8b217ea0113bf2cf3e37df8cb716/include/sta_info.h#L28
[2] https://lore.kernel.org/linux-wireless/27e83382-4c84-1841-c428-d1e5143ea20c@gmail.com/

Signed-off-by: Georg Müller <georgmueller@gmx.net>
---
 drivers/net/wireless/realtek/rtl8xxxu/8188e.c    | 12 ++++++------
 drivers/net/wireless/realtek/rtl8xxxu/core.c     | 11 +++++++----
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |  3 ++-
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
index 766a7a7c7d28..ca044979ba79 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c
@@ -1468,9 +1468,8 @@ static void rtl8188e_reset_ra_counter(struct rtl8xxxu_ra_info *ra)
 	ra->nsc_down = (n_threshold_high[rate_id] + n_threshold_low[rate_id]) >> 1;
 }
 
-static void rtl8188e_rate_decision(struct rtl8xxxu_ra_info *ra)
+static void rtl8188e_rate_decision(struct rtl8xxxu_priv *priv, struct rtl8xxxu_ra_info *ra)
 {
-	struct rtl8xxxu_priv *priv = container_of(ra, struct rtl8xxxu_priv, ra_info);
 	const u8 *retry_penalty_idx_0;
 	const u8 *retry_penalty_idx_1;
 	const u8 *retry_penalty_up_idx;
@@ -1669,7 +1668,7 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s
 	u32 *_rx_desc = (u32 *)(skb->data - sizeof(struct rtl8xxxu_rxdesc16));
 	struct rtl8xxxu_rxdesc16 *rx_desc = (struct rtl8xxxu_rxdesc16 *)_rx_desc;
 	struct device *dev = &priv->udev->dev;
-	struct rtl8xxxu_ra_info *ra = &priv->ra_info;
+	struct rtl8xxxu_ra_info *ra;
 	u32 tx_rpt_len = rx_desc->pktlen & 0x3ff;
 	u32 items = tx_rpt_len / TX_RPT2_ITEM_SIZE;
 	u64 macid_valid = ((u64)_rx_desc[5] << 32) | _rx_desc[4];
@@ -1688,6 +1687,7 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s
 
 	for (macid = 0; macid < items; macid++) {
 		valid = false;
+		 ra = &priv->ra_info[macid];
 
 		if (macid < 64)
 			valid = macid_valid & BIT(macid);
@@ -1704,7 +1704,7 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s
 
 			if (ra->total > 0) {
 				if (ra->ra_stage < 5)
-					rtl8188e_rate_decision(ra);
+					rtl8188e_rate_decision(priv, ra);
 				else if (ra->ra_stage == 5)
 					rtl8188e_power_training_try_state(ra);
 				else /* ra->ra_stage == 6 */
@@ -1781,7 +1781,7 @@ rtl8188e_update_rate_mask(struct rtl8xxxu_priv *priv,
 			  u32 ramask, u8 rateid, int sgi, int txbw_40mhz,
 			  u8 macid)
 {
-	struct rtl8xxxu_ra_info *ra = &priv->ra_info;
+	struct rtl8xxxu_ra_info *ra = &priv->ra_info[macid];
 
 	ra->rate_id = rateid;
 	ra->rate_mask = ramask;
@@ -1792,7 +1792,7 @@ rtl8188e_update_rate_mask(struct rtl8xxxu_priv *priv,
 
 static void rtl8188e_ra_set_rssi(struct rtl8xxxu_priv *priv, u8 macid, u8 rssi)
 {
-	priv->ra_info.rssi_sta_ra = rssi;
+	priv->ra_info[macid].rssi_sta_ra = rssi;
 }
 
 void rtl8188e_ra_info_init_all(struct rtl8xxxu_ra_info *ra)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 794187d28caa..570b1d58e475 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -3921,6 +3921,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
 	struct device *dev = &priv->udev->dev;
 	struct rtl8xxxu_fileops *fops = priv->fops;
 	bool macpower;
+	u16 mac_id;
 	int ret;
 	u8 val8;
 	u16 val16;
@@ -4393,9 +4394,11 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
 		priv->cfo_tracking.crystal_cap = priv->default_crystal_cap;
 	}
 
-	if (priv->rtl_chip == RTL8188E)
-		rtl8188e_ra_info_init_all(&priv->ra_info);
-
+	if (priv->rtl_chip == RTL8188E)	{
+		for (mac_id = 0; mac_id < ARRAY_SIZE(priv->ra_info); mac_id++) {
+			rtl8188e_ra_info_init_all(&priv->ra_info[mac_id]);
+		}
+	}
 	set_bit(RTL8XXXU_BC_MC_MACID, priv->mac_id_map);
 	set_bit(RTL8XXXU_BC_MC_MACID1, priv->mac_id_map);
 
@@ -5338,7 +5341,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;
+	struct rtl8xxxu_ra_info *ra = &priv->ra_info[macid];
 	u8 *qc = ieee80211_get_qos_ctl(hdr);
 	u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
 	u32 rate = 0;
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 9fb2583ffffc..6a415b9c3bd9 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -76,6 +76,7 @@
 #define RTL_FW_PAGE_SIZE		4096
 #define RTL8XXXU_FIRMWARE_POLL_MAX	1000
 
+#define RTL8188E_MAX_MAC_ID_NUM		16
 #define RTL8723A_CHANNEL_GROUPS		3
 #define RTL8723A_MAX_RF_PATHS		2
 #define RTL8723B_CHANNEL_GROUPS		6
@@ -1916,7 +1917,7 @@ struct rtl8xxxu_priv {
 	struct rtl8xxxu_btcoex bt_coex;
 	struct rtl8xxxu_ra_report ra_report;
 	struct rtl8xxxu_cfo_tracking cfo_tracking;
-	struct rtl8xxxu_ra_info ra_info;
+	struct rtl8xxxu_ra_info ra_info[RTL8188E_MAX_MAC_ID_NUM];
 
 	bool led_registered;
 	char led_name[32];
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
  2026-03-12 17:06     ` Bitterblue Smith
  2026-03-12 20:58       ` [RFC PATCH] wifi: rtl8xxxu: handle rate control for 8188e a per mac_id Georg Müller
@ 2026-03-12 22:20       ` Bitterblue Smith
  2026-03-12 23:52         ` Georg Müller
  1 sibling, 1 reply; 8+ messages in thread
From: Bitterblue Smith @ 2026-03-12 22:20 UTC (permalink / raw)
  To: Georg Müller, Jes.Sorensen; +Cc: linux-wireless, linux-kernel

On 12/03/2026 19:06, Bitterblue Smith wrote:
> On 12/03/2026 18:08, Georg Müller wrote:
>>
>> Am 12.03.26 um 16:58 schrieb Bitterblue Smith:
>>> On 12/03/2026 16:21, Georg Müller wrote:
>>>> Allow devices with this driver to be used as a wireless access point.
>>>>
>>>> I successfully tested this with a TP-Link TP-Link TL-WN725N adapter.
>>>>
>>>> Experiments two years ago failed, but some other improvements to the
>>>> driver seemed to have resolved theses issues.
>>>>
>>>
>>> The rate control code still doesn't handle more than one station.
>>> It's not going to work right.
>>>
>>> It shouldn't be too complicated. The ra_info member of rtl8xxxu_priv
>>> needs to become an array.
>>
>> Ok, I have only tested it with one client in my setup.
>>
>> So the ra_info array needs to of size max_macid_num?
>> Dynamically allocated or hard-coded in struct rtl8xxxu_priv (8188e seems
>> to be the only user of struct rtl8xxxu_ra_info)?
>>
> 
> Yes. :)
> 
> Also, if I remember correctly, there was a member of rtl8xxxu_ra_info
> that needs to be moved to rtl8xxxu_priv, because it's a global thing,
> not per macid.
> 

Ah, we talked about it before:
https://lore.kernel.org/linux-wireless/938ae608-a865-4056-06de-c230d74e1847@gmail.com/

>> Best regards,
>> Georg
>>
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU
  2026-03-12 22:20       ` [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Bitterblue Smith
@ 2026-03-12 23:52         ` Georg Müller
  0 siblings, 0 replies; 8+ messages in thread
From: Georg Müller @ 2026-03-12 23:52 UTC (permalink / raw)
  To: Bitterblue Smith, Jes.Sorensen; +Cc: linux-wireless, linux-kernel


Am 12.03.26 um 23:20 schrieb Bitterblue Smith:
> On 12/03/2026 19:06, Bitterblue Smith wrote:
>> On 12/03/2026 18:08, Georg Müller wrote:
>>>
>>> Am 12.03.26 um 16:58 schrieb Bitterblue Smith:
>>>> On 12/03/2026 16:21, Georg Müller wrote:
>>>>> Allow devices with this driver to be used as a wireless access point.
>>>>>
>>>>> I successfully tested this with a TP-Link TP-Link TL-WN725N adapter.
>>>>>
>>>>> Experiments two years ago failed, but some other improvements to the
>>>>> driver seemed to have resolved theses issues.
>>>>>
>>>>
>>>> The rate control code still doesn't handle more than one station.
>>>> It's not going to work right.
>>>>
>>>> It shouldn't be too complicated. The ra_info member of rtl8xxxu_priv
>>>> needs to become an array.
>>>
>>> Ok, I have only tested it with one client in my setup.
>>>
>>> So the ra_info array needs to of size max_macid_num?
>>> Dynamically allocated or hard-coded in struct rtl8xxxu_priv (8188e seems
>>> to be the only user of struct rtl8xxxu_ra_info)?
>>>
>>
>> Yes. :)
>>
>> Also, if I remember correctly, there was a member of rtl8xxxu_ra_info
>> that needs to be moved to rtl8xxxu_priv, because it's a global thing,
>> not per macid.
>>
> 
> Ah, we talked about it before:
> https://lore.kernel.org/linux-wireless/938ae608-a865-4056-06de-c230d74e1847@gmail.com/

Oh, yes, I didn't remember all the details from then and only checked an earlier response.

I will try to integrate the suggestions into the RFC patch and will send a v2.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-12 23:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 14:21 [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Georg Müller
2026-03-12 14:29 ` Georg Müller
2026-03-12 15:58 ` Bitterblue Smith
2026-03-12 16:08   ` Georg Müller
2026-03-12 17:06     ` Bitterblue Smith
2026-03-12 20:58       ` [RFC PATCH] wifi: rtl8xxxu: handle rate control for 8188e a per mac_id Georg Müller
2026-03-12 22:20       ` [PATCH] wifi: rtl8xxxu: Enable AP mode for RTL8188EU Bitterblue Smith
2026-03-12 23:52         ` Georg Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox