diff mbox series

[net-next,2/4] net/smc: remove the fallback in __smc_connect

Message ID 20240730012506.3317978-3-shaozhengchao@huawei.com (mailing list archive)
State Accepted
Commit 5a79575711264b98b435e08107c9e5bf129df210
Delegated to: Netdev Maintainers
Headers show
Series net/smc: do some cleanups in smc module | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 42 this patch: 42
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 43 this patch: 43
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 43 this patch: 43
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-31--09-00 (tests: 706)

Commit Message

shaozhengchao July 30, 2024, 1:25 a.m. UTC
When the SMC client begins to connect to server, smcd_version is set
to SMC_V1 + SMC_V2. If fail to get VLAN ID, only SMC_V2 information
is left in smcd_version. And smcd_version will not be changed to 0.
Therefore, remove the fallback caused by the failure to get VLAN ID.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 net/smc/af_smc.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Simon Horman July 30, 2024, 6:57 p.m. UTC | #1
On Tue, Jul 30, 2024 at 09:25:04AM +0800, Zhengchao Shao wrote:
> When the SMC client begins to connect to server, smcd_version is set
> to SMC_V1 + SMC_V2. If fail to get VLAN ID, only SMC_V2 information
> is left in smcd_version. And smcd_version will not be changed to 0.
> Therefore, remove the fallback caused by the failure to get VLAN ID.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>

Thanks,

I agree that smcd_version, which is initialised just above the code
modified by this patch, cannot be 0 at the point of the check removed by
this patch.

Reviewed-by: Simon Horman <horms@kernel.org>
Wenjia Zhang July 31, 2024, 3:15 p.m. UTC | #2
On 30.07.24 03:25, Zhengchao Shao wrote:
> When the SMC client begins to connect to server, smcd_version is set
> to SMC_V1 + SMC_V2. If fail to get VLAN ID, only SMC_V2 information
> is left in smcd_version. And smcd_version will not be changed to 0.
> Therefore, remove the fallback caused by the failure to get VLAN ID.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>   net/smc/af_smc.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 73a875573e7a..83f5a1849971 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1523,10 +1523,6 @@ static int __smc_connect(struct smc_sock *smc)
>   		ini->smcd_version &= ~SMC_V1;
>   		ini->smcr_version = 0;
>   		ini->smc_type_v1 = SMC_TYPE_N;
> -		if (!ini->smcd_version) {
> -			rc = SMC_CLC_DECL_GETVLANERR;
> -			goto fallback;
> -		}
>   	}
>   
>   	rc = smc_find_proposal_devices(smc, ini);

Though you're right that here smcd_version never gets 0, it actually is 
a bug from ("42042dbbc2eb net/smc: prepare for SMC-Rv2 connection"). The 
purpose of the check here was to fallback at a early phase before 
calling smc_find_proposal_devices(). However, this change is not wrong, 
just I personally like adding a check for smc_ism_is_v2_capable() more.

Thanks,
Wenjia
shaozhengchao Aug. 1, 2024, 1:22 a.m. UTC | #3
Hi Wenjia Zhang:
    Looks like the logic you're saying is okay. Do I need another patch
to perfect it? As below:
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 73a875573e7a..b23d15506afc 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1523,7 +1523,7 @@ static int __smc_connect(struct smc_sock *smc)
                 ini->smcd_version &= ~SMC_V1;
                 ini->smcr_version = 0;
                 ini->smc_type_v1 = SMC_TYPE_N;
