public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Wen Gu <guwen@linux.alibaba.com>
To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: alibuda@linux.alibaba.com, tonylu@linux.alibaba.com,
	guwen@linux.alibaba.com, linux-s390@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 04/18] net/smc: support SMCv2.x supplemental features negotiation
Date: Tue, 19 Sep 2023 22:41:48 +0800	[thread overview]
Message-ID: <1695134522-126655-5-git-send-email-guwen@linux.alibaba.com> (raw)
In-Reply-To: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com>

This patch adds SMCv2.1 supplemental features negotiation. Supported
SMCv2.1 supplemental features are represented by feature_mask in FCE
header of CLC messages.

 Server                                  Client
        Proposal(features(c-mask bits))
      <-----------------------------------
         Accept(features(s-mask bits))
      ----------------------------------->
        Confirm(features(s&c-mask bits))
      <-----------------------------------

Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
---
 net/smc/smc_clc.c  | 7 +++++++
 net/smc/smc_clc.h  | 6 ++++--
 net/smc/smc_core.h | 1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index 8deb46c..125b0d2 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -426,6 +426,7 @@ static int smc_clc_fill_fce(struct smc_clc_first_contact_ext_v2x *fce,
 	memset(fce, 0, sizeof(*fce));
 	fce->fce_v2_base.os_type = SMC_CLC_OS_LINUX;
 	fce->fce_v2_base.release = ini->release_nr;
+	fce->fce_v2_base.feature_mask = htons(ini->feature_mask);
 	memcpy(fce->fce_v2_base.hostname, smc_hostname, sizeof(smc_hostname));
 	if (ini->is_smcd && ini->release_nr < SMC_RELEASE_1) {
 		ret = sizeof(struct smc_clc_first_contact_ext);
@@ -906,6 +907,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
 		pclc_smcd->v2_ext_offset = htons(v2_ext_offset);
 		plen += sizeof(*v2_ext);
 
+		v2_ext->feature_mask = htons(ini->feature_mask);
 		read_lock(&smc_clc_eid_table.lock);
 		v2_ext->hdr.eid_cnt = smc_clc_eid_table.ueid_cnt;
 		plen += smc_clc_eid_table.ueid_cnt * SMC_MAX_EID_LEN;
@@ -1219,6 +1221,7 @@ int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,
 			return SMC_CLC_DECL_MAXLINKERR;
 		ini->max_links = fce_v2x->max_links;
 	}
+	ini->feature_mask &= ntohs(fce->feature_mask);
 
 	return 0;
 }
@@ -1250,6 +1253,10 @@ int smc_clc_v2x_features_confirm_check(struct smc_clc_msg_accept_confirm *cclc,
 			return SMC_CLC_DECL_MAXLINKERR;
 	}
 
+	if (~(ini->feature_mask) & ntohs(fce->feature_mask))
+		return SMC_CLC_DECL_FEATUNSUPP;
+	ini->feature_mask = ntohs(fce->feature_mask);
+
 	return 0;
 }
 
diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
index c5c8e7d..bcf37c8 100644
--- a/net/smc/smc_clc.h
+++ b/net/smc/smc_clc.h
@@ -48,6 +48,7 @@
 #define SMC_CLC_DECL_RELEASEERR	0x03030009  /* release version negotiate failed */
 #define SMC_CLC_DECL_MAXCONNERR	0x0303000a  /* max connections negotiate failed */
 #define SMC_CLC_DECL_MAXLINKERR	0x0303000b  /* max links negotiate failed */
+#define SMC_CLC_DECL_FEATUNSUPP	0x0303000c  /* supplemental features not supported */
 #define SMC_CLC_DECL_MODEUNSUPP	0x03040000  /* smc modes do not match (R or D)*/
 #define SMC_CLC_DECL_RMBE_EC	0x03050000  /* peer has eyecatcher in RMBE    */
 #define SMC_CLC_DECL_OPTUNSUPP	0x03060000  /* fastopen sockopt not supported */
@@ -138,7 +139,8 @@ struct smc_clc_v2_extension {
 	u8 roce[16];		/* RoCEv2 GID */
 	u8 max_conns;
 	u8 max_links;
-	u8 reserved[14];
+	__be16 feature_mask;
+	u8 reserved[12];
 	u8 user_eids[][SMC_MAX_EID_LEN];
 };
 
@@ -234,7 +236,7 @@ struct smc_clc_first_contact_ext {
 	u8 release : 4,
 	   os_type : 4;
 #endif
-	u8 reserved2[2];
+	__be16 feature_mask;
 	u8 hostname[SMC_MAX_HOSTNAME_LEN];
 };
 
diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h
index 120027d..9f65678 100644
--- a/net/smc/smc_core.h
+++ b/net/smc/smc_core.h
@@ -401,6 +401,7 @@ struct smc_init_info {
 	u8			max_links;
 	u8			first_contact_peer;
 	u8			first_contact_local;
+	u16			feature_mask;
 	unsigned short		vlan_id;
 	u32			rc;
 	u8			negotiated_eid[SMC_MAX_EID_LEN];
-- 
1.8.3.1


  parent reply	other threads:[~2023-09-19 14:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 14:41 [PATCH net-next 00/18] net/smc: implement virtual ISM extension and loopback-ism Wen Gu
2023-09-19 14:41 ` [PATCH net-next 01/18] net/smc: decouple ism_dev from SMC-D device dump Wen Gu
2023-09-21 20:41   ` Simon Horman
2023-09-22  8:05     ` Wen Gu
2023-09-22 18:13       ` Gerd Bayer
2023-09-23  9:24         ` Wen Gu
2023-09-19 14:41 ` [PATCH net-next 02/18] net/smc: decouple ism_dev from SMC-D DMB registration Wen Gu
2023-09-19 14:41 ` [PATCH net-next 03/18] net/smc: extract v2 check helper from SMC-D device registration Wen Gu
2023-09-19 14:41 ` Wen Gu [this message]
2023-09-19 14:41 ` [PATCH net-next 05/18] net/smc: reserve CHID range for SMC-D virtual device Wen Gu
2023-09-19 14:41 ` [PATCH net-next 06/18] net/smc: extend GID to 128bits for virtual ISM device Wen Gu
2023-09-20  7:02   ` kernel test robot
2023-09-20  8:11     ` Wen Gu
2023-09-20  9:00       ` Niklas Schnelle
2023-09-20 13:05         ` Wen Gu
2023-09-19 14:41 ` [PATCH net-next 07/18] net/smc: disable SEID on non-s390 architecture Wen Gu
2023-09-19 14:41 ` [PATCH net-next 08/18] net/smc: enable virtual ISM device feature bit Wen Gu
2023-09-19 14:41 ` [PATCH net-next 09/18] net/smc: introduce SMC-D loopback device Wen Gu
2023-09-19 14:41 ` [PATCH net-next 10/18] net/smc: implement ID-related operations of loopback Wen Gu
2023-09-19 14:41 ` [PATCH net-next 11/18] net/smc: implement some unsupported " Wen Gu
2023-09-19 14:41 ` [PATCH net-next 12/18] net/smc: implement DMB-related " Wen Gu
2023-09-23 15:24   ` kernel test robot
2023-09-24  8:54     ` Wen Gu
2023-09-19 14:41 ` [PATCH net-next 13/18] net/smc: register loopback device as SMC-Dv2 device Wen Gu
2023-09-19 14:41 ` [PATCH net-next 14/18] net/smc: add operation for getting DMB attribute Wen Gu
2023-09-19 14:41 ` [PATCH net-next 15/18] net/smc: add operations for DMB attach and detach Wen Gu
2023-09-19 14:42 ` [PATCH net-next 16/18] net/smc: avoid data copy from sndbuf to peer RMB in SMC-D Wen Gu
2023-09-19 14:42 ` [PATCH net-next 17/18] net/smc: modify cursor update logic when sndbuf mapped to RMB Wen Gu
2023-09-19 14:42 ` [PATCH net-next 18/18] net/smc: add interface implementation of loopback device Wen Gu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1695134522-126655-5-git-send-email-guwen@linux.alibaba.com \
    --to=guwen@linux.alibaba.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jaka@linux.ibm.com \
    --cc=kgraul@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=wenjia@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox