From: Israel Rukshin <israelr@xxxxxxxxxxxx> Added 'pi_enable' to 'connect' command so users can enable metadata support. usage examples: nvme connect --pi_enable --transport=rdma --traddr=10.0.1.1 --nqn=test-nvme nvme connect -p -t rdma -a 10.0.1.1 -n test_nvme Signed-off-by: Israel Rukshin <israelr@xxxxxxxxxxxx> Reviewed-by: Max Gurtovoy <maxg@xxxxxxxxxxxx> --- fabrics.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/fabrics.c b/fabrics.c index a112f76..1b5b3f7 100644 --- a/fabrics.c +++ b/fabrics.c @@ -78,6 +78,7 @@ static struct config { int disable_sqflow; int hdr_digest; int data_digest; + int pi_enable; bool persistent; bool quiet; } cfg = { NULL }; @@ -851,7 +852,9 @@ static int build_options(char *argstr, int max_len, bool discover) add_bool_argument(&argstr, &max_len, "disable_sqflow", cfg.disable_sqflow) || add_bool_argument(&argstr, &max_len, "hdr_digest", cfg.hdr_digest) || - add_bool_argument(&argstr, &max_len, "data_digest", cfg.data_digest)) + add_bool_argument(&argstr, &max_len, "data_digest", + cfg.data_digest) || + add_bool_argument(&argstr, &max_len, "pi_enable", cfg.pi_enable)) return -EINVAL; return 0; @@ -980,6 +983,13 @@ retry: p += len; } + if (cfg.pi_enable) { + len = sprintf(p, ",pi_enable"); + if (len < 0) + return -EINVAL; + p += len; + } + switch (e->trtype) { case NVMF_TRTYPE_RDMA: case NVMF_TRTYPE_TCP: @@ -1259,6 +1269,7 @@ int discover(const char *desc, int argc, char **argv, bool connect) OPT_INT("tos", 'T', &cfg.tos, "type of service"), OPT_FLAG("hdr_digest", 'g', &cfg.hdr_digest, "enable transport protocol header digest (TCP transport)"), OPT_FLAG("data_digest", 'G', &cfg.data_digest, "enable transport protocol data digest (TCP transport)"), + OPT_FLAG("pi_enable", 'p', &cfg.pi_enable, "enable metadata (T10-PI) support (default false)"), OPT_INT("nr-io-queues", 'i', &cfg.nr_io_queues, "number of io queues to use (default is core count)"), OPT_INT("nr-write-queues", 'W', &cfg.nr_write_queues, "number of write queues to use (default 0)"), OPT_INT("nr-poll-queues", 'P', &cfg.nr_poll_queues, "number of poll queues to use (default 0)"), @@ -1319,6 +1330,7 @@ int connect(const char *desc, int argc, char **argv) OPT_FLAG("disable-sqflow", 'd', &cfg.disable_sqflow, "disable controller sq flow control (default false)"), OPT_FLAG("hdr-digest", 'g', &cfg.hdr_digest, "enable transport protocol header digest (TCP transport)"), OPT_FLAG("data-digest", 'G', &cfg.data_digest, "enable transport protocol data digest (TCP transport)"), + OPT_FLAG("pi_enable", 'p', &cfg.pi_enable, "enable metadata (T10-PI) support (default false)"), OPT_END() }; -- 1.8.3.1