]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
mi: Add maximum More Processing Required limit API
authorJeremy Kerr <jk@codeconstruct.com.au>
Mon, 18 Jul 2022 06:33:58 +0000 (14:33 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Mon, 18 Jul 2022 06:49:51 +0000 (14:49 +0800)
This change adds a function to set the maximum time we're prepared to
wait for a response after a More Processing Required message.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
src/nvme/mi.c
src/nvme/mi.h
src/nvme/private.h

index 8ece73ce963dc33709fac9eba298b84d96e51536..afac5f73f19a5f7b9d7a14deeff77a5d4f61c667 100644 (file)
@@ -61,6 +61,7 @@ struct nvme_mi_ep *nvme_mi_init_ep(nvme_root_t root)
        ep->root = root;
        ep->controllers_scanned = false;
        ep->timeout = default_timeout;
+       ep->mprt_max = 0;
        list_head_init(&ep->controllers);
 
        list_add(&root->endpoints, &ep->root_entry);
@@ -81,6 +82,11 @@ int nvme_mi_ep_set_timeout(nvme_mi_ep_t ep, unsigned int timeout_ms)
        return 0;
 }
 
+void nvme_mi_ep_set_mprt_max(nvme_mi_ep_t ep, unsigned int mprt_max_ms)
+{
+       ep->mprt_max = mprt_max_ms;
+}
+
 unsigned int nvme_mi_ep_get_timeout(nvme_mi_ep_t ep)
 {
        return ep->timeout;
index 7f427b3af37f3400f190ac6a81490ebb3850660c..a02ff89fce738a3f0dc85680d836b702a78f20ad 100644 (file)
@@ -458,6 +458,24 @@ nvme_mi_ep_t nvme_mi_next_endpoint(nvme_root_t m, nvme_mi_ep_t e);
  */
 int nvme_mi_ep_set_timeout(nvme_mi_ep_t ep, unsigned int timeout_ms);
 
+/**
+ * nvme_mi_ep_set_mprt_max - set the maximum wait time for a More Processing
+ * Required response
+ * @ep: MI endpoint object
+ * @mprt_max_ms: Maximum more processing required wait time
+ *
+ * NVMe-MI endpoints may respond to a request with a "More Processing Required"
+ * response; this also includes a hint on the worst-case processing time for
+ * the eventual response data, with a specification-defined maximum of 65.535
+ * seconds.
+ *
+ * This function provides a way to limit the maximum time we're prepared to
+ * wait for the final response. Specify zero in @mprt_max_ms for no limit.
+ * This should be larger than the command/response timeout set in
+ * &nvme_mi_ep_set_timeout().
+ */
+void nvme_mi_ep_set_mprt_max(nvme_mi_ep_t ep, unsigned int mprt_max_ms);
+
 /**
  * nvme_mi_ep_get_timeout - get the current timeout value for NVMe-MI responses
  * @ep: MI endpoint object
index 283b27b42f4bb012bd9a0e69cd6b1ac775a70ab7..4e0f75dd6cfa153f729b49603f14919ad5bddb89 100644 (file)
@@ -194,6 +194,7 @@ struct nvme_mi_ep {
        struct list_head controllers;
        bool controllers_scanned;
        unsigned int timeout;
+       unsigned int mprt_max;
 };
 
 struct nvme_mi_ctrl {