Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
[pandora-kernel.git] / drivers / scsi / bnx2fc / bnx2fc_constants.h
index fe77691..399cda0 100644 (file)
@@ -5,6 +5,12 @@
  * This file defines HSI constants for the FCoE flows
  */
 
+/* Current FCoE HSI version number composed of two fields (16 bit) */
+/* Implies on a change broken previous HSI */
+#define FCOE_HSI_MAJOR_VERSION (1)
+/* Implies on a change which does not broken previous HSI */
+#define FCOE_HSI_MINOR_VERSION (1)
+
 /* KWQ/KCQ FCoE layer code */
 #define FCOE_KWQE_LAYER_CODE   (7)
 
 #define FCOE_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE  (0x3)
 #define FCOE_KCQE_COMPLETION_STATUS_CTX_FREE_FAILURE   (0x4)
 #define FCOE_KCQE_COMPLETION_STATUS_NIC_ERROR                  (0x5)
+#define FCOE_KCQE_COMPLETION_STATUS_WRONG_HSI_VERSION   (0x6)
+
+/* CQE type */
+#define FCOE_PENDING_CQE_TYPE                  0
+#define FCOE_UNSOLIC_CQE_TYPE                  1
 
 /* Unsolicited CQE type */
 #define FCOE_UNSOLICITED_FRAME_CQE_TYPE                        0
 #define FCOE_ERROR_DETECTION_CQE_TYPE                  1
 #define FCOE_WARNING_DETECTION_CQE_TYPE                        2
 
+/* E_D_TOV timer resolution in ms */
+#define FCOE_E_D_TOV_TIMER_RESOLUTION_MS (20)
+
+/* E_D_TOV timer resolution for SDM (4 micro) */
+#define FCOE_E_D_TOV_SDM_TIMER_RESOLUTION                              \
+       (FCOE_E_D_TOV_TIMER_RESOLUTION_MS * 1000 / 4)
+
+/* REC timer resolution in ms */
+#define FCOE_REC_TIMER_RESOLUTION_MS (20)
+
+/* REC timer resolution for SDM (4 micro) */
+#define FCOE_REC_SDM_TIMER_RESOLUTION (FCOE_REC_TIMER_RESOLUTION_MS * 1000 / 4)
+
+/* E_D_TOV timer default wraparound value (2 sec) in 20 ms resolution */
+#define FCOE_E_D_TOV_DEFAULT_WRAPAROUND_VAL                    \
+                       (2000 / FCOE_E_D_TOV_TIMER_RESOLUTION_MS)
+
+/* REC_TOV timer default wraparound value (3 sec) in 20 ms resolution */
+#define FCOE_REC_TOV_DEFAULT_WRAPAROUND_VAL                    \
+                       (3000 / FCOE_REC_TIMER_RESOLUTION_MS)
+
+#define FCOE_NUM_OF_TIMER_TASKS  (8 * 1024)
+
+#define FCOE_NUM_OF_CACHED_TASKS_TIMER (8)
+
 /* Task context constants */
+/******** Remove FCP_CMD write tce sleep ***********************/
+/* In case timer services are required then shall be updated by Xstorm after
+ * start processing the task. In case no timer facilities are required then the
+ * driver would initialize the state to this value
+ *
+#define        FCOE_TASK_TX_STATE_NORMAL                               0
+ * After driver has initialize the task in case timer services required *
+#define        FCOE_TASK_TX_STATE_INIT                                 1
+******** Remove FCP_CMD write tce sleep ***********************/
 /* After driver has initialize the task in case timer services required */
 #define        FCOE_TASK_TX_STATE_INIT                                 0
 /* In case timer services are required then shall be updated by Xstorm after
  * start processing the task. In case no timer facilities are required then the
- * driver would initialize the state to this value */
+ * driver would initialize the state to this value
+ */
 #define        FCOE_TASK_TX_STATE_NORMAL                               1
 /* Task is under abort procedure. Updated in order to stop processing of
- * pending WQEs on this task */
+ * pending WQEs on this task
+ */
 #define        FCOE_TASK_TX_STATE_ABORT                                2
 /* For E_D_T_TOV timer expiration in Xstorm (Class 2 only) */
 #define        FCOE_TASK_TX_STATE_ERROR                                3
 #define        FCOE_TASK_TX_STATE_EXCHANGE_CLEANUP                     6
 /* For sequence cleanup request task */
 #define        FCOE_TASK_TX_STATE_SEQUENCE_CLEANUP                     7
