From 1fe70193d4e3f0a0848d6c0af73aaf439d094bf9 Mon Sep 17 00:00:00 2001 From: adrian Date: Tue, 1 Feb 2011 03:51:35 +0000 Subject: Add a new capability which reports the number of spatial streams a device supports. The higher levels (net80211, if_ath, ath_rate) need this to make correct choices about what MCS capabilities to advertise and what MCS rates are able to be TXed. In summary: * AR5416 - 2/3 antennas, 2x2 streams * AR9160 - 2/3 antennas, 2x2 streams * AR9220 - 2 antennas, 2x2 sstraems * AR9280 - 2 antennas, 2x2 streams * AR9285 - 2 antennas but with antenna diversity, 1x1 stream --- sys/dev/ath/ath_hal/ah.c | 11 +++++++++++ sys/dev/ath/ath_hal/ah.h | 1 + sys/dev/ath/ath_hal/ah_internal.h | 2 ++ sys/dev/ath/ath_hal/ar5416/ar5416_attach.c | 3 +++ sys/dev/ath/ath_hal/ar9001/ar9160_attach.c | 4 ++++ sys/dev/ath/ath_hal/ar9002/ar9280_attach.c | 4 ++++ sys/dev/ath/ath_hal/ar9002/ar9285_attach.c | 4 ++++ 7 files changed, 29 insertions(+) diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c index 031caa2..ef4f256 100644 --- a/sys/dev/ath/ath_hal/ah.c +++ b/sys/dev/ath/ath_hal/ah.c @@ -583,6 +583,17 @@ ath_hal_getcapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, return HAL_OK; case HAL_CAP_BSSIDMATCH: /* hardware has disable bssid match */ return pCap->halBssidMatchSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_STREAMS: /* number of 11n spatial streams */ + switch (capability) { + case 0: /* TX */ + *result = pCap->halTxStreams; + return HAL_OK; + case 1: /* RX */ + *result = pCap->halRxStreams; + return HAL_OK; + default: + return HAL_ENOTSUPP; + } default: return HAL_EINVAL; } diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h index cb1af32..6358a72 100644 --- a/sys/dev/ath/ath_hal/ah.h +++ b/sys/dev/ath/ath_hal/ah.h @@ -111,6 +111,7 @@ typedef enum { HAL_CAP_MAC_HANG = 36, /* can MAC hang */ HAL_CAP_INTRMASK = 37, /* bitmask of supported interrupts */ HAL_CAP_BSSIDMATCH = 38, /* hardware has disable bssid match */ + HAL_CAP_STREAMS = 39, /* how many 802.11n spatial streams are available */ } HAL_CAPABILITY_TYPE; /* diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h index 46f252f..f8c157d 100644 --- a/sys/dev/ath/ath_hal/ah_internal.h +++ b/sys/dev/ath/ath_hal/ah_internal.h @@ -209,6 +209,8 @@ typedef struct { uint8_t halNumAntCfg2GHz; uint8_t halNumAntCfg5GHz; uint32_t halIntrMask; + uint8_t halTxStreams; + uint8_t halRxStreams; } HAL_CAPABILITIES; struct regDomain; diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c index 5307cd7..4977462 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c @@ -819,6 +819,9 @@ ar5416FillCapabilityInfo(struct ath_hal *ah) pCap->halTxChainMask = ath_hal_eepromGet(ah, AR_EEP_TXMASK, AH_NULL); /* XXX CB71 uses GPIO 0 to indicate 3 rx chains */ pCap->halRxChainMask = ath_hal_eepromGet(ah, AR_EEP_RXMASK, AH_NULL); + /* AR5416 may have 3 antennas but is a 2x2 stream device */ + pCap->halTxStreams = 2; + pCap->halRxStreams = 2; pCap->halRtsAggrLimit = 8*1024; /* Owl 2.0 limit */ pCap->halMbssidAggrSupport = AH_TRUE; pCap->halForcePpmSupport = AH_TRUE; diff --git a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c index 7ea4467..4674a79 100644 --- a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c +++ b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c @@ -290,6 +290,10 @@ ar9160FillCapabilityInfo(struct ath_hal *ah) pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; pCap->halAutoSleepSupport = AH_FALSE; /* XXX? */ + /* AR9160 is a 2x2 stream device */ + pCap->halTxStreams = 2; + pCap->halRxStreams = 2; + return AH_TRUE; } diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c index 8302f3d..589a923 100644 --- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c +++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c @@ -684,6 +684,10 @@ ar9280FillCapabilityInfo(struct ath_hal *ah) #if 0 pCap->halWowMatchPatternDword = AH_TRUE; #endif + /* AR9280 is a 2x2 stream device */ + pCap->halTxStreams = 2; + pCap->halRxStreams = 2; + pCap->halCSTSupport = AH_TRUE; pCap->halRifsRxSupport = AH_TRUE; pCap->halRifsTxSupport = AH_TRUE; diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c index f8383b8..2b9468e 100644 --- a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c +++ b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c @@ -370,6 +370,10 @@ ar9285FillCapabilityInfo(struct ath_hal *ah) #if 0 pCap->halWowMatchPatternDword = AH_TRUE; #endif + /* AR9285 has 2 antennas but is a 1x1 stream device */ + pCap->halTxStreams = 2; + pCap->halRxStreams = 2; + pCap->halCSTSupport = AH_TRUE; pCap->halRifsRxSupport = AH_TRUE; pCap->halRifsTxSupport = AH_TRUE; -- cgit v1.1