Author: sam
Date: Sat Jun 27 20:06:56 2009
New Revision: 195114
URL: http://svn.freebsd.org/changeset/base/195114

Log:
  Add HAL_RX_FILTER_BSSID support (to disable bssid match):
  o add HAL_CAP_BSSIDMATCH to identify parts that have the support for
    disabling bssid match
  o honor capability for set/get rx filter
  o use HAL_CAP_BSSIDMATCH in driver to decide whether to use the bssid
    match disable or fall back to promisc mode
  
  Reviewed by:  rpaulo
  Approved by:  re (rwatson)

Modified:
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c       Sat Jun 27 19:57:55 2009        
(r195113)
+++ head/sys/dev/ath/ath_hal/ah.c       Sat Jun 27 20:06:56 2009        
(r195114)
@@ -503,6 +503,8 @@ ath_hal_getcapability(struct ath_hal *ah
        case HAL_CAP_INTRMASK:          /* mask of supported interrupts */
                *result = pCap->halIntrMask;
                return HAL_OK;
+       case HAL_CAP_BSSIDMATCH:        /* hardware has disable bssid match */
+               return pCap->halBssidMatchSupport ? HAL_OK : HAL_ENOTSUPP;
        default:
                return HAL_EINVAL;
        }

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h       Sat Jun 27 19:57:55 2009        
(r195113)
+++ head/sys/dev/ath/ath_hal/ah.h       Sat Jun 27 20:06:56 2009        
(r195114)
@@ -110,6 +110,7 @@ typedef enum {
        HAL_CAP_BB_HANG         = 35,   /* can baseband hang */
        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_CAPABILITY_TYPE;
 
 /* 
@@ -296,6 +297,7 @@ typedef enum {
        HAL_RX_FILTER_PHYERR    = 0x00000100,   /* Allow phy errors */
        HAL_RX_FILTER_PHYRADAR  = 0x00000200,   /* Allow phy radar errors */
        HAL_RX_FILTER_COMPBAR   = 0x00000400,   /* Allow compressed BAR */
+       HAL_RX_FILTER_BSSID     = 0x00000800,   /* Disable BSSID match */
 } HAL_RX_FILTER;
 
 typedef enum {

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h      Sat Jun 27 19:57:55 2009        
(r195113)
+++ head/sys/dev/ath/ath_hal/ah_internal.h      Sat Jun 27 20:06:56 2009        
(r195114)
@@ -193,7 +193,8 @@ typedef struct {
                        halExtChanDfsSupport            : 1,
                        halForcePpmSupport              : 1,
                        halEnhancedPmSupport            : 1,
-                       halMbssidAggrSupport            : 1;
+                       halMbssidAggrSupport            : 1,
+                       halBssidMatchSupport            : 1;
        uint32_t        halWirelessModes;
        uint16_t        halTotalQueues;
        uint16_t        halKeyCacheSize;

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c     Sat Jun 27 19:57:55 
2009        (r195113)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c     Sat Jun 27 20:06:56 
2009        (r195114)
@@ -833,11 +833,15 @@ ar5212FillCapabilityInfo(struct ath_hal 
        ahpriv->ah_rxornIsFatal =
            (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_VENICE);
 
-       /* h/w phy counters first appeared in Hainan */
-       pCap->halHwPhyCounterSupport =
-           (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE &&
+       /* enable features that first appeared in Hainan */
+       if ((AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE &&
             AH_PRIVATE(ah)->ah_macRev == AR_SREV_HAINAN) ||
-           AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_VENICE;
+           AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_VENICE) {
+               /* h/w phy counters */
+               pCap->halHwPhyCounterSupport = AH_TRUE;
+               /* bssid match disable */
+               pCap->halBssidMatchSupport = AH_TRUE;
+       }
 
        pCap->halTstampPrecision = 15;
        pCap->halIntrMask = HAL_INT_COMMON

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c       Sat Jun 27 19:57:55 
2009        (r195113)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c       Sat Jun 27 20:06:56 
2009        (r195114)
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5212_recv.c,v 1.4 2008/11/10 04:08:03 sam Exp $
+ * $FreeBSD$
  */
 #include "opt_ah.h"
 
@@ -163,6 +163,9 @@ ar5212GetRxFilter(struct ath_hal *ah)
                bits |= HAL_RX_FILTER_PHYRADAR;
        if (phybits & (AR_PHY_ERR_OFDM_TIMING|AR_PHY_ERR_CCK_TIMING))
                bits |= HAL_RX_FILTER_PHYERR;
+       if (AH_PRIVATE(ah)->ah_caps.halBssidMatchSupport &&
+           (OS_REG_READ(ah, AR_MISC_MODE) & AR_MISC_MODE_BSSID_MATCH_FORCE))
+               bits |= HAL_RX_FILTER_BSSID;
        return bits;
 }
 
@@ -175,7 +178,8 @@ ar5212SetRxFilter(struct ath_hal *ah, ui
        uint32_t phybits;
 
        OS_REG_WRITE(ah, AR_RX_FILTER,
-           bits &~ (HAL_RX_FILTER_PHYRADAR|HAL_RX_FILTER_PHYERR));
+           bits &~ (HAL_RX_FILTER_PHYRADAR|HAL_RX_FILTER_PHYERR|
+           HAL_RX_FILTER_BSSID));
        phybits = 0;
        if (bits & HAL_RX_FILTER_PHYRADAR)
                phybits |= AR_PHY_ERR_RADAR;
@@ -189,6 +193,14 @@ ar5212SetRxFilter(struct ath_hal *ah, ui
                OS_REG_WRITE(ah, AR_RXCFG,
                        OS_REG_READ(ah, AR_RXCFG) &~ AR_RXCFG_ZLFDMA);
        }
+       if (AH_PRIVATE(ah)->ah_caps.halBssidMatchSupport) {
+               uint32_t miscbits = OS_REG_READ(ah, AR_MISC_MODE);
+               if (bits & HAL_RX_FILTER_BSSID)
+                       miscbits |= AR_MISC_MODE_BSSID_MATCH_FORCE;
+               else
+                       miscbits &= ~AR_MISC_MODE_BSSID_MATCH_FORCE;
+               OS_REG_WRITE(ah, AR_MISC_MODE, miscbits);
+       }
 }
 
 /*

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Sat Jun 27 19:57:55 
2009        (r195113)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Sat Jun 27 20:06:56 
2009        (r195114)
@@ -811,6 +811,7 @@ ar5416FillCapabilityInfo(struct ath_hal 
        pCap->halMbssidAggrSupport = AH_TRUE;
        pCap->halForcePpmSupport = AH_TRUE;
        pCap->halEnhancedPmSupport = AH_TRUE;
+       pCap->halBssidMatchSupport = AH_TRUE;
 
        if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) &&
            ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == 
HAL_OK) {

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h        Sat Jun 27 19:57:55 2009        
(r195113)
+++ head/sys/dev/ath/if_athvar.h        Sat Jun 27 20:06:56 2009        
(r195114)
@@ -590,6 +590,8 @@ void        ath_intr(void *);
        (ath_hal_getcapability(_ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)
 #define        ath_hal_hasbssidmask(_ah) \
        (ath_hal_getcapability(_ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK)
+#define        ath_hal_hasbssidmatch(_ah) \
+       (ath_hal_getcapability(_ah, HAL_CAP_BSSIDMATCH, 0, NULL) == HAL_OK)
 #define        ath_hal_hastsfadjust(_ah) \
        (ath_hal_getcapability(_ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK)
 #define        ath_hal_gettsfadjust(_ah) \
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to