Commit 9e25dd9d authored by Alexander Lobakin's avatar Alexander Lobakin Committed by Jakub Kicinski
Browse files

xsk: allow attaching XSk pool via xdp_rxq_info_reg_mem_model()



When you register an XSk pool as XDP Rxq info memory model, you then
need to manually attach it after the registration.
Let the user combine both actions into one by just passing a pointer
to the pool directly to xdp_rxq_info_reg_mem_model(), which will take
care of calling xsk_pool_set_rxq_info(). This looks similar to how a
&page_pool gets registered and reduce repeating driver code.

Acked-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/20241203173733.3181246-6-aleksander.lobakin@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f65966fe
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -358,6 +358,9 @@ int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq,
	if (IS_ERR(xdp_alloc))
		return PTR_ERR(xdp_alloc);

	if (type == MEM_TYPE_XSK_BUFF_POOL && allocator)
		xsk_pool_set_rxq_info(allocator, xdp_rxq);

	if (trace_mem_connect_enabled() && xdp_alloc)
		trace_mem_connect(xdp_alloc, xdp_rxq);
	return 0;