From patchwork Tue Sep 19 14:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gu X-Patchwork-Id: 141928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3445499vqi; Tue, 19 Sep 2023 07:49:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvLn3LgjuclT6tWLQ+xeB75Jifw/SWebOr+J1sRcFaVv2K6Or1ipEzLSOczgII2ytLdXKC X-Received: by 2002:a05:6a21:33a1:b0:15c:9ed0:b1a7 with SMTP id yy33-20020a056a2133a100b0015c9ed0b1a7mr171917pzb.25.1695134963724; Tue, 19 Sep 2023 07:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695134963; cv=none; d=google.com; s=arc-20160816; b=EM+RoeigH4r62fI09K2Anotu66cxnD8jQ5D+aThctTITqOe8DIosNTtIy6fdKYTCXN 5Mq9n4+b/iRBTlW0ateVr52hN56Rez3GjY27HhozEV7sdQ/MlDUkrTH+b8Aj9nRTuh4X Mtzvb19XhpIdGQ7U3TtmS0XpQ3axnymK9DRDYIR/AMOg0742uiLOy5hA+qkuy8cAIw2M 69da8uuWdA1myP5KxfvUPEYkRG5rwgVZAW/kWMEH8qo9HCC1sxcAD9VPiiZiZOa3VSUZ ODXexaZiaPLj8oxyb4mHeHQyc+vYTh6h4/RQzooAqCn06+ajdYeiEaUSQ92A+pnUA4Tk dvIw== 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=FFcdt3tSi5VEvwuNXlGgsQTDRbQOqV1EM+p8fHV+qd8=; fh=2Ks5OhTjwS8gZt4F+VGxBODwUEQ0u2wJBF3lQY5ZqAM=; b=z9oJci8AQfY5B2ZTOVjxbxh3DSBDjNLeZPdJ4C3EGw7RbodTYrxxxbbgDkvaN99z/h uPp3BWh4YJiWvos/t1RvKxqYAT83ntgCxKhq5urbZ3H/4Wxxn+AMC29eQF/ENY3mqb2I XLrVRcqJK9b89h0MvAgzXtKijT7xTs40Oy/ZkR8tHd0kR+gPKBLrAEkpDzN/Bg3cV793 1Og02ChlXaTFA7APHpB3feCfwI9bZKzMcynoIX0K7gacaNy65hfal2DckvlOHSZfZWGI 5vUWxtK2Yrtw4mCeNOsnRnf0DpNWVpubFlSavI5j9d/Odz0x98BCrMoAg3z34hCClOC6 mv+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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. [23.128.96.32]) by mx.google.com with ESMTPS id r15-20020a632b0f000000b00578b0afaee3si1540112pgr.626.2023.09.19.07.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 07:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 EFFF981BE2D5; Tue, 19 Sep 2023 07:44:13 -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 S233112AbjISOno (ORCPT + 26 others); Tue, 19 Sep 2023 10:43:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbjISOna (ORCPT ); Tue, 19 Sep 2023 10:43:30 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14170CE0; Tue, 19 Sep 2023 07:43:08 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VsRxWEI_1695134583; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsRxWEI_1695134583) by smtp.aliyun-inc.com; Tue, 19 Sep 2023 22:43:04 +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 14/18] net/smc: add operation for getting DMB attribute Date: Tue, 19 Sep 2023 22:41:58 +0800 Message-Id: <1695134522-126655-15-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:44:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777477839663292620 X-GMAIL-MSGID: 1777477839663292620 On s390, ISM devices are used on machine level hypervisors which is a partitioning hypervisor without paging. The sndbufs and peer DMBs in such case can't be mapped to the same physical memory. However in other cases, such as communication within the same OS instance with loopback, the sndbufs and peer DMBs can be mapped to the same physical memory to avoid memory copy from sndbufs to peer DMBs. So this patch introduces an operation to smcd_ops to judge whether the sndbufs-DMB map is available. And for reuse, the interface is designed to return DMB attribute, not only the sndbuf-DMB map feature. Signed-off-by: Wen Gu --- include/net/smc.h | 5 +++++ net/smc/smc_ism.c | 8 ++++++++ net/smc/smc_ism.h | 1 + 3 files changed, 14 insertions(+) diff --git a/include/net/smc.h b/include/net/smc.h index 389d26d..6930c8a 100644 --- a/include/net/smc.h +++ b/include/net/smc.h @@ -55,6 +55,10 @@ struct smcd_seid { #define ISM_ERROR 0xFFFF +enum { + ISM_ATTR_DMB_MAP = 0, +}; + struct smcd_dev; struct smcd_gid { @@ -82,6 +86,7 @@ struct smcd_ops { void (*get_local_gid)(struct smcd_dev *dev, struct smcd_gid *gid); u16 (*get_chid)(struct smcd_dev *dev); struct device* (*get_dev)(struct smcd_dev *dev); + int (*get_dev_attr)(struct smcd_dev *dev); }; struct smcd_dev { diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index ba37b27..14e018c 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -214,6 +214,14 @@ int smc_ism_unregister_dmb(struct smcd_dev *smcd, struct smc_buf_desc *dmb_desc) return rc; } +bool smc_ism_dmb_mappable(struct smcd_dev *smcd) +{ + if (smcd->ops->get_dev_attr && + (smcd->ops->get_dev_attr(smcd) & BIT(ISM_ATTR_DMB_MAP))) + return true; + return false; +} + int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len, struct smc_buf_desc *dmb_desc) { diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h index 7ab82dd..cef212c 100644 --- a/net/smc/smc_ism.h +++ b/net/smc/smc_ism.h @@ -44,6 +44,7 @@ int smc_ism_cantalk(struct smcd_gid *peer_gid, unsigned short vlan_id, int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size, struct smc_buf_desc *dmb_desc); int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc); +bool smc_ism_dmb_mappable(struct smcd_dev *smcd); int smc_ism_signal_shutdown(struct smc_link_group *lgr); void smc_ism_get_system_eid(u8 **eid); u16 smc_ism_get_chid(struct smcd_dev *dev);