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 040CE45641; Thu, 18 Jul 2024 08:30:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 700FE427A7; Thu, 18 Jul 2024 08:30:40 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013060.outbound.protection.outlook.com [52.101.67.60]) by mails.dpdk.org (Postfix) with ESMTP id 08396402B7; Thu, 18 Jul 2024 08:30:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tCLgLyvhg8XVixW0fSEsnugHu2gXJN3+AzNqaM3zHpYEXI3+8XjJ8ybYXdzOfzVZbph0RZb33a4hmzyE7ynz/gRAw1HJU7fWX7Cv4jYmht/60cHnYnL5ae+Hofd0oqB7q+XR8PqqTXMPPA4W8Q4GdK2eVt9oTQD9EL9qa9z/Q02eBiksIuBhB218+PfTEWGDSttzaM1ZF3Y/yeqW30yjjXV0PaiGtQ4G9JlsifT92RFKYY9T3u9Mh+ZGAAD5oSfL9A4skV/OfBrWfANVAmIS0ebRAxIbP/2TEsxgHscus7kSJ5wv8eFNIsW86NEjrlR+WlZERN+53PUCi61ymyw49A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=7bNqiDj+8D+SoUzi+B493WLLYUoGLD7KO31RujQTUJk=; b=xx2IfYTB+eVWhUhdXK6wdqrUk2+xOJ59F24oXfYgCzTcWijD5lRmuRULoMSah6tUZt3GG5PJ8We2F3/NYHMNPzposAcVi6762u9SNv9k91hzmsA30TACfXtSqHpVHpuKZ7X8aTzQt8txsLCgPDBPaU5cRQJ+Xg4TUbYyZ8JY5BBMmy7Kwgq3jdovbiVdjMITe51+DxFjwGOmwNARn3iNBfVXtM/uqpfx5ZrE3aGmB55c9VMEFpwgjDu+B4ADFVdU9QbDd1Ln6rKMdk3nm8tdGveV4cjUF5kz1XlyDpnPFTXQaIShNB4Sjj/A05RxnK9KqhH9raSDIPIQGWFmuklp/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7bNqiDj+8D+SoUzi+B493WLLYUoGLD7KO31RujQTUJk=; b=HEdeov0s2Si9S5N6Xew8joZgQ41hRW1dTLclQURQL6LYrnTw419okruUr+PxIxEzeq5fKADVVkaNRdS8ANQY94Udh+RFAK+LDCSCKaLVY3pC0jN2cQl0jUBzJJN5HT2NtitxQhvz5c/a9R5t9CPI3pysMVF9OZtu5FKJ9quBIN4= Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by VI1PR04MB9954.eurprd04.prod.outlook.com (2603:10a6:800:1d7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.18; Thu, 18 Jul 2024 06:30:36 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%6]) with mapi id 15.20.7784.016; Thu, 18 Jul 2024 06:30:36 +0000 From: Gagandeep Singh To: Konstantin Ananyev , "dev@dpdk.org" , Konstantin Ananyev , Sean Morrissey CC: "stable@dpdk.org" Subject: RE: [PATCH 3/3] examples/l3fwd: fix maximum acceptable port ID in routes Thread-Topic: [PATCH 3/3] examples/l3fwd: fix maximum acceptable port ID in routes Thread-Index: AQHa1p/wVRBmr3j9f0St0JrbTClx37H6t9YAgAFKzOA= Date: Thu, 18 Jul 2024 06:30:36 +0000 Message-ID: References: <20240715101458.645014-1-g.singh@nxp.com> <20240715101458.645014-3-g.singh@nxp.com> <370cf325ad02427cbca5a37756da4c35@huawei.com> In-Reply-To: <370cf325ad02427cbca5a37756da4c35@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAXPR04MB8205:EE_|VI1PR04MB9954:EE_ x-ms-office365-filtering-correlation-id: 21f9954c-c742-45e9-f510-08dca6f322a4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?IzPXq3weMIxCD9Y0yuuroR8EzthpQe0hD7hW05zIhbkg/OC0EQChqYMt68+q?= =?us-ascii?Q?cs9bmkd1AczOdzFcQvgMqtNeRm1ClvaUnbA9Ul0HXeRAd1Mkf8D+I/oqk8ux?= =?us-ascii?Q?tDZQL3e+CwE9q29T3LZahZAOy4Z7GNWo7Q+4iYHylpfO2rSSxyc/+EvpuJxD?= =?us-ascii?Q?3eYJtbLzn96VGjFf/YRogT3q6rlFnm1j/9KS4RorRzJOvjklAZ4FXxePPPXq?= =?us-ascii?Q?d1vfeS7LC5tnjPFjbCfk/kwy6wzMpAzGs235TljfGMVxBp5Kr+azuxsruWXc?= =?us-ascii?Q?xqPDyWu9UZRIWrkAK58ntS6THS2npN0bD8be5CdVrRHa4AiAskDGydEoSYML?= =?us-ascii?Q?jBkrzYe9jnLSg7sWYr/HuJ60DYVryPBfTZc8z1dYeVMJgnQha4mVCNvYbC/D?=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zXLzUa5W6eT1h49MbixUlwb4?= =?us-ascii?Q?5W/mK9wvIDGhxjwvd+xSENXPP1i4bkkmZiS1+gfHzpV8xVSQx/mZpOhwYbP3?= =?us-ascii?Q?LPCg5EglOL80lN3xCXdCuuuktWHPkXgSLwTdGzkHem5PIUNGug=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0GdlM/q+3JBmD7PlrgvqxqFe42rLurobibZBOxUPd0J06OrT3blfy85Y4/cb?= =?us-ascii?Q?v0wFyu42otXC9tfse0KwhzXIqhyFSXImZ1Jxya2u1jfcCKbWod6H335XCg87?= =?us-ascii?Q?6F23ag7v1GlXHU8B74lLelaK2Z+BVj2CwO+lcjbG9mroT4XguZNBrmrG3Zko?= =?us-ascii?Q?1N5XdcIrv8muXdAvmJflgsppL31zx6tvS9o3yt7ANhwI4HP9b4+ylcfYHGbd?= =?us-ascii?Q?OJiF7KnTgXYToqDC70HbNqOG5jtrjVdtoVYb5mz2O9ytOvF3liPx77tmWi2P?= =?us-ascii?Q?KxqI0ro+sSTnuHRe7x80K3goPcsGKL+Pr9zOborFvbl/jgxtOufOYvP56JTI?= =?us-ascii?Q?zq2f+oIlbURYnxFX9pEVLAymLUCQ/lqKyOuMMuoq/BayL+/DEzgJWgZKcJtf?= =?us-ascii?Q?6ekbxYeJbbRkTSlAZZ8qsr9daljJOqZi+U8ZTfED+J+6QFJqajf8Yi5LXytK?= =?us-ascii?Q?vxtPNfoXjorc6jxEOLQrpJDVuzXkYtfSTYcti7VBgdPqJC2kHdCep6Q30mSo?= =?us-ascii?Q?cV9hlTThPB2XNateqiZIDSG7kfa0+iDFWu9Q72wz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gSs0QGsAiqdXANlboUtpK4AzGUVOZ1veNYn+oPIYyiVg+5?= =?us-ascii?Q?vQfBn7TSD7FMIEvCfrAMMs4/BcwJ06PdTpnkAwDAwVBCWkNkYfm+p5ND7LQE?= =?us-ascii?Q?dtZ94ze7B1TXLc8QINY=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21f9954c-c742-45e9-f510-08dca6f322a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jul 2024 06:30:36.7878 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nt42g8ACZftPYvXp/Ekf53m86JgFg9KW/MyDaZjujThyzBSBA+U9Y7NgZc3JvSQC X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9954 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 Hi, > -----Original Message----- > From: Konstantin Ananyev > Sent: Wednesday, July 17, 2024 3:48 PM > To: Gagandeep Singh ; dev@dpdk.org; Konstantin Ananyev > ; Sean Morrissey > > Cc: stable@dpdk.org > Subject: RE: [PATCH 3/3] examples/l3fwd: fix maximum acceptable port ID i= n > routes >=20 >=20 >=20 > > Application is accepting routes for port ID up to UINT8_MAX for LPM > > amd EM routes on parsing the given rule file, but only up to 32 ports > > can be enabled as per the variable enabled_port_mask which is defined > > as uint32_t. > > > > This patch restricts the rules parsing code to accept routes for port > > ID up to 31 only to avoid any unnecessary maintenance of rules which > > will never be used. >=20 > If we want to add this extra check, probably better to do it in setup_lpm= (). > Where we already check that port is enabled, and If not, then this route = rule will > be skipped: >=20 > /* populate the LPM table */ > for (i =3D 0; i < route_num_v4; i++) { > struct in_addr in; >=20 > /* skip unused ports */ > if ((1 << route_base_v4[i].if_out & > enabled_port_mask) =3D=3D 0) > continue; >=20 > Same for EM. I am trying to update the check for MAX if_out value in rules config file p= arsing which will be before setup_lpm(). =20 The reason is, restricting and adding only those rules which can be used by= the application while populating the route_base_v4/v6 at first step and avoid unnecessary m= emory allocation for local variables to store more not required rules. > ((1 << route_base_v4[i].if_out & > enabled_port_mask) By looking into this check, it seems restriction to maximum 31 port ID whil= e parsing rule file becomes more valid as this check can pass due to overflow in case value of route_ba= se_v4[i].if_out Is 31+. > Another question here - why we just silently skip the rule with invalid p= ort? In read_config_files_lpm() we are calling the rte_exit in case port ID is 3= 1+. In setup_lpm, skipping the rules for the ports which are not enabled and no= t giving error, I guess probably because of ease of use. e.g. user has only single ipv4_routes config file with route rules for port= ID 0,1,2,3,4 and want to use same file for multiple test cases like 1. when only port 0 enabled 2. when only port 0 and 1 enabled and so on. In this case, user can avoid to have separate route files for each of the t= est case. > Probably need to fail with error... that what ACL code-path does. >=20 > > Fixes: e7e6dd643092 ("examples/l3fwd: support config file for EM") > > Fixes: 52def963fc1c ("examples/l3fwd: support config file for > > LPM/FIB") > > Cc: sean.morrissey@intel.com > > Cc: stable@dpdk.org > > > > Signed-off-by: Gagandeep Singh > > --- > > examples/l3fwd/em_route_parse.c | 6 ++++-- > > examples/l3fwd/lpm_route_parse.c | 6 ++++-- > > 2 files changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/examples/l3fwd/em_route_parse.c > > b/examples/l3fwd/em_route_parse.c index 8b534de5f1..65c71cd1ba 100644 > > --- a/examples/l3fwd/em_route_parse.c > > +++ b/examples/l3fwd/em_route_parse.c > > @@ -65,7 +65,8 @@ em_parse_v6_rule(char *str, struct em_rule *v) > > /* protocol. */ > > GET_CB_FIELD(in[CB_FLD_PROTO], v->v6_key.proto, 0, UINT8_MAX, 0); > > /* out interface. */ > > - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); > > + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, > > + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); > > > > return 0; > > } > > @@ -102,7 +103,8 @@ em_parse_v4_rule(char *str, struct em_rule *v) > > /* protocol. */ > > GET_CB_FIELD(in[CB_FLD_PROTO], v->v4_key.proto, 0, UINT8_MAX, 0); > > /* out interface. */ > > - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); > > + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, > > + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); > > > > return 0; > > } > > diff --git a/examples/l3fwd/lpm_route_parse.c > > b/examples/l3fwd/lpm_route_parse.c > > index f27b66e838..357c12d9fe 100644 > > --- a/examples/l3fwd/lpm_route_parse.c > > +++ b/examples/l3fwd/lpm_route_parse.c > > @@ -110,7 +110,8 @@ lpm_parse_v6_rule(char *str, struct lpm_route_rule > > *v) > > > > rc =3D lpm_parse_v6_net(in[CB_FLD_DST_ADDR], v->ip_32, &v->depth); > > > > - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); > > + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, > > + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); > > > > return rc; > > } > > @@ -132,7 +133,8 @@ lpm_parse_v4_rule(char *str, struct lpm_route_rule > > *v) > > > > rc =3D parse_ipv4_addr_mask(in[CB_FLD_DST_ADDR], &v->ip, &v->depth); > > > > - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); > > + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, > > + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); > > > > return rc; > > } > > -- > > 2.25.1 Gagan