qcacld-3.0: Add a sysfs replacement for connect info

Add sysfs entry to get connection info instead of debugfs.

This feature can be controlled using configuration flag
CONFIG_WLAN_SYSFS_CONNECT_INFO

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

example command: cat /sys/class/net/wlanxx/connect_info

Change-Id: Ibe183e4665cdbea66b83abd4732e7ef33843612d
CRs-Fixed: 2682856
This commit is contained in:
Bapiraju Alla
2020-05-11 10:50:57 +05:30
committed by nshrivas
부모 5cb4bcdee5
커밋 9171aece4a
8개의 변경된 파일187개의 추가작업 그리고 100개의 파일을 삭제

6
Kbuild
파일 보기

@@ -114,7 +114,6 @@ ifeq ($(CONFIG_WLAN_FEATURE_MIB_STATS), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_debugfs_mibstat.o
endif
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_debugfs_csr.o
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_debugfs_connect.o
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_debugfs_offload.o
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_debugfs_roam.o
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_debugfs_config.o
@@ -274,6 +273,9 @@ HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_suspend_resume.o
endif
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_unit_test.o
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_modify_acl.o
ifeq ($(CONFIG_WLAN_SYSFS_CONNECT_INFO), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_connect_info.o
endif
endif
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
@@ -2615,6 +2617,8 @@ cppflags-$(CONFIG_WLAN_SYSFS) += -DWLAN_SYSFS
cppflags-$(CONFIG_FEATURE_WLAN_RMC) += -DFEATURE_WLAN_RMC
cppflags-$(CONFIG_FEATURE_BECN_STATS) += -DWLAN_FEATURE_BEACON_RECEPTION_STATS
cppflags-$(CONFIG_WLAN_SYSFS_CONNECT_INFO) += -DWLAN_SYSFS_CONNECT_INFO
#Set RX_PERFORMANCE
cppflags-$(CONFIG_RX_PERFORMANCE) += -DRX_PERFORMANCE

파일 보기

@@ -177,6 +177,7 @@ CONFIG_WLAN_SYSFS := y
ifeq ($(CONFIG_WLAN_SYSFS), y)
CONFIG_WLAN_SET_FW_MODE_CFG := y
CONFIG_WLAN_REASSOC := y
CONFIG_WLAN_SYSFS_CONNECT_INFO := y
endif
CONFIG_WLAN_POWER_DEBUG := y

파일 보기

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2018, 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
@@ -25,15 +25,13 @@
/**
* enum hdd_debugfs_file_id - Debugfs file Identifier
* @HDD_DEBUFS_FILE_ID_CONNECT_INFO: connect_info file id
* @HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO: roam_scan_stats file id
* @HDD_DEBUFS_FILE_ID_OFFLOAD_INFO: offload_info file id
* @HDD_DEBUGFS_FILE_ID_MAX: maximum id of csr debugfs file
*/
enum hdd_debugfs_file_id {
HDD_DEBUFS_FILE_ID_CONNECT_INFO = 0,
HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO = 1,
HDD_DEBUFS_FILE_ID_OFFLOAD_INFO = 2,
HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO = 0,
HDD_DEBUFS_FILE_ID_OFFLOAD_INFO = 1,
HDD_DEBUGFS_FILE_ID_MAX,
};

파일 보기

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-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
@@ -30,7 +30,6 @@
#ifdef WLAN_DEBUGFS
#define DEBUGFS_CONNECT_INFO_BUF_SIZE (4 * 1024)
#define DEBUGFS_OFFLOAD_INFO_BUF_SIZE (4 * 1024)
#define DEBUGFS_ROAM_SCAN_STATS_INFO_BUF_SIZE (4 * 1024)
@@ -87,19 +86,6 @@ void wlan_hdd_debugfs_csr_deinit(struct hdd_adapter *adapter);
ssize_t
wlan_hdd_current_time_info_debugfs(uint8_t *buf, ssize_t buf_avail_len);
/**
* wlan_hdd_debugfs_update_connect_info() - API to get connect info
* into user buffer
* @buf: output buffer to hold connect info
* @buf_avail_len: available buffer length
*
* Return: No.of bytes copied
*/
ssize_t
wlan_hdd_debugfs_update_connect_info(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter,
uint8_t *buf, ssize_t buf_avail_len);
/**
* wlan_hdd_debugfs_update_filters_info() - API to get offload info
* into user buffer
@@ -160,22 +146,6 @@ wlan_hdd_current_time_info_debugfs(uint8_t *buf, ssize_t buf_avail_len)
return 0;
}
/**
* wlan_hdd_debugfs_update_connect_info() - API to get connect info
* into user buffer
* @buf: output buffer to hold connect info
* @buf_avail_len: available buffer length
*
* Return: No.of bytes copied
*/
static inline ssize_t
wlan_hdd_debugfs_update_connect_info(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter,
uint8_t *buf, ssize_t buf_avail_len)
{
return 0;
}
/**
* wlan_hdd_debugfs_update_filters_info() - API to get offload info
* into user buffer

파일 보기

@@ -0,0 +1,65 @@
/*
* Copyright (c) 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_connect_info.h
*
* implementation for creating sysfs file connect_info
*/
#ifndef _WLAN_HDD_SYSFS_CONNECT_INFO_H
#define _WLAN_HDD_SYSFS_CONNECT_INFO_H
#if defined(WLAN_SYSFS) && defined(WLAN_SYSFS_CONNECT_INFO)
#define SYSFS_CONNECT_INFO_BUF_SIZE (4 * 1024)
/**
* hdd_sysfs_connect_info_interface_create() - API to create connect_info sysfs
* interface
* @adapter: pointer to adapter
*
* file path: /sys/class/net/wlanxx/connect_info
* where wlanxx is adapter name
*
* usage:
* cat /sys/class/net/wlanxx/connect_info
*
* Return: none
*/
void hdd_sysfs_connect_info_interface_create(struct hdd_adapter *adapter);
/**
* hdd_sysfs_connect_info_interface_destroy() - API to destroy connect_info
* sysfs interface
* @adapter: pointer to adapter
*
* Return: none
*/
void hdd_sysfs_connect_info_interface_destroy(struct hdd_adapter *adapter);
#else
static inline
void hdd_sysfs_connect_info_interface_create(struct hdd_adapter *adapter)
{
}
static inline
void hdd_sysfs_connect_info_interface_destroy(struct hdd_adapter *adapter)
{
}
#endif
#endif /* #ifndef _WLAN_HDD_SYSFS_CONNECT_INFO_H */

파일 보기

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-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
@@ -72,11 +72,6 @@ wlan_hdd_debugfs_update_csr(struct hdd_context *hdd_ctx,
ssize_t len = 0;
switch (id) {
case HDD_DEBUFS_FILE_ID_CONNECT_INFO:
/* populate connect info */
len = wlan_hdd_debugfs_update_connect_info(hdd_ctx, adapter,
buf, buf_avail_len);
break;
case HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO:
/* populate roam scan stats info */
len = wlan_hdd_debugfs_update_roam_stats(hdd_ctx, adapter,
@@ -326,19 +321,6 @@ void wlan_hdd_debugfs_csr_init(struct hdd_adapter *adapter)
* and roam info and store in csr_file member of adapter
*/
csr = &adapter->csr_file[HDD_DEBUFS_FILE_ID_CONNECT_INFO];
if (!csr->entry) {
strlcpy(csr->name, "connect_info", max_len);
csr->id = HDD_DEBUFS_FILE_ID_CONNECT_INFO;
csr->buf_max_size = DEBUGFS_CONNECT_INFO_BUF_SIZE;
csr->entry = debugfs_create_file(csr->name, 0444,
adapter->debugfs_phy,
csr, &fops_csr_debugfs);
if (!csr->entry)
hdd_err("Failed to create debugfs file: %s",
csr->name);
}
csr = &adapter->csr_file[HDD_DEBUFS_FILE_ID_OFFLOAD_INFO];
if (!csr->entry) {
strlcpy(csr->name, "offload_info", max_len);

파일 보기

@@ -43,6 +43,7 @@
#include "wlan_hdd_sysfs_suspend_resume.h"
#include "wlan_hdd_sysfs_unit_test.h"
#include "wlan_hdd_sysfs_modify_acl.h"
#include "wlan_hdd_sysfs_connect_info.h"
#define MAX_PSOC_ID_SIZE 10
@@ -619,11 +620,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_suspend_create(adapter);
hdd_sysfs_resume_create(adapter);
hdd_sysfs_unit_test_target_create(adapter);
hdd_sysfs_connect_info_interface_create(adapter);
}
static void
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
{
hdd_sysfs_connect_info_interface_destroy(adapter);
hdd_sysfs_unit_test_target_destroy(adapter);
hdd_sysfs_resume_destroy(adapter);
hdd_sysfs_suspend_destroy(adapter);
@@ -640,11 +643,13 @@ hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_resume_create(adapter);
hdd_sysfs_unit_test_target_create(adapter);
hdd_sysfs_modify_acl_create(adapter);
hdd_sysfs_connect_info_interface_create(adapter);
}
static void
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
{
hdd_sysfs_connect_info_interface_destroy(adapter);
hdd_sysfs_modify_acl_destroy(adapter);
hdd_sysfs_unit_test_target_destroy(adapter);
hdd_sysfs_resume_destroy(adapter);

파일 보기

@@ -1,37 +1,33 @@
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-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.
* 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.
* 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_debugfs_connect.c
* DOC: wlan_hdd_sysfs_connect_info.c
*
* WLAN Host Device Driver implementation to update
* debugfs with connect information
* WLAN Host Device Driver implementation to update sysfs with connect
* information
*/
#include <wlan_hdd_debugfs_csr.h>
#include <wlan_hdd_main.h>
#include <cds_sched.h>
#include <wma_api.h>
#include <wlan_hdd_includes.h>
#include "osif_vdev_sync.h"
#include "wlan_hdd_sysfs_connect_info.h"
#include "qwlan_version.h"
#include "wmi_unified_param.h"
/**
* wlan_hdd_version_info_debugfs() - Populate driver, FW and HW version
* wlan_hdd_version_info() - Populate driver, FW and HW version
* @hdd_ctx: pointer to hdd context
* @buf: output buffer to hold version info
* @buf_avail_len: available buffer length
@@ -39,8 +35,8 @@
* Return: No.of bytes populated by this function in buffer
*/
static ssize_t
wlan_hdd_version_info_debugfs(struct hdd_context *hdd_ctx, uint8_t *buf,
ssize_t buf_avail_len)
wlan_hdd_version_info(struct hdd_context *hdd_ctx, uint8_t *buf,
ssize_t buf_avail_len)
{
ssize_t length = 0;
int ret_val;
@@ -305,16 +301,15 @@ uint8_t *hdd_ch_width_str(enum phy_ch_width ch_width)
}
/**
* wlan_hdd_connect_info_debugfs() - Populate connect info
* wlan_hdd_connect_info() - Populate connect info
* @adapter: pointer to sta adapter for which connect info is required
* @buf: output buffer to hold version info
* @buf_avail_len: available buffer length
*
* Return: No.of bytes populated by this function in buffer
*/
static ssize_t
wlan_hdd_connect_info_debugfs(struct hdd_adapter *adapter, uint8_t *buf,
ssize_t buf_avail_len)
static ssize_t wlan_hdd_connect_info(struct hdd_adapter *adapter, uint8_t *buf,
ssize_t buf_avail_len)
{
ssize_t length = 0;
struct hdd_station_ctx *hdd_sta_ctx;
@@ -410,47 +405,114 @@ wlan_hdd_connect_info_debugfs(struct hdd_adapter *adapter, uint8_t *buf,
return length;
}
ssize_t
wlan_hdd_debugfs_update_connect_info(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter,
uint8_t *buf, ssize_t buf_avail_len)
static ssize_t
wlan_hdd_current_time_info(uint8_t *buf, ssize_t buf_avail_len)
{
ssize_t length;
char time_buffer[HDD_TIME_STRING_LEN];
int ret_val;
qdf_get_time_of_the_day_in_hr_min_sec_usec(time_buffer,
sizeof(time_buffer));
ret_val = scnprintf(buf, buf_avail_len,
"\nTime at which this file generated = %s\n",
time_buffer);
if (ret_val < 0)
return 0;
length = ret_val;
return length;
}
static ssize_t __show_connect_info(struct net_device *net_dev, char *buf,
ssize_t buf_avail_len)
{
struct hdd_adapter *adapter = netdev_priv(net_dev);
struct hdd_context *hdd_ctx;
ssize_t len;
int ret_val;
hdd_enter();
hdd_enter_dev(net_dev);
len = wlan_hdd_current_time_info_debugfs(buf, buf_avail_len);
len = wlan_hdd_current_time_info(buf, buf_avail_len);
if (len >= buf_avail_len) {
hdd_err("No sufficient buf_avail_len");
return buf_avail_len;
len = buf_avail_len;
goto exit;
}
ret_val = hdd_validate_adapter(adapter);
if (0 != ret_val)
return len;
if (adapter->device_mode != QDF_STA_MODE) {
ret_val = scnprintf(buf + len, buf_avail_len - len,
"Interface is not operating STA Mode\n");
if (ret_val <= 0)
return len;
goto exit;
len += ret_val;
return len;
goto exit;
}
if (len >= buf_avail_len) {
hdd_err("No sufficient buf_avail_len");
return buf_avail_len;
len = buf_avail_len;
goto exit;
}
len += wlan_hdd_version_info_debugfs(hdd_ctx, buf + len,
buf_avail_len - len);
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
ret_val = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret_val)
goto exit;
len += wlan_hdd_version_info(hdd_ctx, buf + len, buf_avail_len - len);
if (len >= buf_avail_len) {
hdd_err("No sufficient buf_avail_len");
return buf_avail_len;
len = buf_avail_len;
goto exit;
}
len += wlan_hdd_connect_info_debugfs(adapter, buf + len,
buf_avail_len - len);
len += wlan_hdd_connect_info(adapter, buf + len, buf_avail_len - len);
exit:
hdd_exit();
return len;
}
static ssize_t show_connect_info(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;
ssize_t buf_avail_len = SYSFS_CONNECT_INFO_BUF_SIZE;
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
if (err_size)
return err_size;
err_size = __show_connect_info(net_dev, buf, buf_avail_len);
osif_vdev_sync_op_stop(vdev_sync);
return err_size;
}
static DEVICE_ATTR(connect_info, 0444, show_connect_info, NULL);
void hdd_sysfs_connect_info_interface_create(struct hdd_adapter *adapter)
{
int error;
error = device_create_file(&adapter->dev->dev, &dev_attr_connect_info);
if (error)
hdd_err("could not create connect_info sysfs file");
}
void hdd_sysfs_connect_info_interface_destroy(struct hdd_adapter *adapter)
{
device_remove_file(&adapter->dev->dev, &dev_attr_connect_info);
}