Skip to content

Commit

Permalink
net/smc: Introduce a sysctl for setting SMC-R buffer type
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Wen Gu authored and davem330 committed Jul 18, 2022
1 parent 0ef69e7 commit 4bc5008
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Documentation/networking/smc-sysctl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,16 @@ autocorking_size - INTEGER
know how/when to uncork their sockets.

Default: 64K

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.
1 change: 1 addition & 0 deletions include/net/netns/smc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ struct netns_smc {
struct ctl_table_header *smc_hdr;
#endif
unsigned int sysctl_autocorking_size;
unsigned int sysctl_smcr_buf_type;
};
#endif
6 changes: 6 additions & 0 deletions net/smc/smc_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,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,
Expand Down
11 changes: 11 additions & 0 deletions net/smc/smc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <net/net_namespace.h>

#include "smc.h"
#include "smc_core.h"
#include "smc_sysctl.h"

static struct ctl_table smc_table[] = {
Expand All @@ -25,6 +26,15 @@ static struct ctl_table smc_table[] = {
.mode = 0644,
.proc_handler = proc_douintvec,
},
{
.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 = SYSCTL_TWO,
},
{ }
};

Expand All @@ -49,6 +59,7 @@ int __net_init smc_sysctl_net_init(struct net *net)
goto err_reg;

net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS;

return 0;

Expand Down

0 comments on commit 4bc5008

Please sign in to comment.