summaryrefslogtreecommitdiff
path: root/lib/librte_lpm
diff options
context:
space:
mode:
authorWei Dai <wei.dai@intel.com>2016-08-08 14:42:37 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-10-13 22:17:00 +0200
commitf05b0fbe7d73b105ec9c848d4ecb6bb965391b8c (patch)
tree94148cb76c924020ea4db18c8fa5d356e5d024de /lib/librte_lpm
parent69ed52dddc0fc64f5cec7e7384197874f92ff393 (diff)
downloaddpdk-next-eventdev-f05b0fbe7d73b105ec9c848d4ecb6bb965391b8c.zip
dpdk-next-eventdev-f05b0fbe7d73b105ec9c848d4ecb6bb965391b8c.tar.gz
dpdk-next-eventdev-f05b0fbe7d73b105ec9c848d4ecb6bb965391b8c.tar.xz
lpm: remove redundant check when adding rule
When a rule with depth > 24 is added into an existing rule with depth <=24, a new tbl8 is allocated, the existing rule first fulfill whole new tbl8, so the filed valid of each entry in this tbl8 is always true and depth of each entry is always <= 24 before adding the new rule with depth > 24. Signed-off-by: Wei Dai <wei.dai@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'lib/librte_lpm')
-rw-r--r--lib/librte_lpm/rte_lpm.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index 24fec4b..ec67765 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -940,14 +940,9 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth,
/* Insert new rule into the tbl8 entry. */
for (i = tbl8_index; i < tbl8_index + tbl8_range; i++) {
- if (!lpm->tbl8[i].valid ||
- lpm->tbl8[i].depth <= depth) {
- lpm->tbl8[i].valid = VALID;
- lpm->tbl8[i].depth = depth;
- lpm->tbl8[i].next_hop = next_hop;
-
- continue;
- }
+ lpm->tbl8[i].valid = VALID;
+ lpm->tbl8[i].depth = depth;
+ lpm->tbl8[i].next_hop = next_hop;
}
/*
@@ -1071,14 +1066,9 @@ add_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
/* Insert new rule into the tbl8 entry. */
for (i = tbl8_index; i < tbl8_index + tbl8_range; i++) {
- if (!lpm->tbl8[i].valid ||
- lpm->tbl8[i].depth <= depth) {
- lpm->tbl8[i].valid = VALID;
- lpm->tbl8[i].depth = depth;
- lpm->tbl8[i].next_hop = next_hop;
-
- continue;
- }
+ lpm->tbl8[i].valid = VALID;
+ lpm->tbl8[i].depth = depth;
+ lpm->tbl8[i].next_hop = next_hop;
}
/*