git: 565655f4e33e - main - inpcb: reduce some aliased functions after removal of PCBGROUP.

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 02 Dec 2021 18:49:05 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=565655f4e33e6e04c53c1c566b50fc07fd685f2f

commit 565655f4e33e6e04c53c1c566b50fc07fd685f2f
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-12-02 18:48:48 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-12-02 18:48:48 +0000

    inpcb: reduce some aliased functions after removal of PCBGROUP.
    
    Reviewed by:            rrs
    Differential revision:  https://reviews.freebsd.org/D33021
---
 sys/netinet/in_pcb.c       | 42 +++++++-----------------------------------
 sys/netinet/in_pcb.h       |  6 +-----
 sys/netinet/tcp_syncache.c |  4 ++--
 sys/netinet/udp_usrreq.c   |  2 +-
 sys/netinet6/in6_pcb.c     |  4 ++--
 sys/netinet6/udp6_usrreq.c |  2 +-
 6 files changed, 14 insertions(+), 46 deletions(-)

diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index f1ac46b28477..ecca470805d2 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1072,8 +1072,8 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
  * then pick one.
  */
 int
-in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
-    struct ucred *cred, struct mbuf *m, bool rehash)
+in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred,
+    bool rehash)
 {
 	u_short lport, fport;
 	in_addr_t laddr, faddr;
@@ -1109,9 +1109,9 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
 	inp->inp_faddr.s_addr = faddr;
 	inp->inp_fport = fport;
 	if (rehash) {
-		in_pcbrehash_mbuf(inp, m);
+		in_pcbrehash(inp);
 	} else {
-		in_pcbinshash_mbuf(inp, m);
+		in_pcbinshash(inp);
 	}
 
 	if (anonport)
@@ -1119,13 +1119,6 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
 	return (0);
 }
 
-int
-in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
-{
-
-	return (in_pcbconnect_mbuf(inp, nam, cred, NULL, true));
-}
-
 /*
  * Do proper source address selection on an unbound socket in case
  * of connect. Take jails into account as well.
@@ -2285,8 +2278,8 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr,
 /*
  * Insert PCB onto various hash lists.
  */
-static int
-in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
+int
+in_pcbinshash(struct inpcb *inp)
 {
 	struct inpcbhead *pcbhash;
 	struct inpcbporthead *pcbporthash;
@@ -2355,20 +2348,6 @@ in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
 	return (0);
 }
 
-int
-in_pcbinshash(struct inpcb *inp)
-{
-
-	return (in_pcbinshash_internal(inp, NULL));
-}
-
-int
-in_pcbinshash_mbuf(struct inpcb *inp, struct mbuf *m)
-{
-
-	return (in_pcbinshash_internal(inp, m));
-}
-
 /*
  * Move PCB to the proper hash bucket when { faddr, fport } have  been
  * changed. NOTE: This does not handle the case of the lport changing (the
@@ -2376,7 +2355,7 @@ in_pcbinshash_mbuf(struct inpcb *inp, struct mbuf *m)
  * not change after in_pcbinshash() has been called.
  */
 void
-in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m)
+in_pcbrehash(struct inpcb *inp)
 {
 	struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
 	struct inpcbhead *head;
@@ -2402,13 +2381,6 @@ in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m)
 	CK_LIST_INSERT_HEAD(head, inp, inp_hash);
 }
 
-void
-in_pcbrehash(struct inpcb *inp)
-{
-
-	in_pcbrehash_mbuf(inp, NULL);
-}
-
 /*
  * Remove PCB from various lists.
  */
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 813c87559de3..47ecbd4f121b 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -766,9 +766,7 @@ int	in_pcballoc(struct socket *, struct inpcbinfo *);
 int	in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
 int	in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
 	    u_short *, struct ucred *);
-int	in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);
-int	in_pcbconnect_mbuf(struct inpcb *, struct sockaddr *, struct ucred *,
-	    struct mbuf *, bool);
+int	in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *, bool);
 int	in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
 	    u_short *, in_addr_t *, u_short *, struct inpcb **,
 	    struct ucred *);
@@ -777,7 +775,6 @@ void	in_pcbdisconnect(struct inpcb *);
 void	in_pcbdrop(struct inpcb *);
 void	in_pcbfree(struct inpcb *);
 int	in_pcbinshash(struct inpcb *);
-int	in_pcbinshash_mbuf(struct inpcb *, struct mbuf *);
 int	in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *,
 	    struct ucred *);
 int	in_pcblbgroup_numa(struct inpcb *, int arg);
@@ -791,7 +788,6 @@ void	in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr,
 	    int, struct inpcb *(*)(struct inpcb *, int));
 void	in_pcbref(struct inpcb *);
 void	in_pcbrehash(struct inpcb *);
-void	in_pcbrehash_mbuf(struct inpcb *, struct mbuf *);
 int	in_pcbrele_rlocked(struct inpcb *);
 int	in_pcbrele_wlocked(struct inpcb *);
 void	in_losing(struct inpcb *);
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 39ec65df7426..7dd8443cad65 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -943,8 +943,8 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
 		laddr = inp->inp_laddr;
 		if (inp->inp_laddr.s_addr == INADDR_ANY)
 			inp->inp_laddr = sc->sc_inc.inc_laddr;
-		if ((error = in_pcbconnect_mbuf(inp, (struct sockaddr *)&sin,
-		    thread0.td_ucred, m, false)) != 0) {
+		if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
+		    thread0.td_ucred, false)) != 0) {
 			inp->inp_laddr = laddr;
 			if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
 				log(LOG_DEBUG, "%s; %s: in_pcbconnect failed "
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index a9d534fbc8c0..efd5c77ca8c5 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1697,7 +1697,7 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
 	}
 	NET_EPOCH_ENTER(et);
 	INP_HASH_WLOCK(pcbinfo);
-	error = in_pcbconnect(inp, nam, td->td_ucred);
+	error = in_pcbconnect(inp, nam, td->td_ucred, true);
 	INP_HASH_WUNLOCK(pcbinfo);
 	NET_EPOCH_EXIT(et);
 	if (error == 0)
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 6f3cd120d1c8..629593bb365c 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -516,9 +516,9 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
 		    (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
 
 	if (rehash) {
-		in_pcbrehash_mbuf(inp, m);
+		in_pcbrehash(inp);
 	} else {
-		in_pcbinshash_mbuf(inp, m);
+		in_pcbinshash(inp);
 	}
 
 	return (0);
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 5939b631a1ab..5ce3a1fd1a78 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -1215,7 +1215,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
 		NET_EPOCH_ENTER(et);
 		INP_HASH_WLOCK(pcbinfo);
 		error = in_pcbconnect(inp, (struct sockaddr *)&sin,
-		    td->td_ucred);
+		    td->td_ucred, true);
 		INP_HASH_WUNLOCK(pcbinfo);
 		NET_EPOCH_EXIT(et);
 		/*