From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gemini.bisdn.de (gemini.bisdn.de [212.91.241.169]) by dpdk.org (Postfix) with ESMTP id 2C0404C6E for ; Thu, 1 Aug 2013 17:35:55 +0200 (CEST) Received: from [192.168.207.121] (unknown [185.27.182.16]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by gemini.bisdn.de (Postfix) with ESMTPSA id 6BA9182349 for ; Thu, 1 Aug 2013 17:33:18 +0200 (CEST) Message-ID: <51FA80BF.2020801@bisdn.de> Date: Thu, 01 Aug 2013 17:37:35 +0200 From: Marc Sune User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130704 Icedove/17.0.7 MIME-Version: 1.0 To: dev@dpdk.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] Non-argv dependant rte_eal_init() call 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: , X-List-Received-Date: Thu, 01 Aug 2013 15:35:55 -0000 Dear all, Sorry in advance if there is another API for this and I haven't found it, or if there is a strong reason for having it this way. I've seen that in the case of both baremetal and Linux applications, the way to initialize EAL is passing argv: //... /* init EAL */ ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n"); argc -= ret; argv += ret; //... However, this is a little bit annoying in the case of GNU/Linux user-space applications, hence using DPDK as a library, when porting them to DPDK (specially in case of multi-platform applications, like in our case), since they are not necessarily designed to be changing the main routines in a per platform basis. In our case they are even in separate autotools package, since the library providing DPDK based services needs to be distributed also in binary version, linking to non-DPDK aware code. In our case, we are right now simply faking the argv, which is a little bit ugly: //... 37 const char* argv[EAL_ARGS] = {"./fake", "-c",CORE_MASK, "-n",NUM_CACHE_LINES, ""}; //... 53 ret = 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 library-like initialization. Something like: /* * In the comments a warning that this should be called at the very beginning of the program. *... */ int rte_eal_init(eal_coremask_t core_mask, unsigned int num_of_lines /*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 this really necessary? Isn't it enough to clearly state in the documentation that certain API calls need to be made on the very beginning of the application? Best Marc --- BISDN GmbH Marc Suñé Clos Christburger Straße 45, 10405 Berlin, Germany Berlin Institute for Software Defined Networks - BISDN GmbH Managing Directors: Dr.-Ing. Hagen Woesner, Andreas Köpsel Commercial register: Amtsgericht Berlin-Charlottenburg HRB 141569 B VAT ID No: DE283257294 Corporate seat: Berlin