Skip to content

Commit 81999e1

Browse files
committed
mac80211: Add 256MB memory profile for ath11k
1 parent aeaa099 commit 81999e1

File tree

4 files changed

+402
-2
lines changed

4 files changed

+402
-2
lines changed

package/kernel/mac80211/ath.mk

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PKG_CONFIG_DEPENDS += \
1212
CONFIG_ATH9K_TX99 \
1313
CONFIG_ATH10K_LEDS \
1414
CONFIG_ATH10K_THERMAL \
15+
CONFIG_ATH11K_MEM_PROFILE_256M \
16+
CONFIG_ATH11K_MEM_PROFILE_512M \
17+
CONFIG_ATH11K_MEM_PROFILE_1G \
1518
CONFIG_ATH11K_THERMAL \
1619
CONFIG_ATH11K_NSS_SUPPORT \
1720
CONFIG_ATH_USER_REGD
@@ -55,8 +58,9 @@ config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
5558
config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR
5659
config-$(CONFIG_ATH10K_LEDS) += ATH10K_LEDS
5760
config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL
58-
# Undefine this mean larger memory
59-
config-$(CONFIG_TARGET_ipq50xx) += ATH11K_MEM_PROFILE_512M
61+
config-$(CONFIG_ATH11K_MEM_PROFILE_256M) += ATH11K_MEM_PROFILE_256M
62+
config-$(CONFIG_ATH11K_MEM_PROFILE_512M) += ATH11K_MEM_PROFILE_512M
63+
config-$(CONFIG_ATH11K_MEM_PROFILE_1G) += ATH11K_MEM_PROFILE_1G
6064
config-$(CONFIG_ATH11K_THERMAL) += ATH11K_THERMAL
6165
config-$(CONFIG_ATH11K_NSS_SUPPORT) += ATH11K_NSS_SUPPORT
6266

@@ -322,6 +326,23 @@ endef
322326
define KernelPackage/ath11k/config
323327
if PACKAGE_kmod-ath11k
324328

