From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CFD3CA0579;
	Thu,  8 Apr 2021 09:42:01 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id BDEB740698;
	Thu,  8 Apr 2021 09:42:01 +0200 (CEST)
Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com
 [209.85.221.41]) by mails.dpdk.org (Postfix) with ESMTP id 3BBF940138
 for <dev@dpdk.org>; Thu,  8 Apr 2021 09:42:01 +0200 (CEST)
Received: by mail-wr1-f41.google.com with SMTP id a6so993685wrw.8
 for <dev@dpdk.org>; Thu, 08 Apr 2021 00:42:01 -0700 (PDT)
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=k3HURz5CKFJXChQAodvSTbV5qBw89wwLzaTv+0T9MKg=;
 b=aRInmM5EEfsC6O756f+Apbp0C4qtBPNUwq1WozC0V2zGMihagQP0JIufO74tNJqkPV
 yp4hX6BOGppVXgB8nE08ReKhDju8GU3LGDZKNS/MIkNYKfk1sYgzK0e3cRmIQImKkE4v
 uOekSLLvfkRfvuOY+nkW4ZJPY1LkTpIaDykC3p8lerTd7PHifzdggmm4G8F0eAhySlsV
 yVE/kcsOoZKVaycIoUPi2NHH+1IjWzWqZz0K7ZrGi3A+/rQjbDrmI6bf900wNDmtGEj5
 WR6qg5QAOOJ/pJjuSbNR5/ZyHsBhfsdzzLGIFiQvf0oudncXwoTZcBjiKWVggfyTzB2L
 eDqA==
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=k3HURz5CKFJXChQAodvSTbV5qBw89wwLzaTv+0T9MKg=;
 b=SpG81dH4PUzwLxY9kwj4v0ZLaxjDVpVCGPalFcAQtf/aZS0S8bcgEbFm4DsSJYCWaa
 Lgmi0s6K9V7M7XErljWqqBuJxzvWq4PYDdb44c839XB/mfYVOzLPLpnmnKA0cOBLlahU
 mXE89kTPixjxT7EE9cvt6dOkSV3lYHnAdTv6hgzVHtIh1dXV9NXEjLmtPCho/6iVSNTH
 Qwz66w5l/RSFA0WWxb9FLd00wWiMkuYTZM73t0o/92YPoKvKWrZNH3RxwwebU0mx9nX1
 ql6eHLZkR3sWMU5Xv2O9fuijnyQ9lYeC69WWTkH/1BOUFvzrWnbDDKywyTZEoj7obCJh
 RHlw==
X-Gm-Message-State: AOAM530uWjVdkfjVn6872RAeZYqYBmSsD/cvJB0RKRx9DBA6Dsfv4MX0
 8BXYd/znvxgrqrOlpj+p+C3LFw==
X-Google-Smtp-Source: ABdhPJzMctURHYj6HCAX322pAJmOP1zuqJOf0s6GSIjUL41C44DDTso9F3K9mf8f8J7OyksHRwz/VQ==
X-Received: by 2002:a5d:530d:: with SMTP id e13mr9462226wrv.334.1617867720959; 
 Thu, 08 Apr 2021 00:42:00 -0700 (PDT)
Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25])
 by smtp.gmail.com with ESMTPSA id p10sm1382626wmi.0.2021.04.08.00.42.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 08 Apr 2021 00:42:00 -0700 (PDT)
Date: Thu, 8 Apr 2021 09:41:59 +0200
From: Olivier Matz <olivier.matz@6wind.com>
To: Flavio Leitner <fbl@sysclose.org>
Cc: David Marchand <david.marchand@redhat.com>, dev@dpdk.org,
 maxime.coquelin@redhat.com, i.maximets@ovn.org,
 Keith Wiles <keith.wiles@intel.com>
Message-ID: <20210408074159.GQ1650@platinum>
References: <20210401095243.18211-1-david.marchand@redhat.com>
 <20210401095243.18211-3-david.marchand@redhat.com>
 <YG4S6/rUguRiKYf5@p50.lan>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <YG4S6/rUguRiKYf5@p50.lan>
User-Agent: Mutt/1.10.1 (2018-07-13)
Subject: Re: [dpdk-dev] [PATCH 2/5] net/tap: do not touch Tx offload flags
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Wed, Apr 07, 2021 at 05:15:39PM -0300, Flavio Leitner wrote:
> On Thu, Apr 01, 2021 at 11:52:40AM +0200, David Marchand wrote:
> > Tx offload flags are of the application responsibility.
> > Leave the mbuf alone and check for TSO where needed.
> > 
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> 
> The patch looks good, but maybe a better approach would be
> to change the documentation to require the TCP_CKSUM flag
> when TCP_SEG is used, otherwise this flag adjusting needs
> to be replicated every time TCP_SEG is used.
> 
> The above could break existing applications, so perhaps doing
> something like below would be better and backwards compatible?
> Then we can remove those places tweaking the flags completely.

As a first step, I suggest to document that:
- applications must set TCP_CKSUM when setting TCP_SEG
- pmds must suppose that TCP_CKSUM is set when TCP_SEG is set

This is clearer that what we have today, and I think it does not break
anything. This will guide apps in the correct direction, facilitating
an eventual future PMD change.

> diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
> index c17dc95c5..6a0c2cdd9 100644
> --- a/lib/librte_mbuf/rte_mbuf_core.h
> +++ b/lib/librte_mbuf/rte_mbuf_core.h
> @@ -298,7 +298,7 @@ extern "C" {
>   *  - if it's IPv4, set the PKT_TX_IP_CKSUM flag
>   *  - fill the mbuf offload information: l2_len, l3_len, l4_len, tso_segsz
>   */
> -#define PKT_TX_TCP_SEG       (1ULL << 50)
> +#define PKT_TX_TCP_SEG       (1ULL << 50) | PKT_TX_TCP_CKSUM
>  
>  /** TX IEEE1588 packet to timestamp. */
>  #define PKT_TX_IEEE1588_TMST (1ULL << 51)

I'm afraid some applications or drivers use extended bit manipulations
to do the conversion from/to another domain (like hardware descriptors
or application-specific flags). They may expect this constant to be a
uniq flag.