From nobody Wed Nov 29 16:38:46 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SgQ4k5cthz52x8G; Wed, 29 Nov 2023 16:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SgQ4k4TZDz3Kfb; Wed, 29 Nov 2023 16:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UdjMowpBGqrZH9M9MtYDU7ihvg0SMs4VGJSahspM2zI=; b=HjeowpKlQMI1LdyLGoQ/12becl80EXQZkJMtKU/nWvyNVgYGifZysHmc3qmbrga9mfby0O yNEhOdqkveWlK1wwzPapi2ZdkQdzVlh9DpS5XM9M/nvlARM+QKRnHKOuOa6g15jXX0PmAx xqDepqPzLIAR6E5rMH6cToKyzn9FRRDrpF1q79Jag755EQpJruuMRviq1PLro+nrXarW1L OqFSA/C8tvLnxLRZdOn9SyxjcmGhiye/MvgmYonhevQPLMxLCCcFD7vsoKf0A1Kg5glGKU 8VUB2ZOKediaEF5j2DK2U1IJ9FY088SJiHc5iiCKz+BwhF/ZoVMuDheKI+SBjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UdjMowpBGqrZH9M9MtYDU7ihvg0SMs4VGJSahspM2zI=; b=tPBPuLXybgxrW/mX4pSs2h40VjVWzL+OqOEz5acxxUqamS1IqAf2SFSwmb4cCvxZjV2dcn jYWFAYqNsLFPcmiux/m6GQbVWskLhUrxAvY9WpJptOZ15OhqHlyaxLb7l27u4F4xSLuon9 152ckTlK2wsp9BPCYpCsUjtgzgUQ4PA6F5P3Pp927RbeDqxpeVF5RFYqxem1GLzRtECw70 qvoRD6CgdIazY+m5ST71cQZrh7yVFo9G2+JrD3Zw5kflDAT3hRMQT2FRNdjsJXuuSX0vOA fXU0gD21ub3jy1J3o7a08c0/8efnn3dAz8k75sQnWLwvrrvM6XcDYcVM9Dm3PA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701275926; a=rsa-sha256; cv=none; b=SdXPCZvZDJvJQHo6G61LiT0SnCrABztqevR3QvvAaD9VMjQZfQ5tw6tVAXLRf3zhIPfXOt L2wszfSmk1TB3+G0dGEILCJG3lp9h4C1uXvsAo9FZI3OnPpdv6uX5YIwMvkrDXSSdzaDp+ PQK4TGELaoB9tHIViR/AY84vXdYyKbG+J1ZLFqFLE6SuUiUIMjjMnrZl/c+ikwPg+Wt7o/ CRb0/9hG5+y5uYeBsSgRXIO5kTfRZve8xxxXLjjPiiQzEOGd/q4fpRxhl9bGn5roIQwJhe wHemAEWPLK/Hw6l6MyXEqXKXhMa9EQPxJXMzewBDWTVpPv0Us2xSFHLMz5x1tw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SgQ4k3XvQz1CgV; Wed, 29 Nov 2023 16:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ATGckNe046750; Wed, 29 Nov 2023 16:38:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ATGck3h046747; Wed, 29 Nov 2023 16:38:46 GMT (envelope-from git) Date: Wed, 29 Nov 2023 16:38:46 GMT Message-Id: <202311291638.3ATGck3h046747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 848f836a8b8c - stable/13 - net80211: pass __func__, __LINE__ also to ieee80211_alloc_node() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 848f836a8b8ccb5a190c362fe864f814906d5836 Auto-Submitted: auto-generated The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=848f836a8b8ccb5a190c362fe864f814906d5836 commit 848f836a8b8ccb5a190c362fe864f814906d5836 Author: Bjoern A. Zeeb AuthorDate: 2023-10-06 10:38:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-11-29 16:36:10 +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 (cherry picked from commit 3a11944bca0f07079a61f10468b704589c52a76f) --- sys/net80211/ieee80211_node.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 5ac611de9a39..b91881a15bc8 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -82,6 +82,9 @@ CTASSERT((IEEE80211_NODE_HASHSIZE & (IEEE80211_NODE_HASHSIZE-1)) == 0); 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 char *, int); static struct ieee80211_node *node_alloc(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); static int node_init(struct ieee80211_node *); @@ -345,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; @@ -455,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) { @@ -918,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; @@ -1398,7 +1404,8 @@ ieee80211_del_node_nt(struct ieee80211_node_table *nt, 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; @@ -1415,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 */ @@ -1477,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, @@ -1510,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; /* @@ -1538,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);