xref: /linux/include/linux/nvme-rdma.h (revision 26bb0d3f38a764b743a3ad5c8b6e5b5044d7ceb4)
15d8762d5SChristoph Hellwig /* SPDX-License-Identifier: GPL-2.0 */
2931a6de4SSagi Grimberg /*
3931a6de4SSagi Grimberg  * Copyright (c) 2015 Mellanox Technologies. All rights reserved.
4931a6de4SSagi Grimberg  */
5931a6de4SSagi Grimberg 
6931a6de4SSagi Grimberg #ifndef _LINUX_NVME_RDMA_H
7931a6de4SSagi Grimberg #define _LINUX_NVME_RDMA_H
8931a6de4SSagi Grimberg 
925802f3aSMax Gurtovoy #define NVME_RDMA_IP_PORT		4420
1025802f3aSMax Gurtovoy 
11f096ba32SMax Gurtovoy #define NVME_RDMA_MAX_QUEUE_SIZE 256
1236144964SMax Gurtovoy #define NVME_RDMA_MAX_METADATA_QUEUE_SIZE 128
13f096ba32SMax Gurtovoy #define NVME_RDMA_DEFAULT_QUEUE_SIZE 128
1444c3c625SMax Gurtovoy 
15931a6de4SSagi Grimberg enum nvme_rdma_cm_fmt {
16931a6de4SSagi Grimberg 	NVME_RDMA_CM_FMT_1_0 = 0x0,
17931a6de4SSagi Grimberg };
18931a6de4SSagi Grimberg 
19931a6de4SSagi Grimberg enum nvme_rdma_cm_status {
20931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_LEN	= 0x01,
21931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_RECFMT	= 0x02,
22931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_QID	= 0x03,
23931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_HSQSIZE	= 0x04,
24931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_HRQSIZE	= 0x05,
25931a6de4SSagi Grimberg 	NVME_RDMA_CM_NO_RSC		= 0x06,
26931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_IRD	= 0x07,
27931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_ORD	= 0x08,
28*03c3d7c7SNiklas Cassel 	NVME_RDMA_CM_INVALID_CNTLID	= 0x09,
29931a6de4SSagi Grimberg };
30931a6de4SSagi Grimberg 
nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)313ee80c3dSMax Gurtovoy static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)
323ee80c3dSMax Gurtovoy {
333ee80c3dSMax Gurtovoy 	switch (status) {
343ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_LEN:
353ee80c3dSMax Gurtovoy 		return "invalid length";
363ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_RECFMT:
373ee80c3dSMax Gurtovoy 		return "invalid record format";
383ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_QID:
393ee80c3dSMax Gurtovoy 		return "invalid queue ID";
403ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_HSQSIZE:
413ee80c3dSMax Gurtovoy 		return "invalid host SQ size";
423ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_HRQSIZE:
433ee80c3dSMax Gurtovoy 		return "invalid host RQ size";
443ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_NO_RSC:
453ee80c3dSMax Gurtovoy 		return "resource not found";
463ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_IRD:
473ee80c3dSMax Gurtovoy 		return "invalid IRD";
483ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_ORD:
493ee80c3dSMax Gurtovoy 		return "Invalid ORD";
50*03c3d7c7SNiklas Cassel 	case NVME_RDMA_CM_INVALID_CNTLID:
51*03c3d7c7SNiklas Cassel 		return "invalid controller ID";
523ee80c3dSMax Gurtovoy 	default:
533ee80c3dSMax Gurtovoy 		return "unrecognized reason";
543ee80c3dSMax Gurtovoy 	}
553ee80c3dSMax Gurtovoy }
563ee80c3dSMax Gurtovoy 
57931a6de4SSagi Grimberg /**
58931a6de4SSagi Grimberg  * struct nvme_rdma_cm_req - rdma connect request
59931a6de4SSagi Grimberg  *
60931a6de4SSagi Grimberg  * @recfmt:        format of the RDMA Private Data
61931a6de4SSagi Grimberg  * @qid:           queue Identifier for the Admin or I/O Queue
62931a6de4SSagi Grimberg  * @hrqsize:       host receive queue size to be created
63931a6de4SSagi Grimberg  * @hsqsize:       host send queue size to be created
64931a6de4SSagi Grimberg  */
65931a6de4SSagi Grimberg struct nvme_rdma_cm_req {
66931a6de4SSagi Grimberg 	__le16		recfmt;
67931a6de4SSagi Grimberg 	__le16		qid;
68931a6de4SSagi Grimberg 	__le16		hrqsize;
69931a6de4SSagi Grimberg 	__le16		hsqsize;
70*03c3d7c7SNiklas Cassel 	__le16		cntlid;
71*03c3d7c7SNiklas Cassel 	u8		rsvd[22];
72931a6de4SSagi Grimberg };
73931a6de4SSagi Grimberg 
74931a6de4SSagi Grimberg /**
75931a6de4SSagi Grimberg  * struct nvme_rdma_cm_rep - rdma connect reply
76931a6de4SSagi Grimberg  *
77931a6de4SSagi Grimberg  * @recfmt:        format of the RDMA Private Data
78931a6de4SSagi Grimberg  * @crqsize:       controller receive queue size
79931a6de4SSagi Grimberg  */
80931a6de4SSagi Grimberg struct nvme_rdma_cm_rep {
81931a6de4SSagi Grimberg 	__le16		recfmt;
82931a6de4SSagi Grimberg 	__le16		crqsize;
83931a6de4SSagi Grimberg 	u8		rsvd[28];
84931a6de4SSagi Grimberg };
85931a6de4SSagi Grimberg 
86931a6de4SSagi Grimberg /**
87931a6de4SSagi Grimberg  * struct nvme_rdma_cm_rej - rdma connect reject
88931a6de4SSagi Grimberg  *
89931a6de4SSagi Grimberg  * @recfmt:        format of the RDMA Private Data
9082bebbdeSMinwoo Im  * @sts:           error status for the associated connect request
91931a6de4SSagi Grimberg  */
92931a6de4SSagi Grimberg struct nvme_rdma_cm_rej {
93931a6de4SSagi Grimberg 	__le16		recfmt;
94931a6de4SSagi Grimberg 	__le16		sts;
95931a6de4SSagi Grimberg };
96931a6de4SSagi Grimberg 
97931a6de4SSagi Grimberg #endif /* _LINUX_NVME_RDMA_H */
98