qcacld-3.0: Add a sysfs replacement for get_sta_info

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

This feature can be controlled using configuration flag
CONFIG_WLAN_SYSFS_GET_STA_INFO

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

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

Change-Id: Iac23cdc92a860279480ec9703697f22b2f0b5223
CRs-Fixed: 2682163
このコミットが含まれているのは:
Bapiraju Alla
2020-05-08 23:44:33 +05:30
committed by nshrivas
コミット ba6b3520d3
5個のファイルの変更182行の追加0行の削除

5
Kbuild
ファイルの表示

@@ -265,6 +265,9 @@ endif
ifeq ($(CONFIG_WLAN_REASSOC), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_reassoc.o
endif
ifeq ($(CONFIG_WLAN_SYSFS_GET_STA_INFO), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_sta_info.o
endif
ifeq ($(CONFIG_WLAN_DEBUG_CRASH_INJECT), y)
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_crash_inject.o
endif
@@ -2519,6 +2522,8 @@ cppflags-$(CONFIG_WLAN_WOWL_ADD_PTRN) += -DCONFIG_WLAN_WOWL_ADD_PTRN
cppflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
cppflags-$(CONFIG_FEATURE_WLM_STATS) += -DFEATURE_WLM_STATS
cppflags-$(CONFIG_WLAN_SYSFS_GET_STA_INFO) += -DWLAN_SYSFS_GET_STA_INFO
ifeq ($(CONFIG_LEAK_DETECTION), y)
cppflags-y += \
-DCONFIG_HALT_KMEMLEAK \

ファイルの表示

@@ -175,6 +175,7 @@ CONFIG_QCOM_TDLS := y
CONFIG_WLAN_SYSFS := y
ifeq ($(CONFIG_WLAN_SYSFS), y)
CONFIG_WLAN_SYSFS_GET_STA_INFO := y
CONFIG_WLAN_SET_FW_MODE_CFG := y
CONFIG_WLAN_REASSOC := y
CONFIG_WLAN_SYSFS_CONNECT_INFO := y

62
core/hdd/inc/wlan_hdd_sysfs_get_sta_info.h ノーマルファイル
ファイルの表示

@@ -0,0 +1,62 @@
/*
* 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_get_sta_info.h
*
* implementation for creating sysfs file get_sta_info
*/
#ifndef _WLAN_HDD_SYSFS_GET_STA_INFO_H
#define _WLAN_HDD_SYSFS_GET_STA_INFO_H
#if defined(WLAN_SYSFS) && defined(WLAN_SYSFS_GET_STA_INFO)
/**
* hdd_sysfs_get_sta_info_interface_create() - API to create get_sta_info sysfs
* interface
* @adapter: pointer to adapter
*
* this file is created for SAP adapter.
* file path: /sys/class/net/wlanxx/get_sta_info
* where wlanxx is adapter name
*
* usage:
* cat /sys/class/net/wlanxx/get_sta_info
*
* Return: none
*/
void hdd_sysfs_get_sta_info_interface_create(struct hdd_adapter *adapter);
/**
* hdd_sysfs_get_sta_info_interface_destroy() - API to destroy get_sta_info
* @adapter: pointer to adapter
*
* Return: none
*/
void hdd_sysfs_get_sta_info_interface_destroy(struct hdd_adapter *adapter);
#else
static inline
void hdd_sysfs_get_sta_info_interface_create(struct hdd_adapter *adapter)
{
}
static inline
void hdd_sysfs_get_sta_info_interface_destroy(struct hdd_adapter *adapter)
{
}
#endif
#endif /* #ifndef _WLAN_HDD_SYSFS_GET_STA_INFO_H */

ファイルの表示

@@ -37,6 +37,7 @@
#include <sir_api.h>
#endif
#include "osif_sync.h"
#include "wlan_hdd_sysfs_get_sta_info.h"
#include <wlan_hdd_sysfs_set_fw_mode_cfg.h>
#include <wlan_hdd_sysfs_reassoc.h>
#include "wlan_hdd_sysfs_crash_inject.h"
@@ -617,6 +618,7 @@ static void hdd_sysfs_destroy_bcn_reception_interface(struct hdd_adapter
static void
hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
{
hdd_sysfs_get_sta_info_interface_create(adapter);
hdd_sysfs_create_bcn_reception_interface(adapter);
hdd_sysfs_reassoc_create(adapter);
hdd_sysfs_crash_inject_create(adapter);
@@ -638,11 +640,13 @@ hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_crash_inject_destroy(adapter);
hdd_sysfs_reassoc_destroy(adapter);
hdd_sysfs_destroy_bcn_reception_interface(adapter);
hdd_sysfs_get_sta_info_interface_destroy(adapter);
}
static void
hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
{
hdd_sysfs_get_sta_info_interface_create(adapter);
hdd_sysfs_crash_inject_create(adapter);
hdd_sysfs_suspend_create(adapter);
hdd_sysfs_resume_create(adapter);
@@ -660,6 +664,7 @@ hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
hdd_sysfs_resume_destroy(adapter);
hdd_sysfs_suspend_destroy(adapter);
hdd_sysfs_crash_inject_destroy(adapter);
hdd_sysfs_get_sta_info_interface_destroy(adapter);
}
void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)

109
core/hdd/src/wlan_hdd_sysfs_get_sta_info.c ノーマルファイル
ファイルの表示

@@ -0,0 +1,109 @@
/*
* 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_get_sta_info.c
*
* implementation for creating sysfs file get_sta_info
*/
#include <wlan_hdd_includes.h>
#include "osif_vdev_sync.h"
#include "wlan_hdd_sysfs_get_sta_info.h"
static ssize_t __show_sta_info(struct net_device *net_dev, char *buf)
{
struct hdd_adapter *adapter = netdev_priv(net_dev);
struct hdd_context *hdd_ctx;
struct hdd_station_info *sta;
int ret_val;
hdd_enter_dev(net_dev);
ret_val = hdd_validate_adapter(adapter);
if (0 != ret_val)
goto exit;
if (adapter->device_mode != QDF_SAP_MODE)
goto exit;
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
ret_val = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret_val)
goto exit;
ret_val = scnprintf(buf, PAGE_SIZE,
"%s get_sta_info:\nstaAddress\n",
net_dev->name);
hdd_for_each_sta_ref(adapter->sta_info_list, sta) {
if (QDF_IS_ADDR_BROADCAST(sta->sta_mac.bytes)) {
hdd_put_sta_info_ref(&adapter->sta_info_list, &sta,
true);
continue;
}
ret_val += scnprintf(buf + ret_val, PAGE_SIZE - ret_val,
QDF_MAC_ADDR_STR " ecsa=%d\n",
sta->sta_mac.bytes[0],
sta->sta_mac.bytes[1],
sta->sta_mac.bytes[2],
sta->sta_mac.bytes[3],
sta->sta_mac.bytes[4],
sta->sta_mac.bytes[5],
sta->ecsa_capable);
hdd_put_sta_info_ref(&adapter->sta_info_list, &sta, true);
}
exit:
hdd_exit();
return ret_val;
}
static ssize_t show_sta_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;
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
if (err_size)
return err_size;
err_size = __show_sta_info(net_dev, buf);
osif_vdev_sync_op_stop(vdev_sync);
return err_size;
}
static DEVICE_ATTR(get_sta_info, 0444, show_sta_info, NULL);
void hdd_sysfs_get_sta_info_interface_create(struct hdd_adapter *adapter)
{
int error;
error = device_create_file(&adapter->dev->dev, &dev_attr_get_sta_info);
if (error)
hdd_err("Could not create get_sta_info sysfs file");
}
void hdd_sysfs_get_sta_info_interface_destroy(struct hdd_adapter *adapter)
{
device_remove_file(&adapter->dev->dev, &dev_attr_get_sta_info);
}