summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2019-03-12 19:06:32 -0700
committerDamjan Marion <dmarion@me.com>2019-03-13 08:22:02 +0000
commit485710e0b7b81e7ee511cc227a8bbca19b1ecf80 (patch)
tree30d5c1e0e3d5aefabb075a543ea132dd4a98ed70 /src
parentc599c6f001bc28e1023fb5e74a27db37b1aae847 (diff)
vmbus: not having uio_hv_generic is not an error
If uio_hv_generic is not loaded, then the startup code will fallback to the older failsafe/tap method of initialization in DPDK. Therefore don't put out scary message in the log. Also, reorder startup to avoid manipulating lower device until/unless uio is going to work. Change-Id: Ie1cc77b4b5359c04f00a93d01a772eccf3bbab37 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/linux/vmbus.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/vlib/linux/vmbus.c b/src/vlib/linux/vmbus.c
index 2dba8025326..a359c10a71f 100644
--- a/src/vlib/linux/vmbus.c
+++ b/src/vlib/linux/vmbus.c
@@ -199,6 +199,16 @@ done:
return error;
}
+static int
+directory_exists (char *path)
+{
+ struct stat s = { 0 };
+ if (stat (path, &s) == -1)
+ return 0;
+
+ return S_ISDIR (s.st_mode);
+}
+
clib_error_t *
vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr)
{
@@ -223,6 +233,10 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr)
if (!driver_name || strcmp ("hv_netvsc", (char *) driver_name) != 0)
goto done;
+ /* if uio_hv_generic is not loaded, then can't use native DPDK driver. */
+ if (!directory_exists ("/sys/module/uio_hv_generic"))
+ goto done;
+
s = format (s, "%v/net%c", dev_dir_name, 0);
dir = opendir ((char *) s);
vec_reset_length (s);
@@ -277,13 +291,6 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr)
goto done;
}
- error = vlib_vmbus_raise_lower (fd, ifname);
- close (fd);
-
- if (error)
- goto done;
-
-
/* tell uio_hv_generic about netvsc device type */
if (uio_new_id_needed)
{
@@ -298,6 +305,12 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr)
}
+ error = vlib_vmbus_raise_lower (fd, ifname);
+ close (fd);
+
+ if (error)
+ goto done;
+
/* prefer the simplier driver_override model */
vec_reset_length (s);
s = format (s, "%/driver_override%c", dev_dir_name, 0);