[dpdk-dev] [PATCH 08/11] net/hns3: change the log level to INFO

Ferruh Yigit ferruh.yigit at intel.com
Mon Sep 7 14:10:15 CEST 2020


On 9/7/2020 12:34 PM, Wei Hu (Xavier) wrote:
> Hi,Ferruh Yigit
> 
> On 2020/9/4 18:34, Ferruh Yigit wrote:
>> On 8/25/2020 12:53 PM, Wei Hu (Xavier) wrote:
>>> From: "Wei Hu (Xavier)" <xavier.huwei at huawei.com>
>>>
>>> This patch changes the log level from NOTICE to INFO.
>>>
>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
>>> ---
>>>   drivers/net/hns3/hns3_ethdev.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
>>> index fca035d4f..3827d3277 100644
>>> --- a/drivers/net/hns3/hns3_ethdev.c
>>> +++ b/drivers/net/hns3/hns3_ethdev.c
>>> @@ -5744,5 +5744,5 @@ static struct rte_pci_driver rte_hns3_pmd = {
>>>   RTE_PMD_REGISTER_PCI(net_hns3, rte_hns3_pmd);
>>>   RTE_PMD_REGISTER_PCI_TABLE(net_hns3, pci_id_hns3_map);
>>>   RTE_PMD_REGISTER_KMOD_DEP(net_hns3, "* igb_uio | vfio-pci");
>>> -RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, NOTICE);
>>> -RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, NOTICE);
>>> +RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, INFO);
>>> +RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, INFO);
>>>
>>
>> Why making the PMD more verbose by default? You can update the log level
>> dynamically when need to be more verbose.
>>
>> Common approach is to set default PMD log level is to 'NOTICE', I think this is
>> good to make applications more usable.
> 
> Currently hns3 PMD driver invokes the private macro named hns3_info in 
> several places, we found that these information wouldn't never be logged.
>      hns3_info -> rte_log(RTE_LOG_INFO, hns3_logtype_dirver,...)
> 
> To display the related log information, we need to execute the following 
> code in the application, right? Is there any other way?
> extern int hns3_logtype_driver;
> rte_log_set_level(hns3_logtype_driver, RTE_LOG_INFO);
> 

Hi Xavier,

This is mainly it. Setting log level to something ">= 'RTE_LOG_INFO'" using
'rte_log_set_level()' will display INFO level logs.

There are some variant functions too, 'rte_log_set_level_pattern()' &
'rte_log_set_level_regexp()', these let use change log level of multiple
components, like "pmd.net.*"

Another way is provide the log level to application via eal command
"--log-level=<type-match>:<int>", like "--log-level=*:debug". This arg is
wrapper to above APIs.

Or if you are using testpmd, can change the log level via command "set log"
dynamically, like "set log pmd.net.hns3*".
Applications can do something similar to change log levels on demand based on
their need, so components doesn't need to be verbose by default.




More information about the dev mailing list