All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, fiona.trahe@intel.com,
	roy.fan.zhang@intel.com,
	Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [dpdk-dev] [PATCH v2 13/16] common/qat: add service discovery to qat gen4
Date: Mon, 28 Jun 2021 17:34:31 +0100	[thread overview]
Message-ID: <20210628163434.77741-14-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20210628163434.77741-1-arkadiuszx.kusztal@intel.com>

This commit adds service discovery to generation four
of Intel QuickAssist Technology devices.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 drivers/common/qat/qat_common.h |  8 ++++++
 drivers/common/qat/qat_device.c | 20 ++++++++++++---
 drivers/common/qat/qat_device.h |  3 +++
 drivers/common/qat/qat_qp.c     | 43 +++++++++++++++++++++++++--------
 drivers/common/qat/qat_qp.h     |  3 +--
 5 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/drivers/common/qat/qat_common.h b/drivers/common/qat/qat_common.h
index 845c8d99ab..23715085f4 100644
--- a/drivers/common/qat/qat_common.h
+++ b/drivers/common/qat/qat_common.h
@@ -29,6 +29,14 @@ enum qat_service_type {
 	QAT_SERVICE_INVALID
 };
 
+enum qat_svc_list {
+	QAT_SVC_UNUSED = 0,
+	QAT_SVC_CRYPTO = 1,
+	QAT_SVC_COMPRESSION = 2,
+	QAT_SVC_SYM = 3,
+	QAT_SVC_ASYM = 4,
+};
+
 #define QAT_MAX_SERVICES		(QAT_SERVICE_INVALID)
 
 /**< Common struct for scatter-gather list operations */
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index e52d90fcd7..1b967cbcf7 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -148,6 +148,22 @@ qat_gen4_reset_ring_pair(struct qat_pci_device *qat_pci_dev)
 	return 0;
 }
 
