net/ixgbe: do not return internal code in rte_eth_dev_reset

Message ID 20180821110649.26711-1-bluca@debian.org (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series net/ixgbe: do not return internal code in rte_eth_dev_reset |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Luca Boccassi Aug. 21, 2018, 11:06 a.m. UTC
  In case of a temporary failure the ixgbe driver can return the internal
error IXGBE_ERR_RESET_FAILED to the application. Instead, return
-EAGAIN as per the public API specification.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin Aug. 21, 2018, 11:17 a.m. UTC | #1
> -----Original Message-----
> From: Luca Boccassi [mailto:bluca@debian.org]
> Sent: Tuesday, August 21, 2018 12:07 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [PATCH] net/ixgbe: do not return internal code in rte_eth_dev_reset
> 
> In case of a temporary failure the ixgbe driver can return the internal
> error IXGBE_ERR_RESET_FAILED to the application. Instead, return
> -EAGAIN as per the public API specification.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
>  drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
> index 5b25a6b4d4..62f2bf2e7d 100644
> --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> @@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
>  		usec_delay(5);
>  	}
> 
> +	/*
> +	 * This error code will be propagated to the app by rte_eth_dev_reset,
> +	 * so use a public error code rather than the internal-only
> +	 * IXGBE_ERR_RESET_FAILED
> +	 */
>  	if (!timeout)
> -		return IXGBE_ERR_RESET_FAILED;
> +		return -EAGAIN;
> 
>  	/* Reset VF registers to initial values */
>  	ixgbe_virt_clr_reg(hw);
> --
> 2.18.0

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  
Qi Zhang Sept. 3, 2018, 12:54 p.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Luca Boccassi
> Sent: Tuesday, August 21, 2018 7:07 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Subject: [dpdk-dev] [PATCH] net/ixgbe: do not return internal code in
> rte_eth_dev_reset
> 
> In case of a temporary failure the ixgbe driver can return the internal error
> IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN as per
> the public API specification.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
>  drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c
> b/drivers/net/ixgbe/base/ixgbe_vf.c
> index 5b25a6b4d4..62f2bf2e7d 100644
> --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> @@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
>  		usec_delay(5);
>  	}
> 
> +	/*
> +	 * This error code will be propagated to the app by rte_eth_dev_reset,
> +	 * so use a public error code rather than the internal-only
> +	 * IXGBE_ERR_RESET_FAILED
> +	 */
>  	if (!timeout)
> -		return IXGBE_ERR_RESET_FAILED;
> +		return -EAGAIN;

I think it's better not to change this in base code which are assumed to only return IXGBE_ERR_xxx
And also this is not the only place in ixgbe_reset_hw_vf that will propagated the internal error.
Why not convert it in "eth_ixgbevf_dev_init" which looks like a right place?


> 
>  	/* Reset VF registers to initial values */
>  	ixgbe_virt_clr_reg(hw);
> --
> 2.18.0
  
Luca Boccassi Sept. 3, 2018, 2:18 p.m. UTC | #3
On Mon, 2018-09-03 at 12:54 +0000, Zhang, Qi Z wrote:
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Luca Boccassi
> > Sent: Tuesday, August 21, 2018 7:07 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>
> > Subject: [dpdk-dev] [PATCH] net/ixgbe: do not return internal code
> > in
> > rte_eth_dev_reset
> > 
> > In case of a temporary failure the ixgbe driver can return the
> > internal error
> > IXGBE_ERR_RESET_FAILED to the application. Instead, return -EAGAIN
> > as per
> > the public API specification.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_vf.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c
> > b/drivers/net/ixgbe/base/ixgbe_vf.c
> > index 5b25a6b4d4..62f2bf2e7d 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> > @@ -203,8 +203,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
> >  		usec_delay(5);
> >  	}
> > 
> > +	/*
> > +	 * This error code will be propagated to the app by
> > rte_eth_dev_reset,
> > +	 * so use a public error code rather than the internal-
> > only
> > +	 * IXGBE_ERR_RESET_FAILED
> > +	 */
> >  	if (!timeout)
> > -		return IXGBE_ERR_RESET_FAILED;
> > +		return -EAGAIN;
> 
> I think it's better not to change this in base code which are assumed
> to only return IXGBE_ERR_xxx
> And also this is not the only place in ixgbe_reset_hw_vf that will
> propagated the internal error.
> Why not convert it in "eth_ixgbevf_dev_init" which looks like a right
> place?

Ok, done in v2
  

Patch

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 5b25a6b4d4..62f2bf2e7d 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -203,8 +203,13 @@  s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
 		usec_delay(5);
 	}
 
+	/*
+	 * This error code will be propagated to the app by rte_eth_dev_reset,
+	 * so use a public error code rather than the internal-only
+	 * IXGBE_ERR_RESET_FAILED
+	 */
 	if (!timeout)
-		return IXGBE_ERR_RESET_FAILED;
+		return -EAGAIN;
 
 	/* Reset VF registers to initial values */
 	ixgbe_virt_clr_reg(hw);