]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: brcmfmac: don't allow arp/nd offload to be enabled if ap mode exists
authorTing-Ying Li <tingying.li@cypress.com>
Fri, 6 Jun 2025 09:34:44 +0000 (04:34 -0500)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 24 Jun 2025 09:37:00 +0000 (11:37 +0200)
Add a check to determine whether arp/nd offload enabling
request is allowed. If there is any interface acts as ap
mode and is operating, reject the request of arp offload
enabling from cfg80211.

Signed-off-by: Ting-Ying Li <tingying.li@cypress.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Link: https://patch.msgid.link/20250606093444.15753-1-ian.lin@infineon.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

index b94c3619526cfafa4c3decd22c8bf01694a9ff64..5a0b252dfeafeb05f75d10e4afa1e5a8a6ed5329 100644 (file)
@@ -1043,6 +1043,21 @@ void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
        }
 }
 
+bool brcmf_is_apmode_operating(struct wiphy *wiphy)
+{
+       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+       struct brcmf_cfg80211_vif *vif;
+       bool ret = false;
+
+       list_for_each_entry(vif, &cfg->vif_list, list) {
+               if (brcmf_is_apmode(vif) &&
+                   test_bit(BRCMF_VIF_STATUS_AP_CREATED, &vif->sme_state))
+                       ret = true;
+       }
+
+       return ret;
+}
+
 static void brcmf_scan_params_v2_to_v1(struct brcmf_scan_params_v2_le *params_v2_le,
                                       struct brcmf_scan_params_le *params_le)
 {
@@ -5416,8 +5431,8 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
                        bphy_err(drvr, "bss_enable config failed %d\n", err);
        }
        brcmf_set_mpc(ifp, 1);
-       brcmf_configure_arp_nd_offload(ifp, true);
        clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
+       brcmf_configure_arp_nd_offload(ifp, true);
        brcmf_net_setcarrier(ifp, false);
 
        return err;
index b83485ec7b8774d673bdeef2e9d8dbd1a6a93845..273c80f2d483a37f2d4a242b86142c4aeac06de6 100644 (file)
@@ -487,6 +487,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
                                struct brcmf_if *ifp, bool aborted,
                                bool fw_abort);
 void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
+bool brcmf_is_apmode_operating(struct wiphy *wiphy);
 void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
 void brcmf_cfg80211_free_netdev(struct net_device *ndev);
 
index 04f41c09deca86508c7a8f22ea19b10df81861bf..862a0336a0b59156a4ef77a5fe64fa241c4724fb 100644 (file)
@@ -98,6 +98,11 @@ void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
        s32 err;
        u32 mode;
 
+       if (enable && brcmf_is_apmode_operating(ifp->drvr->wiphy)) {
+               brcmf_dbg(TRACE, "Skip ARP/ND offload enable when soft AP is running\n");
+               return;
+       }
+
        if (enable)
                mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY;
        else