Skip to contentSkip to conversation

brcmfmac: add FT/OKC roaming offload support

PATCH Superseded Jason Huang 3 participants 26 messages Aug 21 – Sep 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover brcmfmac: add FT/OKC roaming offload support

From: Carella Chen <[email protected]>

This series adds the cfg80211/nl80211 and brcmfmac pieces needed to support firmware-assisted FT/OKC roaming offload.

Patch 1 adds an nl80211 extended feature bit so drivers can advertise roaming PMK programming support without claiming full 802.1X 4-way handshake offload. The brcmfmac patches then detect firmware FBT/OKC capabilities, keep roaming-offload connections in a firmware-supplicant profile state, program PMK material for FT/OKC roaming, report port authorization after offloaded roaming, and advertise the new capability when firmware support is present.

Changes in v5:
- Reworked nl80211_set_pmk() to avoid the 80-column checkpatch warning on the 4-way handshake extended-feature check.
- Added kernel-doc for the brcmfmac OKC profile state added by the PMK programming patch.
- Normalized Assisted-by trailers to the checkpatch-accepted AGENT_NAME:MODEL_VERSION format.
- Added Johannes and the wireless/brcm80211 lists to the cover letter Cc list for the nl80211 and brcmfmac changes.

Changes in v4:
- Resend the complete 5-patch series because v3 reached linux-wireless without patch 5/5.
- No code changes from v3.

Changes in v3:
- Send as a new standalone thread; v2 was accidentally posted once without patches and once as a reply to v1.
- Stop using deprecated NL80211_ATTR_PORT_AUTHORIZED and report authorization through cfg80211_port_authorized(), which emits NL80211_CMD_PORT_AUTHORIZED.
- Squash OKC PMK programming and firmware roaming supplicant mode into one brcmfmac patch.
- Clean up authorship/trailers for the squashed patch.

---
Carella Chen (3):
wifi: nl80211: add roam offload extended feature
wifi: brcmfmac: detect firmware FBT and OKC support
wifi: brcmfmac: advertise firmware roam offload support

Darren Li (2):
wifi: brcmfmac: add PMK programming for firmware roaming offload
wifi: brcmfmac: report port authorization after offloaded roaming

 .../broadcom/brcm80211/brcmfmac/cfg80211.c         | 125 +++++++++++++++++++--
 .../broadcom/brcm80211/brcmfmac/cfg80211.h         |   5 +-
 .../wireless/broadcom/brcm80211/brcmfmac/feature.c |   2 +
 .../wireless/broadcom/brcm80211/brcmfmac/feature.h |   4 +-
 include/uapi/linux/nl80211.h                       |   4 +
 net/wireless/nl80211.c                             |   7 +-
 6 files changed, 132 insertions(+), 15 deletions(-)

---
base-commit: 6c5fc504d0d6934132637aa3db4b9b58148eaa78
change-id: 20260821-upstream-wireless-next-main-jason-11r-support-v1-0201e1f9c0e0

Best regards,

Signature · 1 line
Jason Huang <[email protected]>
#1 lore raw

PATCH v5 1/5 wifi: nl80211: add roam offload extended feature

From: Carella Chen <[email protected]>

Drivers can offload FT or OKC roaming without necessarily advertising full 802.1X 4-way handshake offload. Add an extended feature bit for that capability and allow PMK configuration when it is present.

This gives userspace a way to provide PMK or PMK-R0 material needed by firmware roaming implementations while keeping the existing 4-way handshake offload capability unchanged.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
 include/uapi/linux/nl80211.h | 4 ++++
 net/wireless/nl80211.c       | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
include/uapi/linux/nl80211.h +4 -0
index 020387d76412..9f8d9e3d5990 100644
@@ -7110,6 +7110,9 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_PROBE_AP: Driver supports probing the associated AP
  *	in STA mode using @NL80211_CMD_PROBE_PEER.
  *
+ * @NL80211_EXT_FEATURE_ROAM_OFFLOAD: Driver supports Fast Transition or
+ *	Opportunistic Key Caching roaming offload in station mode.
+ *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -7192,6 +7195,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_ROC_ADDR_FILTER,
 	NL80211_EXT_FEATURE_SET_KEY_LTF_SEED,
 	NL80211_EXT_FEATURE_PROBE_AP,
+	NL80211_EXT_FEATURE_ROAM_OFFLOAD,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c +5 -2
index 44f2bad08670..15731440c57a 100644
@@ -18434,6 +18434,7 @@ static int nl80211_set_multicast_to_unicast(struct sk_buff *skb,
 static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct wiphy *wiphy = &rdev->wiphy;
 	struct net_device *dev = info->user_ptr[1];
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct cfg80211_pmk_conf pmk_conf = {};
@@ -18442,8 +18443,10 @@ static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
 	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
 		return -EOPNOTSUPP;
 
-	if (!wiphy_ext_feature_isset(&rdev->wiphy,
-				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X))
+	if (!wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X) &&
+	    !wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_ROAM_OFFLOAD))
 		return -EOPNOTSUPP;
 
 	if (!info->attrs[NL80211_ATTR_MAC] || !info->attrs[NL80211_ATTR_PMK])
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH v5 1/5] wifi: nl80211: add roam offload extended feature

Quoted 24 lines · Jason Huang

From: Carella Chen <[email protected]>

Drivers can offload FT or OKC roaming without necessarily advertising full 802.1X 4-way handshake offload. Add an extended feature bit for that capability and allow PMK configuration when it is present.

This gives userspace a way to provide PMK or PMK-R0 material needed by firmware roaming implementations while keeping the existing 4-way handshake offload capability unchanged.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
  include/uapi/linux/nl80211.h | 4 ++++
  net/wireless/nl80211.c       | 7 +++++--
  2 files changed, 9 insertions(+), 2 deletions(-)
include/uapi/linux/nl80211.h +0 -0
index 020387d76412..9f8d9e3d5990 100644

