From 45b9e9c730cc9aebc3f1586945fe1f67e937a09d Mon Sep 17 00:00:00 2001 From: Alok Kumar Date: Mon, 22 Jul 2019 17:53:00 +0530 Subject: [PATCH] qcacld-3.0: Add CDS API to update parameter for pkt capture mode Update packet capture mode param in the HDD context after reading the INI parameter. Change-Id: I3ea88e376f1ad8ebc96715d08395331470c23d4a CRs-Fixed: 2528536 --- core/cds/inc/cds_api.h | 38 ++++++++++++++++++++++++++++++++++- core/cds/src/cds_api.c | 30 ++++++++++++++++++++++++++- core/hdd/inc/wlan_hdd_main.h | 8 +++++++- core/hdd/src/wlan_hdd_tx_rx.c | 28 +++++++++++++++++++++++++- 4 files changed, 100 insertions(+), 4 deletions(-) diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index 3f5f089f2f95..473f6095e74e 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2020 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 @@ -551,4 +551,40 @@ QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present); * Return: Status of map operation */ int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); + +#ifdef WLAN_FEATURE_PKT_CAPTURE +/** + * cds_is_pktcapture_enabled() - is packet capture support enabled + * + * Check is packet capture mode enabled from ini + * + * Return: 0 - disable, 1 - enable + */ +bool cds_is_pktcapture_enabled(void); + +/** + * cds_get_pktcapture_mode() - get pktcapture mode value + * + * Get the pktcapture mode value from hdd context + * + * Return: 0 - disable + * 1 - Mgmt packets + * 2 - Data packets + * 3 - Both Mgmt and Data packets + */ +uint8_t cds_get_pktcapture_mode(void); +#else +static inline +bool cds_is_pktcapture_enabled(void) +{ + return false; +} + +static inline +uint8_t cds_get_pktcapture_mode(void) +{ + return 0; +} +#endif /* WLAN_FEATURE_PKT_CAPTURE */ + #endif /* if !defined __CDS_API_H */ diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 319790fd459f..97aeefbad11b 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 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 @@ -2886,3 +2886,31 @@ int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) return 0; } #endif + +#ifdef WLAN_FEATURE_PKT_CAPTURE +bool cds_is_pktcapture_enabled(void) +{ + struct hdd_context *hdd_ctx; + + hdd_ctx = gp_cds_context->hdd_context; + if (!hdd_ctx) { + cds_err("HDD context is NULL"); + return false; + } + + return hdd_ctx->enable_pkt_capture_support; +} + +uint8_t cds_get_pktcapture_mode(void) +{ + struct hdd_context *hdd_ctx; + + hdd_ctx = gp_cds_context->hdd_context; + if (!hdd_ctx) { + cds_err("HDD context is NULL"); + return false; + } + + return hdd_ctx->val_pkt_capture_mode; +} +#endif /* WLAN_FEATURE_PKT_CAPTURE */ diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 970087c1986d..a004ef19e3b6 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 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 @@ -1882,6 +1882,12 @@ struct hdd_context { (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 19, 0)) struct pm_qos_request pm_qos_req; #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE + /* enable packet capture support */ + bool enable_pkt_capture_support; + /* value for packet capturte mode */ + uint8_t val_pkt_capture_mode; +#endif }; /** diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 188aae02b5e4..c81dc6d606e6 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 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 @@ -3163,6 +3163,31 @@ static void hdd_dp_hl_bundle_cfg_update(struct hdd_config *config, } #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE +/** + * hdd_set_pktcapture_mode_value() - set pktcapture_mode values + * @hdd_ctx: hdd context + * @psoc: pointer to psoc obj + * + * Return: none + */ +static inline void +hdd_dp_pktcapture_mode_cfg_update(struct hdd_context *hdd_ctx, + struct wlan_objmgr_psoc *psoc) +{ + hdd_ctx->enable_pkt_capture_support = cfg_get( + psoc, CFG_DP_PKT_CAPTURE_MODE_ENABLE); + hdd_ctx->val_pkt_capture_mode = cfg_get( + psoc, CFG_DP_PKT_CAPTURE_MODE_VALUE); +} +#else +static inline void +hdd_dp_pktcapture_mode_cfg_update(struct hdd_context *hdd_ctx, + struct wlan_objmgr_psoc *psoc) +{ +} +#endif /* WLAN_FEATURE_PKT_CAPTURE */ + void hdd_dp_cfg_update(struct wlan_objmgr_psoc *psoc, struct hdd_context *hdd_ctx) { @@ -3198,6 +3223,7 @@ void hdd_dp_cfg_update(struct wlan_objmgr_psoc *psoc, config->cfg_wmi_credit_cnt = cfg_get(psoc, CFG_DP_HTC_WMI_CREDIT_CNT); hdd_dp_dp_trace_cfg_update(config, psoc); hdd_dp_nud_tracking_cfg_update(config, psoc); + hdd_dp_pktcapture_mode_cfg_update(hdd_ctx, psoc); } bool wlan_hdd_rx_rpm_mark_last_busy(struct hdd_context *hdd_ctx,