From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0ADC6A04AF;
	Mon,  4 May 2020 10:06:38 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 77AA01D404;
	Mon,  4 May 2020 10:06:37 +0200 (CEST)
Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com
 [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 7A4FD1BF72
 for <dev@dpdk.org>; Mon,  4 May 2020 10:06:36 +0200 (CEST)
Received: by mail-wr1-f68.google.com with SMTP id k1so884235wro.12
 for <dev@dpdk.org>; Mon, 04 May 2020 01:06:36 -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=o4uVWpX3nka0QvkHPvt2MMmgxlASCHf7suk2O8Iqzbo=;
 b=fJoT8Wzwc2kCXa93ibk3hvC//tT0XJtripfOBjjkvT84/56FVGaCcDIMU9cXh4diYA
 VAPvCjfWzyY4NrQL+d6qbqCdw/4hpHu6fgTUvZ8BwSzxvmdPB8q0MjAc442sC/xVIkor
 AXKsW2NGYS5etX/uKHiwUel2WufvlQLhzZ28Ho+W6YJt/kI/T3HB1/l7rwEo9T0Z6BYk
 qZTnw912Hfdf1CgaH2Wj7EvKy0hmLrMA6owN8jqAYuWjmWYxS7u2pJ6xLK8PcYIjsvrw
 xAzEbEyNz+EX8TCZIZ39hQShP+ixOdrQRLE+aWEuaBIxjIM67chkYEWV6yfqLRp2L9xH
 Qo/g==
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=o4uVWpX3nka0QvkHPvt2MMmgxlASCHf7suk2O8Iqzbo=;
 b=SaXCQC7J+w6F6aCgTKsZd29r19E8scappYP/mF/aQER1gGtSE4xCOGjGra/WJHubWR
 n3JS9J2MfA3OUQ5bVnkRcvgdxYB3OYyeg8larEeHiBJRzl4Jhlb+qj5qLgPkZhmJPXi6
 XJyvE9neOwQZQvgF3RsIIHGbTEVtyE2Kmog9FelG+FjZhgeBhJcFdzwxDvz3ehtgIYo9
 6j851TXe4tmT5HquVZhpyb3G/bJ4sKIK6V9EAVuuAtvpo2ni34nLWe7BjtXMwx2+dzDg
 hdFl6OrKkBfgAH2bKnWv5geZHBd2qSGqPucRiOxWvq+jYXT1Xr7vjpP3nnte4AcNoR2K
 GUfw==
X-Gm-Message-State: AGi0PuaXHjCK3sfZf3LT4vyL9asdL5qyHzB6lY1CmaRFk5CWei5G8Hbg
 ypQKLbLzr9f9nU0msViivCqmvw==
X-Google-Smtp-Source: APiQypJkQdTt2zfNhz6+dZ8qi5q7W1MU1fgpGh28iTK/wRWWf1/cF9tO7CenEOJyF5RrAZ5G7Ulpfw==
X-Received: by 2002:a5d:4d05:: with SMTP id z5mr5067023wrt.130.1588579596011; 
 Mon, 04 May 2020 01:06:36 -0700 (PDT)
Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr.
 [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0])
 by smtp.gmail.com with ESMTPSA id w6sm10601783wrt.39.2020.05.04.01.06.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 04 May 2020 01:06:35 -0700 (PDT)
Date: Mon, 4 May 2020 10:06:34 +0200
From: Olivier Matz <olivier.matz@6wind.com>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: Nithin Dabilpuram <nithind1988@gmail.com>,
 Thomas Monjalon <thomas@monjalon.net>,
 Ferruh Yigit <ferruh.yigit@intel.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>, Ori Kam <orika@mellanox.com>,
 Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
 Anatoly Burakov <anatoly.burakov@intel.com>,
 John McNamara <john.mcnamara@intel.com>,
 Marko Kovacevic <marko.kovacevic@intel.com>,
 dpdk-dev <dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>,
 Krzysztof Kanas <kkanas@marvell.com>,
 Nithin Dabilpuram <ndabilpuram@marvell.com>
Message-ID: <20200504080634.GB6327@platinum>
References: <20200417072254.11455-1-nithind1988@gmail.com>
 <CALBAE1MeWqShW2O44WD01=vXzrLjMeszFOKPmm86FPxmuY4aSQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CALBAE1MeWqShW2O44WD01=vXzrLjMeszFOKPmm86FPxmuY4aSQ@mail.gmail.com>
