qcacld-3.0: Add ini support for NDP inactivity timeout

Add an ini configuration that configures the inactivity timeout for NDP
peer. The value is sent to the firmware via the VDEV param
WMI_VDEV_PARAM_NDP_INACTIVITY_TIMEOUT.

Change-Id: Ifffe6bb40df94761d739463cf7e54a0be7e2a375
CRs-Fixed: 2531756
This commit is contained in:
Sourav Mohapatra 2019-09-06 14:38:53 +05:30 committed by nshrivas
parent 67ecb07330
commit 3f02b6a70d
6 changed files with 73 additions and 2 deletions

View File

@ -80,11 +80,13 @@ enum nan_disc_state {
* @enable: NAN feature enable * @enable: NAN feature enable
* @dp_enable: NAN Datapath feature enable * @dp_enable: NAN Datapath feature enable
* @ndi_mac_randomize: Randomize NAN datapath interface MAC * @ndi_mac_randomize: Randomize NAN datapath interface MAC
* @ndp_inactivity_timeout: NDP inactivity timeout
*/ */
struct nan_cfg_params { struct nan_cfg_params {
bool enable; bool enable;
bool dp_enable; bool dp_enable;
bool ndi_mac_randomize; bool ndi_mac_randomize;
uint16_t ndp_inactivity_timeout;
}; };
/** /**

View File

@ -93,10 +93,36 @@
1, \ 1, \
"Enable NAN MAC Randomization") "Enable NAN MAC Randomization")
/*
* <ini>
* ndp_inactivity_timeout - To configure duration of how many seconds
* without TX/RX data traffic, NDI vdev can kickout the connected
* peer(i.e. NDP Termination).
*
* @Min: 0
* @Max: 1800
* @Default: 60
*
* Related: None
*
* Supported Feature: NAN
*
* Usage: External
*
* </ini>
*/
#define CFG_NAN_NDP_INACTIVITY_TIMEOUT CFG_INI_UINT("ndp_inactivity_timeout", \
0, \
1800, \
60, \
CFG_VALUE_OR_DEFAULT, \
"NDP Auto Terminate time")
#ifdef WLAN_FEATURE_NAN #ifdef WLAN_FEATURE_NAN
#define CFG_NAN_DISC CFG(CFG_NAN_ENABLE) #define CFG_NAN_DISC CFG(CFG_NAN_ENABLE)
#define CFG_NAN_DP CFG(CFG_NAN_DATAPATH_ENABLE) \ #define CFG_NAN_DP CFG(CFG_NAN_DATAPATH_ENABLE) \
CFG(CFG_NAN_RANDOMIZE_NDI_MAC) CFG(CFG_NAN_RANDOMIZE_NDI_MAC) \
CFG(CFG_NAN_NDP_INACTIVITY_TIMEOUT)
#else #else
#define CFG_NAN_DISC #define CFG_NAN_DISC
#define CFG_NAN_DP #define CFG_NAN_DP

View File

@ -53,6 +53,17 @@ bool cfg_nan_get_datapath_enable(struct wlan_objmgr_psoc *psoc);
* This function returns NAN Datapath Interface MAC randomization status * This function returns NAN Datapath Interface MAC randomization status
*/ */
bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc); bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc);
/**
* cfg_nan_get_ndp_inactivity_timeout() - get NDP inactivity timeout value
* @psoc: pointer to psoc object
* @val: pointer to the value where inactivity timeout has to be copied to
*
* Return: QDF_STATUS
*/
QDF_STATUS cfg_nan_get_ndp_inactivity_timeout(struct wlan_objmgr_psoc *psoc,
uint16_t *val);
#else #else
static inline bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc) static inline bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc)
{ {
@ -68,6 +79,13 @@ static inline bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc)
{ {
return false; return false;
} }
static inline
QDF_STATUS cfg_nan_get_ndp_inactivity_timeout(struct wlan_objmgr_psoc *psoc,
uint16_t *val)
{
return QDF_STATUS_SUCCESS;
}
#endif #endif
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@ -67,3 +67,17 @@ bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc)
return nan_obj->cfg_param.ndi_mac_randomize; return nan_obj->cfg_param.ndi_mac_randomize;
} }
QDF_STATUS cfg_nan_get_ndp_inactivity_timeout(struct wlan_objmgr_psoc *psoc,
uint16_t *val)
{
struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
if (!nan_obj) {
nan_err("NAN obj null");
return QDF_STATUS_E_INVAL;
}
*val = nan_obj->cfg_param.ndp_inactivity_timeout;
return QDF_STATUS_SUCCESS;
}

View File

@ -64,6 +64,8 @@ static void nan_cfg_dp_init(struct wlan_objmgr_psoc *psoc,
CFG_NAN_DATAPATH_ENABLE); CFG_NAN_DATAPATH_ENABLE);
nan_obj->cfg_param.ndi_mac_randomize = nan_obj->cfg_param.ndi_mac_randomize =
cfg_get(psoc, CFG_NAN_RANDOMIZE_NDI_MAC); cfg_get(psoc, CFG_NAN_RANDOMIZE_NDI_MAC);
nan_obj->cfg_param.ndp_inactivity_timeout =
cfg_get(psoc, CFG_NAN_NDP_INACTIVITY_TIMEOUT);
} }
#else #else
static void nan_cfg_init(struct wlan_objmgr_psoc *psoc, static void nan_cfg_init(struct wlan_objmgr_psoc *psoc,

View File

@ -681,6 +681,7 @@ void hdd_ndi_drv_ndi_create_rsp_handler(uint8_t vdev_id,
struct hdd_station_ctx *sta_ctx; struct hdd_station_ctx *sta_ctx;
struct csr_roam_info *roam_info; struct csr_roam_info *roam_info;
struct bss_description tmp_bss_descp = {0}; struct bss_description tmp_bss_descp = {0};
uint16_t ndp_inactivity_timeout = 0;
struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BCAST_INIT; struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BCAST_INIT;
uint8_t sta_id; uint8_t sta_id;
@ -720,6 +721,14 @@ void hdd_ndi_drv_ndi_create_rsp_handler(uint8_t vdev_id,
wlan_hdd_netif_queue_control(adapter, wlan_hdd_netif_queue_control(adapter,
WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, WLAN_START_ALL_NETIF_QUEUE_N_CARRIER,
WLAN_CONTROL_PATH); WLAN_CONTROL_PATH);
if (QDF_IS_STATUS_ERROR(cfg_nan_get_ndp_inactivity_timeout(
hdd_ctx->psoc, &ndp_inactivity_timeout)))
hdd_err("Failed to fetch inactivity timeout value");
sme_cli_set_command(adapter->vdev_id,
WMI_VDEV_PARAM_NDP_INACTIVITY_TIMEOUT,
ndp_inactivity_timeout, VDEV_CMD);
} else { } else {
hdd_alert("NDI interface creation failed with reason %d", hdd_alert("NDI interface creation failed with reason %d",
ndi_rsp->reason /* create_reason */); ndi_rsp->reason /* create_reason */);