Index: chromeos/drivers/ath6kl/wlan/src/wlan_node.c |
diff --git a/chromeos/drivers/ath6kl/wlan/src/wlan_node.c b/chromeos/drivers/ath6kl/wlan/src/wlan_node.c |
index 4f87d031459cb46d13ab67f41cfd97a4b5392faf..6ec4e48eb2fd5b133727dbc1ca5b82536b2565a8 100644 |
--- a/chromeos/drivers/ath6kl/wlan/src/wlan_node.c |
+++ b/chromeos/drivers/ath6kl/wlan/src/wlan_node.c |
@@ -1,15 +1,19 @@ |
//------------------------------------------------------------------------------ |
// <copyright file="wlan_node.c" company="Atheros"> |
-// Copyright (c) 2004-2008 Atheros Corporation. All rights reserved. |
+// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. |
// |
-// This program is free software; you can redistribute it and/or modify |
-// it under the terms of the GNU General Public License version 2 as |
-// published by the Free Software Foundation; |
// |
-// Software distributed under the License is distributed on an "AS |
-// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
-// implied. See the License for the specific language governing |
-// rights and limitations under the License. |
+// Permission to use, copy, modify, and/or distribute this software for any |
+// purpose with or without fee is hereby granted, provided that the above |
+// copyright notice and this permission notice appear in all copies. |
+// |
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
+// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
+// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
+// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
+// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
+// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
// |
// |
//------------------------------------------------------------------------------ |
@@ -34,7 +38,7 @@ |
#define ATH_DEBUG_WLAN ATH_DEBUG_MAKE_MODULE_MASK(0) |
-#ifdef DEBUG |
+#ifdef ATH_DEBUG_MODULE |
static ATH_DEBUG_MASK_DESCRIPTION wlan_debug_desc[] = { |
{ ATH_DEBUG_WLAN , "General WLAN Node Tracing"}, |
@@ -49,7 +53,9 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(wlan, |
#endif |
+#ifdef THREAD_X |
static void wlan_node_timeout(A_ATH_TIMER arg); |
+#endif |
static bss_t * _ieee80211_find_node (struct ieee80211_node_table *nt, |
const A_UINT8 *macaddr); |
@@ -117,6 +123,7 @@ wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni, |
timeoutValue = nt->nt_nodeAge; |
ni->ni_tstamp = A_GET_MS (timeoutValue); |
+ ni->ni_actcnt = WLAN_NODE_INACT_CNT; |
IEEE80211_NODE_LOCK_BH(nt); |
@@ -141,10 +148,12 @@ wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni, |
ni->ni_hash_prev = NULL; |
nt->nt_hash[hash] = ni; |
+#ifdef THREAD_X |
if (!nt->isTimerArmed) { |
A_TIMEOUT_MS(&nt->nt_inact_timer, timeoutValue, 0); |
nt->isTimerArmed = TRUE; |
} |
+#endif |
IEEE80211_NODE_UNLOCK_BH(nt); |
} |
@@ -277,7 +286,7 @@ wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt) |
{ |
int i; |
- AR_DEBUG_PRINTF(ATH_DEBUG_WLAN, ("node table = 0x%x\n", (A_UINT32)nt)); |
+ AR_DEBUG_PRINTF(ATH_DEBUG_WLAN, ("node table = 0x%lx\n", (unsigned long)nt)); |
IEEE80211_NODE_LOCK_INIT(nt); |
A_REGISTER_MODULE_DEBUG_INFO(wlan); |
@@ -288,8 +297,10 @@ wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt) |
nt->nt_hash[i] = NULL; |
} |
+#ifdef THREAD_X |
A_INIT_TIMER(&nt->nt_inact_timer, wlan_node_timeout, nt); |
nt->isTimerArmed = FALSE; |
+#endif |
nt->nt_wmip = wmip; |
nt->nt_nodeAge = WLAN_NODE_INACT_TIMEOUT_MSEC; |
@@ -310,6 +321,59 @@ wlan_set_nodeage(struct ieee80211_node_table *nt, A_UINT32 nodeAge) |
nt->nt_nodeAge = nodeAge; |
return; |
} |
+void |
+wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt) |
+{ |
+#ifdef THREAD_X |
+ bss_t *bss, *nextBss; |
+ A_UINT8 myBssid[IEEE80211_ADDR_LEN], reArmTimer = FALSE; |
+ |
+ wmi_get_current_bssid(nt->nt_wmip, myBssid); |
+ |
+ bss = nt->nt_node_first; |
+ while (bss != NULL) |
+ { |
+ nextBss = bss->ni_list_next; |
+ if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) |
+ { |
+ /* |
+ * free up all but the current bss - if set |
+ */ |
+ wlan_node_reclaim(nt, bss); |
+ |
+ } |
+ bss = nextBss; |
+ } |
+#else |
+ bss_t *bss, *nextBss; |
+ A_UINT8 myBssid[IEEE80211_ADDR_LEN]; |
+ A_UINT32 timeoutValue = 0; |
+ A_UINT32 now = A_GET_MS(0); |
+ timeoutValue = nt->nt_nodeAge; |
+ |
+ wmi_get_current_bssid(nt->nt_wmip, myBssid); |
+ |
+ bss = nt->nt_node_first; |
+ while (bss != NULL) |
+ { |
+ nextBss = bss->ni_list_next; |
+ if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) |
+ { |
+ |
+ if (bss->ni_tstamp <= now || --bss->ni_actcnt == 0) |
+ { |
+ /* |
+ * free up all but the current bss - if set |
+ */ |
+ wlan_node_reclaim(nt, bss); |
+ } |
+ } |
+ bss = nextBss; |
+ } |
+#endif |
+} |
+ |
+#ifdef THREAD_X |
static void |
wlan_node_timeout (A_ATH_TIMER arg) |
{ |
@@ -353,12 +417,15 @@ wlan_node_timeout (A_ATH_TIMER arg) |
nt->isTimerArmed = reArmTimer; |
} |
+#endif |
void |
wlan_node_table_cleanup(struct ieee80211_node_table *nt) |
{ |
+#ifdef THREAD_X |
A_UNTIMEOUT(&nt->nt_inact_timer); |
A_DELETE_TIMER(&nt->nt_inact_timer); |
+#endif |
wlan_free_allnodes(nt); |
IEEE80211_NODE_LOCK_DESTROY(nt); |
} |