Lines Matching refs:ar
31 struct ath11k *ar = ath11k_ab_to_ar(ab, 0); in ath11k_wow_enable() local
39 ret = ath11k_wmi_wow_enable(ar); in ath11k_wow_enable()
68 struct ath11k *ar = ath11k_ab_to_ar(ab, 0); in ath11k_wow_wakeup() local
80 ret = ath11k_wmi_wow_host_wakeup_ind(ar); in ath11k_wow_wakeup()
98 struct ath11k *ar = arvif->ar; in ath11k_wow_vif_cleanup() local
102 ret = ath11k_wmi_wow_add_wakeup_event(ar, arvif->vdev_id, i, 0); in ath11k_wow_vif_cleanup()
104 ath11k_warn(ar->ab, "failed to issue wow wakeup for event %s on vdev %i: %d\n", in ath11k_wow_vif_cleanup()
110 for (i = 0; i < ar->wow.max_num_patterns; i++) { in ath11k_wow_vif_cleanup()
111 ret = ath11k_wmi_wow_del_pattern(ar, arvif->vdev_id, i); in ath11k_wow_vif_cleanup()
113 ath11k_warn(ar->ab, "failed to delete wow pattern %d for vdev %i: %d\n", in ath11k_wow_vif_cleanup()
122 static int ath11k_wow_cleanup(struct ath11k *ar) in ath11k_wow_cleanup() argument
127 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_cleanup()
129 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_cleanup()
132 ath11k_warn(ar->ab, "failed to clean wow wakeups on vdev %i: %d\n", in ath11k_wow_cleanup()
242 static int ath11k_wmi_pno_check_and_convert(struct ath11k *ar, u32 vdev_id, in ath11k_wmi_pno_check_and_convert() argument
317 ath11k_warn(ar->ab, "Invalid number of scan plans %d !!", in ath11k_wmi_pno_check_and_convert()
342 struct ath11k *ar = arvif->ar; in ath11k_vif_wow_set_wakeups() local
379 ar->nlo_enabled = true; in ath11k_vif_wow_set_wakeups()
381 ret = ath11k_wmi_pno_check_and_convert(ar, arvif->vdev_id, in ath11k_vif_wow_set_wakeups()
384 ath11k_wmi_wow_config_pno(ar, arvif->vdev_id, pno); in ath11k_vif_wow_set_wakeups()
413 if (ar->wmi->wmi_ab->wlan_resource_config.rx_decap_mode == in ath11k_vif_wow_set_wakeups()
432 ret = ath11k_wmi_wow_add_pattern(ar, arvif->vdev_id, in ath11k_vif_wow_set_wakeups()
439 ath11k_warn(ar->ab, "failed to add pattern %i to vdev %i: %d\n", in ath11k_vif_wow_set_wakeups()
452 ret = ath11k_wmi_wow_add_wakeup_event(ar, arvif->vdev_id, i, 1); in ath11k_vif_wow_set_wakeups()
454 ath11k_warn(ar->ab, "failed to enable wakeup event %s on vdev %i: %d\n", in ath11k_vif_wow_set_wakeups()
463 static int ath11k_wow_set_wakeups(struct ath11k *ar, in ath11k_wow_set_wakeups() argument
469 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_set_wakeups()
471 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_set_wakeups()
474 ath11k_warn(ar->ab, "failed to set wow wakeups on vdev %i: %d\n", in ath11k_wow_set_wakeups()
486 struct ath11k *ar = arvif->ar; in ath11k_vif_wow_clean_nlo() local
490 if (ar->nlo_enabled) { in ath11k_vif_wow_clean_nlo()
498 ar->nlo_enabled = false; in ath11k_vif_wow_clean_nlo()
499 ret = ath11k_wmi_wow_config_pno(ar, arvif->vdev_id, pno); in ath11k_vif_wow_clean_nlo()
509 static int ath11k_wow_nlo_cleanup(struct ath11k *ar) in ath11k_wow_nlo_cleanup() argument
514 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_nlo_cleanup()
516 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_nlo_cleanup()
519 ath11k_warn(ar->ab, "failed to clean nlo settings on vdev %i: %d\n", in ath11k_wow_nlo_cleanup()
528 static int ath11k_wow_set_hw_filter(struct ath11k *ar) in ath11k_wow_set_hw_filter() argument
534 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_set_hw_filter()
536 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_set_hw_filter()
539 ret = ath11k_wmi_hw_data_filter_cmd(ar, arvif->vdev_id, in ath11k_wow_set_hw_filter()
543 ath11k_warn(ar->ab, "failed to set hw data filter on vdev %i: %d\n", in ath11k_wow_set_hw_filter()
552 static int ath11k_wow_clear_hw_filter(struct ath11k *ar) in ath11k_wow_clear_hw_filter() argument
557 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_clear_hw_filter()
559 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_clear_hw_filter()
560 ret = ath11k_wmi_hw_data_filter_cmd(ar, arvif->vdev_id, 0, false); in ath11k_wow_clear_hw_filter()
563 ath11k_warn(ar->ab, "failed to clear hw data filter on vdev %i: %d\n", in ath11k_wow_clear_hw_filter()
572 static int ath11k_wow_arp_ns_offload(struct ath11k *ar, bool enable) in ath11k_wow_arp_ns_offload() argument
577 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_arp_ns_offload()
579 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_arp_ns_offload()
583 ret = ath11k_wmi_arp_ns_offload(ar, arvif, enable); in ath11k_wow_arp_ns_offload()
586 ath11k_warn(ar->ab, "failed to set arp ns offload vdev %i: enable %d, ret %d\n", in ath11k_wow_arp_ns_offload()
595 static int ath11k_gtk_rekey_offload(struct ath11k *ar, bool enable) in ath11k_gtk_rekey_offload() argument
600 lockdep_assert_held(&ar->conf_mutex); in ath11k_gtk_rekey_offload()
602 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_gtk_rekey_offload()
610 ret = ath11k_wmi_gtk_rekey_getinfo(ar, arvif); in ath11k_gtk_rekey_offload()
612 ath11k_warn(ar->ab, "failed to request rekey info vdev %i, ret %d\n", in ath11k_gtk_rekey_offload()
618 ret = ath11k_wmi_gtk_rekey_offload(ar, arvif, enable); in ath11k_gtk_rekey_offload()
621 ath11k_warn(ar->ab, "failed to offload gtk reky vdev %i: enable %d, ret %d\n", in ath11k_gtk_rekey_offload()
630 static int ath11k_wow_protocol_offload(struct ath11k *ar, bool enable) in ath11k_wow_protocol_offload() argument
634 ret = ath11k_wow_arp_ns_offload(ar, enable); in ath11k_wow_protocol_offload()
636 ath11k_warn(ar->ab, "failed to offload ARP and NS %d %d\n", in ath11k_wow_protocol_offload()
641 ret = ath11k_gtk_rekey_offload(ar, enable); in ath11k_wow_protocol_offload()
643 ath11k_warn(ar->ab, "failed to offload gtk rekey %d %d\n", in ath11k_wow_protocol_offload()
651 static int ath11k_wow_set_keepalive(struct ath11k *ar, in ath11k_wow_set_keepalive() argument
658 lockdep_assert_held(&ar->conf_mutex); in ath11k_wow_set_keepalive()
660 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_wow_set_keepalive()
672 struct ath11k *ar = hw->priv; in ath11k_wow_op_suspend() local
675 ret = ath11k_mac_wait_tx_complete(ar); in ath11k_wow_op_suspend()
677 ath11k_warn(ar->ab, "failed to wait tx complete: %d\n", ret); in ath11k_wow_op_suspend()
681 mutex_lock(&ar->conf_mutex); in ath11k_wow_op_suspend()
683 ret = ath11k_dp_rx_pktlog_stop(ar->ab, true); in ath11k_wow_op_suspend()
685 ath11k_warn(ar->ab, in ath11k_wow_op_suspend()
691 ret = ath11k_wow_cleanup(ar); in ath11k_wow_op_suspend()
693 ath11k_warn(ar->ab, "failed to clear wow wakeup events: %d\n", in ath11k_wow_op_suspend()
698 ret = ath11k_wow_set_wakeups(ar, wowlan); in ath11k_wow_op_suspend()
700 ath11k_warn(ar->ab, "failed to set wow wakeup events: %d\n", in ath11k_wow_op_suspend()
705 ret = ath11k_wow_protocol_offload(ar, true); in ath11k_wow_op_suspend()
707 ath11k_warn(ar->ab, "failed to set wow protocol offload events: %d\n", in ath11k_wow_op_suspend()
712 ret = ath11k_wow_set_hw_filter(ar); in ath11k_wow_op_suspend()
714 ath11k_warn(ar->ab, "failed to set hw filter: %d\n", in ath11k_wow_op_suspend()
719 ret = ath11k_wow_set_keepalive(ar, in ath11k_wow_op_suspend()
723 ath11k_warn(ar->ab, "failed to enable wow keepalive: %d\n", ret); in ath11k_wow_op_suspend()
727 ret = ath11k_wow_enable(ar->ab); in ath11k_wow_op_suspend()
729 ath11k_warn(ar->ab, "failed to start wow: %d\n", ret); in ath11k_wow_op_suspend()
733 ret = ath11k_dp_rx_pktlog_stop(ar->ab, false); in ath11k_wow_op_suspend()
735 ath11k_warn(ar->ab, in ath11k_wow_op_suspend()
741 ath11k_ce_stop_shadow_timers(ar->ab); in ath11k_wow_op_suspend()
742 ath11k_dp_stop_shadow_timers(ar->ab); in ath11k_wow_op_suspend()
744 ath11k_hif_irq_disable(ar->ab); in ath11k_wow_op_suspend()
745 ath11k_hif_ce_irq_disable(ar->ab); in ath11k_wow_op_suspend()
747 ret = ath11k_hif_suspend(ar->ab); in ath11k_wow_op_suspend()
749 ath11k_warn(ar->ab, "failed to suspend hif: %d\n", ret); in ath11k_wow_op_suspend()
756 ath11k_wow_wakeup(ar->ab); in ath11k_wow_op_suspend()
759 ath11k_wow_cleanup(ar); in ath11k_wow_op_suspend()
762 mutex_unlock(&ar->conf_mutex); in ath11k_wow_op_suspend()
768 struct ath11k *ar = hw->priv; in ath11k_wow_op_set_wakeup() local
770 mutex_lock(&ar->conf_mutex); in ath11k_wow_op_set_wakeup()
771 device_set_wakeup_enable(ar->ab->dev, enabled); in ath11k_wow_op_set_wakeup()
772 mutex_unlock(&ar->conf_mutex); in ath11k_wow_op_set_wakeup()
777 struct ath11k *ar = hw->priv; in ath11k_wow_op_resume() local
780 mutex_lock(&ar->conf_mutex); in ath11k_wow_op_resume()
782 ret = ath11k_hif_resume(ar->ab); in ath11k_wow_op_resume()
784 ath11k_warn(ar->ab, "failed to resume hif: %d\n", ret); in ath11k_wow_op_resume()
788 ath11k_hif_ce_irq_enable(ar->ab); in ath11k_wow_op_resume()
789 ath11k_hif_irq_enable(ar->ab); in ath11k_wow_op_resume()
791 ret = ath11k_dp_rx_pktlog_start(ar->ab); in ath11k_wow_op_resume()
793 ath11k_warn(ar->ab, "failed to start rx pktlog from wow: %d\n", ret); in ath11k_wow_op_resume()
797 ret = ath11k_wow_wakeup(ar->ab); in ath11k_wow_op_resume()
799 ath11k_warn(ar->ab, "failed to wakeup from wow: %d\n", ret); in ath11k_wow_op_resume()
803 ret = ath11k_wow_nlo_cleanup(ar); in ath11k_wow_op_resume()
805 ath11k_warn(ar->ab, "failed to cleanup nlo: %d\n", ret); in ath11k_wow_op_resume()
809 ret = ath11k_wow_clear_hw_filter(ar); in ath11k_wow_op_resume()
811 ath11k_warn(ar->ab, "failed to clear hw filter: %d\n", ret); in ath11k_wow_op_resume()
815 ret = ath11k_wow_protocol_offload(ar, false); in ath11k_wow_op_resume()
817 ath11k_warn(ar->ab, "failed to clear wow protocol offload events: %d\n", in ath11k_wow_op_resume()
822 ret = ath11k_wow_set_keepalive(ar, in ath11k_wow_op_resume()
826 ath11k_warn(ar->ab, "failed to disable wow keepalive: %d\n", ret); in ath11k_wow_op_resume()
832 switch (ar->state) { in ath11k_wow_op_resume()
834 ar->state = ATH11K_STATE_RESTARTING; in ath11k_wow_op_resume()
842 ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n", in ath11k_wow_op_resume()
843 ar->state); in ath11k_wow_op_resume()
849 mutex_unlock(&ar->conf_mutex); in ath11k_wow_op_resume()
853 int ath11k_wow_init(struct ath11k *ar) in ath11k_wow_init() argument
855 if (!test_bit(WMI_TLV_SERVICE_WOW, ar->wmi->wmi_ab->svc_map)) in ath11k_wow_init()
858 ar->wow.wowlan_support = ath11k_wowlan_support; in ath11k_wow_init()
860 if (ar->wmi->wmi_ab->wlan_resource_config.rx_decap_mode == in ath11k_wow_init()
862 ar->wow.wowlan_support.pattern_max_len -= WOW_MAX_REDUCE; in ath11k_wow_init()
863 ar->wow.wowlan_support.max_pkt_offset -= WOW_MAX_REDUCE; in ath11k_wow_init()
866 if (test_bit(WMI_TLV_SERVICE_NLO, ar->wmi->wmi_ab->svc_map)) { in ath11k_wow_init()
867 ar->wow.wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT; in ath11k_wow_init()
868 ar->wow.wowlan_support.max_nd_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in ath11k_wow_init()
871 ar->wow.max_num_patterns = ATH11K_WOW_PATTERNS; in ath11k_wow_init()
872 ar->wow.wowlan_support.n_patterns = ar->wow.max_num_patterns; in ath11k_wow_init()
873 ar->hw->wiphy->wowlan = &ar->wow.wowlan_support; in ath11k_wow_init()
875 device_set_wakeup_capable(ar->ab->dev, true); in ath11k_wow_init()