Subject: Improve the management of scan node and correct every scan node's life 
time

Update the buffer alone, not the entire node.
This involves,
1) Freeing the buffer alone.
2) Allocating a new buffer
3) Update the node timestamp with the current time.

This is related to BOO #9999, Wi-fi driver unable to scan for AP in noisy 
environment
For now, the problem is few APs scanned on scan list UI. 
Except Scan Node's management in driver, we need to update FW to improve the 
number of scanned APs.


Signed-off-by: Samuel Chang <samu...@qca.qualcomm.com>


diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wlan_api.h 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wlan_api.h
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wlan_api.h     
2011-07-03 12:29:58.000000000 +0800
+++ 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wlan_api.h 
    2011-07-16 00:17:25.651873028 +0800
@@ -86,6 +86,7 @@
                 const A_UINT8 *macaddr);
 bss_t *wlan_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr);
 void wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni);
+A_STATUS wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, 
A_UINT32 len);
 void wlan_free_allnodes(struct ieee80211_node_table *nt);
 void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func 
*f,
                         void *arg);
@@ -118,6 +119,7 @@
 wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid,
                     A_UINT32 ssidLength, A_UINT32 dot11AuthMode, A_UINT32 
authMode,
                    A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp);
+void wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni);
 
 #ifdef __cplusplus
 }
diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wmi_api.h 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wmi_api.h
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wmi_api.h      
2011-07-03 12:29:58.000000000 +0800
+++ 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wmi_api.h  
    2011-07-16 00:17:32.139147180 +0800
@@ -330,6 +330,13 @@
 wmi_node_return (struct wmi_t *wmip, bss_t *bss);
 
 void
+wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss);
+
+void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid);
+
+bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len);
+
+void
 wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge);
 
 #if defined(CONFIG_TARGET_PROFILE_SUPPORT)
diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/wlan/src/wlan_node.c 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wlan/src/wlan_node.c
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/wlan/src/wlan_node.c   
2011-07-03 12:29:58.000000000 +0800
+++ 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wlan/src/wlan_node.c
   2011-07-16 00:18:08.321408509 +0800
@@ -60,6 +60,7 @@
     ni = A_MALLOC_NOWAIT(sizeof(bss_t));
 
     if (ni != NULL) {
+        A_MEMZERO(ni, sizeof(bss_t));
         if (wh_size)
         {
                ni->ni_buf = A_MALLOC_NOWAIT(wh_size);
@@ -67,6 +68,8 @@
                A_FREE(ni);
                ni = NULL;
                return ni;
+            } else {
+                A_MEMZERO(ni->ni_buf, wh_size);
                }
         }
     } else {
@@ -104,20 +107,24 @@
 }
 
 void
+wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni)
+{
+    ni->ni_tstamp = A_GET_MS(0);
+    ni->ni_actcnt = WLAN_NODE_INACT_CNT;
+    return;
+}
+
+void
 wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni,
                 const A_UINT8 *macaddr)
 {
     int hash;
-    A_UINT32 timeoutValue = 0;
 
     A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN);
     hash = IEEE80211_NODE_HASH (macaddr);
     ieee80211_node_initref (ni);     /* mark referenced */
 
-    timeoutValue = nt->nt_nodeAge;
-
-    ni->ni_tstamp = A_GET_MS (0);
-    ni->ni_actcnt = WLAN_NODE_INACT_CNT;
+    wlan_node_update_timestamp(nt, ni);
 
     IEEE80211_NODE_LOCK_BH(nt);
 
@@ -208,6 +215,45 @@
     return ni;
 }
 
