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 8e5d8326d551ffb71df1f82a2922e38b0325af37..e4d5e4d597f9ff4c025cb241b78e7b791e27d47f 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 13200a079bd001019c65dcbf9fed1a503eb764af..3b4ba6edd17a9e4157e11869dfa9898b442ef456 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 90c7faea0ef6abe7a107d0a3bbf975aff86086a4..2909facdb100fcc873d0b7a16dc2b848fc9b9c23 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_ */