net: move mp dev config validation to __net_mp_open_rxq()
authorJakub Kicinski <kuba@kernel.org>
Thu, 3 Apr 2025 01:34:04 +0000 (18:34 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 4 Apr 2025 14:35:38 +0000 (07:35 -0700)
commitec304b70d46bd2ed66541c5b57b63276529e05b1
treecdf44a3e05d4cb02eaa6b166857cf49d0993df78
parent053f3ff67d7feefc75797863f3d84b47ad47086f
net: move mp dev config validation to __net_mp_open_rxq()

devmem code performs a number of safety checks to avoid having
to reimplement all of them in the drivers. Move those to
__net_mp_open_rxq() and reuse that function for binding to make
sure that io_uring ZC also benefits from them.

While at it rename the queue ID variable to rxq_idx in
__net_mp_open_rxq(), we touch most of the relevant lines.

The XArray insertion is reordered after the netdev_rx_queue_restart()
call, otherwise we'd need to duplicate the queue index check
or risk inserting an invalid pointer. The XArray allocation
failures should be extremely rare.

Reviewed-by: Mina Almasry <almasrymina@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Fixes: 6e18ed929d3b ("net: add helpers for setting a memory provider on an rx queue")
Link: https://patch.msgid.link/20250403013405.2827250-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/page_pool/memory_provider.h
net/core/devmem.c
net/core/netdev-genl.c
net/core/netdev_rx_queue.c