[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Fri Feb 17 18:14:18 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/d9b16885212e
changeset: 341:d9b16885212e
user: ray at terran.dlink.ua
date: Fri Feb 17 20:15:53 2012 +0200
description:
Enable S/W crypto support. (or disable H/W to be more correct)
Save so bits for future work about RT3052F.
diffstat:
head/sys/dev/rt2860/rt2860.c | 255 ++++++++++++++++++++++++++++--------
head/sys/dev/rt2860/rt2860_debug.h | 34 ++--
head/sys/dev/rt2860/rt2860_io.c | 17 +-
head/sys/dev/rt2860/rt2860_reg.h | 1 +
4 files changed, 220 insertions(+), 87 deletions(-)
diffs (704 lines):
diff -r 23478a9ef9b5 -r d9b16885212e head/sys/dev/rt2860/rt2860.c
--- a/head/sys/dev/rt2860/rt2860.c Sun Feb 12 17:14:30 2012 +0200
+++ b/head/sys/dev/rt2860/rt2860.c Fri Feb 17 20:15:53 2012 +0200
@@ -47,6 +47,7 @@
#define RT2860_TX_WATCHDOG_TIMEOUT 5
+#define RUN_AID2WCID(aid) ((aid) & 0xff)
#define RT2860_WCID_RESERVED 0xff
#define RT2860_WCID_MCAST 0xf7
@@ -98,6 +99,7 @@
static int rt2860_vap_newstate(struct ieee80211vap *vap,
enum ieee80211_state nstate, int arg);
+#ifdef RT2860_HW_CRYPTO
static void rt2860_vap_key_update_begin(struct ieee80211vap *vap);
static void rt2860_vap_key_update_end(struct ieee80211vap *vap);
@@ -107,6 +109,7 @@
static int rt2860_vap_key_delete(struct ieee80211vap *vap,
const struct ieee80211_key *k);
+#endif
static void rt2860_vap_update_beacon(struct ieee80211vap *vap, int what);
@@ -334,6 +337,7 @@
uint32_t val;
} rt2860_def_mac[] =
{
+#if 1
{ RT2860_REG_PBF_BCN_OFFSET0, 0xf8f0e8e0 },
{ RT2860_REG_PBF_BCN_OFFSET1, 0x6f77d0c8 },
{ RT2860_REG_LEGACY_BASIC_RATE, 0x0000013f },
@@ -365,6 +369,50 @@
{ RT2860_REG_SCHDMA_WMM_AIFSN_CFG, 0x00002273 },
{ RT2860_REG_SCHDMA_WMM_CWMIN_CFG, 0x00002344 },
{ RT2860_REG_SCHDMA_WMM_CWMAX_CFG, 0x000034aa },
+#else
+
+ { RT2860_REG_PBF_BCN_OFFSET0, 0xf8f0e8e0}, /* 0x3800(e0), 0x3A00(e8), 0x3C00(f0), 0x3E00(f8), 512B for each beacon */
+ { RT2860_REG_PBF_BCN_OFFSET1, 0x6f77d0c8}, /* 0x3200(c8), 0x3400(d0), 0x1DC0(77), 0x1BC0(6f), 512B for each beacon */
+ { RT2860_REG_LEGACY_BASIC_RATE, 0x0000013f}, // Basic rate set bitmap
+ { RT2860_REG_HT_BASIC_RATE, 0x00008003}, // Basic HT rate set , 20M, MCS=3, MM. Format is the same as in TXWI.
+ { RT2860_REG_SYS_CTRL, 0x00000000}, // 0x1004, , default Disable RX
+ { RT2860_REG_RX_FILTER_CFG, 0x00017f97}, //0x1400 , RX filter control,
+ { RT2860_REG_BKOFF_SLOT_CFG, 0x00000209}, // default set short slot time, CC_DELAY_TIME should be 2
+ { RT2860_REG_TX_SW_CFG0, 0x00000400}, // Gary,2008-05-21 0x0 for CWC test , 2008-06-19 0x400 for rf reason
+ { RT2860_REG_TX_SW_CFG1, 0x00000000}, // Gary,2008-06-18
+ { RT2860_REG_TX_SW_CFG2, 0x00000030}, // Bruce, CwC IOT issue
+ { RT2860_REG_TX_LINK_CFG, 0x00001020}, // Gary,2006-08-23
+ { RT2860_REG_TX_TIMEOUT_CFG, 0x000a2090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01
+ { RT2860_REG_MAX_LEN_CFG, (1 << 12) | RT2860_MAX_AGG_SIZE }, // 0x3018, MAX frame length. Max PSDU = 16kbytes.
+ { RT2860_REG_LED_CFG, 0x7f031e46}, // Gary, 2006-08-23
+ { RT2860_REG_PBF_MAX_PCNT, 0x1F3FBF9F}, //0x1F3f7f9f}, //Jan, 2006/04/20
+ { RT2860_REG_TX_RTY_CFG, 0x47d01f0f}, // Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03
+ { RT2860_REG_AUTO_RSP_CFG, 0x00000053}, // Initial Auto_Responder, because QA will turn off Auto-Responder
+ { RT2860_REG_TX_CCK_PROT_CFG, 0x05740003}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled.
+ { RT2860_REG_TX_OFDM_PROT_CFG, 0x05740003}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled.
+ { RT2860_REG_TX_GF20_PROT_CFG, 0x01744004}, // set 19:18 --> Short NAV for MIMO PS
+ { RT2860_REG_TX_GF40_PROT_CFG, 0x03F44084},
+ { RT2860_REG_TX_MM20_PROT_CFG, 0x01744004},
+ { RT2860_REG_TX_MM40_PROT_CFG, 0x03F54084},
+ { RT2860_REG_TX_TXOP_CTRL_CFG, 0x0000583f}, //Extension channel backoff.
+ { RT2860_REG_TX_RTS_CFG, 0x00092b20},
+ { RT2860_REG_TX_EXP_ACK_TIME, 0x002400ca}, // default value
+ { RT2860_REG_HCCAPSMP_TXOP_HLDR_ET, 0x00000002},
+ { RT2860_REG_XIFS_TIME_CFG, 0x33a41010},
+ { RT2860_REG_PWR_PIN_CFG, 0x00000003}, // patch for 2880-E
+#if 1 /* CONFIG_AP_SUPPORT */
+ { RT2860_REG_SCHDMA_WMM_AIFSN_CFG, 0x00001173},
+ { RT2860_REG_SCHDMA_WMM_CWMIN_CFG, 0x00002344},
+ { RT2860_REG_SCHDMA_WMM_CWMAX_CFG, 0x000034a6},
+ { RT2860_REG_SCHDMA_WMM_TXOP0_CFG, 0x00100020},
+ { RT2860_REG_SCHDMA_WMM_TXOP1_CFG, 0x002F0038},
+ { RT2860_REG_TBTT_SYNC_CFG, 0x00012000},
+#else /* CONFIG_STA_SUPPORT */
+ { RT2860_REG_SCHDMA_WMM_AIFSN_CFG, 0x00002273},
+ { RT2860_REG_SCHDMA_WMM_CWMIN_CFG, 0x00002344},
+ { RT2860_REG_SCHDMA_WMM_CWMAX_CFG, 0x000034aa},
+#endif // CONFIG_AP_SUPPORT //
+#endif
};
#define RT2860_DEF_MAC_SIZE (sizeof(rt2860_def_mac) / sizeof(rt2860_def_mac[0]))
@@ -375,6 +423,7 @@
uint8_t val;
} rt2860_def_bbp[] =
{
+#if 1 /* orig */
{ 65, 0x2c },
{ 66, 0x38 },
{ 69, 0x12 },
@@ -390,6 +439,27 @@
{ 103, 0x00 },
{ 105, 0x05 },
{ 106, 0x35 },
+#else
+ { 31, 0x08}, //gary recommend for ACE
+ { 65, 0x2C}, // fix rssi issue
+ { 66, 0x38}, // Also set this default value to pAd->BbpTuning.R66CurrentValue at initial
+ { 68, 0x0B}, // improve Rx sensitivity.
+ { 69, 0x12},
+ { 70, 0xa}, // BBP_R70 will change to 0x8 in ApStartUp and LinkUp for rt2860C, otherwise value is 0xa
+ { 73, 0x10},
+ { 78, 0x0E},
+ { 80, 0x08}, // requested by Gary for high power
+ { 81, 0x37},
+ { 82, 0x62},
+ { 83, 0x6A},
+ { 84, 0x99}, // 0x19 is for rt2860E and after. This is for extension channel overlapping IOT. 0x99 is for rt2860D and before
+ { 86, 0x00}, // middle range issue, Rory @2008-01-28
+ { 91, 0x04}, // middle range issue, Rory @2008-01-28
+ { 92, 0x00}, // middle range issue, Rory @2008-01-28
+ { 103, 0xC0},
+ { 105, 0x01},/*kurtis:0x01 ori*/// 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before.
+ { 106, 0x35}, // Optimizing the Short GI sampling request from Gray @2009-0409
+#endif
};
#define RT2860_DEF_BBP_SIZE (sizeof(rt2860_def_bbp) / sizeof(rt2860_def_bbp[0]))
@@ -487,9 +557,10 @@
device_get_nameunit(sc->dev), sc->mac_rev,
rt2860_rf_name(sc->rf_rev));
+ RT2860_SOFTC_LOCK(sc);
/* clear key tables */
-
rt2860_asic_clear_keytables(sc);
+ RT2860_SOFTC_UNLOCK(sc);
/* allocate Tx and Rx rings */
@@ -556,18 +627,19 @@
IEEE80211_C_MBSS |
IEEE80211_C_BGSCAN |
IEEE80211_C_TXPMGT |
- IEEE80211_C_SHPREAMBLE |
- IEEE80211_C_SHSLOT |
+ IEEE80211_C_SHPREAMBLE |
+ IEEE80211_C_SHSLOT |
IEEE80211_C_TXFRAG |
IEEE80211_C_BURST |
IEEE80211_C_WME |
IEEE80211_C_WPA;
+#ifdef RT2860_HW_CRYPTO
ic->ic_cryptocaps |= IEEE80211_CRYPTO_WEP |
IEEE80211_CRYPTO_TKIP |
IEEE80211_CRYPTO_TKIPMIC |
IEEE80211_CRYPTO_AES_CCM;
-
+#endif
ic->ic_htcaps = IEEE80211_HTC_HT |
IEEE80211_HTC_AMSDU | /* A-MSDU Tx */
IEEE80211_HTC_AMPDU | /* A-MPDU Tx */
@@ -1696,7 +1768,9 @@
static void rt2860_start(struct ifnet *ifp)
{
struct rt2860_softc *sc;
+ struct ieee80211_frame *wh;
struct ieee80211_node *ni;
+ struct ieee80211_key *k;
struct mbuf *m;
int qid;
@@ -1705,6 +1779,8 @@
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
return;
+ RT2860_SOFTC_LOCK(sc);
+
for (;;)
{
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
@@ -1713,6 +1789,19 @@
ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
+ KASSERT(ni != NULL, ("%s:%d: fail", __func__, __LINE__));
+ wh = mtod(m, struct ieee80211_frame *);
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+ k = ieee80211_crypto_encap(ni, m);
+ if (k == NULL) {
+ ieee80211_free_node(ni);
+ m_freem(m);
+ ifp->if_oerrors++;
+ continue;
+ }
+ }
+ wh = NULL; /* Catch any invalid use */
+
m->m_pkthdr.rcvif = NULL;
qid = M_WME_GETAC(m);
@@ -1757,6 +1846,8 @@
callout_reset(&sc->tx_watchdog_ch, hz, rt2860_tx_watchdog, sc);
}
+ RT2860_SOFTC_UNLOCK(sc);
+
}
/*
@@ -1893,10 +1984,12 @@
vap->iv_newstate = rt2860_vap_newstate;
vap->iv_reset = rt2860_vap_reset;
+#ifdef RT2860_HW_CRYPTO
vap->iv_key_update_begin = rt2860_vap_key_update_begin;
vap->iv_key_update_end = rt2860_vap_key_update_end;
vap->iv_key_set = rt2860_vap_key_set;
vap->iv_key_delete = rt2860_vap_key_delete;
+#endif
vap->iv_update_beacon = rt2860_vap_update_beacon;
rt2860_amrr_init(&rvap->amrr, vap,
@@ -2042,6 +2135,8 @@
error = 0;
+ RT2860_SOFTC_LOCK(sc);
+
switch (cmd)
{
case IEEE80211_IOC_RTSTHRESHOLD:
@@ -2072,6 +2167,8 @@
break;
}
+ RT2860_SOFTC_UNLOCK(sc);
+
return error;
}
@@ -2172,6 +2269,7 @@
return error;
}
+#ifdef RT2860_HW_CRYPTO
/*
* rt2860_vap_key_update_begin
*/
@@ -2231,15 +2329,6 @@
uint8_t mode, vapid, wcid, iv[8];
uint32_t tmp;
- if (k->wk_cipher->ic_cipher != IEEE80211_CIPHER_WEP &&
- k->wk_cipher->ic_cipher != IEEE80211_CIPHER_TKIP &&
- k->wk_cipher->ic_cipher != IEEE80211_CIPHER_AES_CCM)
- return 0;
-
- ic = vap->iv_ic;
- ifp = ic->ic_ifp;
- sc = ifp->if_softc;
-
switch (k->wk_cipher->ic_cipher)
{
case IEEE80211_CIPHER_WEP:
@@ -2258,9 +2347,14 @@
break;
default:
+ printf("Wrong key CIPHER (%d)\n", k->wk_cipher->ic_cipher);
return 0;
}
+ ic = vap->iv_ic;
+ ifp = ic->ic_ifp;
+ sc = ifp->if_softc;
+
RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
"%s: VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
device_get_nameunit(sc->dev), k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
@@ -2270,18 +2364,19 @@
{
/* install pairwise key */
- ni = ieee80211_find_vap_node(&ic->ic_sta, vap, mac);
- if (!ni) {
- printf("ieee80211_find_vap_node return 0\n");
- return 0;
- }
+ if (vap->iv_opmode == IEEE80211_M_HOSTAP)
+ ni = ieee80211_find_vap_node(&ic->ic_sta, vap, mac);
+ else
+ ni = vap->iv_bss;
+
rni = (struct rt2860_softc_node *) ni;
vapid = 0;
- wcid = rni->staid;
+ wcid = (ni != NULL) ? rni->staid : 0;
key_base = RT2860_REG_PKEY(wcid);
- ieee80211_free_node(ni);
+ if (ni != NULL)
+ ieee80211_free_node(ni);
if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_WEP)
{
@@ -2300,7 +2395,6 @@
else
{
/* AES CCMP */
-
iv[0] = k->wk_keytsc;
iv[1] = k->wk_keytsc >> 8;
iv[2] = 0;
@@ -2339,7 +2433,6 @@
{
rt2860_io_mac_write_multi(sc, key_base, k->wk_key, k->wk_keylen);
}
-
tmp = ((vapid & RT2860_REG_VAP_MASK) << RT2860_REG_VAP_SHIFT) |
(mode << RT2860_REG_CIPHER_MODE_SHIFT) | RT2860_REG_PKEY_ENABLE;
@@ -2478,6 +2571,7 @@
return 1;
}
+#endif
/*
* rt2860_vap_update_beacon
@@ -2645,7 +2739,11 @@
ifp = ic->ic_ifp;
sc = ifp->if_softc;
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_disable_tsf_sync(sc);
+
+ RT2860_SOFTC_UNLOCK(sc);
}
/*
@@ -2659,7 +2757,11 @@
ifp = ic->ic_ifp;
sc = ifp->if_softc;
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_enable_tsf_sync(sc);
+
+ RT2860_SOFTC_UNLOCK(sc);
}
/*
@@ -2775,7 +2877,9 @@
sc = ifp->if_softc;
+ RT2860_SOFTC_LOCK(sc);
rt2860_asic_update_promisc(sc);
+ RT2860_SOFTC_UNLOCK(sc);
}
/*
@@ -2901,8 +3005,13 @@
"%s: received DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
device_get_nameunit(sc->dev), ni->ni_associd, rni->staid, tid);
- if (rni->staid != 0)
+ if (rni->staid != 0) {
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_del_ba_session(sc, wcid, tid);
+ RT2860_SOFTC_UNLOCK(sc);
+
+ }
break;
}
}
@@ -2947,8 +3056,13 @@
"%s: sending ADDBA response: associd=0x%04x, staid=0x%02x, status=%d, tid=%d, bufsize=%d\n",
device_get_nameunit(sc->dev), ni->ni_associd, rni->staid, status, tid, bufsize);
- if (status == IEEE80211_STATUS_SUCCESS)
+ if (status == IEEE80211_STATUS_SUCCESS) {
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_add_ba_session(sc, wcid, tid);
+ RT2860_SOFTC_UNLOCK(sc);
+
+ }
break;
/* IEEE80211_ACTION_BA_DELBA */
@@ -2960,8 +3074,13 @@
"%s: sending DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
device_get_nameunit(sc->dev), ni->ni_associd, rni->staid, tid);
- if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) != IEEE80211_DELBAPS_INIT)
+ if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) != IEEE80211_DELBAPS_INIT) {
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_del_ba_session(sc, wcid, tid);
+ RT2860_SOFTC_UNLOCK(sc);
+
+ }
break;
}
}
@@ -3020,8 +3139,13 @@
{
sc->tx_ampdu_sessions++;
- if (sc->tx_ampdu_sessions == 1)
+ if (sc->tx_ampdu_sessions == 1) {
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_updateprot(sc);
+ RT2860_SOFTC_UNLOCK(sc);
+
+ }
}
}
@@ -3072,8 +3196,13 @@
{
sc->tx_ampdu_sessions--;
- if (sc->tx_ampdu_sessions == 0)
+ if (sc->tx_ampdu_sessions == 0) {
+ RT2860_SOFTC_LOCK(sc);
+
rt2860_asic_updateprot(sc);
+ RT2860_SOFTC_UNLOCK(sc);
+
+ }
}
else
{
@@ -4011,7 +4140,7 @@
/* clear WCID attribute table (entries = 256, entry size = 4) */
- rt2860_io_mac_set_region_4(sc, RT2860_REG_WCID_ATTR(0), 0, 256);
+ rt2860_io_mac_set_region_4(sc, RT2860_REG_WCID_ATTR(0), RT2860_REG_PKEY_ENABLE, 256);
/* clear IV/EIV table (entries = 256, entry size = 8) */
@@ -4148,34 +4277,33 @@
rate = 2;
- switch (phymode)
- {
- case RT2860_RXWI_PHYMODE_CCK:
- switch (mcs & ~RT2860_RXWI_MCS_SHOTPRE)
- {
- case 0: rate = 2; break; /* 1 Mbps */
- case 1: rate = 4; break; /* 2 MBps */
- case 2: rate = 11; break; /* 5.5 Mbps */
- case 3: rate = 22; break; /* 11 Mbps */
- }
+ switch (phymode) {
+ case RT2860_RXWI_PHYMODE_CCK:
+ switch (mcs & ~RT2860_RXWI_MCS_SHOTPRE)
+ {
+ case 0: rate = 2; break; /* 1 Mbps */
+ case 1: rate = 4; break; /* 2 MBps */
+ case 2: rate = 11; break; /* 5.5 Mbps */
+ case 3: rate = 22; break; /* 11 Mbps */
+ }
break;
- case RT2860_RXWI_PHYMODE_OFDM:
- switch (mcs)
- {
- case 0: rate = 12; break; /* 6 Mbps */
- case 1: rate = 18; break; /* 9 Mbps */
- case 2: rate = 24; break; /* 12 Mbps */
- case 3: rate = 36; break; /* 18 Mbps */
- case 4: rate = 48; break; /* 24 Mbps */
- case 5: rate = 72; break; /* 36 Mbps */
- case 6: rate = 96; break; /* 48 Mbps */
- case 7: rate = 108; break; /* 54 Mbps */
- }
+ case RT2860_RXWI_PHYMODE_OFDM:
+ switch (mcs)
+ {
+ case 0: rate = 12; break; /* 6 Mbps */
+ case 1: rate = 18; break; /* 9 Mbps */
+ case 2: rate = 24; break; /* 12 Mbps */
+ case 3: rate = 36; break; /* 18 Mbps */
+ case 4: rate = 48; break; /* 24 Mbps */
+ case 5: rate = 72; break; /* 36 Mbps */
+ case 6: rate = 96; break; /* 48 Mbps */
+ case 7: rate = 108; break; /* 54 Mbps */
+ }
break;
- case RT2860_RXWI_PHYMODE_HT_MIXED:
- case RT2860_RXWI_PHYMODE_HT_GF:
+ case RT2860_RXWI_PHYMODE_HT_MIXED:
+ case RT2860_RXWI_PHYMODE_HT_GF:
break;
}
@@ -4477,9 +4605,6 @@
"%s: could not load mbuf DMA map, trying to linearize mbuf: ndmasegs=%d, len=%d, error=%d\n",
device_get_nameunit(sc->dev), ndmasegs, m->m_pkthdr.len, error);
- //m = m_defrag(m, M_DONTWAIT);
- //if (m == NULL)
- // return ENOMEM;
m_d = m_collapse(m, M_DONTWAIT, 16);
if (m_d == NULL) {
m_freem(m);
@@ -5110,6 +5235,7 @@
if (status & RT2860_REG_INT_GP_TIMER)
rt2860_gp_timer_intr(sc);
+
}
/*
@@ -5645,11 +5771,14 @@
bus_dma_segment_t segs[1];
bus_dmamap_t dma_map;
uint32_t index, desc_flags;
- uint8_t cipher_err, rssi, ant, phymode, bw, shortgi, stbc, mcs, keyidx, tid, frag;
+ uint8_t rssi, ant, phymode, bw, shortgi, stbc, mcs, tid, frag;
+#ifdef RT2860_HW_CRYPTO
+ uint8_t cipher_err, keyidx;
+#endif
uint16_t seq;
int8_t rssi_dbm;
int error, nsegs, len, ampdu, amsdu, rssi_dbm_rel, nframes, i;
-
+
ifp = sc->ifp;
ic = ifp->if_l2com;
ring = &sc->rx_ring;
@@ -5766,7 +5895,7 @@
wh = (struct ieee80211_frame *) (rxwi + 1);
/* check for cipher errors */
-
+#ifdef RT2860_HW_CRYPTO
if (desc_flags & RT2860_RXDESC_FLAGS_DECRYPTED)
{
cipher_err = ((desc_flags >> RT2860_RXDESC_FLAGS_CIPHER_ERR_SHIFT) &
@@ -5782,9 +5911,11 @@
}
else
{
- RT2860_DPRINTF(sc, RT2860_DEBUG_RX,
- "%s: rxdesc: cipher error=0x%02x\n",
- device_get_nameunit(sc->dev), cipher_err);
+ RT2860_DPRINTF(sc, RT2860_DEBUG_RX_CRYPT,
+ "%s: rxdesc: cipher error=0x%02x keyidx=%d\n",
+ device_get_nameunit(sc->dev), cipher_err,
+ (rxwi->udf_bssidx_keyidx >> RT2860_RXWI_KEYIDX_SHIFT) &
+ RT2860_RXWI_KEYIDX_MASK);
if (cipher_err == RT2860_RXDESC_FLAGS_CIPHER_ERR_ICV)
sc->rx_cipher_icv_errors++;
@@ -5834,7 +5965,7 @@
}
}
}
-
+#endif
/* check for A-MPDU */
if (desc_flags & RT2860_RXDESC_FLAGS_BA)
diff -r 23478a9ef9b5 -r d9b16885212e head/sys/dev/rt2860/rt2860_debug.h
--- a/head/sys/dev/rt2860/rt2860_debug.h Sun Feb 12 17:14:30 2012 +0200
+++ b/head/sys/dev/rt2860/rt2860_debug.h Fri Feb 17 20:15:53 2012 +0200
@@ -23,22 +23,24 @@
enum
{
- RT2860_DEBUG_EEPROM = 0x00000001,
- RT2860_DEBUG_RX = 0x00000002,
- RT2860_DEBUG_TX = 0x00000004,
- RT2860_DEBUG_INTR = 0x00000008,
- RT2860_DEBUG_STATE = 0x00000010,
- RT2860_DEBUG_CHAN = 0x00000020,
- RT2860_DEBUG_NODE = 0x00000040,
- RT2860_DEBUG_KEY = 0x00000080,
- RT2860_DEBUG_PROT = 0x00000100,
- RT2860_DEBUG_WME = 0x00000200,
- RT2860_DEBUG_BEACON = 0x00000400,
- RT2860_DEBUG_BA = 0x00000800,
- RT2860_DEBUG_STATS = 0x00001000,
- RT2860_DEBUG_RATE = 0x00002000,
- RT2860_DEBUG_PERIODIC = 0x00004000,
- RT2860_DEBUG_WATCHDOG = 0x00008000,
+ RT2860_DEBUG_EEPROM = 0x00000001,
+ RT2860_DEBUG_RX = 0x00000002,
+ RT2860_DEBUG_TX = 0x00000004,
+ RT2860_DEBUG_INTR = 0x00000008,
+ RT2860_DEBUG_STATE = 0x00000010,
+ RT2860_DEBUG_CHAN = 0x00000020,
+ RT2860_DEBUG_NODE = 0x00000040,
+ RT2860_DEBUG_KEY = 0x00000080,
+ RT2860_DEBUG_PROT = 0x00000100,
+ RT2860_DEBUG_WME = 0x00000200,
+ RT2860_DEBUG_BEACON = 0x00000400,
+ RT2860_DEBUG_BA = 0x00000800,
+ RT2860_DEBUG_STATS = 0x00001000,
+ RT2860_DEBUG_RATE = 0x00002000,
+ RT2860_DEBUG_PERIODIC = 0x00004000,
+ RT2860_DEBUG_WATCHDOG = 0x00008000,
+ RT2860_DEBUG_RX_CRYPT = 0x00010000,
+ RT2860_DEBUG_TX_CRYPT = 0x00020000,
RT2860_DEBUG_ANY = 0xffffffff
};
diff -r 23478a9ef9b5 -r d9b16885212e head/sys/dev/rt2860/rt2860_io.c
--- a/head/sys/dev/rt2860/rt2860_io.c Sun Feb 12 17:14:30 2012 +0200
+++ b/head/sys/dev/rt2860/rt2860_io.c Fri Feb 17 20:15:53 2012 +0200
@@ -101,7 +101,7 @@
};
uint8_t rt3052_rf_default[] = {
- 0x50,
+ 0x50, /* 0 */
0x01,
0xF7,
0x75,
@@ -111,7 +111,7 @@
0x50,
0x39,
0x0F,
- 0x60,
+ 0x60, /* 10 */
0x21,
0x75,
0x75,
@@ -121,7 +121,7 @@
0x92,
0x2C,
0x02,
- 0xBA,
+ 0xBA, /* 20 */
0xDB,
0x00,
0x31,
@@ -131,7 +131,7 @@
0x23, /* RF: 1.35V */
0x13, /* ADC: must consist with R27 */
0x83,
- 0x00,
+ 0x00, /* 30 */
0x00,
};
/* #endif */
@@ -182,7 +182,7 @@
*/
uint32_t rt2860_io_mac_read(struct rt2860_softc *sc, uint16_t reg)
{
- bus_space_read_4(sc->bst, sc->bsh, RT2860_REG_MAC_CSR0);
+
return bus_space_read_4(sc->bst, sc->bsh, reg);
}
@@ -192,7 +192,7 @@
void rt2860_io_mac_read_multi(struct rt2860_softc *sc,
uint16_t reg, void *buf, size_t len)
{
- bus_space_read_4(sc->bst, sc->bsh, RT2860_REG_MAC_CSR0);
+
bus_space_read_region_1(sc->bst, sc->bsh, reg, buf, len);
}
@@ -202,7 +202,7 @@
void rt2860_io_mac_write(struct rt2860_softc *sc,
uint16_t reg, uint32_t val)
{
- bus_space_read_4(sc->bst, sc->bsh, RT2860_REG_MAC_CSR0);
+
bus_space_write_4(sc->bst, sc->bsh, reg, val);
}
@@ -215,11 +215,10 @@
int i;
const uint8_t *p;
- bus_space_read_4(sc->bst, sc->bsh, RT2860_REG_MAC_CSR0);
-
p = buf;
for (i = 0; i < len; i ++)
bus_space_write_1(sc->bst, sc->bsh, reg + i, *(p+i));
+
#ifdef notyet
bus_space_write_region_1(sc->bst, sc->bsh, reg, buf, len);
#endif
diff -r 23478a9ef9b5 -r d9b16885212e head/sys/dev/rt2860/rt2860_reg.h
--- a/head/sys/dev/rt2860/rt2860_reg.h Sun Feb 12 17:14:30 2012 +0200
+++ b/head/sys/dev/rt2860/rt2860_reg.h Fri Feb 17 20:15:53 2012 +0200
@@ -172,6 +172,7 @@
#define RT2860_REG_WCID_ATTR(wcid) (0x6800 + (wcid) * 4)
#define RT2860_REG_SKEY(vap, kidx) (0x6c00 + ((vap) * 4 + (kidx)) * 32)
#define RT2860_REG_SKEY_MODE(vap) (0x7000 + ((vap) / 2) * 4)
+#define RT2860_REG_SKEY_MODE_0_7 0x7000
#define RT2860_REG_MCU_UCODE_BASE 0x2000
More information about the Zrouter-src-freebsd
mailing list