From patchwork Sat Aug 29 03:39:23 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: 11743955 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 256281575 for ; Sat, 29 Aug 2020 03:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DEC820872 for ; Sat, 29 Aug 2020 03:39:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gJDeuboG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727036AbgH2DjB (ORCPT ); Fri, 28 Aug 2020 23:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbgH2Dir (ORCPT ); Fri, 28 Aug 2020 23:38:47 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA430C06121B for ; Fri, 28 Aug 2020 20:38:45 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id x7so890889wro.3 for ; Fri, 28 Aug 2020 20:38: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=kmGkmjV/m2zZGU727AEDIK8F57fQ739jwqBKaTJaAC4=; b=gJDeuboGw9uYXGSPAmw2jBgLbsJEgvXTdsY+C0hlTCtU+g1knpbpQz2T8RVBWtSMCK e3uI6jWp9A78ZHUnzMShDR7QoObOAtEKYfFT4Y/+2ApCKS00czoAgcWIiGsum4RJu+Pj 4/UmxZYCaJp6cYcN3/Acw0j0poAO7MzlOgynRdwkvRbiRce5jiPY/NdfIrEJDli09n8F cLW4aq9Hlvu4Roq8WZTnWPs43A48QZ2f7ZBml9O2xu9Elq0fgpHaU0tzLfM3Xx/Owpzn Te+eL7VdDbTh+HFo4+A8UHNOCsrqtWEYH4blrc/5xTybYLVMVQdTbkN0DZcjKMVMx5ry 5vgA== 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=kmGkmjV/m2zZGU727AEDIK8F57fQ739jwqBKaTJaAC4=; b=F3BC52MNST42/c7F5VawOt4iWdemzUlTeezxyUnLqo+VRBURl+2LT9LTBC+Fcw7uZT ioW7GX0wkVUpoYskGx2ulC5aMxRhY0hDTe4dLFtD4CpitY8nKGZsqc9HRa622b1Gms26 pRmymHXqCk3lmQvW6hBa7UAf12ffEdzWtbKefOEltSPK5xaw7IKpbGYXnQM826ze96kw Vb7uNjL8DyRkxVKSwocj2p+2bXLFEgFy2JklLPBKkkXO8uh8NhPNhzaAaFG/c/TbFKPm +1P4ryrF4nGl8PvQdb+SX1P4VVyyl0fVZmnUGZKIHqJ1p5DqXh8WnAKoOAWNVZFrL5fb Xftw== X-Gm-Message-State: AOAM532R+cRFjhI83rdSUPBp1oa7UtqF3r08k48RrW3U3NXXiWK6gRfY gDLuGSliDW02Bm7a2E8a7kgz7w== X-Google-Smtp-Source: ABdhPJyeev3UXfh7W9qjVNHUk8zVjVc0x4etgg8HBUH6EFIwO5TfalWkJ2+huJeFDNcBsjvYbMQrgQ== X-Received: by 2002:a05:6000:1003:: with SMTP id a3mr1689067wrx.258.1598672324461; Fri, 28 Aug 2020 20:38:44 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:44 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 1/7] wcn36xx: Functionally decompose wcn36xx_smd_config_sta() Date: Sat, 29 Aug 2020 04:39:23 +0100 Message-Id: <20200829033929.2167761-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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 --- drivers/net/wireless/ath/wcn36xx/smd.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 97fb47a8bc1a..e8c2f4a152b4 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1312,10 +1312,11 @@ 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; if (wcn->rf_id == RF_IRIS_WCN3680) { INIT_HAL_MSG_V1(msg_body, WCN36XX_HAL_CONFIG_STA_REQ); @@ -1324,46 +1325,56 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn, 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; From patchwork Sat Aug 29 03:39: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: 11743959 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DC98109B for ; Sat, 29 Aug 2020 03:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 313F520838 for ; Sat, 29 Aug 2020 03:39:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HxsSo/PZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbgH2DjD (ORCPT ); Fri, 28 Aug 2020 23:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbgH2Dir (ORCPT ); Fri, 28 Aug 2020 23:38:47 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25223C061233 for ; Fri, 28 Aug 2020 20:38:47 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e16so894942wrm.2 for ; Fri, 28 Aug 2020 20:38:47 -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=or2dbECxnpurnyDMf3aY/pIgT+JTIa/EycsL2GtCXSY=; b=HxsSo/PZu+qfet4lp+lRj+AN0WRVaaZGoaTTcBrC4XMvC3ENptwieaP1VAvMzbCdHB 1y56MxnkH2i9BkW1k7STYaLxHOhCHCFt55FqItCENYDX7l85DSBO9uQYJr48HsTNGDPl q4l6/8pxqehmhZKlXWjHMowSGU486uKlh33rE0vA/p/NYes+4XcX1XSUpY+9Zn+CjFBr Pnxh4ry5j6V2MMKqtVZM+/IBD948IwNopgZbQwQS10JJcvfe0LPqAoHagEYnKa88nvTz wMLOQK8t/zeYDvMSeiKxasvkOUKwjCrs2alg2v1jlBGaRaxq5iIrRM7Ohx7l+qUSg+Wp +Oqw== 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=or2dbECxnpurnyDMf3aY/pIgT+JTIa/EycsL2GtCXSY=; b=DtadjRKy/Qr7tp6uzzkCUXQCZ/tKwVsaWxhM8Bikr9ps9JSWsk9JKipKhpdRIBNeKZ HZoVsgDea0vGbxY7GtQC4pWdJWgb7P8qc4RBfNEKXM/7+6qJldNTG4QmpPZzcIMw+ArX Fn8niTOae9l4deX02ZY2tg2DhjvR8+A5lbqHS/dBqLkwhKZQHokkjvwqu+yMy1fEGV8m q6HUgcDZbQtHhjF77pgZsJJxWuhPtg2yCtfpa+Z0RModygOwM6I15CQxR8/vL7N92+lN ZmP97ZWZHxMlpTp6LRLih20mLls8sdK2wCNIkPxDB9MiFe3UucwyzaIHALwNY4/btqsk xayA== X-Gm-Message-State: AOAM533dPOHu5/NZSeamf68qqlZvpfOFVVILd3aOnTbtysz0Hc2p5yrl 2VL3tZlDM9aViijDhLfmPc8l0g== X-Google-Smtp-Source: ABdhPJx/2C9Jo37q6Bid/XL+XWa9eVEVw3oyYoTyeOxejfCHncDcyu90+AfrysrErLamSyojbaaEOQ== X-Received: by 2002:a5d:5273:: with SMTP id l19mr1832129wrc.64.1598672325876; Fri, 28 Aug 2020 20:38:45 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:45 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 2/7] wcn36xx: Move wcn36xx_smd_set_sta_params() inside wcn36xx_smd_config_bss() Date: Sat, 29 Aug 2020 04:39:24 +0100 Message-Id: <20200829033929.2167761-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In order to facilitate functional decomposition of wcn36xx_smd_config_bss() we need to move wcn36xx_smd_set_sta_params() later in function. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/smd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index e8c2f4a152b4..654ef074b1eb 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1618,7 +1618,6 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_NONE; bss->reserved = 0; - wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params); /* wcn->ssid is only valid in AP and IBSS mode */ bss->ssid.length = vif_priv->ssid.length; @@ -1644,6 +1643,8 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, vif_priv->bss_type = bss->bss_type; + wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params); + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n", bss->bssid, bss->self_mac_addr, bss->bss_type, From patchwork Sat Aug 29 03:39: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: 11743965 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05F47109B for ; Sat, 29 Aug 2020 03:39:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9F1720872 for ; Sat, 29 Aug 2020 03:39:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iNNWC/2f" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727783AbgH2DjI (ORCPT ); Fri, 28 Aug 2020 23:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbgH2Dis (ORCPT ); Fri, 28 Aug 2020 23:38:48 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58743C061234 for ; Fri, 28 Aug 2020 20:38:48 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id b79so838055wmb.4 for ; Fri, 28 Aug 2020 20:38:48 -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=Inet6OCfp+FQ7rBZ5m79Dx9CVjCkFP88QA/07j0o8NA=; b=iNNWC/2fCLSalsnwsckxWXqWvaK53tdB1wHKwQwJT9ji3W3NBg7ejB0p/22b6efFPH fQMAJO8A+fl0vSV1f1CQFkVSqg7TeCUhIX++n89CC1r3p2wdEMr6dHeNeQEMF2Fpb5nT MazZ+SvCTq1kaero31+cWaimSGzfseUAjtLKIIumHBfN8DTYjZT48zZfR3d+plOjkhLm 6WHhllH/dqg00lOtlfp/7OixGHgj6WjBnPMz4xg4b/l+KQUAk+i0BtQFlfLuz3huDbog qoOTNH2lMGElqpsvNBE8OmPOvwb1sBk5j6VvP3rFV95YTfVr93+IRz0DFNqOrqEvo4bk TUYg== 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=Inet6OCfp+FQ7rBZ5m79Dx9CVjCkFP88QA/07j0o8NA=; b=sUe8dykBCPdAMS1GjQVU3MNuxDJoyx2plaRrdbYBk4KpVK1zJSMwLusbNvgPBZ39gm mD/CHuWgq+0hlssr3CHP0icFbacwPIbQvkdwlrfmDbUn7J/03GzzCm8vJCkOuLZyCsMt PuMCEwQB8pen4ZdF4SyGep57Kr4zCD/OQ0KpvwLjsV4rIOmlVsJivas5tkuSbouAE+77 a09YQ43CAElrCk3E0s6vh1BDLCGeZaqMN00aN+UpZTKcO7GgAGy1okYGs69vn41HfUQb Tb79NHLeBofQHreuFKO8rg8X7z758ckuunyoPEc2iIgOhG7MuuaZgHeDzQWKVparSuOX Csbg== X-Gm-Message-State: AOAM533sxsh1qzaCWXcmKpedfg+v/kpJnp13vx7Q0u2LZ5dP+TM6N78C MKKGpsJZ2BGp2PvH/+PbAdp9sA== X-Google-Smtp-Source: ABdhPJzSrig5k6c7XJ503+qiMIYQkgxl2UvrKeHKOpIFoy6GGnBAtSL/41HWSnoKt2MB73BADaKmEg== X-Received: by 2002:a1c:988d:: with SMTP id a135mr1498416wme.8.1598672327030; Fri, 28 Aug 2020 20:38:47 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:46 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 3/7] wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params() Date: Sat, 29 Aug 2020 04:39:25 +0100 Message-Id: <20200829033929.2167761-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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 --- drivers/net/wireless/ath/wcn36xx/smd.c | 172 +++++++++++++------------ 1 file changed, 92 insertions(+), 80 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 654ef074b1eb..4d15abed5493 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1392,6 +1392,97 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +static 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) { @@ -1499,7 +1590,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, @@ -1551,7 +1641,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); @@ -1565,84 +1654,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, From patchwork Sat Aug 29 03:39:26 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: 11743975 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE450109B for ; Sat, 29 Aug 2020 03:39:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D575220838 for ; Sat, 29 Aug 2020 03:39:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HIPVdGgI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbgH2DjR (ORCPT ); Fri, 28 Aug 2020 23:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgH2Dit (ORCPT ); Fri, 28 Aug 2020 23:38:49 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BDD4C061235 for ; Fri, 28 Aug 2020 20:38:49 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id e16so894981wrm.2 for ; Fri, 28 Aug 2020 20:38:49 -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=OfKzT0AQLv9vCASnT+Ck1FNtBdRG7UzTmfEa75WAP6U=; b=HIPVdGgIqrJu0YOXqxK6wFKDD1gqQ2p4RKCSM0fbzMnLmROBz/ap9rkZK1E1vyTdvb tbzo5NvFrEKNeZcIKVZ+lO/k/po46EoRfavRCp3LzV8kOy6wbWzrsfb3vSVMsGBsQCO7 aBZmBeJrlTMIYnBWnQhRcSdwMrWNdW56KZcC8XVS1FrXv00h7qETgyvzsNe08m8bEEXr KA+YIR5UdIeDGqgObtHLW5HUDvHKZXSPyJblp6AWIfQEKN92MaKhHNdoTsGmCrYU/X2u 3SmgnDYtsBA8nR1vCXJGfDQOqNLNV1tVphckCBJHX0m0YrE2zUnWZeqiCmGT2zg8DTxz uaeA== 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=OfKzT0AQLv9vCASnT+Ck1FNtBdRG7UzTmfEa75WAP6U=; b=d+ep3hdHSt8rqXFofp6e0CgtAIXhKQjUjvsp2z0u+RqOH7vG8dFIqQGmdJWKTNS09/ e9k5nd8xE/ZN7W0Bs8jmBEn49vo3RUb9CK8nxlQyd/sP5k5lzS34StUZqOEvKQZaRjFt vxyF2mP4pLF49fQegNHl7yXb2u29ZPkWFqJeLI35vPs+Bho42HpjJs1dhgELXwEGoTNj klSHWwyRZkh5I8zuVv/WwLEAO5KQSz95sh676cdJGV4Kks+4oegti4odxILzrXdVCAdl PkJZKHAGdAjOW38EmWqw8d2VsXaSttD/BgUI0BrzTkQVWgQKdHxGIQvw9m1n52acvu+S IKPg== X-Gm-Message-State: AOAM531kgh2Ay2RvbZVzMDtEO1+Vcut5e3UIjUfBN+Yy2FEgvLwivJd/ hmjsMZWAQNoEntnraBxRAWFwjQ== X-Google-Smtp-Source: ABdhPJxs64sNrquZXRasHMaJs47r8++fy+h1aUQLTK2YUI1PDZxj1HZe5R51d56kDIgP0pe5/8a1zw== X-Received: by 2002:adf:f7c3:: with SMTP id a3mr1691030wrq.162.1598672328149; Fri, 28 Aug 2020 20:38:48 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:47 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 4/7] wcn36xx: Add wcn36xx_smd_config_bss_v0 Date: Sat, 29 Aug 2020 04:39:26 +0100 Message-Id: <20200829033929.2167761-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This commit adds wcn36xx_smd_config_bss_v0() as a step along the road of functionally decomposing wcn36xx_smd_config_bss(). Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/smd.c | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 4d15abed5493..87fee9c1b981 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1590,6 +1590,47 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, return ret; } +int wcn36xx_smd_config_bss_v0(struct wcn36xx *wcn, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, const u8 *bssid, + bool update) +{ + struct wcn36xx_hal_config_bss_req_msg *msg; + struct wcn36xx_hal_config_bss_params *bss; + struct wcn36xx_hal_config_sta_params *sta_params; + int ret; + + msg = kzalloc(sizeof(*msg), GFP_KERNEL); + if (!msg) + return -ENOMEM; + + INIT_HAL_MSG((*msg), WCN36XX_HAL_CONFIG_BSS_REQ); + + bss = &msg->bss_params; + sta_params = &bss->sta; + + wcn36xx_smd_set_bss_params(wcn, vif, sta, bssid, update, bss); + wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params); + + PREPARE_HAL_BUF(wcn->hal_buf, (*msg)); + + wcn36xx_dbg(WCN36XX_DBG_HAL, + "hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n", + bss->bssid, bss->self_mac_addr, bss->bss_type, + bss->oper_mode, bss->nw_type); + + wcn36xx_dbg(WCN36XX_DBG_HAL, + "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n", + sta_params->bssid, sta_params->action, + sta_params->sta_index, sta_params->bssid_index, + sta_params->aid, sta_params->type, + sta_params->mac); + + ret = wcn36xx_smd_send_and_wait(wcn, msg->header.len); + kfree(msg); + + return ret; +} + static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta, From patchwork Sat Aug 29 03:39:27 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: 11743967 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75F93109B for ; Sat, 29 Aug 2020 03:39:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5957320838 for ; Sat, 29 Aug 2020 03:39:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lCBCF76d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727784AbgH2DjL (ORCPT ); Fri, 28 Aug 2020 23:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbgH2Div (ORCPT ); Fri, 28 Aug 2020 23:38:51 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10D06C061236 for ; Fri, 28 Aug 2020 20:38:51 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id e16so895011wrm.2 for ; Fri, 28 Aug 2020 20:38:50 -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=M2t9wZ7+9qiNghmksV/vhHyIEUoeWUrUP3bGc+D3Uw4=; b=lCBCF76dwsRAIsqL0TJgF+cjGH+CzUKtgIYxBFPae2LEaQiRL9OgFZ9+0X0zTSUD0V jUzD6SinouKLEyraTcjS37azGiP52weN8/RTh+FZ96gShZA1FhhHM6FBu8KOE8Sz6sJN JtgC40S646TBQws5jUFz3mxvsAI+A8PH17z8pWOjeo6uTRrpnHQw/34eVD4ylkexExSh /kjqfnqzmgVn1T2kt91LB56ThoAHpG0t8uWzthd5txtc8kD/PoqLtWU22V/EFTtQF1Y2 fcHxNTRysMN8aTAWgzOLEep3a3xwgDx6i2+2vzEa9c6PMKjI0FWxrSSzV7B3g8GTJBJm 5MTA== 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=M2t9wZ7+9qiNghmksV/vhHyIEUoeWUrUP3bGc+D3Uw4=; b=VXEKLVbzzamwzo+FKt73TTXoOa8oPBMNK7s71byva1i5bFq5PR4zKm1O4Kmt0slyMC XdnAsXonDIRBU34U/+ryVHn68rVGRqw4dAbWDtUGbQP0qAd0tjBTonqmjLQb1R+f6R5J s0RJK/beFj70TQx21t0irweWraywGY9DUvG/Pu+VFQtGMC9h2yO5OolEycEwRDIjj29n gi5wlrc97YHuVH7EAXDBZMIFGABn24TS+ma2WrJEaLicktnGgPFbaJBLoo9pMTl5NnV4 1wqN+zTw8yBvtmYXRr+4nm3exOY1khRabJE8rkJ1KwikbAGFoS+shRuUliz2MUgdeHFb +H0A== X-Gm-Message-State: AOAM532Yas1hPWvR31sHupOirDEBK9ZcuJQbzP+R9bTX+K0TPXb8iLzS +a/JKEw8Tf3LKf74khzpQlz2mg== X-Google-Smtp-Source: ABdhPJxyNdxs+uadYeCE1MT2DsughlkIbs7Xcrdef4N39jWi+YrGQ0pBZUc+pdY8D8q10U6VAfJ+fg== X-Received: by 2002:adf:f507:: with SMTP id q7mr1710067wro.343.1598672329743; Fri, 28 Aug 2020 20:38:49 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:48 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 5/7] wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally Date: Sat, 29 Aug 2020 04:39:27 +0100 Message-Id: <20200829033929.2167761-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch updates wcn36xx_smd_config_bss_v1() to update on internally derived parameters only, specifically making use of STA v1 wrapper routines previously added. Once done we no longer need to pass a struct wcn36xx_hal_config_bss_req_msg which gives us options in later patches to eliminate the kzalloc() in wcn36xx_smd_config_bss entirely. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/smd.c | 116 +++++++++++++------------ 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 87fee9c1b981..360348456070 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1483,11 +1483,13 @@ static void wcn36xx_smd_set_bss_params(struct wcn36xx *wcn, 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) +int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, struct ieee80211_vif *vif, + struct ieee80211_sta *sta_80211, const u8 *bssid, + bool update) { struct wcn36xx_hal_config_bss_req_msg_v1 *msg_body; struct wcn36xx_hal_config_bss_params_v1 *bss; + struct wcn36xx_hal_config_bss_params bss_v0; struct wcn36xx_hal_config_sta_params_v1 *sta; int ret; @@ -1505,72 +1507,74 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, bss = &msg_body->bss_params; sta = &bss->sta; + memset(&bss_v0, 0x00, sizeof(bss_v0)); + wcn36xx_smd_set_bss_params(wcn, vif, sta_80211, bssid, update, &bss_v0); + wcn36xx_smd_set_sta_params_v1(wcn, vif, sta_80211, sta); + /* convert orig to v1 */ - memcpy(bss->bssid, &orig->bss_params.bssid, ETH_ALEN); - memcpy(bss->self_mac_addr, &orig->bss_params.self_mac_addr, ETH_ALEN); + memcpy(bss->bssid, &bss_v0.bssid, ETH_ALEN); + memcpy(bss->self_mac_addr, &bss_v0.self_mac_addr, ETH_ALEN); - bss->bss_type = orig->bss_params.bss_type; - bss->oper_mode = orig->bss_params.oper_mode; - bss->nw_type = orig->bss_params.nw_type; + bss->bss_type = bss_v0.bss_type; + bss->oper_mode = bss_v0.oper_mode; + bss->nw_type = bss_v0.nw_type; bss->short_slot_time_supported = - orig->bss_params.short_slot_time_supported; - bss->lla_coexist = orig->bss_params.lla_coexist; - bss->llb_coexist = orig->bss_params.llb_coexist; - bss->llg_coexist = orig->bss_params.llg_coexist; - bss->ht20_coexist = orig->bss_params.ht20_coexist; - bss->lln_non_gf_coexist = orig->bss_params.lln_non_gf_coexist; + bss_v0.short_slot_time_supported; + bss->lla_coexist = bss_v0.lla_coexist; + bss->llb_coexist = bss_v0.llb_coexist; + bss->llg_coexist = bss_v0.llg_coexist; + bss->ht20_coexist = bss_v0.ht20_coexist; + bss->lln_non_gf_coexist = bss_v0.lln_non_gf_coexist; bss->lsig_tx_op_protection_full_support = - orig->bss_params.lsig_tx_op_protection_full_support; - bss->rifs_mode = orig->bss_params.rifs_mode; - bss->beacon_interval = orig->bss_params.beacon_interval; - bss->dtim_period = orig->bss_params.dtim_period; - bss->tx_channel_width_set = orig->bss_params.tx_channel_width_set; - bss->oper_channel = orig->bss_params.oper_channel; - bss->ext_channel = orig->bss_params.ext_channel; - - bss->reserved = orig->bss_params.reserved; - - memcpy(&bss->ssid, &orig->bss_params.ssid, - sizeof(orig->bss_params.ssid)); - - bss->action = orig->bss_params.action; - bss->rateset = orig->bss_params.rateset; - bss->ht = orig->bss_params.ht; - bss->obss_prot_enabled = orig->bss_params.obss_prot_enabled; - bss->rmf = orig->bss_params.rmf; - bss->ht_oper_mode = orig->bss_params.ht_oper_mode; - bss->dual_cts_protection = orig->bss_params.dual_cts_protection; + bss_v0.lsig_tx_op_protection_full_support; + bss->rifs_mode = bss_v0.rifs_mode; + bss->beacon_interval = bss_v0.beacon_interval; + bss->dtim_period = bss_v0.dtim_period; + bss->tx_channel_width_set = bss_v0.tx_channel_width_set; + bss->oper_channel = bss_v0.oper_channel; + bss->ext_channel = bss_v0.ext_channel; + + bss->reserved = bss_v0.reserved; + + memcpy(&bss->ssid, &bss_v0.ssid, + sizeof(bss_v0.ssid)); + + bss->action = bss_v0.action; + bss->rateset = bss_v0.rateset; + bss->ht = bss_v0.ht; + bss->obss_prot_enabled = bss_v0.obss_prot_enabled; + bss->rmf = bss_v0.rmf; + bss->ht_oper_mode = bss_v0.ht_oper_mode; + bss->dual_cts_protection = bss_v0.dual_cts_protection; bss->max_probe_resp_retry_limit = - orig->bss_params.max_probe_resp_retry_limit; - bss->hidden_ssid = orig->bss_params.hidden_ssid; - bss->proxy_probe_resp = orig->bss_params.proxy_probe_resp; - bss->edca_params_valid = orig->bss_params.edca_params_valid; - - memcpy(&bss->acbe, &orig->bss_params.acbe, - sizeof(orig->bss_params.acbe)); - memcpy(&bss->acbk, &orig->bss_params.acbk, - sizeof(orig->bss_params.acbk)); - memcpy(&bss->acvi, &orig->bss_params.acvi, - sizeof(orig->bss_params.acvi)); - memcpy(&bss->acvo, &orig->bss_params.acvo, - sizeof(orig->bss_params.acvo)); + bss_v0.max_probe_resp_retry_limit; + bss->hidden_ssid = bss_v0.hidden_ssid; + bss->proxy_probe_resp = bss_v0.proxy_probe_resp; + bss->edca_params_valid = bss_v0.edca_params_valid; + + memcpy(&bss->acbe, &bss_v0.acbe, + sizeof(bss_v0.acbe)); + memcpy(&bss->acbk, &bss_v0.acbk, + sizeof(bss_v0.acbk)); + memcpy(&bss->acvi, &bss_v0.acvi, + sizeof(bss_v0.acvi)); + memcpy(&bss->acvo, &bss_v0.acvo, + sizeof(bss_v0.acvo)); bss->ext_set_sta_key_param_valid = - orig->bss_params.ext_set_sta_key_param_valid; + bss_v0.ext_set_sta_key_param_valid; memcpy(&bss->ext_set_sta_key_param, - &orig->bss_params.ext_set_sta_key_param, - sizeof(orig->bss_params.acvo)); - - bss->wcn36xx_hal_persona = orig->bss_params.wcn36xx_hal_persona; - bss->spectrum_mgt_enable = orig->bss_params.spectrum_mgt_enable; - bss->tx_mgmt_power = orig->bss_params.tx_mgmt_power; - bss->max_tx_power = orig->bss_params.max_tx_power; + &bss_v0.ext_set_sta_key_param, + sizeof(bss_v0.acvo)); - wcn36xx_smd_convert_sta_to_v1(wcn, &orig->bss_params.sta, sta); + bss->wcn36xx_hal_persona = bss_v0.wcn36xx_hal_persona; + bss->spectrum_mgt_enable = bss_v0.spectrum_mgt_enable; + bss->tx_mgmt_power = bss_v0.tx_mgmt_power; + bss->max_tx_power = bss_v0.max_tx_power; PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body)); @@ -1711,7 +1715,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, sta_params->mac); if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) { - ret = wcn36xx_smd_config_bss_v1(wcn, msg); + ret = wcn36xx_smd_config_bss_v1(wcn, vif, sta, bssid, update); } else { PREPARE_HAL_BUF(wcn->hal_buf, (*msg)); From patchwork Sat Aug 29 03:39:28 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: 11743973 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8CA51575 for ; Sat, 29 Aug 2020 03:39:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C107E20872 for ; Sat, 29 Aug 2020 03:39:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QLKHbzn/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727813AbgH2DjQ (ORCPT ); Fri, 28 Aug 2020 23:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgH2Diw (ORCPT ); Fri, 28 Aug 2020 23:38:52 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74234C061237 for ; Fri, 28 Aug 2020 20:38:52 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e16so895057wrm.2 for ; Fri, 28 Aug 2020 20:38:52 -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=7wSp9Uc31N+F391d+EwEdxeVPC+PHewHvyf7Qc4RkB8=; b=QLKHbzn/8D5DxiEtkzmemLHocLZctxdRUhXfO4Le6dGH/nXvxM3stqjNvSsvmdwBbW 5LVKpiq7x/8KzY4/voVW43ErDPDJgyTmO3lcCXiUpncBP87i8dQLKbxfneui0m5LHgu0 ZXDuIB0P31ZiuHWuYbb9gUKFx3fH4k9EaM50MAdhvh9ZR8h5tN7OznpPWRiQnEakwtL0 wqHlE+LuVakeOV9e5pbQiOu8h/y9MG7P/8724a/YlEcOMBoXEKd15xgAKcreYT3MBofh 5+/2/1f/6+D6dU6AKn22W/JQTbqpi+0pQHMi8/2LsaPAIq0T8hVtW0j3t4Tw2PMjZY0m +SAQ== 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=7wSp9Uc31N+F391d+EwEdxeVPC+PHewHvyf7Qc4RkB8=; b=E6bq9hf2ESwNc1jNibIwExeTA9K2uruY8KSn2Hcx1vcB4VIygnvuIr1ZdI0mIPsrws c//9BUDwKMqcTE5fpi0RZTlgeck/TsLNKahhn7MrPC9Ci3A6kr/9u3O9eNwFhfkLAZby gSHrPBkOAYiT4CnzroZzc5602TPlaN/FEuBFxl6UQto9KathrNvAVcvt4hHV450PmJAv 6h7JAtDgpnE2KR8qx1gk+dc51ryRvN2GQI1vjtYafGjJe6ZCLbbEReItkUDxU8fzYAMc keftkKSoWlqlGJevlazN++fBn7pNe9rpspSqGfjAw7io33B52q4ZWA96EhtHLQl9cUCM n6Vw== X-Gm-Message-State: AOAM532hAbOSOwptxTqdE8bfeqgy9SOUvOgJVzNWObnjQNkI7YNR4WNl gVc91Nq61H9ONs858feYZ05o2g== X-Google-Smtp-Source: ABdhPJxkALG/H6goUDu4JS6Y9HbRlkoW4GKocGchHw2UKtNh6pAaDn63s+Pu0T6KYEmvqXN6wkbi0w== X-Received: by 2002:adf:cf10:: with SMTP id o16mr1589985wrj.380.1598672331177; Fri, 28 Aug 2020 20:38:51 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:50 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 6/7] wcn36xx: Convert to using wcn36xx_smd_config_bss_v0() Date: Sat, 29 Aug 2020 04:39:28 +0100 Message-Id: <20200829033929.2167761-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org A previous patch added wcn36xx_smd_config_bss_v0() this patch converts the version 0 data-path in wcn36xx_smd_config_bss() to use wcn36xx_smd_config_bss_v0(). Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/smd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 360348456070..9acf1af14c54 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1717,9 +1717,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) { ret = wcn36xx_smd_config_bss_v1(wcn, vif, sta, bssid, update); } else { - PREPARE_HAL_BUF(wcn->hal_buf, (*msg)); - - ret = wcn36xx_smd_send_and_wait(wcn, msg->header.len); + ret = wcn36xx_smd_config_bss_v0(wcn, vif, sta, bssid, update); } if (ret) { wcn36xx_err("Sending hal_config_bss failed\n"); From patchwork Sat Aug 29 03:39:29 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: 11743969 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B2C6109B for ; Sat, 29 Aug 2020 03:39:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3361420838 for ; Sat, 29 Aug 2020 03:39:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X7A5f5kI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727046AbgH2DjN (ORCPT ); Fri, 28 Aug 2020 23:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727069AbgH2Diy (ORCPT ); Fri, 28 Aug 2020 23:38:54 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0232FC061232 for ; Fri, 28 Aug 2020 20:38:54 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id o4so906398wrn.0 for ; Fri, 28 Aug 2020 20:38:53 -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=uxv61ncwVKFnMMfQ3MXOOnXWNB/b+jhNeIcIEXIr8Og=; b=X7A5f5kIZQxiUDKLPU+AyV/QmxXLuswYHbKSh6F1VmRxPjWCzx3SyQ4oHX5H1S6t2u mGXjZQfvo1/SQNzftI86fsJS9aq1sIKYUqQy3kShimW8ZADkw3q02mrzeydHmTnNFeIp 7q1hL3lNe0NxQYXBXvJEmHERxi+yEixSHy4Ry2RQeY7kWK3JlOAKbflMcpNDAg7Rhwyp ZMM7aLgFlSS6KO+xOiZww2BGgQJtNR7j3g4zpg3Ht6oQQ5xIa1SlJ3z2YuxeiLzqCRKj Shd4Dh9A8aLG9iOTf3pkjxGKUa6WU8+lltBmEXwUxP3RiRA0sME22LunfGHJH95+E/UQ CdBA== 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=uxv61ncwVKFnMMfQ3MXOOnXWNB/b+jhNeIcIEXIr8Og=; b=Ym91XkT4Rv6AOuS6lC5sXOEPp6rl7NPKE8MzNpCg5eAhrZg9WGIvecs/8+SDeTWbUW hmyGCKKCrvS4cJ7OgX1S2nbcFOQtVeUda76XXPMTN2356Pi8DUUejWKNCDUdbEMA13Cn 9sZz/amB3EAdVO8yS0GfeD2OAPBwvDIzun7LTAFm/yxHiExJ7z5XPNr714Xa/DneP3UI kpX6JJYbH+OcF8ufZ6btc9XF/qi3T+jurzC6kQjygE+ic/lVkkZ6q1cU3u/QIOLRZDIP fLmpamQBHB2r3VRlGn/grRg7q8FWHJKonCHQAtI/6/xPa9P30cIuS3LvbxJ62QEi30Lb az0w== X-Gm-Message-State: AOAM533zd2XOlzxlKnNyUVMcTBJsGxcIj2HvtuKHuNABx2ieWxA2eV7M g5RCpVzxhDgokyLoCrYJFYuBBg== X-Google-Smtp-Source: ABdhPJwzhrKlkVFHTpphp9UXmECJmvvV9nQFnNgEil6PtJvM1c/nJl74SDv3c2LC83vJEprwqwR11g== X-Received: by 2002:adf:f106:: with SMTP id r6mr1752085wro.106.1598672332736; Fri, 28 Aug 2020 20:38:52 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id s20sm1691700wmh.21.2020.08.28.20.38.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 20:38:52 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org Subject: [PATCH v2 7/7] wcn36xx: Remove dead code in wcn36xx_smd_config_bss() Date: Sat, 29 Aug 2020 04:39:29 +0100 Message-Id: <20200829033929.2167761-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> References: <20200829033929.2167761-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org wcn36xx_smd_config_bss_v0() and wcn36xx_smd_config_bss_v1() have been designed to operate in standalone fashion. As a result we can drop the dead code now present in wcn36xx_smd_config_bss() and happily remove one kzalloc from the BSS config path as we do so. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/smd.c | 39 ++++---------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 9acf1af14c54..2c58f7050836 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1683,42 +1683,15 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta, const u8 *bssid, bool update) { - struct wcn36xx_hal_config_bss_req_msg *msg; - struct wcn36xx_hal_config_bss_params *bss; - struct wcn36xx_hal_config_sta_params *sta_params; int ret; mutex_lock(&wcn->hal_mutex); - msg = kzalloc(sizeof(*msg), GFP_KERNEL); - if (!msg) { - ret = -ENOMEM; - goto out; - } - INIT_HAL_MSG((*msg), WCN36XX_HAL_CONFIG_BSS_REQ); - - bss = &msg->bss_params; - sta_params = &bss->sta; - - 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, - "hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n", - bss->bssid, bss->self_mac_addr, bss->bss_type, - bss->oper_mode, bss->nw_type); - wcn36xx_dbg(WCN36XX_DBG_HAL, - "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n", - sta_params->bssid, sta_params->action, - sta_params->sta_index, sta_params->bssid_index, - sta_params->aid, sta_params->type, - sta_params->mac); - - if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) { + if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) ret = wcn36xx_smd_config_bss_v1(wcn, vif, sta, bssid, update); - } else { + else ret = wcn36xx_smd_config_bss_v0(wcn, vif, sta, bssid, update); - } + if (ret) { wcn36xx_err("Sending hal_config_bss failed\n"); goto out; @@ -1728,12 +1701,10 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, sta, wcn->hal_buf, wcn->hal_rsp_len); - if (ret) { + if (ret) wcn36xx_err("hal_config_bss response failed err=%d\n", ret); - goto out; - } + out: - kfree(msg); mutex_unlock(&wcn->hal_mutex); return ret; }