diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-07-15 12:22:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-07-15 12:22:03 +0000 |
commit | f5de6bdd147beb25252c3e7ddc6779ba777bda40 (patch) | |
tree | b78fb7f510a600a936ff48ada0035a1d653db4be | |
parent | 845fb4ed8ef18fbe44ef99b3c88db398fb7816c2 (diff) |
Re-synchronize TSFT after an IBSS merge.
Set up the Tx descriptor ring more safely. Fix an endianness bug.
"It's a wonder this ever worked." (Actually, it's not.)
hange the order in which I write the BSSID registers on the ADM8211,
to match the reference driver. This probably does not make any
functional difference.
Only write the SSID buffer to the ADM8211 SRAM up to the end of
the SSID, not up to the end of the buffer. Given the (too
conservative?) delays involved, this should save some time when we
join a new network.
From NetBSD (dyoung)
-rw-r--r-- | sys/dev/ic/atw.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 9a867a1db95..ae9c431c048 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,5 +1,5 @@ -/* $OpenBSD: atw.c,v 1.10 2004/07/15 12:18:57 millert Exp $ */ -/* $NetBSD: atw.c,v 1.49 2004/07/15 06:38:46 dyoung Exp $ */ +/* $OpenBSD: atw.c,v 1.11 2004/07/15 12:22:02 millert Exp $ */ +/* $NetBSD: atw.c,v 1.53 2004/07/15 06:53:11 dyoung Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ #include <sys/cdefs.h> #if defined(__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.49 2004/07/15 06:38:46 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.53 2004/07/15 06:53:11 dyoung Exp $"); #endif #include "bpfilter.h" @@ -1103,13 +1103,14 @@ atw_init(struct ifnet *ifp) */ memset(sc->sc_txdescs, 0, sizeof(sc->sc_txdescs)); for (i = 0; i < ATW_NTXDESC; i++) { + sc->sc_txdescs[i].at_ctl = 0; /* no transmit chaining */ - sc->sc_txdescs[i].at_ctl = 0 /* ATW_TXFLAG_TCH */; + sc->sc_txdescs[i].at_flags = 0 /* ATW_TXFLAG_TCH */; sc->sc_txdescs[i].at_buf2 = htole32(ATW_CDTXADDR(sc, ATW_NEXTTX(i))); } /* use ring mode */ - sc->sc_txdescs[ATW_NTXDESC - 1].at_ctl |= ATW_TXFLAG_TER; + sc->sc_txdescs[ATW_NTXDESC - 1].at_flags |= htole32(ATW_TXFLAG_TER); ATW_CDTXSYNC(sc, 0, ATW_NTXDESC, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); sc->sc_txfree = ATW_NTXDESC; @@ -1906,18 +1907,18 @@ atw_write_bssid(struct atw_softc *sc) bssid = ic->ic_bss->ni_bssid; - ATW_WRITE(sc, ATW_ABDA1, - (ATW_READ(sc, ATW_ABDA1) & - ~(ATW_ABDA1_BSSIDB4_MASK|ATW_ABDA1_BSSIDB5_MASK)) | - LSHIFT(bssid[4], ATW_ABDA1_BSSIDB4_MASK) | - LSHIFT(bssid[5], ATW_ABDA1_BSSIDB5_MASK)); - ATW_WRITE(sc, ATW_BSSID0, LSHIFT(bssid[0], ATW_BSSID0_BSSIDB0_MASK) | LSHIFT(bssid[1], ATW_BSSID0_BSSIDB1_MASK) | LSHIFT(bssid[2], ATW_BSSID0_BSSIDB2_MASK) | LSHIFT(bssid[3], ATW_BSSID0_BSSIDB3_MASK)); + ATW_WRITE(sc, ATW_ABDA1, + (ATW_READ(sc, ATW_ABDA1) & + ~(ATW_ABDA1_BSSIDB4_MASK|ATW_ABDA1_BSSIDB5_MASK)) | + LSHIFT(bssid[4], ATW_ABDA1_BSSIDB4_MASK) | + LSHIFT(bssid[5], ATW_ABDA1_BSSIDB5_MASK)); + DPRINTF(sc, ("%s: BSSID %s -> ", sc->sc_dev.dv_xname, ether_sprintf(sc->sc_bssid))); DPRINTF(sc, ("%s\n", ether_sprintf(bssid))); @@ -2132,9 +2133,7 @@ atw_recv_beacon(struct ieee80211com *ic, struct mbuf *m0, ic->ic_flags &= ~IEEE80211_F_SIBSS; -#if 0 atw_tsf(sc); -#endif /* negotiate rates with new IBSS */ ieee80211_fix_rate(ic, ni, IEEE80211_F_DOFRATE | @@ -2168,14 +2167,17 @@ void atw_write_ssid(struct atw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - /* 34 bytes are reserved in ADM8211 SRAM for the SSID */ + /* 34 bytes are reserved in ADM8211 SRAM for the SSID, but + * it only expects the element length, not its ID. + */ u_int8_t buf[roundup(1 /* length */ + IEEE80211_NWID_LEN, 2)]; memset(buf, 0, sizeof(buf)); buf[0] = ic->ic_bss->ni_esslen; memcpy(&buf[1], ic->ic_bss->ni_essid, ic->ic_bss->ni_esslen); - atw_write_sram(sc, ATW_SRAM_ADDR_SSID, buf, sizeof(buf)); + atw_write_sram(sc, ATW_SRAM_ADDR_SSID, buf, + roundup(1 + ic->ic_bss->ni_esslen, 2)); } /* Write the supported rates in the ieee80211com to the SRAM of the ADM8211. |