Ticket #1025: madwifi_tx_tsf_r1864.patch

File madwifi_tx_tsf_r1864.patch, 1.2 kB (added by scottr, 2 years ago)

Possible fix for TX TSF problem

  • ath/if_ath.c

    old new  
    53615361        struct ieee80211_frame *wh; 
    53625362        int extra = A_MAX(sizeof(struct ath_tx_radiotap_header),  
    53635363                          A_MAX(sizeof(wlan_ng_prism2_header), ATHDESC_HEADER_SIZE)); 
    5364         u_int64_t tsf; 
    53655364 
    5366         /* Pass up tsf clock in mactime 
    5367          * tx descriptor has the low 15 bits of the tsf at 
    5368          * the time the frame was received.  Use the current 
    5369          * tsf to extend this to 64 bits
     5365        /*  
     5366         * ts_tstamp appears to be a 16-bit value, incremented approximately once 
     5367         * per millisecond. Shifting left by 10 bits gives better results than  
     5368         * muliplying by 10 when sorting a trace based on hardware timestamp
    53705369         */ 
    5371         tsf = ath_extend_tsf(sc->sc_ah, ds->ds_txstat.ts_tstamp); 
     5370        u_int32_t rstamp = ds->ds_txstat.ts_tstamp << 10; 
     5371        u_int64_t tsf = ath_hal_gettsf64(sc->sc_ah); 
    53725372 
     5373        if ((tsf & 0x3ffffff) < rstamp) 
     5374                tsf -= 0x4000000; 
     5375        tsf = ((tsf &~ 0x3ffffff) | rstamp); 
     5376 
    53735377        /*                                                                       
    53745378         * release the owner of this skb since we're basically                   
    53755379         * recycling it