From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 31F89A0547; Tue, 9 Feb 2021 02:13:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9ECA84014E; Tue, 9 Feb 2021 02:13:35 +0100 (CET) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 1AA9D40147 for ; Tue, 9 Feb 2021 02:13:33 +0100 (CET) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DZPxh6g1Qz7j7J; Tue, 9 Feb 2021 09:12:08 +0800 (CST) Received: from [127.0.0.1] (10.69.27.114) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 09:13:27 +0800 To: Olivier Matz , Thomas Monjalon References: <2589865.Xk4bFtH7LZ@thomas> <20210208084045.GD1725@platinum> CC: Ferruh Yigit , "dev@dpdk.org" , , From: Chengchang Tang Message-ID: Date: Tue, 9 Feb 2021 09:13:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20210208084045.GD1725@platinum> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.27.114] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [Question about 'rte_eth_tx_prepare'] X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2021/2/8 16:40, Olivier Matz wrote: > Hi, > > On Mon, Feb 08, 2021 at 09:07:39AM +0100, Thomas Monjalon wrote: >> 08/02/2021 07:29, Chengchang Tang: >>> Hi, Thomas Monjalon and Ferruh Yigit and others. >>> >>> Here are two questions: >>> 1. What functions should be included in the 'tx_prepare' for PMDs? >>> 2. Whether an app must invoke 'rte_eth_tx_prepare' or under which >>> conditions an app must invoke the 'rte_eth_tx_prepare'? >> >> I would say by default the app should prepare the checksums, >> except if there is an explicit offload request (DEV_TX_OFFLOAD_*). >> I think the tx_prepare should only prepare the HW Tx offload >> if the offload is not entirely done in HW. > > On our side, we call tx_prepare() on a tx bulk if: > > 1/ a Tx offload is enabled on the port (DEV_TX_OFFLOAD_*) > 2/ at least one mbuf in the bulk has an offload flag among > PKT_TX_OFFLOAD_MASK > > The purpose of tx_prepare() is to check that offload can be done in hw, > and to prepare the packet data for the hw. For instance, niantics NICs > require that the L4 checksum in the packet is set to the pseudo-header > checksum. > > This could have be done in the tx() function, but it is a separated > function for 2 reasons: > - the application does not need to call it if it does not do hw tx offload > - the tx_prepare() function may modify packet data, which should not be the > case for tx(). In a pipeline model, these 2 functions may be called on > different cores. > > In my opinion, the tx_prepare() function should deal with outer checksums > preparation as well. > > Olivier > > . Thank you, Thomas and Olivier. It's really helpful. Chengchang