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 00F31A0548;
	Sun,  9 May 2021 16:20:56 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D496A40140;
	Sun,  9 May 2021 16:20:56 +0200 (CEST)
Received: from mail-io1-f42.google.com (mail-io1-f42.google.com
 [209.85.166.42]) by mails.dpdk.org (Postfix) with ESMTP id 3B7C34003E
 for <dev@dpdk.org>; Sun,  9 May 2021 16:20:56 +0200 (CEST)
Received: by mail-io1-f42.google.com with SMTP id i7so4909367ioa.12
 for <dev@dpdk.org>; Sun, 09 May 2021 07:20:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=semihalf-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-transfer-encoding;
 bh=eJXv8XF+Qa7k3ynlv6iCZhO2foR3yQj8+Qj+/7E8wUQ=;
 b=1lETvSwD+26jf6K6RURjH84gbwzMV2lIUThXYAZAXzc9EhLhAdlOYQ/SAULf3DIveN
 b/MPM2OJFG/PHbYRzE7yozPxzeNDSuUltJzwMWg1dG/k/2uhqZoD7oDEqwHJPu0QxzaM
 Eu3qKGdAmL24D5dICc1H7fsQCFUIRAOs4JBRtOqSragL9M6tLw/jIWCBskJwv+XtWQCB
 kOI8tuZ9FAWP/PJLfz3tMwFfvgjQMJBmOV8YAnsBHEzgjKiY04HY2oVN5QzdiScAeOqH
 Zdkp3lGIpbGghF8CD8CNcl+UO6aIaMA+qiZ/ntih7SpmWnNOgO0yhOvBV+VJNuQsMEUQ
 oO/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=eJXv8XF+Qa7k3ynlv6iCZhO2foR3yQj8+Qj+/7E8wUQ=;
 b=gbhvjaGPBu3IR5M3CPmxfvjbDg1JnSGUQm7dZahKmL/MFPzwCRX5SZOl3HCvHh9urU
 TfpDP6Vu8UecaQG6aspQOMWYxG7lESJx99rGkHtltb7ZbwXIKPK/bBeIvCTLBn1AASBC
 qMz4w6hcZkjbm3RHQQqLa4OsosVfaMJUtkI89PT8J5oQcadHu+zKy7FENsaomoGBQL6p
 Pg03eUEyRJ/+oO3bKX1K1MadgkwA8tC4NPtelYzteuYMU3An7mGBVRKltEyohvKD+CSv
 jOt8+8cWntYbBimBY3a2F403isLj1yOMv3gOqFUK/Xc1WQy1LRSz1GwozDcVETX8J+VY
 XbEQ==
X-Gm-Message-State: AOAM531gwUTftIU5ycbIv+I3NbgqfNlEsuWOL70gPrD6OaGK+pZGS+kk
 8S2WN8sJ8saCr+PNQsQW/23WmhjOJC/SvZ08fGPKOQ==
X-Google-Smtp-Source: ABdhPJyBcDUienzIJ1pZzlQISyWHvWPihNHJS1SrnJvcm/7YFNab1/r1YxVfXFzGlhfrQGUjNjnu26HctONhhCuhWts=
X-Received: by 2002:a05:6602:14d3:: with SMTP id
 b19mr7240383iow.154.1620570055645; 
 Sun, 09 May 2021 07:20:55 -0700 (PDT)
MIME-Version: 1.0
References: <20210505073348.6394-1-mk@semihalf.com>
 <20210506142526.28245-1-mk@semihalf.com>
 <20210506142526.28245-15-mk@semihalf.com>
 <e2a76596-7ab5-a5c0-9f76-d634b462e3d6@intel.com>
