crypto/kasumi: remove check for SSE4
[dpdk.git] / drivers / crypto / kasumi / rte_kasumi_pmd.c
index 234921e..87e8cc3 100644 (file)
@@ -35,6 +35,7 @@
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
+#include <rte_cryptodev_vdev.h>
 #include <rte_vdev.h>
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
@@ -359,7 +360,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
        }
 
        enqueued_ops = rte_ring_enqueue_burst(qp->processed_ops,
-                               (void **)ops, processed_ops);
+                               (void **)ops, processed_ops, NULL);
        qp->qp_stats.enqueued_count += enqueued_ops;
        *accumulated_enqueued_ops += enqueued_ops;
 
@@ -410,7 +411,7 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
        }
 
        enqueued_op = rte_ring_enqueue_burst(qp->processed_ops, (void **)&op,
-                               processed_op);
+                               processed_op, NULL);
        qp->qp_stats.enqueued_count += enqueued_op;
        *accumulated_enqueued_ops += enqueued_op;
 
@@ -542,44 +543,36 @@ kasumi_pmd_dequeue_burst(void *queue_pair,
        unsigned nb_dequeued;
 
        nb_dequeued = rte_ring_dequeue_burst(qp->processed_ops,
-                       (void **)c_ops, nb_ops);
+                       (void **)c_ops, nb_ops, NULL);
        qp->qp_stats.dequeued_count += nb_dequeued;
 
        return nb_dequeued;
 }
 
-static int cryptodev_kasumi_remove(const char *name);
+static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
 
 static int
-cryptodev_kasumi_create(struct rte_crypto_vdev_init_params *init_params)
+cryptodev_kasumi_create(const char *name,
+                       struct rte_vdev_device *vdev,
+                       struct rte_crypto_vdev_init_params *init_params)
 {
        struct rte_cryptodev *dev;
        struct kasumi_private *internals;
        uint64_t cpu_flags = 0;
 
-       if (init_params->name[0] == '\0') {
-               int ret = rte_cryptodev_pmd_create_dev_name(
-                               init_params->name,
-                               RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
-
-               if (ret < 0) {
-                       KASUMI_LOG_ERR("failed to create unique name");
-                       return ret;
-               }
-       }
+       if (init_params->name[0] == '\0')
+               snprintf(init_params->name, sizeof(init_params->name),
+                               "%s", name);
 
        /* Check CPU for supported vector instruction set */
        if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX))
                cpu_flags |= RTE_CRYPTODEV_FF_CPU_AVX;
-       else if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_1))
+       else
                cpu_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
-       else {
-               KASUMI_LOG_ERR("Vector instructions are not supported by CPU");
-               return -EFAULT;
-       }
 
-       dev = rte_cryptodev_pmd_virtual_dev_init(init_params->name,
-                       sizeof(struct kasumi_private), init_params->socket_id);
+       dev = rte_cryptodev_vdev_pmd_init(init_params->name,
+                       sizeof(struct kasumi_private), init_params->socket_id,
+                       vdev);
        if (dev == NULL) {
                KASUMI_LOG_ERR("failed to create cryptodev vdev");
                goto init_error;
@@ -606,13 +599,12 @@ init_error:
        KASUMI_LOG_ERR("driver %s: cryptodev_kasumi_create failed",
                        init_params->name);
 
-       cryptodev_kasumi_remove(init_params->name);
+       cryptodev_kasumi_remove(vdev);
        return -EFAULT;
 }
 
 static int
-cryptodev_kasumi_probe(const char *name,
-               const char *input_args)
+cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
 {
        struct rte_crypto_vdev_init_params init_params = {
                RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
@@ -620,8 +612,15 @@ cryptodev_kasumi_probe(const char *name,
                rte_socket_id(),
                {0}
        };
+       const char *name;
+       const char *input_args;
 
-       rte_cryptodev_parse_vdev_init_params(&init_params, input_args);
+       name = rte_vdev_device_name(vdev);
+       if (name == NULL)
+               return -EINVAL;
+       input_args = rte_vdev_device_args(vdev);
+
+       rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
 
        RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
                        init_params.socket_id);
@@ -633,12 +632,15 @@ cryptodev_kasumi_probe(const char *name,
        RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
                        init_params.max_nb_sessions);
 
-       return cryptodev_kasumi_create(&init_params);
+       return cryptodev_kasumi_create(name, vdev, &init_params);
 }
 
 static int
-cryptodev_kasumi_remove(const char *name)
+cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
 {
+       const char *name;
+
+       name = rte_vdev_device_name(vdev);
        if (name == NULL)
                return -EINVAL;