git: 58630bdd13fd - main - Revert "ip_mroute: do not call epoch_waitwhen lock is taken"

From: Wojciech Macek <wma_at_FreeBSD.org>
Date: Fri, 21 Jan 2022 05:19:00 UTC
The branch main has been updated by wma:

URL: https://cgit.FreeBSD.org/src/commit/?id=58630bdd13fd086fe11f239528ee7a82e2b9d685

commit 58630bdd13fd086fe11f239528ee7a82e2b9d685
Author:     Wojciech Macek <wma@FreeBSD.org>
AuthorDate: 2022-01-20 12:12:23 +0000
Commit:     Wojciech Macek <wma@FreeBSD.org>
CommitDate: 2022-01-21 05:17:19 +0000

    Revert "ip_mroute: do not call epoch_waitwhen lock is taken"
    
    This reverts commit 2e72208b6c622505323ed48dc58830fc307392b1.
---
 sys/netinet/ip_mroute.h | 9 ++++-----
 sys/netinet/raw_ip.c    | 1 -
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
index faf5b8c72a46..65c5bdd3a025 100644
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -365,12 +365,11 @@ extern int	(*ip_mrouter_set)(struct socket *, struct sockopt *);
 extern int	(*ip_mrouter_get)(struct socket *, struct sockopt *);
 extern int	(*ip_mrouter_done)(void);
 extern int	(*mrt_ioctl)(u_long, caddr_t, int);
-extern int	ip_mrouter_critical_section_cnt;
 
-#define	MROUTER_RLOCK_TRACKER
-#define	MROUTER_RLOCK()		atomic_add_int(&ip_mrouter_critical_section_cnt, 1)
-#define	MROUTER_RUNLOCK()	atomic_subtract_int(&ip_mrouter_critical_section_cnt, 1)
-#define	MROUTER_WAIT()		do {} while (atomic_load_int(&ip_mrouter_critical_section_cnt) != 0)
+#define	MROUTER_RLOCK_TRACKER	struct epoch_tracker mrouter_et
+#define	MROUTER_RLOCK()	epoch_enter_preempt(net_epoch_preempt, &mrouter_et)
+#define	MROUTER_RUNLOCK()	epoch_exit_preempt(net_epoch_preempt, &mrouter_et)
+#define	MROUTER_WAIT()	epoch_wait_preempt(net_epoch_preempt)
 
 #endif /* _KERNEL */
 
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index dc49c36f25ad..7c495745806e 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -120,7 +120,6 @@ VNET_DEFINE(struct socket *, ip_mrouter);
 int (*ip_mrouter_set)(struct socket *, struct sockopt *);
 int (*ip_mrouter_get)(struct socket *, struct sockopt *);
 int (*ip_mrouter_done)(void);
-int ip_mrouter_critical_section_cnt;
 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
 		   struct ip_moptions *);
 int (*mrt_ioctl)(u_long, caddr_t, int);