Changeset 3772

Show
Ignore:
Timestamp:
07/15/08 14:58:49 (3 months ago)
Author:
proski
Message:

Merge -r3751:3771 from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/branches/madwifi-hal-0.10.5.6/INSTALL

    r3280 r3772  
    1010------------ 
    1111 
    12 - Configured kernel sources of the target kernel.  Some Linux 
    13   distributions provide headers, makefiles and configuration data - it 
    14   should suffice. 
    15  
    16 - Wireless Extensions support (14 or later, 17 preferred) - option 
    17   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. 
    1818 
    1919- Sysctl support - option CONFIG_SYSCTL in kernel .config file. 
     
    2323  back to a private implementation). 
    2424 
    25 - gcc of same version that was used to compile the kernel.  At least 
     25- gcc of the same version that was used to compile the kernel.  At least 
    2626  make sure that the first two version numbers or the compiler are the 
    2727  same (e.g. it's OK to use gcc 3.4.6 to compile MadWifi if the kernel 
     
    3535work. 
    3636 
    37 Automatic module loading support (CONFIG_KMOD) is recommended; otherwise,  
    38 care will have to be taken to manually load needed modules. 
     37Automatic module loading support (CONFIG_KMOD) is highly recommended; 
     38otherwise, you'll need to load all required modules manually. 
     39 
    3940 
    4041Building the driver 
  • madwifi/branches/madwifi-hal-0.10.5.6/Makefile

    r3748 r3772  
    4444TOP = $(obj) 
    4545 
    46 ifneq (svnversion.h,$(MAKECMDGOALS)) 
    4746include $(TOP)/Makefile.inc 
    48 endif 
    4947 
    5048obj-y := ath/ ath_hal/ ath_rate/ net80211/ 
     
    5856 
    5957.PHONY: modules 
    60 modules: configcheck svnversion.h 
     58modules: configcheck $(TOP)/svnversion.h 
    6159ifdef LINUX24 
    6260        for i in $(obj-y); do \ 
     
    6765endif 
    6866 
    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 \ 
    7272                ver=$$(svnversion -nc . | sed -e 's/^[^:]*://;s/[A-Za-z]//'); \ 
    7373                echo "#define SVNVERSION \"svn r$$ver\"" > $@.tmp; \ 
  • madwifi/branches/madwifi-hal-0.10.5.6/ath/if_ath.c

    r3752 r3772  
    103103 
    104104#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 
    105112 
    106113/* unaligned little endian access */ 
     
    36953702        HAL_KEYVAL *hk, const u_int8_t mac[IEEE80211_ADDR_LEN]) 
    36963703{ 
    3697 #define IEEE80211_KEY_XR        (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV) 
    36983704        static const u_int8_t zerobssid[IEEE80211_ADDR_LEN]; 
    36993705        struct ath_hal *ah = sc->sc_ah; 
     
    37013707        KASSERT(k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP, 
    37023708                ("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) { 
    37043710                if (sc->sc_splitmic) { 
    37053711                        /* 
     
    37323738                                        mac, AH_FALSE); 
    37333739                } 
    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. */ 
    37393743                memcpy(hk->kv_mic, k->wk_flags & IEEE80211_KEY_XMIT ? 
    37403744                        k->wk_txmic : k->wk_rxmic, sizeof(hk->kv_mic)); 
     
    37443748        } 
    37453749        return 0; 
    3746 #undef IEEE80211_KEY_XR 
    37473750} 
    37483751 
     
    41524155ath_calcrxfilter(struct ath_softc *sc) 
    41534156{ 
    4154 #define RX_FILTER_PRESERVE      (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR) 
    41554157        struct ieee80211com *ic = &sc->sc_ic; 
    41564158        struct net_device *dev = ic->ic_dev; 
     
    41584160        u_int32_t rfilt; 
    41594161 
    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)) | 
    41614165                 HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | 
    41624166                 HAL_RX_FILTER_MCAST; 
     
    41754179                rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR); 
    41764180        return rfilt; 
    4177 #undef RX_FILTER_PRESERVE 
    41784181} 
    41794182 
     
    42424245ath_slottime2timeout(struct ath_softc *sc, int slottime) 
    42434246{ 
    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. 
    42464250         * 
    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
    42644265 
    42654266static inline int  
     
    43734374ath_beacon_dturbo_config(struct ieee80211vap *vap, u_int32_t intval) 
    43744375{ 
    4375 #define IS_CAPABLE(vap) \ 
    4376         (vap->iv_bss && (vap->iv_bss->ni_ath_flags & (IEEE80211_ATHC_TURBOP)) == \ 
    4377                 (IEEE80211_ATHC_TURBOP)) 
    43784376        struct ieee80211com *ic = vap->iv_ic; 
    43794377        struct ath_softc *sc = ic->ic_dev->priv; 
    43804378 
    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)) { 
    43834383                /* Dynamic Turbo is supported on this channel. */ 
    43844384                sc->sc_dturbo = 1; 
     
    44144414                ic->ic_ath_cap &= ~IEEE80211_ATHC_BOOST; 
    44154415        } 
    4416 #undef IS_CAPABLE 
    44174416} 
    44184417 
     
    46444643ath_beaconq_config(struct ath_softc *sc) 
    46454644{ 
    4646 #define ATH_EXPONENT_TO_VALUE(v)        ((1<<v)-1) 
    46474645        struct ieee80211com *ic = &sc->sc_ic; 
    46484646        struct ath_hal *ah = sc->sc_ah; 
     
    46654663                qi.tqi_aifs = wmep->wmep_aifsn; 
    46664664                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); 
    46684666        } 
    46694667 
     
    46814679                return 1; 
    46824680        } 
    4683 #undef ATH_EXPONENT_TO_VALUE 
    46844681} 
    46854682 
     
    71847181ath_txq_update(struct ath_softc *sc, struct ath_txq *txq, int ac) 
    71857182{ 
    7186 #define ATH_EXPONENT_TO_VALUE(v)        ((1<<v)-1) 
    7187 #define ATH_TXOP_TO_US(v)               (v<<5) 
    71887183        struct ieee80211com *ic = &sc->sc_ic; 
    71897184        struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac]; 
     
    71937188        ath_hal_gettxqueueprops(ah, txq->axq_qnum, &qi); 
    71947189        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. */ 
    71987193 
    71997194        if (!ath_hal_settxqueueprops(ah, txq->axq_qnum, &qi)) { 
     
    72067201                return 1; 
    72077202        } 
    7208 #undef ATH_TXOP_TO_US 
    7209 #undef ATH_EXPONENT_TO_VALUE 
    72107203} 
    72117204 
     
    74087401                struct ath_buf *bf, struct sk_buff *skb, int nextfraglen) 
    74097402{ 
    7410 #define MIN(a,b)        ((a) < (b) ? (a) : (b)) 
    74117403        struct ath_softc *sc = dev->priv; 
    74127404        struct ieee80211com *ic = ni->ni_ic; 
     
    79987990        ath_tx_txqaddbuf(sc, PASS_NODE(ni), txq, bf, pktlen); 
    79997991        return 0; 
    8000 #undef MIN 
    80017992} 
    80027993 
     
    93299320ath_setup_comp(struct ieee80211_node *ni, int enable) 
    93309321{ 
    9331 #define IEEE80211_KEY_XR        (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV) 
    93329322        struct ieee80211vap *vap = ni->ni_vap; 
    93339323        struct ath_softc *sc = vap->iv_ic->ic_dev->priv; 
     
    93519341                    (ni->ni_rsn.rsn_ucastcipher == IEEE80211_CIPHER_TKIP) && 
    93529342                    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
    93559345                                keyix = ni->ni_ucastkey.wk_keyix + 32; 
    93569346                        else 
     
    93699359 
    93709360        return; 
    9371 #undef IEEE80211_KEY_XR 
    93729361} 
    93739362#endif 
     
    1010310092        u_int32_t txoplimit; 
    1010410093 
    10105 #define US_PER_4MS 4000 
    10106 #define MIN(a,b)        ((a) < (b) ? (a) : (b)) 
    10107  
    1010810094        *flushq = AH_FALSE; 
    1010910095 
     
    1012910115                ic->ic_wme.wme_chanParams.cap_wmeParams[skb->priority].wmep_txopLimit); 
    1013010116 
    10131         /* if the 4 msec limit is set on the channel, take it into account */ 
     10117        /* Handle 4 ms channel limit. */ 
    1013210118        if (sc->sc_curchan.privFlags & CHANNEL_4MS_LIMIT) 
    10133                 txoplimit = MIN(txoplimit, US_PER_4MS); 
     10119                txoplimit = MIN(txoplimit, 4000); 
    1013410120 
    1013510121        if (txoplimit != 0 && athff_approx_txtime(sc, an, skb) > txoplimit) { 
     
    1014210128 
    1014310129        return AH_TRUE; 
    10144  
    10145 #undef US_PER_4MS 
    10146 #undef MIN 
    1014710130} 
    1014810131#endif 
     
    1045410437ath_estimate_max_distance(struct ath_softc *sc) 
    1045510438{ 
    10456         /* Prefer overrided, ask HAL if not overridden */ 
     10439        /* Prefer override; ask HAL if not overridden. */ 
    1045710440        int slottime = sc->sc_slottimeconf; 
    1045810441        if (slottime <= 0) 
    1045910442                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. */ 
    1046210446        return (slottime - ath_ccatime(sc)) * 150; 
    1046310447} 
     
    1046610450ath_distance2slottime(struct ath_softc *sc, int distance) 
    1046710451{ 
    10468  
    1046910452        /* Allowance for air propagation (roundtrip time) should be at least  
    1047010453         * 5us per the standards. 
    1047110454         *  
    1047210455         * 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 */ 
    1047810458        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. */ 
    1048410463        return ath_ccatime(sc) + aAirPropagation; 
    1048510464} 
     
    1048810467ath_distance2timeout(struct ath_softc *sc, int distance) 
    1048910468{ 
    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 of  
    10493          * timeout is probably just being very careful or taking something into 
    10494          * account that I can't find 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. 
    1049510474         * 
    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). *
    1049810477        return ath_slottime2timeout(sc, ath_distance2slottime(sc, distance)); 
    1049910478} 
     
    1051110490        ctl->maxlen = sizeof(val); 
    1051210491 
    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. */ 
    1051710495        if (ctl->extra2 == (void *)ATH_RP) { 
    1051810496                ctl->data = &tab_3_val; 
     
    1204812026        char buf[MAX_REGISTER_NAME_LEN]; 
    1204912027#endif 
    12050         #define UNFILTERED AH_FALSE 
    12051         #define FILTERED   AH_TRUE 
    12052  
    1205312028        if ((ar_device(sc->devid) != 5212) && (ar_device(sc->devid) != 5213))  
    12054                 return FILTERED
     12029                return AH_TRUE
    1205512030        /* Addresses with side effects are never dumped out by bulk debug  
    1205612031         * 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
    1205912034        /* PCI timing registers are not interesting */ 
    12060         if ((address >= 0x4000) && (address <= 0x5000)) return FILTERED
     12035        if ((address >= 0x4000) && (address <= 0x5000)) return AH_TRUE
    1206112036        /* 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
    1206312038 
    1206412039#ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR 
     
    1206912044        return (AH_TRUE == ath_hal_lookup_register_name(sc->sc_ah, buf,  
    1207012045                                MAX_REGISTER_NAME_LEN, address)) ? 
    12071                 UNFILTERED : FILTERED
     12046                AH_FALSE : AH_TRUE
    1207212047#else /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */ 
    1207312048 
    12074         return UNFILTERED
     12049        return AH_FALSE
    1207512050#endif /* #ifndef ATH_REVERSE_ENGINEERING_WITH_NO_FEAR */ 
    12076         #undef UNFILTERED 
    12077         #undef FILTERED 
    1207812051} 
    1207912052#endif /* #ifdef ATH_REVERSE_ENGINEERING */ 
  • madwifi/branches/madwifi-hal-0.10.5.6/include/compat.h

    r3752 r3772  
    124124#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) 
    125125typedef int gfp_t; 
    126 #endif 
    127  
    128 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) 
     126 
    129127static inline void *kzalloc(size_t size, gfp_t flags) 
    130128{ 
  • madwifi/branches/madwifi-hal-0.10.5.6/net80211/ieee80211_crypto.h

    r3722 r3772  
    8181#define IEEE80211_KEY_SWCRYPT   0x10    /* host-based encrypt/decrypt */ 
    8282#define IEEE80211_KEY_SWMIC     0x20    /* host-based enmic/demic */ 
     83#define IEEE80211_KEY_TXRX      (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV) 
    8384        ieee80211_keyix_t wk_keyix;     /* key index */ 
    8485        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  
    17771777}; 
    17781778 
    1779 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26
    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) \ 
    17831783        iwe_stream_add_value(b, c, d, e, f) 
     1784#define iwe_stream_lcp_len(a)                   IW_EV_LCP_LEN 
    17841785#endif 
    17851786static int 
     
    18891890        last_ev = current_ev; 
    18901891        iwe.cmd = SIOCGIWRATE; 
    1891         current_val = current_ev + IW_EV_LCP_LEN
     1892        current_val = current_ev + iwe_stream_lcp_len(req->info)
    18921893        /* NB: not sorted, does it matter? */ 
    18931894        for (j = 0; j < se->se_rates[1]; j++) { 
     
    19101911        } 
    19111912        /* 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)) { 
    19131914                current_ev = current_val; 
    19141915        } else {