From patchwork Tue Sep 8 18:24:51 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: 249326 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4791649ilg; Tue, 8 Sep 2020 11:24:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWlbyfZqbGkdMhxxMG/bQasIqvQFVp4DTSpG6WrRiZkph9x99Mv3Tb1F2viuBjZjPkg0mc X-Received: by 2002:a05:6638:210f:: with SMTP id n15mr205858jaj.41.1599589462789; Tue, 08 Sep 2020 11:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599589462; cv=none; d=google.com; s=arc-20160816; b=FVYCQRmy6rOp3XKCexrzR+bG/cesIE3Y5t6R+BvNQvXcM4YpsXHhLjb6oJXuaY2XJz jfZPJ26zAflxdmqvbs65G6P+C/vJ0HDMkBFCNkQXbFeXCIIorgWElPMlSYIrmag3/97Z FHM88czvidLZmpuMgxetSNGUl9ktV95w3KbBZn5+W0Wv9L+XGU56Oh9Sr/Ewchz9TiBO Mh80yo5NVdhvQZYaUK01vO+eZv9i5cQT2a4pZAycpbuAeJyO+PTlHKnvy3UV5hTWGaHZ 1zZD1+dIt9f7EOveSb2doU114S7lGN3qdgFfiuewTUdL3I/qdy78EWZSO8m+2O6Eb7my 8ngg== 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=NprAu/VbDp1c2lMQtjlRxkKKUON4VXBurjxr7hWJOfJzrfYE40naK4Qa2LQztXMTrf Lvzzpk62dRShkRNSQQY8eU4eVCA5QaBocFIzAACp/HQgr0YATjk8sC4MuGtfxUUMibsv 4y8gbGh3rscF1SOuI5bBEMZdEyfiY9eyhuYCsUnKLt+XrFgJNEI2qeTSR3NZOJ+D6aJx VjQL1EnnpOOfuW72sRi3Z1NQ7IsI4UQT4F9ho5P2/lnqdi7e3xyhqJLRE7GGGrGN4niK GHASDX2iqH2uVsFmdNtlmD43BXer7tSA0rvEOJGFthq68ET+cVbCyUUohdHkeaGmlwh8 fr5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=Ojl7d7Vo; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bNNS+mdf; 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 d18si91139ioc.87.2020.09.08.11.24.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 11:24:22 -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=Ojl7d7Vo; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bNNS+mdf; 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=Ojl7d7Voy50WpXQ3er3/evPlu mloJEzuYMRZIpGxBxBlA+xx0eh1MIcagt/Z963kRwugAT7JHJY1fvc32R8zEQmL+AgZg5lkIjEjXN +YlkkTBfVWy8en8IfN0M/gJzA0QPz50sWVZ+sYZlbIXkhezKH3nzLsmW0yjvcCPHXeyugtccpZiIX j9zYStcPNNkWARMxZTL2rFrLRYth4k17CQU/5+rmiUsDL83r2EsVkGe6E5G9F6cOHlTLjmb28JQI+ VJ9GZKsEdURvaJfVcdnRearpk+cn3gk4MK0K+JnyfI9mMSjy9gqDSr1txEffsrczUdWrpYcBayBrj K4Ks3mIgg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFiHz-0005CL-37; Tue, 08 Sep 2020 18:24:19 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFiHu-000595-Jt for wcn36xx@lists.infradead.org; Tue, 08 Sep 2020 18:24:16 +0000 Received: by mail-wm1-x343.google.com with SMTP id b79so298074wmb.4 for ; Tue, 08 Sep 2020 11:24:14 -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=bNNS+mdfG3LMvb1uwhdXes1htGVAIaVqty70MIaW7ALRAvqZsHlO+++KBtrKxKlp3r 3tzBTUHN79U6mT7bWgue8NTM5Iu7fbJufz8IFDvCYiur3gPtPU5YgAS90JVtauXldS5g J5U0y4zk11NGT9b51wjPbfX9h+ckBL5EGcMTNtF0yesEtQFj5TSiSoQN3qRRsw1O/6MO Cf1TQZU4nm5plUDmXcnkvLUstwXPvK9eaIHmQ9/Xil97Pe2s+BaaSw9m75fDgCWHKSAS zCxCMLxHqjEEBnVw/yP53PN9dmWcN8AWIjpQdjuvPM6/+czyTjpIvrnfCw85eAQJav1x cy4g== 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=cnuGtfRCwcbAZBVoFtWz+yllEvTRIWWRXH2QNYgtzERTmggXhYCpvnjXF++XKY91CT Bgwt0kUmrBmaAB54JCTE+ZbUS3q0vM3PV8xFVATHuhiLJeRy1gnqfpleCvQl1QT/j8qS T3PKxPcd80b2mV2CQV2kg4kPS9n8PrnhNOcg/TQY3REDfymdsg2JDBo425+YgLXfX++a 7tb59Six+PC7uDSZzqhrj6KmjirEQVwMDj9A+GSoi7x263GwGtP+6Ex5DwNl92gsBrlQ 0fgkjdN5MVNWcui5+9qyongJpGQWCVpHbCiO+ODO8JDqWHqtQXEywYm9MZWdMJvoU8xm z+eQ== X-Gm-Message-State: AOAM533yGPFv0T1YeG1nGYric10JNc3575XF7mjmgd5VQ6LbFI8xRocU 368V8z5c4n0I9juQ9DHj12nAuA== X-Received: by 2002:a1c:92:: with SMTP id 140mr397804wma.39.1599589451702; Tue, 08 Sep 2020 11:24:11 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id 189sm330439wmb.3.2020.09.08.11.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 11:24:11 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH v3 3/7] wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params() Date: Tue, 8 Sep 2020 19:24:51 +0100 Message-Id: <20200908182455.2870345-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200908182455.2870345-1-bryan.odonoghue@linaro.org> References: <20200908182455.2870345-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-20200908_142414_826662_DF699288 X-CRM114-Status: GOOD ( 17.52 ) 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:343 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 Message has at least one valid DKIM or DK signature -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 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 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,