From 91da9aaafe319dacdfa429c200a80fb04e39655b Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 11 Jul 2019 07:41:54 +0900 Subject: [PATCH] nvmf: Add a flag dif_insert_or_strip to struct spdk_nvmf_ctrlr Add a flag dif_insert_or_strip to struct spdk_nvmf_ctrlr that indicates whether DIF insert/strip is done. Copy the DIF insert/strip setting of the corresponding transport options to the flag at NVMf controller creation. The purpose of this patch is to make DIF insert/strip not per-transport option but per-controller option because we may want to be able to control DIF insert/strip per controller at some point. Besides this patch will clean the implementation. Besides align indent around the change. Signed-off-by: Shuhei Matsumoto Change-Id: I57f65960b430e55f4021ed514aacd85581ff9993 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461313 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Darek Stojaczyk --- lib/nvmf/ctrlr.c | 2 ++ lib/nvmf/nvmf_internal.h | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index 79be86898..ffb16799c 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -352,6 +352,8 @@ spdk_nvmf_ctrlr_create(struct spdk_nvmf_subsystem *subsystem, SPDK_DEBUGLOG(SPDK_LOG_NVMF, "cc 0x%x\n", ctrlr->vcprop.cc.raw); SPDK_DEBUGLOG(SPDK_LOG_NVMF, "csts 0x%x\n", ctrlr->vcprop.csts.raw); + ctrlr->dif_insert_or_strip = transport->opts.dif_insert_or_strip; + req->qpair->ctrlr = ctrlr; spdk_thread_send_msg(subsystem->thread, _spdk_nvmf_subsystem_add_ctrlr, req); diff --git a/lib/nvmf/nvmf_internal.h b/lib/nvmf/nvmf_internal.h index 96d978c46..bc38f3078 100644 --- a/lib/nvmf/nvmf_internal.h +++ b/lib/nvmf/nvmf_internal.h @@ -310,10 +310,12 @@ struct spdk_nvmf_ctrlr { TAILQ_HEAD(log_page_head, spdk_nvmf_reservation_log) log_head; /* Time to trigger keep-alive--poller_time = now_tick + period */ - uint64_t last_keep_alive_tick; - struct spdk_poller *keep_alive_poller; + uint64_t last_keep_alive_tick; + struct spdk_poller *keep_alive_poller; - TAILQ_ENTRY(spdk_nvmf_ctrlr) link; + bool dif_insert_or_strip; + + TAILQ_ENTRY(spdk_nvmf_ctrlr) link; }; struct spdk_nvmf_subsystem {