diff mbox series

wifi: mwifiex: increase max_num_akm_suites

Message ID 20240530130156.1651174-1-s.hauer@pengutronix.de
State New
Headers show
Series wifi: mwifiex: increase max_num_akm_suites | expand

Commit Message

Sascha Hauer May 30, 2024, 1:01 p.m. UTC
The maximum number of AKM suites will be set to two if not specified by
the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
specify up to ten AKM suites in the akm_suites array.

Without only the first two AKM suites will be used, further ones are
ignored.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Current wpa_supplicant/hostapd only put a maximum of two into the
akm_suites array as well, a patch changing this can be found here:
http://lists.infradead.org/pipermail/hostap/2024-May/042720.html
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kalle Valo June 6, 2024, 12:25 p.m. UTC | #1
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> The maximum number of AKM suites will be set to two if not specified by
> the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
> specify up to ten AKM suites in the akm_suites array.
> 
> Without only the first two AKM suites will be used, further ones are
> ignored.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

I assume you that you have also tested this on a real device, right?
Sascha Hauer June 10, 2024, 7:27 a.m. UTC | #2
On Thu, Jun 06, 2024 at 12:25:48PM +0000, Kalle Valo wrote:
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > The maximum number of AKM suites will be set to two if not specified by
> > the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
> > specify up to ten AKM suites in the akm_suites array.
> > 
> > Without only the first two AKM suites will be used, further ones are
> > ignored.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> I assume you that you have also tested this on a real device, right?

Sure. It was tested with a MAYA-W161-00B module from u-blox with a IW416
chipset.

BTW I haven't mentioned this, but It fixes the same problem as mentioned here:

https://lore.kernel.org/linux-kernel/20240523081428.2852276-1-s.hauer@pengutronix.de/T/

Sascha
Marcel Ziswiler June 11, 2024, 1:12 p.m. UTC | #3
Hi Sascha

On Mon, 2024-06-10 at 09:27 +0200, Sascha Hauer wrote:
> On Thu, Jun 06, 2024 at 12:25:48PM +0000, Kalle Valo wrote:
> > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > 
> > > The maximum number of AKM suites will be set to two if not specified by
> > > the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
> > > specify up to ten AKM suites in the akm_suites array.
> > > 
> > > Without only the first two AKM suites will be used, further ones are
> > > ignored.
> > > 
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > I assume you that you have also tested this on a real device, right?
> 
> Sure. It was tested with a MAYA-W161-00B module from u-blox with a IW416
> chipset.
> 
> BTW I haven't mentioned this, but It fixes the same problem as mentioned here:
> 
> https://lore.kernel.org/linux-kernel/20240523081428.2852276-1-s.hauer@pengutronix.de/T/

As we are also using the IW416 albeit from the MAYA-W160-00B module on our Verdin AM62, we were wondering about
the exact use case this patch helps solving. Could you reveal some more details around this? Thanks!

> Sascha

Cheers

Marcel
Sascha Hauer June 12, 2024, 1:03 p.m. UTC | #4
On Tue, Jun 11, 2024 at 01:12:26PM +0000, Marcel Ziswiler wrote:
> Hi Sascha
> 
> On Mon, 2024-06-10 at 09:27 +0200, Sascha Hauer wrote:
> > On Thu, Jun 06, 2024 at 12:25:48PM +0000, Kalle Valo wrote:
> > > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > > 
> > > > The maximum number of AKM suites will be set to two if not specified by
> > > > the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
> > > > specify up to ten AKM suites in the akm_suites array.
> > > > 
> > > > Without only the first two AKM suites will be used, further ones are
> > > > ignored.
> > > > 
> > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > 
> > > I assume you that you have also tested this on a real device, right?
> > 
> > Sure. It was tested with a MAYA-W161-00B module from u-blox with a IW416
> > chipset.
> > 
> > BTW I haven't mentioned this, but It fixes the same problem as mentioned here:
> > 
> > https://lore.kernel.org/linux-kernel/20240523081428.2852276-1-s.hauer@pengutronix.de/T/
> 
> As we are also using the IW416 albeit from the MAYA-W160-00B module on our Verdin AM62, we were wondering about
> the exact use case this patch helps solving. Could you reveal some more details around this? Thanks!

You'll need this patch once wpa_supplicant specifies more than two akm
suites in the key_mgmt (in AP mode).

With the current mainline driver using NetworkManager to setup a hotspot
with:

nmcli device wifi hotspot con-name leica ssid mywifi band bg password hallo123

NetworkManager ends up setting the key_mgmt option to 'WPA-PSK WPA-PSK-SHA256'.
These are two entries and this works fine.

