net/i40e/base: enable AQ event get in NVM update
[dpdk.git] / drivers / crypto / armv8 / rte_armv8_pmd_ops.c
index 05a7703..3817ad7 100644 (file)
@@ -1,33 +1,5 @@
-/*
- *   BSD LICENSE
- *
- *   Copyright (C) Cavium, Inc. 2017.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Cavium, Inc nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Cavium, Inc
  */
 
 #include <string.h>
@@ -50,16 +22,15 @@ static const struct rte_cryptodev_capabilities
                                        .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
                                        .block_size = 64,
                                        .key_size = {
-                                               .min = 16,
-                                               .max = 128,
-                                               .increment = 0
+                                               .min = 1,
+                                               .max = 64,
+                                               .increment = 1
                                        },
                                        .digest_size = {
                                                .min = 20,
                                                .max = 20,
                                                .increment = 0
                                        },
-                                       .aad_size = { 0 },
                                        .iv_size = { 0 }
                                }, }
                        }, }
@@ -72,16 +43,15 @@ static const struct rte_cryptodev_capabilities
                                        .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
                                        .block_size = 64,
                                        .key_size = {
-                                               .min = 16,
-                                               .max = 128,
-                                               .increment = 0
+                                               .min = 1,
+                                               .max = 64,
+                                               .increment = 1
                                        },
                                        .digest_size = {
                                                .min = 32,
                                                .max = 32,
                                                .increment = 0
                                        },
-                                       .aad_size = { 0 },
                                        .iv_size = { 0 }
                                }, }
                        }, }
@@ -211,7 +181,7 @@ armv8_crypto_pmd_qp_set_unique_name(struct rte_cryptodev *dev,
        n = snprintf(qp->name, sizeof(qp->name), "armv8_crypto_pmd_%u_qp_%u",
                        dev->data->dev_id, qp->id);
 
-       if (n > sizeof(qp->name))
+       if (n >= sizeof(qp->name))
                return -1;
 
        return 0;
@@ -325,24 +295,26 @@ armv8_crypto_pmd_session_configure(struct rte_cryptodev *dev,
                struct rte_mempool *mempool)
 {
        void *sess_private_data;
+       int ret;
 
        if (unlikely(sess == NULL)) {
                ARMV8_CRYPTO_LOG_ERR("invalid session struct");
-               return -1;
+               return -EINVAL;
        }
 
        if (rte_mempool_get(mempool, &sess_private_data)) {
                CDEV_LOG_ERR(
                        "Couldn't get object from session mempool");
-               return -1;
+               return -ENOMEM;
        }
 
-       if (armv8_crypto_set_session_parameters(sess_private_data, xform) != 0) {
+       ret = armv8_crypto_set_session_parameters(sess_private_data, xform);
+       if (ret != 0) {
                ARMV8_CRYPTO_LOG_ERR("failed configure session parameters");
 
                /* Return session to mempool */
                rte_mempool_put(mempool, sess_private_data);
-               return -1;
+               return ret;
        }
 
        set_session_private_data(sess, dev->driver_id,