Message ID | 1695568613-125057-6-git-send-email-guwen@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp713478vqu; Sun, 24 Sep 2023 08:17:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/GZFamGfMifrJ3oAUp4lp7NGWcl/TUD6MtrQJ67LnyyTEPV29Z5YDXEQEXwblUEW9RQRj X-Received: by 2002:a17:903:32d1:b0:1c4:335:b06d with SMTP id i17-20020a17090332d100b001c40335b06dmr3786500plr.32.1695568673827; Sun, 24 Sep 2023 08:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695568673; cv=none; d=google.com; s=arc-20160816; b=RKiPRKHPzS+mjeETvIOitjKNS+Y3Roi7hEbUiSmNWbrtU1/NdcQ+Glv81z4pRli+G6 ZdGX2lZVB0ae3t3kPbHt9emqgZKeliKUrZjNfYcSbrIqZvn8KO2DhVm88X+2oYWRvgeH peGadAqauxfKXd+B+rXYmHq7Afif0lul9Hx8sliHFwnw626bhRndxgr1+2EWGq1c57L3 WNbWPXHNhj5AZV4CdSS1eeTh/WSqKxu0TvFAMa23F3bCBTcgE71zqczHC8V6zjiULSGe u2PDkE9gJ85rbPaXCBaPoCMxVNmueHnJ0VY8rodiADHBiHzZND45GU/v9lpKNHFpXinZ QP4A== 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=VOcJAd/GukUuNrekkdAuy9WsRxE6/ZRaYrN8C7EMKy4=; fh=kTBstCixiri9Ahdk8UNuw7wmcx8Ry+mqafUdDsc8Vd0=; b=IKBFoPCjWde9HuT+qc2z3/NLWYJde8njN0GA5qpX1s4c4hyA4AkjrHEsRblclDXgxK 3nyhJHeYEuOrkSVzlS/j3yoQlUvrMXrQYEKvBWBCxFvQUyevTTxOTesnUzkMsI+pXi6r 7jW4KplkE3xxQ0Jj3kOZ+Bsra/JU6lxfnrBOqToykjiHd/9Xfi3wKFAW4sZJr4W5lMNi 6MIZ4dE3My8oin+y0AK8818UYlOwB3+Ib6xsbgI1u8Wh0t1TFg9yAcfQ4TuxWQxuk+dH j+F80dnvR4ep9VuhU06sk2V4hMj/I+p7RGtiaZ5oFr32Z9eIYw2xB3fwqClSGrWCfowS BYiA== 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 Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q17-20020a17090311d100b001c36018fdaasi8508003plh.219.2023.09.24.08.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:17:53 -0700 (PDT) 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 D74B9819D1E7; Sun, 24 Sep 2023 08:17:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjIXPR1 (ORCPT <rfc822;pusanteemu@gmail.com> + 30 others); Sun, 24 Sep 2023 11:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjIXPRV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 24 Sep 2023 11:17:21 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC60EFD; Sun, 24 Sep 2023 08:17:13 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R221e4;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=18;SR=0;TI=SMTPD_---0Vsio7sa_1695568628; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vsio7sa_1695568628) by smtp.aliyun-inc.com; Sun, 24 Sep 2023 23:17:10 +0800 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: wintera@linux.ibm.com, schnelle@linux.ibm.com, gbayer@linux.ibm.com, pasic@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, dust.li@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 v4 05/18] net/smc: reserve CHID range for SMC-D virtual device Date: Sun, 24 Sep 2023 23:16:40 +0800 Message-Id: <1695568613-125057-6-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695568613-125057-1-git-send-email-guwen@linux.alibaba.com> References: <1695568613-125057-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,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: <linux-kernel.vger.kernel.org> 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]); Sun, 24 Sep 2023 08:17:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777932617762654615 X-GMAIL-MSGID: 1777932617762654615 |
Series |
net/smc: implement virtual ISM extension and loopback-ism
|
|
Commit Message
Wen Gu
Sept. 24, 2023, 3:16 p.m. UTC
This patch reserve CHID range from 0xFF00 to 0xFFFF for SMC-D virtual
device and introduces helpers to identify them.
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
---
net/smc/smc_ism.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Comments
On 24/09/2023 17:16, Wen Gu wrote: > This patch reserve CHID range from 0xFF00 to 0xFFFF for SMC-D virtual The current state is that 0xFF00 - 0xFFFF is the range of all virtual SMC-D devices. This range devides into: - 0xFF00 - 0xFFFE is for virto-ism - 0xFFFF is for loopback > device and introduces helpers to identify them. > > Signed-off-by: Wen Gu <guwen@linux.alibaba.com> > --- > net/smc/smc_ism.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h > index 14d2e77..2ecc8de 100644 > --- a/net/smc/smc_ism.h > +++ b/net/smc/smc_ism.h > @@ -15,6 +15,9 @@ > > #include "smc.h" > > +#define SMC_VIRT_ISM_CHID_MAX 0xFFFF SMC_VIRT_ISM_MAX is 0xFFFE. Or do you mean virtual devices as the whole group. If yes i think that this naming will be very confusing in a few months/years. Maybe something like SMC_VIRTUAL_DEV_CHID_{MIN|MAX}? > +#define SMC_VIRT_ISM_CHID_MIN 0xFF00 > + > struct smcd_dev_list { /* List of SMCD devices */ > struct list_head list; > struct mutex mutex; /* Protects list of devices */ > @@ -57,4 +60,16 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, > return rc < 0 ? rc : 0; > } > > +static inline bool __smc_ism_is_virtdev(u16 chid) > +{ > + return (chid >= SMC_VIRT_ISM_CHID_MIN && chid <= SMC_VIRT_ISM_CHID_MAX); > +} > + > +static inline bool smc_ism_is_virtdev(struct smcd_dev *smcd) > +{ > + u16 chid = smcd->ops->get_chid(smcd); > + > + return __smc_ism_is_virtdev(chid); > +} > + > #endif
On 28.09.23 05:08, Jan Karcher wrote: > On 24/09/2023 17:16, Wen Gu wrote: >> This patch reserve CHID range from 0xFF00 to 0xFFFF for SMC-D virtual > > The current state is that 0xFF00 - 0xFFFF is the range of all virtual SMC-D devices. This range devides into: > - 0xFF00 - 0xFFFE is for virto-ism > - 0xFFFF is for loopback > > >> device and introduces helpers to identify them. >> >> Signed-off-by: Wen Gu <guwen@linux.alibaba.com> >> --- >> net/smc/smc_ism.h | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> >> diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h >> index 14d2e77..2ecc8de 100644 >> --- a/net/smc/smc_ism.h >> +++ b/net/smc/smc_ism.h >> @@ -15,6 +15,9 @@ >> #include "smc.h" >> +#define SMC_VIRT_ISM_CHID_MAX 0xFFFF > > SMC_VIRT_ISM_MAX is 0xFFFE. Or do you mean virtual devices as the whole group. If yes i think that this naming will be very confusing in a few months/years. > Maybe something like SMC_VIRTUAL_DEV_CHID_{MIN|MAX}? IMO names are important. They can make future lives easier or harder. Your first group of patches aims at 'decouple ISM device hard code from SMC-D stack' Maybe now would be a good point in time to decide what ISM should mean in net/smc. a) the s390 ISM devices b) SMC-D devices in general I would vote for a). (today a) and b) can be found in the code, as well as the term smcd_dev) Then like Jan wrote above: "0xFF00 - 0xFFFF is the range of all virtual SMC-D devices" and it should NOT be called SMC_VIRT_ISM_CHID_MAX. Then in many places in net/smc 'ism' should be replaces by 'smcd_dev' or something similar. Wen Gu, is that something you would offer to do as part of the preparation work for this series?
On 2023/9/28 17:10, Alexandra Winter wrote: > > > On 28.09.23 05:08, Jan Karcher wrote: >> On 24/09/2023 17:16, Wen Gu wrote: >>> This patch reserve CHID range from 0xFF00 to 0xFFFF for SMC-D virtual >> >> The current state is that 0xFF00 - 0xFFFF is the range of all virtual SMC-D devices. This range devides into: >> - 0xFF00 - 0xFFFE is for virto-ism >> - 0xFFFF is for loopback >> >> >>> device and introduces helpers to identify them. >>> >>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com> >>> --- >>> net/smc/smc_ism.h | 15 +++++++++++++++ >>> 1 file changed, 15 insertions(+) >>> >>> diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h >>> index 14d2e77..2ecc8de 100644 >>> --- a/net/smc/smc_ism.h >>> +++ b/net/smc/smc_ism.h >>> @@ -15,6 +15,9 @@ >>> #include "smc.h" >>> +#define SMC_VIRT_ISM_CHID_MAX 0xFFFF >> >> SMC_VIRT_ISM_MAX is 0xFFFE. Or do you mean virtual devices as the whole group. If yes i think that this naming will be very confusing in a few months/years. >> Maybe something like SMC_VIRTUAL_DEV_CHID_{MIN|MAX}? > > > IMO names are important. They can make future lives easier or harder. > Hi Sandy and Jan, I agree with your opinion that names are important. I view these terms in this way: SMC-D devices (smcd_dev) | |- s390 ISM devices (ISM, ism_dev) | |- virtual ISM devices (virtual ISM, smc_lo_dev) | | | |- loopback-ism | | | |- virtio-ism | |- maybe future devices SMC_VIRT_ISM_CHID_MAX was introduced to represent the maximum CHID of virtual ISM devices. CHIDs used by virtual ISM devices should be in range of [SMC_VIRT_ISM_CHID_MIN, SMC_VIRT_ISM_CHID_MAX]. I think the problem here is that SMC_VIRT_ISM_CHID_MAX might be misunderstood as CHID of virtio-ism? Then I will change them to SMC_VIRTUAL_ISM_CHID_{MAX|MIN}. > Your first group of patches aims at 'decouple ISM device hard code from SMC-D stack' > Maybe now would be a good point in time to decide what ISM should mean in net/smc. > a) the s390 ISM devices > b) SMC-D devices in general > I would vote for a). (today a) and b) can be found in the code, as well as the term smcd_dev) > > Then like Jan wrote above: > "0xFF00 - 0xFFFF is the range of all virtual SMC-D devices" and it should NOT be called SMC_VIRT_ISM_CHID_MAX. > Yes, I also vote for a). But IMHO, loopback-ism and virtio-ism should be better classified as 'virtual ISM devices', like what describes in the specification, rather than 'virtual SMC-D devices', since they are intended to emulate ISM devices for using SMC-D on non-s390 systems. > > Then in many places in net/smc 'ism' should be replaces by 'smcd_dev' or something similar. > Wen Gu, is that something you would offer to do as part of the preparation work for this series? Yes. But I'm not sure which 'ism' words you suggested to be replaced with 'smcd_dev'/'smcd'? IMHO, in some generic codes like SMC-D operations (smcd_ops) or SMC-D device dump, they should be generic to all kinds of SMC-D devices, so struct ism_dev or struct ism_client should not be used, that is what patch#1 & #2 want to do. But in some operations related to underlay device, like smcd_ism_register_dmb(), smc_ism_cantalk(), and etc in smc_ism.c. They works for both s390 ISM devices and virtual ISM devices. I think they can keep 'ism' in the helpers' name as they are now. What do you think? Thanks and regards, Wen Gu
diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h index 14d2e77..2ecc8de 100644 --- a/net/smc/smc_ism.h +++ b/net/smc/smc_ism.h @@ -15,6 +15,9 @@ #include "smc.h" +#define SMC_VIRT_ISM_CHID_MAX 0xFFFF +#define SMC_VIRT_ISM_CHID_MIN 0xFF00 + struct smcd_dev_list { /* List of SMCD devices */ struct list_head list; struct mutex mutex; /* Protects list of devices */ @@ -57,4 +60,16 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, return rc < 0 ? rc : 0; } +static inline bool __smc_ism_is_virtdev(u16 chid) +{ + return (chid >= SMC_VIRT_ISM_CHID_MIN && chid <= SMC_VIRT_ISM_CHID_MAX); +} + +static inline bool smc_ism_is_virtdev(struct smcd_dev *smcd) +{ + u16 chid = smcd->ops->get_chid(smcd); + + return __smc_ism_is_virtdev(chid); +} + #endif