Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/smc: Introduce a specific sysctl for TEST_LINK time

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>

authored by

Wen Gu and committed by
Paolo Abeni
77eee325 9b17dbd9

+19 -1
+7
Documentation/networking/smc-sysctl.rst
··· 34 34 - 1 - Use virtually contiguous buffers 35 35 - 2 - Mixed use of the two types. Try physically contiguous buffers first. 36 36 If not available, use virtually contiguous buffers then. 37 + 38 + smcr_testlink_time - INTEGER 39 + How frequently SMC-R link sends out TEST_LINK LLC messages to confirm 40 + viability, after the last activity of connections on it. Value 0 means 41 + disabling TEST_LINK. 42 + 43 + Default: 30 seconds.
+1
include/net/netns/smc.h
··· 19 19 #endif 20 20 unsigned int sysctl_autocorking_size; 21 21 unsigned int sysctl_smcr_buf_type; 22 + int sysctl_smcr_testlink_time; 22 23 }; 23 24 #endif
+1 -1
net/smc/smc_llc.c
··· 2127 2127 init_waitqueue_head(&lgr->llc_flow_waiter); 2128 2128 init_waitqueue_head(&lgr->llc_msg_waiter); 2129 2129 mutex_init(&lgr->llc_conf_mutex); 2130 - lgr->llc_testlink_time = READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time); 2130 + lgr->llc_testlink_time = READ_ONCE(net->smc.sysctl_smcr_testlink_time); 2131 2131 } 2132 2132 2133 2133 /* called after lgr was removed from lgr_list */
+1
net/smc/smc_llc.h
··· 19 19 20 20 #define SMC_LLC_WAIT_FIRST_TIME (5 * HZ) 21 21 #define SMC_LLC_WAIT_TIME (2 * HZ) 22 + #define SMC_LLC_TESTLINK_DEFAULT_TIME (30 * HZ) 22 23 23 24 enum smc_llc_reqresp { 24 25 SMC_LLC_REQ,
+9
net/smc/smc_sysctl.c
··· 16 16 17 17 #include "smc.h" 18 18 #include "smc_core.h" 19 + #include "smc_llc.h" 19 20 #include "smc_sysctl.h" 20 21 21 22 static struct ctl_table smc_table[] = { ··· 35 34 .proc_handler = proc_douintvec_minmax, 36 35 .extra1 = SYSCTL_ZERO, 37 36 .extra2 = SYSCTL_TWO, 37 + }, 38 + { 39 + .procname = "smcr_testlink_time", 40 + .data = &init_net.smc.sysctl_smcr_testlink_time, 41 + .maxlen = sizeof(int), 42 + .mode = 0644, 43 + .proc_handler = proc_dointvec_jiffies, 38 44 }, 39 45 { } 40 46 }; ··· 68 60 69 61 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; 70 62 net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS; 63 + net->smc.sysctl_smcr_testlink_time = SMC_LLC_TESTLINK_DEFAULT_TIME; 71 64 72 65 return 0; 73 66