aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xdma
diff options
context:
space:
mode:
authorRuslan Bukin <br@FreeBSD.org>2020-02-08 23:07:29 +0000
committerRuslan Bukin <br@FreeBSD.org>2020-02-08 23:07:29 +0000
commitd987842d1edea3de3bad34d8bdc4b1b34cff48a9 (patch)
tree1a2154279b66ff00be6e6441fea9aa41aad385b6 /sys/dev/xdma
parent12373e951965d9abcb21d0c47a0cb81d9afc8ccd (diff)
Notes
Diffstat (limited to 'sys/dev/xdma')
-rw-r--r--sys/dev/xdma/xdma.c15
-rw-r--r--sys/dev/xdma/xdma.h4
-rw-r--r--sys/dev/xdma/xdma_fdt_test.c2
3 files changed, 16 insertions, 5 deletions
diff --git a/sys/dev/xdma/xdma.c b/sys/dev/xdma/xdma.c
index aa6e6497a34c..74caf6cba61c 100644
--- a/sys/dev/xdma/xdma.c
+++ b/sys/dev/xdma/xdma.c
@@ -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);
diff --git a/sys/dev/xdma/xdma.h b/sys/dev/xdma/xdma.h
index b9a8dd2c37c3..b00b2f5bdc9a 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 6a4869df8ebc..edf192a47016 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);