]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/nvme/host/nvme.h
nvme: expose cntrltype and dctype through sysfs
[mirror_ubuntu-jammy-kernel.git] / drivers / nvme / host / nvme.h
index ed79a6c7e8043b50d9770d278d0b8316436e4bbf..446fe29d2392a67fdc06da24f17633fd690f10c4 100644 (file)
@@ -144,6 +144,11 @@ enum nvme_quirks {
         * encoding the generation sequence number.
         */
        NVME_QUIRK_SKIP_CID_GEN                 = (1 << 17),
+
+       /*
+        * Reports garbage in the namespace identifiers (eui64, nguid, uuid).
+        */
+       NVME_QUIRK_BOGUS_NID                    = (1 << 18),
 };
 
 /*
@@ -348,6 +353,9 @@ struct nvme_ctrl {
        unsigned long discard_page_busy;
 
        struct nvme_fault_inject fault_inject;
+
+       enum nvme_ctrl_type cntrltype;
+       enum nvme_dctype dctype;
 };
 
 enum nvme_iopolicy {
@@ -693,6 +701,25 @@ static inline bool nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
                return true;
        return __nvme_check_ready(ctrl, rq, queue_live);
 }
+
+/*
+ * NSID shall be unique for all shared namespaces, or if at least one of the
+ * following conditions is met:
+ *   1. Namespace Management is supported by the controller
+ *   2. ANA is supported by the controller
+ *   3. NVM Set are supported by the controller
+ *
+ * In other case, private namespace are not required to report a unique NSID.
+ */
+static inline bool nvme_is_unique_nsid(struct nvme_ctrl *ctrl,
+               struct nvme_ns_head *head)
+{
+       return head->shared ||
+               (ctrl->oacs & NVME_CTRL_OACS_NS_MNGT_SUPP) ||
+               (ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA) ||
+               (ctrl->ctratt & NVME_CTRL_CTRATT_NVM_SETS);
+}
+
 int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
                void *buf, unsigned bufflen);
 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,