From nobody Wed Apr 24 22:15:00 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VPtZr6hRzz5JDn5; Wed, 24 Apr 2024 22:15:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VPtZr69Knz4dNm; Wed, 24 Apr 2024 22:15:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713996900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o4BWpbxH2Y30/lYOc55WOXPunD7/JhQLMBH0Tri2w6Y=; b=jHiT4Laij3KJPQ1kDN8owkLYGavSGcNnwGN16Y1+4lohktcDq0INuQGFEJhXLU4+/D87fG Xt+W2lduTbtQCuURhvR2TeBdEwb2dKeXxsTBqEXsFBSEh1fPBreOHNGl52w6tTpJ8Mfn8l NWerDjub5807CHtUu5Y3hQkXlQIl6z/HjJeGVCeQTXDas1h5m6jdp3RA0A07Y+r+h3hnbS 9U5h9bLYO7uMnKNL2Zyy44RepVMKsTK3hTSG+Cq7stxMbtjPVjLAYRWL30/Xrsr5w2cVGe pVZc9UtIp3g5g9GhJ/31rLKv/M0Aeg4c9Z+vBInYbS4KCOPnZoAv+CWhlT/7Mg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713996900; a=rsa-sha256; cv=none; b=GGLWy2YA6NrOk9gg3Y7WVAVwteqpVv0z8PohAbhrstnlakkLbAWT7THY1f5Nz0oKtAYfJQ KVkKBppPteFREuZKg8cfObClm49L+j+h0YHYzviVGpu5SN3WNTKCXkvChniX6iWHMOujT7 p2FFUQxzMZYk/smNPn17Pgzxz+vM2DkJzk8FKA3weQ5TH2omx5HJfVTq1tWRoewqQfMpA9 GAnTV45ELHVexsNysMvIJlBm34Zth/rLefv/As2Rh4egUwuOpr1IZzFzIB4dF8rVy9B2MD u45b2itq4OAipxD+ZEi7GFkx1NV8ygeyVKPhORCMpiNYCHkAPuR+nfexcuQmiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713996900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o4BWpbxH2Y30/lYOc55WOXPunD7/JhQLMBH0Tri2w6Y=; b=SJ87BRNtTl3mbnOLVEYhAzlxerI94O4Y436hfIsmCwL8Wa8ncWHRSEep0i5UPOwb7AEO/a qSL2xlWyh1bQt6wC86pYtwVk61oKlmp+Dj+B3meAJQdIlJCzwS/qjX4gL+naRLyQI+DS13 3vu9HRWOAzORlwcoAEnPldgltPt08XObLQd2YWW0x9jzRsq18TMX+DcM+saoGrA+Eh5097 WiVPEEC951HbgmFauZtqI6MMS6Rd6RwCpKXJ0Kjxy/Z6OwpeJZilxaPjDoQ4bvd99WBLyH d65FEBrc9y2gehTvujF3iarGuCQmnqwYSEpfcwhESONXSbMlbRQfg5M+FCmciA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VPtZr5nD6zYZb; Wed, 24 Apr 2024 22:15:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43OMF0s4071360; Wed, 24 Apr 2024 22:15:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43OMF09D071357; Wed, 24 Apr 2024 22:15:00 GMT (envelope-from git) Date: Wed, 24 Apr 2024 22:15:00 GMT Message-Id: <202404242215.43OMF09D071357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 59d1c385f681 - stable/14 - iflib: Add subinterface interrupt allocation function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 59d1c385f68168052d2f62717ec2b89b29df17d8 Auto-Submitted: auto-generated The branch stable/14 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=59d1c385f68168052d2f62717ec2b89b29df17d8 commit 59d1c385f68168052d2f62717ec2b89b29df17d8 Author: Eric Joyner AuthorDate: 2023-01-18 00:46:39 +0000 Commit: Eric Joyner CommitDate: 2024-04-24 22:14:48 +0000 iflib: Add subinterface interrupt allocation function The ice(4) driver will add the ability to create extra interfaces that hang off of the base interface; to do that the driver requires a method for the subinterface to request hardware interrupt resources from the base interface. Signed-off-by: Eric Joyner Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D39930 (cherry picked from commit ed34a6b6eab9ea39759ccd3f12876a815d271929) --- sys/net/iflib.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- sys/net/iflib.h | 12 +++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index ac27450480c9..01493e90f6bb 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1467,8 +1467,8 @@ iflib_dma_alloc_align(if_ctx_t ctx, int size, int align, iflib_dma_info_t dma, i &dma->idi_tag); if (err) { device_printf(dev, - "%s: bus_dma_tag_create failed: %d\n", - __func__, err); + "%s: bus_dma_tag_create failed: %d (size=%d, align=%d)\n", + __func__, err, size, align); goto fail_0; } @@ -6197,6 +6197,81 @@ iflib_irq_set_affinity(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, return (0); } +/* + * Allocate a hardware interrupt for subctx using the parent (ctx)'s hardware + * resources. + * + * Similar to iflib_irq_alloc_generic(), but for interrupt type IFLIB_INTR_RXTX + * only. + * + * XXX: Could be removed if subctx's dev has its intr resource allocation + * methods replaced with custom ones? + */ +int +iflib_irq_alloc_generic_subctx(if_ctx_t ctx, if_ctx_t subctx, if_irq_t irq, + int rid, iflib_intr_type_t type, + driver_filter_t *filter, void *filter_arg, + int qid, const char *name) +{ + device_t dev, subdev; + struct grouptask *gtask; + struct taskqgroup *tqg; + iflib_filter_info_t info; + gtask_fn_t *fn; + int tqrid, err; + driver_filter_t *intr_fast; + void *q; + + MPASS(ctx != NULL); + MPASS(subctx != NULL); + + tqrid = rid; + dev = ctx->ifc_dev; + subdev = subctx->ifc_dev; + + switch (type) { + case IFLIB_INTR_RXTX: + q = &subctx->ifc_rxqs[qid]; + info = &subctx->ifc_rxqs[qid].ifr_filter_info; + gtask = &subctx->ifc_rxqs[qid].ifr_task; + tqg = qgroup_if_io_tqg; + fn = _task_fn_rx; + intr_fast = iflib_fast_intr_rxtx; + NET_GROUPTASK_INIT(gtask, 0, fn, q); + break; + default: + device_printf(dev, "%s: unknown net intr type for subctx %s (%d)\n", + __func__, device_get_nameunit(subdev), type); + return (EINVAL); + } + + info->ifi_filter = filter; + info->ifi_filter_arg = filter_arg; + info->ifi_task = gtask; + info->ifi_ctx = q; + + NET_GROUPTASK_INIT(gtask, 0, fn, q); + + /* Allocate interrupts from hardware using parent context */ + err = _iflib_irq_alloc(ctx, irq, rid, intr_fast, NULL, info, name); + if (err != 0) { + device_printf(dev, "_iflib_irq_alloc failed for subctx %s: %d\n", + device_get_nameunit(subdev), err); + return (err); + } + + if (tqrid != -1) { + err = iflib_irq_set_affinity(ctx, irq, type, qid, gtask, tqg, q, + name); + if (err) + return (err); + } else { + taskqgroup_attach(tqg, gtask, q, dev, irq->ii_res, name); + } + + return (0); +} + int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, iflib_intr_type_t type, driver_filter_t *filter, diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 5e1adccf202c..bf40c7429fb8 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -393,6 +393,11 @@ typedef enum { * function. */ #define IFLIB_FEATURE_QUEUE_SELECT_V2 1400073 +/* + * Driver can create subinterfaces with their own Tx/Rx queues + * that all share a single device (or commonly, port) + */ +#define IFLIB_FEATURE_SUB_INTERFACES 1500014 /* * These enum values are used in iflib_needs_restart to indicate to iflib @@ -491,4 +496,11 @@ void iflib_add_int_delay_sysctl(if_ctx_t, const char *, const char *, if_int_delay_info_t, int, int); uint16_t iflib_get_extra_msix_vectors_sysctl(if_ctx_t ctx); +/* + * Sub-interface support + */ +int iflib_irq_alloc_generic_subctx(if_ctx_t ctx, if_ctx_t subctx, if_irq_t irq, + int rid, iflib_intr_type_t type, + driver_filter_t *filter, void *filter_arg, + int qid, const char *name); #endif /* __IFLIB_H_ */