From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A547B2C65 for ; Fri, 6 May 2016 17:13:35 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 06 May 2016 08:13:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,587,1455004800"; d="scan'208";a="98477511" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.220.75]) by fmsmga004.fm.intel.com with SMTP; 06 May 2016 08:13:33 -0700 Received: by (sSMTP sendmail emulation); Fri, 06 May 2016 16:13:32 +0025 Date: Fri, 6 May 2016 16:13:31 +0100 From: Bruce Richardson To: Jingjing Wu Cc: helin.zhang@intel.com, dev@dpdk.org Message-ID: <20160506151331.GG8880@bricha3-MOBL3> References: <1462429374-17620-1-git-send-email-jingjing.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462429374-17620-1-git-send-email-jingjing.wu@intel.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] i40evf: fix return value if command fails X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2016 15:13:36 -0000 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 > --- > 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