Changeset 139
- Timestamp:
- 05/13/03 06:32:01 (6 years ago)
- Files:
-
- cvs-import/trunk/driver/if_ath.c (modified) (12 diffs)
- cvs-import/trunk/driver/if_athvar.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cvs-import/trunk/driver/if_ath.c
r136 r139 91 91 static int ath_rate_setup(struct net_device *, u_int mode); 92 92 static void ath_rate_mapsetup(struct net_device *); 93 static void ath_rate_ctl_reset(struct ath_softc * );93 static void ath_rate_ctl_reset(struct ath_softc *, enum ieee80211_state); 94 94 static void ath_rate_ctl(void *, struct ieee80211_node *); 95 95 … … 1825 1825 HAL_CHANNEL hchan; 1826 1826 1827 sc->sc_stats.ast_per_cal++; 1828 1827 1829 /* 1828 1830 * Convert to a HAL channel description with the flags … … 1837 1839 if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) { 1838 1840 HAL_STATUS status; 1841 1842 sc->sc_stats.ast_per_rfgain++; 1839 1843 /* 1840 1844 * Rfgain is out of bounds, reset the chip 1841 1845 * to load new gain values. 1842 1846 */ 1843 printk("%s: gain values need update, reset channel\n", dev->name);/*XXX*/1844 1847 ath_hal_intrset(ah, 0); /* disable interrupts */ 1845 ath_hal_stoptxdma(ah, sc->sc_txhalq); 1846 ath_hal_stoptxdma(ah, sc->sc_bhalq); 1847 ath_stoprecv(sc); 1848 if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_FALSE, &status)) 1848 netif_stop_queue(dev); /* conservative */ 1849 ath_draintxq(sc); /* stop xmit side */ 1850 ath_stoprecv(sc); /* stop recv side */ 1851 /* NB: indicate channel change so we do a full reset */ 1852 if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_TRUE, &status)) 1849 1853 printk("%s: unable to reset hardware; hal status %u\n", 1850 1854 dev->name, status); 1851 /* XXX needed? */ 1852 if (ic->ic_flags & IEEE80211_F_WEPON) 1853 ath_initkeytable(sc); 1854 if (ath_startrecv(dev) != 0) 1855 ath_hal_intrset(ah, sc->sc_imask); 1856 if (ath_startrecv(dev) != 0) /* restart recv */ 1855 1857 printk("%s: unable to start recv logic\n", dev->name); 1856 ath_hal_intrset(ah, sc->sc_imask);1858 netif_start_queue(dev); /* restart xmit */ 1857 1859 } 1858 1860 if (!ath_hal_calibrate(ah, &hchan)) … … 1892 1894 DPRINTF(("%s: %s -> %s\n", __func__, stname[ostate], stname[nstate])); 1893 1895 1894 ath_hal_setledstate(ah, leds[nstate]); /* set LED */1896 ath_hal_setledstate(ah, leds[nstate]); /* set LED */ 1895 1897 netif_stop_queue(dev); /* before we do anything else */ 1896 1898 … … 2051 2053 * Reset the rate control state. 2052 2054 */ 2053 ath_rate_ctl_reset(sc );2055 ath_rate_ctl_reset(sc, nstate); 2054 2056 return 0; 2055 2057 bad: … … 2168 2170 } 2169 2171 2172 /* 2173 * Reset the rate control state for each 802.11 state transition. 2174 */ 2170 2175 static void 2171 ath_rate_ctl_reset(struct ath_softc *sc )2176 ath_rate_ctl_reset(struct ath_softc *sc, enum ieee80211_state state) 2172 2177 { 2173 2178 struct ieee80211com *ic = &sc->sc_ic; … … 2177 2182 st = &sc->sc_bss_stat; 2178 2183 st->st_tx_ok = st->st_tx_err = st->st_tx_retr = st->st_tx_upper = 0; 2179 if (ic->ic_opmode != IEEE80211_M_STA) { 2184 if (ic->ic_opmode == IEEE80211_M_STA) { 2185 ni = &ic->ic_bss; 2186 if (state == IEEE80211_S_RUN) { 2187 /* start with highest negotiated rate */ 2188 KASSERT(ni->ni_rates.rs_nrates > 0, 2189 ("transition to RUN state w/ no rates!")); 2190 ni->ni_txrate = ni->ni_rates.rs_nrates - 1; 2191 } else { 2192 /* use lowest rate */ 2193 ni->ni_txrate = 0; 2194 } 2195 } else { 2180 2196 TAILQ_FOREACH(ni, &ic->ic_node, ni_list) { 2197 ni->ni_txrate = 0; /* use lowest rate */ 2181 2198 st = ni->ni_private; 2182 2199 st->st_tx_ok = st->st_tx_err = st->st_tx_retr = … … 2186 2203 } 2187 2204 2205 /* 2206 * Examine and potentially adjust the transmit rate. 2207 */ 2188 2208 static void 2189 2209 ath_rate_ctl(void *arg, struct ieee80211_node *ni) … … 2198 2218 * XXX: very primitive version. 2199 2219 */ 2200 (void) sc; /* NB: silence compiler */2220 sc->sc_stats.ast_rate_calls++; 2201 2221 2202 2222 enough = (st->st_tx_ok + st->st_tx_err >= 10); … … 2221 2241 break; 2222 2242 case -1: 2223 if (ni->ni_txrate > 0) 2243 if (ni->ni_txrate > 0) { 2224 2244 ni->ni_txrate--; 2245 sc->sc_stats.ast_rate_drop++; 2246 } 2225 2247 st->st_tx_upper = 0; 2226 2248 break; … … 2229 2251 break; 2230 2252 st->st_tx_upper = 0; 2231 if (ni->ni_txrate + 1 < rs->rs_nrates) 2253 if (ni->ni_txrate + 1 < rs->rs_nrates) { 2232 2254 ni->ni_txrate++; 2255 sc->sc_stats.ast_rate_raise++; 2256 } 2233 2257 break; 2234 2258 } … … 2402 2426 STAT(be_nobuf); 2403 2427 2428 STAT(per_cal); STAT(per_rfgain); 2429 STAT(rate_calls); STAT(rate_raise); STAT(rate_drop); 2430 2404 2431 return cp - page; 2405 2432 #undef PHYSTAT cvs-import/trunk/driver/if_athvar.h
r136 r139 85 85 u_int32_t ast_rx_nobuf; /* rx setup failed 'cuz no skbuff */ 86 86 u_int32_t ast_be_nobuf; /* no skbuff available for beacon */ 87 u_int32_t ast_per_cal; /* periodic calibration calls */ 88 u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */ 89 u_int32_t ast_rate_calls; /* rate control checks */ 90 u_int32_t ast_rate_raise; /* rate control raised xmit rate */ 91 u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ 87 92 }; 88 93
