bfa_plog.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFA_PORTLOG_H__
  18. #define __BFA_PORTLOG_H__
  19. #include "protocol/fc.h"
  20. #include <defs/bfa_defs_types.h>
  21. #define BFA_PL_NLOG_ENTS 256
  22. #define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
  23. #define BFA_PL_STRING_LOG_SZ 32 /* number of chars in string log */
  24. #define BFA_PL_INT_LOG_SZ 8 /* number of integers in the integer log */
  25. enum bfa_plog_log_type {
  26. BFA_PL_LOG_TYPE_INVALID = 0,
  27. BFA_PL_LOG_TYPE_INT = 1,
  28. BFA_PL_LOG_TYPE_STRING = 2,
  29. };
  30. /*
  31. * the (fixed size) record format for each entry in the portlog
  32. */
  33. struct bfa_plog_rec_s {
  34. u32 tv; /* Filled by the portlog driver when the *
  35. * entry is added to the circular log. */
  36. u8 port; /* Source port that logged this entry. CM
  37. * entities will use 0xFF */
  38. u8 mid; /* Integer value to be used by all entities *
  39. * while logging. The module id to string *
  40. * conversion will be done by BFAL. See
  41. * enum bfa_plog_mid */
  42. u8 eid; /* indicates Rx, Tx, IOCTL, etc. See
  43. * enum bfa_plog_eid */
  44. u8 log_type; /* indicates string log or integer log.
  45. * see bfa_plog_log_type_t */
  46. u8 log_num_ints;
  47. /*
  48. * interpreted only if log_type is INT_LOG. indicates number of
  49. * integers in the int_log[] (0-PL_INT_LOG_SZ).
  50. */
  51. u8 rsvd;
  52. u16 misc; /* can be used to indicate fc frame length,
  53. *etc.. */
  54. union {
  55. char string_log[BFA_PL_STRING_LOG_SZ];
  56. u32 int_log[BFA_PL_INT_LOG_SZ];
  57. } log_entry;
  58. };
  59. /*
  60. * the following #defines will be used by the logging entities to indicate
  61. * their module id. BFAL will convert the integer value to string format
  62. *
  63. * process to be used while changing the following #defines:
  64. * - Always add new entries at the end
  65. * - define corresponding string in BFAL
  66. * - Do not remove any entry or rearrange the order.
  67. */
  68. enum bfa_plog_mid {
  69. BFA_PL_MID_INVALID = 0,
  70. BFA_PL_MID_DEBUG = 1,
  71. BFA_PL_MID_DRVR = 2,
  72. BFA_PL_MID_HAL = 3,
  73. BFA_PL_MID_HAL_FCXP = 4,
  74. BFA_PL_MID_HAL_UF = 5,
  75. BFA_PL_MID_FCS = 6,
  76. BFA_PL_MID_LPS = 7,
  77. BFA_PL_MID_MAX = 8
  78. };
  79. #define BFA_PL_MID_STRLEN 8
  80. struct bfa_plog_mid_strings_s {
  81. char m_str[BFA_PL_MID_STRLEN];
  82. };
  83. /*
  84. * the following #defines will be used by the logging entities to indicate
  85. * their event type. BFAL will convert the integer value to string format
  86. *
  87. * process to be used while changing the following #defines:
  88. * - Always add new entries at the end
  89. * - define corresponding string in BFAL
  90. * - Do not remove any entry or rearrange the order.
  91. */
  92. enum bfa_plog_eid {
  93. BFA_PL_EID_INVALID = 0,
  94. BFA_PL_EID_IOC_DISABLE = 1,
  95. BFA_PL_EID_IOC_ENABLE = 2,
  96. BFA_PL_EID_PORT_DISABLE = 3,
  97. BFA_PL_EID_PORT_ENABLE = 4,
  98. BFA_PL_EID_PORT_ST_CHANGE = 5,
  99. BFA_PL_EID_TX = 6,
  100. BFA_PL_EID_TX_ACK1 = 7,
  101. BFA_PL_EID_TX_RJT = 8,
  102. BFA_PL_EID_TX_BSY = 9,
  103. BFA_PL_EID_RX = 10,
  104. BFA_PL_EID_RX_ACK1 = 11,
  105. BFA_PL_EID_RX_RJT = 12,
  106. BFA_PL_EID_RX_BSY = 13,
  107. BFA_PL_EID_CT_IN = 14,
  108. BFA_PL_EID_CT_OUT = 15,
  109. BFA_PL_EID_DRIVER_START = 16,
  110. BFA_PL_EID_RSCN = 17,
  111. BFA_PL_EID_DEBUG = 18,
  112. BFA_PL_EID_MISC = 19,
  113. BFA_PL_EID_FIP_FCF_DISC = 20,
  114. BFA_PL_EID_FIP_FCF_CVL = 21,
  115. BFA_PL_EID_LOGIN = 22,
  116. BFA_PL_EID_LOGO = 23,
  117. BFA_PL_EID_MAX = 24
  118. };
  119. #define BFA_PL_ENAME_STRLEN 8
  120. struct bfa_plog_eid_strings_s {
  121. char e_str[BFA_PL_ENAME_STRLEN];
  122. };
  123. #define BFA_PL_SIG_LEN 8
  124. #define BFA_PL_SIG_STR "12pl123"
  125. /*
  126. * per port circular log buffer
  127. */
  128. struct bfa_plog_s {
  129. char plog_sig[BFA_PL_SIG_LEN]; /* Start signature */
  130. u8 plog_enabled;
  131. u8 rsvd[7];
  132. u32 ticks;
  133. u16 head;
  134. u16 tail;
  135. struct bfa_plog_rec_s plog_recs[BFA_PL_NLOG_ENTS];
  136. };
  137. void bfa_plog_init(struct bfa_plog_s *plog);
  138. void bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  139. enum bfa_plog_eid event, u16 misc, char *log_str);
  140. void bfa_plog_intarr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  141. enum bfa_plog_eid event, u16 misc,
  142. u32 *intarr, u32 num_ints);
  143. void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  144. enum bfa_plog_eid event, u16 misc,
  145. struct fchs_s *fchdr);
  146. void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
  147. enum bfa_plog_eid event, u16 misc,
  148. struct fchs_s *fchdr, u32 pld_w0);
  149. void bfa_plog_clear(struct bfa_plog_s *plog);
  150. void bfa_plog_enable(struct bfa_plog_s *plog);
  151. void bfa_plog_disable(struct bfa_plog_s *plog);
  152. bfa_boolean_t bfa_plog_get_setting(struct bfa_plog_s *plog);
  153. #endif /* __BFA_PORTLOG_H__ */