summaryrefslogtreecommitdiff
path: root/drivers/compress
diff options
context:
space:
mode:
authorFiona Trahe <fiona.trahe@intel.com>2018-07-13 03:28:24 +0100
committerPablo de Lara <pablo.de.lara.guarch@intel.com>2018-07-24 01:48:10 +0200
commit2519de891e74d2bf8ed0c18ef45d68044bad819f (patch)
treeddc9b6d00de4ad937ad80bbd3fab970cd05215a4 /drivers/compress
parentc0c90bc4cade706f9ea271b1235f05f78870fe55 (diff)
downloaddpdk-next-eventdev-2519de891e74d2bf8ed0c18ef45d68044bad819f.zip
dpdk-next-eventdev-2519de891e74d2bf8ed0c18ef45d68044bad819f.tar.gz
dpdk-next-eventdev-2519de891e74d2bf8ed0c18ef45d68044bad819f.tar.xz
compress/qat: prevent usage if incorrect firmware
Previous check only causes op to fail on dequeue. This extends so once first fail is detected, application can no longer enqueue ops to the device and will also get an appropriate error if trying to reconfigure or setup the device. Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Diffstat (limited to 'drivers/compress')
-rw-r--r--drivers/compress/qat/qat_comp_pmd.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index 9bb9897..764c053 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -251,6 +251,60 @@ qat_comp_pmd_dequeue_op_burst(void *qp, struct rte_comp_op **ops,
return qat_dequeue_op_burst(qp, (void **)ops, nb_ops);
}
+static uint16_t
+qat_comp_pmd_enq_deq_dummy_op_burst(void *qp __rte_unused,
+ struct rte_comp_op **ops __rte_unused,
+ uint16_t nb_ops __rte_unused)
+{
+ QAT_DP_LOG(ERR, "QAT PMD detected wrong FW version !");
+ return 0;
+}
+
+static struct rte_compressdev_ops compress_qat_dummy_ops = {
+
+ /* Device related operations */
+ .dev_configure = NULL,
+ .dev_start = NULL,
+ .dev_stop = qat_comp_dev_stop,
+ .dev_close = qat_comp_dev_close,
+ .dev_infos_get = NULL,
+
+ .stats_get = NULL,
+ .stats_reset = qat_comp_stats_reset,
+ .queue_pair_setup = NULL,
+ .queue_pair_release = qat_comp_qp_release,
+
+ /* Compression related operations */
+ .private_xform_create = NULL,
+ .private_xform_free = qat_comp_private_xform_free
+};
+
+static uint16_t
+qat_comp_pmd_dequeue_frst_op_burst(void *qp, struct rte_comp_op **ops,
+ uint16_t nb_ops)
+{
+ uint16_t ret = qat_dequeue_op_burst(qp, (void **)ops, nb_ops);
+ struct qat_qp *tmp_qp = (struct qat_qp *)qp;
+
+ if (ret) {
+ if ((*ops)->debug_status ==
+ (uint64_t)ERR_CODE_QAT_COMP_WRONG_FW) {
+ tmp_qp->qat_dev->comp_dev->compressdev->enqueue_burst =
+ qat_comp_pmd_enq_deq_dummy_op_burst;
+ tmp_qp->qat_dev->comp_dev->compressdev->dequeue_burst =
+ qat_comp_pmd_enq_deq_dummy_op_burst;
+
+ tmp_qp->qat_dev->comp_dev->compressdev->dev_ops =
+ &compress_qat_dummy_ops;
+ QAT_LOG(ERR, "QAT PMD detected wrong FW version !");
+
+ } else {
+ tmp_qp->qat_dev->comp_dev->compressdev->dequeue_burst =
+ qat_comp_pmd_dequeue_op_burst;
+ }
+ }
+ return ret;
+}
static struct rte_compressdev_ops compress_qat_ops = {
@@ -302,7 +356,7 @@ qat_comp_dev_create(struct qat_pci_device *qat_pci_dev)
compressdev->dev_ops = &compress_qat_ops;
compressdev->enqueue_burst = qat_comp_pmd_enqueue_op_burst;
- compressdev->dequeue_burst = qat_comp_pmd_dequeue_op_burst;
+ compressdev->dequeue_burst = qat_comp_pmd_dequeue_frst_op_burst;
compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED;