From patchwork Tue Sep 8 18:24:49 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: 249324 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4791574ilg; Tue, 8 Sep 2020 11:24:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6rUdnqvKhcaba+qJRaX0sxo3c7clso9Xy9eZh2ZNPSZcUmukUldptwfJMYpcaCVbkQ6p4 X-Received: by 2002:a5e:8c0c:: with SMTP id n12mr109111ioj.147.1599589456703; Tue, 08 Sep 2020 11:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599589456; cv=none; d=google.com; s=arc-20160816; b=dslhUz4+yIH4IqQF1CHsIVTpJPmS8mlKhWOx6pIBy0K8/kvOztDlzIYitwBnYpyVkP Ya3ZL8qflFAUSR4NbHWxRdq0eL/EKVLaFzav51R+q5GokJgwsEq4oHOqnyBVpwW78B4M lQmvRBoZIfvkoNYk+4Q5vmWde6hs2EOlcSu7asIDLLArIghCJnClalPLsXJp1rTDj1gf SyaIWxi3IR2ydFFNbyqAjQ2QH6cULL/KSjbhcxH8lBMGPhSy8I96av9HzyZW7tJG9UYR WhIfLw+QA5mrY9Zh+TaKaVm4LHBI4VbekwSiLld7Y/qfAFqriIlUb+NNRDkznV0CdUtQ 8E/w== 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=C4g4mMI52fsEsbvsmNy8zjDNbcpu2f8Am+MW4Fmn4VxpVS0v/FrIaH1WZBg4XTZT1i 4KS2UKJMEqUgaDiO7oFnD2hQsAaz/0Hv7qpGNlJgtQCIIwxo9ztbx8DNACZcs0GJ8mPv uAKUVGY7/EUJ7AvD6BSFZzsWCFmUSH4QiqfDw0SOVNKNR9IFszVmdFkIlcaBCsigPPdb d0F5ohVObdUZfIkxcz+w1K9WCqnTnecV6ndFVtpEXYzm6vc3dL1ew3dxdVU9gheyz7iU TFKl7xZe9fQo0E1lq/0zZ8oL3fpKCacnlqSMjTFUXw34pvs3WrW1tuIaq68x4gkbCWFe KF5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=J3uNU+UW; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=X1nC4See; 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 x5si204612ila.127.2020.09.08.11.24.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 11:24:16 -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=J3uNU+UW; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=X1nC4See; 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=J3uNU+UWpHTv7q/Q8VEYg9nmV Fg+TbMsvIJcvUK2jagIZsLmCVK6PZi0zVz2xq159lPnmrBrSvzcAnmqxdSLGXSAiX+hp1grUD4zmh 1AXFzIcVJRLU82DdykywlcYfXXnQCHKNPL8usKpx7f2/laHGiaBQIdYNaZy3o35DI3VYeO0qKZLlw UEuzB9dgrg/sv+Gxi8/LJQTrsgJKJF08QFRlDxLPxzIKUAiCVtdZx2hS8JnGJP2q/TXxGaP8ia6IL soCcT0TPLX+W3iuIp0rsYviPV7JUHHpuhECYxnG8a87YwPUZ6zEl4LLDZvuWyEyY/Zfrr1WQLtnfl Wth1lOXnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFiHt-00058f-18; Tue, 08 Sep 2020 18:24:13 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFiHq-000576-Ca for wcn36xx@lists.infradead.org; Tue, 08 Sep 2020 18:24:11 +0000 Received: by mail-wr1-x444.google.com with SMTP id w5so207913wrp.8 for ; Tue, 08 Sep 2020 11:24:10 -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=X1nC4SeejQjeJyQI7dQSYL+Z5IwxvGY68esopG5mFiYSIhNtKZcHeTzSAFJivUmYr8 bbZERcQTQp/IXonUh9Jl26zU4PbcZ+AFMGSwUQr+ceDmAESUAG8paUWvX+uR45R9dOWU dikp4JnU9SALDdiTYFhLBwu4o0s7Zaa34RL9jvwxe1pzhUmDdIOpppxbB2Q61y3IMDRU dwrs/APby+NsKxiBij/MS5X8Wn/I9eNfxvamn/QfkkMhExxWl5ojoQg1Tk7oVpmqb79n mhfiVBmeYnZrFXhfIYL2U1rwITzlpPZYhDTOwUdO2E15EJ6ktPOGzwFgJAXTN+oq5h0i B5HQ== 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=NT5HCK0YSjn2JdmDM4zXQtOb+d3JC9+EoNbDadv7tKFym1K4UYMLmZKoIzc/xtGtoc VARuOk9HnnQJJn6Tx5GDn7IPArSv1616AX4OGPRSXN+P0za0IGi74S6fwyiRX+aS7XaH 5H37jj7pFt6t7Xod31eAEHlfqfzJqfOtnFYxSBFJaOKrX5F7z91t3xl22j6nWFPGIXnP MLiRs9a6Z6S7R+Yg/7nf7IP2qmXZ4MNsSSXzTyhZE00n7jDW1YKYL34uaD3QywhvtmbD lEpb21irV4ykwKR/PeQsSXQAA3Yb2jx7lzjtcqZP5aqEsPppiMWDFjMtNWr2iZO0oG0v GPVw== X-Gm-Message-State: AOAM531VjomHhY1TjYZKKdVVPUxcHO9DeddgN5vBtdwANie/XUtNUdXO aW/vqwdLiK28HKA2uZwjWuIRvQ== X-Received: by 2002:a5d:4bc6:: with SMTP id l6mr1005090wrt.132.1599589449430; Tue, 08 Sep 2020 11:24:09 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id 189sm330439wmb.3.2020.09.08.11.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 11:24:08 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH v3 1/7] wcn36xx: Functionally decompose wcn36xx_smd_config_sta() Date: Tue, 8 Sep 2020 19:24:49 +0100 Message-Id: <20200908182455.2870345-2-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_142410_469362_BE0A49E0 X-CRM114-Status: GOOD ( 13.48 ) 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:444 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 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;