[RFC v2 22/24] net: let pp memory provider to specify rx buf len
From: Pavel Begunkov
Date: Fri Aug 08 2025 - 11:03:30 EST
Allow memory providers to configure rx queues with a specific receive
buffer length. Pass it in sturct pp_memory_provider_params, which is
copied into the queue, and make __netdev_queue_config() to check if it's
present and apply to the configuration. This way the configured length
will persist across queue restarts, and will be automatically removed
once a memory provider is detached.
Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
include/net/page_pool/types.h | 1 +
net/core/netdev_config.c | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
index 431b593de709..e86bb471f1fc 100644
--- a/include/net/page_pool/types.h
+++ b/include/net/page_pool/types.h
@@ -161,6 +161,7 @@ struct memory_provider_ops;
struct pp_memory_provider_params {
void *mp_priv;
const struct memory_provider_ops *mp_ops;
+ u32 rx_buf_len;
};
struct page_pool {
diff --git a/net/core/netdev_config.c b/net/core/netdev_config.c
index c5ae39e76f40..2c9b06f94e01 100644
--- a/net/core/netdev_config.c
+++ b/net/core/netdev_config.c
@@ -2,6 +2,7 @@
#include <linux/netdevice.h>
#include <net/netdev_queues.h>
+#include <net/netdev_rx_queue.h>
#include "dev.h"
@@ -77,7 +78,7 @@ void netdev_queue_config_update_cnt(struct net_device *dev, unsigned int txq,
}
}
-void __netdev_queue_config(struct net_device *dev, int rxq,
+void __netdev_queue_config(struct net_device *dev, int rxq_idx,
struct netdev_queue_config *qcfg, bool pending)
{
const struct netdev_config *cfg;
@@ -88,18 +89,24 @@ void __netdev_queue_config(struct net_device *dev, int rxq,
/* Get defaults from the driver, in case user config not set */
if (dev->queue_mgmt_ops->ndo_queue_cfg_defaults)
- dev->queue_mgmt_ops->ndo_queue_cfg_defaults(dev, rxq, qcfg);
+ dev->queue_mgmt_ops->ndo_queue_cfg_defaults(dev, rxq_idx, qcfg);
/* Set config based on device-level settings */
if (cfg->rx_buf_len)
qcfg->rx_buf_len = cfg->rx_buf_len;
/* Set config dedicated to this queue */
- if (rxq >= 0) {
- const struct netdev_queue_config *user_cfg = &cfg->qcfg[rxq];
+ if (rxq_idx >= 0) {
+ const struct netdev_queue_config *user_cfg;
+ struct netdev_rx_queue *rxq;
+ user_cfg = &cfg->qcfg[rxq_idx];
if (user_cfg->rx_buf_len)
qcfg->rx_buf_len = user_cfg->rx_buf_len;
+
+ rxq = __netif_get_rx_queue(dev, rxq_idx);
+ if (rxq->mp_params.mp_ops && rxq->mp_params.rx_buf_len)
+ qcfg->rx_buf_len = rxq->mp_params.rx_buf_len;
}
}
--
2.49.0