Skip to contentSkip to conversation

wifi: mwifiex: add code to support host mlme

PATCH Superseded David Lin 4 participants 22 messages Dec 22, 2023 – May 23, 2024 Marvell mwifiex wireless driver

v8 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

David Lin

author
#0 lore raw

v8 cover wifi: mwifiex: add code to support 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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

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   | 394 +++++++++++++++++-
 drivers/net/wireless/marvell/mwifiex/cmdevt.c |  27 ++
 drivers/net/wireless/marvell/mwifiex/decl.h   |  22 +
 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   |  54 +++
 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  |   3 +-
 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, 974 insertions(+), 17 deletions(-)

base-commit: 783004b6dbda2cfe9a552a4cc9c1d168a2068f6c

Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v8 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.

---

v8:
- first full and complete patch to support host based MLME for client mode.

---
 .../net/wireless/marvell/mwifiex/cfg80211.c   | 315 ++++++++++++++++++
 drivers/net/wireless/marvell/mwifiex/cmdevt.c |  25 ++
 drivers/net/wireless/marvell/mwifiex/decl.h   |  22 ++
 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   |  54 +++
 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 +
 .../net/wireless/marvell/mwifiex/sta_event.c  |  36 +-
 .../net/wireless/marvell/mwifiex/sta_ioctl.c  |   3 +-
 drivers/net/wireless/marvell/mwifiex/sta_tx.c |   9 +-
 drivers/net/wireless/marvell/mwifiex/util.c   |  80 +++++
 15 files changed, 673 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +315 -0
index 7a15ea8072e6..3cee1b58465e 100644
@@ -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,
@@ -3629,6 +3632,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);
 }
