All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net/mlx5: fix socket connection return value
@ 2018-05-01 11:18 Shahaf Shuler
  2018-05-01 11:18 ` [PATCH 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Shahaf Shuler @ 2018-05-01 11:18 UTC (permalink / raw)
  To: nelio.laranjeiro, adrien.mazarguil, yskoh; +Cc: dev

Upon success, mlx5_socket_connect should return the fd descriptor of the
primary process

Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c        | 2 +-
 drivers/net/mlx5/mlx5_socket.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 8f983061a0..46cb370a29 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -804,7 +804,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 				goto error;
 			/* Receive command fd from primary process */
 			err = mlx5_socket_connect(eth_dev);
-			if (err)
+			if (err < 0)
 				goto error;
 			/* Remap UAR for Tx queues. */
 			err = mlx5_tx_uar_remap(eth_dev, err);
diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c
index e12c4cb2e1..99297d5c43 100644
--- a/drivers/net/mlx5/mlx5_socket.c
+++ b/drivers/net/mlx5/mlx5_socket.c
@@ -294,7 +294,7 @@ mlx5_socket_connect(struct rte_eth_dev *dev)
 	}
 	ret = *fd;
 	close(socket_fd);
-	return 0;
+	return ret;
 error:
 	if (socket_fd != -1)
 		close(socket_fd);
-- 
2.12.0

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

* [PATCH 2/2] net/mlx5: fix probe return value polarity
  2018-05-01 11:18 [PATCH 1/2] net/mlx5: fix socket connection return value Shahaf Shuler
@ 2018-05-01 11:18 ` Shahaf Shuler
  2018-05-02  1:54   ` Yongseok Koh
  2018-05-02  6:50 ` [PATCH 1/2] net/mlx5: fix socket connection return value Nélio Laranjeiro
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Shahaf Shuler @ 2018-05-01 11:18 UTC (permalink / raw)
  To: nelio.laranjeiro, adrien.mazarguil, yskoh; +Cc: dev

mlx5 prefixed function returns a negative errno value.
the error handler on mlx5_pci_probe is doing the same.

Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 46cb370a29..ab860b5985 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -804,12 +804,16 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 				goto error;
 			/* Receive command fd from primary process */
 			err = mlx5_socket_connect(eth_dev);
-			if (err < 0)
+			if (err < 0) {
+				err = -err;
 				goto error;
+			}
 			/* Remap UAR for Tx queues. */
 			err = mlx5_tx_uar_remap(eth_dev, err);
