From patchwork Tue Mar 26 12:55:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sivaprasad Tummala X-Patchwork-Id: 138804 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 482FA43D51; Tue, 26 Mar 2024 13:57:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E73341141; Tue, 26 Mar 2024 13:57:10 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) by mails.dpdk.org (Postfix) with ESMTP id 7348F40E09; Tue, 26 Mar 2024 13:57:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cik1mL3gIi+3oHw4Yz7RTzeim/bJnyttcpV4KhhCvQA62K4dM/6qoC6F0veja3pPbKAvzIDpAtlrrIHPDnlEAYI+lREoUjy/ngLZfqy6lRZm8zt8AsgqKzV/SEwnmBR4Tyk8y63cmSM54eLLd3GrlT6FhhXGBG9G4I+EOi6mzGjlvBlE/Tiall4Pozp9NX+3b7CdFojoLzMah0jzOhd7slGOSx6Xwimd+W4DGOz7M3VuoFOY/viB7IM5adTsHg0mYFsWVnGOgapBR0hBXYkFmS7Qq0egyRnIVBYeGHn6WFDXBaVESpLMOlVgSrzWuUScorDDhQuGZeQoUOyUv5v1jw== 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=c5Wyvs3nPPdiKXM5ZKWrwKAz1v4DyHuQWWoGAeE6Ssk=; b=X/RzWNazpxg2pe39K6d2k7klt9Dj56mFBRfgh7SW4GD0OwVS46kXx1267gUD7caSYdW75pWvBZk4HhUo5wj99fb8iT22SeI5sjYiixD6cJ6AqiSRX3AKVFjhw91JiKpOmY/cKaSnpc7sVTvxGf5NiYNiHsvJPCOkzMTXcXKWaCZHVer8UR2EDzcHLAqg/nCjWgWaSWnD3SFIOeHOjt9LaoANPy/io4q7+f6uiqZ6XOyNp1Axg0Y3b6/KVK8XYT2GoJQR7myopDbzDPb+4WwOqmhbPW56BsBedcWUoGb485ORh9i0CSoO7D+xXQcAyxKLLHj5dz2vsf1m8cNTZRsY9Q== 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=c5Wyvs3nPPdiKXM5ZKWrwKAz1v4DyHuQWWoGAeE6Ssk=; b=hE7lJCWwhml1Tf8yvbJ7cn7a1Snho7k/olV1F7EGJ/xNF1eFqDzwuIUyIirqbMN/OzNicL1loZm8VMNviXbt5dxFLkDQ4Erc/8+Ag6wor8P68lz8DrLAA3KpKn7tWTWxenHsleDCUZ06T1/5cQq0cOucIMlLw0a6pMvuy4/eKsc= Received: from DM6PR18CA0016.namprd18.prod.outlook.com (2603:10b6:5:15b::29) by MN2PR12MB4421.namprd12.prod.outlook.com (2603:10b6:208:26c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 12:57:03 +0000 Received: from DS2PEPF00003445.namprd04.prod.outlook.com (2603:10b6:5:15b:cafe::47) by DM6PR18CA0016.outlook.office365.com (2603:10b6:5:15b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 12:57:03 +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 DS2PEPF00003445.mail.protection.outlook.com (10.167.17.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 12:57:02 +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.35; Tue, 26 Mar 2024 07:56:54 -0500 From: Sivaprasad Tummala To: , , , , , , , , , , CC: , , Subject: [PATCH v7 08/14] examples/ipsec-secgw: fix lcore ID restriction Date: Tue, 26 Mar 2024 13:55:47 +0100 Message-ID: <20240326125554.138840-9-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240326125554.138840-1-sivaprasad.tummala@amd.com> References: <20240321184721.69040-1-sivaprasad.tummala@amd.com> <20240326125554.138840-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: DS2PEPF00003445:EE_|MN2PR12MB4421:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fa50ca7-2832-4c20-0bac-08dc4d943b48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oRltKVBsR7W9DVio5GiVJH10tQu1O25C2Rgnwwnj5jam5zsnAn6dNe/CjRL3bQosJA7sV6Qd91Vv0G5eEiTyYmvcmdvjV6HFdg2xmIENnHGmZe3L5hI8eozKw4M8D+KFA8wFGw0LlMhN37OnhOXP8R9RyNCkQCc3dYPtm/ngrpNhUprT3IhRPytR/NE9bB6d61s/cbR59HnnkQAUEcGvLO0QogGjRaab18SeqTJmcREGF94Lm8ZqE6UiB0cOjRnbRFMCzDRz+w6nqlP1INDX4Q1dKVFsZRPztR0BMB/RcaAitOnHrQkhI0d4AhE11tu6oS+UEhYE8VyFS0Pjr694u7wKIbiCwyoiaq96zq9uFTYAqDyogEIiOUm2l+PIceBnUVjcjkLGuBOUoFeuZj4wiIHxNmnwXQQVNEB7A18nwGbIEN8MDQwHkSH19eFKSevayKHL3avqaRIsHR8MnEirLFEef1914En1y7t0W1/oq6NkUcHggXWCHinc5X8BvgIhSpfGP9sb+JN07mCytM/ef7yKZZOz0iUWTjXjdft+r3vn/R/wH1yCUlcDeK9Fsr2r4Je4low8gaQ63U1Dh4zXe464pYLFqm33PCwFfCU6MQjWSlUgQ6B9t6jbM6kKzX9uKAbhH2u1xpaxyG61HfCzdNiQcTfDaKAosJSXdgF0H+cicg4GyVaK3JwPZPw83wO6QDd0Twl1g8YeDNLCSSxqFxaGoUvuJhq4c6nwLnmGYYDcoNrqtiFflQz0cqU/50he/F72MZSh5a7WTzmI+BQ2bA== 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)(7416005)(376005)(82310400014)(36860700004)(1800799015)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 12:57:02.3906 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fa50ca7-2832-4c20-0bac-08dc4d943b48 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: DS2PEPF00003445.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4421 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 fixes these constraints by allowing all lcore IDs up to RTE_MAX_LCORES. Also the queue IDs are increased to support up to 65535. 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 Acked-by: Morten Brørup Acked-by: Ferruh Yigit --- examples/ipsec-secgw/event_helper.h | 2 +- examples/ipsec-secgw/ipsec-secgw.c | 21 +++++++++++++-------- examples/ipsec-secgw/ipsec.c | 2 +- examples/ipsec-secgw/ipsec.h | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/ipsec-secgw/event_helper.h b/examples/ipsec-secgw/event_helper.h index dfb81bfcf1..be635685b4 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; + uint32_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 782535f4b5..2d004d82fd 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; uint16_t queue_id; - uint8_t lcore_id; + uint32_t lcore_id; } __rte_cache_aligned; static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS]; @@ -807,7 +807,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; + uint32_t lcore; uint16_t portid; uint16_t i; int32_t socket_id; @@ -826,13 +826,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 %u 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 %u is on socket %d " "with numa off\n", lcore, socket_id); } @@ -867,7 +867,7 @@ static int32_t init_lcore_rx_queues(void) { uint16_t i, nb_rx_queue; - uint8_t lcore; + uint32_t lcore; for (i = 0; i < nb_lcore_params; ++i) { lcore = lcore_params[i].lcore_id; @@ -1048,7 +1048,11 @@ parse_config(const char *q_arg) char *str_fld[_NUM_FLD]; int32_t i; uint32_t size; - uint32_t max_fld[_NUM_FLD] = {255, RTE_MAX_QUEUES_PER_PORT, 255}; + uint32_t max_fld[_NUM_FLD] = { + 255, + RTE_MAX_QUEUES_PER_PORT, + RTE_MAX_LCORE + }; nb_lcore_params = 0; @@ -1082,7 +1086,7 @@ parse_config(const char *q_arg) lcore_params_array[nb_lcore_params].queue_id = (uint16_t)int_fld[FLD_QUEUE]; lcore_params_array[nb_lcore_params].lcore_id = - (uint8_t)int_fld[FLD_LCORE]; + (uint32_t)int_fld[FLD_LCORE]; ++nb_lcore_params; } lcore_params = lcore_params_array; @@ -1918,7 +1922,8 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads, struct rte_eth_dev_info dev_info; struct rte_eth_txconf *txconf; uint16_t nb_tx_queue, nb_rx_queue; - uint16_t tx_queueid, rx_queueid, queue, lcore_id; + uint16_t tx_queueid, rx_queueid, queue; + uint32_t lcore_id; int32_t ret, socket_id; struct lcore_conf *qconf; struct rte_ether_addr ethaddr; diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index c321108119..b52b0ffc3d 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 = 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; diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 29b9b283f0..6526a80d81 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -256,11 +256,11 @@ extern struct offloads tx_offloads; * (hash key calculation reads 8 bytes if this struct is size 5 bytes). */ struct cdev_key { - uint16_t lcore_id; + uint32_t lcore_id; uint8_t cipher_algo; uint8_t auth_algo; uint8_t aead_algo; - uint8_t padding[3]; /* padding to 8-byte size should be zeroed */ + uint8_t padding; /* padding to 8-byte size should be zeroed */ }; struct socket_ctx {