@@ -4202,6 +4208,302 @@ 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 addr[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+	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);
+	memcpy(mgmt->addr4, addr, ETH_ALEN);
+
+	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)
+{
+	return -1;
+}
+
 /* station cfg80211 operations */
 static struct cfg80211_ops mwifiex_cfg80211_ops = {
 	.add_virtual_intf = mwifiex_add_virtual_intf,
@@ -4347,6 +4649,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;
@@ -4428,6 +4740,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
index 3756aa247e77..3dd6db3cc4c3 100644
@@ -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.
  *
@@ -1680,6 +1698,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 +22 -0
index 326ffb05d791..796e5be515f3 100644
@@ -31,6 +31,28 @@
 						 *   + sizeof(tx_control)
 						 */
 
+#define FRMCTL_LEN                2
+#define DURATION_LEN              2
+#define SEQCTL_LEN                2
+#define MWIFIEX_MGMT_HEADER_LEN   (FRMCTL_LEN + FRMCTL_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
index 8e6db904e5b2..4cd82120832e 100644
@@ -209,6 +209,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
 
@@ -743,6 +745,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;
@@ -802,6 +823,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;
@@ -905,6 +931,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
index c9c58419c37b..a336d45b9677 100644
@@ -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 +54 -0

84 lines not on this page · raw message

drivers/net/wireless/marvell/mwifiex/main.h +17 -0
index d263eae6078c..b5aef4c92b98 100644
@@ -384,6 +384,7 @@ struct ieee_types_aid {
 
 struct mwifiex_bssdescriptor {
 	u8 mac_address[ETH_ALEN];
+	struct cfg80211_bss *bss;
 	struct cfg80211_ssid ssid;
 	u32 privacy;
 	s32 rssi;
@@ -426,6 +427,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;
@@ -527,6 +530,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;
@@ -610,6 +615,7 @@ struct mwifiex_private {
 #define MWIFIEX_ASSOC_RSP_BUF_SIZE  500
 	u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
 	u32 assoc_rsp_size;
+	struct cfg80211_bss *req_bss;
 
 #define MWIFIEX_GENIE_BUF_SIZE      256
 	u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
@@ -649,6 +655,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;
@@ -878,6 +885,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;
@@ -909,6 +918,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;
@@ -998,6 +1010,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;
@@ -1063,6 +1076,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);
 
@@ -1094,6 +1110,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
index 72904c275461..7ecff7ce06e4 100644
@@ -1383,6 +1383,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
index 6462a0ffe698..e7b488fca52f 100644
@@ -331,6 +331,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
 	.can_dump_fw = false,
 	.can_auto_tdls = false,
 	.can_ext_scan = false,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
@@ -346,6 +347,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
 	.can_dump_fw = false,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
@@ -361,6 +363,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
 	.can_dump_fw = false,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
@@ -376,6 +379,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
 	.can_dump_fw = true,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
@@ -392,6 +396,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
 	.fw_dump_enh = true,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
@@ -408,6 +413,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
 	.fw_dump_enh = true,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = true,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
@@ -425,6 +431,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
 	.fw_dump_enh = true,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
@@ -440,6 +447,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
 	.can_dump_fw = false,
 	.can_auto_tdls = true,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
@@ -456,6 +464,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
 	.fw_dump_enh = true,
 	.can_auto_tdls = true,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
@@ -471,6 +480,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
 	.can_dump_fw = false,
 	.can_auto_tdls = false,
 	.can_ext_scan = true,
+	.host_mlme = false,
 };
 
 static struct memory_type_mapping generic_mem_type_map[] = {
@@ -563,6 +573,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
 		card->fw_dump_enh = data->fw_dump_enh;
 		card->can_auto_tdls = data->can_auto_tdls;
 		card->can_ext_scan = data->can_ext_scan;
+		card->host_mlme = data->host_mlme;
 		INIT_WORK(&card->work, mwifiex_sdio_work);
 	}
 
@@ -2493,6 +2504,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
index b86a9263a6a8..4f253d8cae42 100644
@@ -255,6 +255,7 @@ struct sdio_mmc_card {
 	bool fw_dump_enh;
 	bool can_auto_tdls;
 	bool can_ext_scan;
+	bool host_mlme;
 
 	struct mwifiex_sdio_mpa_tx mpa_tx;
 	struct mwifiex_sdio_mpa_rx mpa_rx;
@@ -278,6 +279,7 @@ struct mwifiex_sdio_device {
 	bool fw_dump_enh;
 	bool can_auto_tdls;
 	bool can_ext_scan;
+	bool host_mlme;
 };
 
 /*
drivers/net/wireless/marvell/mwifiex/sta_event.c +29 -7
index df9cdd10a494..b5f3821a6a8f 100644
@@ -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 +2 -1
index a2ad2b53f016..23639aacf092 100644
@@ -136,6 +136,7 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
 	const struct cfg80211_bss_ies *ies;
 
 	rcu_read_lock();
+	bss_desc->bss = bss;
 	ies = rcu_dereference(bss->ies);
 	beacon_ie = kmemdup(ies->data, ies->len, GFP_ATOMIC);
 	beacon_ie_len = ies->len;
@@ -339,7 +340,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
index 70c2790b8e35..9d0ef04ebe02 100644
@@ -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.25.1
reviewer Reviewed-by on v8 1/2
#2 lore raw

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

Quoted 7 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.

Currently this do not apply cleanly on wireless-next/main git tree, it should be rebased to that branch as v9 (the reason is your addition of fw_ready_extra_delay from a previous, now merged, patch).

In general the patch looks good to me, however I am no expert on wireless driver or the related linux subsystem. I just have a couple of small comments that I would suggest address in v9 (given that you need to do it as a minimum to rebase your code).

Quoted 23 lines
---
 .../net/wireless/marvell/mwifiex/cfg80211.c   | 315 ++++++++++++++++++
 drivers/net/wireless/marvell/mwifiex/cmdevt.c |  25 ++
 drivers/net/wireless/marvell/mwifiex/decl.h   |  22 ++
 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   |  54 +++
 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 +
 .../net/wireless/marvell/mwifiex/sta_event.c  |  36 +-
 .../net/wireless/marvell/mwifiex/sta_ioctl.c  |   3 +-
 drivers/net/wireless/marvell/mwifiex/sta_tx.c |   9 +-
 drivers/net/wireless/marvell/mwifiex/util.c   |  80 +++++
 15 files changed, 673 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
index 7a15ea8072e6..3cee1b58465e 100644
@@ -4202,6 +4208,302 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,

...

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, · line 4504

Quoted 6 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -0
+static int
+mwifiex_cfg80211_probe_client(struct wiphy *wiphy,
+			      struct net_device *dev, const u8 *peer,
+			      u64 *cookie)
+{
+	return -1;

See my following comment on this

Quoted 8 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
+}
+
 /* station cfg80211 operations */
 static struct cfg80211_ops mwifiex_cfg80211_ops = {
 	.add_virtual_intf = mwifiex_add_virtual_intf,
@@ -4347,6 +4649,16 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 			    "%s: creating new wiphy\n", __func__);
 		return -ENOMEM;

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4660

Quoted 10 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +9 -0
 	}
+	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;

Can you omit this one? You should get -EOPNOTSUPP for free with probe_client set to NULL. Am I wrong?

Quoted 4 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +1 -0
+	}
 	wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH;
 	wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN;
 	wiphy->mgmt_stypes = mwifiex_mgmt_stypes;

...

drivers/net/wireless/marvell/mwifiex/sta_ioctl.c int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, · line 139

Quoted 9 lines
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +1 -0
index a2ad2b53f016..23639aacf092 100644
@@ -136,6 +136,7 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
 	const struct cfg80211_bss_ies *ies;
 
 	rcu_read_lock();
+	bss_desc->bss = bss;

what is this change for? I was not able to understand it, nor to find any user of this bss parameter. This looks like an unrelated fix, but no code seems to be affected.

With these 2 comments addressed, please feel free to add to v9

And thanks for this work!
Francesco

author
#3 lore raw

RE: [EXT] Re: [PATCH v8 1/2] wifi: mwifiex: add host mlme for client mode

Quoted 23 lines

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, February 28, 2024 1:53 AM
To: David Lin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: [EXT] Re: [PATCH v8 1/2] wifi: mwifiex: add host mlme for client mode

Caution: 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

Quoted 7 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.

Quoted 9 lines

Currently this do not apply cleanly on wireless-next/main git tree, it should be rebased to that branch as v9 (the reason is your addition of fw_ready_extra_delay from a previous, now merged, patch).

In general the patch looks good to me, however I am no expert on wireless driver or the related linux subsystem. I just have a couple of small comments that I would suggest address in v9 (given that you need to do it as a minimum to rebase your code).

Yes. Will rebase and create patch v9.

Quoted 57 lines
Quoted 3 lines
---
 .../net/wireless/marvell/mwifiex/cfg80211.c   | 315

++++++++++++++++++

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct

Quoted 22 lines
 drivers/net/wireless/marvell/mwifiex/cmdevt.c |  25 ++
 drivers/net/wireless/marvell/mwifiex/decl.h   |  22 ++
 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   |  54 +++
 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 +
 .../net/wireless/marvell/mwifiex/sta_event.c  |  36 +-
 .../net/wireless/marvell/mwifiex/sta_ioctl.c  |   3 +-
 drivers/net/wireless/marvell/mwifiex/sta_tx.c |   9 +-
 drivers/net/wireless/marvell/mwifiex/util.c   |  80 +++++
 15 files changed, 673 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
index 7a15ea8072e6..3cee1b58465e 100644
@@ -4202,6 +4208,302 @@ mwifiex_cfg80211_change_station(struct

wiphy

Quoted 1 line
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
 *wiphy, struct net_device *dev,

...

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, · line 4504

Quoted 5 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +5 -0
+static int
+mwifiex_cfg80211_probe_client(struct wiphy *wiphy,
+                           struct net_device *dev, const u8 *peer,
+                           u64 *cookie) {
+     return -1;

See my following comment on this

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,

Quoted 6 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +3 -0
+}
+
 /* station cfg80211 operations */
 static struct cfg80211_ops mwifiex_cfg80211_ops = {
      .add_virtual_intf = mwifiex_add_virtual_intf, @@ -4347,6
+4649,16 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter

*adapter)

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Quoted 5 lines
                          "%s: creating new wiphy\n", __func__);
              return -ENOMEM;
      }
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
+     if (adapter->host_mlme_enabled) {
+             mwifiex_cfg80211_ops.auth =

mwifiex_cfg80211_authenticate;

Quoted 1 line

+ mwifiex_cfg80211_ops.assoc =

mwifiex_cfg80211_associate;

Quoted 1 line

+ mwifiex_cfg80211_ops.deauth =

mwifiex_cfg80211_deauthenticate;

Quoted 1 line

+ mwifiex_cfg80211_ops.disassoc =

Quoted 9 lines

mwifiex_cfg80211_disassociate;

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4660

Quoted 4 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +4 -0
+             mwifiex_cfg80211_ops.disconnect = NULL;
+             mwifiex_cfg80211_ops.connect = NULL;
+             mwifiex_cfg80211_ops.probe_client =
+                     mwifiex_cfg80211_probe_client;

Can you omit this one? You should get -EOPNOTSUPP for free with probe_client set to NULL. Am I wrong?

Yes. You are right. Remove in patch v9.

Quoted 14 lines
Quoted 4 lines

+ }

      wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH;
      wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN;
      wiphy->mgmt_stypes = mwifiex_mgmt_stypes;

