Subject: Re: [PATCH net-next v4 2/3] cxgb4: check rule prio conflicts before offload

From: Rahul Lakkireddy <[email-masked]>
Date: Tue, 19 Nov 2019 09:57:56 +0530

On Monday, November 11/18/19, 2019 at 15:36:06 -0800, Jakub Kicinski wrote:
> Hi Rahul!
> 
> Please remember to CC people who have you feedback to make sure we
> don't miss the next version of the set.
> 

Ok, got it.

> On Mon, 18 Nov 2019 22:30:18 +0530, Rahul Lakkireddy wrote:
> > Only offload rule if it satisfies following conditions:
> > 1. The immediate previous rule has priority < current rule's priority.
> > 2. The immediate next rule has priority > current rule's priority.
> 
> Hm, the strict comparison here looks suspicious.
> 
> The most common use case for flower is to insert many non-conflicting
> rules (different keys) at the same priority. From looking at this
> description and the code:
> 

Yes, I had seen this regression in one of my tests and updated the
check below to consider equal priority in the equation. But, looks
like I missed to update the commit and comment. It should be <=
and >=, respectively. Will fix in v5.

> +	if ((prev_fe->valid && prio < prev_fe->fs.tc_prio) ||
> +	    (next_fe->valid && prio > next_fe->fs.tc_prio))
> +		valid = false;
> 
> I get the feeling that either you haven't tested flower well or these
> ->valid flags are unreliable?
> 

I'm guessing the confusion here is because of my commit message. Let me
know if I'm missing something else. Here, the ->valid tells if the rule
is active in hardware. If previous entry's prio is greater than current
entry's prio OR if next entry's prio is less than current entry, then
reject the rule. If current entry's prio is equal, then still consider
accepting the rule.

> > Also rework free entry fetch logic to search from end of TCAM, instead
> > of beginning, because higher indices have lower priority than lower
> > indices. This is similar to how TC auto generates priority values.
> > 
> > Signed-off-by: Rahul Lakkireddy <[email-masked]>
> > ---
> > v4:
> > - Patch added in this version.
> 
> FWIW in the networking world we like the version history to be included
> in the commit message, i.e. above the --- lines. It's useful
> information.

Ok, got it.

Thanks,
Rahul