wifi: ath12k: pass link_conf for tx_arvif retrieval
authorAloka Dixit <aloka.dixit@oss.qualcomm.com>
Tue, 8 Apr 2025 18:45:01 +0000 (11:45 -0700)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 16 May 2025 21:36:07 +0000 (14:36 -0700)
Three out of four callers to ath12k_mac_get_tx_arvif() have
link_conf pointer already set for other operations. Pass it
as a parameter. Modify ath12k_control_beaconing() to set
link_conf first.

Signed-off-by: Aloka Dixit <aloka.dixit@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250408184501.3715887-4-aloka.dixit@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/mac.c

index 30329119cfeedb4739ab658f15aa8ed037066229..38099b39bc91d04bd65ff20a44d3e5ed3f8042b2 100644 (file)
@@ -580,22 +580,16 @@ static int ath12k_mac_vif_link_chan(struct ieee80211_vif *vif, u8 link_id,
        return 0;
 }
 
-static struct ath12k_link_vif *ath12k_mac_get_tx_arvif(struct ath12k_link_vif *arvif)
+static struct ath12k_link_vif *
+ath12k_mac_get_tx_arvif(struct ath12k_link_vif *arvif,
+                       struct ieee80211_bss_conf *link_conf)
 {
-       struct ieee80211_bss_conf *link_conf, *tx_bss_conf;
+       struct ieee80211_bss_conf *tx_bss_conf;
        struct ath12k *ar = arvif->ar;
        struct ath12k_vif *tx_ahvif;
 
        lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
 
-       link_conf = ath12k_mac_get_link_bss_conf(arvif);
-       if (!link_conf) {
-               ath12k_warn(ar->ab,
-                           "unable to access bss link conf for link %u required to retrieve transmitting link conf\n",
-                           arvif->link_id);
-               return NULL;
-       }
-
        tx_bss_conf = wiphy_dereference(ath12k_ar_to_hw(ar)->wiphy,
                                        link_conf->tx_bss_conf);
        if (tx_bss_conf) {
@@ -1623,7 +1617,7 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
                return -ENOLINK;
        }
 
-       tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+       tx_arvif = ath12k_mac_get_tx_arvif(arvif, link_conf);
        if (tx_arvif) {
                if (tx_arvif != arvif && arvif->is_up)
                        return 0;
@@ -1693,6 +1687,7 @@ static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
 {
        struct ath12k_wmi_vdev_up_params params = {};
        struct ath12k_vif *ahvif = arvif->ahvif;
+       struct ieee80211_bss_conf *link_conf;
        struct ath12k_link_vif *tx_arvif;
        struct ath12k *ar = arvif->ar;
        int ret;
@@ -1725,7 +1720,15 @@ static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
        params.aid = ahvif->aid;
        params.bssid = arvif->bssid;
 
-       tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+       link_conf = ath12k_mac_get_link_bss_conf(arvif);
+       if (!link_conf) {
+               ath12k_warn(ar->ab,
+                           "unable to access bss link conf for link %u required to retrieve transmitting link conf\n",
+                           arvif->link_id);
+               return;
+       }
+
+       tx_arvif = ath12k_mac_get_tx_arvif(arvif, link_conf);
        if (tx_arvif) {
                params.tx_bssid = tx_arvif->bssid;
                params.nontx_profile_idx = info->bssid_index;
@@ -8018,7 +8021,7 @@ static int ath12k_mac_setup_vdev_params_mbssid(struct ath12k_link_vif *arvif,
                return -ENOLINK;
        }
 
-       tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+       tx_arvif = ath12k_mac_get_tx_arvif(arvif, link_conf);
        if (!tx_arvif)
                return 0;
 
@@ -9645,7 +9648,7 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
                params.aid = ahvif->aid;
                params.bssid = arvif->bssid;
 
-               tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+               tx_arvif = ath12k_mac_get_tx_arvif(arvif, link_conf);
                if (tx_arvif) {
                        params.tx_bssid = tx_arvif->bssid;
                        params.nontx_profile_idx = link_conf->bssid_index;