wcn36xx: Add host resume request support
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Sat, 5 Jun 2021 01:11:39 +0000 (02:11 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 14 Jun 2021 15:18:17 +0000 (18:18 +0300)
This commit is the corresponding resume() path request to the firmware when
resuming. Unlike the suspend() version which is a unidirectional
indication, the resume version is a standard request/response.

Once the resume() request completes ipv4 ARP, ipv6 NS and GTK rekey offload
stop working and can subsequently be rolled back.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Benjamin Li <benl@squareup.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210605011140.2004643-12-bryan.odonoghue@linaro.org
drivers/net/wireless/ath/wcn36xx/main.c
drivers/net/wireless/ath/wcn36xx/smd.c
drivers/net/wireless/ath/wcn36xx/smd.h

index e4d5e4d..c697b9f 100644 (file)
@@ -1144,6 +1144,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)
        mutex_lock(&wcn->conf_mutex);
        vif = wcn36xx_get_first_assoc_vif(wcn);
        if (vif) {
+               wcn36xx_smd_host_resume(wcn);
                wcn36xx_smd_set_power_params(wcn, false);
                wcn36xx_smd_gtk_offload_get_info(wcn, vif);
                wcn36xx_smd_gtk_offload(wcn, vif, false);
index 3b4ba6e..cf8e52c 100644 (file)
@@ -2985,6 +2985,40 @@ int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn)
        return ret;
 }
 
+int wcn36xx_smd_host_resume(struct wcn36xx *wcn)
+{
+       struct wcn36xx_hal_wlan_host_resume_req_msg msg_body;
+       struct wcn36xx_hal_host_resume_rsp_msg *rsp;
+       int ret;
+
+       mutex_lock(&wcn->hal_mutex);
+
+       INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_RESUME_REQ);
+       msg_body.configured_mcst_bcst_filter_setting = 0;
+
+       PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+       ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+       if (ret) {
+               wcn36xx_err("Sending wlan_host_resume failed\n");
+               goto out;
+       }
+       ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+       if (ret) {
+               wcn36xx_err("wlan_host_resume err=%d\n", ret);
+               goto out;
+       }
+
+       rsp = (struct wcn36xx_hal_host_resume_rsp_msg *)wcn->hal_buf;
+       if (rsp->status)
+               wcn36xx_warn("wlan_host_resume status=%d\n", rsp->status);
+
+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)
 {
@@ -3036,6 +3070,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev,
        case WCN36XX_HAL_HOST_OFFLOAD_RSP:
        case WCN36XX_HAL_GTK_OFFLOAD_RSP:
        case WCN36XX_HAL_GTK_OFFLOAD_GETINFO_RSP:
+       case WCN36XX_HAL_HOST_RESUME_RSP:
                memcpy(wcn->hal_buf, buf, len);
                wcn->hal_rsp_len = len;
                complete(&wcn->hal_rsp_compl);
index 2909fac..d8bded0 100644 (file)
@@ -161,4 +161,6 @@ int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn,
 
 int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn);
 
+int wcn36xx_smd_host_resume(struct wcn36xx *wcn);
+
 #endif /* _SMD_H_ */