summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/rtw.c556
-rw-r--r--sys/dev/ic/rtwreg.h32
-rw-r--r--sys/dev/ic/rtwvar.h60
3 files changed, 324 insertions, 324 deletions
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c
index c38d6f35a43..031ce47e969 100644
--- a/sys/dev/ic/rtw.c
+++ b/sys/dev/ic/rtw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtw.c,v 1.9 2005/01/19 11:29:27 jsg Exp $ */
+/* $OpenBSD: rtw.c,v 1.10 2005/01/22 10:14:25 jsg Exp $ */
/* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
@@ -107,14 +107,14 @@ void rtw_start(struct ifnet *);
void rtw_srom_defaults(struct rtw_srom *, u_int32_t *, u_int8_t *,
enum rtw_rfchipid *, u_int32_t *);
void rtw_txdesc_blk_init_all(struct rtw_txdesc_blk *);
-void rtw_txctl_blk_init_all(struct rtw_txctl_blk *);
+void rtw_txsoft_blk_init_all(struct rtw_txsoft_blk *);
void rtw_txdescs_sync(bus_dma_tag_t, bus_dmamap_t , struct rtw_txdesc_blk *,
u_int, u_int, int);
void rtw_txdescs_sync_all(bus_dma_tag_t, bus_dmamap_t,
struct rtw_txdesc_blk *);
-void rtw_rxbufs_release(bus_dma_tag_t, struct rtw_rxctl *);
+void rtw_rxbufs_release(bus_dma_tag_t, struct rtw_rxsoft *);
void rtw_rxdesc_init_all(bus_dma_tag_t, bus_dmamap_t,
- struct rtw_rxdesc *, struct rtw_rxctl *, int);
+ struct rtw_rxdesc *, struct rtw_rxsoft *, int);
void rtw_io_enable(struct rtw_regs *, u_int8_t, int);
void rtw_intr_rx(struct rtw_softc *, u_int16_t);
void rtw_intr_beacon(struct rtw_softc *, u_int16_t);
@@ -130,7 +130,7 @@ void rtw_recv_mgmt(struct ieee80211com *, struct mbuf *,
struct ieee80211_node * rtw_node_alloc(struct ieee80211com *);
void rtw_node_free(struct ieee80211com *, struct ieee80211_node *);
void rtw_media_status(struct ifnet *, struct ifmediareq *);
-void rtw_txctl_blk_cleanup_all(struct rtw_softc *);
+void rtw_txsoft_blk_cleanup_all(struct rtw_softc *);
void rtw_txdesc_blk_setup(struct rtw_txdesc_blk *, struct rtw_txdesc *,
u_int, bus_addr_t, bus_addr_t);
void rtw_txdesc_blk_setup_all(struct rtw_softc *);
@@ -154,13 +154,13 @@ void rtw_set_rfprog(struct rtw_regs *, enum rtw_rfchipid,
const char *);
u_int8_t rtw_chan2txpower(struct rtw_srom *, struct ieee80211com *,
struct ieee80211_channel *);
-int rtw_txctl_blk_init(struct rtw_txctl_blk *);
-int rtw_rxctl_init_all(bus_dma_tag_t, struct rtw_rxctl *, u_int *,
+int rtw_txsoft_blk_init(struct rtw_txsoft_blk *);
+int rtw_rxsoft_init_all(bus_dma_tag_t, struct rtw_rxsoft *, u_int *,
const char *);
-void rtw_txbuf_release(bus_dma_tag_t, struct ieee80211com *,
- struct rtw_txctl *);
-void rtw_txbufs_release(bus_dma_tag_t, bus_dmamap_t,
- struct ieee80211com *, struct rtw_txctl_blk *);
+void rtw_txsoft_release(bus_dma_tag_t, struct ieee80211com *,
+ struct rtw_txsoft *);
+void rtw_txsofts_release(bus_dma_tag_t, bus_dmamap_t,
+ struct ieee80211com *, struct rtw_txsoft_blk *);
void rtw_hwring_setup(struct rtw_softc *);
void rtw_swring_setup(struct rtw_softc *);
void rtw_txdesc_blk_reset(struct rtw_txdesc_blk *);
@@ -173,39 +173,39 @@ void rtw_set_nettype(struct rtw_softc *, enum ieee80211_opmode);
int rtw_init(struct ifnet *);
int rtw_ioctl(struct ifnet *, u_long, caddr_t);
int rtw_seg_too_short(bus_dmamap_t);
-struct mbuf * rtw_dmamap_load_txbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *,
+struct mbuf * rtw_dmamap_load_txsoft(bus_dma_tag_t, bus_dmamap_t, struct mbuf *,
u_int, short *, const char *);
int rtw_newstate(struct ieee80211com *, enum ieee80211_state, int);
int rtw_media_change(struct ifnet *);
-int rtw_txctl_blk_setup_all(struct rtw_softc *);
+int rtw_txsoft_blk_setup_all(struct rtw_softc *);
struct rtw_rf * rtw_rf_attach(struct rtw_softc *, enum rtw_rfchipid, int);
u_int8_t rtw_check_phydelay(struct rtw_regs *, u_int32_t);
int rtw_chip_reset1(struct rtw_regs *, const char *);
int rtw_chip_reset(struct rtw_regs *, const char *);
int rtw_recall_eeprom(struct rtw_regs *, const char *);
int rtw_reset(struct rtw_softc *);
-int rtw_txdesc_dmamaps_create(bus_dma_tag_t, struct rtw_txctl *, u_int);
-int rtw_rxdesc_dmamaps_create(bus_dma_tag_t, struct rtw_rxctl *, u_int);
-void rtw_rxctls_setup(struct rtw_rxctl *);
-void rtw_rxdesc_dmamaps_destroy(bus_dma_tag_t, struct rtw_rxctl *, u_int);
-void rtw_txdesc_dmamaps_destroy(bus_dma_tag_t, struct rtw_txctl *, u_int);
+int rtw_txdesc_dmamaps_create(bus_dma_tag_t, struct rtw_txsoft *, u_int);
+int rtw_rxdesc_dmamaps_create(bus_dma_tag_t, struct rtw_rxsoft *, u_int);
+void rtw_rxsofts_setup(struct rtw_rxsoft *);
+void rtw_rxdesc_dmamaps_destroy(bus_dma_tag_t, struct rtw_rxsoft *, u_int);
+void rtw_txdesc_dmamaps_destroy(bus_dma_tag_t, struct rtw_txsoft *, u_int);
void rtw_srom_free(struct rtw_srom *);
void rtw_init_channels(enum rtw_locale, struct ieee80211_channel (*)[],
const char*);
void rtw_identify_country(struct rtw_regs *, enum rtw_locale *, const char *);
int rtw_identify_sta(struct rtw_regs *, u_int8_t (*)[], const char *);
void rtw_rxdescs_sync(bus_dma_tag_t, bus_dmamap_t, u_int, u_int, int);
-int rtw_rxbuf_alloc(bus_dma_tag_t, struct rtw_rxctl *);
+int rtw_rxsoft_alloc(bus_dma_tag_t, struct rtw_rxsoft *);
void rtw_rxdesc_init(bus_dma_tag_t, bus_dmamap_t, struct rtw_rxdesc *,
- struct rtw_rxctl *, int, int);
+ struct rtw_rxsoft *, int, int);
void rtw_collect_txpkt(struct rtw_softc *, struct rtw_txdesc_blk *,
- struct rtw_txctl *, int);
-void rtw_collect_txring(struct rtw_softc *, struct rtw_txctl_blk *,
+ struct rtw_txsoft *, int);
+void rtw_collect_txring(struct rtw_softc *, struct rtw_txsoft_blk *,
struct rtw_txdesc_blk *);
void rtw_suspend_ticks(struct rtw_softc *);
void rtw_resume_ticks(struct rtw_softc *);
void rtw_enable_interrupts(struct rtw_softc *);
-int rtw_dequeue(struct ifnet *, struct rtw_txctl_blk **,
+int rtw_dequeue(struct ifnet *, struct rtw_txsoft_blk **,
struct rtw_txdesc_blk **, struct mbuf **,
struct ieee80211_node **);
void rtw_setifprops(struct ifnet *, const char *, void *);
@@ -214,16 +214,16 @@ void rtw_set80211methods(struct rtw_mtbl *, struct ieee80211com *);
void rtw_establish_hooks(struct rtw_hooks *, const char *, void *);
void rtw_disestablish_hooks(struct rtw_hooks *, const char *, void *);
void rtw_init_radiotap(struct rtw_softc *);
-int rtw_txctl_blk_setup(struct rtw_txctl_blk *, u_int);
+int rtw_txsoft_blk_setup(struct rtw_txsoft_blk *, u_int);
#ifdef RTW_DEBUG
void rtw_print_txdesc(struct rtw_softc *, const char *,
- struct rtw_txctl *, struct rtw_txdesc_blk *, int);
+ struct rtw_txsoft *, struct rtw_txdesc_blk *, int);
const char * rtw_access_string(enum rtw_access);
void rtw_dump_rings(struct rtw_softc *);
void rtw_print_txdesc(struct rtw_softc *, const char *,
- struct rtw_txctl *, struct rtw_txdesc_blk *, int);
+ struct rtw_txsoft *, struct rtw_txdesc_blk *, int);
void rtw_print_regs(struct rtw_regs *, const char *, const char *);
#endif
@@ -576,13 +576,13 @@ rtw_reset(struct rtw_softc *sc)
}
int
-rtw_txdesc_dmamaps_create(bus_dma_tag_t dmat, struct rtw_txctl *descs,
+rtw_txdesc_dmamaps_create(bus_dma_tag_t dmat, struct rtw_txsoft *descs,
u_int ndescs)
{
int i, rc = 0;
for (i = 0; i < ndescs; i++) {
rc = bus_dmamap_create(dmat, MCLBYTES, RTW_MAXPKTSEGS, MCLBYTES,
- 0, 0, &descs[i].stx_dmamap);
+ 0, 0, &descs[i].ts_dmamap);
if (rc != 0)
break;
}
@@ -590,13 +590,13 @@ rtw_txdesc_dmamaps_create(bus_dma_tag_t dmat, struct rtw_txctl *descs,
}
int
-rtw_rxdesc_dmamaps_create(bus_dma_tag_t dmat, struct rtw_rxctl *descs,
+rtw_rxdesc_dmamaps_create(bus_dma_tag_t dmat, struct rtw_rxsoft *descs,
u_int ndescs)
{
int i, rc = 0;
for (i = 0; i < ndescs; i++) {
rc = bus_dmamap_create(dmat, MCLBYTES, 1, MCLBYTES, 0, 0,
- &descs[i].srx_dmamap);
+ &descs[i].rs_dmamap);
if (rc != 0)
break;
}
@@ -604,32 +604,32 @@ rtw_rxdesc_dmamaps_create(bus_dma_tag_t dmat, struct rtw_rxctl *descs,
}
void
-rtw_rxctls_setup(struct rtw_rxctl *descs)
+rtw_rxsofts_setup(struct rtw_rxsoft *descs)
{
int i;
for (i = 0; i < RTW_RXQLEN; i++)
- descs[i].srx_mbuf = NULL;
+ descs[i].rs_mbuf = NULL;
}
void
-rtw_rxdesc_dmamaps_destroy(bus_dma_tag_t dmat, struct rtw_rxctl *descs,
+rtw_rxdesc_dmamaps_destroy(bus_dma_tag_t dmat, struct rtw_rxsoft *descs,
u_int ndescs)
{
int i;
for (i = 0; i < ndescs; i++) {
- if (descs[i].srx_dmamap != NULL)
- bus_dmamap_destroy(dmat, descs[i].srx_dmamap);
+ if (descs[i].rs_dmamap != NULL)
+ bus_dmamap_destroy(dmat, descs[i].rs_dmamap);
}
}
void
-rtw_txdesc_dmamaps_destroy(bus_dma_tag_t dmat, struct rtw_txctl *descs,
+rtw_txdesc_dmamaps_destroy(bus_dma_tag_t dmat, struct rtw_txsoft *descs,
u_int ndescs)
{
int i;
for (i = 0; i < ndescs; i++) {
- if (descs[i].stx_dmamap != NULL)
- bus_dmamap_destroy(dmat, descs[i].stx_dmamap);
+ if (descs[i].ts_dmamap != NULL)
+ bus_dmamap_destroy(dmat, descs[i].ts_dmamap);
}
}
@@ -1017,40 +1017,40 @@ rtw_chan2txpower(struct rtw_srom *sr, struct ieee80211com *ic,
}
void
-rtw_txdesc_blk_init_all(struct rtw_txdesc_blk *htcs)
+rtw_txdesc_blk_init_all(struct rtw_txdesc_blk *tdb)
{
int pri;
u_int ndesc[RTW_NTXPRI] =
{RTW_NTXDESCLO, RTW_NTXDESCMD, RTW_NTXDESCHI, RTW_NTXDESCBCN};
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- htcs[pri].htc_nfree = ndesc[pri];
- htcs[pri].htc_next = 0;
+ tdb[pri].tdb_nfree = ndesc[pri];
+ tdb[pri].tdb_next = 0;
}
}
int
-rtw_txctl_blk_init(struct rtw_txctl_blk *stc)
+rtw_txsoft_blk_init(struct rtw_txsoft_blk *tsb)
{
int i;
- struct rtw_txctl *stx;
+ struct rtw_txsoft *ts;
- SIMPLEQ_INIT(&stc->stc_dirtyq);
- SIMPLEQ_INIT(&stc->stc_freeq);
- for (i = 0; i < stc->stc_ndesc; i++) {
- stx = &stc->stc_desc[i];
- stx->stx_mbuf = NULL;
- SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
+ SIMPLEQ_INIT(&tsb->tsb_dirtyq);
+ SIMPLEQ_INIT(&tsb->tsb_freeq);
+ for (i = 0; i < tsb->tsb_ndesc; i++) {
+ ts = &tsb->tsb_desc[i];
+ ts->ts_mbuf = NULL;
+ SIMPLEQ_INSERT_TAIL(&tsb->tsb_freeq, ts, ts_q);
}
return 0;
}
void
-rtw_txctl_blk_init_all(struct rtw_txctl_blk *stcs)
+rtw_txsoft_blk_init_all(struct rtw_txsoft_blk *tsb)
{
int pri;
for (pri = 0; pri < RTW_NTXPRI; pri++)
- rtw_txctl_blk_init(&stcs[pri]);
+ rtw_txsoft_blk_init(&tsb[pri]);
}
void
@@ -1079,54 +1079,54 @@ rtw_rxdescs_sync(bus_dma_tag_t dmat, bus_dmamap_t dmap, u_int desc0, u_int
void
rtw_txdescs_sync(bus_dma_tag_t dmat, bus_dmamap_t dmap,
- struct rtw_txdesc_blk *htc, u_int desc0, u_int nsync, int ops)
+ struct rtw_txdesc_blk *tdb, u_int desc0, u_int nsync, int ops)
{
/* sync to end of ring */
- if (desc0 + nsync > htc->htc_ndesc) {
+ if (desc0 + nsync > tdb->tdb_ndesc) {
bus_dmamap_sync(dmat, dmap,
- htc->htc_ofs + sizeof(struct rtw_txdesc) * desc0,
- sizeof(struct rtw_txdesc) * (htc->htc_ndesc - desc0),
+ tdb->tdb_ofs + sizeof(struct rtw_txdesc) * desc0,
+ sizeof(struct rtw_txdesc) * (tdb->tdb_ndesc - desc0),
ops);
- nsync -= (htc->htc_ndesc - desc0);
+ nsync -= (tdb->tdb_ndesc - desc0);
desc0 = 0;
}
/* sync what remains */
bus_dmamap_sync(dmat, dmap,
- htc->htc_ofs + sizeof(struct rtw_txdesc) * desc0,
+ tdb->tdb_ofs + sizeof(struct rtw_txdesc) * desc0,
sizeof(struct rtw_txdesc) * nsync, ops);
}
void
rtw_txdescs_sync_all(bus_dma_tag_t dmat, bus_dmamap_t dmap,
- struct rtw_txdesc_blk *htcs)
+ struct rtw_txdesc_blk *tdb)
{
int pri;
for (pri = 0; pri < RTW_NTXPRI; pri++) {
rtw_txdescs_sync(dmat, dmap,
- &htcs[pri], 0, htcs[pri].htc_ndesc,
+ &tdb[pri], 0, tdb[pri].tdb_ndesc,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
}
}
void
-rtw_rxbufs_release(bus_dma_tag_t dmat, struct rtw_rxctl *desc)
+rtw_rxbufs_release(bus_dma_tag_t dmat, struct rtw_rxsoft *desc)
{
int i;
- struct rtw_rxctl *srx;
+ struct rtw_rxsoft *rs;
for (i = 0; i < RTW_RXQLEN; i++) {
- srx = &desc[i];
- bus_dmamap_sync(dmat, srx->srx_dmamap, 0,
- srx->srx_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD);
- bus_dmamap_unload(dmat, srx->srx_dmamap);
- m_freem(srx->srx_mbuf);
- srx->srx_mbuf = NULL;
+ rs = &desc[i];
+ bus_dmamap_sync(dmat, rs->rs_dmamap, 0,
+ rs->rs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD);
+ bus_dmamap_unload(dmat, rs->rs_dmamap);
+ m_freem(rs->rs_mbuf);
+ rs->rs_mbuf = NULL;
}
}
int
-rtw_rxbuf_alloc(bus_dma_tag_t dmat, struct rtw_rxctl *srx)
+rtw_rxsoft_alloc(bus_dma_tag_t dmat, struct rtw_rxsoft *rs)
{
int rc;
struct mbuf *m;
@@ -1141,34 +1141,34 @@ rtw_rxbuf_alloc(bus_dma_tag_t dmat, struct rtw_rxctl *srx)
m->m_pkthdr.len = m->m_len = m->m_ext.ext_size;
- if (srx->srx_mbuf != NULL)
- bus_dmamap_unload(dmat, srx->srx_dmamap);
+ if (rs->rs_mbuf != NULL)
+ bus_dmamap_unload(dmat, rs->rs_dmamap);
- srx->srx_mbuf = NULL;
+ rs->rs_mbuf = NULL;
- rc = bus_dmamap_load_mbuf(dmat, srx->srx_dmamap, m, BUS_DMA_NOWAIT);
+ rc = bus_dmamap_load_mbuf(dmat, rs->rs_dmamap, m, BUS_DMA_NOWAIT);
if (rc != 0) {
m_freem(m);
return -1;
}
- srx->srx_mbuf = m;
+ rs->rs_mbuf = m;
return 0;
}
int
-rtw_rxctl_init_all(bus_dma_tag_t dmat, struct rtw_rxctl *desc,
+rtw_rxsoft_init_all(bus_dma_tag_t dmat, struct rtw_rxsoft *desc,
u_int *next, const char *dvname)
{
int i, rc;
- struct rtw_rxctl *srx;
+ struct rtw_rxsoft *rs;
for (i = 0; i < RTW_RXQLEN; i++) {
- srx = &desc[i];
- if ((rc = rtw_rxbuf_alloc(dmat, srx)) == 0)
+ rs = &desc[i];
+ if ((rc = rtw_rxsoft_alloc(dmat, rs)) == 0)
continue;
- printf("%s: failed rtw_rxbuf_alloc after %d buffers, rc = %d\n",
+ printf("%s: failed rtw_rxsoft_alloc after %d buffers, rc = %d\n",
dvname, i, rc);
if (i == 0) {
rtw_rxbufs_release(dmat, desc);
@@ -1181,32 +1181,32 @@ rtw_rxctl_init_all(bus_dma_tag_t dmat, struct rtw_rxctl *desc,
void
rtw_rxdesc_init(bus_dma_tag_t dmat, bus_dmamap_t dmam,
- struct rtw_rxdesc *hrx, struct rtw_rxctl *srx, int idx, int kick)
+ struct rtw_rxdesc *rd, struct rtw_rxsoft *rs, int idx, int kick)
{
int is_last = (idx == RTW_RXQLEN - 1);
u_int32_t ctl, octl, obuf;
- obuf = hrx->hrx_buf;
- hrx->hrx_buf = htole32(srx->srx_dmamap->dm_segs[0].ds_addr);
+ obuf = rd->rd_buf;
+ rd->rd_buf = htole32(rs->rs_dmamap->dm_segs[0].ds_addr);
- ctl = LSHIFT(srx->srx_mbuf->m_len, RTW_RXCTL_LENGTH_MASK) |
+ ctl = LSHIFT(rs->rs_mbuf->m_len, RTW_RXCTL_LENGTH_MASK) |
RTW_RXCTL_OWN | RTW_RXCTL_FS | RTW_RXCTL_LS;
if (is_last)
ctl |= RTW_RXCTL_EOR;
- octl = hrx->hrx_ctl;
- hrx->hrx_ctl = htole32(ctl);
+ octl = rd->rd_ctl;
+ rd->rd_ctl = htole32(ctl);
RTW_DPRINTF(
kick ? (RTW_DEBUG_RECV_DESC | RTW_DEBUG_IO_KICK)
: RTW_DEBUG_RECV_DESC,
- ("%s: hrx %p buf %08x -> %08x ctl %08x -> %08x\n", __func__, hrx,
- letoh32(obuf), letoh32(hrx->hrx_buf), letoh32(octl),
- letoh32(hrx->hrx_ctl)));
+ ("%s: rd %p buf %08x -> %08x ctl %08x -> %08x\n", __func__, rd,
+ letoh32(obuf), letoh32(rd->rd_buf), letoh32(octl),
+ letoh32(rd->rd_ctl)));
/* sync the mbuf */
- bus_dmamap_sync(dmat, srx->srx_dmamap, 0, srx->srx_dmamap->dm_mapsize,
+ bus_dmamap_sync(dmat, rs->rs_dmamap, 0, rs->rs_dmamap->dm_mapsize,
BUS_DMASYNC_PREREAD);
/* sync the descriptor */
@@ -1217,16 +1217,16 @@ rtw_rxdesc_init(bus_dma_tag_t dmat, bus_dmamap_t dmam,
void
rtw_rxdesc_init_all(bus_dma_tag_t dmat, bus_dmamap_t dmam,
- struct rtw_rxdesc *desc, struct rtw_rxctl *ctl, int kick)
+ struct rtw_rxdesc *desc, struct rtw_rxsoft *ctl, int kick)
{
int i;
- struct rtw_rxdesc *hrx;
- struct rtw_rxctl *srx;
+ struct rtw_rxdesc *rd;
+ struct rtw_rxsoft *rs;
for (i = 0; i < RTW_RXQLEN; i++) {
- hrx = &desc[i];
- srx = &ctl[i];
- rtw_rxdesc_init(dmat, dmam, hrx, srx, i, kick);
+ rd = &desc[i];
+ rs = &ctl[i];
+ rtw_rxdesc_init(dmat, dmam, rd, rs, i, kick);
}
}
@@ -1265,8 +1265,8 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr)
u_int next, nproc = 0;
int hwrate, len, rate, rssi;
u_int32_t hrssi, hstat, htsfth, htsftl;
- struct rtw_rxdesc *hrx;
- struct rtw_rxctl *srx;
+ struct rtw_rxdesc *rd;
+ struct rtw_rxsoft *rs;
struct mbuf *m;
struct ieee80211com *ic = &sc->sc_ic;
@@ -1278,13 +1278,13 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr)
for (next = sc->sc_rxnext; ; next = (next + 1) % RTW_RXQLEN) {
rtw_rxdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap,
next, 1, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- hrx = &sc->sc_rxdesc[next];
- srx = &sc->sc_rxctl[next];
+ rd = &sc->sc_rxdesc[next];
+ rs = &sc->sc_rxsoft[next];
- hstat = letoh32(hrx->hrx_stat);
- hrssi = letoh32(hrx->hrx_rssi);
- htsfth = letoh32(hrx->hrx_tsfth);
- htsftl = letoh32(hrx->hrx_tsftl);
+ hstat = letoh32(rd->rd_stat);
+ hrssi = letoh32(rd->rd_rssi);
+ htsfth = letoh32(rd->rd_tsfth);
+ htsftl = letoh32(rd->rd_tsftl);
RTW_DPRINTF(RTW_DEBUG_RECV_DESC,
("%s: rxdesc[%d] hstat %08x hrssi %08x htsft %08x%08x\n",
@@ -1303,8 +1303,8 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr)
/* sometimes the NIC skips to the 0th descriptor */
rtw_rxdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap,
0, 1, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- hrx = &sc->sc_rxdesc[0];
- if ((hrx->hrx_stat & htole32(RTW_RXSTAT_OWN)) != 0)
+ rd = &sc->sc_rxdesc[0];
+ if ((rd->rd_stat & htole32(RTW_RXSTAT_OWN)) != 0)
break;
RTW_DPRINTF(RTW_DEBUG_BUGS,
("%s: NIC skipped to rxdesc[0]\n",
@@ -1373,17 +1373,17 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr)
goto next;
}
- bus_dmamap_sync(sc->sc_dmat, srx->srx_dmamap, 0,
- srx->srx_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD);
+ bus_dmamap_sync(sc->sc_dmat, rs->rs_dmamap, 0,
+ rs->rs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD);
- m = srx->srx_mbuf;
+ m = rs->rs_mbuf;
/* if temporarily out of memory, re-use mbuf */
- switch (rtw_rxbuf_alloc(sc->sc_dmat, srx)) {
+ switch (rtw_rxsoft_alloc(sc->sc_dmat, rs)) {
case 0:
break;
case ENOBUFS:
- printf("%s: rtw_rxbuf_alloc(, %d) failed, "
+ printf("%s: rtw_rxsoft_alloc(, %d) failed, "
"dropping this packet\n", sc->sc_dev.dv_xname,
next);
goto next;
@@ -1429,7 +1429,7 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr)
ieee80211_free_node(&sc->sc_ic, ni);
next:
rtw_rxdesc_init(sc->sc_dmat, sc->sc_desc_dmamap,
- hrx, srx, next, 0);
+ rd, rs, next, 0);
}
KASSERT(sc->sc_rxnext < RTW_RXQLEN);
@@ -1439,22 +1439,22 @@ next:
}
void
-rtw_txbuf_release(bus_dma_tag_t dmat, struct ieee80211com *ic,
- struct rtw_txctl *stx)
+rtw_txsoft_release(bus_dma_tag_t dmat, struct ieee80211com *ic,
+ struct rtw_txsoft *ts)
{
struct mbuf *m;
struct ieee80211_node *ni;
- m = stx->stx_mbuf;
- ni = stx->stx_ni;
+ m = ts->ts_mbuf;
+ ni = ts->ts_ni;
KASSERT(m != NULL);
KASSERT(ni != NULL);
- stx->stx_mbuf = NULL;
- stx->stx_ni = NULL;
+ ts->ts_mbuf = NULL;
+ ts->ts_ni = NULL;
- bus_dmamap_sync(dmat, stx->stx_dmamap, 0, stx->stx_dmamap->dm_mapsize,
+ bus_dmamap_sync(dmat, ts->ts_dmamap, 0, ts->ts_dmamap->dm_mapsize,
BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(dmat, stx->stx_dmamap);
+ bus_dmamap_unload(dmat, ts->ts_dmamap);
m_freem(m);
if (ni == ic->ic_bss)
ieee80211_unref_node(&ni);
@@ -1463,34 +1463,34 @@ rtw_txbuf_release(bus_dma_tag_t dmat, struct ieee80211com *ic,
}
void
-rtw_txbufs_release(bus_dma_tag_t dmat, bus_dmamap_t desc_dmamap,
- struct ieee80211com *ic, struct rtw_txctl_blk *stc)
+rtw_txsofts_release(bus_dma_tag_t dmat, bus_dmamap_t desc_dmamap,
+ struct ieee80211com *ic, struct rtw_txsoft_blk *tsb)
{
- struct rtw_txctl *stx;
+ struct rtw_txsoft *ts;
- while ((stx = SIMPLEQ_FIRST(&stc->stc_dirtyq)) != NULL) {
- rtw_txbuf_release(dmat, ic, stx);
- SIMPLEQ_REMOVE_HEAD(&stc->stc_dirtyq, stx_q);
- SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
+ while ((ts = SIMPLEQ_FIRST(&tsb->tsb_dirtyq)) != NULL) {
+ rtw_txsoft_release(dmat, ic, ts);
+ SIMPLEQ_REMOVE_HEAD(&tsb->tsb_dirtyq, ts_q);
+ SIMPLEQ_INSERT_TAIL(&tsb->tsb_freeq, ts, ts_q);
}
}
void
-rtw_collect_txpkt(struct rtw_softc *sc, struct rtw_txdesc_blk *htc,
- struct rtw_txctl *stx, int ndesc)
+rtw_collect_txpkt(struct rtw_softc *sc, struct rtw_txdesc_blk *tdb,
+ struct rtw_txsoft *ts, int ndesc)
{
uint32_t hstat;
int data_retry, rts_retry;
- struct rtw_txdesc *htxn;
+ struct rtw_txdesc *tdn;
const char *condstring;
- rtw_txbuf_release(sc->sc_dmat, &sc->sc_ic, stx);
+ rtw_txsoft_release(sc->sc_dmat, &sc->sc_ic, ts);
- htc->htc_nfree += ndesc;
+ tdb->tdb_nfree += ndesc;
- htxn = &htc->htc_desc[stx->stx_last];
+ tdn = &tdb->tdb_desc[ts->ts_last];
- hstat = letoh32(htxn->htx_stat);
+ hstat = letoh32(tdn->td_stat);
rts_retry = MASK_AND_RSHIFT(hstat, RTW_TXSTAT_RTSRETRY_MASK);
data_retry = MASK_AND_RSHIFT(hstat, RTW_TXSTAT_DRC_MASK);
@@ -1504,55 +1504,55 @@ rtw_collect_txpkt(struct rtw_softc *sc, struct rtw_txdesc_blk *htc,
}
DPRINTF(sc, RTW_DEBUG_XMIT_DESC,
- ("%s: stx %p txdesc[%d, %d] %s tries rts %u data %u\n",
- sc->sc_dev.dv_xname, stx, stx->stx_first, stx->stx_last,
+ ("%s: ts %p txdesc[%d, %d] %s tries rts %u data %u\n",
+ sc->sc_dev.dv_xname, ts, ts->ts_first, ts->ts_last,
condstring, rts_retry, data_retry));
}
/* Collect transmitted packets. */
void
-rtw_collect_txring(struct rtw_softc *sc, struct rtw_txctl_blk *stc,
- struct rtw_txdesc_blk *htc)
+rtw_collect_txring(struct rtw_softc *sc, struct rtw_txsoft_blk *tsb,
+ struct rtw_txdesc_blk *tdb)
{
int ndesc;
- struct rtw_txctl *stx;
+ struct rtw_txsoft *ts;
- while ((stx = SIMPLEQ_FIRST(&stc->stc_dirtyq)) != NULL) {
- ndesc = 1 + stx->stx_last - stx->stx_first;
- if (stx->stx_last < stx->stx_first)
- ndesc += htc->htc_ndesc;
+ while ((ts = SIMPLEQ_FIRST(&tsb->tsb_dirtyq)) != NULL) {
+ ndesc = 1 + ts->ts_last - ts->ts_first;
+ if (ts->ts_last < ts->ts_first)
+ ndesc += tdb->tdb_ndesc;
KASSERT(ndesc > 0);
- rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap, htc,
- stx->stx_first, ndesc,
+ rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap, tdb,
+ ts->ts_first, ndesc,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- if ((htc->htc_desc[stx->stx_last].htx_stat &
+ if ((tdb->tdb_desc[ts->ts_last].td_stat &
htole32(RTW_TXSTAT_OWN)) != 0)
break;
- rtw_collect_txpkt(sc, htc, stx, ndesc);
- SIMPLEQ_REMOVE_HEAD(&stc->stc_dirtyq, stx_q);
- SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
+ rtw_collect_txpkt(sc, tdb, ts, ndesc);
+ SIMPLEQ_REMOVE_HEAD(&tsb->tsb_dirtyq, ts_q);
+ SIMPLEQ_INSERT_TAIL(&tsb->tsb_freeq, ts, ts_q);
sc->sc_if.if_flags &= ~IFF_OACTIVE;
}
- if (stx == NULL)
- stc->stc_tx_timer = 0;
+ if (ts == NULL)
+ tsb->tsb_tx_timer = 0;
}
void
rtw_intr_tx(struct rtw_softc *sc, u_int16_t isr)
{
int pri;
- struct rtw_txctl_blk *stc;
- struct rtw_txdesc_blk *htc;
+ struct rtw_txsoft_blk *tsb;
+ struct rtw_txdesc_blk *tdb;
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- stc = &sc->sc_txctl_blk[pri];
- htc = &sc->sc_txdesc_blk[pri];
+ tsb = &sc->sc_txsoft_blk[pri];
+ tdb = &sc->sc_txdesc_blk[pri];
- rtw_collect_txring(sc, stc, htc);
+ rtw_collect_txring(sc, tsb, tdb);
if ((isr & RTW_INTR_TX) != 0)
rtw_start(&sc->sc_if);
@@ -1580,27 +1580,27 @@ rtw_intr_atim(struct rtw_softc *sc)
void
rtw_dump_rings(struct rtw_softc *sc)
{
- struct rtw_txdesc_blk *htc;
- struct rtw_rxdesc *hrx;
+ struct rtw_txdesc_blk *tdb;
+ struct rtw_rxdesc *rd;
int desc, pri;
if ((rtw_debug & RTW_DEBUG_IO_KICK) == 0)
return;
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- htc = &sc->sc_txdesc_blk[pri];
+ tdb = &sc->sc_txdesc_blk[pri];
printf("%s: txpri %d ndesc %d nfree %d\n", __func__, pri,
- htc->htc_ndesc, htc->htc_nfree);
- for (desc = 0; desc < htc->htc_ndesc; desc++)
- rtw_print_txdesc(sc, ".", NULL, htc, desc);
+ tdb->tdb_ndesc, tdb->tdb_nfree);
+ for (desc = 0; desc < tdb->tdb_ndesc; desc++)
+ rtw_print_txdesc(sc, ".", NULL, tdb, desc);
}
for (desc = 0; desc < RTW_RXQLEN; desc++) {
- hrx = &sc->sc_rxdesc[desc];
+ rd = &sc->sc_rxdesc[desc];
printf("%s: ctl %08x rsvd0/rssi %08x buf/tsftl %08x "
"rsvd1/tsfth %08x\n", __func__,
- letoh32(hrx->hrx_ctl), letoh32(hrx->hrx_rssi),
- letoh32(hrx->hrx_buf), letoh32(hrx->hrx_tsfth));
+ letoh32(rd->rd_ctl), letoh32(rd->rd_rssi),
+ letoh32(rd->rd_buf), letoh32(rd->rd_tsfth));
}
}
#endif /* RTW_DEBUG */
@@ -1639,14 +1639,14 @@ rtw_swring_setup(struct rtw_softc *sc)
{
rtw_txdesc_blk_init_all(&sc->sc_txdesc_blk[0]);
- rtw_txctl_blk_init_all(&sc->sc_txctl_blk[0]);
+ rtw_txsoft_blk_init_all(&sc->sc_txsoft_blk[0]);
rtw_rxdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap,
0, RTW_RXQLEN, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- rtw_rxctl_init_all(sc->sc_dmat, sc->sc_rxctl, &sc->sc_rxnext,
+ rtw_rxsoft_init_all(sc->sc_dmat, sc->sc_rxsoft, &sc->sc_rxnext,
sc->sc_dev.dv_xname);
rtw_rxdesc_init_all(sc->sc_dmat, sc->sc_desc_dmamap,
- sc->sc_rxdesc, sc->sc_rxctl, 1);
+ sc->sc_rxdesc, sc->sc_rxsoft, 1);
rtw_txdescs_sync_all(sc->sc_dmat, sc->sc_desc_dmamap,
&sc->sc_txdesc_blk[0]);
@@ -1657,31 +1657,31 @@ rtw_swring_setup(struct rtw_softc *sc)
}
void
-rtw_txdesc_blk_reset(struct rtw_txdesc_blk *htc)
+rtw_txdesc_blk_reset(struct rtw_txdesc_blk *tdb)
{
int i;
- (void)memset(htc->htc_desc, 0,
- sizeof(htc->htc_desc[0]) * htc->htc_ndesc);
- for (i = 0; i < htc->htc_ndesc; i++)
- htc->htc_desc[i].htx_next = htole32(RTW_NEXT_DESC(htc, i));
- htc->htc_nfree = htc->htc_ndesc;
- htc->htc_next = 0;
+ (void)memset(tdb->tdb_desc, 0,
+ sizeof(tdb->tdb_desc[0]) *tdb->tdb_ndesc);
+ for (i = 0; i < tdb->tdb_ndesc; i++)
+ tdb->tdb_desc[i].td_next = htole32(RTW_NEXT_DESC(tdb, i));
+ tdb->tdb_nfree = tdb->tdb_ndesc;
+ tdb->tdb_next = 0;
}
void
rtw_txdescs_reset(struct rtw_softc *sc)
{
int pri;
- struct rtw_txdesc_blk *htc;
+ struct rtw_txdesc_blk *tdb;
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- htc = &sc->sc_txdesc_blk[pri];
- rtw_txbufs_release(sc->sc_dmat, sc->sc_desc_dmamap, &sc->sc_ic,
- &sc->sc_txctl_blk[pri]);
- rtw_txdesc_blk_reset(htc);
- rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap, htc,
- 0, htc->htc_ndesc,
+ tdb = &sc->sc_txdesc_blk[pri];
+ rtw_txsofts_release(sc->sc_dmat, sc->sc_desc_dmamap, &sc->sc_ic,
+ &sc->sc_txsoft_blk[pri]);
+ rtw_txdesc_blk_reset(tdb);
+ rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap, tdb,
+ 0, tdb->tdb_ndesc,
BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
}
}
@@ -1691,7 +1691,7 @@ rtw_rxdescs_reset(struct rtw_softc *sc)
{
/* Re-initialize descriptors, just in case. */
rtw_rxdesc_init_all(sc->sc_dmat, sc->sc_desc_dmamap, sc->sc_rxdesc,
- &sc->sc_rxctl[0], 1);
+ &sc->sc_rxsoft[0], 1);
/* Reset to start of ring. */
sc->sc_rxnext = 0;
@@ -1895,13 +1895,13 @@ rtw_stop(struct ifnet *ifp, int disable)
}
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- rtw_txbufs_release(sc->sc_dmat, sc->sc_desc_dmamap, &sc->sc_ic,
- &sc->sc_txctl_blk[pri]);
+ rtw_txsofts_release(sc->sc_dmat, sc->sc_desc_dmamap, &sc->sc_ic,
+ &sc->sc_txsoft_blk[pri]);
}
if (disable) {
rtw_disable(sc);
- rtw_rxbufs_release(sc->sc_dmat, &sc->sc_rxctl[0]);
+ rtw_rxbufs_release(sc->sc_dmat, &sc->sc_rxsoft[0]);
}
/* Mark the interface as not running. Cancel the watchdog timer. */
@@ -2495,16 +2495,16 @@ rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
return rc;
}
-/* Point *mp at the next 802.11 frame to transmit. Point *stcp
+/* Point *mp at the next 802.11 frame to transmit. Point *tsbp
* at the driver's selection of transmit control block for the packet.
*/
int
-rtw_dequeue(struct ifnet *ifp, struct rtw_txctl_blk **stcp,
- struct rtw_txdesc_blk **htcp, struct mbuf **mp,
+rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
+ struct rtw_txdesc_blk **tdbp, struct mbuf **mp,
struct ieee80211_node **nip)
{
- struct rtw_txctl_blk *stc;
- struct rtw_txdesc_blk *htc;
+ struct rtw_txsoft_blk *tsb;
+ struct rtw_txdesc_blk *tdb;
struct mbuf *m0;
struct rtw_softc *sc;
struct ieee80211com *ic;
@@ -2515,10 +2515,10 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txctl_blk **stcp,
("%s: enter %s\n", sc->sc_dev.dv_xname, __func__));
*mp = NULL;
- stc = &sc->sc_txctl_blk[RTW_TXPRIMD];
- htc = &sc->sc_txdesc_blk[RTW_TXPRIMD];
+ tsb = &sc->sc_txsoft_blk[RTW_TXPRIMD];
+ tdb = &sc->sc_txdesc_blk[RTW_TXPRIMD];
- if (SIMPLEQ_EMPTY(&stc->stc_freeq) || htc->htc_nfree == 0) {
+ if (SIMPLEQ_EMPTY(&tsb->tsb_freeq) || tdb->tdb_nfree == 0) {
DPRINTF(sc, RTW_DEBUG_XMIT,
("%s: out of descriptors\n", __func__));
ifp->if_flags |= IFF_OACTIVE;
@@ -2564,8 +2564,8 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txctl_blk **stcp,
}
}
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: leave\n", __func__));
- *stcp = stc;
- *htcp = htc;
+ *tsbp = tsb;
+ *tdbp = tdb;
*mp = m0;
return 0;
}
@@ -2585,8 +2585,8 @@ rtw_seg_too_short(bus_dmamap_t dmamap)
/* TBD factor with atw_start */
struct mbuf *
-rtw_dmamap_load_txbuf(bus_dma_tag_t dmat, bus_dmamap_t dmam, struct mbuf *chain,
- u_int ndescfree, short *ifflagsp, const char *dvname)
+rtw_dmamap_load_txsoft(bus_dma_tag_t dmat, bus_dmamap_t dmam,
+ struct mbuf *chain, u_int ndescfree, short *ifflagsp, const char *dvname)
{
int first, rc;
struct mbuf *m, *m0;
@@ -2647,15 +2647,15 @@ rtw_dmamap_load_txbuf(bus_dma_tag_t dmat, bus_dmamap_t dmam, struct mbuf *chain,
#ifdef RTW_DEBUG
void
rtw_print_txdesc(struct rtw_softc *sc, const char *action,
- struct rtw_txctl *stx, struct rtw_txdesc_blk *htc, int desc)
+ struct rtw_txsoft *ts, struct rtw_txdesc_blk *tdb, int desc)
{
- struct rtw_txdesc *htx = &htc->htc_desc[desc];
+ struct rtw_txdesc *td = &tdb->tdb_desc[desc];
DPRINTF(sc, RTW_DEBUG_XMIT_DESC, ("%s: %p %s txdesc[%d] ctl0 %#08x "
"ctl1 %#08x buf %#08x len %#08x\n",
- sc->sc_dev.dv_xname, stx, action, desc,
- letoh32(htx->htx_ctl0),
- letoh32(htx->htx_ctl1), letoh32(htx->htx_buf),
- letoh32(htx->htx_len)));
+ sc->sc_dev.dv_xname, ts, action, desc,
+ letoh32(td->td_ctl0),
+ letoh32(td->td_ctl1), letoh32(td->td_buf),
+ letoh32(td->td_len)));
}
#endif /* RTW_DEBUG */
@@ -2672,10 +2672,10 @@ rtw_start(struct ifnet *ifp)
struct ieee80211_node *ni;
struct mbuf *m0;
struct rtw_softc *sc;
- struct rtw_txctl_blk *stc;
- struct rtw_txdesc_blk *htc;
- struct rtw_txctl *stx;
- struct rtw_txdesc *htx;
+ struct rtw_txsoft_blk *tsb;
+ struct rtw_txdesc_blk *tdb;
+ struct rtw_txsoft *ts;
+ struct rtw_txdesc *td;
sc = (struct rtw_softc *)ifp->if_softc;
ic = &sc->sc_ic;
@@ -2705,16 +2705,16 @@ rtw_start(struct ifnet *ifp)
proto_ctl0 |= RTW_TXCTL0_SPLCP;
for (;;) {
- if (rtw_dequeue(ifp, &stc, &htc, &m0, &ni) == -1)
+ if (rtw_dequeue(ifp, &tsb, &tdb, &m0, &ni) == -1)
continue;
if (m0 == NULL)
break;
- stx = SIMPLEQ_FIRST(&stc->stc_freeq);
+ ts = SIMPLEQ_FIRST(&tsb->tsb_freeq);
- dmamap = stx->stx_dmamap;
+ dmamap = ts->ts_dmamap;
- m0 = rtw_dmamap_load_txbuf(sc->sc_dmat, dmamap, m0,
- htc->htc_nfree, &ifp->if_flags, sc->sc_dev.dv_xname);
+ m0 = rtw_dmamap_load_txsoft(sc->sc_dmat, dmamap, m0,
+ tdb->tdb_nfree, &ifp->if_flags, sc->sc_dev.dv_xname);
if (m0 == NULL || dmamap->dm_nsegs == 0) {
DPRINTF(sc, RTW_DEBUG_XMIT,
@@ -2738,7 +2738,7 @@ rtw_start(struct ifnet *ifp)
if (ieee80211_compute_duration(wh, m0->m_pkthdr.len,
ic->ic_flags, ic->ic_fragthreshold,
- rate, &stx->stx_d0, &stx->stx_dn, &npkt,
+ rate, &ts->ts_d0, &ts->ts_dn, &npkt,
(sc->sc_if.if_flags & (IFF_DEBUG|IFF_LINK2)) ==
(IFF_DEBUG|IFF_LINK2)) == -1) {
DPRINTF(sc, RTW_DEBUG_XMIT,
@@ -2750,7 +2750,7 @@ rtw_start(struct ifnet *ifp)
if (m0->m_pkthdr.len > ic->ic_rtsthreshold)
ctl0 |= RTW_TXCTL0_RTSEN;
- d0 = &stx->stx_d0;
+ d0 = &ts->ts_d0;
*(uint16_t*)wh->i_dur = htole16(d0->d_data_dur);
@@ -2762,71 +2762,71 @@ rtw_start(struct ifnet *ifp)
/* TBD fragmentation */
- stx->stx_first = htc->htc_next;
+ ts->ts_first = tdb->tdb_next;
rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap,
- htc, stx->stx_first, dmamap->dm_nsegs,
+ tdb, ts->ts_first, dmamap->dm_nsegs,
BUS_DMASYNC_PREWRITE);
- KASSERT(stx->stx_first < htc->htc_ndesc);
+ KASSERT(ts->ts_first < tdb->tdb_ndesc);
- for (i = 0, lastdesc = desc = stx->stx_first;
+ for (i = 0, lastdesc = desc = ts->ts_first;
i < dmamap->dm_nsegs;
- i++, desc = RTW_NEXT_IDX(htc, desc)) {
+ i++, desc = RTW_NEXT_IDX(tdb, desc)) {
if (dmamap->dm_segs[i].ds_len > RTW_TXLEN_LENGTH_MASK) {
DPRINTF(sc, RTW_DEBUG_XMIT_DESC,
("%s: seg too long\n", __func__));
goto post_load_err;
}
- htx = &htc->htc_desc[desc];
- htx->htx_ctl0 = htole32(ctl0);
+ td = &tdb->tdb_desc[desc];
+ td->td_ctl0 = htole32(ctl0);
if (i != 0)
- htx->htx_ctl0 |= htole32(RTW_TXCTL0_OWN);
- htx->htx_ctl1 = htole32(ctl1);
- htx->htx_buf = htole32(dmamap->dm_segs[i].ds_addr);
- htx->htx_len = htole32(dmamap->dm_segs[i].ds_len);
+ td->td_ctl0 |= htole32(RTW_TXCTL0_OWN);
+ td->td_ctl1 = htole32(ctl1);
+ td->td_buf = htole32(dmamap->dm_segs[i].ds_addr);
+ td->td_len = htole32(dmamap->dm_segs[i].ds_len);
lastdesc = desc;
#ifdef RTW_DEBUG
- rtw_print_txdesc(sc, "load", stx, htc, desc);
+ rtw_print_txdesc(sc, "load", ts, tdb, desc);
#endif /* RTW_DEBUG */
}
- KASSERT(desc < htc->htc_ndesc);
+ KASSERT(desc < tdb->tdb_ndesc);
- stx->stx_ni = ni;
- stx->stx_mbuf = m0;
- stx->stx_last = lastdesc;
- htc->htc_desc[stx->stx_last].htx_ctl0 |= htole32(RTW_TXCTL0_LS);
- htc->htc_desc[stx->stx_first].htx_ctl0 |=
+ ts->ts_ni = ni;
+ ts->ts_mbuf = m0;
+ ts->ts_last = lastdesc;
+ tdb->tdb_desc[ts->ts_last].td_ctl0 |= htole32(RTW_TXCTL0_LS);
+ tdb->tdb_desc[ts->ts_first].td_ctl0 |=
htole32(RTW_TXCTL0_FS);
#ifdef RTW_DEBUG
- rtw_print_txdesc(sc, "FS on", stx, htc, stx->stx_first);
- rtw_print_txdesc(sc, "LS on", stx, htc, stx->stx_last);
+ rtw_print_txdesc(sc, "FS on", ts, tdb, ts->ts_first);
+ rtw_print_txdesc(sc, "LS on", ts, tdb, ts->ts_last);
#endif /* RTW_DEBUG */
- htc->htc_nfree -= dmamap->dm_nsegs;
- htc->htc_next = desc;
+ tdb->tdb_nfree -= dmamap->dm_nsegs;
+ tdb->tdb_next = desc;
rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap,
- htc, stx->stx_first, dmamap->dm_nsegs,
+ tdb, ts->ts_first, dmamap->dm_nsegs,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
- htc->htc_desc[stx->stx_first].htx_ctl0 |=
+ tdb->tdb_desc[ts->ts_first].td_ctl0 |=
htole32(RTW_TXCTL0_OWN);
#ifdef RTW_DEBUG
- rtw_print_txdesc(sc, "OWN on", stx, htc, stx->stx_first);
+ rtw_print_txdesc(sc, "OWN on", ts, tdb, ts->ts_first);
#endif /* RTW_DEBUG */
rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap,
- htc, stx->stx_first, 1,
+ tdb, ts->ts_first, 1,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
- SIMPLEQ_REMOVE_HEAD(&stc->stc_freeq, stx_q);
- SIMPLEQ_INSERT_TAIL(&stc->stc_dirtyq, stx, stx_q);
+ SIMPLEQ_REMOVE_HEAD(&tsb->tsb_freeq, ts_q);
+ SIMPLEQ_INSERT_TAIL(&tsb->tsb_dirtyq, ts, ts_q);
- stc->stc_tx_timer = 5;
+ tsb->tsb_tx_timer = 5;
ifp->if_timer = 1;
tppoll = RTW_READ8(&sc->sc_regs, RTW_TPPOLL);
@@ -2851,7 +2851,7 @@ rtw_watchdog(struct ifnet *ifp)
{
int pri;
struct rtw_softc *sc;
- struct rtw_txctl_blk *stc;
+ struct rtw_txsoft_blk *tsb;
sc = ifp->if_softc;
@@ -2861,13 +2861,13 @@ rtw_watchdog(struct ifnet *ifp)
return;
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- stc = &sc->sc_txctl_blk[pri];
+ tsb = &sc->sc_txsoft_blk[pri];
- if (stc->stc_tx_timer == 0)
+ if (tsb->tsb_tx_timer == 0)
continue;
- if (--stc->stc_tx_timer == 0) {
- if (SIMPLEQ_EMPTY(&stc->stc_dirtyq))
+ if (--tsb->tsb_tx_timer == 0) {
+ if (SIMPLEQ_EMPTY(&tsb->tsb_dirtyq))
continue;
printf("%s: transmit timeout, priority %d\n",
ifp->if_xname, pri);
@@ -3234,40 +3234,40 @@ rtw_init_radiotap(struct rtw_softc *sc)
}
int
-rtw_txctl_blk_setup(struct rtw_txctl_blk *stc, u_int qlen)
+rtw_txsoft_blk_setup(struct rtw_txsoft_blk *tsb, u_int qlen)
{
- SIMPLEQ_INIT(&stc->stc_dirtyq);
- SIMPLEQ_INIT(&stc->stc_freeq);
- stc->stc_ndesc = qlen;
- stc->stc_desc = malloc(qlen * sizeof(*stc->stc_desc), M_DEVBUF,
+ SIMPLEQ_INIT(&tsb->tsb_dirtyq);
+ SIMPLEQ_INIT(&tsb->tsb_freeq);
+ tsb->tsb_ndesc = qlen;
+ tsb->tsb_desc = malloc(qlen * sizeof(*tsb->tsb_desc), M_DEVBUF,
M_NOWAIT);
- if (stc->stc_desc == NULL)
+ if (tsb->tsb_desc == NULL)
return ENOMEM;
return 0;
}
void
-rtw_txctl_blk_cleanup_all(struct rtw_softc *sc)
+rtw_txsoft_blk_cleanup_all(struct rtw_softc *sc)
{
int pri;
- struct rtw_txctl_blk *stc;
+ struct rtw_txsoft_blk *tsb;
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- stc = &sc->sc_txctl_blk[pri];
- free(stc->stc_desc, M_DEVBUF);
- stc->stc_desc = NULL;
+ tsb = &sc->sc_txsoft_blk[pri];
+ free(tsb->tsb_desc, M_DEVBUF);
+ tsb->tsb_desc = NULL;
}
}
int
-rtw_txctl_blk_setup_all(struct rtw_softc *sc)
+rtw_txsoft_blk_setup_all(struct rtw_softc *sc)
{
int pri, rc = 0;
int qlen[RTW_NTXPRI] =
{RTW_TXQLENLO, RTW_TXQLENMD, RTW_TXQLENHI, RTW_TXQLENBCN};
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- rc = rtw_txctl_blk_setup(&sc->sc_txctl_blk[pri], qlen[pri]);
+ rc = rtw_txsoft_blk_setup(&sc->sc_txsoft_blk[pri], qlen[pri]);
if (rc != 0)
break;
}
@@ -3275,18 +3275,18 @@ rtw_txctl_blk_setup_all(struct rtw_softc *sc)
}
void
-rtw_txdesc_blk_setup(struct rtw_txdesc_blk *htc, struct rtw_txdesc *desc,
+rtw_txdesc_blk_setup(struct rtw_txdesc_blk *tdb, struct rtw_txdesc *desc,
u_int ndesc, bus_addr_t ofs, bus_addr_t physbase)
{
- htc->htc_ndesc = ndesc;
- htc->htc_desc = desc;
- htc->htc_physbase = physbase;
- htc->htc_ofs = ofs;
+ tdb->tdb_ndesc = ndesc;
+ tdb->tdb_desc = desc;
+ tdb->tdb_physbase = physbase;
+ tdb->tdb_ofs = ofs;
- (void)memset(htc->htc_desc, 0,
- sizeof(htc->htc_desc[0]) * htc->htc_ndesc);
+ (void)memset(tdb->tdb_desc, 0,
+ sizeof(tdb->tdb_desc[0]) * tdb->tdb_ndesc);
- rtw_txdesc_blk_reset(htc);
+ rtw_txdesc_blk_reset(tdb);
}
void
@@ -3379,7 +3379,7 @@ rtw_check_phydelay(struct rtw_regs *regs, u_int32_t rcr0)
void
rtw_attach(struct rtw_softc *sc)
{
- struct rtw_txctl_blk *stc;
+ struct rtw_txsoft_blk *tsb;
int pri, rc;
#if 0
@@ -3453,7 +3453,7 @@ rtw_attach(struct rtw_softc *sc)
}
NEXT_ATTACH_STATE(sc, FINISH_DESCMAP_LOAD);
- if (rtw_txctl_blk_setup_all(sc) != 0)
+ if (rtw_txsoft_blk_setup_all(sc) != 0)
goto err;
NEXT_ATTACH_STATE(sc, FINISH_TXCTLBLK_SETUP);
@@ -3463,13 +3463,13 @@ rtw_attach(struct rtw_softc *sc)
sc->sc_rxdesc = &sc->sc_descs->hd_rx[0];
- rtw_rxctls_setup(&sc->sc_rxctl[0]);
+ rtw_rxsofts_setup(&sc->sc_rxsoft[0]);
for (pri = 0; pri < RTW_NTXPRI; pri++) {
- stc = &sc->sc_txctl_blk[pri];
+ tsb = &sc->sc_txsoft_blk[pri];
if ((rc = rtw_txdesc_dmamaps_create(sc->sc_dmat,
- &stc->stc_desc[0], stc->stc_ndesc)) != 0) {
+ &tsb->tsb_desc[0], tsb->tsb_ndesc)) != 0) {
printf("%s: could not load DMA map for "
"hw tx descriptors, error %d\n",
sc->sc_dev.dv_xname, rc);
@@ -3478,7 +3478,7 @@ rtw_attach(struct rtw_softc *sc)
}
NEXT_ATTACH_STATE(sc, FINISH_TXMAPS_CREATE);
- if ((rc = rtw_rxdesc_dmamaps_create(sc->sc_dmat, &sc->sc_rxctl[0],
+ if ((rc = rtw_rxdesc_dmamaps_create(sc->sc_dmat, &sc->sc_rxsoft[0],
RTW_RXQLEN)) != 0) {
printf("%s: could not load DMA map for hw rx descriptors, "
"error %d\n", sc->sc_dev.dv_xname, rc);
@@ -3621,19 +3621,19 @@ rtw_detach(struct rtw_softc *sc)
/*FALLTHROUGH*/
case FINISH_RESET:
case FINISH_RXMAPS_CREATE:
- rtw_rxdesc_dmamaps_destroy(sc->sc_dmat, &sc->sc_rxctl[0],
+ rtw_rxdesc_dmamaps_destroy(sc->sc_dmat, &sc->sc_rxsoft[0],
RTW_RXQLEN);
/*FALLTHROUGH*/
case FINISH_TXMAPS_CREATE:
for (pri = 0; pri < RTW_NTXPRI; pri++) {
rtw_txdesc_dmamaps_destroy(sc->sc_dmat,
- sc->sc_txctl_blk[pri].stc_desc,
- sc->sc_txctl_blk[pri].stc_ndesc);
+ sc->sc_txsoft_blk[pri].tsb_desc,
+ sc->sc_txsoft_blk[pri].tsb_ndesc);
}
/*FALLTHROUGH*/
case FINISH_TXDESCBLK_SETUP:
case FINISH_TXCTLBLK_SETUP:
- rtw_txctl_blk_cleanup_all(sc);
+ rtw_txsoft_blk_cleanup_all(sc);
/*FALLTHROUGH*/
case FINISH_DESCMAP_LOAD:
bus_dmamap_unload(sc->sc_dmat, sc->sc_desc_dmamap);
diff --git a/sys/dev/ic/rtwreg.h b/sys/dev/ic/rtwreg.h
index 7a6857b1c2d..6d4ae58c6a6 100644
--- a/sys/dev/ic/rtwreg.h
+++ b/sys/dev/ic/rtwreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtwreg.h,v 1.2 2004/12/30 06:40:03 jsg Exp $ */
+/* $OpenBSD: rtwreg.h,v 1.3 2005/01/22 10:14:25 jsg Exp $ */
/* $NetBSD: rtwreg.h,v 1.4 2004/12/21 09:07:23 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
@@ -845,15 +845,15 @@
/* Tx descriptor */
struct rtw_txdesc {
- u_int32_t htx_ctl0;
- u_int32_t htx_ctl1;
- u_int32_t htx_buf;
- u_int32_t htx_len;
- u_int32_t htx_next;
- u_int32_t htx_rsvd[3];
+ u_int32_t td_ctl0;
+ u_int32_t td_ctl1;
+ u_int32_t td_buf;
+ u_int32_t td_len;
+ u_int32_t td_next;
+ u_int32_t td_rsvd[3];
};
-#define htx_stat htx_ctl0
+#define td_stat td_ctl0
#define RTW_TXCTL0_OWN BIT(31) /* 1: ready to Tx */
#define RTW_TXCTL0_RSVD0 BIT(30) /* reserved */
@@ -907,16 +907,16 @@ struct rtw_txdesc {
/* Rx descriptor */
struct rtw_rxdesc {
- u_int32_t hrx_ctl;
- u_int32_t hrx_rsvd0;
- u_int32_t hrx_buf;
- u_int32_t hrx_rsvd1;
+ u_int32_t rd_ctl;
+ u_int32_t rd_rsvd0;
+ u_int32_t rd_buf;
+ u_int32_t rd_rsvd1;
};
-#define hrx_stat hrx_ctl
-#define hrx_rssi hrx_rsvd0
-#define hrx_tsftl hrx_buf /* valid only when RTW_RXSTAT_LS is set */
-#define hrx_tsfth hrx_rsvd1 /* valid only when RTW_RXSTAT_LS is set */
+#define rd_stat rd_ctl
+#define rd_rssi rd_rsvd0
+#define rd_tsftl rd_buf /* valid only when RTW_RXSTAT_LS is set */
+#define rd_tsfth rd_rsvd1 /* valid only when RTW_RXSTAT_LS is set */
#define RTW_RXCTL_OWN BIT(31) /* 1: owned by NIC */
#define RTW_RXCTL_EOR BIT(30) /* end of ring */
diff --git a/sys/dev/ic/rtwvar.h b/sys/dev/ic/rtwvar.h
index d0d0b550563..4844256112b 100644
--- a/sys/dev/ic/rtwvar.h
+++ b/sys/dev/ic/rtwvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtwvar.h,v 1.3 2005/01/19 11:07:33 jsg Exp $ */
+/* $OpenBSD: rtwvar.h,v 1.4 2005/01/22 10:14:25 jsg Exp $ */
/* $NetBSD: rtwvar.h,v 1.10 2004/12/26 22:37:57 mycroft Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
@@ -124,20 +124,20 @@ struct rtw_srom {
u_int16_t sr_size;
};
-struct rtw_rxctl {
- struct mbuf *srx_mbuf;
- bus_dmamap_t srx_dmamap;
+struct rtw_rxsoft {
+ struct mbuf *rs_mbuf;
+ bus_dmamap_t rs_dmamap;
};
-struct rtw_txctl {
- SIMPLEQ_ENTRY(rtw_txctl) stx_q;
- struct mbuf *stx_mbuf;
- bus_dmamap_t stx_dmamap;
- struct ieee80211_node *stx_ni; /* destination node */
- u_int stx_first; /* 1st hw descriptor */
- u_int stx_last; /* last hw descriptor */
- struct ieee80211_duration stx_d0;
- struct ieee80211_duration stx_dn;
+struct rtw_txsoft {
+ SIMPLEQ_ENTRY(rtw_txsoft) ts_q;
+ struct mbuf *ts_mbuf;
+ bus_dmamap_t ts_dmamap;
+ struct ieee80211_node *ts_ni; /* destination node */
+ u_int ts_first; /* 1st hw descriptor */
+ u_int ts_last; /* last hw descriptor */
+ struct ieee80211_duration ts_d0;
+ struct ieee80211_duration ts_dn;
};
#define RTW_NTXPRI 4 /* number of Tx priorities */
@@ -170,29 +170,29 @@ struct rtw_txctl {
#define RTW_RXQLEN 64
struct rtw_txdesc_blk {
- u_int htc_ndesc;
- u_int htc_next;
- u_int htc_nfree;
- bus_addr_t htc_physbase;
- bus_addr_t htc_ofs;
- struct rtw_txdesc *htc_desc;
+ u_int tdb_ndesc;
+ u_int tdb_next;
+ u_int tdb_nfree;
+ bus_addr_t tdb_physbase;
+ bus_addr_t tdb_ofs;
+ struct rtw_txdesc *tdb_desc;
};
-#define RTW_NEXT_IDX(__htc, __idx) (((__idx) + 1) % (__htc)->htc_ndesc)
+#define RTW_NEXT_IDX(__htc, __idx) (((__idx) + 1) % (__htc)->tdb_ndesc)
#define RTW_NEXT_DESC(__htc, __idx) \
- ((__htc)->htc_physbase + \
+ ((__htc)->tdb_physbase + \
sizeof(struct rtw_txdesc) * RTW_NEXT_IDX((__htc), (__idx)))
-SIMPLEQ_HEAD(rtw_txq, rtw_txctl);
+SIMPLEQ_HEAD(rtw_txq, rtw_txsoft);
-struct rtw_txctl_blk {
+struct rtw_txsoft_blk {
/* dirty/free s/w descriptors */
- struct rtw_txq stc_dirtyq;
- struct rtw_txq stc_freeq;
- u_int stc_ndesc;
- int stc_tx_timer;
- struct rtw_txctl *stc_desc;
+ struct rtw_txq tsb_dirtyq;
+ struct rtw_txq tsb_freeq;
+ u_int tsb_ndesc;
+ int tsb_tx_timer;
+ struct rtw_txsoft *tsb_desc;
};
struct rtw_descs {
@@ -347,8 +347,8 @@ struct rtw_softc {
u_int8_t sc_phydelay;
/* s/w Tx/Rx descriptors */
- struct rtw_txctl_blk sc_txctl_blk[RTW_NTXPRI];
- struct rtw_rxctl sc_rxctl[RTW_RXQLEN];
+ struct rtw_txsoft_blk sc_txsoft_blk[RTW_NTXPRI];
+ struct rtw_rxsoft sc_rxsoft[RTW_RXQLEN];
u_int sc_txq;
u_int sc_txnext;