oradax.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*
  18. * Oracle DAX driver API definitions
  19. */
  20. #ifndef _ORADAX_H
  21. #define _ORADAX_H
  22. #include <linux/types.h>
  23. #define CCB_KILL 0
  24. #define CCB_INFO 1
  25. #define CCB_DEQUEUE 2
  26. struct dax_command {
  27. __u16 command; /* CCB_KILL/INFO/DEQUEUE */
  28. __u16 ca_offset; /* offset into mmapped completion area */
  29. };
  30. struct ccb_kill_result {
  31. __u16 action; /* action taken to kill ccb */
  32. };
  33. struct ccb_info_result {
  34. __u16 state; /* state of enqueued ccb */
  35. __u16 inst_num; /* dax instance number of enqueued ccb */
  36. __u16 q_num; /* queue number of enqueued ccb */
  37. __u16 q_pos; /* ccb position in queue */
  38. };
  39. struct ccb_exec_result {
  40. __u64 status_data; /* additional status data (e.g. bad VA) */
  41. __u32 status; /* one of DAX_SUBMIT_* */
  42. };
  43. union ccb_result {
  44. struct ccb_exec_result exec;
  45. struct ccb_info_result info;
  46. struct ccb_kill_result kill;
  47. };
  48. #define DAX_MMAP_LEN (16 * 1024)
  49. #define DAX_MAX_CCBS 15
  50. #define DAX_CCB_BUF_MAXLEN (DAX_MAX_CCBS * 64)
  51. #define DAX_NAME "oradax"
  52. /* CCB_EXEC status */
  53. #define DAX_SUBMIT_OK 0
  54. #define DAX_SUBMIT_ERR_RETRY 1
  55. #define DAX_SUBMIT_ERR_WOULDBLOCK 2
  56. #define DAX_SUBMIT_ERR_BUSY 3
  57. #define DAX_SUBMIT_ERR_THR_INIT 4
  58. #define DAX_SUBMIT_ERR_ARG_INVAL 5
  59. #define DAX_SUBMIT_ERR_CCB_INVAL 6
  60. #define DAX_SUBMIT_ERR_NO_CA_AVAIL 7
  61. #define DAX_SUBMIT_ERR_CCB_ARR_MMU_MISS 8
  62. #define DAX_SUBMIT_ERR_NOMAP 9
  63. #define DAX_SUBMIT_ERR_NOACCESS 10
  64. #define DAX_SUBMIT_ERR_TOOMANY 11
  65. #define DAX_SUBMIT_ERR_UNAVAIL 12
  66. #define DAX_SUBMIT_ERR_INTERNAL 13
  67. /* CCB_INFO states - must match HV_CCB_STATE_* definitions */
  68. #define DAX_CCB_COMPLETED 0
  69. #define DAX_CCB_ENQUEUED 1
  70. #define DAX_CCB_INPROGRESS 2
  71. #define DAX_CCB_NOTFOUND 3
  72. /* CCB_KILL actions - must match HV_CCB_KILL_* definitions */
  73. #define DAX_KILL_COMPLETED 0
  74. #define DAX_KILL_DEQUEUED 1
  75. #define DAX_KILL_KILLED 2
  76. #define DAX_KILL_NOTFOUND 3
  77. #endif /* _ORADAX_H */