diff mbox series

[net,1/2] net/smc: bugfix for smcr v2 server connect success statistic

Message ID 20230908033143.89489-2-guangguan.wang@linux.alibaba.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series Two fixes for SMC-R | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
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: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Guangguan Wang Sept. 8, 2023, 3:31 a.m. UTC
In the macro SMC_STAT_SERV_SUCC_INC, the smcd_version is used
to determin whether to increase the v1 statistic or the v2
statistic. It is correct for SMCD. But for SMCR, smcr_version
should be used.

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
---
 net/smc/smc_stats.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Wenjia Zhang Sept. 8, 2023, 9:42 a.m. UTC | #1
On 08.09.23 05:31, Guangguan Wang wrote:
> In the macro SMC_STAT_SERV_SUCC_INC, the smcd_version is used
> to determin whether to increase the v1 statistic or the v2
> statistic. It is correct for SMCD. But for SMCR, smcr_version
> should be used.
> 
> Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
> ---
>   net/smc/smc_stats.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/smc/smc_stats.h b/net/smc/smc_stats.h
> index b60fe1eb37ab..aa8928975cc6 100644
> --- a/net/smc/smc_stats.h
> +++ b/net/smc/smc_stats.h
> @@ -243,8 +243,9 @@ while (0)
>   #define SMC_STAT_SERV_SUCC_INC(net, _ini) \
>   do { \
>   	typeof(_ini) i = (_ini); \
> -	bool is_v2 = (i->smcd_version & SMC_V2); \
>   	bool is_smcd = (i->is_smcd); \
> +	u8 version = is_smcd ? i->smcd_version : i->smcr_version; \
> +	bool is_v2 = (version & SMC_V2); \
>   	typeof(net->smc.smc_stats) smc_stats = (net)->smc.smc_stats; \
>   	if (is_v2 && is_smcd) \
>   		this_cpu_inc(smc_stats->smc[SMC_TYPE_D].srv_v2_succ_cnt); \

ohje, that is because the statistic was implemented first, then SMCR_v2. 
Good catch! Thank you!
diff mbox series

Patch

diff --git a/net/smc/smc_stats.h b/net/smc/smc_stats.h
index b60fe1eb37ab..aa8928975cc6 100644
--- a/net/smc/smc_stats.h
+++ b/net/smc/smc_stats.h
@@ -243,8 +243,9 @@  while (0)
 #define SMC_STAT_SERV_SUCC_INC(net, _ini) \
 do { \
 	typeof(_ini) i = (_ini); \
-	bool is_v2 = (i->smcd_version & SMC_V2); \
 	bool is_smcd = (i->is_smcd); \
+	u8 version = is_smcd ? i->smcd_version : i->smcr_version; \
+	bool is_v2 = (version & SMC_V2); \
 	typeof(net->smc.smc_stats) smc_stats = (net)->smc.smc_stats; \
 	if (is_v2 && is_smcd) \
 		this_cpu_inc(smc_stats->smc[SMC_TYPE_D].srv_v2_succ_cnt); \