Enter the network epoch in the xdma interrupt handler if required
by a peripheral device driver. Sponsored by: DARPA, AFRL
This commit is contained in:
parent
12373e9519
commit
d987842d1e
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/epoch.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kobj.h>
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user