Skip to content

Commit 41b6231

Browse files
Rameshkumar Sundaramgregkh
authored andcommitted
wifi: ath12k: enforce vdev limit in ath12k_mac_vdev_create()
[ Upstream commit 448bf7b ] Currently, vdev limit check is performed only in ath12k_mac_assign_vif_to_vdev(). If the host has already created maximum number of vdevs for the radio (ar) and a scan request arrives for the same radio, ath12k_mac_initiate_hw_scan() attempts to create a vdev without checking the limit, causing firmware asserts. Centralize the vdev limit guard by moving the check into ath12k_mac_vdev_create() so that all callers obey the limit. While doing this, update the condition from `num_created_vdevs > (TARGET_NUM_VDEVS(ab) - 1)` to `num_created_vdevs >= TARGET_NUM_VDEVS(ab)` for clarity and to eliminate unnecessary arithmetic. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Fixes: 0d6e673 ("wifi: ath12k: scan statemachine changes for single wiphy") Fixes: 4938ba7 ("wifi: ath12k: modify remain on channel for single wiphy") Signed-off-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Link: https://patch.msgid.link/20251026182254.1399650-2-rameshkumar.sundaram@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4f93750 commit 41b6231

File tree

1 file changed

+6
-6
lines changed
  • drivers/net/wireless/ath/ath12k

1 file changed

+6
-6
lines changed

drivers/net/wireless/ath/ath12k/mac.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9687,6 +9687,12 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
96879687
if (vif->type == NL80211_IFTYPE_MONITOR && ar->monitor_vdev_created)
96889688
return -EINVAL;
96899689

9690+
if (ar->num_created_vdevs >= TARGET_NUM_VDEVS(ab)) {
9691+
ath12k_warn(ab, "failed to create vdev, reached max vdev limit %d\n",
9692+
TARGET_NUM_VDEVS(ab));
9693+
return -ENOSPC;
9694+
}
9695+
96909696
link_id = arvif->link_id;
96919697

96929698
if (link_id < IEEE80211_MLD_MAX_NUM_LINKS) {
@@ -10046,12 +10052,6 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,
1004610052
if (arvif->is_created)
1004710053
goto flush;
1004810054

10049-
if (ar->num_created_vdevs > (TARGET_NUM_VDEVS(ab) - 1)) {
10050-
ath12k_warn(ab, "failed to create vdev, reached max vdev limit %d\n",
10051-
TARGET_NUM_VDEVS(ab));
10052-
goto unlock;
10053-
}
10054-
1005510055
ret = ath12k_mac_vdev_create(ar, arvif);
1005610056
if (ret) {
1005710057
ath12k_warn(ab, "failed to create vdev %pM ret %d", vif->addr, ret);

0 commit comments

Comments
 (0)