From f2957c0b62a48397248a3b9bd39a10a85a018439 Mon Sep 17 00:00:00 2001
From: Carter Chen <carter.chen@infineon.com>
Date: Sun, 8 Sep 2024 21:54:27 -0500
Subject: [PATCH 290/301] non-upstream: fix set/del pmksa fail on kernel 6.6

Revert "wifi: brcmfmac: cfg80211: Add support for PMKID_V3 operations"

This reverts commit a96202acaea47fa8377088e0952bb63bd02a3bab.


Signed-off-by: Carter Chen <carter.chen@infineon.com>
---
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index b2609b789..cb2059d24 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -4968,47 +4968,6 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
 	return 0;
 }
 
-static s32
-brcmf_pmksa_v3_op(struct brcmf_if *ifp, struct cfg80211_pmksa *pmksa,
-		  bool alive)
-{
-	struct brcmf_pmk_op_v3_le *pmk_op;
-	int length = offsetof(struct brcmf_pmk_op_v3_le, pmk);
-	int ret;
-
-	pmk_op = kzalloc(sizeof(*pmk_op), GFP_KERNEL);
-	if (!pmk_op)
-		return -ENOMEM;
-
-	pmk_op->version = cpu_to_le16(BRCMF_PMKSA_VER_3);
-
-	if (!pmksa) {
-		/* Flush operation, operate on entire list */
-		pmk_op->count = cpu_to_le16(0);
-	} else {
-		/* Single PMK operation */
-		pmk_op->count = cpu_to_le16(1);
-		length += sizeof(struct brcmf_pmksa_v3);
-		if (pmksa->bssid)
-			memcpy(pmk_op->pmk[0].bssid, pmksa->bssid, ETH_ALEN);
-		if (pmksa->pmkid) {
-			memcpy(pmk_op->pmk[0].pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
-			pmk_op->pmk[0].pmkid_len = WLAN_PMKID_LEN;
-		}
-		if (pmksa->ssid && pmksa->ssid_len) {
-			memcpy(pmk_op->pmk[0].ssid.SSID, pmksa->ssid, pmksa->ssid_len);
-			pmk_op->pmk[0].ssid.SSID_len = pmksa->ssid_len;
-		}
-		pmk_op->pmk[0].time_left = cpu_to_le32(alive ? BRCMF_PMKSA_NO_EXPIRY : 0);
-	}
-
-	pmk_op->length = cpu_to_le16(length);
-
-	ret = brcmf_fil_iovar_data_set(ifp, "pmkid_info", pmk_op, sizeof(*pmk_op));
-	kfree(pmk_op);
-	return ret;
-}
-
 static __used s32
 brcmf_update_pmklist(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp)
 {
@@ -5109,10 +5068,6 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
 	brcmf_dbg(CONN, "set_pmksa - PMK bssid: %pM =\n", pmksa->bssid);
 	brcmf_dbg(CONN, "%*ph\n", WLAN_PMKID_LEN, pmksa->pmkid);
 
-	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PMKID_V3))
-		return brcmf_pmksa_v3_op(ifp, pmksa, true);
-
-	/* TODO: implement PMKID_V2 */
 	err = brcmf_update_pmksa(cfg, ifp, pmksa->bssid, pmksa->pmkid, PMKSA_SET);
 	if (err < 0) {
 		bphy_err(drvr,
@@ -5153,9 +5108,6 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
 
 	brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid);
 
-	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PMKID_V3))
-		return brcmf_pmksa_v3_op(ifp, pmksa, false);
-
 	/* TODO: implement PMKID_V2 */
 	err = brcmf_update_pmksa(cfg, ifp, pmksa->bssid, pmksa->pmkid, PMKSA_DELETE);
 	if (err < 0) {
@@ -5180,11 +5132,6 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
 	if (!check_vif_up(ifp->vif))
 		return -EIO;
 
-	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PMKID_V3))
-		return brcmf_pmksa_v3_op(ifp, NULL, false);
-
-	/* TODO: implement PMKID_V2 */
-
 	memset(&cfg->pmk_list, 0, sizeof(cfg->pmk_list));
 	err = brcmf_update_pmklist(cfg, ifp);
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
index bf6b32104..3c9c323e2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
@@ -426,12 +426,6 @@ struct brcmf_ssid_le {
 	unsigned char SSID[IEEE80211_MAX_SSID_LEN];
 };
 
