qcacmn: Define configures about P2P

Based on converged cfg component, define P2P configures and APIs to
get or set these configures.

Change-Id: I9b0126d9cc71f7de0d255981ba5fe88f3da05ce2
CRs-Fixed: 2277551
This commit is contained in:
Wu Gao 2018-06-14 18:58:40 +08:00 • committed by nshrivas
commit b974b2df0f
5 changed files with 360 additions and 0 deletions

View file

@ -33,6 +33,8 @@
#include "wlan_p2p_main.h"
#include "wlan_p2p_roc.h"
#include "wlan_p2p_off_chan_tx.h"
#include "wlan_p2p_cfg.h"
#include "cfg_ucfg_api.h"
#ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
#include <wlan_pmo_obj_mgmt_api.h>
@ -515,6 +517,34 @@ static QDF_STATUS process_peer_for_noa(struct wlan_objmgr_vdev *vdev,
return QDF_STATUS_SUCCESS;
}
/**
* p2p_object_init_params() - init parameters for p2p object
* @psoc: pointer to psoc object
* @p2p_soc_obj: pointer to p2p psoc object
*
* This function init parameters for p2p object
*/
static QDF_STATUS p2p_object_init_params(
struct wlan_objmgr_psoc *psoc,
struct p2p_soc_priv_obj *p2p_soc_obj)
{
if (!psoc || !p2p_soc_obj) {
p2p_err("invalid param");
return QDF_STATUS_E_INVAL;
}
p2p_soc_obj->param.go_keepalive_period =
cfg_get(psoc, CFG_GO_KEEP_ALIVE_PERIOD);
p2p_soc_obj->param.go_link_monitor_period =
cfg_get(psoc, CFG_GO_LINK_MONITOR_PERIOD);
p2p_soc_obj->param.p2p_device_addr_admin =
cfg_get(psoc, CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED);
p2p_soc_obj->param.skip_dfs_channel_p2p_search =
cfg_get(psoc, CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH);
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_P2P_DEBUG
/**
* wlan_p2p_init_connection_status() - init connection status
@ -815,6 +845,7 @@ QDF_STATUS p2p_psoc_object_open(struct wlan_objmgr_psoc *soc)
return QDF_STATUS_E_FAILURE;
}
p2p_object_init_params(soc, p2p_soc_obj);
qdf_list_create(&p2p_soc_obj->roc_q, MAX_QUEUE_LENGTH);
qdf_list_create(&p2p_soc_obj->tx_q_roc, MAX_QUEUE_LENGTH);
qdf_list_create(&p2p_soc_obj->tx_q_ack, MAX_QUEUE_LENGTH);

View file

@ -156,6 +156,24 @@ enum p2p_connection_status {
};
#endif
/**
* struct p2p_param - p2p parameters to be used
* @go_keepalive_period: P2P GO keep alive period
* @go_link_monitor_period: period where link is idle and
* where we send NULL frame
* @p2p_device_addr_admin: enable/disable to derive the P2P
* MAC address from the primary MAC address
* @skip_dfs_channel_p2p_search: kip DFS Channel in case of P2P Search
* @ignore_dynamic_dtim_in_p2p_mode:Ignore Dynamic Dtim in case of P2P options
*/
struct p2p_param {
uint32_t go_keepalive_period;
uint32_t go_link_monitor_period;
bool p2p_device_addr_admin;
bool skip_dfs_channel_p2p_search;
bool ignore_dynamic_dtim_in_p2p_mode;
};
/**
* struct p2p_soc_priv_obj - Per SoC p2p private object
* @soc: Pointer to SoC context
@ -172,6 +190,7 @@ enum p2p_connection_status {
* @p2p_cb: Callbacks to protocol stack
* @cur_roc_vdev_id: Vdev id of current roc
* @p2p_idr: p2p idr
* @param: p2p parameters to be used
* @connection_status:Global P2P connection status
*/
struct p2p_soc_priv_obj {
@ -188,6 +207,7 @@ struct p2p_soc_priv_obj {
struct p2p_protocol_callbacks p2p_cb;
uint32_t cur_roc_vdev_id;
qdf_idr p2p_idr;
struct p2p_param param;
#ifdef WLAN_FEATURE_P2P_DEBUG
enum p2p_connection_status connection_status;
#endif

View file

@ -0,0 +1,128 @@
/*
* 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(CONFIG_P2P_H__)
#define CONFIG_P2P_H__
#include "cfg_define.h"
#include "cfg_converged.h"
#include "qdf_types.h"
/*
* <ini>
* gGoKeepAlivePeriod - P2P GO keep alive period.
* @Min: 1
* @Max: 65535
* @Default: 20
*
* This is P2P GO keep alive period.
*
* Related: None.
*
* Supported Feature: P2P
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_GO_KEEP_ALIVE_PERIOD CFG_INI_UINT( \
"gGoKeepAlivePeriod", \
1, \
65535, \
20, \
CFG_VALUE_OR_DEFAULT, \
"P2P GO keep alive period")
/*
* <ini>
* gGoLinkMonitorPeriod - period where link is idle and where
* we send NULL frame
* @Min: 3
* @Max: 50
* @Default: 10
*
* This is period where link is idle and where we send NULL frame for P2P GO.
*
* Related: None.
*
* Supported Feature: P2P
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_GO_LINK_MONITOR_PERIOD CFG_INI_UINT( \
"gGoLinkMonitorPeriod", \
3, \
50, \
10, \
CFG_VALUE_OR_DEFAULT, \
"period where link is idle and where we send NULL frame")
/*
* <ini>
* isP2pDeviceAddrAdministrated - Enables to derive the P2P MAC address from
* the primary MAC address
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to enable/disable to derive the P2P MAC address from the
* primary MAC address.
*
* Related: None.
*
* Supported Feature: P2P
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED CFG_INI_BOOL( \
"isP2pDeviceAddrAdministrated", \
1, \
"derive the P2P MAC address from the primary MAC address")
/*
* <ini>
* gSkipDfsChannelInP2pSearch - Skip DFS Channel in case of P2P Search
* @Min: 0
* @Max: 1
* @Default: 1
*
* This ini is used to disable(skip) dfs channel in p2p search.
* Related: None.
*
* Supported Feature: DFS P2P
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH CFG_INI_BOOL( \
"gSkipDfsChannelInP2pSearch", \
1, \
"skip dfs channel in p2p search")
#define CFG_P2P_ALL \
CFG(CFG_GO_KEEP_ALIVE_PERIOD) \
CFG(CFG_GO_LINK_MONITOR_PERIOD) \
CFG(CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED) \
CFG(CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH)
#endif

View file

@ -0,0 +1,76 @@
/*
* 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 p2p configures interface definitions
*/
#ifndef _WLAN_P2P_CFG_API_H_
#define _WLAN_P2P_CFG_API_H_
#include <qdf_types.h>
struct wlan_objmgr_psoc;
/**
* cfg_p2p_get_go_keepalive_period() - get go keepalive period
* @psoc: pointer to psoc object
* @period: go keepalive period
*
* This function gets go keepalive period to p2p component
*/
QDF_STATUS
cfg_p2p_get_go_keepalive_period(struct wlan_objmgr_psoc *psoc,
uint32_t *period);
/**
* cfg_p2p_get_go_link_monitor_period() - get go link monitor period
* @psoc: pointer to psoc object
* @period: go link monitor period
*
* This function gets go link monitor period to p2p component
*/
QDF_STATUS
cfg_p2p_get_go_link_monitor_period(struct wlan_objmgr_psoc *psoc,
uint32_t *period);
/**
* cfg_p2p_get_device_addr_admin() - get enable/disable p2p device
* addr administrated
* @psoc: pointer to psoc object
* @enable: enable/disable p2p device addr administrated
*
* This function gets enable/disable p2p device addr administrated
*/
QDF_STATUS
cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc *psoc,
bool *enable);
/**
* cfg_p2p_get_skip_dfs_channel_p2p_search() - get skip dfs channel
* in p2p search
* @psoc: pointer to psoc object
* @enable: enable/disable skip dfs channel in p2p search
*
* This function gets enable/disable skip dfs channel in p2p search
*/
QDF_STATUS
cfg_p2p_get_skip_dfs_channel_p2p_search(struct wlan_objmgr_psoc *psoc,
bool *enable);
#endif /* _WLAN_P2P_CFG_API_H_ */

View file

@ -0,0 +1,105 @@
/*
* 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: This file contains p2p configures interface definitions
*/
#include <wlan_objmgr_psoc_obj.h>
#include "wlan_p2p_public_struct.h"
#include "wlan_p2p_cfg_api.h"
#include "../../core/src/wlan_p2p_main.h"
static inline struct p2p_soc_priv_obj *
wlan_psoc_get_p2p_object(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_P2P);
}
QDF_STATUS
cfg_p2p_get_go_keepalive_period(struct wlan_objmgr_psoc *psoc,
uint32_t *period)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
if (!p2p_soc_obj) {
*period = 0;
p2p_err("p2p psoc null");
return QDF_STATUS_E_INVAL;
}
*period = p2p_soc_obj->param.go_keepalive_period;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
cfg_p2p_get_go_link_monitor_period(struct wlan_objmgr_psoc *psoc,
uint32_t *period)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
if (!p2p_soc_obj) {
*period = 0;
p2p_err("p2p psoc null");
return QDF_STATUS_E_INVAL;
}
*period = p2p_soc_obj->param.go_link_monitor_period;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc *psoc,
bool *enable)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
if (!p2p_soc_obj) {
*enable = false;
p2p_err("p2p psoc null");
return QDF_STATUS_E_INVAL;
}
*enable = p2p_soc_obj->param.p2p_device_addr_admin;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
cfg_p2p_get_skip_dfs_channel_p2p_search(struct wlan_objmgr_psoc *psoc,
bool *enable)
{
struct p2p_soc_priv_obj *p2p_soc_obj;
p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
if (!p2p_soc_obj) {
*enable = false;
p2p_err("p2p psoc null");
return QDF_STATUS_E_INVAL;
}
*enable = p2p_soc_obj->param.skip_dfs_channel_p2p_search;
return QDF_STATUS_SUCCESS;
}