-			if (err)
+			if (err) {
+				err = -err;
 				goto error;
+			}
 			/*
 			 * Ethdev pointer is still required as input since
 			 * the primary device is not accessible from the
-- 
2.12.0

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

* Re: [PATCH 2/2] net/mlx5: fix probe return value polarity
  2018-05-01 11:18 ` [PATCH 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
@ 2018-05-02  1:54   ` Yongseok Koh
  2018-05-02  6:49     ` Nélio Laranjeiro
  0 siblings, 1 reply; 10+ messages in thread
From: Yongseok Koh @ 2018-05-02  1:54 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: Nélio Laranjeiro, Adrien Mazarguil, dev


> On May 1, 2018, at 4:18 AM, Shahaf Shuler <shahafs@mellanox.com> wrote:
> 
> mlx5 prefixed function returns a negative errno value.
> the error handler on mlx5_pci_probe is doing the same.
> 
> Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
> Cc: nelio.laranjeiro@6wind.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
> drivers/net/mlx5/mlx5.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 46cb370a29..ab860b5985 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -804,12 +804,16 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
> 				goto error;

Shouldn't you do the same for mlx5_uar_init_secondary()?
Looks like a few more. E.g. mlx5_args(), mlx5_get_mtu() and mlx5_uar_init_primary().
What about ibv_query_port() and mlx5_flow_create_drop_queue()? 

Thanks

> 			/* Receive command fd from primary process */
> 			err = mlx5_socket_connect(eth_dev);
> -			if (err < 0)
> +			if (err < 0) {
> +				err = -err;

Instead of changing sign, how about 'err = rte_errno;' ?
However, err looks redundant to me because mlx5_* funcs set rte_errno.
Here, err is used to set rte_errno at the end.

Thanks,
Yongseok

> 				goto error;
> +			}
> 			/* Remap UAR for Tx queues. */
> 			err = mlx5_tx_uar_remap(eth_dev, err);
> -			if (err)
> +			if (err) {
> +				err = -err;
> 				goto error;
> +			}
> 			/*
> 			 * Ethdev pointer is still required as input since
> 			 * the primary device is not accessible from the
> -- 
> 2.12.0
> 

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

* Re: [PATCH 2/2] net/mlx5: fix probe return value polarity
  2018-05-02  1:54   ` Yongseok Koh
@ 2018-05-02  6:49     ` Nélio Laranjeiro
  2018-05-03  7:40       ` Shahaf Shuler
  0 siblings, 1 reply; 10+ messages in thread
From: Nélio Laranjeiro @ 2018-05-02  6:49 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: Shahaf Shuler, Adrien Mazarguil, dev

On Wed, May 02, 2018 at 01:54:37AM +0000, Yongseok Koh wrote:
> 
> > On May 1, 2018, at 4:18 AM, Shahaf Shuler <shahafs@mellanox.com> wrote:
> > 
> > mlx5 prefixed function returns a negative errno value.
> > the error handler on mlx5_pci_probe is doing the same.
> > 
> > Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
> > Cc: nelio.laranjeiro@6wind.com
> > 
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> > index 46cb370a29..ab860b5985 100644
> > --- a/drivers/net/mlx5/mlx5.c
> > +++ b/drivers/net/mlx5/mlx5.c
> > @@ -804,12 +804,16 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
> > 				goto error;
> 
> Shouldn't you do the same for mlx5_uar_init_secondary()?
> Looks like a few more. E.g. mlx5_args(), mlx5_get_mtu() and mlx5_uar_init_primary().
> What about ibv_query_port() and mlx5_flow_create_drop_queue()? 
> 
> Thanks
> 
> > 			/* Receive command fd from primary process */
> > 			err = mlx5_socket_connect(eth_dev);
> > -			if (err < 0)
> > +			if (err < 0) {
> > +				err = -err;
> 
> Instead of changing sign, how about 'err = rte_errno;' ?

+1

> However, err looks redundant to me because mlx5_* funcs set rte_errno.

Not it is not, rte_errno is the strict equivalent of errno but instead
of being global to the process, it is global per logical core, its
cannot be determined nor modified at the beginning of the function thus
the function must track any failure and report it accordingly.

> Here, err is used to set rte_errno at the end.

It is just a optimization to avoid a lot of rte_errno sets among the
function, it must only be set if err != 0.

> Thanks,
> Yongseok
> 
> > 				goto error;
> > +			}
> > 			/* Remap UAR for Tx queues. */
> > 			err = mlx5_tx_uar_remap(eth_dev, err);
> > -			if (err)
> > +			if (err) {
> > +				err = -err;
> > 				goto error;
> > +			}
> > 			/*
> > 			 * Ethdev pointer is still required as input since
> > 			 * the primary device is not accessible from the
> > -- 
> > 2.12.0
> > 
 
Regards,

-- 
Nélio Laranjeiro
6WIND

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

* Re: [PATCH 1/2] net/mlx5: fix socket connection return value
  2018-05-01 11:18 [PATCH 1/2] net/mlx5: fix socket connection return value Shahaf Shuler
  2018-05-01 11:18 ` [PATCH 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
@ 2018-05-02  6:50 ` Nélio Laranjeiro
  2018-05-03  7:59 ` [PATCH v2 " Shahaf Shuler
  2018-05-03  7:59 ` [PATCH v2 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
  3 siblings, 0 replies; 10+ messages in thread
From: Nélio Laranjeiro @ 2018-05-02  6:50 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: adrien.mazarguil, yskoh, dev

On Tue, May 01, 2018 at 02:18:05PM +0300, Shahaf Shuler wrote:
> Upon success, mlx5_socket_connect should return the fd descriptor of the
> primary process
> 
> Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
> Cc: nelio.laranjeiro@6wind.com
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>

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

> ---
>  drivers/net/mlx5/mlx5.c        | 2 +-
>  drivers/net/mlx5/mlx5_socket.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 8f983061a0..46cb370a29 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -804,7 +804,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  				goto error;
>  			/* Receive command fd from primary process */
>  			err = mlx5_socket_connect(eth_dev);
> -			if (err)
> +			if (err < 0)
>  				goto error;
>  			/* Remap UAR for Tx queues. */
>  			err = mlx5_tx_uar_remap(eth_dev, err);
> diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c
> index e12c4cb2e1..99297d5c43 100644
> --- a/drivers/net/mlx5/mlx5_socket.c
> +++ b/drivers/net/mlx5/mlx5_socket.c
> @@ -294,7 +294,7 @@ mlx5_socket_connect(struct rte_eth_dev *dev)
>  	}
>  	ret = *fd;
>  	close(socket_fd);
> -	return 0;
> +	return ret;
>  error:
>  	if (socket_fd != -1)
>  		close(socket_fd);
> -- 
> 2.12.0
> 

