RDMA/core: Support link status events dispatching
authorYuyu Li <liyuyu6@huawei.com>
Fri, 22 Nov 2024 10:52:58 +0000 (18:52 +0800)
committerLeon Romanovsky <leon@kernel.org>
Tue, 24 Dec 2024 10:22:18 +0000 (05:22 -0500)
commit1fb0644c3899b2f857b11037b19ed362b67bfe91
treeffd270b8c8293cdbfa6192bb355d17f1f7383c4f
parent0c039a57b68dfb1dd49dfc16240791086d8e57ad
RDMA/core: Support link status events dispatching

Currently the dispatching of link status events is implemented by
each RDMA driver independently, and most of them have very similar
patterns. Add support for this in ib_core so that we can get rid
of duplicate codes in each driver.

A new last_port_state is added in ib_port_cache to cache the port
state of the last link status events dispatching. The original
port_state in ib_port_cache is not used here because it will be
updated when ib_dispatch_event() is called, which means it may
be changed between two link status events, and may lead to a loss
of event dispatching.

Some drivers currently have some private stuff in their link status
events handler in addition to event dispatching, and cannot be
perfectly integrated into the ib_core handling process. For these
drivers, add a new ops report_port_event() so that they can keep
their current processing.

Finally, events of LAG devices are not supported yet in this patch
as currently there is no way to obtain ibdev from upper netdev in
ib_core. This can be a TODO work after the core have more support
for LAG.

Signed-off-by: Yuyu Li <liyuyu6@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/device.c
include/rdma/ib_verbs.h