[prev in list] [next in list] [prev in thread] [next in thread]
List: dpdk-dev
Subject: [dpdk-dev] [PATCH 1/5] net/mlx5: optimize neigh and local encap rules search
From: Viacheslav Ovsiienko <viacheslavo () mellanox ! com>
Date: 2018-12-29 19:55:36
Message-ID: 1546113340-30356-2-git-send-email-viacheslavo () mellanox ! com
[Download RAW message or body]
This patch removes unnecessary local varialbles and optimizes
local and neigh encapsulation rules search.
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_tcf.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c
index 33ebddd..b4734a0 100644
--- a/drivers/net/mlx5/mlx5_flow_tcf.c
+++ b/drivers/net/mlx5/mlx5_flow_tcf.c
@@ -4781,8 +4781,7 @@ struct tcf_nlcb_context {
struct rte_flow_error *error)
{
const struct flow_tcf_vxlan_encap *encap = dev_flow->tcf.vxlan_encap;
- struct tcf_local_rule *rule;
- bool found = false;
+ struct tcf_local_rule *rule = NULL;
int ret;
assert(encap);
@@ -4793,7 +4792,6 @@ struct tcf_nlcb_context {
if (rule->mask & FLOW_TCF_ENCAP_IPV4_SRC &&
encap->ipv4.src == rule->ipv4.src &&
encap->ipv4.dst == rule->ipv4.dst) {
- found = true;
break;
}
}
@@ -4806,12 +4804,11 @@ struct tcf_nlcb_context {
sizeof(encap->ipv6.src)) &&
!memcmp(&encap->ipv6.dst, &rule->ipv6.dst,
sizeof(encap->ipv6.dst))) {
- found = true;
break;
}
}
}
- if (found) {
+ if (rule) {
if (enable) {
rule->refcnt++;
return 0;
@@ -4890,8 +4887,7 @@ struct tcf_nlcb_context {
struct rte_flow_error *error)
{
const struct flow_tcf_vxlan_encap *encap = dev_flow->tcf.vxlan_encap;
- struct tcf_neigh_rule *rule;
- bool found = false;
+ struct tcf_neigh_rule *rule = NULL;
int ret;
assert(encap);
@@ -4901,7 +4897,6 @@ struct tcf_nlcb_context {
LIST_FOREACH(rule, &vtep->neigh, next) {
if (rule->mask & FLOW_TCF_ENCAP_IPV4_DST &&
encap->ipv4.dst == rule->ipv4.dst) {
- found = true;
break;
}
}
@@ -4912,12 +4907,11 @@ struct tcf_nlcb_context {
if (rule->mask & FLOW_TCF_ENCAP_IPV6_DST &&
!memcmp(&encap->ipv6.dst, &rule->ipv6.dst,
sizeof(encap->ipv6.dst))) {
- found = true;
break;
}
}
}
- if (found) {
+ if (rule) {
if (memcmp(&encap->eth.dst, &rule->eth,
sizeof(encap->eth.dst))) {
DRV_LOG(WARNING, "Destination MAC differs"
--
1.8.3.1
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic