DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: ignore double calls to rte_kni_init()
@ 2015-06-01  0:32 Marc Sune
  2015-06-15  1:08 ` Zhang, Helin
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Sune @ 2015-06-01  0:32 UTC (permalink / raw)
  To: dev

Prevent double initialization of the KNI subsytem.

Signed-off-by: Marc Sune <marc.sune@bisdn.de>
---
 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);
-- 
2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: ignore double calls to rte_kni_init()
  2015-06-01  0:32 [dpdk-dev] [PATCH] kni: ignore double calls to rte_kni_init() Marc Sune
@ 2015-06-15  1:08 ` Zhang, Helin
  2015-06-18 16:34   ` [dpdk-dev] [PATCH v2] " Marc Sune
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Helin @ 2015-06-15  1:08 UTC (permalink / raw)
  To: Marc Sune, thomas.monjalon; +Cc: dev

Hi Marc

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Marc Sune
> Sent: Monday, June 1, 2015 8:33 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] kni: ignore double calls to rte_kni_init()
> 
> Prevent double initialization of the KNI subsytem.
> 
> Signed-off-by: Marc Sune <marc.sune@bisdn.de>
> ---
>  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;
I'd prefer to have a debug log before returning out, as there is no error code for it.
Thanks,
Helin

> +
>  	if (max_kni_ifaces == 0) {
>  		RTE_LOG(ERR, KNI, "Invalid number of max_kni_ifaces %d\n",
>  							max_kni_ifaces);
> --
> 2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] kni: ignore double calls to rte_kni_init()
  2015-06-15  1:08 ` Zhang, Helin
@ 2015-06-18 16:34   ` Marc Sune
  2015-06-19  3:47     ` Zhang, Helin
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Sune @ 2015-06-18 16:34 UTC (permalink / raw)
  To: dev

Prevent double initialization of the KNI subsytem.

v2: added warning trace

Signed-off-by: Marc Sune <marc.sune@bisdn.de>
---
 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] kni: ignore double calls to rte_kni_init()
  2015-06-18 16:34   ` [dpdk-dev] [PATCH v2] " Marc Sune
@ 2015-06-19  3:47     ` Zhang, Helin
  2015-06-22 16:40       ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Helin @ 2015-06-19  3:47 UTC (permalink / raw)
  To: Marc Sune; +Cc: dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Marc Sune
> Sent: Friday, June 19, 2015 12:35 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] kni: ignore double calls to rte_kni_init()
> 
> Prevent double initialization of the KNI subsytem.
> 
> v2: added warning trace
> 
> Signed-off-by: Marc Sune <marc.sune@bisdn.de>
Acked-by: Helin Zhang <helin.zhang@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] kni: ignore double calls to rte_kni_init()
  2015-06-19  3:47     ` Zhang, Helin
@ 2015-06-22 16:40       ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2015-06-22 16:40 UTC (permalink / raw)
  To: Marc Sune; +Cc: dev

> > Prevent double initialization of the KNI subsytem.
> > 
> > v2: added warning trace
> > 
> > Signed-off-by: Marc Sune <marc.sune@bisdn.de>
> Acked-by: Helin Zhang <helin.zhang@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-22 16:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01  0:32 [dpdk-dev] [PATCH] kni: ignore double calls to rte_kni_init() Marc Sune
2015-06-15  1:08 ` Zhang, Helin
2015-06-18 16:34   ` [dpdk-dev] [PATCH v2] " Marc Sune
2015-06-19  3:47     ` Zhang, Helin
2015-06-22 16:40       ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).