57xx_iscsi_constants.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* 57xx_iscsi_constants.h: QLogic NetXtreme II iSCSI HSI
  2. *
  3. * Copyright (c) 2006 - 2013 Broadcom Corporation
  4. * Copyright (c) 2014, QLogic Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation.
  9. *
  10. * Written by: Anil Veerabhadrappa (anilgv@broadcom.com)
  11. * Previously Maintained by: Eddie Wai (eddie.wai@broadcom.com)
  12. * Maintained by: QLogic-Storage-Upstream@qlogic.com
  13. */
  14. #ifndef __57XX_ISCSI_CONSTANTS_H_
  15. #define __57XX_ISCSI_CONSTANTS_H_
  16. /**
  17. * This file defines HSI constants for the iSCSI flows
  18. */
  19. /* iSCSI request op codes */
  20. #define ISCSI_OPCODE_CLEANUP_REQUEST (7)
  21. /* iSCSI response/messages op codes */
  22. #define ISCSI_OPCODE_CLEANUP_RESPONSE (0x27)
  23. #define ISCSI_OPCODE_NOPOUT_LOCAL_COMPLETION (0)
  24. /* iSCSI task types */
  25. #define ISCSI_TASK_TYPE_READ (0)
  26. #define ISCSI_TASK_TYPE_WRITE (1)
  27. #define ISCSI_TASK_TYPE_MPATH (2)
  28. /* initial CQ sequence numbers */
  29. #define ISCSI_INITIAL_SN (1)
  30. /* KWQ (kernel work queue) layer codes */
  31. #define ISCSI_KWQE_LAYER_CODE (6)
  32. /* KWQ (kernel work queue) request op codes */
  33. #define ISCSI_KWQE_OPCODE_OFFLOAD_CONN1 (0)
  34. #define ISCSI_KWQE_OPCODE_OFFLOAD_CONN2 (1)
  35. #define ISCSI_KWQE_OPCODE_UPDATE_CONN (2)
  36. #define ISCSI_KWQE_OPCODE_DESTROY_CONN (3)
  37. #define ISCSI_KWQE_OPCODE_INIT1 (4)
  38. #define ISCSI_KWQE_OPCODE_INIT2 (5)
  39. /* KCQ (kernel completion queue) response op codes */
  40. #define ISCSI_KCQE_OPCODE_OFFLOAD_CONN (0x10)
  41. #define ISCSI_KCQE_OPCODE_UPDATE_CONN (0x12)
  42. #define ISCSI_KCQE_OPCODE_DESTROY_CONN (0x13)
  43. #define ISCSI_KCQE_OPCODE_INIT (0x14)
  44. #define ISCSI_KCQE_OPCODE_FW_CLEAN_TASK (0x15)
  45. #define ISCSI_KCQE_OPCODE_TCP_RESET (0x16)
  46. #define ISCSI_KCQE_OPCODE_TCP_SYN (0x17)
  47. #define ISCSI_KCQE_OPCODE_TCP_FIN (0X18)
  48. #define ISCSI_KCQE_OPCODE_TCP_ERROR (0x19)
  49. #define ISCSI_KCQE_OPCODE_CQ_EVENT_NOTIFICATION (0x20)
  50. #define ISCSI_KCQE_OPCODE_ISCSI_ERROR (0x21)
  51. /* KCQ (kernel completion queue) completion status */
  52. #define ISCSI_KCQE_COMPLETION_STATUS_SUCCESS (0x0)
  53. #define ISCSI_KCQE_COMPLETION_STATUS_INVALID_OPCODE (0x1)
  54. #define ISCSI_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE (0x2)
  55. #define ISCSI_KCQE_COMPLETION_STATUS_CTX_FREE_FAILURE (0x3)
  56. #define ISCSI_KCQE_COMPLETION_STATUS_NIC_ERROR (0x4)
  57. #define ISCSI_KCQE_COMPLETION_STATUS_HDR_DIG_ERR (0x5)
  58. #define ISCSI_KCQE_COMPLETION_STATUS_DATA_DIG_ERR (0x6)
  59. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_UNEXPECTED_OPCODE (0xa)
  60. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_OPCODE (0xb)
  61. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_AHS_LEN (0xc)
  62. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ITT (0xd)
  63. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_STATSN (0xe)
  64. /* Response */
  65. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_EXP_DATASN (0xf)
  66. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T (0x10)
  67. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_IS_ZERO (0x2c)
  68. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG (0x2d)
  69. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_0 (0x11)
  70. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_1 (0x12)
  71. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_2 (0x13)
  72. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_3 (0x14)
  73. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_4 (0x15)
  74. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_5 (0x16)
  75. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_6 (0x17)
  76. /* Data-In */
  77. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_RCV_LEN (0x18)
  78. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_RCV_PDU_LEN (0x19)
  79. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_F_BIT_ZERO (0x1a)
  80. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_NOT_RSRV (0x1b)
  81. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATASN (0x1c)
  82. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_BURST_LEN (0x1d)
  83. /* R2T */
  84. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_BUFFER_OFF (0x1f)
  85. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_LUN (0x20)
  86. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_R2TSN (0x21)
  87. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0 (0x22)
  88. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1 (0x23)
  89. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_EXCEED (0x24)
  90. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_IS_RSRV (0x25)
  91. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_BURST_LEN (0x26)
  92. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_NOT_ZERO (0x27)
  93. /* TMF */
  94. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REJECT_PDU_LEN (0x28)
  95. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ASYNC_PDU_LEN (0x29)
  96. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_NOPIN_PDU_LEN (0x2a)
  97. #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_IN_CLEANUP (0x2b)
  98. /* IP/TCP processing errors: */
  99. #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_FRAGMENT (0x40)
  100. #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_OPTIONS (0x41)
  101. #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_URGENT_FLAG (0x42)
  102. #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_MAX_RTRANS (0x43)
  103. /* iSCSI licensing errors */
  104. /* general iSCSI license not installed */
  105. #define ISCSI_KCQE_COMPLETION_STATUS_ISCSI_NOT_SUPPORTED (0x50)
  106. /* additional LOM specific iSCSI license not installed */
  107. #define ISCSI_KCQE_COMPLETION_STATUS_LOM_ISCSI_NOT_ENABLED (0x51)
  108. #define ISCSI_KCQE_COMPLETION_STATUS_CID_BUSY (0x80)
  109. #define ISCSI_KCQE_COMPLETION_STATUS_PARITY_ERR (0x81)
  110. /* SQ/RQ/CQ DB structure sizes */
  111. #define ISCSI_SQ_DB_SIZE (16)
  112. #define ISCSI_RQ_DB_SIZE (64)
  113. #define ISCSI_CQ_DB_SIZE (80)
  114. #define ISCSI_SQN_TO_NOTIFY_NOT_VALID 0xFFFF
  115. /* Page size codes (for flags field in connection offload request) */
  116. #define ISCSI_PAGE_SIZE_256 (0)
  117. #define ISCSI_PAGE_SIZE_512 (1)
  118. #define ISCSI_PAGE_SIZE_1K (2)
  119. #define ISCSI_PAGE_SIZE_2K (3)
  120. #define ISCSI_PAGE_SIZE_4K (4)
  121. #define ISCSI_PAGE_SIZE_8K (5)
  122. #define ISCSI_PAGE_SIZE_16K (6)
  123. #define ISCSI_PAGE_SIZE_32K (7)
  124. #define ISCSI_PAGE_SIZE_64K (8)
  125. #define ISCSI_PAGE_SIZE_128K (9)
  126. #define ISCSI_PAGE_SIZE_256K (10)
  127. #define ISCSI_PAGE_SIZE_512K (11)
  128. #define ISCSI_PAGE_SIZE_1M (12)
  129. #define ISCSI_PAGE_SIZE_2M (13)
  130. #define ISCSI_PAGE_SIZE_4M (14)
  131. #define ISCSI_PAGE_SIZE_8M (15)
  132. /* Iscsi PDU related defines */
  133. #define ISCSI_HEADER_SIZE (48)
  134. #define ISCSI_DIGEST_SHIFT (2)
  135. #define ISCSI_DIGEST_SIZE (4)
  136. #define B577XX_ISCSI_CONNECTION_TYPE 3
  137. #endif /*__57XX_ISCSI_CONSTANTS_H_ */