summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <naveenrawat@codeaurora.org>2017-11-27 17:37:40 -0800
committersnandini <snandini@codeaurora.org>2017-11-28 19:10:07 -0800
commit41bd6414ce70fac783e77cec6b68d180f0d277cf (patch)
treec387a83df3bf1abc38fd2ab83f0b6699da20d5e8
parente586629274d12395a688e0300bf674710132b562 (diff)
qcacld-3.0: Statically allocate DPH hash table
DPH hash table is allocated for each session of depth equal to max possible peers. This memory chunk goes upto 33KB in size and may fail. Instead allocate the memory from BSS segment so that run-time allocation is not needed. Change-Id: I56d6adb7934faef1940ab8515fed30646f536ab2 CRs-fixed: 2149563
-rw-r--r--core/mac/inc/sir_api.h1
-rw-r--r--core/mac/src/pe/lim/lim_session.c29
-rw-r--r--core/sme/inc/csr_internal.h2
-rw-r--r--core/wma/inc/wma.h2
4 files changed, 18 insertions, 16 deletions
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 070043f91b25..3072ee0ff560 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -59,6 +59,7 @@ typedef struct sAniSirGlobal *tpAniSirGlobal;
#include <dot11f.h>
#define MAX_PEERS 32
+#define SIR_MAX_SUPPORTED_BSS 5
#define OFFSET_OF(structType, fldName) (&((structType *)0)->fldName)
diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c
index c04cfbf5d6f2..99606faf693b 100644
--- a/core/mac/src/pe/lim/lim_session.c
+++ b/core/mac/src/pe/lim/lim_session.c
@@ -47,6 +47,10 @@
#include "sch_api.h"
#include "lim_send_messages.h"
+
+static struct sDphHashNode
+ g_dph_node_array[SIR_MAX_SUPPORTED_BSS][CFG_SAP_MAX_NO_PEERS_MAX + 1];
+
/*--------------------------------------------------------------------------
\brief pe_init_beacon_params() - Initialize the beaconParams structure
@@ -429,17 +433,7 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId,
return NULL;
}
- session_ptr->dph.dphHashTable.pDphNodeArray =
- qdf_mem_malloc(sizeof(tDphHashNode) * (numSta + 1));
- if (NULL == session_ptr->dph.dphHashTable.pDphNodeArray) {
- pe_err("memory allocate failed!");
- qdf_mem_free(session_ptr->dph.dphHashTable.pHashTable);
- session_ptr->dph.dphHashTable.
- pHashTable = NULL;
- return NULL;
- }
-
-
+ session_ptr->dph.dphHashTable.pDphNodeArray = g_dph_node_array[i];
session_ptr->dph.dphHashTable.size = numSta + 1;
dph_hash_table_class_init(pMac, &session_ptr->dph.dphHashTable);
session_ptr->gpLimPeerIdxpool = qdf_mem_malloc(
@@ -448,7 +442,9 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId,
if (NULL == session_ptr->gpLimPeerIdxpool) {
pe_err("memory allocate failed!");
qdf_mem_free(session_ptr->dph.dphHashTable.pHashTable);
- qdf_mem_free(session_ptr->dph.dphHashTable.pDphNodeArray);
+ qdf_mem_zero(session_ptr->dph.dphHashTable.pDphNodeArray,
+ sizeof(struct sDphHashNode) *
+ (CFG_SAP_MAX_NO_PEERS_MAX + 1));
session_ptr->dph.dphHashTable.pHashTable = NULL;
session_ptr->dph.dphHashTable.pDphNodeArray = NULL;
return NULL;
@@ -502,7 +498,10 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId,
|| (NULL == session_ptr->pSchBeaconFrameEnd)) {
pe_err("memory allocate failed!");
qdf_mem_free(session_ptr->dph.dphHashTable.pHashTable);
- qdf_mem_free(session_ptr->dph.dphHashTable.pDphNodeArray);
+ qdf_mem_zero(
+ session_ptr->dph.dphHashTable.pDphNodeArray,
+ sizeof(struct sDphHashNode) *
+ (CFG_SAP_MAX_NO_PEERS_MAX + 1));
qdf_mem_free(session_ptr->gpLimPeerIdxpool);
qdf_mem_free(session_ptr->pSchProbeRspTemplate);
qdf_mem_free(session_ptr->pSchBeaconFrameBegin);
@@ -740,7 +739,9 @@ void pe_delete_session(tpAniSirGlobal mac_ctx, tpPESession session)
}
if (session->dph.dphHashTable.pDphNodeArray != NULL) {
- qdf_mem_free(session->dph.dphHashTable.pDphNodeArray);
+ qdf_mem_zero(session->dph.dphHashTable.pDphNodeArray,
+ sizeof(struct sDphHashNode) *
+ (CFG_SAP_MAX_NO_PEERS_MAX + 1));
session->dph.dphHashTable.pDphNodeArray = NULL;
}
diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h
index 2606962faed0..aa7cd8510291 100644
--- a/core/sme/inc/csr_internal.h
+++ b/core/sme/inc/csr_internal.h
@@ -53,7 +53,7 @@
/* session ID invalid */
#define CSR_SESSION_ID_INVALID 0xFF
/* No of sessions to be supported, and a session is for Infra, IBSS or BT-AMP */
-#define CSR_ROAM_SESSION_MAX 5
+#define CSR_ROAM_SESSION_MAX SIR_MAX_SUPPORTED_BSS
#define CSR_IS_SESSION_VALID(pMac, sessionId) \
(((sessionId) < CSR_ROAM_SESSION_MAX) && \
((pMac)->roam.roamSession[(sessionId)].sessionActive))
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 911f9b3ff7aa..ec1ae165bf5b 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -86,7 +86,7 @@
#else
#define WMA_MAX_SUPPORTED_STAS 12
#endif
-#define WMA_MAX_SUPPORTED_BSS 5
+#define WMA_MAX_SUPPORTED_BSS SIR_MAX_SUPPORTED_BSS
#define WMA_MAX_MGMT_MPDU_LEN 2000