linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
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 07/12] wcn36xx: Add set_rekey_data callback
Date: Fri, 19 Mar 2021 16:15:15 +0000	[thread overview]
Message-ID: <20210319161520.3590510-8-bryan.odonoghue@linaro.org> (raw)
In-Reply-To: <20210319161520.3590510-1-bryan.odonoghue@linaro.org>

Add a callback for Group Temporal Key tracking as provided by the standard
WiFi ops structure.

We track the key to integrate GTK offloading into the WoWLAN suspend path
later on. Code comes from the Intel iwlwifi driver with minimal name
changes.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c    | 19 +++++++++++++++++++
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  6 ++++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 36cf771d8a20..6b0deed23c5a 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1155,6 +1155,24 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)
 	return 0;
 }
 
+void wcn36xx_set_rekey_data(struct ieee80211_hw *hw,
+			    struct ieee80211_vif *vif,
+			    struct cfg80211_gtk_rekey_data *data)
+{
+	struct wcn36xx *wcn = hw->priv;
+	struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
+
+	mutex_lock(&wcn->conf_mutex);
+
+	memcpy(vif_priv->rekey_data.kek, data->kek, NL80211_KEK_LEN);
+	memcpy(vif_priv->rekey_data.kck, data->kck, NL80211_KCK_LEN);
+	vif_priv->rekey_data.replay_ctr =
+		cpu_to_le64(be64_to_cpup((__be64 *)data->replay_ctr));
+	vif_priv->rekey_data.valid = true;
+
+	mutex_unlock(&wcn->conf_mutex);
+}
+
 #endif
 
 static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
@@ -1257,6 +1275,7 @@ static const struct ieee80211_ops wcn36xx_ops = {
 #ifdef CONFIG_PM
 	.suspend		= wcn36xx_suspend,
 	.resume			= wcn36xx_resume,
+	.set_rekey_data		= wcn36xx_set_rekey_data,
 #endif
 	.config			= wcn36xx_config,
 	.prepare_multicast	= wcn36xx_prepare_multicast,
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 5a5114660b18..6121d8a5641a 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -143,6 +143,12 @@ struct wcn36xx_vif {
 	unsigned long tentative_addrs[BITS_TO_LONGS(WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX)];
 	int num_target_ipv6_addrs;
 #endif
+	/* WoWLAN GTK rekey data */
+	struct {
+		u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
+		__le64 replay_ctr;
+		bool valid;
+	} rekey_data;
 
 	struct list_head sta_list;
 };
-- 
2.30.1


  parent reply	other threads:[~2021-03-19 16:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 16:15 [PATCH v3 00/12] wcn36xx: Enable downstream consistent Wake on Lan Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 01/12] wcn36xx: Return result of set_power_params in suspend Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 02/12] wcn36xx: Run suspend for the first ieee80211_vif Bryan O'Donoghue
2021-03-19 16:57   ` Loic Poulain
2021-03-20 12:40     ` Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 03/12] wcn36xx: Add ipv4 ARP offload support in suspend Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 04/12] wcn36xx: Do not flush indication queue on suspend/resume Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 05/12] wcn36xx: Add ipv6 address tracking Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 06/12] wcn36xx: Add ipv6 namespace offload in suspend Bryan O'Donoghue
2021-03-19 16:15 ` Bryan O'Donoghue [this message]
2021-03-19 16:15 ` [PATCH v3 08/12] wcn36xx: Add GTK offload to WoWLAN path Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 09/12] wcn36xx: Add GTK offload info to WoWLAN resume Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 10/12] wcn36xx: Add Host suspend indication support Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 11/12] wcn36xx: Add host resume request support Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 12/12] wcn36xx: Enable WOWLAN flags Bryan O'Donoghue
2021-03-25 19:52 ` [PATCH v3 00/12] wcn36xx: Enable downstream consistent Wake on Lan Benjamin Li
2021-03-26  1:46   ` Bryan O'Donoghue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210319161520.3590510-8-bryan.odonoghue@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=benl@squareup.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=shawn.guo@linaro.org \
    --cc=wcn36xx@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).