Changeset 3639

Show
Ignore:
Timestamp:
05/17/08 06:41:01 (3 months ago)
Author:
mentor
Message:

Interference mitigation control code changes:

  • More pedanting of comments
  • Update sysctl to return early if no change is made and OPNOTSUPP if !sc_hasintmit
  • Tidy call to set HAL int. mit. status. Remove chatty printf as it is known that this does not work.
  • Preprocessor out HAL call as the int. mit. status is unconditionally set manually.
  • Misc. churn.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/trunk/ath/if_ath.c

    r3635 r3639  
    617617         * problems for OFDM. */ 
    618618        sc->sc_hasintmit = ath_hal_hasintmit(ah); 
    619         if (!sc->sc_hasintmit) { 
    620                 if (intmit) { 
    621                         WPRINTF(sc, "Interference mitigation was requested, " 
    622                                     "but is not supported by the " 
    623                                     "HAL/hardware.\n"); 
    624                         intmit = 0; 
    625                 } 
    626                 sc->sc_useintmit = 0; 
     619        sc->sc_useintmit = (intmit && sc->sc_hasintmit); 
     620        if (!sc->sc_hasintmit && intmit) { 
     621                WPRINTF(sc, "Interference mitigation was requested, but is not" 
     622                                "supported by the HAL/hardware.\n"); 
     623                intmit = 0; /* Stop use in future ath_attach(). */ 
    627624        } 
    628625        else { 
    629                 ath_hal_setintmit(ah, (sc->sc_useintmit = intmit)); 
     626                ath_hal_setintmit(ah, sc->sc_useintmit); 
    630627                IPRINTF(sc, "Interference mitigation is supported.  Currently %s.\n", 
    631628                        (sc->sc_useintmit ? "enabled" : "disabled")); 
     
    16031600} 
    16041601 
    1605 /* NB: INTMIT was not implemented so that it could be enabled/disabled, 
     1602/* NB: Int. mit. was not implemented so that it could be enabled/disabled, 
    16061603 * and actually in 0.9.30.13 HAL it really can't even be disabled because 
    16071604 * it will start adjusting registers even when we turn off the capability 
     
    16091606 * 
    16101607 * NB: This helper function basically clobbers all the related registers 
    1611  * if we have disabled INTMIT cap, allowing us to turn it on and off and 
     1608 * if we have disabled int. mit. cap, allowing us to turn it on and off and 
    16121609 * work around the bug preventing it from being disabled. */ 
    16131610static inline void ath_override_intmit_if_disabled(struct ath_softc *sc) { 
    1614         /* Restore intmit registers if we turned off intmit! */ 
     1611        /* Restore int. mit. registers if they were turned off. */ 
    16151612        if (sc->sc_hasintmit && !sc->sc_useintmit) 
    16161613                ath_hal_restore_default_intmit(sc->sc_ah); 
    1617         /* Sanity check...remove later */ 
     1614        /* Sanity check... remove later. */ 
    16181615        if (!sc->sc_useintmit) { 
    16191616                ath_hal_verify_default_intmit(sc->sc_ah); 
    1620                 /* If we don't have INTMIT and we don't have DFS on channel, 
    1621                  * it is safe to filter error packets! */ 
     1617                /* If we don't have int. mit. and we don't have DFS on channel, 
     1618                 * it is safe to filter error packets. */ 
    16221619                if (!ath_radar_is_dfs_required(sc, &sc->sc_curchan)) { 
    1623                         ath_hal_setrxfilter(sc->sc_ah,  
     1620                        ath_hal_setrxfilter(sc->sc_ah, 
    16241621                                ath_hal_getrxfilter(sc->sc_ah) &  
    1625                                            ~HAL_RX_FILTER_PHYERR); 
     1622                                ~HAL_RX_FILTER_PHYERR); 
    16261623                } 
    16271624        } 
    16281625        else { 
    1629                 /* Make sure that we have errors in rx filter cause ANI needs  
     1626                /* Make sure that we have errors in RX filter because ANI needs 
    16301627                 * them. */ 
    16311628                ath_hal_setrxfilter(sc->sc_ah,  
     
    16911688        } 
    16921689 
    1693         if (sc->sc_hasintmit) { 
    1694                 u_int32_t intmit_on = 0; 
    1695                 ath_hal_getintmit(sc->sc_ah, &intmit_on); 
    1696                 if (intmit_on != sc->sc_useintmit) { 
    1697                         WPRINTF(sc, "Int. Mit. HAL capability out of sync.  Got %d!\n", intmit); 
    1698                         ath_hal_setintmit(sc->sc_ah, (sc->sc_hasintmit && sc->sc_useintmit)); 
    1699                 } 
    1700         } 
    17011690#ifdef ATH_CAP_TPC 
    17021691        if (sc->sc_hastpc && (hal_tpc != ath_hal_gettpc(sc->sc_ah))) { 
     
    17051694        } 
    17061695#endif 
    1707 /* XXX: Any other features they clobber? */ 
     1696#if 0 /* Setting via HAL does not work, so it is done manually below. */ 
     1697        if (sc->sc_hasintmit) 
     1698                ath_hal_setintmit(sc->sc_ah, sc->sc_useintmit); 
     1699#endif 
    17081700        ath_override_intmit_if_disabled(sc); 
    17091701        if (sc->sc_softled) 
    17101702                ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin); 
    1711         ath_update_txpow(sc);           /* update tx power state */ 
     1703        ath_update_txpow(sc);           /* Update TX power state. */ 
     1704        ath_setdefantenna(sc, sc->sc_defant); 
     1705        /* XXX: Any other clobbered features? */ 
     1706 
    17121707        ath_radar_update(sc); 
    1713         ath_setdefantenna(sc, sc->sc_defant); 
    17141708        ath_rp_flush(sc); 
    17151709 
     
    1069910693        u_int tab_3_val[3]; 
    1070010694        int ret = 0; 
    10701         int oldval = 0; 
    1070210695 
    1070310696        ctl->data = &val; 
     
    1092210915                                break; 
    1092310916                        case ATH_INTMIT: 
    10924                                 oldval = sc->sc_useintmit; 
    10925                                 sc->sc_useintmit = (sc->sc_hasintmit && val);  
     10917                                if (!sc->sc_hasintmit) { 
     10918                                        ret = -EOPNOTSUPP; 
     10919                                        break; 
     10920                                } 
     10921                                if (sc->sc_useintmit == val) 
     10922                                        break; 
     10923                                sc->sc_useintmit = val;  
    1092610924                                sc->sc_needmib = ath_hal_hwphycounters(ah) &&  
    10927                                         sc->sc_hasintmit &&  
    1092810925                                        sc->sc_useintmit; 
    1092910926                                /* Update the HAL and MIB interrupt mask bits */ 
    10930                                 ath_hal_setintmit(ah, val ? 1 : 0);  
     10927                                ath_hal_setintmit(ah, !!val);  
    1093110928                                sc->sc_imask = (sc->sc_imask & ~HAL_INT_MIB) |  
    1093210929                                        (sc->sc_needmib ? HAL_INT_MIB : 0); 
     
    1093410931                                /* Only do a reset if device is valid and UP  
    1093510932                                 * and we just made a change to the settings. */ 
    10936                                 if ((oldval != sc->sc_useintmit) && 
    10937                                     NULL != sc->sc_dev && !sc->sc_invalid && 
    10938                                     (sc->sc_dev->flags & IFF_RUNNING) &&  
    10939                                     sc->sc_hasintmit) 
     10933                                if (sc->sc_dev && !sc->sc_invalid && 
     10934                                    (sc->sc_dev->flags & IFF_RUNNING)) 
    1094010935                                        ath_reset(sc->sc_dev);  
    1094110936                                /* NB: Run this step to cleanup if HAL doesn't