Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2749602iob; Mon, 16 May 2022 05:33:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTjFyh6zfG+rkz2T22LZpPQUybCoPfGw5+NhvW/nHTPGSQ0Bkjc/xHuUK57zdHKFoGb7uh X-Received: by 2002:a5d:6d05:0:b0:20c:64fd:f98a with SMTP id e5-20020a5d6d05000000b0020c64fdf98amr13887357wrq.474.1652704423191; Mon, 16 May 2022 05:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652704423; cv=none; d=google.com; s=arc-20160816; b=YQRX7jF23W197WpG8I8rq5o1WpFnuEtXjip6heHPJ+Y9meqWlwhKxQL40w/dlIhtP/ CpyB2m0Qeop1U3IMnKZzoTcOf4/eLM8tDivoyCMSTvCEOJPnfebjGL6Sst/tCXs8SrZC 3GTJXPyYoD7xcovl/uylvnNl+aqCjEgC1zFPRlOHTyaLVT+V7W7IbCnEEvYfsNnXRV8M HnrEw29X0BNiNAThKtJ/MH58QyAnV8KOGBOB7DZMYCBHqdGSxiUzYUjEoL9MofNz1CEo jfNRTwQAbgB6TLoXMv6pLRtjBn/EUVbsIfS6sk54EuCW3GQV4CDfoAzBrgwytsZLCy3u 4M5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=0hpCpSpBc/kL5pPH5On8V44n7izwGZ2OReTQFI/w/30=; b=cofcmZ5qGfNy5/DOYOzsWv81/O8aU7kJiyhzHZe5xFbMNeeEkz9VB/Nx30I3eJ90lZ gEtbw+8C37iE2h3bL+vkzl2TmWVkyHXcNIlO3qu9njmw4I3HE/nxrSNUpwHd1v86c7RT Gi8bcRZKC06dnrhdXxgA/C7S3MJGYteBYautjGOI8l2BIaZkzZT00IA0bKyazaIg4v0U TVSF5FIykKcqCkocxYf3wboA5D84G05dy6ahkuvcGqunY0ckdhWMrnaFFA8TxjCEqLGB IJwoyHoOHhZyyZJW7QDxooaTQ55M6DSnbVuTSzeNxNJV3mVK48aarqzm60GDVP//fWf6 xKVQ== 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 a6-20020a056000188600b0020a789fbbb7si10326362wri.1036.2022.05.16.05.33.14; Mon, 16 May 2022 05:33:43 -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 S231515AbiENJhD (ORCPT + 99 others); Sat, 14 May 2022 05:37:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231331AbiENJhB (ORCPT ); Sat, 14 May 2022 05:37:01 -0400 Received: from out199-17.us.a.mail.aliyun.com (out199-17.us.a.mail.aliyun.com [47.90.199.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A6C61B8; Sat, 14 May 2022 02:36:58 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R751e4;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=9;SR=0;TI=SMTPD_---0VD6nEFN_1652521014; Received: from 30.15.218.194(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0VD6nEFN_1652521014) by smtp.aliyun-inc.com(127.0.0.1); Sat, 14 May 2022 17:36:55 +0800 Message-ID: <8a2be07b-acf6-1148-e299-8196c18cfeed@linux.alibaba.com> Date: Sat, 14 May 2022 17:36:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH net-next 1/2] net/smc: send cdc msg inline if qp has sufficient inline space Content-Language: en-US To: Leon Romanovsky Cc: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220513071551.22065-1-guangguan.wang@linux.alibaba.com> <20220513071551.22065-2-guangguan.wang@linux.alibaba.com> From: Guangguan Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,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 On 2022/5/14 14:02, Leon Romanovsky wrote: >> diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c >> index 24be1d03fef9..8a2f9a561197 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); > > When will it be false? You are creating QPs with 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 ? (u64)(&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; > > If you try to transfer data == SMC_WR_TX_SIZE, you will get -ENOMEM error. > IB drivers check that length < qp->max_inline_data. > > Thanks > Got it. I should create qps with max_inline_data == 0, and get the actual max_inline_data by query_qp. And I should use lnk->qp_attr.cap.max_inline_data > SMC_WR_TX_SIZE to decide whether to send inline or not. Thank you.