netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/smc: return the right falback reason when prefix checks fail
@ 2023-10-12 12:37 Dust Li
  2023-10-12 13:05 ` Alexandra Winter
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dust Li @ 2023-10-12 12:37 UTC (permalink / raw)
  To: Karsten Graul, Wenjia Zhang, Jan Karcher, D. Wythe, Tony Lu,
	Wen Gu, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Dust Li, linux-s390, netdev, linux-kernel

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@linux.alibaba.com>
---
 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 */
-- 
2.19.1.6.gb485710b


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail
  2023-10-12 12:37 [PATCH net] net/smc: return the right falback reason when prefix checks fail Dust Li
@ 2023-10-12 13:05 ` Alexandra Winter
  2023-10-12 19:15   ` Wenjia Zhang
  2023-10-13  1:19   ` Dust Li
  2023-10-13  8:00 ` Wen Gu
  2023-10-16 23:40 ` patchwork-bot+netdevbpf
  2 siblings, 2 replies; 7+ messages in thread
From: Alexandra Winter @ 2023-10-12 13:05 UTC (permalink / raw)
  To: Dust Li, Karsten Graul, Wenjia Zhang, Jan Karcher, D. Wythe,
	Tony Lu, Wen Gu, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-s390, netdev, linux-kernel



On 12.10.23 14: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@linux.alibaba.com>

As you point out the current code is not really wrong. So I am not sure,
whether this should be a fix for net, or rather a debug improvement for
net-next.

> ---
>  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 */

For the code change:
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail
  2023-10-12 13:05 ` Alexandra Winter
@ 2023-10-12 19:15   ` Wenjia Zhang
  2023-10-13  1:19   ` Dust Li
  1 sibling, 0 replies; 7+ messages in thread
From: Wenjia Zhang @ 2023-10-12 19:15 UTC (permalink / raw)
  To: Alexandra Winter, Dust Li, Karsten Graul, Jan Karcher, D. Wythe,
	Tony Lu, Wen Gu, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-s390, netdev, linux-kernel



On 12.10.23 15:05, Alexandra Winter wrote:
> 
> 
> On 12.10.23 14: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@linux.alibaba.com>
> 
> As you point out the current code is not really wrong. So I am not sure,
> whether this should be a fix for net, or rather a debug improvement for
> net-next.
> The return code was not precise, and since we do have already a more 
appropriate return code to use. IMO, it was wrong. I'm for net.

Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail
  2023-10-12 13:05 ` Alexandra Winter
  2023-10-12 19:15   ` Wenjia Zhang
@ 2023-10-13  1:19   ` Dust Li
  1 sibling, 0 replies; 7+ messages in thread
From: Dust Li @ 2023-10-13  1:19 UTC (permalink / raw)
  To: Alexandra Winter, Karsten Graul, Wenjia Zhang, Jan Karcher,
	D. Wythe, Tony Lu, Wen Gu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-s390, netdev, linux-kernel

On Thu, Oct 12, 2023 at 03:05:20PM +0200, Alexandra Winter wrote:
>
>
>On 12.10.23 14: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@linux.alibaba.com>
>
>As you point out the current code is not really wrong. So I am not sure,
>whether this should be a fix for net, or rather a debug improvement for
>net-next.

To be honest, I was a bit conflicted which branch should this go for.
But after checking the code before e49300a6bf62 ("net/smc: add listen
processing for SMC-Rv2"), I discovered the previous behavior was to return
SMC_CLC_DECL_DIFFPREFIX. Therefor, I have decided it should be
considered a fix.

I should have memtioned this in the commit message.

Best regards,
Dust


>
>> ---
>>  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 */
>
>For the code change:
>Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail
  2023-10-12 12:37 [PATCH net] net/smc: return the right falback reason when prefix checks fail Dust Li
  2023-10-12 13:05 ` Alexandra Winter
@ 2023-10-13  8:00 ` Wen Gu
  2023-10-13  8:38   ` Guangguan Wang
  2023-10-16 23:40 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 7+ messages in thread
From: Wen Gu @ 2023-10-13  8:00 UTC (permalink / raw)
  To: Dust Li, Karsten Graul, Wenjia Zhang, Jan Karcher, D. Wythe,
	Tony Lu, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-s390, netdev, linux-kernel



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@linux.alibaba.com>
> ---
>   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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail
  2023-10-13  8:00 ` Wen Gu
@ 2023-10-13  8:38   ` Guangguan Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Guangguan Wang @ 2023-10-13  8:38 UTC (permalink / raw)
  To: Wen Gu, Dust Li, Karsten Graul, Wenjia Zhang, Jan Karcher,
	D. Wythe, Tony Lu, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-s390, netdev, linux-kernel



On 2023/10/13 16:00, Wen Gu wrote:
> 
> 
> 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@linux.alibaba.com>
>> ---
>>   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.

Yes, the reason code here also makes me confused.
I think it is caused by not correctly using the function smc_find_ism_store_rc.
I'm working for the fix.

> 
> 
> Thanks,
> Wen Gu
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net/smc: return the right falback reason when prefix checks fail
  2023-10-12 12:37 [PATCH net] net/smc: return the right falback reason when prefix checks fail Dust Li
  2023-10-12 13:05 ` Alexandra Winter
  2023-10-13  8:00 ` Wen Gu
@ 2023-10-16 23:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-16 23:40 UTC (permalink / raw)
  To: Dust Li
  Cc: kgraul, wenjia, jaka, alibuda, tonylu, guwen, davem, edumazet,
	kuba, pabeni, linux-s390, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 12 Oct 2023 20:37:29 +0800 you 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.
> 
> [...]

Here is the summary with links:
  - [net] net/smc: return the right falback reason when prefix checks fail
    https://git.kernel.org/netdev/net/c/4abbd2e3c1db

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-16 23:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12 12:37 [PATCH net] net/smc: return the right falback reason when prefix checks fail Dust Li
2023-10-12 13:05 ` Alexandra Winter
2023-10-12 19:15   ` Wenjia Zhang
2023-10-13  1:19   ` Dust Li
2023-10-13  8:00 ` Wen Gu
2023-10-13  8:38   ` Guangguan Wang
2023-10-16 23:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).