1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: Radisys Logging Framework
23 Desc: This file contains logging framework include file for library.
26 *********************************************************************21*/
27 /****************************************************************************
28 @ description: This is header file is used by logging framework module. This
29 file should not be included by any other application. This is internal
30 header file logging framework.
31 *****************************************************************************/
39 #include <sys/types.h>
43 #include "rl_common.h"
45 #define MAX_FILE_SIZE 3145728 /* 3MB */
46 #define MAX_LOG_LEN 256
47 #define MAX_FILENAME_LEN 300
48 #define LOG_TIME_LEN 64
49 #define MAX_LOG_BUF_SIZE 5000
50 #define RLOG_MAX_CIRBUF_SIZE (1024*100)
51 #define RLOG_REMOTE_LOGGING_PORT 9099
52 #define RLOG_MAX_FILES 5
53 #define RLOG_MAX_TIME_STAMP 80
54 #define RLOG_MAX_TAX_NAME 16
55 #define RLOG_FIFO_FILE "/tmp/l2logs"
56 #define RLOG_CIRBUF_READ_INTERVAL 1 /* 60 seconds read interval */
57 #define RLOG_MAX_THREADS 16
58 #define RLOG_TIME_ZONE_LEN 8
59 #define RLOG_MAX_STACK_DEPTH 24
60 #define RLOG_MAX_BACKTRACE_BUFSZ 2048
61 #define RLOG_READ_POS_THRESHOLD 300
62 #define RLOG_FIXED_LENGTH_BUFFER_SIZE 50
63 #define RLOGTICKSCNTTOPRCL2LOGS 10
65 /* Console handling */
66 #define RLOG_CTRL_L 12
67 #define RLOG_CTRL_Y 25
68 #define RLOG_ENTER_KEY 10
69 #define RLOG_SET_LOGLEVEL 1
70 #define RLOG_SET_MODMASK 2
73 #define PROCESS_L2LOG_TTI 10
82 typedef enum rlLogCntLmt
84 RL_LOG_COUNT_LIMIT_START = 1,
85 RL_LOG_COUNT_LIMIT_STOP
88 #ifndef RLOG_ENABLE_TEXT_LOGGING
102 } __attribute__ ((__packed__)) LOGTIME;
106 LOGID logId; /* 4 bytes | 32 bits */
107 LOGTIME logTime; /* 8 bytes */
108 unsigned int argType :2;
109 unsigned int logLevel :3;
110 unsigned int numOfArgs :3;
112 } __attribute__ ((__packed__)) LOGDATA;
117 char buf[MAX_LOG_BUF_SIZE];
118 } __attribute__ ((__packed__)) ARGDATA;
127 char unusedByte[19]; /* To make it as 50 byte */
128 } __attribute__ ((__packed__)) ARG4DATA;
139 char unusedByte[14]; /* To make it as 50 byte */
140 } __attribute__ ((__packed__)) SPL_ARGDATA;
142 typedef enum _endian {little_endian, big_endian} EndianType;
149 char szTimeZone[RLOG_TIME_ZONE_LEN+1];
152 } __attribute__ ((__packed__)) FILE_HEADER;
154 #endif /* RLOG_ENABLE_TEXT_LOGGING */
158 char szTaskName[RLOG_MAX_TAX_NAME];
159 U8* logBuff; /* LOG Buffer */
160 U32 logBufLen; /* Data Written till now */
161 U32 logReadPos; /* Reader thread position */
162 U8 listIndex; /* Index to global list */
166 extern void readL2LogBuff(void);
167 extern void processL2LogBuff(void);
168 extern S16 sendL2LogBuftoL3(void);
169 extern void rlInitL2Log(void);
170 /* Extern for soc specific file */
171 extern void rlProcessLogBufFromL2(void *mBuf);
172 extern void rlInitL2SocSpecific(void);
173 //extern void processL2LogBuff(void);
174 extern void rlProcessTicks(void);
175 extern void rlGetL2LogBufPtr (void *mBuf, U32 *logLen,U8 **logPtr);
176 extern void rlInvalidateL2LogsInCache(U8 *ptr,U32 len);
178 extern U8 *g_l2rlogBuf; /* buffer pointer for shared memory allocation */
179 extern U8 *g_l2LogBufStartPtr; /* buffer pointer where logs has to be written */
180 extern U8 *g_l2LogBufBasePtr; /* Base pointer for log buffer */
181 extern U8 *g_logBufRcvdFromL2; /* Buffer pointer received from L2 at L3*/
182 extern U8 *g_l2LogBaseBuff; /* Base log buffer received at L3 */
183 extern U32 g_l2LogBufLen; /* Log Buffer length written at L2 */
184 extern U32 startL2Logging; /* flag to start processing of L2 logs */
185 extern U32 g_l2logBuffPos; /* Log Buffer block which is in use for L2 logging */
186 extern U8 g_writeCirBuf; /* Flag to indicate whether to write logs or not */
187 //extern Pst g_rlog_pst;