diff mbox

[ibsim] umad2sim/umad2sim.c: Fix ibsim for latest libibumad in rdma-core

Message ID 83fbc732-22e9-25ee-6e25-f3b80dff79ba@dev.mellanox.co.il (mailing list archive)
State Not Applicable
Delegated to: Ira Weiny
Headers show

Commit Message

Hal Rosenstock May 17, 2018, 1:23 p.m. UTC
With the latest rdma-core libibumad with following patch:

commit abf72057c27750275d0668375d30c4971911d041
Author: Jason Gunthorpe <jgg@mellanox.com>
Date:   Thu Apr 5 11:04:14 2018 -0600

    umad: Do not check for umad sysfs files in umad_init

    Now that we don't load the umad module if the HW doesn't use it (eg
    for roce only hardware) umad_init is failing to read the ABI version
    from the kernel.

    Applications still want to use some libibumad services that are not
    related to the char device, so move the version check to umad_open_port
    instead.

    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

ibstat and OpenSM no longer work with ibsim as no local IB
devices are found.

Fix this by having scandir initialize umad2sim if not already
initialized. This creates the needed client specific sysfs files.

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 umad2sim/umad2sim.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/umad2sim/umad2sim.c b/umad2sim/umad2sim.c
index 90b1c73..84ab84f 100644
--- a/umad2sim/umad2sim.c
+++ b/umad2sim/umad2sim.c
@@ -737,6 +737,12 @@  int scandir(const char *path, struct dirent ***namelist,
 	char new_path[4096];
 
 	CHECK_INIT();
+
+	if (!umad2sim_initialized && (is_sysfs_file(path) ||
+				      !strncmp(path, umad_dev_dir,
+					       strlen(umad_dev_dir))))
+		umad2sim_init();
+
 	DEBUG("libs_wrap: scandir: %s...\n", path);
 
 	if (is_sysfs_file(path)) {