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>
This commit is contained in:
Marc Sune 2015-06-18 18:34:48 +02:00 committed by Thomas Monjalon
parent 9c6dfcb720
commit 3913d96a04

View File

@ -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);