From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3503B3624DB; Mon, 23 Mar 2026 20:00:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774296023; cv=none; b=oyMYZxucuz4Kw0T5YInObb9bKUST65cXQRxamPlqPRBS1zPzOn8Nsr17gafAxuh5BS+stIKHkqiLkO9REcaHIag/Di/bmxksJAumtLZMX9u4+UgvAoB/TW1ewzUNoLWFamtO4LmF0MlSZ14oZAh1p/+DewLna+TtnkRIbPbC8xA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774296023; c=relaxed/simple; bh=Bm9ZZKA1jd/A4sOFyZzKzhf42MlMLt5vQvwZ245ov7c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O6/z+BoCHWRae7937rHCWFiSWpdrwSrFO+iS2C53GM1nK8lmsjnIU/A/ete1Vy6y72ban5JUxQpSQrzTSO7jz/my0TLkwWcvIMGMaRKPSN8lKRPLImhwOxGijLRfmLu81FD2Ct2dmHHruxP5dCXrLnz728IepostahSktoaX5M0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1202) id 4DC3120B712B; Mon, 23 Mar 2026 13:00:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4DC3120B712B From: Long Li To: Long Li , Konstantin Taranov , Jakub Kicinski , "David S . Miller" , Paolo Abeni , Eric Dumazet , Andrew Lunn , Jason Gunthorpe , Leon Romanovsky , Haiyang Zhang , "K . Y . Srinivasan" , Wei Liu , Dexuan Cui Cc: Simon Horman , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 5/6] net: mana: Allocate interrupt context for each EQ when creating vPort Date: Mon, 23 Mar 2026 12:59:51 -0700 Message-ID: <20260323195952.1767304-6-longli@microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260323195952.1767304-1-longli@microsoft.com> References: <20260323195952.1767304-1-longli@microsoft.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use GIC functions to create a dedicated interrupt context or acquire a shared interrupt context for each EQ when setting up a vPort. Signed-off-by: Long Li --- drivers/net/ethernet/microsoft/mana/gdma_main.c | 2 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 17 ++++++++++++++++- include/net/mana/gdma.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index e7d5e589a217..34b19e0740e1 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -826,7 +826,6 @@ static void mana_gd_deregister_irq(struct gdma_queue *queue) } spin_unlock_irqrestore(&gic->lock, flags); - queue->eq.msix_index = INVALID_PCI_MSIX_INDEX; synchronize_rcu(); } @@ -941,6 +940,7 @@ static int mana_gd_create_eq(struct gdma_dev *gd, out: dev_err(dev, "Failed to create EQ: %d\n", err); mana_gd_destroy_eq(gc, false, queue); + queue->eq.msix_index = INVALID_PCI_MSIX_INDEX; return err; } diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 004d48bba8aa..b3c3a70f733f 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1606,6 +1606,7 @@ void mana_destroy_eq(struct mana_port_context *apc) struct gdma_context *gc = ac->gdma_dev->gdma_context; struct gdma_queue *eq; int i; + unsigned int msi; if (!apc->eqs) return; @@ -1618,7 +1619,9 @@ void mana_destroy_eq(struct mana_port_context *apc) if (!eq) continue; + msi = eq->eq.msix_index; mana_gd_destroy_queue(gc, eq); + mana_gd_put_gic(gc, !gc->msi_sharing, msi); } kfree(apc->eqs); @@ -1635,6 +1638,7 @@ static void mana_create_eq_debugfs(struct mana_port_context *apc, int i) eq.mana_eq_debugfs = debugfs_create_dir(eqnum, apc->mana_eqs_debugfs); debugfs_create_u32("head", 0400, eq.mana_eq_debugfs, &eq.eq->head); debugfs_create_u32("tail", 0400, eq.mana_eq_debugfs, &eq.eq->tail); + debugfs_create_u32("irq", 0400, eq.mana_eq_debugfs, &eq.eq->eq.irq); debugfs_create_file("eq_dump", 0400, eq.mana_eq_debugfs, eq.eq, &mana_dbg_q_fops); } @@ -1645,6 +1649,7 @@ int mana_create_eq(struct mana_port_context *apc) struct gdma_queue_spec spec = {}; int err; int i; + struct gdma_irq_context *gic; WARN_ON(apc->eqs); apc->eqs = kzalloc_objs(struct mana_eq, apc->num_queues); @@ -1661,12 +1666,22 @@ int mana_create_eq(struct mana_port_context *apc) apc->mana_eqs_debugfs = debugfs_create_dir("EQs", apc->mana_port_debugfs); for (i = 0; i < apc->num_queues; i++) { - spec.eq.msix_index = (i + 1) % gc->num_msix_usable; + if (gc->msi_sharing) + spec.eq.msix_index = (i + 1) % gc->num_msix_usable; + + gic = mana_gd_get_gic(gc, !gc->msi_sharing, &spec.eq.msix_index); + if (!gic) { + err = -ENOMEM; + goto out; + } + err = mana_gd_create_mana_eq(gd, &spec, &apc->eqs[i].eq); if (err) { dev_err(gc->dev, "Failed to create EQ %d : %d\n", i, err); + mana_gd_put_gic(gc, !gc->msi_sharing, spec.eq.msix_index); goto out; } + apc->eqs[i].eq->eq.irq = gic->irq; mana_create_eq_debugfs(apc, i); } diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h index 4614a6a7271b..84f85b2299b4 100644 --- a/include/net/mana/gdma.h +++ b/include/net/mana/gdma.h @@ -342,6 +342,7 @@ struct gdma_queue { void *context; unsigned int msix_index; + unsigned int irq; u32 log2_throttle_limit; } eq; -- 2.43.0