From patchwork Fri Mar 19 16:15:16 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: 404815 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1511210jai; Fri, 19 Mar 2021 09:14:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIPcNxIlfmwvDczQJyHXCZ0Hx+tk1F20ibxhZPHStGOthDvKQhvJ2jXWW3TipyqzF2tueI X-Received: by 2002:adf:d1cd:: with SMTP id b13mr5294051wrd.47.1616170449847; Fri, 19 Mar 2021 09:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616170449; cv=none; d=google.com; s=arc-20160816; b=BYTCFnXlKigxaqOYaXKD0lneVaCk5YS4ytAjvqS2P5uFttlcO/lyv8TAxeUt0aq84f gLyF81isxi4NbHeBELW8aKphJm+p3P7NkwNCoOPWCKfD8ND+9zhZY8rPIhc5Wd8Dbu3M uBGpkGjyiqOWUI5dM0fy3mCGnAcNxLdRj4KKG1Ol5+xG15Cb7735ckizswm98awNhX3P 9SwhOVD+V+iZDcVo7pnd+52aPxBAcXuUfRhkZlBD9MU9NR9V1WP/t0vBtbuEKeQlxhXw rzjjA/cjyQxj3f1AeivyZPrt1gJY3yAe5UvRVEPK8L9HHqgeX77zGWd2Qqok2RQSzsvI wtvA== 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=Wu1TfqE1oaaSxOa7sLol/NRAKmHkKglMaygHJMWNyLw=; b=eoQ5o5Vvjn+Xl2B1of++Xnbi2rgkusWQy+cC33xUN+makwz7kNjfLn7eO2wCVCLLjb 6Jlw/9vgHyEls7orx0o/fRr1qNkK4Gx2G60Wh4IakTH6+WNnSNM5274hgPcibuT6RSak 5uUh1WiCBkiRpiKDk+5jxtWpa5D7bJrL0aMS7poQsB6DWdaxAanSiK7qQaGyx9ZfQ/TJ OIN8FlHl3SZlXVMYTGjtC4HPzc6FZWCamCxRNwC4wDQQ6DJVHBOHB7WOB8zu2Iqi0lr1 fQrz11ltQqk4msQIUVOKuozjOGpTIImkZaFEnJmCk6QDomysoqQ5xXLZsRsXXSm2fbTf D6Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=AHf31vX8; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=x6fhiApw; 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 z4si5260261wrm.178.2021.03.19.09.14.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 09:14:09 -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=AHf31vX8; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=x6fhiApw; 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=Wu1TfqE1oaaSxOa7sLol/NRAKmHkKglMaygHJMWNyLw=; b=AHf31vX8Jzh88AFGQSLSHzUzC 6gKsv1eHQRW8ypv2v+YwIhXlLcxIRRZ/umuuU463TpodipmRpdKieaCvdgU82XdM+cfdr7kZBgPLb U/b0CqbCfgX40P285o763X5OeEczU+hkcu2FJTZtZYH9YQgr/z436ASsDhol8LymI3+UeA1HtCz4o nBboyvxEPGC21dmhHFlKtNfx0WRVZgI1o4LKxk9KHG6ozh/kn1apx37xUbPEnGYfhmrAmch+6PKHW lGlQlpRL/gd0Ef0FMKg3b8X2azhPa+qQudEadtre//ZcTuwesqXVxHI9VuURRNSUNTnjgNlV50YOA M7untYkmQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNHlI-007ftQ-0h; Fri, 19 Mar 2021 16:14:08 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNHlA-007fpO-47 for wcn36xx@lists.infradead.org; Fri, 19 Mar 2021 16:14:01 +0000 Received: by mail-wm1-x329.google.com with SMTP id r10-20020a05600c35cab029010c946c95easo5535316wmq.4 for ; Fri, 19 Mar 2021 09:14:00 -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=hfX1Ogv73uurEKmswylGOfrhr0B3EvW2dgqtNPTZVyA=; b=x6fhiApwghFo1P2OHZClb8jBXq6clJVd/jv+8668GVtKRifHQ5cJZIkTjYjC1+bqEJ 9nHC5nciZRhNZRpl0E2T368UlWuete+VtHRO0k8/rbDdjc3jila9WqPXQzVSeEJ6ED8D yPUGx/dww5nAfdx+b1D5U2Bc/XY5Xi4Iih7UTmuwSvVmpDgggrv/rl1+93xqALbOXVs3 WenkbQxpK34ECDxoPKXr6J9bCPBmDtC3ukcKvWKNEQ+6kY5t/QVjYTE0G6FilYcrd8tN tT8k8U7PSqBnDz27WmaxjpFFGLEdd5BPJJZ4ZXlf3mZUoCc2f3Hf2rvNh9TWDlPZ/iOJ Mj3A== 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=hfX1Ogv73uurEKmswylGOfrhr0B3EvW2dgqtNPTZVyA=; b=jQuscQPlz5ZuKUSK1OTNIjxViKHxqY1rqRNqgX+dxFs1Up6o7Tv6AYj6h46gRnrNAg tQkda4/jpHgy8E5/VKFH5WCnzqeJyLkfS87A1oTsOL6N4WFB01CoO37UOd3ZZ6spDJ9F iffpGRWA2ADCCe/qECZk950Ax2MYPhPE4RibSCYHQxujxpljvKi/RovkP3VQ7iuI5Im3 YhEIGQnPZbom+M9Hnixd/eHevY9NQCvUu1ZXn1I8XOy06y7c2URkTRZs3bFswRcW2btI +psD30tjbEkw/hIvJ7WZNo21t81yHm8SsSsR10odpg/CZj/hipL6/kRadtzoNN/xE9WY hjJA== X-Gm-Message-State: AOAM531DnqCSRLhJjCvEI0tHZN2fOgwfLBu13B8ZfcThFaA2jRYemq3l B6vEOMt4k9CfkTtxyLzSqIxBtQ== X-Received: by 2002:a05:600c:4154:: with SMTP id h20mr4477888wmm.149.1616170439786; Fri, 19 Mar 2021 09:13:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 09:13:59 -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 08/12] wcn36xx: Add GTK offload to WoWLAN path Date: Fri, 19 Mar 2021 16:15:16 +0000 Message-Id: <20210319161520.3590510-9-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_161400_265427_479964E9 X-CRM114-Status: GOOD ( 15.33 ) 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: 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:329 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_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 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.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 6b0deed23c5a..a138b84d0aec 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 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_ */