diff options
author | Aaron Conole <aconole@redhat.com> | 2016-12-09 11:22:28 -0500 |
---|---|---|
committer | Daniele Di Proietto <diproiettod@vmware.com> | 2016-12-21 17:50:07 -0800 |
commit | 71e2a07ad0b694a87ce6d6b4cd218ae9a1cab6a9 (patch) | |
tree | da848e25ec333d84e4c752890b55e9e6f1d25d67 /lib/dpdk.c | |
parent | 7967bc775ce3aa90c2beb61ff25c392cbdaec961 (diff) | |
download | openvswitch-71e2a07ad0b694a87ce6d6b4cd218ae9a1cab6a9.tar.gz |
lib/dpdk: No more deferred release
DPDK documentation is recently updated to reflect that DPDK does not
hold any references to, nor take ownership of, the argv/argc elements.
With that understanding, let's just release the memory asap.
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'lib/dpdk.c')
-rw-r--r-- | lib/dpdk.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/dpdk.c b/lib/dpdk.c index 28f3485af..ee4360b22 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -250,11 +250,8 @@ get_dpdk_args(const struct smap *ovs_other_config, char ***argv, return i + extra_argc; } -static char **dpdk_argv, **dpdk_argv_release; -static int dpdk_argc; - static void -deferred_argv_release(void) +argv_release(char **dpdk_argv, char **dpdk_argv_release, size_t dpdk_argc) { int result; for (result = 0; result < dpdk_argc; ++result) { @@ -268,7 +265,7 @@ deferred_argv_release(void) static void dpdk_init__(const struct smap *ovs_other_config) { - char **argv = NULL; + char **argv = NULL, **argv_to_release = NULL; int result; int argc, argc_tmp; bool auto_determine = true; @@ -367,9 +364,9 @@ dpdk_init__(const struct smap *ovs_other_config) ds_destroy(&eal_args); } - dpdk_argv_release = grow_argv(&dpdk_argv_release, 0, argc); + argv_to_release = grow_argv(&argv_to_release, 0, argc); for (argc_tmp = 0; argc_tmp < argc; ++argc_tmp) { - dpdk_argv_release[argc_tmp] = argv[argc_tmp]; + argv_to_release[argc_tmp] = argv[argc_tmp]; } /* Make sure things are initialized ... */ @@ -377,6 +374,7 @@ dpdk_init__(const struct smap *ovs_other_config) if (result < 0) { ovs_abort(result, "Cannot init EAL"); } + argv_release(argv, argv_to_release, argc); /* Set the main thread affinity back to pre rte_eal_init() value */ if (auto_determine && !err) { @@ -387,11 +385,6 @@ dpdk_init__(const struct smap *ovs_other_config) } } - dpdk_argv = argv; - dpdk_argc = argc; - - atexit(deferred_argv_release); - rte_memzone_dump(stdout); /* We are called from the main thread here */ |