2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
17 #ifndef __BFA_PORTLOG_H__
18 #define __BFA_PORTLOG_H__
23 #define BFA_PL_NLOG_ENTS 256
24 #define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
26 #define BFA_PL_STRING_LOG_SZ 32 /* number of chars in string log */
27 #define BFA_PL_INT_LOG_SZ 8 /* number of integers in the integer log */
29 enum bfa_plog_log_type {
30 BFA_PL_LOG_TYPE_INVALID = 0,
31 BFA_PL_LOG_TYPE_INT = 1,
32 BFA_PL_LOG_TYPE_STRING = 2,
36 * the (fixed size) record format for each entry in the portlog
38 struct bfa_plog_rec_s {
39 u64 tv; /* timestamp */
40 u8 port; /* Source port that logged this entry */
41 u8 mid; /* module id */
42 u8 eid; /* indicates Rx, Tx, IOCTL, etc. bfa_plog_eid */
43 u8 log_type; /* string/integer log, bfa_plog_log_type_t */
46 * interpreted only if log_type is INT_LOG. indicates number of
47 * integers in the int_log[] (0-PL_INT_LOG_SZ).
50 u16 misc; /* can be used to indicate fc frame length */
52 char string_log[BFA_PL_STRING_LOG_SZ];
53 u32 int_log[BFA_PL_INT_LOG_SZ];
59 * the following #defines will be used by the logging entities to indicate
60 * their module id. BFAL will convert the integer value to string format
62 * process to be used while changing the following #defines:
63 * - Always add new entries at the end
64 * - define corresponding string in BFAL
65 * - Do not remove any entry or rearrange the order.
68 BFA_PL_MID_INVALID = 0,
72 BFA_PL_MID_HAL_FCXP = 4,
73 BFA_PL_MID_HAL_UF = 5,
79 #define BFA_PL_MID_STRLEN 8
80 struct bfa_plog_mid_strings_s {
81 char m_str[BFA_PL_MID_STRLEN];
85 * the following #defines will be used by the logging entities to indicate
86 * their event type. BFAL will convert the integer value to string format
88 * process to be used while changing the following #defines:
89 * - Always add new entries at the end
90 * - define corresponding string in BFAL
91 * - Do not remove any entry or rearrange the order.
94 BFA_PL_EID_INVALID = 0,
95 BFA_PL_EID_IOC_DISABLE = 1,
96 BFA_PL_EID_IOC_ENABLE = 2,
97 BFA_PL_EID_PORT_DISABLE = 3,
98 BFA_PL_EID_PORT_ENABLE = 4,
99 BFA_PL_EID_PORT_ST_CHANGE = 5,
101 BFA_PL_EID_TX_ACK1 = 7,
102 BFA_PL_EID_TX_RJT = 8,
103 BFA_PL_EID_TX_BSY = 9,
105 BFA_PL_EID_RX_ACK1 = 11,
106 BFA_PL_EID_RX_RJT = 12,
107 BFA_PL_EID_RX_BSY = 13,
108 BFA_PL_EID_CT_IN = 14,
109 BFA_PL_EID_CT_OUT = 15,
110 BFA_PL_EID_DRIVER_START = 16,
111 BFA_PL_EID_RSCN = 17,
112 BFA_PL_EID_DEBUG = 18,
113 BFA_PL_EID_MISC = 19,
114 BFA_PL_EID_FIP_FCF_DISC = 20,
115 BFA_PL_EID_FIP_FCF_CVL = 21,
116 BFA_PL_EID_LOGIN = 22,
117 BFA_PL_EID_LOGO = 23,
118 BFA_PL_EID_TRUNK_SCN = 24,
122 #define BFA_PL_ENAME_STRLEN 8
123 struct bfa_plog_eid_strings_s {
124 char e_str[BFA_PL_ENAME_STRLEN];
127 #define BFA_PL_SIG_LEN 8
128 #define BFA_PL_SIG_STR "12pl123"
131 * per port circular log buffer
134 char plog_sig[BFA_PL_SIG_LEN]; /* Start signature */
140 struct bfa_plog_rec_s plog_recs[BFA_PL_NLOG_ENTS];
143 void bfa_plog_init(struct bfa_plog_s *plog);
144 void bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
145 enum bfa_plog_eid event, u16 misc, char *log_str);
146 void bfa_plog_intarr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
147 enum bfa_plog_eid event, u16 misc,
148 u32 *intarr, u32 num_ints);
149 void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
150 enum bfa_plog_eid event, u16 misc, struct fchs_s *fchdr);
151 void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
152 enum bfa_plog_eid event, u16 misc,
153 struct fchs_s *fchdr, u32 pld_w0);
155 #endif /* __BFA_PORTLOG_H__ */