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 3/5] net/mlx5: switch encap rules to use container
Date: Sat, 29 Dec 2018 19:55:38 +0000	[thread overview]
Message-ID: <1546113340-30356-4-git-send-email-viacheslavo@mellanox.com> (raw)
In-Reply-To: <1546113340-30356-1-git-send-email-viacheslavo@mellanox.com>

The VXLAN encapsulation neigh/local rules will use
the new introduced structure, which keeps the
rules lists, related to specified outer interface,
instead of attached VTEP structure. It allows us to
unbind VTEP structure from keeping the rules for
interface.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_tcf.c | 42 ++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c
index a6dca08..b99e322 100644
--- a/drivers/net/mlx5/mlx5_flow_tcf.c
+++ b/drivers/net/mlx5/mlx5_flow_tcf.c
@@ -4771,8 +4771,8 @@ struct tcf_nlcb_context {
  *
  * @param[in] tcf
  *   Libmnl socket context object.
- * @param[in] vtep
- *   VTEP object, contains rule database and ifouter index.
+ * @param[in] iface
+ *   Object, contains rule database and ifouter index.
  * @param[in] dev_flow
  *   Flow object, contains the tunnel parameters (for encap only).
  * @param[in] enable
@@ -4785,7 +4785,7 @@ struct tcf_nlcb_context {
  */
 static int
 flow_tcf_encap_local(struct mlx5_flow_tcf_context *tcf,
-		     struct tcf_vtep *vtep,
+		     struct tcf_irule *iface,
 		     struct mlx5_flow *dev_flow,
 		     bool enable,
 		     struct rte_flow_error *error)
@@ -4798,7 +4798,7 @@ struct tcf_nlcb_context {
 	assert(encap->hdr.type == FLOW_TCF_TUNACT_VXLAN_ENCAP);
 	if (encap->mask & FLOW_TCF_ENCAP_IPV4_SRC) {
 		assert(encap->mask & FLOW_TCF_ENCAP_IPV4_DST);
-		LIST_FOREACH(rule, &vtep->local, next) {
+		LIST_FOREACH(rule, &iface->local, next) {
 			if (rule->mask & FLOW_TCF_ENCAP_IPV4_SRC &&
 			    encap->ipv4.src == rule->ipv4.src &&
 			    encap->ipv4.dst == rule->ipv4.dst) {
@@ -4808,7 +4808,7 @@ struct tcf_nlcb_context {
 	} else {
 		assert(encap->mask & FLOW_TCF_ENCAP_IPV6_SRC);
 		assert(encap->mask & FLOW_TCF_ENCAP_IPV6_DST);
-		LIST_FOREACH(rule, &vtep->local, next) {
+		LIST_FOREACH(rule, &iface->local, next) {
 			if (rule->mask & FLOW_TCF_ENCAP_IPV6_SRC &&
 			    !memcmp(&encap->ipv6.src, &rule->ipv6.src,
 					    sizeof(encap->ipv6.src)) &&
@@ -4826,7 +4826,7 @@ struct tcf_nlcb_context {
 		if (!rule->refcnt || !--rule->refcnt) {
 			LIST_REMOVE(rule, next);
 			return flow_tcf_rule_local(tcf, encap,
-					vtep->ifouter, false, error);
+					iface->ifouter, false, error);
 		}
 		return 0;
 	}
@@ -4859,13 +4859,13 @@ struct tcf_nlcb_context {
 		memcpy(&rule->ipv6.src, &encap->ipv6.src, IPV6_ADDR_LEN);
 		memcpy(&rule->ipv6.dst, &encap->ipv6.dst, IPV6_ADDR_LEN);
 	}
-	ret = flow_tcf_rule_local(tcf, encap, vtep->ifouter, true, error);
+	ret = flow_tcf_rule_local(tcf, encap, iface->ifouter, true, error);
 	if (ret) {
 		rte_free(rule);
 		return ret;
 	}
 	rule->refcnt++;
-	LIST_INSERT_HEAD(&vtep->local, rule, next);
+	LIST_INSERT_HEAD(&iface->local, rule, next);
 	return 0;
 }
 
@@ -4877,8 +4877,8 @@ struct tcf_nlcb_context {
  *
  * @param[in] tcf
  *   Libmnl socket context object.
- * @param[in] vtep
- *   VTEP object, contains rule database and ifouter index.
+ * @param[in] iface
+ *   Object, contains rule database and ifouter index.
  * @param[in] dev_flow
  *   Flow object, contains the tunnel parameters (for encap only).
  * @param[in] enable
@@ -4891,7 +4891,7 @@ struct tcf_nlcb_context {
  */
 static int
 flow_tcf_encap_neigh(struct mlx5_flow_tcf_context *tcf,
-		     struct tcf_vtep *vtep,
+		     struct tcf_irule *iface,
 		     struct mlx5_flow *dev_flow,
 		     bool enable,
 		     struct rte_flow_error *error)
@@ -4904,7 +4904,7 @@ struct tcf_nlcb_context {
 	assert(encap->hdr.type == FLOW_TCF_TUNACT_VXLAN_ENCAP);
 	if (encap->mask & FLOW_TCF_ENCAP_IPV4_DST) {
 		assert(encap->mask & FLOW_TCF_ENCAP_IPV4_SRC);
-		LIST_FOREACH(rule, &vtep->neigh, next) {
+		LIST_FOREACH(rule, &iface->neigh, next) {
 			if (rule->mask & FLOW_TCF_ENCAP_IPV4_DST &&
 			    encap->ipv4.dst == rule->ipv4.dst) {
 				break;
@@ -4913,7 +4913,7 @@ struct tcf_nlcb_context {
 	} else {
 		assert(encap->mask & FLOW_TCF_ENCAP_IPV6_SRC);
 		assert(encap->mask & FLOW_TCF_ENCAP_IPV6_DST);
-		LIST_FOREACH(rule, &vtep->neigh, next) {
+		LIST_FOREACH(rule, &iface->neigh, next) {
 			if (rule->mask & FLOW_TCF_ENCAP_IPV6_DST &&
 			    !memcmp(&encap->ipv6.dst, &rule->ipv6.dst,
 						sizeof(encap->ipv6.dst))) {
@@ -4940,7 +4940,7 @@ struct tcf_nlcb_context {
 		if (!rule->refcnt || !--rule->refcnt) {
 			LIST_REMOVE(rule, next);
 			return flow_tcf_rule_neigh(tcf, encap,
-						   vtep->ifouter,
+						   iface->ifouter,
 						   false, error);
 		}
 		return 0;
@@ -4971,13 +4971,13 @@ struct tcf_nlcb_context {
 		memcpy(&rule->ipv6.dst, &encap->ipv6.dst, IPV6_ADDR_LEN);
 	}
 	memcpy(&rule->eth, &encap->eth.dst, sizeof(rule->eth));
-	ret = flow_tcf_rule_neigh(tcf, encap, vtep->ifouter, true, error);
+	ret = flow_tcf_rule_neigh(tcf, encap, iface->ifouter, true, error);
 	if (ret) {
 		rte_free(rule);
 		return ret;
 	}
 	rule->refcnt++;
-	LIST_INSERT_HEAD(&vtep->neigh, rule, next);
+	LIST_INSERT_HEAD(&iface->neigh, rule, next);
 	return 0;
 }
 
@@ -5394,12 +5394,12 @@ struct tcf_nlcb_context {
 	}
 	dev_flow->tcf.vxlan_encap->iface = iface;
 	/* Create local ipaddr with peer to specify the outer IPs. */
-	ret = flow_tcf_encap_local(tcf, vtep, dev_flow, true, error);
+	ret = flow_tcf_encap_local(tcf, iface, dev_flow, true, error);
 	if (!ret) {
 		/* Create neigh rule to specify outer destination MAC. */
-		ret = flow_tcf_encap_neigh(tcf, vtep, dev_flow, true, error);
+		ret = flow_tcf_encap_neigh(tcf, iface, dev_flow, true, error);
 		if (ret)
-			flow_tcf_encap_local(tcf, vtep,
+			flow_tcf_encap_local(tcf, iface,
 					     dev_flow, false, error);
 	}
 	if (ret) {
@@ -5483,8 +5483,8 @@ struct tcf_nlcb_context {
 		/* Remove the encap ancillary rules first. */
 		iface = dev_flow->tcf.vxlan_encap->iface;
 		assert(iface);
-		flow_tcf_encap_neigh(tcf, vtep, dev_flow, false, NULL);
-		flow_tcf_encap_local(tcf, vtep, dev_flow, false, NULL);
+		flow_tcf_encap_neigh(tcf, iface, dev_flow, false, NULL);
+		flow_tcf_encap_local(tcf, iface, dev_flow, false, NULL);
 		flow_tcf_encap_irule_release(iface);
 		dev_flow->tcf.vxlan_encap->iface = NULL;
 		break;
-- 
1.8.3.1

  parent 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 ` [dpdk-dev] [PATCH 1/5] net/mlx5: optimize neigh and local encap rules search Viacheslav Ovsiienko
2018-12-29 19:55 ` [dpdk-dev] [PATCH 2/5] net/mlx5: introduce encapsulation rules container Viacheslav Ovsiienko
2018-12-29 19:55 ` Viacheslav Ovsiienko [this message]
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-4-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).