+
+/* Update the buffer alone, not the entire node.
+ * This involves,
+ * 1) Freeing the buffer alone.
+ * 2) Allocating a new buffer
+ * 3) Update the node timestamp with the current time.
+ */
+A_STATUS 
+wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len)
+{
+    IEEE80211_NODE_LOCK(nt);
+
+    /* Free the ni_buf alone.
+     */
+    if (ni->ni_buf != NULL) {
+        A_FREE(ni->ni_buf);
+        ni->ni_buf = NULL;
+    }
+
+    /* Allocate ni_buf for the new length.
+     */
+    if (len) {
+        ni->ni_buf = A_MALLOC_NOWAIT(len);
+        if (ni->ni_buf == NULL) {
+            return A_ERROR;
+        } else {
+            A_MEMZERO(ni->ni_buf, len);
+        }
+    }
+
+    /* Update the Node's timestamp.
+     */
+    wlan_node_update_timestamp(nt, ni);
+
+    IEEE80211_NODE_UNLOCK(nt);
+
+    return A_OK;
+}
+
 /*
  * Reclaim a node.  If this is the last reference count then
  * do the normal free work.  Otherwise remove it from the node
@@ -384,7 +430,7 @@
 
     for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) {
         pIESsid = ni->ni_cie.ie_ssid;
-        if (pIESsid[1] <= 32) {
+        if ((pIESsid) && pIESsid[1] <= 32) {
 
             // Step 1 : Check SSID
             if (0x00 == memcmp (pSsid, &pIESsid[2], ssidLength)) {
diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/wmi/wmi.c 
kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wmi/wmi.c
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/wmi/wmi.c      2011-07-03 
12:29:58.000000000 +0800
+++ kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wmi/wmi.c      
2011-07-16 00:19:12.142241837 +0800
@@ -1849,6 +1849,8 @@
     A_UCHAR cached_ssid_len = 0;
     A_UCHAR cached_ssid_buf[IEEE80211_NWID_LEN] = {0};
     A_UINT8 beacon_ssid_len = 0;
+    A_UINT8 newNode=0;
+    A_STATUS status = A_OK;
 
 
     if (len <= sizeof(WMI_BSS_INFO_HDR)) {
@@ -1870,13 +1872,13 @@
     if(ar6000_get_driver_cfg(wmip->wmi_devt,
                     AR6000_DRIVER_CFG_GET_WLANNODECACHING,
                     &nodeCachingAllowed) != A_OK) {
-        wmi_node_return(wmip, bss);
-        return A_EINVAL;
+        status = A_EINVAL;
+        goto err_exit;
     }
 
     if(!nodeCachingAllowed) {
-        wmi_node_return(wmip, bss);
-        return A_OK;
+        status = A_OK;
+        goto err_exit;
     }
 
     buf = datap + sizeof(WMI_BSS_INFO_HDR);
@@ -1885,7 +1887,7 @@
     {
         A_WMI_PROBERESP_RECV_EVENT(wmip->wmi_devt,buf,len,bih->bssid);
     }
-    else
+    else if(bih->frameType == BEACON_FTYPE)
     {
         A_WMI_BEACON_RECV_EVENT(wmip->wmi_devt,buf,len,bih->bssid);
     }
@@ -1897,12 +1899,14 @@
               bih->bssid[5]));
 
     if(wps_enable && (bih->frameType == PROBERESP_FTYPE) ) {
-        wmi_node_return(wmip, bss);
-        return A_OK;
+        status = A_OK;
+        goto err_exit;
     }
 
     if (bss != NULL) {
-        /*
+        /* Legacy Way - This is no longer valid. Retaining the comment to know
+         * the history. Now we do not reclaim the entire node. We only update
+         * the ni_buf.
          * Free up the node.  Not the most efficient process given
          * we are about to allocate a new node but it is simple and should be
          * adequate.
@@ -1942,8 +1946,6 @@
         bih->rssi = RSSI_AVE(bss->ni_rssi, bih->rssi, 13);
         bih->snr  = RSSI_AVE(bss->ni_snr, bih->snr, 13);
 
-        wlan_node_reclaim(&wmip->wmi_scan_table, bss);
-    }
 
     /*  beacon/probe response frame format
      *  [8] time stamp
@@ -1961,12 +1963,24 @@
         len += (cached_ssid_len - beacon_ssid_len);
     }
 
+        /* Free up just the ni_buf from the node. Not the entire Node as done
+         * before. The previous method of reclaiming the entire node even for
+         * updates leads to frequent node reclaims/allocs in the case of P2P.
+         */
+
+        if (wlan_node_buf_update(&wmip->wmi_scan_table, bss, len) != A_OK) {
+            status = A_NO_MEMORY;
+            goto err_exit;
+        }
+    } else {
     bss = wlan_node_alloc(&wmip->wmi_scan_table, len);
 
     if (bss == NULL) {
         return A_NO_MEMORY;
     }
 
+        newNode = 1;
+    }
     bss->ni_snr        = bih->snr;
     bss->ni_rssi       = bih->rssi;
     A_ASSERT(bss->ni_buf != NULL);
@@ -2017,9 +2031,10 @@
        }
 
     bss->ni_framelen = len;
