wifi: fix vts test panic issue[1/2]
authorRongjun Chen <rongjun.chen@amlogic.com>
Fri, 15 Sep 2017 11:04:50 +0000 (19:04 +0800)
committerRongjun Chen <rongjun.chen@amlogic.com>
Thu, 21 Sep 2017 02:55:50 +0000 (10:55 +0800)
PD# NONE

fix wifi vts test panic issue

Change-Id: I059d168dd0aadfd797ab64c38ee5af5e44baa1b2
Signed-off-by: Rongjun Chen <rongjun.chen@amlogic.com>
bcmdhd-usb.1.363.110.17.x/Makefile
bcmdhd-usb.1.363.110.17.x/dhd.h
bcmdhd-usb.1.363.110.17.x/dhd_debug.c
bcmdhd-usb.1.363.110.17.x/include/osl.h
bcmdhd-usb.1.363.110.17.x/linux_osl.c
bcmdhd-usb.1.363.110.17.x/wl_escan.c
bcmdhd.1.579.77.41.1.cn/dhd_linux.c
bcmdhd.1.579.77.41.1.cn/wl_cfg80211.c

index 7d93a11668ebdfe179c7a2525895fd21a8cbacad..5e5c40691107b40f77d85b77efc8b2026d16343f 100644 (file)
@@ -3,6 +3,7 @@
 #    otherwise please remove it.
 
 CONFIG_BCMDHD := m
+CONFIG_DHD_USE_STATIC_BUF := y
 
 DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER                \
        -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE            \
