[PATCH v2 5/7] nvme: sysfs: emit the marginal path state in show_state()
From: Jesse Taube
Date: Wed Sep 02 2026 - 16:19:33 EST
From: Bryan Gurney <bgurney@xxxxxxxxxx>
If a controller has received a link integrity or congestion event, and
has the NVME_CTRL_MARGINAL flag set, emit "marginal" in the state
instead of "live", to identify the marginal paths.
Co-developed-by: John Meneghini <jmeneghi@xxxxxxxxxx>
Signed-off-by: John Meneghini <jmeneghi@xxxxxxxxxx>
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
Tested-by: Muneendra Kumar <muneendra.kumar@xxxxxxxxxxxx>
Signed-off-by: Bryan Gurney <bgurney@xxxxxxxxxx>
---
V10 -> V1:
- No change
V1 -> V2:
- Only emit "marginal" if port is "live"
---
drivers/nvme/host/sysfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 75b2d69b5957..9ede6b37f27a 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -526,6 +526,9 @@ static ssize_t nvme_sysfs_show_state(struct device *dev,
[NVME_CTRL_DEAD] = "dead",
};
+ if (state == NVME_CTRL_LIVE && nvme_ctrl_is_marginal(ctrl))
+ return sysfs_emit(buf, "%s\n", "marginal");
+
if (state < ARRAY_SIZE(state_name) && state_name[state])
return sysfs_emit(buf, "%s\n", state_name[state]);
--
2.55.0