DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
To: shahafs@mellanox.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/5] net/mlx5: optimize neigh and local encap rules search
Date: Sat, 29 Dec 2018 19:55:36 +0000	[thread overview]
Message-ID: <1546113340-30356-2-git-send-email-viacheslavo@mellanox.com> (raw)
In-Reply-To: <1546113340-30356-1-git-send-email-viacheslavo@mellanox.com>

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

  reply	other threads:[~2018-12-29 19:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-29 19:55 [dpdk-dev] [PATCH 0/5] net/mlx5: simplify VXLAN devices management for E-Switch Viacheslav Ovsiienko
2018-12-29 19:55 ` Viacheslav Ovsiienko [this message]
2018-12-29 19:55 ` [dpdk-dev] [PATCH 2/5] net/mlx5: introduce encapsulation rules container Viacheslav Ovsiienko
2018-12-29 19:55 ` [dpdk-dev] [PATCH 3/5] net/mlx5: switch encap rules to use container Viacheslav Ovsiienko
2018-12-29 19:55 ` [dpdk-dev] [PATCH 4/5] net/mlx5: switch to detached VXLAN network devices Viacheslav Ovsiienko
2018-12-29 19:55 ` [dpdk-dev] [PATCH 5/5] net/mlx5: add RH7.2 VXLAN device metadata workaround Viacheslav Ovsiienko
2019-01-13 12:19 ` [dpdk-dev] [PATCH 0/5] net/mlx5: simplify VXLAN devices management for E-Switch Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1546113340-30356-2-git-send-email-viacheslavo@mellanox.com \
    --to=viacheslavo@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).