From: Marc Sune <marc.sune-kpkqNMk1I7M@public.gmane.org>
To: Thomas Monjalon
<thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: Non-argv dependant rte_eal_init() call
Date: Thu, 01 Aug 2013 18:13:17 +0200 [thread overview]
Message-ID: <51FA891D.2070702@bisdn.de> (raw)
In-Reply-To: <201308011801.08070.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Dear Thomas,
Regarding the MAIN, then I understand is not really necessary for Linux
user-space applications, and that is there in the examples because they
can run both baremetal and userspace... this is fine.
Regarding the rte_eal_init(), if the concern is the number of parameters
and backwards compatibility, a typical solution is to create a struct
containing the parameters:
<code>
typedef struct eal_init_params{
uint64_t coremask;
unsigned int num_of_cache_lines;
/* Add here more parmeters in future versions... */
}eal_init_params_t;
int rte_eal_init(eal_init_params_t* params);
</code>
Therefore the user code, is always backwards compatible (provided that
is properly recompiled).
In any case, and besides the struct approach, I think is more elegant to
add a parameter to a function call if you jump to a newer version of the
DPDK, than having to create a fake C string array or forcing the
applications to add extra DPDK parameters in the executable.
Just my 2 cents ;)
Best
marc
On 01/08/13 18:01, Thomas Monjalon wrote:
> Hello,
>
> 01/08/2013 17:37, Marc Sune :
>> In our case, we are right now simply faking the argv, which is a little
>> bit ugly:
>> <code>
>> //...
>> 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");
>> //...
>> </code>
> You should provide a better binary name because in your example, your logs
> will be prefixed with "fake" which is, I agree with you, a little bit ugly ;)
>
>> IMHO it would make more sense to have actually two calls, adding a
>> library-like initialization. Something like:
>>
>> <code>
>> /*
>> * 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);
>>
>> </code>
> The problem with your proposal is that the number of options is static.
> So when adding a new option in future releases, all the applications should be
> updated to give a (probably null) value for this new option.
> Not sure it is an improvement.
>
>> 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?
> Not sure to understand this point.
> MAIN is only defined in examples for the bare-metal use case.
> What is the link with the API ?
>
next prev parent reply other threads:[~2013-08-01 16:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 15:37 Non-argv dependant rte_eal_init() call Marc Sune
[not found] ` <51FA80BF.2020801-kpkqNMk1I7M@public.gmane.org>
2013-08-01 16:01 ` Thomas Monjalon
[not found] ` <201308011801.08070.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-08-01 16:13 ` Marc Sune [this message]
[not found] ` <51FA891D.2070702-kpkqNMk1I7M@public.gmane.org>
2013-08-01 16:47 ` Antti Kantee
[not found] ` <51FA9127.8020702-X3B1VOXEql0@public.gmane.org>
2013-08-01 18:14 ` Marc Sune
2013-08-01 17:06 ` Stephen Hemminger
2013-08-01 18:17 ` Marc Sune
[not found] ` <51FAA647.7070709-kpkqNMk1I7M@public.gmane.org>
2013-08-01 19:23 ` Stephen Hemminger
2013-08-01 20:22 ` Balazs Nemeth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51FA891D.2070702@bisdn.de \
--to=marc.sune-kpkqnmk1i7m@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.