Skip to content

Commit 1f2c9dd

Browse files
Guangguan Wangdavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Dust Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f8e80fc commit 1f2c9dd

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
@@ -65,3 +65,9 @@ smcr_max_links_per_lgr - INTEGER
6565
for SMC-R v2.1 and later.
6666

6767
Default: 2
68+
69+
smcr_max_conns_per_lgr - INTEGER
70+
Controls the max number of connections can be added to a SMC-R link group. The
71+
acceptable value ranges from 16 to 255. Only for SMC-R v2.1 and later.
72+
73+
Default: 255

include/net/netns/smc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ struct netns_smc {
2323
int sysctl_wmem;
2424
int sysctl_rmem;
2525
int sysctl_max_links_per_lgr;
26+
int sysctl_max_conns_per_lgr;
2627
};
2728
#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
@@ -27,6 +27,8 @@ static const int net_smc_wmem_init = (64 * 1024);
2727
static const int net_smc_rmem_init = (64 * 1024);
2828
static int links_per_lgr_min = SMC_LINKS_ADD_LNK_MIN;
2929
static int links_per_lgr_max = SMC_LINKS_ADD_LNK_MAX;
30+
static int conns_per_lgr_min = SMC_CONN_PER_LGR_MIN;
31+
static int conns_per_lgr_max = SMC_CONN_PER_LGR_MAX;
3032

3133
static struct ctl_table smc_table[] = {
3234
{
@@ -79,6 +81,15 @@ static struct ctl_table smc_table[] = {
7981
.extra1 = &links_per_lgr_min,
8082
.extra2 = &links_per_lgr_max,
8183
},
84+
{
85+
.procname = "smcr_max_conns_per_lgr",
86+
.data = &init_net.smc.sysctl_max_conns_per_lgr,
87+
.maxlen = sizeof(int),
88+
.mode = 0644,
89+
.proc_handler = proc_dointvec_minmax,
90+
.extra1 = &conns_per_lgr_min,
91+
.extra2 = &conns_per_lgr_max,
92+
},
8293
{ }
8394
};
8495

@@ -109,6 +120,7 @@ int __net_init smc_sysctl_net_init(struct net *net)
109120
WRITE_ONCE(net->smc.sysctl_wmem, net_smc_wmem_init);
110121
WRITE_ONCE(net->smc.sysctl_rmem, net_smc_rmem_init);
111122
net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
123+
net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
112124

113125
return 0;
114126

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)