From patchwork Fri Mar 19 16:15:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 404816 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1511223jai; Fri, 19 Mar 2021 09:14:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrwtX3owTwUCVJOaL5B5cX+qKxyg20DPO/JINA92BMVMqPe6zhhjVtA2e43WhCMpjh+wX8 X-Received: by 2002:a5d:6411:: with SMTP id z17mr5202345wru.119.1616170450599; Fri, 19 Mar 2021 09:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616170450; cv=none; d=google.com; s=arc-20160816; b=JOHTttaZPjcnn4qQAq/LTZ8R3ueq3xDkm/gd5cFDXS0RDjoFMxyI8cL9cIt8zNyQ5r cr4eGA/U7fksNXiuIINZn0Yxt6LSPG9N6/oemlCM8wwTOxlBzwRide9xwWGSyM74lF1Z 112u2jTBB4+4cwPsA9Q8Rtz6SKkpH7z3IefSg/mIN/PW4lPJOfDPSfZQjXtfSBTEvc1v vZIC1sKO6Bg9FWSrc0P24g7xt0ZDUIlScdaGYjCtriO3Xo7hhazGc76VPPUeNnFld6oY qUME8zMBuvSEzqaYVT9CDuBhQsRc53z65PYfzuqLtvAHW7jLhTKAK1VGyXBIFonLwNtv GP2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=siF7nM7yk0LFL2IMYx8tEu2VpRalzldI2ErsYk7P1IU=; b=NPLAG/Xg48mQ1YiB1MeSpVoUFXVSEriAAS0D9yBfp/Aewnyp3HpJw9hFwsjrKAqRy3 hy6EgLr5wkWI5VTLrgXBHyPr2gA3lMaAdZLEh2DbVgYqGwOxCh6peL+SgecT2adgs2J8 7UmYR+iBwwUUIn04gXKZcPcXbPDpPDgnBWmAOyRj14xDTc+njiNnKrHxNBHgkXbi8l+6 GZjISS8CQZ3gX99Z2vN4OCzdn/zBH0X4DXWqeEG5RxrGYPK5e0yA1wZn2RKuD9ZNS0lJ BXuH8yqJkiGhS/G8ILoMUTC5qWSAdfoU+N08sKFrcmkkdbawXojTwSf2UJSW4cKoPjq8 RDRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=igPYlbls; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BHfvpxbc; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 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 desiato.infradead.org (desiato.infradead.org. [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by mx.google.com with ESMTPS id w2si5635047wmc.188.2021.03.19.09.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 09:14:10 -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:1:d65d:64ff:fe57:4e05 as permitted sender) client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=igPYlbls; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BHfvpxbc; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=siF7nM7yk0LFL2IMYx8tEu2VpRalzldI2ErsYk7P1IU=; b=igPYlbls9iLUZ154eamLrQE3p WvNNbctLoN8e7MpQFYn8CAk1rqzd8KOo3/dDlY4f4fnZCIt/4u2yZZfLrz7AFrqkIToYJt62T2m9b X/GXKA1Yb95NFPeERLir+qQIrCxuYB8/5zrk0wGHiBqf77UmKkAeahjpUueFr304Qaf51+j5EDQMK 3ia0NrPrxZeQ6mkrBkxPsaiq7P2QsNnvp1DJrrBiXW/ejkx4n+BwN/4gWw5/qH6cghfvQc4dLflKh +HgfOnuqtreUfxIKdUqxgvGgD9L9wjZeriJkq6g+mHYGKK2FeyKN81CJ6irMlMc1SKd2+AvAn8lrT iaPfewbSA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNHlI-007ftn-PM; Fri, 19 Mar 2021 16:14:08 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNHlB-007fq3-DV for wcn36xx@lists.infradead.org; Fri, 19 Mar 2021 16:14:03 +0000 Received: by mail-wm1-x32d.google.com with SMTP id p19so5768449wmq.1 for ; Fri, 19 Mar 2021 09:14:01 -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=sWDQcCwP5xmFNCU8WV7XgYW43kOv4yOkxdnbhU++6lo=; b=BHfvpxbcOPIY/A0xOGaovHN8XLjdEjtPVvjfCw85NHFstblJDe3eJ8MOegilC7+P4h 4he9nq6vWO1tlK/aGgwwBwraRm0vbFMeahI/LEgRnzT23BR8bULob53rhB9ivj2Heu3S PNbGPC2IzTyigt1onr6CttfX+jFlB0w6T2IXlZLHkb1c5TwZvtRoppdjeuySlMjph+74 ImfZ36DZ+6BSG3b+c3muPfGvfGhDoBLnTE86+pW7qX2WqZlA2GZ9XyraTazX7bc+BjtW DEy08F0Y8C035Uky0JyelJTs+rzGc/qropXcgc9YfgktTFm5JRhZrekKEF6/SX9S7HpH SxTA== 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=sWDQcCwP5xmFNCU8WV7XgYW43kOv4yOkxdnbhU++6lo=; b=EwrMvBqpsz5GMNRr3cCp6WI1k4rvp9aHziMT1dXm/AX/TJB83zSyg0SJ5KnGVxB+H0 oO0CP2WFkkldWCM9R8YV9dhNqW6qFgczsFkcLvEWegyjTAkRdHjw+b8EWc6GcW9cv3Tc iR374uJAMGaOns9FXMBc8+k698vGXUilNNQj3PuF6hgb0DBRV/krClleuuIkWbCFGmc8 /PWGrqCK2E0MKFRd0Jz0vSt0m4s0VPslUCvm1AYzr6mg9/UA7mHY0zXcTom5AEdsEQzy qhsdHZWnUY6UJol9f2tsmNsYr3YRTqfd/QfoFfbxbl4HgsGDmonLKUvyEf0w37i+n4Jc Xpcw== X-Gm-Message-State: AOAM532tH7jHVx+l7/AZ5aO29169yrkdFyByYn5fBiQ9VV7qbk0F/+wt rpM8Wa5S32esvRFqAh9yroQSjQ== X-Received: by 2002:a05:600c:4844:: with SMTP id j4mr4401141wmo.179.1616170440786; Fri, 19 Mar 2021 09:14:00 -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 h8sm8432495wrt.94.2021.03.19.09.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 09:14:00 -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, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v3 09/12] wcn36xx: Add GTK offload info to WoWLAN resume Date: Fri, 19 Mar 2021 16:15:17 +0000 Message-Id: <20210319161520.3590510-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210319161520.3590510-1-bryan.odonoghue@linaro.org> References: <20210319161520.3590510-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-20210319_161401_573738_264EE341 X-CRM114-Status: GOOD ( 16.26 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32d listed in] [list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 X-BeenThere: wcn36xx@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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. In order to enable the SMD command and response we need to pack the existing command/response structures. Given these structures are currently unused, there's no need to backport this as a fix. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 4 +- drivers/net/wireless/ath/wcn36xx/main.c | 1 + drivers/net/wireless/ath/wcn36xx/smd.c | 72 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 78 insertions(+), 2 deletions(-) -- 2.30.1 _______________________________________________ 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 a138b84d0aec..a84128e04cc4 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1149,6 +1149,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 f74cb16327d0..e249971c4ef7 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2893,6 +2893,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) { @@ -2943,6 +3014,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 cdf4231efe26..90c7faea0ef6 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_ */