Skip to content

Commit 03319ea

Browse files
author
Mete Durlu
committed
net/smc: add sysctl for max conns per lgr for SMC-R v2.1
JIRA: https://issues.redhat.com/browse/RHEL-73484 Conflicts: Code changes necessary to adapt to existing differences to upstream - no functional change commit 1f2c9dd Author: Guangguan Wang <guangguan.wang@linux.alibaba.com> Date: Wed Nov 22 21:52:58 2023 +0800 net/smc: add sysctl for max conns per lgr for SMC-R v2.1 Add a new sysctl: net.smc.smcr_max_conns_per_lgr, which is used to control the preferred max connections per lgr for SMC-R v2.1. The default value of this sysctl is 255, and the acceptable value ranges from 16 to 255. Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Mete Durlu <mdurlu@redhat.com>
1 parent 3d495f3 commit 03319ea

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

Documentation/networking/smc-sysctl.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,9 @@ smcr_max_links_per_lgr - INTEGER
4949
for SMC-R v2.1 and later.
5050

5151
Default: 2
52+
53+
smcr_max_conns_per_lgr - INTEGER
54+
Controls the max number of connections can be added to a SMC-R link group. The
55+
acceptable value ranges from 16 to 255. Only for SMC-R v2.1 and later.
56+
57+
Default: 255

include/net/netns/smc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ struct netns_smc {
2121
unsigned int sysctl_smcr_buf_type;
2222
int sysctl_smcr_testlink_time;
2323
int sysctl_max_links_per_lgr;
24+
int sysctl_max_conns_per_lgr;
2425
};
2526
#endif

net/smc/smc_clc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
944944
}
945945
if (smcr_indicated(ini->smc_type_v2)) {
946946
memcpy(v2_ext->roce, ini->smcrv2.ib_gid_v2, SMC_GID_SIZE);
947-
v2_ext->max_conns = SMC_CONN_PER_LGR_PREFER;
947+
v2_ext->max_conns = net->smc.sysctl_max_conns_per_lgr;
948948
v2_ext->max_links = net->smc.sysctl_max_links_per_lgr;
949949
}
950950

@@ -1191,7 +1191,8 @@ int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
11911191
return SMC_CLC_DECL_NOV2EXT;
11921192

11931193
if (ini->smcr_version & SMC_V2) {
1194-
ini->max_conns = min_t(u8, pclc_v2_ext->max_conns, SMC_CONN_PER_LGR_PREFER);
1194+
ini->max_conns = min_t(u8, pclc_v2_ext->max_conns,
1195+
net->smc.sysctl_max_conns_per_lgr);
11951196
if (ini->max_conns < SMC_CONN_PER_LGR_MIN)
11961197
return SMC_CLC_DECL_MAXCONNERR;
11971198

net/smc/smc_sysctl.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
static int links_per_lgr_min = SMC_LINKS_ADD_LNK_MIN;
2323
static int links_per_lgr_max = SMC_LINKS_ADD_LNK_MAX;
24+
static int conns_per_lgr_min = SMC_CONN_PER_LGR_MIN;
25+
static int conns_per_lgr_max = SMC_CONN_PER_LGR_MAX;
2426

2527
static struct ctl_table smc_table[] = {
2628
{
@@ -55,6 +57,15 @@ static struct ctl_table smc_table[] = {
5557
.extra1 = &links_per_lgr_min,
5658
.extra2 = &links_per_lgr_max,
5759
},
60+
{
61+
.procname = "smcr_max_conns_per_lgr",
62+
.data = &init_net.smc.sysctl_max_conns_per_lgr,
63+
.maxlen = sizeof(int),
64+
.mode = 0644,
65+
.proc_handler = proc_dointvec_minmax,
66+
.extra1 = &conns_per_lgr_min,
67+
.extra2 = &conns_per_lgr_max,
68+
},
5869
{ }
5970
};
6071

@@ -82,6 +93,7 @@ int __net_init smc_sysctl_net_init(struct net *net)
8293
net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS;
8394
net->smc.sysctl_smcr_testlink_time = SMC_LLC_TESTLINK_DEFAULT_TIME;
8495
net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
96+
net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
8597

8698
return 0;
8799

net/smc/smc_sysctl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ static inline int smc_sysctl_net_init(struct net *net)
2424
{
2525
net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
2626
net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
27+
net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
2728
return 0;
2829
}
2930

0 commit comments

Comments
 (0)