...

drivers/net/wireless/marvell/mwifiex/sta_ioctl.c int mwifiex_fill_new_bss_desc(struct

Quoted 6 lines
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +0 -0
index a2ad2b53f016..23639aacf092 100644
@@ -136,6 +136,7 @@ int mwifiex_fill_new_bss_desc(struct

mwifiex_private *priv,

Quoted 8 lines

drivers/net/wireless/marvell/mwifiex/sta_ioctl.c int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, · line 139

Quoted 4 lines
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +1 -0
      const struct cfg80211_bss_ies *ies;
 
      rcu_read_lock();
+     bss_desc->bss = bss;

what is this change for? I was not able to understand it, nor to find any user of this bss parameter. This looks like an unrelated fix, but no code seems to be affected.

Yes. It will be removed in patch v9.

Quoted 8 lines

With these 2 comments addressed, please feel free to add to v9

And thanks for this work!
Francesco

author
#4 lore raw

RE: [EXT] Re: [PATCH v8 1/2] wifi: mwifiex: add host mlme for client mode

Quoted 107 lines

From: David Lin
Sent: Thursday, February 29, 2024 11:53 AM
To: 'Francesco Dolcini' <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 1/2] wifi: mwifiex: add host mlme for client mode

Quoted 23 lines

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, February 28, 2024 1:53 AM
To: David Lin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: [EXT] Re: [PATCH v8 1/2] wifi: mwifiex: add host mlme for client mode

Caution: 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

Quoted 7 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.

Quoted 9 lines

Currently this do not apply cleanly on wireless-next/main git tree, it should be rebased to that branch as v9 (the reason is your addition of fw_ready_extra_delay from a previous, now merged, patch).

In general the patch looks good to me, however I am no expert on wireless driver or the related linux subsystem. I just have a couple of small comments that I would suggest address in v9 (given that you need to do it as a minimum to rebase your code).

Yes. Will rebase and create patch v9.

Quoted 63 lines
Quoted 3 lines
---
 .../net/wireless/marvell/mwifiex/cfg80211.c   | 315

++++++++++++++++++

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct

Quoted 22 lines
 drivers/net/wireless/marvell/mwifiex/cmdevt.c |  25 ++
 drivers/net/wireless/marvell/mwifiex/decl.h   |  22 ++
 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   |  54 +++
 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 +
 .../net/wireless/marvell/mwifiex/sta_event.c  |  36 +-
 .../net/wireless/marvell/mwifiex/sta_ioctl.c  |   3 +-
 drivers/net/wireless/marvell/mwifiex/sta_tx.c |   9 +-
 drivers/net/wireless/marvell/mwifiex/util.c   |  80 +++++
 15 files changed, 673 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
index 7a15ea8072e6..3cee1b58465e 100644
@@ -4202,6 +4208,302 @@ mwifiex_cfg80211_change_station(struct

wiphy

Quoted 1 line
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
 *wiphy, struct net_device *dev,

...

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, · line 4504

Quoted 5 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +5 -0
+static int
+mwifiex_cfg80211_probe_client(struct wiphy *wiphy,
+                           struct net_device *dev, const u8 *peer,
+                           u64 *cookie) {
+     return -1;

See my following comment on this

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,

Quoted 6 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +3 -0
+}
+
 /* station cfg80211 operations */
 static struct cfg80211_ops mwifiex_cfg80211_ops = {
      .add_virtual_intf = mwifiex_add_virtual_intf, @@ -4347,6
+4649,16 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter

*adapter)

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Quoted 5 lines
                          "%s: creating new wiphy\n", __func__);
              return -ENOMEM;
      }
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
+     if (adapter->host_mlme_enabled) {
+             mwifiex_cfg80211_ops.auth =

mwifiex_cfg80211_authenticate;

Quoted 1 line

+ mwifiex_cfg80211_ops.assoc =

mwifiex_cfg80211_associate;

Quoted 1 line

+ mwifiex_cfg80211_ops.deauth =

mwifiex_cfg80211_deauthenticate;

Quoted 1 line

+ mwifiex_cfg80211_ops.disassoc =

mwifiex_cfg80211_disassociate;

Quoted 4 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +4 -0
+             mwifiex_cfg80211_ops.disconnect = NULL;
+             mwifiex_cfg80211_ops.connect = NULL;
+             mwifiex_cfg80211_ops.probe_client =
+                     mwifiex_cfg80211_probe_client;
Quoted 6 lines
Quoted 3 lines

Can you omit this one? You should get -EOPNOTSUPP for free with probe_client set to NULL. Am I wrong?

Yes. You are right. Remove in patch v9.

This function must be hooked, otherwise AP mode can't work. I will hook this function as before but return -EOPNOTSUPP instead. Patch v9 is almost done and will be submitted later. Thanks for your suggestion.

Quoted 32 lines
Quoted 14 lines
Quoted 4 lines

+ }

      wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH;
      wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN;
      wiphy->mgmt_stypes = mwifiex_mgmt_stypes;

...

