mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
qcacmn: Add support for converged NAN config params
Update NAN module to support INI configuration params based on converged CFG component. Change-Id: I2253daf8cbbce6d2afa28c5834179f21c2b76660 CRs-fixed: 2290357
This commit is contained in:
parent
cb0c0a1d8b
commit
5c81249094
5 changed files with 379 additions and 0 deletions
|
|
@ -29,6 +29,57 @@
|
|||
#include "wlan_objmgr_psoc_obj.h"
|
||||
#include "wlan_objmgr_pdev_obj.h"
|
||||
#include "wlan_objmgr_vdev_obj.h"
|
||||
#include "cfg_nan.h"
|
||||
#include "cfg_ucfg_api.h"
|
||||
|
||||
/**
|
||||
* nan_cfg_init() - Initialize NAN config params
|
||||
* @psoc: Pointer to PSOC Object
|
||||
* @nan_obj: Pointer to NAN private object
|
||||
*
|
||||
* This function initialize NAN config params
|
||||
*/
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
static void nan_cfg_init(struct wlan_objmgr_psoc *psoc,
|
||||
struct nan_psoc_priv_obj *nan_obj)
|
||||
{
|
||||
if (!psoc || !nan_obj)
|
||||
return;
|
||||
|
||||
nan_obj->cfg_param.enable = cfg_get(psoc, CFG_NAN_ENABLE);
|
||||
}
|
||||
#else
|
||||
static void nan_cfg_init(struct wlan_objmgr_psoc *psoc,
|
||||
struct nan_psoc_priv_obj *nan_obj)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* nan_cfg_dp_init() - Initialize NAN Datapath config params
|
||||
* @psoc: Pointer to PSOC Object
|
||||
* @nan_obj: Pointer to NAN private object
|
||||
*
|
||||
* This function initialize NAN config params
|
||||
*/
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
static void nan_cfg_dp_init(struct wlan_objmgr_psoc *psoc,
|
||||
struct nan_psoc_priv_obj *nan_obj)
|
||||
{
|
||||
if (!psoc || !nan_obj)
|
||||
return;
|
||||
nan_obj->cfg_param.dp_enable = cfg_get(psoc,
|
||||
CFG_NAN_DATAPATH_ENABLE);
|
||||
nan_obj->cfg_param.ndi_ch = cfg_get(psoc, CFG_NAN_NDI_CHANNEL);
|
||||
nan_obj->cfg_param.ndi_mac_randomize =
|
||||
cfg_get(psoc, CFG_NAN_RANDOMIZE_NDI_MAC);
|
||||
}
|
||||
#else
|
||||
static void nan_cfg_dp_init(struct wlan_objmgr_psoc *psoc,
|
||||
struct nan_psoc_priv_obj *nan_obj)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static QDF_STATUS nan_psoc_obj_created_notification(
|
||||
struct wlan_objmgr_psoc *psoc, void *arg_list)
|
||||
|
|
@ -52,6 +103,9 @@ static QDF_STATUS nan_psoc_obj_created_notification(
|
|||
goto nan_psoc_notif_failed;
|
||||
}
|
||||
|
||||
nan_cfg_init(psoc, nan_obj);
|
||||
nan_cfg_dp_init(psoc, nan_obj);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
|
||||
nan_psoc_notif_failed:
|
||||
|
|
|
|||
|
|
@ -50,6 +50,24 @@ struct scheduler_msg;
|
|||
#define MAX_PEERS 32
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct nan_cfg_params - NAN INI config params
|
||||
* @enable: NAN feature enable
|
||||
* @dp_enable: NAN Datapath feature enable
|
||||
* @ndi_ch: NAN Datapath channel
|
||||
* @ndi_mac_randomize: Randomize NAN datapath interface MAC
|
||||
*/
|
||||
struct nan_cfg_params {
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
bool enable;
|
||||
#endif
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
bool dp_enable;
|
||||
uint32_t ndi_ch;
|
||||
bool ndi_mac_randomize;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* struct nan_psoc_priv_obj - nan private psoc obj
|
||||
* @lock: lock to be acquired before reading or writing to object
|
||||
|
|
@ -58,6 +76,7 @@ struct scheduler_msg;
|
|||
struct nan_psoc_priv_obj {
|
||||
qdf_spinlock_t lock;
|
||||
struct nan_callbacks cb_obj;
|
||||
struct nan_cfg_params cfg_param;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
138
umac/nan/dispatcher/inc/cfg_nan.h
Normal file
138
umac/nan/dispatcher/inc/cfg_nan.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Copyright (c) 2018 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.
|
||||
*/
|
||||
|
||||
#if !defined(__NAN_CFG_H__)
|
||||
#define __NAN_CFG_H__
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC: nan_cfg.h
|
||||
*
|
||||
* NAN feature INI configuration parameter definitions
|
||||
*/
|
||||
#include "cfg_define.h"
|
||||
#include "cfg_converged.h"
|
||||
#include "qdf_types.h"
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gEnableNanSupport - NAN feature support configuration
|
||||
* @Min: 0
|
||||
* @Max: 1
|
||||
* @Default: 0
|
||||
*
|
||||
* When set to 1 NAN feature will be enabled.
|
||||
*
|
||||
* Related: None
|
||||
*
|
||||
* Supported Feature: NAN
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_NAN_ENABLE CFG_INI_BOOL("gEnableNanSupport", \
|
||||
0, \
|
||||
"Enable NAN Support")
|
||||
/*
|
||||
* <ini>
|
||||
* genable_nan_datapath - Enable NaN data path feature. NaN data path
|
||||
* enables NAN supported devices to exchange
|
||||
* data over TCP/UDP network stack.
|
||||
* @Min: 0
|
||||
* @Max: 1
|
||||
* @Default: 0
|
||||
*
|
||||
* When set to 1 NAN Datapath feature will be enabled.
|
||||
*
|
||||
* Related: gEnableNanSupport
|
||||
*
|
||||
* Supported Feature: NAN
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_NAN_DATAPATH_ENABLE CFG_INI_BOOL("genable_nan_datapath", \
|
||||
0, \
|
||||
"Enable NAN Datapath support")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* gnan_datapath_ndi_channel - Default channel for NAN Datapath
|
||||
* @Min: 6
|
||||
* @Max: 149
|
||||
* @Default: 6
|
||||
*
|
||||
* Host suggests this channel for NAN datapath. But FW is free to
|
||||
* choose other channels based on system constraints.
|
||||
*
|
||||
* Related: genable_nan_datapath
|
||||
*
|
||||
* Supported Feature: NAN
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
/*
|
||||
* NAN channel on which NAN data interface to start
|
||||
*/
|
||||
#define CFG_NAN_NDI_CHANNEL CFG_INI_UINT("gnan_datapath_ndi_channel", \
|
||||
6, 149, 6, \
|
||||
CFG_VALUE_OR_DEFAULT, \
|
||||
"NAN Datapath Channel")
|
||||
/*
|
||||
* <ini>
|
||||
* gEnableNDIMacRandomization - When enabled this will randomize NDI Mac
|
||||
* @Min: 0
|
||||
* @Max: 1
|
||||
* @Default: 1
|
||||
*
|
||||
* When enabled this will randomize NDI Mac
|
||||
*
|
||||
* Related: gEnableNanSupport
|
||||
*
|
||||
* Supported Feature: NAN
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_NAN_RANDOMIZE_NDI_MAC CFG_INI_BOOL("gEnableNDIMacRandomization", \
|
||||
1, \
|
||||
"Enable NAN MAC Randomization")
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
#define CFG_NAN_DISC CFG(CFG_NAN_ENABLE)
|
||||
#else
|
||||
#define CFG_NAN_DISC
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
#define CFG_NAN_DP CFG(CFG_NAN_DATAPATH_ENABLE) \
|
||||
CFG(CFG_NAN_NDI_CHANNEL) \
|
||||
CFG(CFG_NAN_RANDOMIZE_NDI_MAC)
|
||||
#else
|
||||
#define CFG_NAN_DP
|
||||
#endif
|
||||
|
||||
#define CFG_NAN_ALL CFG_NAN_DISC \
|
||||
CFG_NAN_DP
|
||||
|
||||
#endif
|
||||
88
umac/nan/dispatcher/inc/cfg_nan_api.h
Normal file
88
umac/nan/dispatcher/inc/cfg_nan_api.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 2018 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.
|
||||
*/
|
||||
|
||||
#if !defined(__NAN_CFG_API_H__)
|
||||
#define __NAN_CFG_API_H__
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC: nan_cfg_api.h
|
||||
*
|
||||
* NAN feature INI configuration parameters get/set APIs
|
||||
*/
|
||||
#include "qdf_types.h"
|
||||
|
||||
struct wlan_objmgr_psoc;
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
/**
|
||||
* cfg_nan_get_enable() - get NAN support enable status
|
||||
* @psoc: pointer to psoc object
|
||||
*
|
||||
* This function returns NAN enable status
|
||||
*/
|
||||
bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc);
|
||||
#else
|
||||
static inline bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
/**
|
||||
* cfg_nan_get_datapath_enable() - get NAN Datapath support enable status
|
||||
* @psoc: pointer to psoc object
|
||||
*
|
||||
* This function returns NAN Datapath enable status
|
||||
*/
|
||||
bool cfg_nan_get_datapath_enable(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* cfg_nan_get_ndi_channel() - get NAN Datapath channel
|
||||
* @psoc: pointer to psoc object
|
||||
*
|
||||
* This function returns NAN Datapath channel
|
||||
*/
|
||||
uint32_t cfg_nan_get_ndi_channel(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* cfg_nan_get_ndi_mac_randomize() - get NDI MAC randomize enable status
|
||||
* @psoc: pointer to psoc object
|
||||
*
|
||||
* This function returns NAN Datapath Interface MAC randomization status
|
||||
*/
|
||||
bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc);
|
||||
#else
|
||||
static inline bool cfg_nan_get_datapath_enable(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline uint32_t cfg_nan_get_ndi_channel(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
80
umac/nan/dispatcher/src/cfg_nan.c
Normal file
80
umac/nan/dispatcher/src/cfg_nan.c
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2018 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: contains NAN INI configurations
|
||||
*/
|
||||
|
||||
#include "wlan_objmgr_psoc_obj.h"
|
||||
#include "cfg_nan_api.h"
|
||||
#include "../../core/src/nan_main_i.h"
|
||||
|
||||
static inline struct nan_psoc_priv_obj
|
||||
*cfg_nan_get_priv_obj(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
if (!psoc) {
|
||||
nan_err("PSOC obj null");
|
||||
return NULL;
|
||||
}
|
||||
return wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_NAN);
|
||||
}
|
||||
|
||||
bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
|
||||
|
||||
if (!nan_obj) {
|
||||
nan_err("NAN obj null");
|
||||
return false;
|
||||
}
|
||||
return nan_obj->cfg_param.enable;
|
||||
}
|
||||
|
||||
bool cfg_nan_get_datapath_enable(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
|
||||
|
||||
if (!nan_obj) {
|
||||
nan_err("NAN obj null");
|
||||
return false;
|
||||
}
|
||||
return nan_obj->cfg_param.dp_enable;
|
||||
}
|
||||
|
||||
uint32_t cfg_nan_get_ndi_channel(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
|
||||
|
||||
if (!nan_obj) {
|
||||
nan_err("NAN obj null");
|
||||
return 0;
|
||||
}
|
||||
return nan_obj->cfg_param.ndi_ch;
|
||||
}
|
||||
|
||||
bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
|
||||
|
||||
if (!nan_obj) {
|
||||
nan_err("NAN obj null");
|
||||
return false;
|
||||
}
|
||||
return nan_obj->cfg_param.ndi_mac_randomize;
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue