Changeset 3772
- Timestamp:
- 07/15/08 14:58:49 (3 months ago)
- Files:
-
- madwifi/branches/madwifi-hal-0.10.5.6/INSTALL (modified) (3 diffs)
- madwifi/branches/madwifi-hal-0.10.5.6/Makefile (modified) (3 diffs)
- madwifi/branches/madwifi-hal-0.10.5.6/ath/if_ath.c (modified) (31 diffs)
- madwifi/branches/madwifi-hal-0.10.5.6/include/compat.h (modified) (1 diff)
- madwifi/branches/madwifi-hal-0.10.5.6/net80211/ieee80211_crypto.h (modified) (1 diff)
- madwifi/branches/madwifi-hal-0.10.5.6/net80211/ieee80211_wireless.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
madwifi/branches/madwifi-hal-0.10.5.6/INSTALL
r3280 r3772 10 10 ------------ 11 11 12 - Configured kernel sources of the target kernel. SomeLinux13 distributions provide headers, makefiles and configuration data - it14 s hould suffice.15 16 - Wireless Extensions support (14 or later, 17 preferred) - option17 CONFIG_ NET_RADIO in kernel .config file.12 - Configured kernel sources of the target kernel. Most Linux 13 distributions provide a kernel development package - it should 14 suffice. 15 16 - Wireless Extensions support - option CONFIG_NET_RADIO or 17 CONFIG_WIRELESS_EXT in kernel .config file, whichever is available. 18 18 19 19 - Sysctl support - option CONFIG_SYSCTL in kernel .config file. … … 23 23 back to a private implementation). 24 24 25 - gcc of same version that was used to compile the kernel. At least25 - gcc of the same version that was used to compile the kernel. At least 26 26 make sure that the first two version numbers or the compiler are the 27 27 same (e.g. it's OK to use gcc 3.4.6 to compile MadWifi if the kernel … … 35 35 work. 36 36 37 Automatic module loading support (CONFIG_KMOD) is recommended; otherwise, 38 care will have to be taken to manually load needed modules. 37 Automatic module loading support (CONFIG_KMOD) is highly recommended; 38 otherwise, you'll need to load all required modules manually. 39 39 40 40 41 Building the driver madwifi/branches/madwifi-hal-0.10.5.6/Makefile
r3748 r3772 44 44 TOP = $(obj) 45 45 46 ifneq (svnversion.h,$(MAKECMDGOALS))47 46 include $(TOP)/Makefile.inc 48 endif49 47 50 48 obj-y := ath/ ath_hal/ ath_rate/ net80211/ … … 58 56 59 57 .PHONY: modules 60 modules: configcheck svnversion.h58 modules: configcheck $(TOP)/svnversion.h 61 59 ifdef LINUX24 62 60 for i in $(obj-y); do \ … … 67 65 endif 68 66 69 .PHONY: svnversion.h 70 svnversion.h: 71 @if [ -d .svn ]; then \ 67 $(addprefix $(obj)/, $(obj-y:/=)): $(TOP)/svnversion.h 68 69 $(TOP)/svnversion.h: 70 @cd $(TOP) && \ 71 if [ -d .svn ]; then \ 72 72 ver=$$(svnversion -nc . | sed -e 's/^[^:]*://;s/[A-Za-z]//'); \ 73 73 echo "#define SVNVERSION \"svn r$$ver\"" > $@.tmp; \ madwifi/branches/madwifi-hal-0.10.5.6/ath/if_ath.c
r3752 r3772 103 103 104 104 #include "ah_os.h" 105 106 #ifndef MAX 107 # define MAX(a, b) (((a) > (b))? (a) : (b)) 108 #endif 109 #ifndef MIN 110 # define MIN(a, b) (((a) < (b))? (a) : (b)) 111 #endif 105 112 106 113 /* unaligned little endian access */ … … 3695 3702 HAL_KEYVAL *hk, const u_int8_t mac[IEEE80211_ADDR_LEN]) 3696 3703 { 3697 #define IEEE80211_KEY_XR (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)3698 3704 static const u_int8_t zerobssid[IEEE80211_ADDR_LEN]; 3699 3705 struct ath_hal *ah = sc->sc_ah; … … 3701 3707 KASSERT(k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP, 3702 3708 ("got a non-TKIP key, cipher %u", k->wk_cipher->ic_cipher)); 3703 if ((k->wk_flags & IEEE80211_KEY_ XR) == IEEE80211_KEY_XR) {3709 if ((k->wk_flags & IEEE80211_KEY_TXRX) == IEEE80211_KEY_TXRX) { 3704 3710 if (sc->sc_splitmic) { 3705 3711 /* … … 3732 3738 mac, AH_FALSE); 3733 3739 } 3734 } else if (k->wk_flags & IEEE80211_KEY_XR) { 3735 /* 3736 * TX/RX key goes at first index. 3737 * The HAL handles the MIC keys are index+64. 3738 */ 3740 } else if (k->wk_flags & IEEE80211_KEY_TXRX) { 3741 /* TX/RX key goes at first index. 3742 * The HAL handles the MIC keys are index + 64. */ 3739 3743 memcpy(hk->kv_mic, k->wk_flags & IEEE80211_KEY_XMIT ? 3740 3744 k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); … … 3744 3748 } 3745 3749 return 0; 3746 #undef IEEE80211_KEY_XR3747 3750 } 3748 3751 … … 4152 4155 ath_calcrxfilter(struct ath_softc *sc) 4153 4156 { 4154 #define RX_FILTER_PRESERVE (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR)4155 4157 struct ieee80211com *ic = &sc->sc_ic; 4156 4158 struct net_device *dev = ic->ic_dev; … … 4158 4160 u_int32_t rfilt; 4159 4161 4160 rfilt = (ath_hal_getrxfilter(ah) & RX_FILTER_PRESERVE) | 4162 /* Preserve the current Phy. radar and err. filters. */ 4163 rfilt = (ath_hal_getrxfilter(ah) & 4164 (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR)) | 4161 4165 HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | 4162 4166 HAL_RX_FILTER_MCAST; … … 4175 4179 rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR); 4176 4180 return rfilt; 4177 #undef RX_FILTER_PRESERVE4178 4181 } 4179 4182 … … 4242 4245 ath_slottime2timeout(struct ath_softc *sc, int slottime) 4243 4246 { 4244 /* HAL seems to use a constant of 8 for OFDM overhead and 18 for 4245 * CCK overhead. 4247 /* IEEE 802.11 2007 9.2.8 says the ACK timeout shall be SIFSTime + 4248 * slot time (+ PHY RX start delay). HAL seems to use a constant of 8 4249 * for OFDM overhead and 18 for CCK overhead. 4246 4250 * 4247 * XXX: Update based on emperical evidence (potentially save 15us per timeout) 4248 */ 4249 if (((sc->sc_curchan.channelFlags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) || 4250 (((sc->sc_curchan.channelFlags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) && 4251 (sc->sc_ic.ic_flags & IEEE80211_F_SHSLOT))) 4252 { 4253 /* short slot time - 802.11a, and 802.11g turbo in turbo mode with short slot time */ 4254 return (slottime * 2) + 8; 4255 } 4256 4257 /* constant for CCK mib processing time */ 4258 return (slottime * 2) + 18; 4259 } 4260 4261 #ifndef MAX 4262 # define MAX(a, b) (((a) > (b))? (a) : (b)) 4263 #endif 4251 * XXX: Update based on emperical evidence (potentially save 15us per 4252 * timeout). */ 4253 if (((sc->sc_curchan.channelFlags & IEEE80211_CHAN_A) == 4254 IEEE80211_CHAN_A) || 4255 (((sc->sc_curchan.channelFlags & IEEE80211_CHAN_108G) == 4256 IEEE80211_CHAN_108G) && 4257 (sc->sc_ic.ic_flags & IEEE80211_F_SHSLOT))) 4258 /* Short slot time: 802.11a, and 802.11g turbo in turbo mode 4259 * with short slot time. */ 4260 return slottime + 8; 4261 else 4262 /* Constant for CCK MIB processing time. */ 4263 return slottime + 18; 4264 } 4264 4265 4265 4266 static inline int … … 4373 4374 ath_beacon_dturbo_config(struct ieee80211vap *vap, u_int32_t intval) 4374 4375 { 4375 #define IS_CAPABLE(vap) \4376 (vap->iv_bss && (vap->iv_bss->ni_ath_flags & (IEEE80211_ATHC_TURBOP)) == \4377 (IEEE80211_ATHC_TURBOP))4378 4376 struct ieee80211com *ic = vap->iv_ic; 4379 4377 struct ath_softc *sc = ic->ic_dev->priv; 4380 4378 4381 if (ic->ic_opmode == IEEE80211_M_HOSTAP && IS_CAPABLE(vap)) { 4382 4379 /* Check VAP capability. */ 4380 if ((ic->ic_opmode == IEEE80211_M_HOSTAP) && vap->iv_bss && 4381 ((vap->iv_bss->ni_ath_flags & IEEE80211_ATHC_TURBOP) == 4382 IEEE80211_ATHC_TURBOP)) { 4383 4383 /* Dynamic Turbo is supported on this channel. */ 4384 4384 sc->sc_dturbo = 1; … … 4414 4414 ic->ic_ath_cap &= ~IEEE80211_ATHC_BOOST; 4415 4415 } 4416 #undef IS_CAPABLE4417 4416 } 4418 4417 … … 4644 4643 ath_beaconq_config(struct ath_softc *sc) 4645 4644 { 4646 #define ATH_EXPONENT_TO_VALUE(v) ((1<<v)-1)4647 4645 struct ieee80211com *ic = &sc->sc_ic; 4648 4646 struct ath_hal *ah = sc->sc_ah; … … 4665 4663 qi.tqi_aifs = wmep->wmep_aifsn; 4666 4664 qi.tqi_cwmin = 0; 4667 qi.tqi_cwmax = 2 * ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin);4665 qi.tqi_cwmax = 2 * ((1 << wmep->wmep_logcwmin) - 1); 4668 4666 } 4669 4667 … … 4681 4679 return 1; 4682 4680 } 4683 #undef ATH_EXPONENT_TO_VALUE4684 4681 } 4685 4682 … … 7184 7181 ath_txq_update(struct ath_softc *sc, struct ath_txq *txq, int ac) 7185 7182 { 7186 #define ATH_EXPONENT_TO_VALUE(v) ((1<<v)-1)7187 #define ATH_TXOP_TO_US(v) (v<<5)7188 7183 struct ieee80211com *ic = &sc->sc_ic; 7189 7184 struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac]; … … 7193 7188 ath_hal_gettxqueueprops(ah, txq->axq_qnum, &qi); 7194 7189 qi.tqi_aifs = wmep->wmep_aifsn; 7195 qi.tqi_cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin);7196 qi.tqi_cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax);7197 qi.tqi_burstTime = ATH_TXOP_TO_US(wmep->wmep_txopLimit);7190 qi.tqi_cwmin = (1 << wmep->wmep_logcwmin) - 1; 7191 qi.tqi_cwmax = (1 << wmep->wmep_logcwmax) - 1; 7192 qi.tqi_burstTime = wmep->wmep_txopLimit / 32; /* 32 us units. */ 7198 7193 7199 7194 if (!ath_hal_settxqueueprops(ah, txq->axq_qnum, &qi)) { … … 7206 7201 return 1; 7207 7202 } 7208 #undef ATH_TXOP_TO_US7209 #undef ATH_EXPONENT_TO_VALUE7210 7203 } 7211 7204 … … 7408 7401 struct ath_buf *bf, struct sk_buff *skb, int nextfraglen) 7409 7402 { 7410 #define MIN(a,b) ((a) < (b) ? (a) : (b))7411 7403 struct ath_softc *sc = dev->priv; 7412 7404 struct ieee80211com *ic = ni->ni_ic; … … 7998 7990 ath_tx_txqaddbuf(sc, PASS_NODE(ni), txq, bf, pktlen); 7999 7991 return 0; 8000 #undef MIN8001 7992 } 8002 7993 … … 9329 9320 ath_setup_comp(struct ieee80211_node *ni, int enable) 9330 9321 { 9331 #define IEEE80211_KEY_XR (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)9332 9322 struct ieee80211vap *vap = ni->ni_vap; 9333 9323 struct ath_softc *sc = vap->iv_ic->ic_dev->priv; … … 9351 9341 (ni->ni_rsn.rsn_ucastcipher == IEEE80211_CIPHER_TKIP) && 9352 9342 sc->sc_splitmic) { 9353 if ((ni->ni_ucastkey.wk_flags & IEEE80211_KEY_ XR)9354 == IEEE80211_KEY_ XR)9343 if ((ni->ni_ucastkey.wk_flags & IEEE80211_KEY_TXRX) 9344 == IEEE80211_KEY_TXRX) 9355 9345 keyix = ni->ni_ucastkey.wk_keyix + 32; 9356 9346 else … … 9369 9359 9370 9360 return; 9371 #undef IEEE80211_KEY_XR9372 9361 } 9373 9362 #endif … … 10103 10092 u_int32_t txoplimit; 10104 10093 10105 #define US_PER_4MS 400010106 #define MIN(a,b) ((a) < (b) ? (a) : (b))10107 10108 10094 *flushq = AH_FALSE; 10109 10095 … … 10129 10115 ic->ic_wme.wme_chanParams.cap_wmeParams[skb->priority].wmep_txopLimit); 10130 10116 10131 /* if the 4 msec limit is set on the channel, take it into account*/10117 /* Handle 4 ms channel limit. */ 10132 10118 if (sc->sc_curchan.privFlags & CHANNEL_4MS_LIMIT) 10133 txoplimit = MIN(txoplimit, US_PER_4MS);10119 txoplimit = MIN(txoplimit, 4000); 10134 10120 10135 10121 if (txoplimit != 0 && athff_approx_txtime(sc, an, skb) > txoplimit) { … … 10142 10128 10143 10129 return AH_TRUE; 10144 10145 #undef US_PER_4MS10146 #undef MIN10147 10130 } 10148 10131 #endif … … 10454 10437 ath_estimate_max_distance(struct ath_softc *sc) 10455 10438 { 10456 /* Prefer override d, ask HAL if not overridden*/10439 /* Prefer override; ask HAL if not overridden. */ 10457 10440 int slottime = sc->sc_slottimeconf; 10458 10441 if (slottime <= 0) 10459 10442 slottime = ath_hal_getslottime(sc->sc_ah); 10460 /* NB: We ignore MAC overhead. this function is reverse operation of 10461 * ath_distance2slottime, and assumes slottime is CCA + 2x air propagation. */ 10443 /* NB: We ignore MAC overhead. This function is the reverse operation 10444 * of ath_distance2slottime, and assumes slottime is CCA + 2 * air 10445 * propagation. */ 10462 10446 return (slottime - ath_ccatime(sc)) * 150; 10463 10447 } … … 10466 10450 ath_distance2slottime(struct ath_softc *sc, int distance) 10467 10451 { 10468 10469 10452 /* Allowance for air propagation (roundtrip time) should be at least 10470 10453 * 5us per the standards. 10471 10454 * 10472 10455 * So let's set a minimum distance to accomodate this: 10473 * 10474 * roundtrip time = ( ( distance / speed_of_light ) * 2 ) 10475 * 10476 * distance = ( (time * 300 ) / 2) or ((5 * 300) / 2) = 750 m 10477 */ 10456 * roundtrip time = ((distance / speed_of_light) * 2) 10457 * distance = ((time * 300 ) / 2) or ((5 * 300) / 2) = 750 m */ 10478 10458 int rtdist = distance * 2; 10479 int aAirPropagation = (rtdist / 300) + !!(rtdist % 300); 10480 if (aAirPropagation < 5) { 10481 aAirPropagation = 5; 10482 } 10483 /* NB: We ignore MAC processing delays... no clue */ 10459 int c = 299; /* Speed of light in vacuum in m/us. */ 10460 /* IEEE 802.11 2007 10l.4.3.2. In us. */ 10461 int aAirPropagation = MAX(5, howmany(rtdist, c)); 10462 /* XXX: RX/TX turnaround & MAC delay. */ 10484 10463 return ath_ccatime(sc) + aAirPropagation; 10485 10464 } … … 10488 10467 ath_distance2timeout(struct ath_softc *sc, int distance) 10489 10468 { 10490 /* HAL uses a constant of twice slot time plus 18us. 10491 * The 18us covers rxtx turnaround, MIB processing, etc.10492 * but the athctrl used to return 2slot+3 so the extra 15us of10493 * timeout is probably just being very careful or taking something into10494 * account that I can'tfind in the specs.10469 /* HAL uses a constant of twice slot time plus 18us. The 18us covers 10470 * RX/TX turnaround, MIB processing, etc., but the athctrl used to 10471 * return (2 * slot) + 3, so the extra 15us of timeout is probably just 10472 * being very careful or taking something into account that I can't 10473 * find in the specs. 10495 10474 * 10496 * XXX: Update based on emperical evidence (potentially save 15us per timeout)10497 * /10475 * XXX: Update based on emperical evidence (potentially save 15us per 10476 * timeout). */ 10498 10477 return ath_slottime2timeout(sc, ath_distance2slottime(sc, distance)); 10499 10478 } … … 10511 10490 ctl->maxlen = sizeof(val); 10512 10491 10513 /* special case for ATH_RP which expect 3 integers : tsf rssi 10514 * width. It should be noted that tsf is unsigned 64 bits but the 10515 * sysctl API is only unsigned 32 bits. As a result, tsf might get 10516 * truncated */ 10492 /* Special case for ATH_RP which expect 3 integers: TSF RSSI width. It 10493 * should be noted that tsf is unsigned 64 bits but the sysctl API is 10494 * only unsigned 32 bits. As a result, TSF might get truncated. */ 10517 10495 if (ctl->extra2 == (void *)ATH_RP) { 10518 10496 ctl->data = &tab_3_val; … … 12048 12026 char buf[MAX_REGISTER_NAME_LEN]; 12049 12027 #endif 12050 #define UNFILTERED AH_FALSE12051 #define FILTERED AH_TRUE12052 12053 12028 if ((ar_device(sc->devid) != 5212) && (ar_device(sc->devid) != 5213)) 12054 return FILTERED;12029 return AH_TRUE; 12055 12030 /* Addresses with side effects are never dumped out by bulk debug 12056 12031 * dump routines. */ 12057 if ((address >= 0x00c0) && (address <= 0x00df)) return FILTERED;12058 if ((address >= 0x143c) && (address <= 0x143f)) return FILTERED;12032 if ((address >= 0x00c0) && (address <= 0x00df)) return AH_TRUE; 12033 if ((address >= 0x143c) && (address <= 0x143f)) return AH_TRUE; 12059 12034 /* PCI timing registers are not interesting */ 12060 if ((address >= 0x4000) && (address <= 0x5000)) return FILTERED;12035 if ((address >= 0x4000) && (address <= 0x5000)) return AH_TRUE; 12061 12036 /* reading 0x9200-0x092c causes crashes in turbo A mode? */ 12062 if ((address >= 0x0920) && (address <= 0x092c)) return FILTERED;12037 if ((address >= 0x0920) && (address <= 0x092c)) return AH_TRUE; 12063 12038 12064 12039 #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR … … 12069 12044 return (AH_TRUE == ath_hal_lookup_register_name(sc->sc_ah, buf, 12070 12045 MAX_REGISTER_NAME_LEN, address)) ? 12071 UNFILTERED : FILTERED;12046 AH_FALSE : AH_TRUE; 12072 12047 #else /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */ 12073 12048 12074 return UNFILTERED;12049 return AH_FALSE; 12075 12050 #endif /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */ 12076 #undef UNFILTERED12077 #undef FILTERED12078 12051 } 12079 12052 #endif /* #ifdef ATH_REVERSE_ENGINEERING */ madwifi/branches/madwifi-hal-0.10.5.6/include/compat.h
r3752 r3772 124 124 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) 125 125 typedef int gfp_t; 126 #endif 127 128 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) 126 129 127 static inline void *kzalloc(size_t size, gfp_t flags) 130 128 { madwifi/branches/madwifi-hal-0.10.5.6/net80211/ieee80211_crypto.h
r3722 r3772 81 81 #define IEEE80211_KEY_SWCRYPT 0x10 /* host-based encrypt/decrypt */ 82 82 #define IEEE80211_KEY_SWMIC 0x20 /* host-based enmic/demic */ 83 #define IEEE80211_KEY_TXRX (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV) 83 84 ieee80211_keyix_t wk_keyix; /* key index */ 84 85 u_int8_t wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; madwifi/branches/madwifi-hal-0.10.5.6/net80211/ieee80211_wireless.c
r3752 r3772 1777 1777 }; 1778 1778 1779 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 2 6)1780 #define iwe_stream_add_event(a, b, c, d, e) iwe_stream_add_event(b, c, d, e)1781 #define iwe_stream_add_point(a, b, c, d, e) iwe_stream_add_point(b, c, d, e)1782 #define iwe_stream_add_value(a, b, c, d, e, f) \1779 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) && !defined(IW_REQUEST_FLAG_COMPAT) 1780 #define iwe_stream_add_event(a, b, c, d, e) iwe_stream_add_event(b, c, d, e) 1781 #define iwe_stream_add_point(a, b, c, d, e) iwe_stream_add_point(b, c, d, e) 1782 #define iwe_stream_add_value(a, b, c, d, e, f) \ 1783 1783 iwe_stream_add_value(b, c, d, e, f) 1784 #define iwe_stream_lcp_len(a) IW_EV_LCP_LEN 1784 1785 #endif 1785 1786 static int … … 1889 1890 last_ev = current_ev; 1890 1891 iwe.cmd = SIOCGIWRATE; 1891 current_val = current_ev + IW_EV_LCP_LEN;1892 current_val = current_ev + iwe_stream_lcp_len(req->info); 1892 1893 /* NB: not sorted, does it matter? */ 1893 1894 for (j = 0; j < se->se_rates[1]; j++) { … … 1910 1911 } 1911 1912 /* remove fixed header if no rates were added */ 1912 if ((current_val - current_ev) > IW_EV_LCP_LEN) {1913 if ((current_val - current_ev) > iwe_stream_lcp_len(req->info)) { 1913 1914 current_ev = current_val; 1914 1915 } else {
