From patchwork Wed Sep 9 15:36:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 249482 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp523960ilg; Wed, 9 Sep 2020 08:35:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe7cEZPhI80YsAIXSoVQB5mA/K9W2UKJCpmta2vvAlCjSeYK+pC6rGhsBq+kGvT+KL9J2s X-Received: by 2002:a05:6638:76b:: with SMTP id y11mr4502906jad.29.1599665751770; Wed, 09 Sep 2020 08:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599665751; cv=none; d=google.com; s=arc-20160816; b=kkauOjc5jIlmfNCQDsmgEfJnPtJX7oNs/5Q3Xo+cM3FJ1WhdlciZ8Ijt6MuNvJr/At n46oc5iickVng4mH8+iGAgA+xKJXQtMWYYyPZvJWl67YHeiMP5Haw8tA9xJ/CdXMTBQR 8HTnZf6/DOCtox97fMnFfacFp2NgRyPJC+90z43Z/Nj9wIhQ+cooALsulXlN8FBvDFDM 9eM4FX+1xJXxaztxY2+ljltI6/0RL7dSlnTHIuUD7/opgE1ckbuQ18wPu/4BW7v0BA6P 2oeHoq1AEIo9DePAdZ6fvp/bnAK8WXezgmM04uovtduPiMup3xUm5enbpp66mBPpoXnV 5qfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=FPIOeGX+xnyfwvkYmUEg2RrPq3ioxlRIBUkXGGPU2hM=; b=kWJyVGEqj7Ymd1KWhiE4ernv0cEWGH1uRuI4W31gOYjrgr4hxa/F6+ZpEabsX8eEqb j1tanNo5e5u/LYzUr1ICzkETHqGWFvE0PoPmh1PoJ+TzmboUAs7ChEcGn8rGaMkUuLax DBHbDcdacKULXvabCmsFBVULd4Ncrvva14KLslstRqSa2w/gJZNm44r4FEpvn68YjQN5 cyY+F5O97dHMOdWKgRvCdQjCSEGVfkCibGAf3wVN8xkjQknCvL0uzgi+I5hd6Sggp70D BUQ6jqVBpUzQI2QwLdOXlqSYoXC0X4yFwvhdOKFj2eGv4aM5UxEkg0+gJPBmvjULL8jK VeVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b="Vhkq/VOV"; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="JQmdq/Dm"; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id u18si4487300ilc.144.2020.09.09.08.35.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 08:35:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b="Vhkq/VOV"; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="JQmdq/Dm"; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FPIOeGX+xnyfwvkYmUEg2RrPq3ioxlRIBUkXGGPU2hM=; b=Vhkq/VOVQaJ2U4zZhU600prVL 4EG2TWqKNraUZDlMQLJcAx04cEqSS7CCInVcI1V62YFN6moSugTAdJq10EY5+8hzORUaRUQb+6f96 2iB18UEaoO5t7+iYVQH/jbhrbR0lvdhT0yugovanEs64+s7dD4Vzsh8rE1rc22wpcuE+eyBC/Ri51 SQH9gVozPvc5D15AOpuYMgnJ2xu6nJFE3TIPpQtMFgnXfPekHvppcZ0T4d2by+7E25pgy9qzk10yW TwPkXqHFH/81y7McQSiKak+6qzOqcybmIPq/8BuUS8/c2k+Q8+9iaPlKAIJH/TvBVUX3taDtSvLdT 5Sk7x2nLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG28R-0006Tw-OT; Wed, 09 Sep 2020 15:35:47 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG28N-0006Rl-MP for wcn36xx@lists.infradead.org; Wed, 09 Sep 2020 15:35:45 +0000 Received: by mail-wm1-x342.google.com with SMTP id s13so2718468wmh.4 for ; Wed, 09 Sep 2020 08:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2bb83HCAluDLRPf/WFmZ9LIqNCsJ2xe/qCw3buaSSDk=; b=JQmdq/DmpRMuXqPjhMZTbESGSk0q4YnMaQhFqxvag3yXFNWjosuAlQjmpkSyL8GplP 6424d70nxq8QD4uDwnnv/ihpOvF8iK7EpwbNOTGNd54Y/Rth91iwgjuaOeuHS+OsodYZ gieHSNWHvKTzKNLxBkElMXQ5O1jWzIYvazMkDqNMcM56Mfqn/QnsZQdyGIWM7XOKZFRp CLfIuOxLzzRvvecEaJosbaL6zeHmyn8CjGoVfWbhj3Gdoyc0DYuxA/ktLbySSpngE3yW gVEDeI97yJomHdMWHno3amIX2dAEyHspNZGw3Oe3vq35LjSz5oQoJv2I1Yolft03k4K3 fSbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2bb83HCAluDLRPf/WFmZ9LIqNCsJ2xe/qCw3buaSSDk=; b=fVNkp6a+z4FgDxzbbGEIwJRIhCTF9h30xEvzOCc6oh6IBVyQChOv0E3wxR9QDgISuk FS8WjvrvprXlW8A4YjqVhcETeeIfB98y0rJYwQAu1oonV312c1sCpjtI0J5pBuHQTKXN 6au5epDrBcy7sKdY8ZJrixw5Ga9fgsMLJ61SkFOWdo8tCf8lw+94Jis+iCubAn2eBa4q YgFshDU579r7DY90DkYmcZwawQN6z4WYbi7aIU1aizpNkT89MQRTdLPfP6YdgVyJ1F2M zjP2WT5nS7TCS5p8ULta5AXklYW4mPutJwzUNnRC+SjySSLGWFOyUtCYDvfGAFSM0QDR tRDw== X-Gm-Message-State: AOAM533Tb89BzMiEDK43vGYTV76x1KmAXAfPSVBfFtR9NXs43nSabz1S AfYsSuKm+/dLdyadMnk6DGpZOQ== X-Received: by 2002:a7b:c749:: with SMTP id w9mr3848922wmk.29.1599665742763; Wed, 09 Sep 2020 08:35:42 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id c18sm4924871wrx.63.2020.09.09.08.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 08:35:42 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH v4 3/7] wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params() Date: Wed, 9 Sep 2020 16:36:24 +0100 Message-Id: <20200909153628.2904888-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200909153628.2904888-1-bryan.odonoghue@linaro.org> References: <20200909153628.2904888-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200909_113544_255821_49972782 X-CRM114-Status: GOOD ( 16.30 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: wcn36xx@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Sender: "wcn36xx" Errors-To: wcn36xx-bounces+patch=linaro.org@lists.infradead.org This commit moves BSS parameter setup to a separate function wcn36xx_smd_set_bss_params(). This will allow for further functional decomposition and fewer kzalloc() operations in subsequent patches. Signed-off-by: Bryan O'Donoghue Reviewed-by: Loic Poulain --- drivers/net/wireless/ath/wcn36xx/smd.c | 172 +++++++++++++------------ 1 file changed, 92 insertions(+), 80 deletions(-) -- 2.27.0 _______________________________________________ wcn36xx mailing list wcn36xx@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wcn36xx Reported-by: kernel test robot Reported-by: kernel test robot diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 28a571918b19..3e8b929f45fc 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1384,6 +1384,97 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +void wcn36xx_smd_set_bss_params(struct wcn36xx *wcn, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + const u8 *bssid, + bool update, + struct wcn36xx_hal_config_bss_params *bss) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_config_sta_params *sta_params; + + sta_params = &bss->sta; + + WARN_ON(is_zero_ether_addr(bssid)); + + memcpy(&bss->bssid, bssid, ETH_ALEN); + + memcpy(bss->self_mac_addr, vif->addr, ETH_ALEN); + + if (vif->type == NL80211_IFTYPE_STATION) { + bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE; + + /* STA */ + bss->oper_mode = 1; + bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_MODE; + } else if (vif->type == NL80211_IFTYPE_AP || + vif->type == NL80211_IFTYPE_MESH_POINT) { + bss->bss_type = WCN36XX_HAL_INFRA_AP_MODE; + + /* AP */ + bss->oper_mode = 0; + bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_SAP_MODE; + } else if (vif->type == NL80211_IFTYPE_ADHOC) { + bss->bss_type = WCN36XX_HAL_IBSS_MODE; + + /* STA */ + bss->oper_mode = 1; + } else { + wcn36xx_warn("Unknown type for bss config: %d\n", vif->type); + } + + if (vif->type == NL80211_IFTYPE_STATION) + wcn36xx_smd_set_bss_nw_type(wcn, sta, bss); + else + bss->nw_type = WCN36XX_HAL_11N_NW_TYPE; + + bss->short_slot_time_supported = vif->bss_conf.use_short_slot; + bss->lla_coexist = 0; + bss->llb_coexist = 0; + bss->llg_coexist = 0; + bss->rifs_mode = 0; + bss->beacon_interval = vif->bss_conf.beacon_int; + bss->dtim_period = vif_priv->dtim_period; + + wcn36xx_smd_set_bss_ht_params(vif, sta, bss); + + bss->oper_channel = WCN36XX_HW_CHANNEL(wcn); + + if (conf_is_ht40_minus(&wcn->hw->conf)) + bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_BELOW; + else if (conf_is_ht40_plus(&wcn->hw->conf)) + bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; + else + bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_NONE; + + bss->reserved = 0; + + /* wcn->ssid is only valid in AP and IBSS mode */ + bss->ssid.length = vif_priv->ssid.length; + memcpy(bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length); + + bss->obss_prot_enabled = 0; + bss->rmf = 0; + bss->max_probe_resp_retry_limit = 0; + bss->hidden_ssid = vif->bss_conf.hidden_ssid; + bss->proxy_probe_resp = 0; + bss->edca_params_valid = 0; + + /* FIXME: set acbe, acbk, acvi and acvo */ + + bss->ext_set_sta_key_param_valid = 0; + + /* FIXME: set ext_set_sta_key_param */ + + bss->spectrum_mgt_enable = 0; + bss->tx_mgmt_power = 0; + bss->max_tx_power = WCN36XX_MAX_POWER(wcn); + bss->action = update; + + vif_priv->bss_type = bss->bss_type; +} + static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, const struct wcn36xx_hal_config_bss_req_msg *orig) { @@ -1487,7 +1578,6 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, return ret; } - static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta, @@ -1539,7 +1629,6 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct wcn36xx_hal_config_bss_req_msg *msg; struct wcn36xx_hal_config_bss_params *bss; struct wcn36xx_hal_config_sta_params *sta_params; - struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); int ret; mutex_lock(&wcn->hal_mutex); @@ -1553,84 +1642,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, bss = &msg->bss_params; sta_params = &bss->sta; - WARN_ON(is_zero_ether_addr(bssid)); - - memcpy(&bss->bssid, bssid, ETH_ALEN); - - memcpy(bss->self_mac_addr, vif->addr, ETH_ALEN); - - if (vif->type == NL80211_IFTYPE_STATION) { - bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE; - - /* STA */ - bss->oper_mode = 1; - bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_MODE; - } else if (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_MESH_POINT) { - bss->bss_type = WCN36XX_HAL_INFRA_AP_MODE; - - /* AP */ - bss->oper_mode = 0; - bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_SAP_MODE; - } else if (vif->type == NL80211_IFTYPE_ADHOC) { - bss->bss_type = WCN36XX_HAL_IBSS_MODE; - - /* STA */ - bss->oper_mode = 1; - } else { - wcn36xx_warn("Unknown type for bss config: %d\n", vif->type); - } - - if (vif->type == NL80211_IFTYPE_STATION) - wcn36xx_smd_set_bss_nw_type(wcn, sta, bss); - else - bss->nw_type = WCN36XX_HAL_11N_NW_TYPE; - - bss->short_slot_time_supported = vif->bss_conf.use_short_slot; - bss->lla_coexist = 0; - bss->llb_coexist = 0; - bss->llg_coexist = 0; - bss->rifs_mode = 0; - bss->beacon_interval = vif->bss_conf.beacon_int; - bss->dtim_period = vif_priv->dtim_period; - - wcn36xx_smd_set_bss_ht_params(vif, sta, bss); - - bss->oper_channel = WCN36XX_HW_CHANNEL(wcn); - - if (conf_is_ht40_minus(&wcn->hw->conf)) - bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_BELOW; - else if (conf_is_ht40_plus(&wcn->hw->conf)) - bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - else - bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_NONE; - - bss->reserved = 0; - - /* wcn->ssid is only valid in AP and IBSS mode */ - bss->ssid.length = vif_priv->ssid.length; - memcpy(bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length); - - bss->obss_prot_enabled = 0; - bss->rmf = 0; - bss->max_probe_resp_retry_limit = 0; - bss->hidden_ssid = vif->bss_conf.hidden_ssid; - bss->proxy_probe_resp = 0; - bss->edca_params_valid = 0; - - /* FIXME: set acbe, acbk, acvi and acvo */ - - bss->ext_set_sta_key_param_valid = 0; - - /* FIXME: set ext_set_sta_key_param */ - - bss->spectrum_mgt_enable = 0; - bss->tx_mgmt_power = 0; - bss->max_tx_power = WCN36XX_MAX_POWER(wcn); - bss->action = update; - - vif_priv->bss_type = bss->bss_type; - + wcn36xx_smd_set_bss_params(wcn, vif, sta, bssid, update, bss); wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params); wcn36xx_dbg(WCN36XX_DBG_HAL,