qcacld-3.0: Add a sysfs replacement for wowlAddPtrn
As part of WEXT replacement, replace wowlAddPtrn with a sysfs file. file path: /sys/class/net/wlanxx/wowl_add_ptrn where wlanxx is adapter name example: echo 08:01:FFFFFFFFFFFF0000:FC > wowl_add_ptrn Change-Id: I46d00fd8a15851cf2838f3b07a0ec2d1050d1087 CRs-Fixed: 2680490
This commit is contained in:

committed by
nshrivas

parent
e10a627c6c
commit
6e244ca777
4
Kbuild
4
Kbuild
@@ -282,6 +282,9 @@ endif
|
||||
ifeq ($(CONFIG_WLAN_WOW_ITO), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_wow_ito.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_WOWL_ADD_PTRN), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_wowl_add_ptrn.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
@@ -2512,6 +2515,7 @@ cppflags-$(CONFIG_WLAN_SET_FW_MODE_CFG) += -DCONFIG_WLAN_SET_FW_MODE_CFG
|
||||
cppflags-$(CONFIG_WLAN_REASSOC) += -DCONFIG_WLAN_REASSOC
|
||||
cppflags-$(CONFIG_WLAN_SCAN_DISABLE) += -DCONFIG_WLAN_SCAN_DISABLE
|
||||
cppflags-$(CONFIG_WLAN_WOW_ITO) += -DCONFIG_WLAN_WOW_ITO
|
||||
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
|
||||
|
||||
|
@@ -180,6 +180,7 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
|
||||
CONFIG_WLAN_SYSFS_CONNECT_INFO := y
|
||||
CONFIG_WLAN_SCAN_DISABLE := y
|
||||
CONFIG_WLAN_WOW_ITO := y
|
||||
CONFIG_WLAN_WOWL_ADD_PTRN := y
|
||||
endif
|
||||
|
||||
CONFIG_WLAN_POWER_DEBUG := y
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include "wlan_hdd_sysfs_connect_info.h"
|
||||
#include <wlan_hdd_sysfs_scan_disable.h>
|
||||
#include <wlan_hdd_sysfs_wow_ito.h>
|
||||
#include <wlan_hdd_sysfs_wowl_add_ptrn.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
@@ -623,11 +624,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
hdd_sysfs_resume_create(adapter);
|
||||
hdd_sysfs_unit_test_target_create(adapter);
|
||||
hdd_sysfs_connect_info_interface_create(adapter);
|
||||
hdd_sysfs_wowl_add_ptrn_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_wowl_add_ptrn_destroy(adapter);
|
||||
hdd_sysfs_connect_info_interface_destroy(adapter);
|
||||
hdd_sysfs_unit_test_target_destroy(adapter);
|
||||
hdd_sysfs_resume_destroy(adapter);
|
||||
|
110
core/hdd/src/wlan_hdd_sysfs_wowl_add_ptrn.c
Normal file
110
core/hdd/src/wlan_hdd_sysfs_wowl_add_ptrn.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_wowl_add_ptrn.c
|
||||
*
|
||||
* implementation for creating sysfs file wowl_add_ptrn
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include "osif_vdev_sync.h"
|
||||
#include "wlan_hdd_wowl.h"
|
||||
#include <wlan_hdd_sysfs_wowl_add_ptrn.h>
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_wowl_add_ptrn_store(struct net_device *net_dev,
|
||||
char const *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
||||
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)
|
||||
return ret;
|
||||
|
||||
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) {
|
||||
hdd_err_rl("invalid input");
|
||||
return ret;
|
||||
}
|
||||
|
||||
hdd_debug("wowl_add_ptrn: count %zu buf_local:(%s)",
|
||||
count, buf_local);
|
||||
|
||||
if (!hdd_add_wowl_ptrn(adapter, buf_local)) {
|
||||
hdd_err_rl("Failed to add wowl ptrn");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_wowl_add_ptrn_store(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 = __hdd_sysfs_wowl_add_ptrn_store(net_dev, buf, count);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(wowl_add_ptrn, 0220,
|
||||
NULL, hdd_sysfs_wowl_add_ptrn_store);
|
||||
|
||||
int hdd_sysfs_wowl_add_ptrn_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev,
|
||||
&dev_attr_wowl_add_ptrn);
|
||||
if (error)
|
||||
hdd_err("could not create wowl_add_ptrn sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void hdd_sysfs_wowl_add_ptrn_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_wowl_add_ptrn);
|
||||
}
|
64
core/hdd/src/wlan_hdd_sysfs_wowl_add_ptrn.h
Normal file
64
core/hdd/src/wlan_hdd_sysfs_wowl_add_ptrn.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_wowl_add_ptrn.h
|
||||
*
|
||||
* implementation for creating sysfs file wowl_add_ptrn
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_WOWL_ADD_PTRN_H
|
||||
#define _WLAN_HDD_SYSFS_WOWL_ADD_PTRN_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_WOWL_ADD_PTRN)
|
||||
/**
|
||||
* hdd_sysfs_wowl_add_ptrn_create() - API to create wowl_add_ptrn
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/wowl_add_ptrn
|
||||
* where wlanxx is adapter name
|
||||
*
|
||||
* usage:
|
||||
* echo 08:01:FFFFFFFFFFFF0000:FC > wowl_add_ptrn
|
||||
*
|
||||
* Return: 0 on success and errno on failure
|
||||
*/
|
||||
int hdd_sysfs_wowl_add_ptrn_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_wowl_add_ptrn_destroy() -
|
||||
* API to destroy wowl_add_ptrn
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_wowl_add_ptrn_destroy(struct hdd_adapter *adapter);
|
||||
#else
|
||||
static inline int
|
||||
hdd_sysfs_wowl_add_ptrn_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hdd_sysfs_wowl_add_ptrn_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_WOWL_ADD_PTRN_H */
|
Reference in New Issue
Block a user