bdev/crypto: align I/O buffers for encrypt

In patch fbec702944 (bdev/crypto: Set QAT alignment
requirement) we added an alignment requirement for I/O
buffers, but the internally-allocated buffers for
encryption haven't respected it.

We now allocate those buffers with the crypto bdev's
required alignment. It is only required for QAT and we
do it unconditionally, but we don't want to strcmp the
driver name in the hot I/O path just for that - the
code is to be refactored anyway.

Change-Id: I2cbc04408ddc5574f212b63536a05eb73ceba104
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/441908
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-01-24 15:20:12 +01:00 committed by Jim Harris
parent db5c3ce362
commit 73d1df6dd6
2 changed files with 3 additions and 1 deletions

View File

@ -598,7 +598,8 @@ _crypto_operation(struct spdk_bdev_io *bdev_io, enum rte_crypto_cipher_operation
* has a buffer, which ours always will. So, until we modify that API
* or better yet the current ZCOPY work lands, this is the best we can do.
*/
io_ctx->cry_iov.iov_base = spdk_dma_malloc(total_length, 0x10, NULL);
io_ctx->cry_iov.iov_base = spdk_dma_malloc(total_length,
spdk_bdev_get_buf_align(bdev_io->bdev), NULL);
if (!io_ctx->cry_iov.iov_base) {
SPDK_ERRLOG("ERROR trying to allocate write buffer for encryption!\n");
rc = -ENOMEM;

View File

@ -58,6 +58,7 @@ DEFINE_STUB(spdk_bdev_io_type_supported, bool, (struct spdk_bdev *bdev,
DEFINE_STUB_V(spdk_bdev_module_release_bdev, (struct spdk_bdev *bdev));
DEFINE_STUB_V(spdk_bdev_close, (struct spdk_bdev_desc *desc));
DEFINE_STUB(spdk_bdev_get_name, const char *, (const struct spdk_bdev *bdev), 0);
DEFINE_STUB(spdk_bdev_get_buf_align, size_t, (const struct spdk_bdev *bdev), 0);
DEFINE_STUB(spdk_bdev_get_io_channel, struct spdk_io_channel *, (struct spdk_bdev_desc *desc), 0);
DEFINE_STUB_V(spdk_bdev_unregister, (struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn,
void *cb_arg));