Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp709144rdh; Sun, 24 Sep 2023 08:18:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRvrycDXxtyYmlj/dX8pJBG0zQYHHPEeurSKHojPNQ5f0gkg4cmCQFVbpX1ZYg52yqLVpf X-Received: by 2002:a05:6358:4319:b0:13f:7e5:b397 with SMTP id r25-20020a056358431900b0013f07e5b397mr1809996rwc.7.1695568726786; Sun, 24 Sep 2023 08:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695568726; cv=none; d=google.com; s=arc-20160816; b=Ommgt3nFkhs84Bm3b9IdG0ErbpuxtoQbuvy8NF78EmFvQqi5rXQX2hT89bN29/e81a yUW9RnRt60TtCWn7/gXSRjihqCPUQmHZ5Lw6PUot6QjS394qFjroYMfWc9o+53RPpm9H qs9xO9s39vWNblVLNW/M6vM06RfXi6bCWGQeFKE4KY9Hguk/6Kdwke1k+FwAlcd9F9KK r5guvktjNMM1GtpjwHjD2LuWYuztGJGDWm+UQ+8zlkY64Epgwm2Pn5qgOGfeIsROYs5/ a6GiOs/6/XqrT6koKBDQ5P6M9L/LykQ6Qk2ZLZQfGpPNetAYLk1HyBP4gwf24diTYX8b BsJg== 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 Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id l5-20020a633e05000000b005698cf29f75si8251105pga.222.2023.09.24.08.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:18:46 -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 B7A178020FA3; Sun, 24 Sep 2023 08:18:39 -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 S230151AbjIXPSS (ORCPT + 99 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:39 -0700 (PDT) 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); -- 1.8.3.1