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 91447A00C2 for ; Wed, 24 Aug 2022 10:29:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CACC415D7; Wed, 24 Aug 2022 10:29:24 +0200 (CEST) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by mails.dpdk.org (Postfix) with ESMTP id 131DF40694 for ; Mon, 22 Aug 2022 13:31:13 +0200 (CEST) Received: by mail-lf1-f47.google.com with SMTP id a16so6517081lfs.3 for ; Mon, 22 Aug 2022 04:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=1cz88fz9wPjxcK8ZnjPBQ0kd9Hc8gYO50wzHk9xH0iQ=; b=a1n15RsZMHxKGBZAKjEVp1hzOq+PXT46tNTlGxQaay7nDh8x+iuUb5Y4WIV0j4Q8F5 INJoiwmWN7Nu4VlcaZldUOqYRBoLMKAvXGtT1MobhaIsOj7Q6GXwwlle6ePfPyXsnrGd paheUfGKFIPzfkkbKYv8bFizmQ8vXwWId0fUcRssb9HKFxUA2bhx3TZgsM4RDHdj/hxt 6wxVWdNUNR8NQLvObs5HFnxJYRjgrI4DB6GLPykh0iX67nfjSlfQYiWAqKps+kI/akuL PVrn1CxzHNVDimSc0Kf0IQWhEZEJvtnm66TtHQHLb3Q6NXXwbNblyeymWgY4bojT6WMM h20Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=1cz88fz9wPjxcK8ZnjPBQ0kd9Hc8gYO50wzHk9xH0iQ=; b=2zIP6FNykgj1zeJ/SiZfTo23UbJB0MSAznL6RpldzDBtHxYw8BtGgDC4cjbTzSQa64 b5ahzX8S+XIgKJDY8ah5tPeTJFkh0/0VZpn9VDGs88undtF1Kd4ybjWX/zVPGcpZaQ+n HAkdMv/2qmbrwEOI8xqfiHvL7dC7Dmba6iakXvUGI/7AQRaukMN4Zqr3NFiv1XbtypqL u+VY0wIKeeJHKkN2ixKv70MX1nZ1gPqf/mxvSY3C6B4qi7q21O7PF8DV2eb8PPt1yr0x SpwKxu8NJ5Rjs9oT3PU9UdObqMl5k4sajs0iCx6T2j+YJImAwPwPbw5hz4YyYeniF0MD s8EA== X-Gm-Message-State: ACgBeo3KJJoeJd0ZYoWkKyFirrcvOGNcDQltVi9odCOY/TkYuJzQu1Nq qgNz+yMcc1zQa5Uph0yatU4= X-Google-Smtp-Source: AA6agR7w8jZcmWsn7uSwEqBThFy4SArF6b/YO6zeyswWrgOy4uLKhUUzfyyBsKv6aEZSeB63c+NU9A== X-Received: by 2002:a05:6512:130d:b0:492:8b65:3785 with SMTP id x13-20020a056512130d00b004928b653785mr7425848lfu.351.1661167872453; Mon, 22 Aug 2022 04:31:12 -0700 (PDT) Received: from [10.8.0.210] ([185.66.85.140]) by smtp.gmail.com with ESMTPSA id b14-20020a056512070e00b00492cfd5a4cfsm1308067lfs.203.2022.08.22.04.31.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Aug 2022 04:31:11 -0700 (PDT) Message-ID: <73fb9185-7a9c-063e-1c79-078bd34d67a7@gmail.com> Date: Mon, 22 Aug 2022 18:31:05 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: rte_eth_dev_socket_id return Content-Language: en-US To: Dmitry Kozlyuk Cc: users@dpdk.org References: <20220816230834.751a2288@sovereign> From: Danil Onishchenko In-Reply-To: <20220816230834.751a2288@sovereign> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 24 Aug 2022 10:29:22 +0200 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 Hi Dmitry, Yes, /sys/bus/pci/devices//numa_node contains -1. On 17.08.2022 03:08, Dmitry Kozlyuk wrote: > 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; > }