public inbox for ath12k@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval
@ 2025-01-14 22:36 Aloka Dixit
  2025-01-14 22:36 ` [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval Aloka Dixit
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-14 22:36 UTC (permalink / raw)
  To: ath11k, ath12k, linux-wireless; +Cc: Aloka Dixit

MLO MBSSID series for cfg80211/mac80211, which is in review here 
https://patchwork.kernel.org/project/linux-wireless/list/?series=902914&state=%2A&archive=both,
changes the way transmitted profile data is stored for each link.
As drivers currently retrieve 'arvif' for transmitted profile at
multiple places, MLO MBSSID changes will becomes unnecessarily
bloated with RCU operations for every retrieval. Refactor 'tx_arvif'
to avoid this.

Additionally, fix an issue in ath11k_mac_update_vif_chan() where
tx_arvif is not reset to NULL inside 'for' loop during each
iteration.

Aloka Dixit (5):
  wifi: ath11k: refactor transmitted arvif retrieval
  wifi: ath11k: pass tx arvif for MBSSID and EMA beacon generation
  wifi: ath12k: refactor transmitted arvif retrieval
  wifi: ath12k: pass tx arvif for MBSSID and EMA beacon generation
  wifi: ath12k: pass BSSID index as input for EMA

 drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++-----------
 drivers/net/wireless/ath/ath12k/mac.c | 83 +++++++++++++--------------
 2 files changed, 75 insertions(+), 78 deletions(-)


base-commit: 0c5fcd9069dd5f984e39820629acbfbe0f1b4256
-- 
2.34.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
  2025-01-14 22:36 [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval Aloka Dixit
@ 2025-01-14 22:36 ` Aloka Dixit
  2025-01-15 19:36   ` Sidhanta Sahu
  2025-01-15 23:16   ` kernel test robot
  2025-01-14 22:36 ` [PATCH 2/5] wifi: ath11k: pass tx arvif for MBSSID and EMA beacon generation Aloka Dixit
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-14 22:36 UTC (permalink / raw)
  To: ath11k, ath12k, linux-wireless; +Cc: Aloka Dixit

Create a new function ath11k_mac_get_tx_arvif() to retrieve 'arvif'
for the transmitted interface of the MBSSID set. This will help
modifying the same code path to reflect mac80211 data structure
changes to support MLO. This also fixes an issue in
ath11k_mac_update_vif_chan() where tx_arvif is not reset to NULL
inside for loop during each iteration.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 34 +++++++++++++--------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1556392f7ad4..ebd5a9a7b6c3 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <net/mac80211.h>
@@ -1529,6 +1529,14 @@ static int ath11k_mac_set_vif_params(struct ath11k_vif *arvif,
 	return ret;
 }
 
+static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct ath11k_vif *arvif)
+{
+	if (arvif->vif->mbssid_tx_vif)
+		return ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
+
+	return NULL;
+}
+
 static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 {
 	struct ath11k_vif *tx_arvif;
@@ -1538,7 +1546,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 	u32 params = 0;
 	u8 i = 0;
 
-	tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
+	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
 
 	beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
 							 tx_arvif->vif, 0);
@@ -1597,7 +1605,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
 	int ret;
 
 	if (vif->mbssid_tx_vif) {
-		tx_arvif = ath11k_vif_to_arvif(vif->mbssid_tx_vif);
+		tx_arvif = ath11k_mac_get_tx_arvif(arvif);
 		if (tx_arvif != arvif) {
 			ar = tx_arvif->ar;
 			ab = ar->ab;
@@ -1674,7 +1682,7 @@ static void ath11k_control_beaconing(struct ath11k_vif *arvif,
 				     struct ieee80211_bss_conf *info)
 {
 	struct ath11k *ar = arvif->ar;
-	struct ath11k_vif *tx_arvif = NULL;
+	struct ath11k_vif *tx_arvif;
 	int ret = 0;
 
 	lockdep_assert_held(&arvif->ar->conf_mutex);
@@ -1701,9 +1709,7 @@ static void ath11k_control_beaconing(struct ath11k_vif *arvif,
 
 	ether_addr_copy(arvif->bssid, info->bssid);
 
-	if (arvif->vif->mbssid_tx_vif)
-		tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
-
+	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
 	ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
 				 arvif->bssid,
 				 tx_arvif ? tx_arvif->bssid : NULL,
@@ -6333,14 +6339,12 @@ static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
 	struct ieee80211_vif *tx_vif;
 
 	*tx_vdev_id = 0;
-	tx_vif = arvif->vif->mbssid_tx_vif;
-	if (!tx_vif) {
+	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
+	if (!tx_arvif) {
 		*flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
 		return 0;
 	}
 
-	tx_arvif = ath11k_vif_to_arvif(tx_vif);
-
 	if (arvif->vif->bss_conf.nontransmitted) {
 		if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
 			return -EINVAL;
@@ -7306,8 +7310,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar,
 			   int n_vifs)
 {
 	struct ath11k_base *ab = ar->ab;
-	struct ath11k_vif *arvif, *tx_arvif = NULL;
-	struct ieee80211_vif *mbssid_tx_vif;
+	struct ath11k_vif *arvif, *tx_arvif;
 	int ret;
 	int i;
 	bool monitor_vif = false;
@@ -7361,10 +7364,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar,
 			ath11k_warn(ab, "failed to update bcn tmpl during csa: %d\n",
 				    ret);
 
-		mbssid_tx_vif = arvif->vif->mbssid_tx_vif;
-		if (mbssid_tx_vif)
-			tx_arvif = ath11k_vif_to_arvif(mbssid_tx_vif);
-
+		tx_arvif = ath11k_mac_get_tx_arvif(arvif);
 		ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
 					 arvif->bssid,
 					 tx_arvif ? tx_arvif->bssid : NULL,
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] wifi: ath11k: pass tx arvif for MBSSID and EMA beacon generation
  2025-01-14 22:36 [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval Aloka Dixit
  2025-01-14 22:36 ` [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval Aloka Dixit
@ 2025-01-14 22:36 ` Aloka Dixit
  2025-01-14 22:36 ` [PATCH 3/5] wifi: ath12k: refactor transmitted arvif retrieval Aloka Dixit
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-14 22:36 UTC (permalink / raw)
  To: ath11k, ath12k, linux-wireless; +Cc: Aloka Dixit

Function ath11k_mac_setup_bcn_tmpl() retrieves tx_arvif only for
a sanity check and then calls ath11k_mac_setup_bcn_tmpl_mbssid()
or ath11k_mac_setup_bcn_tmpl_ema() both of which again retrieve
the same pointer. Instead store the pointer and pass it to the
latter two functions.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 40 +++++++++++++--------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index ebd5a9a7b6c3..3a56577c139b 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1537,17 +1537,15 @@ static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct ath11k_vif *arvif)
 	return NULL;
 }
 
