git: 09c3f04ff3be - main - iflib: add support for admin completion queues

Marcin Wojtas mw at FreeBSD.org
Tue Mar 2 23:41:22 UTC 2021


The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=09c3f04ff3be97ef442f2484396b1f963565b259

commit 09c3f04ff3be97ef442f2484396b1f963565b259
Author:     Marcin Wojtas <mw at FreeBSD.org>
AuthorDate: 2021-03-02 23:24:29 +0000
Commit:     Marcin Wojtas <mw at FreeBSD.org>
CommitDate: 2021-03-02 23:40:47 +0000

    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 at semihalf.com>
    Obtained from: Semihalf
    Sponsored by: Amazon, Inc.
    Differential Revision: https://reviews.freebsd.org/D28708
---
 sys/net/ifdi_if.m | 4 ++++
 sys/net/iflib.c   | 2 ++
 sys/net/iflib.h   | 5 +++++
 3 files changed, 11 insertions(+)

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
@@ -398,6 +398,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


More information about the dev-commits-src-all mailing list