From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro Subject: Re: [dpdk-stable] [PATCH] net/mlx5: fix: flow validation Date: Thu, 3 May 2018 11:23:14 +0200 Message-ID: <20180503092314.ianfr2xllm7ner5c@laranjeiro-vm.dev.6wind.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: "dev@dpdk.org" , Adrien Mazarguil , Yongseok Koh , "stable@dpdk.org" To: Shahaf Shuler Return-path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 52D612BA3 for ; Thu, 3 May 2018 11:22:07 +0200 (CEST) Received: by mail-wm0-f43.google.com with SMTP id a8so27139081wmg.5 for ; Thu, 03 May 2018 02:22:07 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, May 03, 2018 at 07:07:54AM +0000, Shahaf Shuler wrote: > Hi Nelio, > > Wednesday, May 2, 2018 5:43 PM, Nelio Laranjeiro: > > Subject: [dpdk-stable] [PATCH] net/mlx5: fix: flow validation > > The title is wrong the : after the fix should be removed. Right, > > Item spec and last are wrongly compared to the NIC capability causing a > > validation failure when the mask is null. > > This validation function should only verify the user is not configuring > > unsupported matching fields. > > > > Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions") > > Cc: stable@dpdk.org > > > > Signed-off-by: Nelio Laranjeiro > > --- >[...] > > - rte_errno = EINVAL; > > - return -rte_errno; > > - } > > + if (!spec && (item->mask || last)) > > + goto error; > > + if (!spec) > > + return 0; > > + for (i = 0; i < size; i++) { > > > I think inline comment which explains what each code section below > verifies would much help. Adding it, > > + if (spec) > > + if (((spec[i] & m[i]) | mask[i]) != mask[i]) > > + goto error; > > Am wondering. > Which the below check of m ... > > > + if (last) > > + if ((((last[i] & m[i]) | mask[i]) != mask[i]) || > > + ((spec[i] & m[i]) != (last[i] & m[i]))) > > + goto error; > > + if (m) > > + if ((m[i] | mask[i]) != mask[i]) > > + goto error; > > Do we really need to spec check? > Meaning if above one passes it is guarantee m is contained in mask. > And if so, then the spec check will always succeed. Indeed, > > } > > return 0; > > +error: > > + rte_errno = ENOTSUP; > > + return -rte_errno; > > } > > > > /** > > -- > > 2.17.0 I am making a v2 accordingly. Thanks, -- Nélio Laranjeiro 6WIND