Ticket #848: madwifi-sta-discs.patch

File madwifi-sta-discs.patch, 3.6 kB (added by espy@pepper.com, 2 years ago)

Add module paramters for beacon miss threshold and beacon sleep duration.

  • ath/if_ath.c

    old new  
    264264static int outdoor = -1; 
    265265static int xchanmode = -1; 
    266266 
     267static int bmiss_thresh = -1; 
     268static int beacon_sleep = -1; 
     269 
    267270static const char *hal_status_desc[] = { 
    268271        "No error", 
    269272        "No hardware present or device not yet supported", 
     
    294297MODULE_PARM(rfkill, "i"); 
    295298MODULE_PARM(autocreate, "s"); 
    296299MODULE_PARM(ratectl, "s"); 
     300MODULE_PARAM(bmiss_thresh, "i"); 
     301MODULE_PARAM(beacon_sleep, "i"); 
    297302#else 
    298303#include <linux/moduleparam.h> 
    299304module_param(countrycode, int, 0600); 
     
    302307module_param(rfkill, int, 0600); 
    303308module_param(autocreate, charp, 0600); 
    304309module_param(ratectl, charp, 0600); 
     310module_param(bmiss_thresh, int, 0600); 
     311module_param(beacon_sleep, int, 0600); 
    305312#endif 
    306313MODULE_PARM_DESC(countrycode, "Override default country code"); 
    307314MODULE_PARM_DESC(outdoor, "Enable/disable outdoor use"); 
     
    309316MODULE_PARM_DESC(rfkill, "Enable/disable RFKILL capability"); 
    310317MODULE_PARM_DESC(autocreate, "Create ath device in [sta|ap|wds|adhoc|ahdemo|monitor] mode. defaults to sta, use 'none' to disable"); 
    311318MODULE_PARM_DESC(ratectl, "Rate control algorithm [amrr|onoe|sample], defaults to '" DEF_RATE_CTL "'"); 
     319MODULE_PARM_DESC(bmiss_thresh, "Override beacon miss threshold"); 
     320MODULE_PARM_DESC(beacon_sleep, "Override beacon sleep duration"); 
    312321 
    313322static int      ath_debug = 0; 
    314323#ifdef AR_DEBUG 
     
    45144523                 * is specified in TU so we only need calculate based 
    45154524                 * on the beacon interval.  Note that we clamp the 
    45164525                 * result to at most 10 beacons. 
     4526                 * 
     4527                 * Pepper: added module parameter control of bmissthreshold. 
     4528                 * If param *is* specified, don't clamp values. 
    45174529                 */ 
    4518                 bs.bs_bmissthreshold = howmany(ic->ic_bmisstimeout, intval); 
    4519                 if (bs.bs_bmissthreshold > 10) 
    4520                         bs.bs_bmissthreshold = 10; 
    4521                 else if (bs.bs_bmissthreshold <= 0) 
    4522                         bs.bs_bmissthreshold = 1; 
     4530                if (bmiss_thresh > -1) { 
     4531                        bs.bs_bmissthreshold = bmiss_thresh; 
     4532                 
     4533                        DPRINTF(sc, ATH_DEBUG_BEACON, "%s: bmiss_thresh override - %d\n", 
     4534                                __func__, 
     4535                                bmiss_thresh); 
    45234536 
     4537                } else { 
     4538                        bs.bs_bmissthreshold = howmany(ic->ic_bmisstimeout, intval); 
     4539 
     4540                        if (bs.bs_bmissthreshold > 10) 
     4541                                bs.bs_bmissthreshold = 10; 
     4542                        else if (bs.bs_bmissthreshold <= 0) 
     4543                                bs.bs_bmissthreshold = 1; 
     4544                } 
     4545 
    45244546                /* 
    45254547                 * Calculate sleep duration.  The configuration is 
    45264548                 * given in ms.  We ensure a multiple of the beacon 
     
    45294551                 * to make it a multiple of that. 
    45304552                 * 
    45314553                 * XXX fixed at 100ms 
     4554                 * Pepper: added module param control of sleepduration. 
    45324555                 */ 
    4533                 bs.bs_sleepduration = 
    4534                         roundup(IEEE80211_MS_TO_TU(100), bs.bs_intval); 
    4535                 if (bs.bs_sleepduration > bs.bs_dtimperiod) 
    4536                         bs.bs_sleepduration = roundup(bs.bs_sleepduration, bs.bs_dtimperiod); 
     4556                if (beacon_sleep > -1) { 
     4557                        bs.bs_sleepduration = beacon_sleep; 
     4558                        DPRINTF(sc, ATH_DEBUG_BEACON, "%s: beacon_sleep override - %d\n", 
     4559                                __func__, 
     4560                                beacon_sleep); 
     4561                } else 
     4562                        bs.bs_sleepduration = 
     4563                                roundup(IEEE80211_MS_TO_TU(100), bs.bs_intval); 
    45374564 
    45384565                DPRINTF(sc, ATH_DEBUG_BEACON,  
    45394566                        "%s: tsf %llu tsf:tu %u intval %u nexttbtt %u dtim %u nextdtim %u bmiss %u sleep %u cfp:period %u maxdur %u next %u timoffset %u\n" 
     
    45534580 
    45544581                ath_hal_intrset(ah, 0); 
    45554582                ath_hal_beacontimers(ah, &bs); 
    4556                 sc->sc_imask |= HAL_INT_BMISS; 
     4583 
     4584                /* 'bmiss_thresh == 0' disables beacon miss interrupts completely */ 
     4585                if (bmiss_thresh != 0)  
     4586                        sc->sc_imask |= HAL_INT_BMISS; 
     4587 
    45574588                ath_hal_intrset(ah, sc->sc_imask); 
    45584589        } else { 
    45594590                ath_hal_intrset(ah, 0);