DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Jingjing Wu <jingjing.wu@intel.com>
Cc: helin.zhang@intel.com, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] i40evf: fix return value if command fails
Date: Fri, 6 May 2016 16:13:31 +0100	[thread overview]
Message-ID: <20160506151331.GG8880@bricha3-MOBL3> (raw)
In-Reply-To: <1462429374-17620-1-git-send-email-jingjing.wu@intel.com>

On Thu, May 05, 2016 at 02:22:54PM +0800, Jingjing Wu wrote:
> Previously, if message is sent successfully, but no response is
> received, function "i40evf_execute_vf_cmd" will return without error.
> The root cause is value "err" is overwritten. This patch fixes it.
> 
> Fixes: ae19955e7c86 ("i40evf: support reporting PF reset")
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index 2bce69b..9380019 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -327,8 +327,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
>  	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
>  	struct i40evf_arq_msg_info info;
>  	enum i40evf_aq_result ret;
> -	int err = -1;
> -	int i = 0;
> +	int err, i = 0;
>  
>  	if (_atomic_set_cmd(vf, args->ops))
>  		return -1;
> @@ -346,6 +345,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args)
>  		return err;
>  	}
>  
> +	err = -1;
>  	switch (args->ops) {
>  	case I40E_VIRTCHNL_OP_RESET_VF:
>  		/*no need to process in this function */

Hi Jingjing,

this patch changes this return value in this case (I40E_VIRTCHNL_OP_RESET_VF).
Is this intentional - if so it probably needs to be documented in the commit
message. If not, the "err = -1" should be put at the start of the do { } while
loop for the GET_VF_RESOURCES command.

Perhaps to avoid future errors, each case in the switch should explicitly set
it's own default error value?

/Bruce

  reply	other threads:[~2016-05-06 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05  6:22 Jingjing Wu
2016-05-06 15:13 ` Bruce Richardson [this message]
2016-05-09  1:39   ` Wu, Jingjing
2016-05-10  2:51 ` [dpdk-dev] [PATCH v2] " Jingjing Wu
2016-05-30 16:31   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160506151331.GG8880@bricha3-MOBL3 \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).