diff mbox series

[08/11] net/hns3: change the log level to INFO

Message ID 20200825115305.58490-9-huwei013@chinasoftinc.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers show
Series updates for hns3 PMD driver | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wei Hu (Xavier) Aug. 25, 2020, 11:53 a.m. UTC
From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

This patch changes the log level from NOTICE to INFO.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ferruh Yigit Sept. 4, 2020, 10:34 a.m. UTC | #1
On 8/25/2020 12:53 PM, Wei Hu (Xavier) wrote:
> From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
> 
> This patch changes the log level from NOTICE to INFO.
> 
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@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.
Wei Hu (Xavier) Sept. 7, 2020, 11:34 a.m. UTC | #2
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@huawei.com>
>>
>> This patch changes the log level from NOTICE to INFO.
>>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@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);

Thanks, Xavier


>
Ferruh Yigit Sept. 7, 2020, 12:10 p.m. UTC | #3
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@huawei.com>
>>>
>>> This patch changes the log level from NOTICE to INFO.
>>>
>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@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.
Wei Hu (Xavier) Sept. 7, 2020, 12:28 p.m. UTC | #4
Hi, Ferruh Yigit

On 2020/9/7 20:10, Ferruh Yigit wrote:
> 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@huawei.com>
>>>>
>>>> This patch changes the log level from NOTICE to INFO.
>>>>
>>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@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.
>
Thanks for your detail description.

Regards

Xavier
diff mbox series

Patch

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);