Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <cassel@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Niklas Cassel and committed by
Keith Busch
03c3d7c7 ff4a0a40

+7 -1
+2
drivers/nvme/host/rdma.c
··· 1876 1876 */ 1877 1877 priv.hrqsize = cpu_to_le16(queue->queue_size); 1878 1878 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); 1879 1881 } 1880 1882 1881 1883 ret = rdma_connect_locked(queue->cm_id, &param);
+5 -1
include/linux/nvme-rdma.h
··· 25 25 NVME_RDMA_CM_NO_RSC = 0x06, 26 26 NVME_RDMA_CM_INVALID_IRD = 0x07, 27 27 NVME_RDMA_CM_INVALID_ORD = 0x08, 28 + NVME_RDMA_CM_INVALID_CNTLID = 0x09, 28 29 }; 29 30 30 31 static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status) ··· 47 46 return "invalid IRD"; 48 47 case NVME_RDMA_CM_INVALID_ORD: 49 48 return "Invalid ORD"; 49 + case NVME_RDMA_CM_INVALID_CNTLID: 50 + return "invalid controller ID"; 50 51 default: 51 52 return "unrecognized reason"; 52 53 } ··· 67 64 __le16 qid; 68 65 __le16 hrqsize; 69 66 __le16 hsqsize; 70 - u8 rsvd[24]; 67 + __le16 cntlid; 68 + u8 rsvd[22]; 71 69 }; 72 70 73 71 /**