diff mbox series

[v3,iproute2-next,5/5] rdma: Add IB device and net device rename events

Message ID 20241112095802.2355220-6-cmeioahs@nvidia.com (mailing list archive)
State Not Applicable
Headers show
Series Add RDMA monitor support | expand

Commit Message

Chiara Meiohas Nov. 12, 2024, 9:58 a.m. UTC
From: Chiara Meiohas <cmeiohas@nvidia.com>

rdma monitor displays the IB device name and the netdevice
name when displaying event info. Since users can modiy these
names, we track and notify on renaming events.

$ rdma monitor
$ rmmod mlx5_ib
[UNREGISTER]    dev 1  rocep8s0f1
[UNREGISTER]    dev 0  rocep8s0f0

$ modprobe mlx5_ib
[REGISTER]      dev 2  mlx5_0
[NETDEV_ATTACH] dev 2  mlx5_0 port 1 netdev 4 eth2
[REGISTER]      dev 3  mlx5_1
[NETDEV_ATTACH] dev 3  mlx5_1 port 1 netdev 5 eth3
[RENAME]        dev 2  rocep8s0f0
[RENAME]        dev 3  rocep8s0f1

$ devlink dev eswitch set pci/0000:08:00.0 mode switchdev
[UNREGISTER]    dev 2  rocep8s0f0
[REGISTER]      dev 4  mlx5_0
[NETDEV_ATTACH] dev 4  mlx5_0 port 30 netdev 4 eth2
[RENAME]        dev 4  rdmap8s0f0

$ echo 4 > /sys/class/net/eth2/device/sriov_numvfs
[NETDEV_ATTACH] dev 4  rdmap8s0f0 port 2 netdev 7 eth4
[NETDEV_ATTACH] dev 4  rdmap8s0f0 port 3 netdev 8 eth5
[NETDEV_ATTACH] dev 4  rdmap8s0f0 port 4 netdev 9 eth6
[NETDEV_ATTACH] dev 4  rdmap8s0f0 port 5 netdev 10 eth7
[REGISTER]      dev 5  mlx5_0
[NETDEV_ATTACH] dev 5  mlx5_0 port 1 netdev 11 eth8
[REGISTER]      dev 6  mlx5_1
[NETDEV_ATTACH] dev 6  mlx5_1 port 1 netdev 12 eth9
[RENAME]        dev 5  rocep8s0f0v0
[RENAME]        dev 6  rocep8s0f0v1
[REGISTER]      dev 7  mlx5_0
[NETDEV_ATTACH] dev 7  mlx5_0 port 1 netdev 13 eth10
[RENAME]        dev 7  rocep8s0f0v2
[REGISTER]      dev 8  mlx5_0
[NETDEV_ATTACH] dev 8  mlx5_0 port 1 netdev 14 eth11
[RENAME]        dev 8  rocep8s0f0v3

$ ip link set eth2 name myeth2
[NETDEV_RENAME]	 netdev 4 myeth2

$ ip link set eth1 name myeth1

** no events received, because eth1 is not attached to
   an IB device **

Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
 rdma/monitor.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/rdma/monitor.c b/rdma/monitor.c
index 8c14d575..fc80f7d8 100644
--- a/rdma/monitor.c
+++ b/rdma/monitor.c
@@ -41,6 +41,8 @@  static void mon_print_event_type(struct nlattr **tb)
 		[RDMA_UNREGISTER_EVENT] = "[UNREGISTER]",
 		[RDMA_NETDEV_ATTACH_EVENT] = "[NETDEV_ATTACH]",
 		[RDMA_NETDEV_DETACH_EVENT] = "[NETDEV_DETACH]",
+		[RDMA_RENAME_EVENT] = "[RENAME]",
+		[RDMA_NETDEV_RENAME_EVENT] = "[NETDEV_RENAME]",
 	};
 	enum rdma_nl_notify_event_type etype;
 	char unknown_type[32];