git: fa0f7eefb92b - stable/13 - iflib: Simplify iflib_legacy_setup

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Wed, 02 Oct 2024 19:56:02 UTC
The branch stable/13 has been updated by kbowling:

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

commit fa0f7eefb92b01fc55358b59f2d65581edfa07bf
Author:     Krzysztof Galazka <krzysztof.galazka@intel.com>
AuthorDate: 2024-09-25 20:28:52 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2024-10-02 19:55:36 +0000

    iflib: Simplify iflib_legacy_setup
    
    Follow the pattern from iflib_irq_alloc_generic function and use
    iflib_fast_intr as a handler for RX only interrupts.
    
    Also remove some intermediate variables and use consistent
    way for referencing queue's structures.
    
    Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D46061
    
    (cherry picked from commit 36a001923836e280e750b76947b8705fcc47b0b7)
---
 sys/net/iflib.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 252fb3b529ed..6f91c0c7f2d8 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -6652,15 +6652,11 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *
 	device_t dev;
 	struct grouptask *gtask;
 	struct resource *res;
-	struct taskqgroup *tqg;
-	void *q;
 	int err, tqrid;
 	bool rx_only;
 
-	q = &ctx->ifc_rxqs[0];
-	info = &rxq[0].ifr_filter_info;
-	gtask = &rxq[0].ifr_task;
-	tqg = qgroup_if_io_tqg;
+	info = &rxq->ifr_filter_info;
+	gtask = &rxq->ifr_task;
 	tqrid = *rid;
 	rx_only = (ctx->ifc_sctx->isc_flags & IFLIB_SINGLE_IRQ_RX_ONLY) != 0;
 
@@ -6668,17 +6664,17 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *
 	info->ifi_filter = filter;
 	info->ifi_filter_arg = filter_arg;
 	info->ifi_task = gtask;
-	info->ifi_ctx = rx_only ? ctx : q;
+	info->ifi_ctx = rxq;
 
 	dev = ctx->ifc_dev;
 	/* We allocate a single interrupt resource */
-	err = _iflib_irq_alloc(ctx, irq, tqrid, rx_only ? iflib_fast_intr_ctx :
+	err = _iflib_irq_alloc(ctx, irq, tqrid, rx_only ? iflib_fast_intr :
 	    iflib_fast_intr_rxtx, NULL, info, name);
 	if (err != 0)
 		return (err);
-	NET_GROUPTASK_INIT(gtask, 0, _task_fn_rx, q);
+	NET_GROUPTASK_INIT(gtask, 0, _task_fn_rx, rxq);
 	res = irq->ii_res;
-	taskqgroup_attach(tqg, gtask, q, dev, res, name);
+	taskqgroup_attach(qgroup_if_io_tqg, gtask, rxq, dev, res, name);
 
 	GROUPTASK_INIT(&txq->ift_task, 0, _task_fn_tx, txq);
 	taskqgroup_attach(qgroup_if_io_tqg, &txq->ift_task, txq, dev, res,