svn commit: r357558 - head/sys/netgraph

Gleb Smirnoff glebius at FreeBSD.org
Wed Feb 5 03:06:30 UTC 2020


Author: glebius
Date: Wed Feb  5 03:06:29 2020
New Revision: 357558
URL: https://svnweb.freebsd.org/changeset/base/357558

Log:
  Enter the network epoch when ng_socket sends data or control from user
  land to the netgraph and potentially further down the network stack.

Modified:
  head/sys/netgraph/ng_socket.c

Modified: head/sys/netgraph/ng_socket.c
==============================================================================
--- head/sys/netgraph/ng_socket.c	Wed Feb  5 02:53:40 2020	(r357557)
+++ head/sys/netgraph/ng_socket.c	Wed Feb  5 03:06:29 2020	(r357558)
@@ -58,6 +58,8 @@
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/epoch.h>
 #include <sys/priv.h>
 #include <sys/protosw.h>
 #include <sys/queue.h>
@@ -217,6 +219,7 @@ static int
 ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
 	 struct mbuf *control, struct thread *td)
 {
+	struct epoch_tracker et;
 	struct ngpcb *const pcbp = sotongpcb(so);
 	struct ngsock *const priv = NG_NODE_PRIVATE(pcbp->sockdata->node);
 	struct sockaddr_ng *const sap = (struct sockaddr_ng *) addr;
@@ -335,7 +338,9 @@ ngc_send(struct socket *so, int flags, struct mbuf *m,
 	item->apply = &apply;
 	priv->error = -1;
 
+	NET_EPOCH_ENTER(et);
 	error = ng_snd_item(item, 0);
+	NET_EPOCH_EXIT(et);
 
 	mtx_lock(&priv->mtx);
 	if (priv->error == -1)
@@ -403,6 +408,7 @@ static int
 ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
 	 struct mbuf *control, struct thread *td)
 {
+	struct epoch_tracker et;
 	struct ngpcb *const pcbp = sotongpcb(so);
 	struct sockaddr_ng *const sap = (struct sockaddr_ng *) addr;
 	int	len, error;
@@ -459,7 +465,9 @@ ngd_send(struct socket *so, int flags, struct mbuf *m,
 	}
 
 	/* Send data. */
+	NET_EPOCH_ENTER(et);
 	NG_SEND_DATA_FLAGS(error, hook, m, NG_WAITOK);
+	NET_EPOCH_EXIT(et);
 
 release:
 	if (control != NULL)


More information about the svn-src-all mailing list