@@ -17,5 +17,6 @@ struct netns_smc {
#endif
int sysctl_wmem_default;
int sysctl_rmem_default;
+ int sysctl_max_lgr_conns;
};
#endif
@@ -2937,6 +2937,7 @@ static __net_init int smc_net_init(struct net *net)
SMC_BUF_MIN_SIZE);
net->smc.sysctl_rmem_default = max(net->ipv4.sysctl_tcp_rmem[1],
SMC_BUF_MIN_SIZE);
+ net->smc.sysctl_max_lgr_conns = SMC_RMBS_PER_LGR_MAX;
return smc_pnet_net_init(net);
}
@@ -1817,7 +1817,7 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
(ini->smcd_version == SMC_V2 ||
lgr->vlan_id == ini->vlan_id) &&
(role == SMC_CLNT || ini->is_smcd ||
- lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) {
+ lgr->conns_num < net->smc.sysctl_max_lgr_conns)) {
/* link group found */
ini->first_contact_local = 0;
conn->lgr = lgr;
@@ -10,6 +10,8 @@
static int min_sndbuf = SMC_BUF_MIN_SIZE;
static int min_rcvbuf = SMC_BUF_MIN_SIZE;
+static int min_lgr_conns = 1;
+static int max_lgr_conns = SMC_RMBS_PER_LGR_MAX;
static struct ctl_table smc_table[] = {
{
@@ -28,6 +30,15 @@ static struct ctl_table smc_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_rcvbuf,
},
+ {
+ .procname = "max_lgr_conns",
+ .data = &init_net.smc.sysctl_max_lgr_conns,
+ .maxlen = sizeof(init_net.smc.sysctl_max_lgr_conns),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &min_lgr_conns,
+ .extra2 = &max_lgr_conns,
+ },
{ }
};
This introduces tunable sysctl knob max_lgr_conns to tune the max connections in one linkgroup. This knob is net-namespaceify. Currently, a linkgroup is shared by SMC_RMBS_PER_LGR_MAX connectiosn at max, which is 255. This shares one QP, and introduces more competition, as connections increases, such as smc_cdc_get_free_slot(), it shares link-level slots. The environment and scenario are different, so this makes it possible to tunable by users, to save linkgroup resources or reduce competition and increase performance. Signed-off-by: Tony Lu <tonylu@linux.alibaba.com> --- include/net/netns/smc.h | 1 + net/smc/af_smc.c | 1 + net/smc/smc_core.c | 2 +- net/smc/smc_sysctl.c | 11 +++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-)