^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2014- QLogic Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * All rights reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * www.qlogic.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __BFA_PORTLOG_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __BFA_PORTLOG_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "bfa_fc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "bfa_defs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define BFA_PL_NLOG_ENTS 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define BFA_PL_LOG_REC_INCR(_x) ((_x)++, (_x) %= BFA_PL_NLOG_ENTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define BFA_PL_STRING_LOG_SZ 32 /* number of chars in string log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define BFA_PL_INT_LOG_SZ 8 /* number of integers in the integer log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) enum bfa_plog_log_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) BFA_PL_LOG_TYPE_INVALID = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) BFA_PL_LOG_TYPE_INT = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) BFA_PL_LOG_TYPE_STRING = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * the (fixed size) record format for each entry in the portlog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct bfa_plog_rec_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u64 tv; /* timestamp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u8 port; /* Source port that logged this entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) u8 mid; /* module id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u8 eid; /* indicates Rx, Tx, IOCTL, etc. bfa_plog_eid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u8 log_type; /* string/integer log, bfa_plog_log_type_t */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u8 log_num_ints;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * interpreted only if log_type is INT_LOG. indicates number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * integers in the int_log[] (0-PL_INT_LOG_SZ).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 rsvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) u16 misc; /* can be used to indicate fc frame length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) char string_log[BFA_PL_STRING_LOG_SZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u32 int_log[BFA_PL_INT_LOG_SZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) } log_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * the following #defines will be used by the logging entities to indicate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * their module id. BFAL will convert the integer value to string format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * process to be used while changing the following #defines:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * - Always add new entries at the end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * - define corresponding string in BFAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * - Do not remove any entry or rearrange the order.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) enum bfa_plog_mid {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) BFA_PL_MID_INVALID = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) BFA_PL_MID_DEBUG = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) BFA_PL_MID_DRVR = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) BFA_PL_MID_HAL = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) BFA_PL_MID_HAL_FCXP = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) BFA_PL_MID_HAL_UF = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) BFA_PL_MID_FCS = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) BFA_PL_MID_LPS = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) BFA_PL_MID_MAX = 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define BFA_PL_MID_STRLEN 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct bfa_plog_mid_strings_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) char m_str[BFA_PL_MID_STRLEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * the following #defines will be used by the logging entities to indicate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * their event type. BFAL will convert the integer value to string format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * process to be used while changing the following #defines:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * - Always add new entries at the end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * - define corresponding string in BFAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * - Do not remove any entry or rearrange the order.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) enum bfa_plog_eid {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) BFA_PL_EID_INVALID = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) BFA_PL_EID_IOC_DISABLE = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) BFA_PL_EID_IOC_ENABLE = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) BFA_PL_EID_PORT_DISABLE = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) BFA_PL_EID_PORT_ENABLE = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) BFA_PL_EID_PORT_ST_CHANGE = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) BFA_PL_EID_TX = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) BFA_PL_EID_TX_ACK1 = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) BFA_PL_EID_TX_RJT = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) BFA_PL_EID_TX_BSY = 9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) BFA_PL_EID_RX = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) BFA_PL_EID_RX_ACK1 = 11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) BFA_PL_EID_RX_RJT = 12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) BFA_PL_EID_RX_BSY = 13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) BFA_PL_EID_CT_IN = 14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) BFA_PL_EID_CT_OUT = 15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) BFA_PL_EID_DRIVER_START = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) BFA_PL_EID_RSCN = 17,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) BFA_PL_EID_DEBUG = 18,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) BFA_PL_EID_MISC = 19,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) BFA_PL_EID_FIP_FCF_DISC = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) BFA_PL_EID_FIP_FCF_CVL = 21,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) BFA_PL_EID_LOGIN = 22,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) BFA_PL_EID_LOGO = 23,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) BFA_PL_EID_TRUNK_SCN = 24,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) BFA_PL_EID_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define BFA_PL_ENAME_STRLEN 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct bfa_plog_eid_strings_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) char e_str[BFA_PL_ENAME_STRLEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define BFA_PL_SIG_LEN 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define BFA_PL_SIG_STR "12pl123"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * per port circular log buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct bfa_plog_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) char plog_sig[BFA_PL_SIG_LEN]; /* Start signature */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) u8 plog_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) u8 rsvd[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) u32 ticks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) u16 head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) u16 tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) struct bfa_plog_rec_s plog_recs[BFA_PL_NLOG_ENTS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) void bfa_plog_init(struct bfa_plog_s *plog);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) void bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) enum bfa_plog_eid event, u16 misc, char *log_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) void bfa_plog_intarr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) enum bfa_plog_eid event, u16 misc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) u32 *intarr, u32 num_ints);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) enum bfa_plog_eid event, u16 misc, struct fchs_s *fchdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) enum bfa_plog_eid event, u16 misc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) struct fchs_s *fchdr, u32 pld_w0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #endif /* __BFA_PORTLOG_H__ */