From patchwork Thu Sep 10 15:06:25 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: 249638 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ecf:0:0:0:0 with SMTP id i15csp825933ilk; Thu, 10 Sep 2020 08:05:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPIZmDNews8oQvB4vt833BiIrerSvEAlkYh4W8rI8Vyby0xbbWM2GMdGAzOMlw1BnO8nzv X-Received: by 2002:aca:570a:: with SMTP id l10mr256730oib.143.1599750351074; Thu, 10 Sep 2020 08:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599750351; cv=none; d=google.com; s=arc-20160816; b=yQSjUmt1vNhABk57O+0UB4CUaVxD0OyECGAV3Bdtd7mZAjxgy4y46Ov5TsjFq/Pme+ fV57Ud0Lg6IVxyz84lqBnSipA7zgAekbL+mn2XapOCDpKsYXq5H4OUnOKudBuyBxYSqF pSz6qWstnILRpzusb4sDphpcemxYel4j9wTonT5IQPLqEHIpeq/4eXJYdWrBg6kSW3Bz pgeFTQwshkTuWTe3ZwM8viSfAfSwZ2WIcuy253dRQqjBCZvCVPSb86diJrWWhwJXnxP8 /rdxfSIb6fZ31QAUefVDnjYSXT3EtRWFIaOoFWwl/aTCWufP6HSedIACOhjig1zQJQHa s3OQ== 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=opZRtL2OTwvlSQmTUfWslamr+jEg5RJpO4j7D0MvwxU=; b=g/X1mcoJ2/9DaMVbHLVvUVNJlh13n5fNdy3Zs68ozEng1WYw+q6RIXSrMeWdWf3Nux Tbhj6kXPAziY/cD6h4P3LJ4jy9eMSfDMw9He1a+124VsKTXC0RUjacUGt6B/PGvP/OzD uTzdcweS7ydMmoyUr7RQJ/edlQNUzmPVUV/q/cIRhhlZU2M+eG9sTG1ojuno2Hb9+0Y1 f0OBu9kmbmXS3g3Cacn5uiNhBjku022GGn11c66DYaP8vYrJUNDPmfRLJRJBEnb5JgXd JWT4Xj8Ol4CwBNoq7eTCIiVm8jSSITXT5MgD+nRE9JYdPpOLngiUsCqIiadSv7BwDp6O k7KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=Hbmp3a5i; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bXdk5WDh; 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 m18si3253059otk.303.2020.09.10.08.05.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 08:05: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=Hbmp3a5i; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bXdk5WDh; 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=opZRtL2OTwvlSQmTUfWslamr+jEg5RJpO4j7D0MvwxU=; b=Hbmp3a5igA9ZMIQsTbJbc3Ems coYinjVuqD6JXzW0JziKzIAOcZU8Gt6a4q7o8hK1+fxMymp7mS9T1X0FmKlUfXMrtVmewq5mrFyJ2 7ing8CvbkstDsPFyq3ZVCi7HkAZWw4iG7GACbZsTir1p/G/rKu7Ht/myLKf7Yw2ZGI6ZQXX81AzgK UI5Nf1kUpFbtYmp3vD8tviWhIe6FPQpdUw9I1Pp1GfTb74NJTL0k7kAOaqn/4rNM1G5YEjxKDmtM9 IZWmNTk8zNANX+DNAI4xdoZ0lhpWT7ffpNHcn1WOY2M+R1NgVpALsjbMfQxHEYb340oJgyGtokuC/ fb9U+DjTQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGO8x-0007fG-J1; Thu, 10 Sep 2020 15:05:47 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGO8v-0007eN-Gv for wcn36xx@lists.infradead.org; Thu, 10 Sep 2020 15:05:46 +0000 Received: by mail-wr1-x443.google.com with SMTP id w5so7060344wrp.8 for ; Thu, 10 Sep 2020 08:05:45 -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=jPZywSlUGy1DbYCXOG17ZaN4fGsj4lfwxAd0j52fwtc=; b=bXdk5WDh+FTYAUqvJ+3Rkt9BfbjPH88W65o4uL/hwqVRtPxELZodv7ZLsql2nAxYPK hs/GH8U/9O9CQ3uFAQeT8ZRsM6bFOxVYqXMv87jBkUyM8VCwjNWq2azM2hi+nlb5jg4T a5OrNL873vPbxgQztjzjpZpCzmPYdT4+Xi4Zn40VyQwQj2RksH148JrQ212hS9l5nEGR xdtJ8iiq9N0F4+Uuapy/YbkIMriqudeoozncz4mLlWuATC6NO0S8mIZjq5fHWNlI8oRc C6EE2WRIVx/yKwRqiDmJBU7/hSfORQDehB+/Fhu933LvKB45Kqt0ZnjfojmkyKozU8Jj vH9A== 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=jPZywSlUGy1DbYCXOG17ZaN4fGsj4lfwxAd0j52fwtc=; b=fFUF7UnEmJ+xASeq5S4ZvnNWbKKpzd6tNOvnrdsSF9UV4YvT7+mlnfQl23wL2jJ0JP c3Ch8/8vfp2/qfB6W3hAPdgGD6jPrhnCxMUj7sGjdwYLw1flDIxtr8NYk6D02UDXdu26 Zar/Th3IwZAHYybycEpxLce55YGtY2OZ/05EBWKUoBdJPad7rGx9l8Dhakxb+g/rCetQ YDt4FCQmg4ZeC4TNQ2ws7Bf+pZCtJbaf91CvvpcULA+9Ws4hEqrk8ZSNy+18nVBXhZFm QoTOQL/qdeY5Yoy/GYsMUqtGSpZ4lSRp6UNf7lfjJ+uvT0UebmgLMkiDLyetRmQ4Oa+h gHNg== X-Gm-Message-State: AOAM5307tp8S9MLG8FShus2lTwe8Zx+q7aWtpl82sNcEgHLq7Je03Mha rjvl2qdZOJWprt4J1Ct+qblXpg== X-Received: by 2002:adf:aad1:: with SMTP id i17mr10102202wrc.360.1599750344653; Thu, 10 Sep 2020 08:05:44 -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 k24sm3857005wmj.19.2020.09.10.08.05.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 08:05:44 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH v5 1/7] wcn36xx: Functionally decompose wcn36xx_smd_config_sta() Date: Thu, 10 Sep 2020 16:06:25 +0100 Message-Id: <20200910150631.2178970-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200910150631.2178970-1-bryan.odonoghue@linaro.org> References: <20200910150631.2178970-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-20200910_110545_563897_B522DE5F X-CRM114-Status: GOOD ( 12.78 ) 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:443 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 functionally decomposes wcn36xx_smd_config_sta into a clearly defined wcn36xx_smd_config_sta_v0 and wcn36xx_smd_config_sta_v1 path. Signed-off-by: Bryan O'Donoghue Reviewed-by: Loic Poulain --- drivers/net/wireless/ath/wcn36xx/smd.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 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 71ecf3ef5ab2..475d4f60185c 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1326,54 +1326,65 @@ static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn, } static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn, - const struct wcn36xx_hal_config_sta_req_msg *orig) + struct ieee80211_vif *vif, + struct ieee80211_sta *sta) { struct wcn36xx_hal_config_sta_req_msg_v1 msg_body; - struct wcn36xx_hal_config_sta_params_v1 *sta = &msg_body.sta_params; + struct wcn36xx_hal_config_sta_params_v1 *sta_params; INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_STA_REQ); msg_body.header.len -= WCN36XX_DIFF_STA_PARAMS_V1_NOVHT; - wcn36xx_smd_convert_sta_to_v1(wcn, &orig->sta_params, - &msg_body.sta_params); + sta_params = &msg_body.sta_params; + + wcn36xx_smd_set_sta_params_v1(wcn, vif, sta, sta_params); PREPARE_HAL_BUF(wcn->hal_buf, msg_body); wcn36xx_dbg(WCN36XX_DBG_HAL, "hal config sta v1 action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n", - sta->action, sta->sta_index, sta->bssid_index, - sta->bssid, sta->type, sta->mac, sta->aid); + sta_params->action, sta_params->sta_index, sta_params->bssid_index, + sta_params->bssid, sta_params->type, sta_params->mac, sta_params->aid); return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); } -int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) +static int wcn36xx_smd_config_sta_v0(struct wcn36xx *wcn, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta) { struct wcn36xx_hal_config_sta_req_msg msg; struct wcn36xx_hal_config_sta_params *sta_params; - int ret; - mutex_lock(&wcn->hal_mutex); INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_STA_REQ); sta_params = &msg.sta_params; wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params); - if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) { - ret = wcn36xx_smd_config_sta_v1(wcn, &msg); - } else { - PREPARE_HAL_BUF(wcn->hal_buf, msg); + PREPARE_HAL_BUF(wcn->hal_buf, msg); - wcn36xx_dbg(WCN36XX_DBG_HAL, - "hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n", - sta_params->action, sta_params->sta_index, - sta_params->bssid_index, sta_params->bssid, - sta_params->type, sta_params->mac, sta_params->aid); + wcn36xx_dbg(WCN36XX_DBG_HAL, + "hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n", + sta_params->action, sta_params->sta_index, + sta_params->bssid_index, sta_params->bssid, + sta_params->type, sta_params->mac, sta_params->aid); + + return wcn36xx_smd_send_and_wait(wcn, msg.header.len); +} + +int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + int ret; + + mutex_lock(&wcn->hal_mutex); + + if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) + ret = wcn36xx_smd_config_sta_v1(wcn, vif, sta); + else + ret = wcn36xx_smd_config_sta_v0(wcn, vif, sta); - ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len); - } if (ret) { wcn36xx_err("Sending hal_config_sta failed\n"); goto out;