From owner-p4-projects@FreeBSD.ORG Fri Mar 7 23:01:20 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 634DD1065673; Fri, 7 Mar 2008 23:01:20 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22E981065672 for ; Fri, 7 Mar 2008 23:01:20 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 10FB78FC1D for ; Fri, 7 Mar 2008 23:01:20 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m27N1Jrk003810 for ; Fri, 7 Mar 2008 23:01:19 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m27N1J0E003808 for perforce@freebsd.org; Fri, 7 Mar 2008 23:01:19 GMT (envelope-from sam@freebsd.org) Date: Fri, 7 Mar 2008 23:01:19 GMT Message-Id: <200803072301.m27N1J0E003808@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 137126 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2008 23:01:20 -0000 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 #include @@ -61,7 +62,6 @@ #include #include #include -#include /* XXX for ether_sprintf */ #include @@ -76,23 +76,6 @@ #include #include -#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