Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net80211 Add some debug messages to ieee80211_notify_nod...



details:   https://anonhg.NetBSD.org/src/rev/0710a3d6594f
branches:  trunk
changeset: 582363:0710a3d6594f
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Sun Jun 26 04:34:43 2005 +0000

description:
Add some debug messages to ieee80211_notify_node_{join,leave}.

Change the way we walk 802.11 peers/clients: for each eligible
interface, walk the ic_sta (peers/clients) table, first; walk the
ic_scan (scan results) table, second; then visit the ic_bss (node
for the network joined/created by the interface).

diffstat:

 sys/net80211/ieee80211_netbsd.c |  63 +++++++++++++++++++++++++++-------------
 sys/net80211/ieee80211_sysctl.h |  15 +++++++--
 2 files changed, 54 insertions(+), 24 deletions(-)

diffs (154 lines):

diff -r 1b9abd86eab0 -r 0710a3d6594f sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c   Sun Jun 26 04:31:51 2005 +0000
+++ b/sys/net80211/ieee80211_netbsd.c   Sun Jun 26 04:34:43 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_netbsd.c,v 1.2 2005/06/22 06:16:02 dyoung Exp $ */
+/* $NetBSD: ieee80211_netbsd.c,v 1.3 2005/06/26 04:34:43 dyoung Exp $ */
 /*-
  * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -30,7 +30,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.6 2005/01/22 20:29:23 sam Exp $");
 #else
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.2 2005/06/22 06:16:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.3 2005/06/26 04:34:43 dyoung Exp $");
 #endif
 
 /*
@@ -230,23 +230,31 @@
  *     must not return NULL.
  */    
 static struct ieee80211_node *
