net/smc: Introduce a specific sysctl for TEST_LINK time
authorWen Gu <guwen@linux.alibaba.com>
Tue, 20 Sep 2022 09:52:21 +0000 (17:52 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 22 Sep 2022 10:58:21 +0000 (12:58 +0200)
SMC-R tests the viability of link by sending out TEST_LINK LLC
messages over RoCE fabric when connections on link have been
idle for a time longer than keepalive interval (testlink time).

But using tcp_keepalive_time as testlink time maybe not quite
suitable because it is default no less than two hours[1], which
is too long for single link to find peer dead. The active host
will still use peer-dead link (QP) sending messages, and can't
find out until get IB_WC_RETRY_EXC_ERR error CQEs, which takes
more time than TEST_LINK timeout (SMC_LLC_WAIT_TIME) normally.

So this patch introduces a independent sysctl for SMC-R to set
link keepalive time, in order to detect link down in time. The
default value is 30 seconds.

[1] https://www.rfc-editor.org/rfc/rfc1122#page-101

Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Documentation/networking/smc-sysctl.rst
include/net/netns/smc.h
net/smc/smc_llc.c
net/smc/smc_llc.h
net/smc/smc_sysctl.c

index 742e90e6d822fcf90965c239392a82cd29268d70..45ba1522e189a34a2d26499f7691b354937122b8 100644 (file)
@@ -34,3 +34,10 @@ smcr_buf_type - INTEGER
         - 1 - Use virtually contiguous buffers
         - 2 - Mixed use of the two types. Try physically contiguous buffers first.
           If not available, use virtually contiguous buffers then.
+
+smcr_testlink_time - INTEGER
+       How frequently SMC-R link sends out TEST_LINK LLC messages to confirm
+       viability, after the last activity of connections on it. Value 0 means
+       disabling TEST_LINK.
+
+       Default: 30 seconds.
index 2adbe2b245df8b548b2aa895d037e7f789878bb9..d295e2c10dcaf31946b1f8f93ff6f88911ea4ceb 100644 (file)
@@ -19,5 +19,6 @@ struct netns_smc {
 #endif
        unsigned int                    sysctl_autocorking_size;
        unsigned int                    sysctl_smcr_buf_type;
+       int                             sysctl_smcr_testlink_time;
 };
 #endif
index 175026ae33ae9e39f0466c006a06b2ce1725bdab..524649d0ab6520484b25f410d83b31f78793df5b 100644 (file)
@@ -2127,7 +2127,7 @@ void smc_llc_lgr_init(struct smc_link_group *lgr, struct smc_sock *smc)
        init_waitqueue_head(&lgr->llc_flow_waiter);
        init_waitqueue_head(&lgr->llc_msg_waiter);
        mutex_init(&lgr->llc_conf_mutex);
-       lgr->llc_testlink_time = READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time);
+       lgr->llc_testlink_time = READ_ONCE(net->smc.sysctl_smcr_testlink_time);
 }
 
 /* called after lgr was removed from lgr_list */
index 4404e52b3346fbc51855667fb4832f32a9987ef9..7e7a3162c68b3d9923a9a5ed4315ec67c4c5fb85 100644 (file)
@@ -19,6 +19,7 @@
 
 #define SMC_LLC_WAIT_FIRST_TIME                (5 * HZ)
 #define SMC_LLC_WAIT_TIME              (2 * HZ)
+#define SMC_LLC_TESTLINK_DEFAULT_TIME  (30 * HZ)
 
 enum smc_llc_reqresp {
        SMC_LLC_REQ,
index 0613868fdb979bc14d6a8989066503393e06cc23..3224d303cc9d43d619888630c0d08b6adf37867b 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "smc.h"
 #include "smc_core.h"
+#include "smc_llc.h"
 #include "smc_sysctl.h"
 
 static struct ctl_table smc_table[] = {
@@ -35,6 +36,13 @@ static struct ctl_table smc_table[] = {
                .extra1         = SYSCTL_ZERO,
                .extra2         = SYSCTL_TWO,
        },
+       {
+               .procname       = "smcr_testlink_time",
+               .data           = &init_net.smc.sysctl_smcr_testlink_time,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_jiffies,
+       },
        {  }
 };
 
@@ -60,6 +68,7 @@ int __net_init smc_sysctl_net_init(struct net *net)
 
        net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
        net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS;
+       net->smc.sysctl_smcr_testlink_time = SMC_LLC_TESTLINK_DEFAULT_TIME;
 
        return 0;