Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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
20#include "protocol/fc.h"
21#include <defs/bfa_defs_types.h>
22
23#define BFA_PL_NLOG_ENTS 256
24#define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
25
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 */
28
29enum 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,
33};
34
35/*
36 * the (fixed size) record format for each entry in the portlog
37 */
38struct bfa_plog_rec_s {
39 u32 tv; /* Filled by the portlog driver when the *
40 * entry is added to the circular log. */
41 u8 port; /* Source port that logged this entry. CM
42 * entities will use 0xFF */
43 u8 mid; /* Integer value to be used by all entities *
44 * while logging. The module id to string *
45 * conversion will be done by BFAL. See
46 * enum bfa_plog_mid */
47 u8 eid; /* indicates Rx, Tx, IOCTL, etc. See
48 * enum bfa_plog_eid */
49 u8 log_type; /* indicates string log or integer log.
50 * see bfa_plog_log_type_t */
51 u8 log_num_ints;
52 /*
53 * interpreted only if log_type is INT_LOG. indicates number of
54 * integers in the int_log[] (0-PL_INT_LOG_SZ).
55 */
56 u8 rsvd;
57 u16 misc; /* can be used to indicate fc frame length,
58 *etc.. */
59 union {
60 char string_log[BFA_PL_STRING_LOG_SZ];
61 u32 int_log[BFA_PL_INT_LOG_SZ];
62 } log_entry;
63
64};
65
66/*
67 * the following #defines will be used by the logging entities to indicate
68 * their module id. BFAL will convert the integer value to string format
69 *
70* process to be used while changing the following #defines:
71 * - Always add new entries at the end
72 * - define corresponding string in BFAL
73 * - Do not remove any entry or rearrange the order.
74 */
75enum bfa_plog_mid {
76 BFA_PL_MID_INVALID = 0,
77 BFA_PL_MID_DEBUG = 1,
78 BFA_PL_MID_DRVR = 2,
79 BFA_PL_MID_HAL = 3,
80 BFA_PL_MID_HAL_FCXP = 4,
81 BFA_PL_MID_HAL_UF = 5,
82 BFA_PL_MID_FCS = 6,
83 BFA_PL_MID_LPS = 7,
84 BFA_PL_MID_MAX = 8
85};
86
87#define BFA_PL_MID_STRLEN 8
88struct bfa_plog_mid_strings_s {
89 char m_str[BFA_PL_MID_STRLEN];
90};
91
92/*
93 * the following #defines will be used by the logging entities to indicate
94 * their event type. BFAL will convert the integer value to string format
95 *
96* process to be used while changing the following #defines:
97 * - Always add new entries at the end
98 * - define corresponding string in BFAL
99 * - Do not remove any entry or rearrange the order.
100 */
101enum bfa_plog_eid {
102 BFA_PL_EID_INVALID = 0,
103 BFA_PL_EID_IOC_DISABLE = 1,
104 BFA_PL_EID_IOC_ENABLE = 2,
105 BFA_PL_EID_PORT_DISABLE = 3,
106 BFA_PL_EID_PORT_ENABLE = 4,
107 BFA_PL_EID_PORT_ST_CHANGE = 5,
108 BFA_PL_EID_TX = 6,
109 BFA_PL_EID_TX_ACK1 = 7,
110 BFA_PL_EID_TX_RJT = 8,
111 BFA_PL_EID_TX_BSY = 9,
112 BFA_PL_EID_RX = 10,
113 BFA_PL_EID_RX_ACK1 = 11,
114 BFA_PL_EID_RX_RJT = 12,
115 BFA_PL_EID_RX_BSY = 13,
116 BFA_PL_EID_CT_IN = 14,
117 BFA_PL_EID_CT_OUT = 15,
118 BFA_PL_EID_DRIVER_START = 16,
119 BFA_PL_EID_RSCN = 17,
120 BFA_PL_EID_DEBUG = 18,
121 BFA_PL_EID_MISC = 19,
122 BFA_PL_EID_FIP_FCF_DISC = 20,
123 BFA_PL_EID_FIP_FCF_CVL = 21,
124 BFA_PL_EID_LOGIN = 22,
125 BFA_PL_EID_LOGO = 23,
126 BFA_PL_EID_MAX = 24
127};
128
129#define BFA_PL_ENAME_STRLEN 8
130struct bfa_plog_eid_strings_s {
131 char e_str[BFA_PL_ENAME_STRLEN];
132};
133
134#define BFA_PL_SIG_LEN 8
135#define BFA_PL_SIG_STR "12pl123"
136
137/*
138 * per port circular log buffer
139 */
140struct bfa_plog_s {
141 char plog_sig[BFA_PL_SIG_LEN]; /* Start signature */
142 u8 plog_enabled;
143 u8 rsvd[7];
144 u32 ticks;
145 u16 head;
146 u16 tail;
147 struct bfa_plog_rec_s plog_recs[BFA_PL_NLOG_ENTS];
148};
149
150void bfa_plog_init(struct bfa_plog_s *plog);
151void bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
152 enum bfa_plog_eid event, u16 misc, char *log_str);
153void bfa_plog_intarr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
154 enum bfa_plog_eid event, u16 misc,
155 u32 *intarr, u32 num_ints);
156void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
157 enum bfa_plog_eid event, u16 misc,
158 struct fchs_s *fchdr);
159void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
160 enum bfa_plog_eid event, u16 misc,
161 struct fchs_s *fchdr, u32 pld_w0);
162void bfa_plog_clear(struct bfa_plog_s *plog);
163void bfa_plog_enable(struct bfa_plog_s *plog);
164void bfa_plog_disable(struct bfa_plog_s *plog);
165bfa_boolean_t bfa_plog_get_setting(struct bfa_plog_s *plog);
166
167#endif /* __BFA_PORTLOG_H__ */