-/* $OpenBSD: if_pflow.c,v 1.79 2017/05/30 21:57:39 benno Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.80 2017/05/31 13:05:43 visa Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
void
pflow_output_process(void *arg)
{
+ struct mbuf_list ml;
struct pflow_softc *sc = arg;
struct mbuf *m;
+ mq_delist(&sc->sc_outputqueue, &ml);
KERNEL_LOCK();
- while ((m = ml_dequeue(&sc->sc_outputqueue)) != NULL) {
+ while ((m = ml_dequeue(&ml)) != NULL) {
pflow_sendout_mbuf(sc, m);
}
KERNEL_UNLOCK();
ifp->if_hdrlen = PFLOW_HDRLEN;
ifp->if_flags = IFF_UP;
ifp->if_flags &= ~IFF_RUNNING; /* not running, need receiver */
- ml_init(&pflowif->sc_outputqueue);
+ mq_init(&pflowif->sc_outputqueue, 8192, IPL_SOFTNET);
pflow_setmtu(pflowif, ETHERMTU);
pflow_init_timeouts(pflowif);
if_attach(ifp);
timeout_del(&sc->sc_tmo_tmpl);
pflow_flush(sc);
task_del(softnettq, &sc->sc_outputtask);
- ml_purge(&sc->sc_outputqueue);
+ mq_purge(&sc->sc_outputqueue);
m_freem(sc->send_nam);
if (sc->so != NULL) {
error = soclose(sc->so);
getnanotime(&tv);
h->time_sec = htonl(tv.tv_sec); /* XXX 2038 */
h->time_nanosec = htonl(tv.tv_nsec);
- ml_enqueue(&sc->sc_outputqueue, m);
- task_add(softnettq, &sc->sc_outputtask);
+ if (mq_enqueue(&sc->sc_outputqueue, m) == 0)
+ task_add(softnettq, &sc->sc_outputtask);
return (0);
}
h10->flow_sequence = htonl(sc->sc_sequence);
sc->sc_sequence += count;
h10->observation_dom = htonl(PFLOW_ENGINE_TYPE);
- ml_enqueue(&sc->sc_outputqueue, m);
- task_add(softnettq, &sc->sc_outputtask);
+ if (mq_enqueue(&sc->sc_outputqueue, m) == 0)
+ task_add(softnettq, &sc->sc_outputtask);
return (0);
}
h10->observation_dom = htonl(PFLOW_ENGINE_TYPE);
timeout_add_sec(&sc->sc_tmo_tmpl, PFLOW_TMPL_TIMEOUT);
- ml_enqueue(&sc->sc_outputqueue, m);
- task_add(softnettq, &sc->sc_outputtask);
+ if (mq_enqueue(&sc->sc_outputqueue, m) == 0)
+ task_add(softnettq, &sc->sc_outputtask);
return (0);
}