summaryrefslogtreecommitdiffstats
path: root/drivers/usb/cdns3/cdnsp-debug.h
blob: ad617b7455b9c3e26bb1dee98fccbb6ad0c11e2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Cadence CDNSP DRD Driver.
 *
 * Copyright (C) 2020 Cadence.
 *
 * Author: Pawel Laszczak <pawell@cadence.com>
 *
 */
#ifndef __LINUX_CDNSP_DEBUG
#define __LINUX_CDNSP_DEBUG

static inline const char *cdnsp_trb_comp_code_string(u8 status)
{
	switch (status) {
	case COMP_INVALID:
		return "Invalid";
	case COMP_SUCCESS:
		return "Success";
	case COMP_DATA_BUFFER_ERROR:
		return "Data Buffer Error";
	case COMP_BABBLE_DETECTED_ERROR:
		return "Babble Detected";
	case COMP_TRB_ERROR:
		return "TRB Error";
	case COMP_RESOURCE_ERROR:
		return "Resource Error";
	case COMP_NO_SLOTS_AVAILABLE_ERROR:
		return "No Slots Available Error";
	case COMP_INVALID_STREAM_TYPE_ERROR:
		return "Invalid Stream Type Error";
	case COMP_SLOT_NOT_ENABLED_ERROR:
		return "Slot Not Enabled Error";
	case COMP_ENDPOINT_NOT_ENABLED_ERROR:
		return "Endpoint Not Enabled Error";
	case COMP_SHORT_PACKET:
		return "Short Packet";
	case COMP_RING_UNDERRUN:
		return "Ring Underrun";
	case COMP_RING_OVERRUN:
		return "Ring Overrun";
	case COMP_VF_EVENT_RING_FULL_ERROR:
		return "VF Event Ring Full Error";
	case COMP_PARAMETER_ERROR:
		return "Parameter Error";
	case COMP_CONTEXT_STATE_ERROR:
		return "Context State Error";
	case COMP_EVENT_RING_FULL_ERROR:
		return "Event Ring Full Error";
	case COMP_INCOMPATIBLE_DEVICE_ERROR:
		return "Incompatible Device Error";
	case COMP_MISSED_SERVICE_ERROR:
		return "Missed Service Error";
	case COMP_COMMAND_RING_STOPPED:
		return "Command Ring Stopped";
	case COMP_COMMAND_ABORTED:
		return "Command Aborted";
	case COMP_STOPPED:
		return "Stopped";
	case COMP_STOPPED_LENGTH_INVALID:
		return "Stopped - Length Invalid";
	case COMP_STOPPED_SHORT_PACKET:
		return "Stopped - Short Packet";
	case COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR:
		return "Max Exit Latency Too Large Error";
	case COMP_ISOCH_BUFFER_OVERRUN:
		return "Isoch Buffer Overrun";
	case COMP_EVENT_LOST_ERROR:
		return "Event Lost Error";
	case COMP_UNDEFINED_ERROR:
		return "Undefined Error";
	case COMP_INVALID_STREAM_ID_ERROR:
		return "Invalid Stream ID Error";
	default:
		return "Unknown!!";
	}
}

static inline const char *cdnsp_trb_type_string(u8 type)
{
	switch (type) {
	case TRB_NORMAL:
		return "Normal";
	case TRB_SETUP:
		return "Setup Stage";
	case TRB_DATA:
		return "Data Stage";
	case TRB_STATUS:
		return "Status Stage";
	case TRB_ISOC:
		return "Isoch";
	case TRB_LINK:
		return "Link";
	case TRB_EVENT_DATA:
		return "Event Data";
	case TRB_TR_NOOP:
		return "No-Op";
	case TRB_ENABLE_SLOT:
		return "Enable Slot Command";
	case TRB_DISABLE_SLOT:
		return "Disable Slot Command";
	case TRB_ADDR_DEV:
		return "Address Device Command";
	case TRB_CONFIG_EP:
		return "Configure Endpoint Command";
	case TRB_EVAL_CONTEXT:
		return "Evaluate Context Command";
	case TRB_RESET_EP:
		return "Reset Endpoint Command";
	case TRB_STOP_RING:
		return "Stop Ring Command";
	case TRB_SET_DEQ:
		return "Set TR Dequeue Pointer Command";
	case TRB_RESET_DEV:
		return "Reset Device Command";
	case TRB_FORCE_HEADER:
		return "Force Header Command";
	case TRB_CMD_NOOP:
		return "No-Op Command";
	case TRB_TRANSFER:
		return "Transfer Event";
	case TRB_COMPLETION:
		return "Command Completion Event";
	case TRB_PORT_STATUS:
		return "Port Status Change Event";
	case TRB_HC_EVENT:
		return "Device Controller Event";
	case TRB_MFINDEX_WRAP:
		return "MFINDEX Wrap Event";
	case TRB_ENDPOINT_NRDY:
		return "Endpoint Not ready";
	case TRB_HALT_ENDPOINT:
		return "Halt Endpoint";
	default:
		return "UNKNOWN";
	}
}

