xref: /linux/include/linux/nvme-rdma.h (revision 3ee80c3d15b61e61611903033df414a0590cfde9)
1931a6de4SSagi Grimberg /*
2931a6de4SSagi Grimberg  * Copyright (c) 2015 Mellanox Technologies. All rights reserved.
3931a6de4SSagi Grimberg  *
4931a6de4SSagi Grimberg  * This program is free software; you can redistribute it and/or modify it
5931a6de4SSagi Grimberg  * under the terms and conditions of the GNU General Public License,
6931a6de4SSagi Grimberg  * version 2, as published by the Free Software Foundation.
7931a6de4SSagi Grimberg  *
8931a6de4SSagi Grimberg  * This program is distributed in the hope it will be useful, but WITHOUT
9931a6de4SSagi Grimberg  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10931a6de4SSagi Grimberg  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11931a6de4SSagi Grimberg  * more details.
12931a6de4SSagi Grimberg  */
13931a6de4SSagi Grimberg 
14931a6de4SSagi Grimberg #ifndef _LINUX_NVME_RDMA_H
15931a6de4SSagi Grimberg #define _LINUX_NVME_RDMA_H
16931a6de4SSagi Grimberg 
17931a6de4SSagi Grimberg enum nvme_rdma_cm_fmt {
18931a6de4SSagi Grimberg 	NVME_RDMA_CM_FMT_1_0 = 0x0,
19931a6de4SSagi Grimberg };
20931a6de4SSagi Grimberg 
21931a6de4SSagi Grimberg enum nvme_rdma_cm_status {
22931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_LEN	= 0x01,
23931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_RECFMT	= 0x02,
24931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_QID	= 0x03,
25931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_HSQSIZE	= 0x04,
26931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_HRQSIZE	= 0x05,
27931a6de4SSagi Grimberg 	NVME_RDMA_CM_NO_RSC		= 0x06,
28931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_IRD	= 0x07,
29931a6de4SSagi Grimberg 	NVME_RDMA_CM_INVALID_ORD	= 0x08,
30931a6de4SSagi Grimberg };
31931a6de4SSagi Grimberg 
32*3ee80c3dSMax Gurtovoy static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)
33*3ee80c3dSMax Gurtovoy {
34*3ee80c3dSMax Gurtovoy 	switch (status) {
35*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_LEN:
36*3ee80c3dSMax Gurtovoy 		return "invalid length";
37*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_RECFMT:
38*3ee80c3dSMax Gurtovoy 		return "invalid record format";
39*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_QID:
40*3ee80c3dSMax Gurtovoy 		return "invalid queue ID";
41*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_HSQSIZE:
42*3ee80c3dSMax Gurtovoy 		return "invalid host SQ size";
43*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_HRQSIZE:
44*3ee80c3dSMax Gurtovoy 		return "invalid host RQ size";
45*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_NO_RSC:
46*3ee80c3dSMax Gurtovoy 		return "resource not found";
47*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_IRD:
48*3ee80c3dSMax Gurtovoy 		return "invalid IRD";
49*3ee80c3dSMax Gurtovoy 	case NVME_RDMA_CM_INVALID_ORD:
50*3ee80c3dSMax Gurtovoy 		return "Invalid ORD";
51*3ee80c3dSMax Gurtovoy 	default:
52*3ee80c3dSMax Gurtovoy 		return "unrecognized reason";
53*3ee80c3dSMax Gurtovoy 	}
54*3ee80c3dSMax Gurtovoy }
55*3ee80c3dSMax Gurtovoy 
56931a6de4SSagi Grimberg /**
57931a6de4SSagi Grimberg  * struct nvme_rdma_cm_req - rdma connect request
58931a6de4SSagi Grimberg  *
59931a6de4SSagi Grimberg  * @recfmt:        format of the RDMA Private Data
60931a6de4SSagi Grimberg  * @qid:           queue Identifier for the Admin or I/O Queue
61931a6de4SSagi Grimberg  * @hrqsize:       host receive queue size to be created
62931a6de4SSagi Grimberg  * @hsqsize:       host send queue size to be created
63931a6de4SSagi Grimberg  */
64931a6de4SSagi Grimberg struct nvme_rdma_cm_req {
65931a6de4SSagi Grimberg 	__le16		recfmt;
66931a6de4SSagi Grimberg 	__le16		qid;
67931a6de4SSagi Grimberg 	__le16		hrqsize;
68931a6de4SSagi Grimberg 	__le16		hsqsize;
69931a6de4SSagi Grimberg 	u8		rsvd[24];
70931a6de4SSagi Grimberg };
71931a6de4SSagi Grimberg 
72931a6de4SSagi Grimberg /**
73931a6de4SSagi Grimberg  * struct nvme_rdma_cm_rep - rdma connect reply
74931a6de4SSagi Grimberg  *
75931a6de4SSagi Grimberg  * @recfmt:        format of the RDMA Private Data
76931a6de4SSagi Grimberg  * @crqsize:       controller receive queue size
77931a6de4SSagi Grimberg  */
78931a6de4SSagi Grimberg struct nvme_rdma_cm_rep {
79931a6de4SSagi Grimberg 	__le16		recfmt;
80931a6de4SSagi Grimberg 	__le16		crqsize;
81931a6de4SSagi Grimberg 	u8		rsvd[28];
82931a6de4SSagi Grimberg };
83931a6de4SSagi Grimberg 
84931a6de4SSagi Grimberg /**
85931a6de4SSagi Grimberg  * struct nvme_rdma_cm_rej - rdma connect reject
86931a6de4SSagi Grimberg  *
87931a6de4SSagi Grimberg  * @recfmt:        format of the RDMA Private Data
88931a6de4SSagi Grimberg  * @fsts:          error status for the associated connect request
89931a6de4SSagi Grimberg  */
90931a6de4SSagi Grimberg struct nvme_rdma_cm_rej {
91931a6de4SSagi Grimberg 	__le16		recfmt;
92931a6de4SSagi Grimberg 	__le16		sts;
93931a6de4SSagi Grimberg };
94931a6de4SSagi Grimberg 
95931a6de4SSagi Grimberg #endif /* _LINUX_NVME_RDMA_H */
96