Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail

From: Wen Gu
Date: Fri Oct 13 2023 - 04:01:06 EST




On 2023/10/12 20:37, Dust Li wrote:

In the smc_listen_work(), if smc_listen_prfx_check() failed,
the real reason: SMC_CLC_DECL_DIFFPREFIX was dropped, and
SMC_CLC_DECL_NOSMCDEV was returned.

Althrough this is also kind of SMC_CLC_DECL_NOSMCDEV, but return
the real reason is much friendly for debugging.

Fixes: e49300a6bf62 ("net/smc: add listen processing for SMC-Rv2")
Signed-off-by: Dust Li <dust.li@xxxxxxxxxxxxxxxxx>
---
net/smc/af_smc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index bacdd971615e..21d4476b937b 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -2361,7 +2361,7 @@ static int smc_listen_find_device(struct smc_sock *new_smc,
smc_find_ism_store_rc(rc, ini);
return (!rc) ? 0 : ini->rc;
}
- return SMC_CLC_DECL_NOSMCDEV;
+ return prfx_rc;
}
/* listen worker: finish RDMA setup */
Inspired by this fix, I am thinking that is it suitable to store the first
decline reason rather than real decline reason that caused the return of
smc_listen_find_device()?

For example, when running SMC between two peers with only RDMA devices. Then
in smc_listen_find_device():

1. call smc_find_ism_v2_device_serv() and find that no ISMv2 can be used.
the reason code will be stored as SMC_CLC_DECL_NOSMCD2DEV.

...

2. call smc_find_rdma_v1_device_serv() and find a RDMA device, but somehow
it failed to create buffers. It should inform users that SMC_CLC_DECL_MEM
occurs, but now the reason code returned SMC_CLC_DECL_NOSMCD2DEV.

I think users may be confused that why peer declines with this reason and
wonder what happens when trying to use SMC-R.


Thanks,
Wen Gu