Changeset 3638

Show
Ignore:
Timestamp:
05/16/08 23:21:53 (3 months ago)
Author:
benoit
Message:

First attempt to solve some IBSS merge problems. This code needs further
testing in order to know when to start/stop beacons properly. Preliminary
testing are OK.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/branches/madwifi-dfs/ath/if_ath.c

    r3637 r3638  
    554554} 
    555555 
     556/* Context: Timer (softIRQ) */ 
     557static void 
     558ath_swba_watchdog(unsigned long data ) 
     559{ 
     560        struct ath_softc * sc = (struct ath_softc *)data; 
     561 
     562        DPRINTF(sc, ATH_DEBUG_BEACON, 
     563                "%s called, configuring beacon\n",__func__); 
     564        if (sc->sc_beacons) 
     565                ath_beacon_config(sc, NULL); 
     566} 
     567 
    556568/* Initialize ath_softc structure */ 
    557569 
     
    760772                goto bad2; 
    761773        } 
     774 
     775        /* SWBA watchdog timer : this timer is needed in order to make sure 
     776         * that beacon timers are still alive. If they are not, for instance 
     777         * following an IBSS merge where TSF has been updated and beacon timers 
     778         * are now in the past, this timer callback will kick in. It might 
     779         * solve other situations where beacons stops being sent for some 
     780         * reason */ 
     781        init_timer(&sc->sc_swba_timer); 
     782        sc->sc_swba_timer.function = ath_swba_watchdog; 
     783        sc->sc_swba_timer.data     = (unsigned long) sc; 
     784 
    762785        /* CAB: Crap After Beacon - a beacon gated queue */ 
    763786        sc->sc_cabq = ath_txq_setup(sc, HAL_TX_QUEUE_CAB, 0); 
     
    13131336        now_tu   = IEEE80211_TSF_TO_TU(ath_hal_gettsf64(ah)); 
    13141337        nexttbtt = sc->sc_nexttbtt + roundup_s( 
    1315                 (signed)(now_tu + 1 - sc->sc_nexttbtt), 
    1316                 vap->iv_bss->ni_intval); 
     1338                now_tu + 1 - sc->sc_nexttbtt, vap->iv_bss->ni_intval); 
    13171339 
    13181340        if (nexttbtt != sc->sc_nexttbtt) { 
     
    26062628                if (status & HAL_INT_SWBA) { 
    26072629                        struct ieee80211vap * vap; 
     2630                        u_int32_t hw_tsftu = IEEE80211_TSF_TO_TU(hw_tsf); 
    26082631 
    26092632                        DPRINTF(sc, ATH_DEBUG_BEACON, 
     
    26112634                                "tsf %10llx tsf_tu:%6u nexttbtt %10llx " 
    26122635                                "nexttbtt_tu:%6u\n", 
    2613                                 __func__, hw_tsf, IEEE80211_TSF_TO_TU(hw_tsf)
     2636                                __func__, hw_tsf, hw_tsftu
    26142637                                (u_int64_t)sc->sc_nexttbtt << 10, 
    26152638                                sc->sc_nexttbtt); 
     
    26302653                        vap = TAILQ_FIRST(&sc->sc_ic.ic_vaps); 
    26312654                        sc->sc_nexttbtt += vap->iv_bss->ni_intval; 
     2655 
     2656                        /* Updates SWBA watchdog timer */ 
     2657                        mod_timer(&sc->sc_swba_timer, jiffies 
     2658                                  + IEEE80211_TU_TO_JIFFIES( 
     2659                                          sc->sc_nexttbtt - hw_tsftu)); 
     2660 
    26322661                } 
    26332662                if (status & HAL_INT_RXEOL) { 
     
    57035732                 * zero, so next beacon will be sent at the next intval 
    57045733                 * time */ 
     5734                hw_tsf   = 0; 
     5735                hw_tsftu = 0; 
    57055736                nexttbtt = intval; 
    57065737        } else if (intval) {    /* NB: can be 0 for monitor mode */ 
     
    57215752                                 * We cannot use the hardware TSF, so we 
    57225753                                 * wait to synchronize beacons again. */ 
     5754                                nexttbtt = roundup(hw_tsftu + FUDGE, intval); 
    57235755                                sc->sc_syncbeacon = 1; 
    5724                                 goto ath_beacon_config_debug; 
    57255756                        } else { 
    57265757                                /* Normal case: we received a beacon to which 
    5727                                  * we have synchronized. Make sure that nexttbtt 
    5728                                  * is at least FUDGE TU ahead of hw_tsf */ 
    5729                                 nexttbtt = tsftu + roundup(hw_tsftu + FUDGE -  
    5730                                                 tsftu, intval); 
     5758                                 * we have synchronized. Make sure that 
     5759                                 * nexttbtt is at least FUDGE TU ahead of 
     5760                                 * hw_tsf */ 
     5761                                nexttbtt = tsftu + roundup(hw_tsftu + FUDGE - 
     5762                                                           tsftu, intval); 
    57315763                        } 
    57325764                } 
     
    58545886                sc->sc_nexttbtt = nexttbtt; 
    58555887                ath_hw_beaconinit(sc, hw_tsftu, nexttbtt, intval); 
    5856                 if (intval & HAL_BEACON_RESET_TSF) { 
     5888                if (reset_tsf) 
    58575889                        sc->sc_last_tsf = 0; 
    5858                 } 
    58595890                sc->sc_bmisscount = 0; 
    58605891                ath_hal_intrset(ah, sc->sc_imask); 
    5861         } 
    5862  
    5863 ath_beacon_config_debug: 
     5892 
     5893                /* Start SWBA watchdog timer */ 
     5894                mod_timer(&sc->sc_swba_timer, jiffies 
     5895                          + IEEE80211_TU_TO_JIFFIES( 
     5896                                  sc->sc_nexttbtt - hw_tsftu)); 
     5897        } 
     5898 
    58645899        /* We print all debug messages here, in order to preserve the 
    58655900         * time critical aspect of this function */ 
  • madwifi/branches/madwifi-dfs/ath/if_athvar.h

    r3633 r3638  
    740740        int sc_bhalq;                           /* HAL q for outgoing beacons */ 
    741741        u_int sc_bmisscount;                    /* missed beacon transmits */ 
     742        struct timer_list sc_swba_timer;        /* watchdog timer for SWBA */ 
    742743        u_int32_t sc_ant_tx[8];                 /* recent tx frames/antenna */ 
    743744        struct ath_txq *sc_cabq;                /* tx q for cab frames */