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 5CB604571F; Tue, 6 Aug 2024 05:41:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB89040662; Tue, 6 Aug 2024 05:41:41 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012006.outbound.protection.outlook.com [52.101.66.6]) by mails.dpdk.org (Postfix) with ESMTP id AE849402A1 for ; Tue, 6 Aug 2024 05:41:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iYstJBQVQIfBJdDQrM90Zl3cnWXL0RcR2Ybnl9uE92ZetSRrwC0plt5OmGWr4srnrWe6uOx7ow8r0oirlrNMO26MuzgCMnRz3Jsk7guxV2qQ9sPV97iuUkMBtXmzpxXg3Axo5Y9RpTS8WFwTae/0OGoEr5GgDGG3EHor5GIpiJW3Mlw3SbyZUuJtzTH3fAcTjfObdImGgJ7+KTERzCgiI+JpvuPyPXfOXnRwW7kzQfVDsO8IY0HAx3zbBq8ZG1Uku1+yfee0WYs22ELkSZ8s6aztRlH7Vv/0VbnmcBIdRdxnToC/tVtx6hXVjjwrIPm/3kX37H8ADcSYROqajOe1aw== 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=SwAxklEePAMQtuKaVpMa8tyG69cgKjw49x7ccJLlnIKN4b6CLX7Ftrc9DuyRhR0+mkhUxqg/7V4bwk2imhtbOokTT/zti5CLiwNobnvT1CDKmn9D+vAumd/vY5QYlfa1bQlwbFvYPdfy6yRExvV1RPf63n7g80CDdbvxNBUBHuoh+e2E4wFQc0w5jWUnOELhKfYmz1VgdzIGWTGsdlQA0dYFi34QvbagThDCoJyaZDBm7j9E+ZSU5I64xt7HqH4giUJ1fAwswSJJmy819ESEUEnoOWtgIUgTIz7yztuGwxkOl2LbL3RbQZGj3mBgBRJJz+7BRyqQSqyBavLMaEphow== 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=l6kixch+intej4LkgXHVzf1X2jxI1uLjIvYCjq0Uq6A=; b=D8fAtihAg2a79NfDEd/TNak9OgIqgGlpWHyzgZ7TX47HaDFILzfPfCJNT3bSsEsbtM1N6+vffsiT7emFm7kNJ9mjVwhx9IPfvyyNhdEi62XojjPw74Oy8/y6uzj8DJh/Wk9LgOOVAPuLt9ytbbkUhe6bJZc024rlQOvKiVCJfl4ZXhpXh2UzR+1M9P0dymGTxTjU+L11N6BAv1Vo7l3H06jEYo9XcWdjh6Z923qzA3b9zkhRbDZ/0wCssISffPKa8sD7MR05toVqsp4Dm4atjJVMUMjiHtIc0CaUaRZVd92zzUqSAidg8Xk3D1yC7NABkVvbo0IJf05sGH/ABMTd+A== 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 AS8PR04MB8387.eurprd04.prod.outlook.com (2603:10a6:20b:3f7::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.11; Tue, 6 Aug 2024 03:41:37 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%7]) with mapi id 15.20.7828.023; Tue, 6 Aug 2024 03:41:37 +0000 From: Gagandeep Singh To: dev@dpdk.org Subject: [v2 1/3] examples/l3fwd: support single route file Date: Tue, 6 Aug 2024 09:11:18 +0530 Message-Id: <20240806034120.3165295-2-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240806034120.3165295-1-g.singh@nxp.com> References: <20240715101458.645014-1-g.singh@nxp.com> <20240806034120.3165295-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0112.apcprd02.prod.outlook.com (2603:1096:4:92::28) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AS8PR04MB8387:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b6e50d1-0902-427b-9200-08dcb5c9aceb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?NwhNksteTLF8rVlRTmRcvc0AZ08Bttcq8Oe8Je/WP6IP0RicJGkYUL0w1kkB?= =?us-ascii?Q?BHjcm73ZwkrBFJ1u1zSMEEb1T52zyWPjq3JYZh80iBzigsipxBDfMhiIvK6+?= =?us-ascii?Q?VHtHC9NNXCXhqcVJaSy6bL/j4olqgvWM+MJsrq0vLzjkyLr52NX4Xg2pq2Hw?= =?us-ascii?Q?zV+6qhgNSUIwPh7paTbV2RMXJb6WBksvIJ0OAcN+diXBHoI393gs9qyrRIDH?= =?us-ascii?Q?62ecU8q/G+bJzHxitJMzvtdKq9qWVToDIumwYcv4+eVxt06wY54ECFrfNfQ0?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vz0A88cbf4ZQbq/x+7rxiyWY0It?= =?us-ascii?Q?aePOhGDS7bTLX6IgyXSwlXDcBWM6x/fdzRt6kgUYpv3mqCuf+W9t0lRDTY36?= =?us-ascii?Q?fzlfhbWiOZ/sAnZUPAV9vJG1tKv/vvIU82mZSnFhWhzWLeAPAdQSuui/kysm?= =?us-ascii?Q?o8yMl/VTlHQAUa4q7zlZiu694eHPEPJYqDi6c8gix5+9BYiDDfmu82hEqDFH?= =?us-ascii?Q?wmSx4PsUAHEQhNS1AGF4ZYo/NYYZOxLiIhoIbbgChsZuSLVaWA=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)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RrDLY6h5z8AS8tZDk8r/egnCbvtcQaX0nyfAVjpla5IOtiFV1hZqTsR7AjJX?= =?us-ascii?Q?nJuWw6tTIFL/UyRFxf6C7crn95//0BYmujCqYuvsfRJ61U+1xu5vfcVUrl2P?= =?us-ascii?Q?aClU2fNf2Luf+dtP3z7k0M+XZMURtT24VUGfbjzDS4T1DL//z2cyrAHmXDuc?= =?us-ascii?Q?LnHnez+EigQ55jWKylnrZvGSzI5E++Pmj893wo15cdRpo/pr7ak4bItoxkaL?= =?us-ascii?Q?+N+qnLwCq7obm/IkfMXbTL4GLJV/JY9qIWL9HJpC64aLokcZdmMOuQkWGwD2?= =?us-ascii?Q?n/BCOU2BLpSdaIiUhJN1w0aYJStqessxRoWPJj8VdifUKKwksZxTPziTzaZ5?= =?us-ascii?Q?avdI2DQJzyOeI3lC2iM7Tq+DjdLHIOwjkkiIDasSsuJ1bGFtFSL3FSuc7W/H?= =?us-ascii?Q?dFv9vP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HdE1gXvcc+H?= =?us-ascii?Q?LO7ZP25SZmwc7td3h11CO3cktPBHGTwjbKX1FFR+rCQ0LC3vkcOgANO/fcZt?= =?us-ascii?Q?m9ib22Akvrtd3Ea70/1Ie89vcYqdIe2xJzqeKfIOfW7UlFONGeQiMKfB6ytL?= =?us-ascii?Q?WSgeHRyuesr8FgelUaTky5jm185xK/TLR/ehXHgTm1aJO44xddFht0mZJ09d?= =?us-ascii?Q?J2KhbtBx2FVFn4OzcbDQKeAn9RS2AG3bEmpiPr5xU9qZPB4lkeJE13J2TaQ/?= =?us-ascii?Q?XW6WIq/hQZqfeLzleag=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b6e50d1-0902-427b-9200-08dcb5c9aceb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2024 03:41:37.5615 (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: i968K7hoVKfV4F/znJOTvjNwx9qskiibtjXPFuj1linSScghRN0LFn+918ZTRh5u X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8387 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