diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index de67ba9e73..5bce496908 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -1414,6 +1414,10 @@ static int dp_srng_calculate_msi_group(struct dp_soc *soc, grp_mask = &soc->wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[0]; break; + case TX_MONITOR_BUF: + grp_mask = &soc->wlan_cfg_ctx->int_host2txmon_ring_mask[0]; + break; + case TCL_DATA: /* CMD_CREDIT_RING is used as command in 8074 and credit in 9000 */ case TCL_CMD_CREDIT: @@ -2322,7 +2326,7 @@ static int dp_process_lmac_rings(struct dp_intr *int_ctx, int total_budget) } if (int_ctx->host2rxdma_ring_mask & - (1 << mac_for_pdev)) { + (1 << mac_for_pdev)) { union dp_rx_desc_list_elem_t *desc_list = NULL; union dp_rx_desc_list_elem_t *tail = NULL; struct dp_srng *rx_refill_buf_ring; @@ -2336,14 +2340,21 @@ static int dp_process_lmac_rings(struct dp_intr *int_ctx, int total_budget) intr_stats->num_host2rxdma_ring_masks++; DP_STATS_INC(pdev, replenish.low_thresh_intrs, - 1); + 1); dp_rx_buffers_replenish(soc, mac_for_pdev, - rx_refill_buf_ring, - &soc->rx_desc_buf[mac_for_pdev], - 0, &desc_list, &tail); + rx_refill_buf_ring, + &soc->rx_desc_buf[mac_for_pdev], + 0, &desc_list, &tail); } + } + if (int_ctx->host2rxdma_mon_ring_mask) + dp_tx_mon_buf_refill(int_ctx); + + if (int_ctx->host2txmon_ring_mask) + dp_tx_mon_buf_refill(int_ctx); + budget_done: return total_budget - budget; } @@ -2895,6 +2906,8 @@ static void dp_soc_interrupt_map_calculate_msi(struct dp_soc *soc, wlan_cfg_get_tx_ring_near_full_mask(soc->wlan_cfg_ctx, intr_ctx_num); + int host2txmon_ring_mask = wlan_cfg_get_host2txmon_ring_mask( + soc->wlan_cfg_ctx, intr_ctx_num); unsigned int vector = (intr_ctx_num % msi_vector_count) + msi_vector_start; int num_irq = 0; @@ -2905,7 +2918,7 @@ static void dp_soc_interrupt_map_calculate_msi(struct dp_soc *soc, rx_wbm_rel_ring_mask | reo_status_ring_mask | rxdma2host_ring_mask | host2rxdma_ring_mask | host2rxdma_mon_ring_mask | rx_near_full_grp_1_mask | rx_near_full_grp_2_mask | - tx_ring_near_full_mask) + tx_ring_near_full_mask | host2txmon_ring_mask) irq_id_map[num_irq++] = pld_get_msi_irq(soc->osdev->dev, vector); @@ -3062,12 +3075,13 @@ static QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc) int tx_ring_near_full_mask = wlan_cfg_get_tx_ring_near_full_mask(soc->wlan_cfg_ctx, i); + int host2txmon_ring_mask = + wlan_cfg_get_host2txmon_ring_mask(soc->wlan_cfg_ctx, i); soc->intr_ctx[i].dp_intr_id = i; soc->intr_ctx[i].tx_ring_mask = tx_mask; soc->intr_ctx[i].rx_ring_mask = rx_mask; soc->intr_ctx[i].rx_mon_ring_mask = rx_mon_mask; - soc->intr_ctx[i].tx_mon_ring_mask = tx_mon_ring_mask; soc->intr_ctx[i].rx_err_ring_mask = rx_err_ring_mask; soc->intr_ctx[i].rxdma2host_ring_mask = rxdma2host_ring_mask; soc->intr_ctx[i].host2rxdma_ring_mask = host2rxdma_ring_mask; @@ -3081,6 +3095,8 @@ static QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc) rx_near_full_grp_2_mask; soc->intr_ctx[i].tx_ring_near_full_mask = tx_ring_near_full_mask; + soc->intr_ctx[i].tx_mon_ring_mask = tx_mon_ring_mask; + soc->intr_ctx[i].host2txmon_ring_mask = host2txmon_ring_mask; soc->intr_ctx[i].soc = soc; diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index e69e55aa37..10e892bdf9 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -822,6 +822,7 @@ struct dp_rx_tid { * @num_reo_status_ring_masks: interrupts with reo_status_ring_mask set * @num_rxdma2host_ring_masks: interrupts with rxdma2host_ring_mask set * @num_host2rxdma_ring_masks: interrupts with host2rxdma_ring_mask set + * @num_host2rxdma_mon_ring_masks: interrupts with host2rxdma_ring_mask set * @num_rx_ring_near_full_masks: Near-full interrupts for REO DST ring * @num_tx_comp_ring_near_full_masks: Near-full interrupts for TX completion * @num_rx_wbm_rel_ring_near_full_masks: total number of times the wbm rel ring @@ -831,6 +832,9 @@ struct dp_rx_tid { * @num_near_full_masks: total number of times the near full interrupt * was received * @num_masks: total number of times the interrupt was received + * @num_host2txmon_ring_masks: interrupts with host2txmon_ring_mask set + * @num_near_full_masks: total number of times the interrupt was received + * @num_masks: total number of times the near full interrupt was received * @num_tx_mon_ring_masks: interrupts with num_tx_mon_ring_masks set * * Counter for individual masks are incremented only if there are any packets @@ -845,10 +849,12 @@ struct dp_intr_stats { uint32_t num_reo_status_ring_masks; uint32_t num_rxdma2host_ring_masks; uint32_t num_host2rxdma_ring_masks; + uint32_t num_host2rxdma_mon_ring_masks; uint32_t num_rx_ring_near_full_masks[MAX_REO_DEST_RINGS]; uint32_t num_tx_comp_ring_near_full_masks[MAX_TCL_DATA_RINGS]; uint32_t num_rx_wbm_rel_ring_near_full_masks; uint32_t num_reo_status_ring_near_full_masks; + uint32_t num_host2txmon_ring__masks; uint32_t num_near_full_masks; uint32_t num_masks; uint32_t num_tx_mon_ring_masks; @@ -875,6 +881,7 @@ struct dp_intr { uint8_t rx_near_full_grp_2_mask; /* WBM TX completion rings near full interrupt mask */ uint8_t tx_ring_near_full_mask; + uint8_t host2txmon_ring_mask; /* Tx monitor buffer ring */ struct dp_soc *soc; /* Reference to SoC structure , to get DMA ring handles */ qdf_lro_ctx_t lro_ctx; diff --git a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c index 024655b9af..c2e5ee7c48 100644 --- a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c +++ b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c @@ -371,6 +371,69 @@ QDF_STATUS dp_mon_htt_srng_setup_2_0(struct dp_soc *soc, return status; } +QDF_STATUS dp_tx_mon_refill_buf_ring_2_0(struct dp_intr *int_ctx) +{ + struct dp_soc *soc = int_ctx->soc; + union dp_mon_desc_list_elem_t *desc_list = NULL; + union dp_mon_desc_list_elem_t *tail = NULL; + struct dp_srng *tx_mon_buf_ring; + struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc); + struct dp_mon_soc_be *mon_soc_be = be_soc->monitor_soc_be; + struct dp_intr_stats *intr_stats = &int_ctx->intr_stats; + uint32_t num_entries_avail; + int sync_hw_ptr = 1; + void *hal_srng; + + tx_mon_buf_ring = &be_soc->monitor_soc_be->tx_mon_buf_ring; + hal_srng = tx_mon_buf_ring->hal_srng; + + intr_stats->num_host2txmon_ring__masks++; + mon_soc_be->tx_low_thresh_intrs++; + hal_srng_access_start(soc->hal_soc, hal_srng); + num_entries_avail = hal_srng_src_num_avail(soc->hal_soc, + hal_srng, + sync_hw_ptr); + hal_srng_access_end(soc->hal_soc, hal_srng); + + dp_mon_buffers_replenish(soc, tx_mon_buf_ring, + &be_soc->monitor_soc_be->tx_desc_mon, + num_entries_avail, &desc_list, &tail); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS dp_rx_mon_refill_buf_ring_2_0(struct dp_intr *int_ctx) +{ + struct dp_soc *soc = int_ctx->soc; + union dp_mon_desc_list_elem_t *desc_list = NULL; + union dp_mon_desc_list_elem_t *tail = NULL; + struct dp_srng *rx_mon_buf_ring; + struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc); + struct dp_mon_soc_be *mon_soc_be = be_soc->monitor_soc_be; + struct dp_intr_stats *intr_stats = &int_ctx->intr_stats; + uint32_t num_entries_avail; + int sync_hw_ptr = 1; + void *hal_srng; + + rx_mon_buf_ring = &soc->rxdma_mon_buf_ring[0]; + hal_srng = rx_mon_buf_ring->hal_srng; + + intr_stats->num_host2rxdma_ring_masks++; + mon_soc_be->rx_low_thresh_intrs++; + hal_srng_access_start(soc->hal_soc, hal_srng); + num_entries_avail = hal_srng_src_num_avail(soc->hal_soc, + hal_srng, + sync_hw_ptr); + hal_srng_access_end(soc->hal_soc, hal_srng); + + dp_mon_buffers_replenish(soc, rx_mon_buf_ring, + &be_soc->monitor_soc_be->rx_desc_mon, + num_entries_avail, &desc_list, &tail); + + return QDF_STATUS_SUCCESS; +} + +#ifndef DISABLE_MON_CONFIG static uint32_t dp_rx_mon_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx, uint32_t mac_id, uint32_t quota) @@ -873,6 +936,8 @@ struct dp_mon_ops monitor_ops_2_0 = { .rx_packet_length_set = dp_rx_mon_packet_length_set, .rx_wmask_subscribe = dp_rx_mon_word_mask_subscribe, .rx_enable_mpdu_logging = dp_rx_mon_enable_mpdu_logging, + .rx_mon_refill_buf_ring = dp_rx_mon_refill_buf_ring_2_0, + .tx_mon_refill_buf_ring = dp_tx_mon_refill_buf_ring_2_0, }; struct cdp_mon_ops dp_ops_mon_2_0 = { @@ -893,3 +958,4 @@ struct cdp_mon_ops *dp_mon_cdp_ops_get_2_0(void) { return &dp_ops_mon_2_0; } +#endif diff --git a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.h b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.h index 2b98eb38ba..3557a614f1 100644 --- a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.h +++ b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.h @@ -89,6 +89,8 @@ struct dp_mon_pdev_be { * @rx_desc_mon: descriptor pool for rx mon src ring * @rx_mon_ring_fill_level: rx mon ring refill level * @tx_mon_ring_fill_level: tx mon ring refill level + * @low_thresh_intrs: number of tx mon low threshold interrupts received + * @low_thresh_intrs: number of rx mon low threshold interrupts received */ struct dp_mon_soc_be { struct dp_mon_soc mon_soc; @@ -103,6 +105,8 @@ struct dp_mon_soc_be { uint16_t rx_mon_ring_fill_level; uint16_t tx_mon_ring_fill_level; + uint32_t tx_low_thresh_intrs; + uint32_t rx_low_thresh_intrs; }; #endif diff --git a/dp/wifi3.0/monitor/dp_mon.h b/dp/wifi3.0/monitor/dp_mon.h index 2abf5632ae..2dcf12b361 100644 --- a/dp/wifi3.0/monitor/dp_mon.h +++ b/dp/wifi3.0/monitor/dp_mon.h @@ -517,6 +517,8 @@ struct dp_mon_ops { struct htt_rx_ring_tlv_filter *tlv_filter); void (*rx_enable_mpdu_logging)(uint32_t *msg_word, struct htt_rx_ring_tlv_filter *tlv_filter); + QDF_STATUS (*rx_mon_refill_buf_ring)(struct dp_intr *int_ctx); + QDF_STATUS (*tx_mon_refill_buf_ring)(struct dp_intr *int_ctx); }; struct dp_mon_soc { @@ -1735,7 +1737,7 @@ void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota) #endif /* - * dp_monitor_process() - Process monitor + * dp_rx_monitor_process() - Process monitor * @soc: point to soc * @int_ctx: interrupt ctx * @mac_id: lma @@ -1746,7 +1748,7 @@ void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota) #ifndef DISABLE_MON_CONFIG static inline uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx, - uint32_t mac_id, uint32_t quota) + uint32_t mac_id, uint32_t quota) { struct dp_mon_ops *monitor_ops; struct dp_mon_soc *mon_soc = soc->monitor_soc; @@ -1765,16 +1767,72 @@ uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx, return monitor_ops->mon_rx_process(soc, int_ctx, mac_id, quota); } -static inline uint32_t -dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, - uint32_t mac_id, uint32_t quota) +static inline +uint32_t dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, + uint32_t mac_id, uint32_t quota) { - return 0; + struct dp_mon_ops *monitor_ops; + struct dp_mon_soc *mon_soc = soc->monitor_soc; + + if (!mon_soc) { + dp_mon_debug("monitor soc is NULL"); + return 0; + } + + monitor_ops = mon_soc->mon_ops; + if (!monitor_ops || !monitor_ops->mon_tx_process) { + dp_mon_debug("callback not registered"); + return 0; + } + + return monitor_ops->mon_tx_process(soc, int_ctx, mac_id, quota); +} + +static inline +uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx) +{ + struct dp_soc *soc = int_ctx->soc; + struct dp_mon_ops *monitor_ops; + struct dp_mon_soc *mon_soc = soc->monitor_soc; + + if (!mon_soc) { + dp_mon_debug("monitor soc is NULL"); + return 0; + } + + monitor_ops = mon_soc->mon_ops; + if (!monitor_ops || !monitor_ops->tx_mon_refill_buf_ring) { + dp_mon_debug("callback not registered"); + return 0; + } + + return monitor_ops->tx_mon_refill_buf_ring(int_ctx); +} + +static inline +uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx) +{ + struct dp_soc *soc = int_ctx->soc; + struct dp_mon_ops *monitor_ops; + struct dp_mon_soc *mon_soc = soc->monitor_soc; + + if (!mon_soc) { + dp_mon_debug("monitor soc is NULL"); + return 0; + } + + monitor_ops = mon_soc->mon_ops; + if (!monitor_ops || !monitor_ops->rx_mon_refill_buf_ring) { + dp_mon_debug("callback not registered"); + return 0; + } + + return monitor_ops->rx_mon_refill_buf_ring(int_ctx); } #else static inline uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx, - uint32_t mac_id, uint32_t quota) + uint32_t mac_id, uint32_t quota) { return 0; } @@ -1785,6 +1843,16 @@ dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, { return 0; } + +static inline +uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx) +{ +} + +static inline +uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx) +{ +} #endif /* diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index 1b82f83a06..4a6a6374e4 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -344,10 +344,6 @@ #define WLAN_CFG_TX_MONITOR_DST_RING_SIZE_MIN 48 #define WLAN_CFG_TX_MONITOR_DST_RING_SIZE_MAX 4096 -#define WLAN_CFG_TX_MONITOR_BUF_SIZE 2048 -#define WLAN_CFG_TX_MONITOR_BUF_SIZE_MIN 48 -#define WLAN_CFG_TX_MONITOR_BUF_SIZE_MAX 8192 - #define WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE 1024 #define WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE_MIN 16 #define WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE_MAX 8192 diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 18a0f3f14b..d5557520fc 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -60,6 +60,8 @@ #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1 0x2 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2 0x4 +#define WLAN_CFG_HOST2TXMON_RING_MASK_0 0x1 + #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0 0x1 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1 0x2 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2 0x4 @@ -104,6 +106,7 @@ struct dp_int_mask_assignment { uint8_t rx_ring_near_full_irq_1_mask[WLAN_CFG_INT_NUM_CONTEXTS]; uint8_t rx_ring_near_full_irq_2_mask[WLAN_CFG_INT_NUM_CONTEXTS]; uint8_t tx_ring_near_full_irq_mask[WLAN_CFG_INT_NUM_CONTEXTS]; + uint8_t host2txmon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; }; #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1) @@ -1355,6 +1358,9 @@ static struct dp_int_mask_assignment dp_mask_assignment[NUM_INTERRUPT_COMBINATIO WLAN_CFG_REO_STATUS_RING_MASK_2, WLAN_CFG_REO_STATUS_RING_MASK_3, 0, 0, 0, 0}, + /* host2txmon ring masks */ + { WLAN_CFG_HOST2TXMON_RING_MASK_0, + 0, 0, 0, 0, 0, 0, 0, 0, 0}, }, }; #endif @@ -1405,7 +1411,7 @@ struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = { struct wlan_srng_cfg wlan_srng_tx_monitor_buf_cfg = { .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_TX, .batch_count_threshold = 0, - .low_threshold = WLAN_CFG_TX_MONITOR_BUF_SIZE_MAX >> 3, + .low_threshold = WLAN_CFG_TX_MONITOR_BUF_RING_SIZE_MAX >> 3, }; /* DEFAULT_CONFIG ring configuration */ @@ -1547,6 +1553,8 @@ void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, dp_mask_assignment[interrupt_index].rx_ring_near_full_irq_2_mask[i]; wlan_cfg_ctx->int_tx_ring_near_full_irq_mask[i] = dp_mask_assignment[interrupt_index].tx_ring_near_full_irq_mask[i]; + wlan_cfg_ctx->int_host2txmon_ring_mask[i] = + dp_mask_assignment[interrupt_index].host2txmon_ring_mask[i]; } } #endif @@ -2913,3 +2921,19 @@ wlan_cfg_get_dp_soc_tx_mon_buf_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) } qdf_export_symbol(wlan_cfg_get_dp_soc_tx_mon_buf_ring_size); + +int wlan_cfg_get_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, + int context) +{ + return cfg->int_host2txmon_ring_mask[context]; +} + +qdf_export_symbol(wlan_cfg_get_host2txmon_ring_mask); + +void wlan_cfg_set_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, + int context, int mask) +{ + cfg->int_host2txmon_ring_mask[context] = mask; +} + +qdf_export_symbol(wlan_cfg_set_host2txmon_ring_mask); diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index 5dc0db120c..06af3eabda 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -153,6 +153,8 @@ struct wlan_srng_cfg { * mapped to each NAPI/INTR context * @int_tx_ring_near_full_irq_mask: Bitmap of Tx completion ring near full * interrupt mapped to each NAPI/INTR context + * @int_host2txmon_ring_mask: Bitmap of Tx monitor source ring interrupt + * mapped to each NAPI/INTR context * @int_ce_ring_mask: Bitmap of CE interrupts mapped to each NAPI/Intr context * @lro_enabled: enable/disable lro feature * @rx_hash: Enable hash based steering of rx packets @@ -275,6 +277,7 @@ struct wlan_cfg_dp_soc_ctxt { uint8_t int_rx_ring_near_full_irq_1_mask[WLAN_CFG_INT_NUM_CONTEXTS]; uint8_t int_rx_ring_near_full_irq_2_mask[WLAN_CFG_INT_NUM_CONTEXTS]; uint8_t int_tx_ring_near_full_irq_mask[WLAN_CFG_INT_NUM_CONTEXTS]; + uint8_t int_host2txmon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int hw_macid[MAX_PDEV_CNT]; int hw_macid_pdev_id_map[MAX_NUM_LMAC_HW]; int base_hw_macid; @@ -1916,4 +1919,23 @@ int wlan_cfg_get_dma_rx_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg); * Return: Size of Tx MON dest ring size */ int wlan_cfg_get_dma_tx_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg); +/* + * wlan_cfg_set_host2txmon_ring_mask() - Set host2txmon ring + * interrupt mask mapped to an interrupt context + * @wlan_cfg_ctx - Configuration Handle + * + * Return: None + */ +void wlan_cfg_set_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, + int context, int mask); +/** + * wlan_cfg_get_host2txmon_ring_mask() - Return host2txmon ring + * interrupt mask mapped to an interrupt context + * @wlan_cfg_ctx - Configuration Handle + * @context - Numerical ID identifying the Interrupt/NAPI context + * + * Return: int_host2txmon_ring_mask[context] + */ +int wlan_cfg_get_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, + int context); #endif