In-Reply-To: <e2a76596-7ab5-a5c0-9f76-d634b462e3d6@intel.com>
From: =?UTF-8?Q?Micha=C5=82_Krawczyk?= <mk@semihalf.com>
Date: Sun, 9 May 2021 16:20:43 +0200
Message-ID: <CAJMMOfMyZiB=Ntyp6h=udSD6AWDMapG0G3MUy2Vjy83koS9L-g@mail.gmail.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev <dev@dpdk.org>, "Dagan, Noam" <ndagan@amazon.com>, "Tzalik,
 Guy" <gtzalik@amazon.com>, 
 "Chauskin, Igor" <igorch@amazon.com>, upstream@semihalf.com, stable@dpdk.org, 
 Amit Bernstein <amitbern@amazon.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 14/22] net/ena: indicate Rx
 RSS hash presence
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>

pt., 7 maj 2021 o 18:47 Ferruh Yigit <ferruh.yigit@intel.com> napisa=C5=82(=
a):
>
> On 5/6/2021 3:25 PM, Michal Krawczyk wrote:
> > To make it possible to the app to determine if the hash was calculated
> > for the packet or not, the PKT_RX_RSS_HASH should be set in the mbuf's
> > ol_flags.
> >
> > As the PMD wasn't setting that, the application couldn't check if there
> > is a hash in a proper way.
> >
> > The hash is valid only if it's UDP or TCP and the IP packet wasn't
> > fragmented.
> >
> > Fixes: e5df9f33db00 ("net/ena: fix passing RSS hash to mbuf")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Michal Krawczyk <mk@semihalf.com>
> > Reviewed-by: Igor Chauskin <igorch@amazon.com>
> > Reviewed-by: Amit Bernstein <amitbern@amazon.com>
> > ---
> >  drivers/net/ena/ena_ethdev.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.=
c
> > index 6092288239..5d107775f4 100644
> > --- a/drivers/net/ena/ena_ethdev.c
> > +++ b/drivers/net/ena/ena_ethdev.c
> > @@ -51,6 +51,8 @@
> >
> >  #define ENA_MIN_RING_DESC    128
> >
> > +#define ENA_PTYPE_HAS_HASH   (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP)
> > +
> >  enum ethtool_stringset {
> >       ETH_SS_TEST             =3D 0,
> >       ETH_SS_STATS,
> > @@ -314,6 +316,11 @@ static inline void ena_rx_mbuf_prepare(struct rte_=
mbuf *mbuf,
> >               else
> >                       ol_flags |=3D PKT_RX_L4_CKSUM_GOOD;
> >
> > +     if (likely((packet_type & ENA_PTYPE_HAS_HASH) && !ena_rx_ctx->fra=
g)) {
> > +             ol_flags |=3D PKT_RX_RSS_HASH;
> > +             mbuf->hash.rss =3D ena_rx_ctx->hash;
> > +     }
>
> The driver should announce the 'DEV_RX_OFFLOAD_RSS_HASH' offload capabili=
ty
> first, and should set 'PKT_RX_RSS_HASH' only if application requests the
> 'DEV_RX_OFFLOAD_RSS_HASH'.
>
>
> Normally this is an optimization to not always update the 'mbuf->hash.rss=
' but
> wait for explicit request from application for it.
>
> But there is no practical performance gain for some PMDs and they enable =
it even
> user does not ask for it [1] (of course if RSS is enabled), if this is sa=
me for
> 'ena' you can do the same.
>

Thanks for the reference - ENA should do the same, I will change that in v4=
.

> [1]
> https://git.dpdk.org/dpdk/tree/drivers/net/ixgbe/ixgbe_ethdev.c?h=3Dv21.0=
5-rc2#n2384
>
> > +
> >       mbuf->ol_flags =3D ol_flags;
> >       mbuf->packet_type =3D packet_type;
> >  }
> > @@ -2245,8 +2252,6 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue,=
 struct rte_mbuf **rx_pkts,
> >                       ++rx_ring->rx_stats.bad_csum;
> >               }
> >
> > -             mbuf->hash.rss =3D ena_rx_ctx.hash;
> > -
> >               rx_pkts[completed] =3D mbuf;
> >               rx_ring->rx_stats.bytes +=3D mbuf->pkt_len;
> >       }
> >
>