drivers/net/wireless/marvell/mwifiex/sta_ioctl.c int mwifiex_fill_new_bss_desc(struct

Quoted 6 lines
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +0 -0
index a2ad2b53f016..23639aacf092 100644
@@ -136,6 +136,7 @@ int mwifiex_fill_new_bss_desc(struct

mwifiex_private *priv,

Quoted 8 lines

drivers/net/wireless/marvell/mwifiex/sta_ioctl.c int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, · line 139

Quoted 4 lines
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +1 -0
      const struct cfg80211_bss_ies *ies;
 
      rcu_read_lock();
+     bss_desc->bss = bss;

what is this change for? I was not able to understand it, nor to find any user of this bss parameter. This looks like an unrelated fix, but no code seems to be affected.

Yes. It will be removed in patch v9.

Quoted 8 lines

With these 2 comments addressed, please feel free to add to v9

And thanks for this work!
Francesco

maintainer
#5 lore raw

Re: [EXT] Re: [PATCH v8 1/2] wifi: mwifiex: add host mlme for client mode

Necromancing some v8 comments here, since I realized I had the same question on my last pass at v10:

Quoted 18 lines · David Lin
Quoted 18 lines

From: David Lin
Sent: Thursday, February 29, 2024 11:53 AM

Quoted 15 lines

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, February 28, 2024 1:53 AM

drivers/net/wireless/marvell/mwifiex/cfg80211.c mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, · line 4504

Quoted 5 lines · David Lin
drivers/net/wireless/marvell/mwifiex/cfg80211.c +5 -0
+static int
+mwifiex_cfg80211_probe_client(struct wiphy *wiphy,
+                           struct net_device *dev, const u8 *peer,
+                           u64 *cookie) {
+     return -1;

See my following comment on this

Quoted 2 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
+             mwifiex_cfg80211_ops.probe_client =
+                     mwifiex_cfg80211_probe_client;
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Can you omit this one? You should get -EOPNOTSUPP for free with probe_client set to NULL. Am I wrong?

Yes. You are right. Remove in patch v9.

This function must be hooked, otherwise AP mode can't work. I will hook this function as before but return -EOPNOTSUPP instead.

You mean, hostapd doesn't like it? That seems like hostapd's problem, because the actual effect is the same -- the feature isn't supported, and will always throw an error. The kernel is lying if it adds NL80211_CMD_PROBE_CLIENT into the wiphy command feature list.

Can you point at what specifically goes wrong in hostapd, and see if we can find a way to fix it in the right place -- in hostapd? I don't really hack on hostapd much, but it looks like it comes down to the drv->use_monitor flag? Notably, that has a comment:

# src/drivers/driver_nl80211_capa.c ~ line 1424
/*
 * If poll command and tx status are supported, mac80211 is new enough
  * to have everything we need to not need monitor interfaces.
 */

So, you're actively subverting something that hostapd is trying to learn about mac80211. That sounds double wrong.

At the very least, if we're going to include hacks like this in the kernel, we should probably have a comment in there, so that future readers don't keep stubbing their toes on the same question. Or worse, removing the seemingly useless function and breaking hostapd. But ideally, we'd drop this hack and fix hostapd.

Brian

author
#6 lore raw

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

In reply to 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.

---

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(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +76 -3
index 3cee1b58465e..eec2525331b1 100644
@@ -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;
@@ -1712,7 +1735,7 @@ static const u32 mwifiex_cipher_suites[] = {
 };
 
 /* Supported mgmt frame types to be advertised to cfg80211 */
-static const struct ieee80211_txrx_stypes
+static struct ieee80211_txrx_stypes
 mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES] = {
 	[NL80211_IFTYPE_STATION] = {
 		.tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
@@ -3949,12 +3972,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;
 
@@ -4192,6 +4246,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;
@@ -4661,6 +4719,17 @@ 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;
+	if (adapter->host_mlme_enabled) {
+		mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].tx = 0xffff;
+		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 = mwifiex_mgmt_stypes;
 	wiphy->max_remain_on_channel_duration = 5000;
 	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
@@ -4703,14 +4772,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
index 3dd6db3cc4c3..ecf6431c3854 100644
@@ -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
index 4cd82120832e..98e43f551fe7 100644
@@ -210,6 +210,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
@@ -406,6 +407,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
@@ -416,6 +418,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
@@ -501,6 +504,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) \
@@ -2330,6 +2336,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;
@@ -2408,6 +2428,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
index 091e7ca79376..80ba79ca74c5 100644
@@ -157,6 +157,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/sta_cmdresp.c +2 -0
index 7b69d27e0c0e..9c53825f222d 100644
@@ -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
index af82f0401c63..c0614c246b5f 100644
@@ -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.25.1
reviewer Reviewed-by on v8 2/2
#7 lore raw

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

Quoted 7 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.

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

Quoted 16 lines

---

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(-)

...

Quoted 33 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +25 -0
index e78a201cd150..1e7f4afe9960 100644
@@ -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);

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv, · line 823

Quoted 10 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +10 -0
+	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

author
#8 lore raw

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

Quoted 100 lines

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, February 28, 2024 1:53 AM
To: David Lin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: [EXT] Re: [PATCH v8 2/2] wifi: mwifiex: add host mlme for AP mode

Caution: 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

Quoted 7 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.

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

Quoted 6 lines

---

v8:
- first full and complete patch to support host based MLME for AP mode.

Quoted 7 lines
---
 .../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

++++++++++++++++++

Quoted 3 lines
 drivers/net/wireless/marvell/mwifiex/util.c   |  24 +++
 7 files changed, 301 insertions(+), 3 deletions(-)

...

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct

Quoted 6 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +0 -0
index e78a201cd150..1e7f4afe9960 100644
@@ -760,6 +786,144 @@ static int mwifiex_cmd_uap_sta_deauth(struct

mwifiex_private *priv,

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv,

Quoted 7 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +4 -0
      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,

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct · line 793

Quoted 1 line
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +1 -0
+                                    u16 cmd_action, void

*data_buf) {

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct · line 794

Quoted 1 line
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +1 -0
+     struct host_cmd_ds_add_station *new_sta =

&cmd->params.sta_info;

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct · line 795

Quoted 1 line
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +1 -0
+     struct mwifiex_sta_info *add_sta = (struct mwifiex_sta_info

*)data_buf;

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv,

Quoted 12 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +12 -0
+     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);

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv,

Quoted 5 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +5 -0
+     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);

drivers/net/wireless/marvell/mwifiex/uap_cmd.c static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv, · line 823

Quoted 11 lines
drivers/net/wireless/marvell/mwifiex/uap_cmd.c +11 -0
+     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

Quoted 6 lines
  cmd->size = cpu_to_le16(size);
  return 0;

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

Francesco

Modify the code in patch v9. Thanks.

David

#9 lore raw
In reply to David Lin
Quoted 81 lines · David Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

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   | 394 +++++++++++++++++-
  drivers/net/wireless/marvell/mwifiex/cmdevt.c |  27 ++
  drivers/net/wireless/marvell/mwifiex/decl.h   |  22 +
  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   |  54 +++
  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  |   3 +-
  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, 974 insertions(+), 17 deletions(-)
Quoted 1 line

base-commit: 783004b6dbda2cfe9a552a4cc9c1d168a2068f6c

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

Rafael

author
#10 lore raw
Quoted 115 lines

From: Rafael Beims <[email protected]>
Sent: Friday, January 19, 2024 1:09 AM
To: David Lin <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 25 lines · David Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

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.

Quoted 5 lines

v6:
- Correct mailing sequence.

v5:
- Add host base MLME support to enable WPA3 functionalities for

both

Quoted 2 lines

STA and AP mode.
- This feature (WPA3) required a firmware with corresponding Key API

V2

Quoted 3 lines

support.
- QA validation and regression have been covered for IW416.
- This feature (WPA3) is currently enabled and verified only for

IW416.

Quoted 5 lines

- 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

Quoted 7 lines

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.

Quoted 6 lines

v3:
- Cleanup commit message.

v2:
- Fix checkpatch error (pwe[1] -> pwe[0]).
- Move module parameter 'host_mlme' to mwifiex_sdio_device

structure.

Quoted 2 lines

Default only enable for IW416.
- Disable advertising NL80211_FEATURE_SAE if host_mlme is not

enabled.

Quoted 6 lines

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   | 394

+++++++++++++++++-

Quoted 20 lines
  drivers/net/wireless/marvell/mwifiex/cmdevt.c |  27 ++
  drivers/net/wireless/marvell/mwifiex/decl.h   |  22 +
  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   |  54 +++
  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  |   3 +-
  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, 974 insertions(+), 17 deletions(-)
Quoted 1 line

base-commit: 783004b6dbda2cfe9a552a4cc9c1d168a2068f6c

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 8 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

Rafael

Our test is on v6.1. I will try to test on v6.7. Thanks for your information.

author
#11 lore raw
In reply to Rafael Beims
Quoted 111 lines

From: Rafael Beims <[email protected]>
Sent: Friday, January 19, 2024 1:09 AM
To: David Lin <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 25 lines · David Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

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.

Quoted 7 lines

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

Quoted 15 lines

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.

Quoted 6 lines

v3:
- Cleanup commit message.

v2:
- Fix checkpatch error (pwe[1] -> pwe[0]).
- Move module parameter 'host_mlme' to mwifiex_sdio_device

structure.

Quoted 2 lines

Default only enable for IW416.
- Disable advertising NL80211_FEATURE_SAE if host_mlme is not

enabled.

Quoted 6 lines

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   | 394

+++++++++++++++++-

Quoted 20 lines
  drivers/net/wireless/marvell/mwifiex/cmdevt.c |  27 ++
  drivers/net/wireless/marvell/mwifiex/decl.h   |  22 +
  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   |  54 +++
  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  |   3 +-
  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, 974 insertions(+), 17 deletions(-)
Quoted 1 line

base-commit: 783004b6dbda2cfe9a552a4cc9c1d168a2068f6c

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 8 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

Rafael

I applied patch v8 (mbox from patch work) to Linux stable repository (tag v6.7.2).

Both client and AP mode can work with and without WPA3.

David

#12 lore raw
Quoted 116 lines · David Lin
Quoted 116 lines

From: Rafael Beims <[email protected]>
Sent: Friday, January 19, 2024 1:09 AM
To: David Lin <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 25 lines · David Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

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.

Quoted 7 lines

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

Quoted 15 lines

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.

Quoted 6 lines

v3:
- Cleanup commit message.

v2:
- Fix checkpatch error (pwe[1] -> pwe[0]).
- Move module parameter 'host_mlme' to mwifiex_sdio_device

structure.

Quoted 2 lines

Default only enable for IW416.
- Disable advertising NL80211_FEATURE_SAE if host_mlme is not

enabled.

Quoted 5 lines

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   | 394

+++++++++++++++++-

Quoted 20 lines
   drivers/net/wireless/marvell/mwifiex/cmdevt.c |  27 ++
   drivers/net/wireless/marvell/mwifiex/decl.h   |  22 +
   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   |  54 +++
   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  |   3 +-
   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, 974 insertions(+), 17 deletions(-)
Quoted 1 line

base-commit: 783004b6dbda2cfe9a552a4cc9c1d168a2068f6c

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

Quoted 7 lines
Quoted 1 line

Rafael

I applied patch v8 (mbox from patch work) to Linux stable repository (tag v6.7.2).

Both client and AP mode can work with and without WPA3.

David

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported before. Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

After seeing the AP starting up, I did a quick series of tests (Toradex Verdin AM62 with 1GB of RAM and two antennas connected via SMA adapter):

1) AP test: I was able to use the simple AP configuration with two clients connected simultaneously. I executed simple ping tests and also a quick run of iperf3 with the following results

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  16.8 MBytes  14.1 Mbits/sec 11             sender [  5]   0.00-10.05  sec  16.4 MBytes  13.7 Mbits/sec                  receiver

I repeated the same iperf3 test several times with similar results.

Comparing the iperf3 results with what I get on the unpatched driver (v6.7.2), there seems to be a difference in average bandwidth:

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  20.2 MBytes  17.0 Mbits/sec 0             sender [  5]   0.00-10.04  sec  19.7 MBytes  16.4 Mbits/sec                  receiver

2) Client test: I also executed a similar test but now with the AM62 as the client. It was possible to connect to an AP and do the ping tests without problems.

