blob: a72fd04aa5e1eac103dd94165edece813663b456 [file] [log] [blame]
Sagi Grimberg931a6de2016-07-06 21:55:50 +09001/*
2 * Copyright (c) 2015 Mellanox Technologies. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef _LINUX_NVME_RDMA_H
15#define _LINUX_NVME_RDMA_H
16
17enum nvme_rdma_cm_fmt {
18 NVME_RDMA_CM_FMT_1_0 = 0x0,
19};
20
21enum nvme_rdma_cm_status {
22 NVME_RDMA_CM_INVALID_LEN = 0x01,
23 NVME_RDMA_CM_INVALID_RECFMT = 0x02,
24 NVME_RDMA_CM_INVALID_QID = 0x03,
25 NVME_RDMA_CM_INVALID_HSQSIZE = 0x04,
26 NVME_RDMA_CM_INVALID_HRQSIZE = 0x05,
27 NVME_RDMA_CM_NO_RSC = 0x06,
28 NVME_RDMA_CM_INVALID_IRD = 0x07,
29 NVME_RDMA_CM_INVALID_ORD = 0x08,
30};
31
Max Gurtovoy3ee80c32017-02-20 13:44:28 +020032static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)
33{
34 switch (status) {
35 case NVME_RDMA_CM_INVALID_LEN:
36 return "invalid length";
37 case NVME_RDMA_CM_INVALID_RECFMT:
38 return "invalid record format";
39 case NVME_RDMA_CM_INVALID_QID:
40 return "invalid queue ID";
41 case NVME_RDMA_CM_INVALID_HSQSIZE:
42 return "invalid host SQ size";
43 case NVME_RDMA_CM_INVALID_HRQSIZE:
44 return "invalid host RQ size";
45 case NVME_RDMA_CM_NO_RSC:
46 return "resource not found";
47 case NVME_RDMA_CM_INVALID_IRD:
48 return "invalid IRD";
49 case NVME_RDMA_CM_INVALID_ORD:
50 return "Invalid ORD";
51 default:
52 return "unrecognized reason";
53 }
54}
55
Sagi Grimberg931a6de2016-07-06 21:55:50 +090056/**
57 * struct nvme_rdma_cm_req - rdma connect request
58 *
59 * @recfmt: format of the RDMA Private Data
60 * @qid: queue Identifier for the Admin or I/O Queue
61 * @hrqsize: host receive queue size to be created
62 * @hsqsize: host send queue size to be created
63 */
64struct nvme_rdma_cm_req {
65 __le16 recfmt;
66 __le16 qid;
67 __le16 hrqsize;
68 __le16 hsqsize;
69 u8 rsvd[24];
70};
71
72/**
73 * struct nvme_rdma_cm_rep - rdma connect reply
74 *
75 * @recfmt: format of the RDMA Private Data
76 * @crqsize: controller receive queue size
77 */
78struct nvme_rdma_cm_rep {
79 __le16 recfmt;
80 __le16 crqsize;
81 u8 rsvd[28];
82};
83
84/**
85 * struct nvme_rdma_cm_rej - rdma connect reject
86 *
87 * @recfmt: format of the RDMA Private Data
88 * @fsts: error status for the associated connect request
89 */
90struct nvme_rdma_cm_rej {
91 __le16 recfmt;
92 __le16 sts;
93};
94
95#endif /* _LINUX_NVME_RDMA_H */