static inline const char *cdnsp_ring_type_string(enum cdnsp_ring_type type)
{
	switch (type) {
	case TYPE_CTRL:
		return "CTRL";
	case TYPE_ISOC:
		return "ISOC";
	case TYPE_BULK:
		return "BULK";
	case TYPE_INTR:
		return "INTR";
	case TYPE_STREAM:
		return "STREAM";
	case TYPE_COMMAND:
		return "CMD";
	case TYPE_EVENT:
		return "EVENT";
	}

	return "UNKNOWN";
}

static inline char *cdnsp_slot_state_string(u32 state)
{
	switch (state) {
	case SLOT_STATE_ENABLED:
		return "enabled/disabled";
	case SLOT_STATE_DEFAULT:
		return "default";
	case SLOT_STATE_ADDRESSED:
		return "addressed";
	case SLOT_STATE_CONFIGURED:
		return "configured";
	default:
		return "reserved";
	}
}

static inline const char *cdnsp_decode_trb(char *str, size_t size, u32 field0,
					   u32 field1, u32 field2, u32 field3)
{
	int ep_id = TRB_TO_EP_INDEX(field3) - 1;
	int type = TRB_FIELD_TO_TYPE(field3);
	unsigned int ep_num;
	int ret;
	u32 temp;

	ep_num = DIV_ROUND_UP(ep_id, 2);

	switch (type) {
	case TRB_LINK:
		ret = snprintf(str, size,
			       "LINK %08x%08x intr %ld type '%s' flags %c:%c:%c:%c",
			       field1, field0, GET_INTR_TARGET(field2),
			       cdnsp_trb_type_string(type),
			       field3 & TRB_IOC ? 'I' : 'i',
			       field3 & TRB_CHAIN ? 'C' : 'c',
			       field3 & TRB_TC ? 'T' : 't',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_TRANSFER:
	case TRB_COMPLETION:
	case TRB_PORT_STATUS:
	case TRB_HC_EVENT:
		ret = snprintf(str, size,
			       "ep%d%s(%d) type '%s' TRB %08x%08x status '%s'"
			       " len %ld slot %ld flags %c:%c",
			       ep_num, ep_id % 2 ? "out" : "in",
			       TRB_TO_EP_INDEX(field3),
			       cdnsp_trb_type_string(type), field1, field0,
			       cdnsp_trb_comp_code_string(GET_COMP_CODE(field2)),
			       EVENT_TRB_LEN(field2), TRB_TO_SLOT_ID(field3),
			       field3 & EVENT_DATA ? 'E' : 'e',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_MFINDEX_WRAP:
		ret = snprintf(str, size, "%s: flags %c",
			       cdnsp_trb_type_string(type),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_SETUP:
		ret = snprintf(str, size,
			       "type '%s' bRequestType %02x bRequest %02x "
			       "wValue %02x%02x wIndex %02x%02x wLength %d "
			       "length %ld TD size %ld intr %ld Setup ID %ld "
			       "flags %c:%c:%c",
			       cdnsp_trb_type_string(type),
			       field0 & 0xff,
			       (field0 & 0xff00) >> 8,
			       (field0 & 0xff000000) >> 24,
			       (field0 & 0xff0000) >> 16,
			       (field1 & 0xff00) >> 8,
			       field1 & 0xff,
			       (field1 & 0xff000000) >> 16 |
			       (field1 & 0xff0000) >> 16,
			       TRB_LEN(field2), GET_TD_SIZE(field2),
			       GET_INTR_TARGET(field2),
			       TRB_SETUPID_TO_TYPE(field3),
			       field3 & TRB_IDT ? 'D' : 'd',
			       field3 & TRB_IOC ? 'I' : 'i',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_DATA:
		ret = snprintf(str, size,
			       "type '%s' Buffer %08x%08x length %ld TD size %ld "
			       "intr %ld flags %c:%c:%c:%c:%c:%c:%c",
			       cdnsp_trb_type_string(type),
			       field1, field0, TRB_LEN(field2),
			       GET_TD_SIZE(field2),
			       GET_INTR_TARGET(field2),
			       field3 & TRB_IDT ? 'D' : 'i',
			       field3 & TRB_IOC ? 'I' : 'i',
			       field3 & TRB_CHAIN ? 'C' : 'c',
			       field3 & TRB_NO_SNOOP ? 'S' : 's',
			       field3 & TRB_ISP ? 'I' : 'i',
			       field3 & TRB_ENT ? 'E' : 'e',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_STATUS:
		ret = snprintf(str, size,
			       "Buffer %08x%08x length %ld TD size %ld intr"
			       "%ld type '%s' flags %c:%c:%c:%c",
			       field1, field0, TRB_LEN(field2),
			       GET_TD_SIZE(field2),
			       GET_INTR_TARGET(field2),
			       cdnsp_trb_type_string(type),
			       field3 & TRB_IOC ? 'I' : 'i',
			       field3 & TRB_CHAIN ? 'C' : 'c',
			       field3 & TRB_ENT ? 'E' : 'e',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_NORMAL:
	case TRB_ISOC:
	case TRB_EVENT_DATA:
	case TRB_TR_NOOP:
		ret = snprintf(str, size,
			       "type '%s' Buffer %08x%08x length %ld "
			       "TD size %ld intr %ld "
			       "flags %c:%c:%c:%c:%c:%c:%c:%c:%c",
			       cdnsp_trb_type_string(type),
			       field1, field0, TRB_LEN(field2),
			       GET_TD_SIZE(field2),
			       GET_INTR_TARGET(field2),
			       field3 & TRB_BEI ? 'B' : 'b',
			       field3 & TRB_IDT ? 'T' : 't',
			       field3 & TRB_IOC ? 'I' : 'i',
			       field3 & TRB_CHAIN ? 'C' : 'c',
			       field3 & TRB_NO_SNOOP ? 'S' : 's',
			       field3 & TRB_ISP ? 'I' : 'i',
			       field3 & TRB_ENT ? 'E' : 'e',
			       field3 & TRB_CYCLE ? 'C' : 'c',
			       !(field3 & TRB_EVENT_INVALIDATE) ? 'V' : 'v');
		break;
	case TRB_CMD_NOOP:
	case TRB_ENABLE_SLOT:
		ret = snprintf(str, size, "%s: flags %c",
			       cdnsp_trb_type_string(type),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_DISABLE_SLOT:
		ret = snprintf(str, size, "%s: slot %ld flags %c",
			       cdnsp_trb_type_string(type),
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_ADDR_DEV:
		ret = snprintf(str, size,
			       "%s: ctx %08x%08x slot %ld flags %c:%c",
			       cdnsp_trb_type_string(type), field1, field0,
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_BSR ? 'B' : 'b',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_CONFIG_EP:
		ret = snprintf(str, size,
			       "%s: ctx %08x%08x slot %ld flags %c:%c",
			       cdnsp_trb_type_string(type), field1, field0,
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_DC ? 'D' : 'd',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_EVAL_CONTEXT:
		ret = snprintf(str, size,
			       "%s: ctx %08x%08x slot %ld flags %c",
			       cdnsp_trb_type_string(type), field1, field0,
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_RESET_EP:
	case TRB_HALT_ENDPOINT:
		ret = snprintf(str, size,
			       "%s: ep%d%s(%d) ctx %08x%08x slot %ld flags %c",
			       cdnsp_trb_type_string(type),
			       ep_num, ep_id % 2 ? "out" : "in",
			       TRB_TO_EP_INDEX(field3), field1, field0,
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_STOP_RING:
		ret = snprintf(str, size,
			       "%s: ep%d%s(%d) slot %ld sp %d flags %c",
			       cdnsp_trb_type_string(type),
			       ep_num, ep_id % 2 ? "out" : "in",
			       TRB_TO_EP_INDEX(field3),
			       TRB_TO_SLOT_ID(field3),
			       TRB_TO_SUSPEND_PORT(field3),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_SET_DEQ:
		ret = snprintf(str, size,
			       "%s: ep%d%s(%d) deq %08x%08x stream %ld slot %ld  flags %c",
			       cdnsp_trb_type_string(type),
			       ep_num, ep_id % 2 ? "out" : "in",
			       TRB_TO_EP_INDEX(field3), field1, field0,
			       TRB_TO_STREAM_ID(field2),
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_RESET_DEV:
		ret = snprintf(str, size, "%s: slot %ld flags %c",
			       cdnsp_trb_type_string(type),
			       TRB_TO_SLOT_ID(field3),
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	case TRB_ENDPOINT_NRDY:
		temp = TRB_TO_HOST_STREAM(field2);

		ret = snprintf(str, size,
			       "%s: ep%d%s(%d) H_SID %x%s%s D_SID %lx flags %c:%c",
			       cdnsp_trb_type_string(type),
			       ep_num, ep_id % 2 ? "out" : "in",
			       TRB_TO_EP_INDEX(field3), temp,
			       temp == STREAM_PRIME_ACK ? "(PRIME)" : "",
			       temp == STREAM_REJECTED ? "(REJECTED)" : "",
			       TRB_TO_DEV_STREAM(field0),
			       field3 & TRB_STAT ? 'S' : 's',
			       field3 & TRB_CYCLE ? 'C' : 'c');
		break;
	default:
		ret = snprintf(str, size,
			       "type '%s' -> raw %08x %08x %08x %08x",
			       cdnsp_trb_type_string(type),
			       field0, field1, field2, field3);
	}

	if (ret >= size)
		pr_info("CDNSP: buffer overflowed.\n");

	return str;
}

static inline const char *cdnsp_decode_slot_context(u32 info, u32 info2,
						    u32 int_target, u32 state)
{
	static char str[1024];
	int ret = 0;
	u32 speed;
	char *s;

	speed = info & DEV_SPEED;

	switch (speed) {
	case SLOT_SPEED_FS:
		s = "full-speed";
		break;
	case SLOT_SPEED_HS:
		s = "high-speed";
		break;
	case SLOT_SPEED_SS:
		s = "super-speed";
		break;
	case SLOT_SPEED_SSP:
		s = "super-speed plus";
		break;
	default:
		s = "UNKNOWN speed";
	}

	ret = sprintf(str, "%s Ctx Entries %d",
		      s, (info & LAST_CTX_MASK) >> 27);

	ret += sprintf(str + ret, " [Intr %ld] Addr %ld State %s",
		       GET_INTR_TARGET(int_target), state & DEV_ADDR_MASK,
		       cdnsp_slot_state_string(GET_SLOT_STATE(state)));

	return str;
}

static inline const char *cdnsp_portsc_link_state_string(u32 portsc)
{
	switch (portsc & PORT_PLS_MASK) {
	case XDEV_U0:
		return "U0";
	case XDEV_U1:
		return "U1";
	case XDEV_U2:
		return "U2";
	case XDEV_U3:
		return "U3";
	case XDEV_DISABLED:
		return "Disabled";
	case XDEV_RXDETECT:
		return "RxDetect";
	case XDEV_INACTIVE:
		return "Inactive";
	case XDEV_POLLING:
		return "Polling";
	case XDEV_RECOVERY:
		return "Recovery";
	case XDEV_HOT_RESET:
		return "Hot Reset";
	case XDEV_COMP_MODE:
		return "Compliance mode";
	case XDEV_TEST_MODE:
		return "Test mode";
	case XDEV_RESUME:
		return "Resume";
	default:
		break;
	}

	return "Unknown";
}

static inline const char *cdnsp_decode_portsc(char *str, size_t size,
					      u32 portsc)
{
	int ret;

	ret = snprintf(str, size, "%s %s %s Link:%s PortSpeed:%d ",
		       portsc & PORT_POWER ? "Powered" : "Powered-off",
		       portsc & PORT_CONNECT ? "Connected" : "Not-connected",
		       portsc & PORT_PED ? "Enabled" : "Disabled",
		       cdnsp_portsc_link_state_string(portsc),
		       DEV_PORT_SPEED(portsc));

	if (portsc & PORT_RESET)
		ret += snprintf(str + ret, size - ret, "In-Reset ");

	ret += snprintf(str + ret, size - ret, "Change: ");
	if (portsc & PORT_CSC)
		ret += snprintf(str + ret, size - ret, "CSC ");
	if (portsc & PORT_WRC)
		ret += snprintf(str + ret, size - ret, "WRC ");
	if (portsc & PORT_RC)
		ret += snprintf(str + ret, size - ret, "PRC ");
	if (portsc & PORT_PLC)
		ret += snprintf(str + ret, size - ret, "PLC ");
	if (portsc & PORT_CEC)
		ret += snprintf(str + ret, size - ret, "CEC ");
	ret += snprintf(str + ret, size - ret, "Wake: ");
	if (portsc & PORT_WKCONN_E)
		ret += snprintf(str + ret, size - ret, "WCE ");
	if (portsc & PORT_WKDISC_E)
		ret += snprintf(str + ret, size - ret, "WDE ");

	return str;
}

static inline const char *cdnsp_ep_state_string(u8 state)
{
	switch (state) {
	case EP_STATE_DISABLED:
		return "disabled";
	case EP_STATE_RUNNING:
		return "running";
	case EP_STATE_HALTED:
		return "halted";
	case EP_STATE_STOPPED:
		return "stopped";
	case EP_STATE_ERROR:
		return "error";
	default:
		return "INVALID";
	}
}

static inline const char *cdnsp_ep_type_string(u8 type)
{
	switch (type) {
	case ISOC_OUT_EP:
		return "Isoc OUT";
	case BULK_OUT_EP:
		return "Bulk OUT";
	case INT_OUT_EP:
		return "Int OUT";
	case CTRL_EP:
		return "Ctrl";
	case ISOC_IN_EP:
		return "Isoc IN";
	case BULK_IN_EP:
		return "Bulk IN";
	case INT_IN_EP:
		return "Int IN";
	default:
		return "INVALID";
	}
}

static inline const char *cdnsp_decode_ep_context(char *str, size_t size,
						  u32 info, u32 info2,
						  u64 deq, u32 tx_info)
{
	u8 max_pstr, ep_state, interval, ep_type, burst, cerr, mult;
	bool lsa, hid;
	u16 maxp, avg;
	u32 esit;
	int ret;

	esit = CTX_TO_MAX_ESIT_PAYLOAD_HI(info) << 16 |
	       CTX_TO_MAX_ESIT_PAYLOAD_LO(tx_info);

	ep_state = info & EP_STATE_MASK;
	max_pstr = CTX_TO_EP_MAXPSTREAMS(info);
	interval = CTX_TO_EP_INTERVAL(info);
	mult = CTX_TO_EP_MULT(info) + 1;
	lsa = !!(info & EP_HAS_LSA);

	cerr = (info2 & (3 << 1)) >> 1;
	ep_type = CTX_TO_EP_TYPE(info2);
	hid = !!(info2 & (1 << 7));
	burst = CTX_TO_MAX_BURST(info2);
	maxp = MAX_PACKET_DECODED(info2);

	avg = EP_AVG_TRB_LENGTH(tx_info);

	ret = snprintf(str, size, "State %s mult %d max P. Streams %d %s",
		       cdnsp_ep_state_string(ep_state), mult,
		       max_pstr, lsa ? "LSA " : "");

	ret += snprintf(str + ret, size - ret,
			"interval %d us max ESIT payload %d CErr %d ",
			(1 << interval) * 125, esit, cerr);

	ret += snprintf(str + ret, size - ret,
			"Type %s %sburst %d maxp %d deq %016llx ",
			cdnsp_ep_type_string(ep_type), hid ? "HID" : "",
			burst, maxp, deq);

	ret += snprintf(str + ret, size - ret, "avg trb len %d", avg);

	return str;
}

#endif /*__LINUX_CDNSP_DEBUG*/