From: Marc Sune Date: Thu, 18 Jun 2015 16:34:48 +0000 (+0200) Subject: kni: ignore double initialization X-Git-Tag: spdx-start~9014 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3913d96a04fc01b483a3ad4fd06472bb3690cf1d;p=dpdk.git kni: ignore double initialization Prevent double initialization of the KNI subsytem. Signed-off-by: Marc Sune Acked-by: Helin Zhang --- diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index c5a008996f..08155dbdfa 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);