Hi, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > Sent: mercoled? 2 settembre 2015 15:10 > To: Montorsi, Francesco <fmontorsi at empirix.com> > Cc: dev at dpdk.org; Bruce Richardson <bruce.richardson at intel.com> > Subject: Re: [dpdk-dev] rte_eal_init() alternative? > > 2015-09-02 13:56, Bruce Richardson: > > On Wed, Sep 02, 2015 at 12:49:40PM +0000, Montorsi, Francesco wrote: > > > Hi all, > > > > > > Currently it seems that the only way to initialize EAL is using > > > rte_eal_init() > function, correct? > > > > > > I have the problem that rte_eal_init() will call rte_panic() whenever > something fails to initialize or in other cases it will call exit(). > > > In my application, I would rather like to attempt DPDK initialization. If > > > it > fails I don't want to exit. > > > Unfortunately I cannot even copy&paste the rte_eal_init() code into my > application (removing rte_panic and exit calls) since it uses a lot of DPDK > internal private functions. > > > > > > I think that my requirements (avoid abort/exit calls when init fails) is a > basic requirement... would you accept a patch that adds an alternative > rte_eal_init() function that just returns an error code upon failure, instead > of > immediately exiting? > > > > > > Thanks for your hard work! > > > > > > Francesco Montorsi > > > > > I, for one, would welcome such a patch. I think the code is overly > > quick in many places to panic or exit the app, when an error code would be > more appropriate. > > Feel free to also look at other libraries in DPDK too, if you like :-) > > Yes but please, do not create an alternative init function. > We just need to replace panic/exit with error codes and be sure that apps > and examples handle them correctly.
To maintain compatibility with existing applications I think that perhaps the best would be to have a core initialization function rte_eal_init_raw() that never calls rte_panic() and returns an error code. Then we can maintain compatibility having an rte_eal_init() function that does call rte_panic() if rte_eal_init_raw() fails. Something like the attached patch. Note that the attached patch exposes also a way to skip the argv/argc configuration process by directly providing a populated configuration structure... Let me know what you think about it (the patch is just a draft and needs more work). Thanks, Francesco