nvme-rdma.h 2.1 KB

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