fio_plugin: export apptag and apptag mask to users

Existing fio plugin tool uses hardcoded application
tag and application tag mask for end-to-end data
protection, we export the two options to users
now.

Change-Id: I64d89c29e99030ce8daa2947e73d941b73ac4a8e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446384
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Changpeng Liu 2019-02-27 22:41:54 +08:00 committed by Ben Walker
parent b5853777fe
commit 92ff5e0b12
2 changed files with 32 additions and 3 deletions

View File

@ -100,3 +100,7 @@ The storage device may use a block format that requires separate metadata (DIX).
will automatically allocate an extra 4KiB buffer per I/O to hold this metadata. For some cases, such as 512 byte
blocks with 32 metadata bytes per block and a 128KiB I/O size, 4KiB isn't large enough. In this case, the
`md_per_io_size` option may be specified to increase the size of the metadata buffer.
Expose two options 'apptag' and 'apptag_mask', users can change them in the configuration file when using
application tag and application tag mask in end-to-end data protection. Application tag and application
tag mask are set to 0x1234 and 0xFFFF by default.

View File

@ -46,13 +46,14 @@
#include "optgroup.h"
#define NVME_IO_ALIGN 4096
#define FIO_NVME_PI_APPTAG 0x1234
static bool g_spdk_env_initialized;
static int g_spdk_enable_sgl = 0;
static uint32_t g_spdk_pract_flag;
static uint32_t g_spdk_prchk_flags;
static uint32_t g_spdk_md_per_io_size = 4096;
static uint16_t g_spdk_apptag;
static uint16_t g_spdk_apptag_mask;
struct spdk_fio_options {
void *pad; /* off1 used in option descriptions may not be 0 */
@ -63,6 +64,8 @@ struct spdk_fio_options {
int pi_act;
char *pi_chk;
int md_per_io_size;
int apptag;
int apptag_mask;
char *digest_enable;
};
@ -402,6 +405,8 @@ static int spdk_fio_setup(struct thread_data *td)
g_spdk_enable_sgl = fio_options->enable_sgl;
parse_pract_flag(fio_options->pi_act);
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_mask = (uint16_t)fio_options->apptag_mask;
parse_prchk_flags(fio_options->pi_chk);
if (spdk_env_init(&opts) < 0) {
SPDK_ERRLOG("Unable to initialize SPDK env\n");
@ -563,7 +568,7 @@ fio_extended_lba_setup_pi(struct spdk_fio_qpair *fio_qpair, struct io_u *io_u)
rc = spdk_dif_ctx_init(&fio_req->dif_ctx, extended_lba_size, md_size,
true, false,
(enum spdk_dif_type)spdk_nvme_ns_get_pi_type(ns),
fio_qpair->io_flags, lba, 0xFFFF, FIO_NVME_PI_APPTAG, 0);
fio_qpair->io_flags, lba, g_spdk_apptag_mask, g_spdk_apptag, 0);
if (rc != 0) {
fprintf(stderr, "Initialization of DIF context failed\n");
return rc;
@ -597,7 +602,7 @@ fio_separate_md_setup_pi(struct spdk_fio_qpair *fio_qpair, struct io_u *io_u)
rc = spdk_dif_ctx_init(&fio_req->dif_ctx, block_size, md_size,
false, false,
(enum spdk_dif_type)spdk_nvme_ns_get_pi_type(ns),
fio_qpair->io_flags, lba, 0xFFFF, FIO_NVME_PI_APPTAG, 0);
fio_qpair->io_flags, lba, g_spdk_apptag_mask, g_spdk_apptag, 0);
if (rc != 0) {
fprintf(stderr, "Initialization of DIF context failed\n");
return rc;
@ -986,6 +991,26 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "apptag",
.lname = "Application Tag used in Protection Information",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, apptag),
.def = "0x1234",
.help = "Application Tag used in Protection Information field (Default: 0x1234)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "apptag_mask",
.lname = "Application Tag Mask",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, apptag_mask),
.def = "0xffff",
.help = "Application Tag Mask used with Application Tag (Default: 0xffff)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "digest_enable",
.lname = "PDU digest choice for NVMe/TCP Transport(NONE|HEADER|DATA|BOTH)",