Commit 1ad04b79 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'smc-sysctl'



Guangguan Wang says:

===================
add two sysctl for SMC-R v2.1

This patch set add two sysctl for SMC-R v2.1:
net.smc.smcr_max_links_per_lgr is used to control the max links
per lgr.
net.smc.smcr_max_conns_per_lgr is used to control the max connections
per lgr.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a8d4879d 1f2c9dd7
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -57,3 +57,17 @@ rmem - INTEGER
	only allowed 512KiB for SMC-R and 1MiB for SMC-D.

	Default: 64KiB

smcr_max_links_per_lgr - INTEGER
	Controls the max number of links can be added to a SMC-R link group. Notice that
	the actual number of the links added to a SMC-R link group depends on the number
	of RDMA devices exist in the system. The acceptable value ranges from 1 to 2. Only
	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
+2 −0
Original line number Diff line number Diff line
@@ -22,5 +22,7 @@ struct netns_smc {
	int				sysctl_smcr_testlink_time;
	int				sysctl_wmem;
	int				sysctl_rmem;
	int				sysctl_max_links_per_lgr;
	int				sysctl_max_conns_per_lgr;
};
#endif
+1 −1
Original line number Diff line number Diff line
@@ -2461,7 +2461,7 @@ static void smc_listen_work(struct work_struct *work)
	if (rc)
		goto out_decl;

	rc = smc_clc_srv_v2x_features_validate(pclc, ini);
	rc = smc_clc_srv_v2x_features_validate(new_smc, pclc, ini);
	if (rc)
		goto out_decl;

+10 −5
Original line number Diff line number Diff line
@@ -824,6 +824,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
	struct smc_clc_smcd_gid_chid *gidchids;
	struct smc_clc_msg_proposal_area *pclc;
	struct smc_clc_ipv6_prefix *ipv6_prfx;
	struct net *net = sock_net(&smc->sk);
	struct smc_clc_v2_extension *v2_ext;
	struct smc_clc_msg_smcd *pclc_smcd;
	struct smc_clc_msg_trail *trl;
@@ -943,8 +944,8 @@ 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_links = SMC_LINKS_PER_LGR_MAX_PREFER;
		v2_ext->max_conns = net->smc.sysctl_max_conns_per_lgr;
		v2_ext->max_links = net->smc.sysctl_max_links_per_lgr;
	}

	pclc_base->hdr.length = htons(plen);
@@ -1171,10 +1172,12 @@ int smc_clc_send_accept(struct smc_sock *new_smc, bool srv_first_contact,
	return len > 0 ? 0 : len;
}

int smc_clc_srv_v2x_features_validate(struct smc_clc_msg_proposal *pclc,
int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
				      struct smc_clc_msg_proposal *pclc,
				      struct smc_init_info *ini)
{
	struct smc_clc_v2_extension *pclc_v2_ext;
	struct net *net = sock_net(&smc->sk);

	ini->max_conns = SMC_CONN_PER_LGR_MAX;
	ini->max_links = SMC_LINKS_ADD_LNK_MAX;
@@ -1188,11 +1191,13 @@ int smc_clc_srv_v2x_features_validate(struct smc_clc_msg_proposal *pclc,
		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;

		ini->max_links = min_t(u8, pclc_v2_ext->max_links, SMC_LINKS_PER_LGR_MAX_PREFER);
		ini->max_links = min_t(u8, pclc_v2_ext->max_links,
				       net->smc.sysctl_max_links_per_lgr);
		if (ini->max_links < SMC_LINKS_ADD_LNK_MIN)
			return SMC_CLC_DECL_MAXLINKERR;
	}
+2 −1
Original line number Diff line number Diff line
@@ -422,7 +422,8 @@ int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact,
			 u8 version, u8 *eid, struct smc_init_info *ini);
int smc_clc_send_accept(struct smc_sock *smc, bool srv_first_contact,
			u8 version, u8 *negotiated_eid, struct smc_init_info *ini);
int smc_clc_srv_v2x_features_validate(struct smc_clc_msg_proposal *pclc,
int smc_clc_srv_v2x_features_validate(struct smc_sock *smc,
				      struct smc_clc_msg_proposal *pclc,
				      struct smc_init_info *ini);
int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,
				       struct smc_init_info *ini);
Loading