public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
@ 2025-01-22  7:15 Ezra Buehler
  2025-01-23  0:31 ` Ping-Ke Shih
  2025-02-03  2:40 ` Ping-Ke Shih
  0 siblings, 2 replies; 7+ messages in thread
From: Ezra Buehler @ 2025-01-22  7:15 UTC (permalink / raw)
  To: linux-wireless
  Cc: Jes Sorensen, Kalle Valo, Ping-Ke Shih, Martin Kaistra,
	Bitterblue Smith, Johannes Berg, Reto Schneider, Ezra Buehler

From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>

This allows the driver to be used in wireless access point mode on the
AT91SAM9G25-based GARDENA smart Gateway.

Unfortunately, the data throughput in AP mode appears to be lower than
with the vendor driver (or in STA mode). Especially when sending, the
data rate is significantly lower. My measurements performed with iperf3
and an Edimax EW-7811Un (VID: 7392, PID: 7811) showed a maximum TX rate
of about 4 Mbits/sec compared to the ~24 Mbits/sec measured with the
rtl8192cu driver.

Although the performance might be good enough for our use case, this is
something that should be further looked into.

Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
---
When comparing the register values dumped for the two drivers in AP
mode, there are quite some differences. So, no idea where to start
digging deeper. Any pointers would be highly appreciated.

Cheers,
Ezra.
---
Changes in v2:
- Set max_macid_num to correct value
- Make commit message more elaborate, mention bad TX performance
- Link to v1: https://lore.kernel.org/20241108195511.1338147-1-ezra@easyb.ch
---
 drivers/net/wireless/realtek/rtl8xxxu/8192c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/8192c.c b/drivers/net/wireless/realtek/rtl8xxxu/8192c.c
index 0abb1b092bc2..73034e7e41d1 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/8192c.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/8192c.c
@@ -644,6 +644,8 @@ struct rtl8xxxu_fileops rtl8192cu_fops = {
 	.rx_agg_buf_size = 16000,
 	.tx_desc_size = sizeof(struct rtl8xxxu_txdesc32),
 	.rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16),
+	.supports_ap = 1,
+	.max_macid_num = 32,
 	.max_sec_cam_num = 32,
 	.adda_1t_init = 0x0b1b25a0,
 	.adda_1t_path_on = 0x0bdb25a0,

base-commit: 361cb056e2468be534f47c1a6745f96581a721e3
-- 
2.47.1


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

* RE: [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
  2025-01-22  7:15 [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS) Ezra Buehler
@ 2025-01-23  0:31 ` Ping-Ke Shih
  2025-02-03  2:40 ` Ping-Ke Shih
  1 sibling, 0 replies; 7+ messages in thread
From: Ping-Ke Shih @ 2025-01-23  0:31 UTC (permalink / raw)
  To: Ezra Buehler, linux-wireless@vger.kernel.org
  Cc: Jes Sorensen, Kalle Valo, Martin Kaistra, Bitterblue Smith,
	Johannes Berg, Reto Schneider, Ezra Buehler

Ezra Buehler <ezra@easyb.ch> wrote:
> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> This allows the driver to be used in wireless access point mode on the
> AT91SAM9G25-based GARDENA smart Gateway.
> 
> Unfortunately, the data throughput in AP mode appears to be lower than
> with the vendor driver (or in STA mode). Especially when sending, the
> data rate is significantly lower. My measurements performed with iperf3
> and an Edimax EW-7811Un (VID: 7392, PID: 7811) showed a maximum TX rate
> of about 4 Mbits/sec compared to the ~24 Mbits/sec measured with the
> rtl8192cu driver.

I assume the TX rate should be similar in AP mode and STA mode for the
same driver, but still little difference from real AP, which has more
antenna and better capability to TX/RX. 

Base on my assumption, I think we can try
1. compare TX rate with/without RF calibration, such as IQK, to ensure
   the calibrations work well in AP mode. 
2. try fixed TX rate by TX description to check if rate selection problem.

Ping-Ke


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

* Re: [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
  2025-01-22  7:15 [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS) Ezra Buehler
  2025-01-23  0:31 ` Ping-Ke Shih
@ 2025-02-03  2:40 ` Ping-Ke Shih
  2025-02-03  7:55   ` Martin Kaistra
  1 sibling, 1 reply; 7+ messages in thread
From: Ping-Ke Shih @ 2025-02-03  2:40 UTC (permalink / raw)
  To: Ezra Buehler, linux-wireless
  Cc: Jes Sorensen, Kalle Valo, Ping-Ke Shih, Martin Kaistra,
	Bitterblue Smith, Johannes Berg, Reto Schneider, Ezra Buehler

Ezra Buehler <ezra@easyb.ch> wrote:

> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> This allows the driver to be used in wireless access point mode on the
> AT91SAM9G25-based GARDENA smart Gateway.
> 
> Unfortunately, the data throughput in AP mode appears to be lower than
> with the vendor driver (or in STA mode). Especially when sending, the
> data rate is significantly lower. My measurements performed with iperf3
> and an Edimax EW-7811Un (VID: 7392, PID: 7811) showed a maximum TX rate
> of about 4 Mbits/sec compared to the ~24 Mbits/sec measured with the
> rtl8192cu driver.
> 
> Although the performance might be good enough for our use case, this is
> something that should be further looked into.
> 
> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

4828f572b20b wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)

---
https://github.com/pkshih/rtw.git


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

* Re: [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
  2025-02-03  2:40 ` Ping-Ke Shih
@ 2025-02-03  7:55   ` Martin Kaistra
  2025-02-03  8:51     ` Ping-Ke Shih
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Kaistra @ 2025-02-03  7:55 UTC (permalink / raw)
  To: Ping-Ke Shih, Ezra Buehler, linux-wireless
  Cc: Jes Sorensen, Kalle Valo, Bitterblue Smith, Johannes Berg,
	Reto Schneider, Ezra Buehler

Am 03.02.25 um 03:40 schrieb Ping-Ke Shih:
> Ezra Buehler <ezra@easyb.ch> wrote:
> 
>> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
>>
>> This allows the driver to be used in wireless access point mode on the
>> AT91SAM9G25-based GARDENA smart Gateway.
>>
>> Unfortunately, the data throughput in AP mode appears to be lower than
>> with the vendor driver (or in STA mode). Especially when sending, the
>> data rate is significantly lower. My measurements performed with iperf3
>> and an Edimax EW-7811Un (VID: 7392, PID: 7811) showed a maximum TX rate
>> of about 4 Mbits/sec compared to the ~24 Mbits/sec measured with the
>> rtl8192cu driver.
>>
>> Although the performance might be good enough for our use case, this is
>> something that should be further looked into.
>>
>> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> 1 patch(es) applied to rtw-next branch of rtw.git, thanks.

Is there a reason for not setting macid in rtl8xxxu_fill_txdesc_v1() and 
rtl8xxxu_update_rate_mask() like it was done for the gen2 case?

> 
> 4828f572b20b wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
> 
> ---
> https://github.com/pkshih/rtw.git
> 



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

* RE: [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
  2025-02-03  7:55   ` Martin Kaistra
@ 2025-02-03  8:51     ` Ping-Ke Shih
  2025-02-04 19:59       ` Ezra Buehler
  0 siblings, 1 reply; 7+ messages in thread
From: Ping-Ke Shih @ 2025-02-03  8:51 UTC (permalink / raw)
  To: Martin Kaistra, Ezra Buehler, linux-wireless@vger.kernel.org
  Cc: Jes Sorensen, Kalle Valo, Bitterblue Smith, Johannes Berg,
	Reto Schneider, Ezra Buehler

Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> Am 03.02.25 um 03:40 schrieb Ping-Ke Shih:
> > Ezra Buehler <ezra@easyb.ch> wrote:
> >
> >> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> >>
> >> This allows the driver to be used in wireless access point mode on the
> >> AT91SAM9G25-based GARDENA smart Gateway.
> >>
> >> Unfortunately, the data throughput in AP mode appears to be lower than
> >> with the vendor driver (or in STA mode). Especially when sending, the
> >> data rate is significantly lower. My measurements performed with iperf3
> >> and an Edimax EW-7811Un (VID: 7392, PID: 7811) showed a maximum TX rate
> >> of about 4 Mbits/sec compared to the ~24 Mbits/sec measured with the
> >> rtl8192cu driver.
> >>
> >> Although the performance might be good enough for our use case, this is
> >> something that should be further looked into.
> >>
> >> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> >
> > 1 patch(es) applied to rtw-next branch of rtw.git, thanks.
> 
> Is there a reason for not setting macid in rtl8xxxu_fill_txdesc_v1() and
> rtl8xxxu_update_rate_mask() like it was done for the gen2 case?

rtl8xxxu_fill_txdesc_v3() doesn't fill macid neither. Quickly search for
the code filling tx desc [1]. I think we can have a
   #define TXDESC32_MACID_MASK GENMASK(4, 0)

The h2c command format of rtl8xxxu_update_rate_mask() seemingly should be
equal to rtl8192c_set_raid_cmd() [2], but not.

Can anyone help to spin patches and test if it works?

[1] https://github.com/lwfinger/rtl8192cu/blob/master/hal/rtl8192cu_xmit.c#L257
[2] https://github.com/lwfinger/rtl8192cu/blob/master/hal/rtl8192c_cmd.c#L201



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

* Re: [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
  2025-02-03  8:51     ` Ping-Ke Shih
@ 2025-02-04 19:59       ` Ezra Buehler
  2025-02-04 20:58         ` Bitterblue Smith
  0 siblings, 1 reply; 7+ messages in thread
From: Ezra Buehler @ 2025-02-04 19:59 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Martin Kaistra, linux-wireless@vger.kernel.org, Jes Sorensen,
	Kalle Valo, Bitterblue Smith, Johannes Berg, Reto Schneider,
	Ezra Buehler

On Mon, Feb 3, 2025 at 9:51 AM Ping-Ke Shih <pkshih@realtek.com> wrote:
>
> Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> >
> > Is there a reason for not setting macid in rtl8xxxu_fill_txdesc_v1() and
> > rtl8xxxu_update_rate_mask() like it was done for the gen2 case?
>
> rtl8xxxu_fill_txdesc_v3() doesn't fill macid neither. Quickly search for
> the code filling tx desc [1]. I think we can have a
>    #define TXDESC32_MACID_MASK GENMASK(4, 0)
>
> The h2c command format of rtl8xxxu_update_rate_mask() seemingly should be
> equal to rtl8192c_set_raid_cmd() [2], but not.
>
> Can anyone help to spin patches and test if it works?

The suggested changes seem to help. A quick test shows TX rates of
around 20 Mbits/sec. I will prepare the patches soon.

>
> [1] https://github.com/lwfinger/rtl8192cu/blob/master/hal/rtl8192cu_xmit.c#L257
> [2] https://github.com/lwfinger/rtl8192cu/blob/master/hal/rtl8192c_cmd.c#L201
>

I've also noticed that the TX rate is not reported correctly. "iw
station dump" shows "tx bitrate: (unknown)" and "hostapd_cli all_sta"
displays "tx_rate_info=0".

Any ideas why that could be?

Cheers,
Ezra.

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

* Re: [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
  2025-02-04 19:59       ` Ezra Buehler
@ 2025-02-04 20:58         ` Bitterblue Smith
  0 siblings, 0 replies; 7+ messages in thread
From: Bitterblue Smith @ 2025-02-04 20:58 UTC (permalink / raw)
  To: Ezra Buehler, Ping-Ke Shih
  Cc: Martin Kaistra, linux-wireless@vger.kernel.org, Jes Sorensen,
	Kalle Valo, Johannes Berg, Reto Schneider, Ezra Buehler

On 04/02/2025 21:59, Ezra Buehler wrote:
> On Mon, Feb 3, 2025 at 9:51 AM Ping-Ke Shih <pkshih@realtek.com> wrote:
>>
>> Martin Kaistra <martin.kaistra@linutronix.de> wrote:
>>>
>>> Is there a reason for not setting macid in rtl8xxxu_fill_txdesc_v1() and
>>> rtl8xxxu_update_rate_mask() like it was done for the gen2 case?
>>
>> rtl8xxxu_fill_txdesc_v3() doesn't fill macid neither. Quickly search for
>> the code filling tx desc [1]. I think we can have a
>>    #define TXDESC32_MACID_MASK GENMASK(4, 0)
>>
>> The h2c command format of rtl8xxxu_update_rate_mask() seemingly should be
>> equal to rtl8192c_set_raid_cmd() [2], but not.
>>
>> Can anyone help to spin patches and test if it works?
> 
> The suggested changes seem to help. A quick test shows TX rates of
> around 20 Mbits/sec. I will prepare the patches soon.
> 
>>
>> [1] https://github.com/lwfinger/rtl8192cu/blob/master/hal/rtl8192cu_xmit.c#L257
>> [2] https://github.com/lwfinger/rtl8192cu/blob/master/hal/rtl8192c_cmd.c#L201
>>
> 
> I've also noticed that the TX rate is not reported correctly. "iw
> station dump" shows "tx bitrate: (unknown)" and "hostapd_cli all_sta"
> displays "tx_rate_info=0".
> 
> Any ideas why that could be?
> 
> Cheers,
> Ezra.

Looks like rtl8xxxu_sta_statistics() was not updated for AP mode.
See rtw_ops_sta_statistics() and rtw_fw_ra_report_iter() in rtw88
for inspiration.

But this chip doesn't report the TX rate, so rtl8xxxu can only
report the theoretical maximum. It does this already for station
mode in rtl8xxxu_bss_info_changed(). I guess you can do the same
for AP mode in rtl8xxxu_sta_add().

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

end of thread, other threads:[~2025-02-04 20:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-22  7:15 [PATCH v2] wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS) Ezra Buehler
2025-01-23  0:31 ` Ping-Ke Shih
2025-02-03  2:40 ` Ping-Ke Shih
2025-02-03  7:55   ` Martin Kaistra
2025-02-03  8:51     ` Ping-Ke Shih
2025-02-04 19:59       ` Ezra Buehler
2025-02-04 20:58         ` Bitterblue Smith

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