From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 744A05F14 for ; Fri, 13 Jul 2018 12:34:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 03:34:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,347,1526367600"; d="scan'208";a="215718208" Received: from silpixa00399466.ir.intel.com (HELO silpixa00399466.ger.corp.intel.com) ([10.237.223.220]) by orsmga004.jf.intel.com with ESMTP; 13 Jul 2018 03:34:15 -0700 From: Pablo de Lara To: fiona.trahe@intel.com, tomaszx.jozwiak@intel.com, john.griffin@intel.com, deepak.k.jain@intel.com Cc: dev@dpdk.org Date: Fri, 13 Jul 2018 03:28:17 +0100 Message-Id: <20180713022825.33106-9-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180713022825.33106-1-pablo.de.lara.guarch@intel.com> References: <1531411499-13156-1-git-send-email-fiona.trahe@intel.com> <20180713022825.33106-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v7 08/16] compress/qat: setup queue-pairs for compression service X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 10:34:21 -0000 From: Fiona Trahe Setup and clear queue-pairs for handling compression requests and responses. Signed-off-by: Fiona Trahe Signed-off-by: Tomasz Jozwiak --- drivers/compress/qat/qat_comp.h | 2 ++ drivers/compress/qat/qat_comp_pmd.c | 61 +++++++++++++++++++++++++++++++++++++ drivers/compress/qat/qat_comp_pmd.h | 6 ++++ 3 files changed, 69 insertions(+) diff --git a/drivers/compress/qat/qat_comp.h b/drivers/compress/qat/qat_comp.h index 937f3c83e..9e6861b8a 100644 --- a/drivers/compress/qat/qat_comp.h +++ b/drivers/compress/qat/qat_comp.h @@ -24,6 +24,8 @@ enum qat_comp_request_type { REQ_COMP_END }; +struct qat_comp_op_cookie { +}; struct qat_comp_xform { struct icp_qat_fw_comp_req qat_comp_req_tmpl; diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c index 6feffb784..5ae6caf83 100644 --- a/drivers/compress/qat/qat_comp_pmd.c +++ b/drivers/compress/qat/qat_comp_pmd.c @@ -2,6 +2,7 @@ * Copyright(c) 2015-2018 Intel Corporation */ +#include "qat_comp.h" #include "qat_comp_pmd.h" void @@ -38,3 +39,63 @@ qat_comp_stats_reset(struct rte_compressdev *dev) qat_stats_reset(qat_priv->qat_dev, QAT_SERVICE_COMPRESSION); } + +int +qat_comp_qp_release(struct rte_compressdev *dev, uint16_t queue_pair_id) +{ + struct qat_comp_dev_private *qat_private = dev->data->dev_private; + + QAT_LOG(DEBUG, "Release comp qp %u on device %d", + queue_pair_id, dev->data->dev_id); + + qat_private->qat_dev->qps_in_use[QAT_SERVICE_COMPRESSION][queue_pair_id] + = NULL; + + return qat_qp_release((struct qat_qp **) + &(dev->data->queue_pairs[queue_pair_id])); +} + +int +qat_comp_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, + uint32_t max_inflight_ops, int socket_id) +{ + int ret = 0; + struct qat_qp_config qat_qp_conf; + + struct qat_qp **qp_addr = + (struct qat_qp **)&(dev->data->queue_pairs[qp_id]); + struct qat_comp_dev_private *qat_private = dev->data->dev_private; + const struct qat_qp_hw_data *comp_hw_qps = + qat_gen_config[qat_private->qat_dev->qat_dev_gen] + .qp_hw_data[QAT_SERVICE_COMPRESSION]; + const struct qat_qp_hw_data *qp_hw_data = comp_hw_qps + qp_id; + + /* If qp is already in use free ring memory and qp metadata. */ + if (*qp_addr != NULL) { + ret = qat_comp_qp_release(dev, qp_id); + if (ret < 0) + return ret; + } + if (qp_id >= qat_qps_per_service(comp_hw_qps, + QAT_SERVICE_COMPRESSION)) { + QAT_LOG(ERR, "qp_id %u invalid for this device", qp_id); + return -EINVAL; + } + + qat_qp_conf.hw = qp_hw_data; + qat_qp_conf.build_request = qat_comp_build_request; + qat_qp_conf.cookie_size = sizeof(struct qat_comp_op_cookie); + qat_qp_conf.nb_descriptors = max_inflight_ops; + qat_qp_conf.socket_id = socket_id; + qat_qp_conf.service_str = "comp"; + + ret = qat_qp_setup(qat_private->qat_dev, qp_addr, qp_id, &qat_qp_conf); + if (ret != 0) + return ret; + + /* store a link to the qp in the qat_pci_device */ + qat_private->qat_dev->qps_in_use[QAT_SERVICE_COMPRESSION][qp_id] + = *qp_addr; + + return ret; +} diff --git a/drivers/compress/qat/qat_comp_pmd.h b/drivers/compress/qat/qat_comp_pmd.h index 27d84c8fd..5a4bc3154 100644 --- a/drivers/compress/qat/qat_comp_pmd.h +++ b/drivers/compress/qat/qat_comp_pmd.h @@ -34,6 +34,12 @@ qat_comp_stats_reset(struct rte_compressdev *dev); void qat_comp_stats_get(struct rte_compressdev *dev, struct rte_compressdev_stats *stats); +int +qat_comp_qp_release(struct rte_compressdev *dev, uint16_t queue_pair_id); + +int +qat_comp_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, + uint32_t max_inflight_ops, int socket_id); #endif #endif /* _QAT_COMP_PMD_H_ */ -- 2.14.4