fio_plugin: add support for mocking SGL entries
FIO is going to always present a contiguous buffer to us. But we can fake out the nvme driver with a couple of global variables. Change-Id: I038e70582043e1d7c1800ed065fe126aa091c290 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/439608 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
62700dac2e
commit
47fca7c7e8
@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
static bool g_spdk_env_initialized;
|
static bool g_spdk_env_initialized;
|
||||||
static int g_spdk_enable_sgl = 0;
|
static int g_spdk_enable_sgl = 0;
|
||||||
|
static uint32_t g_spdk_sge_size = 4096;
|
||||||
static uint32_t g_spdk_pract_flag;
|
static uint32_t g_spdk_pract_flag;
|
||||||
static uint32_t g_spdk_prchk_flags;
|
static uint32_t g_spdk_prchk_flags;
|
||||||
static uint32_t g_spdk_md_per_io_size = 4096;
|
static uint32_t g_spdk_md_per_io_size = 4096;
|
||||||
@ -60,6 +61,7 @@ struct spdk_fio_options {
|
|||||||
int mem_size;
|
int mem_size;
|
||||||
int shm_id;
|
int shm_id;
|
||||||
int enable_sgl;
|
int enable_sgl;
|
||||||
|
int sge_size;
|
||||||
char *hostnqn;
|
char *hostnqn;
|
||||||
int pi_act;
|
int pi_act;
|
||||||
char *pi_chk;
|
char *pi_chk;
|
||||||
@ -407,6 +409,7 @@ static int spdk_fio_setup(struct thread_data *td)
|
|||||||
opts.mem_size = fio_options->mem_size;
|
opts.mem_size = fio_options->mem_size;
|
||||||
opts.shm_id = fio_options->shm_id;
|
opts.shm_id = fio_options->shm_id;
|
||||||
g_spdk_enable_sgl = fio_options->enable_sgl;
|
g_spdk_enable_sgl = fio_options->enable_sgl;
|
||||||
|
g_spdk_sge_size = fio_options->sge_size;
|
||||||
parse_pract_flag(fio_options->pi_act);
|
parse_pract_flag(fio_options->pi_act);
|
||||||
g_spdk_md_per_io_size = spdk_max(fio_options->md_per_io_size, 4096);
|
g_spdk_md_per_io_size = spdk_max(fio_options->md_per_io_size, 4096);
|
||||||
g_spdk_apptag = (uint16_t)fio_options->apptag;
|
g_spdk_apptag = (uint16_t)fio_options->apptag;
|
||||||
@ -708,16 +711,22 @@ spdk_nvme_io_next_sge(void *ref, void **address, uint32_t *length)
|
|||||||
{
|
{
|
||||||
struct spdk_fio_request *fio_req = (struct spdk_fio_request *)ref;
|
struct spdk_fio_request *fio_req = (struct spdk_fio_request *)ref;
|
||||||
struct io_u *io_u = fio_req->io;
|
struct io_u *io_u = fio_req->io;
|
||||||
|
uint32_t iov_len;
|
||||||
|
|
||||||
*address = io_u->buf;
|
*address = io_u->buf;
|
||||||
*length = io_u->xfer_buflen;
|
|
||||||
|
|
||||||
if (fio_req->iov_offset) {
|
if (fio_req->iov_offset) {
|
||||||
assert(fio_req->iov_offset <= io_u->xfer_buflen);
|
assert(fio_req->iov_offset <= io_u->xfer_buflen);
|
||||||
*address += fio_req->iov_offset;
|
*address += fio_req->iov_offset;
|
||||||
*length -= fio_req->iov_offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iov_len = io_u->xfer_buflen - fio_req->iov_offset;
|
||||||
|
if (iov_len > g_spdk_sge_size) {
|
||||||
|
iov_len = g_spdk_sge_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
fio_req->iov_offset += iov_len;
|
||||||
|
*length = iov_len;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -956,6 +965,16 @@ static struct fio_option options[] = {
|
|||||||
.category = FIO_OPT_C_ENGINE,
|
.category = FIO_OPT_C_ENGINE,
|
||||||
.group = FIO_OPT_G_INVALID,
|
.group = FIO_OPT_G_INVALID,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "sge_size",
|
||||||
|
.lname = "SGL size used for I/O commands",
|
||||||
|
.type = FIO_OPT_INT,
|
||||||
|
.off1 = offsetof(struct spdk_fio_options, sge_size),
|
||||||
|
.def = "4096",
|
||||||
|
.help = "SGL size in bytes for I/O Commands (default 4096)",
|
||||||
|
.category = FIO_OPT_C_ENGINE,
|
||||||
|
.group = FIO_OPT_G_INVALID,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "hostnqn",
|
.name = "hostnqn",
|
||||||
.lname = "Host NQN to use when connecting to controllers.",
|
.lname = "Host NQN to use when connecting to controllers.",
|
||||||
|
16
examples/nvme/fio_plugin/mock_sgl_config.fio
Normal file
16
examples/nvme/fio_plugin/mock_sgl_config.fio
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[global]
|
||||||
|
ioengine=spdk
|
||||||
|
thread=1
|
||||||
|
group_reporting=1
|
||||||
|
direct=1
|
||||||
|
verify=0
|
||||||
|
enable_sgl=1
|
||||||
|
time_based=1
|
||||||
|
ramp_time=0
|
||||||
|
runtime=2
|
||||||
|
iodepth=4
|
||||||
|
rw=randrw
|
||||||
|
bs=16k
|
||||||
|
|
||||||
|
[test]
|
||||||
|
numjobs=1
|
@ -50,6 +50,10 @@ PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
|
|||||||
# Test fio_plugin as host with malloc backend
|
# Test fio_plugin as host with malloc backend
|
||||||
LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=RDMA adrfam=IPv4 \
|
LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=RDMA adrfam=IPv4 \
|
||||||
traddr=$NVMF_FIRST_TARGET_IP trsvcid=4420 ns=1"
|
traddr=$NVMF_FIRST_TARGET_IP trsvcid=4420 ns=1"
|
||||||
|
|
||||||
|
# second test mocking multiple SGL elements
|
||||||
|
LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/mock_sgl_config.fio --filename="trtype=RDMA adrfam=IPv4 \
|
||||||
|
traddr=$NVMF_FIRST_TARGET_IP trsvcid=4420 ns=1"
|
||||||
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
|
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
|
||||||
|
|
||||||
if [ $RUN_NIGHTLY -eq 1 ]; then
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user