-/* Alternate SSID structure used in some places... */
-struct brcmf_ssid8_le {
-	u8 SSID_len;
-	unsigned char SSID[IEEE80211_MAX_SSID_LEN];
-};
-
 struct brcmf_scan_params_le {
 	struct brcmf_ssid_le ssid_le;	/* default: {0, ""} */
 	u8 bssid[ETH_ALEN];	/* default: bcast */
@@ -1003,51 +997,6 @@ struct brcmf_pmksa {
 	u8 pmkid[WLAN_PMKID_LEN];
 };
 
-/**
- * struct brcmf_pmksa_v2 - PMK Security Association
- *
- * @length: Length of the structure.
- * @bssid: The AP's BSSID.
- * @pmkid: The PMK ID.
- * @pmk: PMK material for FILS key derivation.
- * @pmk_len: Length of PMK data.
- * @ssid: The AP's SSID.
- * @fils_cache_id: FILS cache identifier
- */
-struct brcmf_pmksa_v2 {
-	__le16 length;
-	u8 bssid[ETH_ALEN];
-	u8 pmkid[WLAN_PMKID_LEN];
-	u8 pmk[WLAN_PMK_LEN_SUITE_B_192];
-	__le16 pmk_len;
-	struct brcmf_ssid8_le ssid;
-	u16 fils_cache_id;
-};
-
-/**
- * struct brcmf_pmksa_v3 - PMK Security Association
- *
- * @bssid: The AP's BSSID.
- * @pmkid: The PMK ID.
- * @pmkid_len: The length of the PMK ID.
- * @pmk: PMK material for FILS key derivation.
- * @pmk_len: Length of PMK data.
- * @fils_cache_id: FILS cache identifier
- * @ssid: The AP's SSID.
- * @time_left: Remaining time until expiry. 0 = expired, ~0 = no expiry.
- */
-struct brcmf_pmksa_v3 {
-	u8 bssid[ETH_ALEN];
-	u8 pmkid[WLAN_PMKID_LEN];
-	u8 pmkid_len;
-	u8 pmk[WLAN_PMK_LEN_SUITE_B_192];
-	u8 pmk_len;
-	__le16 fils_cache_id;
-	u8 pad;
-	struct brcmf_ssid8_le ssid;
-	__le32 time_left;
-};
-
 /**
  * struct brcmf_pmk_list_le - List of pmksa's.
  *
@@ -1059,34 +1008,6 @@ struct brcmf_pmk_list_le {
 	struct brcmf_pmksa pmk[BRCMF_MAXPMKID];
 };
 
-/**
- * struct brcmf_pmk_list_v2_le - List of pmksa's.
- *
- * @version: Request version.
- * @length: Length of this structure.
- * @pmk: PMK SA information.
- */
-struct brcmf_pmk_list_v2_le {
-	__le16 version;
-	__le16 length;
-	struct brcmf_pmksa_v2 pmk[BRCMF_MAXPMKID];
-};
-
-/**
- * struct brcmf_pmk_op_v3_le - Operation on PMKSA list.
- *
- * @version: Request version.
- * @length: Length of this structure.
- * @pmk: PMK SA information.
- */
-struct brcmf_pmk_op_v3_le {
-	__le16 version;
-	__le16 length;
-	__le16 count;
-	__le16 pad;
-	struct brcmf_pmksa_v3 pmk[BRCMF_MAXPMKID];
-};
-
 /**
  * struct brcmf_pno_param_le - PNO scan configuration parameters
  *
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 89816be02..1f90b3dc1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -734,7 +734,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on)
 	unsigned long start_jiffy = 0;
 	unsigned int kso_loop_time = 0;
 
-	brcmf_dbg(TRACE, "Enter: on=%d\n", on);
+	brcmf_dbg(SDIO, "Enter: on=%d\n", on);
 
 	sdio_retune_crc_disable(bus->sdiodev->func1);
 
@@ -4037,7 +4037,7 @@ void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
 
 void brcmf_sdio_isr(struct brcmf_sdio *bus, bool in_isr)
 {
-	brcmf_dbg(TRACE, "Enter\n");
+	brcmf_dbg(SDIO, "Enter\n");
 
 	if (!bus) {
 		brcmf_err("bus is null pointer, exiting\n");
