PageRenderTime 28ms CodeModel.GetById 16ms app.highlight 9ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/scsi/bfa/bfa_plog.h

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C Header | 155 lines | 97 code | 14 blank | 44 comment | 0 complexity | e8ca40db3e287bb62ae8837021c99406 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  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
 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	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 */
 44	u8	 log_num_ints;
 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	 */
 49	u8	 rsvd;
 50	u16	misc;	/* can be used to indicate fc frame length */
 51	union {
 52		char	    string_log[BFA_PL_STRING_LOG_SZ];
 53		u32	int_log[BFA_PL_INT_LOG_SZ];
 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 */
 67enum bfa_plog_mid {
 68	BFA_PL_MID_INVALID	= 0,
 69	BFA_PL_MID_DEBUG	= 1,
 70	BFA_PL_MID_DRVR		= 2,
 71	BFA_PL_MID_HAL		= 3,
 72	BFA_PL_MID_HAL_FCXP	= 4,
 73	BFA_PL_MID_HAL_UF	= 5,
 74	BFA_PL_MID_FCS		= 6,
 75	BFA_PL_MID_LPS		= 7,
 76	BFA_PL_MID_MAX		= 8
 77};
 78
 79#define BFA_PL_MID_STRLEN    8
 80struct bfa_plog_mid_strings_s {
 81	char	    m_str[BFA_PL_MID_STRLEN];
 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 */
 93enum bfa_plog_eid {
 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,
100	BFA_PL_EID_TX			= 6,
101	BFA_PL_EID_TX_ACK1		= 7,
102	BFA_PL_EID_TX_RJT		= 8,
103	BFA_PL_EID_TX_BSY		= 9,
104	BFA_PL_EID_RX			= 10,
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,
119	BFA_PL_EID_MAX
120};
121
122#define BFA_PL_ENAME_STRLEN	8
123struct bfa_plog_eid_strings_s {
124	char	    e_str[BFA_PL_ENAME_STRLEN];
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 */
133struct bfa_plog_s {
134	char	    plog_sig[BFA_PL_SIG_LEN];	/* Start signature */
135	u8	 plog_enabled;
136	u8	 rsvd[7];
137	u32	ticks;
138	u16	head;
139	u16	tail;
140	struct bfa_plog_rec_s  plog_recs[BFA_PL_NLOG_ENTS];
141};
142
143void bfa_plog_init(struct bfa_plog_s *plog);
144void bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
145			enum bfa_plog_eid event, u16 misc, char *log_str);
146void 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);
149void 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);
151void 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__ */