[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65819c0768920744b4f388a154ea7b8e7c4a85e3.1755499376.git.asml.silence@gmail.com>
Date: Mon, 18 Aug 2025 14:57:38 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org
Cc: asml.silence@...il.com,
Eric Dumazet <edumazet@...gle.com>,
Willem de Bruijn <willemb@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
andrew+netdev@...n.ch,
horms@...nel.org,
davem@...emloft.net,
sdf@...ichev.me,
almasrymina@...gle.com,
dw@...idwei.uk,
michael.chan@...adcom.com,
dtatulea@...dia.com,
ap420073@...il.com,
linux-kernel@...r.kernel.org,
io-uring@...r.kernel.org
Subject: [PATCH net-next v3 22/23] net: let pp memory provider to specify rx buf len
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@...il.com>
---
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 1509a536cb85..be74e4aec7b5 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
Powered by blists - more mailing lists