The iperf3 results are in line with what we see on the AP:

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  19.3 MBytes  16.2 Mbits/sec 32             sender [  5]   0.00-10.01  sec  19.0 MBytes  15.9 Mbits/sec                  receiver

Comparing with the unpatched v6.7.2 we can also see a difference:

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  23.4 MBytes  19.6 Mbits/sec 0             sender [  5]   0.00-10.01  sec  20.7 MBytes  17.3 Mbits/sec                  receiver

3) Simple WPA3 AP test: to finish this round of tests, I started an AP with a configuration enabling SAE. The AP was started successfully and I could connect a client with wpa_supplicant. Ping tests were also succesful here.

The iperf3 result shows a bigger bandwidth than all the previous tests:

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  20.6 MBytes  17.3 Mbits/sec 35             sender [  5]   0.00-10.04  sec  19.8 MBytes  16.6 Mbits/sec                  receiver

To summarize the results, it seems that the basic functionality is working and also WPA3 support.

We have a different behavior when starting the AP, where now we need to stop connman (blacklisting the uap0 interface will probably also work) beforehand.

I don't know if the bandwidth results are something to be worried about, I saw some variation between iperf3 runs, but the results I posted show an average of what I was seeing.

Rafael

#13 lore raw
Quoted 10 lines · Rafael Beims
Quoted 9 lines · David Lin
Quoted 9 lines

From: Rafael Beims <[email protected]>

Quoted 7 lines · David Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 28 lines
Quoted 9 lines
Quoted 9 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 9 lines
Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag v6.7.2). Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported before. Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

Quoted 7 lines

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior expected?

Francesco