-               if (!ini->smcd_version) {
+               if (!smc_ism_is_v2_capable()) {
                         rc = SMC_CLC_DECL_GETVLANERR;
                         goto fallback;
                 }


Thank you

Zhengchao Shao

On 2024/7/31 23:15, Wenjia Zhang wrote:
> 
> 
> On 30.07.24 03:25, Zhengchao Shao wrote:
>> When the SMC client begins to connect to server, smcd_version is set
>> to SMC_V1 + SMC_V2. If fail to get VLAN ID, only SMC_V2 information
>> is left in smcd_version. And smcd_version will not be changed to 0.
>> Therefore, remove the fallback caused by the failure to get VLAN ID.
>>
>> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>> ---
>>   net/smc/af_smc.c | 4 ----
>>   1 file changed, 4 deletions(-)
>>
>> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
>> index 73a875573e7a..83f5a1849971 100644
>> --- a/net/smc/af_smc.c
>> +++ b/net/smc/af_smc.c
>> @@ -1523,10 +1523,6 @@ static int __smc_connect(struct smc_sock *smc)
>>           ini->smcd_version &= ~SMC_V1;
>>           ini->smcr_version = 0;
>>           ini->smc_type_v1 = SMC_TYPE_N;
>> -        if (!ini->smcd_version) {
>> -            rc = SMC_CLC_DECL_GETVLANERR;
>> -            goto fallback;
>> -        }
>>       }
>>       rc = smc_find_proposal_devices(smc, ini);
> 
> Though you're right that here smcd_version never gets 0, it actually is 
> a bug from ("42042dbbc2eb net/smc: prepare for SMC-Rv2 connection"). The 
> purpose of the check here was to fallback at a early phase before 
> calling smc_find_proposal_devices(). However, this change is not wrong, 
> just I personally like adding a check for smc_ism_is_v2_capable() more.
> 
> Thanks,
> Wenjia
Wenjia Zhang Aug. 1, 2024, 7:23 a.m. UTC | #4
On 01.08.24 03:22, shaozhengchao wrote:
> Hi Wenjia Zhang:
>     Looks like the logic you're saying is okay. Do I need another patch
> to perfect it? As below:
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 73a875573e7a..b23d15506afc 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1523,7 +1523,7 @@ static int __smc_connect(struct smc_sock *smc)
>                  ini->smcd_version &= ~SMC_V1;
>                  ini->smcr_version = 0;
>                  ini->smc_type_v1 = SMC_TYPE_N;
> -               if (!ini->smcd_version) {
> +               if (!smc_ism_is_v2_capable()) {
>                          rc = SMC_CLC_DECL_GETVLANERR;
>                          goto fallback;
>                  }
> 
> 
> Thank you
> 
> Zhengchao Shao
> 

Hi Zhengchao,

I see your patches series were already applied yesterday. So It's okay 
to let it be now. As I said, your changes are not wrong, just not clean 
enough IMO. Anyway, thanks for your contribution to our code!

Thanks,
Wenjia
shaozhengchao Aug. 1, 2024, 11:35 a.m. UTC | #5
On 2024/8/1 15:23, Wenjia Zhang wrote:
> 
> 
> On 01.08.24 03:22, shaozhengchao wrote:
>> Hi Wenjia Zhang:
>>     Looks like the logic you're saying is okay. Do I need another patch
>> to perfect it? As below:
>> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
>> index 73a875573e7a..b23d15506afc 100644
>> --- a/net/smc/af_smc.c
>> +++ b/net/smc/af_smc.c
>> @@ -1523,7 +1523,7 @@ static int __smc_connect(struct smc_sock *smc)
>>                  ini->smcd_version &= ~SMC_V1;
>>                  ini->smcr_version = 0;
>>                  ini->smc_type_v1 = SMC_TYPE_N;
>> -               if (!ini->smcd_version) {
>> +               if (!smc_ism_is_v2_capable()) {
>>                          rc = SMC_CLC_DECL_GETVLANERR;
>>                          goto fallback;
>>                  }
>>
>>
>> Thank you
>>
>> Zhengchao Shao
>>
>
Hi Wenjia:
    I am currently testing the SMC-R/D, also interested in the SMC
module. I will continue to review SMC code. :)

Thank you

Zhengchao Shao

> Hi Zhengchao,
> 
> I see your patches series were already applied yesterday. So It's okay 
> to let it be now. As I said, your changes are not wrong, just not clean 
> enough IMO. Anyway, thanks for your contribution to our code!
> 
> Thanks,
> Wenjia
diff mbox series

Patch

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 73a875573e7a..83f5a1849971 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1523,10 +1523,6 @@  static int __smc_connect(struct smc_sock *smc)
 		ini->smcd_version &= ~SMC_V1;
 		ini->smcr_version = 0;
 		ini->smc_type_v1 = SMC_TYPE_N;
-		if (!ini->smcd_version) {
-			rc = SMC_CLC_DECL_GETVLANERR;
-			goto fallback;
-		}
 	}
 
 	rc = smc_find_proposal_devices(smc, ini);