git: 1137943b1c5b - main - net80211: remove ieee80211_unref_node()

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

URL: https://cgit.FreeBSD.org/src/commit/?id=1137943b1c5b225e30b82350ff7fb12c258ea90f

commit 1137943b1c5b225e30b82350ff7fb12c258ea90f
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-10-02 14:30:46 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-10-05 14:28:55 +0000

    net80211: remove ieee80211_unref_node()
    
    ieee80211_unref_node() was only used in two error cases in
    ieee80211_send_nulldata().  There we do not need to guard against
    ni pointer reuse after decrementing the refcount of the ni as we
    only update the stats and return.
    
    Update the man page and remove the link for the now gone function.
    
    Sponsored by:   The FreeBSD Foundation
    X-MFC:          never
    Reviewed by:    adrian, emaste
    Differential Revision: https://reviews.freebsd.org/D42035
---
 ObsoleteFiles.inc               |  3 +++
 share/man/man9/Makefile         |  3 +--
 share/man/man9/ieee80211_node.9 | 15 ++++-----------
 sys/net80211/ieee80211_node.h   |  7 -------
 sys/net80211/ieee80211_output.c |  4 ++--
 5 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 09e18daa7abf..c3cc72351963 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20231005: Remove man page link for now gone net80211 function.
+OLD_FILES+=usr/share/man/man9/ieee80211_unref_node.9.gz
+
 # 20231005: bsdconfig remove support for floppy and ftp
 OLD_FILES+=usr/share/bsdconfig/media/floppy.subr
 OLD_FILES+=usr/share/bsdconfig/media/ftp.subr
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 1e38eaf8adae..0b56a47db332 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1212,8 +1212,7 @@ MLINKS+=ieee80211_node.9 ieee80211_dump_node.9 \
 	ieee80211_node.9 ieee80211_find_rxnode_withkey.9 \
 	ieee80211_node.9 ieee80211_free_node.9 \
 	ieee80211_node.9 ieee80211_iterate_nodes.9 \
-	ieee80211_node.9 ieee80211_ref_node.9 \
-	ieee80211_node.9 ieee80211_unref_node.9
+	ieee80211_node.9 ieee80211_ref_node.9
 MLINKS+=ieee80211_output.9 ieee80211_process_callback.9 \
 	ieee80211_output.9 M_SEQNO_GET.9 \
 	ieee80211_output.9 M_WME_GETAC.9
diff --git a/share/man/man9/ieee80211_node.9 b/share/man/man9/ieee80211_node.9
index 8340b4762b67..6dd492e3b33d 100644
--- a/share/man/man9/ieee80211_node.9
+++ b/share/man/man9/ieee80211_node.9
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 28, 2010
+.Dd October 2, 2023
 .Dt IEEE80211_NODE 9
 .Os
 .Sh NAME
@@ -50,9 +50,6 @@
 .Fn ieee80211_ref_node "struct ieee80211_node *"
 .\"
 .Ft void
-.Fn ieee80211_unref_node "struct ieee80211_node *"
-.\"
-.Ft void
 .Fn ieee80211_free_node "struct ieee80211_node *"
 .\"
 .Ft void
@@ -106,14 +103,10 @@ Routines that lookup a table entry return a
 (i.e. a pointer to a table entry with the reference count incremented).
 The
 .Fn ieee80211_ref_node
-and
-.Fn ieee80211_unref_node
-calls explicitly increment/decrement the reference count of a node,
-but are rarely used.
-Instead most callers use
+call explicitly increments the reference count of a node.
 .Fn ieee80211_free_node
-to release a reference and, if the count goes to zero, reclaim the
-table entry.
+decrements the reference count of a node and if the count goes to zero
+reclaims the table entry.
 .Pp
 The station table and its entries are exposed to drivers in several ways.
 Each frame transmitted to a station includes a reference to the
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index 826ecccb1238..685df28ed519 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -326,13 +326,6 @@ ieee80211_ref_node(struct ieee80211_node *ni)
 	return ni;
 }
 
-static __inline void
-ieee80211_unref_node(struct ieee80211_node **ni)
-{
-	ieee80211_node_decref(*ni);
-	*ni = NULL;			/* guard against use */
-}
-
 void	ieee80211_node_attach(struct ieee80211com *);
 void	ieee80211_node_lateattach(struct ieee80211com *);
 void	ieee80211_node_detach(struct ieee80211com *);
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index 2358ba009e13..a02073ae8d9c 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -1104,7 +1104,7 @@ ieee80211_send_nulldata(struct ieee80211_node *ni)
 	if (vap->iv_state == IEEE80211_S_CAC) {
 		IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT | IEEE80211_MSG_DOTH,
 		    ni, "block %s frame in CAC state", "null data");
-		ieee80211_unref_node(&ni);
+		ieee80211_node_decref(ni);
 		vap->iv_stats.is_tx_badstate++;
 		return EIO;		/* XXX */
 	}
@@ -1122,7 +1122,7 @@ ieee80211_send_nulldata(struct ieee80211_node *ni)
 	m = ieee80211_getmgtframe(&frm, ic->ic_headroom + hdrlen, 0);
 	if (m == NULL) {
 		/* XXX debug msg */
-		ieee80211_unref_node(&ni);
+		ieee80211_node_decref(ni);
 		vap->iv_stats.is_tx_nobuf++;
 		return ENOMEM;
 	}