git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
graph: populate fastpath memory for graph reel
[dpdk.git]
/
lib
/
librte_lpm
/
rte_lpm.c
diff --git
a/lib/librte_lpm/rte_lpm.c
b/lib/librte_lpm/rte_lpm.c
index
b78c487
..
38ab512
100644
(file)
--- a/
lib/librte_lpm/rte_lpm.c
+++ b/
lib/librte_lpm/rte_lpm.c
@@
-22,7
+22,6
@@
#include <rte_rwlock.h>
#include <rte_spinlock.h>
#include <rte_tailq.h>
#include <rte_rwlock.h>
#include <rte_spinlock.h>
#include <rte_tailq.h>
-#include <rte_function_versioning.h>
#include "rte_lpm.h"
#include "rte_lpm.h"
@@
-284,8
+283,12
@@
rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
for (; rule_index < last_rule; rule_index++) {
for (; rule_index < last_rule; rule_index++) {
- /* If rule already exists update
its next_
hop and return. */
+ /* If rule already exists update
next
hop and return. */
if (lpm->rules_tbl[rule_index].ip == ip_masked) {
if (lpm->rules_tbl[rule_index].ip == ip_masked) {
+
+ if (lpm->rules_tbl[rule_index].next_hop
+ == next_hop)
+ return -EEXIST;
lpm->rules_tbl[rule_index].next_hop = next_hop;
return rule_index;
lpm->rules_tbl[rule_index].next_hop = next_hop;
return rule_index;
@@
-675,6
+678,12
@@
rte_lpm_add(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,
/* Add the rule to the rule table. */
rule_index = rule_add(lpm, ip_masked, depth, next_hop);
/* Add the rule to the rule table. */
rule_index = rule_add(lpm, ip_masked, depth, next_hop);
+ /* Skip table entries update if The rule is the same as
+ * the rule in the rules table.
+ */
+ if (rule_index == -EEXIST)
+ return 0;
+
/* If the is no space available for new rule return error. */
if (rule_index < 0) {
return rule_index;
/* If the is no space available for new rule return error. */
if (rule_index < 0) {
return rule_index;