Browse Source

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
Alok Kumar 5 years ago
parent
commit
45b9e9c730
4 changed files with 100 additions and 4 deletions
  1. 37 1
      core/cds/inc/cds_api.h
  2. 29 1
      core/cds/src/cds_api.c
  3. 7 1
      core/hdd/inc/wlan_hdd_main.h
  4. 27 1
      core/hdd/src/wlan_hdd_tx_rx.c

+ 37 - 1
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 */

+ 29 - 1
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 */

+ 7 - 1
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
 };
 
 /**

+ 27 - 1
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,