From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 69A064373B
	for <public@inbox.dpdk.org>; Tue, 19 Dec 2023 03:56:41 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 64D9A42DD3;
	Tue, 19 Dec 2023 03:56:41 +0100 (CET)
Received: from NAM12-DM6-obe.outbound.protection.outlook.com
 (mail-dm6nam12on2084.outbound.protection.outlook.com [40.107.243.84])
 by mails.dpdk.org (Postfix) with ESMTP id 57F23402BC
 for <stable@dpdk.org>; Tue, 19 Dec 2023 03:56:39 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=XYORhbjIdke+UFyyStCoWrgps+xuXCUlmsRKFtTaaKJiJ22brlYiYJdB86NSGq1QE0FybHcJ6EOtBme1TewskWr6aEGBFGREH3vUSsZnUdHb3GoFyAa3Qeh/bTSaV91V4Zfsff77SDLVXPjFvy3UymnZQ3JAHoxmbJwTkNxOziMoCJuxk61kWhkRhTx7BaM7K/e1ntrvFqrZo6hskXRKdbwCoeVesog0tMRyHj88fXt5a16KwrRfEojyhsDYYAJvsn9r5m9t81kHD+QQdiw3qJ98hQQe9StERC/mk6bs5RXTYCm1F8AT6wI4Xl7T/sblPLfYMnFnx8KsX+xEa4oD0Q==
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=WTX/dfAUWtPnrTeKM7XgkKOI+3C0YiQsao9l/nyLGXE=;
 b=gUo8KAg6H6WLE36Agj6q2i1fRuURyRBxZwFaCYdetuuOEZPoRlvKePys2m2PUjxeNAzq4WY39wml0Sug7IU8MeiHmLef7lWBT3H9QGV/PEvDniqRArosDKAJta2A+Zh9cUpe9TaxSyw8St+jd07QqcRaWkJtoQ5i02iIzjdn9WMSQ32cla9ccQgvhTeZyITZVFnAs0LZ2GBWJb2ApVerkSCGIxNmeEiatOHp2+wc2WhCoAhP9dZPdFGu4M3zadUN4tQPapgnkMYcd1PtpLy9eiBuNIMcyrX7957rqqSrZG+vIrl36mBrVbZFMU31yh7nMAu3yvWzRQVIKdGm4iJKOA==
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=WTX/dfAUWtPnrTeKM7XgkKOI+3C0YiQsao9l/nyLGXE=;
 b=tw0apiz03hYVaMuXHLl1DzNeiTXhNsQWqD+X68nVrn0GbGucPhuV+t+qGTRL5ZOgeqSJb89FaIuLEi9zWh327zSTCI6zZHDaLLPKEw4d4g9L1oC0ZObqftFRo8IC2AAE49CxNtyeN8tvv33GOUPGEyRYIT5ZG25oTVV2Fxr1308=
Received: from DM6PR08CA0016.namprd08.prod.outlook.com (2603:10b6:5:80::29) by
 DM4PR12MB8498.namprd12.prod.outlook.com (2603:10b6:8:183::11) 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:35 +0000
Received: from CY4PEPF0000EE3A.namprd03.prod.outlook.com
 (2603:10b6:5:80:cafe::1c) by DM6PR08CA0016.outlook.office365.com
 (2603:10b6:5:80::29) 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: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
 CY4PEPF0000EE3A.mail.protection.outlook.com (10.167.242.14) 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: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 20:56:33 -0600
From: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
To: <ferruh.yigit@amd.com>
CC: <radu.nicolau@intel.com>, <stable@dpdk.org>
Subject: [PATCH v2 2/6] examples/l3fwd-power: fix lcore ID restriction
Date: Tue, 19 Dec 2023 03:56:03 +0100
Message-ID: <20231219025608.2538-3-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: CY4PEPF0000EE3A:EE_|DM4PR12MB8498:EE_
X-MS-Office365-Filtering-Correlation-Id: 375673db-8cf2-4f94-cd6e-08dc003e1cdf
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: OLQx29LHB6uNLqQ58mhMJmw56x5m4jmv8zrkSUEWiV+7K5QX1GXO+ZvemLtAvEATiyBM88kKMsUwPKsi2AHWACJEGqSzIOWzbw5fuwq8bvZbcPN3tzbR5TurqSkcyZwEG0ZPQrJcitF+hGYdwxU+PjwEsxYb+mD9Pf7DQr2WVm69HbdWyu1tdRzK4DHu8HROfyKPxwKxjAcGGBwpDr2hDgBaWcjUSIlh9vzGCTlhbcJGOTdRTQnD8lRRg58MQNRwgd6pB6j3VXA1OoB/Bx9FtLLHEVsWS5n0si0h+YWVlXIOPeL7kbitOPwwwoCyqvtNSVt9TKCI5Y/wtQ5RC/Csskxd9ZI/o3p46IRnSiC32yD0oqkQBMhRm9m/Wx7OHmOZUpMDINhDibINzSOl71yIK3Pi8qyPNsuZkDevLJwsJP4LDg5g9V7twDrVm9PtKqEBYBAiARAsIXNz/RxbHIcE3P/JQQef/DnPzjfIOOYHy5fFt+bqr9y8JR7RQWnufTreE06SNg80P+ag5WrR8l4fT14a8f2rq/MV6DvyEMK4I9FkTFXcq5J2OXCh6Xy/w3ba1AvWbvspqfcmhZvlo2X/utxatUbMuVlFbRQrxMj9xbDMCxle/X7mXmfe3jHDKVRrrD8rPF1SjVuj2CmnaErNJKGn0HhNl3BUpQgUzmfHlYeISQmzA+wXvRO4ljhifr19e8Hzxhykvgl0OTcpFU7QOq/YYKCEVKk5A9fLgtwyc/1pbcGRR4kSRHt2a4Kg0m+snZ4cYxpIJAZ5Q4yxncHOKX3zO7A5VelsGMc4k4wMQEzn9pzv5PKXOjV96NlaM/zM
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)(376002)(396003)(136003)(39860400002)(346002)(230922051799003)(230173577357003)(230273577357003)(451199024)(186009)(1800799012)(64100799003)(82310400011)(40470700004)(36840700001)(46966006)(40460700003)(1076003)(2616005)(426003)(26005)(336012)(16526019)(36860700001)(4326008)(8936002)(6862004)(83380400001)(47076005)(5660300002)(44832011)(8676002)(41300700001)(2906002)(6666004)(478600001)(6636002)(316002)(70586007)(70206006)(37006003)(54906003)(81166007)(356005)(82740400003)(86362001)(36756003)(40480700001)(36900700001);
 DIR:OUT; SFP:1101; 
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2023 02:56:35.1075 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 375673db-8cf2-4f94-cd6e-08dc003e1cdf
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: CY4PEPF0000EE3A.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8498
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=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: f88e7c175a68 ("examples/l3fwd-power: add high/regular perf cores options")
Cc: radu.nicolau@intel.com
Cc: stable@dpdk.org

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
 examples/l3fwd-power/main.c | 16 +++++++++-------
 examples/l3fwd-power/main.h |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index f4adcf41b5..bb9da36455 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1399,8 +1399,8 @@ main_legacy_loop(__rte_unused void *dummy)
 static int
 check_lcore_params(void)
 {
-	uint8_t queue, lcore;
-	uint16_t i;
+	uint8_t queue;
+	uint16_t lcore, i;
 	int socketid;
 
 	for (i = 0; i < nb_lcore_params; ++i) {
@@ -1411,13 +1411,13 @@ 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 "
+			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 "
+			printf("warning: lcore %hu is on socket %d with numa "
 						"off\n", lcore, socketid);
 		}
 		if (app_mode == APP_MODE_TELEMETRY && lcore == rte_lcore_id()) {
@@ -1469,7 +1469,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;
@@ -1661,6 +1661,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;
 
@@ -1681,7 +1683,7 @@ parse_config(const char *q_arg)
 			errno = 0;
 			int_fld[i] = strtoul(str_fld[i], &end, 0);
 			if (errno != 0 || end == str_fld[i] || int_fld[i] >
-									255)
+									max_fld[i])
 				return -1;
 		}
 		if (nb_lcore_params >= MAX_LCORE_PARAMS) {
@@ -1694,7 +1696,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/l3fwd-power/main.h b/examples/l3fwd-power/main.h
index 258de98f5b..4e5fd3b6d6 100644
--- a/examples/l3fwd-power/main.h
+++ b/examples/l3fwd-power/main.h
@@ -10,7 +10,7 @@
 struct lcore_params {
 	uint16_t port_id;
 	uint8_t queue_id;
-	uint8_t lcore_id;
+	uint16_t lcore_id;
 } __rte_cache_aligned;
 
 extern struct lcore_params *lcore_params;
-- 
2.25.1