summaryrefslogtreecommitdiff
path: root/lib/librte_kni/rte_kni.c
diff options
context:
space:
mode:
authorMarc Sune <marc.sune@bisdn.de>2015-06-18 18:34:48 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-06-22 18:39:40 +0200
commit3913d96a04fc01b483a3ad4fd06472bb3690cf1d (patch)
tree1097c5ff5451a23a83f53c20d727cb6519871a76 /lib/librte_kni/rte_kni.c
parent9c6dfcb720806dbded289d9aecb26f02f001dd49 (diff)
downloaddpdk-3913d96a04fc01b483a3ad4fd06472bb3690cf1d.zip
dpdk-3913d96a04fc01b483a3ad4fd06472bb3690cf1d.tar.gz
dpdk-3913d96a04fc01b483a3ad4fd06472bb3690cf1d.tar.xz
kni: ignore double initialization
Prevent double initialization of the KNI subsytem. Signed-off-by: Marc Sune <marc.sune@bisdn.de> Acked-by: Helin Zhang <helin.zhang@intel.com>
Diffstat (limited to 'lib/librte_kni/rte_kni.c')
-rw-r--r--lib/librte_kni/rte_kni.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index c5a0089..08155db 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -201,6 +201,12 @@ rte_kni_init(unsigned int max_kni_ifaces)
char obj_name[OBJNAMSIZ];
char mz_name[RTE_MEMZONE_NAMESIZE];
+ /* Immediately return if KNI is already initialized */
+ if (kni_memzone_pool.initialized) {
+ RTE_LOG(WARNING, KNI, "Double call to rte_kni_init()");
+ return;
+ }
+
if (max_kni_ifaces == 0) {
RTE_LOG(ERR, KNI, "Invalid number of max_kni_ifaces %d\n",
max_kni_ifaces);