include/uapi/linux/nl80211.h enum nl80211_feature_flags { · line 7113

Quoted 4 lines
include/uapi/linux/nl80211.h +1 -0
@@ -7110,6 +7110,9 @@ enum nl80211_feature_flags {
   * @NL80211_EXT_FEATURE_PROBE_AP: Driver supports probing the associated AP
   *	in STA mode using @NL80211_CMD_PROBE_PEER.
   *
+ * @NL80211_EXT_FEATURE_ROAM_OFFLOAD: Driver supports Fast Transition or

Please call it NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD or simply _FAST_ROAMING if the name is getting too long. As long as it is clear this is not for regular roaming scenario.

Quoted 26 lines
include/uapi/linux/nl80211.h +3 -0
+ *	Opportunistic Key Caching roaming offload in station mode.
+ *
   * @NUM_NL80211_EXT_FEATURES: number of extended features.
   * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
   */
@@ -7192,6 +7195,7 @@ enum nl80211_ext_feature_index {
  	NL80211_EXT_FEATURE_ROC_ADDR_FILTER,
  	NL80211_EXT_FEATURE_SET_KEY_LTF_SEED,
  	NL80211_EXT_FEATURE_PROBE_AP,
+	NL80211_EXT_FEATURE_ROAM_OFFLOAD,
 
  	/* add new features before the definition below */
  	NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c +1 -0
index 44f2bad08670..15731440c57a 100644
@@ -18434,6 +18434,7 @@ static int nl80211_set_multicast_to_unicast(struct sk_buff *skb,
  static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
  {
  	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct wiphy *wiphy = &rdev->wiphy;
  	struct net_device *dev = info->user_ptr[1];
  	struct wireless_dev *wdev = dev->ieee80211_ptr;
  	struct cfg80211_pmk_conf pmk_conf = {};

net/wireless/nl80211.c static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info) · line 18449

Quoted 9 lines
net/wireless/nl80211.c +4 -2
@@ -18442,8 +18443,10 @@ static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
  	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
  		return -EOPNOTSUPP;
 
-	if (!wiphy_ext_feature_isset(&rdev->wiphy,
-				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X))
+	if (!wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X) &&
+	    !wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_ROAM_OFFLOAD))

Ah. _FAST_ROAM_OFFLOAD is not longer than the other ext_feature checked here.

Quoted 4 lines
net/wireless/nl80211.c +0 -0
  		return -EOPNOTSUPP;
 
  	if (!info->attrs[NL80211_ATTR_MAC] || !info->attrs[NL80211_ATTR_PMK])
maintainer
#3 lore raw

Re: [PATCH v5 1/5] wifi: nl80211: add roam offload extended feature

Quoted 20 lines · Arend van Spriel
Quoted 19 lines · Jason Huang

From: Carella Chen <[email protected]>

Drivers can offload FT or OKC roaming without necessarily advertising full 802.1X 4-way handshake offload. Add an extended feature bit for that capability and allow PMK configuration when it is present.

This gives userspace a way to provide PMK or PMK-R0 material needed by firmware roaming implementations while keeping the existing 4-way handshake offload capability unchanged.

Assisted-by GitHub-Copilot-CLI:gpt-5.5

---
  include/uapi/linux/nl80211.h | 4 ++++
  net/wireless/nl80211.c       | 7 +++++--

  2 files changed, 9 insertions(+), 2 deletions(-)

[...]

Quoted 17 lines
Quoted 17 lines
net/wireless/nl80211.c +1 -0
index 44f2bad08670..15731440c57a 100644
@@ -18434,6 +18434,7 @@ static int 
 nl80211_set_multicast_to_unicast(struct sk_buff *skb,
   static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
   {
       struct cfg80211_registered_device *rdev = info->user_ptr[0];
+    struct wiphy *wiphy = &rdev->wiphy;
       struct net_device *dev = info->user_ptr[1];
       struct wireless_dev *wdev = dev->ieee80211_ptr;

      struct cfg80211_pmk_conf pmk_conf = {};

net/wireless/nl80211.c +0 -0
@@ -18442,8 +18443,10 @@ static int nl80211_set_pmk(struct sk_buff 
 *skb, struct genl_info *info)
           wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
           return -EOPNOTSUPP;
Quoted 8 lines

net/wireless/nl80211.c static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info) · line 18449

Quoted 6 lines
net/wireless/nl80211.c +4 -2
-    if (!wiphy_ext_feature_isset(&rdev->wiphy,
-                     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X))
+    if (!wiphy_ext_feature_isset(wiphy,
+                     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X) &&
+        !wiphy_ext_feature_isset(wiphy,
+                     NL80211_EXT_FEATURE_ROAM_OFFLOAD))

Ah. _FAST_ROAM_OFFLOAD is not longer than the other ext_feature checked here.

Actually there is a checkpatch warning that line with the STA_1X check is 82 characters. So my suggestion please make it FAST_ROAMING instead of ROAM_OFFLOAD and swap the two checks to fix the checkpatch warning.

Regards,
Arend

#4 lore raw

Re: [PATCH v5 1/5] wifi: nl80211: add roam offload extended feature

Hi Arend,

Quoted 4 lines

Actually there is a checkpatch warning that line with the STA_1X check is 82 characters. So my suggestion please make it FAST_ROAMING instead of ROAM_OFFLOAD and swap the two checks to fix the checkpatch warning.

Thank you for your suggestion. We will rename it to NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD. The name reflects that userspace offloads fast-roaming handling to the driver/firmware, and it covers both FT and OKC. We will also reorder the checks to avoid the line-length warning.

Thank you.

maintainer
#5 lore raw

Re: [PATCH v5 1/5] wifi: nl80211: add roam offload extended feature

Quoted 9 lines · HungTsung Huang

Hi Arend,

Quoted 4 lines

Actually there is a checkpatch warning that line with the STA_1X check is 82 characters. So my suggestion please make it FAST_ROAMING instead of ROAM_OFFLOAD and swap the two checks to fix the checkpatch warning.

Thank you for your suggestion. We will rename it to NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD. The name reflects that userspace offloads fast-roaming handling to the driver/firmware, and it covers both FT and OKC. We will also reorder the checks to avoid the line-length warning.

As this is indicating a driver feature the "_OFFLOAD" part is implied. At least that is how I look at it. With the 80 char limit the long name can be a drag in places.

Regards,
Arend

maintainer
#6 lore raw

Re: [PATCH v5 1/5] wifi: nl80211: add roam offload extended feature

In reply to Jason Huang

net/wireless/nl80211.c static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info) · line 18450

Quoted 11 lines · Jason Huang
net/wireless/nl80211.c +4 -2
@@ -18442,8 +18443,10 @@ static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
 	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
 		return -EOPNOTSUPP;
 
-	if (!wiphy_ext_feature_isset(&rdev->wiphy,
-				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X))
+	if (!wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X) &&
+	    !wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_ROAM_OFFLOAD))
 		return -EOPNOTSUPP;

Shouldn't you have a similar change in _del_pmk()?

johannes

#7 lore raw

Re: [PATCH v5 1/5] wifi: nl80211: add roam offload extended feature

Hi Johannes,

