bcmdhd wifi:update driver 1.201.59.5
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / dhd_static_buf.c
index b2f848c4a443b4942651fa36a3241c24b6980754..52885bbf680cabe24b2f86bdeeeacb67c081b8d7 100755 (executable)
@@ -1,11 +1,11 @@
 #include <linux/module.h>\r
 #include <linux/kernel.h>\r
-#include <linux/init.h> \r
-#include <linux/platform_device.h> \r
-#include <linux/delay.h> \r
-#include <linux/err.h> \r
-#include <linux/skbuff.h> \r
-#include <linux/wlan_plat.h> \r
+#include <linux/init.h>\r
+#include <linux/platform_device.h>\r
+#include <linux/delay.h>\r
+#include <linux/err.h>\r
+#include <linux/skbuff.h>\r
+#include <linux/wlan_plat.h>\r
 \r
 #define CONFIG_BROADCOM_WIFI_RESERVED_MEM\r
 \r
@@ -15,7 +15,8 @@
 #define WLAN_STATIC_SCAN_BUF0          5\r
 #define WLAN_STATIC_SCAN_BUF1          6\r
 #define WLAN_STATIC_DHD_INFO           7\r
-#define PREALLOC_WLAN_SEC_NUM          5\r
+#define WLAN_STATIC_DHD_WLFC_INFO              8\r
+#define PREALLOC_WLAN_SEC_NUM          6\r
 #define PREALLOC_WLAN_BUF_NUM          160\r
 #define PREALLOC_WLAN_SECTION_HEADER   24\r
 \r
@@ -24,6 +25,7 @@
 #define WLAN_SECTION_SIZE_2    (PREALLOC_WLAN_BUF_NUM * 512)\r
 #define WLAN_SECTION_SIZE_3    (PREALLOC_WLAN_BUF_NUM * 1024)\r
 #define WLAN_SECTION_SIZE_7    (PREALLOC_WLAN_BUF_NUM * 128)\r
+#define WLAN_SECTION_SIZE_8    (PREALLOC_WLAN_BUF_NUM * 512)\r
 \r
 #define DHD_SKB_HDRSIZE                        336\r
 #define DHD_SKB_1PAGE_BUFSIZE  ((PAGE_SIZE*1)-DHD_SKB_HDRSIZE)\r
@@ -44,7 +46,8 @@ static struct wlan_mem_prealloc wlan_mem_array[PREALLOC_WLAN_SEC_NUM] = {
        {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},\r
        {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},\r
        {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)},\r
-       {NULL, (WLAN_SECTION_SIZE_7 + PREALLOC_WLAN_SECTION_HEADER)}\r
+       {NULL, (WLAN_SECTION_SIZE_7 + PREALLOC_WLAN_SECTION_HEADER)},\r
+       {NULL, (WLAN_SECTION_SIZE_8 + PREALLOC_WLAN_SECTION_HEADER)}\r
 };\r
 \r
 void *wlan_static_scan_buf0;\r
@@ -71,17 +74,22 @@ void *bcmdhd_mem_prealloc(int section, unsigned long size)
                        __FUNCTION__, section, wlan_mem_array[4].mem_ptr);\r
                return wlan_mem_array[4].mem_ptr;\r
        }\r
+       if (section == WLAN_STATIC_DHD_WLFC_INFO) {\r
+               printk("5 %s: section=%d, wlan_mem_array[5]=%p\n",\r
+                       __FUNCTION__, section, wlan_mem_array[5].mem_ptr);\r
+               return wlan_mem_array[5].mem_ptr;\r
+       }\r
        if ((section < 0) || (section > PREALLOC_WLAN_SEC_NUM)) {\r
-               printk("5 %s: out of section %d\n", __FUNCTION__, section);\r
+               printk("6 %s: out of section %d\n", __FUNCTION__, section);\r
                return NULL;\r
        }\r
 \r
        if (wlan_mem_array[section].size < size) {\r
-               printk("6 %s: wlan_mem_array[section].size=%lu, size=%lu\n",\r
+               printk("7 %s: wlan_mem_array[section].size=%lu, size=%lu\n",\r
                        __FUNCTION__, wlan_mem_array[section].size, size);\r
                return NULL;\r
        }\r
-       printk("7 %s: wlan_mem_array[section].mem_ptr=%p, size=%lu\n",\r
+       printk("8 %s: wlan_mem_array[section].mem_ptr=%p, size=%lu\n",\r
                __FUNCTION__, &wlan_mem_array[section], size);\r
 \r
        return wlan_mem_array[section].mem_ptr;\r
@@ -89,7 +97,7 @@ void *bcmdhd_mem_prealloc(int section, unsigned long size)
 \r
 EXPORT_SYMBOL(bcmdhd_mem_prealloc);\r
 \r
-int bcmdhd_init_wlan_mem(void) \r
+int bcmdhd_init_wlan_mem(void)\r
 {\r
        int i;\r
        int j;\r
@@ -97,7 +105,7 @@ int bcmdhd_init_wlan_mem(void)
        for (i=0; i<8; i++) {\r
                wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_1PAGE_BUFSIZE);\r
                if (!wlan_static_skb[i])\r
-                       goto err_skb_alloc; \r
+                       goto err_skb_alloc;\r
                printk("1 %s: wlan_static_skb[%d]=%p, size=%lu\n",\r
                        __FUNCTION__, i, wlan_static_skb[i], DHD_SKB_1PAGE_BUFSIZE);\r
        }\r
@@ -105,14 +113,14 @@ int bcmdhd_init_wlan_mem(void)
        for (; i<16; i++) {\r
                wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_2PAGE_BUFSIZE);\r
                if (!wlan_static_skb[i])\r
-                       goto err_skb_alloc; \r
+                       goto err_skb_alloc;\r
                printk("2 %s: wlan_static_skb[%d]=%p, size=%lu\n",\r
                        __FUNCTION__, i, wlan_static_skb[i], DHD_SKB_2PAGE_BUFSIZE);\r
        }\r
 \r
        wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_4PAGE_BUFSIZE);\r
        if (!wlan_static_skb[i])\r
-               goto err_skb_alloc; \r
+               goto err_skb_alloc;\r
        printk("3 %s: wlan_static_skb[%d]=%p, size=%lu\n",\r
                __FUNCTION__, i, wlan_static_skb[i], DHD_SKB_4PAGE_BUFSIZE);\r
 \r
@@ -127,13 +135,13 @@ int bcmdhd_init_wlan_mem(void)
        }\r
 \r
        wlan_static_scan_buf0 = kmalloc (65536, GFP_KERNEL);\r
-       if(!wlan_static_scan_buf0)\r
+       if (!wlan_static_scan_buf0)\r
                goto err_mem_alloc;\r
        printk("5 %s: wlan_static_scan_buf0=%p, size=%d\n",\r
                __FUNCTION__, wlan_static_scan_buf0, 65536);\r
 \r
        wlan_static_scan_buf1 = kmalloc (65536, GFP_KERNEL);\r
-       if(!wlan_static_scan_buf1)\r
+       if (!wlan_static_scan_buf1)\r
                goto err_mem_alloc;\r
        printk("6 %s: wlan_static_scan_buf1=%p, size=%d\n",\r
                __FUNCTION__, wlan_static_scan_buf1, 65536);\r