qcacld-3.0: Add sysfs entry for dump_dp_trace
Add the sysfs entry for dumpStats and clearStats. Previously these commands would be queried via iwpriv enable / disable --> iwpriv wlan0 dump_dp_trace [1/3] show --> iwpriv wlan0 dump_dp_trace 0 clear --> iwpriv wlan0 dump_dp_trace 2 it is now changed to support via sysfs: enable / disable --> echo [1/0] > /sys/kernel/wifi/dump_dp_trace show --> echo 2 [count] > /sys/kernel/wifi/dump_dp_trace cat /sys/kernel/wifi/dump_dp_trace clear --> echo 1 > /sys/kernel/wifi/clear_dp_trace Change-Id: I2e7caec268776a79d7166020c64af93fee2f8aec CRs-Fixed: 2691705
This commit is contained in:
parent
2f03788ba1
commit
e95713a94e
6
Kbuild
6
Kbuild
@ -325,8 +325,8 @@ endif
|
||||
ifeq ($(CONFIG_WLAN_TXRX_STATS), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_txrx_stats.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_SET_DP_TRACE), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_dp_trace.o
|
||||
ifeq ($(CONFIG_WLAN_SYSFS_DP_TRACE), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_dp_trace.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_GET_RANGE_EXT), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_range_ext.o
|
||||
@ -2591,7 +2591,7 @@ cppflags-$(CONFIG_WLAN_SET_RADAR) += -DCONFIG_WLAN_SET_RADAR
|
||||
cppflags-$(CONFIG_WLAN_SYSFS_RTS_CTS) += -DWLAN_SYSFS_RTS_CTS
|
||||
cppflags-$(CONFIG_WLAN_TXRX_FW_STATS) += -DCONFIG_WLAN_TXRX_FW_STATS
|
||||
cppflags-$(CONFIG_WLAN_TXRX_STATS) += -DCONFIG_WLAN_TXRX_STATS
|
||||
cppflags-$(CONFIG_WLAN_SET_DP_TRACE) += -DCONFIG_WLAN_SET_DP_TRACE
|
||||
cppflags-$(CONFIG_WLAN_SYSFS_DP_TRACE) += -DWLAN_SYSFS_DP_TRACE
|
||||
cppflags-$(CONFIG_WLAN_GET_RANGE_EXT) += -DCONFIG_WLAN_GET_RANGE_EXT
|
||||
cppflags-$(CONFIG_WLAN_GET_TEMP) += -DCONFIG_WLAN_GET_TEMP
|
||||
cppflags-$(CONFIG_WLAN_THERMAL_CFG) += -DCONFIG_WLAN_THERMAL_CFG
|
||||
|
@ -196,7 +196,9 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
|
||||
CONFIG_WLAN_SYSFS_RTS_CTS := y
|
||||
CONFIG_WLAN_TXRX_FW_STATS := y
|
||||
CONFIG_WLAN_TXRX_STATS := y
|
||||
CONFIG_WLAN_SET_DP_TRACE := y
|
||||
ifeq ($(CONFIG_DP_TRACE), y)
|
||||
CONFIG_WLAN_SYSFS_DP_TRACE := y
|
||||
endif
|
||||
CONFIG_WLAN_GET_RANGE_EXT := y
|
||||
ifeq ($(CONFIG_QCOM_TDLS), y)
|
||||
CONFIG_WLAN_GET_TDLS_PEERS := y
|
||||
|
@ -63,7 +63,7 @@
|
||||
#include <wlan_hdd_sysfs_rts_cts.h>
|
||||
#include <wlan_hdd_sysfs_txrx_fw_stats.h>
|
||||
#include <wlan_hdd_sysfs_txrx_stats.h>
|
||||
#include <wlan_hdd_sysfs_set_dp_trace.h>
|
||||
#include <wlan_hdd_sysfs_dp_trace.h>
|
||||
#include <wlan_hdd_sysfs_get_range_ext.h>
|
||||
#include <wlan_hdd_sysfs_get_tdls_peers.h>
|
||||
#include <wlan_hdd_sysfs_get_temp.h>
|
||||
@ -761,7 +761,7 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
|
||||
hdd_sysfs_wow_ito_create(driver_kobject);
|
||||
hdd_sysfs_set_wlan_dbg_create(driver_kobject);
|
||||
hdd_sysfs_set_scan_cfg_create(driver_kobject);
|
||||
hdd_sysfs_set_dp_trace_create(driver_kobject);
|
||||
hdd_sysfs_dp_trace_create(driver_kobject);
|
||||
hdd_sysfs_thermal_cfg_create(driver_kobject);
|
||||
}
|
||||
}
|
||||
@ -770,7 +770,7 @@ void hdd_destroy_sysfs_files(void)
|
||||
{
|
||||
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
||||
hdd_sysfs_thermal_cfg_destroy(driver_kobject);
|
||||
hdd_sysfs_set_dp_trace_destroy(driver_kobject);
|
||||
hdd_sysfs_dp_trace_destroy(driver_kobject);
|
||||
hdd_sysfs_set_scan_cfg_destroy(driver_kobject);
|
||||
hdd_sysfs_set_wlan_dbg_destroy(driver_kobject);
|
||||
hdd_sysfs_wow_ito_destroy(driver_kobject);
|
||||
|
337
core/hdd/src/wlan_hdd_sysfs_dp_trace.c
Normal file
337
core/hdd/src/wlan_hdd_sysfs_dp_trace.c
Normal file
@ -0,0 +1,337 @@
|
||||
/*
|
||||
* Copyright (c) 2011-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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_dp_trace.c
|
||||
*
|
||||
* implementation for creating sysfs files:
|
||||
*
|
||||
* set_dp_trace
|
||||
* dump_dp_trace
|
||||
* clear_dp_trace
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include "osif_psoc_sync.h"
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include <wlan_hdd_sysfs_dp_trace.h>
|
||||
#include "qdf_trace.h"
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_set_dp_trace_store(struct hdd_context *hdd_ctx,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
char *sptr, *token;
|
||||
uint32_t val1;
|
||||
uint8_t val2, val3;
|
||||
int ret;
|
||||
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_validate_and_copy_buf(buf_local, sizeof(buf_local),
|
||||
buf, count);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("invalid input");
|
||||
return ret;
|
||||
}
|
||||
|
||||
sptr = buf_local;
|
||||
hdd_debug("set_dp_trace: count %zu buf_local:(%s)",
|
||||
count, buf_local);
|
||||
|
||||
/* Get val1 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val1))
|
||||
return -EINVAL;
|
||||
|
||||
/* Get val2 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &val2))
|
||||
return -EINVAL;
|
||||
|
||||
/* Get val3 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &val3))
|
||||
return -EINVAL;
|
||||
|
||||
qdf_dp_trace_set_value(val1, val2, val3);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_set_dp_trace_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
ssize_t errno_size;
|
||||
int ret;
|
||||
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
||||
&psoc_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_set_dp_trace_store(hdd_ctx, attr,
|
||||
buf, count);
|
||||
|
||||
osif_psoc_sync_op_stop(psoc_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static struct kobj_attribute set_dp_trace_attribute =
|
||||
__ATTR(set_dp_trace, 0220, NULL,
|
||||
hdd_sysfs_set_dp_trace_store);
|
||||
|
||||
static uint32_t dump_dp_trace_count = 0;
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dump_dp_trace_store(struct hdd_context *hdd_ctx,
|
||||
struct kobj_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
char *sptr, *token;
|
||||
int value, ret;
|
||||
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_validate_and_copy_buf(buf_local, sizeof(buf_local),
|
||||
buf, count);
|
||||
if (ret) {
|
||||
hdd_err_rl("invalid input");
|
||||
return ret;
|
||||
}
|
||||
|
||||
sptr = buf_local;
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
hdd_debug("dump_dp_trace %d", value);
|
||||
|
||||
switch (value) {
|
||||
case HDD_SYSFS_DISABLE_DP_TRACE_LIVE_MODE:
|
||||
qdf_dp_trace_disable_live_mode();
|
||||
break;
|
||||
case HDD_SYSFS_ENABLE_DP_TRACE_LIVE_MODE:
|
||||
qdf_dp_trace_enable_live_mode();
|
||||
break;
|
||||
case HDD_SYSFS_DUMP_DP_TRACE:
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &dump_dp_trace_count))
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
hdd_err_rl("invalid input");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t hdd_sysfs_dump_dp_trace_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
ssize_t errno_size;
|
||||
int ret;
|
||||
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
||||
&psoc_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dump_dp_trace_store(hdd_ctx, attr,
|
||||
buf, count);
|
||||
|
||||
osif_psoc_sync_op_stop(psoc_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dump_dp_trace_show(struct hdd_context *hdd_ctx,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
qdf_dp_trace_dump_all(dump_dp_trace_count, QDF_TRACE_DEFAULT_PDEV_ID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t hdd_sysfs_dump_dp_trace_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
ssize_t errno_size;
|
||||
int ret;
|
||||
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
||||
&psoc_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dump_dp_trace_show(hdd_ctx, attr, buf);
|
||||
|
||||
osif_psoc_sync_op_stop(psoc_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static struct kobj_attribute dump_dp_trace_attribute =
|
||||
__ATTR(dump_dp_trace, 0660, hdd_sysfs_dump_dp_trace_show,
|
||||
hdd_sysfs_dump_dp_trace_store);
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_clear_dp_trace_store(struct hdd_context *hdd_ctx,
|
||||
struct kobj_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
char *sptr, *token;
|
||||
int value, ret;
|
||||
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_validate_and_copy_buf(buf_local, sizeof(buf_local),
|
||||
buf, count);
|
||||
if (ret) {
|
||||
hdd_err_rl("invalid input");
|
||||
return ret;
|
||||
}
|
||||
|
||||
sptr = buf_local;
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
hdd_debug("clear_dp_trace %d", value);
|
||||
|
||||
qdf_dp_trace_clear_buffer();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_clear_dp_trace_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
ssize_t errno_size;
|
||||
int ret;
|
||||
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
||||
&psoc_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_clear_dp_trace_store(hdd_ctx, attr,
|
||||
buf, count);
|
||||
|
||||
osif_psoc_sync_op_stop(psoc_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static struct kobj_attribute clear_dp_trace_attribute =
|
||||
__ATTR(clear_dp_trace, 0220, NULL,
|
||||
hdd_sysfs_clear_dp_trace_store);
|
||||
|
||||
int hdd_sysfs_dp_trace_create(struct kobject *driver_kobject)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (!driver_kobject) {
|
||||
hdd_err("could not get driver kobject!");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
error = sysfs_create_file(driver_kobject,
|
||||
&set_dp_trace_attribute.attr);
|
||||
if (error)
|
||||
hdd_err("could not create set_dp_trace sysfs file");
|
||||
|
||||
error = sysfs_create_file(driver_kobject,
|
||||
&dump_dp_trace_attribute.attr);
|
||||
if (error)
|
||||
hdd_err("could not create dump_dp_trace sysfs file");
|
||||
|
||||
error = sysfs_create_file(driver_kobject,
|
||||
&clear_dp_trace_attribute.attr);
|
||||
if (error)
|
||||
hdd_err("could not create clear_dp_trace sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
hdd_sysfs_dp_trace_destroy(struct kobject *driver_kobject)
|
||||
{
|
||||
if (!driver_kobject) {
|
||||
hdd_err("could not get driver kobject!");
|
||||
return;
|
||||
}
|
||||
sysfs_remove_file(driver_kobject, &set_dp_trace_attribute.attr);
|
||||
sysfs_remove_file(driver_kobject, &clear_dp_trace_attribute.attr);
|
||||
}
|
@ -15,46 +15,61 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_set_dp_trace.h
|
||||
* DOC: wlan_hdd_sysfs_dp_trace.h
|
||||
*
|
||||
* implementation for creating sysfs file set_dp_trace
|
||||
* implementation for creating sysfs files:
|
||||
*
|
||||
* set_dp_trace
|
||||
* dump_dp_trace
|
||||
* clear_dp_trace
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_SET_DP_TRACE_H
|
||||
#define _WLAN_HDD_SYSFS_SET_DP_TRACE_H
|
||||
#ifndef _WLAN_HDD_SYSFS_DP_TRACE_H
|
||||
#define _WLAN_HDD_SYSFS_DP_TRACE_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(WLAN_SYSFS_DP_TRACE)
|
||||
|
||||
#define HDD_SYSFS_DISABLE_DP_TRACE_LIVE_MODE 0
|
||||
#define HDD_SYSFS_ENABLE_DP_TRACE_LIVE_MODE 1
|
||||
#define HDD_SYSFS_DUMP_DP_TRACE 2
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_SET_DP_TRACE)
|
||||
/**
|
||||
* hdd_sysfs_set_dp_trace_create() - API to create set_dp_trace
|
||||
* hdd_sysfs_dp_trace_create() - API to create dp trace related files
|
||||
* @driver_kobject: sysfs driver kobject
|
||||
*
|
||||
* file path: /sys/kernel/wifi/set_dp_trace
|
||||
* /sys/kernel/wifi/dump_dp_trace
|
||||
* /sys/kernel/wifi/clear_dp_trace
|
||||
*
|
||||
* usage:
|
||||
* echo [arg_0] [arg_1] [arg_2]> set_dp_trace
|
||||
* echo [0/1] > dump_dp_trace
|
||||
* echo 2 [count] > dump_dp_trace
|
||||
* cat dump_dp_trace
|
||||
* echo 1 > clear_dp_trace
|
||||
*
|
||||
* Return: 0 on success and errno on failure
|
||||
*/
|
||||
int hdd_sysfs_set_dp_trace_create(struct kobject *driver_kobject);
|
||||
int hdd_sysfs_dp_trace_create(struct kobject *driver_kobject);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_set_dp_trace_destroy() -
|
||||
* API to destroy set_dp_trace
|
||||
* hdd_sysfs_dp_trace_destroy() -
|
||||
* API to destroy dp trace related files
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void
|
||||
hdd_sysfs_set_dp_trace_destroy(struct kobject *driver_kobject);
|
||||
hdd_sysfs_dp_trace_destroy(struct kobject *driver_kobject);
|
||||
#else
|
||||
static inline int
|
||||
hdd_sysfs_set_dp_trace_create(struct kobject *driver_kobject)
|
||||
hdd_sysfs_dp_trace_create(struct kobject *driver_kobject)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hdd_sysfs_set_dp_trace_destroy(struct kobject *driver_kobject)
|
||||
hdd_sysfs_dp_trace_destroy(struct kobject *driver_kobject)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_SET_DP_TRACE_H */
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_DP_TRACE_H */
|
@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_set_dp_trace.c
|
||||
*
|
||||
* implementation for creating sysfs file set_dp_trace
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include "osif_psoc_sync.h"
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include <wlan_hdd_sysfs_set_dp_trace.h>
|
||||
#include "qdf_trace.h"
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_set_dp_trace_store(struct hdd_context *hdd_ctx,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
char *sptr, *token;
|
||||
uint32_t val1;
|
||||
uint8_t val2, val3;
|
||||
int ret;
|
||||
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_validate_and_copy_buf(buf_local, sizeof(buf_local),
|
||||
buf, count);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("invalid input");
|
||||
return ret;
|
||||
}
|
||||
|
||||
sptr = buf_local;
|
||||
hdd_debug("set_dp_trace: count %zu buf_local:(%s)",
|
||||
count, buf_local);
|
||||
|
||||
/* Get val1 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val1))
|
||||
return -EINVAL;
|
||||
|
||||
/* Get val2 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &val2))
|
||||
return -EINVAL;
|
||||
|
||||
/* Get val3 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &val3))
|
||||
return -EINVAL;
|
||||
|
||||
qdf_dp_trace_set_value(val1, val2, val3);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_set_dp_trace_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
ssize_t errno_size;
|
||||
int ret;
|
||||
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
||||
&psoc_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_set_dp_trace_store(hdd_ctx, attr,
|
||||
buf, count);
|
||||
|
||||
osif_psoc_sync_op_stop(psoc_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static struct kobj_attribute set_dp_trace_attribute =
|
||||
__ATTR(set_dp_trace, 0220, NULL,
|
||||
hdd_sysfs_set_dp_trace_store);
|
||||
|
||||
int hdd_sysfs_set_dp_trace_create(struct kobject *driver_kobject)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (!driver_kobject) {
|
||||
hdd_err("could not get driver kobject!");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
error = sysfs_create_file(driver_kobject,
|
||||
&set_dp_trace_attribute.attr);
|
||||
if (error)
|
||||
hdd_err("could not create set_dp_trace sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
hdd_sysfs_set_dp_trace_destroy(struct kobject *driver_kobject)
|
||||
{
|
||||
if (!driver_kobject) {
|
||||
hdd_err("could not get driver kobject!");
|
||||
return;
|
||||
}
|
||||
sysfs_remove_file(driver_kobject, &set_dp_trace_attribute.attr);
|
||||
}
|
Loading…
Reference in New Issue
Block a user