Remove, rename, and move various mystery meat defines

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3756 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
mentor 2008-07-06 02:31:09 +00:00
parent 4c5dbf4fbd
commit caa352fdd2
2 changed files with 25 additions and 43 deletions

View File

@ -3701,13 +3701,12 @@ static int
ath_keyset_tkip(struct ath_softc *sc, const struct ieee80211_key *k, ath_keyset_tkip(struct ath_softc *sc, const struct ieee80211_key *k,
HAL_KEYVAL *hk, const u_int8_t mac[IEEE80211_ADDR_LEN]) HAL_KEYVAL *hk, const u_int8_t mac[IEEE80211_ADDR_LEN])
{ {
#define IEEE80211_KEY_XR (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)
static const u_int8_t zerobssid[IEEE80211_ADDR_LEN]; static const u_int8_t zerobssid[IEEE80211_ADDR_LEN];
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
KASSERT(k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP, KASSERT(k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP,
("got a non-TKIP key, cipher %u", k->wk_cipher->ic_cipher)); ("got a non-TKIP key, cipher %u", k->wk_cipher->ic_cipher));
if ((k->wk_flags & IEEE80211_KEY_XR) == IEEE80211_KEY_XR) { if ((k->wk_flags & IEEE80211_KEY_TXRX) == IEEE80211_KEY_TXRX) {
if (sc->sc_splitmic) { if (sc->sc_splitmic) {
/* /*
* TX key goes at first index, RX key at the rx index. * TX key goes at first index, RX key at the rx index.
@ -3738,11 +3737,9 @@ ath_keyset_tkip(struct ath_softc *sc, const struct ieee80211_key *k,
return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk,
mac, AH_FALSE); mac, AH_FALSE);
} }
} else if (k->wk_flags & IEEE80211_KEY_XR) { } else if (k->wk_flags & IEEE80211_KEY_TXRX) {
/* /* TX/RX key goes at first index.
* TX/RX key goes at first index. * The HAL handles the MIC keys are index + 64. */
* The HAL handles the MIC keys are index+64.
*/
memcpy(hk->kv_mic, k->wk_flags & IEEE80211_KEY_XMIT ? memcpy(hk->kv_mic, k->wk_flags & IEEE80211_KEY_XMIT ?
k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic));
KEYPRINTF(sc, k->wk_keyix, hk, mac); KEYPRINTF(sc, k->wk_keyix, hk, mac);
@ -3750,7 +3747,6 @@ ath_keyset_tkip(struct ath_softc *sc, const struct ieee80211_key *k,
AH_FALSE); AH_FALSE);
} }
return 0; return 0;
#undef IEEE80211_KEY_XR
} }
/* /*
@ -4158,13 +4154,14 @@ ath_key_update_end(struct ieee80211vap *vap)
static u_int32_t static u_int32_t
ath_calcrxfilter(struct ath_softc *sc) ath_calcrxfilter(struct ath_softc *sc)
{ {
#define RX_FILTER_PRESERVE (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR)
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
struct net_device *dev = ic->ic_dev; struct net_device *dev = ic->ic_dev;
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
u_int32_t rfilt; u_int32_t rfilt;
rfilt = (ath_hal_getrxfilter(ah) & RX_FILTER_PRESERVE) | /* Preserve the current Phy. radar and err. filters. */
rfilt = (ath_hal_getrxfilter(ah) &
(HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR)) |
HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST |
HAL_RX_FILTER_MCAST; HAL_RX_FILTER_MCAST;
if (ic->ic_opmode != IEEE80211_M_STA) if (ic->ic_opmode != IEEE80211_M_STA)
@ -4181,7 +4178,6 @@ ath_calcrxfilter(struct ath_softc *sc)
if (sc->sc_curchan.privFlags & CHANNEL_DFS) if (sc->sc_curchan.privFlags & CHANNEL_DFS)
rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR); rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR);
return rfilt; return rfilt;
#undef RX_FILTER_PRESERVE
} }
/* /*
@ -4377,14 +4373,13 @@ ath_updateslot(struct net_device *dev)
static void static void
ath_beacon_dturbo_config(struct ieee80211vap *vap, u_int32_t intval) ath_beacon_dturbo_config(struct ieee80211vap *vap, u_int32_t intval)
{ {
#define IS_CAPABLE(vap) \
(vap->iv_bss && (vap->iv_bss->ni_ath_flags & (IEEE80211_ATHC_TURBOP)) == \
(IEEE80211_ATHC_TURBOP))
struct ieee80211com *ic = vap->iv_ic; struct ieee80211com *ic = vap->iv_ic;
struct ath_softc *sc = ic->ic_dev->priv; struct ath_softc *sc = ic->ic_dev->priv;
if (ic->ic_opmode == IEEE80211_M_HOSTAP && IS_CAPABLE(vap)) { /* Check VAP capability. */
if ((ic->ic_opmode == IEEE80211_M_HOSTAP) && vap->iv_bss &&
((vap->iv_bss->ni_ath_flags & IEEE80211_ATHC_TURBOP) ==
IEEE80211_ATHC_TURBOP)) {
/* Dynamic Turbo is supported on this channel. */ /* Dynamic Turbo is supported on this channel. */
sc->sc_dturbo = 1; sc->sc_dturbo = 1;
sc->sc_dturbo_tcount = 0; sc->sc_dturbo_tcount = 0;
@ -4418,7 +4413,6 @@ ath_beacon_dturbo_config(struct ieee80211vap *vap, u_int32_t intval)
sc->sc_dturbo = 0; sc->sc_dturbo = 0;
ic->ic_ath_cap &= ~IEEE80211_ATHC_BOOST; ic->ic_ath_cap &= ~IEEE80211_ATHC_BOOST;
} }
#undef IS_CAPABLE
} }
/* /*
@ -4648,7 +4642,6 @@ ath_beaconq_setup(struct ath_softc *sc)
static int static int
ath_beaconq_config(struct ath_softc *sc) ath_beaconq_config(struct ath_softc *sc)
{ {
#define ATH_EXPONENT_TO_VALUE(v) ((1<<v)-1)
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
HAL_TXQ_INFO qi; HAL_TXQ_INFO qi;
@ -4669,7 +4662,7 @@ ath_beaconq_config(struct ath_softc *sc)
*/ */
qi.tqi_aifs = wmep->wmep_aifsn; qi.tqi_aifs = wmep->wmep_aifsn;
qi.tqi_cwmin = 0; qi.tqi_cwmin = 0;
qi.tqi_cwmax = 2 * ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); qi.tqi_cwmax = 2 * ((1 << wmep->wmep_logcwmin) - 1);
} }
DPRINTF(sc, ATH_DEBUG_BEACON_PROC, DPRINTF(sc, ATH_DEBUG_BEACON_PROC,
@ -4685,7 +4678,6 @@ ath_beaconq_config(struct ath_softc *sc)
ath_hal_resettxqueue(ah, sc->sc_bhalq); /* push to h/w */ ath_hal_resettxqueue(ah, sc->sc_bhalq); /* push to h/w */
return 1; return 1;
} }
#undef ATH_EXPONENT_TO_VALUE
} }
static int static int
@ -7188,8 +7180,6 @@ ath_tx_setup(struct ath_softc *sc, int ac, int haltype)
static int static int
ath_txq_update(struct ath_softc *sc, struct ath_txq *txq, int ac) ath_txq_update(struct ath_softc *sc, struct ath_txq *txq, int ac)
{ {
#define ATH_EXPONENT_TO_VALUE(v) ((1<<v)-1)
#define ATH_TXOP_TO_US(v) (v<<5)
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac]; struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac];
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
@ -7197,9 +7187,9 @@ ath_txq_update(struct ath_softc *sc, struct ath_txq *txq, int ac)
ath_hal_gettxqueueprops(ah, txq->axq_qnum, &qi); ath_hal_gettxqueueprops(ah, txq->axq_qnum, &qi);
qi.tqi_aifs = wmep->wmep_aifsn; qi.tqi_aifs = wmep->wmep_aifsn;
qi.tqi_cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin); qi.tqi_cwmin = (1 << wmep->wmep_logcwmin) - 1;
qi.tqi_cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax); qi.tqi_cwmax = (1 << wmep->wmep_logcwmax) - 1;
qi.tqi_burstTime = ATH_TXOP_TO_US(wmep->wmep_txopLimit); qi.tqi_burstTime = wmep->wmep_txopLimit / 32; /* 32 us units. */
if (!ath_hal_settxqueueprops(ah, txq->axq_qnum, &qi)) { if (!ath_hal_settxqueueprops(ah, txq->axq_qnum, &qi)) {
EPRINTF(sc, "Unable to update hardware queue " EPRINTF(sc, "Unable to update hardware queue "
@ -7210,8 +7200,6 @@ ath_txq_update(struct ath_softc *sc, struct ath_txq *txq, int ac)
ath_hal_resettxqueue(ah, txq->axq_qnum); /* push to h/w */ ath_hal_resettxqueue(ah, txq->axq_qnum); /* push to h/w */
return 1; return 1;
} }
#undef ATH_TXOP_TO_US
#undef ATH_EXPONENT_TO_VALUE
} }
/* /*
@ -9331,7 +9319,6 @@ ath_comp_set(struct ieee80211vap *vap, struct ieee80211_node *ni, int en)
static void static void
ath_setup_comp(struct ieee80211_node *ni, int enable) ath_setup_comp(struct ieee80211_node *ni, int enable)
{ {
#define IEEE80211_KEY_XR (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)
struct ieee80211vap *vap = ni->ni_vap; struct ieee80211vap *vap = ni->ni_vap;
struct ath_softc *sc = vap->iv_ic->ic_dev->priv; struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
struct ath_node *an = ATH_NODE(ni); struct ath_node *an = ATH_NODE(ni);
@ -9353,8 +9340,8 @@ ath_setup_comp(struct ieee80211_node *ni, int enable)
if ((ni->ni_wpa_ie != NULL) && if ((ni->ni_wpa_ie != NULL) &&
(ni->ni_rsn.rsn_ucastcipher == IEEE80211_CIPHER_TKIP) && (ni->ni_rsn.rsn_ucastcipher == IEEE80211_CIPHER_TKIP) &&
sc->sc_splitmic) { sc->sc_splitmic) {
if ((ni->ni_ucastkey.wk_flags & IEEE80211_KEY_XR) if ((ni->ni_ucastkey.wk_flags & IEEE80211_KEY_TXRX)
== IEEE80211_KEY_XR) == IEEE80211_KEY_TXRX)
keyix = ni->ni_ucastkey.wk_keyix + 32; keyix = ni->ni_ucastkey.wk_keyix + 32;
else else
keyix = ni->ni_ucastkey.wk_keyix; keyix = ni->ni_ucastkey.wk_keyix;
@ -9371,7 +9358,6 @@ ath_setup_comp(struct ieee80211_node *ni, int enable)
} }
return; return;
#undef IEEE80211_KEY_XR
} }
#endif #endif
@ -12039,19 +12025,16 @@ ath_regdump_filter(struct ath_softc *sc, u_int32_t address) {
#ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR
char buf[MAX_REGISTER_NAME_LEN]; char buf[MAX_REGISTER_NAME_LEN];
#endif #endif
#define UNFILTERED AH_FALSE
#define FILTERED AH_TRUE
if ((ar_device(sc->devid) != 5212) && (ar_device(sc->devid) != 5213)) if ((ar_device(sc->devid) != 5212) && (ar_device(sc->devid) != 5213))
return FILTERED; return AH_TRUE;
/* Addresses with side effects are never dumped out by bulk debug /* Addresses with side effects are never dumped out by bulk debug
* dump routines. */ * dump routines. */
if ((address >= 0x00c0) && (address <= 0x00df)) return FILTERED; if ((address >= 0x00c0) && (address <= 0x00df)) return AH_TRUE;
if ((address >= 0x143c) && (address <= 0x143f)) return FILTERED; if ((address >= 0x143c) && (address <= 0x143f)) return AH_TRUE;
/* PCI timing registers are not interesting */ /* PCI timing registers are not interesting */
if ((address >= 0x4000) && (address <= 0x5000)) return FILTERED; if ((address >= 0x4000) && (address <= 0x5000)) return AH_TRUE;
/* reading 0x9200-0x092c causes crashes in turbo A mode? */ /* reading 0x9200-0x092c causes crashes in turbo A mode? */
if ((address >= 0x0920) && (address <= 0x092c)) return FILTERED; if ((address >= 0x0920) && (address <= 0x092c)) return AH_TRUE;
#ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR
/* We are being conservative, and do not want to access addresses that /* We are being conservative, and do not want to access addresses that
@ -12060,13 +12043,11 @@ ath_regdump_filter(struct ath_softc *sc, u_int32_t address) {
* openHAL). */ * openHAL). */
return (AH_TRUE == ath_hal_lookup_register_name(sc->sc_ah, buf, return (AH_TRUE == ath_hal_lookup_register_name(sc->sc_ah, buf,
MAX_REGISTER_NAME_LEN, address)) ? MAX_REGISTER_NAME_LEN, address)) ?
UNFILTERED : FILTERED; AH_FALSE : AH_TRUE;
#else /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */ #else /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */
return UNFILTERED; return AH_FALSE;
#endif /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */ #endif /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */
#undef UNFILTERED
#undef FILTERED
} }
#endif /* #ifdef ATH_REVERSE_ENGINEERING */ #endif /* #ifdef ATH_REVERSE_ENGINEERING */

View File

@ -80,6 +80,7 @@ struct ieee80211_key {
#define IEEE80211_KEY_GROUP 0x04 /* key used for WPA group operation */ #define IEEE80211_KEY_GROUP 0x04 /* key used for WPA group operation */
#define IEEE80211_KEY_SWCRYPT 0x10 /* host-based encrypt/decrypt */ #define IEEE80211_KEY_SWCRYPT 0x10 /* host-based encrypt/decrypt */
#define IEEE80211_KEY_SWMIC 0x20 /* host-based enmic/demic */ #define IEEE80211_KEY_SWMIC 0x20 /* host-based enmic/demic */
#define IEEE80211_KEY_TXRX (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)
ieee80211_keyix_t wk_keyix; /* key index */ ieee80211_keyix_t wk_keyix; /* key index */
u_int8_t wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; u_int8_t wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
#define wk_txmic wk_key+IEEE80211_KEYBUF_SIZE+0 /* XXX can't () right */ #define wk_txmic wk_key+IEEE80211_KEYBUF_SIZE+0 /* XXX can't () right */