[PATCH 11/11] drivers: use per line logging in helpers

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Mon Sep 9 09:23:10 CEST 2024


On 9/9/24 09:55, David Marchand wrote:
> On Sun, Sep 8, 2024 at 10:55 AM Andrew Rybchenko
> <andrew.rybchenko at oktetlabs.ru> wrote:
>>
>> On 9/7/24 17:54, David Marchand wrote:
>>> Use RTE_LOG_LINE in existing macros that append a \n.
>>>
>>> Signed-off-by: David Marchand <david.marchand at redhat.com>
>>
>> [snip]
>>
>>> diff --git a/drivers/common/sfc_efx/sfc_efx_log.h b/drivers/common/sfc_efx/sfc_efx_log.h
>>> index 1519ebdc17..b41ef3490b 100644
>>> --- a/drivers/common/sfc_efx/sfc_efx_log.h
>>> +++ b/drivers/common/sfc_efx/sfc_efx_log.h
>>> @@ -12,11 +12,10 @@
>>>
>>>    /** Generic driver log type */
>>>    extern int sfc_efx_logtype;
>>> +#define RTE_LOGTYPE_SFC_EFX sfc_efx_logtype
>>>
>>>    /** Log message, add a prefix and a line break */
>>>    #define SFC_EFX_LOG(level, ...) \
>>> -     rte_log(RTE_LOG_ ## level, sfc_efx_logtype,                     \
>>> -             RTE_FMT("sfc_efx: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n",   \
>>
>> Is "sfc_efx: " prefix dropped intentionally? Or should
>> RTE_LOG_LINE_PREFIX be used?
> 
> By moving to the RTE_LOG macro (and friends), a prefix is
> automatically appended via the log type.
> #define RTE_LOG(l, t, ...)                                      \
>           rte_log(RTE_LOG_ ## l,                                 \
>                   RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
> 
> So here, the logs prefix is not dropped, but changed from sfc_efx: to SFC_EFX:
> 
> It is possible to keep it unchanged by defining RTE_LOGTYPE_sfc_efx is
> you want to stick to it.

Many thanks for explanation. I've lost it from my view on reviewing.

for common/sfc_efx:

Acked-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>



More information about the dev mailing list