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 E2178A04FD; Mon, 12 Dec 2022 02:02:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 868844021D; Mon, 12 Dec 2022 02:02:41 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id CD44040151 for ; Mon, 12 Dec 2022 02:02:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670806960; x=1702342960; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=2uEMwizlRmTxCkXcCBOcKgKNI4OsvZJJtWLGuQHMmUY=; b=NXs96mP/phjKk97WjRh173WguWLHTUXjoVOKfs3eb4mnmW7Lucj1qhpu B0dsp/NHbchGlkTgOuDPFQxOxPwDn7pEqSjRvYr6J/wKyaNAlVOARgpKf EGUxZ74U6Ayrm1bO3s4g8j7Q0Q0bJnpVh3uA+rYIrOoU/oNNuanJ+6abm In4Jj41MR05qrhSb7rEQLDUOux8f18VpsLD+fafbs5ow+8MBrRwLtB9y9 OarK7fOTqGfQLZr6RHAYQJWzok8aw9QPF+bhJfUqcohCz8gimogIVxzPp yXy4ioYFjn2X8S694DmZs6pyvBiKmwxS/D6PIcllELLBoqtiO4vsX9u// Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10558"; a="305386375" X-IronPort-AV: E=Sophos;i="5.96,237,1665471600"; d="scan'208";a="305386375" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2022 17:02:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10558"; a="790315855" X-IronPort-AV: E=Sophos;i="5.96,237,1665471600"; d="scan'208";a="790315855" Received: from media-frankdu-kahawai-node2.sh.intel.com ([10.67.119.73]) by fmsmga001.fm.intel.com with ESMTP; 11 Dec 2022 17:02:37 -0800 From: Frank Du To: dev@dpdk.org Subject: [PATCH] net/af_xdp: parse numa node id from sysfs Date: Mon, 12 Dec 2022 08:48:57 +0800 Message-Id: <20221212004857.2004805-1-frank.du@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Get from /sys/class/net/{if}/device/numa_node. Signed-off-by: Frank Du --- drivers/net/af_xdp/rte_eth_af_xdp.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index b6ec9bf490..38b9d36ab5 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -39,6 +39,7 @@ #include #include "compat.h" +#include "eal_filesystem.h" #ifndef SO_PREFER_BUSY_POLL #define SO_PREFER_BUSY_POLL 69 @@ -2038,9 +2039,6 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) return -EINVAL; } - if (dev->device.numa_node == SOCKET_ID_ANY) - dev->device.numa_node = rte_socket_id(); - if (parse_parameters(kvlist, if_name, &xsk_start_queue_idx, &xsk_queue_cnt, &shared_umem, prog_path, &busy_budget, &force_copy) < 0) { @@ -2053,6 +2051,19 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) return -EINVAL; } + /* get numa node id from net sysfs */ + if (dev->device.numa_node == SOCKET_ID_ANY) { + unsigned long numa = 0; + char numa_path[PATH_MAX]; + + snprintf(numa_path, sizeof(numa_path), "/sys/class/net/%s/device/numa_node", + if_name); + if (eal_parse_sysfs_value(numa_path, &numa) != 0) + dev->device.numa_node = rte_socket_id(); + else + dev->device.numa_node = numa; + } + busy_budget = busy_budget == -1 ? ETH_AF_XDP_DFLT_BUSY_BUDGET : busy_budget; -- 2.34.1