qcacld-3.0: Add a sysfs replacement for dl_mode commands
As part of WEXT replacement, replace dl_loglevel, dl_mod_loglevel, dl_modoff, dl_modon, dl_report, dl_type, dl_vapoff, dl_vapon with a sysfs file. file path: /sys/class/net/wlanxx/dl_loglevel file path: /sys/class/net/wlanxx/dl_mod_loglevel file path: /sys/class/net/wlanxx/dl_modoff file path: /sys/class/net/wlanxx/dl_modon file path: /sys/class/net/wlanxx/dl_report file path: /sys/class/net/wlanxx/dl_type file path: /sys/class/net/wlanxx/dl_vapoff file path: /sys/class/net/wlanxx/dl_vapon wlanxx is adapter name example: echo 1 > dl_loglevel example: echo 1 > dl_mod_loglevel example: echo 1 > dl_modoff example: echo 1 > dl_modon example: echo 1 > dl_report example: echo 1 > dl_type example: echo 1 > dl_vapoff example: echo 1 > dl_vapon Change-Id: Ic3d748738d0072e42b7ff07177f2ca711b333193 CRs-Fixed: 2715053
This commit is contained in:
4
Kbuild
4
Kbuild
@@ -361,6 +361,9 @@ endif
|
||||
ifeq ($(CONFIG_REMOVE_PKT_LOG), n)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_pktlog.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_DL_MODES), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_dl_modes.o
|
||||
endif
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_policy_mgr.o
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_dp_aggregation.o
|
||||
endif
|
||||
@@ -2686,6 +2689,7 @@ cppflags-$(CONFIG_WLAN_SYSFS_MEM_STATS) += -DCONFIG_WLAN_SYSFS_MEM_STATS
|
||||
cppflags-$(CONFIG_WLAN_SYSFS_DCM) += -DWLAN_SYSFS_DCM
|
||||
cppflags-$(CONFIG_WLAN_SYSFS_HE_BSS_COLOR) += -DWLAN_SYSFS_HE_BSS_COLOR
|
||||
cppflags-$(CONFIG_WLAN_SYSFS_STA_INFO) += -DWLAN_SYSFS_STA_INFO
|
||||
cppflags-$(CONFIG_WLAN_DL_MODES) += -DCONFIG_WLAN_DL_MODES
|
||||
|
||||
ifeq ($(CONFIG_LEAK_DETECTION), y)
|
||||
cppflags-y += \
|
||||
|
@@ -224,6 +224,7 @@ ifeq ($(CONFIG_QCOM_TDLS), y)
|
||||
endif
|
||||
CONFIG_WLAN_SYSFS_TEMPERATURE := y
|
||||
CONFIG_WLAN_THERMAL_CFG := y
|
||||
CONFIG_WLAN_DL_MODES := y
|
||||
endif
|
||||
|
||||
CONFIG_WLAN_POWER_DEBUG := y
|
||||
|
@@ -74,6 +74,7 @@
|
||||
#include <wlan_hdd_sysfs_pkt_log.h>
|
||||
#include <wlan_hdd_sysfs_policy_mgr.h>
|
||||
#include <wlan_hdd_sysfs_dp_aggregation.h>
|
||||
#include <wlan_hdd_sysfs_dl_modes.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
@@ -665,11 +666,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
hdd_sysfs_temperature_create(adapter);
|
||||
hdd_sysfs_motion_detection_create(adapter);
|
||||
hdd_sysfs_range_ext_create(adapter);
|
||||
hdd_sysfs_dl_modes_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_dl_modes_destroy(adapter);
|
||||
hdd_sysfs_range_ext_destroy(adapter);
|
||||
hdd_sysfs_motion_detection_destroy(adapter);
|
||||
hdd_sysfs_temperature_destroy(adapter);
|
||||
@@ -717,11 +720,13 @@ hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
hdd_sysfs_temperature_create(adapter);
|
||||
hdd_sysfs_range_ext_create(adapter);
|
||||
hdd_sysfs_ipa_create(adapter);
|
||||
hdd_sysfs_dl_modes_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_dl_modes_destroy(adapter);
|
||||
hdd_sysfs_ipa_destroy(adapter);
|
||||
hdd_sysfs_range_ext_destroy(adapter);
|
||||
hdd_sysfs_temperature_destroy(adapter);
|
||||
|
808
core/hdd/src/wlan_hdd_sysfs_dl_modes.c
Normal file
808
core/hdd/src/wlan_hdd_sysfs_dl_modes.c
Normal file
@@ -0,0 +1,808 @@
|
||||
/*
|
||||
* 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_dl_modes.c
|
||||
*
|
||||
* implementation for creating sysfs file dl_modes
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include <wlan_hdd_main.h>
|
||||
#include "osif_vdev_sync.h"
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include <wlan_hdd_sysfs_dl_modes.h>
|
||||
#include "wmi_unified_param.h"
|
||||
#include "wma_api.h"
|
||||
|
||||
static int hdd_sysfs_set_dbg(struct hdd_adapter *adapter,
|
||||
int id,
|
||||
const char *id_string,
|
||||
int value)
|
||||
{
|
||||
int errno;
|
||||
|
||||
hdd_debug("%s %d", id_string, value);
|
||||
errno = wma_cli_set_command(adapter->vdev_id, id, value, DBG_CMD);
|
||||
if (errno)
|
||||
hdd_err("Failed to set firmware, errno %d", errno);
|
||||
|
||||
return errno;
|
||||
}
|
||||
|
||||
#define hdd_sysfs_set_dbg(adapter, id, value) \
|
||||
hdd_sysfs_set_dbg(adapter, id, #id, value)
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_loglevel_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_loglevel: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_LOG_LEVEL, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_loglevel: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_loglevel_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_loglevel_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_mod_loglevel_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_mod_loglevel: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_MOD_LOG_LEVEL, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_mod_loglevel: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_mod_loglevel_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_mod_loglevel_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_modoff_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_modoff: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_MODULE_DISABLE, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_modoff: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_modoff_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_modoff_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_modon_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_modon: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_MODULE_ENABLE, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_modon: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_modon_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_modon_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_report_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_report: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_REPORT_ENABLE, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_report: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_report_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_report_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_type_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_type: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_TYPE, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_type: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_type_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_type_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_vapoff_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_vapoff: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_VAP_DISABLE, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_vapoff: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_vapoff_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_vapoff_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_dl_vapon_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
uint32_t value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return 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("dl_vapon: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_set_dbg(adapter, WMI_DBGLOG_VAP_ENABLE, value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("failed dl_vapon: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_dl_vapon_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t errno_size;
|
||||
|
||||
errno_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno_size)
|
||||
return errno_size;
|
||||
|
||||
errno_size = __hdd_sysfs_dl_vapon_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(dl_loglevel, 0220,
|
||||
NULL, hdd_sysfs_dl_loglevel_store);
|
||||
|
||||
static DEVICE_ATTR(dl_mod_loglevel, 0220,
|
||||
NULL, hdd_sysfs_dl_mod_loglevel_store);
|
||||
|
||||
static DEVICE_ATTR(dl_modoff, 0220,
|
||||
NULL, hdd_sysfs_dl_modoff_store);
|
||||
|
||||
static DEVICE_ATTR(dl_modon, 0220,
|
||||
NULL, hdd_sysfs_dl_modon_store);
|
||||
|
||||
static DEVICE_ATTR(dl_report, 0220,
|
||||
NULL, hdd_sysfs_dl_report_store);
|
||||
|
||||
static DEVICE_ATTR(dl_type, 0220,
|
||||
NULL, hdd_sysfs_dl_type_store);
|
||||
|
||||
static DEVICE_ATTR(dl_vapoff, 0220,
|
||||
NULL, hdd_sysfs_dl_vapoff_store);
|
||||
|
||||
static DEVICE_ATTR(dl_vapon, 0220,
|
||||
NULL, hdd_sysfs_dl_vapon_store);
|
||||
|
||||
static int hdd_sysfs_dl_loglevel_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_loglevel);
|
||||
if (error)
|
||||
hdd_err("could not create dl_loglevel sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_loglevel_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_loglevel);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_mod_loglevel_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev,
|
||||
&dev_attr_dl_mod_loglevel);
|
||||
if (error)
|
||||
hdd_err("could not create dl_mod_loglevel sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_mod_loglevel_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_mod_loglevel);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_modoff_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_modoff);
|
||||
if (error)
|
||||
hdd_err("could not create dl_modoff sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_modoff_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_modoff);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_modon_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_modon);
|
||||
if (error)
|
||||
hdd_err("could not create dl_modon sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_modon_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_modon);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_report_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_report);
|
||||
if (error)
|
||||
hdd_err("could not create dl_report sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_report_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_report);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_type_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_type);
|
||||
if (error)
|
||||
hdd_err("could not create dl_type sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_type_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_type);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_vapoff_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_vapoff);
|
||||
if (error)
|
||||
hdd_err("could not create dl_vapoff sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_vapoff_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_vapoff);
|
||||
}
|
||||
|
||||
static int hdd_sysfs_dl_vapon_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_dl_vapon);
|
||||
if (error)
|
||||
hdd_err("could not create dl_vapon sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void hdd_sysfs_dl_vapon_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_dl_vapon);
|
||||
}
|
||||
|
||||
void hdd_sysfs_dl_modes_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_dl_loglevel_create(adapter);
|
||||
hdd_sysfs_dl_mod_loglevel_create(adapter);
|
||||
hdd_sysfs_dl_modoff_create(adapter);
|
||||
hdd_sysfs_dl_modon_create(adapter);
|
||||
hdd_sysfs_dl_report_create(adapter);
|
||||
hdd_sysfs_dl_type_create(adapter);
|
||||
hdd_sysfs_dl_vapoff_create(adapter);
|
||||
hdd_sysfs_dl_vapon_create(adapter);
|
||||
}
|
||||
|
||||
void hdd_sysfs_dl_modes_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_dl_vapon_destroy(adapter);
|
||||
hdd_sysfs_dl_vapoff_destroy(adapter);
|
||||
hdd_sysfs_dl_type_destroy(adapter);
|
||||
hdd_sysfs_dl_report_destroy(adapter);
|
||||
hdd_sysfs_dl_modon_destroy(adapter);
|
||||
hdd_sysfs_dl_modoff_destroy(adapter);
|
||||
hdd_sysfs_dl_mod_loglevel_destroy(adapter);
|
||||
hdd_sysfs_dl_loglevel_destroy(adapter);
|
||||
}
|
114
core/hdd/src/wlan_hdd_sysfs_dl_modes.h
Normal file
114
core/hdd/src/wlan_hdd_sysfs_dl_modes.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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_dl_modes.h
|
||||
*
|
||||
* implementation for creating sysfs file dl_modes
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_DL_MODES_H
|
||||
#define _WLAN_HDD_SYSFS_DL_MODES_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_DL_MODES)
|
||||
/**
|
||||
* wlan_hdd_sysfs_dl_modes_create() - API to create motion
|
||||
* detection sysfs attributes
|
||||
* @adapter: hdd adapter
|
||||
*
|
||||
* This API creates the following sysfs attributes:
|
||||
* 1. dl_loglevel
|
||||
* 2. dl_mod_loglevel
|
||||
* 3. dl_modoff
|
||||
* 4. dl_modon
|
||||
* 5. dl_report
|
||||
* 6. dl_type
|
||||
* 7. dl_vapoff
|
||||
* 8. dl_vapon
|
||||
*
|
||||
* dl_loglevel: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_loglevel
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_loglevel
|
||||
*
|
||||
* dl_mod_loglevel: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_mod_loglevel
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_mod_loglevel
|
||||
*
|
||||
* dl_modoff: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_modoff
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > mt_config
|
||||
*
|
||||
* dl_modon: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_modon
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_modon
|
||||
*
|
||||
* dl_report: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_report
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_report
|
||||
*
|
||||
* dl_type: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_type
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_type
|
||||
*
|
||||
* dl_vapoff: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_vapoff
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_vapoff
|
||||
*
|
||||
* dl_vapon: this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/dl_vapon
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > dl_vapon
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void hdd_sysfs_dl_modes_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_dl_modes_destroy() -
|
||||
* API to destroy dl mode sysfs attributes
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_dl_modes_destroy(struct hdd_adapter *adapter);
|
||||
|
||||
#else
|
||||
static inline void
|
||||
hdd_sysfs_dl_modes_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
hdd_sysfs_dl_modes_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_DL_MODES_H */
|
Reference in New Issue
Block a user