diff options
| author | Julian Elischer <julian@FreeBSD.org> | 2001-02-25 16:49:04 +0000 |
|---|---|---|
| committer | Julian Elischer <julian@FreeBSD.org> | 2001-02-25 16:49:04 +0000 |
| commit | 950809d7aca24538d735bcc348dc71312cb60d01 (patch) | |
| tree | 8aaffd4522a0ea94fbf3f7ed0e5976c95564bbc9 /sys/netgraph | |
| parent | 3233afaec7883be5d098042b56ce0ae311944bd3 (diff) | |
Notes
Diffstat (limited to 'sys/netgraph')
| -rw-r--r-- | sys/netgraph/ng_eiface.c | 50 | ||||
| -rw-r--r-- | sys/netgraph/ng_eiface.h | 16 |
2 files changed, 46 insertions, 20 deletions
diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index eebb503f2134..0e068108c108 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -57,6 +57,23 @@ #include <net/if_arp.h> +static const struct ng_parse_type ng_eiface_par_type = { + &ng_parse_struct_type, + &ng_eiface_par_fields +}; + +static const struct ng_cmdlist ng_eiface_cmdlist[] = { + { + NGM_EIFACE_COOKIE, + NGM_EIFACE_SET, + "set", + &ng_eiface_par_type, + NULL + }, + { 0 } +}; + + /* Node private data */ struct ng_eiface_private { struct ifnet *ifp; /* This interface */ @@ -86,7 +103,7 @@ static ng_disconnect_t ng_eiface_disconnect; /* Node type descriptor */ static struct ng_type typestruct = { - NG_VERSION, + NG_ABI_VERSION, NG_EIFACE_NODE_TYPE, NULL, ng_eiface_constructor, @@ -268,12 +285,14 @@ ng_eiface_init(void *xsc) } /* - * This routine is called to deliver a packet out the interface. We simply - * relay the packet to the ether hook, if it is connected. + * We simply relay the packet to the ether hook, if it is connected. + * We have been throughthe netgraph locking an are guaranteed to + * be the only code running in this node at this time. */ static void -ng_eiface_start(struct ifnet *ifp) +ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) { + struct ifnet *ifp = arg1; const priv_p priv = (priv_p) ifp->if_softc; int len, error = 0; struct mbuf *m; @@ -301,6 +320,7 @@ ng_eiface_start(struct ifnet *ifp) /* Berkeley packet filter * Pass packet to bpf if there is a listener. + * XXX is this safe? locking? */ if (ifp->if_bpf) bpf_mtap(ifp, m); @@ -323,6 +343,28 @@ ng_eiface_start(struct ifnet *ifp) return; } +/* + * This routine is called to deliver a packet out the interface. + * We simply queue the netgraph version to be called when netgraph locking + * allows it to happen. + * Until we know what the rest of the networking code is doing for + * locking, we don't know how we will interact with it. + * Take comfort from the fact that the ifnet struct is part of our + * private info and can't go away while we are queued. + * [Though we don't know it is still there now....] + * it is possible we don't gain anything from this because + * we would like to get the mbuf and queue it as data + * somehow, but we can't and if we did would we solve anything? + */ +static void +ng_eiface_start(struct ifnet *ifp) +{ + + const priv_p priv = (priv_p) ifp->if_softc; + + ng_send_fn(priv->node, NULL, &ng_eiface_start2, ifp, 0); +} + #ifdef DEBUG /* * Display an ioctl to the virtual interface diff --git a/sys/netgraph/ng_eiface.h b/sys/netgraph/ng_eiface.h index 493c0cbeb472..ed639be6f2f3 100644 --- a/sys/netgraph/ng_eiface.h +++ b/sys/netgraph/ng_eiface.h @@ -80,21 +80,5 @@ static const struct ng_parse_struct_info ng_eiface_par_fields = { } }; -static const struct ng_parse_type ng_eiface_par_type = { - &ng_parse_struct_type, - &ng_eiface_par_fields -}; - -static const struct ng_cmdlist ng_eiface_cmdlist[] = { - { - NGM_EIFACE_COOKIE, - NGM_EIFACE_SET, - "set", - &ng_eiface_par_type, - NULL - }, - { 0 } -}; - #endif /* _NETGRAPH_EIFACE_H_ */ |
