tech-net archive

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

RE: detecting loss of access point (link status monitoring fix?)



Here's the unified diff, it should be easier to look at.

Regards, 
Eric

Index: if_rum.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_rum.c,v
retrieving revision 1.23
diff -u -r1.23 if_rum.c
--- if_rum.c    21 Oct 2008 12:21:46 -0000      1.23
+++ if_rum.c    6 Apr 2010 18:50:59 -0000
@@ -203,6 +203,7 @@
 Static void            rum_amrr_timeout(void *);
 Static void            rum_amrr_update(usbd_xfer_handle,
usbd_private_handle,
                            usbd_status status);
+Static void            rum_linkmon(void *);
 
 /*
  * Supported rates for 802.11a/b/g modes (in 500Kbps unit).
@@ -360,6 +361,7 @@
        sc->amrr.amrr_min_success_threshold =  1;
        sc->amrr.amrr_max_success_threshold = 10;
        usb_callout_init(sc->sc_amrr_ch);
+       usb_callout_init(sc->sc_link_mon);
 
        /* retrieve RT2573 rev. no */
        for (ntries = 0; ntries < 1000; ntries++) {
@@ -491,6 +493,7 @@
        usb_rem_task(sc->sc_udev, &sc->sc_task);
        usb_uncallout(sc->sc_scan_ch, rum_next_scan, sc);
        usb_uncallout(sc->sc_amrr_ch, rum_amrr_timeout, sc);
+       usb_uncallout(sc->sc_link_mon, rum_linkmon, sc);
 
        if (sc->amrr_xfer != NULL) {
                usbd_free_xfer(sc->amrr_xfer);
@@ -745,6 +748,7 @@
                                rum_amrr_start(sc, ni);
                }
 
+               usb_callout(sc->sc_link_mon, hz*3, rum_linkmon, sc);
                break;
        }
 
@@ -759,6 +763,7 @@
        usb_rem_task(sc->sc_udev, &sc->sc_task);
        usb_uncallout(sc->sc_scan_ch, rum_next_scan, sc);
        usb_uncallout(sc->sc_amrr_ch, rum_amrr_timeout, sc);
+       usb_uncallout(sc->sc_link_mon, , NULL);
 
        /* do it in a process context */
        sc->sc_state = nstate;
@@ -2286,3 +2291,12 @@
 
        return 0;
 }
+
+void rum_linkmon(void *arg) 
+{
+       struct rum_softc *sc = arg;
+       ieee80211_beacon_miss(&sc->sc_ic);
+       if (sc->sc_ic.ic_state == IEEE80211_S_RUN) {
+               usb_callout(sc->sc_link_mon, hz*3, rum_linkmon, sc);
+       }
+}
Index: if_rumvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_rumvar.h,v
retrieving revision 1.4
diff -u -r1.4 if_rumvar.h
--- if_rumvar.h 25 Nov 2007 09:30:10 -0000      1.4
+++ if_rumvar.h 6 Apr 2010 18:50:59 -0000
@@ -110,6 +110,7 @@
 
        usb_callout_t                   sc_scan_ch;
        usb_callout_t                   sc_amrr_ch;
+       usb_callout_t                   sc_link_mon;
 
        int                             sc_tx_timer;


Regards, 
Eric

-----Original Message-----
From: Eric Naud 
Sent: April 6, 2010 1:59 PM
To: 'tech-net%netbsd.org@localhost'
Subject: detecting loss of access point (link status monitoring fix?)

Hello, 

While working with the rum and ral driver I noticed that these drivers
don't detect the loss of their access point. Situations such as moving
out of range or powering down the AP is not noticed by the driver and as
a result the network status remains active and no efforts are made to
scan for a new channel.

Here's a quick test case:
1. Boot into netBSD5.0.2 
2. Insert rum or ral device 
3. ifconfig rum0 ssid "TESTNETWORK" -nwkey (no keys, keep it simple)
4. ifconfig rum0 up 
5. Wait until network status = active and run ifconfig rum0, note the
bssid. 
6. Unplug the access point associated with that bssid. 
7. Wait. Run ifconfig and notice the 'status: active' is always
displayed instead of 'status: no network' 

Are there other mechanisms available to detect the loss of access point
or network status without manually initiating a channel scan? 

The change below uses the ieee80211_beacon_miss() function in a periodic
callout to determine if two or more consecutive beacons were missed, if
beacons were missed the driver state changes in order to initiate a
scan. 

Any feedback?

Regards, 
Eric

Index: if_rum.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_rum.c,v
retrieving revision 1.23
diff -r1.23 if_rum.c
25d24
< 
205a205
> Static void                 rum_linkmon(void *);
362a363
>          usb_callout_init(sc->sc_link_mon);
493a495
>          usb_uncallout(sc->sc_link_mon, rum_linkmon, sc);
747a750
>                      usb_callout(sc->sc_link_mon, hz*3, rum_linkmon,
sc);
761a765
>          usb_uncallout(sc->sc_link_mon, , NULL);
2288a2293,2301
> 
> void rum_linkmon(void *arg) 
> {
>          struct rum_softc *sc = arg;
>          ieee80211_beacon_miss(&sc->sc_ic);
>          if (ic->ic_state == IEEE80211_S_RUN) {
>                      usb_callout(sc->sc_link_mon, hz*3, rum_linkmon,
sc);
>          }
> }
Index: if_rumvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_rumvar.h,v
retrieving revision 1.4
diff -r1.4 if_rumvar.h
112a113
>          usb_callout_t                            sc_link_mon;




Home | Main Index | Thread Index | Old Index