summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-05-25 14:30:44 +0000
committerglebius <glebius@FreeBSD.org>2015-05-25 14:30:44 +0000
commitcc7b8a5e2f47f370525591f29fe98b35c994753c (patch)
tree6b077a79977eee66616ddd6a1a7bfe05165949ce /sys/net80211
parent66a0596ceed9c2af249e4d81677967af86707db4 (diff)
downloadFreeBSD-src-cc7b8a5e2f47f370525591f29fe98b35c994753c.zip
FreeBSD-src-cc7b8a5e2f47f370525591f29fe98b35c994753c.tar.gz
Use name from ieee80211com instead of parent ifnet, in debugging printfs.
Sponsored by: Netflix Sponsored by: Nginx, Inc.
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211.c33
-rw-r--r--sys/net80211/ieee80211_ddb.c1
-rw-r--r--sys/net80211/ieee80211_dfs.c22
-rw-r--r--sys/net80211/ieee80211_freebsd.c3
-rw-r--r--sys/net80211/ieee80211_ht.c17
-rw-r--r--sys/net80211/ieee80211_node.c11
-rw-r--r--sys/net80211/ieee80211_proto.c3
-rw-r--r--sys/net80211/ieee80211_radiotap.c8
-rw-r--r--sys/net80211/ieee80211_regdomain.c10
-rw-r--r--sys/net80211/ieee80211_var.h1
10 files changed, 59 insertions, 50 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 2fa7e9a..6609f46 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-
#include <sys/socket.h>
+#include <machine/stdarg.h>
+
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_dl.h>
@@ -267,7 +268,20 @@ static void
null_update_chw(struct ieee80211com *ic)
{
- if_printf(ic->ic_ifp, "%s: need callback\n", __func__);
+ ic_printf(ic, "%s: need callback\n", __func__);
+}
+
+int
+ic_printf(struct ieee80211com *ic, const char * fmt, ...)
+{
+ va_list ap;
+ int retval;
+
+ retval = printf("%s: ", ic->ic_name);
+ va_start(ap, fmt);
+ retval += vprintf(fmt, ap);
+ va_end(ap);
+ return (retval);
}
/*
@@ -284,8 +298,8 @@ ieee80211_ifattach(struct ieee80211com *ic,
KASSERT(ifp->if_type == IFT_IEEE80211, ("if_type %d", ifp->if_type));
- IEEE80211_LOCK_INIT(ic, ifp->if_xname);
- IEEE80211_TX_LOCK_INIT(ic, ifp->if_xname);
+ IEEE80211_LOCK_INIT(ic, ic->ic_name);
+ IEEE80211_TX_LOCK_INIT(ic, ic->ic_name);
TAILQ_INIT(&ic->ic_vaps);
/* Create a taskqueue for all state changes */
@@ -427,7 +441,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
- if_printf(ic->ic_ifp, "%s: unable to allocate ifnet\n",
+ ic_printf(ic, "%s: unable to allocate ifnet\n",
__func__);
return ENOMEM;
}
@@ -551,7 +565,7 @@ ieee80211_vap_attach(struct ieee80211vap *vap,
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
"%s: %s parent %s flags 0x%x flags_ext 0x%x\n",
__func__, ieee80211_opmode_name[vap->iv_opmode],
- ic->ic_ifp->if_xname, vap->iv_flags, vap->iv_flags_ext);
+ ic->ic_name, vap->iv_flags, vap->iv_flags_ext);
/*
* Do late attach work that cannot happen until after
@@ -608,7 +622,7 @@ ieee80211_vap_detach(struct ieee80211vap *vap)
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s parent %s\n",
__func__, ieee80211_opmode_name[vap->iv_opmode],
- ic->ic_ifp->if_xname);
+ ic->ic_name);
/* NB: bpfdetach is called by ether_ifdetach and claims all taps */
ether_ifdetach(ifp);
@@ -900,7 +914,7 @@ int
ieee80211_chan2ieee(struct ieee80211com *ic, const struct ieee80211_channel *c)
{
if (c == NULL) {
- if_printf(ic->ic_ifp, "invalid channel (NULL)\n");
+ ic_printf(ic, "invalid channel (NULL)\n");
return 0; /* XXX */
}
return (c == IEEE80211_CHAN_ANYC ? IEEE80211_CHAN_ANY : c->ic_ieee);
@@ -1169,7 +1183,6 @@ ieee80211_get_suprates(struct ieee80211com *ic, const struct ieee80211_channel *
void
ieee80211_announce(struct ieee80211com *ic)
{
- struct ifnet *ifp = ic->ic_ifp;
int i, rate, mword;
enum ieee80211_phymode mode;
const struct ieee80211_rateset *rs;
@@ -1178,7 +1191,7 @@ ieee80211_announce(struct ieee80211com *ic)
for (mode = IEEE80211_MODE_AUTO+1; mode < IEEE80211_MODE_11NA; mode++) {
if (isclr(ic->ic_modecaps, mode))
continue;
- if_printf(ifp, "%s rates: ", ieee80211_phymode_name[mode]);
+ ic_printf(ic, "%s rates: ", ieee80211_phymode_name[mode]);
rs = &ic->ic_sup_rates[mode];
for (i = 0; i < rs->rs_nrates; i++) {
mword = ieee80211_rate2media(ic, rs->rs_rates[i], mode);
diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c
index 74e82e5..e646cf2 100644
--- a/sys/net80211/ieee80211_ddb.c
+++ b/sys/net80211/ieee80211_ddb.c
@@ -521,6 +521,7 @@ _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta,
db_printf(" %s(%p)", vap->iv_ifp->if_xname, vap);
db_printf("\n");
db_printf("\tifp %p(%s)", ic->ic_ifp, ic->ic_ifp->if_xname);
+ db_printf("\tname %s", ic->ic_name);
db_printf(" comlock %p", &ic->ic_comlock);
db_printf("\n");
db_printf("\theadroom %d", ic->ic_headroom);
diff --git a/sys/net80211/ieee80211_dfs.c b/sys/net80211/ieee80211_dfs.c
index 5fa9ba4..232ceb7 100644
--- a/sys/net80211/ieee80211_dfs.c
+++ b/sys/net80211/ieee80211_dfs.c
@@ -253,8 +253,8 @@ dfs_timeout(void *arg)
* msg instead of one for every channel
* table entry.
*/
- if_printf(ic->ic_ifp, "radar on channel"
- " %u (%u MHz) cleared after timeout\n",
+ ic_printf(ic, "radar on channel %u "
+ "(%u MHz) cleared after timeout\n",
c->ic_ieee, c->ic_freq);
/* notify user space */
c->ic_state &=
@@ -272,14 +272,14 @@ dfs_timeout(void *arg)
}
static void
-announce_radar(struct ifnet *ifp, const struct ieee80211_channel *curchan,
+announce_radar(struct ieee80211com *ic, const struct ieee80211_channel *curchan,
const struct ieee80211_channel *newchan)
{
if (newchan == NULL)
- if_printf(ifp, "radar detected on channel %u (%u MHz)\n",
+ ic_printf(ic, "radar detected on channel %u (%u MHz)\n",
curchan->ic_ieee, curchan->ic_freq);
else
- if_printf(ifp, "radar detected on channel %u (%u MHz), "
+ ic_printf(ic, "radar detected on channel %u (%u MHz), "
"moving to channel %u (%u MHz)\n",
curchan->ic_ieee, curchan->ic_freq,
newchan->ic_ieee, newchan->ic_freq);
@@ -309,7 +309,7 @@ ieee80211_dfs_notify_radar(struct ieee80211com *ic, struct ieee80211_channel *ch
* along merrily.
*/
if (ieee80211_dfs_debug == DFS_DBG_NOCSANOL) {
- announce_radar(ic->ic_ifp, chan, chan);
+ announce_radar(ic, chan, chan);
ieee80211_notify_radar(ic, chan);
return;
}
@@ -364,7 +364,7 @@ ieee80211_dfs_notify_radar(struct ieee80211com *ic, struct ieee80211_channel *ch
else
dfs->newchan = chan;
- announce_radar(ic->ic_ifp, chan, dfs->newchan);
+ announce_radar(ic, chan, dfs->newchan);
if (callout_pending(&dfs->cac_timer))
callout_schedule(&dfs->cac_timer, 0);
@@ -380,7 +380,7 @@ ieee80211_dfs_notify_radar(struct ieee80211com *ic, struct ieee80211_channel *ch
* on the NOL to expire.
*/
/*XXX*/
- if_printf(ic->ic_ifp, "%s: No free channels; waiting for entry "
+ ic_printf(ic, "%s: No free channels; waiting for entry "
"on NOL to expire\n", __func__);
}
} else {
@@ -390,9 +390,9 @@ ieee80211_dfs_notify_radar(struct ieee80211com *ic, struct ieee80211_channel *ch
if (dfs->lastchan != chan) {
dfs->lastchan = chan;
dfs->cureps = 0;
- announce_radar(ic->ic_ifp, chan, NULL);
+ announce_radar(ic, chan, NULL);
} else if (ppsratecheck(&dfs->lastevent, &dfs->cureps, 1)) {
- announce_radar(ic->ic_ifp, chan, NULL);
+ announce_radar(ic, chan, NULL);
}
}
}
@@ -434,6 +434,6 @@ ieee80211_dfs_pickchannel(struct ieee80211com *ic)
(c->ic_flags & flags) == flags)
return c;
}
- if_printf(ic->ic_ifp, "HELP, no channel located to switch to!\n");
+ ic_printf(ic, "HELP, no channel located to switch to!\n");
return NULL;
}
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c
index 7a2abf8..973d268 100644
--- a/sys/net80211/ieee80211_freebsd.c
+++ b/sys/net80211/ieee80211_freebsd.c
@@ -207,9 +207,8 @@ static int
ieee80211_sysctl_parent(SYSCTL_HANDLER_ARGS)
{
struct ieee80211com *ic = arg1;
- const char *name = ic->ic_ifp->if_xname;
- return SYSCTL_OUT_STR(req, name);
+ return SYSCTL_OUT_STR(req, ic->ic_name);
}
static int
diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
index 0700de8..d83cf65 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -354,7 +354,6 @@ static struct printranges {
static void
ht_rateprint(struct ieee80211com *ic, enum ieee80211_phymode mode, int ratetype)
{
- struct ifnet *ifp = ic->ic_ifp;
int minrate, maxrate;
struct printranges *range;
@@ -369,12 +368,12 @@ ht_rateprint(struct ieee80211com *ic, enum ieee80211_phymode mode, int ratetype)
minrate = ht_getrate(ic, range->minmcs, mode, ratetype);
maxrate = ht_getrate(ic, range->maxmcs, mode, ratetype);
if (range->maxmcs) {
- if_printf(ifp, "MCS %d-%d: %d%sMbps - %d%sMbps\n",
+ ic_printf(ic, "MCS %d-%d: %d%sMbps - %d%sMbps\n",
range->minmcs, range->maxmcs,
minrate/2, ((minrate & 0x1) != 0 ? ".5" : ""),
maxrate/2, ((maxrate & 0x1) != 0 ? ".5" : ""));
} else {
- if_printf(ifp, "MCS %d: %d%sMbps\n", range->minmcs,
+ ic_printf(ic, "MCS %d: %d%sMbps\n", range->minmcs,
minrate/2, ((minrate & 0x1) != 0 ? ".5" : ""));
}
}
@@ -383,22 +382,21 @@ ht_rateprint(struct ieee80211com *ic, enum ieee80211_phymode mode, int ratetype)
static void
ht_announce(struct ieee80211com *ic, enum ieee80211_phymode mode)
{
- struct ifnet *ifp = ic->ic_ifp;
const char *modestr = ieee80211_phymode_name[mode];
- if_printf(ifp, "%s MCS 20MHz\n", modestr);
+ ic_printf(ic, "%s MCS 20MHz\n", modestr);
ht_rateprint(ic, mode, 0);
if (ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20) {
- if_printf(ifp, "%s MCS 20MHz SGI\n", modestr);
+ ic_printf(ic, "%s MCS 20MHz SGI\n", modestr);
ht_rateprint(ic, mode, 1);
}
if (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) {
- if_printf(ifp, "%s MCS 40MHz:\n", modestr);
+ ic_printf(ic, "%s MCS 40MHz:\n", modestr);
ht_rateprint(ic, mode, 2);
}
if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
(ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40)) {
- if_printf(ifp, "%s MCS 40MHz SGI:\n", modestr);
+ ic_printf(ic, "%s MCS 40MHz SGI:\n", modestr);
ht_rateprint(ic, mode, 3);
}
}
@@ -406,11 +404,10 @@ ht_announce(struct ieee80211com *ic, enum ieee80211_phymode mode)
void
ieee80211_ht_announce(struct ieee80211com *ic)
{
- struct ifnet *ifp = ic->ic_ifp;
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA) ||
isset(ic->ic_modecaps, IEEE80211_MODE_11NG))
- if_printf(ifp, "%dT%dR\n", ic->ic_txstream, ic->ic_rxstream);
+ ic_printf(ic, "%dT%dR\n", ic->ic_txstream, ic->ic_rxstream);
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA))
ht_announce(ic, IEEE80211_MODE_11NA);
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NG))
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index fbb8e93..1bbb8e1 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1908,11 +1908,10 @@ ieee80211_node_table_init(struct ieee80211com *ic,
struct ieee80211_node_table *nt,
const char *name, int inact, int keyixmax)
{
- struct ifnet *ifp = ic->ic_ifp;
nt->nt_ic = ic;
- IEEE80211_NODE_LOCK_INIT(nt, ifp->if_xname);
- IEEE80211_NODE_ITERATE_LOCK_INIT(nt, ifp->if_xname);
+ IEEE80211_NODE_LOCK_INIT(nt, ic->ic_name);
+ IEEE80211_NODE_ITERATE_LOCK_INIT(nt, ic->ic_name);
TAILQ_INIT(&nt->nt_node);
nt->nt_name = name;
nt->nt_scangen = 1;
@@ -1923,7 +1922,7 @@ ieee80211_node_table_init(struct ieee80211com *ic,
keyixmax * sizeof(struct ieee80211_node *),
M_80211_NODE, M_NOWAIT | M_ZERO);
if (nt->nt_keyixmap == NULL)
- if_printf(ic->ic_ifp,
+ ic_printf(ic,
"Cannot allocate key index map with %u entries\n",
keyixmax);
} else
@@ -2256,8 +2255,8 @@ ieee80211_iterate_nt(struct ieee80211_node_table *nt,
TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
if (i >= max_aid) {
ret = E2BIG;
- if_printf(nt->nt_ic->ic_ifp,
- "Node array overflow: max=%u", max_aid);
+ ic_printf(nt->nt_ic, "Node array overflow: max=%u",
+ max_aid);
break;
}
ni_arr[i] = ieee80211_ref_node(ni);
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 1f09616..1dcbc75 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -113,9 +113,8 @@ static int
null_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
const struct ieee80211_bpf_params *params)
{
- struct ifnet *ifp = ni->ni_ic->ic_ifp;
- if_printf(ifp, "missing ic_raw_xmit callback, drop frame\n");
+ ic_printf(ni->ni_ic, "missing ic_raw_xmit callback, drop frame\n");
m_freem(m);
return ENETDOWN;
}
diff --git a/sys/net80211/ieee80211_radiotap.c b/sys/net80211/ieee80211_radiotap.c
index 5638f52..34e4dbb 100644
--- a/sys/net80211/ieee80211_radiotap.c
+++ b/sys/net80211/ieee80211_radiotap.c
@@ -80,8 +80,8 @@ ieee80211_radiotap_attachv(struct ieee80211com *ic,
else if (tx_radiotap & B(IEEE80211_RADIOTAP_XCHANNEL))
off = radiotap_offset(th, n_tx_v, IEEE80211_RADIOTAP_XCHANNEL);
if (off == -1) {
- if_printf(ic->ic_ifp, "%s: no tx channel, radiotap 0x%x\n",
- __func__, tx_radiotap);
+ ic_printf(ic, "%s: no tx channel, radiotap 0x%x\n", __func__,
+ tx_radiotap);
/* NB: we handle this case but data will have no chan spec */
} else
ic->ic_txchan = ((uint8_t *) th) + off;
@@ -96,8 +96,8 @@ ieee80211_radiotap_attachv(struct ieee80211com *ic,
else if (rx_radiotap & B(IEEE80211_RADIOTAP_XCHANNEL))
off = radiotap_offset(rh, n_rx_v, IEEE80211_RADIOTAP_XCHANNEL);
if (off == -1) {
- if_printf(ic->ic_ifp, "%s: no rx channel, radiotap 0x%x\n",
- __func__, rx_radiotap);
+ ic_printf(ic, "%s: no rx channel, radiotap 0x%x\n", __func__,
+ rx_radiotap);
/* NB: we handle this case but data will have no chan spec */
} else
ic->ic_rxchan = ((uint8_t *) rh) + off;
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c
index ed7f422..8273c18 100644
--- a/sys/net80211/ieee80211_regdomain.c
+++ b/sys/net80211/ieee80211_regdomain.c
@@ -304,16 +304,16 @@ ieee80211_alloc_countryie(struct ieee80211com *ic)
aie = malloc(IEEE80211_COUNTRY_MAX_SIZE, M_80211_NODE_IE,
M_NOWAIT | M_ZERO);
if (aie == NULL) {
- if_printf(ic->ic_ifp,
- "%s: unable to allocate memory for country ie\n", __func__);
+ ic_printf(ic, "%s: unable to allocate memory for country ie\n",
+ __func__);
/* XXX stat */
return NULL;
}
ie = (struct ieee80211_country_ie *) aie->ie_data;
ie->ie = IEEE80211_ELEMID_COUNTRY;
if (rd->isocc[0] == '\0') {
- if_printf(ic->ic_ifp, "no ISO country string for cc %d; "
- "using blanks\n", rd->country);
+ ic_printf(ic, "no ISO country string for cc %d; using blanks\n",
+ rd->country);
ie->cc[0] = ie->cc[1] = ' ';
} else {
ie->cc[0] = rd->isocc[0];
@@ -350,7 +350,7 @@ ieee80211_alloc_countryie(struct ieee80211com *ic)
if (c->ic_ieee != nextchan ||
c->ic_maxregpower != frm[-1]) { /* new run */
if (nruns == IEEE80211_COUNTRY_MAX_BANDS) {
- if_printf(ic->ic_ifp, "%s: country ie too big, "
+ ic_printf(ic, "%s: country ie too big, "
"runs > max %d, truncating\n",
__func__, IEEE80211_COUNTRY_MAX_BANDS);
/* XXX stat? fail? */
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 40fab79..48449c9 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -676,6 +676,7 @@ MALLOC_DECLARE(M_80211_VAP);
"\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
"\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS"
+int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3);
void ieee80211_ifattach(struct ieee80211com *,
const uint8_t macaddr[IEEE80211_ADDR_LEN]);
void ieee80211_ifdetach(struct ieee80211com *);
OpenPOWER on IntegriCloud