DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mlx5: fix log initialization
@ 2018-06-13 18:46 Stephen Hemminger
  2018-06-14  6:46 ` Nélio Laranjeiro
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2018-06-13 18:46 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The mlx5 driver had two init functions, but this could
cause log initialization to be done after the
other initialization. Also, the name of the function does
not match convention (cut/paste error?).

Fix by initializing log type first at start of the pmd_init.
This also gets rid of having two constructor functions.

Fixes: a170a30d22a8 ("net/mlx5: use dynamic logging")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/mlx5/mlx5.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index c933e274fe32..6ec4f3178b6b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1439,6 +1439,11 @@ RTE_INIT(rte_mlx5_pmd_init);
 static void
 rte_mlx5_pmd_init(void)
 {
+	/* Initialize driver log type. */
+	mlx5_logtype = rte_log_register("pmd.net.mlx5");
+	if (mlx5_logtype >= 0)
+		rte_log_set_level(mlx5_logtype, RTE_LOG_NOTICE);
+
 	/* Build the static tables for Verbs conversion. */
 	mlx5_set_ptype_table();
 	mlx5_set_cksum_table();
@@ -1480,11 +1485,3 @@ rte_mlx5_pmd_init(void)
 RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);
 RTE_PMD_REGISTER_PCI_TABLE(net_mlx5, mlx5_pci_id_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_mlx5, "* ib_uverbs & mlx5_core & mlx5_ib");
-
-/** Initialize driver log type. */
-RTE_INIT(vdev_netvsc_init_log)
-{
-	mlx5_logtype = rte_log_register("pmd.net.mlx5");
-	if (mlx5_logtype >= 0)
-		rte_log_set_level(mlx5_logtype, RTE_LOG_NOTICE);
-}
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] mlx5: fix log initialization
  2018-06-13 18:46 [dpdk-dev] [PATCH] mlx5: fix log initialization Stephen Hemminger
@ 2018-06-14  6:46 ` Nélio Laranjeiro
  2018-06-17  8:21   ` Shahaf Shuler
  0 siblings, 1 reply; 3+ messages in thread
From: Nélio Laranjeiro @ 2018-06-14  6:46 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Wed, Jun 13, 2018 at 11:46:26AM -0700, Stephen Hemminger wrote:
> The mlx5 driver had two init functions, but this could
> cause log initialization to be done after the
> other initialization. Also, the name of the function does
> not match convention (cut/paste error?).

Indeed an error in the copy/paste, sorry,

> Fix by initializing log type first at start of the pmd_init.
> This also gets rid of having two constructor functions.
> 
> Fixes: a170a30d22a8 ("net/mlx5: use dynamic logging")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

> ---
>  drivers/net/mlx5/mlx5.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index c933e274fe32..6ec4f3178b6b 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1439,6 +1439,11 @@ RTE_INIT(rte_mlx5_pmd_init);
>  static void
>  rte_mlx5_pmd_init(void)
>  {
> +	/* Initialize driver log type. */
> +	mlx5_logtype = rte_log_register("pmd.net.mlx5");
> +	if (mlx5_logtype >= 0)
> +		rte_log_set_level(mlx5_logtype, RTE_LOG_NOTICE);
> +
>  	/* Build the static tables for Verbs conversion. */
>  	mlx5_set_ptype_table();
>  	mlx5_set_cksum_table();
> @@ -1480,11 +1485,3 @@ rte_mlx5_pmd_init(void)
>  RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);
>  RTE_PMD_REGISTER_PCI_TABLE(net_mlx5, mlx5_pci_id_map);
>  RTE_PMD_REGISTER_KMOD_DEP(net_mlx5, "* ib_uverbs & mlx5_core & mlx5_ib");
> -
> -/** Initialize driver log type. */
> -RTE_INIT(vdev_netvsc_init_log)
> -{
> -	mlx5_logtype = rte_log_register("pmd.net.mlx5");
> -	if (mlx5_logtype >= 0)
> -		rte_log_set_level(mlx5_logtype, RTE_LOG_NOTICE);
> -}
> -- 
> 2.17.1

Thanks,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] mlx5: fix log initialization
  2018-06-14  6:46 ` Nélio Laranjeiro
@ 2018-06-17  8:21   ` Shahaf Shuler
  0 siblings, 0 replies; 3+ messages in thread
From: Shahaf Shuler @ 2018-06-17  8:21 UTC (permalink / raw)
  To: Nélio Laranjeiro, Stephen Hemminger; +Cc: dev

Thursday, June 14, 2018 9:46 AM, Nélio Laranjeiro:
> Subject: Re: [dpdk-dev] [PATCH] mlx5: fix log initialization
> 
> On Wed, Jun 13, 2018 at 11:46:26AM -0700, Stephen Hemminger wrote:
> > The mlx5 driver had two init functions, but this could cause log
> > initialization to be done after the other initialization. Also, the
> > name of the function does not match convention (cut/paste error?).
> 
> Indeed an error in the copy/paste, sorry,
> 
> > Fix by initializing log type first at start of the pmd_init.
> > This also gets rid of having two constructor functions.
> >
> > Fixes: a170a30d22a8 ("net/mlx5: use dynamic logging")
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> 

Applied to next-net-mlx with few log modifications:
1. title should be net/mlx5
2. Cc: stable@dpdk.org

Thanks. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-17  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13 18:46 [dpdk-dev] [PATCH] mlx5: fix log initialization Stephen Hemminger
2018-06-14  6:46 ` Nélio Laranjeiro
2018-06-17  8:21   ` Shahaf Shuler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).