diff mbox series

[net-next,3/4] net/smc: remove redundant code in smc_connect_check_aclc

Message ID 20240730012506.3317978-4-shaozhengchao@huawei.com (mailing list archive)
State Accepted
Commit d37307eaac13f3c5fe912787b5f9facbc574f2cf
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 perform CLC handshake, it will check whether
the clc header type is correct in receiving SMC_CLC_ACCEPT packet.
The specific invoking path is as follows:
__smc_connect
  smc_connect_clc
    smc_clc_wait_msg
      smc_clc_msg_hdr_valid
        smc_clc_msg_acc_conf_valid
Therefore, the smc_connect_check_aclc interface invoked by
__smc_connect does not need to check type again.

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:58 p.m. UTC | #1
On Tue, Jul 30, 2024 at 09:25:05AM +0800, Zhengchao Shao wrote:
> When the SMC client perform CLC handshake, it will check whether
> the clc header type is correct in receiving SMC_CLC_ACCEPT packet.
> The specific invoking path is as follows:
> __smc_connect
>   smc_connect_clc
>     smc_clc_wait_msg
>       smc_clc_msg_hdr_valid
>         smc_clc_msg_acc_conf_valid
> Therefore, the smc_connect_check_aclc interface invoked by
> __smc_connect does not need to check type again.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>

Thanks, I agree that in the case of a SMC_CLC_ACCEPT packet,
which is the case here, this check is unnecessary as it
has already been performed by smc_clc_msg_acc_conf_valid().

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 83f5a1849971..6f82e4d8fda4 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1466,10 +1466,6 @@  static int smc_connect_ism(struct smc_sock *smc,
 static int smc_connect_check_aclc(struct smc_init_info *ini,
 				  struct smc_clc_msg_accept_confirm *aclc)
 {
-	if (aclc->hdr.typev1 != SMC_TYPE_R &&
-	    aclc->hdr.typev1 != SMC_TYPE_D)
-		return SMC_CLC_DECL_MODEUNSUPP;
-
 	if (aclc->hdr.version >= SMC_V2) {
 		if ((aclc->hdr.typev1 == SMC_TYPE_R &&
 		     !smcr_indicated(ini->smc_type_v2)) ||