mainline inclusion from mainline-v6.0-rc1 commit 4bc5008e4387106215b50ae1a4ac2467455725ca category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I76JHC CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/ne...
--------------------------------
This patch introduces the sysctl smcr_buf_type for setting the type of SMC-R sndbufs and RMBs.
Valid values includes:
- SMCR_PHYS_CONT_BUFS, which means use physically contiguous buffers for better performance and is the default value.
- SMCR_VIRT_CONT_BUFS, which means use virtually contiguous buffers in case of physically contiguous memory is scarce.
- SMCR_MIXED_BUFS, which means first try to use physically contiguous buffers. If not available, then use virtually contiguous buffers.
Signed-off-by: Wen Gu guwen@linux.alibaba.com Signed-off-by: David S. Miller davem@davemloft.net Signed-off-by: Litao Jiao jiaolitao@sangfor.com.cn --- Documentation/networking/smc-sysctl.rst | 21 +++++++++++++++++++++ include/net/netns/smc.h | 1 + net/smc/smc_core.h | 6 ++++++ net/smc/smc_sysctl.c | 14 ++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 Documentation/networking/smc-sysctl.rst
diff --git a/Documentation/networking/smc-sysctl.rst b/Documentation/networking/smc-sysctl.rst new file mode 100644 index 000000000000..3f0187ffc2a5 --- /dev/null +++ b/Documentation/networking/smc-sysctl.rst @@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========== +SMC Sysctl +========== + +/proc/sys/net/smc/* Variables +============================= + +smcr_buf_type - INTEGER + Controls which type of sndbufs and RMBs to use in later newly created + SMC-R link group. Only for SMC-R. + + Default: 0 (physically contiguous sndbufs and RMBs) + + Possible values: + + - 0 - Use physically contiguous buffers + - 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. diff --git a/include/net/netns/smc.h b/include/net/netns/smc.h index 0a7d25a124e9..38396599938c 100644 --- a/include/net/netns/smc.h +++ b/include/net/netns/smc.h @@ -6,5 +6,6 @@ struct netns_smc { #ifdef CONFIG_SYSCTL struct ctl_table_header *smc_hdr; #endif + unsigned int sysctl_smcr_buf_type; }; #endif diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 9364d0f35cce..5ac5d7ac833b 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -198,6 +198,12 @@ enum smc_lgr_type { /* redundancy state of lgr */ SMC_LGR_ASYMMETRIC_LOCAL, /* local has 1, peer 2 active RNICs */ };
+enum smcr_buf_type { /* types of SMC-R sndbufs and RMBs */ + SMCR_PHYS_CONT_BUFS = 0, + SMCR_VIRT_CONT_BUFS = 1, + SMCR_MIXED_BUFS = 2, +}; + enum smc_llc_flowtype { SMC_LLC_FLOW_NONE = 0, SMC_LLC_FLOW_ADD_LINK = 2, diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c index e06ecf0e7c84..81faae0d1b7b 100644 --- a/net/smc/smc_sysctl.c +++ b/net/smc/smc_sysctl.c @@ -15,8 +15,20 @@ #include <net/net_namespace.h>
#include "smc_sysctl.h" +#include "smc_core.h" + +static int two = 2;
static struct ctl_table smc_table[] = { + { + .procname = "smcr_buf_type", + .data = &init_net.smc.sysctl_smcr_buf_type, + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = proc_douintvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = &two, + }, { } };
@@ -40,6 +52,8 @@ int __net_init smc_sysctl_net_init(struct net *net) if (!net->smc.smc_hdr) goto err_reg;
+ net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS; + return 0;
err_reg: