Date: Fri, 7 Mar 2008 23:01:19 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 137126 for review Message-ID: <200803072301.m27N1J0E003808@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=137126 Change 137126 by sam@sam_ebb on 2008/03/07 23:00:58 overhaul debug support: use the net80211 debug flag to control msgs instead of the ath debug flags Affected files ... .. //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#9 edit .. //depot/projects/vap/sys/modules/ath_rate_sample/Makefile#5 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#9 (text+ko) ==== @@ -42,6 +42,7 @@ * John Bicket's SampleRate control algorithm. */ #include "opt_inet.h" +#include "opt_wlan.h" #include <sys/param.h> #include <sys/systm.h> @@ -61,7 +62,6 @@ #include <net/if.h> #include <net/if_media.h> #include <net/if_arp.h> -#include <net/ethernet.h> /* XXX for ether_sprintf */ #include <net80211/ieee80211_var.h> @@ -76,23 +76,6 @@ #include <dev/ath/ath_rate/sample/sample.h> #include <contrib/dev/ath/ah_desc.h> -#define SAMPLE_DEBUG -#ifdef SAMPLE_DEBUG -enum { - ATH_DEBUG_NODE = 0x00080000, /* node management */ - ATH_DEBUG_RATE = 0x00000010, /* rate control */ - ATH_DEBUG_ANY = 0xffffffff -}; -#define DPRINTF(sc, m, fmt, ...) do { \ - if (sc->sc_debug & (m)) \ - printf(fmt, __VA_ARGS__); \ -} while (0) -#else -#define DPRINTF(sc, m, fmt, ...) do { \ - (void) sc; \ -} while (0) -#endif - /* * This file is an implementation of the SampleRate algorithm * in "Bit-rate Selection in Wireless Networks" @@ -152,14 +135,12 @@ void ath_rate_node_init(struct ath_softc *sc, struct ath_node *an) { - DPRINTF(sc, ATH_DEBUG_NODE, "%s:\n", __func__); /* NB: assumed to be zero'd by caller */ } void ath_rate_node_cleanup(struct ath_softc *sc, struct ath_node *an) { - DPRINTF(sc, ATH_DEBUG_NODE, "%s:\n", __func__); } @@ -323,10 +304,11 @@ if (change_rates) { if (best_ndx != sn->current_rate[size_bin]) { - DPRINTF(sc, ATH_DEBUG_RATE, -"%s: %s size %d switch rate %d (%d/%d) -> %d (%d/%d) after %d packets mrr %d\n", + IEEE80211_NOTE(an->an_node.ni_vap, + IEEE80211_MSG_RATECTL, + &an->an_node, +"%s: size %d switch rate %d (%d/%d) -> %d (%d/%d) after %d packets mrr %d", __func__, - ether_sprintf(an->an_node.ni_macaddr), packet_size_bins[size_bin], sn->rates[sn->current_rate[size_bin]].rate, sn->stats[size_bin][sn->current_rate[size_bin]].average_tx_time, @@ -491,9 +473,10 @@ if (ndx0 == sn->current_sample_ndx[size_bin]) { - DPRINTF(sc, ATH_DEBUG_RATE, -"%s: %s size %d %s sample rate %d tries (%d/%d) tt %d avg_tt (%d/%d)\n", - __func__, ether_sprintf(an->an_node.ni_macaddr), + IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, + &an->an_node, +"%s: size %d %s sample rate %d tries (%d/%d) tt %d avg_tt (%d/%d)", + __func__, size, status ? "FAIL" : "OK", rate, short_tries, tries, tt, @@ -523,9 +506,10 @@ frame_size = 1500; if (sn->num_rates <= 0) { - DPRINTF(sc, ATH_DEBUG_RATE, - "%s: %s size %d %s rate/try %d/%d no rates yet\n", - __func__, ether_sprintf(an->an_node.ni_macaddr), + IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, + &an->an_node, + "%s: size %d %s rate/try %d/%d no rates yet", + __func__, bin_to_size(size_to_bin(frame_size)), ts->ts_status ? "FAIL" : "OK", short_tries, long_tries); @@ -538,9 +522,9 @@ /* * Only one rate was used; optimize work. */ - DPRINTF(sc, ATH_DEBUG_RATE, - "%s: %s size %d %s rate/try %d/%d/%d\n", - __func__, ether_sprintf(an->an_node.ni_macaddr), + IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, + &an->an_node, "%s: size %d %s rate/try %d/%d/%d", + __func__, bin_to_size(size_to_bin(frame_size)), ts->ts_status ? "FAIL" : "OK", final_rate, short_tries, long_tries); @@ -588,9 +572,10 @@ tries3 = MS(ds0->ds_ctl2, AR_XmitDataTries3); ndx3 = rate_to_ndx(sn, rate3); - DPRINTF(sc, ATH_DEBUG_RATE, -"%s: %s size %d finaltsidx %d tries %d %s rate/try [%d/%d %d/%d %d/%d %d/%d]\n", - __func__, ether_sprintf(an->an_node.ni_macaddr), + IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, + &an->an_node, +"%s: size %d finaltsidx %d tries %d %s rate/try [%d/%d %d/%d %d/%d %d/%d]", + __func__, bin_to_size(size_to_bin(frame_size)), finalTSIdx, long_tries, @@ -655,8 +640,6 @@ void ath_rate_newassoc(struct ath_softc *sc, struct ath_node *an, int isnew) { - DPRINTF(sc, ATH_DEBUG_NODE, "%s: %s isnew %d\n", __func__, - ether_sprintf(an->an_node.ni_macaddr), isnew); if (isnew) ath_rate_ctl_reset(sc, &an->an_node); } @@ -697,30 +680,34 @@ sn->static_rate_ndx = srate; } - DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s size 1600 rate/tt", - __func__, ether_sprintf(ni->ni_macaddr)); - sn->num_rates = ni->ni_rates.rs_nrates; for (x = 0; x < ni->ni_rates.rs_nrates; x++) { sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL; sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate]; if (sn->rates[x].rix == 0xff) { - DPRINTF(sc, ATH_DEBUG_RATE, - "%s: ignore bogus rix at %d\n", __func__, x); + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "%s: ignore bogus rix at %d", __func__, x); continue; } sn->rates[x].rateCode = rt->info[sn->rates[x].rix].rateCode; sn->rates[x].shortPreambleRateCode = rt->info[sn->rates[x].rix].rateCode | rt->info[sn->rates[x].rix].shortPreamble; - - DPRINTF(sc, ATH_DEBUG_RATE, " %d/%d", sn->rates[x].rate, - calc_usecs_unicast_packet(sc, 1600, sn->rates[x].rix, 0,0)); + } +#ifdef IEEE80211_DEBUG + if (ieee80211_msg(ni->ni_vap, IEEE80211_MSG_RATECTL)) { + ieee80211_note(ni->ni_vap, "[%6D] %s: size 1600 rate/tt", + __func__, ni->ni_macaddr, ":"); + for (x = 0; x < sn->num_rates; x++) { + if (sn->rates[x].rix == 0xff) + continue; + printf(" %d/%d", sn->rates[x].rate, + calc_usecs_unicast_packet(sc, 1600, + sn->rates[x].rix, 0,0)); + } + printf("\n"); } - DPRINTF(sc, ATH_DEBUG_RATE, "%s\n", ""); - - sn->num_rates = ni->ni_rates.rs_nrates; - +#endif for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { int size = bin_to_size(y); int ndx = 0; @@ -751,9 +738,8 @@ sn->current_rate[y] = ndx; } - DPRINTF(sc, ATH_DEBUG_RATE, - "%s: %s %d rates %d%sMbps (%dus)- %d%sMbps (%dus)\n", - __func__, ether_sprintf(ni->ni_macaddr), + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "%s: %d rates %d%sMbps (%dus)- %d%sMbps (%dus)", __func__, sn->num_rates, sn->rates[0].rate/2, sn->rates[0].rate % 0x1 ? ".5" : "", sn->stats[1][0].perfect_tx_time, @@ -819,7 +805,6 @@ { struct sample_softc *osc; - DPRINTF(sc, ATH_DEBUG_ANY, "%s:\n", __func__); osc = malloc(sizeof(struct sample_softc), M_DEVBUF, M_NOWAIT|M_ZERO); if (osc == NULL) return NULL; ==== //depot/projects/vap/sys/modules/ath_rate_sample/Makefile#5 (text+ko) ==== @@ -40,7 +40,7 @@ KMOD= ath_rate SRCS= sample.c -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ah.h +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ah.h opt_wlan.h HAL= ${.CURDIR}/../../contrib/dev/ath CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${HAL} @@ -56,7 +56,13 @@ ATH_MODULE_ARCH=${MACHINE_ARCH} .endif +.if !defined(KERNBUILDDIR) opt_ah.h: ${HAL}/public/${ATH_MODULE_ARCH}-elf.opt_ah.h cp ${HAL}/public/${ATH_MODULE_ARCH}-elf.opt_ah.h ${.TARGET} +opt_wlan.h: +# echo "#define IEEE80211_DEBUG 1" > opt_wlan.h + echo > opt_wlan.h +.endif + .include <bsd.kmod.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803072301.m27N1J0E003808>