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 4735DA0547; Mon, 8 Feb 2021 09:40:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE9EC40693; Mon, 8 Feb 2021 09:40:48 +0100 (CET) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id 9C82340147 for ; Mon, 8 Feb 2021 09:40:47 +0100 (CET) Received: by mail-wr1-f54.google.com with SMTP id v14so488099wro.7 for ; Mon, 08 Feb 2021 00:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bXh4in/LIHIH4t0HaOub2ChJjqR5VF71HaNmBB8Rg4k=; b=amB+B9AHnnYnRwzM11woVz/ps4V9KmkT5w6fxrvB3kanU/9YS18oaNaysuj2hwvMoZ E/9269MHeRcErMUKwkhbDEZSjx2cGfLl/jxp9rqnMawMUqlE8xFF9Xijo6tw1ELumyRt 7zJgHOYXGcPA+otwd+w1obRIoJeTpVYJsmViQ1cXKHWj5g5XsOKPdo3f8VBvYDrgUvVa 9xUaPaxm5VDVIRFuGTkzBJt8LcYwLQx2OD42iodfm3EuVsGmHFgmIcsyfpXfSF4UMhwR NaVzHna81pI6iO1dPmf6aZonNfIIB0vyzYigU7njw9PJlBDJxHRbCtm/hldImErlz6UC utSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bXh4in/LIHIH4t0HaOub2ChJjqR5VF71HaNmBB8Rg4k=; b=M8qn2msRytsUxJYFs5v7Kcit9uQaWnwFT2jWQvzgCvXKOQvLnLBa2Q+fXAEQ3Cl5S0 mE3+n09EEnOnNQnVh4/vSvTRIjNePAe3CxM5o4VL8bRuiQbeVivWUXOoX/DNCNDs261y wftfiEelIQ3pS1YrrqFNH/pOGTMYFvnzRx663qEviQ9FXUQcZSxn7QyO6GLLmM/QMF4j tGnUeXpymj03l6EhZ4SrOvyaOagpspgfSv8NlEddTmJpON4p9BEkxHYVYFO/1PHDB03R npCRXkqLkOCsZEPYIyYk8JIg03w+Li4HlZ0cPDJJQvKPiDNW0vyoymFH2I58mWlq39p2 8vpw== X-Gm-Message-State: AOAM531oN9qukkIi6eo1AZfEfMExU/5yPO8uw5fUOo04d3FIVldUDVl+ UTNelaD97hVrKgDOAU/SnlEdJV3EOljbyQ== X-Google-Smtp-Source: ABdhPJzDJK3jTiWfEOdXVtZ8Lb0+L2dwPte5+7AhgJZgvrYk8xNtRuFSXIQNH6rpR+i6M/tF9nRrzg== X-Received: by 2002:a05:6000:2cf:: with SMTP id o15mr18300650wry.184.1612773647291; Mon, 08 Feb 2021 00:40:47 -0800 (PST) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id u142sm20483059wmu.3.2021.02.08.00.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 00:40:46 -0800 (PST) Date: Mon, 8 Feb 2021 09:40:45 +0100 From: Olivier Matz To: Thomas Monjalon Cc: Chengchang Tang , Ferruh Yigit , "dev@dpdk.org" , linuxarm@openeuler.org, konstantin.ananyev@intel.com Message-ID: <20210208084045.GD1725@platinum> References: <2589865.Xk4bFtH7LZ@thomas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2589865.Xk4bFtH7LZ@thomas> User-Agent: Mutt/1.10.1 (2018-07-13) 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" 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. > > > > I have some questions about 'rte_eth_tx_prepare'. > > > > When I use TSO offload in bond mode, the checksum error occurs. It is > > because the bond PMD does not implement 'tx_prepare'. So, it will not > > invoke the 'tx_prepare' of each PMDs to do prepare for the PMDs. I am > > not sure whether to add the 'tx_preapre' implementation for the bond > > PMD or put the process of pseudo header in the apps. > > > > And we are now designing the outer UDP cksum offload for HNS3 PMD. > > I find that many PMDs process these pseudo headers in 'tx_prepare', but > > does not process the pseudo header for outer UDP checksum offload. > > Instead, it is processed in csum forward mode of testpmd. Does this mean > > that the pseudo header should be completed by the apps and the apps does > > not need to call 'tx_prepare' to avoid repeated processing? (it seems > > not transplantable) If so, it seems that PMDs need to avoid doing this > > in 'tx_prepare'. > > > > 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