Skip to content

Commit 2ce9608

Browse files
committed
mi: Add maximum More Processing Required limit API
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 <[email protected]>
1 parent 5523019 commit 2ce9608

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/nvme/mi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct nvme_mi_ep *nvme_mi_init_ep(nvme_root_t root)
6161
ep->root = root;
6262
ep->controllers_scanned = false;
6363
ep->timeout = default_timeout;
64+
ep->mprt_max = 0;
6465
list_head_init(&ep->controllers);
6566

6667
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)
8182
return 0;
8283
}
8384

85+
void nvme_mi_ep_set_mprt_max(nvme_mi_ep_t ep, unsigned int mprt_max_ms)
86+
{
87+
ep->mprt_max = mprt_max_ms;
88+
}
89+
8490
unsigned int nvme_mi_ep_get_timeout(nvme_mi_ep_t ep)
8591
{
8692
return ep->timeout;

src/nvme/mi.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,24 @@ nvme_mi_ep_t nvme_mi_next_endpoint(nvme_root_t m, nvme_mi_ep_t e);
458458
*/
459459
int nvme_mi_ep_set_timeout(nvme_mi_ep_t ep, unsigned int timeout_ms);
460460

461+
/**
462+
* nvme_mi_ep_set_mprt_max - set the maximum wait time for a More Processing
463+
* Required response
464+
* @ep: MI endpoint object
465+
* @mprt_max_ms: Maximum more processing required wait time
466+
*
467+
* NVMe-MI endpoints may respond to a request with a "More Processing Required"
468+
* response; this also includes a hint on the worst-case processing time for
469+
* the eventual response data, with a specification-defined maximum of 65.535
470+
* seconds.
471+
*
472+
* This function provides a way to limit the maximum time we're prepared to
473+
* wait for the final response. Specify zero in @mprt_max_ms for no limit.
474+
* This should be larger than the command/response timeout set in
475+
* &nvme_mi_ep_set_timeout().
476+
*/
477+
void nvme_mi_ep_set_mprt_max(nvme_mi_ep_t ep, unsigned int mprt_max_ms);
478+
461479
/**
462480
* nvme_mi_ep_get_timeout - get the current timeout value for NVMe-MI responses
463481
* @ep: MI endpoint object

src/nvme/private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ struct nvme_mi_ep {
194194
struct list_head controllers;
195195
bool controllers_scanned;
196196
unsigned int timeout;
197+
unsigned int mprt_max;
197198
};
198199

199200
struct nvme_mi_ctrl {

0 commit comments

Comments
 (0)