qcacld-3.0: Allocate g_dph_node_array dynamically

Allocate g_dph_node_array dynamically to reduce build size.

Change-Id: Iffd9c2e205f9ee6b5365ab2e326198677fa57de2
CRs-Fixed: 2290501
此提交包含在:
Qiwei Cai
2018-08-07 14:30:09 +08:00
提交者 nshrivas
父節點 0b7542a2b7
當前提交 50a2108ab3
共有 6 個檔案被更改,包括 81 行新增2 行删除

1
Kbuild 一般檔案 → 可執行檔
查看文件

@@ -2146,6 +2146,7 @@ cppflags-$(CONFIG_HTT_PADDR64) += -DHTT_PADDR64
cppflags-$(CONFIG_WLAN_FEATURE_BMI) += -DWLAN_FEATURE_BMI cppflags-$(CONFIG_WLAN_FEATURE_BMI) += -DWLAN_FEATURE_BMI
cppflags-$(CONFIG_QCN7605_SUPPORT) += -DQCN7605_SUPPORT cppflags-$(CONFIG_QCN7605_SUPPORT) += -DQCN7605_SUPPORT
cppflags-$(CONFIG_HIF_REG_WINDOW_SUPPORT) += -DHIF_REG_WINDOW_SUPPORT cppflags-$(CONFIG_HIF_REG_WINDOW_SUPPORT) += -DHIF_REG_WINDOW_SUPPORT
cppflags-$(CONFIG_WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY) += -DWLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY
ccflags-$(CONFIG_QCA_LL_TX_FLOW_CONTROL_RESIZE) += -DQCA_LL_TX_FLOW_CONTROL_RESIZE ccflags-$(CONFIG_QCA_LL_TX_FLOW_CONTROL_RESIZE) += -DQCA_LL_TX_FLOW_CONTROL_RESIZE

查看文件

@@ -570,6 +570,7 @@ CONFIG_WLAN_CONV_SPECTRAL_ENABLE := y
CONFIG_WLAN_SPECTRAL_ENABLE := y CONFIG_WLAN_SPECTRAL_ENABLE := y
CONFIG_WMI_CMD_STRINGS := y CONFIG_WMI_CMD_STRINGS := y
CONFIG_FEATURE_MONITOR_MODE_SUPPORT := y CONFIG_FEATURE_MONITOR_MODE_SUPPORT := y
CONFIG_WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY := n
CONFIG_WLAN_FEATURE_TWT := y CONFIG_WLAN_FEATURE_TWT := y
CONFIG_WLAN_FEATURE_BMI := y CONFIG_WLAN_FEATURE_BMI := y

查看文件

@@ -112,6 +112,7 @@ CONFIG_WLAN_FEATURE_DISA := n
CONFIG_WLAN_FEATURE_FIPS := y CONFIG_WLAN_FEATURE_FIPS := y
CONFIG_WLAN_FEATURE_SAE := y CONFIG_WLAN_FEATURE_SAE := y
CONFIG_CHNL_MATRIX_RESTRICTION := n CONFIG_CHNL_MATRIX_RESTRICTION := n
CONFIG_WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY := y
CONFIG_WLAN_FEATURE_BMI := n CONFIG_WLAN_FEATURE_BMI := n
#Flags to enable/disable vendor commands #Flags to enable/disable vendor commands

查看文件

