Example #1
0
int is_file_or_directory( char *path )
{
    if (!path)
        return 0;
	if (STAT64(path,&buf64) == 0)
	{
		if (buf64.st_mode & M_IS_DIR)
			return 2;
		else
			return 1;
	}
	return 0;
}
Example #2
0
static void
print_sta_stats(FILE *fd, const u_int8_t macaddr[IEEE80211_ADDR_LEN])
{
#define	STAT(x,fmt) \
	if (ns->ns_##x) { fprintf(fd, "%s" #x " " fmt, sep, ns->ns_##x); sep = " "; }
#define	STAT64(x,fmt) \
	if (ns->ns_##x) { fprintf(fd, "%s" #x " " fmt, sep, (long long unsigned int) ns->ns_##x); sep = " "; }
	struct iwreq iwr;
	struct ieee80211req_sta_stats stats;
	const struct ieee80211_nodestats *ns = &stats.is_stats;
	const char *sep;

	(void) memset(&iwr, 0, sizeof(iwr));
	(void) strncpy(iwr.ifr_name, ifr.ifr_name, sizeof(iwr.ifr_name));
    iwr.ifr_name[sizeof(iwr.ifr_name) - 1] = '\0';
	iwr.u.data.pointer = (void *) &stats;
	iwr.u.data.length = sizeof(stats);
	memcpy(stats.is_u.macaddr, macaddr, IEEE80211_ADDR_LEN);
	if (ioctl(s, IEEE80211_IOCTL_STA_STATS, &iwr) < 0)
		err(1, "unable to get station stats for %s",
			ether_ntoa((const struct ether_addr*) macaddr));

	fprintf(fd, "%s:\n", ether_ntoa((const struct ether_addr*) macaddr));

	sep = "\t";
	STAT(rx_data, "%u");
	STAT(rx_mgmt, "%u");
	STAT(rx_ctrl, "%u");
	STAT64(rx_beacons, "%llu");
	STAT(rx_proberesp, "%u");
	STAT(rx_ucast, "%u");
	STAT(rx_mcast, "%u");
	STAT(rx_bytes, "%llu");
	STAT(rx_dup, "%u");
	STAT(rx_noprivacy, "%u");
	STAT(rx_wepfail, "%u");
	STAT(rx_demicfail, "%u");
	STAT(rx_decap, "%u");
	STAT(rx_defrag, "%u");
	STAT(rx_disassoc, "%u");
	STAT(rx_deauth, "%u");
	STAT(rx_action, "%u");
	STAT(rx_decryptcrc, "%u");
	STAT(rx_unauth, "%u");
	STAT(rx_unencrypted, "%u");
	fprintf(fd, "\n");

	sep = "\t";
	STAT(tx_data, "%u");
	STAT(tx_mgmt, "%u");
	STAT(tx_probereq, "%u");
	STAT(tx_ucast, "%u");
	STAT(tx_mcast, "%u");
	STAT(tx_bytes, "%llu");
	STAT(tx_novlantag, "%u");
	STAT(tx_vlanmismatch, "%u");
	fprintf(fd, "\n");

	sep = "\t";
	STAT(tx_assoc, "%u");
	STAT(tx_assoc_fail, "%u");
	STAT(tx_auth, "%u");
	STAT(tx_auth_fail, "%u");
	STAT(tx_deauth, "%u");
	STAT(tx_deauth_code, "%u");
	STAT(tx_disassoc, "%u");
	STAT(tx_disassoc_code, "%u");
	STAT(psq_drops, "%u");
	fprintf(fd, "\n");

	sep = "\t";
	STAT(tx_uapsd, "%u");
	STAT(uapsd_triggers, "%u");
	fprintf(fd, "\n");
	sep = "\t";
	STAT(uapsd_duptriggers, "%u");
	STAT(uapsd_ignoretriggers, "%u");
	fprintf(fd, "\n");
	sep = "\t";
	STAT(uapsd_active, "%u");
	STAT(uapsd_triggerenabled, "%u");
	fprintf(fd, "\n");
	sep = "\t";
	STAT(tx_eosplost, "%u");
	fprintf(fd, "\n");
#undef STAT
#undef STAT64
}
Example #3
0
static void
printstats(FILE *fd, const struct ath_stats *stats)
{
#define N(a)    (sizeof(a) / sizeof(a[0]))

#define STAT(x,fmt) \
    if (stats->ast_##x) fprintf(fd, "%u " fmt "\n", stats->ast_##x)
#define STAT64(x,fmt) \
    if (stats->ast_##x) fprintf(fd, "%llu " fmt "\n", \
	(long long unsigned int) stats->ast_##x)
#define STAT_PEEK_11N(_x)   stats->ast_11n_stats._x
#define STAT_11N(x, descr) \
    fprintf(fd, "%10u " descr "\n", STAT_PEEK_11N(x))
#define STAT_11N_P(x, y, descr) \
    fprintf(fd, "%10.2f " descr "\n", \
            100*(float)STAT_PEEK_11N(x)/((float)(STAT_PEEK_11N(y))+1))
#define STAT_FMT(x,fmt) \
    if (stats->ast_##x) fprintf(fd, "%10u " fmt "\n", stats->ast_##x)

    int i = 0 , j = 0; ////AUTELAN--Added by duanmingzhe for fix error from coverity check

#ifdef VOW_LOGLATENCY
    fprintf(fd, "Retry Delay Distribution\n");
    fprintf(fd, "========================\n");
    fprintf(fd, "RDD0 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_retry_delay[0][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "RDD1 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_retry_delay[1][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "RDD2 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_retry_delay[2][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "RDD3 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_retry_delay[3][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "RDD4 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_retry_delay[4][i]);
    }
    fprintf(fd, "\n");

    fprintf(fd, "Queue Delay Distribution\n");
    fprintf(fd, "========================\n");
    fprintf(fd, "QDD0 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_queue_delay[0][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "QDD1 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_queue_delay[1][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "QDD2 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_queue_delay[2][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "QDD3 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_queue_delay[3][i]);
    }
    fprintf(fd, "\n");
    fprintf(fd, "QDD4 : ");
    for(i=0;i<45;i++) {
      fprintf(fd, "%u : ", stats->ast_queue_delay[4][i]);
    }
    fprintf(fd, "\n");
#endif

    STAT(watchdog, "watchdog timeouts");
    STAT(hardware, "hardware error interrupts");
    STAT(bmiss, "beacon miss interrupts");
    STAT(rxorn, "recv overrun interrupts");
    STAT(rxeol, "recv eol interrupts");
    STAT(txurn, "txmit underrun interrupts");
    STAT(txto,  "global txmit timeout interrupts");
    STAT(cst,  "carrier sense timeout interrupts");
    STAT(mib,  "# mib interrupts");
    STAT(tx_packets, "# packets sent on the interface");
    STAT(tx_mgmt, "tx management frames");

    STAT(tx_discard, "tx frames discarded prior to association");
    STAT(tx_invalid, "tx frames discarded 'cuz device gone");
    STAT(tx_qstop, "tx queue stopped because full");
    STAT(tx_encap, "tx encapsulation failed");
    STAT(tx_nonode, "tx failed 'cuz no node");
    STAT(tx_nobuf, "tx failed 'cuz no tx buffer (data)");
    STAT(tx_stop, "Number of times netif_stop called");
    STAT(tx_resume, "Number of times netif_wake called");
    STAT(tx_nobufmgt, "tx failed 'cuz no tx buffer (mgt)");
    STAT(tx_xretries, "tx failed 'cuz too many retries");
    STAT(tx_fifoerr, "tx failed 'cuz FIFO underrun");
    STAT(tx_filtered, "tx failed 'cuz xmit filtered");
    STAT(tx_badrate, "tx failed 'cuz bogus xmit rate");
    STAT(tx_noack, "tx frames with no ack marked");
	
	/*Begin:Added by duanmingzhe for tx interrupt count*/
    STAT(isr_txok_wifi0_count, "wifi0 TX_OK INTERRUPT COUNT");
    STAT(isr_txerr_wifi0_count, "wifi0 TX_ERR INTERRUPT COUNT");	
    STAT(isr_txeol_wifi0_count, "wifi0 TX_EOL INTERRUPT COUNT");	
    STAT(isr_txok_wifi1_count, "wifi1 TX_OK INTERRUPT COUNT");
    STAT(isr_txerr_wifi1_count, "wifi1 TX_ERR INTERRUPT COUNT");	
    STAT(isr_txeol_wifi1_count, "wifi1 TX_EOL INTERRUPT COUNT");
	/*End:Added by duanmingzhe for tx interrupt count*/
	
	/*Begin:Added by duanmingzhe for print txq info*/
	if(!devid){
		fprintf(fd,"\n----------wifi0 QCU info----------\n",i);
		for(i = 0; i < 10; i++)	
		{
			fprintf(fd,"\nQCU = %d",i);
			fprintf(fd,"\nheadindex = %d tailindex = %d",stats->ast_qcu_info_wifi0[i].txq_headindex,stats->ast_qcu_info_wifi0[i].txq_tailindex);
			fprintf(fd,"\ndepth = %d minfree = %d num_buf_used = %d",stats->ast_qcu_info_wifi0[i].txq_depth,stats->ast_qcu_info_wifi0[i].txq_minfree,stats->ast_qcu_info_wifi0[i].txq_num_buf_used);
			fprintf(fd,"\naggr_depth = %d axq_totalqueued = %d intrcnt = %d",stats->ast_qcu_info_wifi0[i].txq_aggr_depth,stats->ast_qcu_info_wifi0[i].txq_totalqueued,stats->ast_qcu_info_wifi0[i].txq_intrcnt);
		}
		fprintf(fd,"\n----------wifi0 QCU info done-----\n",i);
	}

	if(devid){
		fprintf(fd,"\n----------wifi1 QCU info----------\n",i);	
		for(i = 0; i < 10; i++)	
		{
			fprintf(fd,"\nQCU = %d",i);
			fprintf(fd,"\nheadindex = %d tailindex = %d",stats->ast_qcu_info_wifi1[i].txq_headindex,stats->ast_qcu_info_wifi1[i].txq_tailindex);
			fprintf(fd,"\ndepth = %d minfree = %d num_buf_used = %d",stats->ast_qcu_info_wifi1[i].txq_depth,stats->ast_qcu_info_wifi1[i].txq_minfree,stats->ast_qcu_info_wifi1[i].txq_num_buf_used);
			fprintf(fd,"\naggr_depth = %d axq_totalqueued = %d intrcnt = %d",stats->ast_qcu_info_wifi1[i].txq_aggr_depth,stats->ast_qcu_info_wifi1[i].txq_totalqueued,stats->ast_qcu_info_wifi1[i].txq_intrcnt);
		}	
		fprintf(fd,"\n----------wifi1 QCU info done-----\n",i);
	}
	/*End:Added by duanmingzhe for print txq info*/

    STAT(tx_cts, "tx frames with cts enabled");
    STAT(tx_shortpre, "tx frames with short preamble");
    STAT(tx_altrate, "tx frames with an alternate rate");
    STAT(tx_protect, "tx frames with 11g protection");
    STAT(rx_orn, "rx failed 'cuz of desc overrun");
    STAT(rx_badcrypt, "rx failed 'cuz decryption");
    STAT(rx_badmic, "rx failed 'cuz MIC failure");
    STAT(rx_nobuf, "rx setup failed 'cuz no skbuff");

	STAT(tx_rssi, "tx rssi of last ack");
    STAT64(rx_bytes, "total number of bytes received");
    STAT64(tx_bytes, "total number of bytes transmitted");


/* PHY statistics */

    if (IS_RSSI_VALID(stats->ast_tx_rssi_ctl0))
        fprintf(fd, "rssi of last ack[ctl, ch0]: %u\n",
                stats->ast_tx_rssi_ctl0);

    if (IS_RSSI_VALID(stats->ast_tx_rssi_ctl1))
        fprintf(fd, "rssi of last ack[ctl, ch1]: %u\n",
                stats->ast_tx_rssi_ctl1);

    if (IS_RSSI_VALID(stats->ast_tx_rssi_ctl2))
        fprintf(fd, "rssi of last ack[ctl, ch2]: %u\n",
                stats->ast_tx_rssi_ctl2);
    if (IS_RSSI_VALID(stats->ast_tx_rssi_ext0))
        fprintf(fd, "rssi of last ack[ext, ch0]: %u\n",
                stats->ast_tx_rssi_ext0);
    if (IS_RSSI_VALID(stats->ast_tx_rssi_ext1))
        fprintf(fd, "rssi of last ack[ext, ch1]: %u\n",
                stats->ast_tx_rssi_ext1);
    if (IS_RSSI_VALID(stats->ast_tx_rssi_ext2))
        fprintf(fd, "rssi of last ack[ext, ch2]: %u\n",
                stats->ast_tx_rssi_ext2);


    STAT(rx_rssi, "rx rssi from histogram [combined]");

    if (IS_RSSI_VALID(stats->ast_rx_rssi_ctl0))
        fprintf(fd, "rssi of last rcv[ctl, ch0]: %u\n",
                stats->ast_rx_rssi_ctl0);

    if (IS_RSSI_VALID(stats->ast_rx_rssi_ctl1))
        fprintf(fd, "rssi of last rcv[ctl, ch1]: %u\n",
                stats->ast_rx_rssi_ctl1);

    if (IS_RSSI_VALID(stats->ast_rx_rssi_ctl2))
        fprintf(fd, "rssi of last rcv[ctl, ch2]: %u\n",
                stats->ast_rx_rssi_ctl2);

    if (IS_RSSI_VALID(stats->ast_rx_rssi_ext0))
        fprintf(fd, "rssi of last rcv[ext, ch0]: %u\n",
                stats->ast_rx_rssi_ext0);

    if (IS_RSSI_VALID(stats->ast_rx_rssi_ext1))
        fprintf(fd, "rssi of last rcv[ext, ch1]: %u\n",
                stats->ast_rx_rssi_ext1);

    if (IS_RSSI_VALID(stats->ast_rx_rssi_ext2))
        fprintf(fd, "rssi of last rcv[ext, ch2]: %u\n",
                stats->ast_rx_rssi_ext2);



    STAT(be_xmit, "beacons transmitted");
    STAT(be_nobuf, "no skbuff available for beacon");
    STAT(per_cal, "periodic calibrations");
    STAT(per_calfail, "periodic calibration failures");
    STAT(per_rfgain, "rfgain value change");
    STAT(rate_calls, "rate control checks");
    STAT(rate_raise, "rate control raised xmit rate");
    STAT(rate_drop, "rate control dropped xmit rate");

    fprintf(fd, "Antenna profile:\n");
    STAT(ant_defswitch, "switched default/rx antenna");
    STAT(ant_txswitch, "tx antenna switches");

    for (i = 0; i < 8; i++)
        if (stats->ast_ant_rx[i] || stats->ast_ant_tx[i])
            fprintf(fd, "[%u] tx %8u rx %8u\n", i,
                stats->ast_ant_tx[i], stats->ast_ant_rx[i]);


    STAT(bb_hang, "baseband hangs detected");
    STAT(mac_hang, "mac hangs detected");

#ifdef ATH_SUPPORT_UAPSD
    /*
     * UAPSD stats
     */
    if (stats->ast_uapsdqnul_pkts)
        fprintf(fd, "\nUAPSD stats\n");
    STAT_FMT(uapsdqnulbf_unavail,   "no qos null buffers available");
    STAT_FMT(uapsdqnul_pkts,        "qos null frames sent");
    STAT_FMT(uapsdqnulcomp,         "qos null frames completed");
    STAT_FMT(uapsdnodeinvalid,      "trigger for non-uapsd node");
    STAT_FMT(uapsddataqueued,       "qos data frames queued");
    STAT_FMT(uapsdeospdata,         "qos data with eosp sent");
    STAT_FMT(uapsddata_pkts,        "qos data frames sent");
    STAT_FMT(uapsddatacomp,         "qos data frames completed");
#endif



    /*
     * 11n stats
     */
    fprintf(fd, "\n11n stats\n");
    STAT_11N(tx_pkts,            "total tx data packets");
    STAT_11N(tx_checks,          "tx drops in wrong state");
    STAT_11N(tx_drops,           "tx drops due to qdepth limit");
    STAT_11N(tx_minqdepth,       "tx frame counter that not put to software queue for scheduling later to aggregation");
    STAT_11N(tx_queue,           "tx frame counter that was put to software queue for scheduling later to aggregation");
    STAT_11N(tx_comps,           "tx completions");
    STAT_11N(tx_stopfiltered,    "tx pkts filtered for requeueing");
    STAT_11N(tx_qnull,           "txq empty occurences");
    STAT_11N(tx_noskbs,          "tx no skbs for encapsulations");
    STAT_11N(tx_nobufs,          "tx no descriptors");
    STAT_11N(tx_badsetups,       "tx key setup failures");
    STAT_11N(tx_normnobufs,      "tx no desc for legacy packets");
    STAT_11N(tx_schednone,       "tx tasklet schedule catch the soft pkt queue is empty,do nothing");
    STAT_11N(tx_bars,            "tx bars sent");
    STAT_11N(txbar_compretries,  "tx bar retries sent");
    STAT_11N(txbar_errlast,      "tx bar last frame failed");
    STAT_11N(txbar_xretry,       "tx bar excessive retries");
    STAT_11N(tx_compunaggr,      "tx unaggregated frame completions that acked by the other side");
    STAT_11N(txunaggr_xretry,    "tx unaggregated excessive retries");
    STAT_11N(txunaggr_compretries, "tx unaggregated unacked frames");
    STAT_11N(txunaggr_errlast,   "tx unaggregated last frame failed");
    STAT_11N(tx_compaggr,        "tx aggregated completions frame counter that acked by the other side");
    STAT_11N(tx_bawadv,          "tx block ack window advanced");
    STAT_11N(tx_bawretries,      "tx block ack window retries");
    STAT_11N(tx_bawnorm,         "tx block ack window additions");
    STAT_11N(tx_bawupdates,      "tx block ack window updates");
    STAT_11N(tx_bawupdtadv,      "tx block ack window advances");
    STAT_11N(tx_retries,         "tx retries of sub frames");
    STAT_11N(tx_xretries,        "tx excessive retries of aggregates");
    STAT_11N(txaggr_noskbs,      "tx no skbs for aggr encapsualtion");
    STAT_11N(txaggr_nobufs,      "tx no desc for aggr");
    STAT_11N(txaggr_badkeys,     "tx enc key setup failures");
    STAT_11N(txaggr_schedwindow, "tx no frame scheduled: baw limited");
    STAT_11N(txaggr_single,      "tx frames not aggregated due to the soft queue only have one frame");
	STAT_11N(tx_aggregates,      "tx aggregated frames counter by the sender");
    STAT_11N(tx_aggr_frames,     "tx aggregated sub frames counter by the sender"); 
    STAT_11N(txaggr_mimo,        "tx frames aggregated for mimo");
    STAT_11N(txaggr_compgood,    "tx aggr good sub-frame completions");
    STAT_11N(txaggr_compxretry,  "tx aggr excessive retries");
    STAT_11N(txaggr_compretries, "tx aggr unacked subframes");
    STAT_11N(txaggr_prepends,    "tx aggr old frames requeued");
    STAT_11N(txaggr_filtered,    "filtered aggr packet");
    STAT_11N(txaggr_fifo,        "fifo underrun of aggregate");
    STAT_11N(txaggr_xtxop,       "txop exceeded for an aggregate");
    STAT_11N(txaggr_desc_cfgerr, "aggregate descriptor config error");
    STAT_11N(txaggr_data_urun,   "data underrun for an aggregate");
    STAT_11N(txaggr_delim_urun,  "delimiter underrun for an aggregate");
    STAT_11N(txaggr_errlast,     "tx aggr: last sub-frame failed");
    STAT_11N(txaggr_longretries, "tx aggr: h/w long retries");
    STAT_11N(txaggr_shortretries,"tx aggr: h/w short retries");
    STAT_11N(txaggr_timer_exp,   "tx aggr: tx timer expired");
    STAT_11N(txaggr_babug,       "tx aggr: BA state is not updated");
    STAT_11N(txaggr_badtid,      "tx aggr: BA bad tid");
    STAT_11N(txrifs_single,      "tx frames not aggregated");
    STAT_11N(txrifs_babug,       "tx rifs: BA state is not updated");
    STAT_11N(txrifs_compretries, "tx rifs: unacked subframes");
    STAT_11N(txrifs_bar_alloc,   "tx rifs: bar frames allocated");
    STAT_11N(txrifs_bar_freed,   "tx rifs: bar frames freed");
    STAT_11N(txrifs_compgood,    "tx rifs: good completions");
    STAT_11N(tx_comprifs,        "tx rifs completions");
    STAT_11N(tx_compnorifs,      "tx non-rifs frame completions");
    STAT_11N(txrifs_prepends,    "tx rifs old frames requeued");
    STAT_11N(rx_pkts,            "rx pkts");
    STAT_11N(rx_aggr,            "rx aggregated packets");
    STAT_11N(rx_aggrbadver,      "rx pkts with bad version");
    STAT_11N(rx_bars,            "rx bars");
    STAT_11N(rx_nonqos,          "rx non qos-data frames");
    STAT_11N(rx_seqreset,        "rx sequence resets");
    STAT_11N(rx_oldseq,          "rx old packets");
    STAT_11N(rx_bareset,         "rx block ack window reset");
    STAT_11N(rx_baresetpkts,     "rx pts indicated due to baw resets");
    STAT_11N(rx_dup,             "rx duplicate pkts");
    STAT_11N(rx_baadvance,       "rx block ack window advanced");
    STAT_11N(rx_recvcomp,        "rx pkt completions");
    STAT_11N(rx_bardiscard,      "rx bar discarded");
    STAT_11N(rx_barcomps,        "rx pkts unblocked on bar reception");
    STAT_11N(rx_barrecvs,        "rx pkt completions on bar reception");
    STAT_11N(rx_skipped,         "rx pkt sequences skipped on timeout");
    STAT_11N(rx_comp_to,         "rx indications due to timeout");
    STAT_11N(wd_tx_active,       "watchdog: tx is active");
    STAT_11N(wd_tx_inactive,     "watchdog: tx is not active");
    STAT_11N(wd_tx_hung,         "watchdog: tx is hung");
    STAT_11N(wd_spurious,        "watchdog: spurious tx hang");
    STAT_11N(tx_requeue,         "filter & requeue on 20/40 transitions");
    STAT_11N(tx_drain_txq,       "draining tx queue on error");
    STAT_11N(tx_drain_tid,       "draining tid buf queue on error");
    STAT_11N(tx_cleanup_tid,     "draining tid buf queue on node cleanup");
    STAT_11N(tx_drain_bufs,      "buffers drained from pending tid queue");
    STAT_11N(tx_tidpaused,       "tid paused");
    STAT_11N(tx_tidresumed,      "tid resumed");
    STAT_11N(tx_unaggr_filtered, "unaggregated tx pkts filtered");
    STAT_11N(tx_aggr_filtered,   "aggregated tx pkts filtered");
    STAT_11N(tx_filtered,        "total sub-frames filtered");
    STAT_11N(rx_rb_on,           "rb on");
    STAT_11N(rx_rb_off,          "rb off");
    STAT_11N(rx_dsstat_err,      "rx descriptor status corrupted");

    /* Per Queue Statistics */
    for (i=0;i<10;++i) {
        if (stats->ast_txq_packets[i])
            fprintf(fd,"TXQ[%d]:%s tx %d xretry %d fifoerr %d filtered %d no buffs %d\n",
                    i,qdesc[i], stats->ast_txq_packets[i],stats->ast_txq_xretries[i],
                    stats->ast_txq_fifoerr[i],stats->ast_txq_filtered[i], stats->ast_txq_nobuf[i]);
    }

    /* Percentages */
    STAT_11N_P(txunaggr_xretry, tx_compunaggr,
               "tx unaggregated excessive retry percent");
    STAT_11N_P(txaggr_longretries, tx_compaggr,
               "tx aggregated long retry percent");
    STAT_11N_P(txaggr_compxretry, tx_compaggr,
               "tx aggregated excessive retry percent");
    STAT_11N_P(tx_retries, tx_bawadv,
               "tx aggregate subframe retry percent");
    STAT_11N_P(tx_xretries, tx_bawadv,
               "tx aggregate subframe excessive retry percent");
#ifdef ATH_SUPPORT_VOWEXT
    fprintf(fd, "VOW STATS: ul_tx_calls: %d %d %d %d ath_txq_calls: %d %d %d %d drops(be/bk): %d %d\n",
            stats->ast_vow_ul_tx_calls[0], stats->ast_vow_ul_tx_calls[1],
            stats->ast_vow_ul_tx_calls[2], stats->ast_vow_ul_tx_calls[3],
            stats->ast_vow_ath_txq_calls[0], stats->ast_vow_ath_txq_calls[1],
            stats->ast_vow_ath_txq_calls[2], stats->ast_vow_ath_txq_calls[3],
            stats->ast_vow_ath_be_drop, stats->ast_vow_ath_bk_drop);
#endif
#if UMAC_SUPPORT_VI_DBG
        fprintf(fd, "Timestamp  RSSIC0 RSSIC1 RSSIC2 RSSIE0 RSSIE1 RSSIE2  RSSI  EVM0 EVM1 EVM2 RXRATE TXFRAMECNT RXFRAMECNT RXCLRCOUNT RXEXCLRCNT CYCLECOUNT\n");
    for (i = 0; i < ATH_STATS_VI_LOG_LEN; i++) {
                fprintf(fd, "0x%08x %06d %06d %06d %06d %06d %06d %06d %4hhd %4hhd %4hhd 0x%04x %010d %010u %010u %010u %010u\n",
                             stats->vi_timestamp[i], stats->vi_rssi_ctl0[i], stats->vi_rssi_ctl1[i], stats->vi_rssi_ctl2[i],
                             stats->vi_rssi_ext0[i], stats->vi_rssi_ext1[i], stats->vi_rssi_ext2[i], stats->vi_rssi[i],
                             stats->vi_evm0[i], stats->vi_evm1[i], stats->vi_evm2[i], stats->vi_rs_rate[i],
                             stats->vi_tx_frame_cnt[i], stats->vi_rx_frame_cnt[i], stats->vi_rx_clr_cnt[i], stats->vi_rx_ext_clr_cnt[i],
                             stats->vi_cycle_cnt[i]);
                }
#endif

#ifdef ATH_SUPPORT_TxBF
    fprintf(fd,"\nHT Tx Rate STATS:\n");
    fprintf(fd," mcs 0- mcs 7 STATS:");
    for (i=0 ;i<8 ;i++)
        fprintf(fd,"%#6d,",stats->ast_mcs_count[i]);
    fprintf(fd,"\n mcs 8- mcs15 STATS:");
    for (i=0 ;i<8 ;i++)
        fprintf(fd,"%#6d,",stats->ast_mcs_count[i+8]);
    fprintf(fd,"\n mcs16- mcs23 STATS:");
    for (i=0 ;i<8 ;i++)
        fprintf(fd,"%#6d,",stats->ast_mcs_count[i+16]);
        
    fprintf(fd,"\nTxBF STATS:\n");
    fprintf(fd," Sounding sent %d\n",stats->ast_sounding_count);
    fprintf(fd," V/CV received %d\n",stats->ast_txbf_rpt_count);
#endif

    for (i = MAX_BB_PANICS - 1; i >= 0; i--) {
        if (!stats->ast_bb_panic[i].valid)
            continue;

        fprintf(fd, "\n==== BB update: BB status=0x%08x, tsf=0x%08x ====\n",
            stats->ast_bb_panic[i].status, stats->ast_bb_panic[i].tsf);
        fprintf(fd, "** BB state: wd=%u det=%u rdar=%u rOFDM=%d rCCK=%u tOFDM=%u tCCK=%u agc=%u src=%u **\n",
            stats->ast_bb_panic[i].wd, stats->ast_bb_panic[i].det, stats->ast_bb_panic[i].rdar,
            stats->ast_bb_panic[i].rODFM, stats->ast_bb_panic[i].rCCK, stats->ast_bb_panic[i].tODFM,
            stats->ast_bb_panic[i].tCCK, stats->ast_bb_panic[i].agc, stats->ast_bb_panic[i].src);
        fprintf(fd, "** BB WD cntl: cntl1=0x%08x cntl2=0x%08x **\n",
            stats->ast_bb_panic[i].phy_panic_wd_ctl1, stats->ast_bb_panic[i].phy_panic_wd_ctl2);
        fprintf(fd, "** BB mode: BB_gen_controls=0x%08x **\n", 
            stats->ast_bb_panic[i].phy_gen_ctrl);
        if (stats->ast_bb_panic[i].cycles) {
            fprintf(fd, "** BB busy times: rx_clear=%d%%, rx_frame=%d%%, tx_frame=%d%% **\n",
                stats->ast_bb_panic[i].rxc_pcnt, stats->ast_bb_panic[i].rxf_pcnt, stats->ast_bb_panic[i].txf_pcnt);
        }
        fprintf(fd, "==== BB update: done ====\n\n");
    }

#undef STAT_FMT
#undef STAT
#undef STAT64
#undef STAT_PEEK_11N
#undef STAT_11N_P
#undef STAT_11N
#undef N
}