From patchwork Sun Sep 24 15:16: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: 144110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp713958vqu; Sun, 24 Sep 2023 08:19:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGETnPj669kuaYutLymBKkQfOw+BRRuI45dA2yPgIY7eeUKwa0kdK90+3oY80bM2UU8ppuH X-Received: by 2002:a17:90a:3de1:b0:268:b7a2:62e8 with SMTP id i88-20020a17090a3de100b00268b7a262e8mr3676837pjc.7.1695568742006; Sun, 24 Sep 2023 08:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695568741; cv=none; d=google.com; s=arc-20160816; b=rIOKT3P9d26si1d6YFSVOSX3zgv+gtDQ8wKsw74z5ARNjBWAyxY1paHRsmbV2/DFJP oOf+qW1A8r+Aj4QyDTz4W7gt6G6lieQe5jcGWYzIjf3Bq3eGSJXWJCWQwCSaJv71EIsl I7NIZKdEJavuL8wu8Pycihin0dn9cRmdQlnGI4MejEyGgobR8PWvNXMSRsyB6WmoR5RJ XpWwkKpZCkmrH1nwwvzQShnoGU8oFRcyOOw2QhJvDhci1cqDEFiUS/QlSp12nMFBOG8u G3LfBsKNewGiJ8OqEuKuSOVq1OnxbBFjv0r46RlV6YO3Tr+niF3J+s+P4ECUb7rbNAg5 WCVQ== 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=km7+MH/uplDfRrTYczBdO8VBKCN2dKEvxBb7zJjCRIE=; fh=kTBstCixiri9Ahdk8UNuw7wmcx8Ry+mqafUdDsc8Vd0=; b=mS4gKA26yiJS30/I2qKdXisp0e/GVv/UOkFhMSbvt/LSsv6mNPzjAP3LZFTehOREOo By/rBUU3o2unWfJk58PF7IusdP8Y/iTtE8SXLFrzD4VhVL88wjT8duqntog+qt2yJ+Yv iRySX0NmCvf3xXK0QG+N4SwVi1GF8d6fa3RVOXyLFd65eQMYBSsFTtsIP6FaC38ZIMic EO6s3iBaNmjLCAWlGMF+K59lFYlbx8wjuTzHkj3Y6c+o0jgahqucCH6qKn6o7Tdx+qhS 6ECLapBOiTiLLGqzqOuiyWGtg50hdH/h/8eM/QI1Qp4x9xAGM8zj6tpy3THapEdM66TP C8pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id nv9-20020a17090b1b4900b0026b365096e5si11194203pjb.53.2023.09.24.08.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id B3821801F3F0; Sun, 24 Sep 2023 08:18:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230249AbjIXPSS (ORCPT + 30 others); Sun, 24 Sep 2023 11:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbjIXPRx (ORCPT ); Sun, 24 Sep 2023 11:17:53 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3363719C; Sun, 24 Sep 2023 08:17:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0Vsir41W_1695568649; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vsir41W_1695568649) by smtp.aliyun-inc.com; Sun, 24 Sep 2023 23:17:31 +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: wintera@linux.ibm.com, schnelle@linux.ibm.com, gbayer@linux.ibm.com, pasic@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, dust.li@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 v4 14/18] net/smc: add operation for getting DMB attribute Date: Sun, 24 Sep 2023 23:16:49 +0800 Message-Id: <1695568613-125057-15-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695568613-125057-1-git-send-email-guwen@linux.alibaba.com> References: <1695568613-125057-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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 24 Sep 2023 08:18:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777932689346159274 X-GMAIL-MSGID: 1777932689346159274 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 7c2d35c..917572fb 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 0922fab..9b31d00 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);