Author: weongyo
Date: Tue Jun 29 21:56:42 2010
New Revision: 209598
URL: http://svn.freebsd.org/changeset/base/209598

Log:
  Initializes the ratectl for a node when the state is changed to RUN.
  This prevents a kernel fault by dividing with zero because the initial
  rate was 0 and didn't be initialized.
  
  Tested by:    Warren Block <wblock at wonkity.com>
  MFC after:    3 days

Modified:
  head/sys/dev/bwi/if_bwi.c

Modified: head/sys/dev/bwi/if_bwi.c
==============================================================================
--- head/sys/dev/bwi/if_bwi.c   Tue Jun 29 21:52:40 2010        (r209597)
+++ head/sys/dev/bwi/if_bwi.c   Tue Jun 29 21:56:42 2010        (r209598)
@@ -1769,6 +1769,7 @@ static int
 bwi_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
 {
        struct bwi_vap *bvp = BWI_VAP(vap);
+       const struct ieee80211_txparam *tp;
        struct ieee80211com *ic= vap->iv_ic;
        struct ifnet *ifp = ic->ic_ifp;
        enum ieee80211_state ostate = vap->iv_state;
@@ -1822,6 +1823,11 @@ bwi_newstate(struct ieee80211vap *vap, e
                sc->sc_txpwrcb_type = BWI_TXPWR_CALIB;
 #endif
 
+               /* Initializes ratectl for a node. */
+               tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
+               if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE)
+                       ieee80211_ratectl_node_init(vap->iv_bss);
+
                callout_reset(&sc->sc_calib_ch, hz, bwi_calibrate, sc);
        }
 back:
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to