bdev/crypto: Use iobuf large_bufsize to set opt IO boundary

We used hardcoded value set by bdev module, however
this value might be changed, so get a real value
from iobug config

Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Change-Id: Id15b602f699f3dd63aeff11fb063bb62c384663d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16601
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Alexey Marchuk 2023-01-30 12:37:12 +01:00 committed by Tomasz Zawadzki
parent a54fc9f4a2
commit cc8347dc2d

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (C) 2018 Intel Corporation.
* All rights reserved.
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.
* Copyright (c) 2022, 2023 NVIDIA CORPORATION & AFFILIATES.
* All rights reserved.
*/
@ -12,10 +12,6 @@
#include "spdk/bdev_module.h"
#include "spdk/likely.h"
/* Limit the max IO size by some reasonable value. Since in write operation we use aux buffer,
* let's set the limit to the bdev bounce aux buffer size */
#define CRYPTO_MAX_IO SPDK_BDEV_LARGE_BUF_MAX_SIZE
struct bdev_names {
struct vbdev_crypto_opts *opts;
TAILQ_ENTRY(bdev_names) link;
@ -796,8 +792,13 @@ vbdev_crypto_claim(const char *bdev_name)
struct bdev_names *name;
struct vbdev_crypto *vbdev;
struct spdk_bdev *bdev;
struct spdk_iobuf_opts iobuf_opts;
int rc = 0;
/* Limit the max IO size by some reasonable value. Since in write operation we use aux buffer,
* let's set the limit to the large_bufsize value */
spdk_iobuf_get_opts(&iobuf_opts);
/* Check our list of names from config versus this bdev and if
* there's a match, create the crypto_bdev & bdev accordingly.
*/
@ -836,9 +837,9 @@ vbdev_crypto_claim(const char *bdev_name)
vbdev->crypto_bdev.write_cache = bdev->write_cache;
if (bdev->optimal_io_boundary > 0) {
vbdev->crypto_bdev.optimal_io_boundary =
spdk_min((CRYPTO_MAX_IO / bdev->blocklen), bdev->optimal_io_boundary);
spdk_min((iobuf_opts.large_bufsize / bdev->blocklen), bdev->optimal_io_boundary);
} else {
vbdev->crypto_bdev.optimal_io_boundary = (CRYPTO_MAX_IO / bdev->blocklen);
vbdev->crypto_bdev.optimal_io_boundary = (iobuf_opts.large_bufsize / bdev->blocklen);
}
vbdev->crypto_bdev.split_on_optimal_io_boundary = true;
if (bdev->required_alignment > 0) {