qcacld-3.0: Add a sysfs replacement for get_tx_stbc

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

file path: /sys/class/net/wlanxx/get_tx_stbc
	where wlanxx is adapter name

example: cat /sys/class/net/wlanxx/get_tx_stbc

Change-Id: I3024a574c7aa35398bd4c8ee30f8235ef2fe3128
CRs-Fixed: 2682374
This commit is contained in:
Aditya Kodukula 2020-05-08 20:11:58 -07:00 • committed by nshrivas
commit e514533315
5 changed files with 187 additions and 0 deletions

4
Kbuild
View file

@ -294,6 +294,9 @@ endif
ifeq ($(CONFIG_WLAN_WOWL_DEL_PTRN), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_wowl_del_ptrn.o
endif
ifeq ($(CONFIG_WLAN_GET_TX_STBC), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_tx_stbc.o
endif
ifeq ($(CONFIG_WLAN_SET_SCAN_CFG), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_scan_cfg.o
endif
@ -2555,6 +2558,7 @@ cppflags-$(CONFIG_WLAN_SCAN_DISABLE) += -DCONFIG_WLAN_SCAN_DISABLE
cppflags-$(CONFIG_WLAN_WOW_ITO) += -DCONFIG_WLAN_WOW_ITO
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_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

View file

@ -184,6 +184,7 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
CONFIG_WLAN_WOW_ITO := y
CONFIG_WLAN_WOWL_ADD_PTRN := y
CONFIG_WLAN_WOWL_DEL_PTRN := y
CONFIG_WLAN_GET_TX_STBC := y
CONFIG_WLAN_SET_SCAN_CFG := y
CONFIG_WLAN_SET_MON_CHAN := y
CONFIG_WLAN_SET_RADAR := y

View file

@ -50,6 +50,7 @@
#include <wlan_hdd_sysfs_wow_ito.h>
#include <wlan_hdd_sysfs_wowl_add_ptrn.h>
#include <wlan_hdd_sysfs_wowl_del_ptrn.h>
#include <wlan_hdd_sysfs_get_tx_stbc.h>
#include <wlan_hdd_sysfs_set_scan_cfg.h>
#include <wlan_hdd_sysfs_set_mon_chan.h>
#include <wlan_hdd_sysfs_set_radar.h>
@ -641,6 +642,7 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_connect_info_interface_create(adapter);
hdd_sysfs_wowl_add_ptrn_create(adapter);
hdd_sysfs_wowl_del_ptrn_create(adapter);
hdd_sysfs_get_tx_stbc_create(adapter);
hdd_sysfs_txrx_fw_stats_create(adapter);
hdd_sysfs_txrx_stats_create(adapter);
hdd_sysfs_get_range_ext_create(adapter);
@ -658,6 +660,7 @@ hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_get_range_ext_destroy(adapter);
hdd_sysfs_txrx_stats_destroy(adapter);
hdd_sysfs_txrx_fw_stats_destroy(adapter);
hdd_sysfs_get_tx_stbc_destroy(adapter);
hdd_sysfs_wowl_del_ptrn_destroy(adapter);
hdd_sysfs_wowl_add_ptrn_destroy(adapter);
hdd_sysfs_connect_info_interface_destroy(adapter);
@ -681,6 +684,7 @@ 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_get_tx_stbc_create(adapter);
hdd_sysfs_set_radar_create(adapter);
hdd_sysfs_txrx_fw_stats_create(adapter);
hdd_sysfs_txrx_stats_create(adapter);
@ -694,6 +698,7 @@ hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_txrx_stats_destroy(adapter);
hdd_sysfs_txrx_fw_stats_destroy(adapter);
hdd_sysfs_set_radar_destroy(adapter);
hdd_sysfs_get_tx_stbc_destroy(adapter);
hdd_sysfs_connect_info_interface_destroy(adapter);
hdd_sysfs_modify_acl_destroy(adapter);
hdd_sysfs_unit_test_target_destroy(adapter);

View 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_get_tx_stbc.c
*
* implementation for creating sysfs file get_tx_stbc
*/
#include <wlan_hdd_includes.h>
#include <wlan_hdd_sysfs.h>
#include "osif_vdev_sync.h"
#include "sme_api.h"
#include <wlan_hdd_sysfs_get_tx_stbc.h>
static int hdd_sysfs_get_tx_stbc(struct hdd_adapter *adapter, int *value)
{
mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
int ret;
hdd_enter();
ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
WNI_CFG_HT_CAP_INFO_TX_STBC);
if (ret < 0) {
hdd_err("Failed to get TX STBC value");
} else {
*value = ret;
ret = 0;
}
return ret;
}
static ssize_t
__hdd_sysfs_get_tx_stbc_show(struct net_device *net_dev, char *buf)
{
struct hdd_adapter *adapter = netdev_priv(net_dev);
struct hdd_context *hdd_ctx;
int ret;
int value;
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)
return ret;
if (!wlan_hdd_validate_modules_state(hdd_ctx))
return -EINVAL;
ret = hdd_sysfs_get_tx_stbc(adapter, &value);
if (ret) {
hdd_err_rl("Get_TX_STBC failed %d", ret);
return ret;
}
return scnprintf(buf, PAGE_SIZE, "%d\n", value);
}
static ssize_t
hdd_sysfs_get_tx_stbc_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct net_device *net_dev = container_of(dev, struct net_device, dev);
struct osif_vdev_sync *vdev_sync;
ssize_t err_size;
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
if (err_size)
return err_size;
err_size = __hdd_sysfs_get_tx_stbc_show(net_dev, buf);
osif_vdev_sync_op_stop(vdev_sync);
return err_size;
}
static DEVICE_ATTR(get_tx_stbc, 0440,
hdd_sysfs_get_tx_stbc_show, NULL);
int hdd_sysfs_get_tx_stbc_create(struct hdd_adapter *adapter)
{
int error;
error = device_create_file(&adapter->dev->dev,
&dev_attr_get_tx_stbc);
if (error)
hdd_err("could not create get_tx_stbc sysfs file");
return error;
}
void hdd_sysfs_get_tx_stbc_destroy(struct hdd_adapter *adapter)
{
device_remove_file(&adapter->dev->dev, &dev_attr_get_tx_stbc);
}

View 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_get_tx_stbc.h
*
* implementation for creating sysfs file get_tx_stbc
*/
#ifndef _WLAN_HDD_SYSFS_GET_TX_STBC_H
#define _WLAN_HDD_SYSFS_GET_TX_STBC_H
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_GET_TX_STBC)
/**
* hdd_sysfs_get_tx_stbc_create() - API to create get_tx_stbc
* @adapter: pointer to adapter
*
* this file is created per adapter.
* file path: /sys/class/net/wlanxx/get_tx_stbc
* where wlanxx is adapter name
*
* usage:
* cat /sys/class/net/wlanxx/get_tx_stbc
*
* Return: 0 on success and errno on failure
*/
int hdd_sysfs_get_tx_stbc_create(struct hdd_adapter *adapter);
/**
* hdd_sysfs_get_tx_stbc_destroy() -
* API to destroy get_tx_stbc
* @adapter: pointer to adapter
*
* Return: none
*/
void hdd_sysfs_get_tx_stbc_destroy(struct hdd_adapter *adapter);
#else
static inline int
hdd_sysfs_get_tx_stbc_create(struct hdd_adapter *adapter)
{
return 0;
}
static inline void
hdd_sysfs_get_tx_stbc_destroy(struct hdd_adapter *adapter)
{
}
#endif
#endif /* #ifndef _WLAN_HDD_SYSFS_GET_TX_STBC_H */