From 47fefb5962aa8d8d7f02dcb62a4885447ae78d22 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Wed, 1 Sep 2021 10:47:49 +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/dp_rx.c | 31 +++++++------------------------ wlan_cfg/wlan_cfg.c | 11 +++++++++++ wlan_cfg/wlan_cfg.h | 20 ++++++++++++++++++++ 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h index 668ae29e98cc..e57858821588 100644 --- a/dp/inc/cdp_txrx_stats_struct.h +++ b/dp/inc/cdp_txrx_stats_struct.h @@ -365,6 +365,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, /* End of new event items */ WDI_EVENT_LAST diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 044736d988cd..4b6615a75a63 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -2250,35 +2250,18 @@ 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 + - RX_PKT_TLVS_LEN; - - qdf_nbuf_set_pktlen(nbuf, pkt_len); - dp_rx_skip_tlvs(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 + - RX_PKT_TLVS_LEN); + 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 diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index aa1a106d4cab..1a7a1958fa9d 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -657,6 +657,10 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc) wlan_cfg_ctx->wow_check_rx_pending_enable = cfg_get(psoc, CFG_DP_WOW_CHECK_RX_PENDING); wlan_soc_ipa_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; } @@ -1540,3 +1544,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 879fae8f2c78..0be13218df9a 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -197,6 +197,7 @@ struct wlan_srng_cfg { * @wow_check_rx_pending_enable: Enable RX frame pending check in WoW * @ipa_tx_ring_size: IPA tx ring size * @ipa_tx_comp_ring_size: IPA tx completion ring size + * @pkt_capture_mode: Packet capture mode config */ struct wlan_cfg_dp_soc_ctxt { int num_int_ctxts; @@ -316,6 +317,9 @@ struct wlan_cfg_dp_soc_ctxt { uint32_t ipa_tx_ring_size; uint32_t ipa_tx_comp_ring_size; #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + uint32_t pkt_capture_mode; +#endif }; /** @@ -1566,4 +1570,20 @@ uint32_t wlan_cfg_ipa_tx_comp_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