From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx.bisdn.de (mx.bisdn.de [185.27.182.31]) by dpdk.org (Postfix) with ESMTP id 7BC92C752 for ; Thu, 18 Jun 2015 18:34:54 +0200 (CEST) Received: from localhost.localdomain (unknown [172.16.250.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mx.bisdn.de (Postfix) with ESMTPSA id 30B0BA3049; Thu, 18 Jun 2015 18:34:54 +0200 (CEST) From: Marc Sune To: dev@dpdk.org Date: Thu, 18 Jun 2015 18:34:48 +0200 Message-Id: <1434645288-5753-1-git-send-email-marc.sune@bisdn.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2] kni: ignore double calls to rte_kni_init() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 16:34:54 -0000 Prevent double initialization of the KNI subsytem. v2: added warning trace Signed-off-by: Marc Sune --- lib/librte_kni/rte_kni.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.1.4