From 6ad44e8be617626b65eda3e76dfd12bc6b6af49e Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 29 Aug 2019 02:00:26 -0400 Subject: [PATCH] nvme: add weighted round robin supported flags Change-Id: I4b303e7096dfdd29ef5d39f30223d03c32d20ae1 Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466679 Reviewed-by: Broadcom SPDK FC-NVMe CI Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- CHANGELOG.md | 3 +++ include/spdk/nvme.h | 1 + lib/nvme/nvme_ctrlr.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61a9a3bf0..83f9dc14e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ it for NVMe controllers. When the option is enabled, the controller will not do shutdown process and just disable the controller, users can start their application later again to initialize the controller to the ready state. +A controller flag `SPDK_NVME_CTRLR_WRR_SUPPORTED` was added to indicate the controller +can support weighted round robin arbitration feature with submission queue. + ### iSCSI Portals may no longer be associated with a cpumask. The scheduling of diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index add66a8cd..756433cf8 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -322,6 +322,7 @@ struct spdk_nvme_host_id { enum spdk_nvme_ctrlr_flags { SPDK_NVME_CTRLR_SGL_SUPPORTED = 0x1, /**< The SGL is supported */ SPDK_NVME_CTRLR_SECURITY_SEND_RECV_SUPPORTED = 0x2, /**< security send/receive is supported */ + SPDK_NVME_CTRLR_WRR_SUPPORTED = 0x4, /**< Weighted Round Robin is supported */ }; /** diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 7714b3821..4c8585947 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -2361,6 +2361,10 @@ nvme_ctrlr_init_cap(struct spdk_nvme_ctrlr *ctrlr, const union spdk_nvme_cap_reg ctrlr->cap = *cap; ctrlr->vs = *vs; + if (ctrlr->cap.bits.ams & SPDK_NVME_CAP_AMS_WRR) { + ctrlr->flags |= SPDK_NVME_CTRLR_WRR_SUPPORTED; + } + ctrlr->min_page_size = 1u << (12 + ctrlr->cap.bits.mpsmin); /* For now, always select page_size == min_page_size. */