From 441601f555338fe0d5016688069900ad55cf7b4d Mon Sep 17 00:00:00 2001 From: Gokul Sivakumar Date: Tue, 10 Oct 2023 08:03:44 -0500 Subject: [PATCH 185/296] brcmfmac: avoid unnecessary WL Down & UP while setting "apsta" IOVAR in FW In SAP + STA concurrent configuration, when the STA connects with external AP, the driver brings down the interface with WLC_DOWN, sets "apsta" IOVAR in FW, and brings up the interface WLC_UP. Bringing down the interface at runtime, would diconnect all the external STAs connected with the SAP. Since "apsta" IOVAR could be set in the driver preinit stage itself, query the IOVAR and skip setting the "apsta" IOVAR again to avoid the unnecesary WLC Down & UP, if it is already set. Signed-off-by: Gokul Sivakumar --- .../wireless/broadcom/brcm80211/brcmfmac/p2p.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c index 5f0035ec922f..4a61e0cc8c61 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c @@ -458,11 +458,18 @@ static void brcmf_p2p_print_actframe(bool tx, void *frame, u32 frame_len) static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) { struct brcmf_pub *drvr = ifp->drvr; - s32 ret = 0; - - brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); - brcmf_fil_iovar_int_set(ifp, "apsta", 1); - brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + s32 ret = 0, apsta = 0; + + ret = brcmf_fil_iovar_int_get(ifp, "apsta", &apsta); + if (ret) { + bphy_err(drvr, "failed to query apsta IOVAR"); + } else if (!apsta) { + if (brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1) || + brcmf_fil_iovar_int_set(ifp, "apsta", 1) || + brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1)) { + bphy_err(drvr, "failed to set apsta IOVAR"); + } + } /* In case of COB type, firmware has default mac address * After Initializing firmware, we have to set current mac address to -- 2.25.1