[PATCH v3 03/16] efd: replace RTE_LOGTYPE_EFD with local type

Stephen Hemminger stephen at networkplumber.org
Fri Feb 10 03:47:24 CET 2023


On Fri, 10 Feb 2023 10:03:47 +0800
fengchengwen <fengchengwen at huawei.com> wrote:

> On 2023/2/10 9:07, Stephen Hemminger wrote:
> > Replace all uses of global logtype with a local log type.
> > Do not break message formats across source lines.
> > 
> > Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> > ---  
> 
> ...
> 
> >  };
> >  EAL_REGISTER_TAILQ(rte_efd_tailq);
> >  
> > +RTE_LOG_REGISTER_DEFAULT(efd_logtype, INFO);
> > +
> > +#define EFD_LOG(level, fmt, args...) \
> > +	rte_log(RTE_LOG_ ## level, efd_logtype, "%s(): " fmt "\n", __func__, ##args)
> > +
> >  /** Internal permutation array used to shuffle bins into pseudorandom groups */
> >  const uint32_t efd_bin_to_group[EFD_CHUNK_NUM_BIN_TO_GROUP_SETS][EFD_CHUNK_NUM_BINS] = {
> >  	{
> > @@ -509,13 +514,12 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
> >  	efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
> >  
> >  	if (online_cpu_socket_bitmask == 0) {
> > -		RTE_LOG(ERR, EFD, "At least one CPU socket must be enabled "
> > -				"in the bitmask\n");
> > +		EFD_LOG(ERR, "At least one CPU socket must be enabled in the bitmask");  
> 
> Hi Stephen,
> 
> Original output will be: EFD: At least one CPU ...
> and new output will be: rte_efd_create(): At least one CPU ...
> 
> The new output don't have EFD (module or lib name), logs of the EFD module cannot be easily
> filtered, althought new have function name, but will may not contains module name.
> 
> Suggest add module name in EFD_LOG:
> #define EFD_LOG(level, fmt, args...) \
> 	rte_log(RTE_LOG_ ## level, efd_logtype, "EFD: %s(): " fmt "\n", __func__, ##args)

Thought that the function name was more precise that the module name.
It is what most drivers do.


More information about the dev mailing list