Skip to content

Commit 3158237

Browse files
Baochen QiangKalle Valo
authored andcommitted
ath11k: Change number of TCL rings to one for QCA6390
Some targets, QCA6390 for example, use only one TCL ring, it is better to initialize only one ring and leave others untouched for such targets. This is a theoretical fix found during code review, no visible impact. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Baochen Qiang <[email protected]> Signed-off-by: Jouni Malinen <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 96527d5 commit 3158237

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
lines changed

drivers/net/wireless/ath/ath11k/core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
5858
.rx_mac_buf_ring = false,
5959
.vdev_start_delay = false,
6060
.htt_peer_map_v2 = true,
61-
.tcl_0_only = false,
6261

6362
.spectral = {
6463
.fft_sz = 2,
@@ -81,6 +80,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
8180
.supports_suspend = false,
8281
.hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074),
8382
.fix_l1ss = true,
83+
.max_tx_ring = DP_TCL_NUM_RING_MAX,
8484
},
8585
{
8686
.hw_rev = ATH11K_HW_IPQ6018_HW10,
@@ -109,7 +109,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
109109
.rx_mac_buf_ring = false,
110110
.vdev_start_delay = false,
111111
.htt_peer_map_v2 = true,
112-
.tcl_0_only = false,
113112

114113
.spectral = {
115114
.fft_sz = 4,
@@ -129,6 +128,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
129128
.supports_suspend = false,
130129
.hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074),
131130
.fix_l1ss = true,
131+
.max_tx_ring = DP_TCL_NUM_RING_MAX,
132132
},
133133
{
134134
.name = "qca6390 hw2.0",
@@ -157,7 +157,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
157157
.rx_mac_buf_ring = true,
158158
.vdev_start_delay = true,
159159
.htt_peer_map_v2 = false,
160-
.tcl_0_only = true,
161160

162161
.spectral = {
163162
.fft_sz = 0,
@@ -176,6 +175,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
176175
.supports_suspend = true,
177176
.hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074),
178177
.fix_l1ss = true,
178+
.max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390,
179179
},
180180
{
181181
.name = "qcn9074 hw1.0",
@@ -203,7 +203,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
203203
.rx_mac_buf_ring = false,
204204
.vdev_start_delay = false,
205205
.htt_peer_map_v2 = true,
206-
.tcl_0_only = false,
207206

208207
.spectral = {
209208
.fft_sz = 2,
@@ -223,6 +222,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
223222
.supports_suspend = false,
224223
.hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
225224
.fix_l1ss = true,
225+
.max_tx_ring = DP_TCL_NUM_RING_MAX,
226226
},
227227
{
228228
.name = "wcn6855 hw2.0",
@@ -251,7 +251,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
251251
.rx_mac_buf_ring = true,
252252
.vdev_start_delay = true,
253253
.htt_peer_map_v2 = false,
254-
.tcl_0_only = true,
255254

256255
.spectral = {
257256
.fft_sz = 0,
@@ -270,6 +269,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
270269
.supports_suspend = true,
271270
.hal_desc_sz = sizeof(struct hal_rx_desc_wcn6855),
272271
.fix_l1ss = false,
272+
.max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390,
273273
},
274274
};
275275

drivers/net/wireless/ath/ath11k/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ static ssize_t ath11k_debugfs_dump_soc_dp_stats(struct file *file,
806806
len += scnprintf(buf + len, size - len, "\nSOC TX STATS:\n");
807807
len += scnprintf(buf + len, size - len, "\nTCL Ring Full Failures:\n");
808808

809-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++)
809+
for (i = 0; i < ab->hw_params.max_tx_ring; i++)
810810
len += scnprintf(buf + len, size - len, "ring%d: %u\n",
811811
i, soc_stats->tx_err.desc_na[i]);
812812

drivers/net/wireless/ath/ath11k/dp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void ath11k_dp_stop_shadow_timers(struct ath11k_base *ab)
311311
if (!ab->hw_params.supports_shadow_regs)
312312
return;
313313

314-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++)
314+
for (i = 0; i < ab->hw_params.max_tx_ring; i++)
315315
ath11k_dp_shadow_stop_timer(ab, &ab->dp.tx_ring_timer[i]);
316316

317317
ath11k_dp_shadow_stop_timer(ab, &ab->dp.reo_cmd_timer);
@@ -326,7 +326,7 @@ static void ath11k_dp_srng_common_cleanup(struct ath11k_base *ab)
326326
ath11k_dp_srng_cleanup(ab, &dp->wbm_desc_rel_ring);
327327
ath11k_dp_srng_cleanup(ab, &dp->tcl_cmd_ring);
328328
ath11k_dp_srng_cleanup(ab, &dp->tcl_status_ring);
329-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++) {
329+
for (i = 0; i < ab->hw_params.max_tx_ring; i++) {
330330
ath11k_dp_srng_cleanup(ab, &dp->tx_ring[i].tcl_data_ring);
331331
ath11k_dp_srng_cleanup(ab, &dp->tx_ring[i].tcl_comp_ring);
332332
}
@@ -366,7 +366,7 @@ static int ath11k_dp_srng_common_setup(struct ath11k_base *ab)
366366
goto err;
367367
}
368368

