summaryrefslogtreecommitdiff
path: root/sys/dev/ic/malo.c
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2006-11-25 10:52:46 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2006-11-25 10:52:46 +0000
commit49db54af0a43dc272733263c706790f8bddc76f5 (patch)
treed5c8bb0b39213f3c59086663d16d288c25e625a3 /sys/dev/ic/malo.c
parent87889df060d66f8a71793fe73a50aa1675b4f596 (diff)
If no TX rate has been calculated yet, set rate value to autoselect
instead DS1. Add 'mode' informations to malo_media_status(). Some KNF.
Diffstat (limited to 'sys/dev/ic/malo.c')
-rw-r--r--sys/dev/ic/malo.c71
1 files changed, 41 insertions, 30 deletions
diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c
index f6df02381c4..a41731d89b1 100644
--- a/sys/dev/ic/malo.c
+++ b/sys/dev/ic/malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malo.c,v 1.36 2006/11/24 23:29:39 mglocker Exp $ */
+/* $OpenBSD: malo.c,v 1.37 2006/11/25 10:52:45 mglocker Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -361,6 +361,7 @@ malo_attach(struct malo_softc *sc)
/* set supported rates */
ic->ic_sup_rates[IEEE80211_MODE_11B] = malo_rates_11b;
ic->ic_sup_rates[IEEE80211_MODE_11G] = malo_rates_11g;
+ sc->sc_last_txrate = -1;
/* set channels */
for (i = 1; i <= 14; i++) {
@@ -1049,7 +1050,7 @@ malo_stop(struct malo_softc *sc)
malo_reset_rx_ring(sc, &sc->sc_rxring);
/* set initial rate */
- sc->sc_last_txrate = 0;
+ sc->sc_last_txrate = -1;
/* power off cardbus socket */
if (sc->sc_disable)
@@ -1194,6 +1195,15 @@ malo_media_status(struct ifnet *ifp, struct ifmediareq *imr)
case IEEE80211_M_HOSTAP:
break;
}
+
+ switch (ic->ic_curmode) {
+ case IEEE80211_MODE_11B:
+ imr->ifm_active |= IFM_IEEE80211_11B;
+ break;
+ case IEEE80211_MODE_11G:
+ imr->ifm_active |= IFM_IEEE80211_11G;
+ break;
+ }
}
int
@@ -1201,23 +1211,24 @@ malo_chip2rate(int chip_rate)
{
switch (chip_rate) {
/* CCK rates */
- case 0: return 2;
- case 1: return 4;
- case 2: return 11;
- case 3: return 22;
+ case 0: return (2);
+ case 1: return (4);
+ case 2: return (11);
+ case 3: return (22);
/* OFDM rates */
- case 5: return 12;
- case 6: return 18;
- case 7: return 24;
- case 8: return 36;
- case 9: return 48;
- case 10: return 72;
- case 11: return 96;
- case 12: return 108;
-
- /* unknown rate: should not happen */
- default: return 0;
+ case 4: return (0); /* reserved */
+ case 5: return (12);
+ case 6: return (18);
+ case 7: return (24);
+ case 8: return (36);
+ case 9: return (48);
+ case 10: return (72);
+ case 11: return (96);
+ case 12: return (108);
+
+ /* no rate select yet or unknown rate */
+ default: return (-1);
}
}
@@ -1226,23 +1237,23 @@ malo_fix2rate(int fix_rate)
{
switch (fix_rate) {
/* CCK rates */
- case 0: return 2;
- case 1: return 4;
- case 2: return 11;
- case 3: return 22;
+ case 0: return (2);
+ case 1: return (4);
+ case 2: return (11);
+ case 3: return (22);
/* OFDM rates */
- case 4: return 12;
- case 5: return 18;
- case 6: return 24;
- case 7: return 36;
- case 8: return 48;
- case 9: return 72;
- case 10: return 96;
- case 11: return 108;
+ case 4: return (12);
+ case 5: return (18);
+ case 6: return (24);
+ case 7: return (36);
+ case 8: return (48);
+ case 9: return (72);
+ case 10: return (96);
+ case 11: return (108);
/* unknown rate: should not happen */
- default: return 0;
+ default: return (0);
}
}