Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2176115rdb; Thu, 7 Dec 2023 23:41:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTePSdBkkd3uSeBjaz4P0xpg8YfXA3bpZTdtUv347EEXEIaAjGYR/+ZzSGmW4Tqf+Fd1ry X-Received: by 2002:a05:6a00:23d2:b0:6cd:e046:f3ec with SMTP id g18-20020a056a0023d200b006cde046f3ecmr3359537pfc.5.1702021297803; Thu, 07 Dec 2023 23:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702021297; cv=none; d=google.com; s=arc-20160816; b=uq3AERZwTqMAGtv1joMNPK3U2RrGbApBYxv8QvTjtQJUGB29HuxCfjxo6jVK+tZPOk 2GJvzScJo3IsBEdA/yArv2MJGHjM0wymftiay/RvYL4Q8JvXnsMqenVMFOQyw7j5/bY7 HX8jRbbmbOSHiT+AMAB7ElXAMBEl221ord0WSzlLbif+ei6UtXPbtZgs0ONtCJ2UH9ZT lEocreFP7W3KrknflRMeoarvBKhtzfzh9Kfzy91hYsNaeRTnKK+1kU3sN9t7pf+7i9wF QEjJwztd2xIwBblD5//0b6qw0kLZh5akxDLFLh4nR2rl+lz6vboegX2Ic6Qf4p7tN12Q +H6A== 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=vSPLKjQ/BUV74Av0ffyppM1aL4/e9hP10uHHrHnbO9gQ7S3m/Dd62Dyw1YgTg3fl45 h1NYz6bU6YAGFeburhSm9XVPM2rLQ/LO5iaalNYJ5+pT+skmQmjoqK5pbJUnhWnbG7k1 XEu12Zw5/ersi/qA0prHIJnLuj1LtXhQk0tN90U3sgwnf063YDeuxIk/VTluRvRgNBmu JwIyWTCoVHdaaLkmepQi3paQLutKNgB4o9to8U0Me7WFWA575bRMAuvO5+ky01s3rDVs orKSFunmZaOP2brJyjbmEJMiQjDUqnpxLUCbxrXiymj498umkTvJIyyQohdex6hq4Fg/ czxQ== 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 fb30-20020a056a002d9e00b006ce52bb999fsi1111012pfb.273.2023.12.07.23.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 23:41:37 -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 8D8D880ECAD0; Thu, 7 Dec 2023 23:41:35 -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 S1573343AbjLHHlU (ORCPT + 99 others); Fri, 8 Dec 2023 02:41:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573319AbjLHHlK (ORCPT ); Fri, 8 Dec 2023 02:41:10 -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 9CAB3DD; Thu, 7 Dec 2023 23:41:15 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R361e4;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_---0Vy2TDNX_1702021271; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vy2TDNX_1702021271) by smtp.aliyun-inc.com; Fri, 08 Dec 2023 15:41:13 +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 v5 5/9] net/smc: define a reserved CHID range for virtual ISM devices Date: Fri, 8 Dec 2023 15:40:55 +0800 Message-Id: <1702021259-41504-6-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1702021259-41504-1-git-send-email-guwen@linux.alibaba.com> References: <1702021259-41504-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]); Thu, 07 Dec 2023 23:41:35 -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