From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67])
 by dpdk.org (Postfix) with ESMTP id 48FE21B73D;
 Wed,  7 Feb 2018 22:56:31 +0100 (CET)
Received: from 85-170-243-105.rev.numericable.fr ([85.170.243.105]
 helo=droids-corp.org)
 by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.89) (envelope-from <olivier.matz@6wind.com>)
 id 1ejXhr-0005Oa-FY; Wed, 07 Feb 2018 22:56:44 +0100
Received: by droids-corp.org (sSMTP sendmail emulation);
 Wed, 07 Feb 2018 22:56:29 +0100
Date: Wed, 7 Feb 2018 22:56:29 +0100
From: Olivier Matz <olivier.matz@6wind.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: dev@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>,
 dpdk stable <stable@dpdk.org>
Message-ID: <20180207215629.iuob3danxgqaauks@neon>
References: <20180206170758.1148-1-olivier.matz@6wind.com>
 <CACZ4nhts2krWb8fVQqh_RMM30TyVN38-d=agrNPQYepOMMy-Jw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CACZ4nhts2krWb8fVQqh_RMM30TyVN38-d=agrNPQYepOMMy-Jw@mail.gmail.com>
User-Agent: NeoMutt/20170113 (1.7.2)
Subject: Re: [dpdk-dev] [PATCH] net/bnxt: fix packet type
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://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Feb 2018 21:56:31 -0000

Hi,

On Tue, Feb 06, 2018 at 03:23:34PM -0800, Ajit Khaparde wrote:
> On Tue, Feb 6, 2018 at 9:07 AM, Olivier Matz <olivier.matz@6wind.com> wrote:
> 
> > The hw flags are not read correctly: the defines
> > RX_PKT_CMPL_FLAGS_ITYPE_* are not bits but values, so the should not be
> > tested with if (value & X) but with if ((value & MASK) == X).
> > This was resulting in a wrong packet type.
> >
> > For instance, an IPv4/ICMP packet was returning a value of 7 for
> > the layer 4, which is undefined.
> >
> > This patch rework the way packet types are processed, to ensure
> > that only valid packet types will be advertised.
> >
> > Fixes: 3d2a6644eb05 ("net/bnxt: support getting ptypes")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> >
> ​Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ​

[...]

> > +       case RTE_LE32(RX_PKT_CMPL_FLAGS_ITYPE_UDP):
> > +               if (!t_ipcs)
> > +                       pkt_type |= l3 | RTE_PTYPE_L4_UDP;
> > +               else
> > +                       pkt_type |= l3 | RTE_PTYPE_INNER_L4_UDP;
> > +               break;
> > +
> > +       case RTE_LE32(RX_PKT_CMPL_FLAGS_ITYPE_IP):
> > +               if (!t_ipcs)
> > +                       pkt_type |= l3 | RTE_PTYPE_L4_ICMP;
> > +               else
> > +                       pkt_type |= l3 | RTE_PTYPE_INNER_L4_ICMP;
> > +               break;
> > +       }

Sorry, it looks there is a typo here: it should be pkt_type |= l3
(not ICMP). I'll send a new version.