summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/ar5211.c28
-rw-r--r--sys/dev/ic/ar5212.c28
-rw-r--r--sys/dev/ic/ar5xxx.c5
-rw-r--r--sys/dev/ic/ath.c71
-rw-r--r--sys/dev/ic/athvar.h39
5 files changed, 79 insertions, 92 deletions
diff --git a/sys/dev/ic/ar5211.c b/sys/dev/ic/ar5211.c
index 0adaf5b861b..ff125d7717e 100644
--- a/sys/dev/ic/ar5211.c
+++ b/sys/dev/ic/ar5211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5211.c,v 1.1 2005/02/25 22:25:30 reyk Exp $ */
+/* $OpenBSD: ar5211.c,v 1.2 2005/03/03 16:39:54 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -832,11 +832,11 @@ ar5k_ar5211_resetTxQueue(hal, queue)
*/
if (IEEE80211_IS_CHAN_B(channel)) {
hal->ah_cw_min = AR5K_TUNE_CWMIN_11B;
- hal->ah_cw_max = AR5K_TUNE_CWMAX_11B;
+ cw_max = hal->ah_cw_max = AR5K_TUNE_CWMAX_11B;
hal->ah_aifs = AR5K_TUNE_AIFS_11B;
} else {
hal->ah_cw_min = AR5K_TUNE_CWMIN;
- hal->ah_cw_max = AR5K_TUNE_CWMAX;
+ cw_max = hal->ah_cw_max = AR5K_TUNE_CWMAX;
hal->ah_aifs = AR5K_TUNE_AIFS;
}
@@ -856,11 +856,11 @@ ar5k_ar5211_resetTxQueue(hal, queue)
AR5K_REG_WRITE(AR5K_AR5211_DCU_RETRY_LMT(queue),
AR5K_REG_SM(AR5K_INIT_SLG_RETRY,
- AR5K_AR5211_DCU_RETRY_LMT_SLG_RETRY)
- | AR5K_REG_SM(AR5K_INIT_SSH_RETRY,
- AR5K_AR5211_DCU_RETRY_LMT_SSH_RETRY)
- | AR5K_REG_SM(retry_lg, AR5K_AR5211_DCU_RETRY_LMT_LG_RETRY)
- | AR5K_REG_SM(retry_sh, AR5K_AR5211_DCU_RETRY_LMT_SH_RETRY));
+ AR5K_AR5211_DCU_RETRY_LMT_SLG_RETRY) |
+ AR5K_REG_SM(AR5K_INIT_SSH_RETRY,
+ AR5K_AR5211_DCU_RETRY_LMT_SSH_RETRY) |
+ AR5K_REG_SM(retry_lg, AR5K_AR5211_DCU_RETRY_LMT_LG_RETRY) |
+ AR5K_REG_SM(retry_sh, AR5K_AR5211_DCU_RETRY_LMT_SH_RETRY));
/*
* Set initial content window (cw_min/cw_max)
@@ -1521,27 +1521,23 @@ ar5k_ar5211_setLedState(hal, state)
switch (state) {
case IEEE80211_S_SCAN:
case IEEE80211_S_AUTH:
- led =
- AR5K_AR5211_PCICFG_LEDMODE_PROP |
+ led = AR5K_AR5211_PCICFG_LEDMODE_PROP |
AR5K_AR5211_PCICFG_LED_PEND;
break;
case IEEE80211_S_INIT:
- led =
- AR5K_AR5211_PCICFG_LEDMODE_PROP |
+ led = AR5K_AR5211_PCICFG_LEDMODE_PROP |
AR5K_AR5211_PCICFG_LED_NONE;
break;
case IEEE80211_S_ASSOC:
case IEEE80211_S_RUN:
- led |=
- AR5K_AR5211_PCICFG_LEDMODE_PROP |
+ led = AR5K_AR5211_PCICFG_LEDMODE_PROP |
AR5K_AR5211_PCICFG_LED_ASSOC;
break;
default:
- led |=
- AR5K_AR5211_PCICFG_LEDMODE_PROM |
+ led = AR5K_AR5211_PCICFG_LEDMODE_PROM |
AR5K_AR5211_PCICFG_LED_NONE;
break;
}
diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c
index e539b0de8e7..98572919edd 100644
--- a/sys/dev/ic/ar5212.c
+++ b/sys/dev/ic/ar5212.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5212.c,v 1.3 2005/02/25 22:25:30 reyk Exp $ */
+/* $OpenBSD: ar5212.c,v 1.4 2005/03/03 16:39:54 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -930,11 +930,11 @@ ar5k_ar5212_resetTxQueue(hal, queue)
*/
if (IEEE80211_IS_CHAN_XR(channel)) {
hal->ah_cw_min = AR5K_TUNE_CWMIN_XR;
- hal->ah_cw_max = AR5K_TUNE_CWMAX_XR;
+ cw_max = hal->ah_cw_max = AR5K_TUNE_CWMAX_XR;
hal->ah_aifs = AR5K_TUNE_AIFS_XR;
} else if (IEEE80211_IS_CHAN_B(channel)) {
hal->ah_cw_min = AR5K_TUNE_CWMIN_11B;
- hal->ah_cw_max = AR5K_TUNE_CWMAX_11B;
+ cw_max = hal->ah_cw_max = AR5K_TUNE_CWMAX_11B;
hal->ah_aifs = AR5K_TUNE_AIFS_11B;
} else {
hal->ah_cw_min = AR5K_TUNE_CWMIN;
@@ -958,11 +958,11 @@ ar5k_ar5212_resetTxQueue(hal, queue)
AR5K_REG_WRITE(AR5K_AR5212_DCU_RETRY_LMT(queue),
AR5K_REG_SM(AR5K_INIT_SLG_RETRY,
- AR5K_AR5212_DCU_RETRY_LMT_SLG_RETRY)
- | AR5K_REG_SM(AR5K_INIT_SSH_RETRY,
- AR5K_AR5212_DCU_RETRY_LMT_SSH_RETRY)
- | AR5K_REG_SM(retry_lg, AR5K_AR5212_DCU_RETRY_LMT_LG_RETRY)
- | AR5K_REG_SM(retry_sh, AR5K_AR5212_DCU_RETRY_LMT_SH_RETRY));
+ AR5K_AR5212_DCU_RETRY_LMT_SLG_RETRY) |
+ AR5K_REG_SM(AR5K_INIT_SSH_RETRY,
+ AR5K_AR5212_DCU_RETRY_LMT_SSH_RETRY) |
+ AR5K_REG_SM(retry_lg, AR5K_AR5212_DCU_RETRY_LMT_LG_RETRY) |
+ AR5K_REG_SM(retry_sh, AR5K_AR5212_DCU_RETRY_LMT_SH_RETRY));
/*
* Set initial content window (cw_min/cw_max)
@@ -1793,27 +1793,23 @@ ar5k_ar5212_setLedState(hal, state)
switch (state) {
case IEEE80211_S_SCAN:
case IEEE80211_S_AUTH:
- led =
- AR5K_AR5212_PCICFG_LEDMODE_PROP |
+ led = AR5K_AR5212_PCICFG_LEDMODE_PROP |
AR5K_AR5212_PCICFG_LED_PEND;
break;
case IEEE80211_S_INIT:
- led =
- AR5K_AR5212_PCICFG_LEDMODE_PROP |
+ led = AR5K_AR5212_PCICFG_LEDMODE_PROP |
AR5K_AR5212_PCICFG_LED_NONE;
break;
case IEEE80211_S_ASSOC:
case IEEE80211_S_RUN:
- led |=
- AR5K_AR5212_PCICFG_LEDMODE_PROP |
+ led = AR5K_AR5212_PCICFG_LEDMODE_PROP |
AR5K_AR5212_PCICFG_LED_ASSOC;
break;
default:
- led |=
- AR5K_AR5212_PCICFG_LEDMODE_PROM |
+ led = AR5K_AR5212_PCICFG_LEDMODE_PROM |
AR5K_AR5212_PCICFG_LED_NONE;
break;
}
diff --git a/sys/dev/ic/ar5xxx.c b/sys/dev/ic/ar5xxx.c
index 3d004e34fc6..aa50782c007 100644
--- a/sys/dev/ic/ar5xxx.c
+++ b/sys/dev/ic/ar5xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.c,v 1.15 2005/02/25 22:25:30 reyk Exp $ */
+/* $OpenBSD: ar5xxx.c,v 1.16 2005/03/03 16:39:54 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -1191,7 +1191,7 @@ ar5k_ar5111_channel(hal, channel)
/*
* Set the channel on the AR5111 radio
*/
- data0 = 0;
+ data0 = data1 = 0;
ath_channel = ieee_channel = ath_hal_mhz2ieee(channel->c_channel,
channel->c_channel_flags);
@@ -1230,6 +1230,7 @@ ar5k_ar5112_channel(hal, channel)
u_int32_t data, data0, data1, data2;
u_int16_t c;
+ data = data0 = data1 = data2 = 0;
c = channel->c_channel;
/*
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c
index 392adae4f10..e5ad4c89d88 100644
--- a/sys/dev/ic/ath.c
+++ b/sys/dev/ic/ath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ath.c,v 1.10 2005/03/03 14:36:38 damien Exp $ */
+/* $OpenBSD: ath.c,v 1.11 2005/03/03 16:39:54 reyk Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
@@ -386,24 +386,17 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
#if NBPFILTER > 0
bpfattach(&sc->sc_drvbpf, ifp, DLT_IEEE802_11_RADIO,
- sizeof(struct ieee80211_frame) + 64);
+ sizeof(struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN);
- /*
- * Initialize constant fields.
- * XXX make header lengths a multiple of 32-bits so subsequent
- * headers are properly aligned; this is a kludge to keep
- * certain applications happy.
- *
- * NB: the channel is setup each time we transition to the
- * RUN state to avoid filling it in for each frame.
- */
- sc->sc_tx_th_len = roundup(sizeof(sc->sc_tx_th), sizeof(u_int32_t));
- sc->sc_tx_th.wt_ihdr.it_len = htole16(sc->sc_tx_th_len);
- sc->sc_tx_th.wt_ihdr.it_present = htole32(ATH_TX_RADIOTAP_PRESENT);
+ sc->sc_rxtap_len = sizeof(sc->sc_rxtapu);
+ bzero(&sc->sc_rxtapu, sc->sc_rxtap_len);
+ sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
+ sc->sc_rxtap.wr_ihdr.it_present = htole32(ATH_RX_RADIOTAP_PRESENT);
- sc->sc_rx_th_len = roundup(sizeof(sc->sc_rx_th), sizeof(u_int32_t));
- sc->sc_rx_th.wr_ihdr.it_len = htole16(sc->sc_rx_th_len);
- sc->sc_rx_th.wr_ihdr.it_present = htole32(ATH_RX_RADIOTAP_PRESENT);
+ sc->sc_txtap_len = sizeof(sc->sc_txtapu);
+ bzero(&sc->sc_txtapu, sc->sc_txtap_len);
+ sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len);
+ sc->sc_txtap.wt_ihdr.it_present = htole32(ATH_TX_RADIOTAP_PRESENT);
#endif
sc->sc_flags |= ATH_ATTACHED;
@@ -654,7 +647,6 @@ ath_bmiss_proc(void *arg, int pending)
* machine will drop us into scanning after timing
* out waiting for a probe response.
*/
- /* XXX sometimes after association */
ieee80211_new_state(ic, IEEE80211_S_ASSOC, -1);
}
}
@@ -1342,7 +1334,7 @@ ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_node *ni)
, m->m_pkthdr.len + IEEE80211_CRC_LEN /* packet length */
, sizeof(struct ieee80211_frame) /* header length */
, HAL_PKT_TYPE_BEACON /* Atheros packet type */
- , 0x20 /* txpower XXX */
+ , 60 /* txpower XXX */
, rate, 1 /* series 0 rate/tries */
, HAL_TXKEYIX_INVALID /* no encryption */
, 0 /* antenna mode */
@@ -1973,16 +1965,18 @@ ath_rx_proc(void *arg, int npending)
if (sc->sc_drvbpf) {
struct mbuf mb;
- sc->sc_rx_th.wr_rate =
- sc->sc_hwmap[ds->ds_rxstat.rs_rate];
- sc->sc_rx_th.wr_antsignal = ds->ds_rxstat.rs_rssi;
- sc->sc_rx_th.wr_antenna = ds->ds_rxstat.rs_antenna;
- /* XXX TSF */
+ sc->sc_rxtap.wr_rate =
+ sc->sc_hwmap[ds->ds_rxstat.rs_rate] &
+ IEEE80211_RATE_VAL;
+ sc->sc_rxtap.wr_antsignal = ds->ds_rxstat.rs_rssi;
+ sc->sc_rxtap.wr_antenna = ds->ds_rxstat.rs_antenna;
+
M_DUP_PKTHDR(&mb, m);
- mb.m_data = (caddr_t)&sc->sc_rx_th;
- mb.m_len = sc->sc_rx_th_len;
+ mb.m_data = (caddr_t)&sc->sc_rxtap;
+ mb.m_len = sc->sc_rxtap_len;
mb.m_next = m;
mb.m_pkthdr.len += mb.m_len;
+
bpf_mtap(sc->sc_drvbpf, &mb);
}
#endif
@@ -2337,18 +2331,19 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni,
if (sc->sc_drvbpf) {
struct mbuf mb;
- sc->sc_tx_th.wt_flags = 0;
+ sc->sc_txtap.wt_flags = 0;
if (shortPreamble)
- sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
+ sc->sc_txtap.wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
if (iswep)
- sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_WEP;
- sc->sc_tx_th.wt_rate = ni->ni_rates.rs_rates[ni->ni_txrate];
- sc->sc_tx_th.wt_txpower = 60/2; /* XXX */
- sc->sc_tx_th.wt_antenna = antenna;
+ sc->sc_txtap.wt_flags |= IEEE80211_RADIOTAP_F_WEP;
+ sc->sc_txtap.wt_rate = ni->ni_rates.rs_rates[ni->ni_txrate] &
+ IEEE80211_RATE_VAL;
+ sc->sc_txtap.wt_txpower = 30;
+ sc->sc_txtap.wt_antenna = antenna;
M_DUP_PKTHDR(&mb, m0);
- mb.m_data = (caddr_t)&sc->sc_tx_th;
- mb.m_len = sc->sc_tx_th_len;
+ mb.m_data = (caddr_t)&sc->sc_txtap;
+ mb.m_len = sc->sc_txtap_len;
mb.m_next = m0;
mb.m_pkthdr.len += mb.m_len;
bpf_mtap(sc->sc_drvbpf, &mb);
@@ -2689,10 +2684,10 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
/*
* Update BPF state.
*/
- sc->sc_tx_th.wt_chan_freq = sc->sc_rx_th.wr_chan_freq =
- htole16(chan->ic_freq);
- sc->sc_tx_th.wt_chan_flags = sc->sc_rx_th.wr_chan_flags =
- htole16(chan->ic_flags);
+ sc->sc_txtap.wt_chan_freq = sc->sc_rxtap.wr_chan_freq =
+ htole16(chan->ic_freq);
+ sc->sc_txtap.wt_chan_flags = sc->sc_rxtap.wr_chan_flags =
+ htole16(chan->ic_flags);
/*
* Change channels and update the h/w rate map
diff --git a/sys/dev/ic/athvar.h b/sys/dev/ic/athvar.h
index bc7d92c84c9..9aa20ce42dd 100644
--- a/sys/dev/ic/athvar.h
+++ b/sys/dev/ic/athvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: athvar.h,v 1.4 2005/02/17 21:02:24 reyk Exp $ */
+/* $OpenBSD: athvar.h,v 1.5 2005/03/03 16:39:54 reyk Exp $ */
/* $NetBSD: athvar.h,v 1.10 2004/08/10 01:03:53 dyoung Exp $ */
/*-
@@ -133,13 +133,13 @@ struct ath_stats {
struct ath_rx_radiotap_header {
struct ieee80211_radiotap_header wr_ihdr;
- u_int8_t wr_flags; /* XXX for padding */
+ u_int8_t wr_flags;
u_int8_t wr_rate;
u_int16_t wr_chan_freq;
u_int16_t wr_chan_flags;
u_int8_t wr_antenna;
u_int8_t wr_antsignal;
-};
+} __packed;
#define ATH_TX_RADIOTAP_PRESENT ( \
(1 << IEEE80211_RADIOTAP_FLAGS) | \
@@ -151,13 +151,13 @@ struct ath_rx_radiotap_header {
struct ath_tx_radiotap_header {
struct ieee80211_radiotap_header wt_ihdr;
- u_int8_t wt_flags; /* XXX for padding */
+ u_int8_t wt_flags;
u_int8_t wt_rate;
u_int16_t wt_chan_freq;
u_int16_t wt_chan_flags;
u_int8_t wt_txpower;
u_int8_t wt_antenna;
-};
+} __packed;
/*
* driver-specific node
@@ -235,21 +235,23 @@ struct ath_softc {
u_int8_t sc_hwmap[32]; /* h/w rate ix to IEEE table */
HAL_INT sc_imask; /* interrupt mask copy */
-#ifdef __FreeBSD__
- struct bpf_if *sc_drvbpf;
-#else
+#if NBPFILTER > 0
caddr_t sc_drvbpf;
-#endif
+
union {
- struct ath_tx_radiotap_header th;
- u_int8_t pad[64];
- } u_tx_rt;
- int sc_tx_th_len;
+ struct ath_rx_radiotap_header th;
+ uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
+ } sc_rxtapu;
+#define sc_rxtap sc_rxtapu.th
+ int sc_rxtap_len;
+
union {
- struct ath_rx_radiotap_header th;
- u_int8_t pad[64];
- } u_rx_rt;
- int sc_rx_th_len;
+ struct ath_tx_radiotap_header th;
+ uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
+ } sc_txtapu;
+#define sc_txtap sc_txtapu.th
+ int sc_txtap_len;
+#endif
struct ath_desc *sc_desc; /* TX/RX descriptors */
bus_dma_segment_t sc_dseg;
@@ -362,9 +364,6 @@ enum {
#define ATH_IS_ENABLED(sc) ((sc)->sc_flags & ATH_ENABLED)
#endif
-#define sc_tx_th u_tx_rt.th
-#define sc_rx_th u_rx_rt.th
-
#define ATH_LOCK_INIT(_sc) \
mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE)