From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, almasrymina@google.com,
tariqt@nvidia.com, dtatulea@nvidia.com, hawk@kernel.org,
ilias.apalodimas@linaro.org, alexanderduyck@fb.com,
sdf@fomichev.me, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 03/14] eth: fbnic: move page pool alloc to fbnic_alloc_rx_qt_resources()
Date: Thu, 28 Aug 2025 18:22:53 -0700 [thread overview]
Message-ID: <20250829012304.4146195-4-kuba@kernel.org> (raw)
In-Reply-To: <20250829012304.4146195-1-kuba@kernel.org>
page pools are now at the ring level, move page pool alloc
to fbnic_alloc_rx_qt_resources(), and freeing to
fbnic_free_qt_resources().
This significantly simplifies fbnic_alloc_napi_vector() error
handling, by removing a late failure point.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 37 +++++---------------
1 file changed, 9 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index 29a780f72c14..15ebbaa0bed2 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -1485,7 +1485,6 @@ static void fbnic_free_napi_vector(struct fbnic_net *fbn,
fbnic_remove_rx_ring(fbn, &nv->qt[i].sub0);
fbnic_remove_rx_ring(fbn, &nv->qt[i].sub1);
fbnic_remove_rx_ring(fbn, &nv->qt[i].cmpl);
- fbnic_free_qt_page_pools(&nv->qt[i]);
}
fbnic_napi_free_irq(fbd, nv);
@@ -1681,10 +1680,6 @@ static int fbnic_alloc_napi_vector(struct fbnic_dev *fbd, struct fbnic_net *fbn,
fbnic_ring_init(&qt->cmpl, db, rxq_idx, FBNIC_RING_F_STATS);
fbn->rx[rxq_idx] = &qt->cmpl;
- err = fbnic_alloc_qt_page_pools(fbn, nv, qt);
- if (err)
- goto free_ring_cur_qt;
-
/* Update Rx queue index */
rxt_count--;
rxq_idx += v_count;
@@ -1695,26 +1690,6 @@ static int fbnic_alloc_napi_vector(struct fbnic_dev *fbd, struct fbnic_net *fbn,
return 0;
- while (rxt_count < nv->rxt_count) {
- qt--;
-
- fbnic_free_qt_page_pools(qt);
-free_ring_cur_qt:
- fbnic_remove_rx_ring(fbn, &qt->sub0);
- fbnic_remove_rx_ring(fbn, &qt->sub1);
- fbnic_remove_rx_ring(fbn, &qt->cmpl);
- rxt_count++;
- }
- while (txt_count < nv->txt_count) {
- qt--;
-
- fbnic_remove_tx_ring(fbn, &qt->sub0);
- fbnic_remove_xdp_ring(fbn, &qt->sub1);
- fbnic_remove_tx_ring(fbn, &qt->cmpl);
-
- txt_count++;
- }
- fbnic_napi_free_irq(fbd, nv);
napi_del:
netif_napi_del(&nv->napi);
fbn->napi[fbnic_napi_idx(nv)] = NULL;
@@ -1934,6 +1909,7 @@ static void fbnic_free_qt_resources(struct fbnic_net *fbn,
if (xdp_rxq_info_is_reg(&qt->xdp_rxq)) {
xdp_rxq_info_unreg_mem_model(&qt->xdp_rxq);
xdp_rxq_info_unreg(&qt->xdp_rxq);
+ fbnic_free_qt_page_pools(qt);
}
}
@@ -1971,12 +1947,15 @@ static int fbnic_alloc_rx_qt_resources(struct fbnic_net *fbn,
struct device *dev = fbn->netdev->dev.parent;
int err;
- err = xdp_rxq_info_reg(&qt->xdp_rxq, fbn->netdev, qt->sub0.q_idx,
- nv->napi.napi_id);
+ err = fbnic_alloc_qt_page_pools(fbn, nv, qt);
if (err)
return err;
- /* Register XDP memory model for completion queue */
+ err = xdp_rxq_info_reg(&qt->xdp_rxq, fbn->netdev, qt->sub0.q_idx,
+ nv->napi.napi_id);
+ if (err)
+ goto free_page_pools;
+
err = xdp_rxq_info_reg_mem_model(&qt->xdp_rxq, MEM_TYPE_PAGE_POOL,
qt->sub0.page_pool);
if (err)
@@ -2004,6 +1983,8 @@ static int fbnic_alloc_rx_qt_resources(struct fbnic_net *fbn,
xdp_rxq_info_unreg_mem_model(&qt->xdp_rxq);
unreg_rxq:
xdp_rxq_info_unreg(&qt->xdp_rxq);
+free_page_pools:
+ fbnic_free_qt_page_pools(qt);
return err;
}
--
2.51.0
next prev parent reply other threads:[~2025-08-29 1:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 1:22 [PATCH net-next v2 00/14] eth: fbnic: support queue API and zero-copy Rx Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 01/14] eth: fbnic: move page pool pointer from NAPI to the ring struct Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 02/14] eth: fbnic: move xdp_rxq_info_reg() to resource alloc Jakub Kicinski
2025-08-29 1:22 ` Jakub Kicinski [this message]
2025-08-29 1:22 ` [PATCH net-next v2 04/14] eth: fbnic: use netmem_ref where applicable Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 05/14] eth: fbnic: request ops lock Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 06/14] eth: fbnic: split fbnic_disable() Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 07/14] eth: fbnic: split fbnic_flush() Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 08/14] eth: fbnic: split fbnic_enable() Jakub Kicinski
2025-08-29 1:22 ` [PATCH net-next v2 09/14] eth: fbnic: split fbnic_fill() Jakub Kicinski
2025-08-29 1:23 ` [PATCH net-next v2 10/14] net: add helper to pre-check if PP for an Rx queue will be unreadable Jakub Kicinski
2025-08-29 21:56 ` Mina Almasry
2025-08-29 1:23 ` [PATCH net-next v2 11/14] eth: fbnic: allocate unreadable page pool for the payloads Jakub Kicinski
2025-08-29 1:23 ` [PATCH net-next v2 12/14] eth: fbnic: defer page pool recycling activation to queue start Jakub Kicinski
2025-08-29 21:57 ` Mina Almasry
2025-08-29 1:23 ` [PATCH net-next v2 13/14] eth: fbnic: don't pass NAPI into pp alloc Jakub Kicinski
2025-08-29 1:23 ` [PATCH net-next v2 14/14] eth: fbnic: support queue ops / zero-copy Rx Jakub Kicinski
2025-08-29 22:09 ` Mina Almasry
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=20250829012304.4146195-4-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=tariqt@nvidia.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;
as well as URLs for NNTP newsgroup(s).