Skip to content

Commit 03c3d7c

Browse files
floatiouskeithbusch
authored andcommitted
nvme-rdma: send cntlid in the RDMA_CM_REQUEST Private Data
When sending a RDMA_CM_REQUEST, the NVMe RDMA Transport Specification allows you to populate the cntlid field in the RDMA_CM_REQUEST Private Data. The cntlid is returned by the target on completion of the first RDMA_CM_REQUEST command (which creates the admin queue). The cntlid field can then be populated by the host when the I/O queues are created (using additional RDMA_CM_REQUEST commands), such that the target can perform extra validation for additional RDMA_CM_REQUEST commands. This additional error code and error message is also added, such that nvme_rdma_cm_msg() will display the proper error message if the target fails the RDMA_CM_REQUEST command because of this extra validation. Signed-off-by: Niklas Cassel <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent ff4a0a4 commit 03c3d7c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/nvme/host/rdma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,8 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue)
18761876
*/
18771877
priv.hrqsize = cpu_to_le16(queue->queue_size);
18781878
priv.hsqsize = cpu_to_le16(queue->ctrl->ctrl.sqsize);
1879+
/* cntlid should only be set when creating an I/O queue */
1880+
priv.cntlid = cpu_to_le16(ctrl->ctrl.cntlid);
18791881
}
18801882

18811883
ret = rdma_connect_locked(queue->cm_id, &param);

include/linux/nvme-rdma.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum nvme_rdma_cm_status {
2525
NVME_RDMA_CM_NO_RSC = 0x06,
2626
NVME_RDMA_CM_INVALID_IRD = 0x07,
2727
NVME_RDMA_CM_INVALID_ORD = 0x08,
28+
NVME_RDMA_CM_INVALID_CNTLID = 0x09,
2829
};
2930

3031
static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)
@@ -46,6 +47,8 @@ static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)
4647
return "invalid IRD";
4748
case NVME_RDMA_CM_INVALID_ORD:
4849
return "Invalid ORD";
50+
case NVME_RDMA_CM_INVALID_CNTLID:
51+
return "invalid controller ID";
4952
default:
5053
return "unrecognized reason";
5154
}
@@ -64,7 +67,8 @@ struct nvme_rdma_cm_req {
6467
__le16 qid;
6568
__le16 hrqsize;
6669
__le16 hsqsize;
67-
u8 rsvd[24];
70+
__le16 cntlid;
71+
u8 rsvd[22];
6872
};
6973

7074
/**

0 commit comments

Comments
 (0)