aboutsummaryrefslogtreecommitdiff
path: root/example/sysinfo/odp_sysinfo.c
blob: 1513882638d9bc807e80e91e7ccc087ff7f30413 (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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
/* Copyright (c) 2018, Linaro Limited
 * Copyright (c) 2022-2023, Nokia
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>

#include <odp_api.h>
#include <odp/helper/odph_api.h>

#define KB              1024
#define MB              (1024 * 1024)
#define MAX_HUGE_PAGES  32
#define MAX_IFACES      32
#define MAX_NAME_LEN    128

#define PROG_NAME "odp_sysinfo"

typedef struct {
	char name[MAX_NAME_LEN];
	odp_pktio_capability_t capa;
	odp_proto_stats_capability_t proto_stats_capa;
} pktio_t;

typedef struct {
	int num_pktio;
	pktio_t pktio[MAX_IFACES];
	struct {
		odp_timer_capability_t capa[ODP_CLOCK_NUM_SRC];
		odp_timer_pool_info_t pool_info[ODP_CLOCK_NUM_SRC];
		int num;
	} timer;
} appl_args_t;

/* Check that prints can use %u instead of %PRIu32 */
ODP_STATIC_ASSERT(sizeof(unsigned int) >= sizeof(uint32_t), "unsigned int smaller than uint32_t");

static const char *support_level(odp_support_t support)
{
	switch (support) {
	case ODP_SUPPORT_NO: return "no";
	case ODP_SUPPORT_YES: return "yes";
	case ODP_SUPPORT_PREFERRED: return "yes, preferred";
	default: return "UNKNOWN";
	}
}

static const char *cpu_arch_name(odp_system_info_t *sysinfo)
{
	odp_cpu_arch_t cpu_arch = sysinfo->cpu_arch;

	switch (cpu_arch) {
	case ODP_CPU_ARCH_ARM:
		return "ARM";
	case ODP_CPU_ARCH_MIPS:
		return "MIPS";
	case ODP_CPU_ARCH_PPC:
		return "PPC";
	case ODP_CPU_ARCH_RISCV:
		return "RISC-V";
	case ODP_CPU_ARCH_X86:
		return "x86";
	default:
		return "Unknown";
	}
}

static const char *arm_isa(odp_cpu_arch_arm_t isa)
{
	switch (isa) {
	case ODP_CPU_ARCH_ARMV6:
		return "ARMv6";
	case ODP_CPU_ARCH_ARMV7:
		return "ARMv7-A";
	case ODP_CPU_ARCH_ARMV8_0:
		return "ARMv8.0-A";
	case ODP_CPU_ARCH_ARMV8_1:
		return "ARMv8.1-A";
	case ODP_CPU_ARCH_ARMV8_2:
		return "ARMv8.2-A";
	case ODP_CPU_ARCH_ARMV8_3:
		return "ARMv8.3-A";
	case ODP_CPU_ARCH_ARMV8_4:
		return "ARMv8.4-A";
	case ODP_CPU_ARCH_ARMV8_5:
		return "ARMv8.5-A";
	case ODP_CPU_ARCH_ARMV8_6:
		return "ARMv8.6-A";
	case ODP_CPU_ARCH_ARMV8_7:
		return "ARMv8.7-A";
	case ODP_CPU_ARCH_ARMV8_8:
		return "ARMv8.8-A";
	case ODP_CPU_ARCH_ARMV8_9:
		return "ARMv8.9-A";
	case ODP_CPU_ARCH_ARMV9_0:
		return "ARMv9.0-A";
	case ODP_CPU_ARCH_ARMV9_1:
		return "ARMv9.1-A";
	case ODP_CPU_ARCH_ARMV9_2:
		return "ARMv9.2-A";
	case ODP_CPU_ARCH_ARMV9_3:
		return "ARMv9.3-A";
	default:
		return "Unknown";
	}
}

static const char *x86_isa(odp_cpu_arch_x86_t isa)
{
	switch (isa) {
	case ODP_CPU_ARCH_X86_I686:
		return "x86_i686";
	case ODP_CPU_ARCH_X86_64:
		return "x86_64";
	default:
		return "Unknown";
	}
}

static const char *cpu_arch_isa(odp_system_info_t *sysinfo, int isa_sw)
{
	odp_cpu_arch_t cpu_arch = sysinfo->cpu_arch;

	switch (cpu_arch) {
	case ODP_CPU_ARCH_ARM:
		if (isa_sw)
			return arm_isa(sysinfo->cpu_isa_sw.arm);
		else
			return arm_isa(sysinfo->cpu_isa_hw.arm);
	case ODP_CPU_ARCH_MIPS:
		return "Unknown";
	case ODP_CPU_ARCH_PPC:
		return "Unknown";
	case ODP_CPU_ARCH_RISCV:
		return "Unknown";
	case ODP_CPU_ARCH_X86:
		if (isa_sw)
			return x86_isa(sysinfo->cpu_isa_sw.x86);
		else
			return x86_isa(sysinfo->cpu_isa_hw.x86);
	default:
		return "Unknown";
	}
}

static const char *cipher_alg_name(odp_cipher_alg_t cipher)
{
	switch (cipher) {
	case ODP_CIPHER_ALG_NULL:
		return "null";
	case ODP_CIPHER_ALG_DES:
		return "des";
	case ODP_CIPHER_ALG_3DES_CBC:
		return "3des_cbc";
	case ODP_CIPHER_ALG_AES_CBC:
		return "aes_cbc";
	case ODP_CIPHER_ALG_AES_CTR:
		return "aes_ctr";
	case ODP_CIPHER_ALG_AES_ECB:
		return "aes_ecb";
	case ODP_CIPHER_ALG_AES_CFB128:
		return "aes_cfb128";
	case ODP_CIPHER_ALG_AES_XTS:
		return "aes_xts";
	case ODP_CIPHER_ALG_AES_GCM:
		return "aes_gcm";
	case ODP_CIPHER_ALG_AES_CCM:
		return "aes_ccm";
	case ODP_CIPHER_ALG_CHACHA20_POLY1305:
		return "chacha20_poly1305";
	case ODP_CIPHER_ALG_KASUMI_F8:
		return "kasumi_f8";
	case ODP_CIPHER_ALG_SNOW3G_UEA2:
		return "snow3g_uea2";
	case ODP_CIPHER_ALG_AES_EEA2:
		return "aes_eea2";
	case ODP_CIPHER_ALG_ZUC_EEA3:
		return "zuc_eea3";
	default:
		return "Unknown";
	}
}

static const char *auth_alg_name(odp_auth_alg_t auth)
{
	switch (auth) {
	case ODP_AUTH_ALG_NULL:
		return "null";
	case ODP_AUTH_ALG_MD5_HMAC:
		return "md5_hmac";
	case ODP_AUTH_ALG_SHA1_HMAC:
		return "sha1_hmac";
	case ODP_AUTH_ALG_SHA224_HMAC:
		return "sha224_hmac";
	case ODP_AUTH_ALG_SHA256_HMAC:
		return "sha256_hmac";
	case ODP_AUTH_ALG_SHA384_HMAC:
		return "sha384_hmac";
	case ODP_AUTH_ALG_SHA512_HMAC:
		return "sha512_hmac";
	case ODP_AUTH_ALG_AES_GCM:
		return "aes_gcm";
	case ODP_AUTH_ALG_AES_GMAC:
		return "aes_gmac";
	case ODP_AUTH_ALG_AES_CCM:
		return "aes_ccm";
	case ODP_AUTH_ALG_AES_CMAC:
		return "aes_cmac";
	case ODP_AUTH_ALG_AES_XCBC_MAC:
		return "aes_xcbc_mac";
	case ODP_AUTH_ALG_CHACHA20_POLY1305:
		return "chacha20_poly1305";
	case ODP_AUTH_ALG_KASUMI_F9:
		return "kasumi_f9";
	case ODP_AUTH_ALG_SNOW3G_UIA2:
		return "snow3g_uia2";
	case ODP_AUTH_ALG_AES_EIA2:
		return "aes_eia2";
	case ODP_AUTH_ALG_ZUC_EIA3:
		return "zuc_eia3";
	case ODP_AUTH_ALG_MD5:
		return "md5";
	case ODP_AUTH_ALG_SHA1:
		return "sha1";
	case ODP_AUTH_ALG_SHA224:
		return "sha224";
	case ODP_AUTH_ALG_SHA256:
		return "sha256";
	case ODP_AUTH_ALG_SHA384:
		return "sha384";
	case ODP_AUTH_ALG_SHA512:
		return "sha512";
	default:
		return "Unknown";
	}
}

typedef void (*cipher_op_t)(odp_cipher_alg_t alg);
typedef void (*auth_op_t)(odp_auth_alg_t alg);

static void foreach_cipher(odp_crypto_cipher_algos_t ciphers, cipher_op_t op)
{
	if (ciphers.bit.null)
		op(ODP_CIPHER_ALG_NULL);
	if (ciphers.bit.des)
		op(ODP_CIPHER_ALG_DES);
	if (ciphers.bit.trides_cbc)
		op(ODP_CIPHER_ALG_3DES_CBC);
	if (ciphers.bit.trides_ecb)
		op(ODP_CIPHER_ALG_3DES_ECB);
	if (ciphers.bit.aes_cbc)
		op(ODP_CIPHER_ALG_AES_CBC);
	if (ciphers.bit.aes_ctr)
		op(ODP_CIPHER_ALG_AES_CTR);
	if (ciphers.bit.aes_ecb)
		op(ODP_CIPHER_ALG_AES_ECB);
	if (ciphers.bit.aes_cfb128)
		op(ODP_CIPHER_ALG_AES_CFB128);
	if (ciphers.bit.aes_xts)
		op(ODP_CIPHER_ALG_AES_XTS);
	if (ciphers.bit.aes_gcm)
		op(ODP_CIPHER_ALG_AES_GCM);
	if (ciphers.bit.aes_ccm)
		op(ODP_CIPHER_ALG_AES_CCM);
	if (ciphers.bit.chacha20_poly1305)
		op(ODP_CIPHER_ALG_CHACHA20_POLY1305);
	if (ciphers.bit.kasumi_f8)
		op(ODP_CIPHER_ALG_KASUMI_F8);
	if (ciphers.bit.snow3g_uea2)
		op(ODP_CIPHER_ALG_SNOW3G_UEA2);
	if (ciphers.bit.aes_eea2)
		op(ODP_CIPHER_ALG_AES_EEA2);
	if (ciphers.bit.zuc_eea3)
		op(ODP_CIPHER_ALG_ZUC_EEA3);
}

static void foreach_auth(odp_crypto_auth_algos_t auths, auth_op_t op)
{
	if (auths.bit.null)
		op(ODP_AUTH_ALG_NULL);
	if (auths.bit.md5_hmac)
		op(ODP_AUTH_ALG_MD5_HMAC);
	if (auths.bit.sha1_hmac)
		op(ODP_AUTH_ALG_SHA1_HMAC);
	if (auths.bit.sha224_hmac)
		op(ODP_AUTH_ALG_SHA224_HMAC);
	if (auths.bit.sha256_hmac)
		op(ODP_AUTH_ALG_SHA256_HMAC);
	if (auths.bit.sha384_hmac)
		op(ODP_AUTH_ALG_SHA384_HMAC);
	if (auths.bit.sha512_hmac)
		op(ODP_AUTH_ALG_SHA512_HMAC);
	if (auths.bit.aes_gcm)
		op(ODP_AUTH_ALG_AES_GCM);
	if (auths.bit.aes_gmac)
		op(ODP_AUTH_ALG_AES_GMAC);
	if (auths.bit.aes_ccm)
		op(ODP_AUTH_ALG_AES_CCM);
	if (auths.bit.aes_cmac)
		op(ODP_AUTH_ALG_AES_CMAC);
	if (auths.bit.aes_xcbc_mac)
		op(ODP_AUTH_ALG_AES_XCBC_MAC);
	if (auths.bit.chacha20_poly1305)
		op(ODP_AUTH_ALG_CHACHA20_POLY1305);
	if (auths.bit.kasumi_f9)
		op(ODP_AUTH_ALG_KASUMI_F9);
	if (auths.bit.snow3g_uia2)
		op(ODP_AUTH_ALG_SNOW3G_UIA2);
	if (auths.bit.aes_eia2)
		op(ODP_AUTH_ALG_AES_EIA2);
	if (auths.bit.zuc_eia3)
		op(ODP_AUTH_ALG_ZUC_EIA3);
	if (auths.bit.md5)
		op(ODP_AUTH_ALG_MD5);
	if (auths.bit.sha1)
		op(ODP_AUTH_ALG_SHA1);
	if (auths.bit.sha224)
		op(ODP_AUTH_ALG_SHA224);
	if (auths.bit.sha256)
		op(ODP_AUTH_ALG_SHA256);
	if (auths.bit.sha384)
		op(ODP_AUTH_ALG_SHA384);
	if (auths.bit.sha512)
		op(ODP_AUTH_ALG_SHA512);
}

static void print_cipher_capa(odp_cipher_alg_t cipher)
{
	int caps = odp_crypto_cipher_capability(cipher, NULL, 0);
	int rc, i;

	if (caps <= 0)
		return;

	odp_crypto_cipher_capability_t capa[caps];

	rc = odp_crypto_cipher_capability(cipher, capa, caps);
	if (rc < 0)
		return;

	printf("        %s:\n", cipher_alg_name(cipher));
	for (i = 0; i < rc; i++)
		printf("            key %d iv %d\n",
		       capa[i].key_len, capa[i].iv_len);
}

static void print_auth_capa(odp_auth_alg_t auth)
{
	int caps = odp_crypto_auth_capability(auth, NULL, 0);
	int rc, i;

	if (caps <= 0)
		return;

	odp_crypto_auth_capability_t capa[caps];

	rc = odp_crypto_auth_capability(auth, capa, caps);
	if (rc < 0)
		return;

	printf("        %s:\n", auth_alg_name(auth));
	for (i = 0; i < rc; i++) {
		printf("            digest %d", capa[i].digest_len);
		if (capa[i].key_len != 0)
			printf(" key %d", capa[i].key_len);
		if (capa[i].iv_len != 0)
			printf(" iv %d", capa[i].iv_len);
		if (capa[i].aad_len.max != 0)
			printf(" aad %d, %d, %d",
			       capa[i].aad_len.min, capa[i].aad_len.max,
			       capa[i].aad_len.inc);
		printf("\n");
	}
}

static void print_cipher(odp_cipher_alg_t alg)
{
	printf("%s ", cipher_alg_name(alg));
}

static void print_auth(odp_auth_alg_t alg)
{
	printf("%s ", auth_alg_name(alg));
}

static int pktio_capability(appl_args_t *appl_args)
{
	odp_pool_param_t pool_param;
	odp_pool_t pool;
	int ret = 0;

	odp_pool_param_init(&pool_param);

	pool_param.type = ODP_POOL_PACKET;
	pool_param.pkt.num = 128;

	pool = odp_pool_create("pktio_pool", &pool_param);
	if (pool == ODP_POOL_INVALID) {
		ODPH_ERR("Creating packet pool failed\n");
		return -1;
	}

	for (int i = 0; i < appl_args->num_pktio; i++) {
		odp_pktio_param_t param;
		odp_pktio_t pktio;

		odp_pktio_param_init(&param);

		param.in_mode = ODP_PKTIN_MODE_SCHED;
		param.out_mode = ODP_PKTOUT_MODE_DIRECT;

		pktio = odp_pktio_open(appl_args->pktio[i].name, pool, &param);
		if (pktio == ODP_PKTIO_INVALID) {
			ODPH_ERR("Opening pktio %s failed\n", appl_args->pktio[i].name);
			ret = -1;
			break;
		}

		if (odp_pktio_capability(pktio, &appl_args->pktio[i].capa)) {
			ODPH_ERR("Reading pktio %s capa failed\n", appl_args->pktio[i].name);
			ret = -1;
		}

		if (odp_proto_stats_capability(pktio, &appl_args->pktio[i].proto_stats_capa)) {
			ODPH_ERR("Reading pktio %s proto stats capa failed\n",
				 appl_args->pktio[i].name);
			ret = -1;
		}

		if (odp_pktio_close(pktio)) {
			ODPH_ERR("Closing pktio %s failed\n", appl_args->pktio[i].name);
			ret = -1;
		}

		if (ret)
			break;
	}

	if (odp_pool_destroy(pool)) {
		ODPH_ERR("Destroying pktio pool failed\n");
		return -1;
	}
	return ret;
}

static void print_pktio_capa(appl_args_t *appl_args)
{
	for (int i = 0; i < appl_args->num_pktio; i++) {
		odp_pktio_capability_t *capa = &appl_args->pktio[i].capa;

		printf("\n");
		printf("  PKTIO (%s)\n", appl_args->pktio[i].name);
		printf("    (in_mode:                      ODP_PKTIN_MODE_SCHED)\n");
		printf("    (out_mode:                     ODP_PKTOUT_MODE_DIRECT)\n");
		printf("    max_input_queues:              %u\n", capa->max_input_queues);
		printf("    min_input_queue_size:          %u\n", capa->min_input_queue_size);
		printf("    max_input_queue_size:          %u\n", capa->max_input_queue_size);
		printf("    max_output_queues:             %u\n", capa->max_output_queues);
		printf("    min_output_queue_size:         %u\n", capa->min_output_queue_size);
		printf("    max_output_queue_size:         %u\n", capa->max_output_queue_size);
		printf("    config.pktin:                  0x%" PRIx64 "\n",
		       capa->config.pktin.all_bits);
		printf("    config.pktout:                 0x%" PRIx64 "\n",
		       capa->config.pktout.all_bits);
		printf("    set_op:                        0x%" PRIx32 "\n", capa->set_op.all_bits);
		printf("    vector.supported:              %s\n",
		       support_level(capa->vector.supported));
		printf("    vector.max_size:               %u\n", capa->vector.max_size);
		printf("    vector.min_size:               %u\n", capa->vector.min_size);
		printf("    vector.max_tmo_ns:             %" PRIu64 " ns\n",
		       capa->vector.max_tmo_ns);
		printf("    vector.min_tmo_ns:             %" PRIu64 " ns\n",
		       capa->vector.min_tmo_ns);
		printf("    lso.max_profiles:              %u\n", capa->lso.max_profiles);
		printf("    lso.max_profiles_per_pktio:    %u\n", capa->lso.max_profiles_per_pktio);
		printf("    lso.max_packet_segments:       %u\n", capa->lso.max_packet_segments);
		printf("    lso.max_segments:              %u\n", capa->lso.max_segments);
		printf("    lso.max_payload_len:           %u B\n", capa->lso.max_payload_len);
		printf("    lso.max_payload_offset:        %u B\n", capa->lso.max_payload_offset);
		printf("    lso.mod_op.add_segment_num:    %u\n", capa->lso.mod_op.add_segment_num);
		printf("    lso.mod_op.add_payload_len:    %u\n", capa->lso.mod_op.add_payload_len);
		printf("    lso.mod_op.add_payload_offset: %u\n",
		       capa->lso.mod_op.add_payload_offset);
		printf("    lso.max_num_custom:            %u\n", capa->lso.max_num_custom);
		printf("    lso.proto.custom:              %u\n", capa->lso.proto.custom);
		printf("    lso.proto.ipv4:                %u\n", capa->lso.proto.ipv4);
		printf("    lso.proto.ipv6:                %u\n", capa->lso.proto.ipv6);
		printf("    lso.proto.tcp_ipv4:            %u\n", capa->lso.proto.tcp_ipv4);
		printf("    lso.proto.tcp_ipv6:            %u\n", capa->lso.proto.tcp_ipv6);
		printf("    lso.proto.sctp_ipv4:           %u\n", capa->lso.proto.sctp_ipv4);
		printf("    lso.proto.sctp_ipv6:           %u\n", capa->lso.proto.sctp_ipv6);
		printf("    maxlen.equal:                  %i\n", capa->maxlen.equal);
		printf("    maxlen.min_input:              %u B\n", capa->maxlen.min_input);
		printf("    maxlen.max_input:              %u B\n", capa->maxlen.max_input);
		printf("    maxlen.min_output:             %u B\n", capa->maxlen.min_output);
		printf("    maxlen.max_output:             %u B\n", capa->maxlen.max_output);
		printf("    max_tx_aging_tmo_ns:           %" PRIu64 " ns\n",
		       capa->max_tx_aging_tmo_ns);
		printf("    tx_compl.queue_type_sched:     %i\n", capa->tx_compl.queue_type_sched);
		printf("    tx_compl.queue_type_plain:     %i\n", capa->tx_compl.queue_type_plain);
		printf("    tx_compl.mode_event:           %u\n", capa->tx_compl.mode_event);
		printf("    tx_compl.mode_poll:            %u\n", capa->tx_compl.mode_poll);
		printf("    tx_compl.max_compl_id:         %u\n", capa->tx_compl.max_compl_id);
		printf("    free_ctrl.dont_free:           %u\n", capa->free_ctrl.dont_free);
		printf("    reassembly.ip:                 %i\n", capa->reassembly.ip);
		printf("    reassembly.ipv4:               %i\n", capa->reassembly.ipv4);
		printf("    reassembly.ipv6:               %i\n", capa->reassembly.ipv6);
		printf("    reassembly.max_wait_time:      %" PRIu64 " ns\n",
		       capa->reassembly.max_wait_time);
		printf("    reassembly.max_num_frags:      %u\n", capa->reassembly.max_num_frags);
		printf("    stats.pktio:                   0x%" PRIx64 "\n",
		       capa->stats.pktio.all_counters);
		printf("    stats.pktin_queue:             0x%" PRIx64 "\n",
		       capa->stats.pktin_queue.all_counters);
		printf("    stats.pktout_queue:            0x%" PRIx64 "\n",
		       capa->stats.pktout_queue.all_counters);
		printf("    flow_control.pause_rx:         %u\n", capa->flow_control.pause_rx);
		printf("    flow_control.pfc_rx:           %u\n", capa->flow_control.pfc_rx);
		printf("    flow_control.pause_tx:         %u\n", capa->flow_control.pause_tx);
		printf("    flow_control.pfc_tx:           %u\n", capa->flow_control.pfc_tx);
	}
}

static void print_proto_stats_capa(appl_args_t *appl_args)
{
	for (int i = 0; i < appl_args->num_pktio; i++) {
		odp_proto_stats_capability_t *capa = &appl_args->pktio[i].proto_stats_capa;

		printf("\n");
		printf("  PROTO STATS (%s)\n", appl_args->pktio[i].name);
		printf("    tx.counters:          0x%" PRIx64 "\n", capa->tx.counters.all_bits);
		printf("    tx.oct_count0_adj:    %i\n", capa->tx.oct_count0_adj);
		printf("    tx.oct_count1_adj:    %i\n", capa->tx.oct_count1_adj);
	}
}

static int timer_capability(appl_args_t *appl_args)
{
	for (int i = 0; i < ODP_CLOCK_NUM_SRC; i++) {
		int ret;
		odp_timer_pool_t pool;
		odp_timer_pool_param_t params;
		odp_timer_capability_t *capa = &appl_args->timer.capa[appl_args->timer.num];
		odp_timer_pool_info_t *info = &appl_args->timer.pool_info[appl_args->timer.num];

		ret  = odp_timer_capability(i, capa);
		if (ret && i == ODP_CLOCK_DEFAULT) {
			ODPH_ERR("odp_timer_capability() failed for default clock source: %d\n",
				 ret);
			return -1;
		}
		if (ret == -1)
			continue;
		if (ret < -1) {
			ODPH_ERR("odp_timer_capability() for clock source %d failed: %d\n", i, ret);
			return -1;
		}

		odp_timer_pool_param_init(&params);
		params.clk_src    = i;
		params.res_ns     = capa->max_res.res_ns;
		params.min_tmo    = capa->max_res.min_tmo;
		params.max_tmo    = capa->max_res.max_tmo;
		params.num_timers = 1;

		pool = odp_timer_pool_create("timer_pool", &params);
		if (pool == ODP_TIMER_POOL_INVALID) {
			ODPH_ERR("odp_timer_pool_create() failed for clock source: %d\n", i);
			return -1;
		}

		if (odp_timer_pool_start_multi(&pool, 1) != 1) {
			ODPH_ERR("odp_timer_pool_start_multi() failed for clock source: %d\n", i);
			return -1;
		}

		ret = odp_timer_pool_info(pool, info);
		if (ret) {
			ODPH_ERR("odp_timer_pool_info() for clock source %d failed: %d\n", i, ret);
			return -1;
		}

		odp_timer_pool_destroy(pool);

		appl_args->timer.num++;
	}
	return 0;
}

static void print_timer_capa(appl_args_t *appl_args)
{
	for (int i = 0; i < appl_args->timer.num; i++) {
		odp_timer_capability_t *capa = &appl_args->timer.capa[i];
		odp_timer_pool_info_t *info = &appl_args->timer.pool_info[i];

		printf("\n");
		printf("  TIMER (SRC %d)\n", i);

		printf("    max_pools_combined:   %u\n", capa->max_pools_combined);
		printf("    max_pools:            %u\n", capa->max_pools);
		printf("    max_timers:           %u\n", capa->max_timers);
		printf("    queue_type_sched:     %i\n", capa->queue_type_sched);
		printf("    queue_type_plain:     %i\n", capa->queue_type_plain);
		printf("    highest_res_ns:       %" PRIu64 " nsec\n", capa->highest_res_ns);
		printf("    maximum resolution\n");
		printf("      res_ns:             %" PRIu64 " nsec\n", capa->max_res.res_ns);
		printf("      res_hz:             %" PRIu64 " hz\n", capa->max_res.res_hz);
		printf("      min_tmo:            %" PRIu64 " nsec\n", capa->max_res.min_tmo);
		printf("      max_tmo:            %" PRIu64 " nsec\n", capa->max_res.max_tmo);
		printf("    maximum timeout\n");
		printf("      res_ns:             %" PRIu64 " nsec\n", capa->max_tmo.res_ns);
		printf("      res_hz:             %" PRIu64 " hz\n", capa->max_tmo.res_hz);
		printf("      min_tmo:            %" PRIu64 " nsec\n", capa->max_tmo.min_tmo);
		printf("      max_tmo:            %" PRIu64 " nsec\n", capa->max_tmo.max_tmo);
		printf("    periodic\n");
		printf("      max_pools:          %u\n", capa->periodic.max_pools);
		printf("      max_timers:         %u\n", capa->periodic.max_timers);
		printf("      min_base_freq_hz:   %" PRIu64 " %" PRIu64 "/%" PRIu64 " Hz\n",
		       capa->periodic.min_base_freq_hz.integer,
		       capa->periodic.min_base_freq_hz.numer,
		       capa->periodic.min_base_freq_hz.denom);
		printf("      max_base_freq_hz:   %" PRIu64 " %" PRIu64 "/%" PRIu64 " Hz\n",
		       capa->periodic.max_base_freq_hz.integer,
		       capa->periodic.max_base_freq_hz.numer,
		       capa->periodic.max_base_freq_hz.denom);
		printf("    timer pool tick info (max_res)\n");
		printf("      freq:               %" PRIu64 " %" PRIu64 "/%" PRIu64 " Hz\n",
		       info->tick_info.freq.integer,
		       info->tick_info.freq.numer,
		       info->tick_info.freq.denom);
		printf("      nsec:               %" PRIu64 " %" PRIu64 "/%" PRIu64 " ns\n",
		       info->tick_info.nsec.integer,
		       info->tick_info.nsec.numer,
		       info->tick_info.nsec.denom);
		printf("      clk_cycle:          %" PRIu64 " %" PRIu64 "/%" PRIu64 " cycles\n",
		       info->tick_info.clk_cycle.integer,
		       info->tick_info.clk_cycle.numer,
		       info->tick_info.clk_cycle.denom);
	}
}

static void usage(void)
{
	printf("\n"
	       "System Information\n"
	       "\n"
	       "Usage: %s OPTIONS\n"
	       "  E.g. %s -i eth0\n"
	       "\n"
	       "Optional OPTIONS:\n"
	       "  -i, --interfaces   Ethernet interfaces for packet I/O, comma-separated, no\n"
	       "                     spaces.\n"
	       "  -h, --help         Display help and exit.\n"
	       "\n", PROG_NAME, PROG_NAME);
}

static void parse_interfaces(appl_args_t *config, const char *optarg)
{
	char *tmp_str = strdup(optarg), *tmp;

	if (tmp_str == NULL)
		return;

	tmp = strtok(tmp_str, ",");

	while (tmp && config->num_pktio < MAX_IFACES) {
		if (strlen(tmp) + 1 > MAX_NAME_LEN) {
			ODPH_ERR("Unable to store interface name (MAX_NAME_LEN=%d)\n",
				 MAX_NAME_LEN);
			exit(EXIT_FAILURE);
		}
		strncpy(config->pktio[config->num_pktio].name, tmp, MAX_NAME_LEN);

		config->num_pktio++;

		tmp = strtok(NULL, ",");
	}

	free(tmp_str);
}

static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{
	int opt;
	int long_index;
	static const struct option longopts[] = {
		{"interfaces", required_argument, NULL, 'i'},
		{"help", no_argument, NULL, 'h'},
		{NULL, 0, NULL, 0}
	};
	static const char *shortopts =  "i:h";

	while (1) {
		opt = getopt_long(argc, argv, shortopts, longopts, &long_index);

		if (opt == -1)
			break;	/* No more options */

		switch (opt) {
		case 'i':
			parse_interfaces(appl_args, optarg);
			break;
		case 'h':
			usage();
			exit(EXIT_SUCCESS);
		case '?':
		default:
			usage();
			exit(EXIT_FAILURE);
		}
	}
}

int main(int argc, char **argv)
{
	odp_instance_t inst;
	int i, num_hp, num_hp_print;
	int num_ava, num_work, num_ctrl;
	odp_cpumask_t ava_mask, work_mask, ctrl_mask;
	odp_system_info_t sysinfo;
	odp_shm_capability_t shm_capa;
	odp_pool_capability_t pool_capa;
	odp_pool_ext_capability_t pool_ext_capa;
	odp_cls_capability_t cls_capa;
	odp_comp_capability_t comp_capa;
	odp_dma_capability_t dma_capa;
	odp_queue_capability_t queue_capa;
	odp_crypto_capability_t crypto_capa;
	odp_ipsec_capability_t ipsec_capa;
	odp_schedule_capability_t schedule_capa;
	odp_stash_capability_t stash_capa;
	appl_args_t appl_args;
	uint64_t huge_page[MAX_HUGE_PAGES];
	char ava_mask_str[ODP_CPUMASK_STR_SIZE];
	char work_mask_str[ODP_CPUMASK_STR_SIZE];
	char ctrl_mask_str[ODP_CPUMASK_STR_SIZE];
	int crypto_ret;
	int ipsec_ret;

	memset(&appl_args, 0, sizeof(appl_args_t));

	printf("\n");
	printf("ODP system info example\n");
	printf("***********************************************************\n");
	printf("\n");

	parse_args(argc, argv, &appl_args);

	if (odp_init_global(&inst, NULL, NULL)) {
		ODPH_ERR("Global init failed.\n");
		exit(EXIT_FAILURE);
	}

	if (odp_init_local(inst, ODP_THREAD_CONTROL)) {
		ODPH_ERR("Local init failed.\n");
		exit(EXIT_FAILURE);
	}

	printf("\n");
	printf("odp_sys_info_print()\n");
	printf("***********************************************************\n");
	odp_sys_info_print();

	printf("\n");
	printf("odp_sys_config_print()\n");
	printf("***********************************************************\n");
	odp_sys_config_print();

	if (odp_system_info(&sysinfo)) {
		ODPH_ERR("system info call failed\n");
		exit(EXIT_FAILURE);
	}

	memset(ava_mask_str, 0, ODP_CPUMASK_STR_SIZE);
	num_ava = odp_cpumask_all_available(&ava_mask);
	odp_cpumask_to_str(&ava_mask, ava_mask_str, ODP_CPUMASK_STR_SIZE);

	memset(work_mask_str, 0, ODP_CPUMASK_STR_SIZE);
	num_work = odp_cpumask_default_worker(&work_mask, 0);
	odp_cpumask_to_str(&work_mask, work_mask_str, ODP_CPUMASK_STR_SIZE);

	memset(ctrl_mask_str, 0, ODP_CPUMASK_STR_SIZE);
	num_ctrl = odp_cpumask_default_control(&ctrl_mask, 0);
	odp_cpumask_to_str(&ctrl_mask, ctrl_mask_str, ODP_CPUMASK_STR_SIZE);

	num_hp = odp_sys_huge_page_size_all(huge_page, MAX_HUGE_PAGES);

	num_hp_print = num_hp;
	if (num_hp_print > MAX_HUGE_PAGES)
		num_hp_print = MAX_HUGE_PAGES;

	if (odp_shm_capability(&shm_capa)) {
		ODPH_ERR("shm capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_pool_capability(&pool_capa)) {
		ODPH_ERR("pool capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_pool_ext_capability(ODP_POOL_PACKET, &pool_ext_capa)) {
		ODPH_ERR("external packet pool capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (pktio_capability(&appl_args)) {
		ODPH_ERR("pktio capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_cls_capability(&cls_capa)) {
		ODPH_ERR("classifier capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_comp_capability(&comp_capa)) {
		ODPH_ERR("compression capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_dma_capability(&dma_capa)) {
		ODPH_ERR("dma capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_queue_capability(&queue_capa)) {
		ODPH_ERR("queue capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_schedule_capability(&schedule_capa)) {
		ODPH_ERR("schedule capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (odp_stash_capability(&stash_capa, ODP_STASH_TYPE_DEFAULT)) {
		ODPH_ERR("stash capability failed\n");
		exit(EXIT_FAILURE);
	}

	if (timer_capability(&appl_args)) {
		ODPH_ERR("timer capability failed\n");
		exit(EXIT_FAILURE);
	}

	crypto_ret = odp_crypto_capability(&crypto_capa);
	if (crypto_ret < 0)
		ODPH_ERR("crypto capability failed\n");

	ipsec_ret = odp_ipsec_capability(&ipsec_capa);
	if (ipsec_ret < 0)
		ODPH_ERR("IPsec capability failed\n");

	printf("\n");
	printf("S Y S T E M    I N F O R M A T I O N\n");
	printf("***********************************************************\n");
	printf("\n");
	printf("  ODP API version:        %s\n", odp_version_api_str());
	printf("  ODP impl name:          %s\n", odp_version_impl_name());
	printf("  ODP impl details:       %s\n", odp_version_impl_str());
	printf("  CPU model:              %s\n", odp_cpu_model_str());
	printf("  CPU arch:               %s\n", cpu_arch_name(&sysinfo));
	printf("  CPU ISA version:        %s\n", cpu_arch_isa(&sysinfo, 0));
	printf("  SW ISA version:         %s\n", cpu_arch_isa(&sysinfo, 1));
	printf("  CPU max freq:           %" PRIu64 " hz\n", odp_cpu_hz_max());
	printf("  Current CPU:            %i\n", odp_cpu_id());
	printf("  Current CPU freq:       %" PRIu64 " hz\n", odp_cpu_hz());
	printf("  CPU count:              %i\n", odp_cpu_count());
	printf("  CPU available num:      %i\n", num_ava);
	printf("  CPU available mask:     %s\n", ava_mask_str);
	printf("  CPU worker num:         %i\n", num_work);
	printf("  CPU worker mask:        %s\n", work_mask_str);
	printf("  CPU control num:        %i\n", num_ctrl);
	printf("  CPU control mask:       %s\n", ctrl_mask_str);
	printf("  Max threads (define):   %i\n", ODP_THREAD_COUNT_MAX);
	printf("  Max threads:            %i\n", odp_thread_count_max());
	printf("  Byte order:             %s (%i / %i)\n",
	       ODP_BYTE_ORDER == ODP_BIG_ENDIAN ? "big" : "little",
	       ODP_BIG_ENDIAN, ODP_LITTLE_ENDIAN);
	printf("  Bitfield order:         %s (%i / %i)\n",
	       ODP_BITFIELD_ORDER == ODP_BIG_ENDIAN_BITFIELD ?
	       "big" : "little",
	       ODP_BIG_ENDIAN_BITFIELD, ODP_LITTLE_ENDIAN_BITFIELD);
	printf("  Cache line size:        %i B\n", odp_sys_cache_line_size());
	printf("  Page size:              %" PRIu64 " kB\n", odp_sys_page_size() / KB);
	printf("  Default huge page size: %" PRIu64 " kB\n", odp_sys_huge_page_size() / KB);
	printf("  Num huge page sizes:    %i\n", num_hp);

	for (i = 0; i < num_hp_print; i++)
		printf("  Huge page size [%i]:     %" PRIu64 " kB\n",
		       i, huge_page[i] / KB);

	printf("\n");
	printf("  SHM\n");
	printf("    max_blocks:           %u\n", shm_capa.max_blocks);
	printf("    max_size:             %" PRIu64 " MB\n", shm_capa.max_size / MB);
	printf("    max_align:            %" PRIu64 " B\n", shm_capa.max_align);
	printf("    flags:                0x%x: %s%s%s%s%s%s\n", shm_capa.flags,
	       (shm_capa.flags & ODP_SHM_PROC) ? "PROC " : "",
	       (shm_capa.flags & ODP_SHM_SINGLE_VA) ? "SINGLE_VA " : "",
	       (shm_capa.flags & ODP_SHM_EXPORT) ? "EXPORT " : "",
	       (shm_capa.flags & ODP_SHM_HP) ? "HP " : "",
	       (shm_capa.flags & ODP_SHM_HW_ACCESS) ? "HW_ACCESS " : "",
	       (shm_capa.flags & ODP_SHM_NO_HP) ? "NO_HP " : "");

	printf("\n");
	printf("  POOL\n");
	printf("    max_pools:                %u\n", pool_capa.max_pools);
	printf("    buf.max_pools:            %u\n", pool_capa.buf.max_pools);
	printf("    buf.max_align:            %u B\n", pool_capa.buf.max_align);
	printf("    buf.max_size:             %u kB\n", pool_capa.buf.max_size / KB);
	printf("    buf.max_num:              %u\n", pool_capa.buf.max_num);
	printf("    buf.max_uarea_size:       %u B\n", pool_capa.buf.max_uarea_size);
	printf("    buf.uarea_persistence:    %i\n", pool_capa.buf.uarea_persistence);
	printf("    buf.min_cache_size:       %u\n", pool_capa.buf.min_cache_size);
	printf("    buf.max_cache_size:       %u\n", pool_capa.buf.max_cache_size);
	printf("    buf.stats:                0x%" PRIx64 "\n", pool_capa.buf.stats.all);
	printf("    pkt.max_pools:            %u\n", pool_capa.pkt.max_pools);
	printf("    pkt.max_len:              %u kB\n", pool_capa.pkt.max_len / KB);
	printf("    pkt.max_num:              %u\n", pool_capa.pkt.max_num);
	printf("    pkt.max_align:            %u B\n", pool_capa.pkt.max_align);
	printf("    pkt.min_headroom:         %u B\n", pool_capa.pkt.min_headroom);
	printf("    pkt.max_headroom:         %u B\n", pool_capa.pkt.max_headroom);
	printf("    pkt.min_tailroom:         %u B\n", pool_capa.pkt.min_tailroom);
	printf("    pkt.max_segs_per_pkt:     %u\n", pool_capa.pkt.max_segs_per_pkt);
	printf("    pkt.min_seg_len:          %u B\n", pool_capa.pkt.min_seg_len);
	printf("    pkt.max_seg_len:          %u B\n", pool_capa.pkt.max_seg_len);
	printf("    pkt.max_uarea_size:       %u B\n", pool_capa.pkt.max_uarea_size);
	printf("    pkt.uarea_persistence:    %i\n", pool_capa.pkt.uarea_persistence);
	printf("    pkt.max_num_subparam:     %u\n", pool_capa.pkt.max_num_subparam);
	printf("    pkt.min_cache_size:       %u\n", pool_capa.pkt.min_cache_size);
	printf("    pkt.max_cache_size:       %u\n", pool_capa.pkt.max_cache_size);
	printf("    pkt.stats:                0x%" PRIx64 "\n", pool_capa.pkt.stats.all);
	printf("    tmo.max_pools:            %u\n", pool_capa.tmo.max_pools);
	printf("    tmo.max_num:              %u\n", pool_capa.tmo.max_num);
	printf("    tmo.max_uarea_size:       %u B\n", pool_capa.tmo.max_uarea_size);
	printf("    tmo.uarea_persistence:    %i\n", pool_capa.tmo.uarea_persistence);
	printf("    tmo.min_cache_size:       %u\n", pool_capa.tmo.min_cache_size);
	printf("    tmo.max_cache_size:       %u\n", pool_capa.tmo.max_cache_size);
	printf("    tmo.stats:                0x%" PRIx64 "\n", pool_capa.tmo.stats.all);
	printf("    vector.max_pools:         %u\n", pool_capa.vector.max_pools);
	printf("    vector.max_num:           %u\n", pool_capa.vector.max_num);
	printf("    vector.max_size:          %u\n", pool_capa.vector.max_size);
	printf("    vector.max_uarea_size:    %u B\n", pool_capa.vector.max_uarea_size);
	printf("    vector.uarea_persistence: %i\n", pool_capa.vector.uarea_persistence);
	printf("    vector.min_cache_size:    %u\n", pool_capa.vector.min_cache_size);
	printf("    vector.max_cache_size:    %u\n", pool_capa.vector.max_cache_size);
	printf("    vector.stats:             0x%" PRIx64 "\n", pool_capa.vector.stats.all);

	printf("\n");
	printf("  POOL EXT (pkt)\n");
	printf("    max_pools:             %u\n", pool_ext_capa.max_pools);
	if (pool_ext_capa.max_pools) {
		printf("    min_cache_size:        %u\n", pool_ext_capa.min_cache_size);
		printf("    max_cache_size:        %u\n", pool_ext_capa.max_cache_size);
		printf("    stats:                 0x%" PRIx64 "\n", pool_ext_capa.stats.all);
		printf("    pkt.max_num_buf:       %u\n", pool_ext_capa.pkt.max_num_buf);
		printf("    pkt.max_buf_size:      %u B\n", pool_ext_capa.pkt.max_buf_size);
		printf("    pkt.odp_header_size:   %u B\n", pool_ext_capa.pkt.odp_header_size);
		printf("    pkt.odp_trailer_size:  %u B\n", pool_ext_capa.pkt.odp_trailer_size);
		printf("    pkt.min_mem_align:     %u B\n", pool_ext_capa.pkt.min_mem_align);
		printf("    pkt.min_buf_align:     %u B\n", pool_ext_capa.pkt.min_buf_align);
		printf("    pkt.min_head_align:    %u B\n", pool_ext_capa.pkt.min_head_align);
		printf("    pkt.buf_size_aligned:  %u\n", pool_ext_capa.pkt.buf_size_aligned);
		printf("    pkt.max_headroom:      %u B\n", pool_ext_capa.pkt.max_headroom);
		printf("    pkt.max_headroom_size: %u B\n", pool_ext_capa.pkt.max_headroom_size);
		printf("    pkt.max_segs_per_pkt:  %u\n", pool_ext_capa.pkt.max_segs_per_pkt);
		printf("    pkt.max_uarea_size:    %u B\n", pool_ext_capa.pkt.max_uarea_size);
		printf("    pkt.uarea_persistence: %i\n", pool_ext_capa.pkt.uarea_persistence);
	}

	print_pktio_capa(&appl_args);

	print_proto_stats_capa(&appl_args);

	printf("\n");
	printf("  CLASSIFIER\n");
	printf("    supported_terms:        0x%" PRIx64 "\n", cls_capa.supported_terms.all_bits);
	printf("    max_pmr:                %u\n", cls_capa.max_pmr);
	printf("    max_pmr_per_cos:        %u\n", cls_capa.max_pmr_per_cos);
	printf("    max_terms_per_pmr:      %u\n", cls_capa.max_terms_per_pmr);
	printf("    max_cos:                %u\n", cls_capa.max_cos);
	printf("    max_hash_queues:        %u\n", cls_capa.max_hash_queues);
	printf("    hash_protocols:         0x%x\n", cls_capa.hash_protocols.all_bits);
	printf("    pmr_range_supported:    %i\n", cls_capa.pmr_range_supported);
	printf("    random_early_detection: %s\n", support_level(cls_capa.random_early_detection));
	printf("    threshold_red:          0x%" PRIx8 "\n", cls_capa.threshold_red.all_bits);
	printf("    back_pressure:          %s\n", support_level(cls_capa.back_pressure));
	printf("    threshold_bp:           0x%" PRIx8 "\n", cls_capa.threshold_bp.all_bits);
	printf("    max_mark:               %" PRIu64 "\n", cls_capa.max_mark);
	printf("    stats.queue:            0x%" PRIx64 "\n", cls_capa.stats.queue.all_counters);

	printf("\n");
	printf("  COMPRESSION\n");
	printf("    max_sessions:         %u\n", comp_capa.max_sessions);
	printf("    compl_algos:          0x%x\n", comp_capa.comp_algos.all_bits);
	printf("    hash_algos:           0x%x\n", comp_capa.hash_algos.all_bits);
	printf("    sync support:         %i\n", comp_capa.sync);
	printf("    async support:        %i\n", comp_capa.async);

	printf("\n");
	printf("  DMA\n");
	printf("    max_sessions:           %u\n", dma_capa.max_sessions);
	printf("    max_transfers:          %u\n", dma_capa.max_transfers);
	printf("    max_src_segs:           %u\n", dma_capa.max_src_segs);
	printf("    max_dst_segs:           %u\n", dma_capa.max_dst_segs);
	printf("    max_segs:               %u\n", dma_capa.max_segs);
	printf("    max_seg_len:            %u B\n", dma_capa.max_seg_len);
	printf("    compl_mode_mask:        0x%x\n", dma_capa.compl_mode_mask);
	printf("    queue_type_sched:       %i\n", dma_capa.queue_type_sched);
	printf("    queue_type_plain:       %i\n", dma_capa.queue_type_plain);
	printf("    pool.max_pools:         %u\n", dma_capa.pool.max_pools);
	printf("    pool.max_num:           %u\n", dma_capa.pool.max_num);
	printf("    pool.max_uarea_size:    %u B\n", dma_capa.pool.max_uarea_size);
	printf("    pool.uarea_persistence: %u\n", dma_capa.pool.uarea_persistence);
	printf("    pool.min_cache_size:    %u\n", dma_capa.pool.min_cache_size);
	printf("    pool.max_cache_size:    %u\n", dma_capa.pool.max_cache_size);

	printf("\n");
	printf("  QUEUE\n");
	printf("    max queues:           %u\n", queue_capa.max_queues);
	printf("    plain.max_num:        %u\n", queue_capa.plain.max_num);
	printf("    plain.max_size:       %u\n", queue_capa.plain.max_size);
	printf("    plain.lf.max_num:     %u\n", queue_capa.plain.lockfree.max_num);
	printf("    plain.lf.max_size:    %u\n", queue_capa.plain.lockfree.max_size);
	printf("    plain.wf.max_num:     %u\n", queue_capa.plain.waitfree.max_num);
	printf("    plain.wf.max_size:    %u\n", queue_capa.plain.waitfree.max_size);

	printf("\n");
	printf("  SCHEDULER\n");
	printf("    max_ordered_locks:    %u\n", schedule_capa.max_ordered_locks);
	printf("    max_groups:           %u\n", schedule_capa.max_groups);
	printf("    max_prios:            %u\n", schedule_capa.max_prios);
	printf("    max_queues:           %u\n", schedule_capa.max_queues);
	printf("    max_queue_size:       %u\n", schedule_capa.max_queue_size);
	printf("    max_flow_id:          %u\n", schedule_capa.max_flow_id);
	printf("    lockfree_queues:      %s\n", support_level(schedule_capa.lockfree_queues));
	printf("    waitfree_queues:      %s\n", support_level(schedule_capa.waitfree_queues));
	printf("    order_wait:           %s\n", support_level(schedule_capa.order_wait));

	printf("\n");
	printf("  STASH\n");
	printf("    max_stashes_any_type: %u\n", stash_capa.max_stashes_any_type);
	printf("    max_stashes:          %u\n", stash_capa.max_stashes);
	printf("    max_num_obj:          %" PRIu64 "\n", stash_capa.max_num_obj);
	printf("    max_num.u8:           %" PRIu64 "\n", stash_capa.max_num.u8);
	printf("    max_num.u16:          %" PRIu64 "\n", stash_capa.max_num.u16);
	printf("    max_num.u32:          %" PRIu64 "\n", stash_capa.max_num.u32);
	printf("    max_num.u64:          %" PRIu64 "\n", stash_capa.max_num.u64);
	printf("    max_num.u128:         %" PRIu64 "\n", stash_capa.max_num.u128);
	printf("    max_num.max_obj_size: %" PRIu64 "\n", stash_capa.max_num.max_obj_size);
	printf("    max_obj_size:         %u B\n", stash_capa.max_obj_size);
	printf("    max_cache_size:       %u\n", stash_capa.max_cache_size);
	printf("    max_get_batch:        %u\n", stash_capa.max_get_batch);
	printf("    max_put_batch:        %u\n", stash_capa.max_put_batch);
	printf("    stats:                0x%" PRIx64 "\n", stash_capa.stats.all);

	print_timer_capa(&appl_args);

	if (crypto_ret == 0) {
		printf("\n");
		printf("  CRYPTO\n");
		printf("    max sessions:           %u\n", crypto_capa.max_sessions);
		printf("    sync mode support:      %s\n", support_level(crypto_capa.sync_mode));
		printf("    async mode support:     %s\n", support_level(crypto_capa.async_mode));
		printf("    queue_type_sched:       %i\n", crypto_capa.queue_type_sched);
		printf("    queue_type_plain:       %i\n", crypto_capa.queue_type_plain);
		printf("    cipher algorithms:      ");
		foreach_cipher(crypto_capa.ciphers, print_cipher);
		printf("\n");
		foreach_cipher(crypto_capa.ciphers, print_cipher_capa);
		printf("    cipher algorithms (HW): ");
		foreach_cipher(crypto_capa.hw_ciphers, print_cipher);
		printf("\n");
		foreach_cipher(crypto_capa.hw_ciphers, print_cipher_capa);
		printf("    auth algorithms:        ");
		foreach_auth(crypto_capa.auths, print_auth);
		printf("\n");
		foreach_auth(crypto_capa.auths, print_auth_capa);
		printf("    auth algorithms (HW):   ");
		foreach_auth(crypto_capa.hw_auths, print_auth);
		printf("\n");
		foreach_auth(crypto_capa.hw_auths, print_auth_capa);
	}

	if (ipsec_ret == 0) {
		printf("\n");
		printf("  IPSEC\n");
		printf("    max SAs:                      %u\n", ipsec_capa.max_num_sa);
		printf("    sync mode support:            %s\n",
		       support_level(ipsec_capa.op_mode_sync));
		printf("    async mode support:           %s\n",
		       support_level(ipsec_capa.op_mode_async));
		printf("    inline inbound mode support:  %s\n",
		       support_level(ipsec_capa.op_mode_inline_in));
		printf("    inline outbound mode support: %s\n",
		       support_level(ipsec_capa.op_mode_inline_out));
		printf("    AH support:                   %s\n",
		       support_level(ipsec_capa.proto_ah));
		printf("    post-IPsec fragmentation:     %s\n",
		       support_level(ipsec_capa.frag_after));
		printf("    pre-IPsec fragmentation:      %s\n",
		       support_level(ipsec_capa.frag_before));
		printf("    post-IPsec classification:    %s\n",
		       support_level(ipsec_capa.pipeline_cls));
		printf("    retaining outer headers:      %s\n",
		       support_level(ipsec_capa.retain_header));
		printf("    inbound checksum offload support:\n");
		printf("      IPv4 header checksum:       %s\n",
		       support_level(ipsec_capa.chksums_in.chksum.ipv4));
		printf("      UDP checksum:               %s\n",
		       support_level(ipsec_capa.chksums_in.chksum.udp));
		printf("      TCP checksum:               %s\n",
		       support_level(ipsec_capa.chksums_in.chksum.tcp));
		printf("      SCTP checksum:              %s\n",
		       support_level(ipsec_capa.chksums_in.chksum.sctp));
		printf("    max destination CoSes:        %u\n", ipsec_capa.max_cls_cos);
		printf("    max destination queues:       %u\n", ipsec_capa.max_queues);
		printf("    queue_type_sched:             %i\n", ipsec_capa.queue_type_sched);
		printf("    queue_type_plain:             %i\n", ipsec_capa.queue_type_plain);
		printf("    vector support:               %s\n",
		       support_level(ipsec_capa.vector.supported));
		printf("      min_size:                   %u\n", ipsec_capa.vector.min_size);
		printf("      max_size:                   %u\n", ipsec_capa.vector.max_size);
		printf("      min_tmo_ns:                 %" PRIu64 " ns\n",
		       ipsec_capa.vector.min_tmo_ns);
		printf("      max_tmo_ns:                 %" PRIu64 " ns\n",
		       ipsec_capa.vector.max_tmo_ns);
		printf("    max anti-replay window size:  %u\n",
		       ipsec_capa.max_antireplay_ws);
		printf("    inline TM pipelining:         %s\n",
		       support_level(ipsec_capa.inline_ipsec_tm));
		printf("    testing capabilities:\n");
		printf("      sa_operations.seq_num:      %i\n",
		       ipsec_capa.test.sa_operations.seq_num);
		printf("      sa_operations.antireplay_window_top: %i\n",
		       ipsec_capa.test.sa_operations.antireplay_window_top);
		printf("    post-IPsec reassembly support:\n");
		printf("      ip:                         %i\n", ipsec_capa.reassembly.ip);
		printf("      ipv4:                       %i\n", ipsec_capa.reassembly.ipv4);
		printf("      ipv6:                       %i\n", ipsec_capa.reassembly.ipv6);
		printf("      max_wait_time:              %" PRIu64 "\n",
		       ipsec_capa.reassembly.max_wait_time);
		printf("      max_num_frags:              %" PRIu16 "\n",
		       ipsec_capa.reassembly.max_num_frags);
		printf("    reass_async:                  %i\n", ipsec_capa.reass_async);
		printf("    reass_inline:                 %i\n", ipsec_capa.reass_inline);
		printf("    cipher algorithms:            ");
		foreach_cipher(ipsec_capa.ciphers, print_cipher);
		printf("\n");
		printf("    auth algorithms:              ");
		foreach_auth(ipsec_capa.auths, print_auth);
		printf("\n");
	}

	printf("\n");
	printf("  SHM MEMORY BLOCKS:\n");
	odp_shm_print_all();

	printf("\n");
	printf("***********************************************************\n");
	printf("\n");

	if (odp_term_local()) {
		ODPH_ERR("Local term failed.\n");
		exit(EXIT_FAILURE);
	}

	if (odp_term_global(inst)) {
		ODPH_ERR("Global term failed.\n");
		exit(EXIT_FAILURE);
	}

	return EXIT_SUCCESS;
}