git: 9b7501e7977c - main - in_mcast: garbage collect inp_gcmoptions()

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Mon, 18 Oct 2021 18:41:57 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=9b7501e7977c1f4a0a4a798cdf0af64846009df8

commit 9b7501e7977c1f4a0a4a798cdf0af64846009df8
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-10-18 18:36:07 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-10-18 18:36:07 +0000

    in_mcast: garbage collect inp_gcmoptions()
    
    It is is used only once, merge it into inp_freemoptions().
---
 sys/netinet/in_mcast.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index ad2d7af799a5..f307be283e64 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -1588,13 +1588,16 @@ inp_findmoptions(struct inpcb *inp)
 	return (imo);
 }
 
-static void
-inp_gcmoptions(struct ip_moptions *imo)
+void
+inp_freemoptions(struct ip_moptions *imo)
 {
 	struct in_mfilter *imf;
 	struct in_multi *inm;
 	struct ifnet *ifp;
 
+	if (imo == NULL)
+		return;
+
 	while ((imf = ip_mfilter_first(&imo->imo_head)) != NULL) {
 		ip_mfilter_remove(&imo->imo_head, imf);
 
@@ -1613,20 +1616,6 @@ inp_gcmoptions(struct ip_moptions *imo)
 	free(imo, M_IPMOPTS);
 }
 
-/*
- * Discard the IP multicast options (and source filters).  To minimize
- * the amount of work done while holding locks such as the INP's
- * pcbinfo lock (which is used in the receive path), the free
- * operation is deferred to the epoch callback task.
- */
-void
-inp_freemoptions(struct ip_moptions *imo)
-{
-	if (imo == NULL)
-		return;
-	inp_gcmoptions(imo);
-}
-
 /*
  * Atomically get source filters on a socket for an IPv4 multicast group.
  * Called with INP lock held; returns with lock released.