aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Wojtas <mw@FreeBSD.org>2021-03-02 23:24:29 +0000
committerMarcin Wojtas <mw@FreeBSD.org>2021-03-02 23:40:47 +0000
commit09c3f04ff3be97ef442f2484396b1f963565b259 (patch)
treecd7ff2de77495ba8825b4f8de1d8d34809127f43
parente175b519a6fb83889fb3ca679b73d11ea5bea7ad (diff)
downloadsrc-09c3f04ff3be97ef442f2484396b1f963565b259.tar.gz
src-09c3f04ff3be97ef442f2484396b1f963565b259.zip
iflib: add support for admin completion queues
For interfaces with admin completion queues, introduce a new devmethod IFDI_ADMIN_COMPLETION_HANDLE and a corresponding flag IFLIB_HAS_ADMINCQ. This provides an option for handling any admin cq logic, which cannot be run from an interrupt context. Said method is called from within iflib's admin task, making it safe to sleep. Reviewed by: mmacy Submitted by: Artur Rojek <ar@semihalf.com> Obtained from: Semihalf Sponsored by: Amazon, Inc. Differential Revision: https://reviews.freebsd.org/D28708
-rw-r--r--sys/net/ifdi_if.m4
-rw-r--r--sys/net/iflib.c2
-rw-r--r--sys/net/iflib.h5
3 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/ifdi_if.m b/sys/net/ifdi_if.m
index 2214d17fbcf1..077b19dd7481 100644
--- a/sys/net/ifdi_if.m
+++ b/sys/net/ifdi_if.m
@@ -321,6 +321,10 @@ METHOD void link_intr_enable {
if_ctx_t _ctx;
} DEFAULT null_void_op;
+METHOD void admin_completion_handle {
+ if_ctx_t _ctx;
+} DEFAULT null_void_op;
+
#
# interface configuration
#
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index a7d5a8c24658..05e99ba318df 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -4008,6 +4008,8 @@ _task_fn_admin(void *context)
callout_stop(&txq->ift_timer);
CALLOUT_UNLOCK(txq);
}
+ if (ctx->ifc_sctx->isc_flags & IFLIB_HAS_ADMINCQ)
+ IFDI_ADMIN_COMPLETION_HANDLE(ctx);
if (do_watchdog) {
ctx->ifc_watchdog_events++;
IFDI_WATCHDOG_RESET(ctx);
diff --git a/sys/net/iflib.h b/sys/net/iflib.h
index 95305850f7d3..1e8aed271334 100644
--- a/sys/net/iflib.h
+++ b/sys/net/iflib.h
@@ -399,6 +399,11 @@ typedef enum {
#define IFLIB_PSEUDO_ETHER 0x80000
/*
+ * Interface has an admin completion queue
+ */
+#define IFLIB_HAS_ADMINCQ 0x100000
+
+/*
* These enum values are used in iflib_needs_restart to indicate to iflib
* functions whether or not the interface needs restarting when certain events
* happen.