qcacld-3.0: Add a sysfs replacement for scan_disable
As part of WEXT replacement, replace scan_disable with a sysfs file. file path: /sys/kernel/wifi/scan_disable example: echo 1 > scan_disable Change-Id: Icaa7083d0f7b2cefd0f77cb7da7fe0d3d52d36c5 CRs-Fixed: 2676764
This commit is contained in:
parent
a7b4ee1df8
commit
5d77b1b715
4
Kbuild
4
Kbuild
@ -276,6 +276,9 @@ HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_modify_acl.o
|
|||||||
ifeq ($(CONFIG_WLAN_SYSFS_CONNECT_INFO), y)
|
ifeq ($(CONFIG_WLAN_SYSFS_CONNECT_INFO), y)
|
||||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_connect_info.o
|
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_connect_info.o
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_WLAN_SCAN_DISABLE), y)
|
||||||
|
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_scan_disable.o
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||||
@ -2504,6 +2507,7 @@ cppflags-$(CONFIG_UNIT_TEST) += -DWLAN_UNIT_TEST
|
|||||||
cppflags-$(CONFIG_WLAN_DEBUG_CRASH_INJECT) += -DCONFIG_WLAN_DEBUG_CRASH_INJECT
|
cppflags-$(CONFIG_WLAN_DEBUG_CRASH_INJECT) += -DCONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||||
cppflags-$(CONFIG_WLAN_SET_FW_MODE_CFG) += -DCONFIG_WLAN_SET_FW_MODE_CFG
|
cppflags-$(CONFIG_WLAN_SET_FW_MODE_CFG) += -DCONFIG_WLAN_SET_FW_MODE_CFG
|
||||||
cppflags-$(CONFIG_WLAN_REASSOC) += -DCONFIG_WLAN_REASSOC
|
cppflags-$(CONFIG_WLAN_REASSOC) += -DCONFIG_WLAN_REASSOC
|
||||||
|
cppflags-$(CONFIG_WLAN_SCAN_DISABLE) += -DCONFIG_WLAN_SCAN_DISABLE
|
||||||
cppflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
|
cppflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
|
||||||
cppflags-$(CONFIG_FEATURE_WLM_STATS) += -DFEATURE_WLM_STATS
|
cppflags-$(CONFIG_FEATURE_WLM_STATS) += -DFEATURE_WLM_STATS
|
||||||
|
|
||||||
|
@ -178,6 +178,7 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
|
|||||||
CONFIG_WLAN_SET_FW_MODE_CFG := y
|
CONFIG_WLAN_SET_FW_MODE_CFG := y
|
||||||
CONFIG_WLAN_REASSOC := y
|
CONFIG_WLAN_REASSOC := y
|
||||||
CONFIG_WLAN_SYSFS_CONNECT_INFO := y
|
CONFIG_WLAN_SYSFS_CONNECT_INFO := y
|
||||||
|
CONFIG_WLAN_SCAN_DISABLE := y
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CONFIG_WLAN_POWER_DEBUG := y
|
CONFIG_WLAN_POWER_DEBUG := y
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "wlan_hdd_sysfs_unit_test.h"
|
#include "wlan_hdd_sysfs_unit_test.h"
|
||||||
#include "wlan_hdd_sysfs_modify_acl.h"
|
#include "wlan_hdd_sysfs_modify_acl.h"
|
||||||
#include "wlan_hdd_sysfs_connect_info.h"
|
#include "wlan_hdd_sysfs_connect_info.h"
|
||||||
|
#include <wlan_hdd_sysfs_scan_disable.h>
|
||||||
|
|
||||||
#define MAX_PSOC_ID_SIZE 10
|
#define MAX_PSOC_ID_SIZE 10
|
||||||
|
|
||||||
@ -664,12 +665,14 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
|
|||||||
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
||||||
hdd_sysfs_create_powerstats_interface();
|
hdd_sysfs_create_powerstats_interface();
|
||||||
hdd_sysfs_set_fw_mode_cfg_create(driver_kobject);
|
hdd_sysfs_set_fw_mode_cfg_create(driver_kobject);
|
||||||
|
hdd_sysfs_scan_disable_create(driver_kobject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hdd_destroy_sysfs_files(void)
|
void hdd_destroy_sysfs_files(void)
|
||||||
{
|
{
|
||||||
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
||||||
|
hdd_sysfs_scan_disable_destroy(driver_kobject);
|
||||||
hdd_sysfs_set_fw_mode_cfg_destroy(driver_kobject);
|
hdd_sysfs_set_fw_mode_cfg_destroy(driver_kobject);
|
||||||
hdd_sysfs_destroy_powerstats_interface();
|
hdd_sysfs_destroy_powerstats_interface();
|
||||||
}
|
}
|
||||||
|
130
core/hdd/src/wlan_hdd_sysfs_scan_disable.c
Normal file
130
core/hdd/src/wlan_hdd_sysfs_scan_disable.c
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* 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_scan_disable.c
|
||||||
|
*
|
||||||
|
* implementation for creating sysfs scan_disable
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <wlan_hdd_includes.h>
|
||||||
|
#include "osif_psoc_sync.h"
|
||||||
|
#include <wlan_hdd_sysfs.h>
|
||||||
|
#include <wlan_hdd_sysfs_scan_disable.h>
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
__hdd_sysfs_scan_disable_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 value;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!hdd_ctx->psoc)
|
||||||
|
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("scan_disable: count %zu buf_local:(%s)",
|
||||||
|
count, buf_local);
|
||||||
|
|
||||||
|
/* Get value */
|
||||||
|
token = strsep(&sptr, " ");
|
||||||
|
if (!token)
|
||||||
|
return -EINVAL;
|
||||||
|
if (kstrtou32(token, 0, &value))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
hdd_debug("%d", value);
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
|
||||||
|
else
|
||||||
|
ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
hdd_sysfs_scan_disable_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_scan_disable_store(hdd_ctx, attr,
|
||||||
|
buf, count);
|
||||||
|
|
||||||
|
osif_psoc_sync_op_stop(psoc_sync);
|
||||||
|
|
||||||
|
return errno_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct kobj_attribute scan_disable_attribute =
|
||||||
|
__ATTR(scan_disable, 0220, NULL,
|
||||||
|
hdd_sysfs_scan_disable_store);
|
||||||
|
|
||||||
|
int hdd_sysfs_scan_disable_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,
|
||||||
|
&scan_disable_attribute.attr);
|
||||||
|
if (error)
|
||||||
|
hdd_err("could not create scan_disable sysfs file");
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hdd_sysfs_scan_disable_destroy(struct kobject *driver_kobject)
|
||||||
|
{
|
||||||
|
if (!driver_kobject) {
|
||||||
|
hdd_err("could not get driver kobject!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sysfs_remove_file(driver_kobject, &scan_disable_attribute.attr);
|
||||||
|
}
|
61
core/hdd/src/wlan_hdd_sysfs_scan_disable.h
Normal file
61
core/hdd/src/wlan_hdd_sysfs_scan_disable.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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_scan_disable.h
|
||||||
|
*
|
||||||
|
* implementation for creating sysfs file scan_disable
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WLAN_HDD_SYSFS_SCAN_DISABLE_H
|
||||||
|
#define _WLAN_HDD_SYSFS_SCAN_DISABLE_H
|
||||||
|
|
||||||
|
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_SCAN_DISABLE)
|
||||||
|
/**
|
||||||
|
* hdd_sysfs_scan_disable_create() - API to create scan_disable
|
||||||
|
* @driver_kobject: sysfs driver kobject
|
||||||
|
*
|
||||||
|
* file path: /sys/kernel/wifi/scan_disable
|
||||||
|
*
|
||||||
|
* usage:
|
||||||
|
* echo [arg_0] > scan_disable
|
||||||
|
*
|
||||||
|
* Return: 0 on success and errno on failure
|
||||||
|
*/
|
||||||
|
int hdd_sysfs_scan_disable_create(struct kobject *driver_kobject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hdd_sysfs_scan_disable_destroy() - API to destroy scan_disable
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
hdd_sysfs_scan_disable_destroy(struct kobject *driver_kobject);
|
||||||
|
#else
|
||||||
|
static inline int
|
||||||
|
hdd_sysfs_scan_disable_create(struct kobject *driver_kobject)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
hdd_sysfs_scan_disable_destroy(struct kobject *driver_kobject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* #ifndef _WLAN_HDD_SYSFS_SCAN_DISABLE_H */
|
Loading…
Reference in New Issue
Block a user