From patchwork Tue Sep 19 14:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gu X-Patchwork-Id: 141925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3445446vqi; Tue, 19 Sep 2023 07:49:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl0JCZUnMvm6Io/7Fu1ndqJVFLOYDipYPwtqS6gyAabbKTWJT/gumY2+OjLA0T23wiUFkW X-Received: by 2002:a17:902:c40d:b0:1c4:44a0:5c03 with SMTP id k13-20020a170902c40d00b001c444a05c03mr11733592plk.9.1695134959138; Tue, 19 Sep 2023 07:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695134959; cv=none; d=google.com; s=arc-20160816; b=HgYxjeeuayvoMUR2RZl8S0xfJ0uBRMCUhZsZtS4rIDx0BfpSDn0c4aZ3JDUi2vKkcq JtF4AeyfJv+nHaRnJOOqJJY/jfRv3NNlT6wwzj0dNilN+4sMj0MH6U4Ny9ixDDgwjh5G kzUGlNJMh2pOMv1LvwJ02Vak6ZVQlMXWr1OyXhxC8XGvwxY7IZeDfhW5GvsOAiEyepVu IIN5KqrUw/cmDSQ+ySEaazDLQGezM1zSqkTbOocUZ9k96s04nnVwofD22QwPMo/ZtuDe F8tHJDB56NdAbX+wg/V46OgGicHrcKsO4RrZ2pbJAVswfa6907YDAR/JWMUzSr2i64Vn 45JA== 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=2Ks5OhTjwS8gZt4F+VGxBODwUEQ0u2wJBF3lQY5ZqAM=; b=pJBAfMzIDJ4NE1tUr3LuQNeKG2XjXcFl7iCkuqITfDwmZ06hNCJnDJtoSo+yj0W/c6 fG03MZ/8hxtG83eb9IJJbWBMtDQVHQn/2xwRc6BgrYRhyak5xjfBOPblQOJiWFGw8ukj LeEYY/HwOxSoJJUESStzr35/ll15DwXsNas5pTsbsE6fLaZlc6Ot5xZVXw2oKb90ZY12 yIOqpf9+4oNeHJwcM8cIf/suFFjCJeFzsRtIDcE2O6E8JziFfpF136ulDBatPHyoZBtg p/lHP2VNr602x+IE6ABFC+MKpLc9i0l4eiBZewIqo94iC61JgFcRSTIDDtJ/1s50tIiY URUg== 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 Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b13-20020a170903228d00b001bbad3b063bsi10425720plh.345.2023.09.19.07.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 07:49:19 -0700 (PDT) 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 956B581BC2D3; Tue, 19 Sep 2023 07:43:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232944AbjISOnH (ORCPT + 26 others); Tue, 19 Sep 2023 10:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232907AbjISOm4 (ORCPT ); Tue, 19 Sep 2023 10:42:56 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D47BDD; Tue, 19 Sep 2023 07:42:47 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R731e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VsRs7CG_1695134563; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsRs7CG_1695134563) by smtp.aliyun-inc.com; Tue, 19 Sep 2023 22:42:45 +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: alibuda@linux.alibaba.com, tonylu@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 05/18] net/smc: reserve CHID range for SMC-D virtual device Date: Tue, 19 Sep 2023 22:41:49 +0800 Message-Id: <1695134522-126655-6-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com> References: <1695134522-126655-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 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]); Tue, 19 Sep 2023 07:43:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777477835268073049 X-GMAIL-MSGID: 1777477835268073049 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