From: Wei Dai Date: Mon, 8 Aug 2016 06:39:51 +0000 (+0800) Subject: lpm: fix freeing unused sub-table on rule delete X-Git-Tag: spdx-start~5603 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=69ed52dddc0fc64f5cec7e7384197874f92ff393;p=dpdk.git lpm: fix freeing unused sub-table on rule delete When all rules with depth > 24 are deleted in a same sub-table (tlb8 group) and only a rule with depth <=24 is left in it, this sub-table (tlb8 group) should be recycled. Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field") Fixes: af75078fece3 ("first public release") Signed-off-by: Wei Dai Acked-by: Bruce Richardson --- diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 6f65d1c2dd..24fec4b9e7 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++) {