From d9ce350f01be851479b78e7db597a0fbb79a0613 Mon Sep 17 00:00:00 2001 From: Manjunathappa Prakash Date: Mon, 5 Feb 2018 14:09:17 -0800 Subject: [PATCH] qcacmn: Initialize and reap both 2.4GHz and 5GHz MACs Initialize MAC1 along with MAC0. 2.4GHz monitor mode operates on MAC1 so initialize MAC1 and reap both MAC0 and MAC1. Change-Id: Id281def37d460b224f5f571893266f193846fd0c CRs-Fixed: 2176848 --- dp/wifi3.0/dp_internal.h | 46 +++- dp/wifi3.0/dp_main.c | 396 +++++++++++++++++++--------------- dp/wifi3.0/dp_rx.c | 2 +- dp/wifi3.0/dp_rx_err.c | 10 +- dp/wifi3.0/dp_rx_mon.h | 6 +- dp/wifi3.0/dp_rx_mon_dest.c | 119 +++++----- dp/wifi3.0/dp_rx_mon_status.c | 36 ++-- dp/wifi3.0/dp_types.h | 10 +- dp/wifi3.0/dp_wdi_event.c | 4 +- wlan_cfg/wlan_cfg.c | 2 - wlan_cfg/wlan_cfg.h | 2 + 11 files changed, 372 insertions(+), 261 deletions(-) diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index 127f1ee7197b..27fe5b715757 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/dp/wifi3.0/dp_internal.h @@ -394,7 +394,6 @@ void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle, 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); void dp_mark_peer_inact(void *peer_handle, bool inactive); bool dp_set_inact_params(struct cdp_pdev *pdev_handle, u_int16_t inact_check_interval, @@ -405,6 +404,51 @@ bool dp_peer_is_inact(void *peer_handle); void dp_init_inact_timer(struct dp_soc *soc); void dp_free_inact_timer(struct dp_soc *soc); +/* + * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac + * + * @mac_id: MAC id + * @pdev_id: pdev_id corresponding to pdev, 0 for MCL + * + * Single pdev using both MACs will operate on both MAC rings, + * which is the case for MCL. + * For WIN each PDEV will operate one ring, so index is zero. + * + */ +static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id) +{ + if (mac_id && pdev_id) { + qdf_print("Both mac_id and pdev_id cannot be non zero"); + QDF_BUG(0); + return 0; + } + return (mac_id + pdev_id); +} + +/* + * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids + * + * @soc: handle to DP soc + * @mac_id: MAC id + * + * Single pdev using both MACs will operate on both MAC rings, + * which is the case for MCL. + * For WIN each PDEV will operate one ring, so index is zero. + * + */ +static inline int dp_get_mac_id_for_mac(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; +} + #ifdef 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 917475d8fa61..7973a59e329a 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -729,6 +729,7 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget) uint8_t reo_status_mask = int_ctx->reo_status_ring_mask; uint32_t remaining_quota = dp_budget; struct dp_pdev *pdev = NULL; + int mac_id; /* Process Tx completion interrupts first to return back buffers */ while (tx_mask) { @@ -804,7 +805,6 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_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; @@ -819,12 +819,18 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget) pdev = soc->pdev_list[ring]; if (pdev == NULL) continue; - if (int_ctx->rx_mon_ring_mask & (1 << ring)) { - work_done = dp_mon_process(soc, ring, remaining_quota); - budget -= work_done; - if (budget <= 0) - goto budget_done; - remaining_quota = budget; + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + + if (int_ctx->rx_mon_ring_mask & (1 << mac_for_pdev)) { + work_done = dp_mon_process(soc, mac_for_pdev, + remaining_quota); + budget -= work_done; + if (budget <= 0) + goto budget_done; + remaining_quota = budget; + } } if (int_ctx->rxdma2host_ring_mask & (1 << ring)) { @@ -2430,6 +2436,7 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, struct dp_soc *soc = (struct dp_soc *)txrx_soc; struct dp_pdev *pdev = qdf_mem_malloc(sizeof(*pdev)); + int mac_id; if (!pdev) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, @@ -2525,34 +2532,41 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, goto fail1; } - if (dp_srng_setup(soc, &pdev->rxdma_mon_buf_ring, RXDMA_MONITOR_BUF, 0, - pdev_id, RXDMA_MONITOR_BUF_RING_SIZE)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - FL("dp_srng_setup failed for rxdma_mon_buf_ring")); - goto fail1; - } + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); - if (dp_srng_setup(soc, &pdev->rxdma_mon_dst_ring, RXDMA_MONITOR_DST, 0, - pdev_id, RXDMA_MONITOR_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 (dp_srng_setup(soc, &pdev->rxdma_mon_buf_ring[mac_id], + RXDMA_MONITOR_BUF, 0, mac_for_pdev, + RXDMA_MONITOR_BUF_RING_SIZE)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + FL("dp_srng_setup failed for rxdma_mon_buf_ring")); + goto fail1; + } + + if (dp_srng_setup(soc, &pdev->rxdma_mon_dst_ring[mac_id], + RXDMA_MONITOR_DST, 0, mac_for_pdev, + RXDMA_MONITOR_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 (dp_srng_setup(soc, &pdev->rxdma_mon_status_ring, - RXDMA_MONITOR_STATUS, 0, pdev_id, - RXDMA_MONITOR_STATUS_RING_SIZE)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - FL("dp_srng_setup failed for rxdma_mon_status_ring")); - goto fail1; - } + if (dp_srng_setup(soc, &pdev->rxdma_mon_status_ring[mac_id], + RXDMA_MONITOR_STATUS, 0, mac_for_pdev, + RXDMA_MONITOR_STATUS_RING_SIZE)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + FL("dp_srng_setup failed for rxdma_mon_status_ring")); + goto fail1; + } - if (dp_srng_setup(soc, &pdev->rxdma_mon_desc_ring, - RXDMA_MONITOR_DESC, 0, pdev_id, RXDMA_MONITOR_DESC_RING_SIZE)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - "dp_srng_setup failed for rxdma_mon_desc_ring\n"); - goto fail1; + if (dp_srng_setup(soc, &pdev->rxdma_mon_desc_ring[mac_id], + RXDMA_MONITOR_DESC, 0, mac_for_pdev, + RXDMA_MONITOR_DESC_RING_SIZE)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + "dp_srng_setup failed for rxdma_mon_desc_ring\n"); + goto fail1; + } } if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { @@ -2694,6 +2708,7 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force) struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev; struct dp_soc *soc = pdev->soc; qdf_nbuf_t curr_nbuf, next_nbuf; + int mac_id; dp_wdi_event_detach(pdev); @@ -2729,24 +2744,21 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force) dp_rxdma_ring_cleanup(soc, pdev); - dp_srng_cleanup(soc, &pdev->rxdma_mon_buf_ring, RXDMA_MONITOR_BUF, 0); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + dp_srng_cleanup(soc, &pdev->rxdma_mon_buf_ring[mac_id], + RXDMA_MONITOR_BUF, 0); - dp_srng_cleanup(soc, &pdev->rxdma_mon_dst_ring, RXDMA_MONITOR_DST, 0); + dp_srng_cleanup(soc, &pdev->rxdma_mon_dst_ring[mac_id], + RXDMA_MONITOR_DST, 0); - dp_srng_cleanup(soc, &pdev->rxdma_mon_status_ring, - RXDMA_MONITOR_STATUS, 0); + dp_srng_cleanup(soc, &pdev->rxdma_mon_status_ring[mac_id], + RXDMA_MONITOR_STATUS, 0); - dp_srng_cleanup(soc, &pdev->rxdma_mon_desc_ring, - RXDMA_MONITOR_DESC, 0); + dp_srng_cleanup(soc, &pdev->rxdma_mon_desc_ring[mac_id], + RXDMA_MONITOR_DESC, 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); + dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring[mac_id], + RXDMA_DST, 0); } curr_nbuf = pdev->invalid_peer_head_msdu; @@ -2905,8 +2917,7 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) struct dp_pdev *pdev = soc->pdev_list[i]; if (pdev) { - int mac_id = 0; - int j; + int mac_id; bool dbs_enable = 0; int max_mac_rings = wlan_cfg_get_num_mac_rings @@ -2944,37 +2955,39 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) FL("pdev_id %d max_mac_rings %d\n"), pdev->pdev_id, max_mac_rings); - for (j = 0; j < max_mac_rings; j++) { + for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev( + mac_id, pdev->pdev_id); + QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, - FL("mac_id %d\n"), mac_id); - htt_srng_setup(soc->htt_handle, mac_id, - pdev->rx_mac_buf_ring[j] + FL("mac_id %d\n"), mac_for_pdev); + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rx_mac_buf_ring[mac_id] .hal_srng, RXDMA_BUF); - htt_srng_setup(soc->htt_handle, mac_id, - pdev->rxdma_err_dst_ring[j] + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_err_dst_ring[mac_id] .hal_srng, RXDMA_DST); - mac_id++; + + /* Configure monitor mode rings */ + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_buf_ring[mac_id].hal_srng, + RXDMA_MONITOR_BUF); + + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_dst_ring[mac_id].hal_srng, + RXDMA_MONITOR_DST); + + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS); + + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_desc_ring[mac_id].hal_srng, + RXDMA_MONITOR_DESC); } - - /* Configure monitor mode rings */ - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_buf_ring.hal_srng, - RXDMA_MONITOR_BUF); - - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_dst_ring.hal_srng, - RXDMA_MONITOR_DST); - - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_status_ring.hal_srng, - RXDMA_MONITOR_STATUS); - - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_desc_ring.hal_srng, - RXDMA_MONITOR_DESC); } } @@ -2988,33 +3001,38 @@ static void dp_rxdma_ring_config(struct dp_soc *soc) soc->reap_timer_init = 1; } #else +/* This is only for WIN */ static void dp_rxdma_ring_config(struct dp_soc *soc) { int i; + int mac_id; for (i = 0; i < MAX_PDEV_CNT; i++) { struct dp_pdev *pdev = soc->pdev_list[i]; - if (pdev) { - int ring_idx = dp_get_ring_id_for_mac_id(soc, i); + if (pdev == NULL) + continue; - htt_srng_setup(soc->htt_handle, i, + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, i); + + htt_srng_setup(soc->htt_handle, mac_for_pdev, pdev->rx_refill_buf_ring.hal_srng, RXDMA_BUF); - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_buf_ring.hal_srng, - RXDMA_MONITOR_BUF); - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_dst_ring.hal_srng, - RXDMA_MONITOR_DST); - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_status_ring.hal_srng, + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_buf_ring[mac_id].hal_srng, + RXDMA_MONITOR_BUF); + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_dst_ring[mac_id].hal_srng, + RXDMA_MONITOR_DST); + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, RXDMA_MONITOR_STATUS); - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_mon_desc_ring.hal_srng, + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_desc_ring[mac_id].hal_srng, RXDMA_MONITOR_DESC); - htt_srng_setup(soc->htt_handle, i, - pdev->rxdma_err_dst_ring[ring_idx].hal_srng, + htt_srng_setup(soc->htt_handle, mac_for_pdev, + pdev->rxdma_err_dst_ring[mac_id].hal_srng, RXDMA_DST); } } @@ -4128,8 +4146,9 @@ static int dp_reset_monitor_mode(struct cdp_pdev *pdev_handle) { struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; struct htt_rx_ring_tlv_filter htt_tlv_filter; - struct dp_soc *soc; + struct dp_soc *soc = pdev->soc; uint8_t pdev_id; + int mac_id; pdev_id = pdev->pdev_id; soc = pdev->soc; @@ -4137,13 +4156,17 @@ static int dp_reset_monitor_mode(struct cdp_pdev *pdev_handle) pdev->monitor_vdev = NULL; qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_buf_ring.hal_srng, - RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, &htt_tlv_filter); + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_buf_ring[mac_id].hal_srng, + RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); + } return 0; } @@ -4215,13 +4238,13 @@ static int dp_vdev_set_monitor_mode(struct cdp_vdev *vdev_handle, struct htt_rx_ring_tlv_filter htt_tlv_filter; struct dp_soc *soc; uint8_t pdev_id; + int mac_id; qdf_assert(vdev); pdev = vdev->pdev; pdev_id = pdev->pdev_id; soc = pdev->soc; - QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_WARN, "pdev=%pK, pdev_id=%d, soc=%pK vdev=%pK\n", pdev, pdev_id, soc, vdev); @@ -4271,9 +4294,13 @@ static int dp_vdev_set_monitor_mode(struct cdp_vdev *vdev_handle, htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_buf_ring.hal_srng, - RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); + + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_buf_ring[mac_id].hal_srng, + RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + } htt_tlv_filter.mpdu_start = 1; htt_tlv_filter.msdu_start = 1; @@ -4300,9 +4327,13 @@ static int dp_vdev_set_monitor_mode(struct cdp_vdev *vdev_handle, htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); + + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); + } return QDF_STATUS_SUCCESS; } @@ -4324,6 +4355,7 @@ static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, struct htt_rx_ring_tlv_filter htt_tlv_filter; struct dp_soc *soc; uint8_t pdev_id; + int mac_id; pdev_id = pdev->pdev_id; soc = pdev->soc; @@ -4357,13 +4389,17 @@ static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_buf_ring.hal_srng, - RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, &htt_tlv_filter); + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_buf_ring[mac_id].hal_srng, + RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); + } htt_tlv_filter.mpdu_start = 1; htt_tlv_filter.msdu_start = 1; @@ -4390,9 +4426,13 @@ static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_buf_ring.hal_srng, RXDMA_MONITOR_BUF, - RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); + + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_buf_ring[mac_id].hal_srng, + RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); + } htt_tlv_filter.mpdu_start = 1; htt_tlv_filter.msdu_start = 1; @@ -4419,9 +4459,13 @@ static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; - htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, - pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); + + htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); + } return QDF_STATUS_SUCCESS; } @@ -4987,6 +5031,7 @@ dp_print_ring_stats(struct dp_pdev *pdev) { uint32_t i; char ring_name[STR_MAXLEN + 1]; + int mac_id; dp_print_ring_stat_from_hal(pdev->soc, &pdev->soc->reo_exception_ring, @@ -5038,18 +5083,20 @@ dp_print_ring_stats(struct dp_pdev *pdev) &pdev->rx_refill_buf_ring2, "Second Rx Refill Buf Ring"); - dp_print_ring_stat_from_hal(pdev->soc, - &pdev->rxdma_mon_buf_ring, - "Rxdma Mon Buf Ring"); - dp_print_ring_stat_from_hal(pdev->soc, - &pdev->rxdma_mon_dst_ring, - "Rxdma Mon Dst Ring"); - dp_print_ring_stat_from_hal(pdev->soc, - &pdev->rxdma_mon_status_ring, - "Rxdma Mon Status Ring"); - dp_print_ring_stat_from_hal(pdev->soc, - &pdev->rxdma_mon_desc_ring, - "Rxdma mon desc Ring"); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + dp_print_ring_stat_from_hal(pdev->soc, + &pdev->rxdma_mon_buf_ring[mac_id], + "Rxdma Mon Buf Ring"); + dp_print_ring_stat_from_hal(pdev->soc, + &pdev->rxdma_mon_dst_ring[mac_id], + "Rxdma Mon Dst Ring"); + dp_print_ring_stat_from_hal(pdev->soc, + &pdev->rxdma_mon_status_ring[mac_id], + "Rxdma Mon Status Ring"); + dp_print_ring_stat_from_hal(pdev->soc, + &pdev->rxdma_mon_desc_ring[mac_id], + "Rxdma mon desc Ring"); + } for (i = 0; i < MAX_RX_MAC_RINGS; i++) { snprintf(ring_name, STR_MAXLEN, "Rxdma err dst ring %d", i); @@ -5538,13 +5585,18 @@ static void dp_ppdu_ring_reset(struct dp_pdev *pdev) { struct htt_rx_ring_tlv_filter htt_tlv_filter; + int mac_id; qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); - htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, pdev->pdev_id, - pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); + } } /* @@ -5557,6 +5609,7 @@ static void dp_ppdu_ring_cfg(struct dp_pdev *pdev) { struct htt_rx_ring_tlv_filter htt_tlv_filter = {0}; + int mac_id; htt_tlv_filter.mpdu_start = 0; htt_tlv_filter.msdu_start = 0; @@ -5581,9 +5634,14 @@ dp_ppdu_ring_cfg(struct dp_pdev *pdev) htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; - htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, pdev->pdev_id, - pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, &htt_tlv_filter); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + + htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id].hal_srng, + RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); + } } /* @@ -7005,27 +7063,6 @@ void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id) 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; -} - /* * dp_is_hw_dbs_enable() - Procedure to check if DBS is supported * @soc: DP SoC context @@ -7101,13 +7138,17 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { + int mac_for_pdev = + dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + htt_h2t_rx_ring_cfg(soc->htt_handle, - pdev->pdev_id + mac_id, - pdev->rxdma_mon_status_ring - .hal_srng, - RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, - &htt_tlv_filter); + mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id] + .hal_srng, + RXDMA_MONITOR_STATUS, + RX_BUFFER_SIZE, + &htt_tlv_filter); } @@ -7144,9 +7185,13 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { + int mac_for_pdev = + dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + htt_h2t_rx_ring_cfg(soc->htt_handle, - pdev->pdev_id + mac_id, - pdev->rxdma_mon_status_ring + mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id] .hal_srng, RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE_PKTLOG_LITE, @@ -7168,10 +7213,13 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, } for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev( + mac_id, pdev->pdev_id); + pdev->pktlog_ppdu_stats = true; dp_h2t_cfg_stats_msg_send(pdev, - DP_PPDU_TXLITE_STATS_BITMASK_CFG, - pdev->pdev_id + mac_id); + DP_PPDU_TXLITE_STATS_BITMASK_CFG, + mac_for_pdev); } break; @@ -7194,13 +7242,17 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { + int mac_for_pdev = + dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + htt_h2t_rx_ring_cfg(soc->htt_handle, - pdev->pdev_id + mac_id, - pdev->rxdma_mon_status_ring - .hal_srng, - RXDMA_MONITOR_STATUS, - RX_BUFFER_SIZE, - &htt_tlv_filter); + mac_for_pdev, + pdev->rxdma_mon_status_ring[mac_id] + .hal_srng, + RXDMA_MONITOR_STATUS, + RX_BUFFER_SIZE, + &htt_tlv_filter); } if (soc->reap_timer_init) @@ -7219,16 +7271,20 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, * header file will use proper macros */ for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { + int mac_for_pdev = + dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + pdev->pktlog_ppdu_stats = false; if (!pdev->enhanced_stats_en && !pdev->tx_sniffer_enable && !pdev->mcopy_mode) { dp_h2t_cfg_stats_msg_send(pdev, 0, - pdev->pdev_id + mac_id); + mac_for_pdev); } else if (pdev->tx_sniffer_enable || pdev->mcopy_mode) { dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_SNIFFER, - pdev->pdev_id + mac_id); + mac_for_pdev); } else if (pdev->enhanced_stats_en) { dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_ENH_STATS, - pdev->pdev_id + mac_id); + mac_for_pdev); } } diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 82f5a2d1c9bd..e29bacefbd62 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -82,7 +82,7 @@ QDF_STATUS dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id, { uint32_t num_alloc_desc; uint16_t num_desc_to_free = 0; - struct dp_pdev *dp_pdev = dp_soc->pdev_list[mac_id]; + struct dp_pdev *dp_pdev = dp_get_pdev_for_mac_id(dp_soc, mac_id); uint32_t num_entries_avail; uint32_t count; int sync_hw_ptr = 1; diff --git a/dp/wifi3.0/dp_rx_err.c b/dp/wifi3.0/dp_rx_err.c index b00b528788b2..6c88c505828a 100644 --- a/dp/wifi3.0/dp_rx_err.c +++ b/dp/wifi3.0/dp_rx_err.c @@ -1253,7 +1253,7 @@ dp_rx_err_mpdu_pop(struct dp_soc *soc, uint32_t mac_id, uint8_t push_reason; uint8_t rxdma_error_code = 0; uint8_t bm_action = HAL_BM_ACTION_PUT_IN_IDLE_LIST; - struct dp_pdev *pdev = soc->pdev_list[mac_id]; + struct dp_pdev *pdev = dp_get_pdev_for_mac_id(soc, mac_id); msdu = 0; @@ -1348,8 +1348,7 @@ uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) { 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; + int mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id); void *hal_soc; void *rxdma_dst_ring_desc; void *err_dst_srng; @@ -1364,8 +1363,7 @@ dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) if (!pdev) return 0; #endif - pdev_id = pdev->pdev_id; - err_dst_srng = pdev->rxdma_err_dst_ring[ring_idx].hal_srng; + err_dst_srng = pdev->rxdma_err_dst_ring[mac_for_pdev].hal_srng; if (!err_dst_srng) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, @@ -1401,7 +1399,7 @@ dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) dp_rxdma_srng = &pdev->rx_refill_buf_ring; rx_desc_pool = &soc->rx_desc_buf[mac_id]; - dp_rx_buffers_replenish(soc, pdev_id, dp_rxdma_srng, + dp_rx_buffers_replenish(soc, mac_id, dp_rxdma_srng, rx_desc_pool, rx_bufs_used, &head, &tail, HAL_RX_BUF_RBM_SW3_BM); work_done += rx_bufs_used; diff --git a/dp/wifi3.0/dp_rx_mon.h b/dp/wifi3.0/dp_rx_mon.h index a4154e886b45..52fb06437de8 100644 --- a/dp/wifi3.0/dp_rx_mon.h +++ b/dp/wifi3.0/dp_rx_mon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -41,8 +41,8 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, QDF_STATUS dp_rx_pdev_mon_attach(struct dp_pdev *pdev); QDF_STATUS dp_rx_pdev_mon_detach(struct dp_pdev *pdev); -QDF_STATUS dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev); -QDF_STATUS dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev); +QDF_STATUS dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int mac_id); +QDF_STATUS dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev, int mac_id); uint32_t dp_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota); QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id, diff --git a/dp/wifi3.0/dp_rx_mon_dest.c b/dp/wifi3.0/dp_rx_mon_dest.c index 4cff55ca7673..f493c702cef2 100644 --- a/dp/wifi3.0/dp_rx_mon_dest.c +++ b/dp/wifi3.0/dp_rx_mon_dest.c @@ -38,17 +38,18 @@ */ static QDF_STATUS dp_rx_mon_link_desc_return(struct dp_pdev *dp_pdev, - void *buf_addr_info) + void *buf_addr_info, int mac_id) { struct dp_srng *dp_srng; void *hal_srng; void *hal_soc; QDF_STATUS status = QDF_STATUS_E_FAILURE; void *src_srng_desc; + int mac_for_pdev = dp_get_mac_id_for_mac(dp_pdev->soc, mac_id); hal_soc = dp_pdev->soc->hal_soc; - dp_srng = &dp_pdev->rxdma_mon_desc_ring; + dp_srng = &dp_pdev->rxdma_mon_desc_ring[mac_for_pdev]; hal_srng = dp_srng->hal_srng; qdf_assert(hal_srng); @@ -127,7 +128,7 @@ dp_rx_mon_mpdu_pop(struct dp_soc *soc, uint32_t mac_id, union dp_rx_desc_list_elem_t **head, union dp_rx_desc_list_elem_t **tail) { - struct dp_pdev *dp_pdev = soc->pdev_list[mac_id]; + struct dp_pdev *dp_pdev = dp_get_pdev_for_mac_id(soc, mac_id); void *rx_desc_tlv; void *rx_msdu_link_desc; qdf_nbuf_t msdu; @@ -316,11 +317,11 @@ dp_rx_mon_mpdu_pop(struct dp_soc *soc, uint32_t mac_id, hal_rx_mon_next_link_desc_get(rx_msdu_link_desc, &buf_info, &p_buf_addr_info); - if (dp_rx_mon_link_desc_return(dp_pdev, p_last_buf_addr_info) - != QDF_STATUS_SUCCESS) { + if (dp_rx_mon_link_desc_return(dp_pdev, p_last_buf_addr_info, + mac_id) != QDF_STATUS_SUCCESS) QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, "dp_rx_mon_link_desc_return failed\n"); - } + p_last_buf_addr_info = p_buf_addr_info; } while (buf_info.paddr && msdu_cnt); @@ -361,7 +362,7 @@ qdf_nbuf_t dp_rx_mon_restitch_mpdu_from_msdus(struct dp_soc *soc, unsigned char *dest; struct ieee80211_frame *wh; struct ieee80211_qoscntl *qos; - struct dp_pdev *dp_pdev = soc->pdev_list[mac_id]; + struct dp_pdev *dp_pdev = dp_get_pdev_for_mac_id(soc, mac_id); head_frag_list = NULL; /* The nbuf has been pulled just beyond the status and points to the @@ -673,7 +674,7 @@ void dp_rx_extract_radiotap_info(struct cdp_mon_status *rx_status, QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id, qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu) { - struct dp_pdev *pdev = soc->pdev_list[mac_id]; + struct dp_pdev *pdev = dp_get_pdev_for_mac_id(soc, mac_id); struct cdp_mon_status *rs = &pdev->rx_mon_recv_status; qdf_nbuf_t mon_skb, skb_next; qdf_nbuf_t mon_mpdu = NULL; @@ -731,8 +732,7 @@ mon_deliver_fail: */ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) { - struct dp_pdev *pdev = soc->pdev_list[mac_id]; - uint8_t pdev_id; + struct dp_pdev *pdev = dp_get_pdev_for_mac_id(soc, mac_id); void *hal_soc; void *rxdma_dst_ring_desc; void *mon_dst_srng; @@ -740,9 +740,9 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) union dp_rx_desc_list_elem_t *tail = NULL; uint32_t ppdu_id; uint32_t rx_bufs_used; + int mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id); - pdev_id = pdev->pdev_id; - mon_dst_srng = pdev->rxdma_mon_dst_ring.hal_srng; + mon_dst_srng = pdev->rxdma_mon_dst_ring[mac_for_pdev].hal_srng; if (!mon_dst_srng || !hal_srng_initialized(mon_dst_srng)) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, @@ -797,14 +797,15 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) hal_srng_access_end(hal_soc, mon_dst_srng); if (rx_bufs_used) { - dp_rx_buffers_replenish(soc, pdev_id, - &pdev->rxdma_mon_buf_ring, &soc->rx_desc_mon[pdev_id], - rx_bufs_used, &head, &tail, HAL_RX_BUF_RBM_SW3_BM); + dp_rx_buffers_replenish(soc, mac_id, + &pdev->rxdma_mon_buf_ring[mac_for_pdev], + &soc->rx_desc_mon[mac_id], rx_bufs_used, &head, &tail, + HAL_RX_BUF_RBM_SW3_BM); } } static QDF_STATUS -dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev) { +dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev, int mac_id) { uint8_t pdev_id = pdev->pdev_id; struct dp_soc *soc = pdev->soc; union dp_rx_desc_list_elem_t *desc_list = NULL; @@ -813,20 +814,21 @@ dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev) { uint32_t rxdma_entries; struct rx_desc_pool *rx_desc_pool; QDF_STATUS status; + uint8_t mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id); - rxdma_srng = &pdev->rxdma_mon_buf_ring; + rxdma_srng = &pdev->rxdma_mon_buf_ring[mac_for_pdev]; rxdma_entries = rxdma_srng->alloc_size/hal_srng_get_entrysize( soc->hal_soc, RXDMA_MONITOR_BUF); - rx_desc_pool = &soc->rx_desc_mon[pdev_id]; + rx_desc_pool = &soc->rx_desc_mon[mac_id]; QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, "%s: Mon RX Desc Pool[%d] allocation size=%d" , __func__, pdev_id, rxdma_entries*3); - status = dp_rx_desc_pool_alloc(soc, pdev_id, + status = dp_rx_desc_pool_alloc(soc, mac_id, rxdma_entries*3, rx_desc_pool); if (!QDF_IS_STATUS_SUCCESS(status)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, @@ -838,7 +840,7 @@ dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev) { "%s: Mon RX Buffers Replenish pdev_id=%d", __func__, pdev_id); - status = dp_rx_buffers_replenish(soc, pdev_id, rxdma_srng, rx_desc_pool, + status = dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool, rxdma_entries, &desc_list, &tail, HAL_RX_BUF_RBM_SW3_BM); if (!QDF_IS_STATUS_SUCCESS(status)) { @@ -851,15 +853,14 @@ dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev) { } static QDF_STATUS -dp_rx_pdev_mon_buf_detach(struct dp_pdev *pdev) { - uint8_t pdev_id = pdev->pdev_id; +dp_rx_pdev_mon_buf_detach(struct dp_pdev *pdev, int mac_id) +{ struct dp_soc *soc = pdev->soc; struct rx_desc_pool *rx_desc_pool; - rx_desc_pool = &soc->rx_desc_mon[pdev_id]; - if (rx_desc_pool->pool_size != 0) { - dp_rx_desc_pool_free(soc, pdev_id, rx_desc_pool); - } + rx_desc_pool = &soc->rx_desc_mon[mac_id]; + if (rx_desc_pool->pool_size != 0) + dp_rx_desc_pool_free(soc, mac_id, rx_desc_pool); return QDF_STATUS_SUCCESS; } @@ -870,7 +871,8 @@ dp_rx_pdev_mon_buf_detach(struct dp_pdev *pdev) { */ static int dp_mon_link_desc_pool_setup(struct dp_soc *soc, uint32_t mac_id) { - struct dp_pdev *dp_pdev = soc->pdev_list[mac_id]; + struct dp_pdev *dp_pdev = dp_get_pdev_for_mac_id(soc, mac_id); + int mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id); int link_desc_size = hal_get_link_desc_size(soc->hal_soc); int link_desc_align = hal_get_link_desc_align(soc->hal_soc); uint32_t max_alloc_size = wlan_cfg_max_alloc_size(soc->wlan_cfg_ctx); @@ -883,7 +885,7 @@ static int dp_mon_link_desc_pool_setup(struct dp_soc *soc, uint32_t mac_id) struct dp_srng *dp_srng; int i; - dp_srng = &dp_pdev->rxdma_mon_desc_ring; + dp_srng = &dp_pdev->rxdma_mon_desc_ring[mac_for_pdev]; num_entries = dp_srng->alloc_size/hal_srng_get_entrysize( soc->hal_soc, RXDMA_MONITOR_DESC); @@ -984,7 +986,7 @@ static int dp_mon_link_desc_pool_setup(struct dp_soc *soc, uint32_t mac_id) entry_size = hal_srng_get_entrysize(soc->hal_soc, RXDMA_MONITOR_DESC); total_mem_size = entry_size * total_link_descs; - mon_desc_srng = dp_pdev->rxdma_mon_desc_ring.hal_srng; + mon_desc_srng = dp_pdev->rxdma_mon_desc_ring[mac_for_pdev].hal_srng; num_replenish_buf = 0; @@ -1049,7 +1051,7 @@ fail: */ static void dp_mon_link_desc_pool_cleanup(struct dp_soc *soc, uint32_t mac_id) { - struct dp_pdev *dp_pdev = soc->pdev_list[mac_id]; + struct dp_pdev *dp_pdev = dp_get_pdev_for_mac_id(soc, mac_id); int i; for (i = 0; i < MAX_MON_LINK_DESC_BANKS; i++) { @@ -1077,34 +1079,40 @@ static void dp_mon_link_desc_pool_cleanup(struct dp_soc *soc, uint32_t mac_id) QDF_STATUS dp_rx_pdev_mon_attach(struct dp_pdev *pdev) { - uint8_t pdev_id = pdev->pdev_id; struct dp_soc *soc = pdev->soc; QDF_STATUS status; + uint8_t pdev_id = pdev->pdev_id; + int mac_id; QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, "%s: pdev attach id=%d\n", __func__, pdev_id); - status = dp_rx_pdev_mon_buf_attach(pdev); - if (!QDF_IS_STATUS_SUCCESS(status)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - "%s: dp_rx_pdev_mon_buf_attach() failed \n", __func__); - return status; - } + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); - status = dp_rx_pdev_mon_status_attach(pdev); - if (!QDF_IS_STATUS_SUCCESS(status)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - "%s: dp_rx_pdev_mon_status_attach() failed \n", - __func__); - return status; - } + status = dp_rx_pdev_mon_buf_attach(pdev, mac_for_pdev); + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + "%s: dp_rx_pdev_mon_buf_attach() failed\n", + __func__); + return status; + } - status = dp_mon_link_desc_pool_setup(soc, pdev_id); - if (!QDF_IS_STATUS_SUCCESS(status)) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - "%s: dp_mon_link_desc_pool_setup() failed \n", - __func__); - return status; + status = dp_rx_pdev_mon_status_attach(pdev, mac_for_pdev); + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + "%s: dp_rx_pdev_mon_status_attach() failed\n", + __func__); + return status; + } + + status = dp_mon_link_desc_pool_setup(soc, mac_for_pdev); + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + "%s: dp_mon_link_desc_pool_setup() failed\n", + __func__); + return status; + } } return QDF_STATUS_SUCCESS; @@ -1124,10 +1132,15 @@ QDF_STATUS dp_rx_pdev_mon_detach(struct dp_pdev *pdev) { uint8_t pdev_id = pdev->pdev_id; struct dp_soc *soc = pdev->soc; + int mac_id; - dp_mon_link_desc_pool_cleanup(soc, pdev_id); - dp_rx_pdev_mon_status_detach(pdev); - dp_rx_pdev_mon_buf_detach(pdev); + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); + + dp_mon_link_desc_pool_cleanup(soc, mac_for_pdev); + dp_rx_pdev_mon_status_detach(pdev, mac_for_pdev); + dp_rx_pdev_mon_buf_detach(pdev, mac_for_pdev); + } return QDF_STATUS_SUCCESS; } diff --git a/dp/wifi3.0/dp_rx_mon_status.c b/dp/wifi3.0/dp_rx_mon_status.c index f794087c27d2..a0e637747c29 100644 --- a/dp/wifi3.0/dp_rx_mon_status.c +++ b/dp/wifi3.0/dp_rx_mon_status.c @@ -318,7 +318,7 @@ static inline void dp_rx_mon_status_process_tlv(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); struct hal_rx_ppdu_info *ppdu_info; qdf_nbuf_t status_nbuf; uint8_t *rx_tlv; @@ -401,14 +401,15 @@ static inline uint32_t dp_rx_mon_status_srng_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); void *hal_soc; void *mon_status_srng; void *rxdma_mon_status_ring_entry; QDF_STATUS status; uint32_t work_done = 0; + int mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id); - mon_status_srng = pdev->rxdma_mon_status_ring.hal_srng; + mon_status_srng = pdev->rxdma_mon_status_ring[mac_for_pdev].hal_srng; qdf_assert(mon_status_srng); if (!mon_status_srng || !hal_srng_initialized(mon_status_srng)) { @@ -590,6 +591,7 @@ dp_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) { /** * dp_rx_pdev_mon_detach() - detach dp rx for status ring * @pdev: core txrx pdev context + * @mac_id: mac_id/pdev_id correspondinggly for MCL and WIN * * This function will detach DP RX status ring from * main device context. will free DP Rx resources for @@ -599,16 +601,14 @@ dp_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) { * QDF_STATUS_E_RESOURCES: Error return */ QDF_STATUS -dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev) +dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev, int mac_id) { - uint8_t pdev_id = pdev->pdev_id; struct dp_soc *soc = pdev->soc; struct rx_desc_pool *rx_desc_pool; - rx_desc_pool = &soc->rx_desc_status[pdev_id]; - if (rx_desc_pool->pool_size != 0) { - dp_rx_desc_pool_free(soc, pdev_id, rx_desc_pool); - } + rx_desc_pool = &soc->rx_desc_status[mac_id]; + if (rx_desc_pool->pool_size != 0) + dp_rx_desc_pool_free(soc, mac_id, rx_desc_pool); return QDF_STATUS_SUCCESS; } @@ -772,8 +772,7 @@ QDF_STATUS dp_rx_mon_status_buffers_replenish(struct dp_soc *dp_soc, * QDF_STATUS_E_RESOURCES: Error return */ QDF_STATUS -dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev) { - uint8_t pdev_id = pdev->pdev_id; +dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int ring_id) { struct dp_soc *soc = pdev->soc; union dp_rx_desc_list_elem_t *desc_list = NULL; union dp_rx_desc_list_elem_t *tail = NULL; @@ -781,19 +780,20 @@ dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev) { uint32_t rxdma_entries; struct rx_desc_pool *rx_desc_pool; QDF_STATUS status; + int mac_for_pdev = dp_get_mac_id_for_mac(soc, ring_id); - rxdma_srng = &pdev->rxdma_mon_status_ring; + rxdma_srng = &pdev->rxdma_mon_status_ring[mac_for_pdev]; rxdma_entries = rxdma_srng->alloc_size/hal_srng_get_entrysize( soc->hal_soc, RXDMA_MONITOR_STATUS); - rx_desc_pool = &soc->rx_desc_status[pdev_id]; + rx_desc_pool = &soc->rx_desc_status[ring_id]; QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, "%s: Mon RX Status Pool[%d] allocation size=%d\n", - __func__, pdev_id, rxdma_entries); + __func__, ring_id, rxdma_entries); - status = dp_rx_desc_pool_alloc(soc, pdev_id, rxdma_entries+1, + status = dp_rx_desc_pool_alloc(soc, ring_id, rxdma_entries+1, rx_desc_pool); if (!QDF_IS_STATUS_SUCCESS(status)) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, @@ -802,10 +802,10 @@ dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev) { } QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, - "%s: Mon RX Status Buffers Replenish pdev_id=%d\n", - __func__, pdev_id); + "%s: Mon RX Status Buffers Replenish ring_id=%d\n", + __func__, ring_id); - status = dp_rx_mon_status_buffers_replenish(soc, pdev_id, rxdma_srng, + status = dp_rx_mon_status_buffers_replenish(soc, ring_id, rxdma_srng, rx_desc_pool, rxdma_entries, &desc_list, &tail, HAL_RX_BUF_RBM_SW3_BM); if (!QDF_IS_STATUS_SUCCESS(status)) { diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 90a0eea98c58..393816f9307d 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -985,18 +985,18 @@ struct dp_pdev { struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx; /* RXDMA monitor buffer replenish ring */ - struct dp_srng rxdma_mon_buf_ring; + struct dp_srng rxdma_mon_buf_ring[NUM_RXDMA_RINGS_PER_PDEV]; /* RXDMA monitor destination ring */ - struct dp_srng rxdma_mon_dst_ring; + struct dp_srng rxdma_mon_dst_ring[NUM_RXDMA_RINGS_PER_PDEV]; /* RXDMA monitor status ring. TBD: Check format of this ring */ - struct dp_srng rxdma_mon_status_ring; + struct dp_srng rxdma_mon_status_ring[NUM_RXDMA_RINGS_PER_PDEV]; - struct dp_srng rxdma_mon_desc_ring; + struct dp_srng rxdma_mon_desc_ring[NUM_RXDMA_RINGS_PER_PDEV]; /* RXDMA error destination ring */ - struct dp_srng rxdma_err_dst_ring[MAX_RX_MAC_RINGS]; + struct dp_srng rxdma_err_dst_ring[NUM_RXDMA_RINGS_PER_PDEV]; /* Link descriptor memory banks */ struct { diff --git a/dp/wifi3.0/dp_wdi_event.c b/dp/wifi3.0/dp_wdi_event.c index 6886554c3dfe..d43252933840 100644 --- a/dp/wifi3.0/dp_wdi_event.c +++ b/dp/wifi3.0/dp_wdi_event.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -119,7 +119,7 @@ dp_wdi_event_handler( wdi_event_subscribe *wdi_sub; struct dp_pdev *txrx_pdev; struct dp_soc *soc_t = (struct dp_soc *)soc; - txrx_pdev = (struct dp_pdev *)soc_t->pdev_list[pdev_id]; + txrx_pdev = dp_get_pdev_for_mac_id(soc_t, pdev_id); if (!event) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 656bcfc6ad6a..97e7c90f8b1a 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -35,7 +35,6 @@ #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 #define WLAN_CFG_TX_RING_SIZE 2048 @@ -62,7 +61,6 @@ #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 /* Tx Descriptor and Tx Extension Descriptor pool sizes */ diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index 458bdbee189c..a0565f7534f9 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -35,6 +35,7 @@ /* PPDU Stats Configuration - Configure bitmask for enabling tx ppdu tlv's */ #define DP_PPDU_TXLITE_STATS_BITMASK_CFG 0x1FFF +#define NUM_RXDMA_RINGS_PER_PDEV 2 #else #define MAX_PDEV_CNT 3 #define WLAN_CFG_INT_NUM_CONTEXTS 7 @@ -47,6 +48,7 @@ /* PPDU Stats Configuration - Configure bitmask for enabling tx ppdu tlv's */ #define DP_PPDU_TXLITE_STATS_BITMASK_CFG 0xFFFF +#define NUM_RXDMA_RINGS_PER_PDEV 1 #endif /* Tx configuration */