Changeset 2310

Show
Ignore:
Timestamp:
05/04/07 15:45:58 (2 years ago)
Author:
mentor
Message:

Merge trunk to hal-0.9.30.13 - r2248:r2309

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/madwifi-hal-0.9.30.13/Makefile.inc

    r2053 r2310  
    147147TOOLS=  $(TOP)/tools  
    148148 
    149 COPTS+= -Werror 
     149WARNINGS = -Werror 
     150COPTS+= $(WARNINGS) 
    150151INCS=   -include $(TOP)/include/compat.h -I$(TOP)/include 
    151152 
  • branches/madwifi-hal-0.9.30.13/THANKS

    r2248 r2310  
    138138  two donations with a total of 7 MiniPCI cards 
    139139 
     140* IndraNet Technologies Ltd, New Zealand - http://www.indranet.com.nz 
     141  Minstrel rate control module 
     142 
    140143* Linux-Consulting, USA - http://www.linux-consulting.com 
    141144  madwifi.org domain name, DNS server maintenance 
  • branches/madwifi-hal-0.9.30.13/ath/if_ath.c

    r2248 r2310  
    8080#include "net80211/if_athproto.h" 
    8181#include "if_athvar.h" 
     82 
    8283#include "ah_desc.h" 
     84/* This is defined rubbishly in ah_desc.h; it is only used in this file, so 
     85 * redefine it here. */ 
     86#undef HAL_TXKEYIX_INVALID 
     87#define HAL_TXKEYIX_INVALID     ((ieee80211_keyix_t) -1) 
     88 
    8389#include "ah_devid.h"                   /* XXX to identify chipset */ 
    8490 
     
    131137static void ath_initkeytable(struct ath_softc *); 
    132138#endif 
    133 static int ath_key_alloc(struct ieee80211vap *, const struct ieee80211_key *); 
     139static ieee80211_keyix_t ath_key_alloc(struct ieee80211vap *, const struct ieee80211_key *); 
    134140static int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *, 
    135141        struct ieee80211_node *); 
     
    393399        struct ath_softc *sc = dev->priv; 
    394400        struct ieee80211com *ic = &sc->sc_ic; 
     401        struct ieee80211vap *vap; 
    395402        struct ath_hal *ah; 
    396403        HAL_STATUS status; 
     
    898905        if (autocreatemode != -1) { 
    899906                rtnl_lock(); 
    900                 error = ieee80211_create_vap(ic, "ath%d", dev, 
     907                vap = ieee80211_create_vap(ic, "ath%d", dev, 
    901908                                autocreatemode, IEEE80211_CLONE_BSSID); 
    902909                rtnl_unlock(); 
    903                 if (error
    904                         printk(KERN_ERR "%s: autocreation of VAP failed: %d\n", 
    905                                 dev->name, error); 
     910                if (vap == NULL
     911                        printk(KERN_ERR "%s: autocreation of VAP failed.", 
     912                                dev->name); 
    906913        } 
    907914 
     
    13931400                        break; 
    13941401 
    1395                 /* XXX: we do not support frames spanning multiple descriptors */ 
     1402                /* XXX: We do not support frames spanning multiple descriptors */ 
    13961403                bf->bf_status |= ATH_BUFSTATUS_DONE; 
    13971404 
    1398                 /* errors? */ 
     1405                /* Errors? */ 
    13991406                if (rs->rs_status) 
    14001407                        continue; 
    14011408 
    1402                 /* prepare wireless header for examination */ 
     1409                /* Prepare wireless header for examination */ 
    14031410                bus_dma_sync_single(sc->sc_bdev, bf->bf_skbaddr,  
    14041411                                sizeof(struct ieee80211_qosframe),  
     
    14061413                qwh = (struct ieee80211_qosframe *) skb->data; 
    14071414 
    1408                 /* find the node. it MUST be in the keycache. */ 
     1415                /* Find the node. it MUST be in the keycache. */ 
    14091416                if (rs->rs_keyix == HAL_RXKEYIX_INVALID || 
    14101417                    (ni = sc->sc_keyixmap[rs->rs_keyix]) == NULL) { 
     
    14181425                         */ 
    14191426#if 0 
    1420                         /* 
    1421                          * This print is very chatty, so removing for now. 
    1422                          */ 
     1427                        /* This print is very chatty, so removing for now. */ 
    14231428                        DPRINTF(sc, ATH_DEBUG_UAPSD, "%s: U-APSD node (%s) has invalid keycache entry\n", 
    14241429                                __func__, ether_sprintf(qwh->i_addr2)); 
     
    14411446                        /* 
    14421447                         * NB: do not require lock here since this runs at intr 
    1443                          * "proper" time and cannot be interrupted by rx tasklet 
     1448                         * "proper" time and cannot be interrupted by RX tasklet 
    14441449                         * (code there has lock). May want to place a macro here 
    14451450                         * (that does nothing) to make this more clear. 
     
    14651470                                        ic->ic_uapsdmaxtriggers); 
    14661471                                /*  
    1467                                  * XXX: rapidly thrashing sta could get  
     1472                                 * XXX: Rapidly thrashing sta could get  
    14681473                                 * out-of-order frames due this flush placing 
    14691474                                 * frames on backlogged regular AC queue and 
     
    22292234        struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb)); 
    22302235        const HAL_RATE_TABLE *rt; 
    2231         unsigned int pktlen, hdrlen, keyix, try0, power; 
     2236        unsigned int pktlen, hdrlen, try0, power; 
     2237        ieee80211_keyix_t keyix; 
    22322238        HAL_PKT_TYPE atype; 
    22332239        u_int flags; 
     
    28622868                        memcpy(hk->kv_mic, k->wk_txmic, sizeof(hk->kv_mic)); 
    28632869                        KEYPRINTF(sc, k->wk_keyix, hk, zerobssid); 
    2864                         if (!ath_hal_keyset(ah, k->wk_keyix, hk, zerobssid)) 
     2870                        if (!ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, zerobssid)) 
    28652871                                return 0; 
    28662872 
    28672873                        memcpy(hk->kv_mic, k->wk_rxmic, sizeof(hk->kv_mic)); 
    2868                         KEYPRINTF(sc, k->wk_keyix+32, hk, mac); 
     2874                        KEYPRINTF(sc, k->wk_keyix + 32, hk, mac); 
    28692875                        /* XXX delete tx key on failure? */ 
    2870                         return ath_hal_keyset(ah, k->wk_keyix+32, hk, mac); 
     2876                        return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix + 32), hk, mac); 
    28712877                } else { 
    28722878                        /* 
     
    28802886#endif 
    28812887                        KEYPRINTF(sc, k->wk_keyix, hk, mac); 
    2882                         return ath_hal_keyset(ah, k->wk_keyix, hk, mac); 
     2888                        return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac); 
    28832889                } 
    28842890        } else if (k->wk_flags & IEEE80211_KEY_XR) { 
     
    28902896                        k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); 
    28912897                KEYPRINTF(sc, k->wk_keyix, hk, mac); 
    2892                 return ath_hal_keyset(ah, k->wk_keyix, hk, mac); 
     2898                return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), hk, mac); 
    28932899        } 
    28942900        return 0; 
     
    29542960        } else { 
    29552961                KEYPRINTF(sc, k->wk_keyix, &hk, mac); 
    2956                 return ath_hal_keyset(ah, k->wk_keyix, &hk, mac); 
     2962                return ath_hal_keyset(ah, ATH_KEY(k->wk_keyix), &hk, mac); 
    29572963        } 
    29582964#undef N 
     
    29632969 * each key, one for decrypt/encrypt and the other for the MIC. 
    29642970 */ 
    2965 static u_int16_t 
     2971static ieee80211_keyix_t 
    29662972key_alloc_2pair(struct ath_softc *sc) 
    29672973{ 
    29682974#define N(a)    ((int)(sizeof(a)/sizeof(a[0]))) 
    2969         u_int i, keyix; 
     2975        u_int i; 
     2976        ieee80211_keyix_t keyix; 
    29702977 
    29712978        KASSERT(sc->sc_splitmic, ("key cache !split")); 
     
    30153022 * each key, one for decrypt/encrypt and the other for the MIC. 
    30163023 */ 
    3017 static u_int16_t 
     3024static ieee80211_keyix_t 
    30183025key_alloc_pair(struct ath_softc *sc) 
    30193026{ 
    30203027#define N(a)    (sizeof(a)/sizeof(a[0])) 
    3021         u_int i, keyix; 
     3028        u_int i; 
     3029        ieee80211_keyix_t keyix; 
    30223030 
    30233031        KASSERT(!sc->sc_splitmic, ("key cache split")); 
     
    30603068 * Allocate a single key cache slot. 
    30613069 */ 
    3062 static u_int16_t 
     3070static ieee80211_keyix_t 
    30633071key_alloc_single(struct ath_softc *sc) 
    30643072{ 
    30653073#define N(a)    ((int)(sizeof(a)/sizeof(a[0]))) 
    3066         u_int i, keyix; 
     3074        u_int i; 
     3075        ieee80211_keyix_t keyix; 
    30673076 
    30683077        /* XXX try i,i+32,i+64,i+32+64 to minimize key pair conflicts */ 
     
    30963105 * 64 entries. 
    30973106 */ 
    3098 static in
     3107static ieee80211_keyix_
    30993108ath_key_alloc(struct ieee80211vap *vap, const struct ieee80211_key *k) 
    31003109{ 
     
    31653174        const struct ieee80211_cipher *cip = k->wk_cipher; 
    31663175        struct ieee80211_node *ni; 
    3167         u_int keyix = k->wk_keyix; 
     3176        ieee80211_keyix_t keyix = k->wk_keyix; 
    31683177        unsigned int rxkeyoff = 0; 
    31693178 
     
    56685677                        if (ni != NULL) { 
    56695678                                struct ath_node *an = ATH_NODE(ni); 
    5670                                 u_int16_t keyix; 
     5679                                ieee80211_keyix_t keyix; 
    56715680 
    56725681                                ATH_RSSI_LPF(an->an_avgrssi, rs->rs_rssi); 
     
    58685877        unsigned int i, amode; 
    58695878        unsigned int flags = 0; 
    5870         unsigned int pktlen = 0, keyix = 0; 
     5879        unsigned int pktlen = 0; 
     5880        ieee80211_keyix_t keyix = 0; 
    58715881        unsigned int pollsperrate, pos; 
    58725882        struct sk_buff *skb = NULL; 
     
    59906000                                        k = ieee80211_crypto_encap(vap->iv_bss, skb); 
    59916001                                        if (k) 
    5992                                                 keyix = k->wk_keyix
     6002                                                keyix = ATH_KEY(k->wk_keyix)
    59936003                                } 
    59946004                        } 
     
    65156525        struct ath_hal *ah = sc->sc_ah; 
    65166526        int isprot, ismcast, istxfrag; 
    6517         unsigned int keyix, hdrlen, pktlen, comp = ATH_COMP_PROC_NO_COMP_NO_CCS; 
    6518         int try0
     6527        unsigned int try0, hdrlen, pktlen, comp = ATH_COMP_PROC_NO_COMP_NO_CCS; 
     6528        ieee80211_keyix_t keyix
    65196529        u_int8_t rix, txrate, ctsrate; 
    65206530        u_int32_t ivlen = 0, icvlen = 0; 
    6521         u_int8_t cix = 0xff;           /* NB: silence compiler */ 
     6531        u_int8_t cix = 0xff; 
    65226532        struct ath_desc *ds = NULL; 
    65236533        struct ath_txq *txq = NULL; 
     
    65926602                                        pktlen += cip->ic_miclen; 
    65936603                } 
    6594                 keyix = k->wk_keyix
     6604                keyix = ATH_KEY(k->wk_keyix)
    65956605 
    65966606#ifdef ATH_SUPERG_COMP 
     
    66046614                 * Use station key cache slot, if assigned. 
    66056615                 */ 
    6606                 keyix = ni->ni_ucastkey.wk_keyix; 
    6607                 if (keyix == IEEE80211_KEYIX_NONE) 
    6608                         keyix = HAL_TXKEYIX_INVALID; 
     6616                keyix = ATH_KEY(ni->ni_ucastkey.wk_keyix); 
    66096617        } else 
    66106618                keyix = HAL_TXKEYIX_INVALID; 
     
    68246832                if (istxfrag) 
    68256833                        /* 
    6826                         **  if Tx fragment, it would be desirable to  
    6827                         **  use highest CCK rate for RTS/CTS. 
    6828                         **  However, stations farther away may detect it 
    6829                         **  at a lower CCK rate. Therefore, use the  
    6830                         **  configured protect rate, which is 2 Mbps 
    6831                         **  for 11G. 
    6832                         */ 
     6834                        *  if Tx fragment, it would be desirable to  
     6835                        *  use highest CCK rate for RTS/CTS. 
     6836                        *  However, stations farther away may detect it 
     6837                        *  at a lower CCK rate. Therefore, use the  
     6838                        *  configured protect rate, which is 2 Mbps 
     6839                        *  for 11G. 
     6840                        */ 
    68336841                        cix = rt->info[sc->sc_protrix].controlRate; 
    68346842                else 
     
    68446852            (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) { 
    68456853                u_int16_t dur; 
    6846                 /* 
    6847                  * XXX not right with fragmentation. 
    6848                  */ 
     6854                 
     6855                /* XXX: not right with fragmentation. */ 
    68496856                if (shortPreamble) 
    68506857                        dur = rt->info[rix].spAckDuration; 
     
    72717278#ifdef ATH_SUPERG_FF 
    72727279                { 
    7273                         struct sk_buff *skbnext = bf->bf_skb, *skb = NULL; 
     7280                        /* Handle every skb after the first one - these are FF extra 
     7281                         * buffers */ 
     7282                        struct sk_buff *tskb = NULL, *skb = bf->bf_skb->next; 
    72747283                        unsigned int i; 
    72757284 
    72767285                        for (i = 0; i < bf->bf_numdescff; i++) { 
    7277                                 skb = skbnext; 
    7278                                 skbnext = skb->next; 
     7286                                tskb = skb->next; 
    72797287                                bus_unmap_single(sc->sc_bdev, bf->bf_skbaddrff[i], 
    72807288                                                skb->len, BUS_DMA_TODEVICE); 
     
    72827290                                        __func__, skb); 
    72837291                                ath_tx_capture(sc->sc_dev, bf, skb); 
     7292                                skb = tskb; 
    72847293                        } 
    72857294                } 
     
    75747583        sc->sc_rxbufsize = roundup(IEEE80211_MAX_LEN, sc->sc_cachelsz); 
    75757584#endif 
    7576         DPRINTF(sc,ATH_DEBUG_RESET, "%s: mtu %u cachelsz %u rxbufsize %u\n", 
     7585        DPRINTF(sc, ATH_DEBUG_RESET, "%s: mtu %u cachelsz %u rxbufsize %u\n", 
    75777586                __func__, dev->mtu, sc->sc_cachelsz, sc->sc_rxbufsize); 
    75787587 
     
    82218230        struct ath_softc *sc = vap->iv_ic->ic_dev->priv; 
    82228231        struct ath_node *an = ATH_NODE(ni); 
    8223         u_int16_t keyindex; 
     8232        ieee80211_keyix_t keyix; 
    82248233 
    82258234        if (enable) { 
     
    82338242 
    82348243                /* Setup decompression mask. 
    8235                  * For TKIP and split MIC case, recv. keyindex is at 32 offset 
     8244                 * For TKIP and split MIC case, recv. keyix is at 32 offset 
    82368245                 * from tx key. 
    82378246                 */ 
     
    82418250                        if ((ni->ni_ucastkey.wk_flags & IEEE80211_KEY_XR)  
    82428251                                                        == IEEE80211_KEY_XR) 
    8243                                 keyindex = ni->ni_ucastkey.wk_keyix + 32; 
     8252                                keyix = ni->ni_ucastkey.wk_keyix + 32; 
    82448253                        else 
    8245                                 keyindex = ni->ni_ucastkey.wk_keyix; 
     8254                                keyix = ni->ni_ucastkey.wk_keyix; 
    82468255                } else 
    8247                         keyindex = ni->ni_ucastkey.wk_keyix + ni->ni_rxkeyoff; 
    8248  
    8249                 ath_hal_setdecompmask(sc->sc_ah, keyindex, 1); 
    8250                 an->an_decomp_index = keyindex; 
     8256                        keyix = ni->ni_ucastkey.wk_keyix + ni->ni_rxkeyoff; 
     8257 
     8258                ath_hal_setdecompmask(sc->sc_ah, keyix, 1); 
     8259                an->an_decomp_index = keyix; 
    82518260        } else { 
    82528261                if (an->an_decomp_index != INVALID_DECOMP_INDEX) { 
     
    82748283        struct ieee80211vap *vap = ni->ni_vap; 
    82758284        struct ath_softc *sc = vap->iv_ic->ic_dev->priv; 
    8276         u_int16_t keyix; 
     8285        ieee80211_keyix_t keyix; 
    82778286 
    82788287        keyix = ath_key_alloc(vap, &ni->ni_ucastkey); 
     
    83138322        struct ieee80211_key tmpkey; 
    83148323        struct ieee80211_key *rcv_key, *xmit_key; 
    8315         unsigned int txkeyidx, rxkeyidx = IEEE80211_KEYIX_NONE, i; 
     8324        unsigned int i; 
     8325        ieee80211_keyix_t txkeyidx, rxkeyidx = IEEE80211_KEYIX_NONE; 
    83168326        u_int8_t null_macaddr[IEEE80211_ADDR_LEN] = {0, 0, 0, 0, 0, 0}; 
    83178327 
  • branches/madwifi-hal-0.9.30.13/ath/if_athvar.h

    r2219 r2310  
    314314#define ATH_KEYMAX      128             /* max key cache size we handle */ 
    315315#define ATH_KEYBYTES    (ATH_KEYMAX / NBBY)     /* storage space in bytes */ 
     316 
     317/* 
     318 * Convert from net80211 layer values to Ath layer values. Hopefully this will 
     319 * be optimised away when the two constants are the same. 
     320 */ 
     321#define ATH_KEY(_keyix) ((_keyix == IEEE80211_KEYIX_NONE) ? HAL_TXKEYIX_INVALID : _keyix) 
     322 
    316323#define ATH_MIN_FF_RATE 12000           /* min rate for ff aggregation in kbps */ 
    317324#define ATH_MIN_FF_RATE 12000           /* min rate for ff aggregation in kbps */ 
     
    593600        u_int sc_fftxqmin;                      /* aggregation threshold */ 
    594601        HAL_INT sc_imask;                       /* interrupt mask copy */ 
    595         u_int sc_keymax;                               /* size of key cache */ 
     602        u_int sc_keymax;                        /* size of key cache */ 
    596603        u_int8_t sc_keymap[ATH_KEYBYTES];       /* key use bit map */ 
    597604        struct ieee80211_node *sc_keyixmap[ATH_KEYMAX];/* key ix->node map */ 
    598605        u_int8_t sc_bssidmask[IEEE80211_ADDR_LEN]; 
    599606 
    600         u_int sc_ledpin;                               /* GPIO pin for driving LED */ 
     607        u_int sc_ledpin;                        /* GPIO pin for driving LED */ 
    601608        u_int sc_ledon;                         /* pin setting for LED on */ 
    602609        u_int sc_ledidle;                       /* idle polling interval */ 
    603         int sc_ledevent;                               /* time of last LED event */ 
     610        int sc_ledevent;                        /* time of last LED event */ 
    604611        u_int8_t sc_rxrate;                     /* current rx rate for LED */ 
    605612        u_int8_t sc_txrate;                     /* current tx rate for LED */ 
     
    636643        u_int sc_bmisscount;                    /* missed beacon transmits */ 
    637644        u_int32_t sc_ant_tx[8];                 /* recent tx frames/antenna */ 
    638         struct ath_txq *sc_cabq;                       /* tx q for cab frames */ 
     645        struct ath_txq *sc_cabq;                /* tx q for cab frames */ 
    639646        struct ath_txq sc_grpplq;               /* tx q for XR group polls */ 
    640647        struct ath_txq *sc_xrtxq;               /* tx q for XR data */ 
  • branches/madwifi-hal-0.9.30.13/ath_hal/ah_os.h

    r2178 r2310  
    146146 
    147147#if (AH_BYTE_ORDER == AH_BIG_ENDIAN) 
    148 #define _OS_REG_WRITE(_ah, _reg, _val) do {                             \ 
    149         (0x4000 <= (_reg) && (_reg) < 0x5000) ?                         \ 
    150          writel((_val), (_ah)->ah_sh + (_reg)) :        \ 
    151          __raw_writel((_val), (_ah)->ah_sh + (_reg));   \ 
     148#define _OS_REG_WRITE(_ah, _reg, _val) do {                     \ 
     149        (0x4000 <= (_reg) && (_reg) < 0x5000) ?                 \ 
     150         writel((_val), (_ah)->ah_sh + (_reg)) :                \ 
     151         ({__raw_writel((_val), (_ah)->ah_sh + (_reg));         \ 
     152           mb(); }); 
    152153} while (0) 
    153154#define _OS_REG_READ(_ah, _reg)                                 \ 
    154155        ((0x4000 <= (_reg) && (_reg) < 0x5000) ?                \ 
    155          readl((_ah)->ah_sh + (_reg)) : \ 
    156          __raw_readl((_ah)->ah_sh + (_reg))) 
     156         readl((_ah)->ah_sh + (_reg)) :                         \ 
     157         ({unsigned long __v = __raw_readl((_ah)->ah_sh +       \ 
     158          (_reg)); mb(); __v; })) 
    157159#else /* AH_LITTLE_ENDIAN */ 
    158160#define _OS_REG_WRITE(_ah, _reg, _val) do {                     \ 
  • branches/madwifi-hal-0.9.30.13/ath_rate/amrr/amrr.c

    r2178 r2310  
    104104ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 
    105105        int shortPreamble, size_t frameLen, 
    106         u_int8_t *rix, int *try0, u_int8_t *txrate) 
     106        u_int8_t *rix, unsigned int *try0, u_int8_t *txrate) 
    107107{ 
    108108        struct amrr_node *amn = ATH_NODE_AMRR(an); 
  • branches/madwifi-hal-0.9.30.13/ath_rate/minstrel/minstrel.c

    r2248 r2310  
    117117#include "minstrel.h" 
    118118 
     119/* XXX: Use standard debug functions */ 
    119120#define MINSTREL_DEBUG 10 
    120121#ifdef MINSTREL_DEBUG 
     
    129130#endif 
    130131 
    131 #define ONE_SECOND (1000 * 1000)  /* 1 second, or 1000 milliseconds, eternity in other words */ 
     132#define ONE_SECOND (1000 * 1000)  /* 1 second, or 1000 milliseconds; eternity, in other words */ 
    132133 
    133134#include "release.h" 
     
    193194        unsigned int x = 0, tt = 0; 
    194195        unsigned int cix = rt->info[rix].controlRate; 
    195         int rts, cts
     196        int rts = 0, cts = 0
    196197        int cw = WIFI_CW_MIN; 
    197198 
     
    206207        } 
    207208         
    208         /* XXX getting MAC/PHY level timings should be fixed for turbo 
     209        /* XXX: Getting MAC/PHY level timings should be fixed for turbo 
    209210         * rates, and there is probably a way to get this from the 
    210211         * HAL... */ 
    211212        switch (rt->info[rix].phy) { 
    212213        case IEEE80211_T_OFDM: 
     214#if 0 
    213215                t_slot = 9; 
    214216                t_sifs = 16; 
    215217                t_difs = 28; 
    216218                /* fall through */ 
    217                 /* XXX: WTF? */ 
     219#endif 
    218220        case IEEE80211_T_TURBO: 
    219221                t_slot = 9; 
     
    222224                break; 
    223225        case IEEE80211_T_DS: 
    224                 /* fall through to default */ 
     226                /* Fall through to default */ 
    225227        default: 
    226                 /* pg 205 ieee.802.11.pdf */ 
     228                /* pg. 205 ieee.802.11.pdf */ 
    227229                t_slot = 20; 
    228230                t_difs = 50; 
     
    230232        } 
    231233 
    232         rts = cts = 0; 
    233  
    234234        if ((ic->ic_flags & IEEE80211_F_USEPROT) && 
    235             rt->info[rix].phy == IEEE80211_T_OFDM) { 
     235            (rt->info[rix].phy == IEEE80211_T_OFDM)) { 
    236236                if (ic->ic_protmode == IEEE80211_PROT_RTSCTS) 
    237237                        rts = 1; 
     
    288288ath_rate_node_init(struct ath_softc *sc, struct ath_node *an) 
    289289{ 
    290         /* NB: assumed to be zero'd by caller */ 
     290        /* NB: Assumed to be zero'd by caller */ 
    291291        ath_rate_ctl_reset(sc, &an->an_node); 
    292292} 
     
    312312ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 
    313313        int shortPreamble, size_t frameLen, 
    314         u_int8_t *rix, int *try0, u_int8_t *txrate) 
     314        u_int8_t *rix, unsigned int *try0, u_int8_t *txrate) 
    315315{ 
    316316        struct minstrel_node *sn = ATH_NODE_MINSTREL(an); 
     
    328328        mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR; 
    329329 
    330         if (sn->static_rate_ndx != -1) { 
     330        if (sn->static_rate_ndx >= 0) { 
    331331                ndx = sn->static_rate_ndx; 
    332332        } else { 
    333333                sn->packet_count++; 
    334                 sn->random_n = (sn->a*sn->random_n) + sn->b; 
     334                sn->random_n = (sn->a * sn->random_n) + sn->b; 
    335335                offset = sn->random_n & 0xf; 
    336                 if ((((100 * sn->sample_count)/(sn->sample_count + sn->packet_count)) < ath_lookaround_rate) && (offset < 2)) { 
     336                if ((((100 * sn->sample_count) / (sn->sample_count + sn->packet_count)) < ath_lookaround_rate) && (offset < 2)) { 
    337337                        sn->sample_count++; 
    338338                        sn->is_sampling = 1; 
    339                         if (sn->packet_count >= (10000)) { 
     339                        if (sn->packet_count >= 10000) { 
    340340                                sn->sample_count = 0; 
    341341                                sn->packet_count = 0; 
     
    368368                *try0 = sn->retry_adjusted_count[ndx]; 
    369369 
    370         KASSERT(ndx >= 0 && ndx < sn->num_rates
     370        KASSERT((ndx < sn->num_rates)
    371371                ("%s: bad ndx (%d/%d) for %s?\n", 
    372372                 dev_info, ndx, sn->num_rates, 
     
    399399        rc3 = 0; 
    400400 
    401         KASSERT(rc1 >= 0 && rc1 < sn->num_rates
     401        KASSERT((rc1 >= 0) && (rc1 < sn->num_rates)
    402402                ("%s: bad rc1 (%d/%d) for %s?\n", 
    403403                 dev_info, rc1, sn->num_rates, 
    404404                 ether_sprintf(an->an_node.ni_macaddr))); 
    405405 
    406         KASSERT(rc2 >= 0 && rc2 < sn->num_rates
     406        KASSERT((rc2 >= 0) && (rc2 < sn->num_rates)
    407407                ("%s: bad rc2 (%d/%d) for %s?\n", 
    408408                 dev_info, rc2, sn->num_rates, 
    409409                 ether_sprintf(an->an_node.ni_macaddr))); 
    410410 
    411         KASSERT(rc3 >= 0 && rc3 < sn->num_rates
     411        KASSERT((rc3 >= 0) && (rc3 < sn->num_rates)
    412412                ("%s: bad rc3 (%d/%d) for %s?\n", 
    413413                 dev_info, rc3, sn->num_rates, 
     
    452452         * With no retransmits, it is always 0. 
    453453         * int finalTSIdx = ads->final_ts_index; */ 
    454         final_rate = sc->sc_hwmap[ts->ts_rate &~ HAL_TXSTAT_ALTRATE].ieeerate; 
     454        final_rate = sc->sc_hwmap[ts->ts_rate & ~HAL_TXSTAT_ALTRATE].ieeerate; 
    455455        final_ndx = rate_to_ndx(sn, final_rate); 
    456456        if (final_ndx >= sn->num_rates) { 
     
    463463        }                
    464464 
    465         /* tries is the total number of times we have endeavoured to 
     465        /* 'tries' is the total number of times we have endeavoured to 
    466466         * send this packet, and is a sum of the #attempts at each 
    467          * level in the multi rate retry chain */ 
     467         * level in the multi-rate retry chain */ 
    468468        tries = ts->ts_shortretry + ts->ts_longretry + 1; 
    469469 
     
    648648                        dev_info, __func__, ether_sprintf(ni->ni_macaddr), 
    649649                        vap->iv_fixed_rate); 
    650                 /* there are no rates yet we're done */ 
     650                /* There are no rates yet; we're done */ 
    651651                return; 
    652652        } 
     
    691691                sn->retry_adjusted_count[x] = 1; 
    692692 
    693                 for (retry_index = 2; retry_index < 11; retry_index++) { 
     693                for (retry_index = 2; retry_index < ATH_TXMAXTRY; retry_index++) { 
    694694                        tx_time = calc_usecs_unicast_packet(sc, 1200, sn->rates[x].rix, 0, retry_index); 
    695695                        if (tx_time >  ath_segment_size)  
     
    706706#endif 
    707707 
    708         /* set the initial rate */ 
    709         for (ndx = sn->num_rates-1; ndx > 0; ndx--) 
     708        /* Set the initial rate */ 
     709        for (ndx = sn->num_rates - 1; ndx > 0; ndx--) 
    710710                if (sn->rates[ndx].rate <= 72) 
    711711                        break; 
     
    793793         
    794794        /* Calculate statistics for each date rate in the table */ 
    795         /* micro_secs is the time to transmit 1200 bytes, or 9600 bits.*/ 
     795        /* 'micro_secs' is the time to transmit 1200 bytes, or 9600 bits. */ 
    796796        for (i = 0; i < rs->rs_nrates; i++) { 
    797797                micro_secs = rn->perfect_tx_time[i]; 
     
    804804                        rn->rs_att_hist[i]  += rn->rs_rateattempts[i]; 
    805805                        rn->rs_thisprob[i] = p; 
    806                         p = ((p * (100 - ath_ewma_level)) + (rn->rs_probability[i] * ath_ewma_level))/100; 
     806                        p = ((p * (100 - ath_ewma_level)) + (rn->rs_probability[i] * ath_ewma_level)) / 100; 
    807807                        rn->rs_probability[i] = p; 
    808                         rn->rs_this_tp[i] = p * (ONE_SECOND/micro_secs); 
     808                        rn->rs_this_tp[i] = p * (ONE_SECOND / micro_secs); 
    809809                        rn->rs_lastratesuccess[i] = rn->rs_ratesuccess[i]; 
    810810                        rn->rs_lastrateattempts[i] = rn->rs_rateattempts[i]; 
     
    818818                /* Sample less often below the 10% chance of success. 
    819819                 * Sample less often above the 95% chance of success. 
    820                  * rn->rs_probability is in units of 0..18000(100%), which avoids rounding issues.*/ 
    821                 if ((rn->rs_probability[i] > 17100) || ( rn->rs_probability[i] < 1800)) { 
    822                         rn->retry_adjusted_count[i] = rn->retry_count[i]>> 1; 
     820                 * 'rn->rs_probability' has a scale of 0 (0%) to 18000 (100%), which avoids rounding issues.*/ 
     821                if ((rn->rs_probability[i] > 17100) || (rn->rs_probability[i] < 1800)) { 
     822                        rn->retry_adjusted_count[i] = rn->retry_count[i] >> 1; 
    823823                        if (rn->retry_adjusted_count[i] > 2) 
    824824                                rn->retry_adjusted_count[i] = 2; 
     
    829829        } 
    830830          
    831         /* The High speed rates (e.g 54mbps) is checked last. If 
     831        /* The High speed rates (e.g 54Mbps) is checked last. If 
    832832         * throughput is the same for two rates, we prefer the 
    833833         * lower rate, as this has a better chance of success. */ 
     
    931931                odst = ATH_NODE_MINSTREL(an); 
    932932                /* Skip ourself */ 
    933                 if (memcmp(vap->iv_myaddr, ni->ni_macaddr, IEEE80211_ADDR_LEN) == 0
     933                if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ni->ni_macaddr)
    934934                        continue; 
    935935 
     
    946946                                     (x == odst->max_prob_rate) ? "P" : " "); 
    947947 
    948                         p += sprintf(p, "%3d%s", 
    949                                         odst->rates[x].rate/2, 
     948                        p += sprintf(p, "%3u%s", 
     949                                        odst->rates[x].rate / 2, 
    950950                                        (odst->rates[x].rate & 0x1) != 0 ? ".5" : "  "); 
    951951 
     
    981981                return -ENOMEM; 
    982982 
    983         /* initially allocate both read and write buffers */ 
     983        /* Initially allocate both read and write buffers */ 
    984984        pv = (struct proc_ieee80211_priv *) file->private_data; 
    985985        memset(pv, 0, sizeof(struct proc_ieee80211_priv)); 
     
    10011001        pv->max_rlen = MAX_PROC_IEEE80211_SIZE; 
    10021002 
    1003         /* now read the data into the buffer */ 
     1003        /* Now read the data into the buffer */ 
    10041004        pv->rlen = ath_proc_read_nodes(vap, pv->rbuf, MAX_PROC_IEEE80211_SIZE); 
    10051005        return 0; 
  • branches/madwifi-hal-0.9.30.13/ath_rate/onoe/onoe.c

    r2178 r2310  
    121121ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 
    122122        int shortPreamble, size_t frameLen, 
    123         u_int8_t *rix, int *try0, u_int8_t *txrate) 
     123        u_int8_t *rix, unsigned int *try0, u_int8_t *txrate) 
    124124{ 
    125125        struct onoe_node *on = ATH_NODE_ONOE(an); 
  • branches/madwifi-hal-0.9.30.13/ath_rate/sample/sample.c

    r2211 r2310  
    375375ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 
    376376        int shortPreamble, size_t frameLen, 
    377         u_int8_t *rix, int *try0, u_int8_t *txrate) 
     377        u_int8_t *rix, unsigned int *try0, u_int8_t *txrate) 
    378378{ 
    379379        struct sample_node *sn = ATH_NODE_SAMPLE(an); 
  • branches/madwifi-hal-0.9.30.13/include/compat.h