Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1411275rdb; Wed, 6 Dec 2023 19:51:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmTPPY7tnkJasPdDnMUjdlSFBGMcTv2+lfyF1hsuREPT6TccTMBvN7J8fLFabou6cAOVw1 X-Received: by 2002:a05:6a00:939b:b0:6ce:7a8f:af81 with SMTP id ka27-20020a056a00939b00b006ce7a8faf81mr3702995pfb.28.1701921075639; Wed, 06 Dec 2023 19:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701921075; cv=none; d=google.com; s=arc-20160816; b=wKX79BgrawgzZjKoOgVjpgUkjmoa+zh4cx48O3b44mNppAUTXDLaj+4Vmn0FIv3oh9 Tlgn6g6oA5/CYvtr+BwNY6MXq+yKNxeZNC6ZWoIyIlrdzk3tAX+AItA9b6YTGm2cM8dV 37X9QtKg+onv4N+XDCrmmcXMwu3DNkFMhxf22vGDX59ye4ghIHdeLicbSVBWwiBxJJtB vdTiNMOwFfA55uzIGKjDpPBolEzfkkVU3PefGOfpkzyRuEg41Amb0KcJ6P4ly61NLhu6 5s1IOj1HkE6EOZ3plxY33AoHZEI1T9LQiM1gCn/ZqOrILFeJnnuiTisKjVmYmQd9RvP5 Q0ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=sNKNwz8ni1+EFkHRhzQku3FrXEUJeSGP2MLlK0qVvLY=; fh=uTJ0crBczByYIhxgrQpYUSGkMqtgvc9XI1pgPEVZjxY=; b=c0zTqs9MgpTMKdM/yyQB6xMLhk5c/ttYg888szRkgQpDAPqR5o5dMUoMbqqJD84TnN tOsytaLbCqox1qv9wHEJSXESEEYThWfqiNrZUb/TbQIDySk6bOmCgvHq+MQ333kcDLHn NPRl3FWggkY7s4+kdGY8y9nsQY8C6rIflDi6MWofK6PP79+N1iCUsEHx+aYISAv3Pl4h cJaVdw6CMlu1qySTpW0pP0KD6qYXhayQbqFcfUZqKEJ3ByobqZunt7CRia6eopXEZLGB zofErsZP0wrr44lCDKqT2rSNlg6aWOZBlaVBBR1MYZFHR+PPC8Fuh1N1xtznaVEQiqwA DsIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b12-20020a056a0002cc00b0068e3f550763si461457pft.101.2023.12.06.19.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 19:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F2F948092177; Wed, 6 Dec 2023 19:50:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbjLGDuE (ORCPT + 99 others); Wed, 6 Dec 2023 22:50:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjLGDuB (ORCPT ); Wed, 6 Dec 2023 22:50:01 -0500 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E6FED7D; Wed, 6 Dec 2023 19:50:07 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R581e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vy-Kv2Y_1701921003; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vy-Kv2Y_1701921003) by smtp.aliyun-inc.com; Thu, 07 Dec 2023 11:50:05 +0800 From: Wen Gu To: wintera@linux.ibm.com, wenjia@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, kgraul@linux.ibm.com, jaka@linux.ibm.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, raspl@linux.ibm.com, schnelle@linux.ibm.com, guangguan.wang@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 3/9] net/smc: support SMCv2.x supplemental features negotiation Date: Thu, 7 Dec 2023 11:49:48 +0800 Message-Id: <1701920994-73705-4-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1701920994-73705-1-git-send-email-guwen@linux.alibaba.com> References: <1701920994-73705-1-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 06 Dec 2023 19:50:43 -0800 (PST) This patch adds SMCv2.x supplemental features negotiation. Supported SMCv2.x supplemental features are represented by feature_mask in FCE field. The negotiation process is as follows. Server Client Proposal(features(c-mask bits)) <----------------------------------------- Accept(features(s-mask bits)) -----------------------------------------> Confirm(features(s&c-mask bits)) <----------------------------------------- Signed-off-by: Wen Gu --- net/smc/smc.h | 4 ++++ net/smc/smc_clc.c | 7 +++++++ net/smc/smc_clc.h | 14 ++++++++++---- net/smc/smc_core.h | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/net/smc/smc.h b/net/smc/smc.h index e377980..903b151 100644 --- a/net/smc/smc.h +++ b/net/smc/smc.h @@ -58,6 +58,10 @@ enum smc_state { /* possible states of an SMC socket */ SMC_PROCESSABORT = 27, }; +#define SMC_FEATURE_MASK 0 /* bitmask of + * supported supplemental features + */ + struct smc_link_group; struct smc_wr_rx_hdr { /* common prefix part of LLC and CDC to demultiplex */ diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index 52b4ea9..81e09d1 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -438,6 +438,7 @@ static int smc_clc_fill_fce_v2x(struct smc_clc_first_contact_ext_v2x *fce_v2x, fce_v2x->max_conns = ini->max_conns; fce_v2x->max_links = ini->max_links; } + fce_v2x->feature_mask = htons(ini->feature_mask); } out: @@ -908,6 +909,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(SMC_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; @@ -1214,6 +1216,7 @@ int smc_clc_srv_v2x_features_validate(struct smc_sock *smc, ini->max_conns = SMC_CONN_PER_LGR_MAX; ini->max_links = SMC_LINKS_ADD_LNK_MAX; + ini->feature_mask = SMC_FEATURE_MASK; if ((!(ini->smcd_version & SMC_V2) && !(ini->smcr_version & SMC_V2)) || ini->release_nr < SMC_RELEASE_1) @@ -1257,6 +1260,8 @@ 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; } + /* common supplemental features of server and client */ + ini->feature_mask = ntohs(fce_v2x->feature_mask) & SMC_FEATURE_MASK; return 0; } @@ -1287,6 +1292,8 @@ int smc_clc_v2x_features_confirm_check(struct smc_clc_msg_accept_confirm *cclc, if (fce_v2x->max_links != ini->max_links) return SMC_CLC_DECL_MAXLINKERR; } + /* common supplemental features returned by client */ + ini->feature_mask = ntohs(fce_v2x->feature_mask); return 0; } diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h index 1697b84..0112e7c 100644 --- a/net/smc/smc_clc.h +++ b/net/smc/smc_clc.h @@ -138,7 +138,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]; }; @@ -240,9 +241,14 @@ struct smc_clc_first_contact_ext { struct smc_clc_first_contact_ext_v2x { struct smc_clc_first_contact_ext fce_v2_base; - u8 max_conns; /* for SMC-R only */ - u8 max_links; /* for SMC-R only */ - u8 reserved3[2]; + union { + struct { + u8 max_conns; /* for SMC-R only */ + u8 max_links; /* for SMC-R only */ + }; + u8 reserved3[2]; /* for SMC-D only */ + }; + __be16 feature_mask; __be32 vendor_exp_options; u8 reserved4[8]; } __packed; /* format defined in 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