git: 8c77967ecc58 - main - protosw: retire pr_output method

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 11 Aug 2022 16:20:16 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=8c77967ecc58b5db35bb285013c55492987a9061

commit 8c77967ecc58b5db35bb285013c55492987a9061
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-08-11 16:19:37 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-08-11 16:19:37 +0000

    protosw: retire pr_output method
    
    The only place to execute this method was raw_usend(). Only those
    protocols that used raw socket were able to actually enter that method.
    All pr_output assignments being deleted by this commit were a dead code
    for many years.
    
    Reviewed by:            melifaro
    Differential revision:  https://reviews.freebsd.org/D36126
---
 sys/kern/uipc_debug.c      | 1 -
 sys/kern/uipc_domain.c     | 1 -
 sys/netinet/ip_carp.c      | 2 --
 sys/netinet6/in6_proto.c   | 7 -------
 sys/netpfil/pf/if_pfsync.c | 1 -
 sys/sys/protosw.h          | 9 ---------
 6 files changed, 21 deletions(-)

diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c
index 0abb5352bed5..ead7d0e506c0 100644
--- a/sys/kern/uipc_debug.c
+++ b/sys/kern/uipc_debug.c
@@ -319,7 +319,6 @@ db_print_protosw(struct protosw *pr, const char *prname, int indent)
 
 	db_print_indent(indent);
 	db_printf("pr_input: %p   ", pr->pr_input);
-	db_printf("pr_output: %p   ", pr->pr_output);
 	db_printf("pr_ctlinput: %p\n", pr->pr_ctlinput);
 	db_printf("pr_ctloutput: %p   ", pr->pr_ctloutput);
 
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index 18a682de276e..07e5f829e957 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -451,7 +451,6 @@ pf_proto_unregister(int family, int protocol, int type)
 	dpr->pr_protocol = PROTO_SPACER;
 	dpr->pr_flags = 0;
 	dpr->pr_input = NULL;
-	dpr->pr_output = NULL;
 	dpr->pr_ctlinput = NULL;
 	dpr->pr_ctloutput = NULL;
 	dpr->pr_fasttimo = NULL;
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 71558be619d8..013e4ea5c68b 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -2182,7 +2182,6 @@ static struct protosw in_carp_protosw = {
 	.pr_protocol =		IPPROTO_CARP,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		carp_input,
-	.pr_output =		rip_output,
 	.pr_ctloutput =		rip_ctloutput,
 	.pr_usrreqs =		&rip_usrreqs
 };
@@ -2196,7 +2195,6 @@ static struct protosw in6_carp_protosw = {
 	.pr_protocol =		IPPROTO_CARP,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		carp6_input,
-	.pr_output =		rip6_output,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
 };
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index 6ccd90ac6fdd..b47b726a9a71 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -217,7 +217,6 @@ struct protosw inet6sw[] = {
 	.pr_protocol =		IPPROTO_RAW,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		rip6_input,
-	.pr_output =		rip6_output,
 	.pr_ctlinput =		rip6_ctlinput,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
@@ -228,7 +227,6 @@ struct protosw inet6sw[] = {
 	.pr_protocol =		IPPROTO_ICMPV6,
 	.pr_flags =		PR_ATOMIC|PR_ADDR|PR_LASTHDR,
 	.pr_input =		icmp6_input,
-	.pr_output =		rip6_output,
 	.pr_ctlinput =		rip6_ctlinput,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_fasttimo =		icmp6_fasttimo,
@@ -266,7 +264,6 @@ struct protosw inet6sw[] = {
 	.pr_protocol =		IPPROTO_IPV4,
 	.pr_flags =		PR_ATOMIC|PR_ADDR|PR_LASTHDR,
 	.pr_input =		encap6_input,
-	.pr_output =		rip6_output,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
 },
@@ -277,7 +274,6 @@ struct protosw inet6sw[] = {
 	.pr_protocol =		IPPROTO_IPV6,
 	.pr_flags =		PR_ATOMIC|PR_ADDR|PR_LASTHDR,
 	.pr_input =		encap6_input,
-	.pr_output =		rip6_output,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
 },
@@ -296,7 +292,6 @@ struct protosw inet6sw[] = {
 	.pr_protocol =		IPPROTO_GRE,
 	.pr_flags =		PR_ATOMIC|PR_ADDR|PR_LASTHDR,
 	.pr_input =		encap6_input,
-	.pr_output =		rip6_output,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
 },
@@ -306,7 +301,6 @@ struct protosw inet6sw[] = {
 	.pr_protocol =		IPPROTO_PIM,
 	.pr_flags =		PR_ATOMIC|PR_ADDR|PR_LASTHDR,
 	.pr_input =		encap6_input,
-	.pr_output =		rip6_output,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
 },
@@ -325,7 +319,6 @@ IP6PROTOSPACER,
 	.pr_domain =		&inet6domain,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		rip6_input,
-	.pr_output =		rip6_output,
 	.pr_ctloutput =		rip6_ctloutput,
 	.pr_usrreqs =		&rip6_usrreqs
 },
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index 180bf4440455..47d68b3f00a1 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -2429,7 +2429,6 @@ static struct protosw in_pfsync_protosw = {
 	.pr_protocol =		IPPROTO_PFSYNC,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		pfsync_input,
-	.pr_output =		rip_output,
 	.pr_ctloutput =		rip_ctloutput,
 	.pr_usrreqs =		&rip_usrreqs
 };
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index 85761583c30a..22e057e5691a 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -57,19 +57,11 @@ struct sockopt;
  * The system will call the pr_drain entry if it is low on space and
  * this should throw away any non-critical data.
  *
- * Protocols pass data between themselves as chains of mbufs using
- * the pr_input and pr_output hooks.  Pr_input passes data up (towards
- * the users) and pr_output passes it down (towards the interfaces); control
- * information passes up and down on pr_ctlinput and pr_ctloutput.
- * The protocol is responsible for the space occupied by any the
- * arguments to these entries and must dispose it.
- *
  * In retrospect, it would be a lot nicer to use an interface
  * similar to the vnode VOP interface.
  */
 /* USE THESE FOR YOUR PROTOTYPES ! */
 typedef int	pr_input_t (struct mbuf **, int*, int);
-typedef int	pr_output_t (struct mbuf *, struct socket *, ...);
 typedef void	pr_ctlinput_t (int, struct sockaddr *, void *);
 typedef int	pr_ctloutput_t (struct socket *, struct sockopt *);
 typedef	void	pr_fasttimo_t (void);
@@ -83,7 +75,6 @@ struct protosw {
 	short	pr_flags;		/* see below */
 /* protocol-protocol hooks */
 	pr_input_t *pr_input;		/* input to protocol (from below) */
-	pr_output_t *pr_output;		/* output to protocol (from above) */
 	pr_ctlinput_t *pr_ctlinput;	/* control input (from below) */
 	pr_ctloutput_t *pr_ctloutput;	/* control output (from above) */
 /* utility hooks */