From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 590913777 for ; Mon, 9 May 2016 03:39:52 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 08 May 2016 18:39:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,598,1455004800"; d="scan'208";a="948895374" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 08 May 2016 18:39:50 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 8 May 2016 18:39:50 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 8 May 2016 18:39:50 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.58]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.237]) with mapi id 14.03.0248.002; Mon, 9 May 2016 09:39:48 +0800 From: "Wu, Jingjing" To: "Richardson, Bruce" CC: "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] i40evf: fix return value if command fails Thread-Index: AQHRppakc6bucSINrk2Eo7QKq71Ia5+rgGmAgARZY7A= Date: Mon, 9 May 2016 01:39:48 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F8E3B663@SHSMSX103.ccr.corp.intel.com> References: <1462429374-17620-1-git-send-email-jingjing.wu@intel.com> <20160506151331.GG8880@bricha3-MOBL3> In-Reply-To: <20160506151331.GG8880@bricha3-MOBL3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Mon, 09 May 2016 01:39:52 -0000 > -----Original Message----- > From: Richardson, Bruce > Sent: Friday, May 06, 2016 11:14 PM > To: Wu, Jingjing > Cc: Zhang, Helin; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] i40evf: fix return value if command fails >=20 > 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 =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > > struct i40evf_arq_msg_info info; > > enum i40evf_aq_result ret; > > - int err =3D -1; > > - int i =3D 0; > > + int err, i =3D 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 =3D -1; > > switch (args->ops) { > > case I40E_VIRTCHNL_OP_RESET_VF: > > /*no need to process in this function */ >=20 > Hi Jingjing, >=20 > 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 com= mit > message. If not, the "err =3D -1" should be put at the start of the do { = } while > loop for the GET_VF_RESOURCES command. >=20 > Perhaps to avoid future errors, each case in the switch should explicitly= set > it's own default error value? >=20 Yes, you reminded me the case I40E_VIRTCHNL_OP_RESET_VF. Let me rework this= . Thanks Jingjing > /Bruce