cryptodev: add auth IV
[dpdk.git] / drivers / crypto / snow3g / rte_snow3g_pmd_ops.c
index 5643323..9e44242 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
 
 #include "rte_snow3g_pmd_private.h"
 
+static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
+       {       /* SNOW 3G (UIA2) */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
+                               .block_size = 16,
+                               .key_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 4,
+                                       .max = 4,
+                                       .increment = 0
+                               },
+                               .aad_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               },
+                               .iv_size = { 0 },
+                       }, }
+               }, }
+       },
+       {       /* SNOW 3G (UEA2) */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+                       {.cipher = {
+                               .algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
+                               .block_size = 16,
+                               .key_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               },
+                               .iv_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               }
+                       }, }
+               }, }
+       },
+       RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
+};
+
 /** Configure device */
 static int
-snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev)
+snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev,
+               __rte_unused struct rte_cryptodev_config *config)
 {
        return 0;
 }
@@ -109,6 +160,8 @@ snow3g_pmd_info_get(struct rte_cryptodev *dev,
                dev_info->dev_type = dev->dev_type;
                dev_info->max_nb_queue_pairs = internals->max_nb_queue_pairs;
                dev_info->sym.max_nb_sessions = internals->max_nb_sessions;
+               dev_info->feature_flags = dev->feature_flags;
+               dev_info->capabilities = snow3g_pmd_capabilities;
        }
 }
 
@@ -147,7 +200,7 @@ snow3g_pmd_qp_create_processed_ops_ring(struct snow3g_qp *qp,
 
        r = rte_ring_lookup(qp->name);
        if (r) {
-               if (r->prod.size >= ring_size) {
+               if (rte_ring_get_size(r) >= ring_size) {
                        SNOW3G_LOG_INFO("Reusing existing ring %s"
                                        " for processed packets",
                                         qp->name);
@@ -177,7 +230,7 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
                snow3g_pmd_qp_release(dev, qp_id);
 
        /* Allocate the queue pair data structure. */
-       qp = rte_zmalloc_socket("SNOW3G PMD Queue Pair", sizeof(*qp),
+       qp = rte_zmalloc_socket("SNOW 3G PMD Queue Pair", sizeof(*qp),
                                        RTE_CACHE_LINE_SIZE, socket_id);
        if (qp == NULL)
                return (-ENOMEM);