diff options
| author | Maher Sanalla <msanalla@nvidia.com> | 2025-02-03 14:48:04 +0200 |
|---|---|---|
| committer | Leon Romanovsky <leon@kernel.org> | 2025-02-06 03:40:50 -0500 |
| commit | 5459f6523c1f1a053cdc6411a810061ee717219c (patch) | |
| tree | 68ba266221eae39b9af642ccb55318f1c52c3d08 /include/rdma | |
| parent | 656dff55da19eb889f2b1df5a5f2aa1d28f024fd (diff) | |
| download | linux-5459f6523c1f1a053cdc6411a810061ee717219c.tar.gz linux-5459f6523c1f1a053cdc6411a810061ee717219c.tar.bz2 linux-5459f6523c1f1a053cdc6411a810061ee717219c.zip | |
IB/cache: Add log messages for IB device state changes
Enhance visibility into IB device state transitions by adding log messages
to the kernel log (dmesg). Whenever an IB device changes state, a relevant
print will be printed, such as:
"mlx5_core 0000:08:00.0 mlx5_0: Port: 1 Link DOWN"
"mlx5_core 0000:08:00.0 rdmap8s0f0: Port: 2 Link ACTIVE"
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Link: https://patch.msgid.link/2d26ccbd669bad99089fa2aebb5cba4014fc4999.1738586601.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'include/rdma')
| -rw-r--r-- | include/rdma/ib_verbs.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 0ad104dae253..b59bf30de430 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -519,6 +519,23 @@ enum ib_port_state { IB_PORT_ACTIVE_DEFER = 5 }; +static inline const char *__attribute_const__ +ib_port_state_to_str(enum ib_port_state state) +{ + const char * const states[] = { + [IB_PORT_NOP] = "NOP", + [IB_PORT_DOWN] = "DOWN", + [IB_PORT_INIT] = "INIT", + [IB_PORT_ARMED] = "ARMED", + [IB_PORT_ACTIVE] = "ACTIVE", + [IB_PORT_ACTIVE_DEFER] = "ACTIVE_DEFER", + }; + + if (state < ARRAY_SIZE(states)) + return states[state]; + return "UNKNOWN"; +} + enum ib_port_phys_state { IB_PORT_PHYS_STATE_SLEEP = 1, IB_PORT_PHYS_STATE_POLLING = 2, |
