// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2020 The Linux Foundation. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
for (i = 0; i < ATH11K_WOW_RETRY_NUM; i++) {
reinit_completion(&ab->htc_suspend);
ret = ath11k_wmi_wow_enable(ar); if (ret) {
ath11k_warn(ab, "failed to issue wow enable: %d\n", ret); return ret;
}
ret = wait_for_completion_timeout(&ab->htc_suspend, 3 * HZ); if (ret == 0) {
ath11k_warn(ab, "timed out while waiting for htc suspend completion\n"); return -ETIMEDOUT;
}
if (test_bit(ATH11K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags)) /* success, suspend complete received */ return 0;
ath11k_warn(ab, "htc suspend not complete, failing after %d tries\n", i);
return -ETIMEDOUT;
}
int ath11k_wow_wakeup(struct ath11k_base *ab)
{ struct ath11k *ar = ath11k_ab_to_ar(ab, 0); int ret;
/* In the case of WCN6750, WoW wakeup is done * by sending SMP2P power save exit message * to the target processor.
*/ if (ab->hw_params.smp2p_wow_exit) return 0;
reinit_completion(&ab->wow.wakeup_completed);
ret = ath11k_wmi_wow_host_wakeup_ind(ar); if (ret) {
ath11k_warn(ab, "failed to send wow wakeup indication: %d\n",
ret); return ret;
}
ret = wait_for_completion_timeout(&ab->wow.wakeup_completed, 3 * HZ); if (ret == 0) {
ath11k_warn(ab, "timed out while waiting for wow wakeup completion\n"); return -ETIMEDOUT;
}
return 0;
}
staticint ath11k_wow_vif_cleanup(struct ath11k_vif *arvif)
{ struct ath11k *ar = arvif->ar; int i, ret;
for (i = 0; i < WOW_EVENT_MAX; i++) {
ret = ath11k_wmi_wow_add_wakeup_event(ar, arvif->vdev_id, i, 0); if (ret) {
ath11k_warn(ar->ab, "failed to issue wow wakeup for event %s on vdev %i: %d\n",
wow_wakeup_event(i), arvif->vdev_id, ret); return ret;
}
}
for (i = 0; i < ar->wow.max_num_patterns; i++) {
ret = ath11k_wmi_wow_del_pattern(ar, arvif->vdev_id, i); if (ret) {
ath11k_warn(ar->ab, "failed to delete wow pattern %d for vdev %i: %d\n",
i, arvif->vdev_id, ret); return ret;
}
}
return 0;
}
staticint ath11k_wow_cleanup(struct ath11k *ar)
{ struct ath11k_vif *arvif; int ret;
lockdep_assert_held(&ar->conf_mutex);
list_for_each_entry(arvif, &ar->arvifs, list) {
ret = ath11k_wow_vif_cleanup(arvif); if (ret) {
ath11k_warn(ar->ab, "failed to clean wow wakeups on vdev %i: %d\n",
arvif->vdev_id, ret); return ret;
}
}
/* Copying list of valid channel into request */
pno->a_networks[i].channel_count = nd_config->n_channels;
pno->a_networks[i].rssi_threshold = nd_config->match_sets[i].rssi_thold;
/* set scan to passive if no SSIDs are specified in the request */ if (nd_config->n_ssids == 0)
pno->do_passive_scan = true; else
pno->do_passive_scan = false;
for (i = 0; i < nd_config->n_ssids; i++) {
j = 0; while (j < pno->uc_networks_count) { if (pno->a_networks[j].ssid.ssid_len ==
nd_config->ssids[i].ssid_len &&
(memcmp(pno->a_networks[j].ssid.ssid,
nd_config->ssids[i].ssid,
pno->a_networks[j].ssid.ssid_len) == 0)) {
pno->a_networks[j].bcast_nw_type = BCAST_HIDDEN; break;
}
j++;
}
}
if (nd_config->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { /* enable mac randomization */
pno->enable_pno_scan_randomization = 1;
memcpy(pno->mac_addr, nd_config->mac_addr, ETH_ALEN);
memcpy(pno->mac_addr_mask, nd_config->mac_addr_mask, ETH_ALEN);
}
pno->delay_start_time = nd_config->delay;
/* Current FW does not support min-max range for dwell time */
pno->active_max_time = WMI_ACTIVE_MAX_CHANNEL_TIME;
pno->passive_max_time = WMI_PASSIVE_MAX_CHANNEL_TIME;
for (i = 0; i < WOW_EVENT_MAX; i++) { if (!test_bit(i, &wow_mask)) continue;
ret = ath11k_wmi_wow_add_wakeup_event(ar, arvif->vdev_id, i, 1); if (ret) {
ath11k_warn(ar->ab, "failed to enable wakeup event %s on vdev %i: %d\n",
wow_wakeup_event(i), arvif->vdev_id, ret); return ret;
}
}
/* get rekey info before disable rekey offload */ if (!enable) {
ret = ath11k_wmi_gtk_rekey_getinfo(ar, arvif); if (ret) {
ath11k_warn(ar->ab, "failed to request rekey info vdev %i, ret %d\n",
arvif->vdev_id, ret); return ret;
}
}
ret = ath11k_wmi_gtk_rekey_offload(ar, arvif, enable);
if (ret) {
ath11k_warn(ar->ab, "failed to offload gtk reky vdev %i: enable %d, ret %d\n",
arvif->vdev_id, enable, ret); return ret;
}
}
return 0;
}
staticint ath11k_wow_protocol_offload(struct ath11k *ar, bool enable)
{ int ret;
ret = ath11k_wow_arp_ns_offload(ar, enable); if (ret) {
ath11k_warn(ar->ab, "failed to offload ARP and NS %d %d\n",
enable, ret); return ret;
}
ret = ath11k_gtk_rekey_offload(ar, enable); if (ret) {
ath11k_warn(ar->ab, "failed to offload gtk rekey %d %d\n",
enable, ret); return ret;
}
ret = ath11k_dp_rx_pktlog_start(ar->ab); if (ret) {
ath11k_warn(ar->ab, "failed to start rx pktlog from wow: %d\n", ret); gotoexit;
}
ret = ath11k_wow_wakeup(ar->ab); if (ret) {
ath11k_warn(ar->ab, "failed to wakeup from wow: %d\n", ret); gotoexit;
}
ret = ath11k_wow_nlo_cleanup(ar); if (ret) {
ath11k_warn(ar->ab, "failed to cleanup nlo: %d\n", ret); gotoexit;
}
ret = ath11k_wow_clear_hw_filter(ar); if (ret) {
ath11k_warn(ar->ab, "failed to clear hw filter: %d\n", ret); gotoexit;
}
ret = ath11k_wow_protocol_offload(ar, false); if (ret) {
ath11k_warn(ar->ab, "failed to clear wow protocol offload events: %d\n",
ret); gotoexit;
}
ret = ath11k_wow_set_keepalive(ar,
WMI_STA_KEEPALIVE_METHOD_NULL_FRAME,
WMI_STA_KEEPALIVE_INTERVAL_DISABLE); if (ret) {
ath11k_warn(ar->ab, "failed to disable wow keepalive: %d\n", ret); gotoexit;
}
exit: if (ret) { switch (ar->state) { case ATH11K_STATE_ON:
ar->state = ATH11K_STATE_RESTARTING;
ret = 1; break; case ATH11K_STATE_OFF: case ATH11K_STATE_RESTARTING: case ATH11K_STATE_RESTARTED: case ATH11K_STATE_WEDGED: case ATH11K_STATE_FTM:
ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n",
ar->state);
ret = -EIO; break;
}
}
mutex_unlock(&ar->conf_mutex); return ret;
}
int ath11k_wow_init(struct ath11k *ar)
{ if (!test_bit(WMI_TLV_SERVICE_WOW, ar->wmi->wmi_ab->svc_map)) return 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.