From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yongseok Koh Subject: Re: [PATCH v2 1/3] ethdev: add generic TTL rewrite actions Date: Wed, 3 Oct 2018 19:50:40 +0000 Message-ID: <20181003195030.GA26206@mtidpdk.mti.labs.mlnx> References: <20180925134718.18945-1-jackmin@mellanox.com> <20180925143719.23339-1-jackmin@mellanox.com> <20180925143719.23339-2-jackmin@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "ferruh.yigit@intel.com" , Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Andrew Rybchenko , "dev@dpdk.org" To: Jack Min Return-path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0042.outbound.protection.outlook.com [104.47.2.42]) by dpdk.org (Postfix) with ESMTP id 23BBD1B295 for ; Wed, 3 Oct 2018 21:50:42 +0200 (CEST) In-Reply-To: <20180925143719.23339-2-jackmin@mellanox.com> Content-Language: en-US Content-ID: <84C0E54FEA7B474E83C53F46126A86B0@eurprd05.prod.outlook.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" On Tue, Sep 25, 2018 at 10:37:17PM +0800, Xiaoyu Min wrote: > rewrite TTL by decrease or just set it directly > it's not necessary to check if the final result > is zero or not >=20 > This is slightly different from the one defined > by openflow and more generic >=20 > Signed-off-by: Xiaoyu Min > --- Acked-by: Yongseok Koh Thanks > doc/guides/prog_guide/rte_flow.rst | 30 +++++++++++++++++++++++++++++ > lib/librte_ethdev/rte_flow.c | 2 ++ > lib/librte_ethdev/rte_flow.h | 31 ++++++++++++++++++++++++++++++ > 3 files changed, 63 insertions(+) >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index 4faf8cb40..3aec0834b 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -2166,6 +2166,36 @@ Set a new TCP/UDP destination port number. > | ``port`` | new TCP/UDP destination port | > +---------------+-------------------------+ > =20 > +Action: ``DEC_TTL`` > +^^^^^^^^^^^^^^^^^^^ > + > +Decrease TTL value. > + > +.. _table_rte_flow_action_dec_ttl: > + > +.. table:: DEC_TTL > + > + +---------------+ > + | Field | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > + | no properties | > + +---------------+ > + > +Action: ``SET_TTL`` > +^^^^^^^^^^^^^^^^^^^ > + > +Assigns a new TTL value. > + > +.. _table_rte_flow_action_set_ttl: > + > +.. table:: SET_TTL > + > + +---------------+--------------------+ > + | Field | Value | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > + | ``ttl_value`` | new TTL value | > + +---------------+--------------------+ > + > Negative types > ~~~~~~~~~~~~~~ > =20 > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index 409c79741..631f80efd 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -121,6 +121,8 @@ static const struct rte_flow_desc_data rte_flow_desc_= action[] =3D { > sizeof(struct rte_flow_action_set_tp)), > MK_FLOW_ACTION(SET_TP_DST, > sizeof(struct rte_flow_action_set_tp)), > + MK_FLOW_ACTION(DEC_TTL, 0), > + MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)), > }; > =20 > static int > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index c80771b25..b41e37a31 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -1547,6 +1547,26 @@ enum rte_flow_action_type { > * See struct rte_flow_action_set_tp. > */ > RTE_FLOW_ACTION_TYPE_SET_TP_DST, > + > + /** > + * Decrease TTL value directly > + * > + * If flow pattern doesn't define a valid RTE_FLOW_ITEM_TYPE_IPV4, or > + * RTE_FLOW_ITEM_TYPE_IPV6, the PMD should return a > + * RTE_FLOW_ERROR_TYPE_ACTION error. > + */ > + RTE_FLOW_ACTION_TYPE_DEC_TTL, > + > + /** > + * Set TTL value > + * > + * If flow pattern doesn't define a valid RTE_FLOW_ITEM_TYPE_IPV4, or > + * RTE_FLOW_ITEM_TYPE_IPV6, the PMD should return a > + * RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_ttl > + */ > + RTE_FLOW_ACTION_TYPE_SET_TTL, > }; > =20 > /** > @@ -1955,6 +1975,17 @@ struct rte_flow_action_set_tp { > uint16_t port; > }; > =20 > +/** > + * RTE_FLOW_ACTION_TYPE_SET_TTL > + * > + * Set the TTL value directly for IPv4 or IPv6 > + * The RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6 > + * must be present in pattern > + */ > +struct rte_flow_action_set_ttl { > + uint8_t ttl_value; > +}; > + > /* > * Definition of a single action. > * > --=20 > 2.17.1 >=20