From c04bc3e3948aa0a7262f322fd14a4b0ee346146d Mon Sep 17 00:00:00 2001 From: benoit Date: Sun, 1 Jun 2008 09:34:30 +0000 Subject: [PATCH] Merge -dfs r3410 and r3687 for proper multicast key search operation (disable at this point since it does not work as expected). git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3688 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 14 ++- ath/if_ath_hal_wrappers.h | 176 ++++++++++++++++++++------------------ 2 files changed, 105 insertions(+), 85 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index 98800a5..af2038a 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -962,9 +962,17 @@ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag) sc->sc_splitmic = 1; } sc->sc_hasclrkey = ath_hal_ciphersupported(ah, HAL_CIPHER_CLR); -#if 0 - sc->sc_mcastkey = ath_hal_getmcastkeysearch(ah); -#endif + + /* If hardware has multicast key search capabilities, disable it. It + * is not currently supported by the driver. It seems we can properly + * enable things in the HAL, however multicast packets are still + * decoded using keys located at index 0..3, so current code is no + * longer working */ + if (ath_hal_hasmcastkeysearch(ah)) { + ath_hal_setmcastkeysearch(ah, AH_FALSE); + } + sc->sc_mcastkey = ath_hal_getmcastkeysearch(ah); + /* * Mark key cache slots associated with global keys * as in use. If we knew TKIP was not to be used we diff --git a/ath/if_ath_hal_wrappers.h b/ath/if_ath_hal_wrappers.h index ca05802..6ee8def 100644 --- a/ath/if_ath_hal_wrappers.h +++ b/ath/if_ath_hal_wrappers.h @@ -45,6 +45,8 @@ #ifndef _IF_ATH_HAL_WRAPPERS_H_ #define _IF_ATH_HAL_WRAPPERS_H_ +/* ath_reg_write & ath_reg_read */ + static inline void ath_reg_write(struct ath_softc *sc, u_int reg, u_int32_t val) { ATH_HAL_LOCK_IRQ(sc); @@ -61,9 +63,12 @@ static inline u_int32_t ath_reg_read(struct ath_softc *sc, u_int reg) return ret; } -static inline HAL_BOOL ath_hal_burstsupported(struct ath_hal *ah) +/* ath_hal_getcapability & ath_hal_setcapability sorted by + * HAL_CAPABILITY_TYPE */ + +static inline HAL_BOOL ath_hal_getregdomain(struct ath_hal *ah, u_int32_t *destination) { - return (ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination) == HAL_OK); } static inline HAL_BOOL ath_hal_ciphersupported(struct ath_hal *ah, u_int32_t cipher) @@ -71,84 +76,74 @@ static inline HAL_BOOL ath_hal_ciphersupported(struct ath_hal *ah, u_int32_t cip return (ath_hal_getcapability(ah, HAL_CAP_CIPHER, cipher, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_compressionsupported(struct ath_hal *ah) -{ - return (ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK); -} - -static inline HAL_BOOL ath_hal_fastframesupported(struct ath_hal *ah) -{ - return (ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK); -} - -static inline HAL_BOOL ath_hal_getcountrycode(struct ath_hal *ah, u_int32_t *destination) +static inline HAL_BOOL ath_hal_hastkipmic(struct ath_hal *ah) { - return ((*(destination) = ah->ah_countryCode), AH_TRUE); + return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_getdiversity(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_gettkipmic(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal *ah, u_int32_t *destination) +static inline HAL_BOOL ath_hal_settkipmic(struct ath_hal *ah, u_int32_t v) { - return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2, destination) == HAL_OK); + return (ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC, 1, v, NULL)); } -static inline HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hastkipsplit(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_getnumtxqueues(struct ath_hal *ah, u_int32_t *destination) +static inline HAL_BOOL ath_hal_gettkipsplit(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_NUM_TXQUEUES, 0, destination) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_getregdomain(struct ath_hal *ah, u_int32_t *destination) +static inline HAL_BOOL ath_hal_settkipsplit(struct ath_hal *ah, int v) { - return (ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination) == HAL_OK); + return (ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT, 1, v, NULL)); } -static inline HAL_BOOL ath_hal_gettkipmic(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hwphycounters(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_PHYCOUNTERS, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_gettkipsplit(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hasdiversity(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 1, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_gettpc(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_getdiversity(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_TPC, 1, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_gettpscale(struct ath_hal *ah, u_int32_t *destination) +static inline HAL_BOOL ath_hal_setdiversity(struct ath_hal *ah, int v) { - return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3, destination) == HAL_OK); + return (ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 1, v, NULL)); } -static inline HAL_BOOL ath_hal_gettsfadjust(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_getnumtxqueues(struct ath_hal *ah, u_int32_t *destination) { - return (ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 1, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_NUM_TXQUEUES, 0, destination) == HAL_OK); } -static inline HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal *ah, u_int32_t *destination) +static inline HAL_BOOL ath_hal_hasveol(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1, destination) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hascompression(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_CHAN_HALFRATE, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hasbssidmask(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_compressionsupported(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK); } static inline HAL_BOOL ath_hal_hasbursting(struct ath_hal *ah) @@ -156,14 +151,14 @@ static inline HAL_BOOL ath_hal_hasbursting(struct ath_hal *ah) return (ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hascompression(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_burstsupported(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_COMPRESSION, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_BURST, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hasdiversity(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_fastframesupported(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK); } static inline HAL_BOOL ath_hal_hasfastframes(struct ath_hal *ah) @@ -171,24 +166,29 @@ static inline HAL_BOOL ath_hal_hasfastframes(struct ath_hal *ah) return (ath_hal_getcapability(ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hasrfsilent(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_gettxpowlimit(struct ath_hal *ah, u_int32_t *destination) { - return (ath_hal_getcapability(ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 1, destination) == HAL_OK); } -static inline HAL_BOOL ath_hal_hastkipmic(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_getmaxtxpow(struct ath_hal *ah, u_int32_t *destination) { - return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 2, destination) == HAL_OK); } -static inline HAL_BOOL ath_hal_hastkipsplit(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_gettpscale(struct ath_hal *ah, u_int32_t *destination) { - return (ath_hal_getcapability(ah, HAL_CAP_TKIP_SPLIT, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 3, destination) == HAL_OK); +} + +static inline HAL_BOOL ath_hal_settpscale(struct ath_hal *ah, u_int32_t v) +{ + return (ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3, v, NULL)); } static inline HAL_BOOL ath_hal_hastpc(struct ath_hal *ah) @@ -196,79 +196,79 @@ static inline HAL_BOOL ath_hal_hastpc(struct ath_hal *ah) return (ath_hal_getcapability(ah, HAL_CAP_TPC, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hastsfadjust(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_gettpc(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_TPC, 1, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hastxpowlimit(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_settpc(struct ath_hal *ah, u_int32_t v) { - return (ath_hal_getcapability(ah, HAL_CAP_TXPOW, 0, NULL) == HAL_OK); + return (ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v, NULL)); } -static inline HAL_BOOL ath_hal_hasveol(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hasbssidmask(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_VEOL, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_hwphycounters(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hasmcastkeysearch(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_PHYCOUNTERS, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_getmcastkeysearch(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_CHAN_QUARTERRATE, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_setdiversity(struct ath_hal *ah, int v) +static inline HAL_BOOL ath_hal_setmcastkeysearch(struct ath_hal *ah, u_int32_t v) { - return (ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 1, v, NULL)); + return ath_hal_setcapability(ah, HAL_CAP_MCAST_KEYSRCH, 1, v, NULL); } -static inline HAL_BOOL ath_hal_setrfsilent(struct ath_hal *ah, u_int32_t v) +static inline HAL_BOOL ath_hal_hastsfadjust(struct ath_hal *ah) { - return (ath_hal_setcapability(ah, HAL_CAP_RFSILENT, 1, v, NULL)); + return (ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_settkipmic(struct ath_hal *ah, u_int32_t v) +static inline HAL_BOOL ath_hal_gettsfadjust(struct ath_hal *ah) { - return (ath_hal_setcapability(ah, HAL_CAP_TKIP_MIC, 1, v, NULL)); + return (ath_hal_getcapability(ah, HAL_CAP_TSF_ADJUST, 1, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_settkipsplit(struct ath_hal *ah, int v) +static inline HAL_BOOL ath_hal_settsfadjust(struct ath_hal *ah, u_int32_t v) { - return (ath_hal_setcapability(ah, HAL_CAP_TKIP_SPLIT, 1, v, NULL)); + return (ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST, 1, v, NULL)); } -static inline HAL_BOOL ath_hal_settpc(struct ath_hal *ah, u_int32_t v) +static inline HAL_BOOL ath_hal_xrsupported(struct ath_hal *ah) { - return (ath_hal_setcapability(ah, HAL_CAP_TPC, 1, v, NULL)); + return ath_hal_getcapability(ah, HAL_CAP_XR, 0, NULL) == HAL_OK; } -static inline HAL_BOOL ath_hal_settpscale(struct ath_hal *ah, u_int32_t v) +static inline HAL_BOOL ath_hal_wmetkipmic(struct ath_hal *ah) { - return (ath_hal_setcapability(ah, HAL_CAP_TXPOW, 3, v, NULL)); + return (ath_hal_getcapability(ah, HAL_CAP_WME_TKIPMIC, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_settsfadjust(struct ath_hal *ah, u_int32_t v) +static inline HAL_BOOL ath_hal_halfrate_chansupported(struct ath_hal *ah) { - return (ath_hal_setcapability(ah, HAL_CAP_TSF_ADJUST, 1, v, NULL)); + return (ath_hal_getcapability(ah, HAL_CAP_CHAN_HALFRATE, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_turboagsupported(struct ath_hal *ah, int countrycode) +static inline HAL_BOOL ath_hal_quarterrate_chansupported(struct ath_hal *ah) { - return (ath_hal_getwirelessmodes(ah, countrycode) & (HAL_MODE_108G | HAL_MODE_TURBO)); + return (ath_hal_getcapability(ah, HAL_CAP_CHAN_QUARTERRATE, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_wmetkipmic(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_hasrfsilent(struct ath_hal *ah) { - return (ath_hal_getcapability(ah, HAL_CAP_WME_TKIPMIC, 0, NULL) == HAL_OK); + return (ath_hal_getcapability(ah, HAL_CAP_RFSILENT, 0, NULL) == HAL_OK); } -static inline HAL_BOOL ath_hal_xrsupported(struct ath_hal *ah) +static inline HAL_BOOL ath_hal_setrfsilent(struct ath_hal *ah, u_int32_t v) { - return ath_hal_getcapability(ah, HAL_CAP_XR, 0, NULL) == HAL_OK; + return (ath_hal_setcapability(ah, HAL_CAP_RFSILENT, 1, v, NULL)); } static inline HAL_BOOL ath_hal_hasintmit(struct ath_hal *ah) @@ -286,4 +286,16 @@ static inline HAL_BOOL ath_hal_setintmit(struct ath_hal *ah, u_int32_t v) return (ath_hal_setcapability(ah, HAL_CAP_INTMIT, 1, v, NULL)); } +/* misc */ + +static inline HAL_BOOL ath_hal_getcountrycode(struct ath_hal *ah, u_int32_t *destination) +{ + return ((*(destination) = ah->ah_countryCode), AH_TRUE); +} + +static inline HAL_BOOL ath_hal_turboagsupported(struct ath_hal *ah, int countrycode) +{ + return (ath_hal_getwirelessmodes(ah, countrycode) & (HAL_MODE_108G | HAL_MODE_TURBO)); +} + #endif /* #ifndef _IF_ATH_HAL_WRAPPERS_H_ */ -- 2.35.1