Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2551876iob; Mon, 16 May 2022 00:08:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzii5yo0VDJleX+aUG46kH9cEKjEQtzqVm7yH9+EMm9xn904zd+lm79WNPZClhgzY6KGyYu X-Received: by 2002:a05:6402:34ca:b0:427:c655:9dd6 with SMTP id w10-20020a05640234ca00b00427c6559dd6mr11502549edc.372.1652684884416; Mon, 16 May 2022 00:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652684884; cv=none; d=google.com; s=arc-20160816; b=fx15NaXP2o5+xJSNZ2yxcBuQ6pfsnAAFgKlz6MqEgHP0EwYP/yS5UXBB44ghYEsHeg q33jy1Md+gvrsxBOCCft/d4gQuRHcl5ggfSb9g5M5gNK/xvtkGhr+E47f/oKBMaGZHYv VmOFj26XF0LG8VuiWyXgZxGxTSXGigNM7f3KT4Mye0ZCx9SagIjHjIgUgFgME8jHDOta 6XMM2AYfBJMIZrub+MWst5GaMp4+8ic4tCzFWMvMVkcD9N/glz8vqz/iZFg2h3qua4ZF 5AU0H0iqBhpJE1JDer4z7xZW+9vVYYKAnNG/Mi+m+Fgv1g9tzS4V2trLSWayHiK/jYBG aWXA== 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=VnJ7HWOq+xA1vqq7WHLRpU6uY2gklYAGHcAZ+f8uqak=; b=QG7S1oTRheje4zem1FL5z7NX7jLTYxnQQIpb5PKAXFETrMEiL9forbaUFVSLXZcxxb GORFYe3MzurMVXEeH/ZkwwBk6Zl9ozYSoUrfU7qBJslQbSpRMB9P4xexWYm3iO6EKb3Y 7d7r941/dvdhkBXG+z8bvfCMPywH67jXUuHPqwQ0DHk6dqZdByNOmJz+E+bIws8eJuYH YczKQnWf5EM8hVnhdZ35bQ1Xl3dk46TbXLNpJd/u1pA5AcV3Phvg4acG+8JSzQRSljzg q0d2ig4oUWSKU2qusTqnnY3Kbml6INnXVHIgXxxLHxd8yiiBQG7BlkYYiIg19m46PSEg cufA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk6-20020a1709077f8600b006dffb6427bdsi9970314ejc.269.2022.05.16.00.07.39; Mon, 16 May 2022 00:08:04 -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 S239908AbiEPFwA (ORCPT + 99 others); Mon, 16 May 2022 01:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239943AbiEPFvw (ORCPT ); Mon, 16 May 2022 01:51:52 -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 1453615712; Sun, 15 May 2022 22:51:50 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=guangguan.wang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VDEQJfr_1652680307; Received: from localhost.localdomain(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0VDEQJfr_1652680307) by smtp.aliyun-inc.com(127.0.0.1); Mon, 16 May 2022 13:51:47 +0800 From: Guangguan Wang To: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, leon@kernel.org, tonylu@linux.alibaba.com Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH net-next v3 2/2] net/smc: rdma write inline if qp has sufficient inline space Date: Mon, 16 May 2022 13:51:37 +0800 Message-Id: <20220516055137.51873-3-guangguan.wang@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20220516055137.51873-1-guangguan.wang@linux.alibaba.com> References: <20220516055137.51873-1-guangguan.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham 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 Reviewed-by: Tony Lu Tested-by: kernel test robot --- 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..805a546e8c04 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 = (uintptr_t)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)