From patchwork Mon Oct 24 07:12:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 118977 X-Patchwork-Delegate: david.marchand@redhat.com 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 A9A9BA00C5; Mon, 24 Oct 2022 09:12:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44B974113C; Mon, 24 Oct 2022 09:12:29 +0200 (CEST) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mails.dpdk.org (Postfix) with ESMTP id 9D76840E5A for ; Mon, 24 Oct 2022 09:12:27 +0200 (CEST) Received: by mail-wm1-f47.google.com with SMTP id v11so6008798wmd.1 for ; Mon, 24 Oct 2022 00:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WpQQwJB3WU0HmW0QJBuhASa6CIVCs1JgJLjDKarI4Jc=; b=fuORXWlB9igGXzVX4NXDK5HlQwPMPtfQDsAkYhqWBhE8SCHxY841uAyKgpGy25jANe HnPk/W8psIE0IBIW0mah7JSYSE8KmMg9ZCbDNirzURyRDCCikIXi1R4IQk2mYGnXeDuV tFZWziaWbC720SdK+/MmFJKt9PtaqEgmOnWHwJfNyLuI9QAnx0GqzSyjlfkCXJI7YNg6 8ZFcgjA/VhtdIejainUE+8NGkQSu8YEOKbfmK1BLLMNK/6JV2JdRzSQSXbTsZbs/YJmy CysLor6+7/1F+bIOdZak9weCsI8cJcFNCfd1UiArNs0VDUvuXmbzmWklIqDUfcUENB0A VQnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WpQQwJB3WU0HmW0QJBuhASa6CIVCs1JgJLjDKarI4Jc=; b=vkHp6o3wRyNl9nJbq53w+FbIYtPcpUZyOo8bIm8TENUqKZZvqZlrmBCoL9+yydlSN7 CtTsi1FZeJ0F0t32SJTMOtR7qthI10fKcsRzP9E4bCqseoOKjyMMrZd5PeJCGgGFNO/h RDiRSjyH0T4YjFCKvfiJuMtDWbKjxIWci6C6YEwvL+jUlDE6ZQSOu1nRBlkAMufAeczR 4VOrqeJsaLnIAC4lH5V/y+X1cdepzY23DUnNNyQxBwSAENcyBHSv/W9Z3uroRfd5Oudy CV1kSWp3xi8z6J1MOQJFupzJ4NL4+Jw9NoEkpjJfLVAmhwQN6+mAHB5VEC2AkV0e1RSS TgOw== X-Gm-Message-State: ACrzQf13vrOk8zyQt/2exzHm1jeVS8lBbChqgSAquG+0y1h3Fk5t6Eyp 3EayQ1wlr+5huz0f4dYPC2txv6NRfeO7mg== X-Google-Smtp-Source: AMsMyM5hy5j/Jzk1jrn+YiytFLlcH86cPBMF4LVgK0szNJE9HMWAlGS4q23iib3sYEv1UOGBJ2nAIg== X-Received: by 2002:a05:600c:1616:b0:3cd:f079:e34a with SMTP id m22-20020a05600c161600b003cdf079e34amr3685034wmn.11.1666595547288; Mon, 24 Oct 2022 00:12:27 -0700 (PDT) Received: from gojira.dev.6wind.com ([185.13.181.2]) by smtp.gmail.com with ESMTPSA id p5-20020a1c5445000000b003c71358a42dsm8705312wmi.18.2022.10.24.00.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 00:12:25 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Cc: David Marchand , linglix.chen@intel.com, yux.jiang@intel.com Subject: [PATCH v2] app/test: fix PMD perf test on devices with no socket ID Date: Mon, 24 Oct 2022 09:12:14 +0200 Message-Id: <20221024071214.20980-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221022083108.3759-1-olivier.matz@6wind.com> References: <20221022083108.3759-1-olivier.matz@6wind.com> 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 Tested-by: Lingli Chen Reviewed-by: David Marchand --- v2: * fix typo (-SOCKET_ID_ANY instead of SOCKET_ID_ANY) 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..ff84d251ff 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; }