From 9aaf9e8110749dd7ae0c024e1eaa51585ffb08d6 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Wed, 14 Jul 2021 12:36:50 +0530 Subject: [PATCH] qcacmn: Remove rx packet capture events processing if feature is disabled Currently, rx packet capture events processing happens even when feature is disabled by ini. This incurs per packet overhead in rx path. The fix is to move all the processing from rx path to packet capture mode component. Send only wdi event from rx path, when feature is enabled by ini. Change-Id: I647256b85117cd3373950c78a5a0ae7d6710e4e2 CRs-Fixed: 2969123 --- dp/inc/cdp_txrx_stats_struct.h | 1 + dp/wifi3.0/be/dp_be_rx.c | 1 + dp/wifi3.0/dp_rx.c | 32 +++++++------------------------- wlan_cfg/wlan_cfg.c | 11 +++++++++++ wlan_cfg/wlan_cfg.h | 19 +++++++++++++++++++ 5 files changed, 39 insertions(+), 25 deletions(-) diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h index 04e70402ec..070e3e9e6d 100644 --- a/dp/inc/cdp_txrx_stats_struct.h +++ b/dp/inc/cdp_txrx_stats_struct.h @@ -371,6 +371,7 @@ enum WDI_EVENT { WDI_EVENT_PEER_QOS_STATS, WDI_EVENT_PKT_CAPTURE_TX_DATA, WDI_EVENT_PKT_CAPTURE_RX_DATA, + WDI_EVENT_PKT_CAPTURE_RX_DATA_NO_PEER, WDI_EVENT_PKT_CAPTURE_OFFLOAD_TX_DATA, WDI_EVENT_RX_CBF, /* End of new event items */ diff --git a/dp/wifi3.0/be/dp_be_rx.c b/dp/wifi3.0/be/dp_be_rx.c index 01d22f0da7..a3af5e40c6 100644 --- a/dp/wifi3.0/be/dp_be_rx.c +++ b/dp/wifi3.0/be/dp_be_rx.c @@ -470,6 +470,7 @@ done: nbuf->next = NULL; dp_rx_deliver_to_pkt_capture_no_peer( soc, nbuf, pkt_capture_offload); + if (!pkt_capture_offload) dp_rx_deliver_to_stack_no_peer(soc, nbuf); nbuf = next; diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index f70d4639f7..b655d621a9 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -2066,37 +2066,19 @@ void dp_rx_deliver_to_pkt_capture(struct dp_soc *soc, struct dp_pdev *pdev, uint16_t peer_id, uint32_t is_offload, qdf_nbuf_t netbuf) { - dp_wdi_event_handler(WDI_EVENT_PKT_CAPTURE_RX_DATA, soc, netbuf, - peer_id, is_offload, pdev->pdev_id); + if (wlan_cfg_get_pkt_capture_mode(soc->wlan_cfg_ctx)) + dp_wdi_event_handler(WDI_EVENT_PKT_CAPTURE_RX_DATA, soc, netbuf, + peer_id, is_offload, pdev->pdev_id); } void dp_rx_deliver_to_pkt_capture_no_peer(struct dp_soc *soc, qdf_nbuf_t nbuf, uint32_t is_offload) { - uint16_t msdu_len = 0; - uint16_t peer_id, vdev_id; - uint32_t pkt_len = 0; - uint8_t *rx_tlv_hdr; - struct hal_rx_msdu_metadata msdu_metadata; - - peer_id = QDF_NBUF_CB_RX_PEER_ID(nbuf); - vdev_id = QDF_NBUF_CB_RX_VDEV_ID(nbuf); - rx_tlv_hdr = qdf_nbuf_data(nbuf); - hal_rx_msdu_metadata_get(soc->hal_soc, rx_tlv_hdr, &msdu_metadata); - msdu_len = QDF_NBUF_CB_RX_PKT_LEN(nbuf); - pkt_len = msdu_len + msdu_metadata.l3_hdr_pad + - soc->rx_pkt_tlv_size; - - qdf_nbuf_set_pktlen(nbuf, pkt_len); - dp_rx_skip_tlvs(soc, nbuf, msdu_metadata.l3_hdr_pad); - - dp_wdi_event_handler(WDI_EVENT_PKT_CAPTURE_RX_DATA, soc, nbuf, - HTT_INVALID_VDEV, is_offload, 0); - - qdf_nbuf_push_head(nbuf, msdu_metadata.l3_hdr_pad + - soc->rx_pkt_tlv_size); + if (wlan_cfg_get_pkt_capture_mode(soc->wlan_cfg_ctx)) + dp_wdi_event_handler(WDI_EVENT_PKT_CAPTURE_RX_DATA_NO_PEER, + soc, nbuf, HTT_INVALID_VDEV, + is_offload, 0); } - #endif #endif /* QCA_HOST_MODE_WIFI_DISABLED */ diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 07fed2dc77..20e1edd903 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -1257,6 +1257,10 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc) wlan_soc_ipa_cfg_attach(psoc, wlan_cfg_ctx); wlan_soc_hw_cc_cfg_attach(psoc, wlan_cfg_ctx); wlan_soc_ppe_cfg_attach(psoc, wlan_cfg_ctx); +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + wlan_cfg_ctx->pkt_capture_mode = cfg_get(psoc, CFG_PKT_CAPTURE_MODE) & + PKT_CAPTURE_MODE_DATA_ONLY; +#endif return wlan_cfg_ctx; } @@ -2293,3 +2297,10 @@ wlan_cfg_get_prealloc_cfg(struct cdp_ctrl_objmgr_psoc *ctrl_psoc, cfg->num_tx_desc = cfg_get(ctrl_psoc, CFG_DP_TX_DESC); cfg->num_tx_ext_desc = cfg_get(ctrl_psoc, CFG_DP_TX_EXT_DESC); } + +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +uint32_t wlan_cfg_get_pkt_capture_mode(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->pkt_capture_mode; +} +#endif diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index fe4adba438..8e047689cf 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -226,6 +226,7 @@ struct wlan_srng_cfg { * @ipa_tx_alt_comp_ring_size: IPA tx alt completion ring size * @hw_cc_conv_enabled: cookie conversion enabled * @tcl_wbm_map_array: TCL-WBM map array + * @pkt_capture_mode: Packet capture mode config */ struct wlan_cfg_dp_soc_ctxt { int num_int_ctxts; @@ -366,6 +367,9 @@ struct wlan_cfg_dp_soc_ctxt { int ppe2tcl_ring; int ppe_release_ring; #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + uint32_t pkt_capture_mode; +#endif }; /** @@ -1839,4 +1843,19 @@ wlan_cfg_get_dp_soc_ppe_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); void wlan_cfg_get_prealloc_cfg(struct cdp_ctrl_objmgr_psoc *ctrl_psoc, struct wlan_dp_prealloc_cfg *cfg); +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +/** + * wlan_cfg_get_pkt_capture_mode() - Get packet capture mode config + * @cfg: config context + * + * Return: value of packet capture mode + */ +uint32_t wlan_cfg_get_pkt_capture_mode(struct wlan_cfg_dp_soc_ctxt *cfg); +#else +static inline +uint32_t wlan_cfg_get_pkt_capture_mode(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return 0; +} +#endif #endif