From: Mingming Cao <mmc@linux.ibm.com>
To: netdev@vger.kernel.org
Cc: horms@kernel.org, bjking1@linux.ibm.com, haren@linux.ibm.com,
ricklind@linux.ibm.com, mmc@linux.ibm.com, kuba@kernel.org,
edumazet@google.com, pabeni@redhat.com,
linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
mpe@ellerman.id.au, Dave Marquardt <davemarq@linux.ibm.com>
Subject: [PATCH net-next v2 04/15] ibmveth: Refactor TX resource allocation in open/close paths
Date: Wed, 1 Jul 2026 15:23:16 -0700 [thread overview]
Message-ID: <20260701222327.61325-5-mmc@linux.ibm.com> (raw)
In-Reply-To: <20260701222327.61325-1-mmc@linux.ibm.com>
Same story as the RX refactor: pull TX LTB alloc out of open/close.
ibmveth_alloc_tx_resources() / ibmveth_free_tx_resources() walk
real_num_tx_queues so ethtool TX channel changes keep working. Hooked
into open/close in the next patch.
No MQ RX behaviour change — TX was already multi-queue capable via
ethtool -L. This patch only tidies the open/close path ahead of the
RX helper wiring in the next patch.
Signed-off-by: Mingming Cao <mmc@linux.ibm.com>
Reviewed-by: Dave Marquardt <davemarq@linux.ibm.com>
---
drivers/net/ethernet/ibm/ibmveth.c | 43 ++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index b5ae979c1f82..63b0184c622a 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1038,6 +1038,49 @@ static int ibmveth_allocate_tx_ltb(struct ibmveth_adapter *adapter, int idx)
return 0;
}
+/**
+ * ibmveth_alloc_tx_resources - Allocate TX resources for all queues
+ * @adapter: ibmveth adapter structure
+ *
+ * Allocates TX Long Term Buffers (LTBs) for all TX queues.
+ *
+ * Return: 0 on success, -ENOMEM on failure
+ */
+static int __maybe_unused
+ibmveth_alloc_tx_resources(struct ibmveth_adapter *adapter)
+{
+ struct net_device *netdev = adapter->netdev;
+ int i;
+
+ for (i = 0; i < netdev->real_num_tx_queues; i++) {
+ if (ibmveth_allocate_tx_ltb(adapter, i))
+ goto err_free_ltbs;
+ }
+
+ return 0;
+
+err_free_ltbs:
+ while (--i >= 0)
+ ibmveth_free_tx_ltb(adapter, i);
+ return -ENOMEM;
+}
+
+/**
+ * ibmveth_free_tx_resources - Free TX resources for all queues
+ * @adapter: ibmveth adapter structure
+ *
+ * Frees TX Long Term Buffers (LTBs) for all TX queues.
+ */
+static void __maybe_unused
+ibmveth_free_tx_resources(struct ibmveth_adapter *adapter)
+{
+ struct net_device *netdev = adapter->netdev;
+ int i;
+
+ for (i = 0; i < netdev->real_num_tx_queues; i++)
+ ibmveth_free_tx_ltb(adapter, i);
+}
+
static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter,
union ibmveth_buf_desc rxq_desc,
u64 mac_address)
--
2.39.3 (Apple Git-146)
next prev parent reply other threads:[~2026-07-01 22:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 22:23 [PATCH net-next v2 00/15] ibmveth: Add multi-queue RX support Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 01/15] ibmveth: Refactor RX resource allocation for MQ RX bring-up Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 02/15] ibmveth: Refactor buffer pool management for per-queue MQ RX Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 03/15] ibmveth: Refactor RX interrupt control for MQ RX queues Mingming Cao
2026-07-01 22:23 ` Mingming Cao [this message]
2026-07-01 22:23 ` [PATCH net-next v2 05/15] ibmveth: Add RX queue register/deregister helpers for MQ Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 06/15] ibmveth: Refactor open/close into MQ-ready resource pipeline Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 07/15] ibmveth: Add queue-aware RX buffer submit helper for MQ Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 08/15] ibmveth: Enable multi-queue RX receive path Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 09/15] ibmveth: Add per-queue RX statistics collection and reporting Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 10/15] ibmveth: Add per-queue TX statistics reporting Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 11/15] ibmveth: Expose per-queue buffer pool details via sysfs Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 12/15] ibmveth: Add helpers for incremental MQ RX queue resize Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 13/15] ibmveth: Implement " Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 14/15] ibmveth: Wire ethtool set_channels to " Mingming Cao
2026-07-01 22:23 ` [PATCH net-next v2 15/15] ibmveth: Fix MQ RX poll and shutdown hangs after " Mingming Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701222327.61325-5-mmc@linux.ibm.com \
--to=mmc@linux.ibm.com \
--cc=bjking1@linux.ibm.com \
--cc=davemarq@linux.ibm.com \
--cc=edumazet@google.com \
--cc=haren@linux.ibm.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ricklind@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox