Enter the network epoch when ng_socket sends data or control from user

land to the netgraph and potentially further down the network stack.
This commit is contained in:
Gleb Smirnoff 2020-02-05 03:06:29 +00:00
parent 4c02c20c32
commit 940508a5be
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357558

View File

@ -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, struct sockaddr *addr,
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, struct sockaddr *addr,
}
/* Send data. */
NET_EPOCH_ENTER(et);
NG_SEND_DATA_FLAGS(error, hook, m, NG_WAITOK);
NET_EPOCH_EXIT(et);
release:
if (control != NULL)