From 9adbc5b8203f32999c737759eae70c71cb9c7f0d Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Mon, 12 Feb 2024 11:38:48 +0000 Subject: [PATCH] Make clear which drivers list we are getting Sysfs.list_drivers is returning the list of only PCI driver, so make it clear. We want to support also USB cards so this change could avoid confusions in the future. Signed-off-by: Frediano Ziglio --- ocaml/networkd/bin/network_server.ml | 2 +- ocaml/networkd/lib/network_utils.ml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ocaml/networkd/bin/network_server.ml b/ocaml/networkd/bin/network_server.ml index 2aa2ac94fc6..d31d256ef92 100644 --- a/ocaml/networkd/bin/network_server.ml +++ b/ocaml/networkd/bin/network_server.ml @@ -103,7 +103,7 @@ let set_dns_interface _dbg name = * constitutes adding a VLAN0 Linux device to strip those headers again. *) let need_enic_workaround () = - !backend_kind = Bridge && List.mem "enic" (Sysfs.list_drivers ()) + !backend_kind = Bridge && List.mem "enic" (Sysfs.list_pci_drivers ()) module Sriov = struct open S.Sriov diff --git a/ocaml/networkd/lib/network_utils.ml b/ocaml/networkd/lib/network_utils.ml index 27d23486a51..c436d9e48e0 100644 --- a/ocaml/networkd/lib/network_utils.ml +++ b/ocaml/networkd/lib/network_utils.ml @@ -143,10 +143,10 @@ let fork_script ?on_error ?log script args = check_n_run ?on_error ?log fork_script_internal script args module Sysfs = struct - let list_drivers () = + let list_pci_drivers () = try Array.to_list (Sys.readdir "/sys/bus/pci/drivers") with _ -> - warn "Failed to obtain list of drivers from sysfs" ; + warn "Failed to obtain list of PCI drivers from sysfs" ; [] let getpath dev attr = Printf.sprintf "/sys/class/net/%s/%s" dev attr