329+
choice
330+
prompt "Memory profile"
331+
default ATH11K_MEM_PROFILE_256M if DEFAULT_ATH11K_MEM_PROFILE_256M
332+
default ATH11K_MEM_PROFILE_512M if DEFAULT_ATH11K_MEM_PROFILE_512M
333+
default ATH11K_MEM_PROFILE_1G
334+
335+
config ATH11K_MEM_PROFILE_256M
336+
bool "256MB"
337+
338+
config ATH11K_MEM_PROFILE_512M
339+
bool "512MB"
340+
341+
config ATH11K_MEM_PROFILE_1G
342+
bool "1GB"
343+
344+
endchoice
345+
325346
config ATH11K_THERMAL
326347
bool "Enable thermal sensors and throttling support"
327348

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
From f48a2f23499f4485786eb9dd6b2fc0c18bf23675 Mon Sep 17 00:00:00 2001
2+
From: hzy <hzyitc@outlook.com>
3+
Date: Fri, 20 Jan 2023 10:55:55 +0000
4+
Subject: [PATCH 1/2] ath11k: Prepare for more memory profiles
5+
6+
Signed-off-by: hzy <hzyitc@outlook.com>
7+
---
8+
drivers/net/wireless/ath/ath11k/Kconfig | 16 +++++++++++-----
9+
drivers/net/wireless/ath/ath11k/debugfs.c | 2 +-
10+
drivers/net/wireless/ath/ath11k/dp_rx.c | 4 ++--
11+
drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +-
12+
drivers/net/wireless/ath/ath11k/hw.c | 22 +++++++++++-----------
13+
drivers/net/wireless/ath/ath11k/hw.h | 7 +++----
14+
drivers/net/wireless/ath/ath11k/qmi.h | 2 +-
15+
drivers/net/wireless/ath/ath11k/rx_desc.h | 4 ++--
16+
local-symbols | 1 +
17+
9 files changed, 33 insertions(+), 27 deletions(-)
18+
19+
diff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig
20+
index 02de524..9ccdd95 100644
21+
--- a/drivers/net/wireless/ath/ath11k/Kconfig
22+
+++ b/drivers/net/wireless/ath/ath11k/Kconfig
23+
@@ -85,12 +85,18 @@ config ATH11K_PKTLOG
24+
log uses ring buffer to dump the data. The buffer size,
25+
frame filters can be alterted by debugfs entries.
26+
27+
-config ATH11K_MEM_PROFILE_512M
28+
- bool "ath11k enable 512MB memory profile"
29+
+choice
30+
+ prompt "QCA ath11k memory profile"
31+
depends on ATH11K
32+
- default n
33+
- ---help---
34+
- Enables 512MB memory profile for ath11k
35+
+ default ATH11K_MEM_PROFILE_1G
36+
+
37+
+config ATH11K_MEM_PROFILE_512M
38+
+ bool "512MB"
39+
+
40+
+config ATH11K_MEM_PROFILE_1G
41+
+ bool "1GB"
42+
+
43+
+endchoice
44+
45+
config ATH11K_CFR
46+
bool "QCA ath11k CFR support"
47+
diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
48+
index aceca2a..be7ae95 100644
49+
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
50+
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
51+
@@ -3060,7 +3060,7 @@ static ssize_t ath11k_dump_mgmt_stats(struct file *file, char __user *ubuf,
52+
size_t count, loff_t *ppos)
53+
{
54+
struct ath11k *ar = file->private_data;
55+
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
56+
+#ifdef CPTCFG_ATH11K_MEM_PROFILE_1G
57+
struct ath11k_base *ab = ar->ab;
58+
#endif
59+
struct ath11k_vif *arvif = NULL;
60+
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
61+
index fa86e0a..cfaad2f 100644
62+
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
63+
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
64+
@@ -330,7 +330,7 @@ static inline u8* ath11k_dp_rxdesc_get_mpdu_start_addr2(struct ath11k_base *ab,
65+
return ab->hw_params.hw_ops->rx_desc_mpdu_start_addr2(desc);
66+
}
67+
68+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
69+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
70+
static void ath11k_dp_get_rx_header_offset(struct ath11k_base *ab,
71+
struct htt_rx_ring_tlv_filter *tlv_filter)
72+
{
73+
@@ -5459,7 +5459,7 @@ void ath11k_dp_rx_pdev_free(struct ath11k_base *ab, int mac_id)
74+
ath11k_dp_rxdma_pdev_buf_free(ar);
75+
}
76+
77+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
78+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
79+
static int ath11k_dp_rxdma_ring_sel_config(struct ath11k *ar)
80+
{
81+
struct ath11k_pdev_dp *dp = &ar->dp;
82+
diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c
83+
index 4bfe48f..e043e7e 100644
84+
--- a/drivers/net/wireless/ath/ath11k/dp_tx.c
85+
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
86+
@@ -247,7 +247,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
87+
* If all rings are full, we drop the packet.
88+
* //TODO Add throttling logic when all rings are full
89+
*/
90+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
91+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
92+
if (unlikely(atomic_read(&ab->num_max_allowed) > DP_TX_COMP_MAX_ALLOWED)) {
93+
atomic_inc(&ab->soc_stats.tx_err.max_fail);
94+
return -ENOSPC;
95+
diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/ath/ath11k/hw.c
96+
index f6ae6e3..1f26238 100644
97+
--- a/drivers/net/wireless/ath/ath11k/hw.c
98+
+++ b/drivers/net/wireless/ath/ath11k/hw.c
99+
@@ -207,7 +207,7 @@ static u8 ath11k_hw_ipq8074_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc)
100+
101+
static u8 *ath11k_hw_ipq8074_rx_desc_get_hdr_status(struct hal_rx_desc *desc)
102+
{
103+
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
104+
+#ifdef CPTCFG_ATH11K_MEM_PROFILE_1G
105+
return desc->u.ipq8074.hdr_status;
106+
#else
107+
return NULL;
108+
@@ -407,7 +407,7 @@ u32 ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len(struct hal_rx_mpdu_info *mpdu_inf
109+
__le32_to_cpu(mpdu_info->u.ipq8074.info2));
110+
}
111+
112+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
113+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
114+
static void ath11k_hw_ipq8074_rx_desc_get_offset(struct htt_rx_ring_tlv_filter *tlv_filter)
115+
{
116+
tlv_filter->rx_mpdu_end_offset = __le16_to_cpu(offsetof
117+
@@ -544,7 +544,7 @@ static u8 ath11k_hw_qcn9074_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc)
118+
119+
static u8 *ath11k_hw_qcn9074_rx_desc_get_hdr_status(struct hal_rx_desc *desc)
120+
{
121+
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
122+
+#ifdef CPTCFG_ATH11K_MEM_PROFILE_1G
123+
return desc->u.qcn9074.hdr_status;
124+
#else
125+
return NULL;
126+
@@ -755,7 +755,7 @@ u32 ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len(struct hal_rx_mpdu_info *mpdu_inf
127+
__le32_to_cpu(mpdu_info->u.qcn9074.info2));
128+
}
129+
130+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
131+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
132+
static void ath11k_hw_qcn9074_rx_desc_get_offset(struct htt_rx_ring_tlv_filter *tlv_filter)
133+
{
134+
tlv_filter->rx_mpdu_end_offset = __le16_to_cpu(offsetof
135+
@@ -1069,7 +1069,7 @@ const struct ath11k_hw_ops ipq8074_ops = {
136+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default,
137+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid,
138+
.rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len,
139+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
140+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
141+
.rx_desc_get_offset = ath11k_hw_ipq8074_rx_desc_get_offset,
142+
#endif
143+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_ipq8074_rx_desc_get_mpdu_frame_ctl,
144+
@@ -1121,7 +1121,7 @@ const struct ath11k_hw_ops ipq6018_ops = {
145+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default,
146+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid,
147+
.rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len,
148+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
149+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
150+
.rx_desc_get_offset = ath11k_hw_ipq8074_rx_desc_get_offset,
151+
#endif
152+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_ipq8074_rx_desc_get_mpdu_frame_ctl,
153+
@@ -1169,7 +1169,7 @@ const struct ath11k_hw_ops qca6390_ops = {
154+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default,
155+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid,
156+
.rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len,
157+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
158+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
159+
.rx_desc_get_offset = ath11k_hw_ipq8074_rx_desc_get_offset,
160+
#endif
161+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_ipq8074_rx_desc_get_mpdu_frame_ctl,
162+
@@ -1225,7 +1225,7 @@ const struct ath11k_hw_ops qcn9074_ops = {
163+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default,
164+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_peerid,
165+
.rx_desc_get_hal_mpdu_len = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len,
166+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
167+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
168+
.rx_desc_get_offset = ath11k_hw_qcn9074_rx_desc_get_offset,
169+
#endif
170+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_qcn9074_rx_desc_get_mpdu_frame_ctl,
171+
@@ -1278,7 +1278,7 @@ const struct ath11k_hw_ops ipq5018_ops = {
172+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_peerid,
173+
.rx_desc_get_hal_mpdu_len = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len,
174+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_5018,
175+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
176+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
177+
.rx_desc_get_offset = ath11k_hw_qcn9074_rx_desc_get_offset,
178+
#endif
179+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_qcn9074_rx_desc_get_mpdu_frame_ctl,
180+
@@ -1330,7 +1330,7 @@ const struct ath11k_hw_ops qcn6122_ops = {
181+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_peerid,
182+
.rx_desc_get_hal_mpdu_len = ath11k_hw_qcn9074_rx_desc_get_hal_mpdu_len,
183+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_5018,
184+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
185+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
186+
.rx_desc_get_offset = ath11k_hw_qcn9074_rx_desc_get_offset,
187+
#endif
188+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_qcn9074_rx_desc_get_mpdu_frame_ctl,
189+
@@ -1382,7 +1382,7 @@ const struct ath11k_hw_ops ipq9574_ops = {
190+
.get_reo_dest_remap_config = ath11k_get_reo_dest_remap_config_default,
191+
.rx_desc_get_hal_mpdu_peerid = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_peerid,
192+
.rx_desc_get_hal_mpdu_len = ath11k_hw_ipq8074_rx_desc_get_hal_mpdu_len,
193+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
194+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
195+
.rx_desc_get_offset = ath11k_hw_ipq8074_rx_desc_get_offset,
196+
#endif
197+
.rx_desc_get_mpdu_frame_ctl = ath11k_hw_ipq8074_rx_desc_get_mpdu_frame_ctl,
198+
diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h
199+
index bd2680d..efde50a 100644
200+
--- a/drivers/net/wireless/ath/ath11k/hw.h
201+
+++ b/drivers/net/wireless/ath/ath11k/hw.h
202+
@@ -12,8 +12,7 @@ struct ath11k_csi_cfr_header;
203+
struct ath11k_cfr_peer_tx_param;
204+
205+
/* Target configuration defines */
206+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
207+
-
208+
+#if defined(CPTCFG_ATH11K_MEM_PROFILE_512M)
209+
#define TARGET_NUM_VDEVS 8
210+
#define TARGET_NUM_PEERS_PDEV (128 + TARGET_NUM_VDEVS)
211+
/* Max num of stations (per radio) */
212+
@@ -28,7 +27,7 @@ struct ath11k_cfr_peer_tx_param;
213+
* 18byte mesh hdr + 8byte snap + 1500 eth payload
214+
*/
215+
#define ATH11K_DP_RXDMA_NSS_REFILL_RING_SIZE 1816
216+
-#else
217+
+#else // CPTCFG_ATH11K_MEM_PROFILE_1G
218+
/* Num VDEVS per radio */
219+
#define TARGET_NUM_VDEVS (ab->hw_params.num_vdevs_peers[ab->qmi.target_mem_mode].num_vdevs)
220+
#define TARGET_NUM_PEERS_PDEV (ab->hw_params.num_vdevs_peers[ab->qmi.target_mem_mode].num_peers + TARGET_NUM_VDEVS)
221+
@@ -264,7 +263,7 @@ struct ath11k_hw_ops {
222+
u32 (*get_reo_dest_remap_config)(void);
223+
u16 (*rx_desc_get_hal_mpdu_peerid) (struct hal_rx_mpdu_info *mpdu_info);
224+
u32 (*rx_desc_get_hal_mpdu_len) (struct hal_rx_mpdu_info *mpdu_info);
225+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
226+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
227+
void (*rx_desc_get_offset)(struct htt_rx_ring_tlv_filter *tlv_filter);
228+
#endif
229+
u16 (*rx_desc_get_mpdu_frame_ctl)(struct hal_rx_desc *desc);
230+
diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/ath/ath11k/qmi.h
231+
index 522516b..73cf421 100644
232+
--- a/drivers/net/wireless/ath/ath11k/qmi.h
233+
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
234+
@@ -34,7 +34,7 @@
235+
#define ATH11K_QMI_MAX_QDSS_CONFIG_FILE_NAME_SIZE 64
236+
#define ATH11K_QMI_DEFAULT_QDSS_CONFIG_FILE_NAME "qdss_trace_config.bin"
237+
238+
-#ifdef CPTCFG_ATH11K_MEM_PROFILE_512M
239+
+#ifndef CPTCFG_ATH11K_MEM_PROFILE_1G
240+
#define ATH11K_QMI_IPQ8074_M3_DUMP_ADDRESS 0x4E800000
241+
#define ATH11K_QMI_IPQ6018_M3_DUMP_ADDRESS 0x4E300000
242+
#else
243+
diff --git a/drivers/net/wireless/ath/ath11k/rx_desc.h b/drivers/net/wireless/ath/ath11k/rx_desc.h
244+
index dc46b47..838ccde 100644
245+
--- a/drivers/net/wireless/ath/ath11k/rx_desc.h
246+
+++ b/drivers/net/wireless/ath/ath11k/rx_desc.h
247+
@@ -1375,7 +1375,7 @@ struct hal_rx_desc_ipq8074 {
248+
__le32 mpdu_end_tag;
249+
struct rx_mpdu_end mpdu_end;
250+
u8 rx_padding1[HAL_RX_DESC_PADDING1_BYTES];
251+
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
252+
+#ifdef CPTCFG_ATH11K_MEM_PROFILE_1G
253+
__le32 hdr_status_tag;
254+
__le32 phy_ppdu_id;
255+
u8 hdr_status[HAL_RX_DESC_HDR_STATUS_LEN];
256+
@@ -1396,7 +1396,7 @@ struct hal_rx_desc_qcn9074 {
257+
__le32 mpdu_end_tag;
258+
struct rx_mpdu_end mpdu_end;
259+
u8 rx_padding1[HAL_RX_DESC_PADDING1_BYTES];
260+
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
261+
+#ifdef CPTCFG_ATH11K_MEM_PROFILE_1G
262+
__le32 hdr_status_tag;
263+
__le32 phy_ppdu_id;
264+
u8 hdr_status[HAL_RX_DESC_HDR_STATUS_LEN];
265+
diff --git a/local-symbols b/local-symbols
266+
index e50bab1..6264a7e 100644
267+
--- a/local-symbols
268+
+++ b/local-symbols
269+
@@ -144,6 +144,7 @@ ATH11K_AHB=
270+
ATH11K_PCI=
271+
ATH11K_NSS_SUPPORT=
272+
ATH11K_MEM_PROFILE_512M=
273+
+ATH11K_MEM_PROFILE_1G=
274+
ATH11K_DEBUG=
275+
ATH11K_DEBUGFS=
276+
ATH11K_TRACING=
277+
--
278+
2.25.1
279+

0 commit comments

Comments
 (0)