diff mbox series

[RFC,net-next,2/4] net: core: page_pool_user: Change 'ifindex' for page pool dump

Message ID 20240625120807.1165581-3-amcohen@nvidia.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series Adjust page pool netlink filling to non common case | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 842 this patch: 842
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 849 this patch: 849
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 849 this patch: 849
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Amit Cohen June 25, 2024, 12:08 p.m. UTC
Currently, to dump all page pools, there is a loop which iterates over all
netdevices in the relevant net, then, for each netdevice, iterate over all
page pools which are attached to this netdevice, and call the fill()
function with the pool.

With the exiting code, the netlink message is filled with
'pool->slow.netdev->ifindex', which means that if a pool is used by
several netdevices, it will not be dumped with the real netdevice via
page-pool-get/page-pool-stats-get, as this pointer should be NULL in such
case.

Change 'ifindex' which is passed to fill() function, pass the 'ifindex'
of the netdevice which the pool is stored in its list. This should not
change the behavior for drivers which has netdevice per page pool, as the
same value is passed now. It will allow drivers which have page pool for
several netdevices to dump all the pools. The drivers just need to
make 'netdev->page_pools' list to hold all the pools which the netdevice
consumes pages from.

Note that 'ifindex' for get command is not changed.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
---
 net/core/page_pool_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c
index 44948f7b9d68..ce4a34adad8a 100644
--- a/net/core/page_pool_user.c
+++ b/net/core/page_pool_user.c
@@ -92,7 +92,7 @@  netdev_nl_page_pool_get_dump(struct sk_buff *skb, struct netlink_callback *cb,
 				continue;
 
 			state->pp_id = pool->user.id;
-			err = fill(skb, pool, info, pool->slow.netdev->ifindex);
+			err = fill(skb, pool, info, netdev->ifindex);
 			if (err)
 				goto out;
 		}