From nobody Thu Nov 30 00:38:13 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 4Sgcjx5xKtz52Thf; Thu, 30 Nov 2023 00:38:13 +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 4Sgcjx5MRtz3MD7; Thu, 30 Nov 2023 00:38:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701304693; 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=uMiFGnnG0KhEuwoy0A1y7adLW1KrRln3QSr/Yi9nA4g=; b=IfkOiMoXhj7X1oFIi8Qi1qfAVMylGLsyZCPGINfgNCvky+32KYvm6nKZ/DksDmuwxakGg5 sL05GCIxdnRUN6uZYUffp5/yOZOhFXHwyczDtG/oACERRWlkwbXtY/Sm2gpDQ9KWSW26DG LqkyPnHeeH7TKmvhgaL3eiMbT0Q1RU7wQ3DsRt4cjjxWov6KXnsNy48jkOoOO5e0gyOzRb vCpC1+glXz2nqhuciEO9EM/ACn5EvfmPP7I3h1TZqOqFr7FwjT4Hm2L5SP3EKuwGTQCMqG lMqnWCl7LaI/fyIlWupYKymnE6bJtuo/JBCfOfjTdUhsBbPWyVP2ZGshtxz+nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701304693; 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=uMiFGnnG0KhEuwoy0A1y7adLW1KrRln3QSr/Yi9nA4g=; b=YiAK9WcAd/5j/yAxiC/4W6tqxu74QttDqO9YnfmqFH67PGO7CXjet6Vzdp1bRr4iRuphSE YmYJW7QsVrUvmieHBj3vrR9MiUtZNzxz3t8EYTvYYQzZPh3KVa0TyuUr113gziPKQ1L41O d0aFiWEEZte3uo+S0uOPlmhVsbP7JbKiYZJUI3k6vQIg+jf+h/wcgCv2sYU+u09MF0JxzH qdUqZmDGovVBC8Qex4R3Fdkfg7VLJLQnu+v3lnBoAxCoK4oFsE4rVSMlSmSVaLbmxm7Tdf ka01CXMkzaap/N/71kJFwgL1n2qtaHwRIrDfKwKlO4Vgu76+0QcwZsINyTQzTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701304693; a=rsa-sha256; cv=none; b=xjv6jQgfpwznyiejQKFje+y0rElA3ao4cTJ6vhh5ud0ditYaVjb0xC0fkSOd8IjV+7y8n5 fyn4e8uG2aJD9k6wkdqwxGnPaZpu7NB13zCPnwbGdbUIKGzM4tKOsmG0vGpEQrVYU/kLfs Y7Z2Vpz6TNwOy1ZohepWeRMCDcFH86Tu2a5rxKAS1+7zjEf38iv03makO1BRSNWVVLstC9 1yhkpNVWXEP2nJrPPmTH8YXsxtP5vJes6SbESKkFrj8lrBcrqMv3Ba1Fq4wRu/xN2p1fB1 7wxSrk0QmUE3oJPfdn5HHVq6IOAz5uY3LsM7Iz68Dqn+/nkMhXI1sziMoZeB3g== 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 4Sgcjx4LhWzD8p; Thu, 30 Nov 2023 00:38:13 +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 3AU0cDJo051836; Thu, 30 Nov 2023 00:38:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AU0cDoq051833; Thu, 30 Nov 2023 00:38:13 GMT (envelope-from git) Date: Thu, 30 Nov 2023 00:38:13 GMT Message-Id: <202311300038.3AU0cDoq051833@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: 02c014aaf266 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 02c014aaf2662f6a26c4a418b83432ca2c975009 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=02c014aaf2662f6a26c4a418b83432ca2c975009 commit 02c014aaf2662f6a26c4a418b83432ca2c975009 Author: Bjoern A. Zeeb AuthorDate: 2023-10-06 10:38:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-11-30 00:36:57 +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 | 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);