qcacld-3.0: Add a sysfs replacement for setwlandbg

As part of WEXT replacement, replace setwlandbg with a sysfs file.

file path: /sys/kernel/wifi/set_wlan_dbg

example: echo 1 1 1 > /sys/kernel/wifi/set_wlan_dbg

Change-Id: I886bcd0ed89460e20db1ea809fa48e3a279bb39b
CRs-Fixed: 2686081
Esse commit está contido em:
Aditya Kodukula
2020-05-14 01:50:36 -07:00
commit de nshrivas
commit 029a02db1a
5 arquivos alterados com 201 adições e 0 exclusões

4
Kbuild
Ver arquivo

@@ -333,6 +333,9 @@ endif
ifeq ($(CONFIG_FEATURE_MOTION_DETECTION), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_motion_detection.o
endif
ifeq ($(CONFIG_WLAN_SET_WLAN_DBG), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_wlan_dbg.o
endif
endif
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
@@ -2563,6 +2566,7 @@ cppflags-$(CONFIG_WLAN_WOWL_ADD_PTRN) += -DCONFIG_WLAN_WOWL_ADD_PTRN
cppflags-$(CONFIG_WLAN_WOWL_DEL_PTRN) += -DCONFIG_WLAN_WOWL_DEL_PTRN
cppflags-$(CONFIG_WLAN_GET_TX_STBC) += -DCONFIG_WLAN_GET_TX_STBC
cppflags-$(CONFIG_WLAN_GET_STATS) += -DCONFIG_WLAN_GET_STATS
cppflags-$(CONFIG_WLAN_SET_WLAN_DBG) += -DCONFIG_WLAN_SET_WLAN_DBG
cppflags-$(CONFIG_WLAN_SET_SCAN_CFG) += -DCONFIG_WLAN_SET_SCAN_CFG
cppflags-$(CONFIG_WLAN_SET_MON_CHAN) += -DCONFIG_WLAN_SET_MON_CHAN
cppflags-$(CONFIG_WLAN_SET_RADAR) += -DCONFIG_WLAN_SET_RADAR

Ver arquivo

@@ -186,6 +186,7 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
CONFIG_WLAN_WOWL_DEL_PTRN := y
CONFIG_WLAN_GET_TX_STBC := y
CONFIG_WLAN_GET_STATS := y
CONFIG_WLAN_SET_WLAN_DBG := y
CONFIG_WLAN_SET_SCAN_CFG := y
CONFIG_WLAN_SET_MON_CHAN := y
CONFIG_WLAN_SET_RADAR := y

Ver arquivo

@@ -52,6 +52,7 @@
#include <wlan_hdd_sysfs_wowl_del_ptrn.h>
#include <wlan_hdd_sysfs_get_tx_stbc.h>
#include <wlan_hdd_sysfs_get_stats.h>
#include <wlan_hdd_sysfs_set_wlan_dbg.h>
#include <wlan_hdd_sysfs_set_scan_cfg.h>
#include <wlan_hdd_sysfs_set_mon_chan.h>
#include <wlan_hdd_sysfs_set_radar.h>
@@ -735,6 +736,7 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
hdd_sysfs_set_fw_mode_cfg_create(driver_kobject);
hdd_sysfs_scan_disable_create(driver_kobject);
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_thermal_cfg_create(driver_kobject);
@@ -747,6 +749,7 @@ void hdd_destroy_sysfs_files(void)
hdd_sysfs_thermal_cfg_destroy(driver_kobject);
hdd_sysfs_set_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);
hdd_sysfs_scan_disable_destroy(driver_kobject);
hdd_sysfs_set_fw_mode_cfg_destroy(driver_kobject);

Ver arquivo

@@ -0,0 +1,134 @@
/*
* 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_wlan_dbg.c
*
* implementation for creating sysfs file set_wlan_dbg
*/
#include <wlan_hdd_includes.h>
#include "osif_psoc_sync.h"
#include <wlan_hdd_sysfs.h>
#include <wlan_hdd_sysfs_set_wlan_dbg.h>
static ssize_t
__hdd_sysfs_set_wlan_dbg_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, 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_wlan_dbg: 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 (kstrtou32(token, 0, &val2))
return -EINVAL;
/* Get val3 */
token = strsep(&sptr, " ");
if (!token)
return -EINVAL;
if (kstrtou32(token, 0, &val3))
return -EINVAL;
qdf_print_set_category_verbose(qdf_get_pidx(), val1, val2, val3);
return count;
}
static ssize_t
hdd_sysfs_set_wlan_dbg_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)
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_wlan_dbg_store(hdd_ctx, attr,
buf, count);
osif_psoc_sync_op_stop(psoc_sync);
return errno_size;
}
static struct kobj_attribute set_wlan_dbg_attribute =
__ATTR(set_wlan_dbg, 0220, NULL,
hdd_sysfs_set_wlan_dbg_store);
int hdd_sysfs_set_wlan_dbg_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_wlan_dbg_attribute.attr);
if (error)
hdd_err("could not create set_wlan_dbg sysfs file");
return error;
}
void
hdd_sysfs_set_wlan_dbg_destroy(struct kobject *driver_kobject)
{
if (!driver_kobject) {
hdd_err("could not get driver kobject!");
return;
}
sysfs_remove_file(driver_kobject, &set_wlan_dbg_attribute.attr);
}

Ver arquivo

@@ -0,0 +1,59 @@
/*
* 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_wlan_dbg.h
*
* implementation for creating sysfs file set_wlan_dbg
*/
#ifndef _WLAN_HDD_SYSFS_SET_WLAN_DBG_H
#define _WLAN_HDD_SYSFS_SET_WLAN_DBG_H
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_SET_WLAN_DBG)
/**
* hdd_sysfs_set_wlan_dbg_create() - API to create set_wlan_dbg
* @driver_kobject: sysfs driver kobject
*
* file path: /sys/kernel/wifi/set_wlan_dbg
*
* usage:
* echo [arg_0] [arg_1] [arg_2] > set_wlan_dbg
*
* Return: 0 on success and errno on failure
*/
int hdd_sysfs_set_wlan_dbg_create(struct kobject *driver_kobject);
/**
* hdd_sysfs_set_wlan_dbg_destroy() - API to destroy set_wlan_dbg
*
* Return: none
*/
void
hdd_sysfs_set_wlan_dbg_destroy(struct kobject *driver_kobject);
#else
static inline int
hdd_sysfs_set_wlan_dbg_create(struct kobject *driver_kobject)
{
return 0;
}
static inline void
hdd_sysfs_set_wlan_dbg_destroy(struct kobject *driver_kobject)
{
}
#endif
#endif /* #ifndef _WLAN_HDD_SYSFS_SET_WLAN_DBG_H */