summaryrefslogtreecommitdiff
path: root/net/core/netdev_rx_queue.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2026-01-06 13:25:40 +0000
committerPavel Begunkov <asml.silence@gmail.com>2026-01-14 02:13:36 +0000
commitc0b709bf438ba9d197d369f55e4a97603fd4a705 (patch)
tree81d8d5549d538c5483e6baddd772714b0e27e7b5 /net/core/netdev_rx_queue.c
parentefcb9a4d32d3d9b924642c086b868bfbb9a07c13 (diff)
net: pass queue rx page size from memory provider
Allow memory providers to configure rx queues with a custom receive page size. It's passed in struct pp_memory_provider_params, which is copied into the queue, so it's preserved across queue restarts. Then, it's propagated to the driver in a new queue config parameter. Drivers should explicitly opt into using it by setting QCFG_RX_PAGE_SIZE, in which case they should implement ndo_default_qcfg, validate the size on queue restart and honour the current config in case of a reset. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Diffstat (limited to 'net/core/netdev_rx_queue.c')
-rw-r--r--net/core/netdev_rx_queue.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c
index 86d1c0a925e3..b81cad90ba2f 100644
--- a/net/core/netdev_rx_queue.c
+++ b/net/core/netdev_rx_queue.c
@@ -30,12 +30,21 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx)
!qops->ndo_queue_mem_alloc || !qops->ndo_queue_start)
return -EOPNOTSUPP;
+ if (WARN_ON_ONCE(qops->supported_params && !qops->ndo_default_qcfg))
+ return -EINVAL;
+
netdev_assert_locked(dev);
memset(&qcfg, 0, sizeof(qcfg));
if (qops->ndo_default_qcfg)
qops->ndo_default_qcfg(dev, &qcfg);
+ if (rxq->mp_params.rx_page_size) {
+ if (!(qops->supported_params & QCFG_RX_PAGE_SIZE))
+ return -EOPNOTSUPP;
+ qcfg.rx_page_size = rxq->mp_params.rx_page_size;
+ }
+
new_mem = kvzalloc(qops->ndo_queue_mem_size, GFP_KERNEL);
if (!new_mem)
return -ENOMEM;