summaryrefslogtreecommitdiff
path: root/sys/dev/ic/ral.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-08-27 06:43:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-08-27 06:43:14 +0000
commit0a85834931a8455fb8201d6b31ea4a7c703248e0 (patch)
tree57489041f52c4b111fff63f743c1112fda7b6fec /sys/dev/ic/ral.c
parenta0dbc34adc90aeacb26e57becc86026bc599f60e (diff)
backout unapproved diff
Diffstat (limited to 'sys/dev/ic/ral.c')
-rw-r--r--sys/dev/ic/ral.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/sys/dev/ic/ral.c b/sys/dev/ic/ral.c
index b859e3ed469..99665fdf303 100644
--- a/sys/dev/ic/ral.c
+++ b/sys/dev/ic/ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ral.c,v 1.57 2005/08/25 20:28:11 damien Exp $ */
+/* $OpenBSD: ral.c,v 1.58 2005/08/27 06:42:03 deraadt Exp $ */
/*-
* Copyright (c) 2005
@@ -99,7 +99,7 @@ void ral_decryption_intr(struct ral_softc *);
void ral_rx_intr(struct ral_softc *);
void ral_beacon_expire(struct ral_softc *);
void ral_wakeup_expire(struct ral_softc *);
-int ral_ack_rate(struct ieee80211com *, int);
+int ral_ack_rate(int);
uint16_t ral_txtime(int, int, uint32_t);
uint8_t ral_plcp_signal(int);
void ral_setup_tx_desc(struct ral_softc *, struct ral_tx_desc *,
@@ -910,18 +910,6 @@ ral_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
case IEEE80211_S_RUN:
ral_set_chan(sc, ic->ic_bss->ni_chan);
- /* update basic rate set */
- if (ic->ic_curmode == IEEE80211_MODE_11B) {
- /* 11b basic rates: 1, 2Mbps */
- RAL_WRITE(sc, RAL_ARSP_PLCP_1, 0x3);
- } else if (IEEE80211_IS_CHAN_5GHZ(ic->ic_bss->ni_chan)) {
- /* 11a basic rates: 6, 12, 24Mbps */
- RAL_WRITE(sc, RAL_ARSP_PLCP_1, 0x150);
- } else {
- /* 11g basic rates: 1, 2, 5.5, 11, 6, 12, 24Mbps */
- RAL_WRITE(sc, RAL_ARSP_PLCP_1, 0x15f);
- }
-
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
ral_set_bssid(sc, ic->ic_bss->ni_bssid);
ral_update_slot(sc);
@@ -1473,16 +1461,14 @@ ral_intr(void *arg)
#define RAL_ACK_SIZE 14 /* 10 + 4(FCS) */
#define RAL_CTS_SIZE 14 /* 10 + 4(FCS) */
-
-#define RAL_SIFS 10 /* us */
-#define RAL_RXTX_TURNAROUND 10 /* us */
+#define RAL_SIFS 10
/*
* Return the expected ack rate for a frame transmitted at rate `rate'.
* XXX: this should depend on the destination node basic rate set.
*/
int
-ral_ack_rate(struct ieee80211com *ic, int rate)
+ral_ack_rate(int rate)
{
switch (rate) {
/* CCK rates */
@@ -1491,7 +1477,7 @@ ral_ack_rate(struct ieee80211com *ic, int rate)
case 4:
case 11:
case 22:
- return (ic->ic_curmode == IEEE80211_MODE_11B) ? 4 : rate;
+ return 4;
/* OFDM rates */
case 12:
@@ -1593,7 +1579,7 @@ ral_setup_tx_desc(struct ral_softc *sc, struct ral_tx_desc *desc,
desc->flags |= htole32(RAL_TX_OFDM);
desc->physaddr = htole32(physaddr);
- desc->wme = htole16(RAL_AIFSN(3) | RAL_LOGCWMIN(4) | RAL_LOGCWMAX(6));
+ desc->wme = htole16(RAL_LOGCWMAX(8) | RAL_LOGCWMIN(3) | RAL_AIFSN(2));
/*
* Fill PLCP fields.
@@ -1834,7 +1820,7 @@ ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
int rtsrate, ackrate;
rtsrate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 4;
- ackrate = ral_ack_rate(ic, rate);
+ ackrate = ral_ack_rate(rate);
dur = ral_txtime(m0->m_pkthdr.len + 4, rate, ic->ic_flags) +
ral_txtime(RAL_CTS_SIZE, rtsrate, ic->ic_flags) +
@@ -1967,7 +1953,7 @@ ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
flags |= RAL_TX_ACK;
- dur = ral_txtime(RAL_ACK_SIZE, ral_ack_rate(ic, rate),
+ dur = ral_txtime(RAL_ACK_SIZE, ral_ack_rate(rate),
ic->ic_flags) + RAL_SIFS;
*(uint16_t *)wh->i_dur = htole16(dur);
}
@@ -2410,10 +2396,11 @@ ral_update_slot(struct ral_softc *sc)
slottime = (ic->ic_curmode == IEEE80211_MODE_11A) ? 9 : 20;
/* define the MAC slot boundaries */
- sifs = RAL_SIFS - RAL_RXTX_TURNAROUND;
+ sifs = RAL_SIFS;
pifs = sifs + slottime;
difs = sifs + 2 * slottime;
- eifs = (ic->ic_curmode == IEEE80211_MODE_11B) ? 364 : 60;
+ eifs = sifs + ral_txtime(RAL_ACK_SIZE,
+ (ic->ic_curmode == IEEE80211_MODE_11A) ? 12 : 2, 0) + difs;
tmp = RAL_READ(sc, RAL_CSR11);
tmp = (tmp & ~0x1f00) | slottime << 8;
@@ -2666,7 +2653,7 @@ ral_init(struct ifnet *ifp)
IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl));
ral_set_macaddr(sc, ic->ic_myaddr);
- /* set basic rate set (will be updated later) */
+ /* set supported basic rates (1, 2, 6, 12, 24) */
RAL_WRITE(sc, RAL_ARSP_PLCP_1, 0x153);
ral_set_txantenna(sc, 1);