diff mbox series

[net-next,2/2] net/smc: add sysctl for max conns per lgr for SMC-R v2.1

Message ID 20231122135258.38746-3-guangguan.wang@linux.alibaba.com (mailing list archive)
State Accepted
Commit 1f2c9dd73f0a279214f9b3c382b3f1df272b3253
Delegated to: Netdev Maintainers
Headers show
Series add two sysctl for SMC-R v2.1 | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5483 this patch: 5483
netdev/cc_maintainers success CCed 14 of 14 maintainers
netdev/build_clang success Errors and warnings before: 1386 this patch: 1386
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5821 this patch: 5821
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 69 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Guangguan Wang Nov. 22, 2023, 1:52 p.m. UTC
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>
---
 Documentation/networking/smc-sysctl.rst |  6 ++++++
 include/net/netns/smc.h                 |  1 +
 net/smc/smc_clc.c                       |  5 +++--
 net/smc/smc_sysctl.c                    | 12 ++++++++++++
 net/smc/smc_sysctl.h                    |  1 +
 5 files changed, 23 insertions(+), 2 deletions(-)

Comments

Dust Li Nov. 24, 2023, 5:51 a.m. UTC | #1
On Wed, Nov 22, 2023 at 09:52:58PM +0800, Guangguan Wang wrote:
>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>

>---
> Documentation/networking/smc-sysctl.rst |  6 ++++++
> include/net/netns/smc.h                 |  1 +
> net/smc/smc_clc.c                       |  5 +++--
> net/smc/smc_sysctl.c                    | 12 ++++++++++++
> net/smc/smc_sysctl.h                    |  1 +
> 5 files changed, 23 insertions(+), 2 deletions(-)
>
>diff --git a/Documentation/networking/smc-sysctl.rst b/Documentation/networking/smc-sysctl.rst
>index c6ef86ef4c4f..a874d007f2db 100644
>--- a/Documentation/networking/smc-sysctl.rst
>+++ b/Documentation/networking/smc-sysctl.rst
>@@ -65,3 +65,9 @@ smcr_max_links_per_lgr - INTEGER
> 	for SMC-R v2.1 and later.
> 
> 	Default: 2
>+
>+smcr_max_conns_per_lgr - INTEGER
>+	Controls the max number of connections can be added to a SMC-R link group. The
>+	acceptable value ranges from 16 to 255. Only for SMC-R v2.1 and later.
>+
>+	Default: 255
>diff --git a/include/net/netns/smc.h b/include/net/netns/smc.h
>index da7023587824..fc752a50f91b 100644
>--- a/include/net/netns/smc.h
>+++ b/include/net/netns/smc.h
>@@ -23,5 +23,6 @@ struct netns_smc {
> 	int				sysctl_wmem;
> 	int				sysctl_rmem;
> 	int				sysctl_max_links_per_lgr;
>+	int				sysctl_max_conns_per_lgr;
> };
> #endif
>diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
>index 1f87c8895a27..0fda5156eef0 100644
>--- a/net/smc/smc_clc.c
>+++ b/net/smc/smc_clc.c
>@@ -944,7 +944,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
> 	}
> 	if (smcr_indicated(ini->smc_type_v2)) {
> 		memcpy(v2_ext->roce, ini->smcrv2.ib_gid_v2, SMC_GID_SIZE);
>-		v2_ext->max_conns = SMC_CONN_PER_LGR_PREFER;
>+		v2_ext->max_conns = net->smc.sysctl_max_conns_per_lgr;
> 		v2_ext->max_links = net->smc.sysctl_max_links_per_lgr;
> 	}
> 
>@@ -1191,7 +1191,8 @@ int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
> 		return SMC_CLC_DECL_NOV2EXT;
> 
> 	if (ini->smcr_version & SMC_V2) {
>-		ini->max_conns = min_t(u8, pclc_v2_ext->max_conns, SMC_CONN_PER_LGR_PREFER);
>+		ini->max_conns = min_t(u8, pclc_v2_ext->max_conns,
>+				       net->smc.sysctl_max_conns_per_lgr);
> 		if (ini->max_conns < SMC_CONN_PER_LGR_MIN)
> 			return SMC_CLC_DECL_MAXCONNERR;
> 
>diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
>index 3e9bb921e40a..a5946d1b9d60 100644
>--- a/net/smc/smc_sysctl.c
>+++ b/net/smc/smc_sysctl.c
>@@ -27,6 +27,8 @@ static const int net_smc_wmem_init = (64 * 1024);
> static const int net_smc_rmem_init = (64 * 1024);
> static int links_per_lgr_min = SMC_LINKS_ADD_LNK_MIN;
> static int links_per_lgr_max = SMC_LINKS_ADD_LNK_MAX;
>+static int conns_per_lgr_min = SMC_CONN_PER_LGR_MIN;
>+static int conns_per_lgr_max = SMC_CONN_PER_LGR_MAX;
> 
> static struct ctl_table smc_table[] = {
> 	{
>@@ -79,6 +81,15 @@ static struct ctl_table smc_table[] = {
> 		.extra1		= &links_per_lgr_min,
> 		.extra2		= &links_per_lgr_max,
> 	},
>+	{
>+		.procname	= "smcr_max_conns_per_lgr",
>+		.data		= &init_net.smc.sysctl_max_conns_per_lgr,
>+		.maxlen		= sizeof(int),
>+		.mode		= 0644,
>+		.proc_handler	= proc_dointvec_minmax,
>+		.extra1		= &conns_per_lgr_min,
>+		.extra2		= &conns_per_lgr_max,
>+	},
> 	{  }
> };
> 
>@@ -109,6 +120,7 @@ int __net_init smc_sysctl_net_init(struct net *net)
> 	WRITE_ONCE(net->smc.sysctl_wmem, net_smc_wmem_init);
> 	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;
> 
> 	return 0;
> 
>diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
>index 5783dd7575dd..eb2465ae1e15 100644
>--- a/net/smc/smc_sysctl.h
>+++ b/net/smc/smc_sysctl.h
>@@ -24,6 +24,7 @@ static inline int smc_sysctl_net_init(struct net *net)
> {
> 	net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
> 	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;
> 	return 0;
> }
> 
>-- 
>2.24.3 (Apple Git-128)
Jan Karcher Nov. 24, 2023, 12:22 p.m. UTC | #2
On 22/11/2023 14:52, Guangguan Wang wrote:
> 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>

Hi Guangguan,
thanks for your Submission.

Reviewed-by: Jan Karcher <jaka@linux.ibm.com>

> ---
>   Documentation/networking/smc-sysctl.rst |  6 ++++++
>   include/net/netns/smc.h                 |  1 +
>   net/smc/smc_clc.c                       |  5 +++--
>   net/smc/smc_sysctl.c                    | 12 ++++++++++++
>   net/smc/smc_sysctl.h                    |  1 +
>   5 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/networking/smc-sysctl.rst b/Documentation/networking/smc-sysctl.rst
> index c6ef86ef4c4f..a874d007f2db 100644
> --- a/Documentation/networking/smc-sysctl.rst
> +++ b/Documentation/networking/smc-sysctl.rst
> @@ -65,3 +65,9 @@ smcr_max_links_per_lgr - INTEGER
>   	for SMC-R v2.1 and later.
>   
>   	Default: 2
> +
> +smcr_max_conns_per_lgr - INTEGER
> +	Controls the max number of connections can be added to a SMC-R link group. The
> +	acceptable value ranges from 16 to 255. Only for SMC-R v2.1 and later.
> +
> +	Default: 255
> diff --git a/include/net/netns/smc.h b/include/net/netns/smc.h
> index da7023587824..fc752a50f91b 100644
> --- a/include/net/netns/smc.h
> +++ b/include/net/netns/smc.h
> @@ -23,5 +23,6 @@ struct netns_smc {
>   	int				sysctl_wmem;
>   	int				sysctl_rmem;
>   	int				sysctl_max_links_per_lgr;
> +	int				sysctl_max_conns_per_lgr;
>   };
>   #endif
> diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
> index 1f87c8895a27..0fda5156eef0 100644
> --- a/net/smc/smc_clc.c
> +++ b/net/smc/smc_clc.c
> @@ -944,7 +944,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
>   	}
>   	if (smcr_indicated(ini->smc_type_v2)) {
>   		memcpy(v2_ext->roce, ini->smcrv2.ib_gid_v2, SMC_GID_SIZE);
> -		v2_ext->max_conns = SMC_CONN_PER_LGR_PREFER;
> +		v2_ext->max_conns = net->smc.sysctl_max_conns_per_lgr;
>   		v2_ext->max_links = net->smc.sysctl_max_links_per_lgr;
>   	}
>   
> @@ -1191,7 +1191,8 @@ int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
>   		return SMC_CLC_DECL_NOV2EXT;
>   
>   	if (ini->smcr_version & SMC_V2) {
> -		ini->max_conns = min_t(u8, pclc_v2_ext->max_conns, SMC_CONN_PER_LGR_PREFER);
> +		ini->max_conns = min_t(u8, pclc_v2_ext->max_conns,
> +				       net->smc.sysctl_max_conns_per_lgr);
>   		if (ini->max_conns < SMC_CONN_PER_LGR_MIN)
>   			return SMC_CLC_DECL_MAXCONNERR;
>   
> diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
> index 3e9bb921e40a..a5946d1b9d60 100644
> --- a/net/smc/smc_sysctl.c
> +++ b/net/smc/smc_sysctl.c
> @@ -27,6 +27,8 @@ static const int net_smc_wmem_init = (64 * 1024);
>   static const int net_smc_rmem_init = (64 * 1024);
>   static int links_per_lgr_min = SMC_LINKS_ADD_LNK_MIN;
>   static int links_per_lgr_max = SMC_LINKS_ADD_LNK_MAX;
> +static int conns_per_lgr_min = SMC_CONN_PER_LGR_MIN;
> +static int conns_per_lgr_max = SMC_CONN_PER_LGR_MAX;
>   
>   static struct ctl_table smc_table[] = {
>   	{
> @@ -79,6 +81,15 @@ static struct ctl_table smc_table[] = {
>   		.extra1		= &links_per_lgr_min,
>   		.extra2		= &links_per_lgr_max,
>   	},
> +	{
> +		.procname	= "smcr_max_conns_per_lgr",
> +		.data		= &init_net.smc.sysctl_max_conns_per_lgr,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0644,
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= &conns_per_lgr_min,
> +		.extra2		= &conns_per_lgr_max,
> +	},
>   	{  }
>   };
>   
> @@ -109,6 +120,7 @@ int __net_init smc_sysctl_net_init(struct net *net)
>   	WRITE_ONCE(net->smc.sysctl_wmem, net_smc_wmem_init);
>   	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;
>   
>   	return 0;
>   
> diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
> index 5783dd7575dd..eb2465ae1e15 100644
> --- a/net/smc/smc_sysctl.h
> +++ b/net/smc/smc_sysctl.h
> @@ -24,6 +24,7 @@ static inline int smc_sysctl_net_init(struct net *net)
>   {
>   	net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
>   	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;
>   	return 0;
>   }
>
diff mbox series

Patch

diff --git a/Documentation/networking/smc-sysctl.rst b/Documentation/networking/smc-sysctl.rst
index c6ef86ef4c4f..a874d007f2db 100644
--- a/Documentation/networking/smc-sysctl.rst
+++ b/Documentation/networking/smc-sysctl.rst
@@ -65,3 +65,9 @@  smcr_max_links_per_lgr - INTEGER
 	for SMC-R v2.1 and later.
 
 	Default: 2
+
+smcr_max_conns_per_lgr - INTEGER
+	Controls the max number of connections can be added to a SMC-R link group. The
+	acceptable value ranges from 16 to 255. Only for SMC-R v2.1 and later.
+
+	Default: 255
diff --git a/include/net/netns/smc.h b/include/net/netns/smc.h
index da7023587824..fc752a50f91b 100644
--- a/include/net/netns/smc.h
+++ b/include/net/netns/smc.h
@@ -23,5 +23,6 @@  struct netns_smc {
 	int				sysctl_wmem;
 	int				sysctl_rmem;
 	int				sysctl_max_links_per_lgr;
+	int				sysctl_max_conns_per_lgr;
 };
 #endif
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index 1f87c8895a27..0fda5156eef0 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -944,7 +944,7 @@  int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
 	}
 	if (smcr_indicated(ini->smc_type_v2)) {
 		memcpy(v2_ext->roce, ini->smcrv2.ib_gid_v2, SMC_GID_SIZE);
-		v2_ext->max_conns = SMC_CONN_PER_LGR_PREFER;
+		v2_ext->max_conns = net->smc.sysctl_max_conns_per_lgr;
 		v2_ext->max_links = net->smc.sysctl_max_links_per_lgr;
 	}
 
@@ -1191,7 +1191,8 @@  int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
 		return SMC_CLC_DECL_NOV2EXT;
 
 	if (ini->smcr_version & SMC_V2) {
-		ini->max_conns = min_t(u8, pclc_v2_ext->max_conns, SMC_CONN_PER_LGR_PREFER);
+		ini->max_conns = min_t(u8, pclc_v2_ext->max_conns,
+				       net->smc.sysctl_max_conns_per_lgr);
 		if (ini->max_conns < SMC_CONN_PER_LGR_MIN)
 			return SMC_CLC_DECL_MAXCONNERR;
 
diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
index 3e9bb921e40a..a5946d1b9d60 100644
--- a/net/smc/smc_sysctl.c
+++ b/net/smc/smc_sysctl.c
@@ -27,6 +27,8 @@  static const int net_smc_wmem_init = (64 * 1024);
 static const int net_smc_rmem_init = (64 * 1024);
 static int links_per_lgr_min = SMC_LINKS_ADD_LNK_MIN;
 static int links_per_lgr_max = SMC_LINKS_ADD_LNK_MAX;
+static int conns_per_lgr_min = SMC_CONN_PER_LGR_MIN;
+static int conns_per_lgr_max = SMC_CONN_PER_LGR_MAX;
 
 static struct ctl_table smc_table[] = {
 	{
@@ -79,6 +81,15 @@  static struct ctl_table smc_table[] = {
 		.extra1		= &links_per_lgr_min,
 		.extra2		= &links_per_lgr_max,
 	},
+	{
+		.procname	= "smcr_max_conns_per_lgr",
+		.data		= &init_net.smc.sysctl_max_conns_per_lgr,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &conns_per_lgr_min,
+		.extra2		= &conns_per_lgr_max,
+	},
 	{  }
 };
 
@@ -109,6 +120,7 @@  int __net_init smc_sysctl_net_init(struct net *net)
 	WRITE_ONCE(net->smc.sysctl_wmem, net_smc_wmem_init);
 	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;
 
 	return 0;
 
diff --git a/net/smc/smc_sysctl.h b/net/smc/smc_sysctl.h
index 5783dd7575dd..eb2465ae1e15 100644
--- a/net/smc/smc_sysctl.h
+++ b/net/smc/smc_sysctl.h
@@ -24,6 +24,7 @@  static inline int smc_sysctl_net_init(struct net *net)
 {
 	net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE;
 	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;
 	return 0;
 }