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 v5 10/12] wcn36xx: Add Host suspend indication support
Date: Tue,  1 Jun 2021 16:09:59 +0100	[thread overview]
Message-ID: <20210601151001.1450540-11-bryan.odonoghue@linaro.org> (raw)
In-Reply-To: <20210601151001.1450540-1-bryan.odonoghue@linaro.org>

In order to activate ipv4 ARP offload, ipv6 NS offload and firmware GTK
offload we need to send a unidirectional indication from host to wcn
indicating a transition to suspend.

Once done, firmware will respond to ARP broadcasts, ipv6 NS lookups and
perform GTK rekeys without waking the host.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Benjamin Li <benl@squareup.com>
---
 drivers/net/wireless/ath/wcn36xx/main.c |  3 +++
 drivers/net/wireless/ath/wcn36xx/smd.c  | 19 +++++++++++++++++++
 drivers/net/wireless/ath/wcn36xx/smd.h  |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 8e5d8326d551..e4d5e4d597f9 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1125,6 +1125,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
 		if (ret)
 			goto out;
 		ret = wcn36xx_smd_set_power_params(wcn, true);
+		if (ret)
+			goto out;
+		ret = wcn36xx_smd_wlan_host_suspend_ind(wcn);
 	}
 out:
 	mutex_unlock(&wcn->conf_mutex);
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index e249971c4ef7..302877d23ecf 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -2964,6 +2964,25 @@ int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn,
 	return ret;
 }
 
+int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn)
+{
+	struct wcn36xx_hal_wlan_host_suspend_ind_msg msg_body;
+	int ret;
+
+	mutex_lock(&wcn->hal_mutex);
+
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_SUSPEND_IND);
+	msg_body.configured_mcst_bcst_filter_setting = 0;
+	msg_body.active_session_count = 1;
+	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+	ret = rpmsg_send(wcn->smd_channel, wcn->hal_buf, msg_body.header.len);
+
+	mutex_unlock(&wcn->hal_mutex);
+
+	return ret;
+}
+
 int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev,
 			    void *buf, int len, void *priv, u32 addr)
 {
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h
index 90c7faea0ef6..2909facdb100 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.h
+++ b/drivers/net/wireless/ath/wcn36xx/smd.h
@@ -159,4 +159,6 @@ int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn,
 				     struct ieee80211_vif *vif);
 
+int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn);
+
 #endif	/* _SMD_H_ */
-- 
2.30.1


  parent reply	other threads:[~2021-06-01 15:08 UTC|newest]

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

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=20210601151001.1450540-11-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).