Changeset 2310
- Timestamp:
- 05/04/07 15:45:58 (2 years ago)
- Files:
-
- branches/madwifi-hal-0.9.30.13/Makefile.inc (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/THANKS (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/ath/if_ath.c (modified) (35 diffs)
- branches/madwifi-hal-0.9.30.13/ath/if_athvar.h (modified) (3 diffs)
- branches/madwifi-hal-0.9.30.13/ath_hal/ah_os.h (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/ath_rate/amrr/amrr.c (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/ath_rate/minstrel/minstrel.c (modified) (24 diffs)
- branches/madwifi-hal-0.9.30.13/ath_rate/onoe/onoe.c (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/ath_rate/sample/sample.c (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/include/compat.h (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211.c (modified) (68 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211.h (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_crypto.c (modified) (7 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_crypto.h (modified) (8 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_crypto_ccmp.c (modified) (4 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_input.c (modified) (11 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_ioctl.h (modified) (3 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_linux.c (modified) (2 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_linux.h (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_node.c (modified) (2 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_output.c (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_power.c (modified) (2 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_rate.h (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_scan.c (modified) (10 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_var.h (modified) (4 diffs)
- branches/madwifi-hal-0.9.30.13/net80211/ieee80211_wireless.c (modified) (63 diffs)
- branches/madwifi-hal-0.9.30.13/scripts/find-madwifi-modules.sh (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/scripts/madwifi-unload.bash (modified) (1 diff)
- branches/madwifi-hal-0.9.30.13/tools/wlanconfig.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/madwifi-hal-0.9.30.13/Makefile.inc
r2053 r2310 147 147 TOOLS= $(TOP)/tools 148 148 149 COPTS+= -Werror 149 WARNINGS = -Werror 150 COPTS+= $(WARNINGS) 150 151 INCS= -include $(TOP)/include/compat.h -I$(TOP)/include 151 152 branches/madwifi-hal-0.9.30.13/THANKS
r2248 r2310 138 138 two donations with a total of 7 MiniPCI cards 139 139 140 * IndraNet Technologies Ltd, New Zealand - http://www.indranet.com.nz 141 Minstrel rate control module 142 140 143 * Linux-Consulting, USA - http://www.linux-consulting.com 141 144 madwifi.org domain name, DNS server maintenance branches/madwifi-hal-0.9.30.13/ath/if_ath.c
r2248 r2310 80 80 #include "net80211/if_athproto.h" 81 81 #include "if_athvar.h" 82 82 83 #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 83 89 #include "ah_devid.h" /* XXX to identify chipset */ 84 90 … … 131 137 static void ath_initkeytable(struct ath_softc *); 132 138 #endif 133 static i nt ath_key_alloc(struct ieee80211vap *, const struct ieee80211_key *);139 static ieee80211_keyix_t ath_key_alloc(struct ieee80211vap *, const struct ieee80211_key *); 134 140 static int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *, 135 141 struct ieee80211_node *); … … 393 399 struct ath_softc *sc = dev->priv; 394 400 struct ieee80211com *ic = &sc->sc_ic; 401 struct ieee80211vap *vap; 395 402 struct ath_hal *ah; 396 403 HAL_STATUS status; … … 898 905 if (autocreatemode != -1) { 899 906 rtnl_lock(); 900 error= ieee80211_create_vap(ic, "ath%d", dev,907 vap = ieee80211_create_vap(ic, "ath%d", dev, 901 908 autocreatemode, IEEE80211_CLONE_BSSID); 902 909 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); 906 913 } 907 914 … … 1393 1400 break; 1394 1401 1395 /* XXX: we do not support frames spanning multiple descriptors */1402 /* XXX: We do not support frames spanning multiple descriptors */ 1396 1403 bf->bf_status |= ATH_BUFSTATUS_DONE; 1397 1404 1398 /* errors? */1405 /* Errors? */ 1399 1406 if (rs->rs_status) 1400 1407 continue; 1401 1408 1402 /* prepare wireless header for examination */1409 /* Prepare wireless header for examination */ 1403 1410 bus_dma_sync_single(sc->sc_bdev, bf->bf_skbaddr, 1404 1411 sizeof(struct ieee80211_qosframe), … … 1406 1413 qwh = (struct ieee80211_qosframe *) skb->data; 1407 1414 1408 /* find the node. it MUST be in the keycache. */1415 /* Find the node. it MUST be in the keycache. */ 1409 1416 if (rs->rs_keyix == HAL_RXKEYIX_INVALID || 1410 1417 (ni = sc->sc_keyixmap[rs->rs_keyix]) == NULL) { … … 1418 1425 */ 1419 1426 #if 0 1420 /* 1421 * This print is very chatty, so removing for now. 1422 */ 1427 /* This print is very chatty, so removing for now. */ 1423 1428 DPRINTF(sc, ATH_DEBUG_UAPSD, "%s: U-APSD node (%s) has invalid keycache entry\n", 1424 1429 __func__, ether_sprintf(qwh->i_addr2)); … … 1441 1446 /* 1442 1447 * NB: do not require lock here since this runs at intr 1443 * "proper" time and cannot be interrupted by rxtasklet1448 * "proper" time and cannot be interrupted by RX tasklet 1444 1449 * (code there has lock). May want to place a macro here 1445 1450 * (that does nothing) to make this more clear. … … 1465 1470 ic->ic_uapsdmaxtriggers); 1466 1471 /* 1467 * XXX: rapidly thrashing sta could get1472 * XXX: Rapidly thrashing sta could get 1468 1473 * out-of-order frames due this flush placing 1469 1474 * frames on backlogged regular AC queue and … … 2229 2234 struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb)); 2230 2235 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; 2232 2238 HAL_PKT_TYPE atype; 2233 2239 u_int flags; … … 2862 2868 memcpy(hk->kv_mic, k->wk_txmic, sizeof(hk->kv_mic)); 2863 2869 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)) 2865 2871 return 0; 2866 2872 2867 2873 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); 2869 2875 /* 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); 2871 2877 } else { 2872 2878 /* … … 2880 2886 #endif 2881 2887 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); 2883 2889 } 2884 2890 } else if (k->wk_flags & IEEE80211_KEY_XR) { … … 2890 2896 k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); 2891 2897 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); 2893 2899 } 2894 2900 return 0; … … 2954 2960 } else { 2955 2961 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); 2957 2963 } 2958 2964 #undef N … … 2963 2969 * each key, one for decrypt/encrypt and the other for the MIC. 2964 2970 */ 2965 static u_int16_t2971 static ieee80211_keyix_t 2966 2972 key_alloc_2pair(struct ath_softc *sc) 2967 2973 { 2968 2974 #define N(a) ((int)(sizeof(a)/sizeof(a[0]))) 2969 u_int i, keyix; 2975 u_int i; 2976 ieee80211_keyix_t keyix; 2970 2977 2971 2978 KASSERT(sc->sc_splitmic, ("key cache !split")); … … 3015 3022 * each key, one for decrypt/encrypt and the other for the MIC. 3016 3023 */ 3017 static u_int16_t3024 static ieee80211_keyix_t 3018 3025 key_alloc_pair(struct ath_softc *sc) 3019 3026 { 3020 3027 #define N(a) (sizeof(a)/sizeof(a[0])) 3021 u_int i, keyix; 3028 u_int i; 3029 ieee80211_keyix_t keyix; 3022 3030 3023 3031 KASSERT(!sc->sc_splitmic, ("key cache split")); … … 3060 3068 * Allocate a single key cache slot. 3061 3069 */ 3062 static u_int16_t3070 static ieee80211_keyix_t 3063 3071 key_alloc_single(struct ath_softc *sc) 3064 3072 { 3065 3073 #define N(a) ((int)(sizeof(a)/sizeof(a[0]))) 3066 u_int i, keyix; 3074 u_int i; 3075 ieee80211_keyix_t keyix; 3067 3076 3068 3077 /* XXX try i,i+32,i+64,i+32+64 to minimize key pair conflicts */ … … 3096 3105 * 64 entries. 3097 3106 */ 3098 static i nt3107 static ieee80211_keyix_t 3099 3108 ath_key_alloc(struct ieee80211vap *vap, const struct ieee80211_key *k) 3100 3109 { … … 3165 3174 const struct ieee80211_cipher *cip = k->wk_cipher; 3166 3175 struct ieee80211_node *ni; 3167 u_int keyix = k->wk_keyix;3176 ieee80211_keyix_t keyix = k->wk_keyix; 3168 3177 unsigned int rxkeyoff = 0; 3169 3178 … … 5668 5677 if (ni != NULL) { 5669 5678 struct ath_node *an = ATH_NODE(ni); 5670 u_int16_t keyix;5679 ieee80211_keyix_t keyix; 5671 5680 5672 5681 ATH_RSSI_LPF(an->an_avgrssi, rs->rs_rssi); … … 5868 5877 unsigned int i, amode; 5869 5878 unsigned int flags = 0; 5870 unsigned int pktlen = 0, keyix = 0; 5879 unsigned int pktlen = 0; 5880 ieee80211_keyix_t keyix = 0; 5871 5881 unsigned int pollsperrate, pos; 5872 5882 struct sk_buff *skb = NULL; … … 5990 6000 k = ieee80211_crypto_encap(vap->iv_bss, skb); 5991 6001 if (k) 5992 keyix = k->wk_keyix;6002 keyix = ATH_KEY(k->wk_keyix); 5993 6003 } 5994 6004 } … … 6515 6525 struct ath_hal *ah = sc->sc_ah; 6516 6526 int isprot, ismcast, istxfrag; 6517 unsigned int keyix, hdrlen, pktlen, comp = ATH_COMP_PROC_NO_COMP_NO_CCS;6518 i nt try0;6527 unsigned int try0, hdrlen, pktlen, comp = ATH_COMP_PROC_NO_COMP_NO_CCS; 6528 ieee80211_keyix_t keyix; 6519 6529 u_int8_t rix, txrate, ctsrate; 6520 6530 u_int32_t ivlen = 0, icvlen = 0; 6521 u_int8_t cix = 0xff; /* NB: silence compiler */6531 u_int8_t cix = 0xff; 6522 6532 struct ath_desc *ds = NULL; 6523 6533 struct ath_txq *txq = NULL; … … 6592 6602 pktlen += cip->ic_miclen; 6593 6603 } 6594 keyix = k->wk_keyix;6604 keyix = ATH_KEY(k->wk_keyix); 6595 6605 6596 6606 #ifdef ATH_SUPERG_COMP … … 6604 6614 * Use station key cache slot, if assigned. 6605 6615 */ 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); 6609 6617 } else 6610 6618 keyix = HAL_TXKEYIX_INVALID; … … 6824 6832 if (istxfrag) 6825 6833 /* 6826 ** if Tx fragment, it would be desirable to6827 ** use highest CCK rate for RTS/CTS.6828 ** However, stations farther away may detect it6829 ** at a lower CCK rate. Therefore, use the6830 ** configured protect rate, which is 2 Mbps6831 ** 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 */ 6833 6841 cix = rt->info[sc->sc_protrix].controlRate; 6834 6842 else … … 6844 6852 (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) { 6845 6853 u_int16_t dur; 6846 /* 6847 * XXX not right with fragmentation. 6848 */ 6854 6855 /* XXX: not right with fragmentation. */ 6849 6856 if (shortPreamble) 6850 6857 dur = rt->info[rix].spAckDuration; … … 7271 7278 #ifdef ATH_SUPERG_FF 7272 7279 { 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; 7274 7283 unsigned int i; 7275 7284 7276 7285 for (i = 0; i < bf->bf_numdescff; i++) { 7277 skb = skbnext; 7278 skbnext = skb->next; 7286 tskb = skb->next; 7279 7287 bus_unmap_single(sc->sc_bdev, bf->bf_skbaddrff[i], 7280 7288 skb->len, BUS_DMA_TODEVICE); … … 7282 7290 __func__, skb); 7283 7291 ath_tx_capture(sc->sc_dev, bf, skb); 7292 skb = tskb; 7284 7293 } 7285 7294 } … … 7574 7583 sc->sc_rxbufsize = roundup(IEEE80211_MAX_LEN, sc->sc_cachelsz); 7575 7584 #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", 7577 7586 __func__, dev->mtu, sc->sc_cachelsz, sc->sc_rxbufsize); 7578 7587 … … 8221 8230 struct ath_softc *sc = vap->iv_ic->ic_dev->priv; 8222 8231 struct ath_node *an = ATH_NODE(ni); 8223 u_int16_t keyindex;8232 ieee80211_keyix_t keyix; 8224 8233 8225 8234 if (enable) { … … 8233 8242 8234 8243 /* Setup decompression mask. 8235 * For TKIP and split MIC case, recv. keyi ndex is at 32 offset8244 * For TKIP and split MIC case, recv. keyix is at 32 offset 8236 8245 * from tx key. 8237 8246 */ … … 8241 8250 if ((ni->ni_ucastkey.wk_flags & IEEE80211_KEY_XR) 8242 8251 == IEEE80211_KEY_XR) 8243 keyi ndex = ni->ni_ucastkey.wk_keyix + 32;8252 keyix = ni->ni_ucastkey.wk_keyix + 32; 8244 8253 else 8245 keyi ndex = ni->ni_ucastkey.wk_keyix;8254 keyix = ni->ni_ucastkey.wk_keyix; 8246 8255 } else 8247 keyi ndex = ni->ni_ucastkey.wk_keyix + ni->ni_rxkeyoff;8248 8249 ath_hal_setdecompmask(sc->sc_ah, keyi ndex, 1);8250 an->an_decomp_index = keyi ndex;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; 8251 8260 } else { 8252 8261 if (an->an_decomp_index != INVALID_DECOMP_INDEX) { … … 8274 8283 struct ieee80211vap *vap = ni->ni_vap; 8275 8284 struct ath_softc *sc = vap->iv_ic->ic_dev->priv; 8276 u_int16_t keyix;8285 ieee80211_keyix_t keyix; 8277 8286 8278 8287 keyix = ath_key_alloc(vap, &ni->ni_ucastkey); … … 8313 8322 struct ieee80211_key tmpkey; 8314 8323 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; 8316 8326 u_int8_t null_macaddr[IEEE80211_ADDR_LEN] = {0, 0, 0, 0, 0, 0}; 8317 8327 branches/madwifi-hal-0.9.30.13/ath/if_athvar.h
r2219 r2310 314 314 #define ATH_KEYMAX 128 /* max key cache size we handle */ 315 315 #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 316 323 #define ATH_MIN_FF_RATE 12000 /* min rate for ff aggregation in kbps */ 317 324 #define ATH_MIN_FF_RATE 12000 /* min rate for ff aggregation in kbps */ … … 593 600 u_int sc_fftxqmin; /* aggregation threshold */ 594 601 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 */ 596 603 u_int8_t sc_keymap[ATH_KEYBYTES]; /* key use bit map */ 597 604 struct ieee80211_node *sc_keyixmap[ATH_KEYMAX];/* key ix->node map */ 598 605 u_int8_t sc_bssidmask[IEEE80211_ADDR_LEN]; 599 606 600 u_int sc_ledpin; /* GPIO pin for driving LED */607 u_int sc_ledpin; /* GPIO pin for driving LED */ 601 608 u_int sc_ledon; /* pin setting for LED on */ 602 609 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 */ 604 611 u_int8_t sc_rxrate; /* current rx rate for LED */ 605 612 u_int8_t sc_txrate; /* current tx rate for LED */ … … 636 643 u_int sc_bmisscount; /* missed beacon transmits */ 637 644 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 */ 639 646 struct ath_txq sc_grpplq; /* tx q for XR group polls */ 640 647 struct ath_txq *sc_xrtxq; /* tx q for XR data */ branches/madwifi-hal-0.9.30.13/ath_hal/ah_os.h
r2178 r2310 146 146 147 147 #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(); }); 152 153 } while (0) 153 154 #define _OS_REG_READ(_ah, _reg) \ 154 155 ((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; })) 157 159 #else /* AH_LITTLE_ENDIAN */ 158 160 #define _OS_REG_WRITE(_ah, _reg, _val) do { \ branches/madwifi-hal-0.9.30.13/ath_rate/amrr/amrr.c
r2178 r2310 104 104 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 105 105 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) 107 107 { 108 108 struct amrr_node *amn = ATH_NODE_AMRR(an); branches/madwifi-hal-0.9.30.13/ath_rate/minstrel/minstrel.c
r2248 r2310 117 117 #include "minstrel.h" 118 118 119 /* XXX: Use standard debug functions */ 119 120 #define MINSTREL_DEBUG 10 120 121 #ifdef MINSTREL_DEBUG … … 129 130 #endif 130 131 131 #define ONE_SECOND (1000 * 1000) /* 1 second, or 1000 milliseconds , eternityin other words */132 #define ONE_SECOND (1000 * 1000) /* 1 second, or 1000 milliseconds; eternity, in other words */ 132 133 133 134 #include "release.h" … … 193 194 unsigned int x = 0, tt = 0; 194 195 unsigned int cix = rt->info[rix].controlRate; 195 int rts , cts;196 int rts = 0, cts = 0; 196 197 int cw = WIFI_CW_MIN; 197 198 … … 206 207 } 207 208 208 /* XXX getting MAC/PHY level timings should be fixed for turbo209 /* XXX: Getting MAC/PHY level timings should be fixed for turbo 209 210 * rates, and there is probably a way to get this from the 210 211 * HAL... */ 211 212 switch (rt->info[rix].phy) { 212 213 case IEEE80211_T_OFDM: 214 #if 0 213 215 t_slot = 9; 214 216 t_sifs = 16; 215 217 t_difs = 28; 216 218 /* fall through */ 217 /* XXX: WTF? */ 219 #endif 218 220 case IEEE80211_T_TURBO: 219 221 t_slot = 9; … … 222 224 break; 223 225 case IEEE80211_T_DS: 224 /* fall through to default */226 /* Fall through to default */ 225 227 default: 226 /* pg 205 ieee.802.11.pdf */228 /* pg. 205 ieee.802.11.pdf */ 227 229 t_slot = 20; 228 230 t_difs = 50; … … 230 232 } 231 233 232 rts = cts = 0;233 234 234 if ((ic->ic_flags & IEEE80211_F_USEPROT) && 235 rt->info[rix].phy == IEEE80211_T_OFDM) {235 (rt->info[rix].phy == IEEE80211_T_OFDM)) { 236 236 if (ic->ic_protmode == IEEE80211_PROT_RTSCTS) 237 237 rts = 1; … … 288 288 ath_rate_node_init(struct ath_softc *sc, struct ath_node *an) 289 289 { 290 /* NB: assumed to be zero'd by caller */290 /* NB: Assumed to be zero'd by caller */ 291 291 ath_rate_ctl_reset(sc, &an->an_node); 292 292 } … … 312 312 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 313 313 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) 315 315 { 316 316 struct minstrel_node *sn = ATH_NODE_MINSTREL(an); … … 328 328 mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR; 329 329 330 if (sn->static_rate_ndx != -1) {330 if (sn->static_rate_ndx >= 0) { 331 331 ndx = sn->static_rate_ndx; 332 332 } else { 333 333 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; 335 335 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)) { 337 337 sn->sample_count++; 338 338 sn->is_sampling = 1; 339 if (sn->packet_count >= (10000)) {339 if (sn->packet_count >= 10000) { 340 340 sn->sample_count = 0; 341 341 sn->packet_count = 0; … … 368 368 *try0 = sn->retry_adjusted_count[ndx]; 369 369 370 KASSERT( ndx >= 0 && ndx < sn->num_rates,370 KASSERT((ndx < sn->num_rates), 371 371 ("%s: bad ndx (%d/%d) for %s?\n", 372 372 dev_info, ndx, sn->num_rates, … … 399 399 rc3 = 0; 400 400 401 KASSERT( rc1 >= 0 && rc1 < sn->num_rates,401 KASSERT((rc1 >= 0) && (rc1 < sn->num_rates), 402 402 ("%s: bad rc1 (%d/%d) for %s?\n", 403 403 dev_info, rc1, sn->num_rates, 404 404 ether_sprintf(an->an_node.ni_macaddr))); 405 405 406 KASSERT( rc2 >= 0 && rc2 < sn->num_rates,406 KASSERT((rc2 >= 0) && (rc2 < sn->num_rates), 407 407 ("%s: bad rc2 (%d/%d) for %s?\n", 408 408 dev_info, rc2, sn->num_rates, 409 409 ether_sprintf(an->an_node.ni_macaddr))); 410 410 411 KASSERT( rc3 >= 0 && rc3 < sn->num_rates,411 KASSERT((rc3 >= 0) && (rc3 < sn->num_rates), 412 412 ("%s: bad rc3 (%d/%d) for %s?\n", 413 413 dev_info, rc3, sn->num_rates, … … 452 452 * With no retransmits, it is always 0. 453 453 * 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; 455 455 final_ndx = rate_to_ndx(sn, final_rate); 456 456 if (final_ndx >= sn->num_rates) { … … 463 463 } 464 464 465 /* triesis the total number of times we have endeavoured to465 /* 'tries' is the total number of times we have endeavoured to 466 466 * 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 */ 468 468 tries = ts->ts_shortretry + ts->ts_longretry + 1; 469 469 … … 648 648 dev_info, __func__, ether_sprintf(ni->ni_macaddr), 649 649 vap->iv_fixed_rate); 650 /* there are no rates yetwe're done */650 /* There are no rates yet; we're done */ 651 651 return; 652 652 } … … 691 691 sn->retry_adjusted_count[x] = 1; 692 692 693 for (retry_index = 2; retry_index < 11; retry_index++) {693 for (retry_index = 2; retry_index < ATH_TXMAXTRY; retry_index++) { 694 694 tx_time = calc_usecs_unicast_packet(sc, 1200, sn->rates[x].rix, 0, retry_index); 695 695 if (tx_time > ath_segment_size) … … 706 706 #endif 707 707 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--) 710 710 if (sn->rates[ndx].rate <= 72) 711 711 break; … … 793 793 794 794 /* 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. */ 796 796 for (i = 0; i < rs->rs_nrates; i++) { 797 797 micro_secs = rn->perfect_tx_time[i]; … … 804 804 rn->rs_att_hist[i] += rn->rs_rateattempts[i]; 805 805 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; 807 807 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); 809 809 rn->rs_lastratesuccess[i] = rn->rs_ratesuccess[i]; 810 810 rn->rs_lastrateattempts[i] = rn->rs_rateattempts[i]; … … 818 818 /* Sample less often below the 10% chance of success. 819 819 * 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; 823 823 if (rn->retry_adjusted_count[i] > 2) 824 824 rn->retry_adjusted_count[i] = 2; … … 829 829 } 830 830 831 /* The High speed rates (e.g 54 mbps) is checked last. If831 /* The High speed rates (e.g 54Mbps) is checked last. If 832 832 * throughput is the same for two rates, we prefer the 833 833 * lower rate, as this has a better chance of success. */ … … 931 931 odst = ATH_NODE_MINSTREL(an); 932 932 /* 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)) 934 934 continue; 935 935 … … 946 946 (x == odst->max_prob_rate) ? "P" : " "); 947 947 948 p += sprintf(p, "%3 d%s",949 odst->rates[x].rate /2,948 p += sprintf(p, "%3u%s", 949 odst->rates[x].rate / 2, 950 950 (odst->rates[x].rate & 0x1) != 0 ? ".5" : " "); 951 951 … … 981 981 return -ENOMEM; 982 982 983 /* initially allocate both read and write buffers */983 /* Initially allocate both read and write buffers */ 984 984 pv = (struct proc_ieee80211_priv *) file->private_data; 985 985 memset(pv, 0, sizeof(struct proc_ieee80211_priv)); … … 1001 1001 pv->max_rlen = MAX_PROC_IEEE80211_SIZE; 1002 1002 1003 /* now read the data into the buffer */1003 /* Now read the data into the buffer */ 1004 1004 pv->rlen = ath_proc_read_nodes(vap, pv->rbuf, MAX_PROC_IEEE80211_SIZE); 1005 1005 return 0; branches/madwifi-hal-0.9.30.13/ath_rate/onoe/onoe.c
r2178 r2310 121 121 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 122 122 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) 124 124 { 125 125 struct onoe_node *on = ATH_NODE_ONOE(an); branches/madwifi-hal-0.9.30.13/ath_rate/sample/sample.c
r2211 r2310 375 375 ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, 376 376 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) 378 378 { 379 379 struct sample_node *sn = ATH_NODE_SAMPLE(an); branches/madwifi-hal-0.9.30.13/include/compat.h
