]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net/smc: add sysctl for smc_limit_hs
authorD. Wythe <alibuda@linux.alibaba.com>
Fri, 6 Sep 2024 02:35:35 +0000 (10:35 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 10 Sep 2024 10:11:04 +0000 (12:11 +0200)
In commit 48b6190a0042 ("net/smc: Limit SMC visits when handshake workqueue congested"),
we introduce a mechanism to put constraint on SMC connections visit
according to the pressure of SMC handshake process.

At that time, we believed that controlling the feature through netlink
was sufficient. However, most people have realized now that netlink is
not convenient in container scenarios, and sysctl is a more suitable
approach.

In addition, since commit 462791bbfa35 ("net/smc: add sysctl interface for SMC")
had introcuded smc_sysctl_net_init(), it is reasonable for us to
initialize limit_smc_hs in it instead of initializing it in
smc_pnet_net_int().

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Link: https://patch.msgid.link/1725590135-5631-1-git-send-email-alibuda@linux.alibaba.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/smc/smc_pnet.c
net/smc/smc_sysctl.c

index 2adb92b8c4699c592eddeefb4222f70713d13895..1dd362326c0a8e220eb43122b05d6d8f4805eb1b 100644 (file)
@@ -887,9 +887,6 @@ int smc_pnet_net_init(struct net *net)
 
        smc_pnet_create_pnetids_list(net);
 
-       /* disable handshake limitation by default */
-       net->smc.limit_smc_hs = 0;
-
        return 0;
 }
 
index 13f2bc092db1bbdebe3ba9cd6204217d4fb5c102..2fab6456f76547e68e55bef964f0f3d4320f3d18 100644 (file)
@@ -90,6 +90,15 @@ static struct ctl_table smc_table[] = {
                .extra1         = &conns_per_lgr_min,
                .extra2         = &conns_per_lgr_max,
        },
+       {
+               .procname       = "limit_smc_hs",
+               .data           = &init_net.smc.limit_smc_hs,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
+       },
 };
 
 int __net_init smc_sysctl_net_init(struct net *net)
@@ -121,6 +130,8 @@ int __net_init smc_sysctl_net_init(struct net *net)
        WRITE_ONCE(net->smc.sysctl_rmem, net_smc_rmem_init);
        net->smc.sysctl_max_links_per_lgr = SMC_LINKS_PER_LGR_MAX_PREFER;
        net->smc.sysctl_max_conns_per_lgr = SMC_CONN_PER_LGR_PREFER;
+       /* disable handshake limitation by default */
+       net->smc.limit_smc_hs = 0;
 
        return 0;