qcacld-3.0: Add sysfs entry for the pktlog
Add the sysfs entry for the pktlog. Previously get_ampdu,get_amsdu would be queried via iwpriv --> iwpriv wlan0 1 1 pktlog it is now changed to support via sysfs: --> echo 1 1 > /sys/class/net/wifi/pktlog Change-Id: Id5461c86bb1369a04bc68514e874df6df1230b85 CRs-Fixed: 2684106
This commit is contained in:

committed by
nshrivas

szülő
40c74bf143
commit
7f3ce11381
3
Kbuild
3
Kbuild
@@ -358,6 +358,9 @@ endif
|
||||
ifeq ($(CONFIG_IPA_OFFLOAD), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_ipa.o
|
||||
endif
|
||||
ifeq ($(CONFIG_REMOVE_PKT_LOG), n)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_pktlog.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
|
51
core/hdd/inc/wlan_hdd_sysfs_pkt_log.h
Normal file
51
core/hdd/inc/wlan_hdd_sysfs_pkt_log.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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_PKT_LOG_H
|
||||
#define WLAN_HDD_SYSFS_PKT_LOG_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && !defined(REMOVE_PKT_LOG)
|
||||
|
||||
/**
|
||||
* hdd_sysfs_pktlog_create(): Initialize pktlog specific sysfs file
|
||||
* @driver_kobject: Driver Kobject
|
||||
*
|
||||
* Function to initialize pktlog specific mode syfs files.
|
||||
*
|
||||
* Return: NONE
|
||||
*/
|
||||
void hdd_sysfs_pktlog_create(struct kobject *driver_kobject);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_pktlog_destroy(): Remove pktlog sysfs file
|
||||
* @driver_kobject: Driver Kobject
|
||||
*
|
||||
* Function to remove pktlog specific mode syfs files.
|
||||
*
|
||||
* Return: NONE
|
||||
*/
|
||||
void hdd_sysfs_pktlog_destroy(struct kobject *driver_kobject);
|
||||
#else
|
||||
static inline
|
||||
void hdd_sysfs_pktlog_create(struct kobject *driver_kobject)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void hdd_sysfs_pktlog_destroy(struct kobject *driver_kobject)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -71,6 +71,7 @@
|
||||
#include <wlan_hdd_sysfs_thermal_cfg.h>
|
||||
#include <wlan_hdd_sysfs_motion_detection.h>
|
||||
#include <wlan_hdd_sysfs_ipa.h>
|
||||
#include <wlan_hdd_sysfs_pkt_log.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
@@ -771,12 +772,14 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
|
||||
hdd_sysfs_set_scan_cfg_create(driver_kobject);
|
||||
hdd_sysfs_dp_trace_create(driver_kobject);
|
||||
hdd_sysfs_thermal_cfg_create(driver_kobject);
|
||||
hdd_sysfs_pktlog_create(driver_kobject);
|
||||
}
|
||||
}
|
||||
|
||||
void hdd_destroy_sysfs_files(void)
|
||||
{
|
||||
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
||||
hdd_sysfs_pktlog_destroy(driver_kobject);
|
||||
hdd_sysfs_thermal_cfg_destroy(driver_kobject);
|
||||
hdd_sysfs_dp_trace_destroy(driver_kobject);
|
||||
hdd_sysfs_set_scan_cfg_destroy(driver_kobject);
|
||||
|
100
core/hdd/src/wlan_hdd_sysfs_pktlog.c
Normal file
100
core/hdd/src/wlan_hdd_sysfs_pktlog.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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.h>
|
||||
#include <wlan_hdd_sysfs_pkt_log.h>
|
||||
#include "osif_sync.h"
|
||||
|
||||
#define MAX_USER_COMMAND_SIZE_PKT_LOG_CMD 4
|
||||
|
||||
static ssize_t __hdd_sysfs_pkt_log_cmd_store(struct hdd_context *hdd_ctx,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
char buf_local[MAX_USER_COMMAND_SIZE_PKT_LOG_CMD + 1];
|
||||
char *sptr, *token;
|
||||
uint32_t val1, val2;
|
||||
int ret;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
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)
|
||||
return -EINVAL;
|
||||
|
||||
sptr = buf_local;
|
||||
/* Get val1 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val1))
|
||||
return -EINVAL;
|
||||
|
||||
sptr = buf_local;
|
||||
/* Get val2 */
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val2))
|
||||
return -EINVAL;
|
||||
|
||||
ret = hdd_process_pktlog_command(hdd_ctx, val1, val2);
|
||||
|
||||
hdd_exit();
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t hdd_sysfs_pkt_log_cmd_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 err_size;
|
||||
|
||||
if (wlan_hdd_validate_context(hdd_ctx))
|
||||
return 0;
|
||||
|
||||
err_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
||||
&psoc_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
err_size = __hdd_sysfs_pkt_log_cmd_store(hdd_ctx, buf, count);
|
||||
|
||||
osif_psoc_sync_op_stop(psoc_sync);
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static struct kobj_attribute pktlog_attribute =
|
||||
__ATTR(pktlog, 0220, NULL,
|
||||
hdd_sysfs_pkt_log_cmd_store);
|
||||
|
||||
void hdd_sysfs_pktlog_create(struct kobject *driver_kobject)
|
||||
{
|
||||
if (sysfs_create_file(driver_kobject, &pktlog_attribute.attr))
|
||||
hdd_err("Failed to create pktlog sysfs entry");
|
||||
}
|
||||
|
||||
void hdd_sysfs_pktlog_destroy(struct kobject *driver_kobject)
|
||||
{
|
||||
sysfs_remove_file(driver_kobject, &pktlog_attribute.attr);
|
||||
}
|
Reference in New Issue
Block a user