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 71713A0032; Fri, 1 Oct 2021 19:00:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77F4F411B7; Fri, 1 Oct 2021 19:00:07 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 85A60411A4 for ; Fri, 1 Oct 2021 19:00:05 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10124"; a="205650536" X-IronPort-AV: E=Sophos;i="5.85,339,1624345200"; d="scan'208";a="205650536" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2021 10:00:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,339,1624345200"; d="scan'208";a="521218154" Received: from silpixa00400885.ir.intel.com ([10.243.23.122]) by fmsmga008.fm.intel.com with ESMTP; 01 Oct 2021 10:00:00 -0700 From: Fan Zhang To: dev@dpdk.org Cc: gakhil@marvell.com, Fan Zhang , Arek Kusztal , Kai Ji Date: Fri, 1 Oct 2021 17:59:45 +0100 Message-Id: <20211001165954.717846-2-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001165954.717846-1-roy.fan.zhang@intel.com> References: <20210901144729.26784-1-arkadiuszx.kusztal@intel.com> <20211001165954.717846-1-roy.fan.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 01/10] common/qat: add gen specific data and function 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" This patch adds the data structure and function prototypes for different QAT generations. Signed-off-by: Arek Kusztal Signed-off-by: Fan Zhang Signed-off-by: Kai Ji --- drivers/common/qat/qat_common.c | 8 ++++++++ drivers/common/qat/qat_common.h | 16 ++++++++++------ drivers/common/qat/qat_device.c | 4 ++++ drivers/common/qat/qat_device.h | 23 +++++++++++++++++++++++ 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/drivers/common/qat/qat_common.c b/drivers/common/qat/qat_common.c index 5343a1451e..e813d5c165 100644 --- a/drivers/common/qat/qat_common.c +++ b/drivers/common/qat/qat_common.c @@ -6,6 +6,14 @@ #include "qat_device.h" #include "qat_logs.h" +/* Keep it the same ordering as enum qat_service_type */ +const char *qat_service_type_str[] = { + "asym", + "sym", + "comp", + "invalid" +}; + int qat_sgl_fill_array(struct rte_mbuf *buf, int64_t offset, void *list_in, uint32_t data_len, diff --git a/drivers/common/qat/qat_common.h b/drivers/common/qat/qat_common.h index 23715085f4..55f1ab8611 100644 --- a/drivers/common/qat/qat_common.h +++ b/drivers/common/qat/qat_common.h @@ -15,20 +15,26 @@ /* Intel(R) QuickAssist Technology device generation is enumerated * from one according to the generation of the device */ + enum qat_device_gen { - QAT_GEN1 = 1, + QAT_GEN1, QAT_GEN2, QAT_GEN3, - QAT_GEN4 + QAT_GEN4, + QAT_N_GENS }; enum qat_service_type { - QAT_SERVICE_ASYMMETRIC = 0, + QAT_SERVICE_ASYMMETRIC, QAT_SERVICE_SYMMETRIC, QAT_SERVICE_COMPRESSION, - QAT_SERVICE_INVALID + QAT_MAX_SERVICES }; +extern const char *qat_service_type_str[]; + +#define QAT_SERVICE_INVALID (QAT_MAX_SERVICES) + enum qat_svc_list { QAT_SVC_UNUSED = 0, QAT_SVC_CRYPTO = 1, @@ -37,8 +43,6 @@ enum qat_svc_list { QAT_SVC_ASYM = 4, }; -#define QAT_MAX_SERVICES (QAT_SERVICE_INVALID) - /**< Common struct for scatter-gather list operations */ struct qat_flat_buf { uint32_t len; diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c index 1b967cbcf7..e6b43c541f 100644 --- a/drivers/common/qat/qat_device.c +++ b/drivers/common/qat/qat_device.c @@ -13,6 +13,10 @@ #include "adf_pf2vf_msg.h" #include "qat_pf2vf.h" +/* Hardware device information per generation */ +struct qat_gen_hw_data qat_gen_config[QAT_N_GENS]; +struct qat_dev_hw_spec_funcs *qat_dev_hw_spec[QAT_N_GENS]; + /* pv2vf data Gen 4*/ struct qat_pf2vf_dev qat_pf2vf_gen4 = { .pf2vf_offset = ADF_4XXXIOV_PF2VM_OFFSET, diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h index 228c057d1e..b8b5c387a3 100644 --- a/drivers/common/qat/qat_device.h +++ b/drivers/common/qat/qat_device.h @@ -21,6 +21,29 @@ #define COMP_ENQ_THRESHOLD_NAME "qat_comp_enq_threshold" #define MAX_QP_THRESHOLD_SIZE 32 +/** + * Function prototypes for GENx specific device operations. + **/ +typedef int (*qat_dev_reset_ring_pairs_t) + (struct qat_pci_device *); +typedef const struct rte_mem_resource* (*qat_dev_get_transport_bar_t) + (struct rte_pci_device *); +typedef int (*qat_dev_get_misc_bar_t) + (struct rte_mem_resource **, struct rte_pci_device *); +typedef int (*qat_dev_read_config_t) + (struct qat_pci_device *); +typedef int (*qat_dev_get_extra_size_t)(void); + +struct qat_dev_hw_spec_funcs { + qat_dev_reset_ring_pairs_t qat_dev_reset_ring_pairs; + qat_dev_get_transport_bar_t qat_dev_get_transport_bar; + qat_dev_get_misc_bar_t qat_dev_get_misc_bar; + qat_dev_read_config_t qat_dev_read_config; + qat_dev_get_extra_size_t qat_dev_get_extra_size; +}; + +extern struct qat_dev_hw_spec_funcs *qat_dev_hw_spec[]; + struct qat_dev_cmd_param { const char *name; uint16_t val; -- 2.25.1