vswitchd: skip right number of arguments in dpdk_init()
authorDaniele Di Proietto <ddiproietto@vmware.com>
Mon, 23 Jun 2014 21:11:46 +0000 (14:11 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Mon, 23 Jun 2014 21:41:09 +0000 (14:41 -0700)
rte_eal_init() returns the number of parsed dpdk arguments to skip.
dpdk_init() should add 1 to that number, because it has already skipped
the "--dpdk" argument itself.

This patch also makes sure the program name is ovs-vswitchd in
rte_eal_init() and proctitle_init().

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/netdev-dpdk.c

index fbdb6b3..fb8d953 100644 (file)
@@ -1179,9 +1179,12 @@ dpdk_init(int argc, char **argv)
 {
     int result;
 
-    if (strcmp(argv[1], "--dpdk"))
+    if (argc < 2 || strcmp(argv[1], "--dpdk"))
         return 0;
 
+    /* Make sure program name passed to rte_eal_init() is vswitchd. */
+    argv[1] = argv[0];
+
     argc--;
     argv++;
 
@@ -1193,7 +1196,10 @@ dpdk_init(int argc, char **argv)
     rte_memzone_dump();
     rte_eal_init_ret = 0;
 
-    return result;
+    if (argc > result)
+        argv[result] = argv[0];
+
+    return result + 1;
 }
 
 void