369-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++) {
369+
for (i = 0; i < ab->hw_params.max_tx_ring; i++) {
370370
ret = ath11k_dp_srng_setup(ab, &dp->tx_ring[i].tcl_data_ring,
371371
HAL_TCL_DATA, i, 0,
372372
DP_TCL_DATA_RING_SIZE);
@@ -996,7 +996,7 @@ void ath11k_dp_free(struct ath11k_base *ab)
996996

997997
ath11k_dp_reo_cmd_list_cleanup(ab);
998998

999-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++) {
999+
for (i = 0; i < ab->hw_params.max_tx_ring; i++) {
10001000
spin_lock_bh(&dp->tx_ring[i].tx_idr_lock);
10011001
idr_for_each(&dp->tx_ring[i].txbuf_idr,
10021002
ath11k_dp_tx_pending_cleanup, ab);
@@ -1046,7 +1046,7 @@ int ath11k_dp_alloc(struct ath11k_base *ab)
10461046

10471047
size = sizeof(struct hal_wbm_release_ring) * DP_TX_COMP_RING_SIZE;
10481048

1049-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++) {
1049+
for (i = 0; i < ab->hw_params.max_tx_ring; i++) {
10501050
idr_init(&dp->tx_ring[i].txbuf_idr);
10511051
spin_lock_init(&dp->tx_ring[i].tx_idr_lock);
10521052
dp->tx_ring[i].tcl_data_ring_id = i;

drivers/net/wireless/ath/ath11k/dp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct ath11k_pdev_dp {
170170
#define DP_BA_WIN_SZ_MAX 256
171171

172172
#define DP_TCL_NUM_RING_MAX 3
173+
#define DP_TCL_NUM_RING_MAX_QCA6390 1
173174

174175
#define DP_IDLE_SCATTER_BUFS_MAX 16
175176

drivers/net/wireless/ath/ath11k/dp_tx.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
115115

116116
tcl_ring_sel:
117117
tcl_ring_retry = false;
118-
/* For some chip, it can only use tcl0 to tx */
119-
if (ar->ab->hw_params.tcl_0_only)
120-
ti.ring_id = 0;
121-
else
122-
ti.ring_id = ring_selector % DP_TCL_NUM_RING_MAX;
118+
119+
ti.ring_id = ring_selector % ab->hw_params.max_tx_ring;
123120

124121
ring_map |= BIT(ti.ring_id);
125122

@@ -131,7 +128,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
131128
spin_unlock_bh(&tx_ring->tx_idr_lock);
132129

133130
if (ret < 0) {
134-
if (ring_map == (BIT(DP_TCL_NUM_RING_MAX) - 1)) {
131+
if (ring_map == (BIT(ab->hw_params.max_tx_ring) - 1)) {
135132
atomic_inc(&ab->soc_stats.tx_err.misc_fail);
136133
return -ENOSPC;
137134
}
@@ -248,8 +245,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
248245
* checking this ring earlier for each pkt tx.
249246
* Restart ring selection if some rings are not checked yet.
250247
*/
251-
if (ring_map != (BIT(DP_TCL_NUM_RING_MAX) - 1) &&
252-
!ar->ab->hw_params.tcl_0_only) {
248+
if (ring_map != (BIT(ab->hw_params.max_tx_ring) - 1) &&
249+
ab->hw_params.max_tx_ring > 1) {
253250
tcl_ring_retry = true;
254251
ring_selector++;
255252
}

drivers/net/wireless/ath/ath11k/hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ struct ath11k_hw_params {
152152
bool rx_mac_buf_ring;
153153
bool vdev_start_delay;
154154
bool htt_peer_map_v2;
155-
bool tcl_0_only;
156155

157156
struct {
158157
u8 fft_sz;
@@ -170,6 +169,7 @@ struct ath11k_hw_params {
170169
bool supports_suspend;
171170
u32 hal_desc_sz;
172171
bool fix_l1ss;
172+
u8 max_tx_ring;
173173
};
174174

175175
struct ath11k_hw_ops {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5797,7 +5797,7 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw,
57975797
idr_for_each(&ar->txmgmt_idr,
57985798
ath11k_mac_vif_txmgmt_idr_remove, vif);
57995799

5800-
for (i = 0; i < DP_TCL_NUM_RING_MAX; i++) {
5800+
for (i = 0; i < ab->hw_params.max_tx_ring; i++) {
58015801
spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock);
58025802
idr_for_each(&ab->dp.tx_ring[i].txbuf_idr,
58035803
ath11k_mac_vif_unref, vif);

0 commit comments

Comments
 (0)