2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 #ifndef FMANDEBUGLOG_H
24 #define FMANDEBUGLOG_H
33 class FManModuleDebugLog
;
35 // Frame Manager Debug Log collects the context data from
36 // a related series of Nexus FMAN ICT messages before parsing
37 // the context data into the internal FMan module specific logs.
44 fmanID_(0), context_complete_(false),
45 log_parse_error_(LOG_PARSE_NO_ERROR
),
55 // Reset the log to the initial state.
58 // Add context data to the log.
59 bool addContextData(uint32_t context_data
);
61 // Set last context data to close the log.
62 void setLastContextData()
64 context_complete_
= true;
67 // Evaluate of the context data and return true
68 // if the log contains valid data.
69 bool parseContextData();
71 // Output log as a string.
72 string
asString() const;
75 void setFManID(uint32_t fmanID
)
80 // Return true if the log contains valid data.
81 bool logComplete() const
88 // Constants to access NIA data fields
89 static const uint32_t NIA_SIZE_MASK
= 0x3f;
90 static const uint32_t NIA_SIZE_SHIFT
= 24;
91 static const uint32_t NIA_ENG_MASK
= 0x1f;
92 static const uint32_t NIA_ENG_SHIFT
= 18;
99 vector
<uint32_t> context_data_
;
101 // context data complete
102 bool context_complete_
;
104 // maintain a list of module logs
105 vector
<FManModuleDebugLog
*> logs_
;
108 enum log_parse_error
{
109 LOG_PARSE_NO_ERROR
= 0,
110 LOG_PARSE_DATA_LENGTH_ERROR
,
111 LOG_PARSE_UNDEFINED_ENG_ERROR
118 // Base class for all module specific log types
119 class FManModuleDebugLog
123 FManModuleDebugLog() :
124 verbosity_level_(0), order_restoration_required_(false),
125 action_code_(0), has_timestamp_(false), timestamp_(0)
128 virtual ~FManModuleDebugLog()
132 // parse the context data
133 bool parseContextData(vector
<uint32_t> &context_data
);
135 // output derived log name as string
136 virtual string
nameAsString() const = 0;
138 // output logs as a string
139 string
asString() const;
143 // constants to access context data fields
144 static const uint32_t NIA_VL_MASK
= 0x3;
145 static const uint32_t NIA_VL_SHIFT
= 30;
146 static const uint32_t NIA_ORR_MASK
= 0x1;
147 static const uint32_t NIA_ORR_SHIFT
= 23;
148 static const uint32_t NIA_AC_MASK
= 0x3ffff;
149 static const uint32_t NIA_AC_SHIFT
= 0;
151 // generic model Verbosity Levels
154 FMAN_TRACE_DISABLED
= 0,
155 FMAN_TRACE_MINIMUM
= 1,
156 FMAN_TRACE_VERBOSE
= 2,
157 FMAN_TRACE_VERY_VERBOSE
= 3
161 virtual bool parseContextData_(vector
<uint32_t> &context_data
) = 0;
163 // output logs as a string
164 virtual string
asString_() const = 0;
166 // output a port ID string
167 string
portIDasString_( uint32_t port_id
) const;
170 uint32_t verbosity_level_
;
171 bool order_restoration_required_
;
174 uint32_t action_code_
;
183 class FManControllerDebugLog
: public FManModuleDebugLog
187 FManControllerDebugLog()
190 virtual ~FManControllerDebugLog()
194 // output log name as string
195 virtual string
nameAsString() const
197 return "FMan Controller";
204 CTRL_CLASSIF_CMD
= 0x6,
205 CTRL_INDEP_TX_CMD
= 0x8,
206 CTRL_INDEP_RX_CMD
= 0xa,
210 // parse the context data
211 virtual bool parseContextData_(vector
<uint32_t> &context_data
);
213 // output log as a string
214 virtual string
asString_() const;
220 class FManParserDebugLog
: public FManModuleDebugLog
223 FManParserDebugLog() :
224 hxs_id_(0), parse_start_point_(0)
226 for (uint32_t i
= 0; i
< MAX_NUM_PROG_CTRS
; i
++) {
227 program_counter_
[i
] = 0;
230 virtual ~FManParserDebugLog()
234 // output log name as string
235 virtual string
nameAsString() const
237 return "FMan Parser Engine";
242 static const uint32_t MAX_NUM_PROG_CTRS
= 16;
244 static const uint32_t NIA_AC_HXS_ID_MASK
= 0x3ff;
245 static const uint32_t NIA_AC_HXS_ID_SHIFT
= 0;
249 PARSER_ETH_CMD
= 0x00,
250 PARSER_LLC_SNAP_CMD
= 0x01,
251 PARSER_VLAN_CMD
= 0x02,
252 PARSER_PPP_CMD
= 0x03,
253 PARSER_MPLS_CMD
= 0x04,
254 PARSER_IPV4_CMD
= 0x05,
255 PARSER_IPV6_CMD
= 0x06,
256 PARSER_GRE_CMD
= 0x07,
257 PARSER_MINENCAP_CMD
= 0x08,
258 PARSER_OTHER_L3_CMD
= 0x09,
259 PARSER_TCP_CMD
= 0x0a,
260 PARSER_UDP_CMD
= 0x0b,
261 PARSER_IPSEC_CMD
= 0x0c,
262 PARSER_SCTP_CMD
= 0x0d,
263 PARSER_DCCP_CMD
= 0x0e,
264 PARSER_OTHER_L4_CMD
= 0x0f,
265 PARSER_NULL_CMD
= 0x3ff
267 // parse the context data
268 virtual bool parseContextData_(vector
<uint32_t> &context_data
);
270 // output log as a string
271 virtual string
asString_() const;
276 uint32_t parse_start_point_
;
277 uint32_t program_counter_
[MAX_NUM_PROG_CTRS
];
280 class FManKeyGenDebugLog
: public FManModuleDebugLog
284 FManKeyGenDebugLog() :
285 ccen_(0), ss_(0), scheme_(0),
286 selected_scheme_(0), int_frame_ptr_(0)
289 virtual ~FManKeyGenDebugLog()
295 static const uint32_t NIA_AC_CCEN_MASK
= 0x1;
296 static const uint32_t NIA_AC_CCEN_SHIFT
= 9;
297 static const uint32_t NIA_AC_SS_MASK
= 0x1;
298 static const uint32_t NIA_AC_SS_SHIFT
= 8;
299 static const uint32_t NIA_AC_SCHEME_MASK
= 0x1f;
300 static const uint32_t NIA_AC_SCHEME_SHIFT
= 0;
302 static const uint32_t FMKG_SS_MASK
= 0xff;
303 static const uint32_t FMKG_SS_SHIFT
= 24;
304 static const uint32_t FMKG_IFP_MASK
= 0xff;
305 static const uint32_t FMKG_IFP_SHIFT
= 16;
307 // parse the context data
308 virtual bool parseContextData_(vector
<uint32_t> &context_data
);
310 // output log as a string
311 virtual string
asString_() const;
313 // output log name as string
314 virtual string
nameAsString() const
316 return "FMan Key Generator Engine";
325 uint32_t selected_scheme_
;
326 uint32_t int_frame_ptr_
;
330 class FManPolicerDebugLog
: public FManModuleDebugLog
334 FManPolicerDebugLog() :
361 virtual ~FManPolicerDebugLog()
367 static const uint32_t NIA_AC_PMO_MASK
= 0x1;
368 static const uint32_t NIA_AC_PMO_SHIFT
= 15;
369 static const uint32_t NIA_AC_PNUM_MASK
= 0xff;
370 static const uint32_t NIA_AC_PNUM_SHIFT
= 0;
373 static const uint32_t POLICE_FCS_MASK
= 0x3;
374 static const uint32_t POLICE_FCS_SHIFT
= 30;
375 static const uint32_t POLICE_PORTID_MASK
= 0x3f;
376 static const uint32_t POLICE_PORTID_SHIFT
= 24;
377 static const uint32_t POLICE_FLM_MASK
= 0x1;
378 static const uint32_t POLICE_FLM_SHIFT
= 23;
379 static const uint32_t POLICE_FATM_MASK
= 0x1;
380 static const uint32_t POLICE_FATM_SHIFT
= 22;
381 static const uint32_t POLICE_FBTM_MASK
= 0x1;
382 static const uint32_t POLICE_FBTM_SHIFT
= 21;
383 static const uint32_t POLICE_FCTM_MASK
= 0x1;
384 static const uint32_t POLICE_FCTM_SHIFT
= 20;
385 static const uint32_t POLICE_PNUM_MASK
= 0xff;
386 static const uint32_t POLICE_PNUM_SHIFT
= 8;
387 static const uint32_t POLICE_PPC_MASK
= 0x3;
388 static const uint32_t POLICE_PPC_SHIFT
= 6;
389 static const uint32_t POLICE_PC_MASK
= 0x3;
390 static const uint32_t POLICE_PC_SHIFT
= 4;
391 static const uint32_t POLICE_PKTLEN_MSB_MASK
= 0xf;
392 static const uint32_t POLICE_PKTLEN_MSB_SHIFT
= 0;
395 static const uint32_t POLICE_PKTLEN_LSB_MASK
= 0xffff;
396 static const uint32_t POLICE_PKTLEN_LSB_SHIFT
= 16;
397 static const uint32_t POLICE_PROF_INI_MASK
= 0x1;
398 static const uint32_t POLICE_PROF_INI_SHIFT
= 15;
399 static const uint32_t POLICE_CBLND_MASK
= 0x1;
400 static const uint32_t POLICE_CBLND_SHIFT
= 14;
401 static const uint32_t POLICE_ALG_MASK
= 0x3;
402 static const uint32_t POLICE_ALG_SHIFT
= 12;
403 static const uint32_t POLICE_FLS_MASK
= 0xf;
404 static const uint32_t POLICE_FLS_SHIFT
= 8;
405 static const uint32_t POLICE_PKT_MASK
= 0x1;
406 static const uint32_t POLICE_PKT_SHIFT
= 7;
407 static const uint32_t POLICE_RBFLS_MASK
= 0x1;
408 static const uint32_t POLICE_RBFLS_SHIFT
= 6;
409 static const uint32_t POLICE_FLSRES_MASK
= 0x1;
410 static const uint32_t POLICE_FLSRES_SHIFT
= 5;
411 static const uint32_t POLICE_FPP_MASK
= 0xf;
412 static const uint32_t POLICE_FPP_SHIFT
= 0;
414 // parse the context data
415 virtual bool parseContextData_(vector
<uint32_t> &context_data
);
417 // output log as a string
418 virtual string
asString_() const;
420 // output log name as string
421 virtual string
nameAsString() const
423 return "FMan Policer Engine";
436 // Debug flags and PNUM
454 // derived from multiple fields
455 uint32_t pkt_length_
;
457 // very verbose profile info
458 uint32_t profile_cbs_
;
459 uint32_t profile_cts_
;
460 uint32_t profile_pbs_ebs_
;
461 uint32_t profile_ets_
;
464 class FManBMIDebugLog
: public FManModuleDebugLog
477 virtual ~FManBMIDebugLog()
481 // output log name as string
482 virtual string
nameAsString() const
484 return "FMan Buffer Manager Interface (BMI)";
492 BMI_REL_INT_BUF_TNUM_TERM_CMD
= 0x0C0,
493 BMI_REL_INT_IC_BUF_TNUM_TERM_CMD
= 0x2C0,
494 BMI_TX_FR_REL_BUF_OR_ENQ_CMD
= 0x274,
495 BMI_TX_FR_NO_DMA_CMD
= 0x010,
496 BMI_TX_FR_NO_DMA_REL_INT_BUF_CMD
= 0x050,
497 BMI_TX_FR_NO_DMA_REL_INT_BUF_TERM_CMD
= 0x0D0,
498 BMI_ENQ_FR_CMD
= 0x002,
499 BMI_DISC_FR_TERM_CMD
= 0x0C1,
500 BMI_FETCH_FR_EXE_CMD
= 0x20C,
501 BMI_FETCH_FR_HDR_EXE_CMD
= 0x208
504 // parse the context data
505 virtual bool parseContextData_(vector
<uint32_t> &context_data
);
507 // output log as a string
508 virtual string
asString_() const;
513 uint32_t debug_trap_state_
;
517 // Base QMI class for the QMI Enqueue/Dequeue subclasses
518 class FManQMIDebugLog
: public FManModuleDebugLog
538 virtual ~FManQMIDebugLog()
544 static const uint32_t QMI_CFG_PORTPRI_MASK
= 0x1;
545 static const uint32_t QMI_CFG_PORTPRI_SHIFT
= 31;
546 static const uint32_t QMI_CFG_DEQOPT_MASK
= 0x7;
547 static const uint32_t QMI_CFG_DEQOPT_SHIFT
= 28;
548 static const uint32_t QMI_CFG_PORTEN_MASK
= 0x1;
549 static const uint32_t QMI_CFG_PORTEN_SHIFT
= 27;
550 static const uint32_t QMI_CFG_PREFOPT_MASK
= 0x1;
551 static const uint32_t QMI_CFG_PREFOPT_SHIFT
= 25;
552 static const uint32_t QMI_CFG_FRMCNT_MASK
= 0x1;
553 static const uint32_t QMI_CFG_FRMCNT_SHIFT
= 24;
554 static const uint32_t QMI_CFG_SUBPORT_MASK
= 0xf;
555 static const uint32_t QMI_CFG_SUBPORT_SHIFT
= 20;
556 static const uint32_t QMI_CFG_BYTECNT_MASK
= 0xffff;
557 static const uint32_t QMI_CFG_BYTECNT_SHIFT
= 0;
559 static const uint32_t QMI_RES_SP_MASK
= 0xf;
560 static const uint32_t QMI_RES_SP_SHIFT
= 28;
561 static const uint32_t QMI_RES_FQIDSRC_MASK
= 0x3;
562 static const uint32_t QMI_RES_FQIDSRC_SHIFT
= 26;
563 static const uint32_t QMI_RES_BYTECNT_MASK
= 0xffff;
564 static const uint32_t QMI_RES_BYTECNT_SHIFT
= 10;
565 static const uint32_t QMI_RES_FRMCNT_MASK
= 0x3;
566 static const uint32_t QMI_RES_FRMCNT_SHIFT
= 8;
567 static const uint32_t QMI_RES_TAG_MASK
= 0xff;
568 static const uint32_t QMI_RES_TAG_SHIFT
= 0;
570 // parse the context data
571 virtual bool parseContextData_(vector
<uint32_t> &context_data
);
573 // output log as a string
574 virtual string
asString_() const;
578 uint8_t cfg_port_pri_
;
579 uint8_t cfg_deq_opt_
;
580 uint8_t cfg_port_en_
;
581 uint8_t cfg_pref_opt_
;
582 uint8_t cfg_frm_cnt_
;
583 uint8_t cfg_sub_port_
;
584 uint32_t cfg_byte_cnt_
;
589 uint8_t res_fqid_src_
;
590 uint32_t res_byte_cnt_
;
591 uint8_t res_frm_cnt_
;
595 class FManQMIEnqueueDebugLog
: public FManQMIDebugLog
599 FManQMIEnqueueDebugLog()
602 virtual ~FManQMIEnqueueDebugLog()
606 // output log name as string
607 virtual string
nameAsString() const
609 return "FMan Enqueue Queue Manager Interface (QMI)";
613 class FManQMIDequeueDebugLog
: public FManQMIDebugLog
617 FManQMIDequeueDebugLog()
620 virtual ~FManQMIDequeueDebugLog()
624 // output log name as string
625 virtual string
nameAsString() const
627 return "FMan Enqueue Queue Manager Interface (QMI)";
631 #endif // FMANDEBUGLOG_H