net-procfs: use xarray iterator to implement /proc/net/dev
authorEric Dumazet <edumazet@google.com>
Wed, 7 Feb 2024 16:53:18 +0000 (16:53 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 Feb 2024 03:06:09 +0000 (19:06 -0800)
commit0e0939c0adf90a3233392e2a9650290b1ad8068c
tree84584345d7ba4e8fab8303f6d5c6f210eded1307
parent6fb5dfee274cfbb97646dc4d94fb8e2fd9e33001
net-procfs: use xarray iterator to implement /proc/net/dev

In commit 759ab1edb56c ("net: store netdevs in an xarray")
Jakub added net->dev_by_index to map ifindex to netdevices.

We can get rid of the old hash table (net->dev_index_head),
one patch at a time, if performance is acceptable.

This patch removes unpleasant code to something more readable.

As a bonus, /proc/net/dev gets netdevices sorted by their ifindex.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20240207165318.3814525-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/net-procfs.c