From: Baochen Qiang Date: Fri, 18 Apr 2025 02:55:40 +0000 (+0800) Subject: wifi: ath12k: determine interface mode in _op_add_interface() X-Git-Tag: v6.16-rc1~132^2~46^2~1^2~46 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ee2fc1f7347e8393b94d35a0d2b9d24920c9b24f;p=linux-block.git wifi: ath12k: determine interface mode in _op_add_interface() Currently interface mode is determined each time a vdev is created. In MLO scenario where there could be multiple vdevs this is just a waste of time. Move related logic into a new helper ath12k_mac_determine_vdev_type() and call it once in ath12k_mac_op_add_interface(). Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Baochen Qiang Reviewed-by: Vasanthakumar Thiagarajan Link: https://patch.msgid.link/20250418-ath12k-6g-lp-vlp-v1-7-c869c86cad60@quicinc.com Signed-off-by: Jeff Johnson --- diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 2deffcf36826..5cfd50d0c666 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -8312,6 +8312,43 @@ void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab) } } +static void ath12k_mac_determine_vdev_type(struct ieee80211_vif *vif, + struct ath12k_vif *ahvif) +{ + ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; + + switch (vif->type) { + case NL80211_IFTYPE_UNSPECIFIED: + case NL80211_IFTYPE_STATION: + ahvif->vdev_type = WMI_VDEV_TYPE_STA; + + if (vif->p2p) + ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_CLIENT; + + break; + case NL80211_IFTYPE_MESH_POINT: + ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S; + fallthrough; + case NL80211_IFTYPE_AP: + ahvif->vdev_type = WMI_VDEV_TYPE_AP; + + if (vif->p2p) + ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_GO; + + break; + case NL80211_IFTYPE_MONITOR: + ahvif->vdev_type = WMI_VDEV_TYPE_MONITOR; + break; + case NL80211_IFTYPE_P2P_DEVICE: + ahvif->vdev_type = WMI_VDEV_TYPE_STA; + ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE; + break; + default: + WARN_ON(1); + break; + } +} + int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif) { struct ath12k_hw *ah = ar->ah; @@ -8355,39 +8392,8 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif) arvif->ar = ar; vdev_id = __ffs64(ab->free_vdev_map); arvif->vdev_id = vdev_id; - ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; - - switch (vif->type) { - case NL80211_IFTYPE_UNSPECIFIED: - case NL80211_IFTYPE_STATION: - ahvif->vdev_type = WMI_VDEV_TYPE_STA; - - if (vif->p2p) - ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_CLIENT; - - break; - case NL80211_IFTYPE_MESH_POINT: - ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S; - fallthrough; - case NL80211_IFTYPE_AP: - ahvif->vdev_type = WMI_VDEV_TYPE_AP; - - if (vif->p2p) - ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_GO; - - break; - case NL80211_IFTYPE_MONITOR: - ahvif->vdev_type = WMI_VDEV_TYPE_MONITOR; + if (vif->type == NL80211_IFTYPE_MONITOR) ar->monitor_vdev_id = vdev_id; - break; - case NL80211_IFTYPE_P2P_DEVICE: - ahvif->vdev_type = WMI_VDEV_TYPE_STA; - ahvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE; - break; - default: - WARN_ON(1); - break; - } ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev create id %d type %d subtype %d map %llx\n", arvif->vdev_id, ahvif->vdev_type, ahvif->vdev_subtype, @@ -8766,6 +8772,9 @@ static int ath12k_mac_op_add_interface(struct ieee80211_hw *hw, vif->hw_queue[i] = ATH12K_HW_DEFAULT_QUEUE; vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; + + ath12k_mac_determine_vdev_type(vif, ahvif); + /* Defer vdev creation until assign_chanctx or hw_scan is initiated as driver * will not know if this interface is an ML vif at this point. */