-- 
Nélio Laranjeiro
6WIND

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

* Re: [PATCH 2/2] net/mlx5: fix probe return value polarity
  2018-05-02  6:49     ` Nélio Laranjeiro
@ 2018-05-03  7:40       ` Shahaf Shuler
  0 siblings, 0 replies; 10+ messages in thread
From: Shahaf Shuler @ 2018-05-03  7:40 UTC (permalink / raw)
  To: Nélio Laranjeiro, Yongseok Koh; +Cc: Adrien Mazarguil, dev

Wednesday, May 2, 2018 9:50 AM, Nélio Laranjeiro:
> Subject: Re: [PATCH 2/2] net/mlx5: fix probe return value polarity
> 
> On Wed, May 02, 2018 at 01:54:37AM +0000, Yongseok Koh wrote:
> >
> > > On May 1, 2018, at 4:18 AM, Shahaf Shuler <shahafs@mellanox.com>
> wrote:
> > >
> > > mlx5 prefixed function returns a negative errno value.
> > > the error handler on mlx5_pci_probe is doing the same.
> > >
> > > Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno
> > > values")
> > > Cc: nelio.laranjeiro@6wind.com
> > >
> > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> > > ---
> > > drivers/net/mlx5/mlx5.c | 8 ++++++--
> > > 1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> > > 46cb370a29..ab860b5985 100644
> > > --- a/drivers/net/mlx5/mlx5.c
> > > +++ b/drivers/net/mlx5/mlx5.c
> > > @@ -804,12 +804,16 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
> > > 				goto error;
> >
> > Shouldn't you do the same for mlx5_uar_init_secondary()?
> > Looks like a few more. E.g. mlx5_args(), mlx5_get_mtu() and
> mlx5_uar_init_primary().

Yes thanks.

> > What about ibv_query_port() 

No need, according to man:

RETURN VALUE                                                                                                       
       ibv_query_port() returns 0 on success, or the value of errno on failure (which indicates  the  failure  rea-
       son).                                                                                                       

This is also the case for ibv_query_port_ex, I will align it on the next version. 

and mlx5_flow_create_drop_queue()?

Yes, needed. 

