Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp232335rdb; Thu, 30 Nov 2023 03:28:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEs8gZ0PnVNDd7IC45J1nVQI7mjxt6UxHZW1PvT6ZxgDkzzc0pZ8RPCyE/1nu92J8QuoqE8 X-Received: by 2002:a05:6870:7247:b0:1fa:a95:12a7 with SMTP id y7-20020a056870724700b001fa0a9512a7mr23775313oaf.38.1701343735938; Thu, 30 Nov 2023 03:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701343735; cv=none; d=google.com; s=arc-20160816; b=c2I3UUHGQeEj3pBbwjIRvMgpgN51poWwLwuDe0d5NqroQk1hK5uIn0MJdYruckHD2k 1MqH8L4pfQ3sYR6Mjg+V+XhtmlaIjRREF2daiD1W2r4KwqHQgVpj7fjXk86rva5funDh //yQaJkWCHYof8b9J7kzsfJgH3XItBPP+U8rNvAb4KC84y/Rupw+glYZNDqHfjiZMgC6 RCr5dykli1VLN5eLO76EfoNiPkQcMF+wOfibemeZUk7GytpK8ohIELx4wcpYzzPYi1Nm e+kxbwM1oGlfAobO7LD4Fwk55a+3/oohen4EcQ5K9vHIonwgQCrtw9U2G/P2Q9gjuspn Z6Yg== 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=KQ6DtOg2s6EjX2UG8PvNJAxkkgxsPAP99idIif6uGd8=; b=Umh6+c85eNepWPEXdh8VHM+dfi99fZdji/nOJ0i/EWnePK/iBNQj0GiPg7Ao7qcSbJ 3JPEvKhyghObsWqNycLXWVkiQWrPb7xi+FnPxHftvPlhOv2cGJbTvlLDyqEck+hnelfG /i0Vyfr3F+Sab9kMvC9HCgfE6Qvb8b6yr+umn3fh1q9D58v8VeL8iiNRnQKEU3vBvyuw 7lsz8zSz2ACO1JMU6n2TsG4n38Wx8irbr0gt6TAmrnF1ctB6a2PuSw3kF4g7QdOnVfyV iXfbaEk2SMVCCD8xkRMHLWujnhoww5FxcUCKxSKBoe5Y9STj/HiLYNz5a3D3sRHicc+d 0Mpg== 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 4-20020a631544000000b00569fd44093fsi1149630pgv.230.2023.11.30.03.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 03:28:55 -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 7C5238033DC8; Thu, 30 Nov 2023 03:28:53 -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 S1345199AbjK3L2j (ORCPT + 99 others); Thu, 30 Nov 2023 06:28:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345167AbjK3L2c (ORCPT ); Thu, 30 Nov 2023 06:28:32 -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 04E421709; Thu, 30 Nov 2023 03:28:34 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;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=21;SR=0;TI=SMTPD_---0VxROoLH_1701343710; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VxROoLH_1701343710) by smtp.aliyun-inc.com; Thu, 30 Nov 2023 19:28:32 +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, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 4/7] net/smc: define a reserved CHID range for virtual ISM devices Date: Thu, 30 Nov 2023 19:28:12 +0800 Message-Id: <1701343695-122657-5-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1701343695-122657-1-git-send-email-guwen@linux.alibaba.com> References: <1701343695-122657-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, 30 Nov 2023 03:28:53 -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