From patchwork Mon Dec 28 16:28:35 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: 352762 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp10027881ejs; Mon, 28 Dec 2020 08:27:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/DXFR7c7mLoyPjGbAh899cklIXPptn3U3KVLXaZH2kosNqaulKYR6BxG1GZ2+5n1xQgXq X-Received: by 2002:a92:cdac:: with SMTP id g12mr43762367ild.145.1609172868334; Mon, 28 Dec 2020 08:27:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172868; cv=none; d=google.com; s=arc-20160816; b=PTZ9t2TYSdSRLiKGx/ZGNg67UDTb6eXapP4S8l3CPSrgjSSi2auSXtCmR1PzAf4wwc s2vPBD0NjFCUumMUl1DzjEGR5N61vmETIEgEKUTip236RythB81dIOS0sO96aOUNLdr+ o5mcHVBrZKJms/tSx+Y8K2+uGJntz7sIDVLnHQXt+niSqzsihYpOytsf20IaRemckkvT ownkrzFVyUb8ab8cuJsIX1QM5ml1Z0iFZWQVoKD0cbE2/LUUZ6bUax55S2LnGaPi+zLk vdpzSSrY2zhOtW1345etnhVJvRG8peHzr1In5s6uarzvAdX61COnyLfUUph5ncS+SaEO kfHw== 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=HBG1YM5oBkrCKteuS+uzqBW9yTkmuNgnB/8ZvdlKSCQ=; b=iEZ6VbVT4TYSeTj8VdEJn3Xatyci8bpTVEMQTtFzhy7qa7AO32sTekLrHAMzlV37eE 5W4ckmBqaNG1+2IXmkHgJIPQOSOtj82VJjN4IcFkEaqGsC2KMcZMoz1JGjKlpV02tWRe A5KoOIcRPLoAiCMzpSNThip4BUZh9+a/BEglYhIuZrZ+RBwseAPkuZSbk3W8fo5s3H3n GJ4moRvT5/zsQ67DNRqd4pOrq8YyKc/prLixlWduvRR2uht+wC6Ei6CK6bDTJMCpM59U B2blKK6Hf96yvfpzkd137l6WohgWlzwoHyowlAW766ocd2eirId4EnAiyHFi0Pv+yYwJ PCFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=WRR+XNmC; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VmVxNNjd; 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 b8si26981920ilo.54.2020.12.28.08.27.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:48 -0800 (PST) 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=WRR+XNmC; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VmVxNNjd; 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=HBG1YM5oBkrCKteuS+uzqBW9yTkmuNgnB/8ZvdlKSCQ=; b=WRR+XNmCG6MvbfFuuyN6fNJ6N P2Rm9vdIyBuO8sDSOoOQ4pNm6qB5Enogbm9ngQlgCiAqVNeJO4dwAmuGGVIUwwDBkAdWNNrBmzzsY cvQ+xzLAKC4IQGHoJ6OPVUg5qsk/Ugv9mFJ/zTb540MQRb7eIwvHwg/GUZS0Y207Q9sagXo00h8Hn kk/HhtyQzCiYUbzBJO0bud20/aQetgC11dZsO4BBtbkxWQe+cj3E7fn5yQvjpnNQ7fFua7mb1hp6p Jl4ASjHGX19KeSI8NWJSFidnkxpt7ZdylVt89NC6DL1sCzn8uSEshdlAYM6Xy6ZxFGh0FnasqJWau vKsBYsGWg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvN2-0004cT-Pi; Mon, 28 Dec 2020 16:27:44 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvMz-0004Z3-O4 for wcn36xx@lists.infradead.org; Mon, 28 Dec 2020 16:27:42 +0000 Received: by mail-wm1-x330.google.com with SMTP id q75so10224769wme.2 for ; Mon, 28 Dec 2020 08:27:41 -0800 (PST) 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=6D//l+W7/CZ439o0lMCQJjFN9QzC2gpJYA4w5visRz4=; b=VmVxNNjd896mlU5ueCgdu15CNfm8kvPBCtyjbFXP01LwiiBqXclXGJUDWgRp2WdLDv jRFEda+RODG6Xero3gU9pt9BA6OdwZ0xVpU6yKMUHVf4aOOrJop3+SnlYLrQrGSzT1Jd A3pskoAKOCpnGai634CPnvlhslIeJpZZoDLnZa0UQjp9i/ww2qTuKRXmddAh2WOYe5Q4 Q8hKewjHqQDoREExy4DBaeYrWdXX7XGmqSzY4Dm/BUBWM/ndBnf3MXk7Acq8k32EvE3+ gy6vwizEcYaEbr7Ftu5noh7zrbKtD9tQ/ca/+ubycO1hfcwyq12R+d6qExrvwJeJwTEh p7YQ== 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=6D//l+W7/CZ439o0lMCQJjFN9QzC2gpJYA4w5visRz4=; b=cuBhf/weM+vbf959iG0k5eJXWl1V6ARKCnhjytWPJGHmsZSVHxdEaJfYA+3amXhFNL e+UXQVPd5eUx77vhvU+UyNBBb1GH4X47OCk/1LS6lnOQdMBQd2iIGmmWiZDwYJtP1R2L /Co0yu07ozvldTpeDCHZXWjoTP1kVZ6pV/gYGNEorCWMu1jIrYcRhaaHxpWKWnHNjJT+ +0xJUdGSyeFaM8kHoQSAajYwtb05W79udwSEBLziHGdf1asI+ZLWxmkWkQZtKLnjQzCj KQZbkl9/eXQRZldwxBrg50pJpyYoQM/sGa5/k4Viv5hXIoxve/EI7pBqZ5elW51ZfdM/ amEg== X-Gm-Message-State: AOAM5315z+FvHCNhRivgX2C98xsWNYRF4s5QQUOA54NBy05IIMIeKrye DFX/r7HxPfqtGvpjyXBi49arkw== X-Received: by 2002:a7b:c19a:: with SMTP id y26mr20489509wmi.20.1609172860318; Mon, 28 Dec 2020 08:27:40 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:39 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH 09/13] wcn36xx: Add GTK offload to WoWLAN path Date: Mon, 28 Dec 2020 16:28:35 +0000 Message-Id: <20201228162839.369156-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-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-20201228_112741_933137_F6A025B7 X-CRM114-Status: GOOD ( 15.98 ) 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:330 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_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 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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, benl@squareup.com Sender: "wcn36xx" Errors-To: wcn36xx-bounces+patch=linaro.org@lists.infradead.org Using previously set GTK KCK and KEK material this commit adds GTK rekeying to the WoWLAN suspend/resume path. A small error in the packing of the up to now unused command structure is fixed as we go. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 2 +- drivers/net/wireless/ath/wcn36xx/main.c | 4 +++ drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 46 insertions(+), 1 deletion(-) -- 2.29.2 _______________________________________________ wcn36xx mailing list wcn36xx@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wcn36xx diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 3b949b0b3792..1f3c2e840232 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4905,7 +4905,7 @@ struct wcn36xx_hal_gtk_offload_req_msg { u64 key_replay_counter; u8 bss_index; -}; +} __packed; struct wcn36xx_hal_gtk_offload_rsp_msg { struct wcn36xx_hal_msg_header header; diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b3388e4a76d2..aa2a416daa7f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1121,6 +1121,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) if (ret) goto out; ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true); + if (ret) + goto out; + ret = wcn36xx_smd_gtk_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); @@ -1146,6 +1149,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_gtk_offload(wcn, vif, false); wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); } diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index b05f1e1f253a..db7988176526 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2849,6 +2849,43 @@ int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_gtk_offload_req_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_GTK_OFFLOAD_REQ); + + if (enable) { + memcpy(&msg_body.kek, vif_priv->rekey_data.kek, NL80211_KEK_LEN); + memcpy(&msg_body.kck, vif_priv->rekey_data.kck, NL80211_KCK_LEN); + msg_body.key_replay_counter = vif_priv->rekey_data.replay_ctr; + msg_body.bss_index = vif_priv->bss_index; + } else { + msg_body.flags = WCN36XX_HAL_GTK_OFFLOAD_FLAGS_DISABLE; + } + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending host_offload_arp failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("host_offload_arp failed err=%d\n", ret); + goto out; + } +out: + mutex_unlock(&wcn->hal_mutex); + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { @@ -2898,6 +2935,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_START_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_HOST_OFFLOAD_RSP: + case WCN36XX_HAL_GTK_OFFLOAD_RSP: memcpy(wcn->hal_buf, buf, len); wcn->hal_rsp_len = len; complete(&wcn->hal_rsp_compl); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 380ea58b58ec..dd6710672db8 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -153,4 +153,7 @@ int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, bool enable); +int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable); + #endif /* _SMD_H_ */