qcacld-3.0: Add INI parameter for packet capture mode support

Add INI parameter for packet capture mode

"packet_capture_mode" - ini to set packet capture mode.

Change-Id: Ie60c142af753c65b44aa0018440e43a215e51a27
CRs-Fixed: 2614578
This commit is contained in:
Vulupala Shashank Reddy
2020-01-26 14:40:33 +05:30
committed by nshrivas
parent 2e9da7605c
commit 6e5c807513
10 changed files with 380 additions and 97 deletions

View File

@@ -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)
/*
* <ini>
* 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
*
* </ini>
*/
#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_ */

View File

@@ -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_ */

View File

@@ -27,6 +27,7 @@
#include <qdf_status.h>
#include <qdf_types.h>
#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_ */

View File

@@ -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");
}