Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp978537iob; Fri, 13 May 2022 18:23:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUfmfe/YWEAXV2ZVztIO9jiH6AG417DLIX3fnbqZhagNvPXOH1xMsRsV8GDwyp+Wd9wR0W X-Received: by 2002:adf:f2c6:0:b0:20c:9155:b946 with SMTP id d6-20020adff2c6000000b0020c9155b946mr5900790wrp.20.1652491391146; Fri, 13 May 2022 18:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652491391; cv=none; d=google.com; s=arc-20160816; b=V4yV+jmKDIZiQeSZo+Jmo6vvIkOas3lIGe4KR06B1TozB9TnxnPBZeriCmsV5oZeSA EXiiMp/nMU+2ZXncIRHzi1iS4GGud33A7DZh+2WMUQu1PW4HLdcKL/UJbR/95mvd4mUd hfreonIBggwannq7aH++8bOobJEphatoxYVkOWWdL/hUxet+ZNoBGYPt28R3VHSO+M6u 6rPkKjNsskHEVKs0A7ER8BjZx0teRMOILzL2225twkhFBhfTzqFjCz73HQ3vNDSFKfjv 5PbPaRXKch7fDgIcSyM64iUxSkNCE0ngRr3izvC/jz3jSZPsFlTqpXb59eB7L1AmTFir jzig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rj7391yePaqQ9/+W4SeA6p0LFKOIiy/6tRdl4soB4io=; b=mvbrVK9b6m9ORsZrHR6XCMzyu5E1qKHfaIqZKMCp7/3ocfcAH1XbBmUAPLo4K3IaYN 3CEdKVE0IXG2X70dqJloFt9BNoXnVRs6a4aRymBm/REQK6vHXAxYpU5ztf3UQrlOTT5f J3VgMS3dhRwRjF7Hfa/k8XKFSdAcGokcMGOb5AJTHFEuYCdwIqa3yuONgr9HEsvYRsQZ MIKWHz0UH4N6LAkjridf6GcSzlDB1/2PAp6ilMmtSe44ykWH7gyqLFHR1D0psSDDo8IP rBGlS9eQFcY1TSyRhALD4aw8orB1TDyAp2R+mf7jvU18zTDJqgZLfCkSfEyXqzcjfRWz rLBw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w13-20020a5d608d000000b0020cd4de0237si3312665wrt.497.2022.05.13.18.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:23:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3D2273D17B3; Fri, 13 May 2022 16:52:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377758AbiEMHQU (ORCPT + 99 others); Fri, 13 May 2022 03:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354299AbiEMHQI (ORCPT ); Fri, 13 May 2022 03:16:08 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A9241988; Fri, 13 May 2022 00:16:05 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=guangguan.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VD2I.iy_1652426161; Received: from localhost.localdomain(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0VD2I.iy_1652426161) by smtp.aliyun-inc.com(127.0.0.1); Fri, 13 May 2022 15:16:01 +0800 From: Guangguan Wang To: kgraul@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: [PATCH net-next 2/2] net/smc: rdma write inline if qp has sufficient inline space Date: Fri, 13 May 2022 15:15:51 +0800 Message-Id: <20220513071551.22065-3-guangguan.wang@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20220513071551.22065-1-guangguan.wang@linux.alibaba.com> References: <20220513071551.22065-1-guangguan.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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 Rdma write with inline flag when sending small packages, whose length is shorter than the qp's max_inline_data, can help reducing latency. In my test environment, which are 2 VMs running on the same physical host and whose NICs(ConnectX-4Lx) are working on SR-IOV mode, qperf shows 0.5us-0.7us improvement in latency. Test command: server: smc_run taskset -c 1 qperf client: smc_run taskset -c 1 qperf -oo \ msg_size:1:2K:*2 -t 30 -vu tcp_lat The results shown below: msgsize before after 1B 11.2 us 10.6 us (-0.6 us) 2B 11.2 us 10.7 us (-0.5 us) 4B 11.3 us 10.7 us (-0.6 us) 8B 11.2 us 10.6 us (-0.6 us) 16B 11.3 us 10.7 us (-0.6 us) 32B 11.3 us 10.6 us (-0.7 us) 64B 11.2 us 11.2 us (0 us) 128B 11.2 us 11.2 us (0 us) 256B 11.2 us 11.2 us (0 us) 512B 11.4 us 11.3 us (-0.1 us) 1KB 11.4 us 11.5 us (0.1 us) 2KB 11.5 us 11.5 us (0 us) Signed-off-by: Guangguan Wang --- net/smc/smc_tx.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c index 98ca9229fe87..4294259b3588 100644 --- a/net/smc/smc_tx.c +++ b/net/smc/smc_tx.c @@ -391,12 +391,20 @@ static int smcr_tx_rdma_writes(struct smc_connection *conn, size_t len, int rc; for (dstchunk = 0; dstchunk < 2; dstchunk++) { - struct ib_sge *sge = - wr_rdma_buf->wr_tx_rdma[dstchunk].wr.sg_list; + struct ib_rdma_wr *wr = &wr_rdma_buf->wr_tx_rdma[dstchunk]; + struct ib_sge *sge = wr->wr.sg_list; + u64 base_addr = dma_addr; + + if (dst_len <= link->qp_attr.cap.max_inline_data) { + base_addr = (u64)conn->sndbuf_desc->cpu_addr; + wr->wr.send_flags |= IB_SEND_INLINE; + } else { + wr->wr.send_flags &= ~IB_SEND_INLINE; + } num_sges = 0; for (srcchunk = 0; srcchunk < 2; srcchunk++) { - sge[srcchunk].addr = dma_addr + src_off; + sge[srcchunk].addr = base_addr + src_off; sge[srcchunk].length = src_len; num_sges++; @@ -410,8 +418,7 @@ static int smcr_tx_rdma_writes(struct smc_connection *conn, size_t len, src_len = dst_len - src_len; /* remainder */ src_len_sum += src_len; } - rc = smc_tx_rdma_write(conn, dst_off, num_sges, - &wr_rdma_buf->wr_tx_rdma[dstchunk]); + rc = smc_tx_rdma_write(conn, dst_off, num_sges, wr); if (rc) return rc; if (dst_len_sum == len) -- 2.24.3 (Apple Git-128)