[dpdk-dev] [dpdk-stable] [PATCH] net/mlx5: fix: flow validation

Nélio Laranjeiro nelio.laranjeiro at 6wind.com
Thu May 3 11:23:14 CEST 2018


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 at dpdk.org
> > 
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
> > ---
>[...]
> > -			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


More information about the dev mailing list