1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | /* |
3 | * Copyright (c) 2015 Mellanox Technologies. All rights reserved. |
4 | */ |
5 | |
6 | #ifndef _LINUX_NVME_RDMA_H |
7 | #define _LINUX_NVME_RDMA_H |
8 | |
9 | #define NVME_RDMA_MAX_QUEUE_SIZE 128 |
10 | |
11 | enum nvme_rdma_cm_fmt { |
12 | NVME_RDMA_CM_FMT_1_0 = 0x0, |
13 | }; |
14 | |
15 | enum nvme_rdma_cm_status { |
16 | NVME_RDMA_CM_INVALID_LEN = 0x01, |
17 | NVME_RDMA_CM_INVALID_RECFMT = 0x02, |
18 | NVME_RDMA_CM_INVALID_QID = 0x03, |
19 | NVME_RDMA_CM_INVALID_HSQSIZE = 0x04, |
20 | NVME_RDMA_CM_INVALID_HRQSIZE = 0x05, |
21 | NVME_RDMA_CM_NO_RSC = 0x06, |
22 | NVME_RDMA_CM_INVALID_IRD = 0x07, |
23 | NVME_RDMA_CM_INVALID_ORD = 0x08, |
24 | }; |
25 | |
26 | static inline const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status) |
27 | { |
28 | switch (status) { |
29 | case NVME_RDMA_CM_INVALID_LEN: |
30 | return "invalid length" ; |
31 | case NVME_RDMA_CM_INVALID_RECFMT: |
32 | return "invalid record format" ; |
33 | case NVME_RDMA_CM_INVALID_QID: |
34 | return "invalid queue ID" ; |
35 | case NVME_RDMA_CM_INVALID_HSQSIZE: |
36 | return "invalid host SQ size" ; |
37 | case NVME_RDMA_CM_INVALID_HRQSIZE: |
38 | return "invalid host RQ size" ; |
39 | case NVME_RDMA_CM_NO_RSC: |
40 | return "resource not found" ; |
41 | case NVME_RDMA_CM_INVALID_IRD: |
42 | return "invalid IRD" ; |
43 | case NVME_RDMA_CM_INVALID_ORD: |
44 | return "Invalid ORD" ; |
45 | default: |
46 | return "unrecognized reason" ; |
47 | } |
48 | } |
49 | |
50 | /** |
51 | * struct nvme_rdma_cm_req - rdma connect request |
52 | * |
53 | * @recfmt: format of the RDMA Private Data |
54 | * @qid: queue Identifier for the Admin or I/O Queue |
55 | * @hrqsize: host receive queue size to be created |
56 | * @hsqsize: host send queue size to be created |
57 | */ |
58 | struct nvme_rdma_cm_req { |
59 | __le16 recfmt; |
60 | __le16 qid; |
61 | __le16 hrqsize; |
62 | __le16 hsqsize; |
63 | u8 rsvd[24]; |
64 | }; |
65 | |
66 | /** |
67 | * struct nvme_rdma_cm_rep - rdma connect reply |
68 | * |
69 | * @recfmt: format of the RDMA Private Data |
70 | * @crqsize: controller receive queue size |
71 | */ |
72 | struct nvme_rdma_cm_rep { |
73 | __le16 recfmt; |
74 | __le16 crqsize; |
75 | u8 rsvd[28]; |
76 | }; |
77 | |
78 | /** |
79 | * struct nvme_rdma_cm_rej - rdma connect reject |
80 | * |
81 | * @recfmt: format of the RDMA Private Data |
82 | * @sts: error status for the associated connect request |
83 | */ |
84 | struct nvme_rdma_cm_rej { |
85 | __le16 recfmt; |
86 | __le16 sts; |
87 | }; |
88 | |
89 | #endif /* _LINUX_NVME_RDMA_H */ |
90 | |