diff options
author | sam <sam@FreeBSD.org> | 2003-09-14 22:39:19 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2003-09-14 22:39:19 +0000 |
commit | 5b99feb20561244587f5f8e73a977ae420b42fdf (patch) | |
tree | 12c2d88d2440a699baaeeacc3d9fd87650018070 | |
parent | 73b49f3a66b4a164b5521cb91a2e07e715f6a2ad (diff) | |
download | FreeBSD-src-5b99feb20561244587f5f8e73a977ae420b42fdf.zip FreeBSD-src-5b99feb20561244587f5f8e73a977ae420b42fdf.tar.gz |
o mark the device capable of short preamble (meaningless for the 5210 but
safe since the 802.11 layer does the right thing for 11a operation)
o select short preamble operation based on the negotiated capabilities; not
just the local state/capability
o fillin the duration field in the 802.11 header as appropriate
o remove detection of 11g support; no longer needed
Obtained from: MADWIFI (with modifications)
-rw-r--r-- | sys/dev/ath/if_ath.c | 33 | ||||
-rw-r--r-- | sys/dev/ath/if_athvar.h | 1 |
2 files changed, 18 insertions, 16 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 0d854b9..11876f7 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -279,10 +279,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) ic->ic_phytype = IEEE80211_T_OFDM; ic->ic_opmode = IEEE80211_M_STA; ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP - | IEEE80211_C_MONITOR; - /* NB: 11g support is identified when we fetch the channel set */ - if (sc->sc_have11g) - ic->ic_caps |= IEEE80211_C_SHPREAMBLE; + | IEEE80211_C_MONITOR | IEEE80211_C_SHPREAMBLE; /* get mac address from hardware */ ath_hal_getmac(ah, ic->ic_myaddr); @@ -765,13 +762,6 @@ ath_start(struct ifnet *ifp) } } - /* - * TODO: - * The duration field of 802.11 header should be filled. - * XXX This may be done in the ieee80211 layer, but the upper - * doesn't know the detail of parameters such as IFS - * for now.. - */ if (ath_tx_start(sc, ni, bf, m)) { bad: mtx_lock(&sc->sc_txbuflock); @@ -1797,7 +1787,8 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf * use short preamble based on the current mode and * negotiated parameters. */ - if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) { + if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && + (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE)) { txrate = rt->info[rix].rateCode | rt->info[rix].shortPreamble; shortPreamble = AH_TRUE; sc->sc_stats.ast_tx_shortpre++; @@ -1819,6 +1810,21 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf } /* + * Calculate duration. This logically belongs in the 802.11 + * layer but it lacks sufficient information to calculate it. + */ + if ((flags & HAL_TXDESC_NOACK) == 0 && + (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) { + u_int16_t dur; + /* + * XXX not right with fragmentation. + */ + dur = ath_hal_computetxtime(ah, rt, IEEE80211_ACK_SIZE, + rix, shortPreamble); + *((u_int16_t*) wh->i_dur) = htole16(dur); + } + + /* * Calculate RTS/CTS rate and duration if needed. */ ctsduration = 0; @@ -2395,7 +2401,6 @@ ath_getchannels(struct ath_softc *sc, u_int cc, HAL_BOOL outdoor) HAL_CHANNEL *chans; int i, ix, nchan; - sc->sc_have11g = 0; chans = malloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL), M_TEMP, M_NOWAIT); if (chans == NULL) { @@ -2429,8 +2434,6 @@ ath_getchannels(struct ath_softc *sc, u_int cc, HAL_BOOL outdoor) /* channels overlap; e.g. 11g and 11b */ ic->ic_channels[ix].ic_flags |= c->channelFlags; } - if ((c->channelFlags & CHANNEL_G) == CHANNEL_G) - sc->sc_have11g = 1; } free(chans, M_TEMP); return 0; diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 857ecd5..73a7887 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -90,7 +90,6 @@ struct ath_softc { struct mtx sc_mtx; /* master lock (recursive) */ struct ath_hal *sc_ah; /* Atheros HAL */ unsigned int sc_invalid : 1,/* disable hardware accesses */ - sc_have11g : 1,/* have 11g support */ sc_doani : 1,/* dynamic noise immunity */ sc_probing : 1;/* probing AP on beacon miss */ /* rate tables */ |