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 B5CB0A00C2; Thu, 21 Jul 2022 09:32:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56EBB40A87; Thu, 21 Jul 2022 09:32:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0322040A7A for ; Thu, 21 Jul 2022 09:32:07 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26L76N3C003324; Thu, 21 Jul 2022 00:32:07 -0700 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3hf24482m4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Jul 2022 00:32:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCJuMuennUq90gLpWDMWXILnzSrKOJbXVaVtSCZDN/g7vmrsFieff1f6hJdwwBtJdhMWUchp/BmVZFW/MuSx/3YgI6UyE7jzJNpXDDLRSMJZwLloGsv+q0F6NiatxANJK12sGYuOGQgT5zNfLFfeF3pegrTmRHYSUpdZkssQgs0hjgsrhKQoGOFWrBYa8hmyUhGMb/YSybaQ8AOHHubAWD83jH3jMLXDZ1KkPMxBUysE1uYOSqvCOWmr8AklYbYXjQlAu4yk0xGtjkqD7k9gh1rWkXJ+HNOsoWLOpJBJnMguu4IaXwGiz0d/oIdY8dz924iZHQEJBESbf1MgkuIOag== 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=NntVfGTB8CMWOJaUT7Li6h2ZO9IPKp/DIp7L0X5aNHQ=; b=PI17UJBjkafDoO8POt7D7aW1qLK+vdjNAuew/gEyXI0LyuoINvEVEK1wPx4NBPzr7QCe7fRgamXQutuVhGQGDda/LfLrJkTE5hHsvDfqP70HGfVFk4twj6zKuuiUMuVmWrQ43d3+q3aAmUVmwhcY4k+KPfJFZKHLb0nA3OKNGdcmSLKnPtkGNVBRWN/RCyBG5W6dGprcnHHPUQWm1ZYj8bLwFRLGmTSuNIrZG3skdJf6KlCbntS4yglkcDEaW2S61fTSiah1NHnPPOutNW3JR46Iwi/0crv9KGz6a2TL8UOi1794ffsiWi9fWm2StbaRaa1K0y57dfyu0OG6PAL9kA== 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=NntVfGTB8CMWOJaUT7Li6h2ZO9IPKp/DIp7L0X5aNHQ=; b=uu5WwsSLRz7EOJaDhinMy50gloSLH7EpEmFCPcfsM08AFPkxhWjjKk1teYaiFusvsSvQsaDE292Skn7gVCeHhAF2jUSEvXqgaRehBduHnuGvnwf/kdmOeB/5ACR5zuBjLkt40N0atYLis57zxgrLwCJs9mF7NhjIdxO11+5ln8k= Received: from CO6PR18MB3860.namprd18.prod.outlook.com (2603:10b6:5:34d::12) by PH0PR18MB4589.namprd18.prod.outlook.com (2603:10b6:510:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Thu, 21 Jul 2022 07:32:04 +0000 Received: from CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::f5e4:a8db:557d:8c07]) by CO6PR18MB3860.namprd18.prod.outlook.com ([fe80::f5e4:a8db:557d:8c07%6]) with mapi id 15.20.5458.019; Thu, 21 Jul 2022 07:32:03 +0000 From: Sunil Kumar Kori To: Sunil Kumar Kori , Cristian Dumitrescu , Aman Singh , Yuying Zhang , Nithin Kumar Dabilpuram , Kiran Kumar Kokkilagadda , Satha Koteswara Rao Kottidi , Jasvinder Singh , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Subject: RE: [PATCH] ethdev: add protocol param to color table update Thread-Topic: [PATCH] ethdev: add protocol param to color table update Thread-Index: AQHYkc7k1cekBTqWgUC46rfd21q1yK2IhCQQ Date: Thu, 21 Jul 2022 07:32:03 +0000 Message-ID: References: <20220707065743.76932-1-skori@marvell.com> In-Reply-To: <20220707065743.76932-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: b75af9e5-b858-4642-9397-08da6aeb1b80 x-ms-traffictypediagnostic: PH0PR18MB4589:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: O1JIIc3qOoibfvZHXjnxycoq5skF3dNBncd1gIeLgTUR2jWrTgX30SOkUOyNDa6MA0hAg/qzFxFB7+TYD+9Q67yDGkurfcIxhJ3DwMuQSjh9Pbbi6T1XAhbhMdx8JvIfNXymzpGbfTdMJr+U+aifzLlMxBXHjIMcrxSL2mkc7p8MsZfcw6aSifonYTndkX/5y1qFHsDEmA96VG/kNwg0PgdS46aZ0DPdQX1a9TF2sWkMJf5g5l/e7P7zkXgxHEm3LEPLRbtoAZgiXxtzHBLY+Qf6v0byC/xvJg3vL52WnvyOOoZTbxGleMFaTxAMXiuO3ogBPhlMjUWUaR9b2ItRwQBAmM+qicS1usb4YR4stZrR4BvD0XBoRxu0QVMqBWf3p0VWSfHUQPcXkqsq0e+l3UH+s9TVAjbgvAgDbYA9OlzL4c6pTABiXcXMJSjcCxwdmpKwt1OSwEUFKEmylS8Uw8njVzr8W0wDkjhGp7sCB+DSX9zI0lwxDCcrVZo7x1rtIZpijjdALYak/K61JF9FTDdPLLDYmsDmMwpDHZGgl2Cb6GnocbmAabXVpEsvV5mwflDnuw8MLoV9vxSw2dfgR+fn1wdpBmeiLvrlAmkzKn+O7Cxdbzb89kFbPl1K2q8ut7KxwbfgY/MdcSsdCxFN1/CLO9JKv7ZwarTkz+glr8sGa2X22rknc0SnXJs1XnTi9sTO3ErWbyezcUOlvSjmZA8IEM9ZEtyzRQ4ghjGoSTlSgURRPPTdKrm/au+DkjaI5NSgr2cT0w4UzAYw6ptAxuSIiV4jcWqjz5sefnI+p5F4uDiCn6BKbzC1pTWUH1/T0R2tKNVkSJ5gsRZPNLggiw== 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:(13230016)(4636009)(396003)(376002)(366004)(136003)(39860400002)(346002)(41300700001)(26005)(9686003)(478600001)(7696005)(53546011)(86362001)(55016003)(6506007)(122000001)(38100700002)(52536014)(2906002)(71200400001)(921005)(15650500001)(5660300002)(30864003)(38070700005)(110136005)(64756008)(8936002)(66476007)(66556008)(66946007)(83380400001)(66446008)(186003)(33656002)(8676002)(4326008)(316002)(76116006); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?eiOHq+kH1OvlECJ07aGArdq2QxByGMKFBAKx2xZgeipj25F0v1/FYS3q2jqF?= =?us-ascii?Q?AyooYPHI/KekfSwbokj/qWrgtQ9fcCG9xIM7ft4dNFFyz7G8e9fXrbDyekkh?= =?us-ascii?Q?ly2JZbbOjIovy9h2Bdx5vEuJ/lUE9O26quWCFkQ4WmT8uNPQGjXpWHb+9vLW?= =?us-ascii?Q?xgRc2OOLi3hgyVK7lmoL5hmQCPQBsl8k0uI4yIhAInejDeD1wBEZTq3InPFb?= =?us-ascii?Q?FEh51bXry51H301MF5REFUqQdN6WeFgxUiO/vGvLDH/hDgkOstdcXlQxxDvM?= =?us-ascii?Q?/itv/2wIMdGgEyR19R2LoH4BpmQYlHxWRJK17+9Dr6QtBTFg6HkYUMxmk28o?= =?us-ascii?Q?EqvwyHBv4EliRAXEYdeUTbxU7fpHP9ySu2ks71oGhHa/otwB++mjeTtM/vnF?= =?us-ascii?Q?m7utaekoaMzuF3dBBcoF9FpWrL6YCDKb29o48J6eKoVH33rzfbMgaf4DzLwU?= =?us-ascii?Q?hY02fHP6lc0J+e30+5YZoOd7TPJb0FsEysdLldYD6vDZWfUw/CEhStYrNKYU?= =?us-ascii?Q?5gmzvd1Cp+bLcLJ6lDwB3TMhXZJFIWPOW+V73nIRafl0bc4msORoT/YAmdO5?= =?us-ascii?Q?7AEzNCJYrPKnoFtThrZErVdM97Vf7LLiDhiN+hvuuGB6xQEec16DGn4giPuQ?= =?us-ascii?Q?EniC0yyEq3mqahRE09Zi0YRcr/FRd+DlzGFglv9OCWzacLl2FQQM0hqr9GpI?= =?us-ascii?Q?3HTtaE9t+q1sRXACELzQSzC+yms76cu2BZ4VBYPalha4XdquruHSSC8kYeOR?= =?us-ascii?Q?joHBCLbRNSdv3mmrx2N6HD9rAvz31gtZfdMt/gCivotjaLd45mGqLHdWFoqt?= =?us-ascii?Q?i5vR4rcbVw3DS7ZNsqDey3Q2ZlvJulP/dw8nMJv/ARJ0CMbQTkOs108MwT4W?= =?us-ascii?Q?1pigKJDrd1cs/Z4Ryn1mMdxFDZdv7boJn18pJICO2YKpB+ZU74ySBa0IblU4?= =?us-ascii?Q?v0BzAX7m7/6Zdiim030WS3IYKoqZqwbApJ8EEq1IV3w5W5su5LEZyKq3hKmt?= =?us-ascii?Q?HfksQ9JEph64Z9w+aK5hKLGuFNJVlYmVc6KnXQjDC/HEWKokJCvBkTYaZq0D?= =?us-ascii?Q?IpnRBjkp129N9B18PMd67EwJ4lrefIFSDIgALDPFyzXBmmvUMc+kZezEGjfq?= =?us-ascii?Q?3w4sxOFZRoU7eH4IXKzW+SYrZ4R6Jt/ihmc0cPtGSp8havUFaGNU1v7Xid53?= =?us-ascii?Q?a5MLE+9ck/kwf5OVKE3j9HRXh+Gc3tJIrboXCFZYsBWE/zSScKIHPi0g2fnL?= =?us-ascii?Q?SI8jpoVvoGFCpHp9GZVoc8zMZxxHtfY6m03vyEiGZHJR9f1Z//0fWb7xoZLK?= =?us-ascii?Q?km18MtdYB8s/tb1NDwBWZJn3UZv7yQvzdBq7ZCe2KOl727bjod48Lcmy+aJ2?= =?us-ascii?Q?WRDqyvYz424yilU5GE0YL7De17pNwYPEl19Lj2bPxo+rPDgNcuwaKs7cxXQ8?= =?us-ascii?Q?T+nPT7GRZJRKI+fwoEsozVL4nF98LhWTEEpUa6GkK+VI+LwJnD15MrvuvHV8?= =?us-ascii?Q?kefHWJhJOgPnpwVmZX4J/UqYKMVUqS2UoUPq3iolrJBO3tlq4WAx27odKzVy?= =?us-ascii?Q?G3ZuQ3OMp2ELKbbM1WjKDPEppC02EG0KNDpHJYv6?= 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: b75af9e5-b858-4642-9397-08da6aeb1b80 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2022 07:32:03.7303 (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: 6/NmSIZKw0P95NAnrli/a4Y+oMYP9rYGRG/MZtff7vTjOwOamNE1+Yz/wuhxwP4MRoehW212OgrG06+VhfMQVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB4589 X-Proofpoint-GUID: y-oRlaDIhYaDhBh07t44FTh9T3ED9Sm- X-Proofpoint-ORIG-GUID: y-oRlaDIhYaDhBh07t44FTh9T3ED9Sm- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-20_12,2022-07-20_01,2022-06-22_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 Hello all, Please have look on it and provide your feedback. Regards Sunil Kumar Kori > -----Original Message----- > From: skori@marvell.com > Sent: Thursday, July 7, 2022 12:28 PM > To: Cristian Dumitrescu ; Aman Singh > ; Yuying Zhang ; > Nithin Kumar Dabilpuram ; Kiran Kumar > Kokkilagadda ; Sunil Kumar Kori > ; Satha Koteswara Rao Kottidi > ; Jasvinder Singh ; > Thomas Monjalon ; Ferruh Yigit > ; Andrew Rybchenko > > Cc: dev@dpdk.org > Subject: [PATCH] ethdev: add protocol param to color table update >=20 > From: Sunil Kumar Kori >=20 > Using rte_mtr_color_in_protocol_set(), user can configure combination of > protocol headers, like outer_vlan and outer_ip, can be enabled on given > meter object. >=20 > But rte_mtr_meter_vlan_table_update() and > rte_mtr_meter_dscp_table_update() do not have information that which > table needs to be updated corresponding to protocol header i.e. inner or > outer. >=20 > Adding protocol paramreter will allow user to provide required protocol > information so that corresponding inner or outer table can be updated > corresponding to protocol header. >=20 > If user wishes to configure both inner and outer table then API must be > called twice with correct protocol information. >=20 > Depends-on: series-23647 ("common/cnxk: update precolor table setup for > VLAN") >=20 > Signed-off-by: Sunil Kumar Kori > --- > app/test-pmd/cmdline_mtr.c | 42 ++++++++++++++++----- > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++-- > drivers/net/cnxk/cnxk_ethdev_mtr.c | 20 +++++++++- > drivers/net/softnic/rte_eth_softnic_meter.c | 4 +- > lib/ethdev/rte_mtr.c | 8 ++-- > lib/ethdev/rte_mtr.h | 7 +++- > lib/ethdev/rte_mtr_driver.h | 4 +- > 7 files changed, 70 insertions(+), 23 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c > index b92e66cedb..c3644ef443 100644 > --- a/app/test-pmd/cmdline_mtr.c > +++ b/app/test-pmd/cmdline_mtr.c > @@ -293,8 +293,8 @@ parse_meter_color_str(char *c_str, uint32_t > *use_prev_meter_color, } >=20 > static int > -parse_multi_token_string(char *t_str, uint16_t *port_id, > - uint32_t *mtr_id, enum rte_color **dscp_table) > +parse_multi_token_string(char *t_str, uint16_t *port_id, uint32_t *mtr_i= d, > + enum rte_mtr_color_in_protocol *proto, enum rte_color > **dscp_table) > { > char *token; > uint64_t val; > @@ -322,6 +322,16 @@ parse_multi_token_string(char *t_str, uint16_t > *port_id, >=20 > *mtr_id =3D val; >=20 > + /* Third token: protocol */ > + token =3D strtok_r(t_str, PARSE_DELIMITER, &t_str); > + if (token =3D=3D NULL) > + return 0; > + > + if (strcmp(token, "outer_ip") =3D=3D 0) > + *proto =3D RTE_MTR_COLOR_IN_PROTO_OUTER_IP; > + else if (strcmp(token, "inner_ip") =3D=3D 0) > + *proto =3D RTE_MTR_COLOR_IN_PROTO_INNER_IP; > + > ret =3D parse_dscp_table_entries(t_str, dscp_table); > if (ret !=3D 0) > return -1; > @@ -331,7 +341,7 @@ parse_multi_token_string(char *t_str, uint16_t > *port_id, >=20 > static int > parse_multi_token_vlan_str(char *t_str, uint16_t *port_id, uint32_t > *mtr_id, > - enum rte_color **vlan_table) > + enum rte_mtr_color_in_protocol *proto, enum rte_color > **vlan_table) > { > uint64_t val; > char *token; > @@ -359,6 +369,16 @@ parse_multi_token_vlan_str(char *t_str, uint16_t > *port_id, uint32_t *mtr_id, >=20 > *mtr_id =3D val; >=20 > + /* Third token: protocol */ > + token =3D strtok_r(t_str, PARSE_DELIMITER, &t_str); > + if (token =3D=3D NULL) > + return 0; > + > + if (strcmp(token, "outer_vlan") =3D=3D 0) > + *proto =3D RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN; > + else if (strcmp(token, "inner_vlan") =3D=3D 0) > + *proto =3D RTE_MTR_COLOR_IN_PROTO_INNER_VLAN; > + > ret =3D parse_vlan_table_entries(t_str, vlan_table); > if (ret !=3D 0) > return -1; > @@ -1384,6 +1404,7 @@ static void > cmd_set_port_meter_dscp_table_parsed(void *parsed_result, > __rte_unused void *data) > { > struct cmd_set_port_meter_dscp_table_result *res =3D parsed_result; > + enum rte_mtr_color_in_protocol proto =3D 0; > struct rte_mtr_error error; > enum rte_color *dscp_table =3D NULL; > char *t_str =3D res->token_string; > @@ -1392,7 +1413,8 @@ static void > cmd_set_port_meter_dscp_table_parsed(void *parsed_result, > int ret; >=20 > /* Parse string */ > - ret =3D parse_multi_token_string(t_str, &port_id, &mtr_id, > &dscp_table); > + ret =3D parse_multi_token_string(t_str, &port_id, &mtr_id, &proto, > + &dscp_table); > if (ret) { > fprintf(stderr, " Multi token string parse error\n"); > return; > @@ -1402,7 +1424,7 @@ static void > cmd_set_port_meter_dscp_table_parsed(void *parsed_result, > goto free_table; >=20 > /* Update Meter DSCP Table*/ > - ret =3D rte_mtr_meter_dscp_table_update(port_id, mtr_id, > + ret =3D rte_mtr_meter_dscp_table_update(port_id, mtr_id, proto, > dscp_table, &error); > if (ret !=3D 0) > print_err_msg(&error); > @@ -1414,7 +1436,7 @@ static void > cmd_set_port_meter_dscp_table_parsed(void *parsed_result, > cmdline_parse_inst_t cmd_set_port_meter_dscp_table =3D { > .f =3D cmd_set_port_meter_dscp_table_parsed, > .data =3D NULL, > - .help_str =3D "set port meter dscp table " > + .help_str =3D "set port meter dscp table " > "[ ... > ]", > .tokens =3D { > (void *)&cmd_set_port_meter_dscp_table_set, > @@ -1457,6 +1479,7 @@ static void > cmd_set_port_meter_vlan_table_parsed(void *parsed_result, > __rte_unused void *data) > { > struct cmd_set_port_meter_vlan_table_result *res =3D parsed_result; > + enum rte_mtr_color_in_protocol proto =3D 0; > struct rte_mtr_error error; > enum rte_color *vlan_table =3D NULL; > char *t_str =3D res->token_string; > @@ -1465,7 +1488,8 @@ static void > cmd_set_port_meter_vlan_table_parsed(void *parsed_result, > int ret; >=20 > /* Parse string */ > - ret =3D parse_multi_token_vlan_str(t_str, &port_id, &mtr_id, > &vlan_table); > + ret =3D parse_multi_token_vlan_str(t_str, &port_id, &mtr_id, &proto, > + &vlan_table); > if (ret) { > fprintf(stderr, " Multi token string parse error\n"); > return; > @@ -1475,7 +1499,7 @@ static void > cmd_set_port_meter_vlan_table_parsed(void *parsed_result, > goto free_table; >=20 > /* Update Meter VLAN Table*/ > - ret =3D rte_mtr_meter_vlan_table_update(port_id, mtr_id, > + ret =3D rte_mtr_meter_vlan_table_update(port_id, mtr_id, proto, > vlan_table, &error); > if (ret !=3D 0) > print_err_msg(&error); > @@ -1487,7 +1511,7 @@ static void > cmd_set_port_meter_vlan_table_parsed(void *parsed_result, > cmdline_parse_inst_t cmd_set_port_meter_vlan_table =3D { > .f =3D cmd_set_port_meter_vlan_table_parsed, > .data =3D NULL, > - .help_str =3D "set port meter vlan table " > + .help_str =3D "set port meter vlan table " > "[ ... > ]", > .tokens =3D { > (void *)&cmd_set_port_meter_vlan_table_set, > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 330e34427d..ce40e3b6f2 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -2597,15 +2597,15 @@ set port meter dscp table >=20 > Set meter dscp table for the ethernet device:: >=20 > - testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entr= y0) \ > - (dscp_tbl_entry1)...(dscp_tbl_entry63)] > + testpmd> set port meter dscp table (port_id) (mtr_id) (proto) \ > + [(dscp_tbl_entry0) (dscp_tbl_entry1)...(dscp_tbl_entry63)] >=20 > set port meter vlan table > ~~~~~~~~~~~~~~~~~~~~~~~~~ > Set meter VLAN table for the Ethernet device:: >=20 > - testpmd> set port meter vlan table (port_id) (mtr_id) [(vlan_tbl_entr= y0) \ > - (vlan_tbl_entry1)...(vlan_tbl_entry15)] > + testpmd> set port meter vlan table (port_id) (mtr_id) (proto) \ > + [(vlan_tbl_entry0) (vlan_tbl_entry1)...(vlan_tbl_entry15)] >=20 > set port meter protocol > ~~~~~~~~~~~~~~~~~~~~~~~ > diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c > b/drivers/net/cnxk/cnxk_ethdev_mtr.c > index be2cb7d628..0fa18f01c7 100644 > --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c > +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c > @@ -720,6 +720,7 @@ cnxk_nix_mtr_disable(struct rte_eth_dev *eth_dev, > uint32_t mtr_id, >=20 > static int > cnxk_nix_mtr_dscp_table_update(struct rte_eth_dev *eth_dev, uint32_t > mtr_id, > + enum rte_mtr_color_in_protocol proto, > enum rte_color *dscp_table, > struct rte_mtr_error *error) > { > @@ -750,7 +751,7 @@ cnxk_nix_mtr_dscp_table_update(struct rte_eth_dev > *eth_dev, uint32_t mtr_id, >=20 > table.count =3D ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP; >=20 > - switch (dev->proto) { > + switch (proto) { > case RTE_MTR_COLOR_IN_PROTO_OUTER_IP: > table.mode =3D ROC_NIX_BPF_PC_MODE_DSCP_OUTER; > break; > @@ -764,6 +765,13 @@ cnxk_nix_mtr_dscp_table_update(struct > rte_eth_dev *eth_dev, uint32_t mtr_id, > goto exit; > } >=20 > + if (dev->proto !=3D proto) { > + rc =3D -rte_mtr_error_set(error, EINVAL, > + RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL, > + "input color protocol is not configured"); > + goto exit; > + } > + > for (i =3D 0; i < ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP; i++) > table.color[i] =3D nix_dscp_tbl[i]; >=20 > @@ -784,6 +792,7 @@ cnxk_nix_mtr_dscp_table_update(struct rte_eth_dev > *eth_dev, uint32_t mtr_id, >=20 > static int > cnxk_nix_mtr_vlan_table_update(struct rte_eth_dev *eth_dev, uint32_t > mtr_id, > + enum rte_mtr_color_in_protocol proto, > enum rte_color *vlan_table, > struct rte_mtr_error *error) > { > @@ -814,7 +823,7 @@ cnxk_nix_mtr_vlan_table_update(struct rte_eth_dev > *eth_dev, uint32_t mtr_id, >=20 > table.count =3D ROC_NIX_BPF_PRECOLOR_TBL_SIZE_VLAN; >=20 > - switch (dev->proto) { > + switch (proto) { > case RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN: > table.mode =3D ROC_NIX_BPF_PC_MODE_VLAN_OUTER; > break; > @@ -828,6 +837,13 @@ cnxk_nix_mtr_vlan_table_update(struct > rte_eth_dev *eth_dev, uint32_t mtr_id, > goto exit; > } >=20 > + if (dev->proto !=3D proto) { > + rc =3D -rte_mtr_error_set(error, EINVAL, > + RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL, > + "input color protocol is not configured"); > + goto exit; > + } > + > for (i =3D 0; i < ROC_NIX_BPF_PRECOLOR_TBL_SIZE_VLAN; i++) > table.color[i] =3D nix_vlan_tbl[i]; >=20 > diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c > b/drivers/net/softnic/rte_eth_softnic_meter.c > index 6b02f43e31..3e635a3cfe 100644 > --- a/drivers/net/softnic/rte_eth_softnic_meter.c > +++ b/drivers/net/softnic/rte_eth_softnic_meter.c > @@ -636,7 +636,7 @@ pmd_mtr_meter_profile_update(struct rte_eth_dev > *dev, > /* MTR object meter DSCP table update */ static int > pmd_mtr_meter_dscp_table_update(struct rte_eth_dev *dev, > - uint32_t mtr_id, > + uint32_t mtr_id, enum rte_mtr_color_in_protocol proto, > enum rte_color *dscp_table, > struct rte_mtr_error *error) > { > @@ -648,6 +648,8 @@ pmd_mtr_meter_dscp_table_update(struct > rte_eth_dev *dev, > uint32_t table_id, i; > int status; >=20 > + RTE_SET_USED(proto); > + > /* MTR object id must be valid */ > m =3D softnic_mtr_find(p, mtr_id); > if (m =3D=3D NULL) > diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c index > c460e4f4e0..e4dff20f76 100644 > --- a/lib/ethdev/rte_mtr.c > +++ b/lib/ethdev/rte_mtr.c > @@ -197,25 +197,25 @@ rte_mtr_meter_policy_update(uint16_t port_id, > /** MTR object meter DSCP table update */ int > rte_mtr_meter_dscp_table_update(uint16_t port_id, > - uint32_t mtr_id, > + uint32_t mtr_id, enum rte_mtr_color_in_protocol proto, > enum rte_color *dscp_table, > struct rte_mtr_error *error) > { > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > return RTE_MTR_FUNC(port_id, meter_dscp_table_update)(dev, > - mtr_id, dscp_table, error); > + mtr_id, proto, 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, > + uint32_t mtr_id, enum rte_mtr_color_in_protocol proto, > 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_id, proto, vlan_table, error); > } >=20 > /** Set the input color protocol on MTR object */ diff --git > a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index > 008bc84f0d..5e4f7ba73b 100644 > --- a/lib/ethdev/rte_mtr.h > +++ b/lib/ethdev/rte_mtr.h > @@ -913,6 +913,8 @@ rte_mtr_meter_policy_update(uint16_t port_id, > * The port identifier of the Ethernet device. > * @param[in] mtr_id > * MTR object ID. Needs to be valid. > + * @param[in] proto > + * Input color protocol. > * @param[in] dscp_table > * 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 > @@ -927,7 +929,7 @@ rte_mtr_meter_policy_update(uint16_t port_id, > __rte_experimental int rte_mtr_meter_dscp_table_update(uint16_t > port_id, > - uint32_t mtr_id, > + uint32_t mtr_id, enum rte_mtr_color_in_protocol proto, > enum rte_color *dscp_table, > struct rte_mtr_error *error); >=20 > @@ -938,6 +940,8 @@ rte_mtr_meter_dscp_table_update(uint16_t port_id, > * The port identifier of the Ethernet device. > * @param[in] mtr_id > * MTR object ID. Needs to be valid. > + * @param[in] proto > + * Input color protocol. > * @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 > @@ -952,6 +956,7 @@ rte_mtr_meter_dscp_table_update(uint16_t port_id, > __rte_experimental int rte_mtr_meter_vlan_table_update(uint16_t port_id= , > uint32_t mtr_id, > + enum rte_mtr_color_in_protocol proto, > enum rte_color *vlan_table, > struct rte_mtr_error *error); >=20 > diff --git a/lib/ethdev/rte_mtr_driver.h b/lib/ethdev/rte_mtr_driver.h in= dex > f7dca9a54c..a8b652a607 100644 > --- a/lib/ethdev/rte_mtr_driver.h > +++ b/lib/ethdev/rte_mtr_driver.h > @@ -93,13 +93,13 @@ typedef int (*rte_mtr_meter_policy_update_t)(struct > rte_eth_dev *dev, >=20 > /** @internal MTR object meter DSCP table update. */ typedef int > (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev, > - uint32_t mtr_id, > + uint32_t mtr_id, enum rte_mtr_color_in_protocol proto, > 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, > + uint32_t mtr_id, enum rte_mtr_color_in_protocol proto, > enum rte_color *vlan_table, > struct rte_mtr_error *error); >=20 > -- > 2.25.1