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 77D76A0032;
	Fri, 24 Jun 2022 14:11:09 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 5EB684069D;
	Fri, 24 Jun 2022 14:11:09 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 3F884400EF
 for <dev@dpdk.org>; Fri, 24 Jun 2022 14:11:08 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25O79QVi020610;
 Fri, 24 Jun 2022 05:11:07 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : mime-version : content-transfer-encoding :
 content-type; s=pfpt0220; bh=YkQD+8qusWCkUrSYhhqAf+jnnw/njZNTdaLyM4OOndk=;
 b=akd4reHaJ2dmim00vqdyIbTdvwBn1bE5OUDi/8Vj375uMnpfueSwkjtIfj2HUnbKPnEo
 YBLhfNx4gdyCED7LqAwWBBrGa7GydagsjjH2hxIZrB3h6VmLxhUGnUeMDf3ahEHu4DgD
 S3h8SlXmUO+TqJRoY1V2mPCeN4mBsf67P3jqs/hI4p2H3QOUwiWkj/GT3HpCL58hVsN6
 VX1qbeqxYt0LTKqmNQNYO4NuTqsDyF9zFFyuw4EvX099ybvyABLmD1DwVL0EKwjEyI7t
 wjXU3shEtvFkAQIYl/5+ofRnuFNKK3bTYLAhJhWV1KZPZNIyTW+yv9XDrggMzdUg22+b 0w== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3gw8ms13fy-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Fri, 24 Jun 2022 05:11:07 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Fri, 24 Jun 2022 05:11:05 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend
 Transport; Fri, 24 Jun 2022 05:11:05 -0700
Received: from localhost.localdomain (unknown [10.28.36.175])
 by maili.marvell.com (Postfix) with ESMTP id D5F1E3F704F;
 Fri, 24 Jun 2022 05:11:03 -0700 (PDT)
From: Srujana Challa <schalla@marvell.com>
To: <gakhil@marvell.com>, <roy.fan.zhang@intel.com>
CC: <dev@dpdk.org>, <jerinj@marvell.com>, <ndabilpuram@marvell.com>,
 <anoobj@marvell.com>
Subject: [RFC PATCH] cryptodev: add return parameter to callback process API
Date: Fri, 24 Jun 2022 17:41:02 +0530
Message-ID: <20220624121102.3450560-1-schalla@marvell.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: Az4tsyWcJbbB23-bh11LQvHpZu3LxTMD
X-Proofpoint-GUID: Az4tsyWcJbbB23-bh11LQvHpZu3LxTMD
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1
 definitions=2022-06-24_07,2022-06-23_01,2022-06-22_01
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

Adds a return parameter "uint16_t qp_id" to the functions
rte_cryptodev_pmd_callback_process and rte_cryptodev_cb_fn.
The new parameter is used to return queue pair ID to
the application when it gets error interrupt, so that
application can disable and enable the queue pair, to bring
the queue back to normal state.

Signed-off-by: Srujana Challa <schalla@marvell.com>
Change-Id: I423c4fd6b8c3d910c60e3a6d4f17534756299213
---
 lib/cryptodev/cryptodev_pmd.h | 3 ++-
 lib/cryptodev/rte_cryptodev.c | 8 ++++----
 lib/cryptodev/rte_cryptodev.h | 9 ++++++---
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3dcc3cb7ed..f087b58161 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -560,6 +560,7 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
  * device.
  *  *
  * @param	dev	Pointer to cryptodev struct
+ * @param	qp_id	To pass qp_id, which got interrupt, to user application.
  * @param	event	Crypto device interrupt event type.
  *
  * @return
@@ -567,7 +568,7 @@ rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev);
  */
 __rte_internal
 void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
-				enum rte_cryptodev_event_type event);
+			uint16_t qp_id, enum rte_cryptodev_event_type event);
 
 /**
  * @internal
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..eee208ce2d 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1689,8 +1689,8 @@ rte_cryptodev_callback_unregister(uint8_t dev_id,
 }
 
 void
-rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
-	enum rte_cryptodev_event_type event)
+rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev, uint16_t qp_id,
+				   enum rte_cryptodev_event_type event)
 {
 	struct rte_cryptodev_callback *cb_lst;
 	struct rte_cryptodev_callback dev_cb;
@@ -1702,8 +1702,8 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
 		rte_spinlock_unlock(&rte_cryptodev_cb_lock);
-		dev_cb.cb_fn(dev->data->dev_id, dev_cb.event,
-						dev_cb.cb_arg);
+		dev_cb.cb_fn(dev->data->dev_id, qp_id, dev_cb.event,
+			     dev_cb.cb_arg);
 		rte_spinlock_lock(&rte_cryptodev_cb_lock);
 		cb_lst->active = 0;
 	}
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 56f459c6a0..6b41262735 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -577,13 +577,16 @@ typedef uint16_t (*rte_cryptodev_callback_fn)(uint16_t dev_id, uint16_t qp_id,
  * software for notification of device events
  *
  * @param	dev_id	Crypto device identifier
+ * @param	qp_id	Return parameter from driver to the application. Driver
+ *			returns queue pair ID when it gets HW error interrupt.
+ *			The application can release and setup the queue
+ *			again, to bring the HW queue back to normal state.
  * @param	event	Crypto device event to register for notification of.
  * @param	cb_arg	User specified parameter to be passed as to passed to
  *			users callback function.
  */
-typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id,
-		enum rte_cryptodev_event_type event, void *cb_arg);
-
+typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id, uint16_t qp_id,
+	enum rte_cryptodev_event_type event, void *cb_arg);
 
 /** Crypto Device statistics */
 struct rte_cryptodev_stats {
-- 
2.25.1