[dpdk-dev,1/2] lpm: fix tlb8 only not freed for depth=24

Message ID 1470035000-72828-1-git-send-email-wei.dai@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Wei Dai Aug. 1, 2016, 7:03 a.m. UTC
  When all rules with depth > 24 are deleted in a same tlb8 group
and only leave a rule with depth <= 24 in this group, the tlb8
group should be recycled.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 lib/librte_lpm/rte_lpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Bruce Richardson Aug. 2, 2016, 3:49 p.m. UTC | #1
On Mon, Aug 01, 2016 at 03:03:20PM +0800, Wei Dai wrote:
> When all rules with depth > 24 are deleted in a same tlb8 group
> and only leave a rule with depth <= 24 in this group, the tlb8
> group should be recycled.
> 

The title needs a bit of rewording, I think e.g. 
lpm: fix freeing unused sub-table on rule delete

Otherwise:
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index 6f65d1c..24fec4b 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -1533,7 +1533,7 @@  tbl8_recycle_check_v20(struct rte_lpm_tbl_entry_v20 *tbl8,
 		 * and if so check the rest of the entries to verify that they
 		 * are all of this depth.
 		 */
-		if (tbl8[tbl8_group_start].depth < MAX_DEPTH_TBL24) {
+		if (tbl8[tbl8_group_start].depth <= MAX_DEPTH_TBL24) {
 			for (i = (tbl8_group_start + 1); i < tbl8_group_end;
 					i++) {
 
@@ -1580,7 +1580,7 @@  tbl8_recycle_check_v1604(struct rte_lpm_tbl_entry *tbl8,
 		 * and if so check the rest of the entries to verify that they
 		 * are all of this depth.
 		 */
-		if (tbl8[tbl8_group_start].depth < MAX_DEPTH_TBL24) {
+		if (tbl8[tbl8_group_start].depth <= MAX_DEPTH_TBL24) {
 			for (i = (tbl8_group_start + 1); i < tbl8_group_end;
 					i++) {