Ejemplo n.º 1
0
void dfs_print_activity(struct ath_softc *sc)
{
    int chan_busy=0, ext_chan_busy=0;
    u_int32_t rxclear=0, rxframe=0, txframe=0, cycles=0;


    cycles = ath_hal_getMibCycleCountsPct(sc->sc_ah,&rxclear, &rxframe, &txframe);
    chan_busy = cycles;

    ext_chan_busy = ath_hal_get11nextbusy(sc->sc_ah);

    DFS_DPRINTK(sc, ATH_DEBUG_DFS,"cycles=%d rxclear=%d rxframe=%d txframe=%d extchanbusy=%d\n", cycles, rxclear, rxframe, txframe, ext_chan_busy);
    DFS_DPRINTK(sc, ATH_DEBUG_DFS, "FILT_OFDM=0x%x FILT_CCK=0x%x\n",(0x00FFFFFF & OS_REG_READ(sc->sc_ah, 0x8124)), (0x00FFFFFF & OS_REG_READ(sc->sc_ah, 0x8128)));
    return;
}
Ejemplo n.º 2
0
int ath_ald_collect_data(ath_dev_t dev, ath_ald_t ald_data)
{
    u_int32_t cu = 0; /* cu: channel utilization; cc: channel capacity */
    u_int32_t msdu_size=0, load=0;
    u_int32_t rxclear=0, rxframe=0, txframe=0;
    u_int32_t new_phyerr=0, new_ostime=0;
    u_int32_t old_phyerr=0, old_ostime=0;
    u_int32_t phyerr_rate=0;
    u_int32_t tmp = 0;
    u_int8_t good;
    struct ath_softc *sc = ATH_DEV_TO_SC(dev);

    spin_lock(ald_data->ald_lock);

    good = ath_hal_getMibCycleCountsPct(sc->sc_ah, &rxclear, &rxframe, &txframe);

    if(good) {
        cu = rxclear;
    }
    old_phyerr = ald_data->ald_phyerr;
    old_ostime = ald_data->ald_ostime;
    new_phyerr = sc->sc_phy_stats[sc->sc_curmode].ast_rx_phyerr;
    new_ostime = OS_GET_TIMESTAMP()/1000;
    if((new_ostime > old_ostime) && (old_ostime > 0))
        phyerr_rate = (new_phyerr - old_phyerr)/(new_ostime - old_ostime);
    else
        phyerr_rate = 0;

    ald_data->ald_phyerr = new_phyerr;
    ald_data->ald_ostime = new_ostime;

    if(ald_data->ald_unicast_tx_packets != 0 ){
        msdu_size = ald_data->ald_unicast_tx_bytes/ald_data->ald_unicast_tx_packets;
    }else{
        msdu_size = ALD_MSDU_SIZE;
    }

    ald_data->phyerr_rate = phyerr_rate;
    ald_data->msdu_size = msdu_size;

    /* currently not in use, the value is not accurate somehow */ 
    if((sc->sc_ald.sc_ald_tbuf != 0) && (sc->sc_ald.sc_ald_tnum != 0)){
        tmp = sc->sc_ald.sc_ald_tbuf/sc->sc_ald.sc_ald_tnum;
        if (tmp > 0) {
            load = sc->sc_txbuf_free*msdu_size/(tmp*1000);
        }
    }else
        load = ALD_MAX_DEV_LOAD;

    if (sc->sc_ald.sc_ald_cunum > 0) {
        cu = sc->sc_ald.sc_ald_cu / sc->sc_ald.sc_ald_cunum;
    }
    sc->sc_ald.sc_ald_cu = 0;
    sc->sc_ald.sc_ald_cunum = 0;
    ald_data->ald_unicast_tx_bytes = 0;
    ald_data->ald_unicast_tx_packets = 0;
   
    ald_data->ald_chan_util = cu;
    ald_data->ald_dev_load = load;
    spin_unlock(ald_data->ald_lock);

    sc->sc_ald.sc_ald_tbuf = 0;
    sc->sc_ald.sc_ald_tnum = 0;
    return 0;
}