[01/30] net/sfc: log port ID as 16-bit unsigned integer on panic

Message ID 1549541873-17403-2-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: improve multi-process support |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Andrew Rybchenko Feb. 7, 2019, 12:17 p.m. UTC
  From: Ivan Malov <ivan.malov@oktetlabs.ru>

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_debug.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Feb. 8, 2019, 10:13 a.m. UTC | #1
On 2/7/2019 12:17 PM, Andrew Rybchenko wrote:
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> 
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/sfc/sfc_debug.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
> index 6b600ff4d..62f3937e8 100644
> --- a/drivers/net/sfc/sfc_debug.h
> +++ b/drivers/net/sfc/sfc_debug.h
> @@ -27,7 +27,8 @@
>  	do {								\
>  		const struct sfc_adapter *_sa = (sa);			\
>  									\
> -		rte_panic("sfc " PCI_PRI_FMT " #%" PRIu8 ": " fmt "\n",	\
> +		rte_panic("sfc " PCI_PRI_FMT				\
> +			  " #%" PRIu16 ": " fmt "\n",			\
>  			  _sa->pci_addr.domain, _sa->pci_addr.bus,	\
>  			  _sa->pci_addr.devid, _sa->pci_addr.function,	\
>  			  _sa->port_id, ##args);			\
> 

Overall it may not be good idea to call rte_panic() from driver. rte_panic()
cause the DPDK application to terminate, if a driver fails application may
prefer to handle that error and continue to run, so terminate decision should be
from application not library.

Can you please double check if rte_panic() usages in the driver can be converted
to error reporting?
  
Andrew Rybchenko Feb. 8, 2019, 10:31 a.m. UTC | #2
Hi Ferruh,

On 2/8/19 1:13 PM, Ferruh Yigit wrote:
> On 2/7/2019 12:17 PM, Andrew Rybchenko wrote:
>> From: Ivan Malov <ivan.malov@oktetlabs.ru>
>>
>> Fixes: f8244c6399d9 ("ethdev: increase port id range")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> ---
>>   drivers/net/sfc/sfc_debug.h | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
>> index 6b600ff4d..62f3937e8 100644
>> --- a/drivers/net/sfc/sfc_debug.h
>> +++ b/drivers/net/sfc/sfc_debug.h
>> @@ -27,7 +27,8 @@
>>   	do {								\
>>   		const struct sfc_adapter *_sa = (sa);			\
>>   									\
>> -		rte_panic("sfc " PCI_PRI_FMT " #%" PRIu8 ": " fmt "\n",	\
>> +		rte_panic("sfc " PCI_PRI_FMT				\
>> +			  " #%" PRIu16 ": " fmt "\n",			\
>>   			  _sa->pci_addr.domain, _sa->pci_addr.bus,	\
>>   			  _sa->pci_addr.devid, _sa->pci_addr.function,	\
>>   			  _sa->port_id, ##args);			\
>>
> Overall it may not be good idea to call rte_panic() from driver. rte_panic()
> cause the DPDK application to terminate, if a driver fails application may
> prefer to handle that error and continue to run, so terminate decision should be
> from application not library.
>
> Can you please double check if rte_panic() usages in the driver can be converted
> to error reporting?

Thanks a lot for reminder. We use it in few places, but even those can be
improved. We'll do it.

Andrew.
  

Patch

diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
index 6b600ff4d..62f3937e8 100644
--- a/drivers/net/sfc/sfc_debug.h
+++ b/drivers/net/sfc/sfc_debug.h
@@ -27,7 +27,8 @@ 
 	do {								\
 		const struct sfc_adapter *_sa = (sa);			\
 									\
-		rte_panic("sfc " PCI_PRI_FMT " #%" PRIu8 ": " fmt "\n",	\
+		rte_panic("sfc " PCI_PRI_FMT				\
+			  " #%" PRIu16 ": " fmt "\n",			\
 			  _sa->pci_addr.domain, _sa->pci_addr.bus,	\
 			  _sa->pci_addr.devid, _sa->pci_addr.function,	\
 			  _sa->port_id, ##args);			\