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 6A75DA0C47 for ; Fri, 11 Jun 2021 03:40:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57C784014F; Fri, 11 Jun 2021 03:40:31 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 02E184014F for ; Fri, 11 Jun 2021 03:40:29 +0200 (CEST) IronPort-SDR: l7wbQmfzy9VUhlYbi4DmwdMvdOONUoU3J5iFKczSZLdc/8AA6j8qh1PVydT5/iSQsM3Iw+tA05 ZveCyRPXXwuA== X-IronPort-AV: E=McAfee;i="6200,9189,10011"; a="192757406" X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="192757406" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2021 18:40:28 -0700 IronPort-SDR: 0oLXyMkElYRzlkLz8nyeF7VHej6ECGDi0ACNexHf7tT/eQSCg28UF1ru0Xe7wQ+6Jj2qEXRsvv tV7T+HsCLBvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="553264178" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2021 18:40:27 -0700 From: Qi Zhang To: bluca@debian.org Cc: vitaliy.zakharchenko@intel.com, arjun.anantharam@intel.com, stable@dpdk.org, Qi Zhang , Ngai-mint Kwan Date: Fri, 11 Jun 2021 09:43:43 +0800 Message-Id: <20210611014343.133471-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [DPDK 20.11] net/iavf: fix error handling for unsupported promisc config X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 308f75b5c9cc5ca3e972dbc84375bdee353c3156 ] [ upstream commit 0c35eecfe8b54bbdf59c30a803404acfdcc4f7eb ] 1. The VIRTCHNL_STATUS_ERR_NOT_SUPPORTED should be esculated to upper with -ENOTSUP in iavf_execute_vf_cmd. 2. fix error code check in iavf_config_promisc 3. change vf->cmd_ret_val from unsigned to signed as it will compare with negtive value. Signed-off-by: Qi Zhang Signed-off-by: Ngai-mint Kwan --- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_vchnl.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 0196f74721..4bcb407b20 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -136,7 +136,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 */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 3d52a8c402..219245d040 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -228,12 +228,18 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) /* 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; + if (i >= MAX_TRY_TIMES) { PMD_DRV_LOG(ERR, "No response or return failure (%d)" " for cmd %d", vf->cmd_retval, args->ops); _clear_cmd(vf); + err = -EIO; + } else if (vf->cmd_retval == 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; } @@ -1099,8 +1105,8 @@ iavf_config_promisc(struct iavf_adapter *adapter, PMD_DRV_LOG(ERR, "fail to execute command CONFIG_PROMISCUOUS_MODE"); - if (err == IAVF_NOT_SUPPORTED) - return -ENOTSUP; + if (err == -ENOTSUP) + return err; return -EAGAIN; } -- 2.26.2