From patchwork Mon Dec 28 16:28:36 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: 352764 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp10027931ejs; Mon, 28 Dec 2020 08:27:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1Zj8s42SOYBLAjJm2dDfQsqg0+vgSpZHEuTTmfBEA9Ruyr7hK17eLBTuNsgE1UZZR6ilX X-Received: by 2002:a5d:8a1a:: with SMTP id w26mr36789360iod.112.1609172873627; Mon, 28 Dec 2020 08:27:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172873; cv=none; d=google.com; s=arc-20160816; b=01gBC3t9JyXxcnkeosuaaCpEV3nQnZp62Aoy8eGojbofbTlT0jKOna2v7jHg0LbOOK zvxw/TaaiykgztHZrlstbeR9cnqkTJdpcZLvYzV/Qp/gqhDkeKGbVKyRYAfGP8DPIu/4 ekkBsh36uMA54HYmoCqyyIh2DbLDFl9ctE9sb2zQLL0V+KRvYDoWX9TB9cvVaX9wxXfm EReiClujwjWkAbrlz6EXit1Yd9xIvup8OhuWioFWbP5JRLwuxsr5/gUZ2E489BYeapT5 EK8+dbXjPL/Ae1VprVD2PJbHbDy8V8IpQHgKfXBqF0IdAKdKfN/kV0ejkkEeGHhvGRli IUpw== 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=HXJoJcs4+xfXFWA1igW1JddGjOEimW4I4/S504N/gzM=; b=hfSrvynkRSnNwTnO43JAOTeiDrx9NTeWq+joPwlwP74w6fhiuQ3NgTSnRMKB4OEAIr z0TAL8DJyM100zM5g5hofDk9GfFLu0NYStA5ith7oMK+aFr3hLskyiA89m5J+Ibvey3J N5ZrwRpwhh0NtEg+L9LmoxJcUhxlMN/AkF/h5fapB/f4NpHAzYmhhDnmgvIlTQ77CO81 XLvDse26kr/YozW6ICbUFGEHeRBTNk/ejcK+U41CVzDjwPEXNDlarvc4VXo+yRWQrXYk 6J03RClSKaYxL4Jc1DOSz/+5QM3LdwQzfzBZ+5nEM9yCHbaeeK85ZLQeeTZVZUJjsLAK 0WTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=Iy9EGUTA; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gDY9SHDE; 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 k1si25530261ilc.40.2020.12.28.08.27.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:53 -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=Iy9EGUTA; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gDY9SHDE; 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=HXJoJcs4+xfXFWA1igW1JddGjOEimW4I4/S504N/gzM=; b=Iy9EGUTA1/hf26tUKnDtqnuL7 PIvcfOzPeiJLMavUT7bLv8nPzOYaaOi6vtfBH2UDGZel/DmMewGpmY1njnYY6D8vlVsM1MObO5zSw xs+614W0ykGbpXlc/rgYNCwAVA/x9M50LhAgIMgMlaKV2hvGYousd52XSZsa4jChz7ooBXb8ghyU6 9WgfHzCBxv9vUpaGJB9xdiWfeuj7T/Hs01jsjIKOo5SFPzwxquL1HLqHDUzN/o8H5LjH/lX8UnC4x CYguR2PW3fV8ssoriyAvckxpwLzTiiSehMmgD6aP841Ojll8zjGWG7o+lER7NeM52y/1v/gkW1kkB zlBYXSRQA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvN3-0004dD-No; Mon, 28 Dec 2020 16:27:45 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvN0-0004Zt-Qb for wcn36xx@lists.infradead.org; Mon, 28 Dec 2020 16:27:43 +0000 Received: by mail-wr1-x432.google.com with SMTP id d26so11721573wrb.12 for ; Mon, 28 Dec 2020 08:27:42 -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=/3oMZ0XZXTwR2OTVYcKlJpwlfLbWhAGf9POHgc7WDlA=; b=gDY9SHDEwZjqC5Yd9qSLQtJPQfZoC4Dfg1PYZrp9vO7Ru4H2lyZlbeSkIfDarXy6/o PHZj0iSyKYOXRa+0HAuIKFrLubu0fEA+C6OB3hOfX33qLnsMpEYylxlUS6EThMlLALub iA5PLE6qgNwsEsRepf03KcLGzm75TgwLIGr/MGfY9bx9w87l2GUXnSQVTRY0PSv40GkY c42kvOthOu82NX8GmP3hpthn5fLW6nzpNzB8zs/kc12X7RKpjavNP+xOOsVyOfgDNwTa 8fcUsgXO1KzJr993fIbtVjlmrakiIwrUNcG0riDzcbQzG+wnJfrXH3q7CLhUjtaEkTH7 oRJQ== 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=/3oMZ0XZXTwR2OTVYcKlJpwlfLbWhAGf9POHgc7WDlA=; b=RUl5h6o1sf5xEJymlG3jeBUyvpQtihLLRZ/lPe6L8UCwbAFDSPuYTwHD0xVhTvV99t wFmCHdmgM/f0DSoswZ/Xy/nM/aIMC2Jo6xW0H7Fc6Rm9NfKU8QFYJJsMB+L24pk52/Dm nmSBvd7H5Zp8xuOY2eKi6MXpk7tYZgd4JvAIvkarFdOLV9FUGDNkIlOJUh3ta2X1DVbR tI2gWcx8D87hb26xWBuqgyRHNaz/au9z1pvQ7v53ksUzKOGoAQ0PGdNr77KwYnaRVpdu Uo0WCy94aTy6CL1QaIi06Npi7+TeniIvI2unCwKjNIjYAb5jpjFSIAu2oMj7lR1DdB/S xbsw== X-Gm-Message-State: AOAM532NIF7iz5ZcYZ+RPp9uFKVwUd8Rq0mpy2q60JgRE8fNtXt0dDYT Cm4UxInwXg7RhP6LQogPgBJDYQ== X-Received: by 2002:a5d:67c3:: with SMTP id n3mr51447656wrw.297.1609172861427; Mon, 28 Dec 2020 08:27:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:40 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH 10/13] wcn36xx: Add GTK offload info to WoWLAN resume Date: Mon, 28 Dec 2020 16:28:36 +0000 Message-Id: <20201228162839.369156-11-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_112742_903188_29B276D2 X-CRM114-Status: GOOD ( 16.49 ) 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:432 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 Having enabled GTK rekey in suspend, we need to extract the replay counter from the firmware on resume and perform a ieee80211_gtk_rekey_notify() so that the STA remains verified from the perspective of the AP. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 4 +- drivers/net/wireless/ath/wcn36xx/main.c | 5 +- drivers/net/wireless/ath/wcn36xx/smd.c | 72 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 81 insertions(+), 3 deletions(-) -- 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 1f3c2e840232..455143c4164e 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4919,7 +4919,7 @@ struct wcn36xx_hal_gtk_offload_rsp_msg { struct wcn36xx_hal_gtk_offload_get_info_req_msg { struct wcn36xx_hal_msg_header header; u8 bss_index; -}; +} __packed; struct wcn36xx_hal_gtk_offload_get_info_rsp_msg { struct wcn36xx_hal_msg_header header; @@ -4943,7 +4943,7 @@ struct wcn36xx_hal_gtk_offload_get_info_rsp_msg { u32 igtk_rekey_count; u8 bss_index; -}; +} __packed; struct dhcp_info { /* Indicates the device mode which indicates about the DHCP activity */ diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index aa2a416daa7f..b48a3f0dcc0b 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -173,7 +173,9 @@ static struct ieee80211_supported_band wcn_band_5ghz = { #ifdef CONFIG_PM static const struct wiphy_wowlan_support wowlan_support = { - .flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_MAGIC_PKT + .flags = WIPHY_WOWLAN_ANY | + WIPHY_WOWLAN_MAGIC_PKT | + WIPHY_WOWLAN_SUPPORTS_GTK_REKEY }; #endif @@ -1149,6 +1151,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_gtk_offload_get_info(wcn, vif); 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 db7988176526..dd12575f33c3 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2886,6 +2886,77 @@ int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +static int wcn36xx_smd_gtk_offload_get_info_rsp(struct wcn36xx *wcn, + struct ieee80211_vif *vif) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_gtk_offload_get_info_rsp_msg *rsp; + __be64 replay_ctr; + + if (wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len)) + return -EIO; + + rsp = (struct wcn36xx_hal_gtk_offload_get_info_rsp_msg *)wcn->hal_buf; + + if (rsp->bss_index != vif_priv->bss_index) { + wcn36xx_err("gtk_offload_info invalid response bss index %d\n", + rsp->bss_index); + return -ENOENT; + } + + replay_ctr = cpu_to_be64(le64_to_cpu(rsp->key_replay_counter)); + if (vif_priv->rekey_data.replay_ctr != rsp->key_replay_counter) { + vif_priv->rekey_data.replay_ctr = rsp->key_replay_counter; + ieee80211_gtk_rekey_notify(vif, vif->bss_conf.bssid, + (void *)&replay_ctr, GFP_KERNEL); + wcn36xx_dbg(WCN36XX_DBG_HAL, + "GTK replay counter increment %llu\n", + rsp->key_replay_counter); + } + + wcn36xx_dbg(WCN36XX_DBG_HAL, + "gtk offload info status %d last_rekey_status %d " + "replay_counter %llu total_rekey_count %d gtk_rekey_count %d " + "igtk_rekey_count %d bss_index %d\n", + rsp->status, rsp->last_rekey_status, + rsp->key_replay_counter, rsp->total_rekey_count, + rsp->gtk_rekey_count, rsp->igtk_rekey_count, + rsp->bss_index); + + return 0; +} + +int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, + struct ieee80211_vif *vif) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_gtk_offload_get_info_req_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_GTK_OFFLOAD_GETINFO_REQ); + + msg_body.bss_index = vif_priv->bss_index; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending gtk_offload_get_info failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("gtk_offload_get_info failed err=%d\n", ret); + goto out; + } + ret = wcn36xx_smd_gtk_offload_get_info_rsp(wcn, vif); +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) { @@ -2936,6 +3007,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_HOST_OFFLOAD_RSP: case WCN36XX_HAL_GTK_OFFLOAD_RSP: + case WCN36XX_HAL_GTK_OFFLOAD_GETINFO_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 dd6710672db8..b225c805107c 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -156,4 +156,7 @@ int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, bool enable); +int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, + struct ieee80211_vif *vif); + #endif /* _SMD_H_ */