From patchwork Wed Sep 9 15:36:22 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: 249480 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp523903ilg; Wed, 9 Sep 2020 08:35:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5jjcf+eUC2cy5/lvZRCR7fiOud2MnoYnHA56rkYM5FYfVvl5ZrswQDNFS2eaUxloOq1ml X-Received: by 2002:a05:6602:2043:: with SMTP id z3mr3695283iod.93.1599665748145; Wed, 09 Sep 2020 08:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599665748; cv=none; d=google.com; s=arc-20160816; b=ICPU3acMg166N6NzlW7PRzDN6em1QjOuodMeXoNIEIVie37xahGAtnR8ZskijbFrPu iTtjg68viHCroKgZioiFU0eyXaZhONX7C8ynWNt/wSNYwW7GbFVCmEAFapoWR5kZEZ8L 6jTopto+7Fp/pI7l1gM7495pzfzjHIXIvC5tOv5PdKUd3hbWr0Bh9M/JpnP0FVqvPdMP YjLd36YRc/c4st+ESf/FuiEn5FBm+AuozEMyqp/dQwqzLjhUOvC8MyWFfaiGXgngadPq RfEDim2CfGc/CLThiCiuMJ+WneHTL1p0ONrhdMQKgGet+JPgvUjIrL3+qqLbZmn5PSWh YCNw== 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=HWuYe2QK/vFD5JMRpHOmJnC95GUKzDFic9CvLoNHpAw=; b=EXN4kNHhBP/g7qqGptZTHqaXsN0qkaYRbluHPlZ0i0w9W81MRwCnhCRKcoVZthBnmU XyAawFmMDTWoZwQt3B1eOGI5U978mqmx2GPgocwLOF7gPknkyZfKzggRhGYfxYKBpfeb lo9znUUytNMkzWdOuWrxzgSJsGB24ILU9aF6rkCmuCnt42meVvjMu1q9ele2990svkF+ ijLoKE/+RBqDPsMUZo7ugCJQNjn5N2YuR3+1UVBZ7BaIj+WiNpwtQYPYfHuYazGZWMZR VT2IMNV5ic+BlCkPoplTiI/pJLco1I6OvoaCc6rEqz4SOxXjV9oWsxKobfbLlRYC20A3 3rSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=kLzSgAoP; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e5dBR0Bu; 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 v4si2086225jan.53.2020.09.09.08.35.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 08:35:48 -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=kLzSgAoP; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e5dBR0Bu; 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=HWuYe2QK/vFD5JMRpHOmJnC95GUKzDFic9CvLoNHpAw=; b=kLzSgAoP11PQ6xUah+dJnoj8A Lf7lzImaESFN51lwo54itByTw2rI0LBHeRTlK+L38GvIb0iMG8klsEQZd7z9euCM+nftBVHzvr8aS gg7P+iq45bMkipTR6oXc9wqMrPpwm8/WJuwEdMXe70oi7jb0t8TgKxMwkglNdQibI0npOztVoNjdX hwFIqE0ucHnMiATqZO1JR208A8pMJgG/J51UcKAa4zRmIfKoPXmpLjGB5AP715Y9qNh/PgSxW9Nav rz1IpItTmi4oVd/9aZWh6mSKevhZtWx0dwksXOMgCOxB4AOmmZv4STLG3K8toarQatvm3nGXHkcNi thq4YDyhQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG28O-0006SD-Kq; Wed, 09 Sep 2020 15:35:44 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG28L-0006Qh-EC for wcn36xx@lists.infradead.org; Wed, 09 Sep 2020 15:35:42 +0000 Received: by mail-wm1-x341.google.com with SMTP id l9so2826579wme.3 for ; Wed, 09 Sep 2020 08:35:41 -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=TAN3QMP99RMuUE2X4Hhmcyc8WgDbU6qUkAUGwiuBm+0=; b=e5dBR0BupdAskOjCR2OsjCy+jm0ple/SxA7HI6cVw3GyCuIddX7XOUMSNPxUx58zTb xrMoV58SdKtT4wjJYoFC6ITxEupXAccFJ5pdbbOb1/eb75eECWSeAXUAAvPSaREJ2lC8 tzDAMVLNL3TXvffbUK/lrvJPQEyzXAfmO6Lc803q2woZRxw52icYgmhFuVp/kmw3Z9F/ 2NJ1LWsja4G6RxP12CAzqNNjGXDTsRtgJHkk1qoC4TtY5ZJLp+rRGQc131eja0/tTsZy I5Fm+ae/XAK/JXKb7k13pVXnvpboLvNcWdYCOMegiDP+/GRi1cEzv9osjqQLsDTbZ97u bZvg== 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=TAN3QMP99RMuUE2X4Hhmcyc8WgDbU6qUkAUGwiuBm+0=; b=nsRrGfvgwVyMAOW/2C1Y5D39j3WW2cmNGruWWapTQOt5VWMcas3QlcKEedu9H+Twwn eu/YZBnbzfZj5WpUtn9iGPiX4ZXcVTiyqtsmX3xmzYq9stHY7L8h7QvFiZ4naFLRfwlL cRcGQxzdxPNge4pkBaLa6FhlxRalYFsdynX9VCQZClN2RfPglb2Zjq8VNDjXRaokMEdB xsXHAtKfZxX9OMVOASZcJf3bibMCaiWxXH86t0nldCfsnyQY8J/iF+Bb8D/anC4/5aUg 2XTdmkoV0xx7ZorepgtGzR2V1tioIS1eRJmVbik5/UMMJYvgZ4+n2oHLP6gVlB3FdVY7 sa/Q== X-Gm-Message-State: AOAM530/b7NFYRyJ1PatTxGsGk7x4p33r5xe1/i+fhIijIYwqDKmWcY0 7v8LBSbbqWsJ4/hsS75ZMq2cEQ== X-Received: by 2002:a05:600c:24cc:: with SMTP id 12mr4285160wmu.126.1599665740601; Wed, 09 Sep 2020 08:35:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 08:35:40 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH v4 1/7] wcn36xx: Functionally decompose wcn36xx_smd_config_sta() Date: Wed, 9 Sep 2020 16:36:22 +0100 Message-Id: <20200909153628.2904888-2-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_113541_507644_0A7631CE X-CRM114-Status: GOOD ( 12.42 ) 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:341 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 f434c355d32d..e26752396bdf 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1308,54 +1308,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;