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

net/smc: Introduce a sysctl for setting SMC-R buffer type

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>

authored by

Wen Gu and committed by
David S. Miller
4bc5008e 0ef69e78

+31
+13
Documentation/networking/smc-sysctl.rst
··· 21 21 know how/when to uncork their sockets. 22 22 23 23 Default: 64K 24 + 25 + smcr_buf_type - INTEGER 26 + Controls which type of sndbufs and RMBs to use in later newly created 27 + SMC-R link group. Only for SMC-R. 28 + 29 + Default: 0 (physically contiguous sndbufs and RMBs) 30 + 31 + Possible values: 32 + 33 + - 0 - Use physically contiguous buffers 34 + - 1 - Use virtually contiguous buffers 35 + - 2 - Mixed use of the two types. Try physically contiguous buffers first. 36 + If not available, use virtually contiguous buffers then.
+1
include/net/netns/smc.h
··· 18 18 struct ctl_table_header *smc_hdr; 19 19 #endif 20 20 unsigned int sysctl_autocorking_size; 21 + unsigned int sysctl_smcr_buf_type; 21 22 }; 22 23 #endif
+6
net/smc/smc_core.h
··· 217 217 SMC_LGR_ASYMMETRIC_LOCAL, /* local has 1, peer 2 active RNICs */ 218 218 }; 219 219 220 + enum smcr_buf_type { /* types of SMC-R sndbufs and RMBs */ 221 + SMCR_PHYS_CONT_BUFS = 0, 222 + SMCR_VIRT_CONT_BUFS = 1, 223 + SMCR_MIXED_BUFS = 2, 224 + }; 225 + 220 226 enum smc_llc_flowtype { 221 227 SMC_LLC_FLOW_NONE = 0, 222 228 SMC_LLC_FLOW_ADD_LINK = 2,
+11
net/smc/smc_sysctl.c
··· 15 15 #include <net/net_namespace.h> 16 16 17 17 #include "smc.h" 18 + #include "smc_core.h" 18 19 #include "smc_sysctl.h" 19 20 20 21 static struct ctl_table smc_table[] = { ··· 25 24 .maxlen = sizeof(unsigned int), 26 25 .mode = 0644, 27 26 .proc_handler = proc_douintvec, 27 + }, 28 + { 29 + .procname = "smcr_buf_type", 30 + .data = &init_net.smc.sysctl_smcr_buf_type, 31 + .maxlen = sizeof(unsigned int), 32 + .mode = 0644, 33 + .proc_handler = proc_douintvec_minmax, 34 + .extra1 = SYSCTL_ZERO, 35 + .extra2 = SYSCTL_TWO, 28 36 }, 29 37 { } 30 38 }; ··· 59 49 goto err_reg; 60 50 61 51 net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; 52 + net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS; 62 53 63 54 return 0; 64 55