From patchwork Thu May 28 09:12:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Sune X-Patchwork-Id: 4930 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 8F07D378B; Thu, 28 May 2015 11:12:19 +0200 (CEST) Received: from mx.bisdn.de (mx.bisdn.de [185.27.182.31]) by dpdk.org (Postfix) with ESMTP id B6E572A07 for ; Thu, 28 May 2015 11:12:17 +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 7BCE7A23F3; Thu, 28 May 2015 11:12:17 +0200 (CEST) From: Marc Sune To: dev@dpdk.org Date: Thu, 28 May 2015 11:12:14 +0200 Message-Id: <1432804334-1981-1-git-send-email-marc.sune@bisdn.de> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Prevent double initialization of the KNI subsytem. Signed-off-by: Marc Sune --- lib/librte_kni/rte_kni.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index c5a0089..df0449f 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -201,6 +201,10 @@ 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) + return; + if (max_kni_ifaces == 0) { RTE_LOG(ERR, KNI, "Invalid number of max_kni_ifaces %d\n", max_kni_ifaces);