1 From 4c1d4af0ac83705828dd11fded409163a87ea515 Mon Sep 17 00:00:00 2001
2 From: Kurt Lee <kurt.lee@cypress.com>
3 Date: Thu, 20 Aug 2020 03:07:02 -0500
4 Subject: [PATCH] brcmfmac: Fix interoperating DPP and other encryption network
7 1. If firmware supports 4-way handshake offload but not supports DPP
8 4-way offload, when user first connects encryption network, driver will
9 set "sup_wpa 1" to firmware, but it will further result in DPP
10 connection failure since firmware won't send EAPOL frame to host.
12 2. Fix DPP AP mode handling action frames.
14 3. For some firmware without fwsup support, the join procedure will be
15 skipped due to "sup_wpa" iovar returning not-support. Check the fwsup
16 feature before do such iovar.
18 Signed-off-by: Kurt Lee <kurt.lee@cypress.com>
19 Signed-off-by: Double Lo <double.lo@cypress.com>
20 Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
22 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 67 ++++++++++---------
23 .../broadcom/brcm80211/brcmfmac/p2p.c | 5 ++
24 2 files changed, 42 insertions(+), 30 deletions(-)
26 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
27 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
28 @@ -2491,43 +2491,50 @@ brcmf_cfg80211_connect(struct wiphy *wip
32 - if (sme->crypto.psk &&
33 - profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
34 - if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) {
37 + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FWSUP)) {
38 + if (sme->crypto.psk) {
39 + if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
40 + if (WARN_ON(profile->use_fwsup !=
41 + BRCMF_PROFILE_FWSUP_NONE)) {
45 + brcmf_dbg(INFO, "using PSK offload\n");
46 + profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
49 + profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
51 - brcmf_dbg(INFO, "using PSK offload\n");
52 - profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
55 - if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
56 - /* enable firmware supplicant for this interface */
57 - err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
59 - bphy_err(drvr, "failed to enable fw supplicant\n");
61 + if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
62 + /* enable firmware supplicant for this interface */
63 + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
65 + bphy_err(drvr, "failed to enable fw supplicant\n");
69 + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 0);
73 - if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK)
74 - err = brcmf_set_pmk(ifp, sme->crypto.psk,
75 - BRCMF_WSEC_MAX_PSK_LEN);
76 - else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) {
77 - /* clean up user-space RSNE */
78 - err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0);
80 - bphy_err(drvr, "failed to clean up user-space RSNE\n");
83 - err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto);
84 - if (!err && sme->crypto.psk)
85 + if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) {
86 err = brcmf_set_pmk(ifp, sme->crypto.psk,
87 BRCMF_WSEC_MAX_PSK_LEN);
88 + } else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) {
89 + /* clean up user-space RSNE */
90 + err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0);
92 + bphy_err(drvr, "failed to clean up user-space RSNE\n");
95 + err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto);
96 + if (!err && sme->crypto.psk)
97 + err = brcmf_set_pmk(ifp, sme->crypto.psk,
98 + BRCMF_WSEC_MAX_PSK_LEN);
106 /* Join with specific BSSID and cached SSID
107 * If SSID is zero join based on BSSID only
109 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
110 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
111 @@ -1281,6 +1281,10 @@ static s32 brcmf_p2p_abort_action_frame(
112 brcmf_dbg(TRACE, "Enter\n");
114 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
117 + vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
119 err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe_abort", &int_val,
122 @@ -1826,6 +1830,7 @@ bool brcmf_p2p_send_action_frame(struct
123 /* validate channel and p2p ies */
124 if (config_af_params.search_channel &&
125 IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) &&
126 + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif &&
127 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) {
128 afx_hdl = &p2p->afx_hdl;
129 afx_hdl->peer_listen_chan = le32_to_cpu(af_params->channel);