net/smc: bugfix for smcr v2 server connect success statistic
authorGuangguan Wang <guangguan.wang@linux.alibaba.com>
Fri, 8 Sep 2023 03:31:42 +0000 (11:31 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 10 Sep 2023 18:31:42 +0000 (19:31 +0100)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_stats.h

index b60fe1e..aa89289 100644 (file)
@@ -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); \