Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp708842rdh; Sun, 24 Sep 2023 08:18:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvzrI3fDIrzL73OilznKdBTAp6PbFwt4pcgjx7XycSBqzsgl9tlBGUeuCyDChI+87pfa59 X-Received: by 2002:a17:902:82c4:b0:1bb:b30e:4364 with SMTP id u4-20020a17090282c400b001bbb30e4364mr3336081plz.39.1695568686074; Sun, 24 Sep 2023 08:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695568686; cv=none; d=google.com; s=arc-20160816; b=lI1PxJsV5bxy1cLENzw0rATPFTKiMit/XMAaW1a8CLJf2x5i/aeNyX49V4VU4Hn39Z tgbqNd4IQ3DA8UIX2mqYCSOl/gUN1GeRKazPsbGdSvBzpIdbRcnLGLYsudYJPfMgkynY FAK7/0Qa8F3ONMSxzSFCvS1FC5P4JpFGyqFtYcqCKGj99J1hRHO6AD8qAiOns7wJ2Zye YjMdTiINhwJgSiKZQ08eYt07CN8PQIhL7CcGrz/ifulsRQEurIWBlkP72kTgl2mtJ3mU lh71ZAiNsrJm22DVS4+KDVHwPcC8RQT0Il4hJnD3dnLK76I6i958qqBrr/QV8/jjwLYh P6IQ== 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 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d5-20020a170903230500b001bf0cc53d1fsi8371909plh.343.2023.09.24.08.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:18:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 411AB802F713; Sun, 24 Sep 2023 08:18:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbjIXPR0 (ORCPT + 99 others); Sun, 24 Sep 2023 11:17:26 -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 ); 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 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Sun, 24 Sep 2023 08:18:03 -0700 (PDT) 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 --- 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 +#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 -- 1.8.3.1