-static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
+static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif,
+					 struct ath11k_vif *tx_arvif)
 {
-	struct ath11k_vif *tx_arvif;
 	struct ieee80211_ema_beacons *beacons;
 	int ret = 0;
 	bool nontx_vif_params_set = false;
 	u32 params = 0;
 	u8 i = 0;
 
-	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
-
 	beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
 							 tx_arvif->vif, 0);
 	if (!beacons || !beacons->cnt) {
@@ -1593,25 +1591,22 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 	return ret;
 }
 
-static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
+static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif,
+					    struct ath11k_vif *tx_arvif)
 {
 	struct ath11k *ar = arvif->ar;
 	struct ath11k_base *ab = ar->ab;
-	struct ath11k_vif *tx_arvif = arvif;
 	struct ieee80211_hw *hw = ar->hw;
 	struct ieee80211_vif *vif = arvif->vif;
 	struct ieee80211_mutable_offsets offs = {};
 	struct sk_buff *bcn;
 	int ret;
 
-	if (vif->mbssid_tx_vif) {
-		tx_arvif = ath11k_mac_get_tx_arvif(arvif);
-		if (tx_arvif != arvif) {
-			ar = tx_arvif->ar;
-			ab = ar->ab;
-			hw = ar->hw;
-			vif = tx_arvif->vif;
-		}
+	if (tx_arvif != arvif) {
+		ar = tx_arvif->ar;
+		ab = ar->ab;
+		hw = ar->hw;
+		vif = tx_arvif->vif;
 	}
 
 	bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0);
@@ -1640,6 +1635,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
 static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
 {
 	struct ieee80211_vif *vif = arvif->vif;
+	struct ath11k_vif *tx_arvif;
 
 	if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
 		return 0;
@@ -1647,14 +1643,18 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
 	/* Target does not expect beacon templates for the already up
 	 * non-transmitting interfaces, and results in a crash if sent.
 	 */
-	if (vif->mbssid_tx_vif &&
-	    arvif != ath11k_vif_to_arvif(vif->mbssid_tx_vif) && arvif->is_up)
-		return 0;
+	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
+	if (tx_arvif) {
+		if (arvif != tx_arvif && arvif->is_up)
+			return 0;
 
-	if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif)
-		return ath11k_mac_setup_bcn_tmpl_ema(arvif);
+		if (vif->bss_conf.ema_ap)
+			return ath11k_mac_setup_bcn_tmpl_ema(arvif, tx_arvif);
+	} else {
+		tx_arvif = arvif;
+	}
 
-	return ath11k_mac_setup_bcn_tmpl_mbssid(arvif);
+	return ath11k_mac_setup_bcn_tmpl_mbssid(arvif, tx_arvif);
 }
 
 void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] wifi: ath12k: refactor transmitted arvif retrieval
  2025-01-14 22:36 [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval Aloka Dixit
  2025-01-14 22:36 ` [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval Aloka Dixit
  2025-01-14 22:36 ` [PATCH 2/5] wifi: ath11k: pass tx arvif for MBSSID and EMA beacon generation Aloka Dixit
@ 2025-01-14 22:36 ` Aloka Dixit
  2025-01-14 22:36 ` [PATCH 4/5] wifi: ath12k: pass tx arvif for MBSSID and EMA beacon generation Aloka Dixit
  2025-01-14 22:36 ` [PATCH 5/5] wifi: ath12k: pass BSSID index as input for EMA Aloka Dixit
  4 siblings, 0 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-14 22:36 UTC (permalink / raw)
  To: ath11k, ath12k, linux-wireless; +Cc: Aloka Dixit

Create a new function ath12k_mac_get_tx_arvif() to retrieve 'arvif'
for the transmitted interface of the MBSSID set. This clean up will
help modifying the same code path for MLO changes.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 62 +++++++++++++++------------
 1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 48d110e2a7de..e3228a7c2707 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <net/mac80211.h>
@@ -502,6 +502,19 @@ 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)
+{
+	struct ath12k_vif *tx_ahvif;
+
+	if (arvif->ahvif->vif->mbssid_tx_vif) {
+		tx_ahvif = ath12k_vif_to_ahvif(arvif->ahvif->vif->mbssid_tx_vif);
+		if (tx_ahvif)
+			return &tx_ahvif->deflink;
+	}
+
+	return NULL;
+}
+
 static struct ieee80211_bss_conf *
 ath12k_mac_get_link_bss_conf(struct ath12k_link_vif *arvif)
 {
@@ -1557,7 +1570,6 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif)
 	struct ieee80211_ema_beacons *beacons;
 	struct ath12k_link_vif *tx_arvif;
 	bool nontx_profile_found = false;
-	struct ath12k_vif *tx_ahvif;
 	int ret = 0;
 	u8 i;
 
@@ -1569,10 +1581,9 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif)
 		return -ENOLINK;
 	}
 
-	tx_ahvif = ath12k_vif_to_ahvif(ahvif->vif->mbssid_tx_vif);
-	tx_arvif = &tx_ahvif->deflink;
+	tx_arvif = ath12k_mac_get_tx_arvif(arvif);
 	beacons = ieee80211_beacon_get_template_ema_list(ath12k_ar_to_hw(tx_arvif->ar),
-							 tx_ahvif->vif,
+							 tx_arvif->ahvif->vif,
 							 tx_arvif->link_id);
 	if (!beacons || !beacons->cnt) {
 		ath12k_warn(arvif->ar->ab,
@@ -1616,11 +1627,10 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
 	struct ath12k_vif *ahvif = arvif->ahvif;
 	struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif);
 	struct ieee80211_bss_conf *link_conf;
-	struct ath12k_link_vif *tx_arvif = arvif;
+	struct ath12k_link_vif *tx_arvif;
 	struct ath12k *ar = arvif->ar;
 	struct ath12k_base *ab = ar->ab;
 	struct ieee80211_mutable_offsets offs = {};
-	struct ath12k_vif *tx_ahvif = ahvif;
 	bool nontx_profile_found = false;
 	struct sk_buff *bcn;
 	int ret;
@@ -1635,17 +1645,19 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
 		return -ENOLINK;
 	}
 
-	if (vif->mbssid_tx_vif) {
-		tx_ahvif = ath12k_vif_to_ahvif(vif->mbssid_tx_vif);
-		tx_arvif = &tx_ahvif->deflink;
+	tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+	if (tx_arvif) {
 		if (tx_arvif != arvif && arvif->is_up)
 			return 0;
 
 		if (link_conf->ema_ap)
 			return ath12k_mac_setup_bcn_tmpl_ema(arvif);
+	} else {
+		tx_arvif = arvif;
 	}
 
-	bcn = ieee80211_beacon_get_template(ath12k_ar_to_hw(tx_arvif->ar), tx_ahvif->vif,
+	bcn = ieee80211_beacon_get_template(ath12k_ar_to_hw(tx_arvif->ar),
+					    tx_arvif->ahvif->vif,
 					    &offs, tx_arvif->link_id);
 	if (!bcn) {
 		ath12k_warn(ab, "failed to get beacon template from mac80211\n");
@@ -1702,6 +1714,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 ath12k_link_vif *tx_arvif;
 	struct ath12k *ar = arvif->ar;
 	int ret;
 
@@ -1732,11 +1745,9 @@ static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
 	params.vdev_id = arvif->vdev_id;
 	params.aid = ahvif->aid;
 	params.bssid = arvif->bssid;
-	if (ahvif->vif->mbssid_tx_vif) {
-		struct ath12k_vif *tx_ahvif =
-			ath12k_vif_to_ahvif(ahvif->vif->mbssid_tx_vif);
-		struct ath12k_link_vif *tx_arvif = &tx_ahvif->deflink;
 
+	tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+	if (tx_arvif) {
 		params.tx_bssid = tx_arvif->bssid;
 		params.nontx_profile_idx = info->bssid_index;
 		params.nontx_profile_cnt = 1 << info->bssid_indicator;
@@ -7555,14 +7566,9 @@ static int ath12k_mac_setup_vdev_params_mbssid(struct ath12k_link_vif *arvif,
 					       u32 *flags, u32 *tx_vdev_id)
 {
 	struct ath12k_vif *ahvif = arvif->ahvif;
-	struct ieee80211_vif *tx_vif = ahvif->vif->mbssid_tx_vif;
 	struct ieee80211_bss_conf *link_conf;
 	struct ath12k *ar = arvif->ar;
 	struct ath12k_link_vif *tx_arvif;
-	struct ath12k_vif *tx_ahvif;
-
-	if (!tx_vif)
-		return 0;
 
 	link_conf = ath12k_mac_get_link_bss_conf(arvif);
 	if (!link_conf) {
@@ -7571,11 +7577,13 @@ static int ath12k_mac_setup_vdev_params_mbssid(struct ath12k_link_vif *arvif,
 		return -ENOLINK;
 	}
 
-	tx_ahvif = ath12k_vif_to_ahvif(tx_vif);
-	tx_arvif = &tx_ahvif->deflink;
+	tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+	if (!tx_arvif)
+		return 0;
 
 	if (link_conf->nontransmitted) {
-		if (ar->ah->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
+		if (ath12k_ar_to_hw(ar)->wiphy !=
+		    ath12k_ar_to_hw(tx_arvif->ar)->wiphy)
 			return -EINVAL;
 
 		*flags = WMI_VDEV_MBSSID_FLAGS_NON_TRANSMIT_AP;
@@ -8976,9 +8984,9 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
 			   int n_vifs)
 {
 	struct ath12k_wmi_vdev_up_params params = {};
+	struct ath12k_link_vif *arvif, *tx_arvif;
 	struct ieee80211_bss_conf *link_conf;
 	struct ath12k_base *ab = ar->ab;
-	struct ath12k_link_vif *arvif;
 	struct ieee80211_vif *vif;
 	struct ath12k_vif *ahvif;
 	u8 link_id;
@@ -9046,11 +9054,9 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
 		params.vdev_id = arvif->vdev_id;
 		params.aid = ahvif->aid;
 		params.bssid = arvif->bssid;
-		if (vif->mbssid_tx_vif) {
-			struct ath12k_vif *tx_ahvif =
-				ath12k_vif_to_ahvif(vif->mbssid_tx_vif);
-			struct ath12k_link_vif *tx_arvif = &tx_ahvif->deflink;
 
+		tx_arvif = ath12k_mac_get_tx_arvif(arvif);
+		if (tx_arvif) {
 			params.tx_bssid = tx_arvif->bssid;
 			params.nontx_profile_idx = link_conf->bssid_index;
 			params.nontx_profile_cnt = 1 << link_conf->bssid_indicator;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] wifi: ath12k: pass tx arvif for MBSSID and EMA beacon generation
  2025-01-14 22:36 [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval Aloka Dixit
                   ` (2 preceding siblings ...)
  2025-01-14 22:36 ` [PATCH 3/5] wifi: ath12k: refactor transmitted arvif retrieval Aloka Dixit
@ 2025-01-14 22:36 ` Aloka Dixit
  2025-01-14 22:36 ` [PATCH 5/5] wifi: ath12k: pass BSSID index as input for EMA Aloka Dixit
  4 siblings, 0 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-14 22:36 UTC (permalink / raw)
  To: ath11k, ath12k, linux-wireless; +Cc: Aloka Dixit

Add new input parameter to ath12k_mac_setup_bcn_tmpl_ema() for
'tx_arvif' as the caller ath12k_mac_setup_bcn_tmpl() already
stores it locally. Avoid duplicate retrieval.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index e3228a7c2707..a6626d419294 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1562,13 +1562,13 @@ static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif, struct sk_bu
 	}
 }
 
-static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif)
+static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif,
+					 struct ath12k_link_vif *tx_arvif)
 {
 	struct ath12k_vif *ahvif = arvif->ahvif;
 	struct ieee80211_bss_conf *bss_conf;
 	struct ath12k_wmi_bcn_tmpl_ema_arg ema_args;
 	struct ieee80211_ema_beacons *beacons;
-	struct ath12k_link_vif *tx_arvif;
 	bool nontx_profile_found = false;
 	int ret = 0;
 	u8 i;
@@ -1581,7 +1581,6 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif)
 		return -ENOLINK;
 	}
 
-	tx_arvif = ath12k_mac_get_tx_arvif(arvif);
 	beacons = ieee80211_beacon_get_template_ema_list(ath12k_ar_to_hw(tx_arvif->ar),
 							 tx_arvif->ahvif->vif,
 							 tx_arvif->link_id);
@@ -1651,7 +1650,7 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
 			return 0;
 
 		if (link_conf->ema_ap)
-			return ath12k_mac_setup_bcn_tmpl_ema(arvif);
+			return ath12k_mac_setup_bcn_tmpl_ema(arvif, tx_arvif);
 	} else {
 		tx_arvif = arvif;
 	}
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] wifi: ath12k: pass BSSID index as input for EMA
  2025-01-14 22:36 [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval Aloka Dixit
                   ` (3 preceding siblings ...)
  2025-01-14 22:36 ` [PATCH 4/5] wifi: ath12k: pass tx arvif for MBSSID and EMA beacon generation Aloka Dixit
@ 2025-01-14 22:36 ` Aloka Dixit
  4 siblings, 0 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-14 22:36 UTC (permalink / raw)
  To: ath11k, ath12k, linux-wireless; +Cc: Aloka Dixit

Function ath12k_mac_setup_bcn_tmpl_ema() retrieves 'bss_conf'
only to get BSSID index which is an overhead because the
caller ath12k_mac_setup_bcn_tmpl() has already stored this
locally. Pass the index as an input instead.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index a6626d419294..5f76b3264f64 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1563,24 +1563,15 @@ static void ath12k_mac_set_arvif_ies(struct ath12k_link_vif *arvif, struct sk_bu
 }
 
 static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif,
-					 struct ath12k_link_vif *tx_arvif)
+					 struct ath12k_link_vif *tx_arvif,
+					 u8 bssid_index)
 {
-	struct ath12k_vif *ahvif = arvif->ahvif;
-	struct ieee80211_bss_conf *bss_conf;
 	struct ath12k_wmi_bcn_tmpl_ema_arg ema_args;
 	struct ieee80211_ema_beacons *beacons;
 	bool nontx_profile_found = false;
 	int ret = 0;
 	u8 i;
 
-	bss_conf = ath12k_mac_get_link_bss_conf(arvif);
-	if (!bss_conf) {
-		ath12k_warn(arvif->ar->ab,
-			    "failed to get link bss conf to update bcn tmpl for vif %pM link %u\n",
-			    ahvif->vif->addr, arvif->link_id);
-		return -ENOLINK;
-	}
-
 	beacons = ieee80211_beacon_get_template_ema_list(ath12k_ar_to_hw(tx_arvif->ar),
 							 tx_arvif->ahvif->vif,
 							 tx_arvif->link_id);
@@ -1596,7 +1587,7 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif,
 	for (i = 0; i < beacons->cnt; i++) {
 		if (tx_arvif != arvif && !nontx_profile_found)
 			ath12k_mac_set_arvif_ies(arvif, beacons->bcn[i].skb,
-						 bss_conf->bssid_index,
+						 bssid_index,
 						 &nontx_profile_found);
 
 		ema_args.bcn_cnt = beacons->cnt;
@@ -1615,7 +1606,7 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif,
 	if (tx_arvif != arvif && !nontx_profile_found)
 		ath12k_warn(arvif->ar->ab,
 			    "nontransmitted bssid index %u not found in beacon template\n",
-			    bss_conf->bssid_index);
+			    bssid_index);
 
 	ieee80211_beacon_free_ema_list(beacons);
 	return ret;
@@ -1650,7 +1641,8 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
 			return 0;
 
 		if (link_conf->ema_ap)
-			return ath12k_mac_setup_bcn_tmpl_ema(arvif, tx_arvif);
+			return ath12k_mac_setup_bcn_tmpl_ema(arvif, tx_arvif,
+							     link_conf->bssid_index);
 	} else {
 		tx_arvif = arvif;
 	}
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
  2025-01-14 22:36 ` [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval Aloka Dixit
@ 2025-01-15 19:36   ` Sidhanta Sahu
  2025-01-18  0:36     ` Aloka Dixit
  2025-01-15 23:16   ` kernel test robot
  1 sibling, 1 reply; 11+ messages in thread
