1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
4 * Copyright (c) 2014- QLogic Corporation.
8 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
10 #ifndef __BFA_PORTLOG_H__
11 #define __BFA_PORTLOG_H__
16 #define BFA_PL_NLOG_ENTS 256
17 #define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
19 #define BFA_PL_STRING_LOG_SZ 32 /* number of chars in string log */
20 #define BFA_PL_INT_LOG_SZ 8 /* number of integers in the integer log */
22 enum bfa_plog_log_type
{
23 BFA_PL_LOG_TYPE_INVALID
= 0,
24 BFA_PL_LOG_TYPE_INT
= 1,
25 BFA_PL_LOG_TYPE_STRING
= 2,
29 * the (fixed size) record format for each entry in the portlog
31 struct bfa_plog_rec_s
{
32 u64 tv
; /* timestamp */
33 u8 port
; /* Source port that logged this entry */
34 u8 mid
; /* module id */
35 u8 eid
; /* indicates Rx, Tx, IOCTL, etc. bfa_plog_eid */
36 u8 log_type
; /* string/integer log, bfa_plog_log_type_t */
39 * interpreted only if log_type is INT_LOG. indicates number of
40 * integers in the int_log[] (0-PL_INT_LOG_SZ).
43 u16 misc
; /* can be used to indicate fc frame length */
45 char string_log
[BFA_PL_STRING_LOG_SZ
];
46 u32 int_log
[BFA_PL_INT_LOG_SZ
];
52 * the following #defines will be used by the logging entities to indicate
53 * their module id. BFAL will convert the integer value to string format
55 * process to be used while changing the following #defines:
56 * - Always add new entries at the end
57 * - define corresponding string in BFAL
58 * - Do not remove any entry or rearrange the order.
61 BFA_PL_MID_INVALID
= 0,
65 BFA_PL_MID_HAL_FCXP
= 4,
66 BFA_PL_MID_HAL_UF
= 5,
72 #define BFA_PL_MID_STRLEN 8
73 struct bfa_plog_mid_strings_s
{
74 char m_str
[BFA_PL_MID_STRLEN
];
78 * the following #defines will be used by the logging entities to indicate
79 * their event type. BFAL will convert the integer value to string format
81 * process to be used while changing the following #defines:
82 * - Always add new entries at the end
83 * - define corresponding string in BFAL
84 * - Do not remove any entry or rearrange the order.
87 BFA_PL_EID_INVALID
= 0,
88 BFA_PL_EID_IOC_DISABLE
= 1,
89 BFA_PL_EID_IOC_ENABLE
= 2,
90 BFA_PL_EID_PORT_DISABLE
= 3,
91 BFA_PL_EID_PORT_ENABLE
= 4,
92 BFA_PL_EID_PORT_ST_CHANGE
= 5,
94 BFA_PL_EID_TX_ACK1
= 7,
95 BFA_PL_EID_TX_RJT
= 8,
96 BFA_PL_EID_TX_BSY
= 9,
98 BFA_PL_EID_RX_ACK1
= 11,
99 BFA_PL_EID_RX_RJT
= 12,
100 BFA_PL_EID_RX_BSY
= 13,
101 BFA_PL_EID_CT_IN
= 14,
102 BFA_PL_EID_CT_OUT
= 15,
103 BFA_PL_EID_DRIVER_START
= 16,
104 BFA_PL_EID_RSCN
= 17,
105 BFA_PL_EID_DEBUG
= 18,
106 BFA_PL_EID_MISC
= 19,
107 BFA_PL_EID_FIP_FCF_DISC
= 20,
108 BFA_PL_EID_FIP_FCF_CVL
= 21,
109 BFA_PL_EID_LOGIN
= 22,
110 BFA_PL_EID_LOGO
= 23,
111 BFA_PL_EID_TRUNK_SCN
= 24,
115 #define BFA_PL_ENAME_STRLEN 8
116 struct bfa_plog_eid_strings_s
{
117 char e_str
[BFA_PL_ENAME_STRLEN
];
120 #define BFA_PL_SIG_LEN 8
121 #define BFA_PL_SIG_STR "12pl123"
124 * per port circular log buffer
127 char plog_sig
[BFA_PL_SIG_LEN
]; /* Start signature */
133 struct bfa_plog_rec_s plog_recs
[BFA_PL_NLOG_ENTS
];
136 void bfa_plog_init(struct bfa_plog_s
*plog
);
137 void bfa_plog_str(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
138 enum bfa_plog_eid event
, u16 misc
, char *log_str
);
139 void bfa_plog_intarr(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
140 enum bfa_plog_eid event
, u16 misc
,
141 u32
*intarr
, u32 num_ints
);
142 void bfa_plog_fchdr(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
143 enum bfa_plog_eid event
, u16 misc
, struct fchs_s
*fchdr
);
144 void bfa_plog_fchdr_and_pl(struct bfa_plog_s
*plog
, enum bfa_plog_mid mid
,
145 enum bfa_plog_eid event
, u16 misc
,
146 struct fchs_s
*fchdr
, u32 pld_w0
);
148 #endif /* __BFA_PORTLOG_H__ */