From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kUxr2pJg2L1a1O+URjMhAL5TGmB/7oeg16np9KadWxQ=; b=rNN+gPn5ai1R8vkuRs0ofQ7hqe0a5ZqTsDv27v0Qt6KPrafdVuvxi4jQgl2+PtXEcO3gsbHtQ39Q0WDIPt5QyD5wSiQCb2PIHvRZDmUmHkOtnx9gOw7hfNs9OBy8a5J19trgQLJtHfaTeU6cakn5iSjj3r02hZJ6a1QGD/fXwYI= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3961.eurprd05.prod.outlook.com (52.134.70.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.23; Wed, 3 Oct 2018 19:50:40 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.024; Wed, 3 Oct 2018 19:50:40 +0000 From: Yongseok Koh To: Jack Min CC: "ferruh.yigit@intel.com" , Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Andrew Rybchenko , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] ethdev: add generic TTL rewrite actions Thread-Index: AQHUVN121RD2Q4kNckS+R64r19EKkaUN+vOA 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> In-Reply-To: <20180925143719.23339-2-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DM5PR21CA0031.namprd21.prod.outlook.com (2603:10b6:3:ed::17) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3961; 6:IKa8OqPIhuu9jyXXLDP6Uj7zyzrGQtNHxpun+F+DWCC5dyF6R0qL4eAEG2v3WHgb+XdrqTB8nSq88PZ50+YiisjQRcCoGNs/Ny+8IYzR3CJ2cisM0Avi/oX5owvryhAYaS6oIPIIZuOW42sSsOUNpe8FkOVCLo3K909UjAACOavZKYlz8HYEiN39ivrI4M5OG8GCL2+klAUmzuVRZU5DIGq4rdbbj0wns5ZTHehYFMjm+zh5ft3w4E2l1/C8b1MYHHv56pKvZZ8uKoydK0u8JeLdZHuhUYSIf2WbIt0lVDgdozJACZ5V7AF570knOzBUOl/i+Ye+g9CMxMOGKXKanmzrQY3/twymcQykyyPZYpww/42LoNMMdRC/VH3GxOPB3rZjQvJtlcTl36TE4fwaN/+pOL/1n80MTxRaiGtWDJfAIpZv5PYUJUy3I4cVL1718u1CcazBJyMshpwEc2S7LQ==; 5:Fmt5LzRlfVwP/lMWAAx3mAoKZGiIIfQpezTy9m0QiWyLQyWYl+XB7dlKId13qizN7d+ecEv9x4m81RVFVyGERWrgMNZzzO5ZQaWpoTnb0yUzdEGMTqbKgqiIQafrks8fBopiTQrL0/0ECPGrLNyxtHmsvFjqNNY69z6sqNT1zMI=; 7:df9CHKdVZEXxD/u1vJJnsDJ8nejTWZYQGsJ4FPtEehbfYRsksu6G/7GvJamFSkyhv6Fi2fJB60BamiCe0jxIiSzS/m6U16IvJ1KURdaowtP6uGuCiWUYrLo+cLX0/EK0ptErucibqByfKrC4wNqYLAqiH1ASJSuXGfStce2qN+nnGYuzPefOiKb9LpnfKTH3fSarUO/ptRVSlHRIZ97XnKJWveat8lVm2L+x958UDiZFOgasQVGnNFV5svd03YQo x-ms-office365-filtering-correlation-id: fa923038-0f56-4b89-b123-08d629697efb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3961; x-ms-traffictypediagnostic: DB3PR0502MB3961: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB3PR0502MB3961; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3961; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(189003)(8936002)(71200400001)(14454004)(3846002)(81156014)(11346002)(33656002)(486006)(386003)(6506007)(478600001)(476003)(26005)(186003)(446003)(33896004)(102836004)(106356001)(71190400001)(6486002)(97736004)(81166006)(105586002)(229853002)(6436002)(2900100001)(6636002)(316002)(6246003)(68736007)(25786009)(1076002)(4326008)(8676002)(6862004)(6512007)(9686003)(53936002)(66066001)(86362001)(5660300001)(305945005)(99286004)(256004)(52116002)(6116002)(2906002)(5250100002)(54906003)(76176011)(7736002)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3961; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: bv/nGBZAtEUtKTHnSWuWxMaK0p5GpyjDvvyA75XTTQjDL3OisvLd5XX7mSie1tr0s97uqJNK/ivyTDeJbEgDpvRCJXDm4ADDyCXnSumZGhIxXJI+nwVa0f24ciunzRT4rtRlBC7/NmJk8o79Y7nZ6TttYbx8huOLmRdQF6RAOTPjmV5BY+SM/39Ol6+pxPubP8COZKVZ9fYR1MFEaj1ckoJ9zchZjv/g0xa1WvkQmQBmR6VOCwVCTZOHB9mAaMKIJG35z+VhDl2YubbGYBiPt0AfOZOgqY7OwcHXrp1E7/JI16D33On41sQ/ScAUNuOgE1o/hnnh8WvNI3RNRoYwuzOk0p417A5ccvDA70LaEFk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <84C0E54FEA7B474E83C53F46126A86B0@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa923038-0f56-4b89-b123-08d629697efb X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 19:50:40.3166 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3961 Subject: Re: [dpdk-dev] [PATCH v2 1/3] ethdev: add generic TTL rewrite actions 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: Wed, 03 Oct 2018 19:50:42 -0000 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