if_rum.c (212122) | if_rum.c (212127) |
---|---|
1/* $FreeBSD: head/sys/dev/usb/wlan/if_rum.c 212122 2010-09-01 23:47:53Z thompsa $ */ | 1/* $FreeBSD: head/sys/dev/usb/wlan/if_rum.c 212127 2010-09-02 03:28:03Z thompsa $ */ |
2 3/*- 4 * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> 6 * Copyright (c) 2007-2008 Hans Petter Selasky <hselasky@FreeBSD.org> 7 * 8 * Permission to use, copy, modify, and distribute this software for any 9 * purpose with or without fee is hereby granted, provided that the above --- 4 unchanged lines hidden (view full) --- 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21#include <sys/cdefs.h> | 2 3/*- 4 * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> 6 * Copyright (c) 2007-2008 Hans Petter Selasky <hselasky@FreeBSD.org> 7 * 8 * Permission to use, copy, modify, and distribute this software for any 9 * purpose with or without fee is hereby granted, provided that the above --- 4 unchanged lines hidden (view full) --- 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_rum.c 212122 2010-09-01 23:47:53Z thompsa $"); | 22__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_rum.c 212127 2010-09-02 03:28:03Z thompsa $"); |
23 24/*- 25 * Ralink Technology RT2501USB/RT2601USB chipset driver 26 * http://www.ralinktech.com.tw/ 27 */ 28 29#include <sys/param.h> 30#include <sys/sockio.h> --- 683 unchanged lines hidden (view full) --- 714 if (ostate == IEEE80211_S_RUN) { 715 /* abort TSF synchronization */ 716 tmp = rum_read(sc, RT2573_TXRX_CSR9); 717 rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); 718 } 719 break; 720 721 case IEEE80211_S_RUN: | 23 24/*- 25 * Ralink Technology RT2501USB/RT2601USB chipset driver 26 * http://www.ralinktech.com.tw/ 27 */ 28 29#include <sys/param.h> 30#include <sys/sockio.h> --- 683 unchanged lines hidden (view full) --- 714 if (ostate == IEEE80211_S_RUN) { 715 /* abort TSF synchronization */ 716 tmp = rum_read(sc, RT2573_TXRX_CSR9); 717 rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); 718 } 719 break; 720 721 case IEEE80211_S_RUN: |
722 ni = vap->iv_bss; | 722 ni = ieee80211_ref_node(vap->iv_bss); |
723 724 if (vap->iv_opmode != IEEE80211_M_MONITOR) { 725 rum_update_slot(ic->ic_ifp); 726 rum_enable_mrr(sc); 727 rum_set_txpreamble(sc); 728 rum_set_basicrates(sc); 729 IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); 730 rum_set_bssid(sc, sc->sc_bssid); --- 7 unchanged lines hidden (view full) --- 738 rum_enable_tsf_sync(sc); 739 else 740 rum_enable_tsf(sc); 741 742 /* enable automatic rate adaptation */ 743 tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; 744 if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) 745 rum_ratectl_start(sc, ni); | 723 724 if (vap->iv_opmode != IEEE80211_M_MONITOR) { 725 rum_update_slot(ic->ic_ifp); 726 rum_enable_mrr(sc); 727 rum_set_txpreamble(sc); 728 rum_set_basicrates(sc); 729 IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); 730 rum_set_bssid(sc, sc->sc_bssid); --- 7 unchanged lines hidden (view full) --- 738 rum_enable_tsf_sync(sc); 739 else 740 rum_enable_tsf(sc); 741 742 /* enable automatic rate adaptation */ 743 tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; 744 if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) 745 rum_ratectl_start(sc, ni); |
746 ieee80211_free_node(ni); |
|
746 break; 747 default: 748 break; 749 } 750 RUM_UNLOCK(sc); 751 IEEE80211_LOCK(ic); 752 return (rvp->newstate(vap, nstate, arg)); 753} --- 1464 unchanged lines hidden (view full) --- 2218static void 2219rum_ratectl_task(void *arg, int pending) 2220{ 2221 struct rum_vap *rvp = arg; 2222 struct ieee80211vap *vap = &rvp->vap; 2223 struct ieee80211com *ic = vap->iv_ic; 2224 struct ifnet *ifp = ic->ic_ifp; 2225 struct rum_softc *sc = ifp->if_softc; | 747 break; 748 default: 749 break; 750 } 751 RUM_UNLOCK(sc); 752 IEEE80211_LOCK(ic); 753 return (rvp->newstate(vap, nstate, arg)); 754} --- 1464 unchanged lines hidden (view full) --- 2219static void 2220rum_ratectl_task(void *arg, int pending) 2221{ 2222 struct rum_vap *rvp = arg; 2223 struct ieee80211vap *vap = &rvp->vap; 2224 struct ieee80211com *ic = vap->iv_ic; 2225 struct ifnet *ifp = ic->ic_ifp; 2226 struct rum_softc *sc = ifp->if_softc; |
2226 struct ieee80211_node *ni = vap->iv_bss; | 2227 struct ieee80211_node *ni; |
2227 int ok, fail; 2228 int sum, retrycnt; 2229 2230 RUM_LOCK(sc); 2231 /* read and clear statistic registers (STA_CSR0 to STA_CSR10) */ 2232 rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof(sc->sta)); 2233 2234 ok = (le32toh(sc->sta[4]) >> 16) + /* TX ok w/o retry */ 2235 (le32toh(sc->sta[5]) & 0xffff); /* TX ok w/ retry */ 2236 fail = (le32toh(sc->sta[5]) >> 16); /* TX retry-fail count */ 2237 sum = ok+fail; 2238 retrycnt = (le32toh(sc->sta[5]) & 0xffff) + fail; 2239 | 2228 int ok, fail; 2229 int sum, retrycnt; 2230 2231 RUM_LOCK(sc); 2232 /* read and clear statistic registers (STA_CSR0 to STA_CSR10) */ 2233 rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof(sc->sta)); 2234 2235 ok = (le32toh(sc->sta[4]) >> 16) + /* TX ok w/o retry */ 2236 (le32toh(sc->sta[5]) & 0xffff); /* TX ok w/ retry */ 2237 fail = (le32toh(sc->sta[5]) >> 16); /* TX retry-fail count */ 2238 sum = ok+fail; 2239 retrycnt = (le32toh(sc->sta[5]) & 0xffff) + fail; 2240 |
2241 ni = ieee80211_ref_node(vap->iv_bss); |
|
2240 ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); 2241 (void) ieee80211_ratectl_rate(ni, NULL, 0); | 2242 ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); 2243 (void) ieee80211_ratectl_rate(ni, NULL, 0); |
2244 ieee80211_free_node(ni); |
|
2242 2243 ifp->if_oerrors += fail; /* count TX retry-fail as Tx errors */ 2244 2245 usb_callout_reset(&rvp->ratectl_ch, hz, rum_ratectl_timeout, rvp); 2246 RUM_UNLOCK(sc); 2247} 2248 2249static void --- 113 unchanged lines hidden --- | 2245 2246 ifp->if_oerrors += fail; /* count TX retry-fail as Tx errors */ 2247 2248 usb_callout_reset(&rvp->ratectl_ch, hz, rum_ratectl_timeout, rvp); 2249 RUM_UNLOCK(sc); 2250} 2251 2252static void --- 113 unchanged lines hidden --- |