Yes, you're right. nl80211_del_pmk() should allow the same ROAM_OFFLOAD-only case as nl80211_set_pmk(); otherwise userspace can install PMK material for roaming offload but cannot delete it again.

I'll fix this in next version by applying the same feature check to del_pmk(). Thanks for catching this.

#8 lore raw

PATCH v5 2/5 wifi: brcmfmac: detect firmware FBT and OKC support

In reply to Jason Huang

From: Carella Chen <[email protected]>

Some firmware advertises Fast BSS Transition and Opportunistic Key Caching support through the firmware capability string. Track those capabilities so later roaming offload handling can be enabled only when firmware reports support.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 2 ++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +2 -0
index 488364ef8ff2..cc19e5e7ebf5 100644
@@ -45,6 +45,8 @@ static const struct brcmf_feat_fwcap brcmf_fwcap_map[] = {
 	{ BRCMF_FEAT_SAE, "sae " },
 	{ BRCMF_FEAT_FWAUTH, "idauth" },
 	{ BRCMF_FEAT_SAE_EXT, "sae_ext" },
+	{ BRCMF_FEAT_FBT, "fbt " },
+	{ BRCMF_FEAT_OKC, "okc" },
 };
 
 #ifdef DEBUG
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +3 -1
index 31f8695ca417..8165a286b630 100644
@@ -59,7 +59,9 @@
 	BRCMF_FEAT_DEF(SCAN_V2) \
 	BRCMF_FEAT_DEF(PMKID_V2) \
 	BRCMF_FEAT_DEF(PMKID_V3) \
-	BRCMF_FEAT_DEF(SAE_EXT)
+	BRCMF_FEAT_DEF(SAE_EXT) \
+	BRCMF_FEAT_DEF(FBT) \
+	BRCMF_FEAT_DEF(OKC)
 
 /*
  * Quirks:
Signature · 1 line
2.25.1
#9 lore raw

PATCH v5 3/5 wifi: brcmfmac: add PMK programming for firmware roaming offload

In reply to Jason Huang

From: Darren Li <[email protected]>

FT and OKC roaming offload need PMK material in firmware even when the initial 802.1X exchange is handled by userspace. Add a roaming firmware-supplicant profile state for those connections and allow PMK configuration while firmware FT or OKC state is active.

Program the OKC PMK through the okc_info_pmk iovar before setting the regular PMK when firmware reports OKC state. Only select the roaming firmware-supplicant state when firmware advertises FBT or OKC support; devices without those capabilities keep the profile in the userspace supplicant state and do not issue roaming-offload specific iovars on every connect.

For FT-PSK with firmware supplicant support, keep the profile in the PSK firmware-supplicant state.

---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c         | 56 +++++++++++++++++++---
 .../broadcom/brcm80211/brcmfmac/cfg80211.h         |  5 +-
 2 files changed, 54 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +50 -6
index 872c48806d09..f2916cc9e5fc 100644
@@ -2112,9 +2112,11 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 	struct brcmf_pub *drvr = ifp->drvr;
 	s32 val;
 	s32 err;
+	s32 okc_enable;
 	const struct brcmf_tlv *rsn_ie;
 	const u8 *ie;
 	u32 ie_len;
+	bool fwsup_roam;
 	u32 offset;
 	u16 rsn_cap;
 	u32 mfp;
@@ -2122,6 +2124,9 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 
 	profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
 	profile->is_ft = false;
+	profile->is_okc = false;
+	fwsup_roam = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FBT) ||
+		     brcmf_feat_is_enabled(ifp, BRCMF_FEAT_OKC);
 
 	if (!sme->crypto.n_akm_suites)
 		return 0;
@@ -2138,6 +2143,8 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 			val = WPA_AUTH_UNSPECIFIED;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_PSK:
 			val = WPA_AUTH_PSK;
@@ -2153,11 +2160,15 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 			val = WPA2_AUTH_UNSPECIFIED;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_8021X_SHA256:
 			val = WPA2_AUTH_1X_SHA256;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_PSK_SHA256:
 			val = WPA2_AUTH_PSK_SHA256;
@@ -2170,10 +2181,16 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 			profile->is_ft = true;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_FT_PSK:
 			val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
 			profile->is_ft = true;
+			if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FWSUP))
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_WFA_DPP:
 			val = WFA_AUTH_DPP;
@@ -2204,8 +2221,22 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 
 	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X)
 		brcmf_dbg(INFO, "using 1X offload\n");
+
+	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X ||
+	    profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM) {
+		err = brcmf_fil_bsscfg_int_get(ifp, "okc_enable",
+					       &okc_enable);
+		if (err) {
+			bphy_err(drvr, "get okc_enable failed (%d)\n", err);
+		} else {
+			brcmf_dbg(INFO, "okc_enable (%d)\n", okc_enable);
+			profile->is_okc = okc_enable;
+		}
+	}
 	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE)
 		brcmf_dbg(INFO, "using SAE offload\n");
+	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM)
+		brcmf_dbg(INFO, "using roaming offload\n");
 
 	if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
 		goto skip_mfp_config;
@@ -2494,13 +2525,14 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
 
 		if (sme->crypto.psk && !is_sae_akm &&
 		    profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
-			if (WARN_ON(profile->use_fwsup !=
-				    BRCMF_PROFILE_FWSUP_NONE)) {
+			if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_NONE) {
+				brcmf_dbg(INFO, "using PSK offload\n");
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
+			} else if (WARN_ON(profile->use_fwsup !=
+					   BRCMF_PROFILE_FWSUP_PSK)) {
 				err = -EINVAL;
 				goto done;
 			}
-			brcmf_dbg(INFO, "using PSK offload\n");
-			profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
 		}
 		if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
 			/* enable firmware supplicant for this interface */
@@ -5953,17 +5985,29 @@ static int brcmf_cfg80211_set_pmk(struct wiphy *wiphy, struct net_device *dev,
 				  const struct cfg80211_pmk_conf *conf)
 {
 	struct brcmf_if *ifp;
+	struct brcmf_pub *drvr;
+	int ret;
 
 	brcmf_dbg(TRACE, "enter\n");
 
-	/* expect using firmware supplicant for 1X */
 	ifp = netdev_priv(dev);
-	if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X))
+	drvr = ifp->drvr;
+	if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X &&
+		    !ifp->vif->profile.is_ft &&
+		    !ifp->vif->profile.is_okc))
 		return -EINVAL;
 
 	if (conf->pmk_len > BRCMF_WSEC_MAX_PSK_LEN)
 		return -ERANGE;
 
