From patchwork Tue Jun 1 15:09:57 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: 451390 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp1870778jao; Tue, 1 Jun 2021 08:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVoI0DGk50aTrFZZ5ekezECL2QkjOUQ8uZdj/4kwG6kcRT/CjbJPgPEd26efsIRC3KZDTe X-Received: by 2002:a17:902:a60a:b029:f0:ad94:70bf with SMTP id u10-20020a170902a60ab02900f0ad9470bfmr26436341plq.31.1622560118324; Tue, 01 Jun 2021 08:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622560118; cv=none; d=google.com; s=arc-20160816; b=le2Y/Y0hPSyy0MXS2UHTbgJ87ewtEYfdBMnWShq7UdhpCavAG7m1fp7of1QUcZciwB k8OALKRtAu46F99zDdZ3R7Od/H8rxp5YE5rHsNyqMh7KqqdQ/1AHn579TwMKcRyHk+qb BS6Zr90V4l+UdJKb0rFAPO5/zthFgV6PYYPzSbi+R3bCDb5hVvJnQuu6w1J3JoVnezML IPeQpghSrrWcQoQ44nElC585YkIyeJf4jCFBCz7JvOSxE0huxuo6IgLOUvNYU5cpm5cB 6zbXMz7I0tIhtnIlFQNqBhTVdnz81Q/BZ2Pjm+U08vKUzJ31rbJKYT3jcv79U21VMKAD f9bQ== 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=x5Z0Ag5uahh76nLsx6IX+HBftdn2PEx45jwrtMV9R1s=; b=gWxFxT1d9hXVnQWNuJdq57gGFkd1EEXgNg2XiIizdiDsJ8a5HhvGp1Q2V/yePqqN0M oE3VGxVpwSuRfC2fiS9GFmhN19g8W508blumeo5M98XdKiKK0ECK83xeB1lEGAkjJFJJ yficvC8CD8eiz9Qoj4gICNILMSxegeQbo6tgn0dXERCYispFZcZV2Zp8mBilGa8EG68B tRTgyeo0IPOG7gZ73oEYIAeuuBS02bJfbdQE1+0CYC5LVTqq/H0j+fVnJvBoTSCujvGp g3tpxcoTgse72lwDQXLHMFlIiIF9IHR9SO6g+eK0hjQkPS2TTgsIQT+dZ2YFIZXSF+6E QJZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=V21isrDE; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Q6MfWM1Z; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 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 bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id s33si12951042pgm.88.2021.06.01.08.08.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 08:08:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=V21isrDE; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Q6MfWM1Z; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 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=bombadil.20210309; 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=x5Z0Ag5uahh76nLsx6IX+HBftdn2PEx45jwrtMV9R1s=; b=V21isrDE2XelX3 ruyf3mdgTa8NLJ6OM/cm++NfXlyTbxbdRgTEutYoZiRqbtt9RBqZ86iEdh/CM0vkI29orpj7C9p0G nIlOroFnicosMP0sy5iHTxengEHFdQnnEYwdauW7Bh/HXozbhs3AfiRv31GD8SqyjiscAe4clZAqJ zZ4Mrt1sGFw92PYLhx5JfAbpIpuPHA3dB0S6CCmMW5qE2jSzeULdyCC4hoK80iS23OP/fVJQB+1iX +UQOibOhusjGvRoyvd3yVzaXLRjiGOLsE4DvJNbLzB7gI615sZgZXzPs0QNcZ3yH+Gwrih07Vj0a3 N2BDENH0DW+FdpKCm+kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo60T-00H7dK-EF; Tue, 01 Jun 2021 15:08:37 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo60N-00H7Wi-Qw for wcn36xx@lists.infradead.org; Tue, 01 Jun 2021 15:08:33 +0000 Received: by mail-wr1-x435.google.com with SMTP id q5so14716998wrs.4 for ; Tue, 01 Jun 2021 08:08:31 -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=CJNEkd9odSJS4sHsW2fkqbqVW7PMvd2b9q+phGy9YsI=; b=Q6MfWM1ZK0fp5R9HisziCn2yGoVuRxfdorL07UBWpGI+U4uAt6GibtMrOm/Mmvzs9s T76+6mv0zQJrJWgAe5DBEHwR06TrGBajw3Q7rtmBy2Ttz4ylstS3YeyUxtf+/3LJEOLT saN/QxQd+yN6zVQzw+55KUxjRMbwHreBAkDET1+siLkYn4bYVgAlNAkcyaWDyPq5cZRR RlPGkHnEm0Q6o6C//1i1GjPp9uKL+6agofFO6etrUHCHioEnDWyVYq9rmS/XKIeOPJBs hL3fRzbyRNdSg/f1Ga1RGtPTfjM1IAosPuxXaboEqTZxxBZ/hynpWNkmvfQOx0ggdns7 8OPQ== 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=CJNEkd9odSJS4sHsW2fkqbqVW7PMvd2b9q+phGy9YsI=; b=sGfI4Rp8eD6j6rJoQlKS5KifFUNah4uMbpz8s/SsS6NaenE7LKsSeSiqQhNFpryKXF hfcMN2XmY+admPeoDP2j1Cel9CeNN5PztCKvukRt4D+cM8mT9agTPiu48QZHDfrdLSU9 R+oW3ddqNsGxpv6eu23Hh/HGqjnMqRSZHzFdP9HNUSkjLk1Jh5izj6y2GfWg0tc142yK y3EdXrlyz7d6Iv2Zu95uW8/y5FYnS/GzX30juQg2nJ/31xcBEGhtttfrIQqGmkxGBdN0 t6UU4a3SGdmRYdZC2U/UC/4E85Otmyhwa8nSbbYtiVUIIQaGzXbz1f85wzXkR5pbbUkq Kx/g== X-Gm-Message-State: AOAM531rZ3i6glhr4GafJ5o/yXAdobF0xM0eYYZXU/VerOusSSLKtiio iVpzmIXR6HXsrtWebZVfe8SuWQ== X-Received: by 2002:a05:6000:2cb:: with SMTP id o11mr28623338wry.326.1622560109995; Tue, 01 Jun 2021 08:08:29 -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 o129sm2822237wmo.22.2021.06.01.08.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 08:08:29 -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 v5 08/12] wcn36xx: Add GTK offload to WoWLAN path Date: Tue, 1 Jun 2021 16:09:57 +0100 Message-Id: <20210601151001.1450540-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601151001.1450540-1-bryan.odonoghue@linaro.org> References: <20210601151001.1450540-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-20210601_080831_945553_3A3DAD12 X-CRM114-Status: GOOD ( 16.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.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: 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. Content analysis details: (-0.2 points, 5.0 required) 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:435 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 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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.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 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 Tested-by: Benjamin Li --- 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.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 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 ec32b8b0067d..db1528a14757 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1119,6 +1119,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); @@ -1139,6 +1142,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { 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 4a50e5f8456a..f74cb16327d0 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2856,6 +2856,43 @@ int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, } #endif +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) { @@ -2905,6 +2942,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 e03ab7878432..cdf4231efe26 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_ */