diff mbox series

[v2,18/18] wifi: rtl8xxxu: Set maximum number of supported stations

Message ID 20230419100145.159191-19-martin.kaistra@linutronix.de (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: rtl8xxxu: Add AP mode support for 8188f | expand

Commit Message

Martin Kaistra April 19, 2023, 10:01 a.m. UTC
Set maximum number of associated stations supported in AP mode. For
8188f, the maximum number of supported macids is 16, reserve one for
broadcast/multicast frames.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h       | 1 +
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 +
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c  | 2 ++
 3 files changed, 4 insertions(+)

Comments

Ping-Ke Shih April 24, 2023, 3:12 a.m. UTC | #1
> -----Original Message-----
> From: Martin Kaistra <martin.kaistra@linutronix.de>
> Sent: Wednesday, April 19, 2023 6:02 PM
> To: linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih
> <pkshih@realtek.com>; Bitterblue Smith <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior
> <bigeasy@linutronix.de>
> Subject: [PATCH v2 18/18] wifi: rtl8xxxu: Set maximum number of supported stations
> 
> Set maximum number of associated stations supported in AP mode. For
> 8188f, the maximum number of supported macids is 16, reserve one for
> broadcast/multicast frames.
> 
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Bitterblue Smith April 24, 2023, 8:16 p.m. UTC | #2
On 19/04/2023 13:01, Martin Kaistra wrote:
> Set maximum number of associated stations supported in AP mode. For
> 8188f, the maximum number of supported macids is 16, reserve one for
> broadcast/multicast frames.
> 
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h       | 1 +
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 +
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c  | 2 ++
>  3 files changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> index 64e823f216967..e996168d0bfd1 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> @@ -1946,6 +1946,7 @@ struct rtl8xxxu_fileops {
>  	u8 ampdu_max_time;
>  	u8 ustime_tsf_edca;
>  	u8 supports_ap:1;
> +	u16 max_sta_num;
>  	u32 adda_1t_init;
>  	u32 adda_1t_path_on;
>  	u32 adda_2t_path_on_a;
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> index 7dc2fd8aa5317..085721c734ae2 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> @@ -1752,6 +1752,7 @@ struct rtl8xxxu_fileops rtl8188fu_fops = {
>  	.ampdu_max_time = 0x70,
>  	.ustime_tsf_edca = 0x28,
>  	.supports_ap = 1,
> +	.max_sta_num = 16,
>  	.adda_1t_init = 0x03c00014,
>  	.adda_1t_path_on = 0x03c00014,
>  	.trxff_boundary = 0x3f7f,
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index bf471c3f98b86..6d0c775244274 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -7464,6 +7464,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
>  
>  	hw->wiphy->max_scan_ssids = 1;
>  	hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
> +	if (priv->fops->max_sta_num)
> +		hw->wiphy->max_ap_assoc_sta = priv->fops->max_sta_num - 1;

The way you use it, "max_macid_num" would be a more accurate name.

>  	hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
>  	if (priv->fops->supports_ap)
>  		hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);
Kalle Valo April 25, 2023, 5:53 a.m. UTC | #3
Bitterblue Smith <rtl8821cerfe2@gmail.com> writes:

>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> @@ -7464,6 +7464,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
>>  
>>  	hw->wiphy->max_scan_ssids = 1;
>>  	hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
>> +	if (priv->fops->max_sta_num)
>> +		hw->wiphy->max_ap_assoc_sta = priv->fops->max_sta_num - 1;
>
> The way you use it, "max_macid_num" would be a more accurate name.

Indeed. I was first wondering why subtract max_sta_num, at least for me
max_macid_num makes more sense.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 64e823f216967..e996168d0bfd1 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1946,6 +1946,7 @@  struct rtl8xxxu_fileops {
 	u8 ampdu_max_time;
 	u8 ustime_tsf_edca;
 	u8 supports_ap:1;
+	u16 max_sta_num;
 	u32 adda_1t_init;
 	u32 adda_1t_path_on;
 	u32 adda_2t_path_on_a;
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
index 7dc2fd8aa5317..085721c734ae2 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
@@ -1752,6 +1752,7 @@  struct rtl8xxxu_fileops rtl8188fu_fops = {
 	.ampdu_max_time = 0x70,
 	.ustime_tsf_edca = 0x28,
 	.supports_ap = 1,
+	.max_sta_num = 16,
 	.adda_1t_init = 0x03c00014,
 	.adda_1t_path_on = 0x03c00014,
 	.trxff_boundary = 0x3f7f,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index bf471c3f98b86..6d0c775244274 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -7464,6 +7464,8 @@  static int rtl8xxxu_probe(struct usb_interface *interface,
 
 	hw->wiphy->max_scan_ssids = 1;
 	hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
+	if (priv->fops->max_sta_num)
+		hw->wiphy->max_ap_assoc_sta = priv->fops->max_sta_num - 1;
 	hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
 	if (priv->fops->supports_ap)
 		hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);