[ovs-dev] [PATCH] vswitchd: skip right number of arguments in dpdk_init()

Ryan Wilson wryan at nicira.com
Mon Jun 23 21:11:46 UTC 2014


From: Daniele Di Proietto <ddiproietto at vmware.com>

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 at vmware.com>
Signed-off-by: Ryan Wilson <wryan at nicira.com>
---
 lib/netdev-dpdk.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index fbdb6b3..fb8d953 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -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
-- 
1.7.9.5




More information about the dev mailing list