diff --git a/components/cfg/cfg_all.h b/components/cfg/cfg_all.h
index 1933595347..3aa0d3fe91 100644
--- a/components/cfg/cfg_all.h
+++ b/components/cfg/cfg_all.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-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
@@ -46,6 +46,7 @@
#include "hdd_dp_cfg.h"
#include "cfg_legacy_dp.h"
#include "wlan_cfg_blm.h"
+#include "cfg_pkt_capture.h"
/* Maintain Alphabetic order here while adding components */
#define CFG_ALL \
@@ -61,4 +62,5 @@
CFG_NAN_ALL \
CFG_P2P_ALL \
CFG_PMO_ALL \
- CFG_TDLS_ALL
+ CFG_TDLS_ALL \
+ CFG_PKT_CAPTURE_MODE_ALL
diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_main.h b/components/pkt_capture/core/inc/wlan_pkt_capture_main.h
index 053e1083d9..cf92a56894 100644
--- a/components/pkt_capture/core/inc/wlan_pkt_capture_main.h
+++ b/components/pkt_capture/core/inc/wlan_pkt_capture_main.h
@@ -58,7 +58,7 @@
*
* Allocate and attach vdev private object.
*
- * Return: QDF_STATUS status in case of success else return error.
+ * Return: QDF_STATUS
*/
QDF_STATUS
pkt_capture_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg);
@@ -70,9 +70,40 @@ pkt_capture_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg);
*
* Deallocate and detach vdev private object.
*
- * Return QDF_STATUS status in case of success else return error
+ * Return: QDF_STATUS
*/
QDF_STATUS
pkt_capture_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg);
+/**
+ * pkt_capture_get_mode() - get packet capture mode
+ * @psoc: pointer to psoc object
+ *
+ * Return: enum pkt_capture_mode
+ */
+enum pkt_capture_mode pkt_capture_get_mode(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * pkt_capture_psoc_create_notification() - Handler for psoc create notify.
+ * @psoc: psoc which is going to be created by objmgr
+ * @arg: argument for notification handler.
+ *
+ * Allocate and attach psoc private object.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+pkt_capture_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg);
+
+/**
+ * pkt_capture_psoc_destroy_notification() - Handler for psoc destroy notify.
+ * @psoc: psoc which is going to be destroyed by objmgr
+ * @arg: argument for notification handler.
+ *
+ * Deallocate and detach psoc private object.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+pkt_capture_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg);
#endif /* end of _WLAN_PKT_CAPTURE_MAIN_H_ */
diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_objmgr.h b/components/pkt_capture/core/inc/wlan_pkt_capture_objmgr.h
index b89541e83e..4da27aed72 100644
--- a/components/pkt_capture/core/inc/wlan_pkt_capture_objmgr.h
+++ b/components/pkt_capture/core/inc/wlan_pkt_capture_objmgr.h
@@ -54,7 +54,7 @@ QDF_STATUS pkt_capture_vdev_get_ref(struct wlan_objmgr_vdev *vdev)
static inline
void pkt_capture_vdev_put_ref(struct wlan_objmgr_vdev *vdev)
{
- return wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID);
+ wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID);
}
/**
@@ -78,4 +78,52 @@ pkt_capture_vdev_get_priv(struct wlan_objmgr_vdev *vdev)
return vdev_priv;
}
+/**
+ * pkt_capture_psoc_get_ref() - Wrapper to increment pkt_capture ref count
+ * @psoc: psoc object
+ *
+ * Wrapper for pkt_capture to increment ref count after checking valid
+ * object state.
+ *
+ * Return: QDF_STATUS
+ */
+static inline
+QDF_STATUS pkt_capture_psoc_get_ref(struct wlan_objmgr_psoc *psoc)
+{
+ return wlan_objmgr_psoc_try_get_ref(psoc, WLAN_PKT_CAPTURE_ID);
+}
+
+/**
+ * pkt_capture_psoc_put_ref() - Wrapper to decrement pkt_capture ref count
+ * @psoc: psoc object
+ *
+ * Wrapper for pkt_capture to decrement ref count of psoc.
+ *
+ * Return: None
+ */
+static inline
+void pkt_capture_psoc_put_ref(struct wlan_objmgr_psoc *psoc)
+{
+ wlan_objmgr_psoc_release_ref(psoc, WLAN_PKT_CAPTURE_ID);
+}
+
+/**
+ * pkt_capture_psoc_get_priv(): Wrapper to retrieve psoc priv obj
+ * @psoc: psoc pointer
+ *
+ * Wrapper for pkt_capture to get psoc private object pointer.
+ *
+ * Return: pkt_capture psoc private object
+ */
+static inline struct pkt_psoc_priv *
+pkt_capture_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
+{
+ struct pkt_psoc_priv *psoc_priv;
+
+ psoc_priv = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+ WLAN_UMAC_COMP_PKT_CAPTURE);
+ QDF_BUG(psoc_priv);
+
+ return psoc_priv;
+}
#endif /* _WLAN_PKT_CAPTURE_OBJMGR_H */
diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h b/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h
index d7f40c345b..a83b4f5557 100644
--- a/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h
+++ b/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h
@@ -28,6 +28,15 @@
#define _WLAN_PKT_CAPTURE_PRIV_STRUCT_H_
#include "wlan_pkt_capture_objmgr.h"
+#include "wlan_pkt_capture_public_structs.h"
+
+/**
+ * struct pkt_capture_cfg - packet capture cfg to store ini values
+ * @pkt_capture_mode: packet capture mode
+ */
+struct pkt_capture_cfg {
+ enum pkt_capture_mode pkt_capture_mode;
+};
/**
* struct pkt_capture_vdev_priv - Private object to be stored in vdev
@@ -36,4 +45,14 @@
struct pkt_capture_vdev_priv {
struct wlan_objmgr_vdev *vdev;
};
+
+/**
+ * struct pkt_psoc_priv - Private object to be stored in psoc
+ * @psoc: pointer to psoc object
+ * @cfg_param: INI config params for packet capture
+ */
+struct pkt_psoc_priv {
+ struct wlan_objmgr_psoc *psoc;
+ struct pkt_capture_cfg cfg_param;
+};
#endif /* End of _WLAN_PKT_CAPTURE_PRIV_STRUCT_H_ */
diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_main.c b/components/pkt_capture/core/src/wlan_pkt_capture_main.c
index e066a7625e..d64934664f 100644
--- a/components/pkt_capture/core/src/wlan_pkt_capture_main.c
+++ b/components/pkt_capture/core/src/wlan_pkt_capture_main.c
@@ -22,16 +22,43 @@
*/
#include "wlan_pkt_capture_main.h"
+#include "cfg_ucfg_api.h"
+
+enum pkt_capture_mode pkt_capture_get_mode(struct wlan_objmgr_psoc *psoc)
+{
+ struct pkt_psoc_priv *psoc_priv;
+
+ if (!psoc) {
+ pkt_capture_err("psoc is NULL");
+ return PACKET_CAPTURE_MODE_DISABLE;
+ }
+
+ psoc_priv = pkt_capture_psoc_get_priv(psoc);
+ if (!psoc_priv) {
+ pkt_capture_err("psoc_priv is NULL");
+ return PACKET_CAPTURE_MODE_DISABLE;
+ }
+
+ return psoc_priv->cfg_param.pkt_capture_mode;
+}
/**
- * pkt_capture_vdev_create_notification() - Handler for vdev create notify.
- * @vdev: vdev which is going to be created by objmgr
- * @arg: argument for notification handler.
+ * pkt_capture_cfg_init() - Initialize packet capture cfg ini params
+ * @psoc_priv: psoc private object
*
- * Allocate and attach vdev private object.
- *
- * Return: QDF_STATUS status in case of success else return error.
+ * Return: None
*/
+static void
+pkt_capture_cfg_init(struct pkt_psoc_priv *psoc_priv)
+{
+ struct pkt_capture_cfg *cfg_param;
+
+ cfg_param = &psoc_priv->cfg_param;
+
+ cfg_param->pkt_capture_mode = cfg_get(psoc_priv->psoc,
+ CFG_PKT_CAPTURE_MODE);
+}
+
QDF_STATUS
pkt_capture_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
{
@@ -39,59 +66,97 @@ pkt_capture_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
QDF_STATUS status;
vdev_priv = qdf_mem_malloc(sizeof(*vdev_priv));
- if (!vdev_priv) {
- status = QDF_STATUS_E_NOMEM;
- goto exit;
- }
+ if (!vdev_priv)
+ return QDF_STATUS_E_NOMEM;
status = wlan_objmgr_vdev_component_obj_attach(
vdev,
WLAN_UMAC_COMP_PKT_CAPTURE,
- (void *)vdev_priv, QDF_STATUS_SUCCESS);
- if (!QDF_IS_STATUS_SUCCESS(status)) {
- pkt_capture_err("Failed to attach priv with vdev");
+ vdev_priv, QDF_STATUS_SUCCESS);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pkt_capture_err("Failed to attach vdev component obj");
goto free_vdev_priv;
}
vdev_priv->vdev = vdev;
- goto exit;
+ return status;
free_vdev_priv:
qdf_mem_free(vdev_priv);
- status = QDF_STATUS_E_INVAL;
-exit:
return status;
}
-/**
- * pkt_capture_vdev_destroy_notification() - Handler for vdev destroy notify.
- * @vdev: vdev which is going to be destroyed by objmgr
- * @arg: argument for notification handler.
- *
- * Deallocate and detach vdev private object.
- *
- * Return QDF_STATUS status in case of success else return error
- */
QDF_STATUS
pkt_capture_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
{
- struct pkt_capture_vdev_priv *vdev_priv = NULL;
- QDF_STATUS status = QDF_STATUS_E_FAILURE;
+ struct pkt_capture_vdev_priv *vdev_priv;
+ QDF_STATUS status;
vdev_priv = pkt_capture_vdev_get_priv(vdev);
if (!vdev_priv) {
pkt_capture_err("vdev priv is NULL");
- goto exit;
+ return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_vdev_component_obj_detach(
vdev,
WLAN_UMAC_COMP_PKT_CAPTURE,
- (void *)vdev_priv);
- if (!QDF_IS_STATUS_SUCCESS(status))
- pkt_capture_err("Failed to detach priv with psoc");
+ vdev_priv);
+ if (QDF_IS_STATUS_ERROR(status))
+ pkt_capture_err("Failed to detach vdev component obj");
qdf_mem_free(vdev_priv);
-exit:
+ return status;
+}
+
+QDF_STATUS
+pkt_capture_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg)
+{
+ struct pkt_psoc_priv *psoc_priv;
+ QDF_STATUS status;
+
+ psoc_priv = qdf_mem_malloc(sizeof(*psoc_priv));
+ if (!psoc_priv)
+ return QDF_STATUS_E_NOMEM;
+
+ status = wlan_objmgr_psoc_component_obj_attach(psoc,
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ psoc_priv, QDF_STATUS_SUCCESS);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pkt_capture_err("Failed to attach psoc component obj");
+ goto free_psoc_priv;
+ }
+
+ psoc_priv->psoc = psoc;
+ pkt_capture_cfg_init(psoc_priv);
+
+ return status;
+
+free_psoc_priv:
+ qdf_mem_free(psoc_priv);
+ return status;
+}
+
+QDF_STATUS
+pkt_capture_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg)
+{
+ struct pkt_psoc_priv *psoc_priv;
+ QDF_STATUS status;
+
+ psoc_priv = pkt_capture_psoc_get_priv(psoc);
+ if (!psoc_priv) {
+ pkt_capture_err("psoc priv is NULL");
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ status = wlan_objmgr_psoc_component_obj_detach(psoc,
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ psoc_priv);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pkt_capture_err("Failed to detach psoc component obj");
+ return status;
+ }
+
+ qdf_mem_free(psoc_priv);
return status;
}
diff --git a/components/pkt_capture/dispatcher/inc/cfg_pkt_capture.h b/components/pkt_capture/dispatcher/inc/cfg_pkt_capture.h
new file mode 100644
index 0000000000..08a2f116b6
--- /dev/null
+++ b/components/pkt_capture/dispatcher/inc/cfg_pkt_capture.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _CFG_PKT_CAPTURE_H_
+#define _CFG_PKT_CAPTURE_H_
+
+#ifdef WLAN_FEATURE_PKT_CAPTURE
+
+#define CFG_PKT_CAPTURE_MODE_DEFAULT (0)
+#define CFG_PKT_CAPTURE_MODE_MGMT_PKT BIT(0)
+#define CFG_PKT_CAPTURE_MODE_DATA_PKT BIT(1)
+#define CFG_PKT_CAPTURE_MODE_MAX (CFG_PKT_CAPTURE_MODE_MGMT_PKT | \
+ CFG_PKT_CAPTURE_MODE_DATA_PKT)
+
+/*
+ *
+ * packet_capture_mode - Packet capture mode
+ * @Min: 0
+ * @Max: 3
+ * Default: 0 - Capture no packets
+ *
+ * This ini is used to decide packet capture mode
+ *
+ * packet_capture_mode = 0 - Capture no packets
+ * packet_capture_mode = 1 - Capture management packets only
+ * packet_capture_mode = 2 - Capture data packets only
+ * packet_capture_mode = 3 - Capture both data and management packets
+ *
+ * Supported Feature: packet capture
+ *
+ * Usage: External
+ *
+ *
+ */
+#define CFG_PKT_CAPTURE_MODE \
+ CFG_INI_UINT("packet_capture_mode", \
+ 0, \
+ CFG_PKT_CAPTURE_MODE_MAX, \
+ CFG_PKT_CAPTURE_MODE_DEFAULT, \
+ CFG_VALUE_OR_DEFAULT, \
+ "Value for packet capture mode")
+
+#define CFG_PKT_CAPTURE_MODE_ALL \
+ CFG(CFG_PKT_CAPTURE_MODE)
+#else
+#define CFG_PKT_CAPTURE_MODE_ALL
+#endif /* WLAN_FEATURE_PKT_CAPTURE */
+#endif /* _CFG_PKT_CAPTURE_H_ */
diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h
new file mode 100644
index 0000000000..86f286c7bd
--- /dev/null
+++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_
+#define _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_
+
+/**
+ * enum pkt_capture_mode - packet capture modes
+ * @PACKET_CAPTURE_MODE_DISABLE: packet capture mode disable
+ * @PACKET_CAPTURE_MODE_MGMT_ONLY: capture mgmt packets only
+ * @PACKET_CAPTURE_MODE_DATA_ONLY: capture data packets only
+ * @PACKET_CAPTURE_MODE_DATA_MGMT: capture both data and mgmt packets
+ */
+enum pkt_capture_mode {
+ PACKET_CAPTURE_MODE_DISABLE = 0,
+ PACKET_CAPTURE_MODE_MGMT_ONLY,
+ PACKET_CAPTURE_MODE_DATA_ONLY,
+ PACKET_CAPTURE_MODE_DATA_MGMT,
+};
+
+#endif /* _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_ */
diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h
index a9ce41289f..bc12c61e66 100644
--- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h
+++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h
@@ -27,6 +27,7 @@
#include
#include
#include "wlan_pkt_capture_objmgr.h"
+#include "wlan_pkt_capture_public_structs.h"
#ifdef WLAN_FEATURE_PKT_CAPTURE
/**
@@ -34,7 +35,7 @@
*
* This function gets called when packet capture initializing.
*
- * Return: QDF_STATUS_SUCCESS - in case of success.
+ * Return: QDF_STATUS
*/
QDF_STATUS ucfg_pkt_capture_init(void);
@@ -46,6 +47,14 @@ QDF_STATUS ucfg_pkt_capture_init(void);
* Return: None
*/
void ucfg_pkt_capture_deinit(void);
+
+/**
+ * ucfg_pkt_capture_get_mode() - get packet capture mode
+ * @psoc: pointer to psoc object
+ *
+ * Return: enum pkt_capture_mode
+ */
+enum pkt_capture_mode ucfg_pkt_capture_get_mode(struct wlan_objmgr_psoc *psoc);
#else
static inline
QDF_STATUS ucfg_pkt_capture_init(void)
@@ -57,5 +66,11 @@ static inline
void ucfg_pkt_capture_deinit(void)
{
}
+
+static inline
+enum pkt_capture_mode ucfg_pkt_capture_get_mode(struct wlan_objmgr_psoc *psoc)
+{
+ return PACKET_CAPTURE_MODE_DISABLE;
+}
#endif /* WLAN_FEATURE_PKT_CAPTURE */
#endif /* _WLAN_PKT_CAPTURE_UCFG_API_H_ */
diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c
index 1a9665e85e..e16e09dbde 100644
--- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c
+++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c
@@ -24,63 +24,93 @@
#include "wlan_pkt_capture_main.h"
#include "wlan_pkt_capture_ucfg_api.h"
-/**
- * ucfg_pkt_capture_init() - Packet capture component initialization.
- *
- * This function gets called when packet capture initializing.
- *
- * Return: QDF_STATUS_SUCCESS - in case of success.
- */
+enum pkt_capture_mode ucfg_pkt_capture_get_mode(struct wlan_objmgr_psoc *psoc)
+{
+ return pkt_capture_get_mode(psoc);
+}
+
QDF_STATUS ucfg_pkt_capture_init(void)
{
QDF_STATUS status;
+ status = wlan_objmgr_register_psoc_create_handler(
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_psoc_create_notification,
+ NULL);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pkt_capture_err("Failed to register psoc create handler");
+ return status;
+ }
+
+ status = wlan_objmgr_register_psoc_destroy_handler(
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_psoc_destroy_notification,
+ NULL);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pkt_capture_err("Failed to register psoc delete handler");
+ goto fail_destroy_psoc;
+ }
+
status = wlan_objmgr_register_vdev_create_handler(
WLAN_UMAC_COMP_PKT_CAPTURE,
pkt_capture_vdev_create_notification, NULL);
- if (!QDF_IS_STATUS_SUCCESS(status)) {
+ if (QDF_IS_STATUS_ERROR(status)) {
pkt_capture_err("Failed to register vdev create handler");
- goto exit;
+ goto fail_create_vdev;
}
status = wlan_objmgr_register_vdev_destroy_handler(
WLAN_UMAC_COMP_PKT_CAPTURE,
pkt_capture_vdev_destroy_notification, NULL);
- if (QDF_IS_STATUS_SUCCESS(status)) {
- pkt_capture_debug("vdev create/del notifications registered");
- goto exit;
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pkt_capture_err("Failed to register vdev destroy handler");
+ goto fail_destroy_vdev;
}
+ return status;
+
+fail_destroy_vdev:
+ wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_vdev_create_notification, NULL);
+
+fail_create_vdev:
+ wlan_objmgr_unregister_psoc_destroy_handler(WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_psoc_destroy_notification, NULL);
+
+fail_destroy_psoc:
+ wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_psoc_create_notification, NULL);
- pkt_capture_err("Failed to register vdev delete handler");
- wlan_objmgr_unregister_vdev_create_handler(
- WLAN_UMAC_COMP_PKT_CAPTURE,
- pkt_capture_vdev_create_notification,
- NULL);
-exit:
return status;
}
-/**
- * ucfg_pkt_capture_deinit() - Packet capture component de-init.
- *
- * This function gets called when packet capture de-init.
- *
- * Return: None
- */
void ucfg_pkt_capture_deinit(void)
{
QDF_STATUS status;
- status = wlan_objmgr_unregister_vdev_create_handler(
- WLAN_UMAC_COMP_PKT_CAPTURE,
- pkt_capture_vdev_create_notification, NULL);
- if (!QDF_IS_STATUS_SUCCESS(status))
- pkt_capture_err("Failed to unregister vdev create handler");
-
status = wlan_objmgr_unregister_vdev_destroy_handler(
WLAN_UMAC_COMP_PKT_CAPTURE,
pkt_capture_vdev_destroy_notification,
NULL);
- if (!QDF_IS_STATUS_SUCCESS(status))
- pkt_capture_err("Failed to unregister vdev delete handler");
+ if (QDF_IS_STATUS_ERROR(status))
+ pkt_capture_err("Failed to unregister vdev destroy handler");
+
+ status = wlan_objmgr_unregister_vdev_create_handler(
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_vdev_create_notification, NULL);
+ if (QDF_IS_STATUS_ERROR(status))
+ pkt_capture_err("Failed to unregister vdev create handler");
+
+ status = wlan_objmgr_unregister_psoc_destroy_handler(
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_psoc_destroy_notification,
+ NULL);
+ if (QDF_IS_STATUS_ERROR(status))
+ pkt_capture_err("Failed to unregister psoc destroy handler");
+
+ status = wlan_objmgr_unregister_psoc_create_handler(
+ WLAN_UMAC_COMP_PKT_CAPTURE,
+ pkt_capture_psoc_create_notification,
+ NULL);
+ if (QDF_IS_STATUS_ERROR(status))
+ pkt_capture_err("Failed to unregister psoc create handler");
}
diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c
index 5c02988392..431dc04580 100644
--- a/core/hdd/src/wlan_hdd_tx_rx.c
+++ b/core/hdd/src/wlan_hdd_tx_rx.c
@@ -3193,31 +3193,6 @@ 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)
{
@@ -3253,7 +3228,6 @@ 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,