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 7D9EC4561A; Mon, 15 Jul 2024 12:15:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EAC2402B0; Mon, 15 Jul 2024 12:15:19 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013054.outbound.protection.outlook.com [52.101.67.54]) by mails.dpdk.org (Postfix) with ESMTP id 88F8F40269 for ; Mon, 15 Jul 2024 12:15:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JNo0iSOnIbgxF9ZOYAJ2AtzMkselK4IXIbWLUrD5F6cQYwcW8zzjXlMGPjaSUBRz2/zYizgNMbyjOHt78l8E9DegfBZatTIMqRAnVFsneUcDqsIlGskuNXtr9NrsgaAbd+YOudXraG92O2WQqBNSCFdvuTNmXEpljPJNJ32Y2zsvuolMlexAqLk9OJe+UsDD0idfqrG81zvCVXpvUqajoB3+lvwOKUDpSHiEz/xhXL1/vOWIgShg/cKPK6HTZCj4H72YFlcUwke3giCnOrX7ONrI0fan+V+ekifX6uqzl/sMRVeDcDvam8hnS5TxwZ62/caSRrG+OUnAfkJQG8nG2Q== 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=l6kixch+intej4LkgXHVzf1X2jxI1uLjIvYCjq0Uq6A=; b=KxvRnFnZJwCTsMUAMZRiTDOlHBsgv9Fo8Cjn3uXkD4LNRc3c4SRA0hTAdfH3Gv0tKtbmMIVo3Z1mFVgEVDIocv9gqavc0yM1no0yNRduYJ/ANuyjiZmFXgsG7hyr/UwpEl1qbH1RSpbdseI/HFfvOL6iBkt3i6E7k/Raa6RKlUshyWzkkVSJ+tgln5uksrd448dKi+Ousos60IL0dPX275BdQTp9gbOdUDBtK1rDUmLLlh8xLSPwweWPLXW3+zHcg29TuTZSs2H5R2DVZ7eAU0MTmgZCUlghtWcjyX7Vzm/Hg5aWK0eLucWya7UuGAf4L5gDnk/mqT7stBCnaau+wQ== 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=l6kixch+intej4LkgXHVzf1X2jxI1uLjIvYCjq0Uq6A=; b=GbgyYTP6f8dj9RI8gRaPxTZ2sqPBoa+Oqk91oDbBPqUhqUqTn9aE+KhGMsuCgwoO3eTIczpkUy0bppIr2MtA9vAEDwcFwpz/NK++rtvVdBpC/rm8Fs+84yF14INiPIF84wnDKNjkcpg588P0WQE4FSqYQdvSNnS6XWSoCBf5Obo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by AM9PR04MB8827.eurprd04.prod.outlook.com (2603:10a6:20b:40a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Mon, 15 Jul 2024 10:15:15 +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.7762.027; Mon, 15 Jul 2024 10:15:15 +0000 From: Gagandeep Singh To: dev@dpdk.org Subject: [PATCH 1/3] examples/l3fwd: support single route file Date: Mon, 15 Jul 2024 15:44:56 +0530 Message-Id: <20240715101458.645014-1-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0125.apcprd03.prod.outlook.com (2603:1096:4:91::29) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AM9PR04MB8827:EE_ X-MS-Office365-Filtering-Correlation-Id: 57e99d65-750f-4234-d245-08dca4b7052b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YcvHfMnm083ouFbHocXgJ++fn0vQC39eqfYFExVRM/OLKBtbvwTCuSXdkWyY?= =?us-ascii?Q?rmFDrlbKJVM9JA1S3wHcksEpoJcsUkpTZdHk/7LAI0T3WflWWGWNd4OPngJ5?= =?us-ascii?Q?BCzXSPeiyWc7YnmWPCSVTrNgOmH+izoMhQ3GzAIsJVZjRLwbmN5OOJpZQO8X?= =?us-ascii?Q?uMrckLvQ2kkmVRWAd3Nc5I/0KQITkazjQXZuBXC/gVWWupF0V6UBsVkG2ts6?= =?us-ascii?Q?ZawOnVh6vNQtYKL6/1KDDEER5VGP6LakmFZaWIFMvtGZ4kgYSU2Du+Ne+8Al?= =?us-ascii?Q?Qxoygrar1ihoTmV5jVsWOA8/AxNvjTS+Boy9MYE21G53EP6qvrfcivgUrbZO?= =?us-ascii?Q?2359u5W2U/Yutf39pQI8MfKN/Kl2Nb9UGZ4LpYd27wrwguQ0F/VNEUFsUFjG?= =?us-ascii?Q?+CzI4cWMk4XwASdW1GOYboKrJofRr5awncuSgBRYVpBkHyocko8EG2FWwPOY?= =?us-ascii?Q?76AYrJDhTigS7WpJ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q?PdiOCduZQ/6bp9zBc8wX27G+LcbCSVQAJTX/b8wE++a5ZRADVA=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)(52116014)(376014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1yEvm8+ocBxDhogJL2J9hvBfrvj2F5tFilXXMB2JOEf00usZpnBCJNVEDy4m?= =?us-ascii?Q?xWYf5K6AhtQ7bn1N5fGHqxWSfWZzIAo5d4EDKKMEYk4/i+0eznJLkzeJK1BH?= =?us-ascii?Q?dxirvQXgKM19mE3O0oKwsYUrPorhcxyOXRE+VZFvAKJ9wrvScLDNqbB3mJop?= =?us-ascii?Q?80Od7DT+Et6uc67MgWumwD/p9zpCnvk2VOolJayn0m5/UOeKcAu0RDEPPE80?= =?us-ascii?Q?mNzX4QS9IANPjaR8xWDFOAEUpjQfL4sg4FLKWzvHGdnXeYKadAWPXRkls0wx?= =?us-ascii?Q?TyXkl+QDlQ4T2CW+t3nneEnSdQK+dH3EHn67TQP0QIR6KK8TxWYh2A2AyxB5?= =?us-ascii?Q?RLi3d11bmA2Yfa+yvlReXfSCMYORar+CRbrFTTJ6lTBB53ID9ed8uT+nUSm+?= =?us-ascii?Q?xN+BEYQyVuE/1+dI2vt5SZOodzRBmSftJqxuCQrTY97xT9R9/O0mgbjIJuVD?= =?us-ascii?Q?+EwOM2bJizfeqvo/e8FunOhBB7dTgcxyyJJMP4ALKPk1dnD8brYFmQVYUfVj?= =?us-ascii?Q?RvYz6XS8hbzUPx+Xx6UvgcTTpHjGW7olokKvdIAr6hgc635al8OFk4ux+uMa?= =?us-ascii?Q?7xlE8Nq/z//66ZPuGRYpj8R14iYRyDnsjH3uj13KOUvZW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D400tURTO4aBSnZiuPLlhc/NScazucZQwSBsP/7X8dg1?= =?us-ascii?Q?C7siDUjZOPLKiLUlXak=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57e99d65-750f-4234-d245-08dca4b7052b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2024 10:15:15.4349 (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: HZsjcxst8ULCIBWOr9kpwKvuCz1MndxE2zhrKSAjWu2D2En9QwMX+rLe0PL+WBAZ X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8827 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 IPv6 rules file needs to be specified together with IPv4 rules file to configure user given rules. But if user want to give only IPv4 or only IPv6 rules, application returns error: "Missing 1 or more rule files" With this patch application can accept only IPv4, only IPv6 or both IP rules. Signed-off-by: Gagandeep Singh --- examples/l3fwd/em_route_parse.c | 18 ++++++++++-------- examples/l3fwd/lpm_route_parse.c | 17 ++++++++++------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/l3fwd/em_route_parse.c b/examples/l3fwd/em_route_parse.c index 6c16832e94..da23356dd6 100644 --- a/examples/l3fwd/em_route_parse.c +++ b/examples/l3fwd/em_route_parse.c @@ -249,8 +249,7 @@ void read_config_files_em(void) { /* ipv4 check */ - if (parm_config.rule_ipv4_name != NULL && - parm_config.rule_ipv6_name != NULL) { + if (parm_config.rule_ipv4_name != NULL) { /* ipv4 check */ route_num_v4 = em_add_rules(parm_config.rule_ipv4_name, &em_route_base_v4, &em_parse_v4_rule); @@ -258,7 +257,14 @@ read_config_files_em(void) em_free_routes(); rte_exit(EXIT_FAILURE, "Failed to add EM IPv4 rules\n"); } - + } else { + RTE_LOG(INFO, L3FWD, "Missing IPv4 rule file, using default instead\n"); + if (em_add_default_v4_rules() < 0) { + em_free_routes(); + rte_exit(EXIT_FAILURE, "Failed to add default IPv4 rules\n"); + } + } + if (parm_config.rule_ipv6_name != NULL) { /* ipv6 check */ route_num_v6 = em_add_rules(parm_config.rule_ipv6_name, &em_route_base_v6, &em_parse_v6_rule); @@ -267,11 +273,7 @@ read_config_files_em(void) rte_exit(EXIT_FAILURE, "Failed to add EM IPv6 rules\n"); } } else { - RTE_LOG(INFO, L3FWD, "Missing 1 or more rule files, using default instead\n"); - if (em_add_default_v4_rules() < 0) { - em_free_routes(); - rte_exit(EXIT_FAILURE, "Failed to add default IPv4 rules\n"); - } + RTE_LOG(INFO, L3FWD, "Missing IPv6 rule file, using default instead\n"); if (em_add_default_v6_rules() < 0) { em_free_routes(); rte_exit(EXIT_FAILURE, "Failed to add default IPv6 rules\n"); diff --git a/examples/l3fwd/lpm_route_parse.c b/examples/l3fwd/lpm_route_parse.c index f2028d79e1..f7d44aa2cd 100644 --- a/examples/l3fwd/lpm_route_parse.c +++ b/examples/l3fwd/lpm_route_parse.c @@ -271,8 +271,7 @@ lpm_free_routes(void) void read_config_files_lpm(void) { - if (parm_config.rule_ipv4_name != NULL && - parm_config.rule_ipv6_name != NULL) { + if (parm_config.rule_ipv4_name != NULL) { /* ipv4 check */ route_num_v4 = lpm_add_rules(parm_config.rule_ipv4_name, &route_base_v4, &lpm_parse_v4_rule); @@ -280,7 +279,15 @@ read_config_files_lpm(void) lpm_free_routes(); rte_exit(EXIT_FAILURE, "Failed to add IPv4 rules\n"); } + } else { + RTE_LOG(INFO, L3FWD, "Missing IPv4 rule file, using default instead\n"); + if (lpm_add_default_v4_rules() < 0) { + lpm_free_routes(); + rte_exit(EXIT_FAILURE, "Failed to add default IPv4 rules\n"); + } + } + if (parm_config.rule_ipv6_name != NULL) { /* ipv6 check */ route_num_v6 = lpm_add_rules(parm_config.rule_ipv6_name, &route_base_v6, &lpm_parse_v6_rule); @@ -289,11 +296,7 @@ read_config_files_lpm(void) rte_exit(EXIT_FAILURE, "Failed to add IPv6 rules\n"); } } else { - RTE_LOG(INFO, L3FWD, "Missing 1 or more rule files, using default instead\n"); - if (lpm_add_default_v4_rules() < 0) { - lpm_free_routes(); - rte_exit(EXIT_FAILURE, "Failed to add default IPv4 rules\n"); - } + RTE_LOG(INFO, L3FWD, "Missing IPv6 rule file, using default instead\n"); if (lpm_add_default_v6_rules() < 0) { lpm_free_routes(); rte_exit(EXIT_FAILURE, "Failed to add default IPv6 rules\n"); -- 2.25.1