From e23acaf21ed683a9c30845b2f4638029b835a2f8 Mon Sep 17 00:00:00 2001 From: Manjunathappa Prakash Date: Fri, 10 Nov 2017 00:17:24 -0800 Subject: [PATCH] qcacmn: Setup RXDMA to software Ring for WMAC1 Setup RxDMA to software ring of both MACs, required for DBS MCC case. Change-Id: I1a094c1fafe39a2a41e8867c82c1236c4b9b6593 CRs-Fixed: 2135851 --- dp/wifi3.0/dp_internal.h | 3 ++ dp/wifi3.0/dp_main.c | 105 +++++++++++++++++++++++++++++++++------ dp/wifi3.0/dp_rx_err.c | 5 +- dp/wifi3.0/dp_types.h | 2 +- wlan_cfg/wlan_cfg.c | 8 +++ wlan_cfg/wlan_cfg.h | 10 ++++ 6 files changed, 115 insertions(+), 18 deletions(-) diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index ea3866daa1..be69f1d7ea 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/dp/wifi3.0/dp_internal.h @@ -309,6 +309,9 @@ void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle, struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, uint32_t *rx_pn); +void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id); +int dp_get_ring_id_for_mac_id(struct dp_soc *soc, uint32_t mac_id); + #if defined(CONFIG_WIN) && WDI_EVENT_ENABLE QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev, uint32_t stats_type_upload_mask); diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 685a03b04a..02bdfaff1f 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -687,6 +687,12 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget) remaining_quota = budget; } } + for (ring = 0; ring < MAX_RX_MAC_RINGS; ring++) { + /* Need to check on this, why is required */ + work_done = dp_rxdma_err_process(soc, ring, + remaining_quota); + budget -= work_done; + } } if (reo_status_mask) @@ -1843,6 +1849,21 @@ static int dp_soc_cmn_setup(struct dp_soc *soc) soc->num_reo_dest_rings = 0; } + /* LMAC RxDMA to SW Rings configuration */ + if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { + /* Only valid for MCL */ + struct dp_pdev *pdev = soc->pdev_list[0]; + + for (i = 0; i < MAX_RX_MAC_RINGS; i++) { + if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring[i], + RXDMA_DST, 0, i, RXDMA_ERR_DST_RING_SIZE)) { + QDF_TRACE(QDF_MODULE_ID_DP, + QDF_TRACE_LEVEL_ERROR, + FL("dp_srng_setup failed for rxdma_err_dst_ring")); + goto fail1; + } + } + } /* TBD: call dp_rx_init to setup Rx SW descriptors */ /* REO reinjection ring */ @@ -2191,11 +2212,13 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, goto fail1; } - if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring, RXDMA_DST, 0, - pdev_id, RXDMA_ERR_DST_RING_SIZE)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - FL("dp_srng_setup failed for rxdma_mon_dst_ring")); - goto fail1; + if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { + if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring[0], RXDMA_DST, + 0, pdev_id, RXDMA_ERR_DST_RING_SIZE)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + FL("dp_srng_setup failed for rxdma_err_dst_ring")); + goto fail1; + } } /* Setup second Rx refill buffer ring */ @@ -2357,7 +2380,15 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force) dp_srng_cleanup(soc, &pdev->rxdma_mon_desc_ring, RXDMA_MONITOR_DESC, 0); - dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring, RXDMA_DST, 0); + if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { + dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring[0], RXDMA_DST, 0); + } else { + int i; + + for (i = 0; i < MAX_RX_MAC_RINGS; i++) + dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring[i], + RXDMA_DST, 0); + } soc->pdev_list[pdev->pdev_id] = NULL; soc->pdev_count--; @@ -2553,6 +2584,10 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) pdev->rx_mac_buf_ring[j] .hal_srng, RXDMA_BUF); + htt_srng_setup(soc->htt_handle, mac_id, + pdev->rxdma_err_dst_ring[j] + .hal_srng, + RXDMA_DST); mac_id++; } @@ -2572,10 +2607,6 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) htt_srng_setup(soc->htt_handle, i, pdev->rxdma_mon_desc_ring.hal_srng, RXDMA_MONITOR_DESC); - - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_err_dst_ring.hal_srng, - RXDMA_DST); } } } @@ -2588,6 +2619,8 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) struct dp_pdev *pdev = soc->pdev_list[i]; if (pdev) { + int ring_idx = dp_get_ring_id_for_mac_id(soc, i); + htt_srng_setup(soc->htt_handle, i, pdev->rx_refill_buf_ring.hal_srng, RXDMA_BUF); @@ -2604,8 +2637,8 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) pdev->rxdma_mon_desc_ring.hal_srng, RXDMA_MONITOR_DESC); htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_err_dst_ring.hal_srng, - RXDMA_DST); + pdev->rxdma_err_dst_ring[ring_idx].hal_srng, + RXDMA_DST); } } } @@ -4134,9 +4167,14 @@ dp_print_ring_stats(struct dp_pdev *pdev) dp_print_ring_stat_from_hal(pdev->soc, &pdev->rxdma_mon_desc_ring, "Rxdma mon desc Ring"); - dp_print_ring_stat_from_hal(pdev->soc, - &pdev->rxdma_err_dst_ring, - "Rxdma err dst ring"); + + for (i = 0; i < MAX_RX_MAC_RINGS; i++) { + snprintf(ring_name, STR_MAXLEN, "Rxdma err dst ring %d", i); + dp_print_ring_stat_from_hal(pdev->soc, + &pdev->rxdma_err_dst_ring[i], + ring_name); + } + for (i = 0; i < MAX_RX_MAC_RINGS; i++) { snprintf(ring_name, STR_MAXLEN, "Rx mac buf ring %d", i); dp_print_ring_stat_from_hal(pdev->soc, @@ -5653,6 +5691,43 @@ fail0: return NULL; } +/* + * dp_get_pdev_for_mac_id() - Return pdev for mac_id + * + * @soc: handle to DP soc + * @mac_id: MAC id + * + * Return: Return pdev corresponding to MAC + */ +void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id) +{ + if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) + return soc->pdev_list[mac_id]; + + /* Typically for MCL as there only 1 PDEV*/ + return soc->pdev_list[0]; +} + +/* + * dp_get_ring_id_for_mac_id() - Return pdev for mac_id + * + * @soc: handle to DP soc + * @mac_id: MAC id + * + * Return: ring id + */ +int dp_get_ring_id_for_mac_id(struct dp_soc *soc, uint32_t mac_id) +{ + /* + * Single pdev using both MACs will operate on both MAC rings, + * which is the case for MCL. + */ + if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) + return mac_id; + + /* For WIN each PDEV will operate one ring, so index is zero. */ + return 0; +} #if defined(CONFIG_WIN) && WDI_EVENT_ENABLE /* * dp_set_pktlog_wifi3() - attach txrx vdev diff --git a/dp/wifi3.0/dp_rx_err.c b/dp/wifi3.0/dp_rx_err.c index 5bbbccc6ef..be637afda7 100644 --- a/dp/wifi3.0/dp_rx_err.c +++ b/dp/wifi3.0/dp_rx_err.c @@ -1235,7 +1235,8 @@ dp_rx_err_mpdu_pop(struct dp_soc *soc, uint32_t mac_id, uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) { - struct dp_pdev *pdev = soc->pdev_list[mac_id]; + struct dp_pdev *pdev = dp_get_pdev_for_mac_id(soc, mac_id); + int ring_idx = dp_get_ring_id_for_mac_id(soc, mac_id); uint8_t pdev_id; void *hal_soc; void *rxdma_dst_ring_desc; @@ -1252,7 +1253,7 @@ dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) return 0; #endif pdev_id = pdev->pdev_id; - err_dst_srng = pdev->rxdma_err_dst_ring.hal_srng; + err_dst_srng = pdev->rxdma_err_dst_ring[ring_idx].hal_srng; if (!err_dst_srng) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 99646a5ae4..098830de80 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -921,7 +921,7 @@ struct dp_pdev { struct dp_srng rxdma_mon_desc_ring; /* RXDMA error destination ring */ - struct dp_srng rxdma_err_dst_ring; + struct dp_srng rxdma_err_dst_ring[MAX_RX_MAC_RINGS]; /* Link descriptor memory banks */ struct { diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index ae124c27a8..66e050a181 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -34,6 +34,7 @@ #ifdef CONFIG_MCL #define WLAN_CFG_PER_PDEV_RX_RING 0 +#define WLAN_CFG_PER_PDEV_LMAC_RING 0 #define NUM_RXDMA_RINGS_PER_PDEV 2 #define WLAN_LRO_ENABLE 1 #ifdef IPA_OFFLOAD @@ -61,6 +62,7 @@ #ifdef CONFIG_WIN #define WLAN_CFG_PER_PDEV_RX_RING 0 +#define WLAN_CFG_PER_PDEV_LMAC_RING 1 #define NUM_RXDMA_RINGS_PER_PDEV 1 #define WLAN_LRO_ENABLE 0 @@ -302,6 +304,7 @@ struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach() wlan_cfg_ctx->per_pdev_tx_ring = WLAN_CFG_PER_PDEV_TX_RING; wlan_cfg_ctx->num_tcl_data_rings = WLAN_CFG_NUM_TCL_DATA_RINGS; wlan_cfg_ctx->per_pdev_rx_ring = WLAN_CFG_PER_PDEV_RX_RING; + wlan_cfg_ctx->per_pdev_lmac_ring = WLAN_CFG_PER_PDEV_LMAC_RING; wlan_cfg_ctx->num_reo_dest_rings = WLAN_CFG_NUM_REO_DEST_RING; wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS; wlan_cfg_ctx->num_tx_ext_desc_pool = WLAN_CFG_NUM_TXEXT_DESC_POOL; @@ -536,6 +539,11 @@ int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) return cfg->per_pdev_tx_ring; } +int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->per_pdev_lmac_ring; +} + int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) { return cfg->num_tcl_data_rings; diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index 01bb228c87..607af19c39 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -105,6 +105,7 @@ struct wlan_cfg_dp_soc_ctxt { int per_pdev_tx_ring; int num_tcl_data_rings; int per_pdev_rx_ring; + int per_pdev_lmac_ring; int num_reo_dest_rings; int num_tx_desc_pool; int num_tx_ext_desc_pool; @@ -410,6 +411,15 @@ int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); */ int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); +/* + * wlan_cfg_per_pdev_lmac_ring() - Return true if error rings are mapped as + * one per radio + * @wlan_cfg_ctx + * + * Return: return 1 if per pdev error ring else 0 + */ +int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); + /* * wlan_cfg_num_reo_dest_rings() - Number of REO Data rings supported by device * @wlan_cfg_ctx - Configuration Handle