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 13490A00C3 for ; Tue, 16 Aug 2022 22:08:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8986E40691; Tue, 16 Aug 2022 22:08:38 +0200 (CEST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by mails.dpdk.org (Postfix) with ESMTP id 701B540150 for ; Tue, 16 Aug 2022 22:08:37 +0200 (CEST) Received: by mail-lj1-f169.google.com with SMTP id x10so11617410ljq.4 for ; Tue, 16 Aug 2022 13:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc; bh=+zeMtqVhU11hGBY4PnY24WRWHqQUdN67txxZqmXvWvs=; b=MJFxaON10Gtj8p62Q3wMvo3Q0GPocbq9vImnuIR7TBsTpgfXTrYAUcPDK/VVrikyll V5B1hHoSOZNegcRvD2pMfUGNAmSOJ9QFFdv3UKQUCsi/v+1HEOjzAniUFfrfHfNB5l7k RRezWfmx0wMCH6vjcZdX4tUSugE32PeLVF09GGDLIs9L3o7r8NFuLnZe3Q0u7SbXhLWl qjwfCj2ygtHq6SjsxVtUq8siLrcDIf+nYAm3A++Dqdz6eNqWqChoXJhKAGCkBU8+c9bv FcayBUCZDW2mJ1WV62cTqsVrSkHQg5xNHzwhqhViLui2S3iYFAOWunSQh2S+sk4Wzxbu AXBw== 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:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=+zeMtqVhU11hGBY4PnY24WRWHqQUdN67txxZqmXvWvs=; b=VCf9cK31TjJV6GBotflzXR7Dlux+6w7KjkCB/6Y52JN5HWw1N1ZQWIDSLbM3XRVN0F vTQC2felFNwiOx93s2rOlA9pxXyuJfoORrkXYjX3RIRUjOS7e9tvzsA6SZTdIiUaQw9a 4lrY0AVyOXdhmw4KeTTle/nTXxdl/m0fsscp1ZzNb1erPurqgxJTCa0qPBi1BC5NnP6u UCHrjJPigOwWP3YcA5jZvuS224hz5QrbB1j6hD9cMQxNZUAWujMVgdQMHQjEW29QeFOl sZfUTilwOluT1pNEGdJf5yXy2kLsgh8kJMbLXmt7/Cu3wBkYLxGejPHRT6CaefMvg/IE W4hQ== X-Gm-Message-State: ACgBeo0bTir5GwixEwqNaWFRF3v/6tEtQ8cd7s7Lp/NhpEgybeobGDRr /XLwQPEs8chh3E+J1dmPIKA= X-Google-Smtp-Source: AA6agR7/MmyLfh2MvDFMoVFEn/Wst7sR5kuWc9WAjyWWdvyaaq2F7AG8VRQqXAaHGBiwESCVEzZsUw== X-Received: by 2002:a2e:7802:0:b0:25e:c926:c5ef with SMTP id t2-20020a2e7802000000b0025ec926c5efmr7215113ljc.360.1660680516728; Tue, 16 Aug 2022 13:08:36 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id j21-20020ac253b5000000b0048b124b070asm1475334lfh.173.2022.08.16.13.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:08:36 -0700 (PDT) Date: Tue, 16 Aug 2022 23:08:34 +0300 From: Dmitry Kozlyuk To: Danil Onishchenko Cc: users@dpdk.org Subject: Re: rte_eth_dev_socket_id return Message-ID: <20220816230834.751a2288@sovereign> In-Reply-To: References: X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org 2022-08-14 15:36 (UTC+0700), Danil Onishchenko: > Hello, > > I faced a confusing behavior of rte_eth_dev_socket_id() function. In my > application I configured eth port and if after that I call > rte_eth_dev_socket_id(port) it returns -1. In documentation of the > function it is said "Returns: The NUMA socket ID to which the Ethernet > device is connected or a default of zero if the socket could not be > determined. -1 is returned is the port_id value is out of range.". > However if call rte_eth_dev_is_valid_port(port) with the same port id it > returns 1. The documentation of this function says "Returns: 0 if port > is out of range or not attached, 1 if device is attached". It looks like > this functions can't return -1 and 1 respectively for the same port > number. Are there any other cases when the first one can return -1? Hi Danil, This function returns whatever the bus driver discovers. Assuming Linux and PCI, the bus driver reads /sys/bus/pci/devices//numa_node Does this file contain "-1" for your device? It's a DPDK bug anyway that documentation doesn't match behavior. Relevant bus driver code: /* get numa node, default to 0 if not present */ snprintf(filename, sizeof(filename), "%s/numa_node", dirname); if (access(filename, F_OK) != -1) { if (eal_parse_sysfs_value(filename, &tmp) == 0) dev->device.numa_node = tmp; else dev->device.numa_node = -1; } else { dev->device.numa_node = 0; }