+	if (ifp->vif->profile.is_okc) {
+		ret = brcmf_fil_iovar_data_set(ifp, "okc_info_pmk",
+					       conf->pmk, conf->pmk_len);
+		if (ret < 0)
+			bphy_err(drvr, "okc_info_pmk iovar failed: ret=%d\n",
+				 ret);
+	}
+
 	return brcmf_set_pmk(ifp, conf->pmk, conf->pmk_len);
 }
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +4 -1
index 63e534523f51..1aa99390a951 100644
@@ -127,7 +127,8 @@ enum brcmf_profile_fwsup {
 	BRCMF_PROFILE_FWSUP_NONE,
 	BRCMF_PROFILE_FWSUP_PSK,
 	BRCMF_PROFILE_FWSUP_1X,
-	BRCMF_PROFILE_FWSUP_SAE
+	BRCMF_PROFILE_FWSUP_SAE,
+	BRCMF_PROFILE_FWSUP_ROAM
 };
 
 /**
@@ -164,6 +165,7 @@ enum brcmf_mgmt_tx_status {
  * @bssid: bssid of joined/joining ibss.
  * @sec: security information.
  * @key: key information
+ * @is_okc: OKC is used for current connection.
  */
 struct brcmf_cfg80211_profile {
 	u8 bssid[ETH_ALEN];
@@ -172,6 +174,7 @@ struct brcmf_cfg80211_profile {
 	enum brcmf_profile_fwsup use_fwsup;
 	u16 use_fwauth;
 	bool is_ft;
+	bool is_okc;
 };
 
 /**
Signature · 1 line
2.25.1
#10 lore raw

PATCH v5 4/5 wifi: brcmfmac: report port authorization after offloaded roaming

In reply to Jason Huang

From: Darren Li <[email protected]>

Firmware can complete FT or OKC roaming before the driver reports the connect or roam event to cfg80211. Detect those successful offloaded cases when the profile uses firmware 1X or roaming offload and the association request carries PMK cache state, FT is in use, or OKC is enabled.

After reporting the connect or roam event, call cfg80211_port_authorized() so nl80211 emits the dedicated NL80211_CMD_PORT_AUTHORIZED event instead of reusing the reserved NL80211_ATTR_PORT_AUTHORIZED flag in CONNECT/ROAM notifications.

---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c         | 65 ++++++++++++++++++++--
 1 file changed, 60 insertions(+), 5 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +60 -5
index f2916cc9e5fc..c11b3eac9d47 100644
@@ -6466,6 +6466,47 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
 	return err;
 }
 
+static bool brcmf_has_pmkid(const u8 *parse, u32 len)
+{
+	const struct brcmf_tlv *rsn_ie;
+	const u8 *ie;
+	u32 ie_len;
+	u32 offset;
+	u16 count;
+
+	if (!parse)
+		return false;
+
+	rsn_ie = brcmf_parse_tlvs(parse, len, WLAN_EID_RSN);
+	if (!rsn_ie)
+		return false;
+
+	ie = (const u8 *)rsn_ie;
+	ie_len = rsn_ie->len + TLV_HDR_LEN;
+
+	offset = TLV_HDR_LEN + WPA_IE_VERSION_LEN + WPA_IE_MIN_OUI_LEN;
+	if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
+		return false;
+
+	count = ie[offset] + (ie[offset + 1] << 8);
+	offset += WPA_IE_SUITE_COUNT_LEN + count * WPA_IE_MIN_OUI_LEN;
+	if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
+		return false;
+
+	count = ie[offset] + (ie[offset + 1] << 8);
+	offset += WPA_IE_SUITE_COUNT_LEN + count * WPA_IE_MIN_OUI_LEN;
+	if (offset + RSN_CAP_LEN >= ie_len)
+		return false;
+
+	offset += RSN_CAP_LEN;
+	if (offset + RSN_PMKID_COUNT_LEN > ie_len)
+		return false;
+
+	count = ie[offset] + (ie[offset + 1] << 8);
+
+	return count > 0;
+}
+
 static s32
 brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
 		       struct net_device *ndev,
@@ -6480,6 +6521,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
 	struct brcmf_bss_info_le *bi;
 	struct brcmu_chan ch;
 	struct cfg80211_roam_info roam_info = {};
+	bool authorized = false;
 	u32 freq;
 	s32 err = 0;
 	u8 *buf;
@@ -6526,14 +6568,18 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
 	roam_info.resp_ie = conn_info->resp_ie;
 	roam_info.resp_ie_len = conn_info->resp_ie_len;
 
+	if ((profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X ||
+	     profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM) &&
+	    (brcmf_has_pmkid(roam_info.req_ie, roam_info.req_ie_len) ||
+	     profile->is_ft || profile->is_okc))
+		authorized = true;
+
 	cfg80211_roamed(ndev, &roam_info, GFP_KERNEL);
+	if (authorized)
+		cfg80211_port_authorized(ndev, profile->bssid, NULL, 0,
+					 GFP_KERNEL);
 	brcmf_dbg(CONN, "Report roaming result\n");
 
-	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) {
-		cfg80211_port_authorized(ndev, profile->bssid, NULL, 0, GFP_KERNEL);
-		brcmf_dbg(CONN, "Report port authorized\n");
-	}
-
 	set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state);
 	brcmf_dbg(TRACE, "Exit\n");
 	return err;
@@ -6548,6 +6594,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
 	struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
 	struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
 	struct cfg80211_connect_resp_params conn_params;
+	bool authorized;
 
 	brcmf_dbg(TRACE, "Enter\n");
 
@@ -6572,7 +6619,15 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
 		conn_params.req_ie_len = conn_info->req_ie_len;
 		conn_params.resp_ie = conn_info->resp_ie;
 		conn_params.resp_ie_len = conn_info->resp_ie_len;
+		authorized = completed &&
+			     (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X ||
+			      profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM) &&
+			     brcmf_has_pmkid(conn_params.req_ie,
+					     conn_params.req_ie_len);
 		cfg80211_connect_done(ndev, &conn_params, GFP_KERNEL);
+		if (authorized)
+			cfg80211_port_authorized(ndev, profile->bssid, NULL, 0,
+						 GFP_KERNEL);
 		brcmf_dbg(CONN, "Report connect result - connection %s\n",
 			  completed ? "succeeded" : "failed");
 	}
Signature · 1 line
2.25.1
maintainer
#11 lore raw
In reply to Jason Huang
Quoted 13 lines · Jason Huang

From: Carella Chen <[email protected]>

This series adds the cfg80211/nl80211 and brcmfmac pieces needed to support firmware-assisted FT/OKC roaming offload.

Patch 1 adds an nl80211 extended feature bit so drivers can advertise roaming PMK programming support without claiming full 802.1X 4-way handshake offload. The brcmfmac patches then detect firmware FBT/OKC capabilities, keep roaming-offload connections in a firmware-supplicant profile state, program PMK material for FT/OKC roaming, report port authorization after offloaded roaming, and advertise the new capability when firmware support is present.

Quoted 9 lines

Changes in v5:
- Reworked nl80211_set_pmk() to avoid the 80-column checkpatch warning on the 4-way handshake extended-feature check.
- Added kernel-doc for the brcmfmac OKC profile state added by the PMK programming patch.
- Normalized Assisted-by trailers to the checkpatch-accepted AGENT_NAME:MODEL_VERSION format.
- Added Johannes and the wireless/brcm80211 lists to the cover letter Cc list for the nl80211 and brcmfmac changes.

Hi Jason,

Thanks for the follow-up, but looks like it happened again. Missing patch 5/5 as happened with v3 series.

Regards,
Arend

maintainer
#12 lore raw
Quoted 24 lines · Arend van Spriel
Quoted 13 lines · Jason Huang

From: Carella Chen <[email protected]>

This series adds the cfg80211/nl80211 and brcmfmac pieces needed to support firmware-assisted FT/OKC roaming offload.

Patch 1 adds an nl80211 extended feature bit so drivers can advertise roaming PMK programming support without claiming full 802.1X 4-way handshake offload. The brcmfmac patches then detect firmware FBT/OKC capabilities, keep roaming-offload connections in a firmware-supplicant profile state, program PMK material for FT/OKC roaming, report port authorization after offloaded roaming, and advertise the new capability when firmware support is present.

Quoted 9 lines

Changes in v5:
- Reworked nl80211_set_pmk() to avoid the 80-column checkpatch warning on the 4-way handshake extended-feature check.
- Added kernel-doc for the brcmfmac OKC profile state added by the PMK programming patch.
- Normalized Assisted-by trailers to the checkpatch-accepted AGENT_NAME:MODEL_VERSION format.
- Added Johannes and the wireless/brcm80211 lists to the cover letter Cc list for the nl80211 and brcmfmac changes.

Quoted 3 lines

Hi Jason,

Thanks for the follow-up, but looks like it happened again. Missing patch 5/5 as happened with v3 series.

I do have other comment(s) for v5 series, but feel free to send the missing patch so I can review that in one go.

Regards,
Arend

#13 lore raw

Hi Arend,

Quoted 4 lines · Arend van Spriel
Quoted 2 lines

Thanks for the follow-up, but looks like it happened again. Missing patch 5/5 as happened with v3 series.

I do have other comment(s) for v5 series, but feel free to send the missing patch so I can review that in one go.

Thanks for pointing this out, and sorry for the noise.

This seems to be an issue with our SMTP / mail gateway. I will make sure we verify that all patches are successfully received in Patchwork for future submissions.

I have re-sent patch 5/5, threaded to the original v5 cover letter:
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

Thank you.

#14 lore raw

PATCH v5 5/5 wifi: brcmfmac: advertise firmware roam offload support

In reply to Jason Huang

From: Carella Chen <[email protected]>

Advertise NL80211_EXT_FEATURE_ROAM_OFFLOAD only when firmware reports FBT or OKC support. That lets userspace provide PMK material for firmware roaming without enabling the path on devices that cannot complete the offloaded roam.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 -0
index c11b3eac9d47..6a97be3149fc 100644
@@ -7830,6 +7830,10 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
 	}
 	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SAE_EXT))
 		wiphy->features |= NL80211_FEATURE_SAE;
+	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FBT) ||
+	    brcmf_feat_is_enabled(ifp, BRCMF_FEAT_OKC))
+		wiphy_ext_feature_set(wiphy,
+				      NL80211_EXT_FEATURE_ROAM_OFFLOAD);
 	wiphy->mgmt_stypes = brcmf_txrx_stypes;
 	wiphy->max_remain_on_channel_duration = 5000;
 	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) {
Signature · 1 line
2.25.1
#15 lore raw

v6 cover wifi: brcmfmac: add FT/OKC fast roaming offload support

In reply to Jason Huang

From: Jason Huang <[email protected]>

Hi,

This series adds nl80211 and brcmfmac support for firmware fast roaming offload covering FT and OKC.

Some Broadcom/Infineon firmware can offload FT or OKC roaming without advertising full 802.1X 4-way handshake offload. The series adds a new nl80211 extended feature bit for this capability, lets userspace install and delete PMK material when the driver advertises it, and wires the capability through brcmfmac based on firmware FBT/OKC support.

For brcmfmac, the series tracks FBT and OKC firmware capabilities, keeps the firmware supplicant profile state distinct for roaming offload, passes PMK material to firmware for FT/OKC, and reports port authorization after successful offloaded roaming.

Changes in v6:
- Rename the nl80211 extended feature to NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD to better describe that userspace offloads fast-roaming handling to the driver/firmware. The feature covers both FT and OKC.
- Reorder the nl80211 PMK capability checks to avoid the line-length warning.
- Allow nl80211_del_pmk() for FAST_ROAM_OFFLOAD-only drivers, matching nl80211_set_pmk(), so userspace can delete PMK material it was allowed to install.

Carella Chen (3):
wifi: nl80211: add fast roam offload extended feature
wifi: brcmfmac: detect firmware FBT and OKC support
wifi: brcmfmac: advertise firmware fast roam offload support

Darren Li (2):
wifi: brcmfmac: add PMK programming for firmware roaming offload
wifi: brcmfmac: report port authorization after offloaded roaming

 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 125 ++++++++++++++++--
 .../broadcom/brcm80211/brcmfmac/cfg80211.h    |   5 +-
 .../broadcom/brcm80211/brcmfmac/feature.c     |   2 +
 .../broadcom/brcm80211/brcmfmac/feature.h     |   4 +-
 include/uapi/linux/nl80211.h                  |   5 +
 net/wireless/nl80211.c                        |  10 +-
 6 files changed, 136 insertions(+), 15 deletions(-)
Signature · 1 line
2.25.1
#16 lore raw

PATCH v6 1/5 wifi: nl80211: add fast roam offload extended feature

From: Carella Chen <[email protected]>

Drivers can offload FT or OKC roaming without necessarily advertising full 802.1X 4-way handshake offload. Add an extended feature bit for that capability and allow PMK configuration when it is present.

This gives userspace a way to provide PMK or PMK-R0 material needed by fast roaming firmware implementations while keeping the existing 4-way handshake offload capability unchanged.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
 include/uapi/linux/nl80211.h |  5 +++++
 net/wireless/nl80211.c       | 10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
include/uapi/linux/nl80211.h +5 -0
index 020387d76412..920d5e2d9966 100644
@@ -7110,6 +7110,10 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_PROBE_AP: Driver supports probing the associated AP
  *	in STA mode using @NL80211_CMD_PROBE_PEER.
  *
+ * @NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD: Driver supports fast roaming
+ *	offload in station mode, including Fast Transition or Opportunistic
+ *	Key Caching.
+ *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -7192,6 +7196,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_ROC_ADDR_FILTER,
 	NL80211_EXT_FEATURE_SET_KEY_LTF_SEED,
 	NL80211_EXT_FEATURE_PROBE_AP,
+	NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c +8 -2
index 44f2bad08670..e4850129a582 100644
@@ -18434,6 +18434,7 @@ static int nl80211_set_multicast_to_unicast(struct sk_buff *skb,
 static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct wiphy *wiphy = &rdev->wiphy;
 	struct net_device *dev = info->user_ptr[1];
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct cfg80211_pmk_conf pmk_conf = {};
@@ -18442,7 +18443,9 @@ static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
 	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
 		return -EOPNOTSUPP;
 
-	if (!wiphy_ext_feature_isset(&rdev->wiphy,
+	if (!wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD) &&
+	    !wiphy_ext_feature_isset(wiphy,
 				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X))
 		return -EOPNOTSUPP;
 
@@ -18472,6 +18475,7 @@ static int nl80211_set_pmk(struct sk_buff *skb, struct genl_info *info)
 static int nl80211_del_pmk(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct wiphy *wiphy = &rdev->wiphy;
 	struct net_device *dev = info->user_ptr[1];
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	const u8 *aa;
@@ -18480,7 +18484,9 @@ static int nl80211_del_pmk(struct sk_buff *skb, struct genl_info *info)
 	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
 		return -EOPNOTSUPP;
 
-	if (!wiphy_ext_feature_isset(&rdev->wiphy,
+	if (!wiphy_ext_feature_isset(wiphy,
+				     NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD) &&
+	    !wiphy_ext_feature_isset(wiphy,
 				     NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X))
 		return -EOPNOTSUPP;
 
Signature · 1 line
2.25.1
maintainer Acked-by on v6 1/5
#17 lore raw

Re: [PATCH v6 1/5] wifi: nl80211: add fast roam offload extended feature

Quoted 11 lines · Jason Huang

From: Carella Chen <[email protected]>

Drivers can offload FT or OKC roaming without necessarily advertising full 802.1X 4-way handshake offload. Add an extended feature bit for that capability and allow PMK configuration when it is present.

This gives userspace a way to provide PMK or PMK-R0 material needed by fast roaming firmware implementations while keeping the existing 4-way handshake offload capability unchanged.

Assisted-by GitHub-Copilot-CLI:gpt-5.5

Regards,
Arend

Quoted 6 lines
---
 include/uapi/linux/nl80211.h | 5 +++++
 net/wireless/nl80211.c       | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
#18 lore raw

PATCH v6 2/5 wifi: brcmfmac: detect firmware FBT and OKC support

In reply to Jason Huang

From: Carella Chen <[email protected]>

Some firmware advertises Fast BSS Transition and Opportunistic Key Caching support through the firmware capability string. Track those capabilities so later roaming offload handling can be enabled only when firmware reports support.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 2 ++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +2 -0
index 488364ef8ff2..cc19e5e7ebf5 100644
@@ -45,6 +45,8 @@ static const struct brcmf_feat_fwcap brcmf_fwcap_map[] = {
 	{ BRCMF_FEAT_SAE, "sae " },
 	{ BRCMF_FEAT_FWAUTH, "idauth" },
 	{ BRCMF_FEAT_SAE_EXT, "sae_ext" },
+	{ BRCMF_FEAT_FBT, "fbt " },
+	{ BRCMF_FEAT_OKC, "okc" },
 };
 
 #ifdef DEBUG
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +3 -1
index 31f8695ca417..8165a286b630 100644
@@ -59,7 +59,9 @@
 	BRCMF_FEAT_DEF(SCAN_V2) \
 	BRCMF_FEAT_DEF(PMKID_V2) \
 	BRCMF_FEAT_DEF(PMKID_V3) \
-	BRCMF_FEAT_DEF(SAE_EXT)
+	BRCMF_FEAT_DEF(SAE_EXT) \
+	BRCMF_FEAT_DEF(FBT) \
+	BRCMF_FEAT_DEF(OKC)
 
 /*
  * Quirks:
Signature · 1 line
2.25.1
maintainer Acked-by on v6 2/5
#19 lore raw

Re: [PATCH v6 2/5] wifi: brcmfmac: detect firmware FBT and OKC support

Quoted 8 lines · Jason Huang

From: Carella Chen <[email protected]>

Some firmware advertises Fast BSS Transition and Opportunistic Key Caching support through the firmware capability string. Track those capabilities so later roaming offload handling can be enabled only when firmware reports support.

Assisted-by GitHub-Copilot-CLI:gpt-5.5

Regards,
Arend

Quoted 6 lines
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 2 ++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
#20 lore raw

PATCH v6 3/5 wifi: brcmfmac: add PMK programming for firmware roaming offload

In reply to Jason Huang

From: Darren Li <[email protected]>

FT and OKC roaming offload need PMK material in firmware even when the initial 802.1X exchange is handled by userspace. Add a roaming firmware-supplicant profile state for those connections and allow PMK configuration while firmware FT or OKC state is active.

Program the OKC PMK through the okc_info_pmk iovar before setting the regular PMK when firmware reports OKC state. Only select the roaming firmware-supplicant state when firmware advertises FBT or OKC support; devices without those capabilities keep the profile in the userspace supplicant state and do not issue roaming-offload specific iovars on every connect.

For FT-PSK with firmware supplicant support, keep the profile in the PSK firmware-supplicant state.

---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 56 +++++++++++++++++--
 .../broadcom/brcm80211/brcmfmac/cfg80211.h    |  5 +-
 2 files changed, 54 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +50 -6
index 872c48806d09..f2916cc9e5fc 100644
@@ -2112,9 +2112,11 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 	struct brcmf_pub *drvr = ifp->drvr;
 	s32 val;
 	s32 err;
+	s32 okc_enable;
 	const struct brcmf_tlv *rsn_ie;
 	const u8 *ie;
 	u32 ie_len;
+	bool fwsup_roam;
 	u32 offset;
 	u16 rsn_cap;
 	u32 mfp;
@@ -2122,6 +2124,9 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 
 	profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
 	profile->is_ft = false;
+	profile->is_okc = false;
+	fwsup_roam = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FBT) ||
+		     brcmf_feat_is_enabled(ifp, BRCMF_FEAT_OKC);
 
 	if (!sme->crypto.n_akm_suites)
 		return 0;
@@ -2138,6 +2143,8 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 			val = WPA_AUTH_UNSPECIFIED;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_PSK:
 			val = WPA_AUTH_PSK;
@@ -2153,11 +2160,15 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 			val = WPA2_AUTH_UNSPECIFIED;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_8021X_SHA256:
 			val = WPA2_AUTH_1X_SHA256;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_PSK_SHA256:
 			val = WPA2_AUTH_PSK_SHA256;
@@ -2170,10 +2181,16 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 			profile->is_ft = true;
 			if (sme->want_1x)
 				profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_FT_PSK:
 			val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
 			profile->is_ft = true;
+			if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FWSUP))
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
+			else if (fwsup_roam)
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_ROAM;
 			break;
 		case WLAN_AKM_SUITE_WFA_DPP:
 			val = WFA_AUTH_DPP;
@@ -2204,8 +2221,22 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
 
 	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X)
 		brcmf_dbg(INFO, "using 1X offload\n");
+
+	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X ||
+	    profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM) {
+		err = brcmf_fil_bsscfg_int_get(ifp, "okc_enable",
+					       &okc_enable);
+		if (err) {
+			bphy_err(drvr, "get okc_enable failed (%d)\n", err);
+		} else {
+			brcmf_dbg(INFO, "okc_enable (%d)\n", okc_enable);
+			profile->is_okc = okc_enable;
+		}
+	}
 	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE)
 		brcmf_dbg(INFO, "using SAE offload\n");
+	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM)
+		brcmf_dbg(INFO, "using roaming offload\n");
 
 	if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
 		goto skip_mfp_config;
@@ -2494,13 +2525,14 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
 
 		if (sme->crypto.psk && !is_sae_akm &&
 		    profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
-			if (WARN_ON(profile->use_fwsup !=
-				    BRCMF_PROFILE_FWSUP_NONE)) {
+			if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_NONE) {
+				brcmf_dbg(INFO, "using PSK offload\n");
+				profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
+			} else if (WARN_ON(profile->use_fwsup !=
+					   BRCMF_PROFILE_FWSUP_PSK)) {
 				err = -EINVAL;
 				goto done;
 			}
-			brcmf_dbg(INFO, "using PSK offload\n");
-			profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
 		}
 		if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
 			/* enable firmware supplicant for this interface */
@@ -5953,17 +5985,29 @@ static int brcmf_cfg80211_set_pmk(struct wiphy *wiphy, struct net_device *dev,
 				  const struct cfg80211_pmk_conf *conf)
 {
 	struct brcmf_if *ifp;
+	struct brcmf_pub *drvr;
+	int ret;
 
 	brcmf_dbg(TRACE, "enter\n");
 
-	/* expect using firmware supplicant for 1X */
 	ifp = netdev_priv(dev);
-	if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X))
+	drvr = ifp->drvr;
+	if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X &&
+		    !ifp->vif->profile.is_ft &&
+		    !ifp->vif->profile.is_okc))
 		return -EINVAL;
 
 	if (conf->pmk_len > BRCMF_WSEC_MAX_PSK_LEN)
 		return -ERANGE;
 
