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
This commit is contained in:
Bjoern A. Zeeb 2023-10-02 20:20:14 +00:00
parent 0d2cb6a6ec
commit 2188852196
2 changed files with 18 additions and 7 deletions

View file

@ -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)
{

View file

@ -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) \