qcacld-3.0: Add a sysfs replacement for setRadar
As part of WEXT replacement, replace setRadar with a sysfs file. file path: /sys/class/net/wlanxx/set_radar wlanxx is adapter name example: echo 1 > set_radar Change-Id: I6451f506c1525dcfc48c988f965cc6dedf64b369 CRs-Fixed: 2680424
This commit is contained in:
parent
e735aef7ac
commit
3264896675
4
Kbuild
4
Kbuild
@ -294,6 +294,9 @@ endif
|
||||
ifeq ($(CONFIG_WLAN_SET_MON_CHAN), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_mon_chan.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_SET_RADAR), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_radar.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
@ -2527,6 +2530,7 @@ cppflags-$(CONFIG_WLAN_WOW_ITO) += -DCONFIG_WLAN_WOW_ITO
|
||||
cppflags-$(CONFIG_WLAN_WOWL_ADD_PTRN) += -DCONFIG_WLAN_WOWL_ADD_PTRN
|
||||
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
|
||||
cppflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
|
||||
cppflags-$(CONFIG_FEATURE_WLM_STATS) += -DFEATURE_WLM_STATS
|
||||
|
||||
|
@ -184,6 +184,7 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
|
||||
CONFIG_WLAN_WOWL_ADD_PTRN := y
|
||||
CONFIG_WLAN_SET_SCAN_CFG := y
|
||||
CONFIG_WLAN_SET_MON_CHAN := y
|
||||
CONFIG_WLAN_SET_RADAR := y
|
||||
endif
|
||||
|
||||
CONFIG_WLAN_POWER_DEBUG := y
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <wlan_hdd_sysfs_wowl_add_ptrn.h>
|
||||
#include <wlan_hdd_sysfs_set_scan_cfg.h>
|
||||
#include <wlan_hdd_sysfs_set_mon_chan.h>
|
||||
#include <wlan_hdd_sysfs_set_radar.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
@ -655,11 +656,13 @@ hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
hdd_sysfs_unit_test_target_create(adapter);
|
||||
hdd_sysfs_modify_acl_create(adapter);
|
||||
hdd_sysfs_connect_info_interface_create(adapter);
|
||||
hdd_sysfs_set_radar_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_set_radar_destroy(adapter);
|
||||
hdd_sysfs_connect_info_interface_destroy(adapter);
|
||||
hdd_sysfs_modify_acl_destroy(adapter);
|
||||
hdd_sysfs_unit_test_target_destroy(adapter);
|
||||
|
130
core/hdd/src/wlan_hdd_sysfs_set_radar.c
Normal file
130
core/hdd/src/wlan_hdd_sysfs_set_radar.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_set_radar.c
|
||||
*
|
||||
* implementation for creating sysfs file set_radar
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include "osif_vdev_sync.h"
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include <wlan_hdd_sysfs_set_radar.h>
|
||||
#include "wlan_dfs_tgt_api.h"
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_set_radar_store(struct net_device *net_dev,
|
||||
char const *buf, size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
struct hdd_ap_ctx *ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
struct radar_found_info radar;
|
||||
struct hdd_context *hdd_ctx;
|
||||
char *sptr, *token;
|
||||
int set_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("set_radar: count %zu buf_local:(%s) net_devname %s",
|
||||
count, buf_local, net_dev->name);
|
||||
|
||||
/* Get set_value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &set_value))
|
||||
return -EINVAL;
|
||||
|
||||
hdd_debug("Set QCASAP_SET_RADAR_CMD val %d", set_value);
|
||||
|
||||
pdev = hdd_ctx->pdev;
|
||||
if (!pdev) {
|
||||
hdd_err("null pdev");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
qdf_mem_zero(&radar, sizeof(radar));
|
||||
if (wlan_reg_is_dfs_for_freq(pdev, ap_ctx->operating_chan_freq))
|
||||
tgt_dfs_process_radar_ind(pdev, &radar);
|
||||
else
|
||||
hdd_debug("Ignore set radar, op ch_freq(%d) is not dfs",
|
||||
ap_ctx->operating_chan_freq);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_set_radar_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_set_radar_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(set_radar, 0220,
|
||||
NULL, hdd_sysfs_set_radar_store);
|
||||
|
||||
int hdd_sysfs_set_radar_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_set_radar);
|
||||
if (error)
|
||||
hdd_err("could not create set_radar sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void hdd_sysfs_set_radar_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_set_radar);
|
||||
}
|
62
core/hdd/src/wlan_hdd_sysfs_set_radar.h
Normal file
62
core/hdd/src/wlan_hdd_sysfs_set_radar.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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_radar.h
|
||||
*
|
||||
* implementation for creating sysfs file set_radar
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_SET_RADAR_H
|
||||
#define _WLAN_HDD_SYSFS_SET_RADAR_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_SET_RADAR)
|
||||
/**
|
||||
* wlan_hdd_sysfs_set_radar_create() - API to create set_radar
|
||||
* (for sap mode only)
|
||||
* @adapter: hdd adapter
|
||||
*
|
||||
* this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/set_radar
|
||||
* (wlanxx is adapter name)
|
||||
* usage:
|
||||
* echo [arg_0] > set_radar
|
||||
*
|
||||
* Return: 0 on success and errno on failure
|
||||
*/
|
||||
int hdd_sysfs_set_radar_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_set_radar_destroy() -
|
||||
* API to destroy set_radar
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_set_radar_destroy(struct hdd_adapter *adapter);
|
||||
#else
|
||||
static inline int
|
||||
hdd_sysfs_set_radar_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hdd_sysfs_set_radar_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_SET_RADAR_H */
|
Loading…
Reference in New Issue
Block a user