mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
qcacld-3.0: Add a sysfs replacement for getTdlsPeers
As part of WEXT replacement, replace getTdlsPeers with a sysfs file. This feature can be controlled using configuration flag CONFIG_WLAN_GET_TDLS_PEERS file path: /sys/class/net/wlanxx/get_tdls_peers where wlanxx is adapter name example command: cat /sys/class/net/wlanxx/get_tdls_peers Change-Id: I66123266d6a3bf4c5c82f70186e35aa9942533b1 CRs-Fixed: 2681810
This commit is contained in:
parent
eeaa86c203
commit
6b2b3ea7c8
5 changed files with 191 additions and 0 deletions
4
Kbuild
4
Kbuild
|
|
@ -309,6 +309,9 @@ endif
|
|||
ifeq ($(CONFIG_WLAN_GET_RANGE_EXT), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_range_ext.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_GET_TDLS_PEERS), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_tdls_peers.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
|
|
@ -2578,6 +2581,7 @@ endif
|
|||
|
||||
#normally, TDLS negative behavior is not needed
|
||||
cppflags-$(CONFIG_QCOM_TDLS) += -DFEATURE_WLAN_TDLS
|
||||
cppflags-$(CONFIG_WLAN_GET_TDLS_PEERS) += -DWLAN_GET_TDLS_PEERS
|
||||
|
||||
cppflags-$(CONFIG_QCACLD_WLAN_LFR3) += -DWLAN_FEATURE_ROAM_OFFLOAD
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
|
|||
CONFIG_WLAN_TXRX_STATS := y
|
||||
CONFIG_WLAN_SET_DP_TRACE := y
|
||||
CONFIG_WLAN_GET_RANGE_EXT := y
|
||||
ifeq ($(CONFIG_QCOM_TDLS), y)
|
||||
CONFIG_WLAN_GET_TDLS_PEERS := y
|
||||
endif
|
||||
endif
|
||||
|
||||
CONFIG_WLAN_POWER_DEBUG := y
|
||||
|
|
|
|||
63
core/hdd/inc/wlan_hdd_sysfs_get_tdls_peers.h
Normal file
63
core/hdd/inc/wlan_hdd_sysfs_get_tdls_peers.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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_tdls_peers.h
|
||||
*
|
||||
* implementation for creating sysfs file get TDLS peers
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_GET_TDLS_PEERS_H
|
||||
#define _WLAN_HDD_SYSFS_GET_TDLS_PEERS_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(WLAN_GET_TDLS_PEERS)
|
||||
/**
|
||||
* hdd_sysfs_get_tdls_peers_interface_create() - API to create get_tdls_peers
|
||||
* sysfs interface
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/get_tdls_peers
|
||||
* where wlanxx is adapter name
|
||||
*
|
||||
* usage:
|
||||
* cat /sys/class/net/wlanxx/get_tdls_peers
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_get_tdls_peers_interface_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_get_tdls_peers_interface_destroy() - API to destroy get_tdls_peers
|
||||
* sysfs interface
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_get_tdls_peers_interface_destroy(struct hdd_adapter *adapter);
|
||||
|
||||
#else
|
||||
static inline
|
||||
void hdd_sysfs_get_tdls_peers_interface_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void hdd_sysfs_get_tdls_peers_interface_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_GET_TDLS_PEERS_H */
|
||||
|
|
@ -55,6 +55,7 @@
|
|||
#include <wlan_hdd_sysfs_txrx_stats.h>
|
||||
#include <wlan_hdd_sysfs_set_dp_trace.h>
|
||||
#include <wlan_hdd_sysfs_get_range_ext.h>
|
||||
#include <wlan_hdd_sysfs_get_tdls_peers.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
|
|
@ -637,11 +638,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
|||
hdd_sysfs_txrx_fw_stats_create(adapter);
|
||||
hdd_sysfs_txrx_stats_create(adapter);
|
||||
hdd_sysfs_get_range_ext_create(adapter);
|
||||
hdd_sysfs_get_tdls_peers_interface_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_get_tdls_peers_interface_destroy(adapter);
|
||||
hdd_sysfs_get_range_ext_destroy(adapter);
|
||||
hdd_sysfs_txrx_stats_destroy(adapter);
|
||||
hdd_sysfs_txrx_fw_stats_destroy(adapter);
|
||||
|
|
|
|||
118
core/hdd/src/wlan_hdd_sysfs_get_tdls_peers.c
Normal file
118
core/hdd/src/wlan_hdd_sysfs_get_tdls_peers.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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_tdls_peers.c
|
||||
*
|
||||
* implementation for creating sysfs file get_tdls_peers
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include "osif_vdev_sync.h"
|
||||
#include "wlan_hdd_object_manager.h"
|
||||
#include "wlan_hdd_sysfs_get_tdls_peers.h"
|
||||
|
||||
/**
|
||||
* __show_tdls_all_peers() - dump all TDLS peer info into output string
|
||||
* @net_dev: net device
|
||||
* @buf: output string buffer to hold the peer info
|
||||
*
|
||||
* Return: The size (in bytes) of the valid peer info in the output buffer
|
||||
*/
|
||||
static int __show_tdls_all_peers(struct net_device *net_dev, char *buf)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
int ret_val;
|
||||
|
||||
hdd_enter_dev(net_dev);
|
||||
|
||||
ret_val = scnprintf(buf, PAGE_SIZE, "%s getTdlsPeers:",
|
||||
net_dev->name);
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
ret_val += scnprintf(buf + ret_val, PAGE_SIZE - ret_val,
|
||||
"\nHDD adapter is not valid\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
if (0 != (wlan_hdd_validate_context(hdd_ctx))) {
|
||||
ret_val += scnprintf(buf + ret_val, PAGE_SIZE - ret_val,
|
||||
"\nHDD context is not valid\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((QDF_STA_MODE != adapter->device_mode) &&
|
||||
(QDF_P2P_CLIENT_MODE != adapter->device_mode)) {
|
||||
ret_val += scnprintf(buf + ret_val, PAGE_SIZE - ret_val,
|
||||
"\nNo TDLS support for this adapter\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
vdev = hdd_objmgr_get_vdev(adapter);
|
||||
if (!vdev) {
|
||||
ret_val += scnprintf(buf + ret_val, PAGE_SIZE - ret_val,
|
||||
"\nVDEV is NULL\n");
|
||||
goto exit;
|
||||
}
|
||||
ret_val += wlan_cfg80211_tdls_get_all_peers(vdev, buf + ret_val,
|
||||
PAGE_SIZE - ret_val);
|
||||
hdd_objmgr_put_vdev(vdev);
|
||||
|
||||
exit:
|
||||
if ((PAGE_SIZE - ret_val) > 0)
|
||||
ret_val += scnprintf(buf + ret_val, PAGE_SIZE - ret_val, "\n");
|
||||
|
||||
hdd_exit();
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static ssize_t show_tdls_all_peers(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_tdls_all_peers(net_dev, buf);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(get_tdls_peers, 0444, show_tdls_all_peers, NULL);
|
||||
|
||||
void hdd_sysfs_get_tdls_peers_interface_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev,
|
||||
&dev_attr_get_tdls_peers);
|
||||
if (error)
|
||||
hdd_err("could not create get_tdls_peers sysfs file");
|
||||
}
|
||||
|
||||
void hdd_sysfs_get_tdls_peers_interface_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_get_tdls_peers);
|
||||
}
|
||||
Loading…
Reference in a new issue