-/* Mark task as aborted and indicate that ABTS was not transmitted */
-#define        FCOE_TASK_TX_STATE_BEFORE_ABTS_TX                       8
-/* Mark task as aborted and indicate that ABTS was transmitted */
-#define        FCOE_TASK_TX_STATE_AFTER_ABTS_TX                        9
 /* For completion the ABTS task. */
-#define        FCOE_TASK_TX_STATE_ABTS_TX_COMPLETED                    10
-/* Mark task as aborted and indicate that Exchange cleanup was not transmitted
- */
-#define        FCOE_TASK_TX_STATE_BEFORE_EXCHANGE_CLEANUP_TX           11
-/* Mark task as aborted and indicate that Exchange cleanup was transmitted */
-#define        FCOE_TASK_TX_STATE_AFTER_EXCHANGE_CLEANUP_TX            12
+#define        FCOE_TASK_TX_STATE_ABTS_TX                              8
 
 #define        FCOE_TASK_RX_STATE_NORMAL                               0
 #define        FCOE_TASK_RX_STATE_COMPLETED                            1
 #define        FCOE_TASK_RX_STATE_WARNING                              3
 /* For E_D_T_TOV timer expiration in Ustorm */
 #define        FCOE_TASK_RX_STATE_ERROR                                4
-/* ABTS ACC arrived wait for local completion to finally complete the task. */
-#define        FCOE_TASK_RX_STATE_ABTS_ACC_ARRIVED                     5
-/* local completion arrived wait for ABTS ACC to finally complete the task. */
-#define        FCOE_TASK_RX_STATE_ABTS_LOCAL_COMP_ARRIVED              6
+/* FW only: First visit at rx-path, part of the abts round trip */
+#define        FCOE_TASK_RX_STATE_ABTS_IN_PROCESS                      5
+/* FW only: Second visit at rx-path, after ABTS frame transmitted */
+#define        FCOE_TASK_RX_STATE_ABTS_TRANSMITTED                     6
 /* Special completion indication in case of task was aborted. */
 #define FCOE_TASK_RX_STATE_ABTS_COMPLETED                      7
-/* Special completion indication in case of task was cleaned. */
-#define FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_COMPLETED          8
-/* Special completion indication (in task requested the exchange cleanup) in
- * case cleaned task is in non-valid. */
-#define FCOE_TASK_RX_STATE_ABORT_CLEANUP_COMPLETED             9
+/* FW only: First visit at rx-path, part of the cleanup round trip */
+#define        FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_IN_PROCESS          8
+/* FW only: Special completion indication in case of task was cleaned. */
+#define FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_COMPLETED          9
+/* Not in used: Special completion indication (in task requested the exchange
+ * cleanup) in case cleaned task is in non-valid.
+ */
+#define FCOE_TASK_RX_STATE_ABORT_CLEANUP_COMPLETED             10
 /* Special completion indication (in task requested the sequence cleanup) in
- * case cleaned task was already returned to normal. */
-#define FCOE_TASK_RX_STATE_IGNORED_SEQUENCE_CLEANUP            10
-/* Exchange cleanup arrived wait until xfer will be handled to finally
- * complete the task. */
-#define        FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_ARRIVED             11
-/* Xfer handled, wait for exchange cleanup to finally complete the task. */
-#define        FCOE_TASK_RX_STATE_EXCHANGE_CLEANUP_HANDLED_XFER        12
+ * case cleaned task was already returned to normal.
+ */
+#define FCOE_TASK_RX_STATE_IGNORED_SEQUENCE_CLEANUP            11
+
 
 #define        FCOE_TASK_TYPE_WRITE                    0
 #define        FCOE_TASK_TYPE_READ                             1
 #define FCOE_TASK_CLASS_TYPE_3                 0
 #define FCOE_TASK_CLASS_TYPE_2                 1
 
+/* FCoE/FC packet fields  */
+#define        FCOE_ETH_TYPE                                   0x8906
+
+/* FCoE maximum elements in hash table */
+#define FCOE_MAX_ELEMENTS_IN_HASH_TABLE_ROW    8
+
+/* FCoE half of the elements in hash table */
+#define FCOE_HALF_ELEMENTS_IN_HASH_TABLE_ROW                   \
+                       (FCOE_MAX_ELEMENTS_IN_HASH_TABLE_ROW / 2)
+
+/* FcoE number of cached T2 entries */
+#define T_FCOE_NUMBER_OF_CACHED_T2_ENTRIES (4)
+
+/* FCoE maximum elements in hash table */
+#define FCOE_HASH_TBL_CHUNK_SIZE       16384
+
 /* Everest FCoE connection type */
 #define B577XX_FCOE_CONNECTION_TYPE            4
 
