Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tokunori Ikegami <ikegami.t@gmail.com>
To: linux-nvme@lists.infradead.org
Cc: Tokunori Ikegami <ikegami.t@gmail.com>
Subject: [PATCH] nvme: combine NVME_CTRL_ATTR and NVME_CTRL_CTRATT definitions
Date: Mon, 23 Sep 2024 14:53:23 +0900	[thread overview]
Message-ID: <20240923055350.33246-1-ikegami.t@gmail.com> (raw)

Also added some new NVME_CTRL_CTRATT definitions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
 drivers/nvme/host/core.c        | 10 +++++-----
 drivers/nvme/target/admin-cmd.c |  4 ++--
 include/linux/nvme.h            | 19 ++++++++++++-------
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ca9959a8fb9e..cdda168bbb18 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1273,7 +1273,7 @@ static unsigned long nvme_keep_alive_work_period(struct nvme_ctrl *ctrl)
 	 * command completion can postpone sending a keep alive command
 	 * by up to twice the delay between runs.
 	 */
-	if (ctrl->ctratt & NVME_CTRL_ATTR_TBKAS)
+	if (ctrl->ctratt & NVME_CTRL_CTRATT_TBKAS)
 		delay /= 2;
 	return delay;
 }
@@ -1343,7 +1343,7 @@ static void nvme_keep_alive_work(struct work_struct *work)
 
 	ctrl->ka_last_check_time = jiffies;
 
-	if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) {
+	if ((ctrl->ctratt & NVME_CTRL_CTRATT_TBKAS) && comp_seen) {
 		dev_dbg(ctrl->device,
 			"reschedule traffic based keep-alive timer\n");
 		ctrl->comp_seen = false;
@@ -1913,7 +1913,7 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
 	if (!head->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
 		return;
 
-	if (nvm && (ctrl->ctratt & NVME_CTRL_ATTR_ELBAS)) {
+	if (nvm && (ctrl->ctratt & NVME_CTRL_CTRATT_ELBAS)) {
 		nvme_configure_pi_elbas(head, id, nvm);
 	} else {
 		head->pi_size = sizeof(struct t10_pi_tuple);
@@ -2137,7 +2137,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	}
 	lbaf = nvme_lbaf_index(id->flbas);
 
-	if (ns->ctrl->ctratt & NVME_CTRL_ATTR_ELBAS) {
+	if (ns->ctrl->ctratt & NVME_CTRL_CTRATT_ELBAS) {
 		ret = nvme_identify_ns_nvm(ns->ctrl, info->nsid, &nvm);
 		if (ret < 0)
 			goto out;
@@ -2541,7 +2541,7 @@ static int nvme_configure_host_options(struct nvme_ctrl *ctrl)
 	/* Don't bother enabling the feature if retry delay is not reported */
 	if (ctrl->crdt[0])
 		acre = NVME_ENABLE_ACRE;
-	if (ctrl->ctratt & NVME_CTRL_ATTR_ELBAS)
+	if (ctrl->ctratt & NVME_CTRL_CTRATT_ELBAS)
 		lbafee = NVME_ENABLE_LBAFEE;
 
 	if (!acre && !lbafee)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 954d4c074770..799c2e61e9ec 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -401,8 +401,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
 
 	/* XXX: figure out what to do about RTD3R/RTD3 */
 	id->oaes = cpu_to_le32(NVMET_AEN_CFG_OPTIONAL);
-	id->ctratt = cpu_to_le32(NVME_CTRL_ATTR_HID_128_BIT |
-		NVME_CTRL_ATTR_TBKAS);
+	id->ctratt = cpu_to_le32(NVME_CTRL_CTRATT_128_ID |
+		NVME_CTRL_CTRATT_TBKAS);
 
 	id->oacs = 0;
 
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index b58d9405d65e..c48e7f3fa09b 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -271,12 +271,6 @@ enum {
 	NVME_PS_FLAGS_NON_OP_STATE	= 1 << 1,
 };
 
-enum nvme_ctrl_attr {
-	NVME_CTRL_ATTR_HID_128_BIT	= (1 << 0),
-	NVME_CTRL_ATTR_TBKAS		= (1 << 6),
-	NVME_CTRL_ATTR_ELBAS		= (1 << 15),
-};
-
 struct nvme_id_ctrl {
 	__le16			vid;
 	__le16			ssvid;
@@ -375,7 +369,7 @@ enum {
 	NVME_CTRL_ONCS_RESERVATIONS		= 1 << 5,
 	NVME_CTRL_ONCS_TIMESTAMP		= 1 << 6,
 	NVME_CTRL_VWC_PRESENT			= 1 << 0,
-	NVME_CTRL_OACS_SEC_SUPP                 = 1 << 0,
+	NVME_CTRL_OACS_SEC_SUPP			= 1 << 0,
 	NVME_CTRL_OACS_NS_MNGT_SUPP		= 1 << 3,
 	NVME_CTRL_OACS_DIRECTIVES		= 1 << 5,
 	NVME_CTRL_OACS_DBBUF_SUPP		= 1 << 8,
@@ -386,8 +380,19 @@ enum {
 	NVME_CTRL_CTRATT_READ_RECV_LVLS		= 1 << 3,
 	NVME_CTRL_CTRATT_ENDURANCE_GROUPS	= 1 << 4,
 	NVME_CTRL_CTRATT_PREDICTABLE_LAT	= 1 << 5,
+	NVME_CTRL_CTRATT_TBKAS			= 1 << 6,
 	NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY	= 1 << 7,
+	NVME_CTRL_CTRATT_SQ_ASSOCIATIONS	= 1 << 8,
 	NVME_CTRL_CTRATT_UUID_LIST		= 1 << 9,
+	NVME_CTRL_CTRATT_MDS			= 1 << 10,
+	NVME_CTRL_CTRATT_FIXED_CAP		= 1 << 11,
+	NVME_CTRL_CTRATT_VARIABLE_CAP		= 1 << 12,
+	NVME_CTRL_CTRATT_DEL_ENDURANCE_GROUPS	= 1 << 13,
+	NVME_CTRL_CTRATT_DEL_NVM_SETS		= 1 << 14,
+	NVME_CTRL_CTRATT_ELBAS			= 1 << 15,
+	NVME_CTRL_CTRATT_MEM			= 1 << 16,
+	NVME_CTRL_CTRATT_HMBR			= 1 << 17,
+	NVME_CTRL_CTRATT_FDPS			= 1 << 19,
 };
 
 struct nvme_lbaf {
-- 
2.43.0



                 reply	other threads:[~2024-09-23  5:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240923055350.33246-1-ikegami.t@gmail.com \
    --to=ikegami.t@gmail.com \
    --cc=linux-nvme@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox