summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/fabrics.h
diff options
context:
space:
mode:
authorChaitanya Kulkarni <kch@nvidia.com>2022-03-30 02:40:32 -0700
committerChristoph Hellwig <hch@lst.de>2022-05-16 08:07:25 +0200
commit93ba75c90524618ef2c20979b0e660b9d071f0e6 (patch)
tree559252d94463a7ac1d8ed7ec42cc205bc5e60473 /drivers/nvme/host/fabrics.h
parentb98235d3a471e121376bfabce27380dde5add1d9 (diff)
downloadlinux-stable-93ba75c90524618ef2c20979b0e660b9d071f0e6.tar.gz
linux-stable-93ba75c90524618ef2c20979b0e660b9d071f0e6.tar.bz2
linux-stable-93ba75c90524618ef2c20979b0e660b9d071f0e6.zip
nvme-fabrics: add a request timeout helper
The RDAMA and TCP transport both complete the timed out request in the same manner and hence code is duplicated. Add and use the helper nvmf_complete_timed_out_request() to remove the duplicate code. Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme/host/fabrics.h')
-rw-r--r--drivers/nvme/host/fabrics.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index 1e3a09cad961..46d6e194ac2b 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -187,6 +187,14 @@ static inline char *nvmf_ctrl_subsysnqn(struct nvme_ctrl *ctrl)
return ctrl->subsys->subnqn;
}
+static inline void nvmf_complete_timed_out_request(struct request *rq)
+{
+ if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) {
+ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
+ blk_mq_complete_request(rq);
+ }
+}
+
int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val);
int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val);
int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val);