From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH 1/3] app/testpmd: support MPLS for generic filter Date: Fri, 3 Mar 2017 12:09:26 +0100 Message-ID: <20170303110926.GY3790@6wind.com> References: <1488534236-29904-1-git-send-email-beilei.xing@intel.com> <1488534236-29904-2-git-send-email-beilei.xing@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jingjing.wu@intel.com, helin.zhang@intel.com, dev@dpdk.org To: Beilei Xing Return-path: Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id F1E75952 for ; Fri, 3 Mar 2017 12:09:35 +0100 (CET) Received: by mail-wr0-f173.google.com with SMTP id u48so71379162wrc.0 for ; Fri, 03 Mar 2017 03:09:35 -0800 (PST) Content-Disposition: inline In-Reply-To: <1488534236-29904-2-git-send-email-beilei.xing@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Beilei, I think the commit title should reflect that this commit adds support for GRE and MPLS items to rte_flow, testpmd changes are only a consequence. On Fri, Mar 03, 2017 at 05:43:54PM +0800, Beilei Xing wrote: > This patch adds MPLS support for generic filter > API. > > Signed-off-by: Beilei Xing > --- > app/test-pmd/cmdline_flow.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ > app/test-pmd/config.c | 2 ++ > lib/librte_ether/rte_flow.h | 40 +++++++++++++++++++++++++++++++++ > 3 files changed, 97 insertions(+) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index ff98690..241bda1 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -159,6 +159,11 @@ enum index { > ITEM_SCTP_CKSUM, > ITEM_VXLAN, > ITEM_VXLAN_VNI, > + ITEM_MPLS, > + ITEM_MPLS_LABEL, > + ITEM_GRE, > + ITEM_GRE_FLAGS, > + ITEM_GRE_PROTO, > > /* Validate/create actions. */ > ACTIONS, > @@ -432,6 +437,8 @@ static const enum index next_item[] = { > ITEM_TCP, > ITEM_SCTP, > ITEM_VXLAN, > + ITEM_MPLS, > + ITEM_GRE, > ZERO, > }; > > @@ -538,6 +545,19 @@ static const enum index item_vxlan[] = { > ZERO, > }; > > +static const enum index item_mpls[] = { > + ITEM_MPLS_LABEL, > + ITEM_NEXT, > + ZERO, > +}; > + > +static const enum index item_gre[] = { > + ITEM_GRE_FLAGS, > + ITEM_GRE_PROTO, > + ITEM_NEXT, > + ZERO, > +}; > + > static const enum index next_action[] = { > ACTION_END, > ACTION_VOID, > @@ -1279,6 +1299,41 @@ static const struct token token_list[] = { > .next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param), > .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)), > }, > + [ITEM_MPLS] = { > + .name = "mpls", > + .help = "match MPLS header", > + .priv = PRIV_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), > + .next = NEXT(item_mpls), > + .call = parse_vc, > + }, > + [ITEM_MPLS_LABEL] = { > + .name = "label", > + .help = "MPLS label", > + .next = NEXT(item_mpls, NEXT_ENTRY(UNSIGNED), item_param), > + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_mpls, > + label_tc_s_ttl)), > + }, > + [ITEM_GRE] = { > + .name = "gre", > + .help = "match GRE header", > + .priv = PRIV_ITEM(GRE, sizeof(struct rte_flow_item_gre)), > + .next = NEXT(item_gre), > + .call = parse_vc, > + }, > + [ITEM_GRE_FLAGS] = { > + .name = "c_rsvd0_ver", > + .help = "GRE c_rsvd0_ver", > + .next = NEXT(item_gre, NEXT_ENTRY(UNSIGNED), item_param), > + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre, > + c_rsvd0_ver)), > + }, > + [ITEM_GRE_PROTO] = { > + .name = "protocol", > + .help = "GRE protocol type", > + .next = NEXT(item_gre, NEXT_ENTRY(UNSIGNED), item_param), > + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre, > + protocol)), > + }, Testpmd documentation must be updated accordingly, see: doc/guides/testpmd_app_ug/testpmd_funcs.rst > /* Validate/create actions. */ > [ACTIONS] = { > .name = "actions", > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 80491fc..c042765 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -963,6 +963,8 @@ static const struct { > 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)), > }; > > /** Compute storage space needed by item specification. */ > diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h > index 171a569..c845953 100644 > --- a/lib/librte_ether/rte_flow.h > +++ b/lib/librte_ether/rte_flow.h > @@ -282,6 +282,20 @@ enum rte_flow_item_type { > * See struct rte_flow_item_nvgre. > */ > RTE_FLOW_ITEM_TYPE_NVGRE, > + > + /** > + * Matches a MPLS header. > + * > + * See struct rte_flow_item_mpls. > + */ > + RTE_FLOW_ITEM_TYPE_MPLS, > + > + /** > + * Matches a GRE header. > + * > + * See struct rte_flow_item_gre. > + */ > + RTE_FLOW_ITEM_TYPE_GRE, > }; API documentation must be updated accordingly, see: doc/guides/prog_guide/rte_flow.rst Same comments about RTE_FLOW_ITEM_TYPE_NVGRE added by another series. You should mention there's a dependency between them. > > /** > @@ -599,6 +613,32 @@ struct rte_flow_item_nvgre { > }; > > /** > + * RTE_FLOW_ITEM_TYPE_MPLS. > + * > + * Matches a MPLS header. > + */ > + struct rte_flow_item_mpls { > + /** > + * Lable (20b), TC (3b), Bottom of Stack (1b), TTL (8b). > + */ > + uint32_t label_tc_s_ttl; > + }; Wrong indentation. > + > +/** > + * RTE_FLOW_ITEM_TYPE_GRE. > + * > + * Matches a GRE header. > + */ > +struct rte_flow_item_gre { > + /** > + * Checksum (1b), reserved 0 (12b), version (3b). > + * Refer to RFC 2784. > + */ > + uint16_t c_rsvd0_ver; > + uint16_t protocol; /**< Protocol type. */ > +}; > + > +/** > * Matching pattern item definition. > * > * A pattern is formed by stacking items starting from the lowest protocol > -- > 2.5.5 > This patch looks otherwise good. -- Adrien Mazarguil 6WIND