Currently if there were 'n' preallocated tbl8 entries only 'n - 1' were
able to be used. Fix the logic allowing to use all preallocated tbl8
entries.

Fixes: c3e12e0f0354 ("fib: add dataplane algorithm for IPv6")
Cc: [email protected]

Signed-off-by: Vladimir Medvedkin <[email protected]>
---
 lib/fib/trie.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/fib/trie.c b/lib/fib/trie.c
index 5a9978b4ca..6427920c58 100644
--- a/lib/fib/trie.c
+++ b/lib/fib/trie.c
@@ -576,8 +576,7 @@ trie_modify(struct rte_fib6 *fib, const struct 
rte_ipv6_addr *ip,
                        return 0;
                }
 
-               if ((depth > 24) && (dp->rsvd_tbl8s >=
-                               dp->number_tbl8s - depth_diff))
+               if ((depth > 24) && (dp->rsvd_tbl8s + depth_diff > 
dp->number_tbl8s))
                        return -ENOSPC;
 
                node = rte_rib6_insert(rib, &ip_masked, depth);
-- 
2.43.0

Reply via email to