author
#14 lore raw
Quoted 67 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · Rafael Beims
Quoted 9 lines · David Lin
Quoted 9 lines

From: Rafael Beims <[email protected]> On 22/12/2023 00:21, David

Quoted 7 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

v6.7.2).

Quoted 16 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported before. Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

Quoted 7 lines
Quoted 3 lines

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior expected?

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to issue "sudo systemctl stop NetworkManager" in order to test AP mode.

For i.MX + SDIO IW416, it needs to install following two files for client and AP mode to "/lib/systemd/network" for systemd-networkd:

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

David

#15 lore raw
Quoted 65 lines · David Lin
Quoted 65 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · Rafael Beims
Quoted 9 lines · David Lin
Quoted 9 lines

From: Rafael Beims <[email protected]> On 22/12/2023 00:21, David

Quoted 7 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

v6.7.2).

Quoted 16 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported before. Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior expected?

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to issue "sudo systemctl stop NetworkManager" in order to test AP mode.

The issue I reported is that the kernel with the patch is behaving differently when compared to the kernel without the patch. I kept all the test conditions the same, just replacing the kernel. It seems that you can reproduce this on your end using NetworkManager.

This is a change in behavior on userspace that's not currently explained.

Quoted 21 lines

For i.MX + SDIO IW416, it needs to install following two files for client and AP mode to "/lib/systemd/network" for systemd-networkd:

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

Quoted 7 lines

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

David

I didn't really understand what systemd-networkd has to do with anything being discussed here. We could use it to create an AP, but that's not the test I did. In my case I used hostapd directly.

Rafael

author
#16 lore raw
Quoted 127 lines

From: Rafael Beims <[email protected]>
Sent: Thursday, February 15, 2024 8:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 63 lines · David Lin
Quoted 63 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · Rafael Beims
Quoted 9 lines · David Lin
Quoted 9 lines

From: Rafael Beims <[email protected]> On 22/12/2023 00:21, David

Quoted 7 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

v6.7.2).

Quoted 12 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported before. Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior

expected?

Quoted 3 lines
Quoted 2 lines

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to

issue "sudo systemctl stop NetworkManager" in order to test AP mode.

The issue I reported is that the kernel with the patch is behaving differently when compared to the kernel without the patch. I kept all the test conditions the same, just replacing the kernel. It seems that you can reproduce this on your end using NetworkManager.

This is a change in behavior on userspace that's not currently explained.

Quoted 1 line

For i.MX + SDIO IW416, it needs to install following two files for client and

AP mode to "/lib/systemd/network" for systemd-networkd:

Quoted 26 lines

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

Quoted 8 lines
Quoted 1 line

David

I didn't really understand what systemd-networkd has to do with anything being discussed here. We could use it to create an AP, but that's not the test I did. In my case I used hostapd directly.

Rafael

I think the difference between previous driver is host mlme. Systemd-networkd is only for address assignment, so it won't affect the test of AP mode. However, Ubuntu Network Manager will affect AP mode test, so it needs to stop it before running hostapd.

David

author
#17 lore raw
Quoted 150 lines

From: David Lin
Sent: Friday, February 16, 2024 9:41 AM
To: Rafael Beims <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 10 lines

From: Rafael Beims <[email protected]>
Sent: Thursday, February 15, 2024 8:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 32 lines

Caution: 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

Quoted 26 lines · David Lin
Quoted 26 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · Rafael Beims
Quoted 9 lines · David Lin
Quoted 9 lines

From: Rafael Beims <[email protected]> On 22/12/2023 00:21, David

Quoted 7 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this

change.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 17 lines
Quoted 17 lines
Quoted 9 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

v6.7.2).

Quoted 6 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported

before.

Quoted 65 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior

expected?

Quoted 4 lines
Quoted 2 lines

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to

issue "sudo systemctl stop NetworkManager" in order to test AP mode.

The issue I reported is that the kernel with the patch is behaving differently when compared to the kernel without the patch. I kept all the test conditions the same, just replacing the kernel. It seems that you can reproduce this on your end using NetworkManager.

This is a change in behavior on userspace that's not currently explained.

Quoted 2 lines

For i.MX + SDIO IW416, it needs to install following two files for client and

AP mode to "/lib/systemd/network" for systemd-networkd:

Quoted 20 lines

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

Quoted 7 lines

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

David

I didn't really understand what systemd-networkd has to do with anything being discussed here. We could use it to create an AP, but that's not the test I did. In my case I used hostapd directly.

Quoted 8 lines
Quoted 1 line

Rafael

I think the difference between previous driver is host mlme. Systemd-networkd is only for address assignment, so it won't affect the test of AP mode. However, Ubuntu Network Manager will affect AP mode test, so it needs to stop it before running hostapd.

David

I found https://groups.google.com/g/beagleboard/c/3Um2Xqa2MHU to setup commman with hostapd. Can you give me your setting for commman? Thanks.

David

#18 lore raw
Quoted 153 lines · David Lin
Quoted 153 lines

From: David Lin
Sent: Friday, February 16, 2024 9:41 AM
To: Rafael Beims <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 10 lines

From: Rafael Beims <[email protected]>
Sent: Thursday, February 15, 2024 8:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 32 lines

Caution: 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

Quoted 26 lines · David Lin
Quoted 26 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · Rafael Beims
Quoted 9 lines · David Lin
Quoted 9 lines

From: Rafael Beims <[email protected]> On 22/12/2023 00:21, David

Quoted 7 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this

change.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 17 lines
Quoted 17 lines
Quoted 9 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with IW416):

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

v6.7.2).

Quoted 6 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported

before.

Quoted 56 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior

expected?

Quoted 3 lines
Quoted 1 line

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to

issue "sudo systemctl stop NetworkManager" in order to test AP mode.

The issue I reported is that the kernel with the patch is behaving differently when compared to the kernel without the patch. I kept all the test conditions the same, just replacing the kernel. It seems that you can reproduce this on your end using NetworkManager.

This is a change in behavior on userspace that's not currently explained.

Quoted 2 lines

For i.MX + SDIO IW416, it needs to install following two files for client and

AP mode to "/lib/systemd/network" for systemd-networkd:

Quoted 25 lines

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

Quoted 7 lines
Quoted 1 line

David

I didn't really understand what systemd-networkd has to do with anything being discussed here. We could use it to create an AP, but that's not the test I did. In my case I used hostapd directly.

Rafael

I think the difference between previous driver is host mlme. Systemd-networkd is only for address assignment, so it won't affect the test of AP mode. However, Ubuntu Network Manager will affect AP mode test, so it needs to stop it before running hostapd.

