git: 3a11944bca0f - main - net80211: pass __func__, __LINE__ also to ieee80211_alloc_node()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Oct 2023 10:50:41 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3a11944bca0f07079a61f10468b704589c52a76f commit 3a11944bca0f07079a61f10468b704589c52a76f Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2023-10-06 10:38:22 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2023-10-06 10:50:06 +0000 net80211: pass __func__, __LINE__ also to ieee80211_alloc_node() Pass caller information to ieee80211_alloc_node() so that in case IEEE80211_DEBUG_REFCNT is compiled in we can (better) track references, in this case the initial ieee80211_node_initref(). Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/net80211/ieee80211_node.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 88c8ab4eff1c..e451b03d8dac 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -84,7 +84,7 @@ static int ieee80211_sta_join1(struct ieee80211_node *); static struct ieee80211_node *ieee80211_alloc_node( struct ieee80211_node_table *, struct ieee80211vap *, - const uint8_t macaddr[IEEE80211_ADDR_LEN]); + const uint8_t macaddr[IEEE80211_ADDR_LEN], const char *, int); static struct ieee80211_node *node_alloc(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); static int node_init(struct ieee80211_node *); @@ -348,7 +348,8 @@ ieee80211_create_ibss(struct ieee80211vap* vap, struct ieee80211_channel *chan) ieee80211_channel_type_char(chan), chan->ic_flags); - ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, + __func__, __LINE__); if (ni == NULL) { /* XXX recovery? */ return; @@ -458,7 +459,8 @@ ieee80211_reset_bss(struct ieee80211vap *vap) /* XXX multi-bss: wrong */ ieee80211_vap_reset_erp(vap); - ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, + __func__, __LINE__); KASSERT(ni != NULL, ("unable to setup initial BSS node")); obss = vap->iv_update_bss(vap, ieee80211_ref_node(ni)); if (obss != NULL) { @@ -921,7 +923,8 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, struct ieee80211_node *ni; int do_ht = 0; - ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr, + __func__, __LINE__); if (ni == NULL) { /* XXX msg */ return 0; @@ -1401,7 +1404,8 @@ ieee80211_del_node_nt(struct ieee80211_node_table *nt, static struct ieee80211_node * ieee80211_alloc_node(struct ieee80211_node_table *nt, - struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN]) + struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN], + const char *func __debrefcnt_used, int line __debrefcnt_used) { struct ieee80211com *ic = nt->nt_ic; struct ieee80211_node *ni; @@ -1418,6 +1422,11 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); ieee80211_node_initref(ni); /* mark referenced */ +#ifdef IEEE80211_DEBUG_REFCNT + IEEE80211_DPRINTF(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)); +#endif ni->ni_chan = IEEE80211_CHAN_ANYC; ni->ni_authmode = IEEE80211_AUTH_OPEN; ni->ni_txpower = ic->ic_txpowlimit; /* max power */ @@ -1480,6 +1489,12 @@ ieee80211_tmp_node(struct ieee80211vap *vap, IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); IEEE80211_ADDR_COPY(ni->ni_bssid, bss->ni_bssid); ieee80211_node_initref(ni); /* mark referenced */ +#ifdef IEEE80211_DEBUG_REFCNT + /* Only one caller so we skip func/line passing into the func. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, "", -1, ni, + ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); +#endif /* NB: required by ieee80211_fix_rate */ ieee80211_node_set_chan(ni, bss->ni_chan); ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey, @@ -1513,7 +1528,7 @@ ieee80211_dup_bss(struct ieee80211vap *vap, struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; - ni = ieee80211_alloc_node(&ic->ic_sta, vap, macaddr); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, macaddr, __func__, __LINE__); if (ni != NULL) { struct ieee80211_node *bss = vap->iv_bss; /* @@ -1541,7 +1556,7 @@ ieee80211_node_create_wds(struct ieee80211vap *vap, struct ieee80211_node *ni; /* XXX check if node already in sta table? */ - ni = ieee80211_alloc_node(&ic->ic_sta, vap, bssid); + ni = ieee80211_alloc_node(&ic->ic_sta, vap, bssid, __func__, __LINE__); if (ni != NULL) { ni->ni_wdsvap = vap; IEEE80211_ADDR_COPY(ni->ni_bssid, bssid);