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 A491C45D4C; Wed, 20 Nov 2024 05:05:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C001D42EE4; Wed, 20 Nov 2024 05:05:36 +0100 (CET) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2077.outbound.protection.outlook.com [40.107.104.77]) by mails.dpdk.org (Postfix) with ESMTP id AA9B040144 for ; Wed, 20 Nov 2024 05:05:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DpNyRasYyFCTMeH+jkT1JWv+Qn7Lku4Dr0Z3EZgAbbJATDwjHYcXUzSAtRegoO7YlFqnDO2NjAfN2A7HZ0Qk7OAmqUj2+c7I7ApKjapzT/7sXhrEkRM8C0C8kJHFQM44F/k6ZJocg5kkKyVB07S0b2W58KKb8rZzjo53Vq/MKcqNglI0fHMQI+tKy73cWDmiDpao4W4I/1yJcWFPh/ircPHygxvw8CYHmKS7Twu3mpqZkogVAPpf6CJop6YgNOpRBfqwiyOSY90BzuR1z8qM1y6WsW7uNirK83gpPPI6DDmgwfvfk0zYLZes2vP7jsCl78gD6kJPnrjrGfZ11mUKkQ== 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=JpC2q5kypUdOnrti1hUo/EUPMMT4gubII7Ysv8LdspI=; b=Saw5Er+EozLD1fzOqHhEZwNfaqqHSYs+CH8suD7tQ1/8c7fvmaMsAfgsZQhAp5Qu0estqeWeuqI9hv04Zy36v126iQ+I2oINSh6qTH6nd3PXocGDcl+0cNSKmqlrYUpiA2mK4OyvmAJrtgN/RVSbjZcuOpyzRkq3UYeLRJ1jN4DyQYx7m41hIyalp8XnGZNTyOCA5LBYFHID3wlVDSC4pWx6kbEWTZNNwqj95MeY+1LUikBIH7QA6XTgkiGChXFuyTFcdFMe65/tyKSpKGzwRDfanyazFchgJ/E2KZVlJA6cgVqZyoXzYhgXvZnPS/ILJUaQ/MGbetLVKbhx3fgKpw== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JpC2q5kypUdOnrti1hUo/EUPMMT4gubII7Ysv8LdspI=; b=H6+ACr608xx0YBEs/DVq/mofT0BPCgZaonq08K7y8qYhkFuXxGfok5Y+2BZO9WMkj3FXBrZymKeGV6s1vRSzuMz36gRvmXUNYwMql8ig/X0xIev9oLEf4BSqwMlCwh5xvnzjzfejaHPkJ8IQhbvEY9qClA0LwVxd7Nyft3u563SyHeh8TFaabjC9l2oauc8WtfwD1llHGQ3wAiaclXydt2NeiKok5svXCKMPf1eDJxYl8IdmK11/BF2eKnc4ssdRmhmswQXrMF2jdvxhRezHMJR7+eQhlSSVA0fUg6Z6Lc5xlvjWk/ZwB5/Rd8q2QOI+tYkYjVazSfM/b2fftl1Dcw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Wed, 20 Nov 2024 04:05:33 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195%4]) with mapi id 15.20.8182.013; Wed, 20 Nov 2024 04:05:33 +0000 From: Gagandeep Singh To: dev@dpdk.org Subject: [v3 1/3] examples/l3fwd: support single route file Date: Wed, 20 Nov 2024 09:35:14 +0530 Message-Id: <20241120040516.2836371-2-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120040516.2836371-1-g.singh@nxp.com> References: <20240806034120.3165295-1-g.singh@nxp.com> <20241120040516.2836371-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2P153CA0034.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::17) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cf82927-42ea-477e-97f0-08dd091894af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?SHWduKInGJUyNVCYe3K5CIaK3p488cSB24gv8Vl2P8tbBT97ywls5LVR9rjK?= =?us-ascii?Q?0JwtBMxUXoUGHag1yOrD7iwQMXtdanAtHSNFUKXAcpGeu6JaQHJW0VM5VKpK?= =?us-ascii?Q?fR0bBo/S5nlSTqYDWOCSNr4jZmRvuXHMP0R7tpH0VV110HuGHB50DD/4tpjw?= =?us-ascii?Q?eYxGgra0WJ5UcnQTatH5PC8luhYmxzGeyBTqmZEuNyMGwB3YeWUhd32vV95F?= =?us-ascii?Q?mrg2G+I3xrPDtU6+UeHAKorq/8r5uwDByNu3WA3JryIdFncoEchxxUC9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gkv3ypn2SBTFbwPAKrwvHBSmVR64oQZa5/?= =?us-ascii?Q?+lpZs03S77nzN06KCmuoE5vMJnAQyfAgNvIRondJSCaZ7XybiZyWFHVZ9xTy?= =?us-ascii?Q?2thlULtTuoI8BB9aG85H0kL7J7z5BjiJ+GaPzyAhvsNAg5Ffmy5FXFi7A9Yr?= =?us-ascii?Q?N4WolU7iTYPyTJTXDps2jVSkBEhqPs5Y/jSvFycLxfYO+JHMkwoM2L/tWIcz?= =?us-ascii?Q?sziR9CA=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(1800799024)(366016)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?IVtARDIwYjPt3TcHP+kbj27gLVv8wsCegYM5NeQGhZ6EF67C1y0r2wXtDvgD?= =?us-ascii?Q?sb9Ph8dgwLPkHuW0ZF8pFEW8WFfka+MeVFvLObqycqFP7ywFCrBvgiw0VHG3?= =?us-ascii?Q?ZyU8pymqikeCzhgqb9sBGDwdjJSu0Pyg1L7qxM/8STNWR5tdRfSaohxU+bWS?= =?us-ascii?Q?uKpqMQU01xlBKJPTkuBmnQCUI3ObUyDw446k4AMRsLyWlU+aKhvMErBzCO6V?= =?us-ascii?Q?2Aj6ppEgy4GwteILZTFwXMpnQc3N4/QnA87zLwDc6tExkISCeIbSk1DgNSBK?= =?us-ascii?Q?CF5BrRDXxqnD9jBUVMELPa4ewu+OJQ0yiZezzWS/rWYnn0OnwG6wP6puWQUN?= =?us-ascii?Q?DOCbO9GX6/RoPUMoKaUnK4IHejdLVsubONk8v5lxvxprWCL9mJEFIdVOBbI8?= =?us-ascii?Q?w1Cbg/VRXecYpXq6Cqi2vBK2t+pTvAIssXP/L09w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gzVJtjhWzSZMDmLGwRXQsmriDEXWx8Fh2nuCdSCWjpi5zTAt2HVRU?= =?us-ascii?Q?O5duNghzWKmZMvpLAvLxSQtTbjaNil3ZmcnnKGSOV7Vz7CjwT/Z79MFaSA+2?= =?us-ascii?Q?nZBE6dBtlaGTTJmZAz6yPyqHarWmk0Si1K5Xyyz36OCh48ODiLSmQaJx9Id5?= =?us-ascii?Q?XQ2zqtcFBcjvu0/w0GjisJSv3Qjd8UfgSMww3Jb3u5Zgbu1AJi4NN8W9CaSn?= =?us-ascii?Q?rSXdAq1TyGiPvnqF9eI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cf82927-42ea-477e-97f0-08dd091894af X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2024 04:05:33.6459 (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: c7q/jHropsaqAQzF4mkNLT/xwnGv4bW1cFxPeSNHwmRlbJ1PDDKibpH8q6TrNpOz X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 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 9c179dc065..2df1b3e925 100644 --- a/examples/l3fwd/lpm_route_parse.c +++ b/examples/l3fwd/lpm_route_parse.c @@ -270,8 +270,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); @@ -279,7 +278,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); @@ -288,11 +295,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