> >
> > Thanks
> >
> > > 			/* Receive command fd from primary process */
> > > 			err = mlx5_socket_connect(eth_dev);
> > > -			if (err < 0)
> > > +			if (err < 0) {
> > > +				err = -err;
> >
> > Instead of changing sign, how about 'err = rte_errno;' ?
> 
> +1

Ok.

> 
> > However, err looks redundant to me because mlx5_* funcs set rte_errno.
> 
> Not it is not, rte_errno is the strict equivalent of errno but instead of being
> global to the process, it is global per logical core, its cannot be determined
> nor modified at the beginning of the function thus the function must track
> any failure and report it accordingly.
> 
> > Here, err is used to set rte_errno at the end.
> 
> It is just a optimization to avoid a lot of rte_errno sets among the function, it
> must only be set if err != 0.

I think I will keep the local err for the meanwhile. 

> 
> > Thanks,
> > Yongseok
> >
> > > 				goto error;
> > > +			}
> > > 			/* Remap UAR for Tx queues. */
> > > 			err = mlx5_tx_uar_remap(eth_dev, err);
> > > -			if (err)
> > > +			if (err) {
> > > +				err = -err;
> > > 				goto error;
> > > +			}
> > > 			/*
> > > 			 * Ethdev pointer is still required as input since
> > > 			 * the primary device is not accessible from the
> > > --
> > > 2.12.0
> > >
> 
> Regards,
> 
> --
> Nélio Laranjeiro
> 6WIND

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

* [PATCH v2 1/2] net/mlx5: fix socket connection return value
  2018-05-01 11:18 [PATCH 1/2] net/mlx5: fix socket connection return value Shahaf Shuler
  2018-05-01 11:18 ` [PATCH 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
  2018-05-02  6:50 ` [PATCH 1/2] net/mlx5: fix socket connection return value Nélio Laranjeiro
@ 2018-05-03  7:59 ` Shahaf Shuler
  2018-05-03 10:33   ` Shahaf Shuler
  2018-05-03  7:59 ` [PATCH v2 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
  3 siblings, 1 reply; 10+ messages in thread
From: Shahaf Shuler @ 2018-05-03  7:59 UTC (permalink / raw)
  To: nelio.laranjeiro, adrien.mazarguil, yskoh; +Cc: dev

Upon success, mlx5_socket_connect should return the fd descriptor of the
primary process

Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---

On v2:
 - No change. 

---
 drivers/net/mlx5/mlx5.c        | 2 +-
 drivers/net/mlx5/mlx5_socket.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 8f983061a0..46cb370a29 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -804,7 +804,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 				goto error;
 			/* Receive command fd from primary process */
 			err = mlx5_socket_connect(eth_dev);
-			if (err)
+			if (err < 0)
 				goto error;
 			/* Remap UAR for Tx queues. */
 			err = mlx5_tx_uar_remap(eth_dev, err);
diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c
index e12c4cb2e1..99297d5c43 100644
--- a/drivers/net/mlx5/mlx5_socket.c
+++ b/drivers/net/mlx5/mlx5_socket.c
@@ -294,7 +294,7 @@ mlx5_socket_connect(struct rte_eth_dev *dev)
 	}
 	ret = *fd;
 	close(socket_fd);
-	return 0;
+	return ret;
 error:
 	if (socket_fd != -1)
 		close(socket_fd);
-- 
2.12.0

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

