From nobody Sat Feb 7 18:20:49 2026 Received: from mail-oa1-f65.google.com (mail-oa1-f65.google.com [209.85.160.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBE1F2D0602 for ; Sun, 28 Dec 2025 15:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766934859; cv=none; b=dXLHjU+yQ42vz1YdmXKR8EECD14FKNJbvSCP7QtyeGsNT29JmGzaWCvclxA+s6g3UY/h8zXt/fRmH3Bi2yLdb+DQ8FJtSmGJN8SNUailkg+ZGPNUs0vmYLHcFUoTY+KXKdXU9eM8bEq2r8fxr5L1+YLmefuMfs5ipnvjxdoLH0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766934859; c=relaxed/simple; bh=DPU/DvzNMItb5Qrx46MSTvFyvT5TKOJuCPMS5zGTXWU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HyKNH/UbgBHpUzMyL6jT2O7i1GrNW1Ivm2Xofh+Hm+GnhR7kHsVOZXoAwEzAr6kGZkb7WKTtV6ncQzb5Uc6lWjArEIA751VUyVKsvVTfXDasSTEhZEYLWLLMaEWwVsrZB94Pc9PebOYXrKdWrbelIVhJixC8g6Xt/Srnd0Y1pMw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XGlMSQMy; arc=none smtp.client-ip=209.85.160.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XGlMSQMy" Received: by mail-oa1-f65.google.com with SMTP id 586e51a60fabf-3e3dac349easo9037309fac.2 for ; Sun, 28 Dec 2025 07:14:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766934856; x=1767539656; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6DhkrKrnhAYglYBvdgmFTu35O+fBVWrb0itD+SYPa6M=; b=XGlMSQMy89JkUx/ZckyO4+0BR1J+bX9l39FPZ7rf/fJJ0D/T+PwOBs7fbmoUXGxiqK M25aICzfDCmnnq1N9akDwzezf9ja+daKWJVeWeYuKqHR5cS4VN0DoGgMGynajjQaLZcU ExVhK5SBeLBzddeAKomoHGtj6pAidmxAIsSHQRCKThdKxo1X3GaT6LUB8OPlD2PtuLZV TnpMd5QdHErA4tzuWQ9NYK2hiHygYsSILC0Y6rhii4Y0LXnkyhaWS4ki7Q+i+wd5NEqW g2T0aCOVkDdWSPcHGIuFBx5DS90gcyUGXM1i3/TUcQeU4bru2bnwFelW8+F6bbeZCe94 /s+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766934856; x=1767539656; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6DhkrKrnhAYglYBvdgmFTu35O+fBVWrb0itD+SYPa6M=; b=w11n+qbONkESe4t024XxmRWpd43XR1lb74jvstyx9VzYfAqW06XBwnmN5iTC7rz/Uy LNx5Hu7XFwqp8OTixAitQtGSJ/Do2MAS6qKZTYmwtvKSEObGUG5+oEuWeYJ0PargV2Y6 PC6T3qI/5wbYEkZ4wLWYpz7t28Lf32JAY5Qn7FnZ7e2h4aBNY+uuqD2TjlupTdi6In8c uRoGeLBApjwo2SZv5QvuXO2NrDsc5CpqeAfq9C/YrsJBP7x2kk50YesxAP6FXlcvLJhe hFMMMKikeqvz5Z4JVI1EPuGMGuCwh3Axmzt3bJVH4StTtEC5OhYamngz6JLWvZx0XYqY l5Tw== X-Forwarded-Encrypted: i=1; AJvYcCUgDSDbGx+Ae177CkZQ9kfN2SrYe4hyrbcGABHNmMbdANkmOOhGmrZPOPTjlRBUBQrYklHjpIM8d1PjD8A=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7iGeLNv0Y8icjeNvW4m2ZDT38yOCEK66EF2DYwa4IawmBh9Wy wofHzDP/toSyuh4cou9Jxy1SxHvatU+OJeeGJV65Ury/M4SPV/oekbZO X-Gm-Gg: AY/fxX5I14N1DGJGynAK0HJvHhFg0tzCS7QsFPS+7auAFYMtGmDSISx2UmNZwtVFqgc KW4E9t1nVg7zLVFUES7e8jM1v3qSl0zpIUBYc5lTaZDcYoTeeXopidlpDDYycSX9jKXJZ2zUM6k sQ0R/Surbdu6+bwGGvHfWKCBwyw3RVZ3UH5cuP4ZIg4GbueP687sN7NRbXhYWnnDOAXizD73EUi LUmFXrbGjuv5Atk7UZ2pLicYKNGH0WuxBRDn4x3z1oTozC0ec3K67X9wOCWGJ+HyBkSiAZ+D+OP 4PEPsqOA3K0zNB4C+p4S4g/bryVxtax7RgOd4IuRf23P5teJA+oMq7LcknvGUdw8EdsXhktiKBr S3gAFBFKCRlvn7qthIqX4grEsweqaHIaznR/2CnyfBKkXpTah3Kh0JCiNzfeNO8h4yTdbnIiPOK C0AFxZVhLfZNrL+0aUwMm6zE1I097e0OG6QTLMap73aQKz6D3ktGJMlJhWhmuKG3wYGIMOR0X85 lqodfeT7aWUo4S5mfCjBT67ez62 X-Google-Smtp-Source: AGHT+IECc+U3TVNXp3czTIzSO9Z76x2G0HYELfxJXcOGQhylpsHroDwr7oZCfOdlfaVh0fuMa8pTKA== X-Received: by 2002:a05:6871:546:b0:3c9:415b:a282 with SMTP id 586e51a60fabf-3fda55f32fbmr13567686fac.1.1766934856314; Sun, 28 Dec 2025 07:14:16 -0800 (PST) Received: from nukework.lan (c-98-57-15-22.hsd1.tx.comcast.net. [98.57.15.22]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3fdaabbadacsm17461426fac.15.2025.12.28.07.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 07:14:14 -0800 (PST) From: Alexandru Gagniuc To: jjohnson@kernel.org, ath11k@lists.infradead.org Cc: baochen.qiang@oss.qualcomm.com, Alexandru Gagniuc , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] wifi: ath11k: move .max_tx_ring to struct ath11k_hw_hal_params Date: Sun, 28 Dec 2025 09:14:05 -0600 Message-ID: <20251228151408.2116108-1-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ".max_tx_ring" is an upper bounds to indexing ".tcl2wbm_rbm_map". It is initialized in, core.c, a different file than the array. This spaghetti-like relation is fragile and not obvious. Accidentally setting ".max_tx_ring" too high leads to a hard to track out-of- bounds access and memory corruption. There is a small ambiguity on the meaning of "max_tx_ring": - The highest ring, max=3D3 implies there are 4 rings (0, 1, 2, 3) - The highest number to use for array indexing (there are 3 rings) Clarify this dependency by moving ".max_tx_ring" adjacent to the array ".tcl2wbm_rbm_map", and name it "num_tx_rings". Use ARRAY_SIZE() instead of #defines to initialize the length field. The ath11k_hw_hal_params_qca6390 uses fewer num_tx_rings than its map, so use a constant to express the correct value. Add a static_assert() to fail compilation if the constant is accidentally set too high. The intent is to make the code easier to understand rather than fix an existing bug. Signed-off-by: Alexandru Gagniuc Reviewed-by: Baochen Qiang Reviewed-by: Vasanthakumar Thiagarajan --- I am trying to make ath11k work on IPQ9574. My device uses a IPQ9570 with a QCN5024 as the 2.4 GHz wifi. I spent a few days tracking a memory corruption bug caused by erroneously setting ".max_tx_ring" too high. I think I would not have made this mistake if the initializations of .max_tx_ring and .tcl2wbm_rbm_map were right next to each other. Changes since v2: - Use ipq5018 rbm_map for ath11k_hw_hal_params_qca6390 - Drop unecessarry static_assert Changes since v1: - use "num_tx_rings" name instead of "map_len" - make sure debugfs.c is correctly updated - add a static_assert for ath11k_hw_hal_params_qca6390 special case --- drivers/net/wireless/ath/ath11k/core.c | 12 +----------- drivers/net/wireless/ath/ath11k/debugfs.c | 2 +- drivers/net/wireless/ath/ath11k/dp.c | 12 ++++++------ drivers/net/wireless/ath/ath11k/dp.h | 1 - drivers/net/wireless/ath/ath11k/dp_tx.c | 9 +++++---- drivers/net/wireless/ath/ath11k/hw.c | 19 ++++++++++++++++++- drivers/net/wireless/ath/ath11k/hw.h | 3 ++- drivers/net/wireless/ath/ath11k/mac.c | 2 +- 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index 812686173ac8a..07199ceecbeb4 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -100,7 +100,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D false, .fix_l1ss =3D true, .credit_flow =3D false, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D true, @@ -184,7 +183,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D false, .fix_l1ss =3D true, .credit_flow =3D false, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D true, @@ -271,7 +269,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D false, .fix_l1ss =3D true, .credit_flow =3D true, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, @@ -358,7 +355,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D false, .fix_l1ss =3D true, .credit_flow =3D false, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz =3D true, .alloc_cacheable_memory =3D true, @@ -445,7 +441,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D true, .fix_l1ss =3D false, .credit_flow =3D true, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, @@ -533,7 +528,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D true, .fix_l1ss =3D false, .credit_flow =3D true, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, @@ -619,7 +613,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D true, .fix_l1ss =3D false, .credit_flow =3D true, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX, .hal_params =3D &ath11k_hw_hal_params_wcn6750, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, @@ -662,7 +655,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .qmi_service_ins_id =3D ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ8074, .ring_mask =3D &ath11k_hw_ring_mask_ipq8074, .credit_flow =3D false, - .max_tx_ring =3D 1, .spectral =3D { .fft_sz =3D 2, .fft_pad_sz =3D 0, @@ -698,7 +690,7 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D false, .idle_ps =3D false, .supports_suspend =3D false, - .hal_params =3D &ath11k_hw_hal_params_ipq8074, + .hal_params =3D &ath11k_hw_hal_params_ipq5018, .single_pdev_only =3D false, .coldboot_cal_mm =3D true, .coldboot_cal_ftm =3D true, @@ -789,7 +781,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D true, .fix_l1ss =3D false, .credit_flow =3D true, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, @@ -876,7 +867,6 @@ static const struct ath11k_hw_params ath11k_hw_params[]= =3D { .supports_regdb =3D true, .fix_l1ss =3D false, .credit_flow =3D true, - .max_tx_ring =3D DP_TCL_NUM_RING_MAX_QCA6390, .hal_params =3D &ath11k_hw_hal_params_qca6390, .supports_dynamic_smps_6ghz =3D false, .alloc_cacheable_memory =3D false, diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wirele= ss/ath/ath11k/debugfs.c index 977f945b6e669..50f344803e8fd 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c @@ -707,7 +707,7 @@ static ssize_t ath11k_debugfs_dump_soc_dp_stats(struct = file *file, len +=3D scnprintf(buf + len, size - len, "\nSOC TX STATS:\n"); len +=3D scnprintf(buf + len, size - len, "\nTCL Ring Full Failures:\n"); =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) len +=3D scnprintf(buf + len, size - len, "ring%d: %u\n", i, soc_stats->tx_err.desc_na[i]); =20 diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/at= h/ath11k/dp.c index 56b1a657e0b0f..c940de285276d 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -344,7 +344,7 @@ void ath11k_dp_stop_shadow_timers(struct ath11k_base *a= b) if (!ab->hw_params.supports_shadow_regs) return; =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) ath11k_dp_shadow_stop_timer(ab, &ab->dp.tx_ring_timer[i]); =20 ath11k_dp_shadow_stop_timer(ab, &ab->dp.reo_cmd_timer); @@ -359,7 +359,7 @@ static void ath11k_dp_srng_common_cleanup(struct ath11k= _base *ab) ath11k_dp_srng_cleanup(ab, &dp->wbm_desc_rel_ring); ath11k_dp_srng_cleanup(ab, &dp->tcl_cmd_ring); ath11k_dp_srng_cleanup(ab, &dp->tcl_status_ring); - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) { + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { ath11k_dp_srng_cleanup(ab, &dp->tx_ring[i].tcl_data_ring); ath11k_dp_srng_cleanup(ab, &dp->tx_ring[i].tcl_comp_ring); } @@ -400,7 +400,7 @@ static int ath11k_dp_srng_common_setup(struct ath11k_ba= se *ab) goto err; } =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) { + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { tcl_num =3D ab->hw_params.hal_params->tcl2wbm_rbm_map[i].tcl_ring_num; wbm_num =3D ab->hw_params.hal_params->tcl2wbm_rbm_map[i].wbm_ring_num; =20 @@ -782,7 +782,7 @@ int ath11k_dp_service_srng(struct ath11k_base *ab, int i, j; int tot_work_done =3D 0; =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) { + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { if (BIT(ab->hw_params.hal_params->tcl2wbm_rbm_map[i].wbm_ring_num) & ab->hw_params.ring_mask->tx[grp_id]) ath11k_dp_tx_completion_handler(ab, i); @@ -1035,7 +1035,7 @@ void ath11k_dp_free(struct ath11k_base *ab) =20 ath11k_dp_reo_cmd_list_cleanup(ab); =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) { + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { spin_lock_bh(&dp->tx_ring[i].tx_idr_lock); idr_for_each(&dp->tx_ring[i].txbuf_idr, ath11k_dp_tx_pending_cleanup, ab); @@ -1086,7 +1086,7 @@ int ath11k_dp_alloc(struct ath11k_base *ab) =20 size =3D sizeof(struct hal_wbm_release_ring) * DP_TX_COMP_RING_SIZE; =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) { + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { idr_init(&dp->tx_ring[i].txbuf_idr); spin_lock_init(&dp->tx_ring[i].tx_idr_lock); dp->tx_ring[i].tcl_data_ring_id =3D i; diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/at= h/ath11k/dp.h index 7a55afd33be82..1bd513f68a3c3 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -199,7 +199,6 @@ struct ath11k_pdev_dp { #define DP_BA_WIN_SZ_MAX 256 =20 #define DP_TCL_NUM_RING_MAX 3 -#define DP_TCL_NUM_RING_MAX_QCA6390 1 =20 #define DP_IDLE_SCATTER_BUFS_MAX 16 =20 diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 562aba66582f3..86e1e6c27b36c 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -91,6 +91,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *ar= vif, struct hal_srng *tcl_ring; struct ieee80211_hdr *hdr =3D (void *)skb->data; struct dp_tx_ring *tx_ring; + size_t num_tx_rings =3D ab->hw_params.hal_params->num_tx_rings; void *hal_tcl_desc; u8 pool_id; u8 hal_ring_id; @@ -113,7 +114,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, tcl_ring_sel: tcl_ring_retry =3D false; =20 - ti.ring_id =3D ring_selector % ab->hw_params.max_tx_ring; + ti.ring_id =3D ring_selector % num_tx_rings; ti.rbm_id =3D ab->hw_params.hal_params->tcl2wbm_rbm_map[ti.ring_id].rbm_i= d; =20 ring_map |=3D BIT(ti.ring_id); @@ -126,7 +127,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, spin_unlock_bh(&tx_ring->tx_idr_lock); =20 if (unlikely(ret < 0)) { - if (ring_map =3D=3D (BIT(ab->hw_params.max_tx_ring) - 1) || + if (ring_map =3D=3D (BIT(num_tx_rings) - 1) || !ab->hw_params.tcl_ring_retry) { atomic_inc(&ab->soc_stats.tx_err.misc_fail); return -ENOSPC; @@ -244,8 +245,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, * checking this ring earlier for each pkt tx. * Restart ring selection if some rings are not checked yet. */ - if (unlikely(ring_map !=3D (BIT(ab->hw_params.max_tx_ring)) - 1) && - ab->hw_params.tcl_ring_retry && ab->hw_params.max_tx_ring > 1) { + if (unlikely(ring_map !=3D (BIT(num_tx_rings)) - 1) && + ab->hw_params.tcl_ring_retry && num_tx_rings > 1) { tcl_ring_retry =3D true; ring_selector++; } diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/at= h/ath11k/hw.c index caa6dc12a790b..d19c4b372a2aa 100644 --- a/drivers/net/wireless/ath/ath11k/hw.c +++ b/drivers/net/wireless/ath/ath11k/hw.c @@ -2707,6 +2707,14 @@ const struct ath11k_hw_regs wcn6750_regs =3D { .hal_reo1_misc_ctl =3D 0x000005d8, }; =20 +static const struct ath11k_hw_tcl2wbm_rbm_map ath11k_hw_tcl2wbm_rbm_map_ip= q5018[] =3D { + { + .tcl_ring_num =3D 0, + .wbm_ring_num =3D 0, + .rbm_id =3D HAL_RX_BUF_RBM_SW0_BM, + }, +}; + static const struct ath11k_hw_tcl2wbm_rbm_map ath11k_hw_tcl2wbm_rbm_map_ip= q8074[] =3D { { .tcl_ring_num =3D 0, @@ -2822,19 +2830,28 @@ const struct ath11k_hw_regs ipq5018_regs =3D { .hal_wbm1_release_ring_base_lsb =3D 0x0000097c, }; =20 +const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq5018 =3D { + .rx_buf_rbm =3D HAL_RX_BUF_RBM_SW3_BM, + .tcl2wbm_rbm_map =3D ath11k_hw_tcl2wbm_rbm_map_ipq5018, + .num_tx_rings =3D ARRAY_SIZE(ath11k_hw_tcl2wbm_rbm_map_ipq5018), +}; + const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074 =3D { .rx_buf_rbm =3D HAL_RX_BUF_RBM_SW3_BM, .tcl2wbm_rbm_map =3D ath11k_hw_tcl2wbm_rbm_map_ipq8074, + .num_tx_rings =3D ARRAY_SIZE(ath11k_hw_tcl2wbm_rbm_map_ipq8074), }; =20 const struct ath11k_hw_hal_params ath11k_hw_hal_params_qca6390 =3D { .rx_buf_rbm =3D HAL_RX_BUF_RBM_SW1_BM, - .tcl2wbm_rbm_map =3D ath11k_hw_tcl2wbm_rbm_map_ipq8074, + .tcl2wbm_rbm_map =3D ath11k_hw_tcl2wbm_rbm_map_ipq5018, + .num_tx_rings =3D ARRAY_SIZE(ath11k_hw_tcl2wbm_rbm_map_ipq5018), }; =20 const struct ath11k_hw_hal_params ath11k_hw_hal_params_wcn6750 =3D { .rx_buf_rbm =3D HAL_RX_BUF_RBM_SW1_BM, .tcl2wbm_rbm_map =3D ath11k_hw_tcl2wbm_rbm_map_wcn6750, + .num_tx_rings =3D ARRAY_SIZE(ath11k_hw_tcl2wbm_rbm_map_wcn6750), }; =20 static const struct cfg80211_sar_freq_ranges ath11k_hw_sar_freq_ranges_wcn= 6855[] =3D { diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/at= h/ath11k/hw.h index 52d9f4c13b136..9db984ac4321c 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -134,6 +134,7 @@ struct ath11k_hw_tcl2wbm_rbm_map { struct ath11k_hw_hal_params { enum hal_rx_buf_return_buf_manager rx_buf_rbm; const struct ath11k_hw_tcl2wbm_rbm_map *tcl2wbm_rbm_map; + size_t num_tx_rings; }; =20 struct ath11k_hw_params { @@ -198,7 +199,6 @@ struct ath11k_hw_params { bool supports_regdb; bool fix_l1ss; bool credit_flow; - u8 max_tx_ring; const struct ath11k_hw_hal_params *hal_params; bool supports_dynamic_smps_6ghz; bool alloc_cacheable_memory; @@ -291,6 +291,7 @@ extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq501= 8; =20 extern const struct ce_remap ath11k_ce_remap_ipq5018; =20 +extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq5018; extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074; extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_qca6390; extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_wcn6750; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 3276fe443502f..33ebe03380114 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -7392,7 +7392,7 @@ static void ath11k_mac_op_remove_interface(struct iee= e80211_hw *hw, idr_for_each(&ar->txmgmt_idr, ath11k_mac_vif_txmgmt_idr_remove, vif); =20 - for (i =3D 0; i < ab->hw_params.max_tx_ring; i++) { + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock); idr_for_each(&ab->dp.tx_ring[i].txbuf_idr, ath11k_mac_vif_unref, vif); --=20 2.45.1