Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp587129imi; Fri, 22 Jul 2022 05:31:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szw1E90GjEmcXAK1kxgEYjZZkxL+1pMXSKjgrTNpVuPZzT6JsJFOy+pNJySHJci+kdwL2p X-Received: by 2002:a05:6402:294f:b0:43a:ba61:18ed with SMTP id ed15-20020a056402294f00b0043aba6118edmr456917edb.180.1658493118155; Fri, 22 Jul 2022 05:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658493118; cv=none; d=google.com; s=arc-20160816; b=XePXjX46q3oab+Ljdp8DeoPyRvJDAl2MwZNbPP1eRERIua004/dVoavbT1J1YdKC6k gtaxzAz/g4jzbvk998Ur29YsbymroBWKCWJovYHp9x0S6fSH0XT14aAK41M/Yp02esUd diNCQyxduZ0fDSKfeg4eG7fwScbxt/Iplq+PwWUeH6+Jpc9beOWY8/nwFNuQvUmerZbT BBMQgX879XixUGryjEHgroAYd0jMsnBsSlcM7mdexPkGrkgEq81kodYytQgqUrZlOaEt 9d/BNDZ1m/4U+f46wTjxl8fDlX9ny7x4j/4scCHT5QcHgiy1fS1yVuyjIE3i9sOdWlqh 0tlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M+WvqbaFpPpGg91O1fVKyHX+g59A2oh+3eav6/3+mjU=; b=Rd0XCkhtoBZeBnziQ9whZ5FvEzQEZpZwUg3xg5Kk/BtTyAFMizx1svlTtRzhEjsZ6B dubKI936isQgIFlX6Bjqfe0Y4+tySW+SkkSwg2VUaRBjQzPlCSEoeZB40BQRK7cXoOuG cwdkUtixOvJH3PKSo20QbT6S3LUQ4A2o0xanU+OW2JN+l94ysz5n+paUPq4jsuVQNUsK BtwciKO3t3bLppIQdN1Vuido5ZdxMkDtGkpVMHhrsGkfvr1etstIzo1QFVTTPj2OIH1t LyOiNFa9XgEFbSt2ujYjpcHvV6HZ8lRnPTQzGdGIxoFLECKpf+qe7rga/XKB0mMbCT/D oLJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@pqrs.dk header.s=google header.b=RolgvUGK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr21-20020a170906d55500b0072b44b630absi120793ejc.867.2022.07.22.05.31.36; Fri, 22 Jul 2022 05:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@pqrs.dk header.s=google header.b=RolgvUGK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234532AbiGVMaX (ORCPT + 65 others); Fri, 22 Jul 2022 08:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233944AbiGVMaN (ORCPT ); Fri, 22 Jul 2022 08:30:13 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE703E01C for ; Fri, 22 Jul 2022 05:30:09 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id z22so5658274edd.6 for ; Fri, 22 Jul 2022 05:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M+WvqbaFpPpGg91O1fVKyHX+g59A2oh+3eav6/3+mjU=; b=RolgvUGKU/Oww+066Om3j+mSOJxaKjTICUKNkhIgNPb7XaSAR+pKWuCdKUWr57rhZ0 0l5D8lF43dr9s/Z3o1B00TQyG9s4D/gsfS4ocfFuWVEreY4tyamfeN0BLxpIX7VKMESG Oth4pmATrqRXXBDt1qRTYJBpD3Crj/VeebjWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M+WvqbaFpPpGg91O1fVKyHX+g59A2oh+3eav6/3+mjU=; b=RZAMJXvl2per7rIoYRJoQNIZeVJEE2mAqh6tm9LBvxV5tX/z7GRKfSxElHaX4FRZIY eeB+qvS3o/JeJvw743SnG0rBi8dmu2kghR6uS3V3ZUyxSzcBXOefIQe2k//Xo/KpgNCm LX8u7BZCltMzxnuQbV6fzXVwZIghLRNzPxf6S5qPxbPHhkONB3SfBR/Mumb4P3WWmo/z HYCymGVPkQUsgPyctLfIJBXudQZLKil3aAwBdys0wUFolVRW75Sy3ytsh4aqPH4h5huR VnsDPpYAtTllHUXa40209IYRLLPfYZZYSYTwYSBL6X7ALw29lKyQjFpwao6APZBB/Y81 4IIw== X-Gm-Message-State: AJIora91y8UppKEUM3ULY4W17OhhLMILWPIKK5AKcX7Qh+ZT+qaClTbv T41pGAf1ZB9lnnruZ4FlfLNfSA== X-Received: by 2002:a05:6402:2405:b0:43a:86c6:862 with SMTP id t5-20020a056402240500b0043a86c60862mr431154eda.210.1658493008130; Fri, 22 Jul 2022 05:30:08 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id f6-20020a05640214c600b0043a6df72c11sm2462432edx.63.2022.07.22.05.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 05:30:07 -0700 (PDT) From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Soontak Lee , Chi-Hsien Lin , Ahmad Fatoum , =?UTF-8?q?Alvin=20=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH -next 1/2] brcmfmac: Support multiple AP interfaces and fix STA disconnection issue Date: Fri, 22 Jul 2022 14:29:54 +0200 Message-Id: <20220722122956.841786-2-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722122956.841786-1-alvin@pqrs.dk> References: <20220722122956.841786-1-alvin@pqrs.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Soontak Lee Support multiple AP interfaces for STA + AP + AP usecase. And fix STA disconnection when deactivating AP interface. Signed-off-by: Soontak Lee Signed-off-by: Chi-Hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 48 +++++++++++++++---- .../broadcom/brcm80211/brcmfmac/cfg80211.h | 1 + .../broadcom/brcm80211/brcmfmac/common.c | 5 ++ 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 3ae6779fe153..856fd5516ddf 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -4747,6 +4747,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, settings->inactivity_timeout); dev_role = ifp->vif->wdev.iftype; mbss = ifp->vif->mbss; + brcmf_dbg(TRACE, "mbss %s\n", mbss ? "enabled" : "disabled"); /* store current 11d setting */ if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, @@ -4961,6 +4962,9 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, if ((err) && (!mbss)) { brcmf_set_mpc(ifp, 1); brcmf_configure_arp_nd_offload(ifp, true); + } else { + cfg->num_softap++; + brcmf_dbg(TRACE, "Num of SoftAP %u\n", cfg->num_softap); } return err; } @@ -4975,6 +4979,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev, s32 err; struct brcmf_fil_bss_enable_le bss_enable; struct brcmf_join_params join_params; + s32 apsta = 0; brcmf_dbg(TRACE, "Enter\n"); @@ -4983,6 +4988,27 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev, /* first to make sure they get processed by fw. */ msleep(400); + cfg->num_softap--; + + /* Clear bss configuration and SSID */ + bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); + bss_enable.enable = cpu_to_le32(0); + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) + brcmf_err("bss_enable config failed %d\n", err); + + memset(&join_params, 0, sizeof(join_params)); + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) + bphy_err(drvr, "SET SSID error (%d)\n", err); + + if (cfg->num_softap) { + brcmf_dbg(TRACE, "Num of SoftAP %u\n", cfg->num_softap); + return 0; + } + if (profile->use_fwauth != BIT(BRCMF_PROFILE_FWAUTH_NONE)) { if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_PSK)) brcmf_set_pmk(ifp, NULL, 0); @@ -5000,17 +5026,18 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev, if (ifp->bsscfgidx == 0) brcmf_fil_iovar_int_set(ifp, "closednet", 0); - memset(&join_params, 0, sizeof(join_params)); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, - &join_params, sizeof(join_params)); - if (err < 0) - bphy_err(drvr, "SET SSID error (%d)\n", err); - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); - if (err < 0) - bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err); - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); + err = brcmf_fil_iovar_int_get(ifp, "apsta", &apsta); if (err < 0) - bphy_err(drvr, "setting AP mode failed %d\n", err); + brcmf_err("wl apsta failed (%d)\n", err); + + if (!apsta) { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) + bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); + if (err < 0) + bphy_err(drvr, "Set AP mode error %d\n", err); + } if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) brcmf_fil_iovar_int_set(ifp, "mbss", 0); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, @@ -7641,6 +7668,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, cfg->wiphy = wiphy; cfg->pub = drvr; + cfg->num_softap = 0; init_vif_event(&cfg->vif_event); INIT_LIST_HEAD(&cfg->vif_list); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h index e90a30808c22..e4ebc2fa6ebb 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h @@ -371,6 +371,7 @@ struct brcmf_cfg80211_info { struct brcmf_cfg80211_wowl wowl; struct brcmf_pno_info *pno; u8 ac_priority[MAX_8021D_PRIO]; + u8 num_softap; }; /** diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index fe01da9e620d..83e023a22f9b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -303,6 +303,11 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) brcmf_dbg(INFO, "CLM version = %s\n", clmver); } + /* set apsta */ + err = brcmf_fil_iovar_int_set(ifp, "apsta", 1); + if (err) + brcmf_info("failed setting apsta, %d\n", err); + /* set mpc */ err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); if (err) { -- 2.37.0