From patchwork Sat Oct 22 08:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 118973 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ECAA0A0032; Sat, 22 Oct 2022 10:32:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96963400D6; Sat, 22 Oct 2022 10:32:15 +0200 (CEST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 175F940042 for ; Sat, 22 Oct 2022 10:32:14 +0200 (CEST) Received: by mail-wr1-f45.google.com with SMTP id v1so8222047wrt.11 for ; Sat, 22 Oct 2022 01:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+tVqk35IH/7Wamlm6NBJ29ZYoqNaUkT4hUf1sTvrVZM=; b=imKTyMHye7rozvQw8jwZ2ujHZCduj+5vVZssXqZxuKksV3QiCZ6t+avrNH90x/b2hV i9BslO+aTjEzdYPPpY/SX35qy6021f1Yh6LhHdjJLxYeQekMq2qtFQLGQwy3bET253Rb c9gFOAEMyiKTquJLkKXc6q/goBb90wsSKY6flAMnt0BzInplvi13Zi4eo75ng0FyDOPJ AjHIltTWjKMDJII9cVU0od6EBz466YjXcjyiuMEeiuoVETU9KCxKjf8iSxDuY4Dir3n4 VxyokBV5Svar9XzqeVYqZXgF1st2d7ue81rbd4/04Ur4g2oahRa+DglvDjbBZ9qg8Inx bi3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+tVqk35IH/7Wamlm6NBJ29ZYoqNaUkT4hUf1sTvrVZM=; b=pIDUmhNfq+l4N458g2/VZ96LdKP1WtSJoKyGSHrX2AJlNZZvtG7mUrwSpZ5cuvd+f8 iBe7Y9gVycTHA4S+YnovbYvAmPuCLLJLbUMdHd123IUUsjMczVhpW365QF0WMmBk9fvv A0GgiWdFealsiwLx6tDbeBUUBhRfLAOqTKXn+Uu5YOThsRH/cZJB69GnkLwU/JwZgJQF 3PWE8KrP2AHNAuWd3WRWvHgN/c11+qwPTtaw9Y5mNMopBcLqe7DY9HV7e8n2wgOaSMyD Gz9p0YPJBsQd8mU4KdygVZjFPmCdDo14Bvq6xwuPj02s7hbOqrP2sHnoPPM0+uYh3Sq7 6h8w== X-Gm-Message-State: ACrzQf0nKIDdOZhfdFeNmTWCCJY0NpHk0F4Dht78OeaIcJNsL/0qAXoy L46nVQUjj9eZNtcVSqDebDLLLsLyZ4SVqQ== X-Google-Smtp-Source: AMsMyM7+uNlGZHrqvS29ZvUSuw8lPBsLZolFzUqi77DieltOj6QmYGanbJ4QFyZhuG1RmNwKPLwgBg== X-Received: by 2002:a05:6000:1008:b0:236:60e8:3d40 with SMTP id a8-20020a056000100800b0023660e83d40mr807375wrx.3.1666427533754; Sat, 22 Oct 2022 01:32:13 -0700 (PDT) Received: from gojira.dev.6wind.com ([185.13.181.2]) by smtp.gmail.com with ESMTPSA id s16-20020a5d4250000000b0022e47b57735sm20559997wrr.97.2022.10.22.01.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 01:32:12 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Cc: David Marchand Subject: [PATCH] app/test: fix PMD perf test on devices with no socket ID Date: Sat, 22 Oct 2022 10:31:09 +0200 Message-Id: <20221022083108.3759-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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 If the socket ID of a device is unknown, rte_eth_dev_socket_id(portid) now returns -1 instead of 0 since commit 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default"). This change breaks the pmd_perf test on environment where the device socket ID is unknown. The test fails with the following error, because it does not find a lcore on socket -1: > No avail lcore to run test Take the new behavior in account in the pmd_perf test: in this environment, the test can now run on any lcore, and not only those from socket 0 (this was the old behavior). Bugzilla ID: 1105 Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default") Signed-off-by: Olivier Matz --- app/test/test_pmd_perf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index fe765c4173..300c3a8a6f 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -265,13 +265,14 @@ init_mbufpool(unsigned nb_mbuf) } static uint16_t -alloc_lcore(uint16_t socketid) +alloc_lcore(int socketid) { unsigned lcore_id; for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { if (LCORE_AVAIL != lcore_conf[lcore_id].status || - lcore_conf[lcore_id].socketid != socketid || + (socketid != -SOCKET_ID_ANY && + lcore_conf[lcore_id].socketid != socketid) || lcore_id == rte_get_main_lcore()) continue; lcore_conf[lcore_id].status = LCORE_USED; @@ -711,17 +712,18 @@ test_pmd_perf(void) num = 0; RTE_ETH_FOREACH_DEV(portid) { if (socketid == -1) { - socketid = rte_eth_dev_socket_id(portid); - worker_id = alloc_lcore(socketid); + worker_id = alloc_lcore(rte_eth_dev_socket_id(portid)); if (worker_id == (uint16_t)-1) { printf("No avail lcore to run test\n"); return -1; } + socketid = rte_lcore_to_socket_id(worker_id); printf("Performance test runs on lcore %u socket %u\n", worker_id, socketid); } - if (socketid != rte_eth_dev_socket_id(portid)) { + if (socketid != rte_eth_dev_socket_id(portid) && + rte_eth_dev_socket_id(portid) != SOCKET_ID_ANY) { printf("Skip port %d\n", portid); continue; }