From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7DBA7A034F; Tue, 1 Mar 2022 11:49:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 419CD40DF6; Tue, 1 Mar 2022 11:49:15 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 62F53407FF for ; Tue, 1 Mar 2022 11:49:13 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2218xRcA005969; Tue, 1 Mar 2022 02:49:09 -0800 Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2046.outbound.protection.outlook.com [104.47.74.46]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ehgf40h4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Mar 2022 02:49:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=haxnmMwvIvvW6JRvIn7Q8twMMav0BVU//ANFgtKLkCK5NWl1S/htOdx5HKZchEJ78V/qMnZZjkAY7TpdiMj4q9GqwIG0MnxvsV2s2g49UgkYdbPSiEnHoeA05Ch7yleqWvthI+IQQBzdAetuc6jUH6M1OZUbyhpZ7lHx8DYOzS7uS+tBNJU3QHcqYsVZL7GOquwxeG8lcjsOaDQMcrGxWyeEzjVKXVjuphg3x607rvx/8AY5x4X06IjGW77tMVfpF/Wr7pryWAAkgn1awRzLpYwoq4ZvuZ/8FXHi1DO84ckFD/VCXS3/ZGvfEZCwnU13/CBCGF0oyOEuz4Zj2R3xaQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NV91uVNxSy3jX6GgWxtk/li/i1etbaBUkPJdclYMc44=; b=ic+zHQ7LZ2UivR+sM3lqXDva9u1SV5qtVra80dsTJqkH6syIFPpW3D9WQVF8DrzUOg/UwtPA8wAVB2wzVYAMN+ogeHm1HRn+A22MYbxFvmd8YxZDZihDXyqV8I7nasGoGSHibqA2Hti3J1O+ez8aWTAf5X8qjLy8mIlzHvNVQrAmnT3zHJWSR4wMK4JZpyqHqsejZbkvJDeqqIIwaxKKbyfoRZY70uFpj/du2AMtSzaaucBWcj9UvW9Pm4cCiqwW9NOFuOXDzgm9ckC/sQWYqKv30ItzoAHDpduZQeyJVBTkWYL7XgghIJp3M9Qj1/CDH29vyHoH19T/E8XSycLevg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NV91uVNxSy3jX6GgWxtk/li/i1etbaBUkPJdclYMc44=; b=NgKjiDxhFGcQXIIzQqq1Y9L+MTvxnHOVDXoDzK7FVrcvUVluavZP21O93bgisK6TbNA1oJ0Sl+CdTUWKvyQyt2LhWuC+PGItm2m8HWS1cAqiS/cq4wyW+G3WNE1W6eHsfdvwp+FwrgIH9KNXqE18+k8sOvZ1BtOUh8hPgYrGcdU= Received: from CO6PR18MB3860.namprd18.prod.outlook.com (2603:10b6:5:34d::12) by BN6PR1801MB1987.namprd18.prod.outlook.com (2603:10b6:405:6b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24; Tue, 1 Mar 2022 10:49:05 +0000 Received: from CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::8552:b31f:8358:7805]) by CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::8552:b31f:8358:7805%6]) with mapi id 15.20.5038.014; Tue, 1 Mar 2022 10:49:05 +0000 From: Sunil Kumar Kori To: Sunil Kumar Kori , Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ray Kinsella CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran Subject: RE: [EXT] [PATCH v3 1/1] ethdev: mtr: support input color selection Thread-Topic: [EXT] [PATCH v3 1/1] ethdev: mtr: support input color selection Thread-Index: AQHYLUqQeOp0+GsuHU2wzu87qPziY6yqWHmw Date: Tue, 1 Mar 2022 10:49:05 +0000 Message-ID: References: <20220214120246.4181470-1-jerinj@marvell.com> <20220301085824.1041009-1-skori@marvell.com> In-Reply-To: <20220301085824.1041009-1-skori@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 971deffb-dfd9-4f9d-31db-08d9fb711b3b x-ms-traffictypediagnostic: BN6PR1801MB1987:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8OFdRfrL7sENwBJ7gx5rX0Rs1r9O56RQw3FV5GZIWEIAsaLhEvy1I/bedqpAK0KffD69aJ7zlOyj/g1byftwqTKI+FEo9ojDBxEghJx/dI+6hxGR3i+hyb7s9OXLbfvHeNWCYLItFjm0y3VLylk0aP3zAYEjc8xPsxfS5FTmKqiGvoc2XXk6czGLyCgrTwibZWA4TDxu90B3HHKhmJ0skDbIQSkmi4X3bfgMQ6KlWaNDVCPb7yQ3GxHFT2nCVaPozZ1uxDBgnJ9uE67d9AdJuVH+NIAiDe4C1YQCnnUmmy0Up/GFWT5ewZB4C0C2xx+S5De4Vz/Cp9Vq3QC1ZSkIS+sC+uV+xYlCuFn8T7WcIgFDAeAldOQ4e+pPqAqHzPjyqKx6Zkg1k8eT+u9fHrWu8Uov1WsO6j3V+atLBnRusTeCTaNArxovdKc42ZDO8tK62T0RgoXXGag1vHz+UL9OVb/ilTdWcBRUT5bXU4mUslQ7xHh9yh6ZfZsKU5VVfSZ4vsTzk6Scm7wu1GXcwIKl6VHzHrUMJ1d6bJFdFs08yQxW4APsjdcA0U/QWKus1qlhQ9vY7G51i3b6A+vEwWtWSYrRoLalM7n/BdHq3/OG7EbqJZt54574NbLEfw8BefcINRYq3QeMNBfFQY6vIcaaQ7KSE7OQgyT+YT7vCB39kNpgty4zpPsCOP6QHoUg4j6zIeK1jAZmdyZ45NKwXHbsQ1XBB27tBk61qnWHHcY8EoeGLFvgbDsYAOxcpA5u9xBdkKii73Bpfl4WnowRhD1wt5jiJgR3rRuiPt0J2O32QltnoRULht2l2eeYwXWC4iyklysnd9nDWOmsjlJNhMMciA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB3860.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(7696005)(55016003)(316002)(6506007)(30864003)(64756008)(19627235002)(71200400001)(52536014)(53546011)(8936002)(110136005)(54906003)(86362001)(83380400001)(66446008)(66556008)(66476007)(107886003)(66946007)(8676002)(33656002)(9686003)(38070700005)(122000001)(2906002)(508600001)(966005)(76116006)(26005)(186003)(5660300002)(4326008)(38100700002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?abKOf+F+cGyHPY1t2y19hUfA+KeFwYK5tREiI03fh4NgsKuNpi+iLOFreZEb?= =?us-ascii?Q?5NoIOD0wbEW18gR2ubYvuxHgJFaMhuIDa0i2F5pY00xU5RW+SQGCFDmTzEvf?= =?us-ascii?Q?7Gnk6TPhAAidTfhBs77Qrlr/T4GfNKVYsjL21jkvXSoRaqn4nScghFh+kKME?= =?us-ascii?Q?e+MeuI/0Fmt52VNlNj6KPimHl4HqYYTcFIc5GW+tbmSojuGRb9SlKMP+gXe2?= =?us-ascii?Q?v2jkYECEqMuyC1xrJZX+CD6bPpQVlejFXLL5eTW48rdL26onJuuHCITnLIwl?= =?us-ascii?Q?q6lkEv+Ca9roXMQ9oFFpl+HCQZJxNSgl0YA8/ss69MhDymHmMfGd0fNEvSb0?= =?us-ascii?Q?POtxknDj7Z2Arch0tUEJ4qF7AjqVN7o8VLdA5esYVa0j+vUOcICWCDNYOQuq?= =?us-ascii?Q?sZRa8pIsLfWUHwLMzfuofLMENoVUci+jOtzo4zDO065YopUsmQK7eDcH23GO?= =?us-ascii?Q?sZpcaVRP/15VkcGmOou01xOzLNgPFG4wFFg/E/AixjrfT8IDTnfqHC0wWo7I?= =?us-ascii?Q?Us1bq115rDTZz4jCWFVJHJ8zQ6UCBZZQ6snxHQe0glt0XzsKnJvEYSWhYH1r?= =?us-ascii?Q?F16UvgdogWWJmWHz8MQQXY5oXkRK0LgnPg9qhxe3MPIPF+NfUbtFk2xV1h9C?= =?us-ascii?Q?8esKDzAvAdO7kHA60O7kfpUoP3wATMm068szJvjZl7/1eTrQ8c/QCSHmq7+f?= =?us-ascii?Q?haX+m6KEgdFf2j6iJqQcpF3Fljpm0Rzy94dpwoQrVY7XrSej2FjY4RNFjnP8?= =?us-ascii?Q?dj55BdiN8f+LcFrNTZK/9NECg/+nys8zTdSpEKhIkizgow9IvZzqKoKZgNRl?= =?us-ascii?Q?9cUwPZVpMJS8hiirZVkN1SX+mG+5iiNOlcSTjJsO85K3j0q7CAnESnu7dKKf?= =?us-ascii?Q?3KVnGRK/QgquyX6ARczrtxobo2cg0o/lISR1X5FnrHFNQg6aBuyelEacCWoJ?= =?us-ascii?Q?DNsJ8WqUa605Buqe3YJe2wby2NAwcQtVE/PpYlbTF4D+JrZVjV8Uh0Tgh1Gz?= =?us-ascii?Q?H3f7mqDox3ocxrnm6v9HxNGPPvCbZdYKmf3OztkbsdaNlCUfc+390vWkkpI7?= =?us-ascii?Q?O2UEf4IUbBLJKiad1xTsU+X/AANHkR2hlcHp0uGkDaxlNOodEwFK9x+251Qx?= =?us-ascii?Q?x5U8/Qx9D/8EyXEskPhT3EbeIaSgyuGPmhud13+JGEPKOsCc8dWvCjSMS4/e?= =?us-ascii?Q?ZRlXydFsPFL2pjt90DLWazDWqlJD8Xvze5DO0E45HcnWbh98IdlgBpfJngQI?= =?us-ascii?Q?9ds4vkbQjb5Tp35+M4k9G6faxZ9TBZQaOe173QODAUougaP4KsIPsHlCCC6+?= =?us-ascii?Q?dO1l60TbYrVLGGLx8X9nNTjn0gFhPOU/pv3mhnHNdXdAx4Z8qY+cY3u1Sn3M?= =?us-ascii?Q?mjMba1POqp5IWZ1BuWdwNX5I9yPBWv+beqvQiEXU3lfkQGQ5Vac7dxwr8sGe?= =?us-ascii?Q?0fnANPSVBWmr/CM55effjYldJaoXnUgOqU4i8MVC1gTcI0v84uXfCfrxGqfR?= =?us-ascii?Q?wDVvr1mFmywHmF6CfOA/Zr4Y6P7qOo7Yq+x8HoQ4dfeMnRxzOmqpDkwvcOxb?= =?us-ascii?Q?mlaudcsIaLWbQv3+sqpSd1G+DlohGsaulOKNQblRH5bjGOs1Fk8e2o40Tnrz?= =?us-ascii?Q?ag=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB3860.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 971deffb-dfd9-4f9d-31db-08d9fb711b3b X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2022 10:49:05.4814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: kwscf+uGRBMdedNxJApyFpUdjrNJ+XMGh0zWaCFQQG7ft6i5hHPh0kfomNgfUexz4xtuHbEVQnSah4sdLRUxiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1801MB1987 X-Proofpoint-GUID: upS9Cc-FpLwtSQTazGRZYK5eL9ue-ov5 X-Proofpoint-ORIG-GUID: upS9Cc-FpLwtSQTazGRZYK5eL9ue-ov5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-02-28_10,2022-02-26_01,2022-02-23_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Corresponding driver implementation is available at http://patches.dpdk.org= /project/dpdk/patch/20220301090056.1042866-1-skori@marvell.com/. Also CLI is added to testpmd for below API and available at http://patches.= dpdk.org/project/dpdk/patch/20220301090056.1042866-3-skori@marvell.com/=20 > -----Original Message----- > From: skori@marvell.com > Sent: Tuesday, March 1, 2022 2:28 PM > To: Cristian Dumitrescu ; Thomas Monjalon > ; Ferruh Yigit ; Andrew > Rybchenko ; Ray Kinsella > > Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran > Subject: [EXT] [PATCH v3 1/1] ethdev: mtr: support input color selection >=20 > External Email >=20 > ---------------------------------------------------------------------- > From: Jerin Jacob >=20 > Currently, meter object supports only DSCP based on input color table, Th= e > patch enhance that to support VLAN based input color table, color table > based on inner field for the tunnel use case, and support for fallback co= lor > per meter if packet based on a different field. >=20 > All of the above features are exposed through capability and added > additional capability to specify the implementation supports more than on= e > input color table per ethdev port >=20 > Suggested-by: Cristian Dumitrescu > Signed-off-by: Jerin Jacob > --- > v3..v2: > - Fix input color flags as a bitmask > - Add definitions for newly added API >=20 > v2..v1: >=20 > - Fix seperate typo >=20 > v1..RFC: >=20 > Address the review comments by Cristian at > https://urldefense.proofpoint.com/v2/url?u=3Dhttps- > 3A__patches.dpdk.org_project_dpdk_patch_20210820082401.3778736-2D1- > 2Djerinj- > 40marvell.com_&d=3DDwIDAg&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DdXeXaAMkP5 > COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=3DbvYbz6aP4xuLPRt2TIk1o99kWXj > u-rRDvz3qXnCVbz_TER0zcRDqjQxJSm3SnLXM&s=3DmVeBbQWjsvJLRm-dcB4h- > KmAj3tGi4WT0E9IvsuNT2g&e=3D >=20 > - Moved to v22.07 release > - Updated rte_mtr_input_color_method to support all VLAN, DSCP, Inner > cases > - Added input_color_method > - Removed union between vlan_table and dscp_table > - Kept VLAN instead of PCP as HW coloring based on DEI(1bit), PCP(3 bits) >=20 > What is missing: > - 22.07 release notes update >=20 > .../traffic_metering_and_policing.rst | 28 +++ > lib/ethdev/rte_mtr.c | 12 ++ > lib/ethdev/rte_mtr.h | 164 +++++++++++++++++- > lib/ethdev/rte_mtr_driver.h | 9 + > lib/ethdev/version.map | 3 + > 5 files changed, 214 insertions(+), 2 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst > b/doc/guides/prog_guide/traffic_metering_and_policing.rst > index ceb5a96488..59ebd361ba 100644 > --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst > +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst > @@ -21,6 +21,7 @@ The main features are: > * Policer actions (per meter output color): recolor, drop > * Statistics (per policer output color) > * Chaining multiple meter objects > +* Packet content based input color selection >=20 > Configuration steps > ------------------- > @@ -105,3 +106,30 @@ traffic meter and policing library. > * Adding one (or multiple) actions of the type > ``RTE_FLOW_ACTION_TYPE_METER`` > to the list of meter actions (``struct > rte_mtr_meter_policy_params::actions``) > specified per color as show in :numref:`figure_rte_mtr_chaining`. > + > +Packet content based input color selection > +------------------------------------------ > + > +The API supports selecting the input color based on the packet content. > +Following is the API usage model for the same. > + > +#. Probe the input color selection device capabilities using following > + parameter using ``rte_mtr_capabilities_get()`` API > + ``struct rte_mtr_capabilities::methods_mask`` and > + ``struct rte_mtr_capabilitie::separate_input_color_table_per_port`` > + > +#. When creating the meter object using ``rte_mtr_create()``, configure > + relevant input color selection parameters such as > + > + * Select the input color method ``struct > + rte_mtr_params::input_color_method`` > + > + * Fill the tables ``struct rte_mtr_params::dscp_table``, > + ``struct rte_mtr_params::dscp_table`` based on input color > + selected > + > + * Update the ``struct rte_mtr_params::default_input_color`` to determ= ine > + the default input color in case the input packet does not match > + the input color method > + > + * If needed, update the input color table at runtime using > + ``rte_mtr_meter_vlan_table_update()`` and > ``rte_mtr_meter_dscp_table_update()`` > + APIs. > diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c index > e49fcf271c..a0cb91e0b1 100644 > --- a/lib/ethdev/rte_mtr.c > +++ b/lib/ethdev/rte_mtr.c > @@ -207,6 +207,18 @@ rte_mtr_meter_dscp_table_update(uint16_t > port_id, > mtr_id, dscp_table, error); > } >=20 > +/** MTR object meter VLAN table update */ int > +rte_mtr_meter_vlan_table_update(uint16_t port_id, > + uint32_t mtr_id, > + enum rte_color *vlan_table, > + struct rte_mtr_error *error) > +{ > + struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > + return RTE_MTR_FUNC(port_id, meter_vlan_table_update)(dev, > + mtr_id, vlan_table, error); > +} > + > /** MTR object enabled stats update */ > int > rte_mtr_stats_update(uint16_t port_id, > diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index > 40df0888c8..7f9abebb41 100644 > --- a/lib/ethdev/rte_mtr.h > +++ b/lib/ethdev/rte_mtr.h > @@ -213,6 +213,80 @@ struct rte_mtr_meter_policy_params { > const struct rte_flow_action *actions[RTE_COLORS]; }; >=20 > +/** > + * Input color method > + */ > +enum rte_mtr_input_color_method { > + /** > + * The input color is always green. > + * The default_input_color is ignored for this method. > + * @see struct rte_mtr_params::default_input_color > + */ > + RTE_MTR_INPUT_COLOR_METHOD_COLOR_BLIND =3D RTE_BIT64(0), > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the outermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_VLAN =3D RTE_BIT64(1), > + /** > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the outermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_DSCP =3D RTE_BIT64(2), > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the outermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the outermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_VLAN_DSCP =3D RTE_BIT64(3), > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the innermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN =3D RTE_BIT64(4), > + /** > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the innermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_INNER_DSCP =3D RTE_BIT64(5), > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the innermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the innermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN_DSCP =3D > RTE_BIT64(6), }; > + > /** > * Parameters for each traffic metering & policing object > * > @@ -233,7 +307,15 @@ struct rte_mtr_params { > */ > int use_prev_mtr_color; >=20 > - /** Meter input color. When non-NULL: it points to a pre-allocated > and > + /** Meter input color based on IP DSCP field. > + * > + * Valid when input_color_method set to any of the following > + * RTE_MTR_INPUT_COLOR_METHOD_DSCP, > + * RTE_MTR_INPUT_COLOR_METHOD_VLAN_DSCP, > + * RTE_MTR_INPUT_COLOR_METHOD_INNER_DSCP, > + * RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN_DSCP > + * > + * When non-NULL: it points to a pre-allocated and > * pre-populated table with exactly 64 elements providing the input > * color for each value of the IPv4/IPv6 Differentiated Services Code > * Point (DSCP) input packet field. When NULL: it is equivalent to @@ > -244,9 +326,39 @@ struct rte_mtr_params { > * *use_prev_mtr_color* is non-zero value or when *dscp_table* > contains > * at least one yellow or red color element, then the color aware > mode > * is configured. > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_DSCP > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_VLAN_DS > CP > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_INNER_D > SCP > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_INNER_VL > AN_DSCP > + * @see struct rte_mtr_params::input_color_method > */ > enum rte_color *dscp_table; > - > + /** Meter input color based on VLAN DEI(1bit), PCP(3 bits) fields. > + * > + * Valid when input_color_method set to any of the following > + * RTE_MTR_INPUT_COLOR_METHOD_VLAN, > + * RTE_MTR_INPUT_COLOR_METHOD_VLAN_DSCP, > + * RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN, > + * RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN_DSCP > + * > + * When non-NULL: it points to a pre-allocated and pre-populated > + * table with exactly 16 elements providing the input color for > + * each value of the DEI(1bit), PCP(3 bits) input packet field. > + * When NULL: it is equivalent to setting this parameter to an > + * all-green populated table (i.e. table with > + * all the 16 elements set to green color). The color blind mode > + * is configured by setting *use_prev_mtr_color* to 0 and > + * *vlan_table* to either NULL or to an all-green > + * populated table. When *use_prev_mtr_color* is non-zero value > + * or when *vlan_table* contains at least one yellow or > + * red color element, then the color aware mode is configured. > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_VLAN > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_VLAN_DS > CP > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_INNER_VL > AN > + * @see enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_INNER_VL > AN_DSCP > + * @see struct rte_mtr_params::input_color_method > + */ > + enum rte_color *vlan_table; > /** Non-zero to enable the meter, zero to disable the meter at the > time > * of MTR object creation. Ignored when the meter profile indicated > by > * *meter_profile_id* is set to NONE. > @@ -261,6 +373,20 @@ struct rte_mtr_params { >=20 > /** Meter policy ID. @see rte_mtr_meter_policy_add() */ > uint32_t meter_policy_id; > + > + /** Input color method to select. > + * @see struct rte_mtr_params::dscp_table > + * @see struct rte_mtr_params::vlan_table > + */ > + enum rte_mtr_input_color_method input_color_method; > + > + /** Input color to be set for the input packet when none of the > + * enabled input color methods is applicable to the input packet. > + * Ignored when this method is set to the > + * enum > rte_mtr_input_color_method::RTE_MTR_INPUT_COLOR_METHOD_COLOR_B > LIND > + * method. > + */ > + enum rte_color default_input_color; > }; >=20 > /** > @@ -417,6 +543,16 @@ struct rte_mtr_capabilities { > * @see enum rte_mtr_stats_type > */ > uint64_t stats_mask; > + > + /** Set of supported input color methods. > + * @see enum rte_mtr_input_color_method > + */ > + uint64_t methods_mask; > + > + /** When non-zero, it indicates that driver supports separate > + * input color table for given ethdev port. > + */ > + int separate_input_color_table_per_port; > }; >=20 > /** > @@ -832,6 +968,30 @@ rte_mtr_meter_dscp_table_update(uint16_t > port_id, > enum rte_color *dscp_table, > struct rte_mtr_error *error); >=20 > +/** > + * MTR object VLAN table update > + * > + * @param[in] port_id > + * The port identifier of the Ethernet device. > + * @param[in] mtr_id > + * MTR object ID. Needs to be valid. > + * @param[in] vlan_table > + * When non-NULL: it points to a pre-allocated and pre-populated table > with > + * exactly 16 elements providing the input color for each value of the > + * each value of the DEI(1bit), PCP(3 bits) input packet field. > + * When NULL: it is equivalent to setting this parameter to an "all-gr= een" > + * populated table (i.e. table with all the 16 elements set to green c= olor). > + * @param[out] error > + * Error details. Filled in only on error, when not NULL. > + * @return > + * 0 on success, non-zero error code otherwise. > + */ > +__rte_experimental > +int > +rte_mtr_meter_vlan_table_update(uint16_t port_id, > + uint32_t mtr_id, > + enum rte_color *vlan_table, > + struct rte_mtr_error *error); > /** > * MTR object enabled statistics counters update > * > diff --git a/lib/ethdev/rte_mtr_driver.h b/lib/ethdev/rte_mtr_driver.h in= dex > ee8c6ef7ad..37ab79666b 100644 > --- a/lib/ethdev/rte_mtr_driver.h > +++ b/lib/ethdev/rte_mtr_driver.h > @@ -97,6 +97,12 @@ typedef int > (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev, > enum rte_color *dscp_table, > struct rte_mtr_error *error); >=20 > +/** @internal MTR object meter VLAN table update. */ typedef int > +(*rte_mtr_meter_vlan_table_update_t)(struct rte_eth_dev *dev, > + uint32_t mtr_id, > + enum rte_color *vlan_table, > + struct rte_mtr_error *error); > + > /** @internal MTR object enabled stats update. */ typedef int > (*rte_mtr_stats_update_t)(struct rte_eth_dev *dev, > uint32_t mtr_id, > @@ -139,6 +145,9 @@ struct rte_mtr_ops { > /** MTR object meter DSCP table update */ > rte_mtr_meter_dscp_table_update_t meter_dscp_table_update; >=20 > + /** MTR object meter VLAN table update */ > + rte_mtr_meter_vlan_table_update_t meter_vlan_table_update; > + > /** MTR object enabled stats update */ > rte_mtr_stats_update_t stats_update; >=20 > diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index > 20391ab29e..77915c0ddc 100644 > --- a/lib/ethdev/version.map > +++ b/lib/ethdev/version.map > @@ -279,6 +279,9 @@ EXPERIMENTAL { > rte_flow_async_action_handle_create; > rte_flow_async_action_handle_destroy; > rte_flow_async_action_handle_update; > + > + # added in 22.07 > + rte_mtr_meter_vlan_table_update; > }; >=20 > INTERNAL { > -- > 2.25.1