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 B02E14372F; Wed, 20 Dec 2023 07:45:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E68F42E8B; Wed, 20 Dec 2023 07:45:45 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 07D3242E81; Wed, 20 Dec 2023 07:45:44 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IExwu/AnnRYKWNSkC86znnDEFqeH5EzbYf4dUWFm2qYOEfbGaMAbgFPiIYJGO/fYGtTxJYY3D3wI8rIIrrU60ggJY12+LDukVMdI7NI87aKqCo6Bpa361SB0VS/GrnL13EKgtoVbRfPHopb3s/mBhakuedQR6uUnj9D44VMafhY2SMwL/kDv8WdouhBfFVvOA0w4CgtkeB8R/65Vx3/dl3DNx80irWN5FMc2V9hLDg2MHSZV7dQm5Bbr0sStSPvZqC5FCvXOC5SFMNQDJjV35nOSUQq30OJtw5jGCNJLU4GaeayoAP3ty8gBsiS6Kd1TP129/iPwaJUY0s+2qLfPxg== 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=g4KXxn+RXv3Epj+NNeKc0G63+AmFWcqlfXQO0doW1l8=; b=fBU3mJHHjWcEDs0eMTUBz6bI7Xt2nKEpNK735hh9HRkam/ZZ6/zqZbKEBMNB2HBVjTIoPrfmvMdXaercAQ6iELdqGpIwlqGTQo0yGlXQu0Hqj8Na9X9Gz9kYCAlQNsR/9vyMdD/wQ2d1mqZcx8SbWuzroPXUPymdiQU00kfd0TKzpWnvmfO/A9264n+5rSUciVc9k2mIJU/Bf1oYYmRLOLmACs6RcCZ49G6Chn6qp8M6mU1mA8MkRZ2hWJvvYNAWJHcTdn602OsB497eZ4sfFHewJALQeIbfT/jwGn+xgpyAgRk2Mp8LiZuGrX8F7C/ZwsQY+aK/03w9Vb2fezr1Jg== 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=g4KXxn+RXv3Epj+NNeKc0G63+AmFWcqlfXQO0doW1l8=; b=GsRG42LXqAxXAm84Vz36Uk6r3IeZL/lRRfoVWMT5u/g2I0mmF1YDjyCRcu8T0onWP0dA9Qo28Lwj7bR+4SaS26VB92ucGbn5uaDzh5c3OPAu0NvdFJZt2GqwinHfQA1iEkCZlvF/zI81QmIbYsX8s0BQw2zZ8E5kqmEcAuLEwmM= Received: from BL1P223CA0005.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::10) by BN9PR12MB5034.namprd12.prod.outlook.com (2603:10b6:408:104::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 06:45:42 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:2c4:cafe::ab) by BL1P223CA0005.outlook.office365.com (2603:10b6:208:2c4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18 via Frontend Transport; Wed, 20 Dec 2023 06:45:42 +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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7113.14 via Frontend Transport; Wed, 20 Dec 2023 06:45:42 +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; Wed, 20 Dec 2023 00:45:37 -0600 From: Sivaprasad Tummala To: , , , , , , , CC: , , Subject: [PATCH v3 4/6] examples/ipsec-secgw: fix lcore ID restriction Date: Wed, 20 Dec 2023 07:44:59 +0100 Message-ID: <20231220064502.2830-5-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231220064502.2830-1-sivaprasad.tummala@amd.com> References: <20231219032826.4814-1-sivaprasad.tummala@amd.com> <20231220064502.2830-1-sivaprasad.tummala@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: BL6PEPF0001AB4D:EE_|BN9PR12MB5034:EE_ X-MS-Office365-Filtering-Correlation-Id: ef9dc5f2-1d53-4f2d-74a5-08dc0127492b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3fBx+cIos2X0HKSrEBt/iURZndGSPOnCa5u9aPZDBi0XzrF6l6LXAe0z3lLzl2SxtuSFyHm/Xx7iv5iGubdME3gp0OloTzYTe0YvhmkDIP6nCp6BrfL9bG/RXIeO4MQKH4vR1oP2AR+D2H3nf88S+iL6Jz8eYREq6JBPhvZQG4l31wB8QoYkCrDU+UMg1kH2fkjTZQbif2HdMuZRBQte1psrREK08stZaAxWzSn3ZQ+aBfpKLqh12LJS/ZHbN3m3lP+w9af5KWiTleqY2y0yEifAThHe24r8cYyIzBYFuwEWQab7CyaEFiar/V/zVMBMET+zYG7KX3gyAuVztZZ0MnMvScDUTGPMkJ4bS/GfSnzxkWAFOOfDe7dGTc1I0Yd6wxIzWntHUary/xTA1y/02wWrfIOEayaYyN8AUN+O/yst2DfYvLU3cD95EodQeqKiYOLVIn6qPw/XFxekPpbvAi2uRyEWqQtVh3fz5+mKLaA4DdJE5MP/OelBMas5uhJTrFrdKf3LNYA0C959S1jFIVxDMSN2uaPFlGa7XqvJXR9PUSct/tpRJk+Om7J781ZSS6Jh6Rxa0ZQzPUNmy6aF4OT385/A7KyXjjuj7ekPzeXax72PQwPjSwuCTZfBz3ASYqbFjyLh13iLKqx2x3a3cMJO131sU7NMUE3Nv8UfbtPAx5cUAfHhOOY2AROUsDpGklq/U9B/EIyzBjQvkgPw7IcFpJGKzfkeCNmnHuznTdVW69oLV3m5LaXxGWWvywWz5vlK8+jbKdYAtH06lAVxUxaQcHcG2f74NubUzi05lA6GsqYImIkFsM3f0K1mIhOk 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)(39860400002)(136003)(346002)(396003)(376002)(230173577357003)(230273577357003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(82310400011)(36840700001)(40470700004)(46966006)(110136005)(41300700001)(44832011)(86362001)(8936002)(8676002)(7416002)(316002)(54906003)(70206006)(2906002)(36860700001)(70586007)(40480700001)(82740400003)(40460700003)(36756003)(5660300002)(4326008)(478600001)(6666004)(2616005)(16526019)(356005)(81166007)(26005)(83380400001)(47076005)(426003)(1076003)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2023 06:45:42.2392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef9dc5f2-1d53-4f2d-74a5-08dc0127492b 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5034 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 | 32 ++++++++++++++--------------- examples/ipsec-secgw/ipsec.c | 2 +- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/ipsec_worker.c | 10 ++++----- 5 files changed, 23 insertions(+), 25 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..f03a93259c 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -220,8 +220,8 @@ static const char *cfgfile; struct lcore_params { uint16_t port_id; - uint8_t queue_id; - uint8_t lcore_id; + uint16_t queue_id; + uint16_t lcore_id; } __rte_cache_aligned; static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS]; @@ -696,8 +696,7 @@ ipsec_poll_mode_worker(void) uint32_t lcore_id; uint64_t prev_tsc, diff_tsc, cur_tsc; int32_t i, nb_rx; - uint16_t portid; - uint8_t queueid; + uint16_t portid, queueid; struct lcore_conf *qconf; int32_t rc, socket_id; const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) @@ -789,8 +788,7 @@ int check_flow_params(uint16_t fdir_portid, uint8_t fdir_qid) { uint16_t i; - uint16_t portid; - uint8_t queueid; + uint16_t portid, queueid; for (i = 0; i < nb_lcore_params; ++i) { portid = lcore_params_array[i].port_id; @@ -810,7 +808,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 +827,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); } @@ -852,7 +850,7 @@ check_poll_mode_params(struct eh_conf *eh_conf) return 0; } -static uint8_t +static uint16_t get_port_nb_rx_queues(const uint16_t port) { int32_t queue = -1; @@ -863,14 +861,14 @@ get_port_nb_rx_queues(const uint16_t port) lcore_params[i].queue_id > queue) queue = lcore_params[i].queue_id; } - return (uint8_t)(++queue); + return (uint16_t)(++queue); } 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 +1049,8 @@ parse_config(const char *q_arg) char *str_fld[_NUM_FLD]; int32_t i; uint32_t size; + uint16_t max_fld[_NUM_FLD] = {RTE_MAX_ETHPORTS, + USHRT_MAX, RTE_MAX_LCORE}; nb_lcore_params = 0; @@ -1071,7 +1071,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) { @@ -1080,11 +1080,11 @@ parse_config(const char *q_arg) return -1; } lcore_params_array[nb_lcore_params].port_id = - (uint8_t)int_fld[FLD_PORT]; + (uint16_t)int_fld[FLD_PORT]; lcore_params_array[nb_lcore_params].queue_id = - (uint8_t)int_fld[FLD_QUEUE]; + (uint16_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; diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index bdcada1c40..29b9b283f0 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -285,7 +285,7 @@ struct cnt_blk { struct lcore_rx_queue { uint16_t port_id; - uint8_t queue_id; + uint16_t queue_id; void *sec_ctx; } __rte_cache_aligned; diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c index 8d122e8519..90a4c38ba4 100644 --- a/examples/ipsec-secgw/ipsec_worker.c +++ b/examples/ipsec-secgw/ipsec_worker.c @@ -1598,8 +1598,7 @@ ipsec_poll_mode_wrkr_inl_pr(void) int32_t socket_id; uint32_t lcore_id; int32_t i, nb_rx; - uint16_t portid; - uint8_t queueid; + uint16_t portid, queueid; prev_tsc = 0; lcore_id = rte_lcore_id(); @@ -1633,7 +1632,7 @@ ipsec_poll_mode_wrkr_inl_pr(void) portid = rxql[i].port_id; queueid = rxql[i].queue_id; RTE_LOG(INFO, IPSEC, - " -- lcoreid=%u portid=%u rxqueueid=%hhu\n", + " -- lcoreid=%u portid=%u rxqueueid=%hu\n", lcore_id, portid, queueid); } @@ -1729,8 +1728,7 @@ ipsec_poll_mode_wrkr_inl_pr_ss(void) uint32_t i, nb_rx, j; int32_t socket_id; uint32_t lcore_id; - uint16_t portid; - uint8_t queueid; + uint16_t portid, queueid; prev_tsc = 0; lcore_id = rte_lcore_id(); @@ -1764,7 +1762,7 @@ ipsec_poll_mode_wrkr_inl_pr_ss(void) portid = rxql[i].port_id; queueid = rxql[i].queue_id; RTE_LOG(INFO, IPSEC, - " -- lcoreid=%u portid=%u rxqueueid=%hhu\n", + " -- lcoreid=%u portid=%u rxqueueid=%hu\n", lcore_id, portid, queueid); } -- 2.25.1