From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2247A04B3; Mon, 16 Dec 2019 08:49:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D0491C133; Mon, 16 Dec 2019 08:49:54 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20061.outbound.protection.outlook.com [40.107.2.61]) by dpdk.org (Postfix) with ESMTP id 590EF1C132 for ; Mon, 16 Dec 2019 08:49:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bbg/ab6BuPy4L7ERzCzxO8v0hweJDpHu8jLg1WscTSLKyZrEsAfbk8R4cL7V91CIeiS5l2Pv0DH7R900lnlE38nmfkkophZiLhCywT+s03HpyQF/bN/R03L5adavCBadqq6ojqrYa79oJHNXeudyszPlu3cfECbc/c/kMKQq/HK9R95PMa38R0yqhUW5Yj4jdBYYDjRSGqXi6SprNC+MVL0wX50rQQ3qyESjh9xRxqSid66VJPpK1rfALsQ8Vkwxjd+AJUiw39nkGYFPNqwZST/qC6DJs1txlx4cyAQMaSVIQuMi+q8e+MkU4M5hr3AeC3dSs4P+UJKYYlEfkS28xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fNaaBM8/KyZdNHeChqMf0fAKoyGDpN9V4yNhpINsdlc=; b=Uxo4F8/3PQDxT40h6nEue9tCoKhFrfhVhTpgJXM8zihkeJqqggX/HL3Ep99SK1ZpvHdGvO5jJakP7/3OA192ioNSQl8XT5XHiljnk9aLPd11cN3WME04uVmYPoidcP4iFXrdymSJ/BOZm72H4jlqXsKwEqYKD+KqKvF4wRywqQTbm/FEEGydcCp0Wt4Yrx94jtlcXKsqfn+Vmg7lQPiZPjYmdI43vfUNcXfR7vg8ACq/RueHPARNmnvkOxBEUR23/jr9ah4D/seMgW1cIO1sET4dgwNzwgl9zbmnkt3TVEoO6mfEw6sPgMxwBmQjPJW8hO3yzCZp8ITK4aHhoE1mQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=fNaaBM8/KyZdNHeChqMf0fAKoyGDpN9V4yNhpINsdlc=; b=fzAWR4d9sANGVF82f+/HAXWpOULAjz4SwM32IdISnBAFZbs8hiaTTi7cKOGLVh0cWZyzWG3fjleozWqICWeYzm8d2sAnFxbfxbevK8MfxLUgVYOY9OO+ruAdhNvugdqr9S2QUsc7nKcxy5q4xlrKvaBOIVYzD/E4G4gB5W1JapU= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3218.eurprd05.prod.outlook.com (10.170.125.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.17; Mon, 16 Dec 2019 07:49:52 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::5114:421:f4a9:5ca8]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::5114:421:f4a9:5ca8%6]) with mapi id 15.20.2538.019; Mon, 16 Dec 2019 07:49:51 +0000 From: Ori Kam To: Suanming Mou , Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , Shahaf Shuler , Matan Azrad , Slava Ovsiienko Thread-Topic: [RFC v3 1/2] ethdev: add IPv4/IPv6 DSCP rewrite action Thread-Index: AQHVs8LNKew+5zw40EuS6IgvgK+f+Ke8Yung Date: Mon, 16 Dec 2019 07:49:51 +0000 Message-ID: References: <1575955386-6672-1-git-send-email-suanmingm@mellanox.com> <1576467723-68792-1-git-send-email-suanmingm@mellanox.com> In-Reply-To: <1576467723-68792-1-git-send-email-suanmingm@mellanox.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=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: bd4e4793-e450-4eca-2a10-08d781fc8893 x-ms-traffictypediagnostic: AM4PR05MB3218:|AM4PR05MB3218: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:669; x-forefront-prvs: 02530BD3AA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(346002)(376002)(366004)(136003)(39860400002)(13464003)(189003)(199004)(8936002)(52536014)(86362001)(2906002)(81156014)(4326008)(81166006)(55016002)(9686003)(107886003)(5660300002)(7416002)(71200400001)(33656002)(8676002)(186003)(110136005)(316002)(478600001)(7696005)(6506007)(64756008)(66446008)(66556008)(54906003)(66476007)(26005)(66946007)(76116006)(53546011)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3218; H:AM4PR05MB3425.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fVKLn59P8ppItaeNpKpTlRCfXjyD0gQLVyxXnCpPq2jDFkGpHjUOIyPUTBJQQ8fndW+/HT4eezSy9wNrUBeXqgop4hJMc1+8VQ8YN1YRMyrGgkZUhFlECxtDL9o8H1TbJK9U2E6TU4DTykSkHSM8F4kmtsU2nx6uwhfZyA/tK5LKnAfVsmmc0cKQuKcRk0ScWSdKUKKVWBwyS6PVzHyItvZCAHOTjiRr02KoznLliQ3+VvsW63O5ffjJdJdFnp6vUryxuWyMud5Cno74YZFMEKm0x45T6hIwPRczWRkBHucapb2wayBOuBizs2EuWRRrFu/aTfLb3IzS3/s76QCrljqvAuw+se/GY1w0PRdMdndlx0S0hK+V7txeovUUB+ukWiVaqn1v8TUrjMWPT6i75cuoz6uVhEnsl0AYKfy+qacmYz1sHQ9xcUI3w8KEBs+c+7aEnrH0+qBrwGQ7b5jECdUlc0PpWWqoKZ5il7pDJE3EP1o3KWuZ9cGr18MkSvhyGc1tqJoEx7VySEvUx9esOg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd4e4793-e450-4eca-2a10-08d781fc8893 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Dec 2019 07:49:51.7922 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OXahSpxBJWF9U6S+APTnD+2GK61vcNMoTerMIslCKi5tYOF/vc7nbtqmC7IyF6RBshDC/hc++IdjDjrPUlkntw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3218 Subject: Re: [dpdk-dev] [RFC v3 1/2] ethdev: add IPv4/IPv6 DSCP rewrite action 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Suanming Mou > Sent: Monday, December 16, 2019 5:42 AM > To: Adrien Mazarguil ; Wenzhuo Lu > ; Jingjing Wu ; Bernard > Iremonger ; John McNamara > ; Marko Kovacevic > ; Thomas Monjalon ; > Ferruh Yigit ; Andrew Rybchenko > > Cc: dev@dpdk.org; Shahaf Shuler ; Ori Kam > ; Matan Azrad ; Slava > Ovsiienko > Subject: [RFC v3 1/2] ethdev: add IPv4/IPv6 DSCP rewrite action >=20 > For some overlay network, such as VXLAN, the DSCP field in the new outer > IP header after VXLAN decapsulation may need to be updated accordingly. >=20 > This commit introduce the DSCP modify action for IPv4 and IPv6. >=20 > Signed-off-by: Suanming Mou > Acked-by: Andrew Rybchenko > --- >=20 > v3: > * Add testpmd code. > * Add one more commit support action in mlx5 pmd code. >=20 > v2: > * Add space to IPv4/6 DSCP. > * Fix typo. >=20 > --- Acked-by: Ori Kam Best, Ori > app/test-pmd/cmdline_flow.c | 50 > +++++++++++++++++++++++++++++ > doc/guides/prog_guide/rte_flow.rst | 40 +++++++++++++++++++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++++ > lib/librte_ethdev/rte_flow.c | 2 ++ > lib/librte_ethdev/rte_flow.h | 31 ++++++++++++++++++ > 5 files changed, 131 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 99dade7..af94dbe 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -326,6 +326,10 @@ enum index { > ACTION_SET_META, > ACTION_SET_META_DATA, > ACTION_SET_META_MASK, > + ACTION_SET_IPV4_DSCP, > + ACTION_SET_IPV4_DSCP_VALUE, > + ACTION_SET_IPV6_DSCP, > + ACTION_SET_IPV6_DSCP_VALUE, > }; >=20 > /** Maximum size for pattern in struct rte_flow_item_raw. */ > @@ -1087,6 +1091,8 @@ struct parse_action_priv { > ACTION_RAW_DECAP, > ACTION_SET_TAG, > ACTION_SET_META, > + ACTION_SET_IPV4_DSCP, > + ACTION_SET_IPV6_DSCP, > ZERO, > }; >=20 > @@ -1300,6 +1306,18 @@ struct parse_action_priv { > ZERO, > }; >=20 > +static const enum index action_set_ipv4_dscp[] =3D { > + ACTION_SET_IPV4_DSCP_VALUE, > + ACTION_NEXT, > + ZERO, > +}; > + > +static const enum index action_set_ipv6_dscp[] =3D { > + ACTION_SET_IPV6_DSCP_VALUE, > + ACTION_NEXT, > + ZERO, > +}; > + > static int parse_set_raw_encap_decap(struct context *, const struct toke= n > *, > const char *, unsigned int, > void *, unsigned int); > @@ -3493,6 +3511,38 @@ static int comp_set_raw_index(struct context *, > const struct token *, > (struct rte_flow_action_set_meta, mask)), > .call =3D parse_vc_conf, > }, > + [ACTION_SET_IPV4_DSCP] =3D { > + .name =3D "set_ipv4_dscp", > + .help =3D "set dscp value", > + .priv =3D PRIV_ACTION(SET_IPV4_DSCP, > + sizeof(struct rte_flow_action_set_dscp)), > + .next =3D NEXT(action_set_ipv4_dscp), > + .call =3D parse_vc, > + }, > + [ACTION_SET_IPV4_DSCP_VALUE] =3D { > + .name =3D "dscp_value", > + .help =3D "new IPv4 DSCP value to set", > + .next =3D NEXT(action_set_ipv4_dscp, > NEXT_ENTRY(UNSIGNED)), > + .args =3D ARGS(ARGS_ENTRY > + (struct rte_flow_action_set_dscp, dscp)), > + .call =3D parse_vc_conf, > + }, > + [ACTION_SET_IPV6_DSCP] =3D { > + .name =3D "set_ipv6_dscp", > + .help =3D "set DSCP value", > + .priv =3D PRIV_ACTION(SET_IPV6_DSCP, > + sizeof(struct rte_flow_action_set_dscp)), > + .next =3D NEXT(action_set_ipv6_dscp), > + .call =3D parse_vc, > + }, > + [ACTION_SET_IPV6_DSCP_VALUE] =3D { > + .name =3D "dscp_value", > + .help =3D "new IPv6 DSCP value to set", > + .next =3D NEXT(action_set_ipv6_dscp, > NEXT_ENTRY(UNSIGNED)), > + .args =3D ARGS(ARGS_ENTRY > + (struct rte_flow_action_set_dscp, dscp)), > + .call =3D parse_vc_conf, > + }, > }; >=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 a254c81..2f21309 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -2558,6 +2558,46 @@ the other path depending on HW capability. > | ``mask`` | bit-mask applies to "data" | > +----------+----------------------------+ >=20 > +Action: ``SET_IPV4_DSCP`` > +^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set IPv4 DSCP. > + > +Modify DSCP in IPv4 header. > + > +It must be used with RTE_FLOW_ITEM_TYPE_IPV4 in pattern. > +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_ipv4_dscp: > + > +.. table:: SET_IPV4_DSCP > + > + +-----------+---------------------------------+ > + | 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+ > + | ``dscp`` | DSCP in low 6 bits, rest ignore | > + +-----------+---------------------------------+ > + > +Action: ``SET_IPV6_DSCP`` > +^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set IPv6 DSCP. > + > +Modify DSCP in IPv6 header. > + > +It must be used with RTE_FLOW_ITEM_TYPE_IPV6 in pattern. > +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_ipv6_dscp: > + > +.. table:: SET_IPV6_DSCP > + > + +-----------+---------------------------------+ > + | 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+ > + | ``dscp`` | DSCP in low 6 bits, rest ignore | > + +-----------+---------------------------------+ > + > Negative types > ~~~~~~~~~~~~~~ >=20 > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 10aabf5..3baaacb 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -4228,6 +4228,14 @@ This section lists supported actions and their > attributes, if any. >=20 > - ``value {unsigned}``: Value to decrease TCP acknowledgment number by= . >=20 > +- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value > + > + - ``dscp_value {unsigned}``: The new DSCP value to be set > + > +- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value > + > + - ``dscp_value {unsigned}``: The new DSCP value to be set > + > Destroying flow rules > ~~~~~~~~~~~~~~~~~~~~~ >=20 > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index 87a3e8c..b86aee3 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -168,6 +168,8 @@ struct rte_flow_desc_data { > MK_FLOW_ACTION(DEC_TCP_ACK, sizeof(rte_be32_t)), > MK_FLOW_ACTION(SET_TAG, sizeof(struct > rte_flow_action_set_tag)), > MK_FLOW_ACTION(SET_META, sizeof(struct > rte_flow_action_set_meta)), > + MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct > rte_flow_action_set_dscp)), > + MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct > rte_flow_action_set_dscp)), > }; >=20 > int > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index 452d359..76bf080 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -2004,6 +2004,26 @@ enum rte_flow_action_type { > * See struct rte_flow_action_set_meta. > */ > RTE_FLOW_ACTION_TYPE_SET_META, > + > + /** > + * Modify IPv4 DSCP in the outermost IP header. > + * > + * If flow pattern does not define a valid > RTE_FLOW_ITEM_TYPE_IPV4, > + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION > error. > + * > + * See struct rte_flow_action_set_dscp. > + */ > + RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP, > + > + /** > + * Modify IPv6 DSCP in the outermost IP header. > + * > + * If flow pattern does not define a valid > RTE_FLOW_ITEM_TYPE_IPV6, > + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION > error. > + * > + * See struct rte_flow_action_set_dscp. > + */ > + RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP, > }; >=20 > /** > @@ -2530,6 +2550,17 @@ struct rte_flow_action_set_meta { > uint32_t mask; > }; >=20 > +/** > + * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP > + * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP > + * > + * Set the DSCP value for IPv4/IPv6 header. > + * DSCP in low 6 bits, rest ignored. > + */ > +struct rte_flow_action_set_dscp { > + uint8_t dscp; > +}; > + > /* Mbuf dynamic field offset for metadata. */ > extern int rte_flow_dynf_metadata_offs; >=20 > -- > 1.8.3.1