diff options
author | Guoqing Jiang <guoqing.jiang@linux.dev> | 2022-09-02 13:19:21 +0300 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2022-09-06 14:05:22 +0300 |
commit | 57eb9382370e768fc13e9f3bbdca5579f14ffe83 (patch) | |
tree | 2127069d08b5d98f603e193403194374089d9e4a /drivers/infiniband/ulp/rtrs/rtrs-clt.c | |
parent | 2aa9e4a2c3db065672fe530fb594a8e31f5672f6 (diff) | |
download | linux-57eb9382370e768fc13e9f3bbdca5579f14ffe83.tar.xz |
RDMA/rtrs-clt: Break the loop once one path is connected
No need to iterate all paths after find one connected path.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Link: https://lore.kernel.org/r/20220902101922.26273-3-guoqing.jiang@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband/ulp/rtrs/rtrs-clt.c')
-rw-r--r-- | drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 5219bb10777a..c29eccdb4fd2 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -54,7 +54,10 @@ static inline bool rtrs_clt_is_connected(const struct rtrs_clt_sess *clt) rcu_read_lock(); list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry) - connected |= READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED; + if (READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED) { + connected = true; + break; + } rcu_read_unlock(); return connected; |