From: Sidhanta Sahu @ 2025-01-15 19:36 UTC (permalink / raw)
  To: Aloka Dixit; +Cc: ath11k, ath12k, linux-wireless


>   
> +static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct ath11k_vif *arvif)
> +{
> +	if (arvif->vif->mbssid_tx_vif)
> +		return ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
> +
> +	return NULL;
> +}
> +
>   static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
>   {
>   	struct ath11k_vif *tx_arvif;
> @@ -1538,7 +1546,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
>   	u32 params = 0;
>   	u8 i = 0;
>   
> -	tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
> +	tx_arvif = ath11k_mac_get_tx_arvif(arvif);

ath11k_mac_get_tx_arvif can return NULL, below, we are accessing 
tx_arvif without a NULL check. Shouldn't we add a null check wherever 
applicable to prevent potential issues?

>   
>   	beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
>   							 tx_arvif->vif, 0);
> @@ -1597,7 +1605,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
>   	int ret;
>   
>   	if (vif->mbssid_tx_vif) {
> -		tx_arvif = ath11k_vif_to_arvif(vif->mbssid_tx_vif);
> +		tx_arvif = ath11k_mac_get_tx_arvif(arvif);
>   		if (tx_arvif != arvif) {
>   			ar = tx_arvif->ar;
>   			ab = ar->ab;
> @@ -1674,7 +1682,7 @@ static void ath11k_control_beaconing(struct ath11k_vif *arvif,
>   				     struct ieee80211_bss_conf *info)
>   {
>   	struct ath11k *ar = arvif->ar;
> -	struct ath11k_vif *tx_arvif = NULL;
> +	struct ath11k_vif *tx_arvif;
>   	int ret = 0;
>   
>   	lockdep_assert_held(&arvif->ar->conf_mutex);
> @@ -1701,9 +1709,7 @@ static void ath11k_control_beaconing(struct ath11k_vif *arvif,
>   
>   	ether_addr_copy(arvif->bssid, info->bssid);
>   
> -	if (arvif->vif->mbssid_tx_vif)
> -		tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
> -
> +	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
>   	ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
>   				 arvif->bssid,
>   				 tx_arvif ? tx_arvif->bssid : NULL,
> @@ -6333,14 +6339,12 @@ static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
>   	struct ieee80211_vif *tx_vif;
>   
>   	*tx_vdev_id = 0;
> -	tx_vif = arvif->vif->mbssid_tx_vif;
> -	if (!tx_vif) {
> +	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
> +	if (!tx_arvif) {
>   		*flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
>   		return 0;
>   	}
>   
> -	tx_arvif = ath11k_vif_to_arvif(tx_vif);
> -
>   	if (arvif->vif->bss_conf.nontransmitted) {
>   		if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
>   			return -EINVAL;
> @@ -7306,8 +7310,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar,
>   			   int n_vifs)
>   {
>   	struct ath11k_base *ab = ar->ab;
> -	struct ath11k_vif *arvif, *tx_arvif = NULL;
> -	struct ieee80211_vif *mbssid_tx_vif;
> +	struct ath11k_vif *arvif, *tx_arvif;
>   	int ret;
>   	int i;
>   	bool monitor_vif = false;
> @@ -7361,10 +7364,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar,
>   			ath11k_warn(ab, "failed to update bcn tmpl during csa: %d\n",
>   				    ret);
>   
> -		mbssid_tx_vif = arvif->vif->mbssid_tx_vif;
> -		if (mbssid_tx_vif)
> -			tx_arvif = ath11k_vif_to_arvif(mbssid_tx_vif);
> -
> +		tx_arvif = ath11k_mac_get_tx_arvif(arvif);
>   		ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
>   					 arvif->bssid,
>   					 tx_arvif ? tx_arvif->bssid : NULL,


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
  2025-01-14 22:36 ` [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval Aloka Dixit
  2025-01-15 19:36   ` Sidhanta Sahu
@ 2025-01-15 23:16   ` kernel test robot
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-01-15 23:16 UTC (permalink / raw)
  To: Aloka Dixit, ath11k, ath12k, linux-wireless
  Cc: llvm, oe-kbuild-all, Aloka Dixit

Hi Aloka,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0c5fcd9069dd5f984e39820629acbfbe0f1b4256]

url:    https://github.com/intel-lab-lkp/linux/commits/Aloka-Dixit/wifi-ath11k-refactor-transmitted-arvif-retrieval/20250115-063922
base:   0c5fcd9069dd5f984e39820629acbfbe0f1b4256
patch link:    https://lore.kernel.org/r/20250114223612.2979310-2-quic_alokad%40quicinc.com
patch subject: [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20250116/202501160626.Jbb3GHnk-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250116/202501160626.Jbb3GHnk-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501160626.Jbb3GHnk-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath11k/mac.c:6349:46: warning: variable 'tx_vif' is uninitialized when used here [-Wuninitialized]
    6349 |                 if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
         |                                                            ^~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:6339:30: note: initialize the variable 'tx_vif' to silence this warning
    6339 |         struct ieee80211_vif *tx_vif;
         |                                     ^
         |                                      = NULL
   1 warning generated.


vim +/tx_vif +6349 drivers/net/wireless/ath/ath11k/mac.c

d5c65159f28953 Kalle Valo  2019-11-23  6333  
5a81610acf66c4 Aloka Dixit 2023-05-05  6334  static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
5a81610acf66c4 Aloka Dixit 2023-05-05  6335  					       u32 *flags, u32 *tx_vdev_id)
5a81610acf66c4 Aloka Dixit 2023-05-05  6336  {
5a81610acf66c4 Aloka Dixit 2023-05-05  6337  	struct ath11k *ar = arvif->ar;
5a81610acf66c4 Aloka Dixit 2023-05-05  6338  	struct ath11k_vif *tx_arvif;
5a81610acf66c4 Aloka Dixit 2023-05-05  6339  	struct ieee80211_vif *tx_vif;
5a81610acf66c4 Aloka Dixit 2023-05-05  6340  
5a81610acf66c4 Aloka Dixit 2023-05-05  6341  	*tx_vdev_id = 0;
72f88bc503a76c Aloka Dixit 2025-01-14  6342  	tx_arvif = ath11k_mac_get_tx_arvif(arvif);
72f88bc503a76c Aloka Dixit 2025-01-14  6343  	if (!tx_arvif) {
5a81610acf66c4 Aloka Dixit 2023-05-05  6344  		*flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
5a81610acf66c4 Aloka Dixit 2023-05-05  6345  		return 0;
5a81610acf66c4 Aloka Dixit 2023-05-05  6346  	}
5a81610acf66c4 Aloka Dixit 2023-05-05  6347  
5a81610acf66c4 Aloka Dixit 2023-05-05  6348  	if (arvif->vif->bss_conf.nontransmitted) {
5a81610acf66c4 Aloka Dixit 2023-05-05 @6349  		if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
5a81610acf66c4 Aloka Dixit 2023-05-05  6350  			return -EINVAL;
5a81610acf66c4 Aloka Dixit 2023-05-05  6351  
5a81610acf66c4 Aloka Dixit 2023-05-05  6352  		*flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
5a81610acf66c4 Aloka Dixit 2023-05-05  6353  		*tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id;
5a81610acf66c4 Aloka Dixit 2023-05-05  6354  	} else if (tx_arvif == arvif) {
5a81610acf66c4 Aloka Dixit 2023-05-05  6355  		*flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
5a81610acf66c4 Aloka Dixit 2023-05-05  6356  	} else {
5a81610acf66c4 Aloka Dixit 2023-05-05  6357  		return -EINVAL;
5a81610acf66c4 Aloka Dixit 2023-05-05  6358  	}
5a81610acf66c4 Aloka Dixit 2023-05-05  6359  
5a81610acf66c4 Aloka Dixit 2023-05-05  6360  	if (arvif->vif->bss_conf.ema_ap)
5a81610acf66c4 Aloka Dixit 2023-05-05  6361  		*flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
5a81610acf66c4 Aloka Dixit 2023-05-05  6362  
5a81610acf66c4 Aloka Dixit 2023-05-05  6363  	return 0;
5a81610acf66c4 Aloka Dixit 2023-05-05  6364  }
5a81610acf66c4 Aloka Dixit 2023-05-05  6365  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
  2025-01-15 19:36   ` Sidhanta Sahu
@ 2025-01-18  0:36     ` Aloka Dixit
  2025-01-18  0:44       ` Sidhanta Sahu
  0 siblings, 1 reply; 11+ messages in thread
From: Aloka Dixit @ 2025-01-18  0:36 UTC (permalink / raw)
  To: Sidhanta Sahu; +Cc: ath11k, ath12k, linux-wireless


On 1/15/2025 11:36 AM, Sidhanta Sahu wrote:
>
>>   +static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct 
>> ath11k_vif *arvif)
>> +{
>> +    if (arvif->vif->mbssid_tx_vif)
>> +        return ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
>> +
>> +    return NULL;
>> +}
>> +
>>   static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
>>   {
>>       struct ath11k_vif *tx_arvif;
>> @@ -1538,7 +1546,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct 
>> ath11k_vif *arvif)
>>       u32 params = 0;
>>       u8 i = 0;
>>   -    tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
>> +    tx_arvif = ath11k_mac_get_tx_arvif(arvif);
>
> ath11k_mac_get_tx_arvif can return NULL, below, we are accessing 
> tx_arvif without a NULL check. Shouldn't we add a null check wherever 
> applicable to prevent potential issues?
>
>>         beacons = 
>> ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
>>                                tx_arvif->vif, 0);

ath11k_mac_setup_bcn_tmpl_ema() gets called only when tx_arvif is non-NULL.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
  2025-01-18  0:36     ` Aloka Dixit
@ 2025-01-18  0:44       ` Sidhanta Sahu
  2025-01-19  4:57         ` Aloka Dixit
  0 siblings, 1 reply; 11+ messages in thread
From: Sidhanta Sahu @ 2025-01-18  0:44 UTC (permalink / raw)
  To: Aloka Dixit; +Cc: ath11k, ath12k, linux-wireless



On 1/17/2025 4:36 PM, Aloka Dixit wrote:
> 
> On 1/15/2025 11:36 AM, Sidhanta Sahu wrote:
>>
>>>   +static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct 
>>> ath11k_vif *arvif)
>>> +{
>>> +    if (arvif->vif->mbssid_tx_vif)
>>> +        return ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
>>> +
>>> +    return NULL;
>>> +}
>>> +
>>>   static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
>>>   {
>>>       struct ath11k_vif *tx_arvif;
>>> @@ -1538,7 +1546,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct 
>>> ath11k_vif *arvif)
>>>       u32 params = 0;
>>>       u8 i = 0;
>>>   -    tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
>>> +    tx_arvif = ath11k_mac_get_tx_arvif(arvif);
>>
>> ath11k_mac_get_tx_arvif can return NULL, below, we are accessing 
>> tx_arvif without a NULL check. Shouldn't we add a null check wherever 
>> applicable to prevent potential issues?
>>
>>>         beacons = 
>>> ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
>>>                                tx_arvif->vif, 0);
> 
> ath11k_mac_setup_bcn_tmpl_ema() gets called only when tx_arvif is non-NULL.

If tx_arvif is not NULL (and known already), Is it still required to 
call `ath11k_mac_get_tx_arvif` under `ath11k_mac_setup_bcn_tmpl_ema`?

> 
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval
  2025-01-18  0:44       ` Sidhanta Sahu
@ 2025-01-19  4:57         ` Aloka Dixit
  0 siblings, 0 replies; 11+ messages in thread
From: Aloka Dixit @ 2025-01-19  4:57 UTC (permalink / raw)
  To: Sidhanta Sahu; +Cc: ath11k, ath12k, linux-wireless


On 1/17/2025 4:44 PM, Sidhanta Sahu wrote:
>
>
> On 1/17/2025 4:36 PM, Aloka Dixit wrote:
>>
>> On 1/15/2025 11:36 AM, Sidhanta Sahu wrote:
>>>
>>>>   +static struct ath11k_vif *ath11k_mac_get_tx_arvif(struct 
>>>> ath11k_vif *arvif)
>>>> +{
>>>> +    if (arvif->vif->mbssid_tx_vif)
>>>> +        return ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
>>>> +
>>>> +    return NULL;
>>>> +}
>>>> +
>>>>   static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
>>>>   {
>>>>       struct ath11k_vif *tx_arvif;
>>>> @@ -1538,7 +1546,7 @@ static int 
>>>> ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
>>>>       u32 params = 0;
>>>>       u8 i = 0;
>>>>   -    tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
>>>> +    tx_arvif = ath11k_mac_get_tx_arvif(arvif);
>>>
>>> ath11k_mac_get_tx_arvif can return NULL, below, we are accessing 
>>> tx_arvif without a NULL check. Shouldn't we add a null check 
>>> wherever applicable to prevent potential issues?
>>>
>>>>         beacons = 
>>>> ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
>>>>                                tx_arvif->vif, 0);
>>
>> ath11k_mac_setup_bcn_tmpl_ema() gets called only when tx_arvif is 
>> non-NULL.
>
> If tx_arvif is not NULL (and known already), Is it still required to 
> call `ath11k_mac_get_tx_arvif` under `ath11k_mac_setup_bcn_tmpl_ema`?


Yes, as per the current code it still needs to retrieve tx_arvif to be used.

This patch 1/5 only creates a new function to refactor existing repeated 
code.

The next patch,

https://patchwork.kernel.org/project/linux-wireless/patch/20250114223612.2979310-3-quic_alokad@quicinc.com/,

adds few more changes on the same code.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-01-19  4:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 22:36 [PATCH 0/5] wifi:ath11k/ath12k: refactor tx_arvif retrieval Aloka Dixit
2025-01-14 22:36 ` [PATCH 1/5] wifi: ath11k: refactor transmitted arvif retrieval Aloka Dixit
2025-01-15 19:36   ` Sidhanta Sahu
2025-01-18  0:36     ` Aloka Dixit
2025-01-18  0:44       ` Sidhanta Sahu
2025-01-19  4:57         ` Aloka Dixit
2025-01-15 23:16   ` kernel test robot
2025-01-14 22:36 ` [PATCH 2/5] wifi: ath11k: pass tx arvif for MBSSID and EMA beacon generation Aloka Dixit
2025-01-14 22:36 ` [PATCH 3/5] wifi: ath12k: refactor transmitted arvif retrieval Aloka Dixit
2025-01-14 22:36 ` [PATCH 4/5] wifi: ath12k: pass tx arvif for MBSSID and EMA beacon generation Aloka Dixit
2025-01-14 22:36 ` [PATCH 5/5] wifi: ath12k: pass BSSID index as input for EMA Aloka Dixit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox