git: 218885219615 - main - net80211: de-inline ieee80211_ref_node()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 05 Oct 2023 15:03:40 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=2188852196151e5f04533eaa928a7ad0896e4bd6

commit 2188852196151e5f04533eaa928a7ad0896e4bd6
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-10-02 20:20:14 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-10-05 14:56:02 +0000

    net80211: de-inline ieee80211_ref_node()
    
    Make ieee80211_ref_node() a macro so we can pass __func__, __LINE__
    in for IEEE80211_DEBUG_REFCNT as we do for other refcount related
    functions.  Add the appropriate IEEE80211_DPRINTF() call to the
    _ieee80211_ref_node() implementation to support wlandebug(8) +node
    printf style tracing.
    As a plus we can now also use Dtrace fbt on the
    _ieee80211_{ref,free}_node() implementations with futher logic,
    gathering backtraces, etc. more flexibly.
    
    Sponsored by:   The FreeBSD Foundation
    X-MFC:          never
---
 sys/net80211/ieee80211_node.c | 14 ++++++++++++++
 sys/net80211/ieee80211_node.h | 11 ++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index b7cdc5090c96..88c8ab4eff1c 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -2056,6 +2056,20 @@ _ieee80211_find_txnode(struct ieee80211vap *vap,
 	return ni;
 }
 
+struct ieee80211_node *
+_ieee80211_ref_node(struct ieee80211_node *ni,
+    const char *func __debrefcnt_used, int line __debrefcnt_used)
+{
+
+#ifdef IEEE80211_DEBUG_REFCNT
+	IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE,
+	    "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni,
+	    ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)+1);
+#endif
+	ieee80211_node_incref(ni);
+	return (ni);
+}
+
 static void
 __ieee80211_free_node(struct ieee80211_node *ni)
 {
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index 685df28ed519..954e8e03563f 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -319,13 +319,6 @@ MALLOC_DECLARE(M_80211_NODE_IE);
 #define	IEEE80211_RSSI_GET(x) \
 	IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER)
 
-static __inline struct ieee80211_node *
-ieee80211_ref_node(struct ieee80211_node *ni)
-{
-	ieee80211_node_incref(ni);
-	return ni;
-}
-
 void	ieee80211_node_attach(struct ieee80211com *);
 void	ieee80211_node_lateattach(struct ieee80211com *);
 void	ieee80211_node_detach(struct ieee80211com *);
@@ -397,6 +390,8 @@ struct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *,
 		struct ieee80211_channel *);
 
 /* These functions are taking __func__, __LINE__ for IEEE80211_DEBUG_REFCNT */
+struct ieee80211_node *_ieee80211_ref_node(struct ieee80211_node *,
+		const char *func, int line);
 void	_ieee80211_free_node(struct ieee80211_node *,
 		const char *func, int line);
 struct ieee80211_node *_ieee80211_find_node_locked(
@@ -426,6 +421,8 @@ struct ieee80211_node *_ieee80211_find_rxnode_withkey(
 struct ieee80211_node *_ieee80211_find_txnode(struct ieee80211vap *,
 		const uint8_t macaddr[IEEE80211_ADDR_LEN],
 		const char *func, int line);
+#define	ieee80211_ref_node(ni) \
+	_ieee80211_ref_node(ni, __func__, __LINE__)
 #define	ieee80211_free_node(ni) \
 	_ieee80211_free_node(ni, __func__, __LINE__)
 #define	ieee80211_find_node_locked(nt, mac) \