Skip to contentSkip to conversation

eth: fbnic: support ring size configuration

PATCH In review Jakub Kicinski 3 participants 8 messages Mar 6, 2025 – Mar 8, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover eth: fbnic: support ring size configuration

Support ethtool -g / -G and a couple other small tweaks.

Jakub Kicinski (3):
eth: fbnic: link NAPIs to page pools
eth: fbnic: fix typo in compile assert
eth: fbnic: support ring size configuration

 drivers/net/ethernet/meta/fbnic/fbnic_txrx.h  |  13 +++
 .../net/ethernet/meta/fbnic/fbnic_ethtool.c   | 109 ++++++++++++++++++
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c  |   6 +-
 3 files changed, 126 insertions(+), 2 deletions(-)
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 1/3 eth: fbnic: link NAPIs to page pools

The lifetime of page pools is tied to NAPI instances, and they are destroyed before NAPI is deleted. It's safe to link them up.

---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +3 -1
index aba4c65974ee..2d2d41c6891b 100644
@@ -1316,7 +1316,9 @@ static int fbnic_alloc_nv_page_pool(struct fbnic_net *fbn,
 		.dev = nv->dev,
 		.dma_dir = DMA_BIDIRECTIONAL,
 		.offset = 0,
-		.max_len = PAGE_SIZE
+		.max_len = PAGE_SIZE,
+		.napi	= &nv->napi,
+		.netdev	= fbn->netdev,
 	};
 	struct page_pool *pp;
 
Signature · 1 line
2.48.1
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH net-next 1/3] eth: fbnic: link NAPIs to page pools

Quoted 9 lines · Jakub Kicinski

The lifetime of page pools is tied to NAPI instances, and they are destroyed before NAPI is deleted. It's safe to link them up.

---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
author maintainer
#3 lore raw

PATCH 2/3 eth: fbnic: fix typo in compile assert

In reply to Jakub Kicinski

We should be validating the Rx count on the Rx struct, not the Tx struct. There is no real change here, rx_stats and tx_stats are instances of the same struct.

---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +1 -1
index 2d2d41c6891b..ac11389a764c 100644
@@ -1221,7 +1221,7 @@ void fbnic_aggregate_ring_rx_counters(struct fbnic_net *fbn,
 	fbn->rx_stats.rx.csum_complete += stats->rx.csum_complete;
 	fbn->rx_stats.rx.csum_none += stats->rx.csum_none;
 	/* Remember to add new stats here */
-	BUILD_BUG_ON(sizeof(fbn->tx_stats.rx) / 8 != 3);
+	BUILD_BUG_ON(sizeof(fbn->rx_stats.rx) / 8 != 3);
 }
 
 void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
Signature · 1 line
2.48.1
Acked-by on v1 2/3
#4 lore raw

Re: [PATCH net-next 2/3] eth: fbnic: fix typo in compile assert

Quoted 9 lines · Jakub Kicinski

We should be validating the Rx count on the Rx struct, not the Tx struct. There is no real change here, rx_stats and tx_stats are instances of the same struct.

---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Good catch.

author maintainer
#5 lore raw

PATCH 3/3 eth: fbnic: support ring size configuration

In reply to Jakub Kicinski

Support ethtool -g / -G. Leverage the code added for -l / -L to alloc / stop / start / free.

Check parameters against HW min/max but also our own min/max. Min HW queue is 16 entries, we can't deal with TWQs that small because of the queue waking logic. Add similar contraint on RCQ for symmetry.

We need 3 sizes on Rx, as the NIC does header-data split two separate buffer pools:
(1) head page ring - how many empty pages we post for headers
(2) payload page ring - how many empty pages we post for payloads
(3) completion ring - where NIC produces the Rx descriptors

---
v0.2:
- trim unused defines
- add comment
- add info to commit msg
- add extack

---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.h  |  13 +++
 .../net/ethernet/meta/fbnic/fbnic_ethtool.c   | 109 ++++++++++++++++++
 2 files changed, 122 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h +13 -0
index 54368dc22328..f46616af41ea 100644
@@ -24,9 +24,22 @@ struct fbnic_net;
 #define FBNIC_TX_DESC_WAKEUP	(FBNIC_MAX_SKB_DESC * 2)
 #define FBNIC_TX_DESC_MIN	roundup_pow_of_two(FBNIC_TX_DESC_WAKEUP)
 
+/* To receive the worst case packet we need:
+ *	1 descriptor for primary metadata
+ *	+ 1 descriptor for optional metadata
+ *	+ 1 descriptor for headers
+ *	+ 4 descriptors for payload
+ */
+#define FBNIC_MAX_RX_PKT_DESC	7
+#define FBNIC_RX_DESC_MIN	roundup_pow_of_two(FBNIC_MAX_RX_PKT_DESC * 2)
+
 #define FBNIC_MAX_TXQS			128u
 #define FBNIC_MAX_RXQS			128u
 
+/* These apply to TWQs, TCQ, RCQ */
+#define FBNIC_QUEUE_SIZE_MIN		16u
+#define FBNIC_QUEUE_SIZE_MAX		SZ_64K
+
 #define FBNIC_TXQ_SIZE_DEFAULT		1024
 #define FBNIC_HPQ_SIZE_DEFAULT		256
 #define FBNIC_PPQ_SIZE_DEFAULT		256
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c +109 -0

121 lines not on this page · raw message

Signature · 1 line
2.48.1
Acked-by on v1 3/3
#6 lore raw
Quoted 21 lines · Jakub Kicinski

Support ethtool -g / -G. Leverage the code added for -l / -L to alloc / stop / start / free.

Check parameters against HW min/max but also our own min/max. Min HW queue is 16 entries, we can't deal with TWQs that small because of the queue waking logic. Add similar contraint on RCQ for symmetry.

We need 3 sizes on Rx, as the NIC does header-data split two separate buffer pools:
(1) head page ring - how many empty pages we post for headers
(2) payload page ring - how many empty pages we post for payloads
(3) completion ring - where NIC produces the Rx descriptors

---
v0.2:
- trim unused defines
- add comment
- add info to commit msg
- add extack

Quoted 4 lines
---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.h  |  13 +++
 .../net/ethernet/meta/fbnic/fbnic_ethtool.c   | 109 ++++++++++++++++++
 2 files changed, 122 insertions(+)

Looked at this for a bit and read a bit more of fbnic. I obviously know nothing about this device but nothing jumped out to me while reading the patch:

#7 lore raw
In reply to Jakub Kicinski
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 6 Mar 2025 06:51:47 -0800 you wrote:

Support ethtool -g / -G and a couple other small tweaks.

Jakub Kicinski (3):
eth: fbnic: link NAPIs to page pools
eth: fbnic: fix typo in compile assert
eth: fbnic: support ring size configuration

[...]

Here is the summary with links:
- [net-next,1/3] eth: fbnic: link NAPIs to page pools

    https://git.kernel.org/netdev/net-next/c/c1aacad30614
  - [net-next,2/3] eth: fbnic: fix typo in compile assert
    https://git.kernel.org/netdev/net-next/c/bfb522f347df

- [net-next,3/3] eth: fbnic: support ring size configuration (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html