wifi: mwifiex: add code to support host mlme
v11 cover wifi: mwifiex: add code to support host mlme
With host mlme:
Without host mlme:
This series add host based MLME support to the mwifiex driver, this enables WPA3 support in both client and AP mode.
To enable WPA3, a firmware with corresponding V2 Key API support is required.
The feature is currently only enabled on NXP IW416 (SD8978), and it was internally validated by NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.
v11:
- add proper and useful comment for mwifiex_cfg80211_probe_client().
- modify 'mwifiex_mgmt_stypes' to allow multi-adapters with different setting of host_mlme_enbaled.
v10:
- Use eth_broadcast_addr() to set the broadcast address.
- Add comment for constant used for the length of FW special 4 address management header.
- Check host_mlme_enabled to decide if creating host_mlme_workqueue or not.
- Use cpu_to_le16 instead of casting via (__force __le16).
- Change the abbreviation "disasso" to "disassoc" of the printout message.
v9:
- Remove redundent code.
- Remove unnecessary goto target.
v8:
- Separate 6/12 from patch v7.
As it's a bug fix not part of host MLME feature.
- Rearrnage MLME feature into 2 patches:
a. Add host based MLME support for STA mode. b. Add host based MLME support for AP mode.
v7:
- Fix regression: Downlink throughput degraded by 70% in AP mode.
- Fix issue: On STAUT, kernel Oops occurs when there is no association response from AP.
- Fix issue: On STAUT, if AP leaves abruptly and deauth is missing, STA can't connect to AP anymore.
- Fix regression: STA can't connect to AP when host_mlme is disabled (impact all chips).
- Address reviewer comments.
v6:
- Correct mailing sequence.
v5:
- Add host base MLME support to enable WPA3 functionalities for both STA and AP mode.
- This feature (WPA3) required a firmware with corresponding Key API V2 support.
- QA validation and regression have been covered for IW416.
- This feature (WPA3) is currently enabled and verified only for IW416.
- Changelogs since patch V4:
a. Add WPA3 support for AP mode.
b. Bug fix: In WPA3 STA mode, deice gets disconnected from AP
when group rekey occurs.
c. Bug fix: STAUT doesn't send WMM IE in association request when
associate to a WMM-AP.
v4:
- Refine code segment per review comment.
- Add API to check firmware encryption key command version when host_mlme is enabled.
v3:
- Cleanup commit message.
v2:
- Fix checkpatch error (pwe[1] -> pwe[0]).
- Move module parameter 'host_mlme' to mwifiex_sdio_device structure. Default only enable for IW416.
- Disable advertising NL80211_FEATURE_SAE if host_mlme is not enabled.
David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode
.../net/wireless/marvell/mwifiex/cfg80211.c | 404 +++++++++++++++++- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 27 ++ drivers/net/wireless/marvell/mwifiex/decl.h | 23 + drivers/net/wireless/marvell/mwifiex/fw.h | 54 +++ drivers/net/wireless/marvell/mwifiex/init.c | 6 + drivers/net/wireless/marvell/mwifiex/ioctl.h | 5 + drivers/net/wireless/marvell/mwifiex/join.c | 66 ++- drivers/net/wireless/marvell/mwifiex/main.c | 62 +++ drivers/net/wireless/marvell/mwifiex/main.h | 17 + drivers/net/wireless/marvell/mwifiex/scan.c | 6 + drivers/net/wireless/marvell/mwifiex/sdio.c | 13 + drivers/net/wireless/marvell/mwifiex/sdio.h | 2 + .../wireless/marvell/mwifiex/sta_cmdresp.c | 2 + .../net/wireless/marvell/mwifiex/sta_event.c | 36 +- .../net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_tx.c | 9 +- .../net/wireless/marvell/mwifiex/uap_cmd.c | 171 ++++++++ drivers/net/wireless/marvell/mwifiex/util.c | 104 +++++ 18 files changed, 992 insertions(+), 17 deletions(-)
base-commit: 347bf38330c2971230d8206eb8b37ed36b54982d
Signature · 1 line
2.34.1
PATCH v11 1/2 wifi: mwifiex: add host mlme for client mode
Add host based MLME to enable WPA3 functionalities in client 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.
---
v11:
- add proper and useful comment for mwifiex_cfg80211_probe_client().
v10:
- use eth_broadcast_addr() to set the broadcast address.
- add comment for constant used for the length of FW special 4 address management header.
- check host_mlme_enabled to decide if creating host_mlme_workqueue or not.
- use cpu_to_le16 instead of casting via (__force __le16).
- change the abbreviation "disasso" to "disassoc" of the printout message.
v9:
- remove redundent code.
v8:
- first full and complete patch to support host based MLME for client mode.
--- .../net/wireless/marvell/mwifiex/cfg80211.c | 318 ++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/cmdevt.c | 25 ++ drivers/net/wireless/marvell/mwifiex/decl.h | 23 ++ drivers/net/wireless/marvell/mwifiex/fw.h | 33 ++ drivers/net/wireless/marvell/mwifiex/init.c | 6 + drivers/net/wireless/marvell/mwifiex/join.c | 66 +++- drivers/net/wireless/marvell/mwifiex/main.c | 62 ++++ drivers/net/wireless/marvell/mwifiex/main.h | 16 + drivers/net/wireless/marvell/mwifiex/scan.c | 6 + drivers/net/wireless/marvell/mwifiex/sdio.c | 13 + drivers/net/wireless/marvell/mwifiex/sdio.h | 2 + .../net/wireless/marvell/mwifiex/sta_event.c | 36 +- .../net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_tx.c | 9 +- drivers/net/wireless/marvell/mwifiex/util.c | 80 +++++ 15 files changed, 683 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +318 -0
@@ -268,6 +268,8 @@ mwifiex_cfg80211_update_mgmt_frame_registrations(struct wiphy *wiphy,if (mask != priv->mgmt_frame_mask) { priv->mgmt_frame_mask = mask; +if (priv->host_mlme_reg) + priv->mgmt_frame_mask |=HOST_MLME_MGMT_MASK ;mwifiex_send_cmd (priv, HostCmd_CMD_MGMT_FRAME_REG, HostCmd_ACT_GEN_SET,0 , &priv->mgmt_frame_mask, false);
@@ -848,6 +850,7 @@ static int mwifiex_deinit_priv_params(struct mwifiex_private *priv)struct mwifiex_adapter *adapter = priv->adapter;unsigned long flags; + priv->host_mlme_reg = false; priv->mgmt_frame_mask =0 ; if (mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG, HostCmd_ACT_GEN_SET, 0,
@@ -3633,6 +3636,9 @@ static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev,if (!ISSUPP_FIRMWARE_SUPPLICANT (priv->adapter->fw_cap_info))return -EOPNOTSUPP ; +if (priv->adapter->host_mlme_enabled) +return 0 ; +return mwifiex_send_cmd (priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG, HostCmd_ACT_GEN_SET,0 , data, true); }
@@ -4206,6 +4212,305 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,return ret; } +static int +mwifiex_cfg80211_authenticate (struct wiphy *wiphy, +struct net_device *dev, +struct cfg80211_auth_request *req) +{ +struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); +struct mwifiex_adapter *adapter = priv->adapter; +struct sk_buff *skb; +u16 pkt_len, auth_alg; +int ret; +struct mwifiex_ieee80211_mgmt *mgmt; +struct mwifiex_txinfo *tx_info; +u32 tx_control =0 , pkt_type =PKT_TYPE_MGMT ; +u8 trans =1 , status_code =0 ; +u8 *varptr; + +if (GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_UAP ) { +mwifiex_dbg (priv->adapter,ERROR ,"Interface role is AP\n" ); +return -EFAULT ; + } + +if (priv->wdev.iftype !=NL80211_IFTYPE_STATION ) { +mwifiex_dbg (priv->adapter,ERROR , +"Interface type is not correct (type %d)\n" , + priv->wdev.iftype); +return -EINVAL ; + } + +if (priv->auth_alg !=WLAN_AUTH_SAE && + (priv->auth_flag &HOST_MLME_AUTH_PENDING )) { +mwifiex_dbg (priv->adapter,ERROR ,"Pending auth on going\n" ); +return -EBUSY ; + } + +if (!priv->host_mlme_reg) { + priv->host_mlme_reg = true; + priv->mgmt_frame_mask |=HOST_MLME_MGMT_MASK ; +mwifiex_send_cmd (priv, HostCmd_CMD_MGMT_FRAME_REG, + HostCmd_ACT_GEN_SET,0 , + &priv->mgmt_frame_mask, false); + } + +switch (req->auth_type) { +case NL80211_AUTHTYPE_OPEN_SYSTEM : + auth_alg =WLAN_AUTH_OPEN ; +break ; +case NL80211_AUTHTYPE_SHARED_KEY : + auth_alg =WLAN_AUTH_SHARED_KEY ; +break ; +case NL80211_AUTHTYPE_FT : + auth_alg =WLAN_AUTH_FT ; +break ; +case NL80211_AUTHTYPE_NETWORK_EAP : + auth_alg =WLAN_AUTH_LEAP ; +break ; +case NL80211_AUTHTYPE_SAE : + auth_alg =WLAN_AUTH_SAE ; +break ; +default : +mwifiex_dbg (priv->adapter,ERROR , +"unsupported auth type=%d\n" , req->auth_type); +return -EOPNOTSUPP ; + } + +if (!priv->auth_flag) { + ret =mwifiex_remain_on_chan_cfg (priv, HostCmd_ACT_GEN_SET, + req->bss->channel, +AUTH_TX_DEFAULT_WAIT_TIME ); + +if (!ret) { + priv->roc_cfg.cookie =get_random_u32 () |1 ; + priv->roc_cfg.chan = *req->bss->channel; + }else { +return -EFAULT ; + } + } + + priv->sec_info.authentication_mode = auth_alg; + +mwifiex_cancel_scan (adapter); + + pkt_len = (u16 )req->ie_len + req->auth_data_len + +MWIFIEX_MGMT_HEADER_LEN +MWIFIEX_AUTH_BODY_LEN ; +if (req->auth_data_len >=4 ) + pkt_len -=4 ; + + skb =dev_alloc_skb (MWIFIEX_MIN_DATA_HEADER_LEN + +MWIFIEX_MGMT_FRAME_HEADER_SIZE + + pkt_len +sizeof (pkt_len)); +if (!skb) { +mwifiex_dbg (priv->adapter,ERROR , +"allocate skb failed for management frame\n" ); +return -ENOMEM ; + } + + tx_info =MWIFIEX_SKB_TXCB (skb); +memset (tx_info,0 ,sizeof (*tx_info)); + tx_info->bss_num = priv->bss_num; + tx_info->bss_type = priv->bss_type; + tx_info->pkt_len = pkt_len; + +skb_reserve (skb,MWIFIEX_MIN_DATA_HEADER_LEN + +MWIFIEX_MGMT_FRAME_HEADER_SIZE +sizeof (pkt_len)); +memcpy (skb_push (skb,sizeof (pkt_len)), &pkt_len,sizeof (pkt_len)); +memcpy (skb_push (skb,sizeof (tx_control)), + &tx_control,sizeof (tx_control)); +memcpy (skb_push (skb,sizeof (pkt_type)), &pkt_type,sizeof (pkt_type)); + + mgmt = (struct mwifiex_ieee80211_mgmt *)skb_put (skb, pkt_len); +memset (mgmt,0 , pkt_len); + mgmt->frame_control = +cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_AUTH ); +memcpy (mgmt->da, req->bss->bssid,ETH_ALEN ); +memcpy (mgmt->sa, priv->curr_addr,ETH_ALEN ); +memcpy (mgmt->bssid, req->bss->bssid,ETH_ALEN ); +eth_broadcast_addr (mgmt->addr4); + +if (req->auth_data_len >=4 ) { +if (req->auth_type ==NL80211_AUTHTYPE_SAE ) { +__le16 *pos = (__le16 *)req->auth_data; + + trans =le16_to_cpu (pos[0 ]); + status_code =le16_to_cpu (pos[1 ]); + } +memcpy ((u8 *)(&mgmt->auth.variable), req->auth_data +4 , + req->auth_data_len -4 ); + varptr = (u8 *)&mgmt->auth.variable + + (req->auth_data_len -4 ); + } + + mgmt->auth.auth_alg =cpu_to_le16 (auth_alg); + mgmt->auth.auth_transaction =cpu_to_le16 (trans); + mgmt->auth.status_code =cpu_to_le16 (status_code); + +if (req->ie && req->ie_len) { +if (!varptr) + varptr = (u8 *)&mgmt->auth.variable; +memcpy ((u8 *)varptr, req->ie, req->ie_len); + } + + priv->auth_flag =HOST_MLME_AUTH_PENDING ; + priv->auth_alg = auth_alg; + + skb->priority =WMM_HIGHEST_PRIORITY ; +__net_timestamp (skb); + +mwifiex_dbg (priv->adapter,MSG , +"auth: send authentication to %pM\n" , req->bss->bssid); + +mwifiex_queue_tx_pkt (priv, skb); + +return 0 ; +} + +static int +mwifiex_cfg80211_associate (struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_assoc_request *req) +{ +struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); +struct mwifiex_adapter *adapter = priv->adapter; +int ret; +struct cfg80211_ssid req_ssid; +const u8 *ssid_ie; + +if (GET_BSS_ROLE (priv) !=MWIFIEX_BSS_ROLE_STA ) { +mwifiex_dbg (adapter,ERROR , +"%s: reject infra assoc request in non-STA role\n" , + dev->name); +return -EINVAL ; + } + +if (test_bit (MWIFIEX_SURPRISE_REMOVED , &adapter->work_flags) || +test_bit (MWIFIEX_IS_CMD_TIMEDOUT , &adapter->work_flags)) { +mwifiex_dbg (adapter,ERROR , +"%s: Ignore association.\t" +"Card removed or FW in bad state\n" , + dev->name); +return -EFAULT ; + } + +if (priv->auth_alg ==WLAN_AUTH_SAE ) + priv->auth_flag =HOST_MLME_AUTH_DONE ; + +if (priv->auth_flag && !(priv->auth_flag &HOST_MLME_AUTH_DONE )) +return -EBUSY ; + +if (priv->roc_cfg.cookie) { + ret =mwifiex_remain_on_chan_cfg (priv, HostCmd_ACT_GEN_REMOVE, + &priv->roc_cfg.chan,0 ); +if (!ret) +memset (&priv->roc_cfg,0 , +sizeof (struct mwifiex_roc_cfg )); +else +return -EFAULT ; + } + +if (!mwifiex_stop_bg_scan (priv)) +cfg80211_sched_scan_stopped_locked (priv->wdev.wiphy,0 ); + +memset (&req_ssid,0 ,sizeof (struct cfg80211_ssid )); +rcu_read_lock (); + ssid_ie =ieee80211_bss_get_ie (req->bss,WLAN_EID_SSID ); + +if (!ssid_ie) + goto ssid_err; + + req_ssid.ssid_len = ssid_ie[1 ]; +if (req_ssid.ssid_len >IEEE80211_MAX_SSID_LEN ) { +mwifiex_dbg (adapter,ERROR ,"invalid SSID - aborting\n" ); + goto ssid_err; + } + +memcpy (req_ssid.ssid, ssid_ie +2 , req_ssid.ssid_len); +if (!req_ssid.ssid_len || req_ssid.ssid[0 ] <0x20 ) { +mwifiex_dbg (adapter,ERROR ,"invalid SSID - aborting\n" ); + goto ssid_err; + } +rcu_read_unlock (); + +/* As this is new association, clear locally stored +* keys and security related flags +*/ + priv->sec_info.wpa_enabled = false; + priv->sec_info.wpa2_enabled = false; + priv->wep_key_curr_index =0 ; + priv->sec_info.encryption_mode =0 ; + priv->sec_info.is_authtype_auto =0 ; +if (mwifiex_set_encode (priv,NULL ,NULL ,0 ,0 ,NULL ,1 )) { +mwifiex_dbg (priv->adapter,ERROR ,"deleting the crypto keys\n" ); +return -EFAULT ; + } + +if (req->crypto.n_ciphers_pairwise) + priv->sec_info.encryption_mode = + req->crypto.ciphers_pairwise[0 ]; + +if (req->crypto.cipher_group) + priv->sec_info.encryption_mode = req->crypto.cipher_group; + +if (req->ie) +mwifiex_set_gen_ie (priv, req->ie, req->ie_len); + +memcpy (priv->cfg_bssid, req->bss->bssid,ETH_ALEN ); + +mwifiex_dbg (adapter,MSG , +"assoc: send association to %pM\n" , req->bss->bssid); + +cfg80211_ref_bss (adapter->wiphy, req->bss); + ret =mwifiex_bss_start (priv, req->bss, &req_ssid); +if (ret) { + priv->auth_flag =0 ; + priv->auth_alg =WLAN_AUTH_NONE ; +eth_zero_addr (priv->cfg_bssid); + } + +if (priv->assoc_rsp_size) { + priv->req_bss = req->bss; + adapter->assoc_resp_received = true; +queue_work (adapter->host_mlme_workqueue, + &adapter->host_mlme_work); + } + +cfg80211_put_bss (priv->adapter->wiphy, req->bss); + +return 0 ; + +ssid_err: +rcu_read_unlock (); +return -EFAULT ; +} + +static int +mwifiex_cfg80211_deauthenticate (struct wiphy *wiphy, +struct net_device *dev, +struct cfg80211_deauth_request *req) +{ +return mwifiex_cfg80211_disconnect (wiphy, dev, req->reason_code); +} + +static int +mwifiex_cfg80211_disassociate (struct wiphy *wiphy, +struct net_device *dev, +struct cfg80211_disassoc_request *req) +{ +return mwifiex_cfg80211_disconnect (wiphy, dev, req->reason_code); +} + +static int +mwifiex_cfg80211_probe_client (struct wiphy *wiphy, +struct net_device *dev,const u8 *peer, +u64 *cookie) +{ +/* hostapd looks for NL80211_CMD_PROBE_CLIENT support; otherwise, +* it requires monitor-mode support (which mwifiex doesn't support). +* Provide fake probe_client support to work around this. +*/ +return -EOPNOTSUPP ; +} +/* station cfg80211 operations */ static struct cfg80211_ops mwifiex_cfg80211_ops = { .add_virtual_intf = mwifiex_add_virtual_intf,
@@ -4351,6 +4656,16 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) "%s: creating new wiphy\n", __func__);return -ENOMEM ; } +if (adapter->host_mlme_enabled) { + mwifiex_cfg80211_ops.auth = mwifiex_cfg80211_authenticate; + mwifiex_cfg80211_ops.assoc = mwifiex_cfg80211_associate; + mwifiex_cfg80211_ops.deauth = mwifiex_cfg80211_deauthenticate; + mwifiex_cfg80211_ops.disassoc = mwifiex_cfg80211_disassociate; + mwifiex_cfg80211_ops.disconnect =NULL ; + mwifiex_cfg80211_ops.connect =NULL ; + mwifiex_cfg80211_ops.probe_client = + mwifiex_cfg80211_probe_client; + } wiphy->max_scan_ssids =MWIFIEX_MAX_SSID_LIST_LENGTH ; wiphy->max_scan_ie_len =MWIFIEX_MAX_VSIE_LEN ; wiphy->mgmt_stypes = mwifiex_mgmt_stypes;
@@ -4432,6 +4747,9 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)NL80211_FEATURE_LOW_PRIORITY_SCAN |NL80211_FEATURE_NEED_OBSS_SCAN ; +if (adapter->host_mlme_enabled) + wiphy->features |=NL80211_FEATURE_SAE ; +if (ISSUPP_ADHOC_ENABLED (adapter->fw_cap_info)) wiphy->features |=NL80211_FEATURE_HT_IBSS ;
drivers/net/wireless/marvell/mwifiex/cmdevt.c +25 -0
@@ -924,6 +924,24 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)return ret; } +void mwifiex_process_assoc_resp (struct mwifiex_adapter *adapter) +{ +struct cfg80211_rx_assoc_resp_data assoc_resp = { + .uapsd_queues =-1 , + }; +struct mwifiex_private *priv = +mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_STA ); + +if (priv->assoc_rsp_size) { + assoc_resp.links[0 ].bss = priv->req_bss; + assoc_resp.buf = priv->assoc_rsp_buf; + assoc_resp.len = priv->assoc_rsp_size; +cfg80211_rx_assoc_resp (priv->netdev, + &assoc_resp); + priv->assoc_rsp_size =0 ; + } +} +/* * This function handles the timeout of command sending. *
@@ -1672,6 +1690,13 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,if (adapter->fw_api_ver ==MWIFIEX_FW_V15 ) adapter->scan_chan_gap_enabled = true; +if (adapter->key_api_major_ver !=KEY_API_VER_MAJOR_V2 ) + adapter->host_mlme_enabled = false; + +mwifiex_dbg (adapter,MSG ,"host_mlme: %s, key_api: %d\n" , + adapter->host_mlme_enabled ?"enable" :"disable" , + adapter->key_api_major_ver); +return 0 ; }
drivers/net/wireless/marvell/mwifiex/decl.h +23 -0
@@ -31,6 +31,29 @@* + sizeof(tx_control) */ +#define FRMCTL_LEN 2 +#define DURATION_LEN 2 +#define SEQCTL_LEN 2 +/* special FW 4 address management header */ +#define MWIFIEX_MGMT_HEADER_LEN (FRMCTL_LEN + DURATION_LEN + ETH_ALEN + \ + ETH_ALEN + ETH_ALEN + SEQCTL_LEN + ETH_ALEN) + +#define AUTH_ALG_LEN 2 +#define AUTH_TRANSACTION_LEN 2 +#define AUTH_STATUS_LEN 2 +#define MWIFIEX_AUTH_BODY_LEN (AUTH_ALG_LEN + AUTH_TRANSACTION_LEN + \ + AUTH_STATUS_LEN) + +#define HOST_MLME_AUTH_PENDING BIT(0) +#define HOST_MLME_AUTH_DONE BIT(1) + +#define HOST_MLME_MGMT_MASK (BIT(IEEE80211_STYPE_AUTH >> 4) | \ + BIT(IEEE80211_STYPE_DEAUTH >> 4) | \ + BIT(IEEE80211_STYPE_DISASSOC >> 4)) +#define AUTH_TX_DEFAULT_WAIT_TIME 2400 + +#define WLAN_AUTH_NONE 0xFFFF +#define MWIFIEX_MAX_TX_BASTREAM_SUPPORTED 2#define MWIFIEX_MAX_RX_BASTREAM_SUPPORTED 16#define MWIFIEX_MAX_TDLS_PEER_SUPPORTED 8
drivers/net/wireless/marvell/mwifiex/fw.h +33 -0
@@ -210,6 +210,8 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define TLV_TYPE_RANDOM_MAC (PROPRIETARY_TLV_BASE_ID + 236)#define TLV_TYPE_CHAN_ATTR_CFG (PROPRIETARY_TLV_BASE_ID + 237)#define TLV_TYPE_MAX_CONN (PROPRIETARY_TLV_BASE_ID + 279) +#define TLV_TYPE_HOST_MLME (PROPRIETARY_TLV_BASE_ID + 307) +#define TLV_TYPE_SAE_PWE_MODE (PROPRIETARY_TLV_BASE_ID + 339)#define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048
@@ -744,6 +746,25 @@ struct uap_rxpd {u8 flags; } __packed; +struct mwifiex_auth { +__le16 auth_alg; +__le16 auth_transaction; +__le16 status_code; +/* possibly followed by Challenge text */ +u8 variable[]; +} __packed; + +struct mwifiex_ieee80211_mgmt { +__le16 frame_control; +__le16 duration; +u8 da[ETH_ALEN ]; +u8 sa[ETH_ALEN ]; +u8 bssid[ETH_ALEN ]; +__le16 seq_ctrl; +u8 addr4[ETH_ALEN ]; +struct mwifiex_auth auth; +} __packed; +struct mwifiex_fw_chan_stats {u8 chan_num;u8 bandcfg;
@@ -803,6 +824,11 @@ struct mwifiex_ie_types_ssid_param_set {u8 ssid[]; } __packed; +struct mwifiex_ie_types_host_mlme { +struct mwifiex_ie_types_header header; +u8 host_mlme; +} __packed; +struct mwifiex_ie_types_num_probes {struct mwifiex_ie_types_header header;__le16 num_probes;
@@ -906,6 +932,13 @@ struct mwifiex_ie_types_tdls_idle_timeout {__le16 value; } __packed; +#define MWIFIEX_AUTHTYPE_SAE 6 + +struct mwifiex_ie_types_sae_pwe_mode { +struct mwifiex_ie_types_header header; +u8 pwe[]; +} __packed; +struct mwifiex_ie_types_rsn_param_set {struct mwifiex_ie_types_header header;u8 rsn_ie[];
drivers/net/wireless/marvell/mwifiex/init.c +6 -0
@@ -81,6 +81,9 @@ int mwifiex_init_priv(struct mwifiex_private *priv) priv->bcn_avg_factor =DEFAULT_BCN_AVG_FACTOR ; priv->data_avg_factor =DEFAULT_DATA_AVG_FACTOR ; + priv->auth_flag =0 ; + priv->auth_alg =WLAN_AUTH_NONE ; + priv->sec_info.wep_enabled =0 ; priv->sec_info.authentication_mode =NL80211_AUTHTYPE_OPEN_SYSTEM ; priv->sec_info.encryption_mode =0 ;
@@ -220,6 +223,9 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->cmd_resp_received = false; adapter->event_received = false; adapter->data_received = false; + adapter->assoc_resp_received = false; + adapter->priv_link_lost =NULL ; + adapter->host_mlme_link_lost = false;clear_bit (MWIFIEX_SURPRISE_REMOVED , &adapter->work_flags);
drivers/net/wireless/marvell/mwifiex/join.c +64 -2
109 lines not on this page · raw message
drivers/net/wireless/marvell/mwifiex/main.c +62 -0
92 lines not on this page · raw message
drivers/net/wireless/marvell/mwifiex/main.h +16 -0
@@ -424,6 +424,8 @@ struct mwifiex_bssdescriptor {u16 wpa_offset;struct ieee_types_generic *bcn_rsn_ie;u16 rsn_offset; +struct ieee_types_generic *bcn_rsnx_ie; +u16 rsnx_offset;struct ieee_types_generic *bcn_wapi_ie;u16 wapi_offset;u8 *beacon_buf;
@@ -525,6 +527,8 @@ struct mwifiex_private {u8 bss_priority;u8 bss_num;u8 bss_started; +u8 auth_flag; +u16 auth_alg;u8 frame_type;u8 curr_addr[ETH_ALEN ];u8 media_connected;
@@ -608,6 +612,7 @@ struct mwifiex_private {#define MWIFIEX_ASSOC_RSP_BUF_SIZE 500u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE ];u32 assoc_rsp_size; +struct cfg80211_bss *req_bss;#define MWIFIEX_GENIE_BUF_SIZE 256u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE ];
@@ -647,6 +652,7 @@ struct mwifiex_private {u16 gen_idx;u8 ap_11n_enabled;u8 ap_11ac_enabled; +bool host_mlme_reg;u32 mgmt_frame_mask;struct mwifiex_roc_cfg roc_cfg;bool scan_aborting;
@@ -876,6 +882,8 @@ struct mwifiex_adapter {struct work_struct main_work;struct workqueue_struct *rx_workqueue;struct work_struct rx_work; +struct workqueue_struct *host_mlme_workqueue; +struct work_struct host_mlme_work;bool rx_work_enabled;bool rx_processing;bool delay_main_work;
@@ -907,6 +915,9 @@ struct mwifiex_adapter {u8 cmd_resp_received;u8 event_received;u8 data_received; +u8 assoc_resp_received; +struct mwifiex_private *priv_link_lost; +u8 host_mlme_link_lost;u16 seq_num;struct cmd_ctrl_node *cmd_pool;struct cmd_ctrl_node *curr_cmd;
@@ -996,6 +1007,7 @@ struct mwifiex_adapter {bool is_up;bool ext_scan; +bool host_mlme_enabled;u8 fw_api_ver;u8 key_api_major_ver, key_api_minor_ver;u8 max_p2p_conn, max_sta_conn;
@@ -1061,6 +1073,9 @@ int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb);int mwifiex_uap_recv_packet (struct mwifiex_private *priv,struct sk_buff *skb); +void mwifiex_host_mlme_disconnect (struct mwifiex_private *priv, +u16 reason_code,u8 *sa); +int mwifiex_process_mgmt_packet (struct mwifiex_private *priv,struct sk_buff *skb);
@@ -1092,6 +1107,7 @@ void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,int mwifiex_exec_next_cmd (struct mwifiex_adapter *adapter);int mwifiex_process_cmdresp (struct mwifiex_adapter *adapter); +void mwifiex_process_assoc_resp (struct mwifiex_adapter *adapter);int mwifiex_handle_rx_packet (struct mwifiex_adapter *adapter,struct sk_buff *skb); int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
drivers/net/wireless/marvell/mwifiex/scan.c +6 -0
@@ -1371,6 +1371,12 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter, bss_entry->rsn_offset = (u16) (current_ptr - bss_entry->beacon_buf);break ; +case WLAN_EID_RSNX : + bss_entry->bcn_rsnx_ie = + (struct ieee_types_generic *)current_ptr; + bss_entry->rsnx_offset = + (u16)(current_ptr - bss_entry->beacon_buf); +break ;case WLAN_EID_BSS_AC_ACCESS_DELAY : bss_entry->bcn_wapi_ie = (struct ieee_types_generic *) current_ptr;
drivers/net/wireless/marvell/mwifiex/sdio.c +13 -0
@@ -332,6 +332,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { .can_auto_tdls = false, .can_ext_scan = false, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
@@ -348,6 +349,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
@@ -364,6 +366,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
@@ -380,6 +383,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
@@ -397,6 +401,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
@@ -414,6 +419,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = true, + .host_mlme = true, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
@@ -432,6 +438,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
@@ -448,6 +455,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { .can_auto_tdls = true, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
@@ -465,6 +473,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { .can_auto_tdls = true, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
@@ -481,6 +490,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { .can_auto_tdls = false, .can_ext_scan = true, .fw_ready_extra_delay = false, + .host_mlme = false, };static struct memory_type_mapping generic_mem_type_map[] = {
@@ -574,6 +584,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) card->can_auto_tdls = data->can_auto_tdls; card->can_ext_scan = data->can_ext_scan; card->fw_ready_extra_delay = data->fw_ready_extra_delay; + card->host_mlme = data->host_mlme;INIT_WORK (&card->work, mwifiex_sdio_work); }
@@ -2511,6 +2522,8 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) adapter->num_mem_types =ARRAY_SIZE (mem_type_mapping_tbl); } + adapter->host_mlme_enabled = card->host_mlme; +return 0 ; }
drivers/net/wireless/marvell/mwifiex/sdio.h +2 -0
@@ -256,6 +256,7 @@ struct sdio_mmc_card {bool can_auto_tdls;bool can_ext_scan;bool fw_ready_extra_delay; +bool host_mlme;struct mwifiex_sdio_mpa_tx mpa_tx;struct mwifiex_sdio_mpa_rx mpa_rx;
@@ -280,6 +281,7 @@ struct mwifiex_sdio_device {bool can_auto_tdls;bool can_ext_scan;bool fw_ready_extra_delay; +bool host_mlme; };/*
drivers/net/wireless/marvell/mwifiex/sta_event.c +29 -7
@@ -135,6 +135,9 @@ void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code, priv->media_connected = false; + priv->auth_flag =0 ; + priv->auth_alg =WLAN_AUTH_NONE ; + priv->scan_block = false; priv->port_open = false;
@@ -222,8 +225,12 @@ void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code, priv->cfg_bssid, reason_code);if (priv->bss_mode ==NL80211_IFTYPE_STATION || priv->bss_mode ==NL80211_IFTYPE_P2P_CLIENT ) { -cfg80211_disconnected (priv->netdev, reason_code,NULL ,0 , - !from_ap,GFP_KERNEL ); +if (adapter->host_mlme_enabled && adapter->host_mlme_link_lost) +mwifiex_host_mlme_disconnect (adapter->priv_link_lost, + reason_code,NULL ); +else +cfg80211_disconnected (priv->netdev, reason_code,NULL , +0 , !from_ap,GFP_KERNEL ); }eth_zero_addr (priv->cfg_bssid);
@@ -746,7 +753,15 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)if (priv->media_connected) { reason_code =get_unaligned_le16 (adapter->event_body); -mwifiex_reset_connect_state (priv, reason_code, true); +if (adapter->host_mlme_enabled) { + adapter->priv_link_lost = priv; + adapter->host_mlme_link_lost = true; +queue_work (adapter->host_mlme_workqueue, + &adapter->host_mlme_work); + }else { +mwifiex_reset_connect_state (priv, reason_code, + true); + } }break ;
@@ -999,10 +1014,17 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)case EVENT_REMAIN_ON_CHAN_EXPIRED :mwifiex_dbg (adapter,EVENT ,"event: Remain on channel expired\n" ); -cfg80211_remain_on_channel_expired (&priv->wdev, - priv->roc_cfg.cookie, - &priv->roc_cfg.chan, -GFP_ATOMIC ); + +if (adapter->host_mlme_enabled && + (priv->auth_flag &HOST_MLME_AUTH_PENDING )) { + priv->auth_flag =0 ; + priv->auth_alg =WLAN_AUTH_NONE ; + }else { +cfg80211_remain_on_channel_expired (&priv->wdev, + priv->roc_cfg.cookie, + &priv->roc_cfg.chan, +GFP_ATOMIC ); + }memset (&priv->roc_cfg,0x00 ,sizeof (struct mwifiex_roc_cfg ));
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +1 -1
@@ -339,7 +339,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, ret =mwifiex_associate (priv, bss_desc); } -if (bss) +if (bss && !priv->adapter->host_mlme_enabled)cfg80211_put_bss (priv->adapter->wiphy, bss); }else {/* Adhoc mode */
drivers/net/wireless/marvell/mwifiex/sta_tx.c +5 -4
@@ -36,7 +36,7 @@ void mwifiex_process_sta_txpd(struct mwifiex_private *priv,struct txpd *local_tx_pd;struct mwifiex_txinfo *tx_info =MWIFIEX_SKB_TXCB (skb);unsigned int pad; -u16 pkt_type, pkt_offset; +u16 pkt_type, pkt_length, pkt_offset;int hroom = adapter->intf_hdr_len; pkt_type =mwifiex_is_skb_mgmt_frame (skb) ?PKT_TYPE_MGMT :0 ;
@@ -49,9 +49,10 @@ void mwifiex_process_sta_txpd(struct mwifiex_private *priv,memset (local_tx_pd,0 ,sizeof (struct txpd )); local_tx_pd->bss_num = priv->bss_num; local_tx_pd->bss_type = priv->bss_type; - local_tx_pd->tx_pkt_length =cpu_to_le16 ((u16)(skb->len - - (sizeof (struct txpd ) + - pad))); + pkt_length = (u16)(skb->len - (sizeof (struct txpd ) + pad)); +if (pkt_type ==PKT_TYPE_MGMT ) + pkt_length -=MWIFIEX_MGMT_FRAME_HEADER_SIZE ; + local_tx_pd->tx_pkt_length =cpu_to_le16 (pkt_length); local_tx_pd->priority = (u8 ) skb->priority; local_tx_pd->pkt_delay_2ms =
drivers/net/wireless/marvell/mwifiex/util.c +80 -0
92 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v11 1/2] wifi: mwifiex: add host mlme for client mode
Quoted 9 lines · David Lin
Add host based MLME to enable WPA3 functionalities in client 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 <[email protected]>Reviewed-by Francesco Dolcini <[email protected]>Acked-by Brian Norris <[email protected]>
2 patches applied to wireless-next.git, thanks.
36995892c271 wifi: mwifiex: add host mlme for client mode 9588469d0697 wifi: mwifiex: add host mlme for AP mode
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH v11 2/2 wifi: mwifiex: add host mlme for AP mode
In reply to David LinAdd 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.
---
v11:
- modify 'mwifiex_mgmt_stypes' to allow multi-adapters with different setting of host_mlme_enbaled.
v10:
- none
v9:
- remove unnecessary goto target.
v8:
- first full and complete patch to support host based MLME for AP mode.
--- .../net/wireless/marvell/mwifiex/cfg80211.c | 86 ++++++++- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 + drivers/net/wireless/marvell/mwifiex/fw.h | 21 +++ drivers/net/wireless/marvell/mwifiex/ioctl.h | 5 + drivers/net/wireless/marvell/mwifiex/main.h | 1 + .../wireless/marvell/mwifiex/sta_cmdresp.c | 2 + .../net/wireless/marvell/mwifiex/uap_cmd.c | 171 ++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/util.c | 24 +++ 8 files changed, 309 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +83 -3
@@ -221,6 +221,26 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,return 0 ; } +if (GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_UAP ) { +if (ieee80211_is_auth (mgmt->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"auth: send auth to %pM\n" , mgmt->da); +if (ieee80211_is_deauth (mgmt->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"auth: send deauth to %pM\n" , mgmt->da); +if (ieee80211_is_disassoc (mgmt->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"assoc: send disassoc to %pM\n" , mgmt->da); +if (ieee80211_is_assoc_resp (mgmt->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"assoc: send assoc resp to %pM\n" , + mgmt->da); +if (ieee80211_is_reassoc_resp (mgmt->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"assoc: send reassoc resp to %pM\n" , + mgmt->da); + } + pkt_len = len +ETH_ALEN ; skb = dev_alloc_skb(MWIFIEX_MIN_DATA_HEADER_LEN + MWIFIEX_MGMT_FRAME_HEADER_SIZE +
@@ -505,6 +525,9 @@ mwifiex_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,wiphy_dbg (wiphy,"set default mgmt key, key index=%d\n" , key_index); +if (priv->adapter->host_mlme_enabled) +return 0 ; +memset (&encrypt_key,0 ,sizeof (struct mwifiex_ds_encrypt_key )); encrypt_key.key_len =WLAN_KEY_LEN_CCMP ; encrypt_key.key_index = key_index;
@@ -3953,12 +3976,43 @@ mwifiex_cfg80211_tdls_cancel_chan_switch(struct wiphy *wiphy, } } +static int +mwifiex_cfg80211_uap_add_station (struct mwifiex_private *priv,const u8 *mac, +struct station_parameters *params) +{ +struct mwifiex_sta_info add_sta; +int ret; + +memcpy (add_sta.peer_mac, mac,ETH_ALEN ); + add_sta.params = params; + + ret =mwifiex_send_cmd (priv, HostCmd_CMD_ADD_NEW_STATION, + HostCmd_ACT_ADD_STA,0 , (void *)&add_sta, true); + +if (!ret) { +struct station_info *sinfo; + + sinfo =kzalloc (sizeof (*sinfo),GFP_KERNEL ); +if (!sinfo) +return -ENOMEM ; + +cfg80211_new_sta (priv->netdev, mac, sinfo,GFP_KERNEL ); +kfree (sinfo); + } + +return ret; +} +static int mwifiex_cfg80211_add_station (struct wiphy *wiphy,struct net_device *dev,const u8 *mac,struct station_parameters *params) {struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); +if (priv->adapter->host_mlme_enabled && + (GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_UAP )) +return mwifiex_cfg80211_uap_add_station (priv, mac, params); +if (!(params->sta_flags_set &BIT (NL80211_STA_FLAG_TDLS_PEER )))return -EOPNOTSUPP ;
@@ -4196,6 +4250,10 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,int ret;struct mwifiex_private *priv =mwifiex_netdev_get_priv (dev); +if (priv->adapter->host_mlme_enabled && + (GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_UAP )) +return 0 ; +/* we support change_station handler only for TDLS peers*/ if (!(params->sta_flags_set &BIT (NL80211_STA_FLAG_TDLS_PEER )))return -EOPNOTSUPP ;
@@ -4668,7 +4726,25 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) } wiphy->max_scan_ssids =MWIFIEX_MAX_SSID_LIST_LENGTH ; wiphy->max_scan_ie_len =MWIFIEX_MAX_VSIE_LEN ; - wiphy->mgmt_stypes = mwifiex_mgmt_stypes; +if (adapter->host_mlme_enabled) { +memcpy (adapter->mwifiex_mgmt_stypes, + mwifiex_mgmt_stypes, +NUM_NL80211_IFTYPES * +sizeof (struct ieee80211_txrx_stypes )); + + adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP ].tx =0xffff ; + adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP ].rx = +BIT (IEEE80211_STYPE_ASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_REASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_PROBE_REQ >>4 ) | +BIT (IEEE80211_STYPE_DISASSOC >>4 ) | +BIT (IEEE80211_STYPE_AUTH >>4 ) | +BIT (IEEE80211_STYPE_DEAUTH >>4 ) | +BIT (IEEE80211_STYPE_ACTION >>4 ); + wiphy->mgmt_stypes = adapter->mwifiex_mgmt_stypes; + }else { + wiphy->mgmt_stypes = mwifiex_mgmt_stypes; + } wiphy->max_remain_on_channel_duration =5000 ; wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) | BIT(NL80211_IFTYPE_P2P_CLIENT) |
@@ -4710,14 +4786,18 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)ether_addr_copy (wiphy->perm_addr, adapter->perm_addr); wiphy->signal_type =CFG80211_SIGNAL_TYPE_MBM ; - wiphy->flags |=WIPHY_FLAG_HAVE_AP_SME | -WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | + wiphy->flags |=WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |WIPHY_FLAG_AP_UAPSD |WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |WIPHY_FLAG_HAS_CHANNEL_SWITCH |WIPHY_FLAG_NETNS_OK |WIPHY_FLAG_PS_ON_BY_DEFAULT ; +if (adapter->host_mlme_enabled) + wiphy->flags |=WIPHY_FLAG_REPORTS_OBSS ; +else + wiphy->flags |=WIPHY_FLAG_HAVE_AP_SME ; +if (ISSUPP_TDLS_ENABLED (adapter->fw_cap_info)) wiphy->flags |=WIPHY_FLAG_SUPPORTS_TDLS |WIPHY_FLAG_TDLS_EXTERNAL_SETUP ;
drivers/net/wireless/marvell/mwifiex/cmdevt.c +2 -0
@@ -635,6 +635,8 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,case HostCmd_CMD_UAP_STA_DEAUTH:case HOST_CMD_APCMD_SYS_RESET :case HOST_CMD_APCMD_STA_LIST : +case HostCmd_CMD_CHAN_REPORT_REQUEST: +case HostCmd_CMD_ADD_NEW_STATION: ret =mwifiex_uap_prepare_cmd (priv, cmd_no, cmd_action, cmd_oid, data_buf, cmd_ptr);
drivers/net/wireless/marvell/mwifiex/fw.h +21 -0
@@ -211,6 +211,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define TLV_TYPE_CHAN_ATTR_CFG (PROPRIETARY_TLV_BASE_ID + 237)#define TLV_TYPE_MAX_CONN (PROPRIETARY_TLV_BASE_ID + 279)#define TLV_TYPE_HOST_MLME (PROPRIETARY_TLV_BASE_ID + 307) +#define TLV_TYPE_UAP_STA_FLAGS (PROPRIETARY_TLV_BASE_ID + 313)#define TLV_TYPE_SAE_PWE_MODE (PROPRIETARY_TLV_BASE_ID + 339)#define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048
@@ -407,6 +408,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define HostCmd_CMD_STA_CONFIGURE 0x023f#define HostCmd_CMD_CHAN_REGION_CFG 0x0242#define HostCmd_CMD_PACKET_AGGR_CTRL 0x0251 +#define HostCmd_CMD_ADD_NEW_STATION 0x025f#define PROTOCOL_NO_SECURITY 0x01#define PROTOCOL_STATIC_WEP 0x02
@@ -417,6 +419,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define KEY_MGMT_NONE 0x04#define KEY_MGMT_PSK 0x02#define KEY_MGMT_EAP 0x01 +#define KEY_MGMT_SAE 0x400#define CIPHER_TKIP 0x04#define CIPHER_AES_CCMP 0x08#define VALID_CIPHER_BITMAP 0x0c
@@ -502,6 +505,9 @@ enum mwifiex_channel_flags {#define HostCmd_ACT_GET_TX 0x0008#define HostCmd_ACT_GET_BOTH 0x000c +#define HostCmd_ACT_REMOVE_STA 0x0 +#define HostCmd_ACT_ADD_STA 0x1 +#define RF_ANTENNA_AUTO 0xFFFF#define HostCmd_SET_SEQ_NO_BSS_INFO (seq, num, type) \
@@ -2331,6 +2337,20 @@ struct host_cmd_ds_sta_configure {u8 tlv_buffer[]; } __packed; +struct mwifiex_ie_types_sta_flag { +struct mwifiex_ie_types_header header; +__le32 sta_flags; +} __packed; + +struct host_cmd_ds_add_station { +__le16 action; +__le16 aid; +u8 peer_mac[ETH_ALEN ]; +__le32 listen_interval; +__le16 cap_info; +u8 tlv[]; +} __packed; +struct host_cmd_ds_command {__le16 command;__le16 size;
@@ -2409,6 +2429,7 @@ struct host_cmd_ds_command {struct host_cmd_ds_chan_region_cfg reg_cfg;struct host_cmd_ds_pkt_aggr_ctrl pkt_aggr_ctrl;struct host_cmd_ds_sta_configure sta_cfg; +struct host_cmd_ds_add_station sta_info; } params; } __packed;
drivers/net/wireless/marvell/mwifiex/ioctl.h +5 -0
@@ -158,6 +158,11 @@ struct mwifiex_bss_info {u8 bssid[ETH_ALEN ]; }; +struct mwifiex_sta_info { +u8 peer_mac[ETH_ALEN ]; +struct station_parameters *params; +}; +#define MAX_NUM_TID 8#define MAX_RX_WINSIZE 64
drivers/net/wireless/marvell/mwifiex/main.h +1 -0
@@ -1008,6 +1008,7 @@ struct mwifiex_adapter {bool ext_scan;bool host_mlme_enabled; +struct ieee80211_txrx_stypes mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES ];u8 fw_api_ver;u8 key_api_major_ver, key_api_minor_ver;u8 max_p2p_conn, max_sta_conn;
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +2 -0
@@ -1398,6 +1398,8 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,break ;case HostCmd_CMD_UAP_STA_DEAUTH:break ; +case HostCmd_CMD_ADD_NEW_STATION: +break ;case HOST_CMD_APCMD_SYS_RESET :break ;case HostCmd_CMD_MEF_CFG:
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +171 -0
201 lines not on this page · raw message
drivers/net/wireless/marvell/mwifiex/util.c +24 -0
@@ -497,6 +497,30 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,cfg80211_rx_mlme_mgmt (priv->netdev, skb->data, pkt_len); } +if (priv->adapter->host_mlme_enabled && + (GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_UAP )) { +if (ieee80211_is_auth (ieee_hdr->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"auth: receive auth from %pM\n" , + ieee_hdr->addr2); +if (ieee80211_is_deauth (ieee_hdr->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"auth: receive deauth from %pM\n" , + ieee_hdr->addr2); +if (ieee80211_is_disassoc (ieee_hdr->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"assoc: receive disassoc from %pM\n" , + ieee_hdr->addr2); +if (ieee80211_is_assoc_req (ieee_hdr->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"assoc: receive assoc req from %pM\n" , + ieee_hdr->addr2); +if (ieee80211_is_reassoc_req (ieee_hdr->frame_control)) +mwifiex_dbg (priv->adapter,MSG , +"assoc: receive reassoc req from %pM\n" , + ieee_hdr->addr2); + } +cfg80211_rx_mgmt (&priv->wdev, priv->roc_cfg.chan.center_freq,CAL_RSSI (rx_pd->snr, rx_pd->nf), skb->data, pkt_len,0 );
Signature · 1 line
2.34.1
Brian Norris
maintainerRe: [PATCH v11 2/2] wifi: mwifiex: add host mlme for AP mode
Hi David,
Quoted 14 lines · David Lin
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 <[email protected]>Reviewed-by Francesco Dolcini <[email protected]>Acked-by Brian Norris <[email protected]>---
v11:
- modify 'mwifiex_mgmt_stypes' to allow multi-adapters with different setting ofhost_mlme_enbaled.
...
Quoted 23 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +19
-1- wiphy->mgmt_stypes = mwifiex_mgmt_stypes; +if (adapter->host_mlme_enabled) { +memcpy (adapter->mwifiex_mgmt_stypes, + mwifiex_mgmt_stypes, +NUM_NL80211_IFTYPES * +sizeof (struct ieee80211_txrx_stypes )); + + adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP ].tx =0xffff ; + adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP ].rx = +BIT (IEEE80211_STYPE_ASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_REASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_PROBE_REQ >>4 ) | +BIT (IEEE80211_STYPE_DISASSOC >>4 ) | +BIT (IEEE80211_STYPE_AUTH >>4 ) | +BIT (IEEE80211_STYPE_DEAUTH >>4 ) | +BIT (IEEE80211_STYPE_ACTION >>4 ); + wiphy->mgmt_stypes = adapter->mwifiex_mgmt_stypes; + }else { + wiphy->mgmt_stypes = mwifiex_mgmt_stypes; + } wiphy->max_remain_on_channel_duration =5000 ; wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) | BIT(NL80211_IFTYPE_P2P_CLIENT) |
...
drivers/net/wireless/marvell/mwifiex/main.h struct mwifiex_adapter { · line 1011
Quoted 7 lines
drivers/net/wireless/marvell/mwifiex/main.h +1
-0@@ -1008,6 +1008,7 @@ struct mwifiex_adapter {bool ext_scan;bool host_mlme_enabled; +struct ieee80211_txrx_stypes mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES ];
This wasn't exactly what I had in mind by a "second copy" of mwifiex_mgmt_stypes -- that you add a new array to mwifiex_adapter that is only sometimes used. I meant something more like a const 'mwifiex_mgmt_stypes_mlme`, with the appropriate constant values. But I suppose this works too, if a bit awkward, and saves a bit of code/data duplication.
So, the 'Acked-by' still seems appropriate.
Thanks for the patience on this series.
Brian
RE: [EXT] Re: [PATCH v11 2/2] wifi: mwifiex: add host mlme for AP mode
Hi Brian,
Quoted 74 lines
-----Original Message-----
From: Brian Norris <[email protected]>
Sent: Tuesday, July 9, 2024 3:27 AM
To: David Lin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>; Francesco Dolcini <[email protected]>
Subject: [EXT] Re: [PATCH v11 2/2] wifi: mwifiex: add host mlme for AP modeCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi David,
Quoted 14 lines · David Lin
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 <[email protected]>Reviewed-by Francesco Dolcini <[email protected]>Acked-by Brian Norris <[email protected]>---
v11:
- modify 'mwifiex_mgmt_stypes' to allow multi-adapters with different setting ofhost_mlme_enbaled....
drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
Quoted 8 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7
-1- wiphy->mgmt_stypes = mwifiex_mgmt_stypes; +if (adapter->host_mlme_enabled) { +memcpy (adapter->mwifiex_mgmt_stypes, + mwifiex_mgmt_stypes, +NUM_NL80211_IFTYPES * +sizeof (struct ieee80211_txrx_stypes )); + + adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].tx =
0xffff;Quoted 15 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +12
-0+ adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP ].rx = +BIT (IEEE80211_STYPE_ASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_REASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_PROBE_REQ >>4 ) | +BIT (IEEE80211_STYPE_DISASSOC >>4 ) | +BIT (IEEE80211_STYPE_AUTH >>4 ) | +BIT (IEEE80211_STYPE_DEAUTH >>4 ) | +BIT (IEEE80211_STYPE_ACTION >>4 ); + wiphy->mgmt_stypes = adapter->mwifiex_mgmt_stypes; + }else { + wiphy->mgmt_stypes = mwifiex_mgmt_stypes; + } wiphy->max_remain_on_channel_duration =5000 ; wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) | BIT(NL80211_IFTYPE_P2P_CLIENT) |...
drivers/net/wireless/marvell/mwifiex/main.h struct mwifiex_adapter { · line 1012
Quoted 8 lines
drivers/net/wireless/marvell/mwifiex/main.h +2
-0@@ -1008,6 +1008,7 @@ struct mwifiex_adapter {bool ext_scan;bool host_mlme_enabled; +struct ieee80211_txrx_stypes + mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES ];This wasn't exactly what I had in mind by a "second copy" of
mwifiex_mgmt_stypes-- that you add a new array tomwifiex_adapterthat is only sometimes used. I meant something more like a const 'mwifiex_mgmt_stypes_mlme`, with the appropriate constant values. But I suppose this works too, if a bit awkward, and saves a bit of code/data duplication.
Quoted 5 lines
So, the 'Acked-by' still seems appropriate.
Thanks for the patience on this series.
Brian
Thanks for you to keep "ACKed-by" tag and the efforts of you to continue to maintain mwifiex.
Hopefully this series can be merged to mainline Linux kernel soon. So user of mwifiex can use more robust and updated security method - WPA3.
Thanks,
David
Hi Kalle,
I found the state of this patch series had been changed to "Deferred".
Since this patch series had been reviewed for a long period of time and reviewed, tested, and acked by members from community. I wonder what else should I do to let it be merged to mainline Linux kernel?
David
Quoted 117 lines
From: David Lin <[email protected]>
Sent: Thursday, July 4, 2024 11:30 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>; David Lin <[email protected]>; Rafael Beims <[email protected]>; Francesco Dolcini <[email protected]>
Subject: [PATCH v11 0/2] wifi: mwifiex: add code to support host mlmeWith host mlme:
mlme:
This series add host based MLME support to the mwifiex driver, this enables WPA3 support in both client and AP mode.
To enable WPA3, a firmware with corresponding V2 Key API support is required.
The feature is currently only enabled on NXP IW416 (SD8978), and it was internally validated by NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.v11:
- add proper and useful comment formwifiex_cfg80211_probe_client().
- modify 'mwifiex_mgmt_stypes' to allow multi-adapters with different setting ofhost_mlme_enbaled.v10:
- Useeth_broadcast_addr()to set the broadcast address.
- Add comment for constant used for the length of FW special 4 address management header.
- Checkhost_mlme_enabledto decide if creatinghost_mlme_workqueueor not.
- Usecpu_to_le16instead of casting via (__force__le16).
- Change the abbreviation "disasso" to "disassoc" of the printout message.v9:
- Remove redundent code.
- Remove unnecessary goto target.v8:
- Separate 6/12 from patch v7.
As it's a bug fix not part of host MLME feature.
- Rearrnage MLME feature into 2 patches:
a. Add host based MLME support for STA mode. b. Add host based MLME support for AP mode.v7:
- Fix regression: Downlink throughput degraded by 70% in AP mode.
- Fix issue: On STAUT, kernel Oops occurs when there is no association response from AP.
- Fix issue: On STAUT, if AP leaves abruptly and deauth is missing, STA can't connect to AP anymore.
- Fix regression: STA can't connect to AP whenhost_mlmeis disabled (impact all chips).
- Address reviewer comments.v6:
- Correct mailing sequence.v5:
- Add host base MLME support to enable WPA3 functionalities for both STA and AP mode.
- This feature (WPA3) required a firmware with corresponding Key API V2 support.
- QA validation and regression have been covered for IW416.
- This feature (WPA3) is currently enabled and verified only for IW416.
- Changelogs since patch V4:
a. Add WPA3 support for AP mode.
b. Bug fix: In WPA3 STA mode, deice gets disconnected from AP
when group rekey occurs.
c. Bug fix: STAUT doesn't send WMM IE in association request when
associate to a WMM-AP.v4:
- Refine code segment per review comment.
- Add API to check firmware encryption key command version whenhost_mlmeis enabled.v3:
- Cleanup commit message.v2:
- Fix checkpatch error (pwe[1] -> pwe[0]).
- Move module parameter 'host_mlme' tomwifiex_sdio_devicestructure. Default only enable for IW416.
- Disable advertisingNL80211_FEATURE_SAEifhost_mlmeis not enabled.David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode.../net/wireless/marvell/mwifiex/cfg80211.c | 404 +++++++++++++++++- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 27 ++ drivers/net/wireless/marvell/mwifiex/decl.h | 23 + drivers/net/wireless/marvell/mwifiex/fw.h | 54 +++ drivers/net/wireless/marvell/mwifiex/init.c | 6 + drivers/net/wireless/marvell/mwifiex/ioctl.h | 5 + drivers/net/wireless/marvell/mwifiex/join.c | 66 ++- drivers/net/wireless/marvell/mwifiex/main.c | 62 +++ drivers/net/wireless/marvell/mwifiex/main.h | 17 + drivers/net/wireless/marvell/mwifiex/scan.c | 6 + drivers/net/wireless/marvell/mwifiex/sdio.c | 13 + drivers/net/wireless/marvell/mwifiex/sdio.h | 2 + .../wireless/marvell/mwifiex/sta_cmdresp.c | 2 + .../net/wireless/marvell/mwifiex/sta_event.c | 36 +- .../net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- drivers/net/wireless/marvell/mwifiex/sta_tx.c | 9 +- .../net/wireless/marvell/mwifiex/uap_cmd.c | 171 ++++++++ drivers/net/wireless/marvell/mwifiex/util.c | 104 +++++ 18 files changed, 992 insertions(+), 17 deletions(-)base-commit:
347bf38330c2971230d8206eb8b37ed36b54982d--
2.34.1
Quoted 5 lines · David Lin
I found the state of this patch series had been changed to "Deferred".
Since this patch series had been reviewed for a long period of time and reviewed, tested, and acked by members from community. I wonder what else should I do to let it be merged to mainline Linux kernel?
Most likely the merge window opens on Sunday and I didn't want to apply the patchset last minute. So this has to wait v6.12.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 17 lines
From: Kalle Valo <[email protected]>
Sent: Wednesday, July 10, 2024 4:02 PM
To: David Lin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>; Rafael Beims <[email protected]>; Francesco Dolcini <[email protected]>
Subject: [EXT] Re: [PATCH v11 0/2] wifi: mwifiex: add code to support host mlmeCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
David Lin <[email protected]> writes:
Quoted 9 lines
Quoted 5 lines
I found the state of this patch series had been changed to "Deferred".
Since this patch series had been reviewed for a long period of time and reviewed, tested, and acked by members from community. I wonder what else should I do to let it be merged to mainline Linux kernel?
Most likely the merge window opens on Sunday and I didn't want to apply the patchset last minute. So this has to wait v6.12.
Thanks for your help.
David