+int qat_query_svc(struct qat_pci_device *qat_dev, uint8_t *val)
+{
+	int ret = -(EINVAL);
+	struct qat_pf2vf_msg pf2vf_msg;
+
+	if (qat_dev->qat_dev_gen == QAT_GEN4) {
+		pf2vf_msg.msg_type = ADF_VF2PF_MSGTYPE_GET_SMALL_BLOCK_REQ;
+		pf2vf_msg.block_hdr = ADF_VF2PF_BLOCK_MSG_GET_RING_TO_SVC_REQ;
+		pf2vf_msg.msg_data = 2;
+		ret = qat_pf2vf_exch_msg(qat_dev, pf2vf_msg, 2, val);
+	}
+
+	return ret;
+}
+
+
 static void qat_dev_parse_cmd(const char *str, struct qat_dev_cmd_param
 		*qat_dev_cmd_param)
 {
@@ -296,9 +312,7 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev,
 		qat_dev_parse_cmd(devargs->drv_str, qat_dev_cmd_param);
 
 	if (qat_dev->qat_dev_gen >= QAT_GEN4) {
-		int ret = qat_read_qp_config(qat_dev, qat_dev->qat_dev_gen);
-
-		if (ret) {
+		if (qat_read_qp_config(qat_dev)) {
 			QAT_LOG(ERR,
 				"Cannot acquire ring configuration for QAT_%d",
 				qat_dev_id);
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index 05e164baa7..228c057d1e 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -159,4 +159,7 @@ qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused,
 int
 qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
 
+int
+qat_query_svc(struct qat_pci_device *qat_pci_dev, uint8_t *ret);
+
 #endif /* _QAT_DEVICE_H_ */
diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 8be59779f9..026ea5ee01 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -504,20 +504,43 @@ qat_select_valid_queue(struct qat_pci_device *qat_dev, int qp_id,
 }
 
 int
-qat_read_qp_config(struct qat_pci_device *qat_dev,
-			enum qat_device_gen qat_dev_gen)
+qat_read_qp_config(struct qat_pci_device *qat_dev)
 {
+	int i = 0;
+	enum qat_device_gen qat_dev_gen = qat_dev->qat_dev_gen;
+
 	if (qat_dev_gen == QAT_GEN4) {
-		/* Read default configuration,
-		 * until some probe of it can be done
-		 */
-		int i = 0;
+		uint16_t svc = 0;
 
+		if (qat_query_svc(qat_dev, (uint8_t *)&svc))
+			return -(EFAULT);
 		for (; i < QAT_GEN4_BUNDLE_NUM; i++) {
 			struct qat_qp_hw_data *hw_data =
 				&qat_dev->qp_gen4_data[i][0];
-			enum qat_service_type service_type =
-				(QAT_GEN4_QP_DEFCON >> (8 * i)) & 0xFF;
+			uint8_t svc1 = (svc >> (3 * i)) & 0x7;
+			enum qat_service_type service_type = QAT_SERVICE_INVALID;
+
+			if (svc1 == QAT_SVC_SYM) {
+				service_type = QAT_SERVICE_SYMMETRIC;
+				QAT_LOG(DEBUG,
+					"Discovered SYMMETRIC service on bundle %d",
+					i);
+			} else if (svc1 == QAT_SVC_COMPRESSION) {
+				service_type = QAT_SERVICE_COMPRESSION;
+				QAT_LOG(DEBUG,
+					"Discovered COPRESSION service on bundle %d",
+					i);
+			} else if (svc1 == QAT_SVC_ASYM) {
+				service_type = QAT_SERVICE_ASYMMETRIC;
+				QAT_LOG(DEBUG,
+					"Discovered ASYMMETRIC service on bundle %d",
+					i);
+			} else {
+				QAT_LOG(ERR,
+					"Unrecognized service on bundle %d",
+					i);
+				return -(EFAULT);
+			}
 
 			memset(hw_data, 0, sizeof(*hw_data));
 			hw_data->service_type = service_type;
@@ -534,9 +557,9 @@ qat_read_qp_config(struct qat_pci_device *qat_dev,
 			hw_data->rx_ring_num = 1;
 			hw_data->hw_bundle_num = i;
 		}
+		return 0;
 	}
-	/* With default config will always return success */
-	return 0;
+	return -(EINVAL);
 }
 
 static int qat_qp_check_queue_alignment(uint64_t phys_addr,
diff --git a/drivers/common/qat/qat_qp.h b/drivers/common/qat/qat_qp.h
index 3d9a757349..e1627197fa 100644
--- a/drivers/common/qat/qat_qp.h
+++ b/drivers/common/qat/qat_qp.h
@@ -134,7 +134,6 @@ qat_select_valid_queue(struct qat_pci_device *qat_dev, int qp_id,
 			enum qat_service_type service_type);
 
 int
-qat_read_qp_config(struct qat_pci_device *qat_dev,
-			enum qat_device_gen qat_dev_gen);
+qat_read_qp_config(struct qat_pci_device *qat_dev);
 
 #endif /* _QAT_QP_H_ */
-- 
2.30.2


  parent reply	other threads:[~2021-06-28 16:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 16:34 [dpdk-dev] [PATCH v2 00/16] Add support for fourth generation of Intel QuickAssist Technology devices Arek Kusztal
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 01/16] common/qat: rework qp per service function Arek Kusztal
2021-06-29 12:15   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 02/16] crypto/qat: add support for generation 4 devices Arek Kusztal
2021-06-29 12:15   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 03/16] crypto/qat: enable gen4 legacy algorithms Arek Kusztal
2021-06-29 12:18   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 04/16] crypto/qat: add gen4 ucs slice type, add ctr mode Arek Kusztal
2021-06-29 12:16   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 05/16] crypto/qat: rename content descriptor functions Arek Kusztal
2021-06-29 12:18   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 06/16] crypto/qat: add legacy gcm and ccm Arek Kusztal
2021-06-29 12:22   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 07/16] crypto/qat: rework init common header function Arek Kusztal
2021-06-29 12:23   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 08/16] crypto/qat: add aes gcm in ucs spc mode Arek Kusztal
2021-06-29 12:19   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 09/16] crypto/qat: add chacha-poly " Arek Kusztal
2021-06-29 12:20   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 10/16] crypto/qat: add gmac in legacy mode on gen 4 Arek Kusztal
2021-06-29 12:20   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 11/16] common/qat: add pf2vf communication in qat Arek Kusztal
2021-06-29 12:22   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 12/16] common/qat: reset ring pairs before setting gen4 Arek Kusztal
2021-06-29 12:21   ` Zhang, Roy Fan
2021-06-28 16:34 ` Arek Kusztal [this message]
2021-06-29 12:21   ` [dpdk-dev] [PATCH v2 13/16] common/qat: add service discovery to qat gen4 Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 14/16] crypto/qat: update raw dp api Arek Kusztal
2021-06-29 13:06   ` Dybkowski, AdamX
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 15/16] crypto/qat: enable RAW API on QAT GEN1-3 only Arek Kusztal
2021-06-29 12:23   ` Zhang, Roy Fan
2021-06-28 16:34 ` [dpdk-dev] [PATCH v2 16/16] test/crypto: check if RAW API is supported Arek Kusztal
2021-06-29 12:24   ` Zhang, Roy Fan
2021-07-16 18:06   ` [dpdk-dev] [EXT] " Akhil Goyal
2021-07-19 12:39     ` Dybkowski, AdamX
2021-06-29 12:14 ` [dpdk-dev] [PATCH v2 00/16] Add support for fourth generation of Intel QuickAssist Technology devices Zhang, Roy Fan
2021-07-16 18:09 ` [dpdk-dev] [EXT] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210628163434.77741-14-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=gakhil@marvell.com \
    --cc=roy.fan.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.