However, when the patches adding host mlme support are applied (see
https://lore.kernel.org/lkml/Zk6TklTIbxZxIWyb@google.com/T/),
NetworkManager will set key_mgmt to 'WPA-PSK WPA-PSK-SHA256 SAE'. These
are three entries and thus exceed the current array size of two. The
effect is that SAE is ignored by the driver and SAE is not enabled in
the device.

Sascha
Brian Norris June 21, 2024, 7:16 p.m. UTC | #5
On Fri, Jun 21, 2024 at 1:48 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Thu, Jun 20, 2024 at 11:05:24AM -0700, Brian Norris wrote:
> > Possibly dumb question: what's unique about mwifiex here? Everything you
> > describe above sounds applicable to all drivers, IIUC, and I don't see
> > any other driver that touches max_num_akm_suites.
>
> I asked myself the same question and I don't have an answer to it. To me
> it looks like the number of akm suites is limited by the akm_suites array
> size which is CFG80211_MAX_NUM_AKM_SUITES which is 10 and that could be
> used for all drivers.

Yeah, I can't figure out a great answer either. Although I did find that
(1) it's theoretically possible some driver could be confused by
larger indices (which should be easy enough to audit...) and
(2) there's at least 1 borderline example, in wilc1000 --
wilc_join_bss_param is only prepared to handle up to 3 akm_suites. But
it also has a (magic number) bound of 3, so it will silently drop the
4th, 5th, ... suite.

So maybe it's a reasonable start to have drivers modify this as
needed. If we later figure out all drivers should be OK with an
increased limit, we can unify that later.

> max_num_akm_suites is introduced to be driver specific and so I changed
> it only for the driver I am currently interested in.

Sure. Seems fine to me.

Acked-by: Brian Norris <briannorris@chromium.org>
Sascha Hauer July 16, 2024, 9:10 a.m. UTC | #6
On Thu, May 30, 2024 at 03:01:56PM +0200, Sascha Hauer wrote:
> The maximum number of AKM suites will be set to two if not specified by
> the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
> specify up to ten AKM suites in the akm_suites array.
> 
> Without only the first two AKM suites will be used, further ones are
> ignored.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 
> Current wpa_supplicant/hostapd only put a maximum of two into the
> akm_suites array as well, a patch changing this can be found here:
> http://lists.infradead.org/pipermail/hostap/2024-May/042720.html

This was recently merged: http://lists.infradead.org/pipermail/hostap/2024-July/042802.html

Kalle, given that userspace now would be able to make use of a bigger
AKM suites array, can we merge this patch for the kernel as well?

Sascha

> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index b909a7665e9cc..908dfe01c30d7 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -4358,6 +4358,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
>  				 BIT(NL80211_IFTYPE_P2P_GO) |
>  				 BIT(NL80211_IFTYPE_AP);
>  
> +	wiphy->max_num_akm_suites = CFG80211_MAX_NUM_AKM_SUITES;
> +
>  	if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
>  		wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
>  
> -- 
> 2.39.2
> 
>
Kalle Valo July 30, 2024, 8:48 a.m. UTC | #7
Sascha Hauer <s.hauer@pengutronix.de> writes:

> On Thu, May 30, 2024 at 03:01:56PM +0200, Sascha Hauer wrote:
>> The maximum number of AKM suites will be set to two if not specified by
>> the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
>> specify up to ten AKM suites in the akm_suites array.
>> 
>> Without only the first two AKM suites will be used, further ones are
>> ignored.
>> 
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>> 
>> Current wpa_supplicant/hostapd only put a maximum of two into the
>> akm_suites array as well, a patch changing this can be found here:
>> http://lists.infradead.org/pipermail/hostap/2024-May/042720.html
>
> This was recently merged:
> http://lists.infradead.org/pipermail/hostap/2024-July/042802.html
>
> Kalle, given that userspace now would be able to make use of a bigger
> AKM suites array, can we merge this patch for the kernel as well?

I changed the state to New now so it's back in my queue.
Kalle Valo Aug. 4, 2024, 8:54 a.m. UTC | #8
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> The maximum number of AKM suites will be set to two if not specified by
> the driver. Set it to CFG80211_MAX_NUM_AKM_SUITES to let userspace
> specify up to ten AKM suites in the akm_suites array.
> 
> Without only the first two AKM suites will be used, further ones are
> ignored.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Acked-by: Brian Norris <briannorris@chromium.org>

Patch applied to wireless-next.git, thanks.

e8b7d0c66a4d wifi: mwifiex: increase max_num_akm_suites
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index b909a7665e9cc..908dfe01c30d7 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4358,6 +4358,8 @@  int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 				 BIT(NL80211_IFTYPE_P2P_GO) |
 				 BIT(NL80211_IFTYPE_AP);
 
+	wiphy->max_num_akm_suites = CFG80211_MAX_NUM_AKM_SUITES;
+
 	if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
 		wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);