Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1469210iob; Sat, 14 May 2022 09:48:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdNg0E/hVIm/ks7kRX6yml3Oqnn1J5mqAyn2BhNXfByWPABg3F12qAKBD82TAMhsHkvSa9 X-Received: by 2002:a05:6402:424a:b0:427:d3d0:da1e with SMTP id g10-20020a056402424a00b00427d3d0da1emr4708536edb.262.1652546919220; Sat, 14 May 2022 09:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652546919; cv=none; d=google.com; s=arc-20160816; b=jOrem5b/BhLr4Zdy9MjV53nfw0AJF05GNFPJMrV0DNpl2fEoelZ/KaYgGau5r6Ubaf 2aGtu6UrPBwLcv9ZnZKONPYbBaDAGrCfLv17ErwlWRj9cxAAEdP8w9d5XPmqXdHUy/sd 6pUXQZ0BRqVvkt+gbc3RSc1MKSk6Wvrjx1zYs57mU+46LyK63Py2aXYrd7qqTTgyLRzv VZnrcqRO6SHxfZDHtamiDQak4y/0TNIHh/CP72mr0o1P4t8pepVvM279rlITwq3boOeP RPmVG9virYPYDiuNJZtMmv718uqWHXJY09HQHqgRjGlOXamB0PTRxSDvGLXzkEXxmsiN uj7w== 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=fcrbdBf4XpY1hfGB7WBkHjmnFSLZYkEDdKBUf76tWjg=; b=AkSnadIXZVIoy9XLNmgVrKhPi+zPvMMiF7Xamsxh0Ek3BS7Drd6S5ERuVB+Dwa9aG0 GB5++2x5bPwcrRKcWmfPYA55rWCdDwHbzmKNf80pIA2ADYPD6rKt9HH4YnonCO1QQ5hf usjgxf31v9aWTL4Vdw4Q7g2MdL0zgUbC992unaP0xTaSvoDdUZILJtcC7iPo2oYdZtL9 y1Zq3RrHxSfruhFpsD+f+iNKfKtGfkFQGVrGkO8IUQCXHNsbU++WREpXJc7NXRyMpkgy MMsIcNy00Kg6kbPFJ4WC8UdEyI58uOMJgtyurKROIRkfOv4jukakTEZyWOC0KmnkIYGP 4Bow== 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 h20-20020a170906111400b006f4bc447ddfsi5108802eja.773.2022.05.14.09.48.05; Sat, 14 May 2022 09:48:39 -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 S231710AbiENK2V (ORCPT + 99 others); Sat, 14 May 2022 06:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbiENK17 (ORCPT ); Sat, 14 May 2022 06:27:59 -0400 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C780A39173; Sat, 14 May 2022 03:27:56 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R681e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=guangguan.wang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VD6nQiT_1652524073; Received: from localhost.localdomain(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0VD6nQiT_1652524073) by smtp.aliyun-inc.com(127.0.0.1); Sat, 14 May 2022 18:27:53 +0800 From: Guangguan Wang To: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, leon@kernel.org Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH net-next v2 1/2] net/smc: send cdc msg inline if qp has sufficient inline space Date: Sat, 14 May 2022 18:27:38 +0800 Message-Id: <20220514102739.41252-2-guangguan.wang@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20220514102739.41252-1-guangguan.wang@linux.alibaba.com> References: <20220514102739.41252-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 As cdc msg's length is 44B, cdc msgs can be sent inline in most rdma devices, which can help reducing sending 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.4us-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.9 us 11.2 us (-0.7 us) 2B 11.7 us 11.2 us (-0.5 us) 4B 11.7 us 11.3 us (-0.4 us) 8B 11.6 us 11.2 us (-0.4 us) 16B 11.7 us 11.3 us (-0.4 us) 32B 11.7 us 11.3 us (-0.4 us) 64B 11.7 us 11.2 us (-0.5 us) 128B 11.6 us 11.2 us (-0.4 us) 256B 11.8 us 11.2 us (-0.6 us) 512B 11.8 us 11.4 us (-0.4 us) 1KB 11.9 us 11.4 us (-0.5 us) 2KB 12.1 us 11.5 us (-0.6 us) Reported-by: kernel test robot Signed-off-by: Guangguan Wang --- net/smc/smc_ib.c | 1 + net/smc/smc_wr.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index a3e2d3b89568..dcda4165d107 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -671,6 +671,7 @@ int smc_ib_create_queue_pair(struct smc_link *lnk) .max_recv_wr = SMC_WR_BUF_CNT * 3, .max_send_sge = SMC_IB_MAX_SEND_SGE, .max_recv_sge = sges_per_buf, + .max_inline_data = 0, }, .sq_sig_type = IB_SIGNAL_REQ_WR, .qp_type = IB_QPT_RC, diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c index 24be1d03fef9..26f8f240d9e8 100644 --- a/net/smc/smc_wr.c +++ b/net/smc/smc_wr.c @@ -554,10 +554,11 @@ void smc_wr_remember_qp_attr(struct smc_link *lnk) static void smc_wr_init_sge(struct smc_link *lnk) { int sges_per_buf = (lnk->lgr->smc_version == SMC_V2) ? 2 : 1; + bool send_inline = (lnk->qp_attr.cap.max_inline_data > SMC_WR_TX_SIZE); u32 i; for (i = 0; i < lnk->wr_tx_cnt; i++) { - lnk->wr_tx_sges[i].addr = + lnk->wr_tx_sges[i].addr = send_inline ? (uintptr_t)(&lnk->wr_tx_bufs[i]) : lnk->wr_tx_dma_addr + i * SMC_WR_BUF_SIZE; lnk->wr_tx_sges[i].length = SMC_WR_TX_SIZE; lnk->wr_tx_sges[i].lkey = lnk->roce_pd->local_dma_lkey; @@ -575,6 +576,8 @@ static void smc_wr_init_sge(struct smc_link *lnk) lnk->wr_tx_ibs[i].opcode = IB_WR_SEND; lnk->wr_tx_ibs[i].send_flags = IB_SEND_SIGNALED | IB_SEND_SOLICITED; + if (send_inline) + lnk->wr_tx_ibs[i].send_flags |= IB_SEND_INLINE; lnk->wr_tx_rdmas[i].wr_tx_rdma[0].wr.opcode = IB_WR_RDMA_WRITE; lnk->wr_tx_rdmas[i].wr_tx_rdma[1].wr.opcode = IB_WR_RDMA_WRITE; lnk->wr_tx_rdmas[i].wr_tx_rdma[0].wr.sg_list = -- 2.24.3 (Apple Git-128)