-    if (wlan_parse_beacon(bss->ni_buf, len, &bss->ni_cie) != A_OK) {
-        wlan_node_free(bss);
-        return A_EINVAL;
+    if ((bih->frameType == BEACON_FTYPE || bih->frameType == PROBERESP_FTYPE) 
&&
+            wlan_parse_beacon(bss->ni_buf, len, &bss->ni_cie) != A_OK) {
+        status = A_EINVAL;
+        goto err_exit;
     }
 
 
@@ -2028,9 +2043,21 @@
      * which is done in wlan_parse_beacon
      */
     bss->ni_cie.ie_chan = bih->channel;
+    /* If the Node was updated, release the ref. count acquired by 
wlan_find_node() in the
+     * beginning.
+     */
+err_exit:
+    if (newNode) {
+        if (status == A_OK) {
     wlan_setup_node(&wmip->wmi_scan_table, bss, bih->bssid);
+        } else if (bss) {
+                 wlan_node_free(bss);
+        }
+    } else {
+        wmi_node_return(wmip, bss);
+    }
 
-    return A_OK;
+    return status;
 }
 
 static A_STATUS
@@ -3032,6 +3059,7 @@
     A_NETBUF_PUT(osbuf, size);
 
     sc = (WMI_START_SCAN_CMD *)(A_NETBUF_DATA(osbuf));
+    A_MEMZERO(sc, sizeof(*sc));
     sc->scanType = scanType;
     sc->forceFgScan = forceFgScan;
     sc->isLegacy = isLegacy;
@@ -5936,6 +5964,24 @@
 }
 
 void
+wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss)
+{
+    if (NULL != bss) {
+        wlan_node_update_timestamp(&wmip->wmi_scan_table, bss);
+    }
+}
+
+void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid)
+{
+    wlan_setup_node(&wmip->wmi_scan_table, bss, bssid);
+}
+
+bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len)
+{
+    return wlan_node_alloc(&wmip->wmi_scan_table, len);
+}
+
+void
 wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge)
 {
     wlan_set_nodeage(&wmip->wmi_scan_table,nodeAge);
Subject: Improve the management of scan node and correct every scan node's life time

Update the buffer alone, not the entire node.
This involves,
1) Freeing the buffer alone.
2) Allocating a new buffer
3) Update the node timestamp with the current time.

Signed-off-by: Samuel Chang <samu...@qca.qualcomm.com>


diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wlan_api.h kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wlan_api.h
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wlan_api.h	2011-07-03 12:29:58.000000000 +0800
+++ kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wlan_api.h	2011-07-16 00:17:25.651873028 +0800
@@ -86,6 +86,7 @@
                 const A_UINT8 *macaddr);
 bss_t *wlan_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr);
 void wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni);
+A_STATUS wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len);
 void wlan_free_allnodes(struct ieee80211_node_table *nt);
 void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f,
                         void *arg);
@@ -118,6 +119,7 @@
 wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid,
                     A_UINT32 ssidLength, A_UINT32 dot11AuthMode, A_UINT32 authMode,
                    A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp);
+void wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni);
 
 #ifdef __cplusplus
 }
diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wmi_api.h kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wmi_api.h
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/include/wmi_api.h	2011-07-03 12:29:58.000000000 +0800
+++ kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/include/wmi_api.h	2011-07-16 00:17:32.139147180 +0800
@@ -330,6 +330,13 @@
 wmi_node_return (struct wmi_t *wmip, bss_t *bss);
 
 void
+wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss);
+
+void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid);
+
+bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len);
+
+void
 wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge);
 
 #if defined(CONFIG_TARGET_PROFILE_SUPPORT)
diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/wlan/src/wlan_node.c kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wlan/src/wlan_node.c
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/wlan/src/wlan_node.c	2011-07-03 12:29:58.000000000 +0800
+++ kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wlan/src/wlan_node.c	2011-07-16 00:18:08.321408509 +0800
@@ -60,6 +60,7 @@
     ni = A_MALLOC_NOWAIT(sizeof(bss_t));
 
     if (ni != NULL) {
+        A_MEMZERO(ni, sizeof(bss_t));
         if (wh_size)
         {
         	ni->ni_buf = A_MALLOC_NOWAIT(wh_size);
@@ -67,6 +68,8 @@
             	A_FREE(ni);
             	ni = NULL;
             	return ni;
+            } else {
+                A_MEMZERO(ni->ni_buf, wh_size);
         	}
         }
     } else {
@@ -104,20 +107,24 @@
 }
 
 void
+wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni)
+{
+    ni->ni_tstamp = A_GET_MS(0);
+    ni->ni_actcnt = WLAN_NODE_INACT_CNT;
+    return;
+}
+
+void
 wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni,
                 const A_UINT8 *macaddr)
 {
     int hash;
-    A_UINT32 timeoutValue = 0;
 
     A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN);
     hash = IEEE80211_NODE_HASH (macaddr);
     ieee80211_node_initref (ni);     /* mark referenced */
 
-    timeoutValue = nt->nt_nodeAge;
-
-    ni->ni_tstamp = A_GET_MS (0);
-    ni->ni_actcnt = WLAN_NODE_INACT_CNT;
+    wlan_node_update_timestamp(nt, ni);
 
     IEEE80211_NODE_LOCK_BH(nt);
 
@@ -208,6 +215,45 @@
     return ni;
 }
 
+
+/* Update the buffer alone, not the entire node.
+ * This involves,
+ * 1) Freeing the buffer alone.
+ * 2) Allocating a new buffer
+ * 3) Update the node timestamp with the current time.
+ */
+A_STATUS 
+wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len)
+{
+    IEEE80211_NODE_LOCK(nt);
+
+    /* Free the ni_buf alone.
+     */
+    if (ni->ni_buf != NULL) {
+        A_FREE(ni->ni_buf);
+        ni->ni_buf = NULL;
+    }
+
+    /* Allocate ni_buf for the new length.
+     */
+    if (len) {
+        ni->ni_buf = A_MALLOC_NOWAIT(len);
+        if (ni->ni_buf == NULL) {
+            return A_ERROR;
+        } else {
+            A_MEMZERO(ni->ni_buf, len);
+        }
+    }
+
+    /* Update the Node's timestamp.
+     */
+    wlan_node_update_timestamp(nt, ni);
+
+    IEEE80211_NODE_UNLOCK(nt);
+
+    return A_OK;
+}
+
 /*
  * Reclaim a node.  If this is the last reference count then
  * do the normal free work.  Otherwise remove it from the node
@@ -384,7 +430,7 @@
 
     for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) {
         pIESsid = ni->ni_cie.ie_ssid;
-        if (pIESsid[1] <= 32) {
+        if ((pIESsid) && pIESsid[1] <= 32) {
 
             // Step 1 : Check SSID
             if (0x00 == memcmp (pSsid, &pIESsid[2], ssidLength)) {
diff -ruN kernel-2.6.37.6-151.5/drivers/staging/ar6003/wmi/wmi.c kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wmi/wmi.c
--- kernel-2.6.37.6-151.5/drivers/staging/ar6003/wmi/wmi.c	2011-07-03 12:29:58.000000000 +0800
+++ kernel-2.6.37.6-151.5_scan_node_patch/drivers/staging/ar6003/wmi/wmi.c	2011-07-16 00:19:12.142241837 +0800
@@ -1849,6 +1849,8 @@
     A_UCHAR cached_ssid_len = 0;
     A_UCHAR cached_ssid_buf[IEEE80211_NWID_LEN] = {0};
     A_UINT8 beacon_ssid_len = 0;
+    A_UINT8 newNode=0;
+    A_STATUS status = A_OK;
 
 
     if (len <= sizeof(WMI_BSS_INFO_HDR)) {
@@ -1870,13 +1872,13 @@
     if(ar6000_get_driver_cfg(wmip->wmi_devt,
                     AR6000_DRIVER_CFG_GET_WLANNODECACHING,
                     &nodeCachingAllowed) != A_OK) {
-        wmi_node_return(wmip, bss);
-        return A_EINVAL;
+        status = A_EINVAL;
+        goto err_exit;
     }
 
     if(!nodeCachingAllowed) {
-        wmi_node_return(wmip, bss);
-        return A_OK;
+        status = A_OK;
+        goto err_exit;
     }
 
     buf = datap + sizeof(WMI_BSS_INFO_HDR);
@@ -1885,7 +1887,7 @@
     {
         A_WMI_PROBERESP_RECV_EVENT(wmip->wmi_devt,buf,len,bih->bssid);
     }
-    else
+    else if(bih->frameType == BEACON_FTYPE)
     {
         A_WMI_BEACON_RECV_EVENT(wmip->wmi_devt,buf,len,bih->bssid);
     }
@@ -1897,12 +1899,14 @@
               bih->bssid[5]));
 
     if(wps_enable && (bih->frameType == PROBERESP_FTYPE) ) {
-        wmi_node_return(wmip, bss);
-        return A_OK;
+        status = A_OK;
+        goto err_exit;
     }
 
     if (bss != NULL) {
-        /*
+        /* Legacy Way - This is no longer valid. Retaining the comment to know
+         * the history. Now we do not reclaim the entire node. We only update
+         * the ni_buf.
          * Free up the node.  Not the most efficient process given
          * we are about to allocate a new node but it is simple and should be
          * adequate.
@@ -1942,8 +1946,6 @@
         bih->rssi = RSSI_AVE(bss->ni_rssi, bih->rssi, 13);
         bih->snr  = RSSI_AVE(bss->ni_snr, bih->snr, 13);
 
-        wlan_node_reclaim(&wmip->wmi_scan_table, bss);
-    }
 
     /*  beacon/probe response frame format
      *  [8] time stamp
@@ -1961,12 +1963,24 @@
         len += (cached_ssid_len - beacon_ssid_len);
     }
 
+        /* Free up just the ni_buf from the node. Not the entire Node as done
+         * before. The previous method of reclaiming the entire node even for
+         * updates leads to frequent node reclaims/allocs in the case of P2P.
+         */
+
+        if (wlan_node_buf_update(&wmip->wmi_scan_table, bss, len) != A_OK) {
+            status = A_NO_MEMORY;
+            goto err_exit;
+        }
+    } else {
     bss = wlan_node_alloc(&wmip->wmi_scan_table, len);
 
     if (bss == NULL) {
         return A_NO_MEMORY;
     }
 
+        newNode = 1;
+    }
     bss->ni_snr        = bih->snr;
     bss->ni_rssi       = bih->rssi;
     A_ASSERT(bss->ni_buf != NULL);
