Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bfa_plog.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005-2010 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 "bfa_fc.h"
21 #include "bfa_defs.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 
33 };
34 
35 /*
36  * the (fixed size) record format for each entry in the portlog
37  */
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 */
45  /*
46  * interpreted only if log_type is INT_LOG. indicates number of
47  * integers in the int_log[] (0-PL_INT_LOG_SZ).
48  */
50  u16 misc; /* can be used to indicate fc frame length */
51  union {
54  } log_entry;
55 
56 };
57 
58 /*
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
61  *
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.
66  */
77 };
78 
79 #define BFA_PL_MID_STRLEN 8
82 };
83 
84 /*
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
87  *
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.
92  */
120 };
121 
122 #define BFA_PL_ENAME_STRLEN 8
125 };
126 
127 #define BFA_PL_SIG_LEN 8
128 #define BFA_PL_SIG_STR "12pl123"
129 
130 /*
131  * per port circular log buffer
132  */
133 struct bfa_plog_s {
134  char plog_sig[BFA_PL_SIG_LEN]; /* Start signature */
136  u8 rsvd[7];
141 };
142 
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);
154 
155 #endif /* __BFA_PORTLOG_H__ */