Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,11 @@ if [ -z "${CONFIG[ENV]}" ]; then
CONFIG[DPDK_DIR]="${rootdir}/dpdk/build"
# Default ipsec libs
if [[ "${CONFIG[CRYPTO]}" = "y" ]] && [[ $arch = x86_64* ]]; then
CONFIG[IPSEC_MB]=y
CONFIG[IPSEC_MB_DIR]="${rootdir}/intel-ipsec-mb/lib"
# XXX: This is temporary. and will be uncommented once dependencies
# for ipsec-mb library are sorted.
#CONFIG[IPSEC_MB]=y
#CONFIG[IPSEC_MB_DIR]="${rootdir}/intel-ipsec-mb/lib"
echo "Keeping IPSEC_MB disabled"
fi
echo "Using default DPDK in ${CONFIG[DPDK_DIR]}"
fi
Expand Down
43 changes: 43 additions & 0 deletions module/bdev/crypto/vbdev_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,34 @@ vbdev_crypto_delete_name(struct bdev_names *name)
free(name);
}

/* For the named crypto vbdev and the named base bdev, create the crypto opts */
struct vbdev_crypto_opts *
create_crypto_opts_by_name(char *name, char *base_bdev_name, struct spdk_accel_crypto_key *key,
bool key_owner)
{
struct vbdev_crypto_opts *opts = calloc(1, sizeof(*opts));

if (!opts) {
return NULL;
}

opts->bdev_name = strdup(base_bdev_name);
if (!opts->bdev_name) {
free_crypto_opts(opts);
return NULL;
}
opts->vbdev_name = strdup(name);
if (!opts->vbdev_name) {
free_crypto_opts(opts);
return NULL;
}

opts->key = key;
opts->key_owner = key_owner;

return opts;
}

/* RPC entry point for crypto creation. */
int
create_crypto_disk(struct vbdev_crypto_opts *opts)
Expand Down Expand Up @@ -929,6 +957,21 @@ delete_crypto_disk(const char *bdev_name, spdk_delete_crypto_complete cb_fn,
}
}

/* Get the base bdev corresponding to the given vbdev name. */
struct spdk_bdev *
vbdev_crypto_disk_get_base_bdev(const char *vbdev_name)
{
struct vbdev_crypto *crypto_vbdev;

TAILQ_FOREACH(crypto_vbdev, &g_vbdev_crypto, link) {
if (strcmp(crypto_vbdev->crypto_bdev.name, vbdev_name) == 0) {
return crypto_vbdev->base_bdev;
}
}

return NULL;
}

/* Because we specified this function in our crypto bdev function table when we
* registered our crypto bdev, we'll get this call anytime a new bdev shows up.
* Here we need to decide if we care about it and if so what to do. We
Expand Down
22 changes: 22 additions & 0 deletions module/bdev/crypto/vbdev_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,33 @@ int create_crypto_disk(struct vbdev_crypto_opts *opts);
void delete_crypto_disk(const char *bdev_name, spdk_delete_crypto_complete cb_fn,
void *cb_arg);

/**
* Create crypto opts for the given crypto vbdev name and base bdev name.
*
* \param name Name of crypto vbdev
* \param base_bdev_name Name of base bdev for crypto vbdev
* \param key crypto key for the vbdev
* \param key_owner Is key created by application/RPC.
* \return Handle to created vbdev_crypto_opts or NULL if failed ot create.
*/
struct vbdev_crypto_opts *
create_crypto_opts_by_name(char *name, char *base_bdev_name, struct spdk_accel_crypto_key *key,
bool key_owner);

/**
* Release crypto opts created with create_crypto_opts()
*
* \param opts Crypto opts to release
*/
void free_crypto_opts(struct vbdev_crypto_opts *opts);

/**
* Given a vbdev crypto name, get the handle for base bdev of the vbdev.
*
* \param vbdev_name Name of crypto vbdev.
* \return Handle to base bdev or NULL if not found.
*/
struct spdk_bdev *
vbdev_crypto_disk_get_base_bdev(const char *vbdev_name);

#endif /* SPDK_VBDEV_CRYPTO_H */
Loading