* [PATCH v2 2/2] net/mlx5: fix probe return value polarity
  2018-05-01 11:18 [PATCH 1/2] net/mlx5: fix socket connection return value Shahaf Shuler
                   ` (2 preceding siblings ...)
  2018-05-03  7:59 ` [PATCH v2 " Shahaf Shuler
@ 2018-05-03  7:59 ` Shahaf Shuler
  2018-05-03  9:53   ` Nélio Laranjeiro
  3 siblings, 1 reply; 10+ messages in thread
From: Shahaf Shuler @ 2018-05-03  7:59 UTC (permalink / raw)
  To: nelio.laranjeiro, adrien.mazarguil, yskoh; +Cc: dev

mlx5 prefixed function returns a negative errno value.
the error handler on mlx5_pci_probe is doing the same.

Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---

On v2:
 - fixed more polarity issues on different mlx5_* functions.
 - aligned verb calls return values. 

---
 drivers/net/mlx5/mlx5.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 46cb370a29..7afdae863f 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -751,8 +751,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	DRV_LOG(WARNING,
 		"tunnel offloading disabled due to old OFED/rdma-core version");
 #endif
-	if (mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr)) {
-		err = errno;
+	err = mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr);
+	if (err) {
+		DRV_LOG(ERR, "ibv_query_device_ex() failed");
 		goto error;
 	}
 	DRV_LOG(INFO, "%u port(s) detected",
@@ -800,16 +801,22 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			eth_dev->device = &pci_dev->device;
 			eth_dev->dev_ops = &mlx5_dev_sec_ops;
 			err = mlx5_uar_init_secondary(eth_dev);
-			if (err)
+			if (err) {
+				err = rte_errno;
 				goto error;
+			}
 			/* Receive command fd from primary process */
 			err = mlx5_socket_connect(eth_dev);
-			if (err < 0)
+			if (err < 0) {
+				err = rte_errno;
 				goto error;
+			}
 			/* Remap UAR for Tx queues. */
 			err = mlx5_tx_uar_remap(eth_dev, err);
-			if (err)
+			if (err) {
+				err = rte_errno;
 				goto error;
+			}
 			/*
 			 * Ethdev pointer is still required as input since
 			 * the primary device is not accessible from the
@@ -873,11 +880,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		if (err) {
 			DRV_LOG(ERR, "failed to process device arguments: %s",
 				strerror(err));
+			err = rte_errno;
 			goto port_error;
 		}
-		if (mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex)) {
+		err = mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex);
+		if (err) {
 			DRV_LOG(ERR, "ibv_query_device_ex() failed");
-			err = errno;
 			goto port_error;
 		}
 		config.hw_csum = !!(device_attr_ex.device_cap_flags_ex &
@@ -952,8 +960,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		rte_eth_copy_pci_info(eth_dev, pci_dev);
 		eth_dev->device->driver = &mlx5_driver.driver;
 		err = mlx5_uar_init_primary(eth_dev);
-		if (err)
+		if (err) {
+			err = rte_errno;
 			goto port_error;
+		}
 		/* Configure the first MAC address by default. */
 		if (mlx5_get_mac(eth_dev, &mac.addr_bytes)) {
 			DRV_LOG(ERR,
@@ -983,8 +993,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 #endif
 		/* Get actual MTU if possible. */
 		err = mlx5_get_mtu(eth_dev, &priv->mtu);
-		if (err)
+		if (err) {
+			err = rte_errno;
 			goto port_error;
+		}
 		DRV_LOG(DEBUG, "port %u MTU is %u", eth_dev->data->port_id,
 			priv->mtu);
 		/*
@@ -1031,6 +1043,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		if (err) {
 			DRV_LOG(ERR, "port %u drop queue allocation failed: %s",
 				eth_dev->data->port_id, strerror(rte_errno));
+			err = rte_errno;
 			goto port_error;
 		}
 		/* Supported Verbs flow priority number detection. */
-- 
2.12.0

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

* Re: [PATCH v2 2/2] net/mlx5: fix probe return value polarity
  2018-05-03  7:59 ` [PATCH v2 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
@ 2018-05-03  9:53   ` Nélio Laranjeiro
  0 siblings, 0 replies; 10+ messages in thread
From: Nélio Laranjeiro @ 2018-05-03  9:53 UTC (permalink / raw)
  To: Shahaf Shuler; +Cc: adrien.mazarguil, yskoh, dev

On Thu, May 03, 2018 at 10:59:37AM +0300, Shahaf Shuler wrote:
> mlx5 prefixed function returns a negative errno value.
> the error handler on mlx5_pci_probe is doing the same.
> 
> Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
> Cc: nelio.laranjeiro@6wind.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
> 
> On v2:
>  - fixed more polarity issues on different mlx5_* functions.
>  - aligned verb calls return values. 
> 
> ---
>  drivers/net/mlx5/mlx5.c | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 46cb370a29..7afdae863f 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -751,8 +751,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  	DRV_LOG(WARNING,
>  		"tunnel offloading disabled due to old OFED/rdma-core version");
>  #endif
> -	if (mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr)) {
> -		err = errno;
> +	err = mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr);
> +	if (err) {
> +		DRV_LOG(ERR, "ibv_query_device_ex() failed");

Should be DEBUG() and not DRV_LOG().

>  		goto error;
>  	}
>  	DRV_LOG(INFO, "%u port(s) detected",
> @@ -800,16 +801,22 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  			eth_dev->device = &pci_dev->device;
>  			eth_dev->dev_ops = &mlx5_dev_sec_ops;
>  			err = mlx5_uar_init_secondary(eth_dev);
> -			if (err)
> +			if (err) {
> +				err = rte_errno;
>  				goto error;
> +			}
>  			/* Receive command fd from primary process */
>  			err = mlx5_socket_connect(eth_dev);
> -			if (err < 0)
> +			if (err < 0) {
> +				err = rte_errno;
>  				goto error;
> +			}
>  			/* Remap UAR for Tx queues. */
>  			err = mlx5_tx_uar_remap(eth_dev, err);
> -			if (err)
> +			if (err) {
> +				err = rte_errno;
>  				goto error;
> +			}
>  			/*
>  			 * Ethdev pointer is still required as input since
>  			 * the primary device is not accessible from the
> @@ -873,11 +880,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  		if (err) {
>  			DRV_LOG(ERR, "failed to process device arguments: %s",
>  				strerror(err));
> +			err = rte_errno;
>  			goto port_error;
>  		}
> -		if (mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex)) {
> +		err = mlx5_glue->query_device_ex(ctx, NULL, &device_attr_ex);
> +		if (err) {
>  			DRV_LOG(ERR, "ibv_query_device_ex() failed");
> -			err = errno;
>  			goto port_error;
>  		}
>  		config.hw_csum = !!(device_attr_ex.device_cap_flags_ex &
> @@ -952,8 +960,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  		rte_eth_copy_pci_info(eth_dev, pci_dev);
>  		eth_dev->device->driver = &mlx5_driver.driver;
>  		err = mlx5_uar_init_primary(eth_dev);
> -		if (err)
> +		if (err) {
> +			err = rte_errno;
>  			goto port_error;
> +		}
>  		/* Configure the first MAC address by default. */
>  		if (mlx5_get_mac(eth_dev, &mac.addr_bytes)) {
>  			DRV_LOG(ERR,
> @@ -983,8 +993,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  #endif
>  		/* Get actual MTU if possible. */
>  		err = mlx5_get_mtu(eth_dev, &priv->mtu);
> -		if (err)
> +		if (err) {
> +			err = rte_errno;
>  			goto port_error;
> +		}
>  		DRV_LOG(DEBUG, "port %u MTU is %u", eth_dev->data->port_id,
>  			priv->mtu);
>  		/*
> @@ -1031,6 +1043,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  		if (err) {
>  			DRV_LOG(ERR, "port %u drop queue allocation failed: %s",
>  				eth_dev->data->port_id, strerror(rte_errno));
> +			err = rte_errno;
>  			goto port_error;
>  		}
>  		/* Supported Verbs flow priority number detection. */
> -- 
> 2.12.0

Unless the small comment above, 
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Thanks,

-- 
Nélio Laranjeiro
6WIND

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

* Re: [PATCH v2 1/2] net/mlx5: fix socket connection return value
  2018-05-03  7:59 ` [PATCH v2 " Shahaf Shuler
@ 2018-05-03 10:33   ` Shahaf Shuler
  0 siblings, 0 replies; 10+ messages in thread
From: Shahaf Shuler @ 2018-05-03 10:33 UTC (permalink / raw)
  To: Shahaf Shuler, Nélio Laranjeiro, Adrien Mazarguil, Yongseok Koh; +Cc: dev

Thursday, May 3, 2018 11:00 AM, Shahaf Shuler:
> Subject: [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix socket connection return
> value
> 
> Upon success, mlx5_socket_connect should return the fd descriptor of the
> primary process
> 
> Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
> 

Series applied to next-net-mlx with the DEBUG() comment fix. Thanks. 

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

end of thread, other threads:[~2018-05-03 10:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 11:18 [PATCH 1/2] net/mlx5: fix socket connection return value Shahaf Shuler
2018-05-01 11:18 ` [PATCH 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
2018-05-02  1:54   ` Yongseok Koh
2018-05-02  6:49     ` Nélio Laranjeiro
2018-05-03  7:40       ` Shahaf Shuler
2018-05-02  6:50 ` [PATCH 1/2] net/mlx5: fix socket connection return value Nélio Laranjeiro
2018-05-03  7:59 ` [PATCH v2 " Shahaf Shuler
2018-05-03 10:33   ` Shahaf Shuler
2018-05-03  7:59 ` [PATCH v2 2/2] net/mlx5: fix probe return value polarity Shahaf Shuler
2018-05-03  9:53   ` Nélio Laranjeiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.