net/af_xdp: avoid error log for virtual interfaces

Message ID 20231027143241.538670-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/af_xdp: avoid error log for virtual interfaces |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

David Marchand Oct. 27, 2023, 2:32 p.m. UTC
  For virtual interfaces, like a veth or a tap used in OVS unit tests,
plugging a af_xdp port on them results in an error level message:

dpdk|ERR|EAL: eal_parse_sysfs_value(): cannot open sysfs value
	/sys/class/net/ovs-tap1/device/numa_node
netdev_dpdk|INFO|Device 'net_af_xdptap1,iface=ovs-tap1' attached to DPDK

Avoid this error by checking if the sysfs file exists, like what is done
in DPDK bus drivers using eal_parse_sysfs_value().

Fixes: 3d28387cbc48 ("net/af_xdp: parse NUMA node ID from sysfs")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Oct. 27, 2023, 8:37 p.m. UTC | #1
On 10/27/2023 3:32 PM, David Marchand wrote:
> For virtual interfaces, like a veth or a tap used in OVS unit tests,
> plugging a af_xdp port on them results in an error level message:
> 
> dpdk|ERR|EAL: eal_parse_sysfs_value(): cannot open sysfs value
> 	/sys/class/net/ovs-tap1/device/numa_node
> netdev_dpdk|INFO|Device 'net_af_xdptap1,iface=ovs-tap1' attached to DPDK
> 
> Avoid this error by checking if the sysfs file exists, like what is done
> in DPDK bus drivers using eal_parse_sysfs_value().
> 
> Fixes: 3d28387cbc48 ("net/af_xdp: parse NUMA node ID from sysfs")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 0cc51223ba..353c8688ec 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -2399,7 +2399,7 @@  rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 
 		snprintf(numa_path, sizeof(numa_path), "/sys/class/net/%s/device/numa_node",
 			 if_name);
-		if (eal_parse_sysfs_value(numa_path, &numa) != 0)
+		if (access(numa_path, R_OK) != 0 || eal_parse_sysfs_value(numa_path, &numa) != 0)
 			dev->device.numa_node = rte_socket_id();
 		else
 			dev->device.numa_node = numa;