patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/iavf: fix PF returning error
@ 2021-04-25  5:04 Alvin Zhang
  2021-04-25  6:06 ` Xing, Beilei
  2021-04-25  7:39 ` [dpdk-stable] [PATCH v2] " Alvin Zhang
  0 siblings, 2 replies; 5+ messages in thread
From: Alvin Zhang @ 2021-04-25  5:04 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, Alvin Zhang, stable

When the command sent by VF to PF fails, iavf may need to run
different code paths according to the specific reason of the
failure (not supported or other reasons).

This patch adds support of identifying PF return error type.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 45096cb..6586fc3 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -228,13 +228,19 @@
 			rte_delay_ms(ASQ_DELAY_MS);
 			/* If don't read msg or read sys event, continue */
 		} while (i++ < MAX_TRY_TIMES);
-		/* If there's no response is received, clear command */
-		if (i >= MAX_TRY_TIMES  ||
-		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
-			err = -1;
-			PMD_DRV_LOG(ERR, "No response or return failure (%d)"
-				    " for cmd %d", vf->cmd_retval, args->ops);
+
+		if (i >= MAX_TRY_TIMES) {
+			PMD_DRV_LOG(ERR, "No response for cmd %d", args->ops);
 			_clear_cmd(vf);
+			err = -EIO;
+		} else if (vf->cmd_retval ==
+			   (uint32_t)VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
+			PMD_DRV_LOG(ERR, "Cmd %d not supported", args->ops);
+			err = -ENOTSUP;
+		} else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+			PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
+				    vf->cmd_retval, args->ops);
+			err = -EINVAL;
 		}
 		break;
 	}
-- 
1.8.3.1


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

* Re: [dpdk-stable] [PATCH] net/iavf: fix PF returning error
  2021-04-25  5:04 [dpdk-stable] [PATCH] net/iavf: fix PF returning error Alvin Zhang
@ 2021-04-25  6:06 ` Xing, Beilei
  2021-04-25  7:39 ` [dpdk-stable] [PATCH v2] " Alvin Zhang
  1 sibling, 0 replies; 5+ messages in thread
From: Xing, Beilei @ 2021-04-25  6:06 UTC (permalink / raw)
  To: Zhang, AlvinX, Wu, Jingjing; +Cc: dev, stable



> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Sunday, April 25, 2021 1:05 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/iavf: fix PF returning error
> 
> When the command sent by VF to PF fails, iavf may need to run different code
> paths according to the specific reason of the failure (not supported or other
> reasons).
> 
> This patch adds support of identifying PF return error type.
> 
> Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>  drivers/net/iavf/iavf_vchnl.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> 45096cb..6586fc3 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -228,13 +228,19 @@
>  			rte_delay_ms(ASQ_DELAY_MS);
>  			/* If don't read msg or read sys event, continue */
>  		} while (i++ < MAX_TRY_TIMES);
> -		/* If there's no response is received, clear command */
> -		if (i >= MAX_TRY_TIMES  ||
> -		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
> -			err = -1;
> -			PMD_DRV_LOG(ERR, "No response or return failure
> (%d)"
> -				    " for cmd %d", vf->cmd_retval, args->ops);
> +
> +		if (i >= MAX_TRY_TIMES) {
> +			PMD_DRV_LOG(ERR, "No response for cmd %d", args-
> >ops);
>  			_clear_cmd(vf);
> +			err = -EIO;
> +		} else if (vf->cmd_retval ==
> +			   (uint32_t)VIRTCHNL_STATUS_ERR_NOT_SUPPORTED)

Can we change 'uint32_t cmd_retval' to 'enum virtchnl_status_code cmd_retval' in iavf_info structure? Then we needn't cast here.

> {
> +			PMD_DRV_LOG(ERR, "Cmd %d not supported", args-
> >ops);
> +			err = -ENOTSUP;
> +		} else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
> +			PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
> +				    vf->cmd_retval, args->ops);
> +			err = -EINVAL;
>  		}
>  		break;
>  	}
> --
> 1.8.3.1


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