+	if (ifp->vif->profile.is_okc) {
+		ret = brcmf_fil_iovar_data_set(ifp, "okc_info_pmk",
+					       conf->pmk, conf->pmk_len);
+		if (ret < 0)
+			bphy_err(drvr, "okc_info_pmk iovar failed: ret=%d\n",
+				 ret);
+	}
+
 	return brcmf_set_pmk(ifp, conf->pmk, conf->pmk_len);
 }
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +4 -1
index 63e534523f51..1aa99390a951 100644
@@ -127,7 +127,8 @@ enum brcmf_profile_fwsup {
 	BRCMF_PROFILE_FWSUP_NONE,
 	BRCMF_PROFILE_FWSUP_PSK,
 	BRCMF_PROFILE_FWSUP_1X,
-	BRCMF_PROFILE_FWSUP_SAE
+	BRCMF_PROFILE_FWSUP_SAE,
+	BRCMF_PROFILE_FWSUP_ROAM
 };
 
 /**
@@ -164,6 +165,7 @@ enum brcmf_mgmt_tx_status {
  * @bssid: bssid of joined/joining ibss.
  * @sec: security information.
  * @key: key information
+ * @is_okc: OKC is used for current connection.
  */
 struct brcmf_cfg80211_profile {
 	u8 bssid[ETH_ALEN];
@@ -172,6 +174,7 @@ struct brcmf_cfg80211_profile {
 	enum brcmf_profile_fwsup use_fwsup;
 	u16 use_fwauth;
 	bool is_ft;
+	bool is_okc;
 };
 
 /**
Signature · 1 line
2.25.1
maintainer Acked-by on v6 3/5
#21 lore raw

Re: [PATCH v6 3/5] wifi: brcmfmac: add PMK programming for firmware roaming offload

Quoted 3 lines · Jason Huang

From: Darren Li <[email protected]>

FT and OKC roaming offload need PMK material in firmware even when

[...]

Quoted 4 lines

For FT-PSK with firmware supplicant support, keep the profile in the PSK firmware-supplicant state.

Assisted-by GitHub-Copilot-CLI:gpt-5.5

Regards,
Arend

Quoted 12 lines
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h |  5 ++++-
 2 files changed, 52 insertions(+), 9 deletions(-)
#22 lore raw

PATCH v6 4/5 wifi: brcmfmac: report port authorization after offloaded roaming

In reply to Jason Huang

From: Darren Li <[email protected]>

Firmware can complete FT or OKC roaming before the driver reports the connect or roam event to cfg80211. Detect those successful offloaded cases when the profile uses firmware 1X or roaming offload and the association request carries PMK cache state, FT is in use, or OKC is enabled.

After reporting the connect or roam event, call cfg80211_port_authorized() so nl80211 emits the dedicated NL80211_CMD_PORT_AUTHORIZED event instead of reusing the reserved NL80211_ATTR_PORT_AUTHORIZED flag in CONNECT/ROAM notifications.

---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 65 +++++++++++++++++--
 1 file changed, 60 insertions(+), 5 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +60 -5
index f2916cc9e5fc..c11b3eac9d47 100644
@@ -6466,6 +6466,47 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
 	return err;
 }
 
+static bool brcmf_has_pmkid(const u8 *parse, u32 len)
+{
+	const struct brcmf_tlv *rsn_ie;
+	const u8 *ie;
+	u32 ie_len;
+	u32 offset;
+	u16 count;
+
+	if (!parse)
+		return false;
+
+	rsn_ie = brcmf_parse_tlvs(parse, len, WLAN_EID_RSN);
+	if (!rsn_ie)
+		return false;
+
+	ie = (const u8 *)rsn_ie;
+	ie_len = rsn_ie->len + TLV_HDR_LEN;
+
+	offset = TLV_HDR_LEN + WPA_IE_VERSION_LEN + WPA_IE_MIN_OUI_LEN;
+	if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
+		return false;
+
+	count = ie[offset] + (ie[offset + 1] << 8);
+	offset += WPA_IE_SUITE_COUNT_LEN + count * WPA_IE_MIN_OUI_LEN;
+	if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
+		return false;
+
+	count = ie[offset] + (ie[offset + 1] << 8);
+	offset += WPA_IE_SUITE_COUNT_LEN + count * WPA_IE_MIN_OUI_LEN;
+	if (offset + RSN_CAP_LEN >= ie_len)
+		return false;
+
+	offset += RSN_CAP_LEN;
+	if (offset + RSN_PMKID_COUNT_LEN > ie_len)
+		return false;
+
+	count = ie[offset] + (ie[offset + 1] << 8);
+
+	return count > 0;
+}
+
 static s32
 brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
 		       struct net_device *ndev,
@@ -6480,6 +6521,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
 	struct brcmf_bss_info_le *bi;
 	struct brcmu_chan ch;
 	struct cfg80211_roam_info roam_info = {};
+	bool authorized = false;
 	u32 freq;
 	s32 err = 0;
 	u8 *buf;
@@ -6526,14 +6568,18 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
 	roam_info.resp_ie = conn_info->resp_ie;
 	roam_info.resp_ie_len = conn_info->resp_ie_len;
 
+	if ((profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X ||
+	     profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM) &&
+	    (brcmf_has_pmkid(roam_info.req_ie, roam_info.req_ie_len) ||
+	     profile->is_ft || profile->is_okc))
+		authorized = true;
+
 	cfg80211_roamed(ndev, &roam_info, GFP_KERNEL);
+	if (authorized)
+		cfg80211_port_authorized(ndev, profile->bssid, NULL, 0,
+					 GFP_KERNEL);
 	brcmf_dbg(CONN, "Report roaming result\n");
 
-	if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) {
-		cfg80211_port_authorized(ndev, profile->bssid, NULL, 0, GFP_KERNEL);
-		brcmf_dbg(CONN, "Report port authorized\n");
-	}
-
 	set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state);
 	brcmf_dbg(TRACE, "Exit\n");
 	return err;
@@ -6548,6 +6594,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
 	struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
 	struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
 	struct cfg80211_connect_resp_params conn_params;
+	bool authorized;
 
 	brcmf_dbg(TRACE, "Enter\n");
 
@@ -6572,7 +6619,15 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
 		conn_params.req_ie_len = conn_info->req_ie_len;
 		conn_params.resp_ie = conn_info->resp_ie;
 		conn_params.resp_ie_len = conn_info->resp_ie_len;
+		authorized = completed &&
+			     (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X ||
+			      profile->use_fwsup == BRCMF_PROFILE_FWSUP_ROAM) &&
+			     brcmf_has_pmkid(conn_params.req_ie,
+					     conn_params.req_ie_len);
 		cfg80211_connect_done(ndev, &conn_params, GFP_KERNEL);
+		if (authorized)
+			cfg80211_port_authorized(ndev, profile->bssid, NULL, 0,
+						 GFP_KERNEL);
 		brcmf_dbg(CONN, "Report connect result - connection %s\n",
 			  completed ? "succeeded" : "failed");
 	}
Signature · 1 line
2.25.1
maintainer Acked-by on v6 4/5
#23 lore raw

Re: [PATCH v6 4/5] wifi: brcmfmac: report port authorization after offloaded roaming

Quoted 8 lines · Jason Huang

From: Darren Li <[email protected]>

Firmware can complete FT or OKC roaming before the driver reports the connect or roam event to cfg80211. Detect those successful offloaded cases when the profile uses firmware 1X or roaming offload and the association request carries PMK cache state, FT is in use, or OKC is enabled.

Quoted 6 lines

After reporting the connect or roam event, call cfg80211_port_authorized() so nl80211 emits the dedicated NL80211_CMD_PORT_AUTHORIZED event instead of reusing the reserved NL80211_ATTR_PORT_AUTHORIZED flag in CONNECT/ROAM notifications.

Assisted-by GitHub-Copilot-CLI:gpt-5.5

Regards,
Arend

Quoted 8 lines
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 56 insertions(+), 5 deletions(-)
#24 lore raw

PATCH v6 5/5 wifi: brcmfmac: advertise firmware fast roam offload support

In reply to Jason Huang

From: Carella Chen <[email protected]>

Advertise NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD only when firmware reports FBT or OKC support. That lets userspace provide PMK material for firmware fast roaming without enabling the path on devices that cannot complete the offloaded roam.

Assisted-by GitHub-Copilot-CLI:gpt-5.5
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 -0
index c11b3eac9d47..519de96b042e 100644
@@ -7830,6 +7830,10 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
 	}
 	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SAE_EXT))
 		wiphy->features |= NL80211_FEATURE_SAE;
+	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FBT) ||
+	    brcmf_feat_is_enabled(ifp, BRCMF_FEAT_OKC))
+		wiphy_ext_feature_set(wiphy,
+				      NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD);
 	wiphy->mgmt_stypes = brcmf_txrx_stypes;
 	wiphy->max_remain_on_channel_duration = 5000;
 	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) {
Signature · 1 line
2.25.1
maintainer Acked-by on v6 5/5
#25 lore raw

Re: [PATCH v6 5/5] wifi: brcmfmac: advertise firmware fast roam offload support

Quoted 8 lines · Jason Huang

From: Carella Chen <[email protected]>

Advertise NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD only when firmware reports FBT or OKC support. That lets userspace provide PMK material for firmware fast roaming without enabling the path on devices that cannot complete the offloaded roam.

Assisted-by GitHub-Copilot-CLI:gpt-5.5

Regards,
Arend

Quoted 5 lines
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
 1 file changed, 4 insertions(+)