From patchwork Mon Mar 27 03:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gu X-Patchwork-Id: 75198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1258744vqo; Sun, 26 Mar 2023 21:05:33 -0700 (PDT) X-Google-Smtp-Source: AK7set9YjCRS3YOFDWYGesk0TidFOkONJ4A6032GWGBuB2W5cq7bakMaaL6j1n03O3ZMPSYWAvnC X-Received: by 2002:a05:6a21:3381:b0:db:5e69:c97d with SMTP id yy1-20020a056a21338100b000db5e69c97dmr11487768pzb.25.1679889933349; Sun, 26 Mar 2023 21:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679889933; cv=none; d=google.com; s=arc-20160816; b=BeM539SlGAm0zPfChEu87jqbN7Z56ngJ772WBkfB6H7dJkEEYMCHN6qc9BxCMQXLg6 yNOflleBG29i//uRjF2IC6Yj2LqTBWc6QXP8hHYn0l2WoTKItdzSbFflqzhPZNga3AZM DsSJnYo5QuLmB2KhvPFLv7k/D0LavFyTKriyG3yW7CESa4d1zp4S9W05TyTM8WBEf8QM I4CiaWrMhVrmBkzlw80Mbsv7Ytg8b3GxHPntj1pnFEe+sACQdXFmrdLAWwNyiKgbCQpb K1s86BJSPiGAoKN5QpxpygTz+Fbg4qzaJj0Fgx9x03BM6LiHacSfp2BuF7fw6+KcMjej +Whg== 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=FWgAq5XacUQ3PHXBiD85lQqFfmLKwE7hSbXXaIuBmYk=; b=PDLZwsXsQKulSyJPtpB3Ydg7VT1XeqVfR/Dqvnsq8Ivi4Q9G91Q1JfCvMn+k5fuILS 97jiLpHp37FdgEZVSE5OssuN3UITdiDm4O/1Lf/QBSSACyVY1hGjPKBVsxElV3cyrjLS BWYZ4d2OFjzSV0ybuKTvrhf1L2SQZpsMoCrcJqcsqnLqdaq29VbC6c13PQkp/ZU+PI3n feeZOdWe7zd0pzZo0qOXx9hdxE+T/1Jtb9T0JYOqLPa6WuZvPISzKnHFqTK1+Rz1nZCb QQKz+5e2zcJ5iISw2Z4M+ApXZr7Q/gEHNq8g/Hv7VPOoOBPgc80bZ+8CC/KCCfx6iv7v lsNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a63eb4b000000b005033552517bsi24591235pgk.281.2023.03.26.21.05.20; Sun, 26 Mar 2023 21:05:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232115AbjC0D2z (ORCPT + 99 others); Sun, 26 Mar 2023 23:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231979AbjC0D2k (ORCPT ); Sun, 26 Mar 2023 23:28:40 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B1855255; Sun, 26 Mar 2023 20:28:34 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R541e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VeeviqL_1679887710; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VeeviqL_1679887710) by smtp.aliyun-inc.com; Mon, 27 Mar 2023 11:28:31 +0800 From: Wen Gu To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, wintera@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next v4 5/9] net/smc: Introduce an interface for getting DMB attribute Date: Mon, 27 Mar 2023 11:28:15 +0800 Message-Id: <1679887699-54797-6-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1679887699-54797-1-git-send-email-guwen@linux.alibaba.com> References: <1679887699-54797-1-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761492266964028162?= X-GMAIL-MSGID: =?utf-8?q?1761492266964028162?= On s390, since all OSs run on a kind of machine level hypervisor which is a partitioning hypervisor without paging, the sndbufs and DMBs in such case are unable to be mapped to the same physical memory. However, in other scene, such as communication within the same OS instance (loopback) or between guests of a paging hypervisor (see [1]), eg. KVM, the sndbufs and DMBs can be mapped to the same physical memory to avoid memory copy from sndbufs to DMBs. So this patch introduces an interface to smcd_ops for users to judge whether DMB-map is available. And for reuse, the interface is designed to return DMB attribute, not only mappability. [1] https://lists.oasis-open.org/archives/virtio-comment/202302/msg00148.html 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 021ca42..e39ac41 100644 --- a/include/net/smc.h +++ b/include/net/smc.h @@ -55,6 +55,10 @@ struct smcd_seid { #define ISM_ERROR 0xFFFF +enum { + ISM_DMB_MAPPABLE = 0, +}; + struct smcd_dev; struct smcd_ops { @@ -77,6 +81,7 @@ struct smcd_ops { u64 (*get_local_gid)(struct smcd_dev *dev); u16 (*get_chid)(struct smcd_dev *dev); struct device* (*get_dev)(struct smcd_dev *dev); + int (*get_dev_dmb_attr)(struct smcd_dev *dev); }; struct smcd_dev { diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index f638999..a21c867 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -233,6 +233,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_dmb_attr && + (smcd->ops->get_dev_dmb_attr(smcd) & (1 << ISM_DMB_MAPPABLE))) + 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 870ff7b..0ddaa45 100644 --- a/net/smc/smc_ism.h +++ b/net/smc/smc_ism.h @@ -39,6 +39,7 @@ struct smc_ism_vlanid { /* VLAN id set on ISM device */ 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);