User-Agent: Mutt/1.10.1 (2018-07-13)
Subject: Re: [dpdk-dev] [PATCH 1/3] mbuf: add Tx offloads for packet marking
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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>

Hi,

On Fri, May 01, 2020 at 04:48:21PM +0530, Jerin Jacob wrote:
> On Fri, Apr 17, 2020 at 12:53 PM Nithin Dabilpuram
> <nithind1988@gmail.com> wrote:
> >
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >
> > Introduce PKT_TX_MARK_IP_DSCP, PKT_TX_MARK_IP_ECN
> > and PKT_TX_MARK_VLAN_DEI Tx offload flags to support
> > packet marking.
> >
> > When packet marking feature in Traffic manager is enabled,
> > application has to the use the three new flags to indicate
> > to PMD on whether packet marking needs to be enabled on the
> > specific mbuf or not. By setting the three flags, it is
> > assumed by PMD that application has already verified the
> > applicability of marking on that specific packet and
> > PMD need not perform further checks as per RFC.
> >
> > Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> None of the ethdev TM driver implementations has supported packet
> marking support.
> rte_tm and rte_mbuf maintainers(Christian, Oliver), Could you review this patch?

As you know, the number of mbuf flags is limited (only 18 bits are
remaining), so I think we should use them with care, i.e. for features
that are generic enough.

>From what I understand, this feature is bound to octeontx2, so using a
mbuf dynamic flag would make more sense here. There are some examples in
dpdk repository, just grep for "dynflag".

Also, I think that the feature availability should be advertised through
an ethdev offload, so an application can know at initialization time
that these flags can be used.

Regards,
Olivier



> 
> 
> > ---
> >  doc/guides/nics/features.rst    | 14 ++++++++++++++
> >  lib/librte_mbuf/rte_mbuf.c      |  6 ++++++
> >  lib/librte_mbuf/rte_mbuf_core.h | 36 ++++++++++++++++++++++++++++++++++--
> >  3 files changed, 54 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> > index edd21c4..bc978fb 100644
> > --- a/doc/guides/nics/features.rst
> > +++ b/doc/guides/nics/features.rst
> > @@ -913,6 +913,20 @@ Supports to get Rx/Tx packet burst mode information.
> >  * **[implements] eth_dev_ops**: ``rx_burst_mode_get``, ``tx_burst_mode_get``.
> >  * **[related] API**: ``rte_eth_rx_burst_mode_get()``, ``rte_eth_tx_burst_mode_get()``.
> >
> > +.. _nic_features_traffic_manager_packet_marking_offload:
> > +
> > +Traffic Manager Packet marking offload
> > +--------------------------------------
> > +
> > +Supports enabling a packet marking offload specific mbuf.
> > +
> > +* **[uses]     mbuf**: ``mbuf.ol_flags:PKT_TX_MARK_IP_DSCP``,
> > +  ``mbuf.ol_flags:PKT_TX_MARK_IP_ECN``, ``mbuf.ol_flags:PKT_TX_MARK_VLAN_DEI``,
> > +  ``mbuf.ol_flags:PKT_TX_IPV4``, ``mbuf.ol_flags:PKT_TX_IPV6``.
> > +* **[uses]     mbuf**: ``mbuf.l2_len``.
> > +* **[related] API**: ``rte_tm_mark_ip_dscp()``, ``rte_tm_mark_ip_ecn()``,
> > +  ``rte_tm_mark_vlan_dei()``.
> > +
> >  .. _nic_features_other:
> >
> >  Other dev ops not represented by a Feature
> > diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> > index cd5794d..5c6896d 100644
> > --- a/lib/librte_mbuf/rte_mbuf.c
> > +++ b/lib/librte_mbuf/rte_mbuf.c
> > @@ -880,6 +880,9 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask)
> >         case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD";
> >         case PKT_TX_UDP_SEG: return "PKT_TX_UDP_SEG";
> >         case PKT_TX_OUTER_UDP_CKSUM: return "PKT_TX_OUTER_UDP_CKSUM";
> > +       case PKT_TX_MARK_VLAN_DEI: return "PKT_TX_MARK_VLAN_DEI";
> > +       case PKT_TX_MARK_IP_DSCP: return "PKT_TX_MARK_IP_DSCP";
> > +       case PKT_TX_MARK_IP_ECN: return "PKT_TX_MARK_IP_ECN";
> >         default: return NULL;
> >         }
> >  }
> > @@ -916,6 +919,9 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
> >                 { PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL },
> >                 { PKT_TX_UDP_SEG, PKT_TX_UDP_SEG, NULL },
> >                 { PKT_TX_OUTER_UDP_CKSUM, PKT_TX_OUTER_UDP_CKSUM, NULL },
> > +               { PKT_TX_MARK_VLAN_DEI, PKT_TX_MARK_VLAN_DEI, NULL },
> > +               { PKT_TX_MARK_IP_DSCP, PKT_TX_MARK_IP_DSCP, NULL },
> > +               { PKT_TX_MARK_IP_ECN, PKT_TX_MARK_IP_ECN, NULL },
> >         };
> >         const char *name;
> >         unsigned int i;
> > diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
> > index b9a59c8..d9f1290 100644
> > --- a/lib/librte_mbuf/rte_mbuf_core.h
> > +++ b/lib/librte_mbuf/rte_mbuf_core.h
> > @@ -187,11 +187,40 @@ extern "C" {
> >  /* add new RX flags here, don't forget to update PKT_FIRST_FREE */
> >
> >  #define PKT_FIRST_FREE (1ULL << 23)
> > -#define PKT_LAST_FREE (1ULL << 40)
> > +#define PKT_LAST_FREE (1ULL << 37)
> >
> >  /* add new TX flags here, don't forget to update PKT_LAST_FREE  */
> >
> >  /**
> > + * Packet marking offload flags. These flags indicated what kind
> > + * of packet marking needs to be applied on a given mbuf when
> > + * appropriate Traffic Manager configuration is in place.
> > + * When user set's these flags on a mbuf, below assumptions are made
> > + * 1) When PKT_TX_MARK_VLAN_DEI is set,
> > + * a) PMD assumes pkt to be a 802.1q packet.
> > + * b) Application should also set mbuf.l2_len where 802.1Q header is
> > + *    at (mbuf.l2_len - 6) offset.
> > + * 2) When PKT_TX_MARK_IP_DSCP is set,
> > + * a) Application should also set either PKT_TX_IPV4 or PKT_TX_IPV6
> > + *    to indicate whether if it is IPv4 packet or IPv6 packet
> > + *    for DSCP marking. It should also set PKT_TX_IP_CKSUM if it is
> > + *    IPv4 pkt.
> > + * b) Application should also set mbuf.l2_len that indicates
> > + *    start offset of L3 header.
> > + * 3) When PKT_TX_MARK_IP_ECN is set,
> > + * a) Application should also set either PKT_TX_IPV4 or PKT_TX_IPV6.
> > + *    It should also set PKT_TX_IP_CKSUM if it is IPv4 pkt.
> > + * b) PMD will assume pkt L4 protocol is either TCP or SCTP and
> > + *    ECN is set to 2'b01 or 2'b10 as per RFC 3168 and hence HW
> > + *    can mark the packet for a configured color.
> > + * c) Application should also set mbuf.l2_len that indicates
> > + *    start offset of L3 header.
> > + */
> > +#define PKT_TX_MARK_VLAN_DEI           (1ULL << 38)
> > +#define PKT_TX_MARK_IP_DSCP            (1ULL << 39)
> > +#define PKT_TX_MARK_IP_ECN             (1ULL << 40)
> > +
> > +/**
> >   * Outer UDP checksum offload flag. This flag is used for enabling
> >   * outer UDP checksum in PMD. To use outer UDP checksum, the user needs to
> >   * 1) Enable the following in mbuf,
> > @@ -384,7 +413,10 @@ extern "C" {
> >                 PKT_TX_MACSEC |          \
> >                 PKT_TX_SEC_OFFLOAD |     \
> >                 PKT_TX_UDP_SEG |         \
> > -               PKT_TX_OUTER_UDP_CKSUM)
> > +               PKT_TX_OUTER_UDP_CKSUM | \
> > +               PKT_TX_MARK_VLAN_DEI |   \
> > +               PKT_TX_MARK_IP_DSCP |    \
> > +               PKT_TX_MARK_IP_ECN)
> >
> >  /**
> >   * Mbuf having an external buffer attached. shinfo in mbuf must be filled.
> > --
> > 2.8.4
> >