qcacld-3.0: Add sysfs entry for the ipaucstat
Add the sysfs entry for the ipaucstat. Previously ipaucstat would be queried via iwpriv --> iwpriv wlan0 ipaucstat 1 it is now changed to support via sysfs: --> echo "1" > /sys/class/net/wlanxx/ipaucstat Change-Id: I5a3195a36cd2d7252eb3ef0312545d338b40d3ec CRs-Fixed: 2676440
This commit is contained in:
parent
5a1000a798
commit
40c74bf143
3
Kbuild
3
Kbuild
@ -355,6 +355,9 @@ endif
|
||||
ifeq ($(CONFIG_WLAN_GTX_BW_MASK), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_gtx_bw_mask.o
|
||||
endif
|
||||
ifeq ($(CONFIG_IPA_OFFLOAD), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_ipa.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
|
58
core/hdd/inc/wlan_hdd_sysfs_ipa.h
Normal file
58
core/hdd/inc/wlan_hdd_sysfs_ipa.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef WLAN_HDD_SYSFS_IPA_H
|
||||
#define WLAN_HDD_SYSFS_IPA_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(IPA_OFFLOAD)
|
||||
|
||||
enum ipa_debug_cmd {
|
||||
IPA_UC_STAT = 1,
|
||||
IPA_UC_INFO,
|
||||
IPA_UC_RT_DEBUG_HOST_DUMP,
|
||||
IPA_DUMP_INFO,
|
||||
};
|
||||
|
||||
/**
|
||||
* hdd_sysfs_ipa_create(): Initialize ipa specific sysfs file
|
||||
* @adapter: os if adapter
|
||||
*
|
||||
* Function to initialize ipa specific mode syfs files.
|
||||
*
|
||||
* Return: NONE
|
||||
*/
|
||||
void hdd_sysfs_ipa_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_ipa_destroy(): Remove ipucstat specific sysfs file
|
||||
* @adapter: os if adapter
|
||||
*
|
||||
* Function to remove ipa specific mode syfs files.
|
||||
*
|
||||
* Return: NONE
|
||||
*/
|
||||
void hdd_sysfs_ipa_destroy(struct hdd_adapter *adapter);
|
||||
#else
|
||||
static inline
|
||||
void hdd_sysfs_ipa_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void hdd_sysfs_ipa_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -70,6 +70,7 @@
|
||||
#include <wlan_hdd_sysfs_get_temp.h>
|
||||
#include <wlan_hdd_sysfs_thermal_cfg.h>
|
||||
#include <wlan_hdd_sysfs_motion_detection.h>
|
||||
#include <wlan_hdd_sysfs_ipa.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
@ -716,11 +717,13 @@ hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
hdd_sysfs_txrx_stats_create(adapter);
|
||||
hdd_sysfs_get_temp_create(adapter);
|
||||
hdd_sysfs_range_ext_create(adapter);
|
||||
hdd_sysfs_ipa_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_ipa_destroy(adapter);
|
||||
hdd_sysfs_range_ext_destroy(adapter);
|
||||
hdd_sysfs_get_temp_destroy(adapter);
|
||||
hdd_sysfs_txrx_stats_destroy(adapter);
|
||||
|
124
core/hdd/src/wlan_hdd_sysfs_ipa.c
Normal file
124
core/hdd/src/wlan_hdd_sysfs_ipa.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_main.h>
|
||||
#include <wlan_hdd_sysfs_ipa.h>
|
||||
#include <wlan_ipa_ucfg_api.h>
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include "osif_sync.h"
|
||||
|
||||
#define MAX_USER_COMMAND_SIZE_IPAUCSTAT 4
|
||||
|
||||
static ssize_t __hdd_sysfs_ipaucstate_store(struct net_device *net_dev,
|
||||
const char __user *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
uint8_t cmd[MAX_USER_COMMAND_SIZE_IPAUCSTAT] = {0};
|
||||
int ret;
|
||||
char *sptr, *token;
|
||||
uint8_t set_value = 0;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
if (hdd_validate_adapter(adapter))
|
||||
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;
|
||||
|
||||
if (!ucfg_ipa_is_enabled())
|
||||
return -EINVAL;
|
||||
|
||||
if (adapter->device_mode != QDF_SAP_MODE)
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_sysfs_validate_and_copy_buf(cmd, sizeof(cmd),
|
||||
buf, count);
|
||||
if (ret) {
|
||||
hdd_err_rl("invalid input");
|
||||
return ret;
|
||||
}
|
||||
|
||||
sptr = cmd;
|
||||
/* Get set_value */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &set_value))
|
||||
return -EINVAL;
|
||||
|
||||
/* If input value is non-zero get stats */
|
||||
switch (set_value) {
|
||||
case IPA_UC_STAT:
|
||||
ucfg_ipa_uc_stat(hdd_ctx->pdev);
|
||||
break;
|
||||
case IPA_UC_INFO:
|
||||
ucfg_ipa_uc_info(hdd_ctx->pdev);
|
||||
break;
|
||||
case IPA_UC_RT_DEBUG_HOST_DUMP:
|
||||
ucfg_ipa_uc_rt_debug_host_dump(hdd_ctx->pdev);
|
||||
break;
|
||||
case IPA_DUMP_INFO:
|
||||
ucfg_ipa_dump_info(hdd_ctx->pdev);
|
||||
break;
|
||||
default:
|
||||
/* place holder for stats clean up
|
||||
* Stats clean not implemented yet on FW and IPA
|
||||
*/
|
||||
break;
|
||||
}
|
||||
hdd_exit();
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t hdd_sysfs_ipaucstate_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 err_size;
|
||||
|
||||
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
err_size = __hdd_sysfs_ipaucstate_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(ipaucstat, 0220,
|
||||
NULL, hdd_sysfs_ipaucstate_store);
|
||||
|
||||
void hdd_sysfs_ipa_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
if (device_create_file(&adapter->dev->dev, &dev_attr_ipaucstat))
|
||||
hdd_err("could not create wlan sysfs file");
|
||||
}
|
||||
|
||||
void hdd_sysfs_ipa_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_ipaucstat);
|
||||
}
|
Loading…
Reference in New Issue
Block a user