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 5ECE24373B for ; Tue, 19 Dec 2023 03:56:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36497402D0; Tue, 19 Dec 2023 03:56:38 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2059.outbound.protection.outlook.com [40.107.92.59]) by mails.dpdk.org (Postfix) with ESMTP id DC5F5402BC for ; Tue, 19 Dec 2023 03:56:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ru76temkxmilAno8CKknELx9A19cmgUeOmeZHlEHp7jvGCJgfl7r5QM3C3zzCZC1srTD30D8+VECWERfSWyC+sIUHE7jeeY2opJpqUTwTx1DKRwjM7P3lTrRO3qoAZnMGuYNTGPZanH9NripVSKcQzn6rZBG5BrM3I464d0xAz0GtuvmTYUD4PoU35xnBzcbs81X7dYYtVvTwEscZ1wk7Vx8Bhw3GwVBVweJjGQgAEafcQhacE1/nVTDxxihBA5ESocM8oScZ/HS60g8sUtJUC769r37QHVgaPRhf92xUwtWK4kd8ODCjy/Qia6n4TkJ4ODwOcGg82y6UxFKdl2ikA== 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=2gkc8e+pIo+/5kSziAJvg2TEsTkQfP2xYb3lkoRtbjA=; b=aGklVpdxs3mB8At7gqvXO8+r7sNNFvJceaCAiPQiiLq7rW2R+9y86faOqY1SJMR+NDTLuNgQSI5rqPZUrYzkxIjHhPNO1z739DrdbegCe/WwsLreoTXQyNYk+WVFmEkcOcPHxQTcCnnzLmxuMcfG6qJhLxU0W1dt/twRMZ4uBr9zvDdPXYciceddFJuVdR5DnN5TaB3fTzr/29A3sIgnYqKCYq7kfJnrv1mKJq+qPMkvOs6qmUYD0D+67wVsZf4+FcNUhO02t1kyqQ6u/M2kg0rrx9rW0CobZoTPv+b3CaPPina2nE0Vtdw/VzjDwtZKxhoLRPdlj+KOTBPhkTBLkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org 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=2gkc8e+pIo+/5kSziAJvg2TEsTkQfP2xYb3lkoRtbjA=; b=CW9hPg1SKhQYI3bdkkTfb1M+cAnggeY+W4TiyFQEhI2FhFcL4i55a5I56SmvhtSgGeA/GUkdT7HU4fil9+v1ADE8Qzlkh6a7/ShODX0bPlmi+wo1X9uJBkKga6CjCrYsGF29FW8TN0a71U1VwbNl3WmgKAy9MuZmCqrAKdXSySQ= Received: from CY8PR10CA0040.namprd10.prod.outlook.com (2603:10b6:930:4b::16) by DM8PR12MB5432.namprd12.prod.outlook.com (2603:10b6:8:32::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.38; Tue, 19 Dec 2023 02:56:33 +0000 Received: from CY4PEPF0000EE3F.namprd03.prod.outlook.com (2603:10b6:930:4b:cafe::58) by CY8PR10CA0040.outlook.office365.com (2603:10b6:930:4b::16) 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 02:56:33 +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 CY4PEPF0000EE3F.mail.protection.outlook.com (10.167.242.19) 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 02:56:33 +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 20:56:31 -0600 From: Sivaprasad Tummala To: CC: Subject: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction Date: Tue, 19 Dec 2023 03:56:02 +0100 Message-ID: <20231219025608.2538-2-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231219025608.2538-1-sivaprasad.tummala@amd.com> References: <20231218074905.42749-1-sivaprasad.tummala@amd.com> <20231219025608.2538-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: CY4PEPF0000EE3F:EE_|DM8PR12MB5432:EE_ X-MS-Office365-Filtering-Correlation-Id: f8d08c39-b8ec-4aa8-9bf1-08dc003e1baf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ea0sMJp/v2cARlAQQjKrElV1OAlXJpXQt8BxqAzLv8KQirLyyCjdw9sYQRmUonod1XMDqqBVbRBXCSgs5yPaBpdcGzmWtBVpht6VxD5YSG06e9wYNSxWeFhSPgU46i01V41XvQAhOr0Vo3GDs6mEfYpaPiaJmL7i4ic0cjH0tkFqG1ZJRVlWnYlCt9/Okf6p+C2ZmYUOSa1CKbu8oCVzn4Mpjj3jKoXfP8xV7huI05t5HO6DlIVkFQhBYop4k/zbFPN/VTCx9Uq2itnuxG0oyMoWZqxu0GG7pZadrW7HM5sYWDrTbMTBZaO7bC9GQL3sWri6MRXcoXzLrr8m+r5Lw6Fybhiod2uitqzKJBmtZ20pXJO9TxTEyKqLcY2/AWybDv685S2SIAPT0B0oNiAKjb0MFv6RLuxzqeyNISbZvsg5EIHy5erAcnVVAM96PQcyiyGtYhYTvU5h75L/I5M99BkG6o4IUF6Sn/iIFtM1juphvjBkgftCgfj8SCZ7pr7C4kxYOGDTOR1dBgibsJllWJI8HjCb7tVoHfkIXl88f0DFX2dMrVSgy6+d4zvf/K4StIJ3CSKjk3PFoHbMckuy7RcvCiOldUPyoMFxqD4SGOzVI5vDZyZE2HCiltu68mE2zCKcvZB8g/qFkiyJClzLg79J/9xwAHE7reWAWhkOp9jGSjht7q87oNPHUDRFmZrlce2P8VkRanMj8W8Cud0/hHr31m00RTYMqda4za2SLEto4z9mIgMXuuNOcw1lhFerMNtRfXmJotyW46BuJF/jqc3sdBODGzeAkczkqZ3kfe4NvczDoKoQS5Co5NnLFqUo 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)(376002)(346002)(136003)(396003)(230173577357003)(230273577357003)(230922051799003)(82310400011)(64100799003)(186009)(451199024)(1800799012)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(36860700001)(2616005)(356005)(81166007)(86362001)(82740400003)(70586007)(36756003)(6636002)(478600001)(426003)(83380400001)(47076005)(336012)(26005)(16526019)(1076003)(4326008)(2906002)(70206006)(37006003)(316002)(5660300002)(6666004)(8936002)(8676002)(6862004)(41300700001)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2023 02:56:33.1140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8d08c39-b8ec-4aa8-9bf1-08dc003e1baf 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: CY4PEPF0000EE3F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5432 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Sivaprasad Tummala --- examples/l3fwd/main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 3bf28aec0c..ed116da09c 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -99,7 +99,7 @@ struct parm_cfg parm_config; 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]; @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void) static int check_lcore_params(void) { - uint8_t queue, lcore; - uint16_t i; + uint8_t queue; + uint16_t i, lcore; int socketid; for (i = 0; i < nb_lcore_params; ++i) { @@ -304,12 +304,12 @@ check_lcore_params(void) } lcore = lcore_params[i].lcore_id; if (!rte_lcore_is_enabled(lcore)) { - printf("error: lcore %hhu is not enabled in lcore mask\n", lcore); + printf("error: lcore %hu is not enabled in lcore mask\n", lcore); return -1; } if ((socketid = rte_lcore_to_socket_id(lcore) != 0) && (numa_on == 0)) { - printf("warning: lcore %hhu is on socket %d with numa off \n", + printf("warning: lcore %hu is on socket %d with numa off\n", lcore, socketid); } } @@ -359,7 +359,7 @@ static int 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; @@ -500,6 +500,8 @@ parse_config(const char *q_arg) char *str_fld[_NUM_FLD]; int i; unsigned size; + unsigned int max_fld[_NUM_FLD] = {RTE_MAX_ETHPORTS, + 255, RTE_MAX_LCORE}; nb_lcore_params = 0; @@ -518,7 +520,8 @@ 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) { @@ -531,7 +534,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; -- 2.25.1