66 #if defined(OCS_DEBUG_QUEUE_HISTORY)
67 #define OCS_Q_HIST_SIZE (1000000UL)
70 #define OCS_LOG_ENABLE_SM_TRACE(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 0)) != 0) : 0)
71 #define OCS_LOG_ENABLE_ELS_TRACE(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 1)) != 0) : 0)
72 #define OCS_LOG_ENABLE_SCSI_TRACE(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 2)) != 0) : 0)
73 #define OCS_LOG_ENABLE_SCSI_TGT_TRACE(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 3)) != 0) : 0)
74 #define OCS_LOG_ENABLE_DOMAIN_SM_TRACE(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 4)) != 0) : 0)
75 #define OCS_LOG_ENABLE_Q_FULL_BUSY_MSG(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 5)) != 0) : 0)
76 #define OCS_LOG_ENABLE_IO_ERRORS(ocs) (((ocs) != NULL) ? (((ocs)->logmask & (1U << 6)) != 0) : 0)
79 extern void ocs_dump32(uint32_t, ocs_os_handle_t,
const char *,
void *, uint32_t);
86 #if defined(OCS_DEBUG_QUEUE_HISTORY)
91 typedef union ocs_q_hist_ftr_u {
94 #define Q_HIST_TYPE_LEN 3
95 #define Q_HIST_MASK_LEN 29
96 uint32_t mask:Q_HIST_MASK_LEN,
105 typedef struct ocs_q_hist_wqe_mask_s {
108 } ocs_q_hist_wqe_mask_t;
113 typedef struct ocs_q_hist_cqe_mask_s {
115 uint32_t :Q_HIST_MASK_LEN,
116 type:Q_HIST_TYPE_LEN;
119 } ocs_q_hist_cqe_mask_t;
126 OCS_Q_HIST_TYPE_WQE = 0,
127 OCS_Q_HIST_TYPE_CWQE,
128 OCS_Q_HIST_TYPE_CXABT,
129 OCS_Q_HIST_TYPE_MISC,
132 static __inline
const char *
133 ocs_queue_history_type_name(ocs_q_hist_type_t type)
136 case OCS_Q_HIST_TYPE_WQE:
return "wqe";
break;
137 case OCS_Q_HIST_TYPE_CWQE:
return "wcqe";
break;
138 case OCS_Q_HIST_TYPE_CXABT:
return "xacqe";
break;
139 case OCS_Q_HIST_TYPE_MISC:
return "misc";
break;
140 default:
return "unknown";
break;
147 uint32_t q_hist_index;
148 ocs_lock_t q_hist_lock;
151 extern void ocs_queue_history_cqe(ocs_hal_q_hist_t*, uint8_t, uint32_t *, uint8_t, uint32_t, uint32_t);
156 extern uint32_t ocs_queue_history_prev_index(uint32_t);
157 extern uint8_t ocs_queue_history_q_info_enabled(
void);
158 extern uint8_t ocs_queue_history_timestamp_enabled(
void);
160 #define ocs_queue_history_wq(...)
161 #define ocs_queue_history_cqe(...)
162 #define ocs_queue_history_misc(...)
163 #define ocs_queue_history_init(...)
164 #define ocs_queue_history_free(...)
167 #define OCS_DEBUG_ALWAYS (1U << 0)
168 #define OCS_DEBUG_ENABLE_MQ_DUMP (1U << 1)
169 #define OCS_DEBUG_ENABLE_CQ_DUMP (1U << 2)
170 #define OCS_DEBUG_ENABLE_WQ_DUMP (1U << 3)
171 #define OCS_DEBUG_ENABLE_EQ_DUMP (1U << 4)
172 #define OCS_DEBUG_ENABLE_SPARAM_DUMP (1U << 5)
174 extern void _ocs_assert(
const char *cond,
const char *filename,
int linenum);
176 #define ocs_assert(cond, ...) \
179 _ocs_assert(#cond, __FILE__, __LINE__); \
180 return __VA_ARGS__; \
185 extern void ocs_display_sparams(
const char *prelabel,
const char *reqlabel,
int dest,
void *textbuf,
void *sparams);
#define ocs_queue_history_misc(...)
void ocs_debug_attach(void *)
#define ocs_queue_history_wq(...)
#define ocs_queue_history_init(...)
void ocs_debug_detach(void *)
#define ocs_queue_history_cqe(...)
void ocs_dump_service_params(const char *label, void *sparms)
void ocs_display_sparams(const char *prelabel, const char *reqlabel, int dest, void *textbuf, void *sparams)
Display service parameters.
void _ocs_assert(const char *cond, const char *filename, int linenum)
void ocs_dump32(uint32_t mask, ocs_os_handle_t os, const char *label, void *buf, uint32_t buf_length)
Dump 32 bit hex/ascii data.
#define ocs_queue_history_free(...)
void ocs_debug_enable(uint32_t mask)
enable debug options
int ocs_debug_is_enabled(uint32_t mask)
return true if debug bits are enabled
void ocs_debug_disable(uint32_t mask)
disable debug options