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
This commit is contained in:
Marcin Wojtas 2021-03-03 00:24:29 +01:00
parent e175b519a6
commit 09c3f04ff3
3 changed files with 11 additions and 0 deletions

View File

@ -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
#

View File

@ -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);

View File

@ -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