index 179bed3049511ded702780a511ee0cec6c1a14bb..64817136c380a287089bfc78774530d54318c168 100644 (file)
@@ -181,7 +181,16 @@ enum dhd_prealloc_index {
        DHD_PREALLOC_MEMDUMP_RAM = 11,
        DHD_PREALLOC_DHD_WLFC_HANGER = 12,
        DHD_PREALLOC_PKTID_MAP = 13,
-       DHD_PREALLOC_PKTID_MAP_IOCTL = 14
+       DHD_PREALLOC_PKTID_MAP_IOCTL = 14,
+       DHD_PREALLOC_DHD_LOG_DUMP_BUF = 15,
+       DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16,
+       DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17,
+       DHD_PREALLOC_STAT_REPORT_BUF = 18,
+       DHD_PREALLOC_WL_ESCAN_INFO = 19,
+       DHD_PREALLOC_FW_VERBOSE_RING = 20,
+       DHD_PREALLOC_FW_EVENT_RING = 21,
+       DHD_PREALLOC_DHD_EVENT_RING = 22,
+       DHD_PREALLOC_NAN_EVENT_RING = 23
 };
 
 enum dhd_dongledump_mode {
index e957c872ded4e51ba957db244f6b44371cdd4bdb..e7071448d08cfa26cced5fc5c22d699f04448fa5 100644 (file)
@@ -433,12 +433,15 @@ dhd_dbg_trace_evnt_handler(dhd_pub_t *dhdp, void *event_data,
 
 static int
 dhd_dbg_ring_init(dhd_pub_t *dhdp, dhd_dbg_ring_t *ring, uint16 id, uint8 *name,
-               uint32 ring_sz)
+               uint32 ring_sz, int section)
 {
        void *buf;
        unsigned long flags;
-
+#ifdef CONFIG_DHD_USE_STATIC_BUF
+       buf = dhd_wlan_mem_prealloc(section, ring_sz);
+#else
        buf = MALLOCZ(dhdp->osh, ring_sz);
+#endif
        if (!buf)
                return BCME_NOMEM;
 
@@ -482,8 +485,9 @@ dhd_dbg_ring_deinit(dhd_pub_t *dhdp, dhd_dbg_ring_t *ring)
        dhd_os_spin_unlock(ring->lock, flags);
 
        dhd_os_spin_lock_deinit(dhdp->osh, ring->lock);
-
+#ifndef CONFIG_DHD_USE_STATIC_BUF
        MFREE(dhdp->osh, buf, ring_sz);
+#endif
 }
 
 /*
@@ -706,22 +710,22 @@ dhd_dbg_attach(dhd_pub_t *dhdp, dbg_pullreq_t os_pullreq,
                return BCME_NOMEM;
 
        ret = dhd_dbg_ring_init(dhdp, &dbg->dbg_rings[FW_VERBOSE_RING_ID], FW_VERBOSE_RING_ID,
-                       FW_VERBOSE_RING_NAME, FW_VERBOSE_RING_SIZE);
+                       (uint8 *)FW_VERBOSE_RING_NAME, FW_VERBOSE_RING_SIZE, DHD_PREALLOC_FW_VERBOSE_RING);
        if (ret)
                goto error;
 
        ret = dhd_dbg_ring_init(dhdp, &dbg->dbg_rings[FW_EVENT_RING_ID], FW_EVENT_RING_ID,
-                       FW_EVENT_RING_NAME, FW_EVENT_RING_SIZE);
+                       (uint8 *)FW_EVENT_RING_NAME, FW_EVENT_RING_SIZE, DHD_PREALLOC_FW_EVENT_RING);
        if (ret)
                goto error;
 
        ret = dhd_dbg_ring_init(dhdp, &dbg->dbg_rings[DHD_EVENT_RING_ID], DHD_EVENT_RING_ID,
-                       DHD_EVENT_RING_NAME, DHD_EVENT_RING_SIZE);
+                       (uint8 *)DHD_EVENT_RING_NAME, DHD_EVENT_RING_SIZE, DHD_PREALLOC_DHD_EVENT_RING);
        if (ret)
                goto error;
 
        ret = dhd_dbg_ring_init(dhdp, &dbg->dbg_rings[NAN_EVENT_RING_ID], NAN_EVENT_RING_ID,
-                       NAN_EVENT_RING_NAME, NAN_EVENT_RING_SIZE);
+                       (uint8 *)NAN_EVENT_RING_NAME, NAN_EVENT_RING_SIZE, DHD_PREALLOC_NAN_EVENT_RING);
        if (ret)
                goto error;
 
index 6145982bdb7e36ea9618510b3852c8e541856f0f..1a45fb31bef49e44a1b886a356f16b526571e647 100644 (file)
@@ -112,7 +112,9 @@ MAKE_PREFETCH_RANGE_FN(PREF_STORE_RETAINED)
 #ifndef OR_REG
 #define OR_REG(osh, r, v)              W_REG(osh, (r), R_REG(osh, r) | (v))
 #endif   /* !OR_REG */
-
+#ifdef CONFIG_DHD_USE_STATIC_BUF
+void* dhd_wlan_mem_prealloc(int section, unsigned long size);
+#endif
 #if !defined(OSL_SYSUPTIME)
 #define OSL_SYSUPTIME() (0)
 #define OSL_SYSUPTIME_SUPPORT FALSE
index 9092979e007b75264048f609d2f77ded98ca8b89..d35b4fbb4b3fda0d12059960756130e50a90b793 100644 (file)
@@ -33,7 +33,6 @@
 #include <bcmendian.h>
 #include <linuxver.h>
 #include <bcmdefs.h>
-#include <asm-generic/pci-dma-compat.h>
 #ifdef mips
 #include <asm/paccess.h>
 #include <asm/cache.h>
@@ -53,6 +52,9 @@
 #include <bcmutils.h>
 #include <linux/delay.h>
 #include <pcicfg.h>
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 8, 0))
+#include <asm-generic/pci-dma-compat.h>
+#endif
 
 
 #ifdef BCM_SECURE_DMA
index 2f749e66c4f15e67a387d7910bbc415630c09e88..25d5d98cc5a73a1fd968ff5edbd5c48ac7f30222 100644 (file)
@@ -1411,8 +1411,9 @@ void wl_escan_detach(void)
                kfree(escan->escan_ioctl_buf);
                escan->escan_ioctl_buf = NULL;
        }
-
+#ifndef CONFIG_DHD_USE_STATIC_BUF
        kfree(escan);
+#endif
        g_escan = NULL;
 }
 
@@ -1425,8 +1426,11 @@ wl_escan_attach(struct net_device *dev, void * dhdp)
 
        if (!dev)
                return 0;
-
+#ifdef CONFIG_DHD_USE_STATIC_BUF
+       escan = dhd_wlan_mem_prealloc(DHD_PREALLOC_WL_ESCAN_INFO, sizeof(struct wl_escan_info));
+#else
        escan = kmalloc(sizeof(struct wl_escan_info), GFP_KERNEL);
+#endif
        if (!escan)
                return -ENOMEM;
        memset(escan, 0, sizeof(struct wl_escan_info));
index 09928601b0a5c4107e996fb18d9c2dd4a06fb69d..7d08eb2971be04ae5a58faabd90f92e87c95fa5b 100644 (file)
@@ -5028,8 +5028,8 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
 
        DHD_GENERAL_LOCK(&dhd->pub, flags);
        if (DHD_BUS_CHECK_SUSPEND_OR_SUSPEND_IN_PROGRESS(&dhd->pub)) {
-               DHD_ERROR(("%s: bus is in suspend(%d) or suspending(0x%x) state!!\n",
-                       __FUNCTION__, dhd->pub.busstate, dhd->pub.dhd_bus_busy_state));
+       //      DHD_ERROR(("%s: bus is in suspend(%d) or suspending(0x%x) state!!\n",
+       //              __FUNCTION__, dhd->pub.busstate, dhd->pub.dhd_bus_busy_state));
                DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub);
 #ifdef PCIE_FULL_DONGLE
                /* Stop tx queues if suspend is in progress */
index 725d2dba725c47686c9d6c49a15a3f9681e15bad..ac7c19b7c36b9dd755af45e8614d7f897318b051 100644 (file)
@@ -14085,10 +14085,10 @@ static void wl_scan_timeout(unsigned long data)
        struct wl_bss_info *bi = NULL;
        s32 i;
        u32 channel;
-#if defined(DHD_DEBUG) && defined(DHD_FW_COREDUMP)
+/*#if defined(DHD_DEBUG) && defined(DHD_FW_COREDUMP)
        dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub);
        uint32 prev_memdump_mode = dhdp->memdump_enabled;
-#endif /* DHD_DEBUG && DHD_FW_COREDUMP */
+#endif*/ /* DHD_DEBUG && DHD_FW_COREDUMP */
 
        if (!(cfg->scan_request)) {
                WL_ERR(("timer expired but no scan request\n"));
@@ -14122,14 +14122,15 @@ static void wl_scan_timeout(unsigned long data)
 
        bzero(&msg, sizeof(wl_event_msg_t));
        WL_ERR(("timer expired\n"));
-#if defined(DHD_DEBUG) && defined(DHD_FW_COREDUMP)
+/*#if defined(DHD_DEBUG) && defined(DHD_FW_COREDUMP)
        if (dhdp->memdump_enabled) {
                dhdp->memdump_enabled = DUMP_MEMFILE;
                dhdp->memdump_type = DUMP_TYPE_SCAN_TIMEOUT;
                dhd_bus_mem_dump(dhdp);
                dhdp->memdump_enabled = prev_memdump_mode;
        }
-#endif /* DHD_DEBUG && DHD_FW_COREDUMP */
+#endif*/
+ /* DHD_DEBUG && DHD_FW_COREDUMP */
        msg.event_type = hton32(WLC_E_ESCAN_RESULT);
        msg.status = hton32(WLC_E_STATUS_TIMEOUT);
        msg.reason = 0xFFFFFFFF;
@@ -16931,8 +16932,10 @@ static void wl_link_down(struct bcm_cfg80211 *cfg)
 
        WL_DBG(("In\n"));
        cfg->link_up = false;
-       conn_info->req_ie_len = 0;
-       conn_info->resp_ie_len = 0;
+       if (conn_info) {
+               conn_info->req_ie_len = 0;
+               conn_info->resp_ie_len = 0;
+       }
 }
 
 static unsigned long wl_lock_eq(struct bcm_cfg80211 *cfg)