Re: [PATCH v8 2/2] wifi: mwifiex: add host mlme for AP mode

From: Francesco Dolcini
Date: Tue Feb 27 2024 - 12:53:49 EST


On Fri, Dec 22, 2023 at 11:21:23AM +0800, David Lin wrote:
> Add host based MLME to enable WPA3 functionalities in AP mode.
> This feature required a firmware with the corresponding V2 Key API
> support. The feature (WPA3) is currently enabled and verified only
> on IW416. Also, verified no regression with change when host MLME
> is disabled.
>
> Signed-off-by: David Lin <yu-hao.lin@xxxxxxx>

Reviewed-by: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>

with the same disclaimer from patch 1/2, I'm not a wireless driver expert.

> ---
>
> v8:
> - first full and complete patch to support host based MLME for AP
> mode.
>
> ---
> .../net/wireless/marvell/mwifiex/cfg80211.c | 79 +++++++-
> drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +
> drivers/net/wireless/marvell/mwifiex/fw.h | 21 +++
> drivers/net/wireless/marvell/mwifiex/ioctl.h | 5 +
> .../wireless/marvell/mwifiex/sta_cmdresp.c | 2 +
> .../net/wireless/marvell/mwifiex/uap_cmd.c | 171 ++++++++++++++++++
> drivers/net/wireless/marvell/mwifiex/util.c | 24 +++
> 7 files changed, 301 insertions(+), 3 deletions(-)
>

..

> diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
> index e78a201cd150..1e7f4afe9960 100644
> --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
> +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
> @@ -760,6 +786,144 @@ static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv,
> return 0;
> }
>
> +/* This function prepares AP specific add station command.
> + */
> +static int mwifiex_cmd_uap_add_station(struct mwifiex_private *priv,
> + struct host_cmd_ds_command *cmd,
> + u16 cmd_action, void *data_buf)
> +{
> + struct host_cmd_ds_add_station *new_sta = &cmd->params.sta_info;
> + struct mwifiex_sta_info *add_sta = (struct mwifiex_sta_info *)data_buf;
> + struct station_parameters *params = add_sta->params;
> + struct mwifiex_sta_node *sta_ptr;
> + u8 *pos;
> + u8 qos_capa;
> + u16 header_len = sizeof(struct mwifiex_ie_types_header);
> + u16 tlv_len;
> + int size;
> + struct mwifiex_ie_types_data *tlv;
> + struct mwifiex_ie_types_sta_flag *sta_flag;
> + int i;
> +
> + cmd->command = cpu_to_le16(HostCmd_CMD_ADD_NEW_STATION);
> + new_sta->action = cpu_to_le16(cmd_action);
> + size = sizeof(struct host_cmd_ds_add_station) + S_DS_GEN;
> +
> + if (cmd_action == HostCmd_ACT_ADD_STA)
> + sta_ptr = mwifiex_add_sta_entry(priv, add_sta->peer_mac);
> + else
> + sta_ptr = mwifiex_get_sta_entry(priv, add_sta->peer_mac);
> +
> + if (!sta_ptr)
> + return -1;
> +
> + memcpy(new_sta->peer_mac, add_sta->peer_mac, ETH_ALEN);
> +
> + if (cmd_action == HostCmd_ACT_REMOVE_STA)
> + goto done;

This goto here, skipping lot of code, just to do

cmd->size = cpu_to_le16(size);
return 0;

is not really nice for my personal taste, but fine like that.

Francesco