From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f66.google.com (mail-oi0-f66.google.com [209.85.218.66]) by dpdk.org (Postfix) with ESMTP id 0E6A07D4A for ; Thu, 5 Oct 2017 13:50:37 +0200 (CEST) Received: by mail-oi0-f66.google.com with SMTP id m198so11773784oig.5 for ; Thu, 05 Oct 2017 04:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=H5VioVoYjtlNrQ06gY467pzvTk3EvrMbF3Yfw+GTFW4=; b=fgH6dk48GVaN3UX1+h5pJYbVQVeTyqbxWXcEH9Xv4oqm4EjoR02C9v67im+dgLbnkg lfx7atkrPDZftGHpsuoOvcMv/N33sOl5Bso2S1iKqvC7C1uSDvU7gGBfBGOgg7fSueiQ ivgWUaV6sB88rILvXeB2jcw9M1lMXeDMujFnGuOBnFJClhpPJBhIrnVdPW+X/vSR+UZn oUeCx/toO1x/PeAQ7oe7VHtC8wCy8v+wg73WNdBw0/FAoikXhdzDlJD9Ab+Wld1rkoXO kuD/Plx1EffDRcqCwZufGaCjccdfgt3XswaE4hsjWGYwATMgL+D1jMoLg/eOvzvaZsZg bX3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=H5VioVoYjtlNrQ06gY467pzvTk3EvrMbF3Yfw+GTFW4=; b=akffKC+5E5QkvSgXANg2R8xU3qsu8yVT8/SvhmlSdYaSXIQ3n7CBrA+C7pm2O35GU+ aqyRQrhTpvLpO4W5wtF8guyPB50MTfvhOZ+BAknf+IMIz6GS45rxINZ39s9hG61udhwN AVGh/JrVvrYLfyD624FXa3p8IfipwXywYYiA0CXZjaLWIEouF3XwL1+MvuuCvb0unCY5 Om1KKvO4uLmiXUiAHNpy51IsQtx2OdIdH9dGSCRjmrFxtSQyzBbjqLpWzwFy1Vmi+Rwj l1EX2BrXa6GOY7LDb+w/OS+shYF8QeQzj1vSUfXBUT/QOEIpIOV/+7r7QFt85mfcdNPM r+ug== X-Gm-Message-State: AMCzsaXC56peGYrk5/QwlKUyW5/NGMJA75l4iJXo4NiJDdg4zQ9NcU1l +uSWTIfucycD5EWQC2JHDaSpPiudjiyCGUwkmzs= X-Google-Smtp-Source: AOwi7QBq4LMTG7O1XSavzYVzlge4Rorp2iXro3HcFLoWexLV91DiMi6krrOeR/meo0dqNVeEwjljmDH0oG/Qx+LT2ys= X-Received: by 10.202.245.197 with SMTP id t188mr5089461oih.354.1507204236105; Thu, 05 Oct 2017 04:50:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.83.193 with HTTP; Thu, 5 Oct 2017 04:50:35 -0700 (PDT) In-Reply-To: <1507191297-122088-4-git-send-email-beilei.xing@intel.com> References: <1506700252-34949-1-git-send-email-beilei.xing@intel.com> <1507191297-122088-1-git-send-email-beilei.xing@intel.com> <1507191297-122088-4-git-send-email-beilei.xing@intel.com> From: Sean Harte Date: Thu, 5 Oct 2017 12:50:35 +0100 Message-ID: To: Beilei Xing Cc: "Wu, Jingjing" , "Chilikin, Andrey" , dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v8 3/7] ethdev: add GTP items to support flow API 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: Thu, 05 Oct 2017 11:50:37 -0000 On 5 October 2017 at 09:14, Beilei Xing wrote: > This patch adds GTP, GTPC and GTPU items for > generic flow API, and also exposes item fields > through the flow command. > > Signed-off-by: Beilei Xing > Acked-by: Adrien Mazarguil > Acked-by: Jingjing Wu > --- > app/test-pmd/cmdline_flow.c | 40 ++++++++++++++++++++++ > app/test-pmd/config.c | 3 ++ > doc/guides/prog_guide/rte_flow.rst | 17 ++++++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ > lib/librte_ether/rte_flow.h | 52 +++++++++++++++++++++++= ++++++ > 5 files changed, 116 insertions(+) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index a17a004..26c3e4f 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -171,6 +171,10 @@ enum index { > ITEM_GRE_PROTO, > ITEM_FUZZY, > ITEM_FUZZY_THRESH, > + ITEM_GTP, > + ITEM_GTP_TEID, > + ITEM_GTPC, > + ITEM_GTPU, > > /* Validate/create actions. */ > ACTIONS, > @@ -451,6 +455,9 @@ static const enum index next_item[] =3D { > ITEM_MPLS, > ITEM_GRE, > ITEM_FUZZY, > + ITEM_GTP, > + ITEM_GTPC, > + ITEM_GTPU, > ZERO, > }; > > @@ -588,6 +595,12 @@ static const enum index item_gre[] =3D { > ZERO, > }; > > +static const enum index item_gtp[] =3D { > + ITEM_GTP_TEID, > + ITEM_NEXT, > + ZERO, > +}; > + > static const enum index next_action[] =3D { > ACTION_END, > ACTION_VOID, > @@ -1421,6 +1434,33 @@ static const struct token token_list[] =3D { > .args =3D ARGS(ARGS_ENTRY(struct rte_flow_item_fuzzy, > thresh)), > }, > + [ITEM_GTP] =3D { > + .name =3D "gtp", > + .help =3D "match GTP header", > + .priv =3D PRIV_ITEM(GTP, sizeof(struct rte_flow_item_gtp)= ), > + .next =3D NEXT(item_gtp), > + .call =3D parse_vc, > + }, > + [ITEM_GTP_TEID] =3D { > + .name =3D "teid", > + .help =3D "tunnel endpoint identifier", > + .next =3D NEXT(item_gtp, NEXT_ENTRY(UNSIGNED), item_param= ), > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp, = teid)), > + }, > + [ITEM_GTPC] =3D { > + .name =3D "gtpc", > + .help =3D "match GTP header", > + .priv =3D PRIV_ITEM(GTPC, sizeof(struct rte_flow_item_gtp= )), > + .next =3D NEXT(item_gtp), > + .call =3D parse_vc, > + }, > + [ITEM_GTPU] =3D { > + .name =3D "gtpu", > + .help =3D "match GTP header", > + .priv =3D PRIV_ITEM(GTPU, sizeof(struct rte_flow_item_gtp= )), > + .next =3D NEXT(item_gtp), > + .call =3D parse_vc, > + }, > > /* Validate/create actions. */ > [ACTIONS] =3D { > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 60a8d07..4ec8f0d 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -952,6 +952,9 @@ static const struct { > 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)), > }; > > /** Compute storage space needed by item specification. */ > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index 662a912..73f12ee 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -955,6 +955,23 @@ Usage example, fuzzy match a TCPv4 packets: > | 4 | END | > +-------+----------+ > > +Item: ``GTP``, ``GTPC``, ``GTPU`` > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Matches a GTPv1 header. > + > +Note: GTP, GTPC and GTPU use the same structure. GTPC and GTPU item > +are defined for a user-friendly API when creating GTP-C and GTP-U > +flow rules. > + > +- ``v_pt_rsv_flags``: version (3b), protocol type (1b), reserved (1b), > + extension header flag (1b), sequence number flag (1b), N-PDU number > + flag (1b). > +- ``msg_type``: message type. > +- ``msg_len``: message length. > +- ``teid``: tunnel endpoint identifier. > +- Default ``mask`` matches teid only. > + > Actions > ~~~~~~~ > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/tes= tpmd_app_ug/testpmd_funcs.rst > index aeef3e1..32223ca 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -2721,6 +2721,10 @@ This section lists supported pattern items and the= ir attributes, if any. > > - ``thresh {unsigned}``: accuracy threshold. > > +- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header. > + > + - ``teid {unsigned}``: tunnel endpoint identifier. > + > Actions list > ^^^^^^^^^^^^ > > diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h > index bba6169..b1a1b97 100644 > --- a/lib/librte_ether/rte_flow.h > +++ b/lib/librte_ether/rte_flow.h > @@ -309,6 +309,33 @@ enum rte_flow_item_type { > * See struct rte_flow_item_fuzzy. > */ > RTE_FLOW_ITEM_TYPE_FUZZY, > + > + /** > + * Matches a GTP header. > + * > + * Configure flow for GTP packets. > + * > + * See struct rte_flow_item_gtp. > + */ > + RTE_FLOW_ITEM_TYPE_GTP, > + > + /** > + * Matches a GTP header. > + * > + * Configure flow for GTP-C packets. > + * > + * See struct rte_flow_item_gtp. > + */ > + RTE_FLOW_ITEM_TYPE_GTPC, > + > + /** > + * Matches a GTP header. > + * > + * Configure flow for GTP-U packets. > + * > + * See struct rte_flow_item_gtp. > + */ > + RTE_FLOW_ITEM_TYPE_GTPU, > }; > > /** > @@ -735,6 +762,31 @@ static const struct rte_flow_item_fuzzy rte_flow_ite= m_fuzzy_mask =3D { > #endif > > /** > + * RTE_FLOW_ITEM_TYPE_GTP. > + * > + * Matches a GTPv1 header. > + */ > +struct rte_flow_item_gtp { > + /** > + * Version (3b), protocol type (1b), reserved (1b), > + * Extension header flag (1b), > + * Sequence number flag (1b), > + * N-PDU number flag (1b). > + */ > + uint8_t v_pt_rsv_flags; > + uint8_t msg_type; /**< Message type. */ > + rte_be16_t msg_len; /**< Message length. */ > + rte_be32_t teid; /**< Tunnel endpoint identifier. */ > +}; > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */ > +#ifndef __cplusplus > +static const struct rte_flow_item_gtp rte_flow_item_gtp_mask =3D { > + .teid =3D RTE_BE32(0xffffffff), > +}; > +#endif > + > +/** > * Matching pattern item definition. > * > * A pattern is formed by stacking items starting from the lowest protoc= ol > -- > 2.5.5 > Reviewed-by: Se=C3=A1n Harte