diff options
author | ru <ru@FreeBSD.org> | 2006-02-06 14:30:21 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2006-02-06 14:30:21 +0000 |
commit | db2b824041245329030cff6e7862d219171416d2 (patch) | |
tree | 456d48ce5dda364eefead5f64f4a5880ff302853 /sys/netgraph | |
parent | f9048c6816a9649ba4b286b978b18f1e4a7861d0 (diff) | |
download | FreeBSD-src-db2b824041245329030cff6e7862d219171416d2.zip FreeBSD-src-db2b824041245329030cff6e7862d219171416d2.tar.gz |
Two fixes:
- Run send queue down to completion, not just one packet.
It has been observed to cause a stall queue otherwise.
- Prevent queueing multiple function calls to a node.
MFC after: 3 days
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/ng_eiface.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index f834d30..3ecda10 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -217,43 +217,37 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) (ifp->if_drv_flags & IFF_DRV_RUNNING))) return; - /* Don't do anything if output is active */ - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) - return; + for (;;) { + /* + * Grab a packet to transmit. + */ + IF_DEQUEUE(&ifp->if_snd, m); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + /* If there's nothing to send, break. */ + if (m == NULL) + break; - /* - * Grab a packet to transmit. - */ - IF_DEQUEUE(&ifp->if_snd, m); + /* + * Berkeley packet filter. + * Pass packet to bpf if there is a listener. + * XXX is this safe? locking? + */ + BPF_MTAP(ifp, m); - /* If there's nothing to send, return. */ - if (m == NULL) { - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - return; - } + /* Copy length before the mbuf gets invalidated */ + len = m->m_pkthdr.len; + + /* + * Send packet; if hook is not connected, mbuf will get + * freed. + */ + NG_SEND_DATA_ONLY(error, priv->ether, m); - /* - * Berkeley packet filter. - * Pass packet to bpf if there is a listener. - * XXX is this safe? locking? - */ - BPF_MTAP(ifp, m); - - /* Copy length before the mbuf gets invalidated */ - len = m->m_pkthdr.len; - - /* - * Send packet; if hook is not connected, mbuf will get - * freed. - */ - NG_SEND_DATA_ONLY(error, priv->ether, m); - - /* Update stats */ - if (error == 0) { - ifp->if_obytes += len; - ifp->if_opackets++; + /* Update stats */ + if (error == 0) { + ifp->if_obytes += len; + ifp->if_opackets++; + } } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -280,6 +274,12 @@ ng_eiface_start(struct ifnet *ifp) const priv_p priv = (priv_p)ifp->if_softc; + /* Don't do anything if output is active */ + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) + return; + + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + ng_send_fn(priv->node, NULL, &ng_eiface_start2, ifp, 0); } |