From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0048.outbound.protection.outlook.com [104.47.1.48]) by dpdk.org (Postfix) with ESMTP id AEBCF1B1CA for ; Mon, 16 Apr 2018 07:48:21 +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; bh=gbuJQLYmL4Q9204n7VV3coH7HGlSJ31EM6mekiUGazU=; b=WpPvvFb1JyOYWYMcayw0gsmeaY9yr+I1nGMed25j9E+WezfAKj+Y4voAoFNgai9WSFba6br/TzvPH0A+O5d0jhDrUEzuG17lqrTN+TRL7A1s+yfPTyze/hh/qf/fWq3iHAo9FLfe5oXWQyZCWyiZRxwxW4X7kH3n05pP1pRELQs= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4473.eurprd05.prod.outlook.com (52.134.109.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.14; Mon, 16 Apr 2018 05:48:19 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::808d:386e:26f3:859f]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::808d:386e:26f3:859f%13]) with mapi id 15.20.0675.015; Mon, 16 Apr 2018 05:48:19 +0000 From: Shahaf Shuler To: Qi Zhang , Adrien Mazarguil CC: "dev@dpdk.org" , "declan.doherty@intel.com" , "sugesh.chandran@intel.com" , "michael.j.glynn@intel.com" , "yu.y.liu@intel.com" , "konstantin.ananyev@intel.com" , "bruce.richardson@intel.com" , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v3 3/4] ethdev: add TTL change actions in flow API Thread-Index: AQHT1UIxX5sbbyp2PEus+K6dx4YpK6QC3wTQ Date: Mon, 16 Apr 2018 05:48:19 +0000 Message-ID: References: <1522279780-34842-1-git-send-email-qi.z.zhang@intel.com> <20180416051639.188034-1-qi.z.zhang@intel.com> <20180416051639.188034-4-qi.z.zhang@intel.com> In-Reply-To: <20180416051639.188034-4-qi.z.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4473; 7:rFKaK88HEhDugNrUeDqtEG5QeA21BhHVh8VZgHWKnZcge6PIXqpz3SyPVS7840R/1KPTAaMAHZ2KaurgfInlfHhmeTvr2ahBw/SMDr+Ih81U2t0zHRbaR/j8I5ztiUvALRWeLoiKax4FEAmKzqZSwH/6ERK0fRL0pfkEwwRottEqc+w3ZVl/pgjkEI2ZVigHnrbZtgWnl+e7csPUHukmGLgZb/3KbL+iBcXWwQQJsI76wLlOv8BSRK1EAemnnYbp x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4473; x-ms-traffictypediagnostic: DB7PR05MB4473: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231232)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB7PR05MB4473; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4473; x-forefront-prvs: 0644578634 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(396003)(39380400002)(366004)(199004)(189003)(6246003)(33656002)(446003)(14454004)(476003)(2906002)(2900100001)(68736007)(106356001)(486006)(186003)(26005)(7696005)(8936002)(97736004)(99286004)(3846002)(11346002)(110136005)(54906003)(6436002)(316002)(76176011)(229853002)(5660300001)(86362001)(9686003)(478600001)(6506007)(53936002)(6116002)(5250100002)(74316002)(59450400001)(575784001)(55016002)(81156014)(81166006)(102836004)(105586002)(8676002)(4326008)(305945005)(66066001)(3280700002)(3660700001)(107886003)(25786009)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4473; H:DB7PR05MB4426.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: Mlmuct470hX3TXWQ6Bml9EhDxRebBioa6b+iT/JfymIqDNiB7hQkcG24AfRw6vGjtPCCUbfhx99/ZrsyXPmaoUbQ/R0pGvOzNN36iXxqhTcSmOqrHIX35sIc7BrMop+RFR/LyJiJOheHcmi4J6yhpGPt3OZpo30M0C2fVoBC8tz5cVckr7ezYIkp1Jblfn5u spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 96057c0c-523b-4beb-ce7e-08d5a35da860 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96057c0c-523b-4beb-ce7e-08d5a35da860 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Apr 2018 05:48:19.4058 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4473 Subject: Re: [dpdk-dev] [PATCH v3 3/4] ethdev: add TTL change actions in 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: Mon, 16 Apr 2018 05:48:22 -0000 Hi Qi, Am wondering if we can make the below more generic and not tailored for spe= cific use cases.=20 Monday, April 16, 2018 8:17 AM, Qi Zhang: > Subject: [dpdk-dev] [PATCH v3 3/4] ethdev: add TTL change actions in flow > API >=20 > Add couple OpenFlow frienldy TTL change actions. >=20 > RTE_FLOW_ACTION_MLPS_TTL_DEC - decrement MPLS TTL. > RTE_FLOW_ACTION_IP_TTL_DEC - decrement IP TTL. > RTE_FLOW_ACTION_TTL_COPY_OUT - copy TTL outwards. > RTE_FLOW_ACTION_TTL_COPY_IN - copy TTL inwards. >=20 > Signed-off-by: Qi Zhang > --- > app/test-pmd/cmdline_flow.c | 64 +++++++++++++++++++++++ > doc/guides/prog_guide/rte_flow.rst | 80 > +++++++++++++++++++++++++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 +++++ > lib/librte_ether/rte_flow.h | 77 +++++++++++++++++++++++= ++++ > 4 files changed, 233 insertions(+) [...] >=20 > /** Remove and return last entry from argument stack. */ diff --git > a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > index ea0e40a52..e81f0e375 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1588,6 +1588,86 @@ contain respective protocol layer. > | ``mask`` | Bit-mask applied to new_val = | > +---------------+----------------------------------------------------= ---------------+ >=20 > +Action: ``MPLS_TTL_DEC`` > +^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Decrement MPLS TTL, only applies to packets that contain specific MPLS > +headers. > + > +.. _table_rte_flow_action_mpls_ttl_dec: > + > +.. table:: MPLS_TTL_DEC > + > + +---------------+---------------------------------------------+ > + | 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=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+ > + | ``dir_level`` | Specify the level of MPLS header. | > + | | direction (1b) | > + | | 0: match start from outermost. | > + | | 1: match start from innermost. | > + | | level: (31b) | > + | | 0: outermost or innermost MPLS header | > + | | 1: next to outmost or innermost MPLS header | > + | | 2: and so on ... | > + +---------------+---------------------------------------------+ Why not exposing it is as generic operation: increment/decrement for any ty= pe of header. The action struct will receive the flow item type to modify, list of increm= ent/decrement values for each of its fields (+x/-y) along with correspondin= g mask? It is true the main use case is TTL decrement for vRouters, however It will= save the duplication of the TTL_DEC action below and maybe we will not nee= d to modify the API for future similar actions. > + > +Action: ``IP_TTL_DEC`` > +^^^^^^^^^^^^^^^^^^^^^^ > + > +Decrement IPv4 TTL or IPv6 hop limit field and update the IP checksum, > +only applies to packets that contain specific MPLS headers. > + > +.. _table_rte_flow_action_ip_ttl_dec: > + > +.. table:: IP_TTL_DEC > + > + +---------------+----------------------------------------------------= ------+ > + | 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=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=3D=3D=3D+ > + | ``dir_level`` | Specify the level of IPv4 or IPv6 header. = | > + | | direction (1b) = | > + | | 0: match start from outermost. = | > + | | 1: match start from innermost. = | > + | | level: (31b) = | > + | | 0: outermost or innermost Ipv4 or IPv6 header = | > + | | 1: next to outmost or innermost MPLS IPv4 or IPv6 h= eader | > + | | 2: and so on ... = | > + > + +---------------+----------------------------------------------------- > + -----+ > + > +Action: ``TTL_COPY_OUT`` > +^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Copy the TTL from next-to-outermost to outermost header with TTL, copy > +can be IP to IP, MPLS to MPLS or IP to MPLS, only applies packets that > +contain required MPLS or IP headers. > + > +.. _table_rte_flow_action_ttl_copy_out: > + > +.. table:: TTL_COPY_OUT > + > + +---------------+ > + | Field | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > + | no properties | > + +---------------+ Why only the TTL ? and why only from outermost to next-to-outer-most?=20 We can have an action to copy field from flow item to another flow item.=20 We will need flow item for src + mask for the field to copy, flow item for = dst + mask for the field to set > + > +Action: ``TTL_COPY_IN`` > +^^^^^^^^^^^^^^^^^^^^^^^ > + > +Copy the TTL from outermost to next-to-outermost header with TTL, copy > +can be IP to IP, MPLS to MPLS or MPLS to IP, only applies packets that > +contain required MPLS or IP headers. > + > +.. _table_rte_flow_action_ttl_copy_in: > + > +.. table:: TTL_COPY_IN > + > + +---------------+ > + | Field | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > + | no properties | > + +---------------+ > + > Negative types > ~~~~~~~~~~~~~~ >=20 > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 48688600e..4dd86f10e 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3442,6 +3442,18 @@ This section lists supported actions and their > attributes, if any. > - ``original {boolean}``: use original VF ID if possible. > - ``id {unsigned}``: VF ID to redirect packets to. >=20 > +- ``mpls_ttl_dec``: decrement MPLS TTL. > + > + - ``level``: level of MPLS header. > + > +- ``ip_ttl_dec``: decrement IPv4 TTL or IPv6 Hot Limit. > + > + - ``level``: level of IPv4 or IPv6 header. > + > +- ``ttl_copy_out``: copy TTL outwards. > + > +- ``ttl_copy_in``: copy TTL inwards. > + > Destroying flow rules > ~~~~~~~~~~~~~~~~~~~~~ >=20 > diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h in= dex > 80cf75ff0..96a236945 100644 > --- a/lib/librte_ether/rte_flow.h > +++ b/lib/librte_ether/rte_flow.h > @@ -1250,6 +1250,37 @@ enum rte_flow_action_type { > * See struct rte_flow_action_field_set. > */ > RTE_FLOW_ACTION_TYPE_FIELD_SET, > + > + /** > + * Decrement MPLS TTL, only applies to packets that contain specific > + * MPLS header. > + * > + * See struct rte_flow_action_mpls_ttl_dec. > + */ > + RTE_FLOW_ACTION_TYPE_MPLS_TTL_DEC, > + > + /** > + * Decrement IPv4 TTL or IPv6 Hop limit field and update the IP > + * checksum, only applies to packets that contain specific IPv4 > + * or IPv6 header. > + * > + * See struct rte_flow_action_ip_ttl_dec. > + */ > + RTE_FLOW_ACTION_TYPE_IP_TTL_DEC, > + > + /** > + * Copy the TTL from next-to-outermost to outermost header with > TTL, > + * copy can be IP to IP, MPLS to MPLS or IP to MPLS, only applies > + * packets that contain required protocol headers. > + */ > + RTE_FLOW_ACTION_TYPE_TTL_COPY_OUT, > + > + /** > + * Copy the TTL from outermost to next-to-outermost header with > TTL, > + * copy can be IP to IP, MPLS to MPLS or MPLS to IP, only applies > + * packets that contain required protocol headers. > + */ > + RTE_FLOW_ACTION_TYPE_TTL_COPY_IN, > }; >=20 > /** > @@ -1420,6 +1451,52 @@ struct rte_flow_action_field_set { }; >=20 > /** > + * RTE_FLOW_ACTION_TYPE_MPLS_TTL_DEC > + * > + * Decrement MPLS TTL, only applies to packets that contain specific > + * MPLS header. > + */ > +struct rte_flow_action_mpls_ttl_dec { > + /** > + * Specify the level of MPLS header. > + * > + * direction (1b) > + * 0: match start from outermost. > + * 1: match start from innermost. > + * > + * level (31b) > + * 0: outermost|innermost MPLS header. > + * 1: next to outermost|innermost MPLS header. > + * 2: and so on ... > + */ > + uint32_t dir_level; > + > +}; > + > +/** > + * RTE_FLOW_ACTION_TYPE_IP_TTL_DEC > + * > + * Decrement IPv4 TTL or IPv6 hop limit field and update the IP > + * checksum, only applies to packets that contain specific IPv4 > + * or IPv6 header. > + */ > +struct rte_flow_action_ip_ttl_dec { > + /** > + * Specify the level of IPv4 or IPv6 header. > + * > + * direction (1b) > + * 0: match start from outermost. > + * 1: match start from innermost. > + * > + * level (31b) > + * 0: outermost|innermost IPv4 or IPv6 header. > + * 1: next to outermost|innermost IPv4 or IPv6 header. > + * 2: and so on ... > + */ > + uint32_t dir_level; > +}; > + > +/** > * Definition of a single action. > * > * A list of actions is terminated by a END action. > -- > 2.13.6