-/* Error codes for Error Reporting in fast path flows */
-/* XFER error codes */
+/* FCoE number of rows (in log). This number derives
+ * from the maximum connections supported which is 2048.
+ * TBA: Need a different constant for E2
+ */
+#define FCOE_MAX_NUM_SESSIONS_LOG              11
+
+#define FC_ABTS_REPLY_MAX_PAYLOAD_LEN  12
+
+/* Error codes for Error Reporting in slow path flows */
+#define FCOE_SLOW_PATH_ERROR_CODE_TOO_MANY_FUNCS                       0
+#define FCOE_SLOW_PATH_ERROR_CODE_NO_LICENSE                           1
+
+/* Error codes for Error Reporting in fast path flows
+ * XFER error codes
+ */
 #define FCOE_ERROR_CODE_XFER_OOO_RO                                    0
 #define FCOE_ERROR_CODE_XFER_RO_NOT_ALIGNED                            1
 #define FCOE_ERROR_CODE_XFER_NULL_BURST_LEN                            2
 #define FCOE_ERROR_CODE_DATA_SOFI3_SEQ_ACTIVE_SET                      23
 #define FCOE_ERROR_CODE_DATA_SOFN_SEQ_ACTIVE_RESET                     24
 #define FCOE_ERROR_CODE_DATA_EOFN_END_SEQ_SET                          25
-#define FCOE_ERROR_CODE_DATA_EOFT_END_SEQ_RESET                        26
-#define FCOE_ERROR_CODE_DATA_TASK_TYPE_NOT_READ                        27
+#define FCOE_ERROR_CODE_DATA_EOFT_END_SEQ_RESET                                26
+#define FCOE_ERROR_CODE_DATA_TASK_TYPE_NOT_READ                                27
 #define FCOE_ERROR_CODE_DATA_FCTL                                      28
 
 /* Middle path error codes */
-#define FCOE_ERROR_CODE_MIDPATH_TYPE_NOT_ELS                           29
+#define FCOE_ERROR_CODE_MIDPATH_INVALID_TYPE                           29
 #define FCOE_ERROR_CODE_MIDPATH_SOFI3_SEQ_ACTIVE_SET                   30
 #define FCOE_ERROR_CODE_MIDPATH_SOFN_SEQ_ACTIVE_RESET                  31
 #define FCOE_ERROR_CODE_MIDPATH_EOFN_END_SEQ_SET                       32
 #define FCOE_ERROR_CODE_MIDPATH_EOFT_END_SEQ_RESET                     33
-#define FCOE_ERROR_CODE_MIDPATH_ELS_REPLY_FCTL                         34
+#define FCOE_ERROR_CODE_MIDPATH_REPLY_FCTL                             34
 #define FCOE_ERROR_CODE_MIDPATH_INVALID_REPLY                          35
 #define FCOE_ERROR_CODE_MIDPATH_ELS_REPLY_RCTL                         36
 
 #define FCOE_ERROR_CODE_ABTS_REPLY_F_CTL                               37
 #define FCOE_ERROR_CODE_ABTS_REPLY_DDF_RCTL_FIELD                      38
 #define FCOE_ERROR_CODE_ABTS_REPLY_INVALID_BLS_RCTL                    39
-#define FCOE_ERROR_CODE_ABTS_REPLY_INVALID_RCTL                        40
+#define FCOE_ERROR_CODE_ABTS_REPLY_INVALID_RCTL                                40
 #define FCOE_ERROR_CODE_ABTS_REPLY_RCTL_GENERAL_MISMATCH               41
 
 /* Common error codes */
 #define FCOE_ERROR_CODE_COMMON_DATA_NO_MORE_SGES                       47
 #define FCOE_ERROR_CODE_COMMON_OPTIONAL_FC_HDR                         48
 #define FCOE_ERROR_CODE_COMMON_READ_TCE_OX_ID_TOO_BIG                  49
-#define FCOE_ERROR_CODE_COMMON_DATA_WAS_NOT_TRANSMITTED                50
+#define FCOE_ERROR_CODE_COMMON_DATA_WAS_NOT_TRANSMITTED                        50
 
 /* Unsolicited Rx error codes */
 #define FCOE_ERROR_CODE_UNSOLICITED_TYPE_NOT_ELS                       51