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 852D845BCD; Wed, 30 Oct 2024 06:45:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7277742FB9; Wed, 30 Oct 2024 06:45:26 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) by mails.dpdk.org (Postfix) with ESMTP id A54AE42EC5 for ; Wed, 30 Oct 2024 06:45:24 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Yfh3sTdgjEGKHCd+UzzaGqGCk6BGETMXmmohcDoumTAWkI1jldc6WAnvPYng7efjurLy2aUhPKdk8hL1k0KEHN1QRpQ7rIjC26UUWSsceBzgoYy8uGQ2iDetPi/y+WpXDl+So7l+UPiQnWB4M8S5uWhfMKCQMURoMjVYhaVGU89sYBj8Il+ZxDhM8usPlyMni0dnpGrhhIUJhWJn7LZMgePTsHuaHaMiKsWhKgF57MYQzXVSyPsLSX2uEK4dd8L2GN4PXNbJPanL5+azCYGq/ozllNx561OiEg2OUlCby15qhQCaaZSXtacOBFCofsKadaHV563gsXAXXio1JjMXZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Vniy5eQSvoVvzDwmbxbeTUSyJfAcAaYF3DuZftV+SuY=; b=GA1aUL8jONN4c2Ta5B7mSbu5dt0nksss76/FnORP3EY9cRatj0tzpPr5E0/d2TK2CSHQm67JQdwabwCz/0S9nvfN9UeMGpayvvvxpNfb712C3mDla1a2zGUbZQXXlvdMEC/LrGCCTcmE1imE2K/y8RA/xOScBjItBj+kXTzQK3Z5Ft0O8R4nO7ug2UBrczynyD3IuHtu1203oeaD0tdX0qpEFR1pDuwjBNfOHB1x21SiWmLSdjFSktGne2G37LorEPdt16r2/tM1FEklDpG7SSthkw4tT5GMOUk9Wk5VM/oAEqUCVMkyez/ryyDptPwTdHRaoKinrn01MiVot8vovA== 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=Vniy5eQSvoVvzDwmbxbeTUSyJfAcAaYF3DuZftV+SuY=; b=cJth2cVIuqfZkatXxKqt4YNcNmZ6NXz/EBN9RHkTxc5QSm962LQzK/4qo81+TMkPy+Y/FGi9JHEbcqo3eNCHtrPGT4hayvwlcotLqTmq5+srHQH842RwUvA7aSu2lEqCH2NiTD8AeBB9sinHQsNFi6Zj40l/P+TLosEBadP8IZk= Received: from MW4PR03CA0299.namprd03.prod.outlook.com (2603:10b6:303:b5::34) by CYXPR12MB9340.namprd12.prod.outlook.com (2603:10b6:930:e4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 05:45:18 +0000 Received: from CO1PEPF000044F0.namprd05.prod.outlook.com (2603:10b6:303:b5:cafe::e0) by MW4PR03CA0299.outlook.office365.com (2603:10b6:303:b5::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.26 via Frontend Transport; Wed, 30 Oct 2024 05:45:18 +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 CO1PEPF000044F0.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 05:45:18 +0000 Received: from BLRVIVARGHE.amd.com (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.39; Wed, 30 Oct 2024 00:44:25 -0500 From: Vipin Varghese To: , , , , , CC: , , , , , , , Subject: [RFC v3 2/3] test/lcore: enable tests for topology Date: Wed, 30 Oct 2024 11:11:32 +0530 Message-ID: <20241030054133.520-3-vipin.varghese@amd.com> X-Mailer: git-send-email 2.47.0.windows.1 In-Reply-To: <20241030054133.520-1-vipin.varghese@amd.com> References: <20241030054133.520-1-vipin.varghese@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F0:EE_|CYXPR12MB9340:EE_ X-MS-Office365-Filtering-Correlation-Id: e1f30037-1b83-412b-4f08-08dcf8a6091e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us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MUj9utkEn94jEayGp9RT3R?= =?us-ascii?Q?Cr/D7Pj/Nizdq4xiaqQ7A3S+T2LzQIJhfqejWqA+/x3o2CLQOTT/vTgBk6SA?= =?us-ascii?Q?dQ+gsQdo12ehYAEGTolZ7wH8MXIYs7M4NXtGFm2U4e1IEOEFox0dMPZAsWWd?= =?us-ascii?Q?FuRZ3fz62bdxuaaYmn2UUP7eJP9wFOx/dN45O8GdnxWVl+8bNoeZjpdALoUe?= =?us-ascii?Q?Js866GZuW/ygx2eqSKD+3yjTK2VtJS5STyT9N3nNqM4MNGkDFNYroU/mcDgd?= =?us-ascii?Q?eWTg3h0IdzScUs5Lue32fOdadWlHByhq9d/BTYC9Jb0+CNR8Pn/R4Hihq6lk?= =?us-ascii?Q?bWIjCftVuhqooEvsFtS4PMKVbpOnVcj34aN2Dr1iJJx1tZdW3qNzM8znJjKd?= =?us-ascii?Q?rSw1Nm0cnGln9BE+Ft67dwdIHhwLTVhZlqwRXlfYfYYbhfQYW7iUueS25X3Z?= =?us-ascii?Q?9mUy+NIR98jqBhmglH5zlXBg32+211oaRMnwekfG12St4vthRrB2YkSgRrGy?= =?us-ascii?Q?B5aW9cwfzBJbFzvqaO33ojlxOpemL8xnnpZ5E24KNhFjxGcv1Q=3D=3D?= 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:(13230040)(7416014)(36860700013)(82310400026)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 05:45:18.0071 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1f30037-1b83-412b-4f08-08dcf8a6091e 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: CO1PEPF000044F0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9340 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 add functional test cases to validate topology supported lcore API. v3 changes: - fix test test-report/2024-October/817748.html Signed-off-by: Vipin Varghese --- app/test/test_lcores.c | 189 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c index bd5c0dd94b..a40763d890 100644 --- a/app/test/test_lcores.c +++ b/app/test/test_lcores.c @@ -389,6 +389,186 @@ test_ctrl_thread(void) return 0; } +static int +test_topology_macro(void) +{ + unsigned int total_lcores = 0; + unsigned int total_wrkr_lcores = 0; + + unsigned int total_lcore_io = 0; + unsigned int total_lcore_l3 = 0; + unsigned int total_lcore_l2 = 0; + unsigned int total_lcore_l1 = 0; + + unsigned int total_wrkr_lcore_io = 0; + unsigned int total_wrkr_lcore_l3 = 0; + unsigned int total_wrkr_lcore_l2 = 0; + unsigned int total_wrkr_lcore_l1 = 0; + + unsigned int lcore; + + /* get topology core count */ + lcore = -1; + RTE_LCORE_FOREACH(lcore) + total_lcores += 1; + + lcore = -1; + RTE_LCORE_FOREACH_DOMAIN(lcore, RTE_LCORE_DOMAIN_IO) + total_lcore_io += 1; + + lcore = -1; + RTE_LCORE_FOREACH_DOMAIN(lcore, RTE_LCORE_DOMAIN_L3) + total_lcore_l3 += 1; + + lcore = -1; + RTE_LCORE_FOREACH_DOMAIN(lcore, RTE_LCORE_DOMAIN_L2) + total_lcore_l2 += 1; + + lcore = -1; + RTE_LCORE_FOREACH_DOMAIN(lcore, RTE_LCORE_DOMAIN_L1) + total_lcore_l1 += 1; + + printf("INFO: lcore count topology: none (%u), io (%u), l3 (%u), l2 (%u), l1 (%u).\n", + total_lcores, total_lcore_io, + total_lcore_l3, total_lcore_l2, + total_lcore_l1); + + lcore = -1; + RTE_LCORE_FOREACH_WORKER(lcore) + total_wrkr_lcores += 1; + + lcore = -1; + RTE_LCORE_FOREACH_WORKER_DOMAIN(lcore, RTE_LCORE_DOMAIN_IO) + total_wrkr_lcore_io += 1; + + lcore = -1; + RTE_LCORE_FOREACH_WORKER_DOMAIN(lcore, RTE_LCORE_DOMAIN_L3) + total_wrkr_lcore_l3 += 1; + + lcore = -1; + RTE_LCORE_FOREACH_WORKER_DOMAIN(lcore, RTE_LCORE_DOMAIN_L2) + total_wrkr_lcore_l2 += 1; + + lcore = -1; + RTE_LCORE_FOREACH_WORKER_DOMAIN(lcore, RTE_LCORE_DOMAIN_L1) + total_wrkr_lcore_l1 += 1; + + printf("INFO: worker lcore count topology: none (%u), io (%u), l3 (%u), l2 (%u), l1 (%u).\n", + total_wrkr_lcores, total_wrkr_lcore_io, + total_wrkr_lcore_l3, total_wrkr_lcore_l2, + total_wrkr_lcore_l1); + + if ((total_wrkr_lcores + 1) != total_lcores) { + printf("ERR: failed in MACRO for RTE_LCORE_FOREACH\n"); + return -2; + } + + if ((total_wrkr_lcore_io) > total_lcore_io) { + printf("ERR: failed in MACRO for RTE_LCORE_FOREACH_DOMAIN for IO\n"); + return -2; + } + + if ((total_wrkr_lcore_l3) > total_lcore_l3) { + printf("ERR: failed in MACRO for RTE_LCORE_FOREACH_DOMAIN for L3\n"); + return -2; + } + + if ((total_wrkr_lcore_l2) > total_lcore_l2) { + printf("ERR: failed in MACRO for RTE_LCORE_FOREACH_DOMAIN for L2\n"); + return -2; + } + + if ((total_wrkr_lcore_l1) > total_lcore_l1) { + printf("ERR: failed in MACRO for RTE_LCORE_FOREACH_DOMAIN for L1\n"); + return -2; + } + + printf("INFO: lcore DOMAIN macro: success!\n"); + + return 0; +} + +static int +test_lcore_count_from_domain(void) +{ + unsigned int total_lcores = 0; + unsigned int total_lcore_io = 0; + unsigned int total_lcore_l3 = 0; + unsigned int total_lcore_l2 = 0; + unsigned int total_lcore_l1 = 0; + + unsigned int domain_count; + unsigned int i; + + /* get topology core count */ + total_lcores = rte_lcore_count(); + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_IO); + for (i = 0; i < domain_count; i++) + total_lcore_io += rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_IO, i); + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_L3); + for (i = 0; i < domain_count; i++) + total_lcore_l3 += rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_L3, i); + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_L2); + for (i = 0; i < domain_count; i++) + total_lcore_l2 += rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_L2, i); + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_L1); + for (i = 0; i < domain_count; i++) + total_lcore_l1 += rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_L1, i); + + printf("INFO: lcore count: none (%u), io (%u), l3 (%u), l2 (%u), l1 (%u).\n", + total_lcores, total_lcore_io, total_lcore_l3, total_lcore_l2, total_lcore_l1); + + if ((total_lcores != total_lcore_l1) || + (total_lcores != total_lcore_l2) || + (total_lcores != total_lcore_l3) || + (total_lcores != total_lcore_io)) { + printf("ERR: failed in domain API\n"); + return -2; + } + + printf("INFO: lcore count domain API: success\n"); + + return 0; +} + +static int +test_lcore_from_domain_negative(void) +{ + unsigned int domain_count; + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_IO); + if (rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_IO, domain_count)) { + printf("ERR: domain API inconsistent for IO\n"); + return -1; + } + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_L3); + if (rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_L3, domain_count)) { + printf("ERR: domain API inconsistent for L3\n"); + return -1; + } + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_L2); + if (rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_L2, domain_count)) { + printf("ERR: domain API inconsistent for L2\n"); + return -1; + } + + domain_count = rte_get_domain_count(RTE_LCORE_DOMAIN_L1); + if (rte_lcore_count_from_domain(RTE_LCORE_DOMAIN_L1, domain_count)) { + printf("ERR: domain API inconsistent for L1\n"); + return -1; + } + + printf("INFO: lcore domain API: success!\n"); + + return 0; +} + static int test_lcores(void) { @@ -419,6 +599,15 @@ test_lcores(void) if (test_ctrl_thread() < 0) return TEST_FAILED; + if (test_topology_macro() < 0) + return TEST_FAILED; + + if (test_lcore_count_from_domain() < 0) + return TEST_FAILED; + + if (test_lcore_from_domain_negative() < 0) + return TEST_FAILED; + return TEST_SUCCESS; } -- 2.34.1