1. 问题描述
2. 问题分析
16:11:39.848 2 859:1185 KERN_ERR wireless/wcnss/wcnss_prealloc.c(86) [ 422.147325] wcnss: wcnss_prealloc_get: prealloc not available for size: 84480
16:11:39.856 2 859:1185 KERN_WARNING /android/kernel/mm/page_alloc.c(2063) [ 422.155532] WifiStateMachin: page allocation failure: order:5, mode:0x40d0
|
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 70fd0c7..899d0c9 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -190,9 +190,14 @@ static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
&pMac->sme.smeCmdFreeList)))
goto end;
- pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
+ pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
if ( NULL == pCmd )
+ {
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+ FL("fail to allocate memory %lu"),
+ (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
status = eHAL_STATUS_FAILURE;
+ }
else
{
status = eHAL_STATUS_SUCCESS;
@@ -338,7 +343,7 @@ static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
if(NULL != pMac->sme.pSmeCmdBufAddr)
{
- vos_mem_free(pMac->sme.pSmeCmdBufAddr);
+ vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
pMac->sme.pSmeCmdBufAddr = NULL;
}
diff --git a/CORE/VOSS/inc/vos_memory.h b/CORE/VOSS/inc/vos_memory.h
index 85847d1..69e97d3 100644
--- a/CORE/VOSS/inc/vos_memory.h
+++ b/CORE/VOSS/inc/vos_memory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -304,4 +304,32 @@ v_VOID_t vos_mem_dma_free( v_VOID_t *ptr );
--------------------------------------------------------------------------*/
v_VOID_t vos_mem_set_dma_ptr(unsigned char *dmaBuffer);
#endif /* DMA_DIRECT_ACCESS */
+
+
+/*----------------------------------------------------------------------------
+
+ \brief vos_mem_vmalloc() - allocate memory which is virtually contiguous
+
+ Wrapper function for vmalloc
+
+ \param size memory size to be allocated
+
+ \return on success returns starting address of allocated memory or NULL
+
+ --------------------------------------------------------------------------*/
+v_VOID_t * vos_mem_vmalloc(v_SIZE_t size);
+
+/*----------------------------------------------------------------------------
+
+ \brief vos_mem_vfree() - free memory allocated by vmalloc
+
+ Wrapper function for vfree
+
+ \param address starting address of the memory to be freed
+
+ \return Nothing
+
+ --------------------------------------------------------------------------*/
+v_VOID_t vos_mem_vfree(void *addr);
+
#endif // __VOSS_LOCK_H
diff --git a/CORE/VOSS/src/vos_memory.c b/CORE/VOSS/src/vos_memory.c
index 7690c1b..2db0ca6 100644
--- a/CORE/VOSS/src/vos_memory.c
+++ b/CORE/VOSS/src/vos_memory.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -58,6 +58,7 @@
* ------------------------------------------------------------------------*/
#include "vos_memory.h"
#include "vos_trace.h"
+#include
#ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
#include
@@ -337,6 +338,31 @@ v_VOID_t vos_mem_free( v_VOID_t *ptr )
}
#endif
+v_VOID_t * vos_mem_vmalloc(v_SIZE_t size)
+{
+ if (size == 0 || size >= (1024*1024))
+ {
+ VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+ "%s invalid size: %u", __func__, size);
+ return NULL;
+ }
+
+ return vmalloc(size);
+}
+
+v_VOID_t vos_mem_vfree(void *addr)
+{
+ if (addr == NULL)
+ {
+ VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+ "%s NULL address passed to free", __func__);
+ return;
+ }
+
+ vfree(addr);
+ return;
+}
+
v_VOID_t vos_mem_set( v_VOID_t *ptr, v_SIZE_t numBytes, v_BYTE_t value )
{
if (ptr == NULL)
--
|