Date: Wed, 10 Nov 2004 01:18:38 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 64769 for review Message-ID: <200411100118.iAA1IcFF072928@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=64769 Change 64769 by sam@sam_ebb on 2004/11/10 01:17:43 switch ibss beacon generation from using swba to a self-linked descriptor marked with veol Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#15 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#6 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#15 (text+ko) ==== @@ -499,6 +499,12 @@ } sc->sc_defant = ath_hal_getdefantenna(ah); + /* + * Not all chips have the VEOL support we want to + * use with IBSS beacons; check here for it. + */ + sc->sc_hasveol = ath_hal_veolsupported(ah); + /* get mac address from hardware */ ath_hal_getmac(ah, ic->ic_myaddr); @@ -1577,7 +1583,7 @@ struct ath_node *an = ATH_NODE(ni); struct ath_desc *ds; u_int8_t rate; - int error; + int error, flags; DPRINTF(sc, ATH_DEBUG_BEACON, "%s: m %p len %u\n", __func__, m, m->m_len); @@ -1596,7 +1602,12 @@ /* setup descriptors */ ds = bf->bf_desc; - ds->ds_link = 0; + flags = HAL_TXDESC_NOACK; + if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol) { + ds->ds_link = bf->bf_daddr; /* self-linked */ + flags = HAL_TXDESC_VEOL; + } else + ds->ds_link = 0; ds->ds_data = bf->bf_segs[0].ds_addr; /* * Calculate rate code. @@ -1614,7 +1625,7 @@ , rate, 1 /* series 0 rate/tries */ , HAL_TXKEYIX_INVALID /* no encryption */ , 0 /* antenna mode */ - , HAL_TXDESC_NOACK /* no ack for beacons */ + , flags /* no ack, veol for beacons */ , 0 /* rts/cts rate */ , 0 /* rts/cts duration */ ); @@ -1820,7 +1831,8 @@ nexttbtt = (LE_READ_4(ni->ni_tstamp.data + 4) << 22) | (LE_READ_4(ni->ni_tstamp.data) >> 10); - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt=%u\n", __func__, nexttbtt); + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u\n", + __func__, nexttbtt, ni->ni_intval); nexttbtt += ni->ni_intval; intval = ni->ni_intval & HAL_BEACON_PERIOD; if (ic->ic_opmode == IEEE80211_M_STA) { @@ -1893,17 +1905,36 @@ sc->sc_imask |= HAL_INT_BMISS; ath_hal_intrset(ah, sc->sc_imask); } else { - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: intval %u nexttbtt %u\n", - __func__, ni->ni_intval, nexttbtt); ath_hal_intrset(ah, 0); if (nexttbtt == ni->ni_intval) intval |= HAL_BEACON_RESET_TSF; - if (ic->ic_opmode != IEEE80211_M_MONITOR) { + if (ic->ic_opmode == IEEE80211_M_IBSS) { + /* + * In IBSS mode enable the beacon timers but only + * enable SWBA interrupts if we need to manually + * prepare beacon frames. Otherwise we use a + * self-linked tx descriptor and let the hardware + * deal with things. + */ + intval |= HAL_BEACON_ENA; + if (!sc->sc_hasveol) + sc->sc_imask |= HAL_INT_SWBA; + } else if (ic->ic_opmode == IEEE80211_M_HOSTAP) { + /* + * In AP mode we enable the beacon timers and + * SWBA interrupts to prepare beacon frames. + */ intval |= HAL_BEACON_ENA; sc->sc_imask |= HAL_INT_SWBA; /* beacon prepare */ } ath_hal_beaconinit(ah, nexttbtt, intval); ath_hal_intrset(ah, sc->sc_imask); + /* + * When using a self-linked beacon descriptor in + * ibss mode load it once here. + */ + if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol) + ath_beacon_proc(sc, 0); } } @@ -2143,9 +2174,8 @@ sc->sc_stats.ast_rx_busdma++; return error; } - KASSERT(bf->bf_nseg == 1, - ("ath_rxbuf_init: multi-segment packet; nseg %u", - bf->bf_nseg)); + KASSERT(bf->bf_nseg == 1, ("%s: multi-segment packet; nseg %u", + __func__, bf->bf_nseg)); } bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, BUS_DMASYNC_PREREAD); ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#6 (text+ko) ==== @@ -155,7 +155,8 @@ sc_splitmic: 1, /* split TKIP MIC keys */ sc_needmib : 1, /* enable MIB stats intr */ sc_hasdiversity : 1,/* rx diversity available */ - sc_diversity : 1;/* enable rx diversity */ + sc_diversity : 1,/* enable rx diversity */ + sc_hasveol : 1; /* tx VEOL support */ /* rate tables */ const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX]; const HAL_RATE_TABLE *sc_currates; /* current rate table */ @@ -399,6 +400,8 @@ ath_hal_setcapability(_ah, HAL_CAP_DIAG, 0, _v, NULL) #define ath_hal_getnumtxqueues(_ah, _pv) \ (ath_hal_getcapability(_ah, HAL_CAP_NUM_TXQUEUES, 0, _pv) == HAL_OK) +#define ath_hal_veolsupported(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK) #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411100118.iAA1IcFF072928>