Quoted 5 lines
Quoted 1 line

David

I found https://groups.google.com/g/beagleboard/c/3Um2Xqa2MHU to setup commman with hostapd. Can you give me your setting for commman? Thanks.

David

Just to make it clear, we are *not* setting up the AP with connman. On our reference images we have a simple service that starts hostapd directly. We also have connman running by default and it's responsible for setting up the other interfaces (ethernet, wifi client).

In this setup, we previously were able to just start the hostapd service and the AP would start working. Now with the patch, connman seems to be doing something with the interface that causes the AP to fail starting.

For reference, this is the simple AP service we start:

[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Requires=enable-wifi.service

[Service]
Type=forking
PIDFile=/run/hostapd.pid
ExecStart=/usr/sbin/hostapd /etc/hostapd-tdx-demo-img.conf -P /run/hostapd.pid -B

[Install]
WantedBy=multi-user.target

If you want to replicate this behavior on your side, probably just building connman with yocto and adding it to your image is enough. After enabling connman to start at boot time, you can try to start hostapd manually.

Regards,

Rafael

author
#19 lore raw
Quoted 211 lines

From: Rafael Beims <[email protected]>
Sent: Friday, February 16, 2024 6:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 36 lines · David Lin
Quoted 36 lines

From: David Lin
Sent: Friday, February 16, 2024 9:41 AM
To: Rafael Beims <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 26 lines

From: Rafael Beims <[email protected]>
Sent: Thursday, February 15, 2024 8:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · David Lin
Quoted 10 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Caution: 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

Quoted 2 lines · Rafael Beims
Quoted 1 line · David Lin
Quoted 1 line

From: Rafael Beims <[email protected]> On 22/12/2023 00:21,

David

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this

change.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

...

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with

IW416):

Quoted 85 lines
Quoted 85 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 6 lines

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

Quoted 6 lines

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

v6.7.2).

Quoted 7 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported

before.

Quoted 62 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior

expected?

Quoted 3 lines
Quoted 1 line

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to

issue "sudo systemctl stop NetworkManager" in order to test AP mode.

The issue I reported is that the kernel with the patch is behaving differently when compared to the kernel without the patch. I kept all the test conditions the same, just replacing the kernel. It seems that you can reproduce this on your end using NetworkManager.

This is a change in behavior on userspace that's not currently explained.

Quoted 2 lines

For i.MX + SDIO IW416, it needs to install following two files for client and

AP mode to "/lib/systemd/network" for systemd-networkd:

Quoted 19 lines

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

Quoted 7 lines

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

David

I didn't really understand what systemd-networkd has to do with anything being discussed here. We could use it to create an AP, but that's not the test I did. In my case I used hostapd directly.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Rafael

I think the difference between previous driver is host mlme. Systemd-networkd is only for address assignment, so it won't affect the test of AP mode. However, Ubuntu Network Manager will affect AP mode test, so it needs to stop it before running hostapd.

David

I found

https://groups.go/
ogle.com%2Fg%2Fbeagleboard%2Fc%2F3Um2Xqa2MHU&data=05%7C02%7Cy u-hao.lin%40nxp.com%7C4c74f7c309e243eb6c0c08dc2ed78b4c%7C686ea1d3 bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638436750492293425%7CUnknow n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haW wiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=99eQWmm39kbo63JKNFbiljFQz o%2Bz7ki%2FSsllw%2FdonbE%3D&reserved=0 to setup commman with hostapd. Can you give me your setting for commman? Thanks.

Quoted 3 lines

David

Just to make it clear, we are *not* setting up the AP with connman. On our reference images we have a simple service that starts hostapd directly. We also have connman running by default and it's responsible for setting up the other interfaces (ethernet, wifi client).

In this setup, we previously were able to just start the hostapd service and the AP would start working. Now with the patch, connman seems to be doing something with the interface that causes the AP to fail starting.

For reference, this is the simple AP service we start:

[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Requires=enable-wifi.service

[Service]
Type=forking
PIDFile=/run/hostapd.pid ExecStart=/usr/sbin/hostapd /etc/hostapd-tdx-demo-img.conf -P /run/hostapd.pid -B

[Install]
WantedBy=multi-user.target

Quoted 9 lines

If you want to replicate this behavior on your side, probably just building connman with yocto and adding it to your image is enough. After enabling connman to start at boot time, you can try to start hostapd manually.

Regards,

Rafael

1. Without host mlme, management packet filter of AP mode is the same as client mode. Authentication/Association packets are handled by firmware and once if station is connected, firmware will send station connection event to driver. So you can still start wpa_supplicant and hostapd on uap0 at same time. However, this is not correct setting and usage.

2. With host mlme, management packet filter of AP mode is not the same as client mode. Authentication/Association packets are sent to hostapd, so cfg80211 won't allow wpa_supplicant and hostapd run on uap0 at same time (different management packet filter).

I think no matter with or without patch v8, setting of connman for uap0 should not be client mode. Setting of connman for uap0 should be ap mode or bypass to control it as client mode.

The behavior of patch v8 is correct and it can avoid user to run wpa_supplicant and hostapd on AP wireless interface at same time. There is no side effect of patch v8 for this behavior.

I also found document from Toradex about how to run connman for AP mode:

https://developer.toradex.com/linux-bsp/application-development/networking-connectivity/how-to-setup-wi-fi-access-point-mode-linux/

Please check section 8:

Enable and start hostapd service:
First, make sure to blacklist the uap0 interface on connmanctl by adding it to NetworkInterfaceBlacklist at connman/main.conf.

I think to block uap0 from connman is correct way to run hostapd on uap0.

David

#20 lore raw
Quoted 230 lines · David Lin
Quoted 209 lines

From: Rafael Beims <[email protected]>
Sent: Friday, February 16, 2024 6:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 36 lines · David Lin
Quoted 36 lines

From: David Lin
Sent: Friday, February 16, 2024 9:41 AM
To: Rafael Beims <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: RE: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 26 lines

From: Rafael Beims <[email protected]>
Sent: Thursday, February 15, 2024 8:11 PM
To: David Lin <[email protected]>; Francesco Dolcini <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Caution: 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

Quoted 10 lines · David Lin
Quoted 10 lines

From: Francesco Dolcini <[email protected]>
Sent: Thursday, February 8, 2024 3:25 PM
To: Rafael Beims <[email protected]>
Cc: David Lin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Pete Hsieh <[email protected]>
Subject: Re: [EXT] Re: [PATCH v8 0/2] wifi: mwifiex: add code to support host mlme

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Caution: 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

Quoted 2 lines · Rafael Beims
Quoted 1 line · David Lin
Quoted 1 line

From: Rafael Beims <[email protected]> On 22/12/2023 00:21,

David

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines · Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this

change.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

...

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

David Lin (2):
wifi: mwifiex: add host mlme for client mode
wifi: mwifiex: add host mlme for AP mode

...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I applied the two commits of this series on top of v6.7 but unfortunately the AP is failing to start with the patches. I get this output from "hostapd -d" (running on a Verdin AM62 with

IW416):

Quoted 84 lines
Quoted 84 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 11 lines

nl80211: kernel reports: Match already configured
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]

