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:
parent
4c02c20c32
commit
940508a5be
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user