[Zrouter-src-freebsd] [rt2860-in-ral] 2 new revisions pushed by bschm... at techwires.net on 2012-03-14 11:46 GMT
rt2860-in-ral at googlecode.com
rt2860-in-ral at googlecode.com
Wed Mar 14 11:46:47 UTC 2012
2 new revisions:
Revision: 4c210c3881bd
Author: Bernhard Schmidt <bschmidt at techwires.net>
Date: Wed Mar 14 04:43:04 2012
Log: shuffle some structs around
http://code.google.com/p/rt2860-in-ral/source/detail?r=4c210c3881bd
Revision: 7bba8ac6d729
Author: Bernhard Schmidt <bschmidt at techwires.net>
Date: Wed Mar 14 04:46:02 2012
Log: merge
http://code.google.com/p/rt2860-in-ral/source/detail?r=7bba8ac6d729
==============================================================================
Revision: 4c210c3881bd
Author: Bernhard Schmidt <bschmidt at techwires.net>
Date: Wed Mar 14 04:43:04 2012
Log: shuffle some structs around
http://code.google.com/p/rt2860-in-ral/source/detail?r=4c210c3881bd
Modified:
/sys/dev/ral/rt2860.c
/sys/dev/ral/rt2860reg.h
/sys/dev/ral/rt2860var.h
=======================================
--- /sys/dev/ral/rt2860.c Wed Mar 14 02:42:49 2012
+++ /sys/dev/ral/rt2860.c Wed Mar 14 04:43:04 2012
@@ -16,10 +16,38 @@
*/
#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/sockio.h>
+#include <sys/mbuf.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/taskqueue.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
#include <sys/firmware.h>
-#include <dev/ral/rt2860var.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
+
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_input.h>
+#include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211_regdomain.h>
+
#include <dev/ral/rt2860reg.h>
+#include <dev/ral/rt2860var.h>
/*
* Defines and macros
@@ -177,7 +205,7 @@
static void rt2860_asic_updateslot(struct rt2860_softc *sc);
static void rt2860_asic_wme_update(struct rt2860_softc *sc);
static void rt2860_asic_update_beacon(struct rt2860_softc *sc,
- struct ieee80211vap *vap);
+ struct ieee80211vap *, struct rt2860_txwi *);
static void rt2860_asic_clear_keytables(struct rt2860_softc *sc);
static void rt2860_asic_add_ba_session(struct rt2860_softc *sc,
uint8_t wcid, int tid);
@@ -1919,8 +1947,6 @@
error = rt2860_beacon_alloc(sc, vap);
if (error != 0)
break;
-
- rt2860_asic_update_beacon(sc, vap);
}
if (vap->iv_opmode != IEEE80211_M_MONITOR)
@@ -2252,8 +2278,6 @@
}
ieee80211_beacon_update(vap->iv_bss, bo, m, 0);
-
- rt2860_asic_update_beacon(sc, vap);
}
/*
@@ -3717,17 +3741,15 @@
* rt2860_asic_update_beacon
*/
static void rt2860_asic_update_beacon(struct rt2860_softc *sc,
- struct ieee80211vap *vap)
+ struct ieee80211vap *vap, struct rt2860_txwi *txwi)
{
struct rt2860_softc_vap *rvap;
struct mbuf *m;
- struct rt2860_txwi *txwi;
uint32_t tmp;
rvap = (struct rt2860_softc_vap *) vap;
m = rvap->beacon_mbuf;
- txwi = &rvap->beacon_txwi;
/* disable temporarily TSF sync */
@@ -3860,27 +3882,21 @@
memset(&txwi, 0, sizeof(struct rt2860_txwi));
txwi.wcid = RT2860_WCID_RESERVED;
- txwi.pid_mpdu_len = ((htole16(m->m_pkthdr.len) &
RT2860_TXWI_MPDU_LEN_MASK) <<
- RT2860_TXWI_MPDU_LEN_SHIFT);
- txwi.txop = (RT2860_TXWI_TXOP_HT << RT2860_TXWI_TXOP_SHIFT);
- txwi.mpdu_density_flags |=
- (RT2860_TXWI_FLAGS_TS << RT2860_TXWI_FLAGS_SHIFT);
- txwi.bawin_size_xflags |=
- (RT2860_TXWI_XFLAGS_NSEQ << RT2860_TXWI_XFLAGS_SHIFT);
+ txwi.len = htole16(m->m_pkthdr.len);
+ txwi.txop = RT2860_TX_TXOP_HT;
+ txwi.flags |= RT2860_TX_TS;
+ txwi.xflags |= RT2860_TX_NSEQ;
if (rate == 2) {
- txwi.phymode_ifs_stbc_shortgi =
- (RT2860_TXWI_PHYMODE_CCK << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi.phy = RT2860_PHY_CCK;
if (rate != 2 && (ic->ic_flags & IEEE80211_F_SHPREAMBLE))
- mcs |= RT2860_TXWI_MCS_SHOTPRE;
+ mcs |= RT2860_PHY_SHPRE;
} else {
- txwi.phymode_ifs_stbc_shortgi =
- (RT2860_TXWI_PHYMODE_OFDM << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi.phy = RT2860_PHY_OFDM;
}
- txwi.bw_mcs = (RT2860_TXWI_BW_20 << RT2860_TXWI_BW_SHIFT) |
- ((mcs & RT2860_TXWI_MCS_MASK) << RT2860_TXWI_MCS_SHIFT);
+ txwi.phy |= (mcs & RT2860_PHY_MCS);
if (rvap->beacon_mbuf != NULL) {
m_free(rvap->beacon_mbuf);
@@ -3888,7 +3904,8 @@
}
rvap->beacon_mbuf = m;
- rvap->beacon_txwi = txwi;
+
+ rt2860_asic_update_beacon(sc, vap, &txwi);
return 0;
}
@@ -4035,7 +4052,7 @@
struct rt2860_softc_node *rni;
struct rt2860_softc_tx_ring *ring;
struct rt2860_softc_tx_data *data;
- struct rt2860_txdesc *desc;
+ struct rt2860_txd *desc;
struct rt2860_txwi *txwi;
struct ieee80211_frame *wh;
struct rt2860_softc_tx_radiotap_header *tap;
@@ -4093,8 +4110,7 @@
if (mcs > 7) {
if (ni->ni_flags & IEEE80211_NODE_MIMO_RTS) {
/* dynamic MIMO power save */
- txwi->mpdu_density_flags |=
- (RT2860_TXWI_FLAGS_MIMOPS << RT2860_TXWI_FLAGS_SHIFT);
+ txwi->flags |= RT2860_TX_MMPS;
} else {
/* static MIMO power save */
@@ -4107,38 +4123,30 @@
mimops = 0;
}
- pid = (mcs < 0xf) ? (mcs + 1) : mcs;
-
- txwi->pid_mpdu_len = ((htole16(pid) & RT2860_TXWI_PID_MASK) <<
- RT2860_TXWI_PID_SHIFT) | ((htole16(mpdu_len) &
RT2860_TXWI_MPDU_LEN_MASK) <<
- RT2860_TXWI_MPDU_LEN_SHIFT);
-
+ pid = ((mcs < 0xf) ? (mcs + 1) : mcs) & 0xf;
+
+ txwi->len = (htole16(pid) << RT2860_TX_PID_SHIFT) | htole16(mpdu_len);
if (ni->ni_flags & IEEE80211_NODE_HT) {
- txwi->phymode_ifs_stbc_shortgi |=
- (RT2860_TXWI_PHYMODE_HT_MIXED << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi->phy |= RT2860_PHY_HT;
} else {
if (ieee80211_rate2phytype(ic->ic_rt, rate) != IEEE80211_T_OFDM) {
- txwi->phymode_ifs_stbc_shortgi |=
- (RT2860_TXWI_PHYMODE_CCK << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi->phy |= RT2860_PHY_CCK;
if (rate != 2 && (ic->ic_flags & IEEE80211_F_SHPREAMBLE))
- mcs |= RT2860_TXWI_MCS_SHOTPRE;
+ mcs |= RT2860_PHY_SHPRE;
} else {
- txwi->phymode_ifs_stbc_shortgi |=
- (RT2860_TXWI_PHYMODE_OFDM << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi->phy |= RT2860_PHY_OFDM;
}
}
- txwi->bw_mcs = (RT2860_TXWI_BW_20 << RT2860_TXWI_BW_SHIFT) |
- ((mcs & RT2860_TXWI_MCS_MASK) << RT2860_TXWI_MCS_SHIFT);
-
- txwi->txop = (RT2860_TXWI_TXOP_BACKOFF << RT2860_TXWI_TXOP_SHIFT);
+ txwi->phy |= (mcs & RT2860_PHY_MCS);
+
+ txwi->txop = RT2860_TX_TXOP_BACKOFF;
/* skip ACKs for multicast frames */
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
- txwi->bawin_size_xflags |=
- (RT2860_TXWI_XFLAGS_ACK << RT2860_TXWI_XFLAGS_SHIFT);
+ txwi->xflags |= RT2860_TX_ACK;
if (ni->ni_flags & IEEE80211_NODE_HT) {
/* preamble + plcp + signal extension + SIFS */
@@ -4156,8 +4164,7 @@
if ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK |
IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
- txwi->mpdu_density_flags |=
- (RT2860_TXWI_FLAGS_TS << RT2860_TXWI_FLAGS_SHIFT);
+ txwi->flags |= RT2860_TX_TS;
if (ieee80211_radiotap_active_vap(vap)) {
tap = &sc->txtap;
@@ -4173,7 +4180,7 @@
else
tap->rate = rate;
- if (mcs & RT2860_TXWI_MCS_SHOTPRE)
+ if (mcs & RT2860_PHY_SHPRE)
tap->flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
if (wh->i_fc[1] & IEEE80211_FC1_WEP)
@@ -4258,11 +4265,11 @@
memset((caddr_t) txwi + len, 0, dmalen - len);
- qsel = RT2860_TXDESC_QSEL_EDCA;
+ qsel = RT2860_TX_QSEL_EDCA;
desc->sdp0 = htole32(ring->seg0_phys_addr + ring->data_cur *
RT2860_TX_DATA_SEG0_SIZE);
desc->sdl0 = htole16(dmalen);
- desc->qsel_flags = (qsel << RT2860_TXDESC_QSEL_SHIFT);
+ desc->flags = (qsel << RT2860_TX_QSEL_SHIFT);
/* set up payload segments */
@@ -4279,7 +4286,7 @@
desc->sdp0 = htole32(dma_seg[j].ds_addr);
desc->sdl0 = htole16(dma_seg[j].ds_len);
- desc->qsel_flags = (qsel << RT2860_TXDESC_QSEL_SHIFT);
+ desc->flags = (qsel << RT2860_TX_QSEL_SHIFT);
j++;
}
@@ -4288,9 +4295,9 @@
if (i > 0) {
desc->sdp1 = htole32(dma_seg[j].ds_addr);
- desc->sdl1 = htole16(dma_seg[j].ds_len | RT2860_TXDESC_SDL1_LASTSEG);
+ desc->sdl1 = htole16(dma_seg[j].ds_len | RT2860_TX_LS1);
} else {
- desc->sdl0 |= htole16(RT2860_TXDESC_SDL0_LASTSEG);
+ desc->sdl0 |= htole16(RT2860_TX_LS0);
desc->sdl1 = 0;
}
@@ -4335,7 +4342,7 @@
struct rt2860_softc_node *rni;
struct rt2860_softc_tx_ring *ring;
struct rt2860_softc_tx_data *data;
- struct rt2860_txdesc *desc;
+ struct rt2860_txd *desc;
struct rt2860_txwi *txwi;
struct ieee80211_frame *wh;
struct ieee80211_tx_ampdu *tx_ampdu;
@@ -4343,7 +4350,7 @@
struct rt2860_softc_tx_radiotap_header *tap;
bus_dma_segment_t dma_seg[RT2860_SOFTC_MAX_SCATTER];
u_int hdrsize, hdrspace;
- uint8_t type, rate, bw, stbc, shortgi, mcs, pid, wcid, mpdu_density,
bawin_size, qsel;
+ uint8_t type, rate, stbc, shortgi, mcs, pid, wcid, mpdu_density,
bawin_size, qsel;
uint16_t qos, len, dmalen, mpdu_len, dur;
int error, hasqos, ac, tid, ampdu, mimops, ndmasegs, ndescs, i, j;
@@ -4423,8 +4430,7 @@
if (ni->ni_flags & IEEE80211_NODE_MIMO_RTS) {
/* dynamic MIMO power save */
- txwi->mpdu_density_flags |=
- (RT2860_TXWI_FLAGS_MIMOPS << RT2860_TXWI_FLAGS_SHIFT);
+ txwi->flags |= RT2860_TX_MMPS;
} else {
/* static MIMO power save */
@@ -4437,11 +4443,9 @@
mimops = 0;
}
- pid = (mcs < 0xf) ? (mcs + 1) : mcs;
-
- txwi->pid_mpdu_len = ((htole16(pid) & RT2860_TXWI_PID_MASK) <<
- RT2860_TXWI_PID_SHIFT) | ((htole16(mpdu_len) &
RT2860_TXWI_MPDU_LEN_MASK) <<
- RT2860_TXWI_MPDU_LEN_SHIFT);
+ pid = ((mcs < 0xf) ? (mcs + 1) : mcs) & 0xf;
+
+ txwi->len = (htole16(pid) << RT2860_TX_PID_SHIFT) | htole16(mpdu_len);
stbc = sc->tx_stbc && (mcs <= 7) && (vap->iv_htcaps &
IEEE80211_HTCAP_TXSTBC) &&
(ni->ni_flags & IEEE80211_NODE_HT) && (ni->ni_htcap &
IEEE80211_HTCAP_RXSTBC);
@@ -4449,41 +4453,33 @@
shortgi = ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) && (ni->ni_flags
& IEEE80211_NODE_SGI20) && (ni->ni_chw == 20)) ||
((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40) && (ni->ni_flags &
IEEE80211_NODE_SGI40) && (ni->ni_chw == 40));
- txwi->phymode_ifs_stbc_shortgi |=
- ((stbc & RT2860_TXWI_STBC_MASK) << RT2860_TXWI_STBC_SHIFT) |
- ((shortgi & RT2860_TXWI_SHORTGI_MASK) << RT2860_TXWI_SHORTGI_SHIFT);
+ txwi->phy |= (stbc << RT2860_PHY_STBC);
+ if (shortgi)
+ txwi->phy |= RT2860_PHY_SGI;
if (ni->ni_flags & IEEE80211_NODE_HT) {
- txwi->phymode_ifs_stbc_shortgi |=
- (RT2860_TXWI_PHYMODE_HT_MIXED << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi->phy |= RT2860_PHY_HT;
} else {
if (ieee80211_rate2phytype(ic->ic_rt, rate) != IEEE80211_T_OFDM) {
- txwi->phymode_ifs_stbc_shortgi |=
- (RT2860_TXWI_PHYMODE_CCK << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi->phy |= RT2860_PHY_CCK;
if (rate != 2 && (ic->ic_flags & IEEE80211_F_SHPREAMBLE))
- mcs |= RT2860_TXWI_MCS_SHOTPRE;
+ mcs |= RT2860_PHY_SHPRE;
} else {
- txwi->phymode_ifs_stbc_shortgi |=
- (RT2860_TXWI_PHYMODE_OFDM << RT2860_TXWI_PHYMODE_SHIFT);
+ txwi->phy |= RT2860_PHY_OFDM;
}
}
if ((ni->ni_flags & IEEE80211_NODE_HT) && (ni->ni_chw == 40))
- bw = RT2860_TXWI_BW_40;
- else
- bw = RT2860_TXWI_BW_20;
-
- txwi->bw_mcs = ((bw & RT2860_TXWI_BW_MASK) << RT2860_TXWI_BW_SHIFT) |
- ((mcs & RT2860_TXWI_MCS_MASK) << RT2860_TXWI_MCS_SHIFT);
-
- txwi->txop = (RT2860_TXWI_TXOP_HT << RT2860_TXWI_TXOP_SHIFT);
+ txwi->phy |= RT2860_PHY_BW40;
+ txwi->phy |= (mcs & RT2860_PHY_MCS);
+
+ txwi->txop = RT2860_TX_TXOP_HT;
if (!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
(!hasqos || (qos & IEEE80211_QOS_ACKPOLICY) !=
IEEE80211_QOS_ACKPOLICY_NOACK)) {
- txwi->bawin_size_xflags |=
- (RT2860_TXWI_XFLAGS_ACK << RT2860_TXWI_XFLAGS_SHIFT);
+ txwi->xflags |= RT2860_TX_ACK;
if (ni->ni_flags & IEEE80211_NODE_HT) {
/* preamble + plcp + signal extension + SIFS */
@@ -4505,12 +4501,11 @@
mpdu_density = RT2860_MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
bawin_size = tx_ampdu->txa_wnd;
- txwi->mpdu_density_flags |=
- ((mpdu_density & RT2860_TXWI_MPDU_DENSITY_MASK) <<
RT2860_TXWI_MPDU_DENSITY_SHIFT) |
- (RT2860_TXWI_FLAGS_AMPDU << RT2860_TXWI_FLAGS_SHIFT);
-
- txwi->bawin_size_xflags |=
- ((bawin_size & RT2860_TXWI_BAWIN_SIZE_MASK) <<
RT2860_TXWI_BAWIN_SIZE_SHIFT);
+ txwi->flags |=
+ (mpdu_density << RT2860_TX_MPDU_DSITY_SHIFT) | RT2860_TX_AMPDU;
+
+ txwi->xflags |=
+ (bawin_size << RT2860_TX_BAWINSIZE_SHIFT);
seqno = ni->ni_txseqs[tid]++;
@@ -4527,8 +4522,7 @@
if ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK |
IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
- txwi->mpdu_density_flags |=
- (RT2860_TXWI_FLAGS_TS << RT2860_TXWI_FLAGS_SHIFT);
+ txwi->flags |= RT2860_TX_TS;
if (ieee80211_radiotap_active_vap(vap)) {
tap = &sc->txtap;
@@ -4544,7 +4538,7 @@
else
tap->rate = rate;
- if (mcs & RT2860_TXWI_MCS_SHOTPRE)
+ if (mcs & RT2860_PHY_SHPRE)
tap->flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
if (shortgi)
@@ -4636,12 +4630,12 @@
memset((caddr_t) txwi + len, 0, dmalen - len);
- qsel = RT2860_TXDESC_QSEL_EDCA;
+ qsel = RT2860_TX_QSEL_EDCA;
desc->sdp0 = htole32(ring->seg0_phys_addr + ring->data_cur *
RT2860_TX_DATA_SEG0_SIZE);
desc->sdl0 = htole16(dmalen);
- desc->qsel_flags = (qsel << RT2860_TXDESC_QSEL_SHIFT);
+ desc->flags = (qsel << RT2860_TX_QSEL_SHIFT);
/* set up payload segments */
@@ -4659,7 +4653,7 @@
desc->sdp0 = htole32(dma_seg[j].ds_addr);
desc->sdl0 = htole16(dma_seg[j].ds_len);
- desc->qsel_flags = (qsel << RT2860_TXDESC_QSEL_SHIFT);
+ desc->flags = (qsel << RT2860_TX_QSEL_SHIFT);
j++;
}
@@ -4668,10 +4662,9 @@
if (i > 0) {
desc->sdp1 = htole32(dma_seg[j].ds_addr);
- desc->sdl1 = htole16(dma_seg[j].ds_len |
- RT2860_TXDESC_SDL1_LASTSEG);
+ desc->sdl1 = htole16(dma_seg[j].ds_len | RT2860_TX_LS1);
} else {
- desc->sdl0 |= htole16(RT2860_TXDESC_SDL0_LASTSEG);
+ desc->sdl0 |= htole16(RT2860_TX_LS0);
desc->sdl1 = 0;
}
@@ -5213,7 +5206,7 @@
struct rt2860_softc_node *rni;
struct rt2860_softc_rx_radiotap_header *tap;
struct rt2860_softc_rx_ring *ring;
- struct rt2860_rxdesc *desc;
+ struct rt2860_rxd *desc;
struct rt2860_softc_rx_data *data;
struct rt2860_rxwi *rxwi;
struct mbuf *m, *mnew;
@@ -5245,7 +5238,7 @@
bus_dmamap_sync(ring->desc_dma_tag, ring->desc_dma_map,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
#ifdef XXX_TESTED_AND_WORKED
- if (!(desc->sdl0 & htole16(RT2860_RXDESC_SDL0_DDONE)))
+ if (!(desc->sdl0 & htole16(RT2860_RX_DDONE)))
break;
#endif
@@ -5303,12 +5296,12 @@
/* get Rx wireless info */
rxwi = mtod(m, struct rt2860_rxwi *);
- len = (le16toh(rxwi->tid_size) >> RT2860_RXWI_SIZE_SHIFT) &
+ len = (le16toh(rxwi->len) >> RT2860_RXWI_SIZE_SHIFT) &
RT2860_RXWI_SIZE_MASK;
/* check for L2 padding between IEEE 802.11 frame header and body */
- if (desc_flags & RT2860_RXDESC_FLAGS_L2PAD) {
+ if (desc_flags & RT2860_RX_L2PAD) {
RT2860_DPRINTF(sc, RT2860_DEBUG_RX,
"%s: L2 padding: len=%d\n",
device_get_nameunit(sc->sc_dev), len);
@@ -5322,7 +5315,7 @@
/* check for crc errors */
- if (desc_flags & RT2860_RXDESC_FLAGS_CRC_ERR) {
+ if (desc_flags & RT2860_RX_CRCERR) {
RT2860_DPRINTF(sc, RT2860_DEBUG_RX,
"%s: rxdesc: crc error\n",
device_get_nameunit(sc->sc_dev));
@@ -5339,12 +5332,12 @@
/* check for cipher errors */
#ifndef RT2860_NO_HW_CRYPTO
- if (desc_flags & RT2860_RXDESC_FLAGS_DECRYPTED) {
+ if (desc_flags & RT2860_RX_DEC) {
cipher_err = ((desc_flags >>
- RT2860_RXDESC_FLAGS_CIPHER_ERR_SHIFT) &
- RT2860_RXDESC_FLAGS_CIPHER_ERR_MASK);
+ RT2860_RX_CIPHER_ERR_SHIFT) &
+ RT2860_RX_CIPHER_ERR_MASK);
if (cipher_err ==
- RT2860_RXDESC_FLAGS_CIPHER_ERR_NONE) {
+ RT2860_RX_CIPHER_ERR_NONE) {
if (wh->i_fc[1] & IEEE80211_FC1_WEP)
wh->i_fc[1] &= ~IEEE80211_FC1_WEP;
@@ -5357,26 +5350,26 @@
"keyidx=%d\n",
device_get_nameunit(sc->sc_dev),
cipher_err,
- (rxwi->udf_bssidx_keyidx >>
+ (rxwi->keyidx >>
RT2860_RXWI_KEYIDX_SHIFT) &
RT2860_RXWI_KEYIDX_MASK);
if (cipher_err ==
- RT2860_RXDESC_FLAGS_CIPHER_ERR_ICV)
+ RT2860_RX_CIPHER_ERR_ICV)
sc->rx_cipher_icv_errors++;
else if (cipher_err ==
- RT2860_RXDESC_FLAGS_CIPHER_ERR_MIC)
+ RT2860_RX_CIPHER_ERR_MIC)
sc->rx_cipher_mic_errors++;
else if (cipher_err ==
- RT2860_RXDESC_FLAGS_CIPHER_ERR_INVALID_KEY)
+ RT2860_RX_CIPHER_ERR_INVALID_KEY)
sc->rx_cipher_invalid_key_errors++;
/* XXX style(9) */
- if ((cipher_err == RT2860_RXDESC_FLAGS_CIPHER_ERR_MIC) && (desc_flags
& RT2860_RXDESC_FLAGS_MYBSS)) {
+ if ((cipher_err == RT2860_RX_CIPHER_ERR_MIC) && (desc_flags &
RT2860_RX_MYBSS)) {
ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *)
wh);
if (ni != NULL)
{
- keyidx = (rxwi->udf_bssidx_keyidx >> RT2860_RXWI_KEYIDX_SHIFT) &
RT2860_RXWI_KEYIDX_MASK;
+ keyidx = (rxwi->keyidx >> RT2860_RXWI_KEYIDX_SHIFT) &
RT2860_RXWI_KEYIDX_MASK;
ieee80211_notify_michael_failure(ni->ni_vap, wh, keyidx);
@@ -5409,7 +5402,7 @@
#endif
/* check for A-MPDU */
- if (desc_flags & RT2860_RXDESC_FLAGS_BA) {
+ if (desc_flags & RT2860_RX_BA) {
m->m_flags |= M_AMPDU;
sc->rx_ampdu++;
@@ -5424,7 +5417,7 @@
/* check for A-MSDU */
- if (desc_flags & RT2860_RXDESC_FLAGS_AMSDU) {
+ if (desc_flags & RT2860_RX_AMSDU) {
sc->rx_amsdu++;
amsdu = 1;
@@ -5435,22 +5428,21 @@
ant = rt2860_maxrssi_rxpath(sc, rxwi);
rssi = rxwi->rssi[ant];
rssi_dbm = rt2860_rssi2dbm(sc, rssi, ant);
- phymode = ((rxwi->phymode_stbc_shortgi >> RT2860_RXWI_PHYMODE_SHIFT) &
- RT2860_RXWI_PHYMODE_MASK);
+ phymode = ((rxwi->phymode_stbc_shortgi >> RT2860_RXWI_PHYMODE_SHIFT) &
RT2860_RXWI_PHYMODE_MASK);
bw = ((rxwi->bw_mcs >> RT2860_RXWI_BW_SHIFT) & RT2860_RXWI_BW_MASK);
shortgi = ((rxwi->phymode_stbc_shortgi >> RT2860_RXWI_SHORTGI_SHIFT) &
RT2860_RXWI_SHORTGI_MASK);
stbc = ((rxwi->phymode_stbc_shortgi >> RT2860_RXWI_STBC_SHIFT) &
RT2860_RXWI_STBC_MASK);
mcs = ((rxwi->bw_mcs >> RT2860_RXWI_MCS_SHIFT) & RT2860_RXWI_MCS_MASK);
- tid = ((rxwi->tid_size >> RT2860_RXWI_TID_SHIFT) & RT2860_RXWI_TID_MASK);
- seq = ((rxwi->seq_frag >> RT2860_RXWI_SEQ_SHIFT) & RT2860_RXWI_SEQ_MASK);
- frag = ((rxwi->seq_frag >> RT2860_RXWI_FRAG_SHIFT) &
RT2860_RXWI_FRAG_MASK);
+ tid = ((rxwi->len >> RT2860_RX_TID_SHIFT) & RT2860_RXWI_TID_MASK);
+ seq = ((rxwi->seq >> RT2860_RXWI_SEQ_SHIFT) & RT2860_RXWI_SEQ_MASK);
+ frag = ((rxwi->seq >> RT2860_RXWI_FRAG_SHIFT) & RT2860_RXWI_FRAG_MASK);
if (ieee80211_radiotap_active(ic)) {
tap = &sc->rxtap;
- tap->flags = (desc_flags & RT2860_RXDESC_FLAGS_L2PAD) ?
IEEE80211_RADIOTAP_F_DATAPAD : 0;
+ tap->flags = (desc_flags & RT2860_RX_L2PAD) ?
IEEE80211_RADIOTAP_F_DATAPAD : 0;
tap->dbm_antsignal = rssi_dbm;
tap->dbm_antnoise = RT2860_NOISE_FLOOR;
tap->antenna = ant;
@@ -5460,21 +5452,21 @@
tap->chan_ieee = ic->ic_curchan->ic_ieee;
tap->chan_maxpow = 0;
- if (phymode == RT2860_TXWI_PHYMODE_HT_MIXED || phymode ==
RT2860_TXWI_PHYMODE_HT_GF)
+ if (phymode == RT2860_RXWI_PHYMODE_HT_MIXED || phymode ==
RT2860_RXWI_PHYMODE_HT_GF)
tap->rate = mcs | IEEE80211_RATE_MCS;
else
tap->rate = rt2860_rxrate(rxwi);
- if (desc_flags & RT2860_RXDESC_FLAGS_CRC_ERR)
+ if (desc_flags & RT2860_RX_CRCERR)
tap->flags |= IEEE80211_RADIOTAP_F_BADFCS;
- if (desc_flags & RT2860_RXDESC_FLAGS_FRAG)
+ if (desc_flags & RT2860_RX_FRAG)
tap->flags |= IEEE80211_RADIOTAP_F_FRAG;
if (rxwi->bw_mcs & RT2860_RXWI_MCS_SHOTPRE)
tap->flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
- if ((desc_flags & RT2860_RXDESC_FLAGS_DECRYPTED) ||
+ if ((desc_flags & RT2860_RX_DEC) ||
(wh->i_fc[1] & IEEE80211_FC1_WEP))
tap->flags |= IEEE80211_RADIOTAP_F_WEP;
@@ -5527,7 +5519,7 @@
skip:
- desc->sdl0 &= ~htole16(RT2860_RXDESC_SDL0_DDONE);
+ desc->sdl0 &= ~htole16(RT2860_RX_DDONE);
bus_dmamap_sync(ring->desc_dma_tag, ring->desc_dma_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -5560,7 +5552,7 @@
struct rt2860_softc_tx_ring *ring)
{
struct ifnet *ifp;
- struct rt2860_txdesc *desc;
+ struct rt2860_txd *desc;
struct rt2860_softc_tx_data *data;
uint32_t index;
int ndescs, nframes;
@@ -5585,8 +5577,8 @@
bus_dmamap_sync(ring->desc_dma_tag, ring->desc_dma_map,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
- if (desc->sdl0 & htole16(RT2860_TXDESC_SDL0_LASTSEG) ||
- desc->sdl1 & htole16(RT2860_TXDESC_SDL1_LASTSEG)) {
+ if (desc->sdl0 & htole16(RT2860_TX_LS0) ||
+ desc->sdl1 & htole16(RT2860_TX_LS1)) {
nframes++;
data = &ring->data[ring->data_next];
@@ -5615,7 +5607,7 @@
RT2860_SOFTC_TX_RING_UNLOCK(ring);
}
- desc->sdl0 &= ~htole16(RT2860_TXDESC_SDL0_DDONE);
+ desc->sdl0 &= ~htole16(RT2860_TX_DDONE);
bus_dmamap_sync(ring->desc_dma_tag, ring->desc_dma_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -6013,15 +6005,15 @@
static int rt2860_alloc_rx_ring(struct rt2860_softc *sc,
struct rt2860_softc_rx_ring *ring)
{
- struct rt2860_rxdesc *desc;
+ struct rt2860_rxd *desc;
struct rt2860_softc_rx_data *data;
bus_dma_segment_t segs[1];
int i, nsegs, error;
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), PAGE_SIZE, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
- RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc), 1,
- RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc),
+ RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxd), 1,
+ RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxd),
0, NULL, NULL, &ring->desc_dma_tag);
if (error != 0) {
device_printf(sc->sc_dev,
@@ -6039,7 +6031,7 @@
error = bus_dmamap_load(ring->desc_dma_tag, ring->desc_dma_map,
ring->desc,
- RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc),
+ RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxd),
rt2860_dma_map_addr, &ring->desc_phys_addr, 0);
if (error != 0) {
device_printf(sc->sc_dev,
@@ -6121,13 +6113,13 @@
static void rt2860_reset_rx_ring(struct rt2860_softc *sc,
struct rt2860_softc_rx_ring *ring)
{
- struct rt2860_rxdesc *desc;
+ struct rt2860_rxd *desc;
int i;
for (i = 0; i < RT2860_SOFTC_RX_RING_DATA_COUNT; i++) {
desc = &ring->desc[i];
- desc->sdl0 &= ~htole16(RT2860_RXDESC_SDL0_DDONE);
+ desc->sdl0 &= ~htole16(RT2860_RX_DDONE);
}
bus_dmamap_sync(ring->desc_dma_tag, ring->desc_dma_map,
@@ -6186,7 +6178,7 @@
struct rt2860_softc_tx_data *data;
int error, i, size;
- size = RT2860_SOFTC_TX_RING_DESC_COUNT * sizeof(struct rt2860_txdesc);
+ size = RT2860_SOFTC_TX_RING_DESC_COUNT * sizeof(struct rt2860_txd);
mtx_init(&ring->lock, device_get_nameunit(sc->sc_dev), NULL, MTX_DEF);
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), PAGE_SIZE, 0,
@@ -6287,7 +6279,7 @@
struct rt2860_softc_tx_ring *ring)
{
struct rt2860_softc_tx_data *data;
- struct rt2860_txdesc *desc;
+ struct rt2860_txd *desc;
int i;
for (i = 0; i < RT2860_SOFTC_TX_RING_DESC_COUNT; i++) {
=======================================
--- /sys/dev/ral/rt2860reg.h Wed Mar 14 02:42:49 2012
+++ /sys/dev/ral/rt2860reg.h Wed Mar 14 04:43:04 2012
@@ -554,6 +554,162 @@
#define RT2860_Q (1 << 3)
#define RT2860_SHIFT_Q 3
+/* RT2860 TX descriptor */
+struct rt2860_txd {
+ uint32_t sdp0; /* Segment Data Pointer 0 */
+ uint16_t sdl1; /* Segment Data Length 1 */
+#define RT2860_TX_BURST (1 << 15)
+#define RT2860_TX_LS1 (1 << 14) /* SDP1 is the last segment */
+
+ uint16_t sdl0; /* Segment Data Length 0 */
+#define RT2860_TX_DDONE (1 << 15)
+#define RT2860_TX_LS0 (1 << 14) /* SDP0 is the last segment */
+
+ uint32_t sdp1; /* Segment Data Pointer 1 */
+ uint8_t reserved[3];
+ uint8_t flags;
+#define RT2860_TX_QSEL_SHIFT 1
+#define RT2860_TX_QSEL_MGMT (0 << 1)
+#define RT2860_TX_QSEL_HCCA (1 << 1)
+#define RT2860_TX_QSEL_EDCA (2 << 1)
+#define RT2860_TX_WIV (1 << 0)
+} __packed;
+
+/* TX Wireless Information */
+struct rt2860_txwi {
+ uint8_t flags;
+#define RT2860_TX_MPDU_DSITY_SHIFT 5
+#define RT2860_TX_AMPDU (1 << 4)
+#define RT2860_TX_TS (1 << 3)
+#define RT2860_TX_CFACK (1 << 2)
+#define RT2860_TX_MMPS (1 << 1)
+#define RT2860_TX_FRAG (1 << 0)
+
+ uint8_t txop;
+#define RT2860_TX_TXOP_HT 0
+#define RT2860_TX_TXOP_PIFS 1
+#define RT2860_TX_TXOP_SIFS 2
+#define RT2860_TX_TXOP_BACKOFF 3
+
+ uint16_t phy;
+#define RT2860_PHY_MODE 0xc000
+#define RT2860_PHY_CCK (0 << 14)
+#define RT2860_PHY_OFDM (1 << 14)
+#define RT2860_PHY_HT (2 << 14)
+#define RT2860_PHY_HT_GF (3 << 14)
+#define RT2860_PHY_STBC 9
+#define RT2860_PHY_SGI (1 << 8)
+#define RT2860_PHY_BW40 (1 << 7)
+#define RT2860_PHY_MCS 0x7f
+#define RT2860_PHY_SHPRE (1 << 3)
+
+ uint8_t xflags;
+#define RT2860_TX_BAWINSIZE_SHIFT 2
+#define RT2860_TX_NSEQ (1 << 1)
+#define RT2860_TX_ACK (1 << 0)
+
+ uint8_t wcid; /* Wireless Client ID */
+ uint16_t len;
+#define RT2860_TX_PID_SHIFT 12
+
+ uint32_t iv;
+ uint32_t eiv;
+} __packed;
+
+/* RT2860 RX descriptor */
+struct rt2860_rxd {
+ uint32_t sdp0;
+ uint16_t sdl1; /* unused */
+ uint16_t sdl0;
+#define RT2860_RX_DDONE (1 << 15)
+#define RT2860_RX_LS0 (1 << 14)
+
+ uint32_t sdp1; /* unused */
+ uint32_t flags;
+#define RT2860_RX_DEC (1 << 16)
+#define RT2860_RX_AMPDU (1 << 15)
+#define RT2860_RX_L2PAD (1 << 14)
+#define RT2860_RX_RSSI (1 << 13)
+#define RT2860_RX_HTC (1 << 12)
+#define RT2860_RX_AMSDU (1 << 11)
+#define RT2860_RX_MICERR (1 << 10)
+#define RT2860_RX_ICVERR (1 << 9)
+#define RT2860_RX_CRCERR (1 << 8)
+#define RT2860_RX_MYBSS (1 << 7)
+#define RT2860_RX_BC (1 << 6)
+#define RT2860_RX_MC (1 << 5)
+#define RT2860_RX_UC2ME (1 << 4)
+#define RT2860_RX_FRAG (1 << 3)
+#define RT2860_RX_NULL (1 << 2)
+#define RT2860_RX_DATA (1 << 1)
+#define RT2860_RX_BA (1 << 0)
+
+#define RT2860_RX_CIPHER_ERR_SHIFT 9
+#define RT2860_RX_CIPHER_ERR_MASK 0x3
+#define RT2860_RX_CIPHER_ERR_NONE 0
+#define RT2860_RX_CIPHER_ERR_ICV 1
+#define RT2860_RX_CIPHER_ERR_MIC 2
+#define RT2860_RX_CIPHER_ERR_INVALID_KEY 3
+
+#define RT2860_RX_PLCP_SIGNAL_SHIFT 20
+#define RT2860_RX_PLCP_SIGNAL_MASK 0xfff
+} __packed;
+
+/* RX Wireless Information */
+struct rt2860_rxwi {
+ uint8_t wcid;
+ uint8_t keyidx;
+#define RT2860_RX_UDF_SHIFT 5
+#define RT2860_RX_BSS_IDX_SHIFT 2
+#define RT2860_RXWI_KEYIDX_SHIFT 0
+#define RT2860_RXWI_KEYIDX_MASK 0x3
+
+ uint16_t len;
+#define RT2860_RX_TID_SHIFT 12
+#define RT2860_RXWI_TID_MASK 0xf
+#define RT2860_RXWI_SIZE_SHIFT 0
+#define RT2860_RXWI_SIZE_MASK 0xfff
+
+ uint16_t seq;
+#define RT2860_RXWI_FRAG_SHIFT 0
+#define RT2860_RXWI_FRAG_MASK 0xf
+#define RT2860_RXWI_SEQ_SHIFT 4
+#define RT2860_RXWI_SEQ_MASK 0xfff
+
+ uint8_t bw_mcs;
+#define RT2860_RXWI_MCS_SHIFT 0
+#define RT2860_RXWI_MCS_MASK 0x7f
+#define RT2860_RXWI_MCS_SHOTPRE (1 << 3)
+#define RT2860_RXWI_BW_SHIFT 7
+#define RT2860_RXWI_BW_MASK 0x1
+#define RT2860_RXWI_BW_20 0
+#define RT2860_RXWI_BW_40 1
+
+ uint8_t phymode_stbc_shortgi;
+#define RT2860_RXWI_SHORTGI_SHIFT 0
+#define RT2860_RXWI_SHORTGI_MASK 0x1
+#define RT2860_RXWI_STBC_SHIFT 1
+#define RT2860_RXWI_STBC_MASK 0x3
+#define RT2860_RXWI_PHYMODE_SHIFT 6
+#define RT2860_RXWI_PHYMODE_MASK 0x3
+#define RT2860_RXWI_PHYMODE_CCK 0
+#define RT2860_RXWI_PHYMODE_OFDM 1
+#define RT2860_RXWI_PHYMODE_HT_MIXED 2
+#define RT2860_RXWI_PHYMODE_HT_GF 3
+
+ uint8_t rssi[3];
+ uint8_t reserved1;
+ uint8_t snr[2];
+ uint16_t reserved2;
+} __packed;
+
+
+/* first DMA segment contains TXWI + 802.11 header + 32-bit padding */
+#define RT2860_TXWI_DMASZ \
+ (sizeof (struct rt2860_txwi) + \
+ sizeof (struct ieee80211_htframe) + \
+ sizeof (uint16_t))
+
#define RT2860_RF1 0
#define RT2860_RF2 2
#define RT2860_RF3 1
=======================================
--- /sys/dev/ral/rt2860var.h Wed Mar 14 02:42:49 2012
+++ /sys/dev/ral/rt2860var.h Wed Mar 14 04:43:04 2012
@@ -15,36 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/taskqueue.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/endian.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_input.h>
-#include <net80211/ieee80211_radiotap.h>
-#include <net80211/ieee80211_regdomain.h>
-
#ifdef RT2860_DEBUG
enum
@@ -79,199 +49,6 @@
#endif /* #ifdef RT2860_DEBUG */
-#define RT2860_RXDESC_SDL0_DDONE (1 << 15)
-
-#define RT2860_RXDESC_FLAGS_LAST_AMSDU (1 << 19)
-#define RT2860_RXDESC_FLAGS_CIPHER_ALG (1 << 18)
-#define RT2860_RXDESC_FLAGS_PLCP_RSSIL (1 << 17)
-#define RT2860_RXDESC_FLAGS_DECRYPTED (1 << 16)
-#define RT2860_RXDESC_FLAGS_AMPDU (1 << 15)
-#define RT2860_RXDESC_FLAGS_L2PAD (1 << 14)
-#define RT2860_RXDESC_FLAGS_RSSI (1 << 13)
-#define RT2860_RXDESC_FLAGS_HTC (1 << 12)
-#define RT2860_RXDESC_FLAGS_AMSDU (1 << 11)
-#define RT2860_RXDESC_FLAGS_CRC_ERR (1 << 8)
-#define RT2860_RXDESC_FLAGS_MYBSS (1 << 7)
-#define RT2860_RXDESC_FLAGS_BCAST (1 << 6)
-#define RT2860_RXDESC_FLAGS_MCAST (1 << 5)
-#define RT2860_RXDESC_FLAGS_U2M (1 << 4)
-#define RT2860_RXDESC_FLAGS_FRAG (1 << 3)
-#define RT2860_RXDESC_FLAGS_NULL_DATA (1 << 2)
-#define RT2860_RXDESC_FLAGS_DATA (1 << 1)
-#define RT2860_RXDESC_FLAGS_BA (1 << 0)
-
-#define RT2860_RXDESC_FLAGS_CIPHER_ERR_SHIFT 9
-#define RT2860_RXDESC_FLAGS_CIPHER_ERR_MASK 0x3
-#define RT2860_RXDESC_FLAGS_CIPHER_ERR_NONE 0
-#define RT2860_RXDESC_FLAGS_CIPHER_ERR_ICV 1
-#define RT2860_RXDESC_FLAGS_CIPHER_ERR_MIC 2
-#define RT2860_RXDESC_FLAGS_CIPHER_ERR_INVALID_KEY 3
-
-#define RT2860_RXDESC_FLAGS_PLCP_SIGNAL_SHIFT 20
-#define RT2860_RXDESC_FLAGS_PLCP_SIGNAL_MASK 0xfff
-
-struct rt2860_rxdesc
-{
- uint32_t sdp0;
- uint16_t sdl1;
- uint16_t sdl0;
- uint32_t sdp1;
- uint32_t flags;
-} __packed;
-
-#define RT2860_TXDESC_SDL1_BURST (1 << 15)
-#define RT2860_TXDESC_SDL1_LASTSEG (1 << 14)
-
-#define RT2860_TXDESC_SDL0_DDONE (1 << 15)
-#define RT2860_TXDESC_SDL0_LASTSEG (1 << 14)
-
-#define RT2860_TXDESC_FLAGS_SHIFT 0
-#define RT2860_TXDESC_FLAGS_MASK 0xf9
-#define RT2860_TXDESC_FLAGS_WI_VALID (1 << 0)
-
-#define RT2860_TXDESC_QSEL_SHIFT 1
-#define RT2860_TXDESC_QSEL_MASK 0x3
-#define RT2860_TXDESC_QSEL_MGMT 0
-#define RT2860_TXDESC_QSEL_HCCA 1
-#define RT2860_TXDESC_QSEL_EDCA 2
-
-struct rt2860_txdesc
-{
- uint32_t sdp0;
- uint16_t sdl1;
- uint16_t sdl0;
- uint32_t sdp1;
- uint8_t reserved[3];
- uint8_t qsel_flags;
-} __packed;
-
-#define RT2860_TXWI_FLAGS_SHIFT 0
-#define RT2860_TXWI_FLAGS_MASK 0x1f
-#define RT2860_TXWI_FLAGS_AMPDU (1 << 4)
-#define RT2860_TXWI_FLAGS_TS (1 << 3)
-#define RT2860_TXWI_FLAGS_CFACK (1 << 2)
-#define RT2860_TXWI_FLAGS_MIMOPS (1 << 1)
-#define RT2860_TXWI_FLAGS_FRAG (1 << 0)
-
-#define RT2860_TXWI_MPDU_DENSITY_SHIFT 5
-#define RT2860_TXWI_MPDU_DENSITY_MASK 0x7
-
-#define RT2860_TXWI_TXOP_SHIFT 0
-#define RT2860_TXWI_TXOP_MASK 0x3
-#define RT2860_TXWI_TXOP_HT 0
-#define RT2860_TXWI_TXOP_PIFS 1
-#define RT2860_TXWI_TXOP_SIFS 2
-#define RT2860_TXWI_TXOP_BACKOFF 3
-
-#define RT2860_TXWI_MCS_SHIFT 0
-#define RT2860_TXWI_MCS_MASK 0x7f
-#define RT2860_TXWI_MCS_SHOTPRE (1 << 3)
-
-#define RT2860_TXWI_BW_SHIFT 7
-#define RT2860_TXWI_BW_MASK 0x1
-#define RT2860_TXWI_BW_20 0
-#define RT2860_TXWI_BW_40 1
-
-#define RT2860_TXWI_SHORTGI_SHIFT 0
-#define RT2860_TXWI_SHORTGI_MASK 0x1
-
-#define RT2860_TXWI_STBC_SHIFT 1
-#define RT2860_TXWI_STBC_MASK 0x3
-
-#define RT2860_TXWI_IFS_SHIFT 3
-#define RT2860_TXWI_IFS_MASK 0x1
-
-#define RT2860_TXWI_PHYMODE_SHIFT 6
-#define RT2860_TXWI_PHYMODE_MASK 0x3
-#define RT2860_TXWI_PHYMODE_CCK 0
-#define RT2860_TXWI_PHYMODE_OFDM 1
-#define RT2860_TXWI_PHYMODE_HT_MIXED 2
-#define RT2860_TXWI_PHYMODE_HT_GF 3
-
-#define RT2860_TXWI_XFLAGS_SHIFT 0
-#define RT2860_TXWI_XFLAGS_MASK 0x3
-#define RT2860_TXWI_XFLAGS_NSEQ (1 << 1)
-#define RT2860_TXWI_XFLAGS_ACK (1 << 0)
-
-#define RT2860_TXWI_BAWIN_SIZE_SHIFT 2
-#define RT2860_TXWI_BAWIN_SIZE_MASK 0x3f
-
-#define RT2860_TXWI_MPDU_LEN_SHIFT 0
-#define RT2860_TXWI_MPDU_LEN_MASK 0xfff
-
-#define RT2860_TXWI_PID_SHIFT 12
-#define RT2860_TXWI_PID_MASK 0xf
-
-struct rt2860_txwi
-{
- uint8_t mpdu_density_flags;
- uint8_t txop;
- uint8_t bw_mcs;
- uint8_t phymode_ifs_stbc_shortgi;
- uint8_t bawin_size_xflags;
- uint8_t wcid;
- uint16_t pid_mpdu_len;
- uint32_t iv;
- uint32_t eiv;
-} __packed;
-
-#define RT2860_RXWI_KEYIDX_SHIFT 0
-#define RT2860_RXWI_KEYIDX_MASK 0x3
-
-#define RT2860_RXWI_BSSIDX_SHIFT 2
-#define RT2860_RXWI_BSSIDX_MASK 0x7
-
-#define RT2860_RXWI_UDF_SHIFT 5
-#define RT2860_RXWI_UDF_MASK 0x7
-
-#define RT2860_RXWI_SIZE_SHIFT 0
-#define RT2860_RXWI_SIZE_MASK 0xfff
-
-#define RT2860_RXWI_TID_SHIFT 12
-#define RT2860_RXWI_TID_MASK 0xf
-
-#define RT2860_RXWI_FRAG_SHIFT 0
-#define RT2860_RXWI_FRAG_MASK 0xf
-
-#define RT2860_RXWI_SEQ_SHIFT 4
-#define RT2860_RXWI_SEQ_MASK 0xfff
-
-#define RT2860_RXWI_MCS_SHIFT 0
-#define RT2860_RXWI_MCS_MASK 0x7f
-#define RT2860_RXWI_MCS_SHOTPRE (1 << 3)
-
-#define RT2860_RXWI_BW_SHIFT 7
-#define RT2860_RXWI_BW_MASK 0x1
-#define RT2860_RXWI_BW_20 0
-#define RT2860_RXWI_BW_40 1
-
-#define RT2860_RXWI_SHORTGI_SHIFT 0
-#define RT2860_RXWI_SHORTGI_MASK 0x1
-
-#define RT2860_RXWI_STBC_SHIFT 1
-#define RT2860_RXWI_STBC_MASK 0x3
-
-#define RT2860_RXWI_PHYMODE_SHIFT 6
-#define RT2860_RXWI_PHYMODE_MASK 0x3
-#define RT2860_RXWI_PHYMODE_CCK 0
-#define RT2860_RXWI_PHYMODE_OFDM 1
-#define RT2860_RXWI_PHYMODE_HT_MIXED 2
-#define RT2860_RXWI_PHYMODE_HT_GF 3
-
-struct rt2860_rxwi
-{
- uint8_t wcid;
- uint8_t udf_bssidx_keyidx;
- uint16_t tid_size;
- uint16_t seq_frag;
- uint8_t bw_mcs;
- uint8_t phymode_stbc_shortgi;
- uint8_t rssi[3];
- uint8_t reserved1;
- uint8_t snr[2];
- uint16_t reserved2;
-} __packed;
-
#define RT2860_AMRR_MIN_SUCCESS_THRESHOLD 1
#define RT2860_AMRR_MAX_SUCCESS_THRESHOLD 15
@@ -354,7 +131,7 @@
bus_dma_tag_t desc_dma_tag;
bus_dmamap_t desc_dma_map;
bus_addr_t desc_phys_addr;
- struct rt2860_rxdesc *desc;
+ struct rt2860_rxd *desc;
bus_dma_tag_t data_dma_tag;
bus_dmamap_t spare_dma_map;
struct rt2860_softc_rx_data data[RT2860_SOFTC_RX_RING_DATA_COUNT];
@@ -374,7 +151,7 @@
bus_dma_tag_t desc_dma_tag;
bus_dmamap_t desc_dma_map;
bus_addr_t desc_phys_addr;
- struct rt2860_txdesc *desc;
+ struct rt2860_txd *desc;
int desc_queued;
int desc_cur;
int desc_next;
@@ -406,8 +183,6 @@
struct ieee80211_beacon_offsets beacon_offsets;
struct mbuf *beacon_mbuf;
- struct rt2860_txwi beacon_txwi;
-
struct rt2860_amrr amrr;
int (*newstate)(struct ieee80211vap *vap,
==============================================================================
Revision: 7bba8ac6d729
Author: Bernhard Schmidt <bschmidt at techwires.net>
Date: Wed Mar 14 04:46:02 2012
Log: merge
http://code.google.com/p/rt2860-in-ral/source/detail?r=7bba8ac6d729
Modified:
/sys/dev/ral/rt2860.c
/sys/dev/ral/rt2860reg.h
=======================================
--- /sys/dev/ral/rt2860.c Wed Mar 14 04:43:04 2012
+++ /sys/dev/ral/rt2860.c Wed Mar 14 04:46:02 2012
@@ -1148,10 +1148,8 @@
rt2860_asic_set_macaddr(sc, IF_LLADDR(ifp));
/* clear statistic registers */
-#if 0
- rt2860_io_mac_read_multi(sc, RT2860_REG_RX_STA_CNT0,
- stacnt, sizeof(stacnt));
-#endif
+ for (i = 0; i < (sizeof(uint32_t) * 6); i += sizeof(uint32_t))
+ RAL_READ(sc, RT2860_REG_RX_STA_CNT0 + i);
/* set RTS threshold */
@@ -5645,14 +5643,12 @@
rt2860_drain_fifo_stats(sc);
/* read and clear Tx statistic registers */
-#if 0
- rt2860_io_mac_read_multi(sc, RT2860_REG_TX_STA_CNT0,
+ RAL_READ(sc, RT2860_REG_TX_STA_CNT0)
stacnt, sizeof(stacnt));
-#endif
-
- stacnt[0] = le32toh(stacnt[0]);
- stacnt[1] = le32toh(stacnt[1]);
- stacnt[2] = le32toh(stacnt[2]);
+
+ stacnt[0] = le32toh(RAL_READ(sc, RT2860_REG_TX_STA_CNT0));
+ stacnt[1] = le32toh(RAL_READ(sc, RT2860_REG_TX_STA_CNT1));
+ stacnt[2] = le32toh(RAL_READ(sc, RT2860_REG_TX_STA_CNT2));
beacons = stacnt[0] >> 16;
noretryok = stacnt[1] & 0xffff;
=======================================
--- /sys/dev/ral/rt2860reg.h Wed Mar 14 04:43:04 2012
+++ /sys/dev/ral/rt2860reg.h Wed Mar 14 04:46:02 2012
@@ -81,6 +81,9 @@
#define RT2860_REG_AMPDU_MAX_LEN_40M2S 0x103c
#define RT2860_REG_AMPDU_BA_WINSIZE 0x1040
+/* undocumented registers */
+#define RT2860_DEBUG 0x10f4
+
#define RT2860_XIFS_TIME_CFG 0x1100
#define RT2860_BKOFF_SLOT_CFG 0x1104
#define RT2860_REG_NAV_TIME_CFG 0x1108
More information about the Zrouter-src-freebsd
mailing list