From patchwork Sat Dec 29 19:55:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 49365 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 631647D4A; Sat, 29 Dec 2018 20:56:03 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 74CF95F24 for ; Sat, 29 Dec 2018 20:55:52 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 29 Dec 2018 21:55:50 +0200 Received: from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx [10.210.17.40]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBTJtkdX002527; Sat, 29 Dec 2018 21:55:49 +0200 From: Viacheslav Ovsiienko To: shahafs@mellanox.com Cc: dev@dpdk.org Date: Sat, 29 Dec 2018 19:55:38 +0000 Message-Id: <1546113340-30356-4-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1546113340-30356-1-git-send-email-viacheslavo@mellanox.com> References: <1546113340-30356-1-git-send-email-viacheslavo@mellanox.com> Subject: [dpdk-dev] [PATCH 3/5] net/mlx5: switch encap rules to use container X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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;