diff mbox series

[1/2] wifi: ath12k: Refactor Rx descriptor CMEM configuration

Message ID 20240516000807.1704913-2-quic_periyasa@quicinc.com
State New
Headers show
Series wifi: ath12k: Refactor Rx descriptor buffer CMEM | expand

Commit Message

Karthikeyan Periyasamy May 16, 2024, 12:08 a.m. UTC
Currently, data path Rx descriptor placed in the CMEM memory respective
to the Rx offset. This Rx descriptor CMEM placement is not meeting the
requirements to support inter device MLO. In inter device MLO, multiple
devices participate in a group. The device specific Rx descriptor buffers
transmit to multiple device REO rings. To distinguish between device
specific Rx descriptor buffers, the CMEM setup configuration need to
choose a different placement based on the unique identifier (device index).

Below are the CMEM configuration placement representation:

Intra-Device MLO scenario:

        Device 0                                Device 1

     +-------------+                         +-------------+
     |             |                         |             |
     |     Tx      |                         |     Tx      |
     |             |                         |             |
     +-------------+                         +-------------+
     |             |                         |             |
     |     Rx      |                         |     Rx      |
     |             |                         |             |
     +-------------+                         +-------------+

Inter-Device MLO scenario:

        Device 0                                Device 1

     +-------------+                         +-------------+
     |             |                         |             |
     |     Tx      |                         |     Tx      |
     |             |                         |             |
     +-------------+                         +-------------+
     |             |                         |             |
     |     Rx      |                         |   Reserved  |
     |  Device 0   |                         |             |
     |             |                         |             |
     +-------------+                         +-------------+
     |             |                         |     Rx      |
     |   Reserved  |                         |   Device 1  |
     |             |                         |             |
     +-------------+                         +-------------+

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 HW2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/dp.c | 11 ++++++++---
 drivers/net/wireless/ath/ath12k/dp.h |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Jeff Johnson May 16, 2024, 1:06 p.m. UTC | #1
On 5/15/2024 5:08 PM, Karthikeyan Periyasamy wrote:
> Currently, data path Rx descriptor placed in the CMEM memory respective
> to the Rx offset. This Rx descriptor CMEM placement is not meeting the
> requirements to support inter device MLO. In inter device MLO, multiple
> devices participate in a group. The device specific Rx descriptor buffers
> transmit to multiple device REO rings. To distinguish between device
> specific Rx descriptor buffers, the CMEM setup configuration need to
> choose a different placement based on the unique identifier (device index).
> 
> Below are the CMEM configuration placement representation:
> 
> Intra-Device MLO scenario:
> 
>         Device 0                                Device 1
> 
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Tx      |                         |     Tx      |
>      |             |                         |             |
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Rx      |                         |     Rx      |
>      |             |                         |             |
>      +-------------+                         +-------------+
> 
> Inter-Device MLO scenario:
> 
>         Device 0                                Device 1
> 
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Tx      |                         |     Tx      |
>      |             |                         |             |
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Rx      |                         |   Reserved  |
>      |  Device 0   |                         |             |
>      |             |                         |             |
>      +-------------+                         +-------------+
>      |             |                         |     Rx      |
>      |   Reserved  |                         |   Device 1  |
>      |             |                         |             |
>      +-------------+                         +-------------+
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> Tested-on: WCN7850 HW2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> 
> Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Kalle Valo May 25, 2024, 8:54 a.m. UTC | #2
Karthikeyan Periyasamy <quic_periyasa@quicinc.com> wrote:

> Currently, data path Rx descriptor placed in the CMEM memory respective
> to the Rx offset. This Rx descriptor CMEM placement is not meeting the
> requirements to support inter device MLO. In inter device MLO, multiple
> devices participate in a group. The device specific Rx descriptor buffers
> transmit to multiple device REO rings. To distinguish between device
> specific Rx descriptor buffers, the CMEM setup configuration need to
> choose a different placement based on the unique identifier (device index).
> 
> Below are the CMEM configuration placement representation:
> 
> Intra-Device MLO scenario:
> 
>         Device 0                                Device 1
> 
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Tx      |                         |     Tx      |
>      |             |                         |             |
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Rx      |                         |     Rx      |
>      |             |                         |             |
>      +-------------+                         +-------------+
> 
> Inter-Device MLO scenario:
> 
>         Device 0                                Device 1
> 
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Tx      |                         |     Tx      |
>      |             |                         |             |
>      +-------------+                         +-------------+
>      |             |                         |             |
>      |     Rx      |                         |   Reserved  |
>      |  Device 0   |                         |             |
>      |             |                         |             |
>      +-------------+                         +-------------+
>      |             |                         |     Rx      |
>      |   Reserved  |                         |   Device 1  |
>      |             |                         |             |
>      +-------------+                         +-------------+
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> Tested-on: WCN7850 HW2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> 
> Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

2 patches applied to ath-next branch of ath.git, thanks.

4f82a8d5c277 wifi: ath12k: refactor rx descriptor CMEM configuration
35864b62fa12 wifi: ath12k: improve the rx descriptor error information
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c
index 412ab08e6cca..db388eeb901c 100644
--- a/drivers/net/wireless/ath/ath12k/dp.c
+++ b/drivers/net/wireless/ath/ath12k/dp.c
@@ -1341,13 +1341,14 @@  static inline void *ath12k_dp_cc_get_desc_addr_ptr(struct ath12k_base *ab,
 struct ath12k_rx_desc_info *ath12k_dp_get_rx_desc(struct ath12k_base *ab,
 						  u32 cookie)
 {
+	struct ath12k_dp *dp = &ab->dp;
 	struct ath12k_rx_desc_info **desc_addr_ptr;
 	u16 start_ppt_idx, end_ppt_idx, ppt_idx, spt_idx;
 
 	ppt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_PPT);
 	spt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_SPT);
 
-	start_ppt_idx = ATH12K_RX_SPT_PAGE_OFFSET;
+	start_ppt_idx = dp->rx_ppt_base + ATH12K_RX_SPT_PAGE_OFFSET;
 	end_ppt_idx = start_ppt_idx + ATH12K_NUM_RX_SPT_PAGES;
 
 	if (ppt_idx < start_ppt_idx ||
@@ -1355,6 +1356,7 @@  struct ath12k_rx_desc_info *ath12k_dp_get_rx_desc(struct ath12k_base *ab,
 	    spt_idx > ATH12K_MAX_SPT_ENTRIES)
 		return NULL;
 
+	ppt_idx = ppt_idx - dp->rx_ppt_base;
 	desc_addr_ptr = ath12k_dp_cc_get_desc_addr_ptr(ab, ppt_idx, spt_idx);
 
 	return *desc_addr_ptr;
@@ -1389,7 +1391,7 @@  static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
 	struct ath12k_rx_desc_info *rx_descs, **rx_desc_addr;
 	struct ath12k_tx_desc_info *tx_descs, **tx_desc_addr;
 	u32 i, j, pool_id, tx_spt_page;
-	u32 ppt_idx;
+	u32 ppt_idx, cookie_ppt_idx;
 
 	spin_lock_bh(&dp->rx_desc_lock);
 
@@ -1404,10 +1406,11 @@  static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
 		}
 
 		ppt_idx = ATH12K_RX_SPT_PAGE_OFFSET + i;
+		cookie_ppt_idx = dp->rx_ppt_base + ppt_idx;
 		dp->spt_info->rxbaddr[i] = &rx_descs[0];
 
 		for (j = 0; j < ATH12K_MAX_SPT_ENTRIES; j++) {
-			rx_descs[j].cookie = ath12k_dp_cc_cookie_gen(ppt_idx, j);
+			rx_descs[j].cookie = ath12k_dp_cc_cookie_gen(cookie_ppt_idx, j);
 			rx_descs[j].magic = ATH12K_DP_RX_DESC_MAGIC;
 			list_add_tail(&rx_descs[j].list, &dp->rx_desc_free_list);
 
@@ -1468,6 +1471,7 @@  static int ath12k_dp_cmem_init(struct ath12k_base *ab,
 		end = start + ATH12K_NUM_TX_SPT_PAGES;
 		break;
 	case ATH12K_DP_RX_DESC:
+		cmem_base += ATH12K_PPT_ADDR_OFFSET(dp->rx_ppt_base);
 		start = ATH12K_RX_SPT_PAGE_OFFSET;
 		end = start + ATH12K_NUM_RX_SPT_PAGES;
 		break;
@@ -1510,6 +1514,7 @@  static int ath12k_dp_cc_init(struct ath12k_base *ab)
 		return -ENOMEM;
 	}
 
+	dp->rx_ppt_base = ab->device_id * ATH12K_NUM_RX_SPT_PAGES;
 	for (i = 0; i < dp->num_spt_pages; i++) {
 		dp->spt_info[i].vaddr = dma_alloc_coherent(ab->dev,
 							   ATH12K_PAGE_SIZE,
diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h
index 43589c3dd4bc..742094545089 100644
--- a/drivers/net/wireless/ath/ath12k/dp.h
+++ b/drivers/net/wireless/ath/ath12k/dp.h
@@ -350,6 +350,7 @@  struct ath12k_dp {
 	struct ath12k_hp_update_timer tx_ring_timer[DP_TCL_NUM_RING_MAX];
 	struct ath12k_spt_info *spt_info;
 	u32 num_spt_pages;
+	u32 rx_ppt_base;
 	struct list_head rx_desc_free_list;
 	/* protects the free desc list */
 	spinlock_t rx_desc_lock;