Changeset 1478

Show
Ignore:
Timestamp:
03/21/06 22:36:32 (3 years ago)
Author:
jbicket
Message:

add option to set ack bitrate:
sysctl -w dev.wifi0.ackrate=1 # send acks at high bit-rate
sysctl -w dev.wifi0.ackrate=0 # send it at a basic-rate (default)
Only works on 5212, 5213 devices.

Files:

Legend:

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

    r1475 r1478  
    111111static void ath_vap_delete(struct ieee80211vap *); 
    112112static int ath_init(struct net_device *); 
     113static int ath_set_ack_bitrate(struct ath_softc *, int); 
    113114static int ath_reset(struct net_device *); 
    114115static void ath_fatal_tasklet(TQUEUE_ARG); 
     
    391392        u_int8_t csz; 
    392393 
     394        sc->devid = devid; 
    393395        sc->sc_debug = ath_debug; 
    394396        DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid); 
     
    19021904         */ 
    19031905        ath_chan_change(sc, ic->ic_curchan); 
     1906        ath_set_ack_bitrate(sc, sc->sc_ackrate); 
    19041907        dev->flags |= IFF_RUNNING;              /* we are ready to go */ 
    19051908        ieee80211_start_running(ic);            /* start all vap's */ 
     
    20062009} 
    20072010 
     2011static int  
     2012ar_device(int devid) 
     2013{ 
     2014        switch (devid) { 
     2015        case AR5210_DEFAULT: 
     2016        case AR5210_PROD: 
     2017        case AR5210_AP: 
     2018                return 5210; 
     2019        case AR5211_DEFAULT: 
     2020        case AR5311_DEVID: 
     2021        case AR5211_LEGACY: 
     2022        case AR5211_FPGA11B: 
     2023                return 5211; 
     2024        case AR5212_DEFAULT: 
     2025        case AR5212_DEVID: 
     2026        case AR5212_FPGA: 
     2027        case AR5212_DEVID_IBM: 
     2028        case AR5212_AR5312_REV2: 
     2029        case AR5212_AR5312_REV7: 
     2030        case AR5212_AR2313_REV8: 
     2031        case AR5212_AR2315_REV6: 
     2032        case AR5212_AR2315_REV7: 
     2033        case AR5212_AR2317_REV1: 
     2034        case AR5212_DEVID_0014: 
     2035        case AR5212_DEVID_0015: 
     2036        case AR5212_DEVID_0016: 
     2037        case AR5212_DEVID_0017: 
     2038        case AR5212_DEVID_0018: 
     2039        case AR5212_DEVID_0019: 
     2040        case AR5212_AR2413: 
     2041        case AR5212_AR5413: 
     2042        case AR5212_AR5424: 
     2043        case AR5212_DEVID_FF19: 
     2044                return 5212; 
     2045        case AR5213_SREV_1_0: 
     2046        case AR5213_SREV_REG: 
     2047        case AR_SUBVENDOR_ID_NOG: 
     2048        case AR_SUBVENDOR_ID_NEW_A: 
     2049                return 5213; 
     2050        default:  
     2051                return 0; /* unknown */ 
     2052        } 
     2053} 
     2054 
     2055 
     2056static int  
     2057ath_set_ack_bitrate(struct ath_softc *sc, int high)  
     2058{ 
     2059        struct ath_hal *ah = sc->sc_ah; 
     2060        if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) { 
     2061                /* set ack to be sent at low bit-rate */ 
     2062                /* registers taken from the openbsd 5212 hal */ 
     2063#define AR5K_AR5212_STA_ID1                     0x8004 
     2064#define AR5K_AR5212_STA_ID1_ACKCTS_6MB          0x01000000 
     2065#define AR5K_AR5212_STA_ID1_BASE_RATE_11B       0x02000000 
     2066                u_int32_t v = AR5K_AR5212_STA_ID1_BASE_RATE_11B | AR5K_AR5212_STA_ID1_ACKCTS_6MB; 
     2067                if (high) { 
     2068                        OS_REG_WRITE(ah, AR5K_AR5212_STA_ID1, OS_REG_READ(ah, AR5K_AR5212_STA_ID1) & ~v); 
     2069                } else { 
     2070                        OS_REG_WRITE(ah, AR5K_AR5212_STA_ID1, OS_REG_READ(ah, AR5K_AR5212_STA_ID1) | v); 
     2071                } 
     2072                return 0; 
     2073        } 
     2074        return 1; 
     2075} 
     2076 
    20082077/* 
    20092078 * Reset the hardware w/o losing operational state.  This is 
     
    20532122                ath_beacon_config(sc, NULL);    /* restart beacons */ 
    20542123        ath_hal_intrset(ah, sc->sc_imask); 
    2055  
     2124        ath_set_ack_bitrate(sc, sc->sc_ackrate); 
    20562125        netif_wake_queue(dev);          /* restart xmit */ 
    20572126#ifdef ATH_SUPERG_XR 
     
    89759044        ATH_XR_POLL_PERIOD      = 20, 
    89769045        ATH_XR_POLL_COUNT       = 21, 
     9046        ATH_ACKRATE             = 22, 
    89779047}; 
    89789048 
     
    91009170                                break; 
    91019171#endif 
     9172                        case ATH_ACKRATE: 
     9173                                sc->sc_ackrate = val; 
     9174                                ath_set_ack_bitrate(sc, sc->sc_ackrate); 
     9175                                break; 
    91029176                        default: 
    91039177                                return -EINVAL; 
     
    91569230                        break; 
    91579231#endif 
     9232                case ATH_ACKRATE: 
     9233                        val = sc->sc_ackrate; 
     9234                        break; 
    91589235                default: 
    91599236                        return -EINVAL; 
     
    92549331        }, 
    92559332#endif 
     9333        { .ctl_name     = ATH_ACKRATE, 
     9334          .procname     = "ackrate", 
     9335          .mode         = 0644, 
     9336          .proc_handler = ath_sysctl_halparam 
     9337        }, 
    92569338        { 0 } 
    92579339}; 
  • trunk/ath/if_athvar.h

    r1441 r1478  
    465465        struct net_device_stats sc_devstats;    /* device statistics */ 
    466466        struct ath_stats        sc_stats;               /* private statistics */ 
     467        int devid; 
    467468        int sc_debug; 
    468469        void (*sc_recv_mgmt)(struct ieee80211_node *, struct sk_buff *, int, int, u_int32_t); 
     
    504505                        sc_rtasksched:1,        /* radar task is scheduled */ 
    505506                        sc_dfswait:1,           /* waiting on channel for radar detect */ 
    506                         sc_dfstest:1;           /* Test timer in progress */ 
     507                        sc_dfstest:1,           /* Test timer in progress */ 
     508                        sc_ackrate:1;           /* send acks at high bitrate */ 
    507509        /* rate tables */ 
    508510        const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX];