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 EA8EA4373B; Tue, 19 Dec 2023 04:29:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C23E142DF4; Tue, 19 Dec 2023 04:29:02 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2085.outbound.protection.outlook.com [40.107.243.85]) by mails.dpdk.org (Postfix) with ESMTP id F0A0D402BC; Tue, 19 Dec 2023 04:29:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UpfQe3f9pe0vQhNTG80yEr34lcCitnHugtUM6LaMTQUUEvHsi4iJRg1uqPZsQT1erv6xuwQRPS2mVAPUcA5t1VuOwp3Oxi/DL9RJf0tOzFSdWVbNtMMd844XW9r/j4n06+d+4igeLsUsQ65DEXMEcIgQjjMePinkNqOM/rDJgsAnOyEhDF4fdMSRPOAc67vEqIgV2uH2fmF3QTyWlKQo0YJOLZmNpvFNcQ0AywUHH3lyLBrsyoJ6AF7oLg4sv7J57ZncRv2g0HhW3wmm0cO2RpcK5nBC9TyeAQkvBe2JVEAtaNGcQHRrODDM3l3GEl67VrtsbvRw2rFCjAgye611yg== 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=YwNH1M5aums33dl9EJ7WC93Dt5ueFHcGM65oJRbykKvoAlN1C5e/WcRroN7g74G93qxmpKRdC0V9M1lEWRsLap6LojqkAo80pTRDtUGCvq0c27X6rtwnrvfnLrG2cP95rkq4I+02qgi6FUsiQwVhyTOslNsknskI5arDg9F3KqJogJdRwmfgaKdjvVyBZEHeyXvJm/snod5uNsTn3v0AWzv6PgZQtjyCk7KgwfSLjbNu3VdHjGysp0VYhbBDanE5c0yue9MlnDJBCoS+7iWvjyx/PQwtv2Q1aIJLKRQolc+Ib0wGvlzehatfnVtGPlbxoS3qV8HYE3ATq1Rmeaz8dA== 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=2gkc8e+pIo+/5kSziAJvg2TEsTkQfP2xYb3lkoRtbjA=; b=MGv8obfO31+6fCVLi7Gyv3o+petf37RFWVEtwsmk8Vxp9GAEAGSZddFrBBibXmI6hJ178iCQEn9BmmV4ebF5rgXogQ4+IGOnJVh+9SRWRY0S5TaY19o+Uty4N/bUXkCLrN5wFJcQGLUiIOABSlIt6k89F6UReH7lWNMz/YE5TxI= Received: from CYZPR12CA0012.namprd12.prod.outlook.com (2603:10b6:930:8b::21) by MW4PR12MB6976.namprd12.prod.outlook.com (2603:10b6:303:20a::21) 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 03:28:56 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:930:8b:cafe::ce) by CYZPR12CA0012.outlook.office365.com (2603:10b6:930:8b::21) 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:28:56 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) 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:28:56 +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:28:48 -0600 From: Sivaprasad Tummala To: , , , , , , , CC: , Subject: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction Date: Tue, 19 Dec 2023 04:28:20 +0100 Message-ID: <20231219032826.4814-2-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 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: CY4PEPF0000EE32:EE_|MW4PR12MB6976:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d36e727-aa89-4fef-382b-08dc0042a1d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RoYduZsd3AqfKdm3qKQMcHtIDYRwmgxib/9GSJ7cLKgif62k1YzEfPND+ZCEtMEug82E+Uzv1YizoH5D7rNIkFS4teMZOdVRsa9YWH4t2iqoLiauGJikKHlRVGhvDXCCwlKmiInxA4F4vT3PBmgQCyWaDgfW20fHN6aIeE6pj8SYbEzRiSMWjJS4voEq3+BPIhHF0d3AeahwrXFcNYxsc4dlYw3AGSEBB6rBjs7q7A/7nNAOWnjQqMl1hYNAQuw5m8XtJ5i6Uwqs2/tzyRdLVYYDUsaEqb2Run3wsLQZ/PiWhSAlivehXrE/exy6UDWsitYhQv/luJDnVYxr/DJE/JOcB0RYVw/Rc757p07wvJvHxKQHXxKnS9HSq3tBpYThlGWALmft5DDlhvBqo2dxWgixd9ZifnCiirFq3HaycfpunVu5eHzferlaacu5AlUlDjerVyXoPRrW+hJTOLNNMxQphLTxrpHvxo28TpGcu7Ih+GzXut4jvNhz7aGzqaQbUyrdXrmaUAJj5cD71ZXGXk7irD9DXZnwRni7MOwWqxCB6bCJP/j4E1uf/ujeTBVw7fhPdT4kEc6E+sla3wgkV3PZh/g2XsbyN3FwO0+R2UdU3fY+yOLXktiIRhpfXAFGfOXdkFptPT9JHaMmgKozpqwfMW+8BVbq/QlR3wnK6q4e9s/E2WZ3jQ4zlrpA8zTZOK8QnKRSej3tpOBs7U7XwwXUlMhk9X3MKHyySyVO7Njal1SBhdJW9tiR6qhEYq6Ztunht+6KU6ONAbtiLI5GuLrPx8SihkggiDrbbqoOCEBROgdEee5fMeloGpyTOYmr 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)(230173577357003)(230273577357003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(82310400011)(40470700004)(36840700001)(46966006)(40460700003)(6666004)(1076003)(2616005)(26005)(426003)(336012)(16526019)(4326008)(36860700001)(83380400001)(47076005)(5660300002)(44832011)(41300700001)(478600001)(2906002)(54906003)(70586007)(70206006)(8676002)(8936002)(316002)(110136005)(36756003)(82740400003)(356005)(81166007)(86362001)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2023 03:28:56.1358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d36e727-aa89-4fef-382b-08dc0042a1d1 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6976 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: 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