summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2005-08-25 20:28:20 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2005-08-25 20:28:20 +0000
commit9c5397fa9dd2d38dbe7eef76b20a605049139a7e (patch)
tree89a2aa29ecd6fafe87a5a31da4756c4acc86ace3 /sys
parent0645521daabb2396fb6823ac7ff4b84a70e5aba9 (diff)
Extend basic rate set in 802.11g so that ACKs can be sent at 5.5 or 11Mbps.
Fix WME settings (Best Effort).
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_ral.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c
index f707248f205..1f40972d6e1 100644
--- a/sys/dev/usb/if_ral.c
+++ b/sys/dev/usb/if_ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral.c,v 1.41 2005/08/23 02:25:52 jsg Exp $ */
+/* $OpenBSD: if_ral.c,v 1.42 2005/08/25 20:28:19 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -119,7 +119,7 @@ Static void ural_txeof(usbd_xfer_handle, usbd_private_handle,
usbd_status);
Static void ural_rxeof(usbd_xfer_handle, usbd_private_handle,
usbd_status);
-Static int ural_ack_rate(int);
+Static int ural_ack_rate(struct ieee80211com *, int);
Static uint16_t ural_txtime(int, int, uint32_t);
Static uint8_t ural_plcp_signal(int);
Static void ural_setup_tx_desc(struct ural_softc *,
@@ -736,6 +736,18 @@ ural_task(void *arg)
case IEEE80211_S_RUN:
ural_set_chan(sc, ic->ic_bss->ni_chan);
+ /* update basic rate set */
+ if (ic->ic_curmode == IEEE80211_MODE_11B) {
+ /* 11b basic rates: 1, 2Mbps */
+ ural_write(sc, RAL_TXRX_CSR11, 0x3);
+ } else if (IEEE80211_IS_CHAN_5GHZ(ic->ic_bss->ni_chan)) {
+ /* 11a basic rates: 6, 12, 24Mbps */
+ ural_write(sc, RAL_TXRX_CSR11, 0x150);
+ } else {
+ /* 11g basic rates: 1, 2, 5.5, 11, 6, 12, 24Mbps */
+ ural_write(sc, RAL_TXRX_CSR11, 0x15f);
+ }
+
if (ic->ic_opmode != IEEE80211_M_MONITOR)
ural_set_bssid(sc, ic->ic_bss->ni_bssid);
@@ -947,7 +959,7 @@ skip: /* setup a new transfer */
* XXX: this should depend on the destination node basic rate set.
*/
Static int
-ural_ack_rate(int rate)
+ural_ack_rate(struct ieee80211com *ic, int rate)
{
switch (rate) {
/* CCK rates */
@@ -956,7 +968,7 @@ ural_ack_rate(int rate)
case 4:
case 11:
case 22:
- return 4;
+ return (ic->ic_curmode == IEEE80211_MODE_11B) ? 4 : rate;
/* OFDM rates */
case 12:
@@ -1057,7 +1069,7 @@ ural_setup_tx_desc(struct ural_softc *sc, struct ural_tx_desc *desc,
if (RAL_RATE_IS_OFDM(rate))
desc->flags |= htole32(RAL_TX_OFDM);
- desc->wme = htole16(RAL_LOGCWMAX(5) | RAL_LOGCWMIN(3) | RAL_AIFSN(2));
+ desc->wme = htole16(RAL_AIFSN(3) | RAL_LOGCWMIN(4) | RAL_LOGCWMAX(6));
/*
* Fill PLCP fields.
@@ -1294,7 +1306,7 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
flags |= RAL_TX_ACK;
flags |= RAL_TX_RETRY(7);
- dur = ural_txtime(RAL_ACK_SIZE, ural_ack_rate(rate),
+ dur = ural_txtime(RAL_ACK_SIZE, ural_ack_rate(ic, rate),
ic->ic_flags) + RAL_SIFS;
*(uint16_t *)wh->i_dur = htole16(dur);
}
@@ -2008,7 +2020,7 @@ ural_init(struct ifnet *ifp)
/* we're ready! */
ural_write(sc, RAL_MAC_CSR1, RAL_HOST_READY);
- /* set supported basic rates (1, 2, 6, 12, 24) */
+ /* set basic rate set (will be updated later) */
ural_write(sc, RAL_TXRX_CSR11, 0x153);
error = ural_bbp_init(sc);