Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1411279rdb; Wed, 6 Dec 2023 19:51:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/QjbKGUgPRqpKvA2YvpU7gKStBAcWj6NhmR54NAPln79ofPudaCn+gLs0epFdEeeJe7Qh X-Received: by 2002:a17:902:ce8b:b0:1d0:c849:7a0 with SMTP id f11-20020a170902ce8b00b001d0c84907a0mr2092868plg.19.1701921076429; Wed, 06 Dec 2023 19:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701921076; cv=none; d=google.com; s=arc-20160816; b=guvY9qJV9XTDbh9DNUNIKZ5g9YEjTLDZTWuhpfYPt1Jw2sHhVTIbApJ1fiWhhb6qSS DlC3w835cOy/HGfVs30isXz2q2w7qwh7OS5w5G5ysXPo9nr7RNaRpgflsrxzJPCENBOf bPo+M9R+0Jd+fEU5CGZ0qyv1QNbXKekoVEztWsi1nfTBgkMEbhYaLj7fm8YPjhK9CIm+ QUaBwdfk13Ol08KQbfh4kYZMKuig/wHx50FDXJivAndkSs7Mi/+XfeGRSsqQ3jnK18KY DR22CemNuees83GX8bamc2MfFp/YdVk+oOlQEc57OnzbqHLZT1ACeqC1lBi3dadwrBXJ c77w== 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=gfeh3LoKNNYl4z0aep2eflTTKWie70Gcrf5+qxiqUow=; fh=uTJ0crBczByYIhxgrQpYUSGkMqtgvc9XI1pgPEVZjxY=; b=T571gN1RBIhMbJQgIj5ziiaw6ERLkPWsB0Pd2ec1rpl4WVNqzrMjv2oQIBRYUxw9BJ saTD08UVJHV5F8r8bb3A63eZ3PBKTkwpikqSGWl0T0nb0fooupZxHAHj/HH2DIZ4u6NA DWjepUOdAOemsDIY3w0oytl9OGxbn8MyT6nCVng89bgA3Cp1HIfGA4vOR3+J1/LuVfNl X4E9R4mZF9kSGSuNHCBBukAtSb8jQKWV67b0IQe+bU932bp77TQNSOxObaYT/a293MiI d/16H9kWN6WyvrygdEodWSx+dUuwRirSyTdHCm6L7jg7D1ryvlot/ryj7uz/e9lusAb8 R27g== 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:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id g6-20020a1709026b4600b001d09e83b3bfsi379372plt.92.2023.12.06.19.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 19:51:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 4E2A880B7AD5; Wed, 6 Dec 2023 19:51:03 -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 S229977AbjLGDuQ (ORCPT + 99 others); Wed, 6 Dec 2023 22:50:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjLGDuK (ORCPT ); Wed, 6 Dec 2023 22:50:10 -0500 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A880010C4; Wed, 6 Dec 2023 19:50:12 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vy-JsCQ_1701921008; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vy-JsCQ_1701921008) by smtp.aliyun-inc.com; Thu, 07 Dec 2023 11:50:10 +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 5/9] net/smc: define a reserved CHID range for virtual ISM devices Date: Thu, 7 Dec 2023 11:49:50 +0800 Message-Id: <1701920994-73705-6-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:51:03 -0800 (PST) According to virtual ISM support feature defined by SMCv2.1, CHIDs in the range 0xFF00 to 0xFFFF are reserved for use by virtual ISM devices. And two helpers are introduced to distinguish virtual ISM devices from the existing platform firmware ISM devices. Signed-off-by: Wen Gu --- net/smc/smc_ism.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h index 832b2f4..d1228a6 100644 --- a/net/smc/smc_ism.h +++ b/net/smc/smc_ism.h @@ -15,6 +15,8 @@ #include "smc.h" +#define SMC_VIRTUAL_ISM_CHID_MASK 0xFF00 + struct smcd_dev_list { /* List of SMCD devices */ struct list_head list; struct mutex mutex; /* Protects list of devices */ @@ -56,4 +58,22 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, return rc < 0 ? rc : 0; } +static inline bool __smc_ism_is_virtual(u16 chid) +{ + /* CHIDs in range of 0xFF00 to 0xFFFF are reserved + * for virtual ISM device. + * + * loopback-ism: 0xFFFF + * virtio-ism: 0xFF00 ~ 0xFFFE + */ + return ((chid & 0xFF00) == 0xFF00); +} + +static inline bool smc_ism_is_virtual(struct smcd_dev *smcd) +{ + u16 chid = smcd->ops->get_chid(smcd); + + return __smc_ism_is_virtual(chid); +} + #endif -- 1.8.3.1