diff options
author | Jeff Squyres <jsquyres@cisco.com> | 2015-05-12 07:14:28 -0700 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-07-29 11:56:01 -0400 |
commit | 54883e413d4c40508e25f447daf5430d2f00cb82 (patch) | |
tree | f9d0e21be7611fefc98553015dda139fbe8511d1 | |
parent | 252749ced9cacc991f116ebc99d4f5e4e15e55cc (diff) | |
download | libibverbs-54883e413d4c40508e25f447daf5430d2f00cb82.tar.gz |
libibverbs init.c: conditionally emit warning if no userspace driver found
It's not a warning or an error if libibverbs cannot find a userspace
driver for kernel devices. Indeed, returning a num_devices of is
sufficient -- the middleware shouldn't be unconditionally printing out
stderr message; let the upper layer application do that (if it wants
to).
For debugging purposes, if the environment variable IBV_SHOW_WARNINGS
is set (to any value), warnings will be emitted to stderr if a
corresponding userspace driver cannot be found for a kernel device.
Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | man/ibv_get_device_list.3 | 6 | ||||
-rw-r--r-- | src/init.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/man/ibv_get_device_list.3 b/man/ibv_get_device_list.3 index 16cc1a0..96de554 100644 --- a/man/ibv_get_device_list.3 +++ b/man/ibv_get_device_list.3 @@ -50,6 +50,12 @@ Client code should open all the devices it intends to use with Once it frees the array with .B ibv_free_device_list()\fR, it will be able to use only the open devices; pointers to unopened devices will no longer be valid. +.P +Setting the environment variable +.BR IBV_SHOW_WARNINGS +will cause warnings to be emitted to stderr if a kernel verbs device +is discovered, but no corresponding userspace driver can be found for +it. .SH "SEE ALSO" .BR ibv_fork_init (3), .BR ibv_get_device_name (3), @@ -561,7 +561,7 @@ out: next_dev = sysfs_dev ? sysfs_dev->next : NULL; sysfs_dev; sysfs_dev = next_dev, next_dev = sysfs_dev ? sysfs_dev->next : NULL) { - if (!sysfs_dev->have_driver) { + if (!sysfs_dev->have_driver && getenv("IBV_SHOW_WARNINGS")) { fprintf(stderr, PFX "Warning: no userspace device-specific " "driver found for %s\n", sysfs_dev->sysfs_path); if (statically_linked) |