Android Tethering can't been open(QCOM平台)

1. 问题描述

(1)Using the SD card to burn the version of KK.Wi-Fi tethering turn ON is OK.
(2)Using the SD card to burn the version of L. Wi-Fi tethering turn ON is OK.
(3)Plug in charge.
(4)Waiting for a few minutes. Wi-Fi tethering turn ON is fail.

When we restart the Phone that the problem will not reappear.


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
3.修改方案

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 <vmalloc.h>
  
  #ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
  #include <linux/wcnss_wlan.h>
@@ -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)
-- 





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值