[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240625120807.1165581-3-amcohen@nvidia.com>
Date: Tue, 25 Jun 2024 15:08:05 +0300
From: Amit Cohen <amcohen@...dia.com>
To: <kuba@...nel.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<hawk@...nel.org>, <idosch@...dia.com>, <petrm@...dia.com>,
<mlxsw@...dia.com>, <netdev@...r.kernel.org>, Amit Cohen <amcohen@...dia.com>
Subject: [PATCH RFC net-next 2/4] net: core: page_pool_user: Change 'ifindex' for page pool dump
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@...dia.com>
---
net/core/page_pool_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
2.45.1
Powered by blists - more mailing lists