* [dpdk-stable] [PATCH v2] net/iavf: fix PF returning error
  2021-04-25  5:04 [dpdk-stable] [PATCH] net/iavf: fix PF returning error Alvin Zhang
  2021-04-25  6:06 ` Xing, Beilei
@ 2021-04-25  7:39 ` Alvin Zhang
  2021-04-26  1:34   ` Xing, Beilei
  1 sibling, 1 reply; 5+ messages in thread
From: Alvin Zhang @ 2021-04-25  7:39 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, Alvin Zhang, stable

When the command sent by VF to PF fails, iavf may need to run
different code paths according to the specific reason of the
failure (not supported or other reasons).

This patch adds support of identifying PF return error type.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---

v2: Refine codes according to comments.
---
 drivers/net/iavf/iavf.h       |  4 ++--
 drivers/net/iavf/iavf_vchnl.c | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index d1ae5a3..4a2e203 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -144,7 +144,7 @@ struct iavf_info {
 	uint64_t supported_rxdid;
 	uint8_t *proto_xtr; /* proto xtr type for all queues */
 	volatile enum virtchnl_ops pend_cmd; /* pending command not finished */
-	uint32_t cmd_retval; /* return value of the cmd response from PF */
+	int cmd_retval; /* return value of the cmd response from PF */
 	uint8_t *aq_resp; /* buffer to store the adminq response from PF */
 
 	/* Event from pf */
@@ -264,7 +264,7 @@ struct iavf_cmd_info {
  * _atomic_set_cmd successfully.
  */
 static inline void
-_notify_cmd(struct iavf_info *vf, uint32_t msg_ret)
+_notify_cmd(struct iavf_info *vf, int msg_ret)
 {
 	vf->cmd_retval = msg_ret;
 	rte_wmb();
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 45096cb..f2b46f1 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -228,13 +228,19 @@
 			rte_delay_ms(ASQ_DELAY_MS);
 			/* If don't read msg or read sys event, continue */
 		} while (i++ < MAX_TRY_TIMES);
-		/* If there's no response is received, clear command */
-		if (i >= MAX_TRY_TIMES  ||
-		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
-			err = -1;
-			PMD_DRV_LOG(ERR, "No response or return failure (%d)"
-				    " for cmd %d", vf->cmd_retval, args->ops);
+
+		if (i >= MAX_TRY_TIMES) {
+			PMD_DRV_LOG(ERR, "No response for cmd %d", args->ops);
 			_clear_cmd(vf);
+			err = -EIO;
+		} else if (vf->cmd_retval ==
+			   VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
+			PMD_DRV_LOG(ERR, "Cmd %d not supported", args->ops);
+			err = -ENOTSUP;
+		} else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+			PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
+				    vf->cmd_retval, args->ops);
+			err = -EINVAL;
 		}
 		break;
 	}
-- 
1.8.3.1


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

* Re: [dpdk-stable] [PATCH v2] net/iavf: fix PF returning error
  2021-04-25  7:39 ` [dpdk-stable] [PATCH v2] " Alvin Zhang
@ 2021-04-26  1:34   ` Xing, Beilei
  2021-04-26  4:43     ` Zhang, Qi Z
  0 siblings, 1 reply; 5+ messages in thread
From: Xing, Beilei @ 2021-04-26  1:34 UTC (permalink / raw)
  To: Zhang, AlvinX, Wu, Jingjing; +Cc: dev, stable



> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Sunday, April 25, 2021 3:40 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/iavf: fix PF returning error
> 
> When the command sent by VF to PF fails, iavf may need to run different code
> paths according to the specific reason of the failure (not supported or other
> reasons).
> 
> This patch adds support of identifying PF return error type.
> 
> Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
> 
> v2: Refine codes according to comments.
> ---
>  drivers/net/iavf/iavf.h       |  4 ++--
>  drivers/net/iavf/iavf_vchnl.c | 18 ++++++++++++------
>  2 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> d1ae5a3..4a2e203 100644
> --- a/drivers/net/iavf/iavf.h
> +++ b/drivers/net/iavf/iavf.h
> @@ -144,7 +144,7 @@ struct iavf_info {
>  	uint64_t supported_rxdid;
>  	uint8_t *proto_xtr; /* proto xtr type for all queues */
>  	volatile enum virtchnl_ops pend_cmd; /* pending command not
> finished */
> -	uint32_t cmd_retval; /* return value of the cmd response from PF */
> +	int cmd_retval; /* return value of the cmd response from PF */
>  	uint8_t *aq_resp; /* buffer to store the adminq response from PF */
> 
>  	/* Event from pf */
> @@ -264,7 +264,7 @@ struct iavf_cmd_info {
>   * _atomic_set_cmd successfully.
>   */
>  static inline void
> -_notify_cmd(struct iavf_info *vf, uint32_t msg_ret)
> +_notify_cmd(struct iavf_info *vf, int msg_ret)
>  {
>  	vf->cmd_retval = msg_ret;
>  	rte_wmb();
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> 45096cb..f2b46f1 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -228,13 +228,19 @@
>  			rte_delay_ms(ASQ_DELAY_MS);
>  			/* If don't read msg or read sys event, continue */
>  		} while (i++ < MAX_TRY_TIMES);
> -		/* If there's no response is received, clear command */
> -		if (i >= MAX_TRY_TIMES  ||
> -		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
> -			err = -1;
> -			PMD_DRV_LOG(ERR, "No response or return failure
> (%d)"
> -				    " for cmd %d", vf->cmd_retval, args->ops);
> +
> +		if (i >= MAX_TRY_TIMES) {
> +			PMD_DRV_LOG(ERR, "No response for cmd %d", args-
> >ops);
>  			_clear_cmd(vf);
> +			err = -EIO;
> +		} else if (vf->cmd_retval ==
> +			   VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
> +			PMD_DRV_LOG(ERR, "Cmd %d not supported", args-
> >ops);
> +			err = -ENOTSUP;
> +		} else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
> +			PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
> +				    vf->cmd_retval, args->ops);
> +			err = -EINVAL;
>  		}
>  		break;
>  	}
> --
> 1.8.3.1

