From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 464C5429AA;
	Fri, 21 Apr 2023 10:46:46 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 4A3A742D46;
	Fri, 21 Apr 2023 10:46:15 +0200 (CEST)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by mails.dpdk.org (Postfix) with ESMTP id 0580D4114B
 for <dev@dpdk.org>; Fri, 21 Apr 2023 10:46:12 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1682066773; x=1713602773;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=na+DY3kJkdubMbrHkHHTx9PtdNDzHvcFhNbY3+/qo3k=;
 b=iuWytSi1iGuZMCv1zffKrPPr9GGxk2zTJk6VNOmXEmUYjwQYC/bODnq7
 Rb+GXbZNfC+xLW3Wxtv9IKFkqNNIaPEVD6fyPtLvraKho4svgiqaL5Jck
 lyzh0bX0DzAG7PcCWSh0wwRy7YPsa8sVzRoRtuD4ypPnE6adYoR2cvlUP
 GjGyrnaJM1otRjCzq3TLUib1iub7/wSiQJLtWEqBJ0m6UClAd9CbNC7k5
 94tYMhR3eyaOP1SBQynoiPXHBh3roGEAXnLXlPncs4F4i/HmWRu2e3xqf
 FWhD0p6o93jwswsRz3/k5U0/9FUfv+h1dY2EWNsHT4JNLFNoEm3S+/WoU g==;
X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="334822871"
X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="334822871"
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 21 Apr 2023 01:46:12 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="761501462"
X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="761501462"
Received: from dpdk-wenjing-01.sh.intel.com ([10.67.118.239])
 by fmsmga004.fm.intel.com with ESMTP; 21 Apr 2023 01:46:10 -0700
From: Wenjing Qiao <wenjing.qiao@intel.com>
To: jingjing.wu@intel.com,
	beilei.xing@intel.com,
	qi.z.zhang@intel.com
Cc: dev@dpdk.org, Wenjing Qiao <wenjing.qiao@intel.com>,
 Kazatsker Kirill <kirill.kazatsker@intel.com>,
 Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Subject: [PATCH v2 07/15] common/idpf: add virtchnl2 error codes
Date: Fri, 21 Apr 2023 04:40:35 -0400
Message-Id: <20230421084043.135503-8-wenjing.qiao@intel.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20230421084043.135503-1-wenjing.qiao@intel.com>
References: <20230413094502.1714755-2-wenjing.qiao@intel.com>
 <20230421084043.135503-1-wenjing.qiao@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Virtchnl2 error codes are required for meaningful failure
information sharing between CP and PF/VF. Introduce the
necessary error codes.

New error codes were introduced removing the old ones. So
the references to the old one should be modified to avoid
CI build failures.

Use appropriate error codes wherever necessary.

Signed-off-by: Kazatsker Kirill <kirill.kazatsker@intel.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/common/idpf/base/virtchnl2.h | 40 +++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h
index edf3f200b3..415e90358e 100644
--- a/drivers/common/idpf/base/virtchnl2.h
+++ b/drivers/common/idpf/base/virtchnl2.h
@@ -12,14 +12,34 @@
 
 #include "virtchnl2_lan_desc.h"
 
-/* Error Codes
- * Note that many older versions of various iAVF drivers convert the reported
- * status code directly into an iavf_status enumeration. For this reason, it
- * is important that the values of these enumerations line up.
- */
-#define		VIRTCHNL2_STATUS_SUCCESS		0
-#define		VIRTCHNL2_STATUS_ERR_PARAM		-5
-#define		VIRTCHNL2_STATUS_ERR_OPCODE_MISMATCH	-38
+/* VIRTCHNL2_ERROR_CODES */
+/* success */
+#define	VIRTCHNL2_STATUS_SUCCESS	0
+/* Operation not permitted, used in case of command not permitted for sender */
+#define	VIRTCHNL2_STATUS_ERR_EPERM	1
+/* Bad opcode - virtchnl interface problem */
+#define	VIRTCHNL2_STATUS_ERR_ESRCH	3
+/* I/O error - HW access error */
+#define	VIRTCHNL2_STATUS_ERR_EIO	5
+/* No such resource - Referenced resource is not allacated */
+#define	VIRTCHNL2_STATUS_ERR_ENXIO	6
+/* Permission denied - Resource is not permitted to caller */
+#define	VIRTCHNL2_STATUS_ERR_EACCES	13
+/* Device or resource busy - In case shared resource is in use by others */
+#define	VIRTCHNL2_STATUS_ERR_EBUSY	16
+/* Object already exists and not free */
+#define	VIRTCHNL2_STATUS_ERR_EEXIST	17
+/* Invalid input argument in command */
+#define	VIRTCHNL2_STATUS_ERR_EINVAL	22
+/* No space left or allocation failure */
+#define	VIRTCHNL2_STATUS_ERR_ENOSPC	28
+/* Parameter out of range */
+#define	VIRTCHNL2_STATUS_ERR_ERANGE	34
+
+/* Op not allowed in current dev mode */
+#define	VIRTCHNL2_STATUS_ERR_EMODE	200
+/* State Machine error - Command sequence problem */
+#define	VIRTCHNL2_STATUS_ERR_ESM	201
 
 /* These macros are used to generate compilation errors if a structure/union
  * is not exactly the correct length. It gives a divide by zero error if the
@@ -1445,11 +1465,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3
 	case VIRTCHNL2_OP_EVENT:
 	case VIRTCHNL2_OP_UNKNOWN:
 	default:
-		return VIRTCHNL2_STATUS_ERR_PARAM;
+		return VIRTCHNL2_STATUS_ERR_ESRCH;
 	}
 	/* few more checks */
 	if (err_msg_format || valid_len != msglen)
-		return VIRTCHNL2_STATUS_ERR_OPCODE_MISMATCH;
+		return VIRTCHNL2_STATUS_ERR_EINVAL;
 
 	return 0;
 }
-- 
2.25.1