From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id F1A2F4CC3 for ; Fri, 31 Aug 2018 11:01:27 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id v16-v6so10493969wro.11 for ; Fri, 31 Aug 2018 02:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YR0XOxi3xkElhTJG6YAqZX+uxOzEhP+5zkrZ5Gc67Oc=; b=OaY0CO6s1xrGp6RteyiU2VbUVxk0URLWlu3Hsxdx9zIF19rIS8iZtJRR4FnctYLyQF AbFyK+zy/y2c4p+x7KTMyWMNyzLuy+bh5e+YJKamT+iWpi36FooxIhpioxNW50mtjMNZ wZ1xcL8LxqVDed/Pm7NcINS1c9dJifXQdJkz4H+OklpID4Rk1NAFiiLfMozSRgLifkFd AludEtuPPUm1Q4SOffrLc4wiKdwkLywwmDz3cwip03E7dKHLwCkZDjltt3174Cjylwlh Dq45MkhbwcHLrKjIRUuIRcT1CiuCH8hPruxpt/1KpmVGiiODUCfuyeHm4IdrwG3Yolzq uTrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YR0XOxi3xkElhTJG6YAqZX+uxOzEhP+5zkrZ5Gc67Oc=; b=hs8/EyYqgVeu/spg5Ird5p3sqXHD7LU75MKimtGPGILoUff2OAO3IJgbdH5iQcG0rx rUwyzZUORvUF26sm2DmbF6RHp2fNoi/aXWo6xj/UU2MPsz5g9cpivVW1ZaTdB9aQJCA5 gYtCv8NeEToFCPVm6uGCX92oH6SGiKidSwyMU3eVXz1upiYcik3yLppvgcf1rNXGU3ZO TodJowdNlp6iMbDw3SA0FMCkJLDlLXNrDr4mCsYDMe1nmMFYGvr83QJkgqZ/h/py4QIB jy3eGeNuSANNMYubEmA+rhvNPLgQEnpYgDL00FISDB66rNWG6HXmOuCpY+R7GzgOu54r Satw== X-Gm-Message-State: APzg51CDnr2vUV2NPTKEA+3e7yKYZDoo18tS2xmIi9EzWkUBEXYNig8q qbllA1I9NlavKrlkSQ+lVim/SA== X-Google-Smtp-Source: ANB0VdbX4EUqLWeUKEgA54CUfLIjwec3noL1TyyFKndvPAEomLUX8eTA+Z+tgHv3mjrmQhF6L1xafw== X-Received: by 2002:adf:c890:: with SMTP id k16-v6mr10442169wrh.6.1535706087753; Fri, 31 Aug 2018 02:01:27 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id d18-v6sm3268542wmb.33.2018.08.31.02.01.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 02:01:27 -0700 (PDT) Date: Fri, 31 Aug 2018 11:01:11 +0200 From: Adrien Mazarguil To: Ferruh Yigit Cc: dev@dpdk.org, Declan Doherty , Nelio Laranjeiro Message-ID: <20180831085337.21419-7-adrien.mazarguil@6wind.com> References: <20180803132032.29038-1-adrien.mazarguil@6wind.com> <20180831085337.21419-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180831085337.21419-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v3 6/7] ethdev: add missing items/actions to flow object converter 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: , X-List-Received-Date: Fri, 31 Aug 2018 09:01:28 -0000 Several pattern items and actions were never handled by rte_flow_copy() because their descriptions were missing. rte_flow_conv() inherited this deficiency. This patch adds them and reorders others to match rte_flow.h. It doesn't pose as a fix because so far no one has complained about it and rte_flow_conv() would have to be backported as well: this function is the only sane approach to handle VXLAN and NVGRE encap definitions. As a matter of fact, it's the last missing piece to finally allow testpmd users to request the creation of VXLAN/NVGRE encap/decap flow rules without getting rejected outright. Signed-off-by: Adrien Mazarguil Cc: Declan Doherty Cc: Nelio Laranjeiro -- v2 changes: - Patch was not present in original series. --- lib/librte_ethdev/rte_flow.c | 50 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index c3ff7e713..9c56a9734 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -51,10 +51,15 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)), MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)), MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)), - MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), - MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)), MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)), MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)), + MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), + MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)), + MK_FLOW_ITEM(FUZZY, sizeof(struct rte_flow_item_fuzzy)), + MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)), + MK_FLOW_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)), + MK_FLOW_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)), + MK_FLOW_ITEM(ESP, sizeof(struct rte_flow_item_esp)), MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)), MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)), MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)), @@ -67,6 +72,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { sizeof(struct rte_flow_item_icmp6_nd_opt_sla_eth)), MK_FLOW_ITEM(ICMP6_ND_OPT_TLA_ETH, sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)), + MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)), }; /** Generate flow_action[] entry. */ @@ -81,6 +87,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(END, 0), MK_FLOW_ACTION(VOID, 0), MK_FLOW_ACTION(PASSTHRU, 0), + MK_FLOW_ACTION(JUMP, sizeof(struct rte_flow_action_jump)), MK_FLOW_ACTION(MARK, sizeof(struct rte_flow_action_mark)), MK_FLOW_ACTION(FLAG, 0), MK_FLOW_ACTION(QUEUE, sizeof(struct rte_flow_action_queue)), @@ -91,6 +98,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)), MK_FLOW_ACTION(PHY_PORT, sizeof(struct rte_flow_action_phy_port)), MK_FLOW_ACTION(PORT_ID, sizeof(struct rte_flow_action_port_id)), + MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)), + MK_FLOW_ACTION(SECURITY, sizeof(struct rte_flow_action_security)), MK_FLOW_ACTION(OF_SET_MPLS_TTL, sizeof(struct rte_flow_action_of_set_mpls_ttl)), MK_FLOW_ACTION(OF_DEC_MPLS_TTL, 0), @@ -110,6 +119,10 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { sizeof(struct rte_flow_action_of_pop_mpls)), MK_FLOW_ACTION(OF_PUSH_MPLS, sizeof(struct rte_flow_action_of_push_mpls)), + MK_FLOW_ACTION(VXLAN_ENCAP, sizeof(struct rte_flow_action_vxlan_encap)), + MK_FLOW_ACTION(VXLAN_DECAP, 0), + MK_FLOW_ACTION(NVGRE_ENCAP, sizeof(struct rte_flow_action_vxlan_encap)), + MK_FLOW_ACTION(NVGRE_DECAP, 0), }; static int @@ -407,11 +420,16 @@ rte_flow_conv_action_conf(void *buf, const size_t size, switch (action->type) { union { const struct rte_flow_action_rss *rss; + const struct rte_flow_action_vxlan_encap *vxlan_encap; + const struct rte_flow_action_nvgre_encap *nvgre_encap; } src; union { struct rte_flow_action_rss *rss; + struct rte_flow_action_vxlan_encap *vxlan_encap; + struct rte_flow_action_nvgre_encap *nvgre_encap; } dst; size_t tmp; + int ret; case RTE_FLOW_ACTION_TYPE_RSS: src.rss = action->conf; @@ -445,6 +463,34 @@ rte_flow_conv_action_conf(void *buf, const size_t size, off += tmp; } break; + case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: + case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: + src.vxlan_encap = action->conf; + dst.vxlan_encap = buf; + RTE_BUILD_BUG_ON(sizeof(*src.vxlan_encap) != + sizeof(*src.nvgre_encap) || + offsetof(struct rte_flow_action_vxlan_encap, + definition) != + offsetof(struct rte_flow_action_nvgre_encap, + definition)); + off = sizeof(*dst.vxlan_encap); + if (src.vxlan_encap->definition) { + off = RTE_ALIGN_CEIL + (off, sizeof(*dst.vxlan_encap->definition)); + ret = rte_flow_conv + (RTE_FLOW_CONV_OP_PATTERN, + (void *)((uintptr_t)dst.vxlan_encap + off), + size > off ? size - off : 0, + src.vxlan_encap->definition, NULL); + if (ret < 0) + return 0; + if (size >= off + ret) + dst.vxlan_encap->definition = + (void *)((uintptr_t)dst.vxlan_encap + + off); + off += ret; + } + break; default: off = rte_flow_desc_action[action->type].size; rte_memcpy(buf, action->conf, (size > off ? off : size)); -- 2.11.0