From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E3425A0548; Mon, 26 Apr 2021 06:43:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 562E3410D8; Mon, 26 Apr 2021 06:43:19 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D288440A4B; Mon, 26 Apr 2021 06:43:16 +0200 (CEST) IronPort-SDR: yO1BPBls4EoxgomQycO6cj3NBfkqeR1RfEQX5M6K8NDTwRr/HbKvFBrwXqx5Sy7DxA2bNqk2jH z+bsW7Djlefg== X-IronPort-AV: E=McAfee;i="6200,9189,9965"; a="183761835" X-IronPort-AV: E=Sophos;i="5.82,251,1613462400"; d="scan'208";a="183761835" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2021 21:43:15 -0700 IronPort-SDR: UFPQmtGJUgUx2TdYD3ELRabcXaIdU144u0Hh36ApFtUPgQiGqc02I6fA169kd/zZA2m4fPKSjc 3C2JfpCCSRsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,251,1613462400"; d="scan'208";a="615215366" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga006.fm.intel.com with ESMTP; 25 Apr 2021 21:43:15 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sun, 25 Apr 2021 21:43:14 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 26 Apr 2021 12:43:12 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2106.013; Mon, 26 Apr 2021 12:43:11 +0800 From: "Zhang, Qi Z" To: "Xing, Beilei" , "Zhang, AlvinX" , "Wu, Jingjing" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/iavf: fix PF returning error Thread-Index: AQHXOjxMW7UwWWIp3kCqDP+KTqAIjqrGOMnA Date: Mon, 26 Apr 2021 04:43:11 +0000 Message-ID: <0d782b938de74af4b7b1fe1ea7f7a110@intel.com> References: <20210425050454.12324-1-alvinx.zhang@intel.com> <20210425073934.14884-1-alvinx.zhang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/iavf: fix PF returning error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Xing, Beilei > Sent: Monday, April 26, 2021 9:34 AM > To: Zhang, AlvinX ; Wu, Jingjing > > Cc: dev@dpdk.org; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] net/iavf: fix PF returning error >=20 >=20 >=20 > > -----Original Message----- > > From: Zhang, AlvinX > > Sent: Sunday, April 25, 2021 3:40 PM > > To: Wu, Jingjing ; Xing, Beilei > > > > Cc: dev@dpdk.org; Zhang, AlvinX ; > > 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 > > --- > > > > 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 =3D 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 >=3D MAX_TRY_TIMES || > > - vf->cmd_retval !=3D VIRTCHNL_STATUS_SUCCESS) { > > - err =3D -1; > > - PMD_DRV_LOG(ERR, "No response or return failure > > (%d)" > > - " for cmd %d", vf->cmd_retval, args->ops); > > + > > + if (i >=3D MAX_TRY_TIMES) { > > + PMD_DRV_LOG(ERR, "No response for cmd %d", args- > > >ops); > > _clear_cmd(vf); > > + err =3D -EIO; > > + } else if (vf->cmd_retval =3D=3D > > + VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) { > > + PMD_DRV_LOG(ERR, "Cmd %d not supported", args- > > >ops); > > + err =3D -ENOTSUP; > > + } else if (vf->cmd_retval !=3D VIRTCHNL_STATUS_SUCCESS) { > > + PMD_DRV_LOG(ERR, "Return failure %d for cmd %d", > > + vf->cmd_retval, args->ops); > > + err =3D -EINVAL; > > } > > break; > > } > > -- > > 1.8.3.1 >=20 > Acked-by: Beilei Xing Applied to dpdk-next-net-intel. Thanks Qi