If I run the same hostapd on v6.7 without the patches, the AP is started with no issues.

Is there anything else that should be done in order to test this?

I applied patch v8 (mbox from patch work) to Linux stable repository (tag

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

v6.7.2).

Quoted 7 lines
Quoted 2 lines

Both client and AP mode can work with and without WPA3.

I went back and executed the tests again. I re-applied the pach on top of tag v6.7.2 to make sure we're seeing exactly the same thing.

At first, the behavior I was seeing was exactly the same I reported

before.

Quoted 62 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Upon starting hostapd with our basic example configuration, it would fail to start the AP with the error:

nl80211: kernel reports: Match already configured
nl80211: Could not configure driver mode

After some investigation of what could cause this error, I found out that it was connman that was interfering with this somehow. After killing the connman service, the AP would start correctly.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

I want to point out that this behavior is different from the unpatched driver. With that one we don't need to kill connman in order to start the AP with hostapd.

Any idea what's going on in this regard? Is such a change in behavior

expected?

Quoted 3 lines
Quoted 1 line

Francesco

When I tried to test v6.7.2+ (with patch v8) on NB + SDIO IW416, it needs to

issue "sudo systemctl stop NetworkManager" in order to test AP mode.

The issue I reported is that the kernel with the patch is behaving differently when compared to the kernel without the patch. I kept all the test conditions the same, just replacing the kernel. It seems that you can reproduce this on your end using NetworkManager.

This is a change in behavior on userspace that's not currently explained.

Quoted 2 lines

For i.MX + SDIO IW416, it needs to install following two files for client and

AP mode to "/lib/systemd/network" for systemd-networkd:

Quoted 19 lines

<<Client mode: 80-wifi-station.network>>

[Match]
Type=wlan
WLANInterfaceType=station

[Network]
DHCP=yes

<<AP mode: 80-wifi-ap.network>>

[Match]
Type=wlan
WLANInterfaceType=ap

[Network]
Address=192.168.100.1/24
DHCPServer=yes

Quoted 7 lines

[DHCPServer]
PoolOffset=100
PoolSize=20

I think this is not related to driver.

David

I didn't really understand what systemd-networkd has to do with anything being discussed here. We could use it to create an AP, but that's not the test I did. In my case I used hostapd directly.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Rafael

I think the difference between previous driver is host mlme. Systemd-networkd is only for address assignment, so it won't affect the test of AP mode. However, Ubuntu Network Manager will affect AP mode test, so it needs to stop it before running hostapd.

David

I found

https://groups.go/
ogle.com%2Fg%2Fbeagleboard%2Fc%2F3Um2Xqa2MHU&data=05%7C02%7Cy u-hao.lin%40nxp.com%7C4c74f7c309e243eb6c0c08dc2ed78b4c%7C686ea1d3 bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638436750492293425%7CUnknow n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haW wiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=99eQWmm39kbo63JKNFbiljFQz o%2Bz7ki%2FSsllw%2FdonbE%3D&reserved=0 to setup commman with hostapd. Can you give me your setting for commman? Thanks.

Quoted 2 lines

David

Just to make it clear, we are *not* setting up the AP with connman. On our reference images we have a simple service that starts hostapd directly. We also have connman running by default and it's responsible for setting up the other interfaces (ethernet, wifi client).

In this setup, we previously were able to just start the hostapd service and the AP would start working. Now with the patch, connman seems to be doing something with the interface that causes the AP to fail starting.

For reference, this is the simple AP service we start:

[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Requires=enable-wifi.service

[Service]
Type=forking
PIDFile=/run/hostapd.pid ExecStart=/usr/sbin/hostapd /etc/hostapd-tdx-demo-img.conf -P /run/hostapd.pid -B

[Install]
WantedBy=multi-user.target

Quoted 9 lines

If you want to replicate this behavior on your side, probably just building connman with yocto and adding it to your image is enough. After enabling connman to start at boot time, you can try to start hostapd manually.

Regards,

Rafael

1. Without host mlme, management packet filter of AP mode is the same as client mode. Authentication/Association packets are handled by firmware and once if station is connected, firmware will send station connection event to driver. So you can still start wpa_supplicant and hostapd on uap0 at same time. However, this is not correct setting and usage.

2. With host mlme, management packet filter of AP mode is not the same as client mode. Authentication/Association packets are sent to hostapd, so cfg80211 won't allow wpa_supplicant and hostapd run on uap0 at same time (different management packet filter).

I think no matter with or without patch v8, setting of connman for uap0 should not be client mode. Setting of connman for uap0 should be ap mode or bypass to control it as client mode.

The behavior of patch v8 is correct and it can avoid user to run wpa_supplicant and hostapd on AP wireless interface at same time. There is no side effect of patch v8 for this behavior.

I also found document from Toradex about how to run connman for AP mode:

https://developer.toradex.com/linux-bsp/application-development/networking-connectivity/how-to-setup-wi-fi-access-point-mode-linux/

Quoted 9 lines

Please check section 8:

Enable and start hostapd service:
First, make sure to blacklist the uap0 interface on connmanctl by adding it to NetworkInterfaceBlacklist at connman/main.conf.

I think to block uap0 from connman is correct way to run hostapd on uap0.

David

That explains the difference in behavior, thank you!

Rafael

reviewer Tested-by on the v8 series
#21 lore raw
In reply to David Lin
Quoted 7 lines · David Lin

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 the NXP QA team. Other NXP Wi-Fi chips supported in current mwifiex are not affected by this change.

I did test this series with 88W8997, using SDIO interface, 16.68.1.p197 firmware. Host MLME is disabled in this specific combination, I just wanted to verify that no obvious regression was introduced, and I was not able to see any difference in behavior nor in performances.

Francesco