Acked-by: Beilei Xing <beilei.xing@intel.com>


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

* Re: [dpdk-stable] [PATCH v2] net/iavf: fix PF returning error
  2021-04-26  1:34   ` Xing, Beilei
@ 2021-04-26  4:43     ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2021-04-26  4:43 UTC (permalink / raw)
  To: Xing, Beilei, Zhang, AlvinX, Wu, Jingjing; +Cc: dev, stable



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> Sent: Monday, April 26, 2021 9:34 AM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/iavf: fix PF returning error
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, AlvinX <alvinx.zhang@intel.com>
> > Sent: Sunday, April 25, 2021 3:40 PM
> > To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH v2] net/iavf: fix PF returning error
> >
> > When the command sent by VF to PF fails, iavf may need to run
> > different code paths according to the specific reason of the failure
> > (not supported or other reasons).
> >
> > This patch adds support of identifying PF return error type.
> >
> > Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> > ---
> >
> > v2: Refine codes according to comments.
> > ---
> >  drivers/net/iavf/iavf.h       |  4 ++--
> >  drivers/net/iavf/iavf_vchnl.c | 18 ++++++++++++------
> >  2 files changed, 14 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> > d1ae5a3..4a2e203 100644
> > --- a/drivers/net/iavf/iavf.h
> > +++ b/drivers/net/iavf/iavf.h
> > @@ -144,7 +144,7 @@ struct iavf_info {
> >  	uint64_t supported_rxdid;
> >  	uint8_t *proto_xtr; /* proto xtr type for all queues */
> >  	volatile enum virtchnl_ops pend_cmd; /* pending command not finished
> > */
> > -	uint32_t cmd_retval; /* return value of the cmd response from PF */
> > +	int cmd_retval; /* return value of the cmd response from PF */
> >  	uint8_t *aq_resp; /* buffer to store the adminq response from PF */
> >
> >  	/* Event from pf */
> > @@ -264,7 +264,7 @@ struct iavf_cmd_info {
> >   * _atomic_set_cmd successfully.
> >   */
> >  static inline void
> > -_notify_cmd(struct iavf_info *vf, uint32_t msg_ret)
> > +_notify_cmd(struct iavf_info *vf, int msg_ret)
> >  {
> >  	vf->cmd_retval = msg_ret;
> >  	rte_wmb();
> > diff --git a/drivers/net/iavf/iavf_vchnl.c
> > b/drivers/net/iavf/iavf_vchnl.c index
> > 45096cb..f2b46f1 100644
> > --- a/drivers/net/iavf/iavf_vchnl.c
> > +++ b/drivers/net/iavf/iavf_vchnl.c
> > @@ -228,13 +228,19 @@
> >  			rte_delay_ms(ASQ_DELAY_MS);
> >  			/* If don't read msg or read sys event, continue */
> >  		} while (i++ < MAX_TRY_TIMES);
> > -		/* If there's no response is received, clear command */
> > -		if (i >= MAX_TRY_TIMES  ||
> > -		    vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
> > -			err = -1;
> > -			PMD_DRV_LOG(ERR, "No response or return failure
> > (%d)"
> > -				    " for cmd %d", vf->cmd_retval, args->ops);
> > +
> > +		if (i >= MAX_TRY_TIMES) {
> > +			PMD_DRV_LOG(ERR, "No response for cmd %d", args-
> > >ops);
> >  			_clear_cmd(vf);
> > +			err = -EIO;
> > +		} else if (vf->cmd_retval ==
> > +			   VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
> > +			PMD_DRV_LOG(ERR, "Cmd %d not supported", args-
> > >ops);
> > +			err = -ENOTSUP;
> > +		} else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
> > +			PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
> > +				    vf->cmd_retval, args->ops);
> > +			err = -EINVAL;
> >  		}
> >  		break;
> >  	}
> > --
> > 1.8.3.1
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2021-04-26  4:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25  5:04 [dpdk-stable] [PATCH] net/iavf: fix PF returning error Alvin Zhang
2021-04-25  6:06 ` Xing, Beilei
2021-04-25  7:39 ` [dpdk-stable] [PATCH v2] " Alvin Zhang
2021-04-26  1:34   ` Xing, Beilei
2021-04-26  4:43     ` Zhang, Qi Z

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