Skip to content

Commit 762a11d

Browse files
ChaitanayaKulkarniChristoph Hellwig
authored andcommitted
nvmet: add error log support for rdma backend
This patch adds the support to maintain the error log page for rdma transport, we mainly focus here on the NVME_INVALID_FIELD errors. Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 84faf42 commit 762a11d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/nvme/target/rdma.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,11 @@ static u16 nvmet_rdma_map_sgl_inline(struct nvmet_rdma_rsp *rsp)
630630
u64 off = le64_to_cpu(sgl->addr);
631631
u32 len = le32_to_cpu(sgl->length);
632632

633-
if (!nvme_is_write(rsp->req.cmd))
633+
if (!nvme_is_write(rsp->req.cmd)) {
634+
rsp->req.error_loc =
635+
offsetof(struct nvme_common_command, opcode);
634636
return NVME_SC_INVALID_FIELD | NVME_SC_DNR;
637+
}
635638

636639
if (off + len > rsp->queue->dev->inline_data_size) {
637640
pr_err("invalid inline data offset!\n");
@@ -696,6 +699,8 @@ static u16 nvmet_rdma_map_sgl(struct nvmet_rdma_rsp *rsp)
696699
return nvmet_rdma_map_sgl_inline(rsp);
697700
default:
698701
pr_err("invalid SGL subtype: %#x\n", sgl->type);
702+
rsp->req.error_loc =
703+
offsetof(struct nvme_common_command, dptr);
699704
return NVME_SC_INVALID_FIELD | NVME_SC_DNR;
700705
}
701706
case NVME_KEY_SGL_FMT_DATA_DESC:
@@ -706,10 +711,13 @@ static u16 nvmet_rdma_map_sgl(struct nvmet_rdma_rsp *rsp)
706711
return nvmet_rdma_map_sgl_keyed(rsp, sgl, false);
707712
default:
708713
pr_err("invalid SGL subtype: %#x\n", sgl->type);
714+
rsp->req.error_loc =
715+
offsetof(struct nvme_common_command, dptr);
709716
return NVME_SC_INVALID_FIELD | NVME_SC_DNR;
710717
}
711718
default:
712719
pr_err("invalid SGL type: %#x\n", sgl->type);
720+
rsp->req.error_loc = offsetof(struct nvme_common_command, dptr);
713721
return NVME_SC_SGL_INVALID_TYPE | NVME_SC_DNR;
714722
}
715723
}

0 commit comments

Comments
 (0)