From patchwork Tue Dec 19 03:28:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sivaprasad Tummala X-Patchwork-Id: 135329 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DCB794373B; Tue, 19 Dec 2023 04:29:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5EA3E42E15; Tue, 19 Dec 2023 04:29:44 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2067.outbound.protection.outlook.com [40.107.220.67]) by mails.dpdk.org (Postfix) with ESMTP id EFF764027B; Tue, 19 Dec 2023 04:29:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fq6oJLNw7ZUa2QTOzgGfTFLiVjhwYarqka91Lsy6g79iNIGGXuiS8cHxFQny74a1Y3nObeNehYw+xQ/muOzsMWFE8Eoc/jJdoWxd8la/KivtupSaAS8NI4/ncwdSR5xq8XGsTgUMSZPfVzQtXTqMF/GDfgqMtJ1EHWZ70WG2n5JgxXJbBihjRB8l8nRRbKcObHIN0TCUFS3Tcabt8xLvnXUMW203rzbURYFJ8kJWK2Uh4dY9cHcn5nLy7a4R5JDqzqRzK55Utt+X00SgM5+hxx9d6mrDz9pdBabkbovrIZ1juCMhoqD3Yt/NwHzTAkfgQ3JL1PtKyelVOVIri/DmLg== 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=7SlHXDPxt2WYHbhj7Rgx+Bub8Fy3GSxeEUL5rVh7qCI=; b=M82bqAS6gh5++LxP2t+hQrjNlj2UvTxiV62agB5XASETTRbQSDL9j0+slpPuNJMVTIR0qFTLaxhqWT5eqpmxC/mMcOyzKCwNsIiqGw9k69tPA5tDNSNuNE5c3EbpyLprKUrRGgUP3P8i73gK43RbE5vRKx5fsxUUK8mQN3oT/1PZpd5GmhjP4Ber8pitxlyQhqWrRkZjBFxqB2hrpy+vl2T5CTcW4JUHb48UpvF6w2WYFylHpUA7ibTR7lQ2eXtRyEKh0xsXr8T9Sm1mUy7d2EuEZu1sv+uM6MiSySaGEbkUsBBl06NbA9H3hlED1ev67IO0IHfcN9/ABYTbT1aiAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7SlHXDPxt2WYHbhj7Rgx+Bub8Fy3GSxeEUL5rVh7qCI=; b=XoXP1TO308lfxwTjvR3aVV2kQMpa63iiVmWk694GHN/E4/uCAdgw4fI1IxcqG/BJuNNchWrE46IB7edTaM1WmEkVY7DpURQloeVLVLGJvNV1D6aKgA78Qai4hy35y139VeGnsfuP4kEu3wDrAPqViBwPSSiXvjdiZW/DKvXSVLk= Received: from CY5P221CA0125.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:1f::31) by DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Tue, 19 Dec 2023 03:29:35 +0000 Received: from CY4PEPF0000EE34.namprd05.prod.outlook.com (2603:10b6:930:1f:cafe::93) by CY5P221CA0125.outlook.office365.com (2603:10b6:930:1f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.38 via Frontend Transport; Tue, 19 Dec 2023 03:29:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE34.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7113.14 via Frontend Transport; Tue, 19 Dec 2023 03:29:35 +0000 Received: from ubuntu2004.linuxvmimages.local (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 18 Dec 2023 21:29:01 -0600 From: Sivaprasad Tummala To: , , , , , , , CC: , , Subject: [PATCH v2 4/6] examples/ipsec-secgw: fix lcore ID restriction Date: Tue, 19 Dec 2023 04:28:23 +0100 Message-ID: <20231219032826.4814-5-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231219032826.4814-1-sivaprasad.tummala@amd.com> References: <20231218074905.42749-1-sivaprasad.tummala@amd.com> <20231219032826.4814-1-sivaprasad.tummala@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE34:EE_|DS7PR12MB5744:EE_ X-MS-Office365-Filtering-Correlation-Id: 055f760d-63de-4e5b-7c1e-08dc0042b91d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ueHgoEeiCv4+dk/fvI5vO7Z2fuf3BvXQDqMq8QOYyTfNocnvxhz+AzBOlLNJiVWQDJVn40pJX2ZxuoY21jpqxmq+zFF4wplaLVH/Xs2UI/M3MKIsJd/RplN7R030MxyXwf/G2tokU5J16rYSdk7MkILZE3/18Dxf1lMSxgZ6wi1J+DZQ29PX87nagoBP2l2NSPpcl6EMP1Jj2TNh0YIPdRt38nUTsbViUTqAE6fVkyjEErrbMgr94fl9ajBJ0TBcTGqNljwbGrjGLm0lfx33JmnVe1K1glji+x9dyKYj6t7o6JvbrVOAtMIJ+brjHIKdDYVcJDZambVpF5nhe10njuestdkgNWiL1yyRotG0yIxxfdMRd5vhQQKsdnIQjqg6zrCNGFHWszO0jeO8GecA0knkOVOlqQHQtvUq4WtC3y9bWQsUQfR9aI3kUBmG8EC/Zs3B98/6Ju2zbsKSrE4yHOCst1VgyohbRA9eYdV5148GHz+e2MKp8Uw0psl8+foq+I3YTIBWGGicVse/V/T7xA6IqLEPZtzxRfigZWMND+XFnGoQbTiHSUqixvjBSy3ALwPV+CL6NQWJ0mup5N7h4liyNvv82Ql0RHHQ3TXnVwa7y6mEbnlIkVnMFkkQ9kOxJDQL/DvEWv3tZSo5o/UCGe+WmVXM86xME7640danjlw6gd8fcXOGIHeVwGBCV9hds5mv/UDtyJAVYrT4587qsN7fMrpD1ZB6sfT4cgNnq+jCocpCCAwK7FyivvMmRXAiA+ZjQo6srpAcKxY1ki8c+gqfNqYO//nKmX/2n+3cvAoqy/4axQ2Z2fHlKbARrKWA X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(396003)(39860400002)(136003)(376002)(230273577357003)(230922051799003)(230173577357003)(1800799012)(451199024)(186009)(82310400011)(64100799003)(36840700001)(46966006)(40470700004)(40460700003)(6666004)(2616005)(16526019)(426003)(26005)(1076003)(336012)(36860700001)(8676002)(70586007)(4326008)(5660300002)(44832011)(83380400001)(41300700001)(7416002)(2906002)(478600001)(316002)(70206006)(81166007)(8936002)(54906003)(110136005)(356005)(47076005)(82740400003)(86362001)(36756003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2023 03:29:35.2389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 055f760d-63de-4e5b-7c1e-08dc0042b91d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE34.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5744 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 Currently the config option allows lcore IDs up to 255, irrespective of RTE_MAX_LCORES and needs to be fixed. The patch allows config options based on DPDK config. Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Cc: sergio.gonzalez.monroy@intel.com Cc: stable@dpdk.org Signed-off-by: Sivaprasad Tummala Acked-by: Konstantin Ananyev --- examples/ipsec-secgw/event_helper.h | 2 +- examples/ipsec-secgw/ipsec-secgw.c | 16 +++++++++------- examples/ipsec-secgw/ipsec.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/ipsec-secgw/event_helper.h b/examples/ipsec-secgw/event_helper.h index dfb81bfcf1..9923700f03 100644 --- a/examples/ipsec-secgw/event_helper.h +++ b/examples/ipsec-secgw/event_helper.h @@ -102,7 +102,7 @@ struct eh_event_link_info { /**< Event port ID */ uint8_t eventq_id; /**< Event queue to be linked to the port */ - uint8_t lcore_id; + uint16_t lcore_id; /**< Lcore to be polling on this port */ }; diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index bf98d2618b..6f550db05c 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -221,7 +221,7 @@ static const char *cfgfile; struct lcore_params { uint16_t port_id; uint8_t queue_id; - uint8_t lcore_id; + uint16_t lcore_id; } __rte_cache_aligned; static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS]; @@ -810,7 +810,7 @@ check_flow_params(uint16_t fdir_portid, uint8_t fdir_qid) static int32_t check_poll_mode_params(struct eh_conf *eh_conf) { - uint8_t lcore; + uint16_t lcore; uint16_t portid; uint16_t i; int32_t socket_id; @@ -829,13 +829,13 @@ check_poll_mode_params(struct eh_conf *eh_conf) for (i = 0; i < nb_lcore_params; ++i) { lcore = lcore_params[i].lcore_id; if (!rte_lcore_is_enabled(lcore)) { - printf("error: lcore %hhu is not enabled in " + printf("error: lcore %hu is not enabled in " "lcore mask\n", lcore); return -1; } socket_id = rte_lcore_to_socket_id(lcore); if (socket_id != 0 && numa_on == 0) { - printf("warning: lcore %hhu is on socket %d " + printf("warning: lcore %hu is on socket %d " "with numa off\n", lcore, socket_id); } @@ -870,7 +870,7 @@ static int32_t init_lcore_rx_queues(void) { uint16_t i, nb_rx_queue; - uint8_t lcore; + uint16_t lcore; for (i = 0; i < nb_lcore_params; ++i) { lcore = lcore_params[i].lcore_id; @@ -1051,6 +1051,8 @@ parse_config(const char *q_arg) char *str_fld[_NUM_FLD]; int32_t i; uint32_t size; + unsigned int max_fld[_NUM_FLD] = {RTE_MAX_ETHPORTS, + 255, RTE_MAX_LCORE}; nb_lcore_params = 0; @@ -1071,7 +1073,7 @@ parse_config(const char *q_arg) for (i = 0; i < _NUM_FLD; i++) { errno = 0; int_fld[i] = strtoul(str_fld[i], &end, 0); - if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) + if (errno != 0 || end == str_fld[i] || int_fld[i] > max_fld[i]) return -1; } if (nb_lcore_params >= MAX_LCORE_PARAMS) { @@ -1084,7 +1086,7 @@ parse_config(const char *q_arg) lcore_params_array[nb_lcore_params].queue_id = (uint8_t)int_fld[FLD_QUEUE]; lcore_params_array[nb_lcore_params].lcore_id = - (uint8_t)int_fld[FLD_LCORE]; + (uint16_t)int_fld[FLD_LCORE]; ++nb_lcore_params; } lcore_params = lcore_params_array; diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index f5cec4a928..5ebb71bb9a 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -259,7 +259,7 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[], continue; /* Looking for cryptodev, which can handle this SA */ - key.lcore_id = (uint8_t)lcore_id; + key.lcore_id = (uint16_t)lcore_id; key.cipher_algo = (uint8_t)sa->cipher_algo; key.auth_algo = (uint8_t)sa->auth_algo; key.aead_algo = (uint8_t)sa->aead_algo;