diff --git a/sys/dev/altera/atse/if_atse.c b/sys/dev/altera/atse/if_atse.c index a3552605995..2dfd55b9486 100644 --- a/sys/dev/altera/atse/if_atse.c +++ b/sys/dev/altera/atse/if_atse.c @@ -1293,7 +1293,8 @@ atse_attach(device_t dev) } /* Setup interrupt handler. */ - error = xdma_setup_intr(sc->xchan_tx, atse_xdma_tx_intr, sc, &sc->ih_tx); + error = xdma_setup_intr(sc->xchan_tx, 0, + atse_xdma_tx_intr, sc, &sc->ih_tx); if (error) { device_printf(sc->dev, "Can't setup xDMA interrupt handler.\n"); @@ -1324,7 +1325,8 @@ atse_attach(device_t dev) } /* Setup interrupt handler. */ - error = xdma_setup_intr(sc->xchan_rx, atse_xdma_rx_intr, sc, &sc->ih_rx); + error = xdma_setup_intr(sc->xchan_rx, XDMA_INTR_NET, + atse_xdma_rx_intr, sc, &sc->ih_rx); if (error) { device_printf(sc->dev, "Can't setup xDMA interrupt handler.\n"); @@ -1381,8 +1383,7 @@ atse_attach(device_t dev) } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | - IFF_NEEDSEPOCH; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = atse_ioctl; ifp->if_transmit = atse_transmit; ifp->if_qflush = atse_qflush; diff --git a/sys/dev/flash/cqspi.c b/sys/dev/flash/cqspi.c index 7cb3d50d398..4c2bc1a75bc 100644 --- a/sys/dev/flash/cqspi.c +++ b/sys/dev/flash/cqspi.c @@ -705,7 +705,7 @@ cqspi_attach(device_t dev) } /* Setup xDMA interrupt handlers. */ - error = xdma_setup_intr(sc->xchan_tx, cqspi_xdma_tx_intr, + error = xdma_setup_intr(sc->xchan_tx, 0, cqspi_xdma_tx_intr, sc, &sc->ih_tx); if (error) { device_printf(sc->dev, @@ -713,7 +713,7 @@ cqspi_attach(device_t dev) return (ENXIO); } - error = xdma_setup_intr(sc->xchan_rx, cqspi_xdma_rx_intr, + error = xdma_setup_intr(sc->xchan_rx, 0, cqspi_xdma_rx_intr, sc, &sc->ih_rx); if (error) { device_printf(sc->dev, diff --git a/sys/dev/xdma/xdma.c b/sys/dev/xdma/xdma.c index aa6e6497a34..74caf6cba61 100644 --- a/sys/dev/xdma/xdma.c +++ b/sys/dev/xdma/xdma.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -203,7 +204,7 @@ xdma_channel_free(xdma_channel_t *xchan) } int -xdma_setup_intr(xdma_channel_t *xchan, +xdma_setup_intr(xdma_channel_t *xchan, int flags, int (*cb)(void *, xdma_transfer_status_t *), void *arg, void **ihandler) { @@ -224,6 +225,7 @@ xdma_setup_intr(xdma_channel_t *xchan, ih = malloc(sizeof(struct xdma_intr_handler), M_XDMA, M_WAITOK | M_ZERO); + ih->flags = flags; ih->cb = cb; ih->cb_user = arg; @@ -325,13 +327,20 @@ xdma_callback(xdma_channel_t *xchan, xdma_transfer_status_t *status) struct xdma_intr_handler *ih_tmp; struct xdma_intr_handler *ih; xdma_controller_t *xdma; + struct epoch_tracker et; xdma = xchan->xdma; KASSERT(xdma != NULL, ("xdma is NULL")); - TAILQ_FOREACH_SAFE(ih, &xchan->ie_handlers, ih_next, ih_tmp) - if (ih->cb != NULL) + TAILQ_FOREACH_SAFE(ih, &xchan->ie_handlers, ih_next, ih_tmp) { + if (ih->cb != NULL) { + if (ih->flags & XDMA_INTR_NET) + NET_EPOCH_ENTER(et); ih->cb(ih->cb_user, status); + if (ih->flags & XDMA_INTR_NET) + NET_EPOCH_EXIT(et); + } + } if (xchan->flags & XCHAN_TYPE_SG) xdma_queue_submit(xchan); diff --git a/sys/dev/xdma/xdma.h b/sys/dev/xdma/xdma.h index b9a8dd2c37c..b00b2f5bdc9 100644 --- a/sys/dev/xdma/xdma.h +++ b/sys/dev/xdma/xdma.h @@ -195,6 +195,8 @@ typedef struct xdma_channel xdma_channel_t; struct xdma_intr_handler { int (*cb)(void *cb_user, xdma_transfer_status_t *status); + int flags; +#define XDMA_INTR_NET (1 << 0) void *cb_user; TAILQ_ENTRY(xdma_intr_handler) ih_next; }; @@ -275,7 +277,7 @@ uint32_t xdma_mbuf_chain_count(struct mbuf *m0); int xdma_control(xdma_channel_t *xchan, enum xdma_command cmd); /* Interrupt callback */ -int xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void *, +int xdma_setup_intr(xdma_channel_t *xchan, int flags, int (*cb)(void *, xdma_transfer_status_t *), void *arg, void **); int xdma_teardown_intr(xdma_channel_t *xchan, struct xdma_intr_handler *ih); int xdma_teardown_all_intr(xdma_channel_t *xchan); diff --git a/sys/dev/xdma/xdma_fdt_test.c b/sys/dev/xdma/xdma_fdt_test.c index 6a4869df8eb..edf192a4701 100644 --- a/sys/dev/xdma/xdma_fdt_test.c +++ b/sys/dev/xdma/xdma_fdt_test.c @@ -217,7 +217,7 @@ xdmatest_test(struct xdmatest_softc *sc) } /* Setup callback. */ - err = xdma_setup_intr(sc->xchan, xdmatest_intr, sc, &sc->ih); + err = xdma_setup_intr(sc->xchan, 0, xdmatest_intr, sc, &sc->ih); if (err) { device_printf(sc->dev, "Can't setup xDMA interrupt handler.\n"); return (-1); diff --git a/sys/dev/xilinx/if_xae.c b/sys/dev/xilinx/if_xae.c index e6dbb15de75..36fdf41b731 100644 --- a/sys/dev/xilinx/if_xae.c +++ b/sys/dev/xilinx/if_xae.c @@ -869,7 +869,7 @@ setup_xdma(struct xae_softc *sc) } /* Setup interrupt handler. */ - error = xdma_setup_intr(sc->xchan_tx, + error = xdma_setup_intr(sc->xchan_tx, 0, xae_xdma_tx_intr, sc, &sc->ih_tx); if (error) { device_printf(sc->dev, @@ -885,7 +885,7 @@ setup_xdma(struct xae_softc *sc) } /* Setup interrupt handler. */ - error = xdma_setup_intr(sc->xchan_rx, + error = xdma_setup_intr(sc->xchan_rx, XDMA_INTR_NET, xae_xdma_rx_intr, sc, &sc->ih_rx); if (error) { device_printf(sc->dev, diff --git a/sys/mips/ingenic/jz4780_aic.c b/sys/mips/ingenic/jz4780_aic.c index f7a0ff53fac..5667501ef22 100644 --- a/sys/mips/ingenic/jz4780_aic.c +++ b/sys/mips/ingenic/jz4780_aic.c @@ -744,7 +744,7 @@ aic_attach(device_t dev) pcm_setflags(dev, pcm_getflags(dev) | SD_F_MPSAFE); /* Setup interrupt handler. */ - err = xdma_setup_intr(sc->xchan, aic_intr, scp, &sc->ih); + err = xdma_setup_intr(sc->xchan, 0, aic_intr, scp, &sc->ih); if (err) { device_printf(sc->dev, "Can't setup xDMA interrupt handler.\n");