qcacld-3.0: Add a sysfs replacement for reassoc
As part of WEXT replacement, replace reassoc with a sysfs file. file path: /sys/class/net/wlanxx/reassoc where wlanxx is adapter name example: echo 0 > reassoc Change-Id: Ib4f3582bb8c164dd4f3ab739367520b9aeb0f5b9 CRs-Fixed: 2676629
This commit is contained in:
parent
549fb49793
commit
e93ba0f5b1
4
Kbuild
4
Kbuild
@ -266,6 +266,9 @@ HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs.o
|
||||
ifeq ($(CONFIG_WLAN_SET_FW_MODE_CFG), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_set_fw_mode_cfg.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_REASSOC), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_reassoc.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
@ -2493,6 +2496,7 @@ endif
|
||||
cppflags-$(CONFIG_UNIT_TEST) += -DWLAN_UNIT_TEST
|
||||
cppflags-$(CONFIG_WLAN_DEBUG_CRASH_INJECT) += -DCONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||
cppflags-$(CONFIG_WLAN_SET_FW_MODE_CFG) += -DCONFIG_WLAN_SET_FW_MODE_CFG
|
||||
cppflags-$(CONFIG_WLAN_REASSOC) += -DCONFIG_WLAN_REASSOC
|
||||
cppflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
|
||||
cppflags-$(CONFIG_FEATURE_WLM_STATS) += -DFEATURE_WLM_STATS
|
||||
|
||||
|
@ -176,6 +176,7 @@ CONFIG_WLAN_SYSFS := y
|
||||
|
||||
ifeq ($(CONFIG_WLAN_SYSFS), y)
|
||||
CONFIG_WLAN_SET_FW_MODE_CFG := y
|
||||
CONFIG_WLAN_REASSOC := y
|
||||
endif
|
||||
|
||||
CONFIG_WLAN_POWER_DEBUG := y
|
||||
|
@ -37,21 +37,6 @@ int
|
||||
hdd_sysfs_validate_and_copy_buf(char *dest_buf, size_t dest_buf_size,
|
||||
char const *src_buf, size_t src_buf_size);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_create_adapter_root_obj() - create adapter sysfs entries
|
||||
* @adapter: HDD adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_create_adapter_root_obj(struct hdd_adapter *adapter);
|
||||
/**
|
||||
* hdd_sysfs_destroy_adapter_root_obj() - Destroy adapter sysfs entries
|
||||
* @adapter: HDD adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_destroy_adapter_root_obj(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_create_sysfs_files() - create sysfs files
|
||||
* @hdd_ctx: pointer to hdd context
|
||||
@ -67,6 +52,21 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx);
|
||||
*/
|
||||
void hdd_destroy_sysfs_files(void);
|
||||
|
||||
/**
|
||||
* hdd_create_adapter_sysfs_files - create adapter sysfs files
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_create_adapter_sysfs_files(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_destroy_adapter_sysfs_files - destroy adapter sysfs files
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_destroy_adapter_sysfs_files(struct hdd_adapter *adapter);
|
||||
#else
|
||||
static inline int
|
||||
hdd_sysfs_validate_and_copy_buf(char *dest_buf, size_t dest_buf_size,
|
||||
@ -93,7 +93,13 @@ void hdd_sysfs_destroy_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
static void hdd_create_adapter_sysfs_files(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
static void hdd_destroy_adapter_sysfs_files(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif /* End of WLAN SYSFS*/
|
||||
|
||||
#endif /* End of _WLAN_HDD_SYSFS_H_ */
|
||||
|
@ -5420,8 +5420,8 @@ static void hdd_cleanup_adapter(struct hdd_context *hdd_ctx,
|
||||
hdd_sta_info_deinit(&adapter->cache_sta_info_list);
|
||||
|
||||
wlan_hdd_debugfs_csr_deinit(adapter);
|
||||
if (adapter->device_mode == QDF_STA_MODE)
|
||||
hdd_sysfs_destroy_adapter_root_obj(adapter);
|
||||
|
||||
hdd_destroy_adapter_sysfs_files(adapter);
|
||||
|
||||
hdd_debugfs_exit(adapter);
|
||||
|
||||
@ -6091,9 +6091,6 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
|
||||
hdd_nud_init_tracking(adapter);
|
||||
hdd_mic_init_work(adapter);
|
||||
|
||||
if (adapter->device_mode == QDF_STA_MODE ||
|
||||
adapter->device_mode == QDF_P2P_DEVICE_MODE)
|
||||
hdd_sysfs_create_adapter_root_obj(adapter);
|
||||
qdf_mutex_create(&adapter->disconnection_status_lock);
|
||||
hdd_periodic_sta_stats_mutex_create(adapter);
|
||||
|
||||
@ -6231,6 +6228,8 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
|
||||
|
||||
hdd_periodic_sta_stats_init(adapter);
|
||||
|
||||
hdd_create_adapter_sysfs_files(adapter);
|
||||
|
||||
return adapter;
|
||||
|
||||
err_free_netdev:
|
||||
|
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
#include "osif_sync.h"
|
||||
#include <wlan_hdd_sysfs_set_fw_mode_cfg.h>
|
||||
#include <wlan_hdd_sysfs_reassoc.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
@ -597,22 +598,37 @@ static int hdd_sysfs_create_bcn_reception_interface(struct hdd_adapter
|
||||
return error;
|
||||
}
|
||||
|
||||
void hdd_sysfs_create_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_create_bcn_reception_interface(adapter);
|
||||
}
|
||||
|
||||
static void hdd_sysfs_destroy_bcn_reception_interface(struct hdd_adapter
|
||||
*adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_beacon_stats);
|
||||
}
|
||||
|
||||
void hdd_sysfs_destroy_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
#endif
|
||||
|
||||
static void
|
||||
hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_create_bcn_reception_interface(adapter);
|
||||
hdd_sysfs_reassoc_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_reassoc_destroy(adapter);
|
||||
hdd_sysfs_destroy_bcn_reception_interface(adapter);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
|
||||
void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
|
||||
{
|
||||
@ -630,3 +646,35 @@ void hdd_destroy_sysfs_files(void)
|
||||
hdd_sysfs_destroy_driver_root_obj();
|
||||
}
|
||||
|
||||
void hdd_create_adapter_sysfs_files(struct hdd_adapter *adapter)
|
||||
{
|
||||
int device_mode = adapter->device_mode;
|
||||
|
||||
switch (device_mode){
|
||||
case QDF_STA_MODE:
|
||||
case QDF_P2P_DEVICE_MODE:
|
||||
hdd_sysfs_create_sta_adapter_root_obj(adapter);
|
||||
break;
|
||||
case QDF_SAP_MODE:
|
||||
hdd_sysfs_create_sap_adapter_root_obj(adapter);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void hdd_destroy_adapter_sysfs_files(struct hdd_adapter *adapter)
|
||||
{
|
||||
int device_mode = adapter->device_mode;
|
||||
|
||||
switch (device_mode){
|
||||
case QDF_STA_MODE:
|
||||
hdd_sysfs_destroy_sta_adapter_root_obj(adapter);
|
||||
break;
|
||||
case QDF_SAP_MODE:
|
||||
hdd_sysfs_destroy_sap_adapter_root_obj(adapter);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
114
core/hdd/src/wlan_hdd_sysfs_reassoc.c
Normal file
114
core/hdd/src/wlan_hdd_sysfs_reassoc.c
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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_reassoc.c
|
||||
*
|
||||
* implementation for creating sysfs file reassoc
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include "osif_vdev_sync.h"
|
||||
#include "wlan_hdd_sysfs_reassoc.h"
|
||||
|
||||
static ssize_t
|
||||
__wlan_hdd_store_reassoc_sysfs(struct net_device *net_dev, char const *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
tCsrRoamModifyProfileFields mod_fields;
|
||||
uint32_t roam_id = INVALID_ROAM_ID;
|
||||
struct hdd_context *hdd_ctx;
|
||||
mac_handle_t mac_handle;
|
||||
uint32_t operating_ch;
|
||||
tSirMacAddr bssid;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
mac_handle = hdd_ctx->mac_handle;
|
||||
operating_ch = wlan_reg_freq_to_chan(hdd_ctx->pdev,
|
||||
adapter->session.station.conn_info.chan_freq);
|
||||
|
||||
hdd_debug("reassoc: net_devname %s", net_dev->name);
|
||||
|
||||
sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
|
||||
&mod_fields);
|
||||
|
||||
if (roaming_offload_enabled(hdd_ctx)) {
|
||||
qdf_mem_copy(bssid,
|
||||
&adapter->session.station.conn_info.bssid,
|
||||
sizeof(bssid));
|
||||
hdd_wma_send_fastreassoc_cmd(adapter,
|
||||
bssid, operating_ch);
|
||||
} else {
|
||||
sme_roam_reassoc(mac_handle, adapter->vdev_id,
|
||||
NULL, mod_fields, &roam_id, 1);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t wlan_hdd_store_reassoc_sysfs(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 = __wlan_hdd_store_reassoc_sysfs(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(reassoc, 0220,
|
||||
NULL, wlan_hdd_store_reassoc_sysfs);
|
||||
|
||||
int hdd_sysfs_reassoc_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev, &dev_attr_reassoc);
|
||||
if (error)
|
||||
hdd_err("could not create reassoc sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void hdd_sysfs_reassoc_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_reassoc);
|
||||
}
|
64
core/hdd/src/wlan_hdd_sysfs_reassoc.h
Normal file
64
core/hdd/src/wlan_hdd_sysfs_reassoc.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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_reassoc.h
|
||||
*
|
||||
* implementation for creating sysfs file reassoc
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_REASSOC_H
|
||||
#define _WLAN_HDD_SYSFS_REASSOC_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_REASSOC)
|
||||
/**
|
||||
* hdd_sysfs_reassoc_create() - API to create reassoc
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/reassoc
|
||||
* where wlanxx is adapter name
|
||||
*
|
||||
* usage:
|
||||
* echo [arg_0] > reassoc
|
||||
*
|
||||
* Return: 0 on success and errno on failure
|
||||
*/
|
||||
int hdd_sysfs_reassoc_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_reassoc_destroy() -
|
||||
* API to destroy reassoc
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_reassoc_destroy(struct hdd_adapter *adapter);
|
||||
#else
|
||||
static inline int
|
||||
hdd_sysfs_reassoc_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hdd_sysfs_reassoc_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_REASSOC_H */
|
Loading…
Reference in New Issue
Block a user