cxgb4: check rule prio conflicts before offload
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Wed, 20 Nov 2019 00:16:07 +0000 (05:46 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Nov 2019 20:05:23 +0000 (12:05 -0800)
commit41ec03e534ca450939edae01d9f2037a6262e6de
tree8cd39893db61ada31735e4e5a11e54d797773bb1
parent4ec4762d8ec6edcfe59fd806472d2b7518debe52
cxgb4: check rule prio conflicts before offload

Only offload rule if it satisfies both of the following conditions:
1. The immediate previous rule has priority <= current rule's priority.
2. The immediate next rule has priority >= current rule's priority.

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.

v5:
- Fixed commit message and comment to include comparison for equal
  priority.

v4:
- Patch added in this version.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c