@@ -567,6 +567,32 @@ struct session_params {
Function declarations and documenation Function declarations and documenation
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
#ifdef WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY
/**
* pe_allocate_dph_node_array_buffer() - Allocate g_dph_node_array
* memory dynamically
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_NOMEM on failure
*/
QDF_STATUS pe_allocate_dph_node_array_buffer(void);
/**
* pe_free_dph_node_array_buffer() - Free memory allocated dynamically
*
* Return: None
*/
void pe_free_dph_node_array_buffer(void);
#else /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
static inline QDF_STATUS pe_allocate_dph_node_array_buffer(void)
{
return QDF_STATUS_SUCCESS;
}
static inline void pe_free_dph_node_array_buffer(void)
{
}
#endif /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
/** /**
* pe_create_session() - creates a new PE session given the BSSID * pe_create_session() - creates a new PE session given the BSSID
* *

查看文件

@@ -879,11 +879,17 @@ QDF_STATUS pe_open(tpAniSirGlobal pMac, struct cds_config_info *cds_cfg)
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
if (!QDF_IS_STATUS_SUCCESS(pe_allocate_dph_node_array_buffer())) {
pe_err("g_dph_node_array memory allocate failed!");
return QDF_STATUS_E_NOMEM;
}
pMac->lim.limTimers.gpLimCnfWaitTimer = pMac->lim.limTimers.gpLimCnfWaitTimer =
qdf_mem_malloc(sizeof(TX_TIMER) * (pMac->lim.maxStation + 1)); qdf_mem_malloc(sizeof(TX_TIMER) * (pMac->lim.maxStation + 1));
if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer) { if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer) {
pe_err("gpLimCnfWaitTimer memory allocate failed!"); pe_err("gpLimCnfWaitTimer memory allocate failed!");
return QDF_STATUS_E_NOMEM; status = QDF_STATUS_E_NOMEM;
goto pe_open_timer_fail;
} }
pMac->lim.gpSession = pMac->lim.gpSession =
@@ -927,6 +933,8 @@ pe_open_lock_fail:
pe_open_psession_fail: pe_open_psession_fail:
qdf_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer); qdf_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
pMac->lim.limTimers.gpLimCnfWaitTimer = NULL; pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
pe_open_timer_fail:
pe_free_dph_node_array_buffer();
return status; return status;
} }
@@ -963,6 +971,9 @@ QDF_STATUS pe_close(tpAniSirGlobal pMac)
qdf_mem_free(pMac->lim.gpSession); qdf_mem_free(pMac->lim.gpSession);
pMac->lim.gpSession = NULL; pMac->lim.gpSession = NULL;
pe_free_dph_node_array_buffer();
if (!QDF_IS_STATUS_SUCCESS if (!QDF_IS_STATUS_SUCCESS
(qdf_mutex_destroy(&pMac->lim.lkPeGlobalLock))) { (qdf_mutex_destroy(&pMac->lim.lkPeGlobalLock))) {
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;

查看文件

@@ -38,10 +38,48 @@
#include "sch_api.h" #include "sch_api.h"
#include "lim_send_messages.h" #include "lim_send_messages.h"
#ifdef WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY
static struct sDphHashNode *g_dph_node_array;
QDF_STATUS pe_allocate_dph_node_array_buffer(void)
{
uint32_t buf_size;
buf_size = SIR_MAX_SUPPORTED_BSS * (SIR_SAP_MAX_NUM_PEERS + 1)
* sizeof(struct sDphHashNode);
g_dph_node_array = qdf_mem_malloc(buf_size);
if (!g_dph_node_array) {
pe_err("%s: Failed to allocate %d bytes", __func__, buf_size);
return QDF_STATUS_E_NOMEM;
} else {
return QDF_STATUS_SUCCESS;
}
}
void pe_free_dph_node_array_buffer(void)
{
qdf_mem_free(g_dph_node_array);
g_dph_node_array = NULL;
}
static inline
struct sDphHashNode *pe_get_session_dph_node_array(uint8_t session_id)
{
return &g_dph_node_array[session_id * (SIR_SAP_MAX_NUM_PEERS + 1)];
}
#else /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
static struct sDphHashNode static struct sDphHashNode
g_dph_node_array[SIR_MAX_SUPPORTED_BSS][SIR_SAP_MAX_NUM_PEERS + 1]; g_dph_node_array[SIR_MAX_SUPPORTED_BSS][SIR_SAP_MAX_NUM_PEERS + 1];
static inline
struct sDphHashNode *pe_get_session_dph_node_array(uint8_t session_id)
{
return g_dph_node_array[session_id];
}
#endif /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
\brief pe_init_beacon_params() - Initialize the beaconParams structure \brief pe_init_beacon_params() - Initialize the beaconParams structure
@@ -560,7 +598,8 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId,
return NULL; return NULL;
} }
session_ptr->dph.dphHashTable.pDphNodeArray = g_dph_node_array[i]; session_ptr->dph.dphHashTable.pDphNodeArray =
pe_get_session_dph_node_array(i);
session_ptr->dph.dphHashTable.size = numSta + 1; session_ptr->dph.dphHashTable.size = numSta + 1;
dph_hash_table_class_init(pMac, &session_ptr->dph.dphHashTable); dph_hash_table_class_init(pMac, &session_ptr->dph.dphHashTable);
session_ptr->gpLimPeerIdxpool = qdf_mem_malloc( session_ptr->gpLimPeerIdxpool = qdf_mem_malloc(