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 ECE04A0548; Sun, 25 Apr 2021 07:05:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B580940685; Sun, 25 Apr 2021 07:05:06 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 13E1A4013F; Sun, 25 Apr 2021 07:05:04 +0200 (CEST) IronPort-SDR: 4EYO1vA7KDv0Zc/1GQTo9780Pvlji2CWHrcOlriBzxygv+iJ1i0zJrUmm/OpIyBm/2i4/eIoG2 Y7NTw+du91Sg== X-IronPort-AV: E=McAfee;i="6200,9189,9964"; a="175695596" X-IronPort-AV: E=Sophos;i="5.82,249,1613462400"; d="scan'208";a="175695596" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2021 22:05:03 -0700 IronPort-SDR: GkfR3yFGgIz38YtSLpwtIi0aJwvdfGHzgShUetFWOIC7yni7sTOH85HbFsWlHw28XJ27r3a14m +BtR3vm4meJQ== X-IronPort-AV: E=Sophos;i="5.82,249,1613462400"; d="scan'208";a="464744621" Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2021 22:05:01 -0700 From: Alvin Zhang To: jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, Alvin Zhang , stable@dpdk.org Date: Sun, 25 Apr 2021 13:04:54 +0800 Message-Id: <20210425050454.12324-1-alvinx.zhang@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] 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" 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 --- 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