On Fri, Jun 26, 2020 at 1:16 PM Jerin Jacob <jerinjac...@gmail.com> wrote: > > > Alternative is to keep variable declaration outside, > > > as David suggested, and I tend to agree that it is a > > > bit better. Macro name says 'register'. It is not > > > 'declare and register'. Also it avoids static-vs-extern > > > problem completely. The solution allows to keep the > > > variable declaration untouched and put constructor (macro) > > > at the end of fine where constructors typically reside. > > > > My only concern with that approach is that, We can not save a lot of > > code duplication > > with that scheme. ie. it is [1] vs [2]. We can change the MACRO name > > accordingly if that is a concern. Any suggestions? > > > > Let me know your preference on [1] vs [2], I will stick with for the > > next version. > > If there are no other comments, I change RTE_LOG_REGISTER to static version > and RTE_LOG_REGISTER_EXTERN for a non-static version and send the next > version.
- Having a macro that does more than what its name tells is inconvenient. The trace framework differentiates declaration and registration. Why merge things in the log framework? Saving one line is not worth it. - Having components set log levels at init time in the macro is a bug to me. This has been worked around with rte_log_register/rte_log_register_and_pick_level but the initial problem is that rte_log_set_level* should only be called by the user. There should be a default level for all dpdk components (which means a common interpretation of each level), then the user chooses which logs he wants to see. At the moment, let's say I am looking at a live system, by default, we have: id 0: lib.eal, level is info id 1: lib.malloc, level is info id 2: lib.ring, level is info id 3: lib.mempool, level is info id 4: lib.timer, level is info id 5: pmd, level is info ... id 32: lib.bbdev, level is notice id 33: lib.bpf, level is info id 34: bus.dpaa, level is notice id 35: bus.fslmc, level is notice id 36: bus.ifpga, level is notice id 37: bus.vdev, level is notice id 38: bus.vmbus, level is notice id 39: lib.cfgfile, level is info id 40: pmd.common.dpaax, level is error ... I enable the logs for a component, set it to debug, I get my logs. If now I want to reset the logs to the initial state, err... well unless I took note of it, I don't know what the default level is. But I should not have to care. Restarting dpdk sure is something you can do with testpmd but not with real systems. -- David Marchand