qcacld-3.0: Add a sysfs replacement for range_ext
As part of WEXT replacement, replace range_ext with a sysfs file. This feature can be controlled using configuration flag CONFIG_WLAN_SET_RANGE_EXT file path: /sys/class/net/wlanxx/range_ext where wlanxx is adapter name example command: echo 1 > /sys/class/net/wlan1/range_ext Change-Id: I389da429e1a0cd3a2ed1efede6cb958628eb7e6e CRs-Fixed: 2689879
This commit is contained in:
4
Kbuild
4
Kbuild
@@ -310,6 +310,9 @@ endif
|
|||||||
ifeq ($(CONFIG_WLAN_SET_MON_CHAN), y)
|
ifeq ($(CONFIG_WLAN_SET_MON_CHAN), y)
|
||||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_mon_chan.o
|
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_mon_chan.o
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_WLAN_SET_RANGE_EXT), y)
|
||||||
|
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_range_ext.o
|
||||||
|
endif
|
||||||
ifeq ($(CONFIG_WLAN_SET_RADAR), y)
|
ifeq ($(CONFIG_WLAN_SET_RADAR), y)
|
||||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_radar.o
|
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_radar.o
|
||||||
endif
|
endif
|
||||||
@@ -2624,6 +2627,7 @@ endif
|
|||||||
#normally, TDLS negative behavior is not needed
|
#normally, TDLS negative behavior is not needed
|
||||||
cppflags-$(CONFIG_QCOM_TDLS) += -DFEATURE_WLAN_TDLS
|
cppflags-$(CONFIG_QCOM_TDLS) += -DFEATURE_WLAN_TDLS
|
||||||
cppflags-$(CONFIG_WLAN_GET_TDLS_PEERS) += -DWLAN_GET_TDLS_PEERS
|
cppflags-$(CONFIG_WLAN_GET_TDLS_PEERS) += -DWLAN_GET_TDLS_PEERS
|
||||||
|
cppflags-$(CONFIG_WLAN_SET_RANGE_EXT) += -DWLAN_SET_RANGE_EXT
|
||||||
|
|
||||||
cppflags-$(CONFIG_QCACLD_WLAN_LFR3) += -DWLAN_FEATURE_ROAM_OFFLOAD
|
cppflags-$(CONFIG_QCACLD_WLAN_LFR3) += -DWLAN_FEATURE_ROAM_OFFLOAD
|
||||||
|
|
||||||
|
@@ -392,6 +392,12 @@ ifeq ($(CONFIG_SLUB_DEBUG), y)
|
|||||||
CONFIG_LOCK_STATS_ON:= y
|
CONFIG_LOCK_STATS_ON:= y
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WLAN_SYSFS), y)
|
||||||
|
ifeq ($(CONFIG_MPC_UT_FRAMEWORK), y)
|
||||||
|
CONFIG_WLAN_SET_RANGE_EXT := y
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (y,$(findstring y,$(CONFIG_QCA_WIFI_SDIO) $(CONFIG_HIF_USB)))
|
ifeq (y,$(findstring y,$(CONFIG_QCA_WIFI_SDIO) $(CONFIG_HIF_USB)))
|
||||||
CONFIG_HL_DP_SUPPORT := y
|
CONFIG_HL_DP_SUPPORT := y
|
||||||
else
|
else
|
||||||
|
59
core/hdd/inc/wlan_hdd_sysfs_set_range_ext.h
Normal file
59
core/hdd/inc/wlan_hdd_sysfs_set_range_ext.h
Normal file
@@ -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_range_ext.h
|
||||||
|
*
|
||||||
|
* implementation for creating sysfs file range_ext
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WLAN_HDD_SYSFS_SET_RANGE_EXT_H
|
||||||
|
#define _WLAN_HDD_SYSFS_SET_RANGE_EXT_H
|
||||||
|
|
||||||
|
#if defined(WLAN_SYSFS) && defined(WLAN_SET_RANGE_EXT)
|
||||||
|
/**
|
||||||
|
* wlan_hdd_sysfs_range_ext_create() - API to create range_ext
|
||||||
|
* @adapter: hdd adapter
|
||||||
|
*
|
||||||
|
* this file is created per adapter.
|
||||||
|
* file path: /sys/class/net/wlanxx/range_ext
|
||||||
|
* (wlanxx is adapter name)
|
||||||
|
* usage:
|
||||||
|
* echo 1 > range_ext
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void hdd_sysfs_range_ext_create(struct hdd_adapter *adapter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hdd_sysfs_range_ext_destroy() - API to destroy range_ext
|
||||||
|
* @adapter: pointer to adapter
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void hdd_sysfs_range_ext_destroy(struct hdd_adapter *adapter);
|
||||||
|
#else
|
||||||
|
static inline void
|
||||||
|
hdd_sysfs_range_ext_create(struct hdd_adapter *adapter)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
hdd_sysfs_range_ext_destroy(struct hdd_adapter *adapter)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* #ifndef _WLAN_HDD_SYSFS_SET_RANGE_EXT_H */
|
@@ -58,6 +58,7 @@
|
|||||||
#include <wlan_hdd_sysfs_gtx_bw_mask.h>
|
#include <wlan_hdd_sysfs_gtx_bw_mask.h>
|
||||||
#include <wlan_hdd_sysfs_set_scan_cfg.h>
|
#include <wlan_hdd_sysfs_set_scan_cfg.h>
|
||||||
#include <wlan_hdd_sysfs_set_mon_chan.h>
|
#include <wlan_hdd_sysfs_set_mon_chan.h>
|
||||||
|
#include <wlan_hdd_sysfs_set_range_ext.h>
|
||||||
#include <wlan_hdd_sysfs_set_radar.h>
|
#include <wlan_hdd_sysfs_set_radar.h>
|
||||||
#include <wlan_hdd_sysfs_rts_cts.h>
|
#include <wlan_hdd_sysfs_rts_cts.h>
|
||||||
#include <wlan_hdd_sysfs_txrx_fw_stats.h>
|
#include <wlan_hdd_sysfs_txrx_fw_stats.h>
|
||||||
@@ -659,11 +660,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
|||||||
hdd_sysfs_get_tdls_peers_interface_create(adapter);
|
hdd_sysfs_get_tdls_peers_interface_create(adapter);
|
||||||
hdd_sysfs_get_temp_create(adapter);
|
hdd_sysfs_get_temp_create(adapter);
|
||||||
hdd_sysfs_motion_detection_create(adapter);
|
hdd_sysfs_motion_detection_create(adapter);
|
||||||
|
hdd_sysfs_range_ext_create(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||||
{
|
{
|
||||||
|
hdd_sysfs_range_ext_destroy(adapter);
|
||||||
hdd_sysfs_motion_detection_destroy(adapter);
|
hdd_sysfs_motion_detection_destroy(adapter);
|
||||||
hdd_sysfs_get_temp_destroy(adapter);
|
hdd_sysfs_get_temp_destroy(adapter);
|
||||||
hdd_sysfs_get_tdls_peers_interface_destroy(adapter);
|
hdd_sysfs_get_tdls_peers_interface_destroy(adapter);
|
||||||
@@ -708,11 +711,13 @@ hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
|||||||
hdd_sysfs_txrx_fw_stats_create(adapter);
|
hdd_sysfs_txrx_fw_stats_create(adapter);
|
||||||
hdd_sysfs_txrx_stats_create(adapter);
|
hdd_sysfs_txrx_stats_create(adapter);
|
||||||
hdd_sysfs_get_temp_create(adapter);
|
hdd_sysfs_get_temp_create(adapter);
|
||||||
|
hdd_sysfs_range_ext_create(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||||
{
|
{
|
||||||
|
hdd_sysfs_range_ext_destroy(adapter);
|
||||||
hdd_sysfs_get_temp_destroy(adapter);
|
hdd_sysfs_get_temp_destroy(adapter);
|
||||||
hdd_sysfs_txrx_stats_destroy(adapter);
|
hdd_sysfs_txrx_stats_destroy(adapter);
|
||||||
hdd_sysfs_txrx_fw_stats_destroy(adapter);
|
hdd_sysfs_txrx_fw_stats_destroy(adapter);
|
||||||
|
115
core/hdd/src/wlan_hdd_sysfs_set_range_ext.c
Normal file
115
core/hdd/src/wlan_hdd_sysfs_set_range_ext.c
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* 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_range_ext.c
|
||||||
|
*
|
||||||
|
* implementation for creating sysfs file range_ext
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <wlan_hdd_includes.h>
|
||||||
|
#include "osif_vdev_sync.h"
|
||||||
|
#include <wlan_hdd_sysfs.h>
|
||||||
|
#include "wma_api.h"
|
||||||
|
#include "wlan_hdd_sysfs_set_range_ext.h"
|
||||||
|
|
||||||
|
static ssize_t __hdd_sysfs_range_ext_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, errno;
|
||||||
|
|
||||||
|
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("range_ext: 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;
|
||||||
|
|
||||||
|
hdd_debug("WMI_VDEV_PARAM_HE_RANGE_EXT %d", value);
|
||||||
|
errno = wma_cli_set_command(adapter->vdev_id,
|
||||||
|
WMI_VDEV_PARAM_HE_RANGE_EXT,
|
||||||
|
value, VDEV_CMD);
|
||||||
|
if (errno)
|
||||||
|
hdd_err("Failed to set he_range_ext firmware param, errno %d",
|
||||||
|
errno);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
hdd_sysfs_range_ext_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_range_ext_store(net_dev, buf, count);
|
||||||
|
|
||||||
|
osif_vdev_sync_op_stop(vdev_sync);
|
||||||
|
|
||||||
|
return errno_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEVICE_ATTR(range_ext, 0220, NULL, hdd_sysfs_range_ext_store);
|
||||||
|
|
||||||
|
void hdd_sysfs_range_ext_create(struct hdd_adapter *adapter)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
|
||||||
|
error = device_create_file(&adapter->dev->dev, &dev_attr_range_ext);
|
||||||
|
if (error)
|
||||||
|
hdd_err("could not create range_ext sysfs file");
|
||||||
|
}
|
||||||
|
|
||||||
|
void hdd_sysfs_range_ext_destroy(struct hdd_adapter *adapter)
|
||||||
|
{
|
||||||
|
device_remove_file(&adapter->dev->dev, &dev_attr_range_ext);
|
||||||
|
}
|
Reference in New Issue
Block a user