DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Calling rte_eal_init multiple times in the same process
@ 2014-04-17  9:09 Tomas Vestelind
  2014-04-17  9:44 ` Thomas Monjalon
  2014-04-17 11:06 ` Neil Horman
  0 siblings, 2 replies; 3+ messages in thread
From: Tomas Vestelind @ 2014-04-17  9:09 UTC (permalink / raw)
  To: dev

Dear all,

I'm not sure who to address with this email so I'll just present my problem and my suggested solution.

The problem I'm facing is that I need to do rte_eal_init serveral times in the same process. The reason for this is mostly architectural as we want to divide certain functionality in to different, implementation independent, modules in which DPDK would be used for different purposes. Thus we would need to eventually call rte_eal_init several times because we can't say for sure if it has been called by another module or not.

While thinking about it I saw no good, existing solution to this (I might have missed it though). Would returning a "DPDK has already been initialized" error code in rte_eal_init be a good way to go about it? I haven't done this yet but I could probably provide a patch if it's interesting.

Thank you for your time and a very nice framework with good documentation!

BR,
Tomas

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

* Re: [dpdk-dev] Calling rte_eal_init multiple times in the same process
  2014-04-17  9:09 [dpdk-dev] Calling rte_eal_init multiple times in the same process Tomas Vestelind
@ 2014-04-17  9:44 ` Thomas Monjalon
  2014-04-17 11:06 ` Neil Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2014-04-17  9:44 UTC (permalink / raw)
  To: Tomas Vestelind; +Cc: dev

Hello,

2014-04-17 09:09, Tomas Vestelind:
> The problem I'm facing is that I need to do rte_eal_init serveral times in
> the same process. The reason for this is mostly architectural as we want to
> divide certain functionality in to different, implementation independent,
> modules in which DPDK would be used for different purposes. Thus we would
> need to eventually call rte_eal_init several times because we can't say for
> sure if it has been called by another module or not.
> 
> While thinking about it I saw no good, existing solution to this (I might
> have missed it though). Would returning a "DPDK has already been
> initialized" error code in rte_eal_init be a good way to go about it? I
> haven't done this yet but I could probably provide a patch if it's
> interesting.

Don't hesitate to submit a patch. It's far easier to discuss on a patch basis.
If your patch fill your need and nobody complains about it, it will be 
accepted.

-- 
Thomas

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

* Re: [dpdk-dev] Calling rte_eal_init multiple times in the same process
  2014-04-17  9:09 [dpdk-dev] Calling rte_eal_init multiple times in the same process Tomas Vestelind
  2014-04-17  9:44 ` Thomas Monjalon
@ 2014-04-17 11:06 ` Neil Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2014-04-17 11:06 UTC (permalink / raw)
  To: Tomas Vestelind; +Cc: dev

On Thu, Apr 17, 2014 at 09:09:44AM +0000, Tomas Vestelind wrote:
> Dear all,
> 
> I'm not sure who to address with this email so I'll just present my problem and my suggested solution.
> 
> The problem I'm facing is that I need to do rte_eal_init serveral times in the same process. The reason for this is mostly architectural as we want to divide certain functionality in to different, implementation independent, modules in which DPDK would be used for different purposes. Thus we would need to eventually call rte_eal_init several times because we can't say for sure if it has been called by another module or not.
> 
> While thinking about it I saw no good, existing solution to this (I might have missed it though). Would returning a "DPDK has already been initialized" error code in rte_eal_init be a good way to go about it? I haven't done this yet but I could probably provide a patch if it's interesting.
> 
> Thank you for your time and a very nice framework with good documentation!
> 
> BR,
> Tomas
> 


You already (more or less) have that.  rte_eal_init panics or calls exit() if
something goes wrong during initialization.  If all goes well it returns 0.  The
only time that it returns with something else is if this code at the top of the
function fails:

if (!rte_atomic32_test_and_set(&run_once))
                return -1;

Thats there to specifically gate the init routine so it only gets called once.
All your code needs to do is check the return for -1.  Thats your indicator that
its already been initalized.  Anything >= 0 is success, and if your program
crashes, thats a problem :)

Neil

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

end of thread, other threads:[~2014-04-17 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17  9:09 [dpdk-dev] Calling rte_eal_init multiple times in the same process Tomas Vestelind
2014-04-17  9:44 ` Thomas Monjalon
2014-04-17 11:06 ` Neil Horman

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).