wcn36xx: Add Host suspend indication support
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Sat, 5 Jun 2021 01:11:38 +0000 (02:11 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 14 Jun 2021 15:18:16 +0000 (18:18 +0300)
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210605011140.2004643-11-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 8e5d832..e4d5e4d 100644 (file)
@@ -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);
index 13200a0..3b4ba6e 100644 (file)
@@ -2966,6 +2966,25 @@ out:
        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)
 {
index 90c7fae..2909fac 100644 (file)
@@ -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_ */