• Home
  • Raw
  • Download

Lines Matching refs:ar

462 struct ath11k_vif *ath11k_mac_get_arvif(struct ath11k *ar, u32 vdev_id)  in ath11k_mac_get_arvif()  argument
471 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_get_arvif()
476 ath11k_warn(ar->ab, "No VIF found for vdev %d\n", vdev_id); in ath11k_mac_get_arvif()
492 if (pdev && pdev->ar) { in ath11k_mac_get_arvif_by_vdev_id()
493 arvif = ath11k_mac_get_arvif(pdev->ar, vdev_id); in ath11k_mac_get_arvif_by_vdev_id()
509 if (pdev && pdev->ar) { in ath11k_mac_get_ar_by_vdev_id()
510 if (pdev->ar->allocated_vdev_map & (1LL << vdev_id)) in ath11k_mac_get_ar_by_vdev_id()
511 return pdev->ar; in ath11k_mac_get_ar_by_vdev_id()
525 return pdev ? pdev->ar : NULL; in ath11k_mac_get_ar_by_pdev_id()
535 return (pdev->ar ? pdev->ar : NULL); in ath11k_mac_get_ar_by_pdev_id()
546 struct ath11k *ar; in ath11k_mac_get_ar_vdev_stop_status() local
550 if (pdev && pdev->ar) { in ath11k_mac_get_ar_vdev_stop_status()
551 ar = pdev->ar; in ath11k_mac_get_ar_vdev_stop_status()
553 spin_lock_bh(&ar->data_lock); in ath11k_mac_get_ar_vdev_stop_status()
554 if (ar->vdev_stop_status.stop_in_progress && in ath11k_mac_get_ar_vdev_stop_status()
555 ar->vdev_stop_status.vdev_id == vdev_id) { in ath11k_mac_get_ar_vdev_stop_status()
556 ar->vdev_stop_status.stop_in_progress = false; in ath11k_mac_get_ar_vdev_stop_status()
557 spin_unlock_bh(&ar->data_lock); in ath11k_mac_get_ar_vdev_stop_status()
558 return ar; in ath11k_mac_get_ar_vdev_stop_status()
560 spin_unlock_bh(&ar->data_lock); in ath11k_mac_get_ar_vdev_stop_status()
566 static void ath11k_pdev_caps_update(struct ath11k *ar) in ath11k_pdev_caps_update() argument
568 struct ath11k_base *ab = ar->ab; in ath11k_pdev_caps_update()
570 ar->max_tx_power = ab->target_caps.hw_max_tx_power; in ath11k_pdev_caps_update()
577 ar->min_tx_power = 0; in ath11k_pdev_caps_update()
579 ar->txpower_limit_2g = ar->max_tx_power; in ath11k_pdev_caps_update()
580 ar->txpower_limit_5g = ar->max_tx_power; in ath11k_pdev_caps_update()
581 ar->txpower_scale = WMI_HOST_TP_SCALE_MAX; in ath11k_pdev_caps_update()
584 static int ath11k_mac_txpower_recalc(struct ath11k *ar) in ath11k_mac_txpower_recalc() argument
586 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_txpower_recalc()
591 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_txpower_recalc()
593 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_txpower_recalc()
607 txpower = min_t(u32, max_t(u32, ar->min_tx_power, txpower), in ath11k_mac_txpower_recalc()
608 ar->max_tx_power) * 2; in ath11k_mac_txpower_recalc()
610 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower to set in hw %d\n", in ath11k_mac_txpower_recalc()
614 ar->txpower_limit_2g != txpower) { in ath11k_mac_txpower_recalc()
616 ret = ath11k_wmi_pdev_set_param(ar, param, in ath11k_mac_txpower_recalc()
617 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
620 ar->txpower_limit_2g = txpower; in ath11k_mac_txpower_recalc()
624 ar->txpower_limit_5g != txpower) { in ath11k_mac_txpower_recalc()
626 ret = ath11k_wmi_pdev_set_param(ar, param, in ath11k_mac_txpower_recalc()
627 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
630 ar->txpower_limit_5g = txpower; in ath11k_mac_txpower_recalc()
636 ath11k_warn(ar->ab, "failed to recalc txpower limit %d using pdev param %d: %d\n", in ath11k_mac_txpower_recalc()
643 struct ath11k *ar = arvif->ar; in ath11k_recalc_rtscts_prot() local
647 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalc_rtscts_prot()
668 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %d recalc rts/cts prot %d\n", in ath11k_recalc_rtscts_prot()
671 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_recalc_rtscts_prot()
674 ath11k_warn(ar->ab, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath11k_recalc_rtscts_prot()
682 struct ath11k *ar = arvif->ar; in ath11k_mac_set_kickout() local
686 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_STA_KICKOUT_TH, in ath11k_mac_set_kickout()
688 ar->pdev->pdev_id); in ath11k_mac_set_kickout()
690 ath11k_warn(ar->ab, "failed to set kickout threshold on vdev %i: %d\n", in ath11k_mac_set_kickout()
696 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
699 ath11k_warn(ar->ab, "failed to set keepalive minimum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
705 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
708 ath11k_warn(ar->ab, "failed to set keepalive maximum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
714 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
717 ath11k_warn(ar->ab, "failed to set keepalive maximum unresponsive time on vdev %i: %d\n", in ath11k_mac_set_kickout()
725 void ath11k_mac_peer_cleanup_all(struct ath11k *ar) in ath11k_mac_peer_cleanup_all() argument
728 struct ath11k_base *ab = ar->ab; in ath11k_mac_peer_cleanup_all()
730 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_peer_cleanup_all()
734 ath11k_peer_rx_tid_cleanup(ar, peer); in ath11k_mac_peer_cleanup_all()
740 ar->num_peers = 0; in ath11k_mac_peer_cleanup_all()
741 ar->num_stations = 0; in ath11k_mac_peer_cleanup_all()
744 static int ath11k_monitor_vdev_up(struct ath11k *ar, int vdev_id) in ath11k_monitor_vdev_up() argument
748 ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath11k_monitor_vdev_up()
750 ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", in ath11k_monitor_vdev_up()
755 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac monitor vdev %i started\n", in ath11k_monitor_vdev_up()
772 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_bcn_tmpl() local
773 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_bcn_tmpl()
774 struct ieee80211_hw *hw = ar->hw; in ath11k_mac_setup_bcn_tmpl()
806 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); in ath11k_mac_setup_bcn_tmpl()
820 struct ath11k *ar = arvif->ar; in ath11k_control_beaconing() local
823 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_control_beaconing()
826 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_control_beaconing()
828 ath11k_warn(ar->ab, "failed to down vdev_id %i: %d\n", in ath11k_control_beaconing()
838 ath11k_warn(ar->ab, "failed to update bcn tmpl during vdev up: %d\n", in ath11k_control_beaconing()
849 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_control_beaconing()
852 ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", in ath11k_control_beaconing()
859 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath11k_control_beaconing()
862 static void ath11k_peer_assoc_h_basic(struct ath11k *ar, in ath11k_peer_assoc_h_basic() argument
870 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_basic()
882 arg->peer_listen_intval = ar->hw->conf.listen_interval; in ath11k_peer_assoc_h_basic()
887 static void ath11k_peer_assoc_h_crypto(struct ath11k *ar, in ath11k_peer_assoc_h_crypto() argument
899 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_crypto()
904 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, NULL, 0, in ath11k_peer_assoc_h_crypto()
924 cfg80211_put_bss(ar->hw->wiphy, bss); in ath11k_peer_assoc_h_crypto()
929 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
935 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
948 static void ath11k_peer_assoc_h_rates(struct ath11k *ar, in ath11k_peer_assoc_h_rates() argument
963 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_rates()
969 sband = ar->hw->wiphy->bands[band]; in ath11k_peer_assoc_h_rates()
1010 static void ath11k_peer_assoc_h_ht(struct ath11k *ar, in ath11k_peer_assoc_h_ht() argument
1024 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_ht()
1105 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", in ath11k_peer_assoc_h_ht()
1171 static void ath11k_peer_assoc_h_vht(struct ath11k *ar, in ath11k_peer_assoc_h_vht() argument
1258 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", in ath11k_peer_assoc_h_vht()
1264 static void ath11k_peer_assoc_h_he(struct ath11k *ar, in ath11k_peer_assoc_h_he() argument
1407 static void ath11k_peer_assoc_h_qos(struct ath11k *ar, in ath11k_peer_assoc_h_qos() argument
1439 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac peer %pM qos %d\n", in ath11k_peer_assoc_h_qos()
1443 static int ath11k_peer_assoc_qos_ap(struct ath11k *ar, in ath11k_peer_assoc_qos_ap() argument
1452 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_qos_ap()
1456 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac uapsd_queues 0x%x max_sp %d\n", in ath11k_peer_assoc_qos_ap()
1479 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1485 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1492 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1498 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1505 ath11k_warn(ar->ab, "failed to set ap ps peer param %d for vdev %i: %d\n", in ath11k_peer_assoc_qos_ap()
1516 static enum wmi_phy_mode ath11k_mac_get_phymode_vht(struct ath11k *ar, in ath11k_mac_get_phymode_vht() argument
1544 static enum wmi_phy_mode ath11k_mac_get_phymode_he(struct ath11k *ar, in ath11k_mac_get_phymode_he() argument
1570 static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, in ath11k_peer_assoc_h_phymode() argument
1620 phymode = ath11k_mac_get_phymode_he(ar, sta); in ath11k_peer_assoc_h_phymode()
1623 phymode = ath11k_mac_get_phymode_vht(ar, sta); in ath11k_peer_assoc_h_phymode()
1638 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac peer %pM phymode %s\n", in ath11k_peer_assoc_h_phymode()
1645 static void ath11k_peer_assoc_prepare(struct ath11k *ar, in ath11k_peer_assoc_prepare() argument
1651 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_prepare()
1655 reinit_completion(&ar->peer_assoc_done); in ath11k_peer_assoc_prepare()
1658 ath11k_peer_assoc_h_basic(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1659 ath11k_peer_assoc_h_crypto(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1660 ath11k_peer_assoc_h_rates(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1661 ath11k_peer_assoc_h_ht(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1662 ath11k_peer_assoc_h_vht(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1663 ath11k_peer_assoc_h_he(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1664 ath11k_peer_assoc_h_qos(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1665 ath11k_peer_assoc_h_phymode(ar, vif, sta, arg); in ath11k_peer_assoc_prepare()
1671 static int ath11k_setup_peer_smps(struct ath11k *ar, struct ath11k_vif *arvif, in ath11k_setup_peer_smps() argument
1686 return ath11k_wmi_set_peer_param(ar, addr, arvif->vdev_id, in ath11k_setup_peer_smps()
1695 struct ath11k *ar = hw->priv; in ath11k_bss_assoc() local
1701 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_assoc()
1703 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %i assoc bssid %pM aid %d\n", in ath11k_bss_assoc()
1710 ath11k_warn(ar->ab, "failed to find station entry for bss %pM vdev %i\n", in ath11k_bss_assoc()
1716 ath11k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg, false); in ath11k_bss_assoc()
1720 ret = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg); in ath11k_bss_assoc()
1722 ath11k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n", in ath11k_bss_assoc()
1727 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_bss_assoc()
1728 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_bss_assoc()
1733 ret = ath11k_setup_peer_smps(ar, arvif, bss_conf->bssid, in ath11k_bss_assoc()
1736 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_bss_assoc()
1746 ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath11k_bss_assoc()
1748 ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", in ath11k_bss_assoc()
1755 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_bss_assoc()
1760 ret = ath11k_wmi_set_peer_param(ar, arvif->bssid, in ath11k_bss_assoc()
1765 ath11k_warn(ar->ab, "Unable to authorize BSS peer: %d\n", ret); in ath11k_bss_assoc()
1767 ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, in ath11k_bss_assoc()
1770 ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", in ath11k_bss_assoc()
1777 struct ath11k *ar = hw->priv; in ath11k_bss_disassoc() local
1781 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_disassoc()
1783 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %i disassoc bssid %pM\n", in ath11k_bss_disassoc()
1786 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_bss_disassoc()
1788 ath11k_warn(ar->ab, "failed to down vdev %i: %d\n", in ath11k_bss_disassoc()
1821 static void ath11k_recalculate_mgmt_rate(struct ath11k *ar, in ath11k_recalculate_mgmt_rate() argument
1833 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalculate_mgmt_rate()
1835 sband = ar->hw->wiphy->bands[def->chan->band]; in ath11k_recalculate_mgmt_rate()
1841 ath11k_warn(ar->ab, "bitrate not supported %d\n", bitrate); in ath11k_recalculate_mgmt_rate()
1846 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
1849 ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
1852 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
1855 ath11k_warn(ar->ab, "failed to set beacon tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
1863 struct ath11k *ar = hw->priv; in ath11k_mac_op_bss_info_changed() local
1877 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
1883 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1887 ath11k_warn(ar->ab, "Failed to set beacon interval for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1890 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1898 ret = ath11k_wmi_pdev_set_param(ar, param_id, in ath11k_mac_op_bss_info_changed()
1899 param_value, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
1901 ath11k_warn(ar->ab, "Failed to set beacon mode for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1904 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1910 ath11k_warn(ar->ab, "failed to update bcn template: %d\n", in ath11k_mac_op_bss_info_changed()
1914 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1918 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
1922 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1932 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1937 ath11k_warn(ar->ab, "Failed to set dtim period for VDEV %d: %i\n", in ath11k_mac_op_bss_info_changed()
1940 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1966 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1969 ath11k_warn(ar->ab, "Failed to set CTS prot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1972 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Set CTS prot: %d for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1975 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "defer protection mode setup, vdev is not ready yet\n"); in ath11k_mac_op_bss_info_changed()
1989 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1992 ath11k_warn(ar->ab, "Failed to set erp slot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1995 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
2009 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2012 ath11k_warn(ar->ab, "Failed to set preamble for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
2015 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
2028 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev_id %i txpower %d\n", in ath11k_mac_op_bss_info_changed()
2032 ath11k_mac_txpower_recalc(ar); in ath11k_mac_op_bss_info_changed()
2045 if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) in ath11k_mac_op_bss_info_changed()
2058 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
2063 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2066 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
2071 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2074 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
2081 ath11k_recalculate_mgmt_rate(ar, vif, &def); in ath11k_mac_op_bss_info_changed()
2085 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
2087 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
2091 ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2097 ar, arvif->vdev_id, info->he_bss_color.color, in ath11k_mac_op_bss_info_changed()
2101 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
2104 ret = ath11k_wmi_send_bss_color_change_enable_cmd(ar, in ath11k_mac_op_bss_info_changed()
2108 ath11k_warn(ar->ab, "failed to enable bss color change on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
2111 ar, arvif->vdev_id, 0, in ath11k_mac_op_bss_info_changed()
2114 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
2119 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
2122 void __ath11k_mac_scan_finish(struct ath11k *ar) in __ath11k_mac_scan_finish() argument
2124 lockdep_assert_held(&ar->data_lock); in __ath11k_mac_scan_finish()
2126 switch (ar->scan.state) { in __ath11k_mac_scan_finish()
2131 if (!ar->scan.is_roc) { in __ath11k_mac_scan_finish()
2133 .aborted = (ar->scan.state == in __ath11k_mac_scan_finish()
2137 ieee80211_scan_completed(ar->hw, &info); in __ath11k_mac_scan_finish()
2138 } else if (ar->scan.roc_notify) { in __ath11k_mac_scan_finish()
2139 ieee80211_remain_on_channel_expired(ar->hw); in __ath11k_mac_scan_finish()
2143 ar->scan.state = ATH11K_SCAN_IDLE; in __ath11k_mac_scan_finish()
2144 ar->scan_channel = NULL; in __ath11k_mac_scan_finish()
2145 ar->scan.roc_freq = 0; in __ath11k_mac_scan_finish()
2146 cancel_delayed_work(&ar->scan.timeout); in __ath11k_mac_scan_finish()
2147 complete(&ar->scan.completed); in __ath11k_mac_scan_finish()
2152 void ath11k_mac_scan_finish(struct ath11k *ar) in ath11k_mac_scan_finish() argument
2154 spin_lock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
2155 __ath11k_mac_scan_finish(ar); in ath11k_mac_scan_finish()
2156 spin_unlock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
2159 static int ath11k_scan_stop(struct ath11k *ar) in ath11k_scan_stop() argument
2167 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_stop()
2170 arg.pdev_id = ar->pdev->pdev_id; in ath11k_scan_stop()
2172 ret = ath11k_wmi_send_scan_stop_cmd(ar, &arg); in ath11k_scan_stop()
2174 ath11k_warn(ar->ab, "failed to stop wmi scan: %d\n", ret); in ath11k_scan_stop()
2178 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath11k_scan_stop()
2180 ath11k_warn(ar->ab, in ath11k_scan_stop()
2195 spin_lock_bh(&ar->data_lock); in ath11k_scan_stop()
2196 if (ar->scan.state != ATH11K_SCAN_IDLE) in ath11k_scan_stop()
2197 __ath11k_mac_scan_finish(ar); in ath11k_scan_stop()
2198 spin_unlock_bh(&ar->data_lock); in ath11k_scan_stop()
2203 static void ath11k_scan_abort(struct ath11k *ar) in ath11k_scan_abort() argument
2207 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_abort()
2209 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
2211 switch (ar->scan.state) { in ath11k_scan_abort()
2219 ath11k_warn(ar->ab, "refusing scan abortion due to invalid scan state: %d\n", in ath11k_scan_abort()
2220 ar->scan.state); in ath11k_scan_abort()
2223 ar->scan.state = ATH11K_SCAN_ABORTING; in ath11k_scan_abort()
2224 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
2226 ret = ath11k_scan_stop(ar); in ath11k_scan_abort()
2228 ath11k_warn(ar->ab, "failed to abort scan: %d\n", ret); in ath11k_scan_abort()
2230 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
2234 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
2239 struct ath11k *ar = container_of(work, struct ath11k, in ath11k_scan_timeout_work() local
2242 mutex_lock(&ar->conf_mutex); in ath11k_scan_timeout_work()
2243 ath11k_scan_abort(ar); in ath11k_scan_timeout_work()
2244 mutex_unlock(&ar->conf_mutex); in ath11k_scan_timeout_work()
2247 static int ath11k_start_scan(struct ath11k *ar, in ath11k_start_scan() argument
2252 lockdep_assert_held(&ar->conf_mutex); in ath11k_start_scan()
2254 if (ath11k_spectral_get_mode(ar) == ATH11K_SPECTRAL_BACKGROUND) in ath11k_start_scan()
2255 ath11k_spectral_reset_buffer(ar); in ath11k_start_scan()
2257 ret = ath11k_wmi_send_scan_start_cmd(ar, arg); in ath11k_start_scan()
2261 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath11k_start_scan()
2263 ret = ath11k_scan_stop(ar); in ath11k_start_scan()
2265 ath11k_warn(ar->ab, "failed to stop scan: %d\n", ret); in ath11k_start_scan()
2274 spin_lock_bh(&ar->data_lock); in ath11k_start_scan()
2275 if (ar->scan.state == ATH11K_SCAN_IDLE) { in ath11k_start_scan()
2276 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
2279 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
2288 struct ath11k *ar = hw->priv; in ath11k_mac_op_hw_scan() local
2295 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
2297 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2298 switch (ar->scan.state) { in ath11k_mac_op_hw_scan()
2300 reinit_completion(&ar->scan.started); in ath11k_mac_op_hw_scan()
2301 reinit_completion(&ar->scan.completed); in ath11k_mac_op_hw_scan()
2302 ar->scan.state = ATH11K_SCAN_STARTING; in ath11k_mac_op_hw_scan()
2303 ar->scan.is_roc = false; in ath11k_mac_op_hw_scan()
2304 ar->scan.vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
2313 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2319 ath11k_wmi_start_scan_init(ar, &arg); in ath11k_mac_op_hw_scan()
2349 ret = ath11k_start_scan(ar, &arg); in ath11k_mac_op_hw_scan()
2351 ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); in ath11k_mac_op_hw_scan()
2352 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2353 ar->scan.state = ATH11K_SCAN_IDLE; in ath11k_mac_op_hw_scan()
2354 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2358 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath11k_mac_op_hw_scan()
2366 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
2373 struct ath11k *ar = hw->priv; in ath11k_mac_op_cancel_hw_scan() local
2375 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
2376 ath11k_scan_abort(ar); in ath11k_mac_op_cancel_hw_scan()
2377 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
2379 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_cancel_hw_scan()
2388 struct ath11k *ar = arvif->ar; in ath11k_install_key() local
2398 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_install_key()
2400 reinit_completion(&ar->install_key_done); in ath11k_install_key()
2402 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_install_key()
2430 ath11k_warn(ar->ab, "cipher %d is not supported\n", key->cipher); in ath11k_install_key()
2434 if (test_bit(ATH11K_FLAG_RAW_MODE, &ar->ab->dev_flags)) in ath11k_install_key()
2439 ret = ath11k_wmi_vdev_install_key(arvif->ar, &arg); in ath11k_install_key()
2444 if (!wait_for_completion_timeout(&ar->install_key_done, 1 * HZ)) in ath11k_install_key()
2447 return ar->install_key_status ? -EINVAL : 0; in ath11k_install_key()
2453 struct ath11k *ar = arvif->ar; in ath11k_clear_peer_keys() local
2454 struct ath11k_base *ab = ar->ab; in ath11k_clear_peer_keys()
2461 lockdep_assert_held(&ar->conf_mutex); in ath11k_clear_peer_keys()
2496 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_key() local
2497 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_set_key()
2512 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_mac_op_set_key()
2518 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_key()
2539 ath11k_peer_frags_flush(ar, peer); in ath11k_mac_op_set_key()
2617 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_key()
2622 ath11k_mac_bitrate_mask_num_vht_rates(struct ath11k *ar, in ath11k_mac_bitrate_mask_num_vht_rates() argument
2641 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_vht_fixed_rate() local
2646 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_vht_fixed_rate()
2658 ath11k_warn(ar->ab, "No single VHT Fixed rate found to set for %pM", in ath11k_mac_set_peer_vht_fixed_rate()
2663 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_vht_fixed_rate()
2669 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_vht_fixed_rate()
2674 ath11k_warn(ar->ab, in ath11k_mac_set_peer_vht_fixed_rate()
2681 static int ath11k_station_assoc(struct ath11k *ar, in ath11k_station_assoc() argument
2694 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_assoc()
2702 ath11k_peer_assoc_prepare(ar, vif, sta, &peer_arg, reassoc); in ath11k_station_assoc()
2704 ret = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg); in ath11k_station_assoc()
2706 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_station_assoc()
2711 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_station_assoc()
2712 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_station_assoc()
2717 num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); in ath11k_station_assoc()
2737 ret = ath11k_setup_peer_smps(ar, arvif, sta->addr, in ath11k_station_assoc()
2740 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_station_assoc()
2753 ret = ath11k_peer_assoc_qos_ap(ar, arvif, sta); in ath11k_station_assoc()
2755 ath11k_warn(ar->ab, "failed to set qos params for STA %pM for vdev %i: %d\n", in ath11k_station_assoc()
2764 static int ath11k_station_disassoc(struct ath11k *ar, in ath11k_station_disassoc() argument
2771 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_disassoc()
2782 ath11k_warn(ar->ab, "failed to clear all peer keys for vdev %i: %d\n", in ath11k_station_disassoc()
2791 struct ath11k *ar; in ath11k_sta_rc_update_wk() local
2807 ar = arvif->ar; in ath11k_sta_rc_update_wk()
2816 spin_lock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
2825 spin_unlock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
2827 mutex_lock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
2834 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
2837 ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n", in ath11k_sta_rc_update_wk()
2842 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac update sta %pM nss %d\n", in ath11k_sta_rc_update_wk()
2845 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
2848 ath11k_warn(ar->ab, "failed to update STA %pM nss %d: %d\n", in ath11k_sta_rc_update_wk()
2853 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac update sta %pM smps %d\n", in ath11k_sta_rc_update_wk()
2856 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
2859 ath11k_warn(ar->ab, "failed to update STA %pM smps %d: %d\n", in ath11k_sta_rc_update_wk()
2865 num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, in ath11k_sta_rc_update_wk()
2887 ath11k_peer_assoc_prepare(ar, arvif->vif, sta, in ath11k_sta_rc_update_wk()
2890 err = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg); in ath11k_sta_rc_update_wk()
2892 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_sta_rc_update_wk()
2895 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) in ath11k_sta_rc_update_wk()
2896 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_sta_rc_update_wk()
2901 mutex_unlock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
2907 struct ath11k *ar = arvif->ar; in ath11k_mac_inc_num_stations() local
2909 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_inc_num_stations()
2914 if (ar->num_stations >= ar->max_num_stations) in ath11k_mac_inc_num_stations()
2917 ar->num_stations++; in ath11k_mac_inc_num_stations()
2925 struct ath11k *ar = arvif->ar; in ath11k_mac_dec_num_stations() local
2927 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_dec_num_stations()
2932 ar->num_stations--; in ath11k_mac_dec_num_stations()
2935 static int ath11k_mac_station_add(struct ath11k *ar, in ath11k_mac_station_add() argument
2939 struct ath11k_base *ab = ar->ab; in ath11k_mac_station_add()
2945 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_station_add()
2950 ar->max_num_stations); in ath11k_mac_station_add()
2964 ret = ath11k_peer_create(ar, arvif, sta, &peer_param); in ath11k_mac_station_add()
2974 if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) { in ath11k_mac_station_add()
2983 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_station_add()
2993 ret = ath11k_dp_peer_setup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
3003 ret = ath11k_start_vdev_delay(ar->hw, vif); in ath11k_mac_station_add()
3016 ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
3032 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_state() local
3043 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
3051 ret = ath11k_mac_station_add(ar, vif, sta); in ath11k_mac_op_sta_state()
3053 ath11k_warn(ar->ab, "Failed to add station: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
3057 ath11k_dp_peer_cleanup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
3059 ret = ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
3061 ath11k_warn(ar->ab, "Failed to delete peer: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
3064 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Removed peer: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
3068 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
3069 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
3071 ath11k_warn(ar->ab, "Found peer entry %pM n vdev %i after it was supposedly removed\n", in ath11k_mac_op_sta_state()
3076 ar->num_peers--; in ath11k_mac_op_sta_state()
3078 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
3090 ret = ath11k_station_assoc(ar, vif, sta, false); in ath11k_mac_op_sta_state()
3092 ath11k_warn(ar->ab, "Failed to associate station: %pM\n", in ath11k_mac_op_sta_state()
3099 ret = ath11k_station_disassoc(ar, vif, sta); in ath11k_mac_op_sta_state()
3101 ath11k_warn(ar->ab, "Failed to disassociate station: %pM\n", in ath11k_mac_op_sta_state()
3105 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
3113 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_set_txpwr() local
3129 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
3131 ret = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_mac_op_sta_set_txpwr()
3134 ath11k_warn(ar->ab, "failed to set tx power for station ret: %d\n", in ath11k_mac_op_sta_set_txpwr()
3140 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
3149 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_rc_update() local
3155 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
3157 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_rc_update()
3159 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
3160 ath11k_warn(ar->ab, "mac sta rc update failed to find peer %pM on vdev %i\n", in ath11k_mac_op_sta_rc_update()
3165 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
3167 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_sta_rc_update()
3172 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
3191 ath11k_warn(ar->ab, "Invalid bandwidth %d in rc update for %pM\n", in ath11k_mac_op_sta_rc_update()
3218 ath11k_warn(ar->ab, "Invalid smps %d in sta rc update for %pM\n", in ath11k_mac_op_sta_rc_update()
3229 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
3234 static int ath11k_conf_tx_uapsd(struct ath11k *ar, struct ieee80211_vif *vif, in ath11k_conf_tx_uapsd() argument
3268 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
3272 ath11k_warn(ar->ab, "could not set uapsd params %d\n", ret); in ath11k_conf_tx_uapsd()
3281 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
3285 ath11k_warn(ar->ab, "could not set rx wake param %d\n", ret); in ath11k_conf_tx_uapsd()
3295 struct ath11k *ar = hw->priv; in ath11k_mac_op_conf_tx() local
3300 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
3327 ret = ath11k_wmi_send_wmm_update_cmd_tlv(ar, arvif->vdev_id, in ath11k_mac_op_conf_tx()
3330 ath11k_warn(ar->ab, "failed to set wmm params: %d\n", ret); in ath11k_mac_op_conf_tx()
3334 ret = ath11k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath11k_mac_op_conf_tx()
3337 ath11k_warn(ar->ab, "failed to set sta uapsd: %d\n", ret); in ath11k_mac_op_conf_tx()
3340 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
3345 ath11k_create_ht_cap(struct ath11k *ar, u32 ar_ht_cap, u32 rate_cap_rx_chainmask) in ath11k_create_ht_cap() argument
3349 u32 ar_vht_cap = ar->pdev->cap.vht_cap; in ath11k_create_ht_cap()
3400 for (i = 0; i < ar->num_rx_chains; i++) { in ath11k_create_ht_cap()
3413 struct ath11k *ar = arvif->ar; in ath11k_mac_set_txbf_conf() local
3416 u32 vht_cap = ar->pdev->cap.vht_cap; in ath11k_mac_set_txbf_conf()
3422 if (nsts > (ar->num_rx_chains - 1)) in ath11k_mac_set_txbf_conf()
3423 nsts = ar->num_rx_chains - 1; in ath11k_mac_set_txbf_conf()
3431 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_mac_set_txbf_conf()
3432 sound_dim = ar->num_tx_chains - 1; in ath11k_mac_set_txbf_conf()
3457 return ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_txbf_conf()
3461 static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) in ath11k_set_vht_txbf_cap() argument
3469 if (ar->num_tx_chains < 2) { in ath11k_set_vht_txbf_cap()
3474 if (ar->num_rx_chains < 2) { in ath11k_set_vht_txbf_cap()
3497 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_set_vht_txbf_cap()
3498 sound_dim = ar->num_tx_chains - 1; in ath11k_set_vht_txbf_cap()
3507 if (nsts > (ar->num_rx_chains - 1)) in ath11k_set_vht_txbf_cap()
3508 nsts = ar->num_rx_chains - 1; in ath11k_set_vht_txbf_cap()
3517 ath11k_create_vht_cap(struct ath11k *ar, u32 rate_cap_tx_chainmask, in ath11k_create_vht_cap() argument
3525 vht_cap.cap = ar->pdev->cap.vht_cap; in ath11k_create_vht_cap()
3527 ath11k_set_vht_txbf_cap(ar, &vht_cap.cap); in ath11k_create_vht_cap()
3537 if (i < ar->num_tx_chains && rate_cap_tx_chainmask & BIT(i)) in ath11k_create_vht_cap()
3542 if (i < ar->num_rx_chains && rate_cap_rx_chainmask & BIT(i)) in ath11k_create_vht_cap()
3557 static void ath11k_mac_setup_ht_vht_cap(struct ath11k *ar, in ath11k_mac_setup_ht_vht_cap() argument
3566 rate_cap_tx_chainmask = ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
3567 rate_cap_rx_chainmask = ar->cfg_rx_chainmask >> cap->rx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
3570 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_ht_vht_cap()
3574 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
3578 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && !ar->supports_6ghz) { in ath11k_mac_setup_ht_vht_cap()
3579 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_ht_vht_cap()
3583 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
3585 band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask, in ath11k_mac_setup_ht_vht_cap()
3590 static int ath11k_check_chain_mask(struct ath11k *ar, u32 ant, bool is_tx_ant) in ath11k_check_chain_mask() argument
3728 static int ath11k_mac_copy_he_cap(struct ath11k *ar, in ath11k_mac_copy_he_cap() argument
3764 he_cap_elem->phy_cap_info[4] |= (ar->num_tx_chains - 1) << 2; in ath11k_mac_copy_he_cap()
3770 he_cap_elem->phy_cap_info[5] |= ar->num_tx_chains - 1; in ath11k_mac_copy_he_cap()
3821 static void ath11k_mac_setup_he_cap(struct ath11k *ar, in ath11k_mac_setup_he_cap() argument
3828 count = ath11k_mac_copy_he_cap(ar, cap, in ath11k_mac_setup_he_cap()
3829 ar->mac.iftype[NL80211_BAND_2GHZ], in ath11k_mac_setup_he_cap()
3831 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
3832 band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
3837 count = ath11k_mac_copy_he_cap(ar, cap, in ath11k_mac_setup_he_cap()
3838 ar->mac.iftype[NL80211_BAND_5GHZ], in ath11k_mac_setup_he_cap()
3840 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
3841 band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
3846 ar->supports_6ghz) { in ath11k_mac_setup_he_cap()
3847 count = ath11k_mac_copy_he_cap(ar, cap, in ath11k_mac_setup_he_cap()
3848 ar->mac.iftype[NL80211_BAND_6GHZ], in ath11k_mac_setup_he_cap()
3850 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
3851 band->iftype_data = ar->mac.iftype[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
3856 static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant) in __ath11k_set_antenna() argument
3860 lockdep_assert_held(&ar->conf_mutex); in __ath11k_set_antenna()
3862 if (ath11k_check_chain_mask(ar, tx_ant, true)) in __ath11k_set_antenna()
3865 if (ath11k_check_chain_mask(ar, rx_ant, false)) in __ath11k_set_antenna()
3868 ar->cfg_tx_chainmask = tx_ant; in __ath11k_set_antenna()
3869 ar->cfg_rx_chainmask = rx_ant; in __ath11k_set_antenna()
3871 if (ar->state != ATH11K_STATE_ON && in __ath11k_set_antenna()
3872 ar->state != ATH11K_STATE_RESTARTED) in __ath11k_set_antenna()
3875 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_TX_CHAIN_MASK, in __ath11k_set_antenna()
3876 tx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
3878 ath11k_warn(ar->ab, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
3883 ar->num_tx_chains = get_num_chains(tx_ant); in __ath11k_set_antenna()
3885 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_RX_CHAIN_MASK, in __ath11k_set_antenna()
3886 rx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
3888 ath11k_warn(ar->ab, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
3893 ar->num_rx_chains = get_num_chains(rx_ant); in __ath11k_set_antenna()
3896 ath11k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL); in __ath11k_set_antenna()
3897 ath11k_mac_setup_he_cap(ar, &ar->pdev->cap); in __ath11k_set_antenna()
3902 static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id) in ath11k_mac_tx_mgmt_free() argument
3907 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_free()
3908 msdu = idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_tx_mgmt_free()
3909 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_free()
3914 dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, in ath11k_mac_tx_mgmt_free()
3920 ieee80211_free_txskb(ar->hw, msdu); in ath11k_mac_tx_mgmt_free()
3925 struct ath11k *ar = ctx; in ath11k_mac_tx_mgmt_pending_free() local
3927 ath11k_mac_tx_mgmt_free(ar, buf_id); in ath11k_mac_tx_mgmt_pending_free()
3936 struct ath11k *ar = skb_cb->ar; in ath11k_mac_vif_txmgmt_idr_remove() local
3939 ath11k_mac_tx_mgmt_free(ar, buf_id); in ath11k_mac_vif_txmgmt_idr_remove()
3944 static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, struct ath11k_vif *arvif, in ath11k_mac_mgmt_tx_wmi() argument
3947 struct ath11k_base *ab = ar->ab; in ath11k_mac_mgmt_tx_wmi()
3954 ATH11K_SKB_CB(skb)->ar = ar; in ath11k_mac_mgmt_tx_wmi()
3956 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3957 buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, in ath11k_mac_mgmt_tx_wmi()
3959 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3982 ret = ath11k_wmi_mgmt_send(ar, arvif->vdev_id, buf_id, skb); in ath11k_mac_mgmt_tx_wmi()
3984 ath11k_warn(ar->ab, "failed to send mgmt frame: %d\n", ret); in ath11k_mac_mgmt_tx_wmi()
3994 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3995 idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_mgmt_tx_wmi()
3996 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
4001 static void ath11k_mgmt_over_wmi_tx_purge(struct ath11k *ar) in ath11k_mgmt_over_wmi_tx_purge() argument
4005 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) in ath11k_mgmt_over_wmi_tx_purge()
4006 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_purge()
4011 struct ath11k *ar = container_of(work, struct ath11k, wmi_mgmt_tx_work); in ath11k_mgmt_over_wmi_tx_work() local
4017 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) { in ath11k_mgmt_over_wmi_tx_work()
4020 ath11k_warn(ar->ab, "no vif found for mgmt frame\n"); in ath11k_mgmt_over_wmi_tx_work()
4021 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_work()
4026 mutex_lock(&ar->conf_mutex); in ath11k_mgmt_over_wmi_tx_work()
4027 if (ar->allocated_vdev_map & (1LL << arvif->vdev_id)) { in ath11k_mgmt_over_wmi_tx_work()
4028 ret = ath11k_mac_mgmt_tx_wmi(ar, arvif, skb); in ath11k_mgmt_over_wmi_tx_work()
4030 ath11k_warn(ar->ab, "failed to tx mgmt frame, vdev_id %d :%d\n", in ath11k_mgmt_over_wmi_tx_work()
4032 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_work()
4034 atomic_inc(&ar->num_pending_mgmt_tx); in ath11k_mgmt_over_wmi_tx_work()
4037 ath11k_warn(ar->ab, in ath11k_mgmt_over_wmi_tx_work()
4041 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_work()
4043 mutex_unlock(&ar->conf_mutex); in ath11k_mgmt_over_wmi_tx_work()
4047 static int ath11k_mac_mgmt_tx(struct ath11k *ar, struct sk_buff *skb, in ath11k_mac_mgmt_tx() argument
4050 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath11k_mac_mgmt_tx()
4052 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_mgmt_tx()
4061 atomic_read(&ar->num_pending_mgmt_tx) > ATH11K_PRB_RSP_DROP_THRESHOLD) { in ath11k_mac_mgmt_tx()
4062 ath11k_warn(ar->ab, in ath11k_mac_mgmt_tx()
4068 ath11k_warn(ar->ab, "mgmt tx queue is full\n"); in ath11k_mac_mgmt_tx()
4073 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath11k_mac_mgmt_tx()
4083 struct ath11k *ar = hw->priv; in ath11k_mac_op_tx() local
4105 ret = ath11k_mac_mgmt_tx(ar, skb, is_prb_rsp); in ath11k_mac_op_tx()
4107 ath11k_warn(ar->ab, "failed to queue management frame %d\n", in ath11k_mac_op_tx()
4109 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
4114 ret = ath11k_dp_tx(ar, arvif, skb); in ath11k_mac_op_tx()
4116 ath11k_warn(ar->ab, "failed to transmit frame %d\n", ret); in ath11k_mac_op_tx()
4117 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
4121 void ath11k_mac_drain_tx(struct ath11k *ar) in ath11k_mac_drain_tx() argument
4126 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath11k_mac_drain_tx()
4127 ath11k_mgmt_over_wmi_tx_purge(ar); in ath11k_mac_drain_tx()
4130 static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable) in ath11k_mac_config_mon_status_default() argument
4133 struct ath11k_base *ab = ar->ab; in ath11k_mac_config_mon_status_default()
4139 if (ath11k_debugfs_rx_filter(ar)) in ath11k_mac_config_mon_status_default()
4140 tlv_filter.rx_filter = ath11k_debugfs_rx_filter(ar); in ath11k_mac_config_mon_status_default()
4144 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_mac_config_mon_status_default()
4145 ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, in ath11k_mac_config_mon_status_default()
4146 ar->dp.mac_id + i, in ath11k_mac_config_mon_status_default()
4157 struct ath11k *ar = hw->priv; in ath11k_mac_op_start() local
4158 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_start()
4159 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_op_start()
4162 ath11k_mac_drain_tx(ar); in ath11k_mac_op_start()
4163 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_start()
4165 switch (ar->state) { in ath11k_mac_op_start()
4167 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_start()
4170 ar->state = ATH11K_STATE_RESTARTED; in ath11k_mac_op_start()
4180 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_PMF_QOS, in ath11k_mac_op_start()
4184 ath11k_err(ar->ab, "failed to enable PMF QOS: (%d\n", ret); in ath11k_mac_op_start()
4188 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_DYNAMIC_BW, 1, in ath11k_mac_op_start()
4191 ath11k_err(ar->ab, "failed to enable dynamic bw: %d\n", ret); in ath11k_mac_op_start()
4195 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_ARP_AC_OVERRIDE, in ath11k_mac_op_start()
4203 ret = ath11k_wmi_send_dfs_phyerr_offload_enable_cmd(ar, pdev->pdev_id); in ath11k_mac_op_start()
4210 ret = ath11k_dp_tx_htt_h2t_ppdu_stats_req(ar, in ath11k_mac_op_start()
4217 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_MESH_MCAST_ENABLE, in ath11k_mac_op_start()
4221 ath11k_err(ar->ab, "failed to enable MESH MCAST ENABLE: (%d\n", ret); in ath11k_mac_op_start()
4225 __ath11k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath11k_mac_op_start()
4229 ath11k_reg_update_chan_list(ar); in ath11k_mac_op_start()
4231 ar->num_started_vdevs = 0; in ath11k_mac_op_start()
4232 ar->num_created_vdevs = 0; in ath11k_mac_op_start()
4233 ar->num_peers = 0; in ath11k_mac_op_start()
4234 ar->allocated_vdev_map = 0; in ath11k_mac_op_start()
4239 ret = ath11k_mac_config_mon_status_default(ar, true); in ath11k_mac_op_start()
4247 ath11k_wmi_pdev_lro_cfg(ar, ar->pdev->pdev_id); in ath11k_mac_op_start()
4251 ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_IDLE_PS_CONFIG, in ath11k_mac_op_start()
4259 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
4261 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], in ath11k_mac_op_start()
4262 &ab->pdevs[ar->pdev_idx]); in ath11k_mac_op_start()
4267 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_start()
4268 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
4275 struct ath11k *ar = hw->priv; in ath11k_mac_op_stop() local
4279 ath11k_mac_drain_tx(ar); in ath11k_mac_op_stop()
4281 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_stop()
4282 ret = ath11k_mac_config_mon_status_default(ar, false); in ath11k_mac_op_stop()
4284 ath11k_err(ar->ab, "failed to clear rx_filter for monitor status ring: (%d)\n", in ath11k_mac_op_stop()
4287 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_op_stop()
4288 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_stop()
4289 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_stop()
4291 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_stop()
4292 cancel_work_sync(&ar->regd_update_work); in ath11k_mac_op_stop()
4294 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_stop()
4295 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { in ath11k_mac_op_stop()
4299 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_stop()
4301 rcu_assign_pointer(ar->ab->pdevs_active[ar->pdev_idx], NULL); in ath11k_mac_op_stop()
4305 atomic_set(&ar->num_pending_mgmt_tx, 0); in ath11k_mac_op_stop()
4312 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_vdev_create_params() local
4313 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_setup_vdev_create_params()
4321 params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
4322 params->chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
4325 params->chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
4326 params->chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
4329 ar->supports_6ghz) { in ath11k_mac_setup_vdev_create_params()
4330 params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
4331 params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
4367 static int ath11k_set_he_mu_sounding_mode(struct ath11k *ar, in ath11k_set_he_mu_sounding_mode() argument
4371 struct ath11k_base *ab = ar->ab; in ath11k_set_he_mu_sounding_mode()
4375 param_value = ath11k_mac_prepare_he_mode(ar->pdev, arvif->vif->type); in ath11k_set_he_mu_sounding_mode()
4376 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_he_mu_sounding_mode()
4388 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_he_mu_sounding_mode()
4401 struct ath11k *ar = hw->priv; in ath11k_mac_op_update_vif_offload() local
4402 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_update_vif_offload()
4420 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_update_vif_offload()
4432 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_interface() local
4433 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_interface()
4445 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
4448 ar->num_peers > (ar->max_num_peers - 1)) { in ath11k_mac_op_add_interface()
4454 if (ar->num_created_vdevs > (TARGET_NUM_VDEVS - 1)) { in ath11k_mac_op_add_interface()
4463 arvif->ar = ar; in ath11k_mac_op_add_interface()
4504 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac add interface id %d type %d subtype %d map %llx\n", in ath11k_mac_op_add_interface()
4514 ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); in ath11k_mac_op_add_interface()
4521 ar->num_created_vdevs++; in ath11k_mac_op_add_interface()
4524 ar->allocated_vdev_map |= 1LL << arvif->vdev_id; in ath11k_mac_op_add_interface()
4527 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4528 list_add(&arvif->list, &ar->arvifs); in ath11k_mac_op_add_interface()
4529 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4533 nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; in ath11k_mac_op_add_interface()
4534 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4538 arvif->vdev_id, ar->cfg_tx_chainmask, nss, ret); in ath11k_mac_op_add_interface()
4547 ret = ath11k_peer_create(ar, arvif, NULL, &peer_param); in ath11k_mac_op_add_interface()
4556 ath11k_warn(ar->ab, "failed to set vdev %i kickout parameters: %d\n", in ath11k_mac_op_add_interface()
4564 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4567 ath11k_warn(ar->ab, "failed to set vdev %d RX wake policy: %d\n", in ath11k_mac_op_add_interface()
4574 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4577 ath11k_warn(ar->ab, "failed to set vdev %d TX wake threshold: %d\n", in ath11k_mac_op_add_interface()
4584 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4587 ath11k_warn(ar->ab, "failed to set vdev %d pspoll count: %d\n", in ath11k_mac_op_add_interface()
4592 ret = ath11k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, false); in ath11k_mac_op_add_interface()
4594 ath11k_warn(ar->ab, "failed to disable vdev %d ps mode: %d\n", in ath11k_mac_op_add_interface()
4604 ret = ath11k_mac_txpower_recalc(ar); in ath11k_mac_op_add_interface()
4609 param_value = ar->hw->wiphy->rts_threshold; in ath11k_mac_op_add_interface()
4610 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4613 ath11k_warn(ar->ab, "failed to set rts threshold for vdev %d: %d\n", in ath11k_mac_op_add_interface()
4617 ath11k_dp_vdev_tx_attach(ar, arvif); in ath11k_mac_op_add_interface()
4619 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
4625 reinit_completion(&ar->peer_delete_done); in ath11k_mac_op_add_interface()
4627 ret = ath11k_wmi_send_peer_delete_cmd(ar, vif->addr, in ath11k_mac_op_add_interface()
4630 ath11k_warn(ar->ab, "failed to delete peer vdev_id %d addr %pM\n", in ath11k_mac_op_add_interface()
4635 ret = ath11k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4640 ar->num_peers--; in ath11k_mac_op_add_interface()
4644 ath11k_wmi_vdev_delete(ar, arvif->vdev_id); in ath11k_mac_op_add_interface()
4645 ar->num_created_vdevs--; in ath11k_mac_op_add_interface()
4646 ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_add_interface()
4648 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4650 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4653 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
4672 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_interface() local
4674 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_interface()
4678 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
4683 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
4685 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
4688 ret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); in ath11k_mac_op_remove_interface()
4694 ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); in ath11k_mac_op_remove_interface()
4699 ar->num_created_vdevs--; in ath11k_mac_op_remove_interface()
4702 ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_remove_interface()
4705 ath11k_peer_cleanup(ar, arvif->vdev_id); in ath11k_mac_op_remove_interface()
4707 idr_for_each(&ar->txmgmt_idr, in ath11k_mac_op_remove_interface()
4718 ath11k_mac_txpower_recalc(ar); in ath11k_mac_op_remove_interface()
4719 clear_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_op_remove_interface()
4723 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
4741 struct ath11k *ar = hw->priv; in ath11k_mac_op_configure_filter() local
4745 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
4749 ar->filter_flags = *total_flags; in ath11k_mac_op_configure_filter()
4752 reset_flag = !(ar->filter_flags & FIF_BCN_PRBRESP_PROMISC); in ath11k_mac_op_configure_filter()
4754 ret = ath11k_dp_tx_htt_monitor_mode_ring_config(ar, reset_flag); in ath11k_mac_op_configure_filter()
4757 set_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_op_configure_filter()
4759 clear_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_op_configure_filter()
4761 ath11k_warn(ar->ab, in ath11k_mac_op_configure_filter()
4764 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_configure_filter()
4768 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
4773 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_antenna() local
4775 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
4777 *tx_ant = ar->cfg_tx_chainmask; in ath11k_mac_op_get_antenna()
4778 *rx_ant = ar->cfg_rx_chainmask; in ath11k_mac_op_get_antenna()
4780 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
4787 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_antenna() local
4790 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
4791 ret = __ath11k_set_antenna(ar, tx_ant, rx_ant); in ath11k_mac_op_set_antenna()
4792 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
4801 struct ath11k *ar = hw->priv; in ath11k_mac_op_ampdu_action() local
4804 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
4808 ret = ath11k_dp_rx_ampdu_start(ar, params); in ath11k_mac_op_ampdu_action()
4811 ret = ath11k_dp_rx_ampdu_stop(ar, params); in ath11k_mac_op_ampdu_action()
4825 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
4833 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_chanctx() local
4834 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_chanctx()
4840 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
4842 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
4846 ar->rx_channel = ctx->def.chan; in ath11k_mac_op_add_chanctx()
4847 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
4849 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
4857 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_chanctx() local
4858 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_chanctx()
4864 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
4866 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
4870 ar->rx_channel = NULL; in ath11k_mac_op_remove_chanctx()
4871 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
4873 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
4876 static inline int ath11k_mac_vdev_setup_sync(struct ath11k *ar) in ath11k_mac_vdev_setup_sync() argument
4878 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_setup_sync()
4880 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_vdev_setup_sync()
4883 if (!wait_for_completion_timeout(&ar->vdev_setup_done, in ath11k_mac_vdev_setup_sync()
4887 return ar->last_wmi_vdev_start_status ? -EINVAL : 0; in ath11k_mac_vdev_setup_sync()
4895 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_start_restart() local
4896 struct ath11k_base *ab = ar->ab; in ath11k_mac_vdev_start_restart()
4901 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_start_restart()
4903 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_start_restart()
4920 arg.pref_tx_streams = ar->num_tx_chains; in ath11k_mac_vdev_start_restart()
4921 arg.pref_rx_streams = ar->num_rx_chains; in ath11k_mac_vdev_start_restart()
4935 arg.regdomain = ar->ab->dfs_region; in ath11k_mac_vdev_start_restart()
4940 ret = ath11k_set_he_mu_sounding_mode(ar, arvif); in ath11k_mac_vdev_start_restart()
4942 ath11k_warn(ar->ab, "failed to set he mode vdev %i\n", in ath11k_mac_vdev_start_restart()
4956 ret = ath11k_wmi_vdev_start(ar, &arg, restart); in ath11k_mac_vdev_start_restart()
4958 ath11k_warn(ar->ab, "failed to %s WMI vdev %i\n", in ath11k_mac_vdev_start_restart()
4963 ret = ath11k_mac_vdev_setup_sync(ar); in ath11k_mac_vdev_start_restart()
4970 ar->num_started_vdevs++; in ath11k_mac_vdev_start_restart()
4984 set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_start_restart()
5000 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_stop() local
5003 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_stop()
5005 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_stop()
5007 spin_lock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
5009 ar->vdev_stop_status.stop_in_progress = true; in ath11k_mac_vdev_stop()
5010 ar->vdev_stop_status.vdev_id = arvif->vdev_id; in ath11k_mac_vdev_stop()
5012 spin_unlock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
5014 ret = ath11k_wmi_vdev_stop(ar, arvif->vdev_id); in ath11k_mac_vdev_stop()
5016 ath11k_warn(ar->ab, "failed to stop WMI vdev %i: %d\n", in ath11k_mac_vdev_stop()
5021 ret = ath11k_mac_vdev_setup_sync(ar); in ath11k_mac_vdev_stop()
5023 ath11k_warn(ar->ab, "failed to synchronize setup for vdev %i: %d\n", in ath11k_mac_vdev_stop()
5028 WARN_ON(ar->num_started_vdevs == 0); in ath11k_mac_vdev_stop()
5030 ar->num_started_vdevs--; in ath11k_mac_vdev_stop()
5031 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM stopped, vdev_id %d\n", in ath11k_mac_vdev_stop()
5034 if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { in ath11k_mac_vdev_stop()
5035 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_stop()
5036 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "CAC Stopped for vdev %d\n", in ath11k_mac_vdev_stop()
5042 spin_lock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
5043 ar->vdev_stop_status.stop_in_progress = false; in ath11k_mac_vdev_stop()
5044 spin_unlock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
5101 ath11k_mac_update_vif_chan(struct ath11k *ar, in ath11k_mac_update_vif_chan() argument
5105 struct ath11k_base *ab = ar->ab; in ath11k_mac_update_vif_chan()
5110 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_vif_chan()
5129 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_mac_update_vif_chan()
5164 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_mac_update_vif_chan()
5175 ath11k_mac_update_active_vif_chan(struct ath11k *ar, in ath11k_mac_update_active_vif_chan() argument
5180 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_active_vif_chan()
5182 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
5193 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
5198 ath11k_mac_update_vif_chan(ar, arg.vifs, arg.n_vifs); in ath11k_mac_update_active_vif_chan()
5207 struct ath11k *ar = hw->priv; in ath11k_mac_op_change_chanctx() local
5208 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_change_chanctx()
5210 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
5223 ath11k_mac_update_active_vif_chan(ar, ctx); in ath11k_mac_op_change_chanctx()
5228 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
5234 struct ath11k *ar = hw->priv; in ath11k_start_vdev_delay() local
5235 struct ath11k_base *ab = ar->ab; in ath11k_start_vdev_delay()
5251 ret = ath11k_monitor_vdev_up(ar, arvif->vdev_id); in ath11k_start_vdev_delay()
5269 struct ath11k *ar = hw->priv; in ath11k_mac_op_assign_vif_chanctx() local
5270 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_assign_vif_chanctx()
5275 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5301 param.peer_addr = ar->mac_addr; in ath11k_mac_op_assign_vif_chanctx()
5303 ret = ath11k_peer_create(ar, arvif, NULL, &param); in ath11k_mac_op_assign_vif_chanctx()
5319 ret = ath11k_monitor_vdev_up(ar, arvif->vdev_id); in ath11k_mac_op_assign_vif_chanctx()
5331 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5341 struct ath11k *ar = hw->priv; in ath11k_mac_op_unassign_vif_chanctx() local
5342 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_unassign_vif_chanctx()
5347 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
5358 peer = ath11k_peer_find_by_addr(ab, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
5361 ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
5373 ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
5375 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
5384 struct ath11k *ar = hw->priv; in ath11k_mac_op_switch_vif_chanctx() local
5386 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
5388 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_switch_vif_chanctx()
5391 ath11k_mac_update_vif_chan(ar, vifs, n_vifs); in ath11k_mac_op_switch_vif_chanctx()
5393 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
5399 ath11k_set_vdev_param_to_all_vifs(struct ath11k *ar, int param, u32 value) in ath11k_set_vdev_param_to_all_vifs() argument
5404 mutex_lock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
5405 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_set_vdev_param_to_all_vifs()
5406 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "setting mac vdev %d param %d value %d\n", in ath11k_set_vdev_param_to_all_vifs()
5409 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_vdev_param_to_all_vifs()
5412 ath11k_warn(ar->ab, "failed to set param %d for vdev %d: %d\n", in ath11k_set_vdev_param_to_all_vifs()
5417 mutex_unlock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
5426 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_rts_threshold() local
5429 return ath11k_set_vdev_param_to_all_vifs(ar, param_id, value); in ath11k_mac_op_set_rts_threshold()
5450 struct ath11k *ar = hw->priv; in ath11k_mac_op_flush() local
5456 time_left = wait_event_timeout(ar->dp.tx_empty_waitq, in ath11k_mac_op_flush()
5457 (atomic_read(&ar->dp.num_tx_pending) == 0), in ath11k_mac_op_flush()
5460 ath11k_warn(ar->ab, "failed to flush transmit queue %ld\n", time_left); in ath11k_mac_op_flush()
5464 ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, in ath11k_mac_bitrate_mask_num_ht_rates() argument
5478 ath11k_mac_has_single_legacy_rate(struct ath11k *ar, in ath11k_mac_has_single_legacy_rate() argument
5486 if (ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask)) in ath11k_mac_has_single_legacy_rate()
5489 if (ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask)) in ath11k_mac_has_single_legacy_rate()
5496 ath11k_mac_bitrate_mask_get_single_nss(struct ath11k *ar, in ath11k_mac_bitrate_mask_get_single_nss() argument
5501 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath11k_mac_bitrate_mask_get_single_nss()
5546 ath11k_mac_get_single_legacy_rate(struct ath11k *ar, in ath11k_mac_get_single_legacy_rate() argument
5581 struct ath11k *ar = arvif->ar; in ath11k_mac_set_fixed_rate_params() local
5585 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_fixed_rate_params()
5587 …ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02hhx nss %hhu sgi %… in ath11k_mac_set_fixed_rate_params()
5591 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5594 ath11k_warn(ar->ab, "failed to set fixed rate param 0x%02x: %d\n", in ath11k_mac_set_fixed_rate_params()
5600 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5603 ath11k_warn(ar->ab, "failed to set nss param %d: %d\n", in ath11k_mac_set_fixed_rate_params()
5609 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5612 ath11k_warn(ar->ab, "failed to set sgi param %d: %d\n", in ath11k_mac_set_fixed_rate_params()
5618 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5621 ath11k_warn(ar->ab, "failed to set ldpc param %d: %d\n", in ath11k_mac_set_fixed_rate_params()
5630 ath11k_mac_vht_mcs_range_present(struct ath11k *ar, in ath11k_mac_vht_mcs_range_present() argument
5659 struct ath11k *ar = arvif->ar; in ath11k_mac_set_bitrate_mask_iter() local
5661 spin_lock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
5663 spin_unlock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
5665 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath11k_mac_set_bitrate_mask_iter()
5672 struct ath11k *ar = arvif->ar; in ath11k_mac_disable_peer_fixed_rate() local
5675 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_disable_peer_fixed_rate()
5680 ath11k_warn(ar->ab, in ath11k_mac_disable_peer_fixed_rate()
5692 struct ath11k *ar = arvif->ar; in ath11k_mac_op_set_bitrate_mask() local
5710 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath11k_mac_op_set_bitrate_mask()
5724 if (ath11k_mac_has_single_legacy_rate(ar, band, mask)) { in ath11k_mac_op_set_bitrate_mask()
5725 ret = ath11k_mac_get_single_legacy_rate(ar, band, mask, &rate, in ath11k_mac_op_set_bitrate_mask()
5728 ath11k_warn(ar->ab, "failed to get single legacy rate for vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
5732 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
5735 } else if (ath11k_mac_bitrate_mask_get_single_nss(ar, band, mask, in ath11k_mac_op_set_bitrate_mask()
5741 nss = min_t(u32, ar->num_tx_chains, in ath11k_mac_op_set_bitrate_mask()
5765 num_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, in ath11k_mac_op_set_bitrate_mask()
5768 if (!ath11k_mac_vht_mcs_range_present(ar, band, mask) && in ath11k_mac_op_set_bitrate_mask()
5773 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
5778 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
5782 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5785 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
5789 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5792 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5796 ath11k_warn(ar->ab, "failed to set fixed rate params on vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
5800 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5809 struct ath11k *ar = hw->priv; in ath11k_mac_op_reconfig_complete() local
5814 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
5816 if (ar->state == ATH11K_STATE_RESTARTED) { in ath11k_mac_op_reconfig_complete()
5817 ath11k_warn(ar->ab, "pdev %d successfully recovered\n", in ath11k_mac_op_reconfig_complete()
5818 ar->pdev->pdev_id); in ath11k_mac_op_reconfig_complete()
5819 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_reconfig_complete()
5820 ieee80211_wake_queues(ar->hw); in ath11k_mac_op_reconfig_complete()
5823 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
5827 ath11k_mac_update_bss_chan_survey(struct ath11k *ar, in ath11k_mac_update_bss_chan_survey() argument
5833 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_bss_chan_survey()
5835 if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_ab.svc_map) || in ath11k_mac_update_bss_chan_survey()
5836 ar->rx_channel != channel) in ath11k_mac_update_bss_chan_survey()
5839 if (ar->scan.state != ATH11K_SCAN_IDLE) { in ath11k_mac_update_bss_chan_survey()
5840 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_update_bss_chan_survey()
5845 reinit_completion(&ar->bss_survey_done); in ath11k_mac_update_bss_chan_survey()
5847 ret = ath11k_wmi_pdev_bss_chan_info_request(ar, type); in ath11k_mac_update_bss_chan_survey()
5849 ath11k_warn(ar->ab, "failed to send pdev bss chan info request\n"); in ath11k_mac_update_bss_chan_survey()
5853 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath11k_mac_update_bss_chan_survey()
5855 ath11k_warn(ar->ab, "bss channel survey timed out\n"); in ath11k_mac_update_bss_chan_survey()
5861 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_survey() local
5869 ar_survey = &ar->survey[idx]; in ath11k_mac_op_get_survey()
5871 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
5887 ath11k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath11k_mac_op_get_survey()
5889 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
5891 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
5895 if (ar->rx_channel == survey->channel) in ath11k_mac_op_get_survey()
5899 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
5975 static void ath11k_mac_update_ch_list(struct ath11k *ar, in ath11k_mac_update_ch_list() argument
5991 static u32 ath11k_get_phy_id(struct ath11k *ar, u32 band) in ath11k_get_phy_id() argument
5993 struct ath11k_pdev *pdev = ar->pdev; in ath11k_get_phy_id()
6002 ath11k_warn(ar->ab, "unsupported phy cap:%d\n", band); in ath11k_get_phy_id()
6007 static int ath11k_mac_setup_channels_rates(struct ath11k *ar, in ath11k_mac_setup_channels_rates() argument
6020 reg_cap = &ar->ab->hal_reg_cap[ar->pdev_idx]; in ath11k_mac_setup_channels_rates()
6029 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_channels_rates()
6035 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath11k_mac_setup_channels_rates()
6037 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
6038 phy_id = ath11k_get_phy_id(ar, WMI_HOST_WLAN_2G_CAP); in ath11k_mac_setup_channels_rates()
6039 reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
6041 ath11k_mac_update_ch_list(ar, band, in ath11k_mac_setup_channels_rates()
6051 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
6055 ar->supports_6ghz = true; in ath11k_mac_setup_channels_rates()
6056 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_channels_rates()
6062 ar->hw->wiphy->bands[NL80211_BAND_6GHZ] = band; in ath11k_mac_setup_channels_rates()
6063 ath11k_mac_update_ch_list(ar, band, in ath11k_mac_setup_channels_rates()
6073 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
6074 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in ath11k_mac_setup_channels_rates()
6078 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_channels_rates()
6084 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath11k_mac_setup_channels_rates()
6086 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
6087 phy_id = ath11k_get_phy_id(ar, WMI_HOST_WLAN_5G_CAP); in ath11k_mac_setup_channels_rates()
6088 reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
6091 ath11k_mac_update_ch_list(ar, band, in ath11k_mac_setup_channels_rates()
6100 static int ath11k_mac_setup_iface_combinations(struct ath11k *ar) in ath11k_mac_setup_iface_combinations() argument
6102 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_iface_combinations()
6140 ar->hw->wiphy->iface_combinations = combinations; in ath11k_mac_setup_iface_combinations()
6141 ar->hw->wiphy->n_iface_combinations = 1; in ath11k_mac_setup_iface_combinations()
6183 static void __ath11k_mac_unregister(struct ath11k *ar) in __ath11k_mac_unregister() argument
6185 cancel_work_sync(&ar->regd_update_work); in __ath11k_mac_unregister()
6187 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_unregister()
6189 idr_for_each(&ar->txmgmt_idr, ath11k_mac_tx_mgmt_pending_free, ar); in __ath11k_mac_unregister()
6190 idr_destroy(&ar->txmgmt_idr); in __ath11k_mac_unregister()
6192 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_unregister()
6193 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_unregister()
6194 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_unregister()
6196 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_unregister()
6197 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_unregister()
6199 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_unregister()
6204 struct ath11k *ar; in ath11k_mac_unregister() local
6210 ar = pdev->ar; in ath11k_mac_unregister()
6211 if (!ar) in ath11k_mac_unregister()
6214 __ath11k_mac_unregister(ar); in ath11k_mac_unregister()
6218 static int __ath11k_mac_register(struct ath11k *ar) in __ath11k_mac_register() argument
6220 struct ath11k_base *ab = ar->ab; in __ath11k_mac_register()
6221 struct ath11k_pdev_cap *cap = &ar->pdev->cap; in __ath11k_mac_register()
6236 ath11k_pdev_caps_update(ar); in __ath11k_mac_register()
6238 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in __ath11k_mac_register()
6240 SET_IEEE80211_DEV(ar->hw, ab->dev); in __ath11k_mac_register()
6242 ret = ath11k_mac_setup_channels_rates(ar, in __ath11k_mac_register()
6247 ath11k_mac_setup_ht_vht_cap(ar, cap, &ht_cap); in __ath11k_mac_register()
6248 ath11k_mac_setup_he_cap(ar, cap); in __ath11k_mac_register()
6250 ret = ath11k_mac_setup_iface_combinations(ar); in __ath11k_mac_register()
6252 ath11k_err(ar->ab, "failed to setup interface combinations: %d\n", ret); in __ath11k_mac_register()
6256 ar->hw->wiphy->available_antennas_rx = cap->rx_chain_mask; in __ath11k_mac_register()
6257 ar->hw->wiphy->available_antennas_tx = cap->tx_chain_mask; in __ath11k_mac_register()
6259 ar->hw->wiphy->interface_modes = ab->hw_params.interface_modes; in __ath11k_mac_register()
6261 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in __ath11k_mac_register()
6262 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in __ath11k_mac_register()
6263 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in __ath11k_mac_register()
6264 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in __ath11k_mac_register()
6265 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in __ath11k_mac_register()
6266 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in __ath11k_mac_register()
6267 ieee80211_hw_set(ar->hw, AP_LINK_PS); in __ath11k_mac_register()
6268 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in __ath11k_mac_register()
6269 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in __ath11k_mac_register()
6270 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in __ath11k_mac_register()
6271 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in __ath11k_mac_register()
6272 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in __ath11k_mac_register()
6273 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in __ath11k_mac_register()
6274 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in __ath11k_mac_register()
6275 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in __ath11k_mac_register()
6276 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); in __ath11k_mac_register()
6278 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in __ath11k_mac_register()
6279 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in __ath11k_mac_register()
6280 ieee80211_hw_set(ar->hw, SUPPORTS_REORDERING_BUFFER); in __ath11k_mac_register()
6281 ieee80211_hw_set(ar->hw, SUPPORTS_AMSDU_IN_AMPDU); in __ath11k_mac_register()
6282 ieee80211_hw_set(ar->hw, USES_RSS); in __ath11k_mac_register()
6285 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in __ath11k_mac_register()
6286 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in __ath11k_mac_register()
6293 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in __ath11k_mac_register()
6295 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in __ath11k_mac_register()
6296 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in __ath11k_mac_register()
6298 ar->hw->max_listen_interval = ATH11K_MAX_HW_LISTEN_INTERVAL; in __ath11k_mac_register()
6300 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in __ath11k_mac_register()
6301 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in __ath11k_mac_register()
6302 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in __ath11k_mac_register()
6304 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in __ath11k_mac_register()
6305 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in __ath11k_mac_register()
6308 ar->max_num_stations = TARGET_NUM_STATIONS; in __ath11k_mac_register()
6309 ar->max_num_peers = TARGET_NUM_PEERS_PDEV; in __ath11k_mac_register()
6311 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in __ath11k_mac_register()
6313 ar->hw->queues = ATH11K_HW_MAX_QUEUES; in __ath11k_mac_register()
6314 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN; in __ath11k_mac_register()
6315 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1; in __ath11k_mac_register()
6316 ar->hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; in __ath11k_mac_register()
6318 ar->hw->vif_data_size = sizeof(struct ath11k_vif); in __ath11k_mac_register()
6319 ar->hw->sta_data_size = sizeof(struct ath11k_sta); in __ath11k_mac_register()
6321 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in __ath11k_mac_register()
6322 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); in __ath11k_mac_register()
6324 ar->hw->wiphy->cipher_suites = cipher_suites; in __ath11k_mac_register()
6325 ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in __ath11k_mac_register()
6327 ar->hw->wiphy->iftype_ext_capab = ath11k_iftypes_ext_capa; in __ath11k_mac_register()
6328 ar->hw->wiphy->num_iftype_ext_capab = in __ath11k_mac_register()
6331 ath11k_reg_init(ar); in __ath11k_mac_register()
6334 ar->hw->netdev_features = NETIF_F_HW_CSUM; in __ath11k_mac_register()
6335 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in __ath11k_mac_register()
6336 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in __ath11k_mac_register()
6339 ret = ieee80211_register_hw(ar->hw); in __ath11k_mac_register()
6341 ath11k_err(ar->ab, "ieee80211 registration failed: %d\n", ret); in __ath11k_mac_register()
6351 ar->hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR); in __ath11k_mac_register()
6354 ret = ath11k_regd_update(ar); in __ath11k_mac_register()
6356 ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); in __ath11k_mac_register()
6360 ret = ath11k_debugfs_register(ar); in __ath11k_mac_register()
6362 ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); in __ath11k_mac_register()
6369 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_register()
6372 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_register()
6373 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_register()
6376 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_register()
6377 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_register()
6378 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_register()
6381 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_register()
6387 struct ath11k *ar; in ath11k_mac_register() local
6397 ar = pdev->ar; in ath11k_mac_register()
6399 ether_addr_copy(ar->mac_addr, pdev->mac_addr); in ath11k_mac_register()
6401 ether_addr_copy(ar->mac_addr, ab->mac_addr); in ath11k_mac_register()
6402 ar->mac_addr[4] += i; in ath11k_mac_register()
6405 ret = __ath11k_mac_register(ar); in ath11k_mac_register()
6409 idr_init(&ar->txmgmt_idr); in ath11k_mac_register()
6410 spin_lock_init(&ar->txmgmt_idr_lock); in ath11k_mac_register()
6422 ar = pdev->ar; in ath11k_mac_register()
6423 __ath11k_mac_unregister(ar); in ath11k_mac_register()
6432 struct ath11k *ar; in ath11k_mac_allocate() local
6449 ar = hw->priv; in ath11k_mac_allocate()
6450 ar->hw = hw; in ath11k_mac_allocate()
6451 ar->ab = ab; in ath11k_mac_allocate()
6452 ar->pdev = pdev; in ath11k_mac_allocate()
6453 ar->pdev_idx = i; in ath11k_mac_allocate()
6454 ar->lmac_id = ath11k_hw_get_mac_from_pdev_id(&ab->hw_params, i); in ath11k_mac_allocate()
6456 ar->wmi = &ab->wmi_ab.wmi[i]; in ath11k_mac_allocate()
6462 ar->cfg_tx_chainmask = pdev->cap.tx_chain_mask; in ath11k_mac_allocate()
6463 ar->cfg_rx_chainmask = pdev->cap.rx_chain_mask; in ath11k_mac_allocate()
6464 ar->num_tx_chains = get_num_chains(pdev->cap.tx_chain_mask); in ath11k_mac_allocate()
6465 ar->num_rx_chains = get_num_chains(pdev->cap.rx_chain_mask); in ath11k_mac_allocate()
6467 pdev->ar = ar; in ath11k_mac_allocate()
6468 spin_lock_init(&ar->data_lock); in ath11k_mac_allocate()
6469 INIT_LIST_HEAD(&ar->arvifs); in ath11k_mac_allocate()
6470 INIT_LIST_HEAD(&ar->ppdu_stats_info); in ath11k_mac_allocate()
6471 mutex_init(&ar->conf_mutex); in ath11k_mac_allocate()
6472 init_completion(&ar->vdev_setup_done); in ath11k_mac_allocate()
6473 init_completion(&ar->peer_assoc_done); in ath11k_mac_allocate()
6474 init_completion(&ar->peer_delete_done); in ath11k_mac_allocate()
6475 init_completion(&ar->install_key_done); in ath11k_mac_allocate()
6476 init_completion(&ar->bss_survey_done); in ath11k_mac_allocate()
6477 init_completion(&ar->scan.started); in ath11k_mac_allocate()
6478 init_completion(&ar->scan.completed); in ath11k_mac_allocate()
6479 init_completion(&ar->thermal.wmi_sync); in ath11k_mac_allocate()
6481 INIT_DELAYED_WORK(&ar->scan.timeout, ath11k_scan_timeout_work); in ath11k_mac_allocate()
6482 INIT_WORK(&ar->regd_update_work, ath11k_regd_update_work); in ath11k_mac_allocate()
6484 INIT_WORK(&ar->wmi_mgmt_tx_work, ath11k_mgmt_over_wmi_tx_work); in ath11k_mac_allocate()
6485 skb_queue_head_init(&ar->wmi_mgmt_tx_queue); in ath11k_mac_allocate()
6486 clear_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_allocate()
6499 struct ath11k *ar; in ath11k_mac_destroy() local
6505 ar = pdev->ar; in ath11k_mac_destroy()
6506 if (!ar) in ath11k_mac_destroy()
6509 ieee80211_free_hw(ar->hw); in ath11k_mac_destroy()
6510 pdev->ar = NULL; in ath11k_mac_destroy()