summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2006-11-13 20:06:39 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2006-11-13 20:06:39 +0000
commitf815983418862c69f38d2ade274a4785797e276c (patch)
treee83e63c3ae3875de702975496c3bd10651422e08 /sys/dev/pci
parent5dfdad8c9a03b5917a916a713c679847e5ca3fbb (diff)
first round of commits for proper 11b/g protection support:
- use the newly introduced ieee80211_get_rts() and ieee80211_get_cts_to_self() functions. - use CTS-to-self instead of RTS/CTS to protect OFDM frames in a mixed 11b/g BSS. - make sure multicast frames are sent using CCK modulation. remove support for 5GHz radios in ral(4) RT2560 and ural(4). i'm not aware of any such adapters on the market and 11a code is known to be broken. some cleanup while i'm here.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_wpi.c41
-rw-r--r--sys/dev/pci/if_wpireg.h3
2 files changed, 28 insertions, 16 deletions
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index 8fb7b06bc17..8d5d6497f8a 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpi.c,v 1.35 2006/11/01 11:25:01 damien Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.36 2006/11/13 20:06:38 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -1457,17 +1457,16 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m0, struct ieee80211_node *ni,
}
/* pickup a rate */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT) {
- /* mgmt frames are sent at the lowest available bit-rate */
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1) ||
+ ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
+ IEEE80211_FC0_TYPE_MGT)) {
+ /* mgmt/multicast frames are sent at the lowest avail. rate */
rate = ni->ni_rates.rs_rates[0];
- } else {
- if (ic->ic_fixed_rate != -1) {
- rate = ic->ic_sup_rates[ic->ic_curmode].
- rs_rates[ic->ic_fixed_rate];
- } else
- rate = ni->ni_rates.rs_rates[ni->ni_txrate];
- }
+ } else if (ic->ic_fixed_rate != -1) {
+ rate = ic->ic_sup_rates[ic->ic_curmode].
+ rs_rates[ic->ic_fixed_rate];
+ } else
+ rate = ni->ni_rates.rs_rates[ni->ni_txrate];
rate &= IEEE80211_RATE_VAL;
#if NBPFILTER > 0
@@ -1504,15 +1503,27 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m0, struct ieee80211_node *ni,
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
tx->id = WPI_ID_BSS;
tx->flags |= htole32(WPI_TX_NEED_ACK);
+ } else
+ tx->id = WPI_ID_BROADCAST;
+ /* check if RTS/CTS or CTS-to-self protection must be used */
+ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ /* multicast frames are not sent at OFDM rates in 802.11b/g */
if (m0->m_pkthdr.len + IEEE80211_CRC_LEN >
- ic->ic_rtsthreshold || (WPI_RATE_IS_OFDM(rate) &&
- (ic->ic_flags & IEEE80211_F_USEPROT))) {
+ ic->ic_rtsthreshold) {
tx->flags |= htole32(WPI_TX_NEED_RTS |
WPI_TX_FULL_TXOP);
+ } else if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
+ WPI_RATE_IS_OFDM(rate)) {
+ if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) {
+ tx->flags |= htole32(WPI_TX_NEED_CTS |
+ WPI_TX_FULL_TXOP);
+ } else if (ic->ic_protmode == IEEE80211_PROT_RTSCTS) {
+ tx->flags |= htole32(WPI_TX_NEED_RTS |
+ WPI_TX_FULL_TXOP);
+ }
}
- } else
- tx->id = WPI_ID_BROADCAST;
+ }
tx->flags |= htole32(WPI_TX_AUTO_SEQ);
diff --git a/sys/dev/pci/if_wpireg.h b/sys/dev/pci/if_wpireg.h
index 72c911990c5..8c285e47623 100644
--- a/sys/dev/pci/if_wpireg.h
+++ b/sys/dev/pci/if_wpireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpireg.h,v 1.11 2006/08/28 19:47:43 damien Exp $ */
+/* $OpenBSD: if_wpireg.h,v 1.12 2006/11/13 20:06:38 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -355,6 +355,7 @@ struct wpi_cmd_data {
uint16_t lnext;
uint32_t flags;
#define WPI_TX_NEED_RTS (1 << 1)
+#define WPI_TX_NEED_CTS (1 << 2)
#define WPI_TX_NEED_ACK (1 << 3)
#define WPI_TX_FULL_TXOP (1 << 7)
#define WPI_TX_AUTO_SEQ (1 << 13)