mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently
@ 2025-04-17  5:49 Aditya Kumar Singh
  2025-04-17  5:49 ` [PATCH ath-next v3 1/2] wifi: ath12k: handle scan link during vdev create Aditya Kumar Singh
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aditya Kumar Singh @ 2025-04-17  5:49 UTC (permalink / raw)
  To: Jeff Johnson
  Cc: ath12k, linux-kernel, linux-wireless, Vasanthakumar Thiagarajan,
	Aditya Kumar Singh

This series of patches addresses the handling of scan links in the ath12k
driver to improve consistency and functionality. The changes ensure that
link ID 15 is correctly used for scan operations across both ML and non-ML
interfaces. Additionally, the patches prevent scan failures by fetching
link_conf only when the link ID is valid and setting appropriate default
values for scan vdevs.

Currently, no issues have been observed; these changes are intended as a
cleanup and to ensure proper handling. For split-mac these changes are
pre-req change.

---
Changes in v3:
- Rebased on ToT.
- Link to v2: https://lore.kernel.org/r/20250411-fix_scan_vdev_handling-v2-0-b6740896c144@oss.qualcomm.com

Changes in v2:
- CCed linux-wireless list as well.
- No other changes.

---
Aditya Kumar Singh (2):
      wifi: ath12k: handle scan link during vdev create
      wifi: ath12k: Use scan link ID 15 for all scan operations

 drivers/net/wireless/ath/ath12k/mac.c | 60 ++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 32 deletions(-)
---
base-commit: d0bcc5eaaa611aacbffe6b2cc2fb64bfc3bdfcbc
change-id: 20250402-fix_scan_vdev_handling-ef5be452b949


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

* [PATCH ath-next v3 1/2] wifi: ath12k: handle scan link during vdev create
  2025-04-17  5:49 [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Aditya Kumar Singh
@ 2025-04-17  5:49 ` Aditya Kumar Singh
  2025-04-17  5:49 ` [PATCH ath-next v3 2/2] wifi: ath12k: Use scan link ID 15 for all scan operations Aditya Kumar Singh
  2025-05-16 17:40 ` [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Jeff Johnson
  2 siblings, 0 replies; 4+ messages in thread
From: Aditya Kumar Singh @ 2025-04-17  5:49 UTC (permalink / raw)
  To: Jeff Johnson
  Cc: ath12k, linux-kernel, linux-wireless, Vasanthakumar Thiagarajan,
	Aditya Kumar Singh

For scanning purposes, the driver can use link ID 15 (scan link). A future
change will make non-ML interfaces to select the scan link. In this
scenario, arvif->link_id will be used to retrieve the link configuration in
ath12k_mac_vdev_create(). However, link ID 15 is not recognized as a valid
link ID in the upper kernel, which will result in a failure to fetch
link_conf and subsequently cause the scan to fail.

To avoid this issue, ensure link_conf is fetched only when the link ID is
within the valid range. Since link_conf cannot be retrieved using the scan
link, use vif->addr as the Ethernet address for creating the scan vdev.
This address will serve as the source address (address 2) in the probe
request frames during scanning. Additionally, use the automatic Tx power
value for the vdev. As this is a scan vdev, these values do not affect the
scan functionality.

Note that vif->addr will only be taken when a valid link_conf can not be
fetched. Otherwise, link_conf's address will be taken as address 2.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index dfc803879028deaa0bb02ced892238086b2687c9..d219c5b07a79c9829a1de12183e298d24eb5336a 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -8310,7 +8310,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 	struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif);
 	struct ath12k_wmi_vdev_create_arg vdev_arg = {0};
 	struct ath12k_wmi_peer_create_arg peer_param = {0};
-	struct ieee80211_bss_conf *link_conf;
+	struct ieee80211_bss_conf *link_conf = NULL;
 	u32 param_id, param_value;
 	u16 nss;
 	int i;
@@ -8325,22 +8325,21 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 	if (vif->type == NL80211_IFTYPE_MONITOR && ar->monitor_vdev_created)
 		return -EINVAL;
 
-	/* If no link is active and scan vdev is requested
-	 * use a default link conf for scan address purpose.
-	 */
-	if (arvif->link_id == ATH12K_DEFAULT_SCAN_LINK && vif->valid_links)
-		link_id = ffs(vif->valid_links) - 1;
-	else
-		link_id = arvif->link_id;
+	link_id = arvif->link_id;
 
-	link_conf = wiphy_dereference(hw->wiphy, vif->link_conf[link_id]);
-	if (!link_conf) {
-		ath12k_warn(ar->ab, "unable to access bss link conf in vdev create for vif %pM link %u\n",
-			    vif->addr, arvif->link_id);
-		return -ENOLINK;
+	if (link_id < IEEE80211_MLD_MAX_NUM_LINKS) {
+		link_conf = wiphy_dereference(hw->wiphy, vif->link_conf[link_id]);
+		if (!link_conf) {
+			ath12k_warn(ar->ab, "unable to access bss link conf in vdev create for vif %pM link %u\n",
+				    vif->addr, arvif->link_id);
+			return -ENOLINK;
+		}
 	}
 
-	memcpy(arvif->bssid, link_conf->addr, ETH_ALEN);
+	if (link_conf)
+		memcpy(arvif->bssid, link_conf->addr, ETH_ALEN);
+	else
+		memcpy(arvif->bssid, vif->addr, ETH_ALEN);
 
 	arvif->ar = ar;
 	vdev_id = __ffs64(ab->free_vdev_map);
@@ -8495,7 +8494,11 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 		break;
 	}
 
-	arvif->txpower = link_conf->txpower;
+	if (link_conf)
+		arvif->txpower = link_conf->txpower;
+	else
+		arvif->txpower = NL80211_TX_POWER_AUTOMATIC;
+
 	ret = ath12k_mac_txpower_recalc(ar);
 	if (ret)
 		goto err_peer_del;

-- 
2.34.1


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

* [PATCH ath-next v3 2/2] wifi: ath12k: Use scan link ID 15 for all scan operations
  2025-04-17  5:49 [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Aditya Kumar Singh
  2025-04-17  5:49 ` [PATCH ath-next v3 1/2] wifi: ath12k: handle scan link during vdev create Aditya Kumar Singh
@ 2025-04-17  5:49 ` Aditya Kumar Singh
  2025-05-16 17:40 ` [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Jeff Johnson
  2 siblings, 0 replies; 4+ messages in thread
From: Aditya Kumar Singh @ 2025-04-17  5:49 UTC (permalink / raw)
  To: Jeff Johnson
  Cc: ath12k, linux-kernel, linux-wireless, Vasanthakumar Thiagarajan,
	Aditya Kumar Singh

According to the code documentation in ath12k_mac_op_hw_scan(), "if no
links of an ML VIF are already active on the radio corresponding to the
given scan frequency, the scan link (link ID 15) should be used". This rule
should apply to non-ML interfaces as well to maintain uniformity across the
driver. However, currently, link 0 is selected as the scan link during
non-ML operations.

Update the code to use scan link ID 15 in all cases.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index d219c5b07a79c9829a1de12183e298d24eb5336a..5e3f77894d035e0dab6d24481e696fd15415a3d2 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -3466,25 +3466,18 @@ static struct ath12k_link_vif *ath12k_mac_assign_link_vif(struct ath12k_hw *ah,
 	if (arvif)
 		return arvif;
 
-	if (!vif->valid_links) {
-		/* Use deflink for Non-ML VIFs and mark the link id as 0
-		 */
-		link_id = 0;
+	/* If this is the first link arvif being created for an ML VIF
+	 * use the preallocated deflink memory except for scan arvifs
+	 */
+	if (!ahvif->links_map && link_id != ATH12K_DEFAULT_SCAN_LINK) {
 		arvif = &ahvif->deflink;
+
+		if (vif->type == NL80211_IFTYPE_STATION)
+			arvif->is_sta_assoc_link = true;
 	} else {
-		/* If this is the first link arvif being created for an ML VIF
-		 * use the preallocated deflink memory except for scan arvifs
-		 */
-		if (!ahvif->links_map && link_id != ATH12K_DEFAULT_SCAN_LINK) {
-			arvif = &ahvif->deflink;
-			if (vif->type == NL80211_IFTYPE_STATION)
-				arvif->is_sta_assoc_link = true;
-		} else {
-			arvif = (struct ath12k_link_vif *)
-			kzalloc(sizeof(struct ath12k_link_vif), GFP_KERNEL);
-			if (!arvif)
-				return NULL;
-		}
+		arvif = kzalloc(sizeof(*arvif), GFP_KERNEL);
+		if (!arvif)
+			return NULL;
 	}
 
 	ath12k_mac_init_arvif(ahvif, arvif, link_id);

-- 
2.34.1


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

* Re: [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently
  2025-04-17  5:49 [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Aditya Kumar Singh
  2025-04-17  5:49 ` [PATCH ath-next v3 1/2] wifi: ath12k: handle scan link during vdev create Aditya Kumar Singh
  2025-04-17  5:49 ` [PATCH ath-next v3 2/2] wifi: ath12k: Use scan link ID 15 for all scan operations Aditya Kumar Singh
@ 2025-05-16 17:40 ` Jeff Johnson
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Johnson @ 2025-05-16 17:40 UTC (permalink / raw)
  To: Jeff Johnson, Aditya Kumar Singh
  Cc: ath12k, linux-kernel, linux-wireless, Vasanthakumar Thiagarajan


On Thu, 17 Apr 2025 11:19:12 +0530, Aditya Kumar Singh wrote:
> This series of patches addresses the handling of scan links in the ath12k
> driver to improve consistency and functionality. The changes ensure that
> link ID 15 is correctly used for scan operations across both ML and non-ML
> interfaces. Additionally, the patches prevent scan failures by fetching
> link_conf only when the link ID is valid and setting appropriate default
> values for scan vdevs.
> 
> [...]

Applied, thanks!

[1/2] wifi: ath12k: handle scan link during vdev create
      commit: 8dc8340c197854bdd7aaa4a1b0f1a75646667596
[2/2] wifi: ath12k: Use scan link ID 15 for all scan operations
      commit: 88c3aaf46ce8878a8314b791b99b8d621f7badeb

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>


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

end of thread, other threads:[~2025-05-16 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-17  5:49 [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Aditya Kumar Singh
2025-04-17  5:49 ` [PATCH ath-next v3 1/2] wifi: ath12k: handle scan link during vdev create Aditya Kumar Singh
2025-04-17  5:49 ` [PATCH ath-next v3 2/2] wifi: ath12k: Use scan link ID 15 for all scan operations Aditya Kumar Singh
2025-05-16 17:40 ` [PATCH ath-next v3 0/2] wifi: ath12k: handle scan vdev consistently Jeff Johnson

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

all inboxes | Powered by JetHome®