@@ -2017,9 +2031,10 @@
 	}
 
     bss->ni_framelen = len;
-    if (wlan_parse_beacon(bss->ni_buf, len, &bss->ni_cie) != A_OK) {
-        wlan_node_free(bss);
-        return A_EINVAL;
+    if ((bih->frameType == BEACON_FTYPE || bih->frameType == PROBERESP_FTYPE) &&
+            wlan_parse_beacon(bss->ni_buf, len, &bss->ni_cie) != A_OK) {
+        status = A_EINVAL;
+        goto err_exit;
     }
 
 
@@ -2028,9 +2043,21 @@
      * which is done in wlan_parse_beacon
      */
     bss->ni_cie.ie_chan = bih->channel;
+    /* If the Node was updated, release the ref. count acquired by wlan_find_node() in the
+     * beginning.
+     */
+err_exit:
+    if (newNode) {
+        if (status == A_OK) {
     wlan_setup_node(&wmip->wmi_scan_table, bss, bih->bssid);
+        } else if (bss) {
+		  wlan_node_free(bss);
+        }
+    } else {
+        wmi_node_return(wmip, bss);
+    }
 
-    return A_OK;
+    return status;
 }
 
 static A_STATUS
@@ -3032,6 +3059,7 @@
     A_NETBUF_PUT(osbuf, size);
 
     sc = (WMI_START_SCAN_CMD *)(A_NETBUF_DATA(osbuf));
+    A_MEMZERO(sc, sizeof(*sc));
     sc->scanType = scanType;
     sc->forceFgScan = forceFgScan;
     sc->isLegacy = isLegacy;
@@ -5936,6 +5964,24 @@
 }
 
 void
+wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss)
+{
+    if (NULL != bss) {
+        wlan_node_update_timestamp(&wmip->wmi_scan_table, bss);
+    }
+}
+
+void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid)
+{
+    wlan_setup_node(&wmip->wmi_scan_table, bss, bssid);
+}
+
+bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len)
+{
+    return wlan_node_alloc(&wmip->wmi_scan_table, len);
+}
+
+void
 wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge)
 {
     wlan_set_nodeage(&wmip->wmi_scan_table,nodeAge);
_______________________________________________
MeeGo-kernel mailing list
MeeGo-kernel@lists.meego.com
http://lists.meego.com/listinfo/meego-kernel

Reply via email to