Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jun 2025 03:44:15 GMT
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1a3c03d88aaf - main - net80211: migrate if_printf() -> net80211_vap_printf()
Message-ID:  <202506040344.5543iFTm031094@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a3c03d88aaf380e9b8bcb5efd3c8c3e84f721b1

commit 1a3c03d88aaf380e9b8bcb5efd3c8c3e84f721b1
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2025-05-31 19:02:25 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2025-06-04 03:34:12 +0000

    net80211: migrate if_printf() -> net80211_vap_printf()
    
    Migrate the if_printf() calls to net80211_vap_printf(), which hides
    the underlying ifp and the network stack.
    
    Note: there are still a LOT of direct printf() calls in the codebase.
    This is just a mostly mechanical conversion of if_printf() calls.
    
    Differential Revision:  https://reviews.freebsd.org/D50643
    Reviewed by:    bz
---
 sys/net80211/ieee80211.c          |  2 +-
 sys/net80211/ieee80211_adhoc.c    |  3 ++-
 sys/net80211/ieee80211_amrr.c     |  9 +++++----
 sys/net80211/ieee80211_dfs.c      | 10 ++++++----
 sys/net80211/ieee80211_hostap.c   |  3 ++-
 sys/net80211/ieee80211_input.c    | 15 ++++++++-------
 sys/net80211/ieee80211_mesh.c     |  3 ++-
 sys/net80211/ieee80211_node.c     |  2 +-
 sys/net80211/ieee80211_rssadapt.c |  9 +++++----
 sys/net80211/ieee80211_scan.c     |  4 ++--
 sys/net80211/ieee80211_scan_sw.c  | 12 ++++--------
 sys/net80211/ieee80211_sta.c      |  3 ++-
 sys/net80211/ieee80211_wds.c      |  3 ++-
 13 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 74fdaa033952..44d6a3294bdc 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -2748,7 +2748,7 @@ ieee80211_is_ctl_frame_for_vap(struct ieee80211_node *ni, const struct mbuf *m0)
 	KASSERT(IEEE80211_IS_CTL(wh), ("%s: not a CTL frame (fc[0]=0x%04x)",
 	    __func__, wh->i_fc[0]));
 	if (!IEEE80211_IS_CTL(wh)) {
-		if_printf(vap->iv_ifp,
+		net80211_vap_printf(vap,
 		    "%s: not a control frame (fc[0]=0x%04x)\n",
 		    __func__, wh->i_fc[0]);
 		return (false);
diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c
index 5f5642884726..85baa132ebcf 100644
--- a/sys/net80211/ieee80211_adhoc.c
+++ b/sys/net80211/ieee80211_adhoc.c
@@ -645,7 +645,8 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m,
 #ifdef IEEE80211_DEBUG
 		if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
 		    ieee80211_msg_dumppkts(vap)) {
-			if_printf(ifp, "received %s from %s rssi %d\n",
+			net80211_vap_printf(vap,
+			    "received %s from %s rssi %d\n",
 			    ieee80211_mgt_subtype_name(subtype),
 			    ether_sprintf(wh->i_addr2), rssi);
 		}
diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c
index 1a06303bd2c9..3ce289fc10b6 100644
--- a/sys/net80211/ieee80211_amrr.c
+++ b/sys/net80211/ieee80211_amrr.c
@@ -121,7 +121,7 @@ amrr_init(struct ieee80211vap *vap)
 	amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr),
 	    M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
 	if (amrr == NULL) {
-		if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n");
+		net80211_vap_printf(vap, "couldn't alloc ratectl structure\n");
 		return;
 	}
 	amrr->amrr_min_success_threshold = IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD;
@@ -231,7 +231,8 @@ amrr_node_init(struct ieee80211_node *ni)
 	struct ieee80211_amrr_node *amn;
 
 	if (!amrr) {
-		if_printf(vap->iv_ifp, "ratectl structure was not allocated, "
+		net80211_vap_printf(vap,
+		    "ratectl structure was not allocated, "
 		    "per-node structure allocation skipped\n");
 		return;
 	}
@@ -240,8 +241,8 @@ amrr_node_init(struct ieee80211_node *ni)
 		ni->ni_rctls = amn = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr_node),
 		    M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
 		if (amn == NULL) {
-			if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
-			    "structure\n");
+			net80211_vap_printf(vap,
+			    "couldn't alloc per-node ratectl structure\n");
 			return;
 		}
 	} else
diff --git a/sys/net80211/ieee80211_dfs.c b/sys/net80211/ieee80211_dfs.c
index bce7c2fa5ea4..83774ed8cc71 100644
--- a/sys/net80211/ieee80211_dfs.c
+++ b/sys/net80211/ieee80211_dfs.c
@@ -144,7 +144,7 @@ cac_timeout(void *arg)
 		ieee80211_notify_cac(ic, ic->ic_curchan,
 		    IEEE80211_NOTIFY_CAC_RADAR);
 
-		if_printf(vap->iv_ifp,
+		net80211_vap_printf(vap,
 		    "CAC timer on channel %u (%u MHz) stopped due to radar\n",
 		    ic->ic_curchan->ic_ieee, ic->ic_curchan->ic_freq);
 
@@ -153,7 +153,7 @@ cac_timeout(void *arg)
 		vap->iv_des_chan = dfs->newchan;
 		ieee80211_new_state_locked(vap, IEEE80211_S_SCAN, 0);
 	} else {
-		if_printf(vap->iv_ifp,
+		net80211_vap_printf(vap,
 		    "CAC timer on channel %u (%u MHz) expired; "
 		    "no radar detected\n",
 		    ic->ic_curchan->ic_ieee, ic->ic_curchan->ic_freq);
@@ -187,7 +187,8 @@ ieee80211_dfs_cac_start(struct ieee80211vap *vap)
 	IEEE80211_LOCK_ASSERT(ic);
 
 	callout_reset(&dfs->cac_timer, CAC_TIMEOUT, cac_timeout, vap);
-	if_printf(vap->iv_ifp, "start %d second CAC timer on channel %u (%u MHz)\n",
+	net80211_vap_printf(vap,
+	    "start %d second CAC timer on channel %u (%u MHz)\n",
 	    ticks_to_secs(CAC_TIMEOUT),
 	    ic->ic_curchan->ic_ieee, ic->ic_curchan->ic_freq);
 	ieee80211_notify_cac(ic, ic->ic_curchan, IEEE80211_NOTIFY_CAC_START);
@@ -206,7 +207,8 @@ ieee80211_dfs_cac_stop(struct ieee80211vap *vap)
 
 	/* NB: racey but not important */
 	if (callout_pending(&dfs->cac_timer)) {
-		if_printf(vap->iv_ifp, "stop CAC timer on channel %u (%u MHz)\n",
+		net80211_vap_printf(vap,
+		    "stop CAC timer on channel %u (%u MHz)\n",
 		    ic->ic_curchan->ic_ieee, ic->ic_curchan->ic_freq);
 		ieee80211_notify_cac(ic, ic->ic_curchan,
 		    IEEE80211_NOTIFY_CAC_STOP);
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c
index 1b246c428411..7f5cffcbb145 100644
--- a/sys/net80211/ieee80211_hostap.c
+++ b/sys/net80211/ieee80211_hostap.c
@@ -838,7 +838,8 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m,
 #ifdef IEEE80211_DEBUG
 		if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
 		    ieee80211_msg_dumppkts(vap)) {
-			if_printf(ifp, "received %s from %s rssi %d\n",
+			net80211_vap_printf(vap,
+			    "received %s from %s rssi %d\n",
 			    ieee80211_mgt_subtype_name(subtype),
 			    ether_sprintf(wh->i_addr2), rssi);
 		}
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 7befff22bd6f..f8e9b4665b56 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -950,10 +950,11 @@ ieee80211_note(const struct ieee80211vap *vap, const char *fmt, ...)
 	len = vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
 
-	if_printf(vap->iv_ifp, "%s", buf);	/* NB: no \n */
+	net80211_vap_printf(vap, "%s", buf);	/* NB: no \n */
 
 	if (len >= sizeof(buf))
-		printf("%s: XXX buffer too small: len = %d\n", __func__, len);
+		net80211_vap_printf(vap,
+		    "%s: XXX buffer too small: len = %d\n", __func__, len);
 }
 
 void
@@ -968,7 +969,7 @@ ieee80211_note_frame(const struct ieee80211vap *vap,
 	va_start(ap, fmt);
 	len = vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
-	if_printf(vap->iv_ifp, "[%s] %s\n",
+	net80211_vap_printf(vap, "[%s] %s\n",
 		ether_sprintf(ieee80211_getbssid(vap, wh)), buf);
 
 	if (len >= sizeof(buf))
@@ -987,7 +988,7 @@ ieee80211_note_mac(const struct ieee80211vap *vap,
 	va_start(ap, fmt);
 	len = vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
-	if_printf(vap->iv_ifp, "[%s] %s\n", ether_sprintf(mac), buf);
+	net80211_vap_printf(vap, "[%s] %s\n", ether_sprintf(mac), buf);
 
 	if (len >= sizeof(buf))
 		printf("%s: XXX buffer too small: len = %d\n", __func__, len);
@@ -1006,7 +1007,7 @@ ieee80211_discard_frame(const struct ieee80211vap *vap,
 	len = vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
 
-	if_printf(vap->iv_ifp, "[%s] discard %s frame, %s\n",
+	net80211_vap_printf(vap, "[%s] discard %s frame, %s\n",
 	    ether_sprintf(ieee80211_getbssid(vap, wh)),
 	    type != NULL ? type : ieee80211_mgt_subtype_name(wh->i_fc[0]),
 	    buf);
@@ -1028,7 +1029,7 @@ ieee80211_discard_ie(const struct ieee80211vap *vap,
 	len = vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
 
-	if_printf(vap->iv_ifp, "[%s] discard%s%s information element, %s\n",
+	net80211_vap_printf(vap, "[%s] discard%s%s information element, %s\n",
 	    ether_sprintf(ieee80211_getbssid(vap, wh)),
 	    type != NULL ? " " : "", type != NULL ? type : "", buf);
 
@@ -1049,7 +1050,7 @@ ieee80211_discard_mac(const struct ieee80211vap *vap,
 	len = vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
 
-	if_printf(vap->iv_ifp, "[%s] discard%s%s frame, %s\n",
+	net80211_vap_printf(vap, "[%s] discard%s%s frame, %s\n",
 	    ether_sprintf(mac),
 	    type != NULL ? " " : "", type != NULL ? type : "", buf);
 
diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c
index 9f81bc3643aa..dac023af1e41 100644
--- a/sys/net80211/ieee80211_mesh.c
+++ b/sys/net80211/ieee80211_mesh.c
@@ -1788,7 +1788,8 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m,
 		if ((ieee80211_msg_debug(vap) && 
 		    (vap->iv_ic->ic_flags & IEEE80211_F_SCAN)) ||
 		    ieee80211_msg_dumppkts(vap)) {
-			if_printf(ifp, "received %s from %s rssi %d\n",
+			net80211_vap_printf(vap,
+			    "received %s from %s rssi %d\n",
 			    ieee80211_mgt_subtype_name(subtype),
 			    ether_sprintf(wh->i_addr2), rssi);
 		}
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index a495f2f78113..360e5e7d9abd 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -179,7 +179,7 @@ ieee80211_node_latevattach(struct ieee80211vap *vap)
 		/* XXX should we allow max aid to be zero? */
 		if (vap->iv_max_aid < IEEE80211_AID_MIN) {
 			vap->iv_max_aid = IEEE80211_AID_MIN;
-			if_printf(vap->iv_ifp,
+			net80211_vap_printf(vap,
 			    "WARNING: max aid too small, changed to %d\n",
 			    vap->iv_max_aid);
 		}
diff --git a/sys/net80211/ieee80211_rssadapt.c b/sys/net80211/ieee80211_rssadapt.c
index 43118aad53c3..d05cfc98c05b 100644
--- a/sys/net80211/ieee80211_rssadapt.c
+++ b/sys/net80211/ieee80211_rssadapt.c
@@ -137,7 +137,7 @@ rssadapt_init(struct ieee80211vap *vap)
 	vap->iv_rs = rs = IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt),
 	    M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
 	if (rs == NULL) {
-		if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n");
+		net80211_vap_printf(vap, "couldn't alloc ratectl structure\n");
 		return;
 	}
 	rs->vap = vap;
@@ -178,7 +178,8 @@ rssadapt_node_init(struct ieee80211_node *ni)
 	const struct ieee80211_rateset *rs = &ni->ni_rates;
 
 	if (!rsa) {
-		if_printf(vap->iv_ifp, "ratectl structure was not allocated, "
+		net80211_vap_printf(vap,
+		    "ratectl structure was not allocated, "
 		    "per-node structure allocation skipped\n");
 		return;
 	}
@@ -188,8 +189,8 @@ rssadapt_node_init(struct ieee80211_node *ni)
 		    IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt_node),
 		        M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
 		if (ra == NULL) {
-			if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
-			    "structure\n");
+			net80211_vap_printf(vap,
+			    "couldn't alloc per-node ratectl structure\n");
 			return;
 		}
 	} else
diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c
index f77baac1b134..78ee78fdd74c 100644
--- a/sys/net80211/ieee80211_scan.c
+++ b/sys/net80211/ieee80211_scan.c
@@ -299,9 +299,9 @@ ieee80211_scan_dump(struct ieee80211_scan_state *ss)
 {
 	struct ieee80211vap *vap = ss->ss_vap;
 
-	if_printf(vap->iv_ifp, "scan set ");
+	net80211_vap_printf(vap, "scan set ");
 	ieee80211_scan_dump_channels(ss);
-	printf(" dwell min %ums max %ums\n",
+	net80211_vap_printf(vap, " dwell min %ums max %ums\n",
 	    ticks_to_msecs(ss->ss_mindwell), ticks_to_msecs(ss->ss_maxdwell));
 }
 #endif /* IEEE80211_DEBUG */
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
index d5770ff41968..96658b83fab4 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -815,11 +815,9 @@ scan_end(struct ieee80211_scan_state *ss, int scandone)
 	 * driver calls (whilst unlocked), update scandone.
 	 */
 	if ((scandone == 0) && ((ss_priv->ss_iflags & ISCAN_PAUSE) == ISCAN_CANCEL)) {
-		/* XXX printf? */
-		if_printf(vap->iv_ifp,
+		net80211_vap_printf(vap,
 		    "%s: OOPS! scan cancelled during driver call (1) (ss_iflags=0x%x)!\n",
-		    __func__,
-		    ss_priv->ss_iflags);
+		    __func__, ss_priv->ss_iflags);
 		scandone = 1;
 	}
 
@@ -886,11 +884,9 @@ scan_end(struct ieee80211_scan_state *ss, int scandone)
 	 * driver calls (whilst unlocked), update scandone.
 	 */
 	if (scandone == 0 && (ss_priv->ss_iflags & ISCAN_PAUSE) == ISCAN_CANCEL) {
-		/* XXX printf? */
-		if_printf(vap->iv_ifp,
+		net80211_vap_printf(vap,
 		    "%s: OOPS! scan cancelled during driver call (2) (ss_iflags=0x%x)!\n",
-		    __func__,
-		    ss_priv->ss_iflags);
+		    __func__, ss_priv->ss_iflags);
 		scandone = 1;
 	}
 
diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
index 062b5610d082..9fc2bf8b7f68 100644
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -916,7 +916,8 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
 #ifdef IEEE80211_DEBUG
 		if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
 		    ieee80211_msg_dumppkts(vap)) {
-			if_printf(ifp, "received %s from %s rssi %d\n",
+			net80211_vap_printf(vap,
+			    "received %s from %s rssi %d\n",
 			    ieee80211_mgt_subtype_name(subtype),
 			    ether_sprintf(wh->i_addr2), rssi);
 		}
diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c
index 98eb7f78c58d..ed8b634a3456 100644
--- a/sys/net80211/ieee80211_wds.c
+++ b/sys/net80211/ieee80211_wds.c
@@ -703,7 +703,8 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m,
 		}
 #ifdef IEEE80211_DEBUG
 		if (ieee80211_msg_debug(vap) || ieee80211_msg_dumppkts(vap)) {
-			if_printf(ifp, "received %s from %s rssi %d\n",
+			net80211_vap_printf(vap,
+			    "received %s from %s rssi %d\n",
 			    ieee80211_mgt_subtype_name(subtype),
 			    ether_sprintf(wh->i_addr2), rssi);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506040344.5543iFTm031094>