-ieee80211_node_walkfirst(struct ieee80211_node_walk *nw,
-    u_short if_index)
+ieee80211_node_walkfirst(struct ieee80211_node_walk *nw, u_short if_index)
 {
-       struct ieee80211com *ic;
        (void)memset(nw, 0, sizeof(*nw));
 
        nw->nw_ifindex = if_index;
 
-       LIST_FOREACH(ic, &ieee80211com_head, ic_list) {
-               if (if_index != 0 && ic->ic_ifp->if_index != if_index)
+       LIST_FOREACH(nw->nw_ic, &ieee80211com_head, ic_list) {
+               if (if_index != 0 && nw->nw_ic->ic_ifp->if_index != if_index)
                        continue;
-               nw->nw_ic = ic;
-               nw->nw_ni = TAILQ_FIRST(&nw->nw_ic->ic_sta.nt_node);
+               if (!TAILQ_EMPTY(&nw->nw_ic->ic_sta.nt_node))
+                       nw->nw_nt = &nw->nw_ic->ic_sta;
+               else if (!TAILQ_EMPTY(&nw->nw_ic->ic_scan.nt_node))
+                       nw->nw_nt = &nw->nw_ic->ic_scan;
+               else if (nw->nw_ic->ic_bss == NULL)
+                       continue;
                break;
        }
 
-       KASSERT(LOGICALLY_EQUAL(nw->nw_ni == NULL, nw->nw_ic == NULL));
+       if (nw->nw_ic == NULL)
+               return NULL;
+
+       if (nw->nw_nt == NULL)
+               nw->nw_ni = nw->nw_ic->ic_bss;
+       else
+               nw->nw_ni = TAILQ_FIRST(&nw->nw_nt->nt_node);
 
        return nw->nw_ni;
 }
@@ -254,14 +262,22 @@
 static struct ieee80211_node *
 ieee80211_node_walknext(struct ieee80211_node_walk *nw)
 {
-       KASSERT(LOGICALLY_EQUAL(nw->nw_ni == NULL, nw->nw_ic == NULL));
+       if (nw->nw_nt != NULL)
+               nw->nw_ni = TAILQ_NEXT(nw->nw_ni, ni_list);
+       else
+               nw->nw_ni = NULL;
 
-       if (nw->nw_ic == NULL && nw->nw_ni == NULL)
-               return NULL;
-
-       nw->nw_ni = TAILQ_NEXT(nw->nw_ni, ni_list);
-
-       if (nw->nw_ni == NULL) {
+       while (nw->nw_ni == NULL) {
+               if (nw->nw_nt == &nw->nw_ic->ic_sta) {
+                       nw->nw_nt = &nw->nw_ic->ic_scan;
+                       nw->nw_ni = TAILQ_FIRST(&nw->nw_nt->nt_node);
+                       continue;
+               } else if (nw->nw_nt == &nw->nw_ic->ic_scan) {
+                       nw->nw_nt = NULL;
+                       nw->nw_ni = nw->nw_ic->ic_bss;
+                       continue;
+               }
+               KASSERT(nw->nw_nt == NULL);
                if (nw->nw_ifindex != 0)
                        return NULL;
 
@@ -269,11 +285,10 @@
                if (nw->nw_ic == NULL)
                        return NULL;
 
-               nw->nw_ni = TAILQ_FIRST(&nw->nw_ic->ic_sta.nt_node);
+               nw->nw_nt = &nw->nw_ic->ic_sta;
+               nw->nw_ni = TAILQ_FIRST(&nw->nw_nt->nt_node);
        }
 
-       KASSERT(LOGICALLY_EQUAL(nw->nw_ni == NULL, nw->nw_ic == NULL));
-
        return nw->nw_ni;
 }
 
@@ -582,6 +597,10 @@
        struct ifnet *ifp = ic->ic_ifp;
        struct ieee80211_join_event iev;
 
+       IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, "%s: %snode %s join\n",
+           ifp->if_xname, (ni == ic->ic_bss) ? "bss " : "",
+           ether_sprintf(ni->ni_macaddr));
+
        if (ni == ic->ic_bss) {
                memset(&iev, 0, sizeof(iev));
                IEEE80211_ADDR_COPY(iev.iev_addr, ni->ni_bssid);
@@ -603,6 +622,10 @@
        struct ifnet *ifp = ic->ic_ifp;
        struct ieee80211_leave_event iev;
 
+       IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, "%s: %snode %s leave\n",
+           ifp->if_xname, (ni == ic->ic_bss) ? "bss " : "",
+           ether_sprintf(ni->ni_macaddr));
+
        if (ni == ic->ic_bss) {
                rt_ieee80211msg(ifp, RTM_IEEE80211_DISASSOC, NULL, 0);
                if_link_state_change(ifp, LINK_STATE_DOWN);
diff -r 1b9abd86eab0 -r 0710a3d6594f sys/net80211/ieee80211_sysctl.h
--- a/sys/net80211/ieee80211_sysctl.h   Sun Jun 26 04:31:51 2005 +0000
+++ b/sys/net80211/ieee80211_sysctl.h   Sun Jun 26 04:34:43 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_sysctl.h,v 1.3 2005/06/22 06:16:02 dyoung Exp $ */
+/* $NetBSD: ieee80211_sysctl.h,v 1.4 2005/06/26 04:34:43 dyoung Exp $ */
 /*-
  * Copyright (c) 2005 David Young.  All rights reserved.
  *
@@ -105,10 +105,17 @@
 } __attribute__((__packed__));
 
 #ifdef __NetBSD__
+enum ieee80211_node_walk_state {
+       IEEE80211_WALK_BSS = 0,
+       IEEE80211_WALK_SCAN,
+       IEEE80211_WALK_STA
+};
+
 struct ieee80211_node_walk {
-       struct ieee80211com     *nw_ic;
-       struct ieee80211_node   *nw_ni;
-       u_short                 nw_ifindex;
+       struct ieee80211com             *nw_ic;
+       struct ieee80211_node_table     *nw_nt;
+       struct ieee80211_node           *nw_ni;
+       u_short                         nw_ifindex;
 };
 #endif /* __NetBSD__ */
 



Home | Main Index | Thread Index | Old Index