2 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
3 * Copyright (c) 2014- QLogic Corporation.
7 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License (GPL) Version 2 as
11 * published by the Free Software Foundation
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 #ifndef __BFA_PORTLOG_H__
19 #define __BFA_PORTLOG_H__
24 #define BFA_PL_NLOG_ENTS 256
25 #define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
27 #define BFA_PL_STRING_LOG_SZ 32 /* number of chars in string log */
28 #define BFA_PL_INT_LOG_SZ 8 /* number of integers in the integer log */
30 enum bfa_plog_log_type
{
31 BFA_PL_LOG_TYPE_INVALID
= 0,
32 BFA_PL_LOG_TYPE_INT
= 1,
33 BFA_PL_LOG_TYPE_STRING
= 2,
37 * the (fixed size) record format for each entry in the portlog
39 struct bfa_plog_rec_s
{
40 u64 tv
; /* timestamp */
41 u8 port
; /* Source port that logged this entry */
42 u8 mid
; /* module id */
43 u8 eid
; /* indicates Rx, Tx, IOCTL, etc. bfa_plog_eid */
44 u8 log_type
; /* string/integer log, bfa_plog_log_type_t */
47 * interpreted only if log_type is INT_LOG. indicates number of
48 * integers in the int_log[] (0-PL_INT_LOG_SZ).
51 u16 misc
; /* can be used to indicate fc frame length */
53 char string_log
[BFA_PL_STRING_LOG_SZ
];
54 u32 int_log
[BFA_PL_INT_LOG_SZ
];
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
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.
69 BFA_PL_MID_INVALID
= 0,
73 BFA_PL_MID_HAL_FCXP
= 4,
74 BFA_PL_MID_HAL_UF
= 5,
80 #define BFA_PL_MID_STRLEN 8
81 struct bfa_plog_mid_strings_s
{
82 char m_str
[BFA_PL_MID_STRLEN
];
86 * the following #defines will be used by the logging entities to indicate
87 * their event type. BFAL will convert the integer value to string format
89 * process to be used while changing the following #defines:
90 * - Always add new entries at the end
91 * - define corresponding string in BFAL
92 * - Do not remove any entry or rearrange the order.
95 BFA_PL_EID_INVALID
= 0,
96 BFA_PL_EID_IOC_DISABLE
= 1,
97 BFA_PL_EID_IOC_ENABLE
= 2,
98 BFA_PL_EID_PORT_DISABLE
= 3,
99 BFA_PL_EID_PORT_ENABLE
= 4,
100 BFA_PL_EID_PORT_ST_CHANGE
= 5,
102 BFA_PL_EID_TX_ACK1
= 7,
103 BFA_PL_EID_TX_RJT
= 8,
104 BFA_PL_EID_TX_BSY
= 9,
106 BFA_PL_EID_RX_ACK1
= 11,
107 BFA_PL_EID_RX_RJT
= 12,
108 BFA_PL_EID_RX_BSY
= 13,
109 BFA_PL_EID_CT_IN
= 14,
110 BFA_PL_EID_CT_OUT
= 15,
111 BFA_PL_EID_DRIVER_START
= 16,
112 BFA_PL_EID_RSCN
= 17,
113 BFA_PL_EID_DEBUG
= 18,
114 BFA_PL_EID_MISC
= 19,
115 BFA_PL_EID_FIP_FCF_DISC
= 20,
116 BFA_PL_EID_FIP_FCF_CVL
= 21,
117 BFA_PL_EID_LOGIN
= 22,
118 BFA_PL_EID_LOGO
= 23,
119 BFA_PL_EID_TRUNK_SCN
= 24,
123 #define BFA_PL_ENAME_STRLEN 8
124 struct bfa_plog_eid_strings_s
{
125 char e_str
[BFA_PL_ENAME_STRLEN
];
128 #define BFA_PL_SIG_LEN 8
129 #define BFA_PL_SIG_STR "12pl123"
132 * per port circular log buffer
135 char plog_sig
[BFA_PL_SIG_LEN
]; /* Start signature */
141 struct bfa_plog_rec_s plog_recs
[BFA_PL_NLOG_ENTS
];
144 void bfa_plog_init(struct bfa_plog_s
*plog
);
145 void bfa_plog_str(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
146 enum bfa_plog_eid event
, u16 misc
, char *log_str
);
147 void bfa_plog_intarr(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
148 enum bfa_plog_eid event
, u16 misc
,
149 u32
*intarr
, u32 num_ints
);
150 void bfa_plog_fchdr(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
151 enum bfa_plog_eid event
, u16 misc
, struct fchs_s
*fchdr
);
152 void bfa_plog_fchdr_and_pl(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
153 enum bfa_plog_eid event
, u16 misc
,
154 struct fchs_s
*fchdr
, u32 pld_w0
);
156 #endif /* __BFA_PORTLOG_H__ */