Skip to contentSkip to conversation

net/smc: return the right falback reason when prefix checks fail

PATCH Applied Dust Li 6 participants 7 messages Oct 12, 2023 – Oct 16, 2023

Subsystems (4)
lore
Share & tools
lore

Dust Li

author maintainer
#0 lore raw

PATCH 1/1 net/smc: return the right falback reason when prefix checks fail

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")
---
 net/smc/af_smc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +1 -1
index bacdd971615e..21d4476b937b 100644
@@ -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 */
Signature · 1 line
2.19.1.6.gb485710b
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dust Li

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")

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.

Quoted 9 lines
---
 net/smc/af_smc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +0 -0
index bacdd971615e..21d4476b937b 100644

net/smc/af_smc.c static int smc_listen_find_device(struct smc_sock *new_smc, · line 2367

Quoted 8 lines
net/smc/af_smc.c +1 -1
@@ -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
#2 lore raw
Quoted 10 lines · Alexandra Winter
Quoted 7 lines · Dust Li

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.

Quoted 7 lines
Quoted 2 lines
Fixes e49300a6bf62 ("net/smc: add listen processing for SMC-Rv2")

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.

author maintainer
#3 lore raw
In reply to Alexandra Winter
Quoted 10 lines · Alexandra Winter
Quoted 7 lines · Dust Li

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.

Quoted 6 lines
Quoted 2 lines
Fixes e49300a6bf62 ("net/smc: add listen processing for SMC-Rv2")

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

Quoted 21 lines
Quoted 10 lines
---
 net/smc/af_smc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +0 -0
index bacdd971615e..21d4476b937b 100644

net/smc/af_smc.c static int smc_listen_find_device(struct smc_sock *new_smc, · line 2367

Quoted 8 lines
net/smc/af_smc.c +1 -1
@@ -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:

reviewer
#4 lore raw
In reply to Dust Li
Quoted 18 lines · Dust Li

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")
---
  net/smc/af_smc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +0 -0
index bacdd971615e..21d4476b937b 100644

net/smc/af_smc.c static int smc_listen_find_device(struct smc_sock *new_smc, · line 2367

Quoted 8 lines
net/smc/af_smc.c +1 -1
@@ -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

#5 lore raw
Quoted 39 lines · Wen Gu
Quoted 18 lines · Dust Li

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")

---
  net/smc/af_smc.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +0 -0
index bacdd971615e..21d4476b937b 100644

net/smc/af_smc.c static int smc_listen_find_device(struct smc_sock *new_smc, · line 2366

Quoted 7 lines
net/smc/af_smc.c +1 -1
@@ -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.

Quoted 8 lines

...

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.

Quoted 5 lines

Thanks,
Wen Gu

#6 lore raw
In reply to Dust Li
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html