All DPDK related code is removed, handling of RESET command was sligthly updated. Handling of -ENOMEM was updated for cases when accel API returns -ENOMEM Crypto tests in blockdev.sh were extended with more crypto_bdevs to verify NOMEM cases - that failed with original vbdev_crypto implementation Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com> Change-Id: If1feba2449bee852c6c4daca4b3406414db6fded Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14860 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (C) 2018 Intel Corporation.
|
|
* All rights reserved.
|
|
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#ifndef SPDK_VBDEV_CRYPTO_H
|
|
#define SPDK_VBDEV_CRYPTO_H
|
|
|
|
#include "spdk/rpc.h"
|
|
#include "spdk/util.h"
|
|
#include "spdk/string.h"
|
|
#include "spdk/log.h"
|
|
#include "spdk/accel.h"
|
|
#include "spdk_internal/accel_module.h"
|
|
|
|
#include "spdk/bdev.h"
|
|
|
|
#define BDEV_CRYPTO_DEFAULT_CIPHER "AES_CBC" /* QAT and AESNI_MB */
|
|
|
|
/* Structure to hold crypto options */
|
|
struct vbdev_crypto_opts {
|
|
char *vbdev_name; /* name of the vbdev to create */
|
|
char *bdev_name; /* base bdev name */
|
|
struct spdk_accel_crypto_key *key; /* crypto key */
|
|
bool key_owner; /* If wet to true then the key was created by RPC and needs to be destroyed */
|
|
};
|
|
|
|
typedef void (*spdk_delete_crypto_complete)(void *cb_arg, int bdeverrno);
|
|
|
|
/**
|
|
* Create new crypto bdev.
|
|
*
|
|
* \param opts Crypto options populated by create_crypto_opts()
|
|
* \return 0 on success, other on failure.
|
|
*/
|
|
int create_crypto_disk(struct vbdev_crypto_opts *opts);
|
|
|
|
/**
|
|
* Delete crypto bdev.
|
|
*
|
|
* \param bdev_name Crypto bdev name.
|
|
* \param cb_fn Function to call after deletion.
|
|
* \param cb_arg Argument to pass to cb_fn.
|
|
*/
|
|
void delete_crypto_disk(const char *bdev_name, spdk_delete_crypto_complete cb_fn,
|
|
void *cb_arg);
|
|
|
|
/**
|
|
* Release crypto opts created with create_crypto_opts()
|
|
*
|
|
* \param opts Crypto opts to release
|
|
*/
|
|
void free_crypto_opts(struct vbdev_crypto_opts *opts);
|
|
|
|
#endif /* SPDK_VBDEV_CRYPTO_H */
|