fbnic: Support larger RX pages
Subsystems (5)
v4 cover fbnic: Support larger RX pages
Hi!
This series adds support for large io_uring zero-copy RX buffers to fbnic.
fbnic hardware consumes receive memory in 4 KiB device pages, while io_uring may expose a larger software buffer, such as 256 KiB. Track the device-page geometry per BDQ, represent each large buffer with consecutive descriptors, and decode completions to the corresponding offset within the buffer. HPQ keeps its existing PAGE_SIZE geometry.
Larger buffers also reduce pressure on the memory provider. One provider allocation supplies multiple 4 KiB device pages, so the same amount of receive memory needs fewer net_iov objects and fewer allocation, refill, and recycle operations. Hardware descriptor use remains unchanged.
Ring depth and buffer size must be validated together. An ethtool ring change can otherwise make an active memory-provider configuration invalid. Store RX ring depths in netdev_config, stage proposed values in cfg_pending, and validate the default and each RX queue before committing the change. Both netlink and ioctl use the same transaction helpers.
The selftest requests a power-of-two buffer larger than twice the MTU, checks the reported buffer length, and verifies received data. It does not assume how packets are placed within the buffer.
This series depends on the fbnic real-queue synchronization fix:
https://lore.kernel.org/netdev/[email protected]/
Changes in v4
=============
- Document that set_ringparam callbacks must report normalized ring sizes through the in/out ethtool_ringparam argument.
- Drop the unused stored TX ring depth; only RX depths are consumed by queue-configuration validation.
- Document that drivers consuming RX ring depths must initialize them before registering the netdev.
- Note the dependency on the separately posted real-queue synchronization fix.
- Carry Breno's Reviewed-by on the BDQ geometry patch and Tested-by on the selftest patch.
- Rebase on net-next after the net tree merge.
Changes in v3
=============
- Carry Breno's Reviewed-by on the netdev_config helper patch.
- Clarify that the fbnic ring-depth consumer follows the core patch.
- Document initialization, override, normalization, and stored ring depth semantics.
- Drop the CQE placement assertion from the large-buffer test.
- Reject a zero RX-jumbo depth before validating large RX pages.
- Rebase on net-next.
Changes in v2
=============
- Add generic netdev_config lifecycle helpers for the netlink and ioctl paths.
- Store ring parameters in netdev_config and revalidate RX queues before committing a ring change.
- Preserve the distinction between accepted and applied HDS state.
- Track fbnic device-page geometry per BDQ.
- Validate the fbnic RX page size, fragment count, and PPQ depth.
- Add automated large-buffer test coverage.
v3: https://lore.kernel.org/netdev/[email protected]/
v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/
Björn Töpel (4):
fbnic: Track BDQ device-page geometry per ring
net: Revalidate queue config for ringparam changes
fbnic: Support larger memory-provider RX pages
selftests: drv-net: Request larger zcrx buffers
Jakub Kicinski (1):
net: Add netdev_config helpers
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 34 +--- .../net/ethernet/meta/fbnic/fbnic_debugfs.c | 5 +- .../net/ethernet/meta/fbnic/fbnic_netdev.c | 4 + drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 173 ++++++++++++++---- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 7 + include/linux/ethtool.h | 4 +- include/net/netdev_queues.h | 56 +++++- net/core/dev.c | 7 +- net/core/dev.h | 7 + net/core/netdev_config.c | 75 +++++++- net/ethtool/common.c | 8 + net/ethtool/common.h | 2 + net/ethtool/ioctl.c | 24 ++- net/ethtool/netlink.c | 15 +- net/ethtool/rings.c | 13 +- .../selftests/drivers/net/hw/iou-zcrx.py | 6 +- 16 files changed, 350 insertions(+), 90 deletions(-)
base-commit: 42a9fb3382fc2573e92f41d203b095d9a372cfc9
Signature · 1 line
2.55.0
PATCH v4 1/5 net: Add netdev_config helpers
From: Jakub Kicinski <[email protected]>
netdev_config manipulation will become slightly more complicated soon and will be used by both ethtool and the queue API. Encapsulate the logic in helper functions.
--- net/core/dev.c | 7 ++----- net/core/dev.h | 5 +++++ net/core/netdev_config.c | 37 +++++++++++++++++++++++++++++++++++++ net/ethtool/netlink.c | 15 +++++++-------- 4 files changed, 51 insertions(+), 13 deletions(-)
net/core/dev.c +2 -5
@@ -12206,10 +12206,8 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,if (!dev->ethtool) goto free_all; - dev->cfg =kzalloc_obj (*dev->cfg,GFP_KERNEL_ACCOUNT ); -if (!dev->cfg) +if (netdev_alloc_config (dev)) goto free_all; - dev->cfg_pending = dev->cfg; dev->num_napi_configs = maxqs; napi_config_sz =array_size (maxqs,sizeof (*dev->napi_config));
@@ -12281,8 +12279,7 @@ void free_netdev(struct net_device *dev)return ; } -WARN_ON (dev->cfg != dev->cfg_pending); -kfree (dev->cfg); +netdev_free_config (dev);kfree (dev->ethtool);netif_free_tx_queues (dev);netif_free_rx_queues (dev);
net/core/dev.h +5 -0
@@ -102,6 +102,11 @@ extern struct rw_semaphore dev_addr_sem;extern struct list_head net_todo_list;void netdev_run_todo (void ); +int netdev_alloc_config (struct net_device *dev); +void __netdev_free_config (struct netdev_config *cfg); +void netdev_free_config (struct net_device *dev); +int netdev_reconfig_start (struct net_device *dev); +int netdev_queue_config_validate (struct net_device *dev,int rxq_idx,struct netdev_queue_config *qcfg,struct netlink_ext_ack *extack);
net/core/netdev_config.c +37 -0
@@ -6,6 +6,43 @@#include "dev.h" +int netdev_alloc_config (struct net_device *dev) +{ +struct netdev_config *cfg; + + cfg =kzalloc_obj (*dev->cfg,GFP_KERNEL_ACCOUNT ); +if (!cfg) +return -ENOMEM ; + + dev->cfg = cfg; + dev->cfg_pending = cfg; +return 0 ; +} + +void __netdev_free_config (struct netdev_config *cfg) +{ +kfree (cfg); +} + +void netdev_free_config (struct net_device *dev) +{ +WARN_ON (dev->cfg != dev->cfg_pending); +__netdev_free_config (dev->cfg); +} + +int netdev_reconfig_start (struct net_device *dev) +{ +struct netdev_config *cfg; + +WARN_ON (dev->cfg != dev->cfg_pending); + cfg =kmemdup (dev->cfg,sizeof (*dev->cfg),GFP_KERNEL_ACCOUNT ); +if (!cfg) +return -ENOMEM ; + + dev->cfg_pending = cfg; +return 0 ; +} +static int netdev_nop_validate_qcfg (struct net_device *dev,struct netdev_queue_config *qcfg,struct netlink_ext_ack *extack)
net/ethtool/netlink.c +7 -8
@@ -11,6 +11,8 @@#include "module_fw.h" #include "netlink.h" +#include "../core/dev.h" +static struct genl_family ethtool_genl_family;static bool ethnl_ok__read_mostly ;
@@ -934,12 +936,9 @@ static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)if (need_rtnl)rtnl_lock ();netdev_lock_ops (dev); - dev->cfg_pending =kmemdup (dev->cfg,sizeof (*dev->cfg), -GFP_KERNEL_ACCOUNT ); -if (!dev->cfg_pending) { - ret = -ENOMEM ; - goto out_tie_cfg; - } + ret =netdev_reconfig_start (dev); +if (ret) + goto out_unlock; ret =ethnl_ops_begin (dev);if (ret <0 )
@@ -958,9 +957,9 @@ static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info) out_ops:ethnl_ops_complete (dev); out_free_cfg: -kfree (dev->cfg_pending); -out_tie_cfg: +__netdev_free_config (dev->cfg_pending); dev->cfg_pending = dev->cfg; +out_unlock:netdev_unlock_ops (dev);if (need_rtnl)rtnl_unlock ();
Signature · 1 line
2.55.0
PATCH v4 2/5 fbnic: Track BDQ device-page geometry per ring
In reply to Björn Töpelfbnic derives the BDQ buffer layout from PAGE_SIZE. That decides at build time how a posted page is split into 4 KiB device pages, and uses the same completion decoding for HPQ and PPQ. That is wrong once the queues use different posted-page sizes; completions must be decoded with the geometry of the queue that produced them.
Keep PAGE_SIZE as the posted-page size for both queues in this change, so the descriptor format and runtime behavior stay unchanged.
--- drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 34 ++------ .../net/ethernet/meta/fbnic/fbnic_debugfs.c | 5 +- drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 83 ++++++++++++------- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 6 ++ 4 files changed, 72 insertions(+), 56 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_csr.h +8 -26
@@ -109,34 +109,19 @@ enum {/* Rx Buffer Descriptor Format * -* The layout of this can vary depending on the page size of the system. +* Buffer descriptors describe 4 KiB device pages. A posted page larger than +* 4 KiB is represented by consecutive device-page descriptors. * -* If the page size is 4K then the layout will simply consist of ID for -* the 16 most significant bits, and the lower 46 are essentially the page -* address with the lowest 12 bits being reserved 0 due to the fact that -* a page will be aligned. -* -* If the page size is larger than 4K then the lower n bits of the ID and -* page address will be reserved for the fragment ID. This fragment will -* be 4K in size and will be used to index both the DMA address and the ID -* by the same amount. +* The address field stores the 4 KiB-aligned DMA address. The ID field stores +* the software page ID, with the low n bits used as the device-page ID when a +* posted page spans multiple device pages. The driver increments both the +* address and ID by one device page for each descriptor belonging to a posted +* page. */ #define FBNIC_BD_DESC_ADDR_MASK DESC_GENMASK(45, 12)#define FBNIC_BD_DESC_ID_MASK DESC_GENMASK(63, 48) -#define FBNIC_BD_FRAG_SIZE \ +#define FBNIC_BD_PAGE_SIZE \ (FBNIC_BD_DESC_ADDR_MASK & ~(FBNIC_BD_DESC_ADDR_MASK - 1)) -#define FBNIC_BD_FRAG_COUNT \ - (PAGE_SIZE / FBNIC_BD_FRAG_SIZE) -#define FBNIC_BD_FRAG_ADDR_MASK \ - (FBNIC_BD_DESC_ADDR_MASK & \ - ~(FBNIC_BD_DESC_ADDR_MASK * FBNIC_BD_FRAG_COUNT)) -#define FBNIC_BD_FRAG_ID_MASK \ - (FBNIC_BD_DESC_ID_MASK & \ - ~(FBNIC_BD_DESC_ID_MASK * FBNIC_BD_FRAG_COUNT)) -#define FBNIC_BD_PAGE_ADDR_MASK \ - (FBNIC_BD_DESC_ADDR_MASK & ~FBNIC_BD_FRAG_ADDR_MASK) -#define FBNIC_BD_PAGE_ID_MASK \ - (FBNIC_BD_DESC_ID_MASK & ~FBNIC_BD_FRAG_ID_MASK)/* Rx Completion Queue Descriptors */ #define FBNIC_RCD_TYPE_MASK DESC_GENMASK(62, 61)
@@ -151,9 +136,6 @@ enum {/* Address/Length Completion Descriptors */ #define FBNIC_RCD_AL_BUFF_ID_MASK DESC_GENMASK(15, 0) -#define FBNIC_RCD_AL_BUFF_FRAG_MASK (FBNIC_BD_FRAG_COUNT - 1) -#define FBNIC_RCD_AL_BUFF_PAGE_MASK \ - (FBNIC_RCD_AL_BUFF_ID_MASK & ~FBNIC_RCD_AL_BUFF_FRAG_MASK)#define FBNIC_RCD_AL_BUFF_LEN_MASK DESC_GENMASK(28, 16)#define FBNIC_RCD_AL_BUFF_OFF_MASK DESC_GENMASK(43, 32)#define FBNIC_RCD_AL_PAGE_FIN DESC_BIT(60)
drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c +3 -2
@@ -181,8 +181,8 @@ static int fbnic_dbg_tcq_desc_seq_show(struct seq_file *s, void *v)static int fbnic_dbg_bdq_desc_seq_show (struct seq_file *s,void *v) {struct fbnic_ring *ring = s->private; +unsigned int i, desc_count;char hdr[80 ]; -int i;/* Generate header on first entry */ fbnic_dbg_ring_show (s);
@@ -197,7 +197,8 @@ static int fbnic_dbg_bdq_desc_seq_show(struct seq_file *s, void *v)return 0 ; } -for (i =0 ; i < (ring->size_mask +1 ) *FBNIC_BD_FRAG_COUNT ; i++) { + desc_count = (ring->size_mask +1 ) *fbnic_bd_page_count (ring); +for (i =0 ; i < desc_count; i++) {u64 bd =le64_to_cpu (ring->desc[i]); seq_printf(s, "%04x %#04llx %#014llx\n", i,
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +55 -28
183 lines not on this page · raw message
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h +6 -0
@@ -131,6 +131,7 @@ struct fbnic_ring {u16 size_mask;/* Size of ring in descriptors - 1 */ u8 q_idx;/* Logical netdev ring index */ u8 flags;/* Ring flags (FBNIC_RING_F_*) */ +u8 bd_page_shift;/* BDQ: ilog2(page_size / 4096) */ u32 head, tail;/* Head/Tail of ring */
@@ -177,6 +178,11 @@ struct fbnic_napi_vector {extern const struct netdev_queue_mgmt_ops fbnic_queue_mgmt_ops; +static inline u16 fbnic_bd_page_count (const struct fbnic_ring *bdq) +{ +return 1U << bdq->bd_page_shift; +} +netdev_tx_t fbnic_xmit_frame (struct sk_buff *skb,struct net_device *dev); netdev_features_t fbnic_features_check(struct sk_buff *skb, struct net_device *dev,
Signature · 1 line
2.55.0
PATCH v4 3/5 net: Revalidate queue config for ringparam changes
In reply to Björn TöpelMemory-provider queue configuration is validated when the provider is bound. A later ethtool ring change may invalidate it because drivers can size queue memory from both ring depth and RX page size. The fbnic consumer is added in the following patch.
Keep configured RX ring depths in netdev_config and stage proposed values in cfg_pending. Validate every RX queue before calling the driver. Each check validates the device defaults, then any queue memory-provider override. Commit the values only after the driver accepts them.
Drivers which consume stored ring depths through queue configuration must initialize every RX depth before registering the netdev. Stored values override callback defaults, including when zero.
The callback receives a rendered configuration rather than a queue ID. Validation should depend on the configuration, not queue identity. Checking defaults also covers the case where every queue has a memory-provider override.
Drivers may normalize ring depths when applying them. Require the validation callback to use the same normalization. Drivers must report the applied depths through the ethtool_ringparam argument so the core records the result.
Use the same transaction for ioctl and netlink. Drivers without ndo_validate_qcfg skip the new validation.
--- include/linux/ethtool.h | 4 ++- include/net/netdev_queues.h | 56 ++++++++++++++++++++++++++++++++----- net/core/dev.h | 2 ++ net/core/netdev_config.c | 38 +++++++++++++++++++++++-- net/ethtool/common.c | 8 ++++++ net/ethtool/common.h | 2 ++ net/ethtool/ioctl.c | 24 ++++++++++++++-- net/ethtool/rings.c | 13 ++++++++- 8 files changed, 133 insertions(+), 14 deletions(-)
include/linux/ethtool.h +3 -1
@@ -1025,7 +1025,9 @@ struct kernel_ethtool_ts_info {* types should be set in @supported_coalesce_params. * Returns a negative error code or zero. * @get_ringparam: Report ring sizes -* @set_ringparam: Set ring sizes. Returns a negative error code or zero. +* @set_ringparam: Set ring sizes. The &struct ethtool_ringparam argument is +* also an output; drivers which normalize requested sizes must update it +* with the applied sizes. Returns a negative error code or zero. * @get_pause_stats: Report pause frame statistics. Drivers must not zero * statistics which they don't report. The stats structure is initialized * to ETHTOOL_STAT_NOT_SET indicating driver does not report statistics.
include/net/netdev_queues.h +49 -7
83 lines not on this page · raw message
net/core/dev.h +2 -0
@@ -110,6 +110,8 @@ int netdev_reconfig_start(struct net_device *dev);int netdev_queue_config_validate (struct net_device *dev,int rxq_idx,struct netdev_queue_config *qcfg,struct netlink_ext_ack *extack); +int netdev_queue_config_revalidate (struct net_device *dev, +struct netlink_ext_ack *extack);bool netif_rxq_has_mp (struct net_device *dev,unsigned int rxq_idx);bool netif_rxq_is_leased (struct net_device *dev,unsigned int rxq_idx);
net/core/netdev_config.c +35 -3
@@ -50,6 +50,15 @@ static int netdev_nop_validate_qcfg(struct net_device *dev,return 0 ; } +static void netdev_qcfg_apply_dev (struct netdev_queue_config *qcfg, +const struct netdev_config *cfg) +{ +/* Device config overrides callback-provided fallbacks. */ + qcfg->rx_ring_size = cfg->rings.rx_pending; + qcfg->rx_mini_ring_size = cfg->rings.rx_mini_pending; + qcfg->rx_jumbo_ring_size = cfg->rings.rx_jumbo_pending; +} + static int __netdev_queue_config(struct net_device *dev, int rxq_idx, struct netdev_queue_config *qcfg, struct netlink_ext_ack *extack,
@@ -70,6 +79,7 @@ static int __netdev_queue_config(struct net_device *dev, int rxq_idx,/* Get defaults from the driver, in case user config not set */ if (dev->queue_mgmt_ops->ndo_default_qcfg) dev->queue_mgmt_ops->ndo_default_qcfg (dev, qcfg); +netdev_qcfg_apply_dev (qcfg, dev->cfg_pending); err =validate_cb (dev, qcfg, extack);if (err)return err;
@@ -91,9 +101,11 @@ static int __netdev_queue_config(struct net_device *dev, int rxq_idx,* @rxq_idx: index of the queue of interest * @qcfg: queue configuration struct (output) * -* Render the configuration for a given queue. This helper should be used -* by drivers which support queue configuration to retrieve config for -* a particular queue. +* Render the configuration for a given queue. During a configuration +* transaction this includes the proposed device-wide values in +* @dev->cfg_pending; otherwise @dev->cfg_pending points to the accepted +* configuration. This helper should be used by drivers which support queue +* configuration to retrieve config for a particular queue. * * @qcfg is an output parameter and is always fully initialized by this * function. Some values may not be set by the user, drivers may either
@@ -113,3 +125,23 @@ int netdev_queue_config_validate(struct net_device *dev, int rxq_idx, {return __netdev_queue_config (dev, rxq_idx, qcfg, extack, true); } + +int netdev_queue_config_revalidate (struct net_device *dev, +struct netlink_ext_ack *extack) +{ +const struct netdev_queue_mgmt_ops *qops = dev->queue_mgmt_ops; +struct netdev_queue_config qcfg; +unsigned int i; +int err; + +if (!qops || !qops->ndo_validate_qcfg) +return 0 ; + +for (i =0 ; i < dev->real_num_rx_queues; i++) { + err =netdev_queue_config_validate (dev, i, &qcfg, extack); +if (err) +return err; + } + +return 0 ; +}
net/ethtool/common.c +8 -0
@@ -956,6 +956,14 @@ void ethtool_ringparam_get_cfg(struct net_device *dev, kparam->hds_thresh = dev->cfg->hds_thresh; } +void ethtool_ringparam_set_cfg (struct netdev_config *cfg, +const struct ethtool_ringparam *param) +{ + cfg->rings.rx_pending = param->rx_pending; + cfg->rings.rx_mini_pending = param->rx_mini_pending; + cfg->rings.rx_jumbo_pending = param->rx_jumbo_pending; +} +static void ethtool_init_tsinfo (struct kernel_ethtool_ts_info *info) {memset (info,0 ,sizeof (*info));
net/ethtool/common.h +2 -0
@@ -53,6 +53,8 @@ void ethtool_ringparam_get_cfg(struct net_device *dev,struct ethtool_ringparam *param, struct kernel_ethtool_ringparam *kparam, struct netlink_ext_ack *extack); +void ethtool_ringparam_set_cfg (struct netdev_config *cfg, +const struct ethtool_ringparam *param);int ethtool_get_rx_ring_count (struct net_device *dev);
net/ethtool/ioctl.c +22 -2
@@ -35,6 +35,7 @@#include <net/netdev_queues.h> #include "common.h" +#include "../core/dev.h" /* State held across locks and calls for commands which have devlink fallback */ struct ethtool_devlink_compat {
@@ -2239,10 +2240,29 @@ static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr) ringparam.tx_pending > max.tx_max_pending) return -EINVAL; + ret =netdev_reconfig_start (dev); +if (ret) +return ret; + +ethtool_ringparam_set_cfg (dev->cfg_pending, &ringparam); + + ret =netdev_queue_config_revalidate (dev,NULL ); +if (ret) + goto out_free_cfg; + ret = dev->ethtool_ops->set_ringparam (dev, &ringparam, &kernel_ringparam,NULL ); -if (!ret) -ethtool_notify (dev,ETHTOOL_MSG_RINGS_NTF ); +if (ret) + goto out_free_cfg; + +/* Capture ring depth adjustments reported by the driver. */ +ethtool_ringparam_set_cfg (dev->cfg_pending, &ringparam); +swap (dev->cfg, dev->cfg_pending); +ethtool_notify (dev,ETHTOOL_MSG_RINGS_NTF ); + +out_free_cfg: +__netdev_free_config (dev->cfg_pending); + dev->cfg_pending = dev->cfg;return ret; }
net/ethtool/rings.c +12 -1
@@ -4,6 +4,7 @@#include "common.h" #include "netlink.h" +#include "../core/dev.h" struct rings_req_info {struct ethnl_req_info base;
@@ -299,10 +300,20 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info) dev->cfg_pending->hds_config = kernel_ringparam.tcp_data_split; dev->cfg_pending->hds_thresh = kernel_ringparam.hds_thresh; +ethtool_ringparam_set_cfg (dev->cfg_pending, &ringparam); + + ret =netdev_queue_config_revalidate (dev, info->extack); +if (ret) +return ret; ret = dev->ethtool_ops->set_ringparam (dev, &ringparam, &kernel_ringparam, info->extack); -return ret <0 ? ret :1 ; +if (ret <0 ) +return ret; + +/* Capture ring depth adjustments reported by the driver. */ +ethtool_ringparam_set_cfg (dev->cfg_pending, &ringparam); +return 1 ; }const struct ethnl_request_ops ethnl_rings_request_ops = {
Signature · 1 line
2.55.0
PATCH v4 4/5 fbnic: Support larger memory-provider RX pages
In reply to Björn TöpelMemory providers can set the receive page size for a queue through QCFG_RX_PAGE_SIZE. fbnic creates PAGE_SIZE PPQ page-pool allocations, so larger rx_buf_len values are not reflected in the PPQ BDQ geometry.
Use the rendered rx_page_size for PPQ allocations and completion decoding. The NIC still consumes 4 KiB device pages; a larger PPQ page is represented by consecutive device-page descriptors, and completion IDs decode to offsets within the same netmem allocation.
Validate rx_page_size against fbnic's fragment-reference budget, device-page geometry, and rendered PPQ depth. The page size must be a power-of-two of at least one device page, its worst-case payload fragment count must fit the page-pool reference bias, and the PPQ must retain usable software depth after expansion.
--- .../net/ethernet/meta/fbnic/fbnic_netdev.c | 4 + drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 96 +++++++++++++++++-- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 1 + 3 files changed, 92 insertions(+), 9 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +4 -0
@@ -773,6 +773,10 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd) fbn->ppq_size =FBNIC_PPQ_SIZE_DEFAULT ; fbn->rcq_size =FBNIC_RCQ_SIZE_DEFAULT ; + netdev->cfg->rings.rx_pending = fbn->rcq_size; + netdev->cfg->rings.rx_mini_pending = fbn->hpq_size; + netdev->cfg->rings.rx_jumbo_pending = fbn->ppq_size; + fbn->tx_usecs =FBNIC_TX_USECS_DEFAULT ; fbn->rx_usecs =FBNIC_RX_USECS_DEFAULT ; fbn->rx_max_frames =FBNIC_RX_FRAMES_DEFAULT ;
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +87 -9
160 lines not on this page · raw message
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h +1 -0
@@ -65,6 +65,7 @@ struct fbnic_net;#define FBNIC_RX_HROOM \ (ALIGN(FBNIC_RX_TROOM + FBNIC_RX_HROOM_PAD, 128) - FBNIC_RX_TROOM)#define FBNIC_RX_PAD 0 +#define FBNIC_RX_PAYLD_ALIGN 128#define FBNIC_RX_PAYLD_OFFSET 0#define FBNIC_RX_PAYLD_PG_CL 0
Signature · 1 line
2.55.0
PATCH v4 5/5 selftests: drv-net: Request larger zcrx buffers
In reply to Björn TöpelThe large-chunk test always requests two base pages. On interfaces with a large MTU, that may not exceed two maximum-sized frames.
Request a power-of-two buffer larger than twice the MTU. This makes the existing rx_buf_len check and data-integrity traffic exercise the larger layout.
--- tools/testing/selftests/drivers/net/hw/iou-zcrx.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/hw/iou-zcrx.py +5 -1
@@ -221,9 +221,13 @@ def test_zcrx_large_chunks(cfg) -> None: single(cfg) page_size = resource.getpagesize() + mtu = cfg.dev["mtu"] nr_pages = 2 + while nr_pages * page_size <= 2 * mtu: + nr_pages *= 2 rx_buf_len = nr_pages * page_size - rx_cmd = f"{cfg.bin_local} -s -p {cfg.port} -i {cfg.ifname} -q {cfg.target} -x {nr_pages}" + rx_cmd = (f"{cfg.bin_local} -s -p {cfg.port} -i {cfg.ifname} " + f"-q {cfg.target} -x {nr_pages}") tx_cmd = f"{cfg.bin_remote} -c -h {cfg.addr_v['6']} -p {cfg.port} -l 12840" probe = cmd(rx_cmd + " -d", fail=False)
Signature · 1 line
2.55.0
Quoted 24 lines · Björn Töpel
Hi!
This series adds support for large
io_uringzero-copy RX buffers to fbnic.fbnic hardware consumes receive memory in 4 KiB device pages, while
io_uringmay expose a larger software buffer, such as 256 KiB. Track the device-page geometry per BDQ, represent each large buffer with consecutive descriptors, and decode completions to the corresponding offset within the buffer. HPQ keeps its existingPAGE_SIZEgeometry.Larger buffers also reduce pressure on the memory provider. One provider allocation supplies multiple 4 KiB device pages, so the same amount of receive memory needs fewer
net_iovobjects and fewer allocation, refill, and recycle operations. Hardware descriptor use remains unchanged.Ring depth and buffer size must be validated together. An ethtool ring change can otherwise make an active memory-provider configuration invalid. Store RX ring depths in
netdev_config, stage proposed values incfg_pending, and validate the default and each RX queue before committing the change. Both netlink and ioctl use the same transaction helpers.
Quoted 6 lines
The selftest requests a power-of-two buffer larger than twice the MTU, checks the reported buffer length, and verifies received data. It does not assume how packets are placed within the buffer.
This series depends on the fbnic real-queue synchronization fix:
https://lore.kernel.org/netdev/[email protected]/
For the series:
Re: [PATCH net-next v4 1/5] net: Add netdev_config helpers
In reply to Björn TöpelQuoted 9 lines · Björn Töpel
From: Jakub Kicinski <[email protected]>
netdev_configmanipulation will become slightly more complicated soon and will be used by both ethtool and the queue API. Encapsulate the logic in helper functions.Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Björn Töpel <[email protected]>Reviewed-by Breno Leitao <[email protected]>
Quoted 6 lines
--- net/core/dev.c | 7 ++----- net/core/dev.h | 5 +++++ net/core/netdev_config.c | 37 +++++++++++++++++++++++++++++++++++++ net/ethtool/netlink.c | 15 +++++++-------- 4 files changed, 51 insertions(+), 13 deletions(-)
Re: [PATCH net-next v4 2/5] fbnic: Track BDQ device-page geometry per ring
In reply to Björn TöpelQuoted 9 lines · Björn Töpel
fbnic derives the BDQ buffer layout from
PAGE_SIZE. That decides at build time how a posted page is split into 4 KiB device pages, and uses the same completion decoding for HPQ and PPQ. That is wrong once the queues use different posted-page sizes; completions must be decoded with the geometry of the queue that produced them.Keep
PAGE_SIZEas the posted-page size for both queues in this change, so the descriptor format and runtime behavior stay unchanged.
Quoted 8 lines
Signed-off-by Björn Töpel <[email protected]>Reviewed-by Breno Leitao <[email protected]>--- drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 34 ++------ .../net/ethernet/meta/fbnic/fbnic_debugfs.c | 5 +- drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 83 ++++++++++++------- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 6 ++ 4 files changed, 72 insertions(+), 56 deletions(-)
Re: [PATCH net-next v4 3/5] net: Revalidate queue config for ringparam changes
In reply to Björn TöpelQuoted 31 lines · Björn Töpel
Memory-provider queue configuration is validated when the provider is bound. A later ethtool ring change may invalidate it because drivers can size queue memory from both ring depth and RX page size. The fbnic consumer is added in the following patch.
Keep configured RX ring depths in
netdev_configand stage proposed values incfg_pending. Validate every RX queue before calling the driver. Each check validates the device defaults, then any queue memory-provider override. Commit the values only after the driver accepts them.Drivers which consume stored ring depths through queue configuration must initialize every RX depth before registering the netdev. Stored values override callback defaults, including when zero.
The callback receives a rendered configuration rather than a queue ID. Validation should depend on the configuration, not queue identity. Checking defaults also covers the case where every queue has a memory-provider override.
Drivers may normalize ring depths when applying them. Require the validation callback to use the same normalization. Drivers must report the applied depths through the
ethtool_ringparamargument so the core records the result.Use the same transaction for ioctl and netlink. Drivers without
ndo_validate_qcfgskip the new validation.Signed-off-by Björn Töpel <[email protected]>
Quoted 11 lines
--- include/linux/ethtool.h | 4 ++- include/net/netdev_queues.h | 56 ++++++++++++++++++++++++++++++++----- net/core/dev.h | 2 ++ net/core/netdev_config.c | 38 +++++++++++++++++++++++-- net/ethtool/common.c | 8 ++++++ net/ethtool/common.h | 2 ++ net/ethtool/ioctl.c | 24 ++++++++++++++-- net/ethtool/rings.c | 13 ++++++++- 8 files changed, 133 insertions(+), 14 deletions(-)
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 5 lines · On Fri, 25 Sep 2026 12:44:07 +0200 you wrote:
Hi!
This series adds support for large
io_uringzero-copy RX buffers to fbnic.
Quoted 7 lines
fbnic hardware consumes receive memory in 4 KiB device pages, while
io_uringmay expose a larger software buffer, such as 256 KiB. Track the device-page geometry per BDQ, represent each large buffer with consecutive descriptors, and decode completions to the corresponding offset within the buffer. HPQ keeps its existingPAGE_SIZEgeometry.[...]
Here is the summary with links:
- [net-next,v4,1/5] net: Add netdev_config helpers
https://git.kernel.org/netdev/net-next/c/c978ff0f1e85 - [net-next,v4,2/5] fbnic: Track BDQ device-page geometry per ring https://git.kernel.org/netdev/net-next/c/0d5c23f827d3 - [net-next,v4,3/5] net: Revalidate queue config for ringparam changes https://git.kernel.org/netdev/net-next/c/f092b749e11c - [net-next,v4,4/5] fbnic: Support larger memory-provider RX pages https://git.kernel.org/netdev/net-next/c/54491a1dbd68 - [net-next,v4,5/5] selftests: drv-net: Request larger zcrx buffers https://git.kernel.org/netdev/net-next/c/b7fb14dff027
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html