From nobody Wed Jan 15 17:57:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE225CE7A88 for ; Sun, 24 Sep 2023 15:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbjIXPR3 (ORCPT ); Sun, 24 Sep 2023 11:17:29 -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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 @@ =20 #include "smc.h" =20 +#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, u= 64 dmb_tok, return rc < 0 ? rc : 0; } =20 +static inline bool __smc_ism_is_virtdev(u16 chid) +{ + return (chid >=3D SMC_VIRT_ISM_CHID_MIN && chid <=3D SMC_VIRT_ISM_CHID_MA= X); +} + +static inline bool smc_ism_is_virtdev(struct smcd_dev *smcd) +{ + u16 chid =3D smcd->ops->get_chid(smcd); + + return __smc_ism_is_virtdev(chid); +} + #endif --=20 1.8.3.1