From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Sune Subject: Non-argv dependant rte_eal_init() call Date: Thu, 01 Aug 2013 17:37:35 +0200 Message-ID: <51FA80BF.2020801@bisdn.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable To: dev-VfR2kkLFssw@public.gmane.org Return-path: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Dear all, Sorry in advance if there is another API for this and I haven't found=20 it, or if there is a strong reason for having it this way. I've seen=20 that in the case of both baremetal and Linux applications, the way to=20 initialize EAL is passing argv: //... /* init EAL */ ret =3D rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n"); argc -=3D ret; argv +=3D ret; //... However, this is a little bit annoying in the case of GNU/Linux=20 user-space applications, hence using DPDK as a library, when porting=20 them to DPDK (specially in case of multi-platform applications, like in=20 our case), since they are not necessarily designed to be changing the=20 main routines in a per platform basis. In our case they are even in=20 separate autotools package, since the library providing DPDK based=20 services needs to be distributed also in binary version, linking to=20 non-DPDK aware code. In our case, we are right now simply faking the argv, which is a little=20 bit ugly: //... 37 const char* argv[EAL_ARGS] =3D {"./fake", "-c",CORE_MASK,=20 "-n",NUM_CACHE_LINES, ""}; //... 53 ret =3D rte_eal_init(EAL_ARGS, (char**)argv); 54 if (ret < 0) 55 rte_exit(EXIT_FAILURE, "rte_eal_init failed"); //... IMHO it would make more sense to have actually two calls, adding a=20 library-like initialization. Something like: /* * In the comments a warning that this should be called at the very=20 beginning of the program. *... */ int rte_eal_init(eal_coremask_t core_mask, unsigned int num_of_lines=20 /*More parameters here...*/); /* * */ int rte_eal_init_argv(int argc, char **argv); Btw, the same applies to the mangling of the main() (MAIN) routine. Is=20 this really necessary? Isn't it enough to clearly state in the=20 documentation that certain API calls need to be made on the very=20 beginning of the application? Best Marc --- BISDN GmbH Marc Su=F1=E9 Clos Christburger Stra=DFe 45, 10405 Berlin, Germany Berlin Institute for Software Defined Networks - BISDN GmbH Managing Directors: Dr.-Ing. Hagen Woesner, Andreas K=F6psel Commercial register: Amtsgericht Berlin-Charlottenburg HRB 141569 B VAT ID No: DE283257294 Corporate seat: Berlin