summaryrefslogtreecommitdiffstats
path: root/sys/contrib/ncsw/inc/Peripherals/fm_pcd_ext.h
blob: 6de21e7369607a05623822b630c7e905a992dbc0 (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
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Freescale Semiconductor nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 *
 * ALTERNATIVELY, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") as published by the Free Software
 * Foundation, either version 2 of that License or (at your option) any
 * later version.
 *
 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**************************************************************************//**
 @File          fm_pcd_ext.h

 @Description   FM PCD ...
*//***************************************************************************/
#ifndef __FM_PCD_EXT
#define __FM_PCD_EXT

#include "std_ext.h"
#include "net_ext.h"
#include "list_ext.h"
#include "fm_ext.h"


/**************************************************************************//**

 @Group         FM_grp Frame Manager API

 @Description   FM API functions, definitions and enums

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Group         FM_PCD_grp FM PCD

 @Description   FM PCD API functions, definitions and enums

                The FM PCD module is responsible for the initialization of all
                global classifying FM modules. This includes the parser general and
                common registers, the key generator global and common registers,
                and the Policer global and common registers.
                In addition, the FM PCD SW module will initialize all required
                key generator schemes, coarse classification flows, and Policer
                profiles. When An FM module is configured to work with one of these
                entities, it will register to it using the FM PORT API. The PCD
                module will manage the PCD resources - i.e. resource management of
                Keygen schemes, etc.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Collection    General PCD defines
*//***************************************************************************/
typedef uint32_t fmPcdEngines_t; /**< options as defined below: */

#define FM_PCD_NONE                                 0                   /**< No PCD Engine indicated */
#define FM_PCD_PRS                                  0x80000000          /**< Parser indicated */
#define FM_PCD_KG                                   0x40000000          /**< Keygen indicated */
#define FM_PCD_CC                                   0x20000000          /**< Coarse classification indicated */
#define FM_PCD_PLCR                                 0x10000000          /**< Policer indicated */
#define FM_PCD_MANIP                                0x08000000          /**< Manipulation indicated */

#define FM_PCD_MAX_NUM_OF_PRIVATE_HDRS              2                   /**< Number of units/headers saved for user */

#define FM_PCD_PRS_NUM_OF_HDRS                      16                  /**< Number of headers supported by HW parser */
#define FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS         (32 - FM_PCD_MAX_NUM_OF_PRIVATE_HDRS)
                                                                        /**< number of distinction units is limited by
                                                                             register size (32), - reserved bits for
                                                                             private headers. */

#define FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS      4                   /**< Maximum number of interchangeable headers in a distinction unit */
#define FM_PCD_KG_NUM_OF_GENERIC_REGS               8                   /**< Total number of generic KG registers */
#define FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY       35                  /**< Max number allowed on any configuration.
                                                                             For reason of HW implementation, in most
                                                                             cases less than this will be allowed. The
                                                                             driver will return error in initialization
                                                                             time if resource is overused. */
#define FM_PCD_KG_NUM_OF_EXTRACT_MASKS              4                   /**< Total number of masks allowed on KG extractions. */
#define FM_PCD_KG_NUM_OF_DEFAULT_GROUPS             16                  /**< Number of default value logical groups */

#define FM_PCD_PRS_NUM_OF_LABELS                    32                  /**< Max number of SW parser label */
#define FM_PCD_SW_PRS_SIZE                          0x00000800          /**< Total size of sw parser area */
#define FM_PCD_PRS_SW_OFFSET                        0x00000040          /**< Size of illegal addresses at the beginning
                                                                             of the SW parser area */
#define FM_PCD_PRS_SW_PATCHES_SIZE                  0x00000200          /**< Number of bytes saved for patches */
#define FM_PCD_PRS_SW_TAIL_SIZE                     4                   /**< Number of bytes that must be cleared at
                                                                             the end of the SW parser area */
#define FM_SW_PRS_MAX_IMAGE_SIZE                    (FM_PCD_SW_PRS_SIZE-FM_PCD_PRS_SW_OFFSET-FM_PCD_PRS_SW_TAIL_SIZE-FM_PCD_PRS_SW_PATCHES_SIZE)
                                                                        /**< Max possible size of SW parser code */

#define FM_PCD_MAX_MANIP_INSRT_TEMPLATE_SIZE        128                 /**< Max possible size of insertion template for
                                                                             insert manipulation*/
/* @} */


/**************************************************************************//**
 @Group         FM_PCD_init_grp FM PCD Initialization Unit

 @Description   FM PCD Initialization Unit

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Description   PCD counters
*//***************************************************************************/
typedef enum e_FmPcdCounters {
    e_FM_PCD_KG_COUNTERS_TOTAL,                                 /**< Policer counter */
    e_FM_PCD_PLCR_COUNTERS_YELLOW,                              /**< Policer counter */
    e_FM_PCD_PLCR_COUNTERS_RED,                                 /**< Policer counter */
    e_FM_PCD_PLCR_COUNTERS_RECOLORED_TO_RED,                    /**< Policer counter */
    e_FM_PCD_PLCR_COUNTERS_RECOLORED_TO_YELLOW,                 /**< Policer counter */
    e_FM_PCD_PLCR_COUNTERS_TOTAL,                               /**< Policer counter */
    e_FM_PCD_PLCR_COUNTERS_LENGTH_MISMATCH,                     /**< Policer counter */
    e_FM_PCD_PRS_COUNTERS_PARSE_DISPATCH,                       /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_L2_PARSE_RESULT_RETURNED,             /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_L3_PARSE_RESULT_RETURNED,             /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_L4_PARSE_RESULT_RETURNED,             /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_SHIM_PARSE_RESULT_RETURNED,           /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_L2_PARSE_RESULT_RETURNED_WITH_ERR,    /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_L3_PARSE_RESULT_RETURNED_WITH_ERR,    /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_L4_PARSE_RESULT_RETURNED_WITH_ERR,    /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_SHIM_PARSE_RESULT_RETURNED_WITH_ERR,  /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_SOFT_PRS_CYCLES,                      /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_SOFT_PRS_STALL_CYCLES,                /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_HARD_PRS_CYCLE_INCL_STALL_CYCLES,     /**< Parser counter */
    e_FM_PCD_PRS_COUNTERS_MURAM_READ_CYCLES,                    /**< MURAM counter */
    e_FM_PCD_PRS_COUNTERS_MURAM_READ_STALL_CYCLES,              /**< MURAM counter */
    e_FM_PCD_PRS_COUNTERS_MURAM_WRITE_CYCLES,                   /**< MURAM counter */
    e_FM_PCD_PRS_COUNTERS_MURAM_WRITE_STALL_CYCLES,             /**< MURAM counter */
    e_FM_PCD_PRS_COUNTERS_FPM_COMMAND_STALL_CYCLES              /**< FPM counter */
} e_FmPcdCounters;

/**************************************************************************//**
 @Description   PCD interrupts
*//***************************************************************************/
typedef enum e_FmPcdExceptions {
    e_FM_PCD_KG_EXCEPTION_DOUBLE_ECC,                   /**< Keygen ECC error */
    e_FM_PCD_PLCR_EXCEPTION_DOUBLE_ECC,                 /**< Read Buffer ECC error */
    e_FM_PCD_KG_EXCEPTION_KEYSIZE_OVERFLOW,             /**< Write Buffer ECC error on system side */
    e_FM_PCD_PLCR_EXCEPTION_INIT_ENTRY_ERROR,           /**< Write Buffer ECC error on FM side */
    e_FM_PCD_PLCR_EXCEPTION_PRAM_SELF_INIT_COMPLETE,    /**< Self init complete */
    e_FM_PCD_PLCR_EXCEPTION_ATOMIC_ACTION_COMPLETE,     /**< Atomic action complete */
    e_FM_PCD_PRS_EXCEPTION_DOUBLE_ECC,                  /**< Parser ECC error */
    e_FM_PCD_PRS_EXCEPTION_SINGLE_ECC                   /**< Parser single ECC */
} e_FmPcdExceptions;


/**************************************************************************//**
 @Description   Exceptions user callback routine, will be called upon an
                exception passing the exception identification.

 @Param[in]     h_App      - User's application descriptor.
 @Param[in]     exception  - The exception.
  *//***************************************************************************/
typedef void (t_FmPcdExceptionCallback) (t_Handle h_App, e_FmPcdExceptions exception);

/**************************************************************************//**
 @Description   Exceptions user callback routine, will be called upon an exception
                passing the exception identification.

 @Param[in]     h_App           - User's application descriptor.
 @Param[in]     exception       - The exception.
 @Param[in]     index           - id of the relevant source (may be scheme or profile id).
 *//***************************************************************************/
typedef void (t_FmPcdIdExceptionCallback) ( t_Handle           h_App,
                                            e_FmPcdExceptions  exception,
                                            uint16_t           index);

/**************************************************************************//**
 @Description   A callback for enqueuing frame onto a QM queue.

 @Param[in]     h_App           - User's application descriptor.
 @Param[in]     p_Fd            - Frame descriptor for the frame.

 @Return        E_OK on success; Error code otherwise.
 *//***************************************************************************/
typedef t_Error (t_FmPcdQmEnqueueCallback) (t_Handle h_QmArg, void *p_Fd);

/**************************************************************************//**
 @Description   A structure for Host-Command
                When using Host command for PCD functionalities, a dedicated port
                must be used. If this routine is called for a PCD in a single partition
                environment, or it is the Master partition in a Multi partition
                environment, The port will be initialized by the PCD driver
                initialization routine.
 *//***************************************************************************/
typedef struct t_FmPcdHcParams {
    uintptr_t                   portBaseAddr;       /**< Host-Command Port Virtual Address of
                                                         memory mapped registers.*/
    uint8_t                     portId;             /**< Host-Command Port Id (0-6 relative
                                                         to Host-Command/Offline parsing ports) */
    uint16_t                    liodnBase;          /**< Irrelevant for P4080 rev 1. LIODN base for this port, to be
                                                         used together with LIODN offset. */
    uint32_t                    errFqid;            /**< Host-Command Port Error Queue Id. */
    uint32_t                    confFqid;           /**< Host-Command Port Confirmation queue Id. */
    uint32_t                    qmChannel;          /**< Host-Command port - QM-channel dedicated to
                                                         this port will be used by the FM for dequeue. */
    t_FmPcdQmEnqueueCallback    *f_QmEnqueue;       /**< Call back routine for enqueuing a frame to the QM */
    t_Handle                    h_QmArg;            /**< A handle of the QM module */
} t_FmPcdHcParams;

/**************************************************************************//**
 @Description   The main structure for PCD initialization
 *//***************************************************************************/
typedef struct t_FmPcdParams {
    bool                        prsSupport;             /**< TRUE if Parser will be used for any
                                                             of the FM ports */
    bool                        ccSupport;              /**< TRUE if Coarse Classification will be used for any
                                                             of the FM ports */
    bool                        kgSupport;              /**< TRUE if Keygen will be used for any
                                                             of the FM ports */
    bool                        plcrSupport;            /**< TRUE if Policer will be used for any
                                                             of the FM ports */
    t_Handle                    h_Fm;                   /**< A handle to the FM module */
    uint8_t                     numOfSchemes;           /**< Number of schemes dedicated to this partition. */
    bool                        useHostCommand;         /**< Optional for single partition, Mandatory for Multi partition */
    t_FmPcdHcParams             hc;                     /**< Relevant only if useHostCommand=TRUE.
                                                             Host Command parameters. */

    t_FmPcdExceptionCallback    *f_Exception;           /**< Relevant for master (or single) partition only: Callback routine
                                                             to be called of PCD exception */
    t_FmPcdIdExceptionCallback  *f_ExceptionId;         /**< Relevant for master (or single) partition only: Callback routine
                                                             to be used for a single scheme and
                                                             profile exceptions */
    t_Handle                    h_App;                  /**< Relevant for master (or single) partition only: A handle to an
                                                             application layer object; This handle will
                                                             be passed by the driver upon calling the above callbacks */
} t_FmPcdParams;


/**************************************************************************//**
 @Function      FM_PCD_Config

 @Description   Basic configuration of the PCD module.
                Creates descriptor for the FM PCD module.

 @Param[in]     p_FmPcdParams    A structure of parameters for the initialization of PCD.

 @Return        A handle to the initialized module.
*//***************************************************************************/
t_Handle FM_PCD_Config(t_FmPcdParams *p_FmPcdParams);

/**************************************************************************//**
 @Function      FM_PCD_Init

 @Description   Initialization of the PCD module.

 @Param[in]     h_FmPcd - FM PCD module descriptor.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_PCD_Init(t_Handle h_FmPcd);

/**************************************************************************//**
 @Function      FM_PCD_Free

 @Description   Frees all resources that were assigned to FM module.

                Calling this routine invalidates the descriptor.

 @Param[in]     h_FmPcd - FM PCD module descriptor.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_PCD_Free(t_Handle h_FmPcd);

/**************************************************************************//**
 @Group         FM_PCD_advanced_init_grp    FM PCD Advanced Configuration Unit

 @Description   Configuration functions used to change default values.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Function      FM_PCD_ConfigPlcrNumOfSharedProfiles

 @Description   Calling this routine changes the internal driver data base
                from its default selection of exceptions enablement.
                [4].

 @Param[in]     h_FmPcd                     FM PCD module descriptor.
 @Param[in]     numOfSharedPlcrProfiles     Number of profiles to
                                            be shared between ports on this partition

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_PCD_ConfigPlcrNumOfSharedProfiles(t_Handle h_FmPcd, uint16_t numOfSharedPlcrProfiles);

/**************************************************************************//**
 @Function      FM_PCD_ConfigException

 @Description   Calling this routine changes the internal driver data base
                from its default selection of exceptions enablement.
                By default all exceptions are enabled.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     exception       The exception to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_ConfigException(t_Handle h_FmPcd, e_FmPcdExceptions exception, bool enable);

/**************************************************************************//**
 @Function      FM_PCD_ConfigPlcrAutoRefreshMode

 @Description   Calling this routine changes the internal driver data base
                from its default selection of exceptions enablement.
                By default autorefresh is enabled.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     enable          TRUE to enable, FALSE to disable

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_ConfigPlcrAutoRefreshMode(t_Handle h_FmPcd, bool enable);

/**************************************************************************//**
 @Function      FM_PCD_ConfigPrsMaxCycleLimit

 @Description   Calling this routine changes the internal data structure for
                the maximum parsing time from its default value
                [0].

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     value           0 to disable the mechanism, or new
                                maximum parsing time.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_ConfigPrsMaxCycleLimit(t_Handle h_FmPcd,uint16_t value);

/** @} */ /* end of FM_PCD_advanced_init_grp group */
/** @} */ /* end of FM_PCD_init_grp group */


/**************************************************************************//**
 @Group         FM_PCD_Runtime_grp FM PCD Runtime Unit

 @Description   FM PCD Runtime Unit

                The runtime control allows creation of PCD infrastructure modules
                such as Network Environment Characteristics, Classification Plan
                Groups and Coarse Classification Trees.
                It also allows on-the-fly initialization, modification and removal
                of PCD modules such as Keygen schemes, coarse classification nodes
                and Policer profiles.


                In order to explain the programming model of the PCD driver interface
                a few terms should be explained, and will be used below.
                  * Distinction Header - One of the 16 protocols supported by the FM parser,
                    or one of the shim headers (1 or 2). May be a header with a special
                    option (see below).
                  * Interchangeable Headers Group- This is a group of Headers recognized
                    by either one of them. For example, if in a specific context the user
                    chooses to treat IPv4 and IPV6 in the same way, they may create an
                    interchangeable Headers Unit consisting of these 2 headers.
                  * A Distinction Unit - a Distinction Header or an Interchangeable Headers
                    Group.
                  * Header with special option - applies to ethernet, mpls, vlan, ipv4 and
                    ipv6, includes multicast, broadcast and other protocol specific options.
                    In terms of hardware it relates to the options available in the classification
                    plan.
                  * Network Environment Characteristics - a set of Distinction Units that define
                    the total recognizable header selection for a certain environment. This is
                    NOT the list of all headers that will ever appear in a flow, but rather
                    everything that needs distinction in a flow, where distinction is made by keygen
                    schemes and coarse classification action descriptors.

                The PCD runtime modules initialization is done in stages. The first stage after
                initializing the PCD module itself is to establish a Network Flows Environment
                Definition. The application may choose to establish one or more such environments.
                Later, when needed, the application will have to state, for some of its modules,
                to which single environment it belongs.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Description   A structure for sw parser labels
 *//***************************************************************************/
typedef struct t_FmPcdPrsLabelParams {
    uint32_t                instructionOffset;              /**< SW parser label instruction offset (2 bytes
                                                                 resolution), relative to Parser RAM. */
    e_NetHeaderType         hdr;                            /**< The existance of this header will envoke
                                                                 the sw parser code. */
    uint8_t                 indexPerHdr;                    /**< Normally 0, if more than one sw parser
                                                                 attachments for the same header, use this
                                                                 index to distinguish between them. */
} t_FmPcdPrsLabelParams;

/**************************************************************************//**
 @Description   A structure for sw parser
 *//***************************************************************************/
typedef struct t_FmPcdPrsSwParams {
    bool                    override;                   /**< FALSE to invoke a check that nothing else
                                                             was loaded to this address, including
                                                             internal patches.
                                                             TRUE to override any existing code.*/
    uint32_t                size;                       /**< SW parser code size */
    uint16_t                base;                       /**< SW parser base (in instruction counts!
                                                             must be larger than 0x20)*/
    uint8_t                 *p_Code;                    /**< SW parser code */
    uint32_t                swPrsDataParams[FM_PCD_PRS_NUM_OF_HDRS];
                                                        /**< SW parser data (parameters) */
    uint8_t                 numOfLabels;                /**< Number of labels for SW parser. */
    t_FmPcdPrsLabelParams   labelsTable[FM_PCD_PRS_NUM_OF_LABELS];
                                                        /**< SW parser labels table, containing
                                                             numOfLabels entries */
} t_FmPcdPrsSwParams;


/**************************************************************************//**
 @Function      FM_PCD_Enable

 @Description   This routine should be called after PCD is initialized for enabling all
                PCD engines according to their existing configuration.

 @Param[in]     h_FmPcd         FM PCD module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
*//***************************************************************************/
t_Error FM_PCD_Enable(t_Handle h_FmPcd);

/**************************************************************************//**
 @Function      FM_PCD_Disable

 @Description   This routine may be called when PCD is enabled in order to
                disable all PCD engines. It may be called
                only when none of the ports in the system are using the PCD.

 @Param[in]     h_FmPcd         FM PCD module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init() and when PCD is enabled.
*//***************************************************************************/
t_Error FM_PCD_Disable(t_Handle h_FmPcd);


/**************************************************************************//**
 @Function      FM_PCD_GetCounter

 @Description   Reads one of the FM PCD counters.

 @Param[in]     h_FmPcd     FM PCD module descriptor.
 @Param[in]     counter     The requested counter.

 @Return        Counter's current value.

 @Cautions      Allowed only following FM_PCD_Init().
                Note that it is user's responsibility to call this routine only
                for enabled counters, and there will be no indication if a
                disabled counter is accessed.
*//***************************************************************************/
uint32_t FM_PCD_GetCounter(t_Handle h_FmPcd, e_FmPcdCounters counter);

/**************************************************************************//**
@Function      FM_PCD_PrsLoadSw

@Description   This routine may be called in order to load software parsing code.


@Param[in]     h_FmPcd         FM PCD module descriptor.
@Param[in]     p_SwPrs         A pointer to a structure of software
                               parser parameters, including the software
                               parser image.

@Return        E_OK on success; Error code otherwise.

@Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
               Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_PrsLoadSw(t_Handle h_FmPcd, t_FmPcdPrsSwParams *p_SwPrs);

/**************************************************************************//**
 @Function      FM_PCD_KgSetDfltValue

 @Description   Calling this routine sets a global default value to be used
                by the keygen when parser does not recognize a required
                field/header.
                By default default values are 0.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     valueId         0,1 - one of 2 global default values.
 @Param[in]     value           The requested default value.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
                Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_KgSetDfltValue(t_Handle h_FmPcd, uint8_t valueId, uint32_t value);

/**************************************************************************//**
 @Function      FM_PCD_KgSetAdditionalDataAfterParsing

 @Description   Calling this routine allows the keygen to access data past
                the parser finishing point.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     payloadOffset   the number of bytes beyond the parser location.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init() and when PCD is disabled.
                Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_KgSetAdditionalDataAfterParsing(t_Handle h_FmPcd, uint8_t payloadOffset);

/**************************************************************************//**
 @Function      FM_PCD_SetException

 @Description   Calling this routine enables/disables PCD interrupts.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     exception       The exception to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
                Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_SetException(t_Handle h_FmPcd, e_FmPcdExceptions exception, bool enable);

/**************************************************************************//**
 @Function      FM_PCD_ModifyCounter

 @Description   Sets a value to an enabled counter. Use "0" to reset the counter.

 @Param[in]     h_FmPcd     FM PCD module descriptor.
 @Param[in]     counter     The requested counter.
 @Param[in]     value       The requested value to be written into the counter.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
                Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_ModifyCounter(t_Handle h_FmPcd, e_FmPcdCounters counter, uint32_t value);

/**************************************************************************//**
 @Function      FM_PCD_SetPlcrStatistics

 @Description   This routine may be used to enable/disable policer statistics
                counter. By default the statistics is enabled.

 @Param[in]     h_FmPcd         FM PCD module descriptor
 @Param[in]     enable          TRUE to enable, FALSE to disable.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
                Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_SetPlcrStatistics(t_Handle h_FmPcd, bool enable);

/**************************************************************************//**
 @Function      FM_PCD_SetPrsStatistics

 @Description   Defines whether to gather parser statistics including all ports.

 @Param[in]     h_FmPcd     FM PCD module descriptor.
 @Param[in]     enable      TRUE to enable, FALSE to disable.

 @Return        None

 @Cautions      Allowed only following FM_PCD_Init().
                Not available for guest partition.
*//***************************************************************************/
void FM_PCD_SetPrsStatistics(t_Handle h_FmPcd, bool enable);

/**************************************************************************//**
 @Function      FM_PCD_ForceIntr

 @Description   Causes an interrupt event on the requested source.

 @Param[in]     h_FmPcd     FM PCD module descriptor.
 @Param[in]     exception       An exception to be forced.

 @Return        E_OK on success; Error code if the exception is not enabled,
                or is not able to create interrupt.

 @Cautions      Allowed only following FM_PCD_Init().
                Not available for guest partition.
*//***************************************************************************/
t_Error FM_PCD_ForceIntr (t_Handle h_FmPcd, e_FmPcdExceptions exception);

/**************************************************************************//**
 @Function      FM_PCD_HcTxConf

 @Description   This routine should be called to confirm frames that were
                 received on the HC confirmation queue.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     p_Fd            Frame descriptor of the received frame.

 @Cautions      Allowed only following FM_PCD_Init(). Allowed only if 'useHostCommand'
                option was selected in the initialization.
*//***************************************************************************/
void FM_PCD_HcTxConf(t_Handle h_FmPcd, t_DpaaFD *p_Fd);

#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
/**************************************************************************//**
 @Function      FM_PCD_DumpRegs

 @Description   Dumps all PCD registers

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_DumpRegs(t_Handle h_FmPcd);

/**************************************************************************//**
 @Function      FM_PCD_KgDumpRegs

 @Description   Dumps all PCD KG registers

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_KgDumpRegs(t_Handle h_FmPcd);

/**************************************************************************//**
 @Function      FM_PCD_PlcrDumpRegs

 @Description   Dumps all PCD Plcr registers

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_PlcrDumpRegs(t_Handle h_FmPcd);

/**************************************************************************//**
 @Function      FM_PCD_PlcrProfileDumpRegs

 @Description   Dumps all PCD Plcr registers

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_Profile       A handle to a profile.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_PlcrProfileDumpRegs(t_Handle h_FmPcd, t_Handle h_Profile);

/**************************************************************************//**
 @Function      FM_PCD_PrsDumpRegs

 @Description   Dumps all PCD Prs registers

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_PrsDumpRegs(t_Handle h_FmPcd);

/**************************************************************************//**
 @Function      FM_PCD_HcDumpRegs

 @Description   Dumps HC Port registers

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error     FM_PCD_HcDumpRegs(t_Handle h_FmPcd);
#endif /* (defined(DEBUG_ERRORS) && ... */



/**************************************************************************//**
 @Group         FM_PCD_Runtime_tree_buildgrp FM PCD Tree building Unit

 @Description   FM PCD Runtime Unit

                This group contains routines for setting, deleting and modifying
                PCD resources, for defining the total PCD tree.
 @{
*//***************************************************************************/

/**************************************************************************//**
 @Collection    Definitions of coarse classification
                parameters as required by keygen (when coarse classification
                is the next engine after this scheme).
*//***************************************************************************/
#define FM_PCD_MAX_NUM_OF_CC_NODES          255
#define FM_PCD_MAX_NUM_OF_CC_TREES          8
#define FM_PCD_MAX_NUM_OF_CC_GROUPS         16
#define FM_PCD_MAX_NUM_OF_CC_UNITS          4
#define FM_PCD_MAX_NUM_OF_KEYS              256
#define FM_PCD_MAX_SIZE_OF_KEY              56
#define FM_PCD_MAX_NUM_OF_CC_ENTRIES_IN_GRP 16
/* @} */

/**************************************************************************//**
 @Collection    A set of definitions to allow protocol
                special option description.
*//***************************************************************************/
typedef uint32_t        protocolOpt_t;          /**< A general type to define a protocol option. */

typedef protocolOpt_t   ethProtocolOpt_t;       /**< Ethernet protocol options. */
#define ETH_BROADCAST               0x80000000  /**< Ethernet Broadcast. */
#define ETH_MULTICAST               0x40000000  /**< Ethernet Multicast. */

typedef protocolOpt_t   vlanProtocolOpt_t;      /**< Vlan protocol options. */
#define VLAN_STACKED                0x20000000  /**< Vlan Stacked. */

typedef protocolOpt_t   mplsProtocolOpt_t;      /**< MPLS protocol options. */
#define MPLS_STACKED                0x10000000  /**< MPLS Stacked. */

typedef protocolOpt_t   ipv4ProtocolOpt_t;      /**< IPv4 protocol options. */
#define IPV4_BROADCAST_1            0x08000000  /**< IPv4 Broadcast. */
#define IPV4_MULTICAST_1            0x04000000  /**< IPv4 Multicast. */
#define IPV4_UNICAST_2              0x02000000  /**< Tunneled IPv4 - Unicast. */
#define IPV4_MULTICAST_BROADCAST_2  0x01000000  /**< Tunneled IPv4 - Broadcast/Multicast. */

typedef protocolOpt_t   ipv6ProtocolOpt_t;      /**< IPv6 protocol options. */
#define IPV6_MULTICAST_1            0x00800000  /**< IPv6 Multicast. */
#define IPV6_UNICAST_2              0x00400000  /**< Tunneled IPv6 - Unicast. */
#define IPV6_MULTICAST_2            0x00200000  /**< Tunneled IPv6 - Multicast. */
/* @} */

/**************************************************************************//**
 @Description   A type used for returning the order of the key extraction.
                each value in this array represents the index of the extraction
                command as defined by the user in the initialization extraction array.
                The valid size of this array is the user define number of extractions
                required (also marked by the second '0' in this array).
*//***************************************************************************/
typedef    uint8_t    t_FmPcdKgKeyOrder [FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY];

/**************************************************************************//**
 @Description   All PCD engines
*//***************************************************************************/
typedef enum e_FmPcdEngine {
    e_FM_PCD_INVALID = 0,   /**< Invalid PCD engine indicated*/
    e_FM_PCD_DONE,          /**< No PCD Engine indicated */
    e_FM_PCD_KG,            /**< Keygen indicated */
    e_FM_PCD_CC,            /**< Coarse classification indicated */
    e_FM_PCD_PLCR,          /**< Policer indicated */
    e_FM_PCD_PRS            /**< Parser indicated */
} e_FmPcdEngine;

/**************************************************************************//**
 @Description   An enum for selecting extraction by header types
*//***************************************************************************/
typedef enum e_FmPcdExtractByHdrType {
    e_FM_PCD_EXTRACT_FROM_HDR,      /**< Extract bytes from header */
    e_FM_PCD_EXTRACT_FROM_FIELD,    /**< Extract bytes from header field */
    e_FM_PCD_EXTRACT_FULL_FIELD     /**< Extract a full field */
} e_FmPcdExtractByHdrType;

/**************************************************************************//**
 @Description   An enum for selecting extraction source
                (when it is not the header)
*//***************************************************************************/
typedef enum e_FmPcdExtractFrom {
    e_FM_PCD_EXTRACT_FROM_FRAME_START,          /**< KG & CC: Extract from beginning of frame */
    e_FM_PCD_EXTRACT_FROM_DFLT_VALUE,           /**< KG only: Extract from a default value */
    e_FM_PCD_EXTRACT_FROM_CURR_END_OF_PARSE,    /**< KG only: Extract from the point where parsing had finished */
    e_FM_PCD_EXTRACT_FROM_KEY,                  /**< CC only: Field where saved KEY */
    e_FM_PCD_EXTRACT_FROM_HASH,                 /**< CC only: Field where saved HASH */
    e_FM_PCD_EXTRACT_FROM_PARSE_RESULT,         /**< KG & CC: Extract from the parser result */
    e_FM_PCD_EXTRACT_FROM_ENQ_FQID,             /**< KG & CC: Extract from enqueue FQID */
    e_FM_PCD_EXTRACT_FROM_FLOW_ID               /**< CC only: Field where saved Dequeue FQID */
} e_FmPcdExtractFrom;

/**************************************************************************//**
 @Description   An enum for selecting extraction type
*//***************************************************************************/
typedef enum e_FmPcdExtractType {
    e_FM_PCD_EXTRACT_BY_HDR,                /**< Extract according to header */
    e_FM_PCD_EXTRACT_NON_HDR,               /**< Extract from data that is not the header */
    e_FM_PCD_KG_EXTRACT_PORT_PRIVATE_INFO   /**< Extract private info as specified by user */
} e_FmPcdExtractType;

/**************************************************************************//**
 @Description   An enum for selecting a default
*//***************************************************************************/
typedef enum e_FmPcdKgExtractDfltSelect {
    e_FM_PCD_KG_DFLT_GBL_0,          /**< Default selection is KG register 0 */
    e_FM_PCD_KG_DFLT_GBL_1,          /**< Default selection is KG register 1 */
    e_FM_PCD_KG_DFLT_PRIVATE_0,      /**< Default selection is a per scheme register 0 */
    e_FM_PCD_KG_DFLT_PRIVATE_1,      /**< Default selection is a per scheme register 1 */
    e_FM_PCD_KG_DFLT_ILLEGAL         /**< Illegal selection */
} e_FmPcdKgExtractDfltSelect;

/**************************************************************************//**
 @Description   An enum defining all default groups -
                each group shares a default value, one of 4 user
                initialized values.
*//***************************************************************************/
typedef enum e_FmPcdKgKnownFieldsDfltTypes {
    e_FM_PCD_KG_MAC_ADDR,               /**< MAC Address */
    e_FM_PCD_KG_TCI,                    /**< TCI field */
    e_FM_PCD_KG_ENET_TYPE,              /**< ENET Type */
    e_FM_PCD_KG_PPP_SESSION_ID,         /**< PPP Session id */
    e_FM_PCD_KG_PPP_PROTOCOL_ID,        /**< PPP Protocol id */
    e_FM_PCD_KG_MPLS_LABEL,             /**< MPLS label */
    e_FM_PCD_KG_IP_ADDR,                /**< IP addr */
    e_FM_PCD_KG_PROTOCOL_TYPE,          /**< Protocol type */
    e_FM_PCD_KG_IP_TOS_TC,              /**< TOS or TC */
    e_FM_PCD_KG_IPV6_FLOW_LABEL,        /**< IPV6 flow label */
    e_FM_PCD_KG_IPSEC_SPI,              /**< IPSEC SPI */
    e_FM_PCD_KG_L4_PORT,                /**< L4 Port */
    e_FM_PCD_KG_TCP_FLAG,               /**< TCP Flag */
    e_FM_PCD_KG_GENERIC_FROM_DATA,      /**< grouping implemented by sw,
                                             any data extraction that is not the full
                                             field described above  */
    e_FM_PCD_KG_GENERIC_FROM_DATA_NO_V, /**< grouping implemented by sw,
                                             any data extraction without validation */
    e_FM_PCD_KG_GENERIC_NOT_FROM_DATA   /**< grouping implemented by sw,
                                             extraction from parser result or
                                             direct use of default value  */
} e_FmPcdKgKnownFieldsDfltTypes;

/**************************************************************************//**
 @Description   enum for defining header index when headers may repeat
*//***************************************************************************/
typedef enum e_FmPcdHdrIndex {
    e_FM_PCD_HDR_INDEX_NONE = 0,        /**< used when multiple headers not used, also
                                             to specify regular IP (not tunneled). */
    e_FM_PCD_HDR_INDEX_1,               /**< may be used for VLAN, MPLS, tunneled IP */
    e_FM_PCD_HDR_INDEX_2,               /**< may be used for MPLS, tunneled IP */
    e_FM_PCD_HDR_INDEX_3,               /**< may be used for MPLS */
    e_FM_PCD_HDR_INDEX_LAST = 0xFF      /**< may be used for VLAN, MPLS */
} e_FmPcdHdrIndex;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile functional type
*//***************************************************************************/
typedef enum e_FmPcdProfileTypeSelection {
    e_FM_PCD_PLCR_PORT_PRIVATE,         /**< Port dedicated profile */
    e_FM_PCD_PLCR_SHARED                /**< Shared profile (shared within partition) */
} e_FmPcdProfileTypeSelection;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile algorithem
*//***************************************************************************/
typedef enum e_FmPcdPlcrAlgorithmSelection {
    e_FM_PCD_PLCR_PASS_THROUGH,         /**< Policer pass through */
    e_FM_PCD_PLCR_RFC_2698,             /**< Policer algorythm RFC 2698 */
    e_FM_PCD_PLCR_RFC_4115              /**< Policer algorythm RFC 4115 */
} e_FmPcdPlcrAlgorithmSelection;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile color mode
*//***************************************************************************/
typedef enum e_FmPcdPlcrColorMode {
    e_FM_PCD_PLCR_COLOR_BLIND,          /**< Color blind */
    e_FM_PCD_PLCR_COLOR_AWARE           /**< Color aware */
} e_FmPcdPlcrColorMode;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile color functional mode
*//***************************************************************************/
typedef enum e_FmPcdPlcrColor {
    e_FM_PCD_PLCR_GREEN,                /**< Green */
    e_FM_PCD_PLCR_YELLOW,               /**< Yellow */
    e_FM_PCD_PLCR_RED,                  /**< Red */
    e_FM_PCD_PLCR_OVERRIDE              /**< Color override */
} e_FmPcdPlcrColor;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile packet frame length selector
*//***************************************************************************/
typedef enum e_FmPcdPlcrFrameLengthSelect {
  e_FM_PCD_PLCR_L2_FRM_LEN,             /**< L2 frame length */
  e_FM_PCD_PLCR_L3_FRM_LEN,             /**< L3 frame length */
  e_FM_PCD_PLCR_L4_FRM_LEN,             /**< L4 frame length */
  e_FM_PCD_PLCR_FULL_FRM_LEN            /**< Full frame length */
} e_FmPcdPlcrFrameLengthSelect;

/**************************************************************************//**
 @Description   An enum for selecting rollback frame
*//***************************************************************************/
typedef enum e_FmPcdPlcrRollBackFrameSelect {
  e_FM_PCD_PLCR_ROLLBACK_L2_FRM_LEN,    /**< Rollback L2 frame length */
  e_FM_PCD_PLCR_ROLLBACK_FULL_FRM_LEN   /**< Rollback Full frame length */
} e_FmPcdPlcrRollBackFrameSelect;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile packet or byte mode
*//***************************************************************************/
typedef enum e_FmPcdPlcrRateMode {
    e_FM_PCD_PLCR_BYTE_MODE,            /**< Byte mode */
    e_FM_PCD_PLCR_PACKET_MODE           /**< Packet mode */
} e_FmPcdPlcrRateMode;

/**************************************************************************//**
 @Description   An enum for defining action of frame
*//***************************************************************************/
typedef enum e_FmPcdDoneAction {
    e_FM_PCD_ENQ_FRAME = 0,        /**< Enqueue frame */
    e_FM_PCD_DROP_FRAME            /**< Drop frame */
} e_FmPcdDoneAction;

/**************************************************************************//**
 @Description   A structure for selecting the policer counter
*//***************************************************************************/
typedef enum e_FmPcdPlcrProfileCounters {
    e_FM_PCD_PLCR_PROFILE_GREEN_PACKET_TOTAL_COUNTER,               /**< Green packets counter */
    e_FM_PCD_PLCR_PROFILE_YELLOW_PACKET_TOTAL_COUNTER,              /**< Yellow packets counter */
    e_FM_PCD_PLCR_PROFILE_RED_PACKET_TOTAL_COUNTER,                 /**< Red packets counter */
    e_FM_PCD_PLCR_PROFILE_RECOLOURED_YELLOW_PACKET_TOTAL_COUNTER,   /**< Recolored yellow packets counter */
    e_FM_PCD_PLCR_PROFILE_RECOLOURED_RED_PACKET_TOTAL_COUNTER       /**< Recolored red packets counter */
} e_FmPcdPlcrProfileCounters;

/**************************************************************************//**
 @Description   A structure for selecting action
*//***************************************************************************/
typedef enum e_FmPcdAction {
    e_FM_PCD_ACTION_NONE,                           /**< NONE  */
    e_FM_PCD_ACTION_EXACT_MATCH,                    /**< Exact match on the selected extraction*/
    e_FM_PCD_ACTION_INDEXED_LOOKUP                  /**< Indexed lookup on the selected extraction*/
} e_FmPcdAction;

#if defined(FM_CAPWAP_SUPPORT)
/**************************************************************************//**
 @Description   An enum for selecting type of insert manipulation
*//***************************************************************************/
typedef enum e_FmPcdManipInsrtType {
    e_FM_PCD_MANIP_INSRT_NONE = 0,                          /**< No insertion */
    e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_INT_FRAME_HDR,   /**< Insert internal frame header to start of frame */
    e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_TEMPLATE         /**< Insert template to start of frame*/
} e_FmPcdManipInsrtType;

/**************************************************************************//**
 @Description   An enum for selecting type of remove manipulation
*//***************************************************************************/
typedef enum e_FmPcdManipRmvParamsType {
    e_FM_PCD_MANIP_RMV_NONE = 0,                                        /**< No remove */
    e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_TILL_SPECIFIC_LOCATION,      /**< Remove from start of frame till (excluding) specified indication */
    e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_INCLUDE_SPECIFIC_LOCATION,   /**< Remove from start of frame till (including) specified indication */
    e_FM_PCD_MANIP_RMV_INT_FRAME_HDR                                    /**< Remove internal frame header to start of frame */
} e_FmPcdManipRmvParamsType;

/**************************************************************************//**
 @Description   An enum for selecting type of location
*//***************************************************************************/
typedef enum e_FmPcdManipLocateType {
    e_FM_PCD_MANIP_LOC_BY_HDR = 0,            /**< Locate according to header */
    e_FM_PCD_MANIP_LOC_NON_HDR                /**< Locate from data that is not the header */
} e_FmPcdManipLocateType;

/**************************************************************************//**
 @Description   An enum for selecting type of Timeout mode
*//***************************************************************************/
typedef enum e_FmPcdManipReassemTimeOutMode {
    e_FM_PCD_MANIP_TIME_OUT_BETWEEN_FRAMES, /**< limits the time of the reassm process from the first frag to the last */
    e_FM_PCD_MANIP_TIME_OUT_BETWEEN_FRAG    /**< limits the time of receiving the fragment */
} e_FmPcdManipReassemTimeOutMode;

/**************************************************************************//**
 @Description   An enum for selecting type of WaysNumber mode
*//***************************************************************************/
typedef enum e_FmPcdManipReassemWaysNumber {
    e_FM_PCD_MANIP_ONE_WAY_HASH = 1,    /**< -------------- */
    e_FM_PCD_MANIP_TWO_WAYS_HASH,       /**< -------------- */
    e_FM_PCD_MANIP_THREE_WAYS_HASH,     /**< -------------- */
    e_FM_PCD_MANIP_FOUR_WAYS_HASH,      /**< four ways hash */
    e_FM_PCD_MANIP_FIVE_WAYS_HASH,      /**< -------------- */
    e_FM_PCD_MANIP_SIX_WAYS_HASH,       /**< -------------- */
    e_FM_PCD_MANIP_SEVEN_WAYS_HASH,     /**< -------------- */
    e_FM_PCD_MANIP_EIGHT_WAYS_HASH      /**< eight ways hash*/
} e_FmPcdManipReassemWaysNumber;

/**************************************************************************//**
 @Description   An enum for selecting type of statistics mode
*//***************************************************************************/
typedef enum e_FmPcdStatsType {
    e_FM_PCD_STATS_PER_FLOWID = 0   /**< type where flowId used as index for getting statistics */
} e_FmPcdStatsType;

#endif /* FM_CAPWAP_SUPPORT */


/**************************************************************************//**
 @Description   A Union of protocol dependent special options
*//***************************************************************************/
typedef union u_FmPcdHdrProtocolOpt {
    ethProtocolOpt_t    ethOpt;     /**< Ethernet options */
    vlanProtocolOpt_t   vlanOpt;    /**< Vlan options */
    mplsProtocolOpt_t   mplsOpt;    /**< MPLS options */
    ipv4ProtocolOpt_t   ipv4Opt;    /**< IPv4 options */
    ipv6ProtocolOpt_t   ipv6Opt;    /**< IPv6 options */
} u_FmPcdHdrProtocolOpt;

/**************************************************************************//**
 @Description   A union holding all known protocol fields
*//***************************************************************************/
typedef union t_FmPcdFields {
    headerFieldEth_t            eth;            /**< eth      */
    headerFieldVlan_t           vlan;           /**< vlan     */
    headerFieldLlcSnap_t        llcSnap;        /**< llcSnap  */
    headerFieldPppoe_t          pppoe;          /**< pppoe    */
    headerFieldMpls_t           mpls;           /**< mpls     */
    headerFieldIpv4_t           ipv4;           /**< ipv4     */
    headerFieldIpv6_t           ipv6;           /**< ipv6     */
    headerFieldUdp_t            udp;            /**< udp      */
    headerFieldTcp_t            tcp;            /**< tcp      */
    headerFieldSctp_t           sctp;           /**< sctp     */
    headerFieldDccp_t           dccp;           /**< dccp     */
    headerFieldGre_t            gre;            /**< gre      */
    headerFieldMinencap_t       minencap;       /**< minencap */
    headerFieldIpsecAh_t        ipsecAh;        /**< ipsecAh  */
    headerFieldIpsecEsp_t       ipsecEsp;       /**< ipsecEsp */
    headerFieldUdpEncapEsp_t    udpEncapEsp;    /**< udpEncapEsp */
} t_FmPcdFields;

/**************************************************************************//**
 @Description   structure for defining header extraction for key generation
*//***************************************************************************/
typedef struct t_FmPcdFromHdr {
    uint8_t             size;           /**< Size in byte */
    uint8_t             offset;         /**< Byte offset */
} t_FmPcdFromHdr;

/**************************************************************************//**
 @Description   structure for defining field extraction for key generation
*//***************************************************************************/
typedef struct t_FmPcdFromField {
    t_FmPcdFields       field;          /**< Field selection */
    uint8_t             size;           /**< Size in byte */
    uint8_t             offset;         /**< Byte offset */
} t_FmPcdFromField;

/**************************************************************************//**
 @Description   A structure of parameters used to define a single network
                environment unit.
                A unit should be defined if it will later be used by one or
                more PCD engines to distinguich between flows.
*//***************************************************************************/
typedef struct t_FmPcdDistinctionUnit {
    struct {
        e_NetHeaderType         hdr;        /**< One of the headers supported by the FM */
        u_FmPcdHdrProtocolOpt   opt;        /**< only one option !! */
    } hdrs[FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS];
} t_FmPcdDistinctionUnit;

/**************************************************************************//**
 @Description   A structure of parameters used to define the different
                units supported by a specific PCD Network Environment
                Characteristics module. Each unit represent
                a protocol or a group of protocols that may be used later
                by the different PCD engined to distinguich between flows.
*//***************************************************************************/
typedef struct t_FmPcdNetEnvParams {
    uint8_t                 numOfDistinctionUnits;                      /**< Number of different units to be identified */
    t_FmPcdDistinctionUnit  units[FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS]; /**< An array of numOfDistinctionUnits of the
                                                                             different units to be identified */
} t_FmPcdNetEnvParams;

/**************************************************************************//**
 @Description   structure for defining a single extraction action
                when creating a key
*//***************************************************************************/
typedef struct t_FmPcdExtractEntry {
    e_FmPcdExtractType                  type;           /**< Extraction type select */
    union {
        struct {
            e_NetHeaderType             hdr;            /**< Header selection */
            bool                        ignoreProtocolValidation;
                                                        /**< Ignore protocol validation */
            e_FmPcdHdrIndex             hdrIndex;       /**< Relevant only for MPLS, VLAN and tunneled
                                                             IP. Otherwise should be cleared.*/
            e_FmPcdExtractByHdrType     type;           /**< Header extraction type select */
            union {
                t_FmPcdFromHdr          fromHdr;        /**< Extract bytes from header parameters */
                t_FmPcdFromField        fromField;      /**< Extract bytes from field parameters*/
                t_FmPcdFields           fullField;      /**< Extract full filed parameters*/
            } extractByHdrType;
        } extractByHdr;                                 /**< used when type = e_FM_PCD_KG_EXTRACT_BY_HDR */
        struct {
            e_FmPcdExtractFrom          src;            /**< Non-header extraction source */
            e_FmPcdAction               action;         /**< Relevant for CC Only */
            uint16_t                    icIndxMask;     /**< Relevant only for CC where
                                                             action=e_FM_PCD_ACTION_INDEXED_LOOKUP */
            uint8_t                     offset;         /**< Byte offset */
            uint8_t                     size;           /**< Size in byte */
        } extractNonHdr;                                /**< used when type = e_FM_PCD_KG_EXTRACT_NON_HDR */
    };
} t_FmPcdExtractEntry;

/**************************************************************************//**
 @Description   A structure for defining masks for each extracted
                field in the key.
*//***************************************************************************/
typedef struct t_FmPcdKgExtractMask {
    uint8_t                         extractArrayIndex;   /**< Index in the extraction array, as initialized by user */
    uint8_t                         offset;              /**< Byte offset */
    uint8_t                         mask;                /**< A byte mask (selected bits will be used) */
} t_FmPcdKgExtractMask;

/**************************************************************************//**
 @Description   A structure for defining default selection per groups
                of fields
*//***************************************************************************/
typedef struct t_FmPcdKgExtractDflt {
    e_FmPcdKgKnownFieldsDfltTypes       type;                /**< Default type select*/
    e_FmPcdKgExtractDfltSelect          dfltSelect;          /**< Default register select */
} t_FmPcdKgExtractDflt;

/**************************************************************************//**
 @Description   A structure for defining all parameters needed for
                generation a key and using a hash function
*//***************************************************************************/
typedef struct t_FmPcdKgKeyExtractAndHashParams {
    uint32_t                    privateDflt0;                /**< Scheme default register 0 */
    uint32_t                    privateDflt1;                /**< Scheme default register 1 */
    uint8_t                     numOfUsedExtracts;           /**< defines the valid size of the following array */
    t_FmPcdExtractEntry         extractArray [FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY]; /**< An array of extractions definition. */
    uint8_t                     numOfUsedDflts;              /**< defines the valid size of the following array */
    t_FmPcdKgExtractDflt        dflts[FM_PCD_KG_NUM_OF_DEFAULT_GROUPS];
                                                             /**< For each extraction used in this scheme, specify the required
                                                                  default register to be used when header is not found.
                                                                  types not specified in this array will get undefined value. */
    uint8_t                     numOfUsedMasks;              /**< defines the valid size of the following array */
    t_FmPcdKgExtractMask        masks[FM_PCD_KG_NUM_OF_EXTRACT_MASKS];
    uint8_t                     hashShift;                   /**< hash result right shift. Select the 24 bits out of the 64 hash
                                                                  result. 0 means using the 24 LSB's, otherwise use the
                                                                  24 LSB's after shifting right.*/
    uint32_t                    hashDistributionNumOfFqids;  /**< must be > 1 and a power of 2. Represents the range
                                                                  of queues for the key and hash functionality */
    uint8_t                     hashDistributionFqidsShift;  /**< selects the FQID bits that will be effected by the hash */
    bool                        symmetricHash;               /**< TRUE to generate the same hash for frames with swapped source and
                                                                  destination fields on all layers; If TRUE, driver will check that for
                                                                  all layers, if SRC extraction is selected, DST extraction must also be
                                                                  selected, and vice versa. */
} t_FmPcdKgKeyExtractAndHashParams;

/**************************************************************************//**
 @Description   A structure of parameters for defining a single
                Fqid mask (extracted OR).
*//***************************************************************************/
typedef struct t_FmPcdKgExtractedOrParams {
    e_FmPcdExtractType              type;               /**< Extraction type select */
    union {
        struct {                                        /**< used when type = e_FM_PCD_KG_EXTRACT_BY_HDR */
            e_NetHeaderType         hdr;
            e_FmPcdHdrIndex         hdrIndex;           /**< Relevant only for MPLS, VLAN and tunneled
                                                             IP. Otherwise should be cleared.*/
            bool                    ignoreProtocolValidation;
                                                        /**< continue extraction even if protocol is not recognized */
        } extractByHdr;
        e_FmPcdExtractFrom          src;                /**< used when type = e_FM_PCD_KG_EXTRACT_NON_HDR */
    };
    uint8_t                         extractionOffset;   /**< Offset for extraction (in bytes).  */
    e_FmPcdKgExtractDfltSelect      dfltValue;          /**< Select register from which extraction is taken if
                                                             field not found */
    uint8_t                         mask;               /**< Extraction mask (specified bits are used) */
    uint8_t                         bitOffsetInFqid;    /**< 0-31, Selects which bits of the 24 FQID bits to effect using
                                                             the extracted byte; Assume byte is placed as the 8 MSB's in
                                                             a 32 bit word where the lower bits
                                                             are the FQID; i.e if bitOffsetInFqid=1 than its LSB
                                                             will effect the FQID MSB, if bitOffsetInFqid=24 than the
                                                             extracted byte will effect the 8 LSB's of the FQID,
                                                             if bitOffsetInFqid=31 than the byte's MSB will effect
                                                             the FQID's LSB; 0 means - no effect on FQID;
                                                             Note that one, and only one of
                                                             bitOffsetInFqid or bitOffsetInPlcrProfile must be set (i.e,
                                                             extracted byte must effect either FQID or Policer profile).*/
    uint8_t                         bitOffsetInPlcrProfile;
                                                        /**< 0-15, Selects which bits of the 8 policer profile id bits to
                                                             effect using the extracted byte; Assume byte is placed
                                                             as the 8 MSB's in a 16 bit word where the lower bits
                                                             are the policer profile id; i.e if bitOffsetInPlcrProfile=1
                                                             than its LSB will effect the profile MSB, if bitOffsetInFqid=8
                                                             than the extracted byte will effect the whole policer profile id,
                                                             if bitOffsetInFqid=15 than the byte's MSB will effect
                                                             the Policer Profile id's LSB;
                                                             0 means - no effect on policer profile; Note that one, and only one of
                                                             bitOffsetInFqid or bitOffsetInPlcrProfile must be set (i.e,
                                                             extracted byte must effect either FQID or Policer profile).*/
} t_FmPcdKgExtractedOrParams;

/**************************************************************************//**
 @Description   A structure for configuring scheme counter
*//***************************************************************************/
typedef struct t_FmPcdKgSchemeCounter {
    bool        update;     /**< FALSE to keep the current counter state
                                 and continue from that point, TRUE to update/reset
                                 the counter when the scheme is written. */
    uint32_t    value;      /**< If update=TRUE, this value will be written into the
                                 counter. clear this field to reset the counter. */
} t_FmPcdKgSchemeCounter;

/**************************************************************************//**
 @Description   A structure for defining policer profile
                parameters as required by keygen (when policer
                is the next engine after this scheme).
*//***************************************************************************/
typedef struct t_FmPcdKgPlcrProfile {
    bool                sharedProfile;              /**< TRUE if this profile is shared between ports
                                                         (i.e. managed by master partition) May not be TRUE
                                                         if profile is after Coarse Classification*/
    bool                direct;                     /**< if TRUE, directRelativeProfileId only selects the profile
                                                         id, if FALSE fqidOffsetRelativeProfileIdBase is used
                                                         together with fqidOffsetShift and numOfProfiles
                                                         parameters, to define a range of profiles from
                                                         which the keygen result will determine the
                                                         destination policer profile.  */
    union {
        uint16_t        directRelativeProfileId;    /**< Used if 'direct' is TRUE, to select policer profile.
                                                         This parameter should
                                                         indicate the policer profile offset within the port's
                                                         policer profiles or SHARED window. */
        struct {
            uint8_t     fqidOffsetShift;            /**< shift of KG results without the qid base */
            uint8_t     fqidOffsetRelativeProfileIdBase;
                                                    /**< OR of KG results without the qid base
                                                         This parameter should indicate the policer profile
                                                         offset within the port's policer profiles window or
                                                         SHARED window depends on sharedProfile */
            uint8_t     numOfProfiles;              /**< Range of profiles starting at base */
        } indirectProfile;
    } profileSelect;
} t_FmPcdKgPlcrProfile;

/**************************************************************************//**
 @Description   A structure for CC parameters if CC is the next engine after KG
*//***************************************************************************/
typedef struct t_FmPcdKgCc {
    t_Handle                h_CcTree;           /**< A handle to a CC Tree */
    uint8_t                 grpId;              /**< CC group id within the CC tree */
    bool                    plcrNext;           /**< TRUE if after CC, in case of data frame,
                                                     policing is required. */
    bool                    bypassPlcrProfileGeneration;
                                                /**< TRUE to bypass keygen policer profile
                                                     generation (profile selected is the one selected at
                                                     port initialization). */
    t_FmPcdKgPlcrProfile    plcrProfile;        /**< only if plcrNext=TRUE and bypassPlcrProfileGeneration=FALSE */
} t_FmPcdKgCc;

/**************************************************************************//**
 @Description   A structure for initializing a keygen single scheme
*//***************************************************************************/
typedef struct t_FmPcdKgSchemeParams {
    bool                                modify;                 /**< TRUE to change an existing scheme */
    union
    {
        uint8_t                         relativeSchemeId;       /**< if modify=FALSE:Partition relative scheme id */
        t_Handle                        h_Scheme;               /**< if modify=TRUE: a handle of the existing scheme */
    }id;
    bool                                alwaysDirect;           /**< This scheme is reached only directly, i.e.                                                              no need for match vector. Keygen will ignore
                                                                     it when matching   */
    struct {                                                    /**< HL Relevant only if alwaysDirect = FALSE */
        t_Handle                        h_NetEnv;               /**< A handle to the Network environment as returned
                                                                     by FM_PCD_SetNetEnvCharacteristics() */
        uint8_t                         numOfDistinctionUnits;  /**< Number of netenv units listed in unitIds array */
        uint8_t                         unitIds[FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS];
                                                                /**< Indexes as passed to SetNetEnvCharacteristics array*/
    } netEnvParams;
    bool                                useHash;                /**< use the KG Hash functionality  */
    t_FmPcdKgKeyExtractAndHashParams    keyExtractAndHashParams;
                                                                /**< used only if useHash = TRUE */
    bool                                bypassFqidGeneration;   /**< Normally - FALSE, TRUE to avoid FQID update in the IC;
                                                                     In such a case FQID after KG will be the default FQID
                                                                     defined for the relevant port, or the FQID defined by CC
                                                                     in cases where CC was the previous engine. */
    uint32_t                            baseFqid;               /**< Base FQID; Relevant only if bypassFqidGeneration = FALSE;
                                                                     If hash is used and an even distribution is expected
                                                                     according to hashDistributionNumOfFqids, baseFqid must be aligned to
                                                                     hashDistributionNumOfFqids.  */
    uint8_t                             numOfUsedExtractedOrs;  /**< Number of Fqid masks listed in extractedOrs array*/
    t_FmPcdKgExtractedOrParams          extractedOrs[FM_PCD_KG_NUM_OF_GENERIC_REGS];
                                                                /**< IN: FM_PCD_KG_NUM_OF_GENERIC_REGS
                                                                     registers are shared between qidMasks
                                                                     functionality and some of the extraction
                                                                     actions; Normally only some will be used
                                                                     for qidMask. Driver will return error if
                                                                     resource is full at initialization time. */
    e_FmPcdEngine                       nextEngine;             /**< may be BMI, PLCR or CC */
    union {                                                     /**< depends on nextEngine */
        e_FmPcdDoneAction               doneAction;             /**< Used when next engine is BMI (done) */
        t_FmPcdKgPlcrProfile            plcrProfile;            /**< Used when next engine is PLCR */
        t_FmPcdKgCc                     cc;                     /**< Used when next engine is CC */
    } kgNextEngineParams;
    t_FmPcdKgSchemeCounter              schemeCounter;          /**< A structure of parameters for updating
                                                                     the scheme counter */
} t_FmPcdKgSchemeParams;

/**************************************************************************//**
 @Description   A structure for defining CC params when CC is the
                next engine after a CC node.
*//***************************************************************************/
typedef struct t_FmPcdCcNextCcParams {
    t_Handle    h_CcNode;               /**< A handle of the next CC node */
} t_FmPcdCcNextCcParams;

/**************************************************************************//**
 @Description   A structure for defining PLCR params when PLCR is the
                next engine after a CC node.
*//***************************************************************************/
typedef struct t_FmPcdCcNextPlcrParams {
    bool        overrideParams;         /**< TRUE if CC override previously decided parameters*/
    bool        sharedProfile;          /**< Relevant only if overrideParams=TRUE:
                                             TRUE if this profile is shared between ports */
    uint16_t    newRelativeProfileId;   /**< Relevant only if overrideParams=TRUE:
                                             (otherwise profile id is taken from keygen);
                                             This parameter should indicate the policer
                                             profile offset within the port's
                                             policer profiles or from SHARED window.*/
    uint32_t    newFqid;                /**< Relevant only if overrideParams=TRUE:
                                             FQID for enqueuing the frame;
                                             In earlier chips  if policer next engine is KEYGEN,
                                             this parameter can be 0, because the KEYGEN
                                             always decides the enqueue FQID.*/
    bool        statisticsEn;           /**< In the case of TRUE Statistic counter is
                                             incremented for each received frame passed through
                                             this Coarse Classification entry.*/
} t_FmPcdCcNextPlcrParams;

/**************************************************************************//**
 @Description   A structure for defining enqueue params when BMI is the
                next engine after a CC node.
*//***************************************************************************/
typedef struct t_FmPcdCcNextEnqueueParams {

    e_FmPcdDoneAction    action;        /**< Action - when next engine is BMI (done) */
    bool                 overrideFqid;  /**< TRUE if CC override previously decided Fqid(by Keygen),
                                             relevant if action = e_FM_PCD_ENQ_FRAME */
    uint32_t             newFqid;       /**< Valid if overrideFqid=TRUE, FQID for enqueuing the frame
                                             (otherwise FQID is taken from keygen),
                                             relevant if action = e_FM_PCD_ENQ_FRAME*/
    bool                 statisticsEn;  /**< In the case of TRUE Statistic counter is
                                             incremented for each received frame passed through
                                             this Coarse Classification entry.*/
} t_FmPcdCcNextEnqueueParams;

/**************************************************************************//**
 @Description   A structure for defining KG params when KG is the
                next engine after a CC node.
*//***************************************************************************/
typedef struct t_FmPcdCcNextKgParams {
    bool        overrideFqid;           /**< TRUE if CC override previously decided Fqid (by keygen),
                                             Note - this parameters irrelevant for earlier chips*/
    uint32_t    newFqid;                /**< Valid if overrideFqid=TRUE, FQID for enqueuing the frame
                                             (otherwise FQID is taken from keygen),
                                             Note - this parameters irrelevant for earlier chips*/
    t_Handle    h_DirectScheme;         /**< Direct scheme handle to go to. */
    bool        statisticsEn;           /**< In the case of TRUE Statistic counter is
                                             incremented for each received frame passed through
                                             this Coarse Classification entry.*/
} t_FmPcdCcNextKgParams;

/**************************************************************************//**
 @Description   A structure for defining next engine params after a CC node.
*//***************************************************************************/
typedef struct t_FmPcdCcNextEngineParams {
    e_FmPcdEngine                       nextEngine;    /**< User has to initialize parameters
                                                            according to nextEngine definition */
    union {
        t_FmPcdCcNextCcParams           ccParams;      /**< Parameters in case next engine is CC */
        t_FmPcdCcNextPlcrParams         plcrParams;    /**< Parameters in case next engine is PLCR */
        t_FmPcdCcNextEnqueueParams      enqueueParams; /**< Parameters in case next engine is BMI */
        t_FmPcdCcNextKgParams           kgParams;      /**< Parameters in case next engine is KG */
    } params;
#if defined(FM_CAPWAP_SUPPORT)
    t_Handle                            h_Manip;       /**< Handler to headerManip.
                                                            Relevant if next engine of the type result
                                                            (e_FM_PCD_PLCR, e_FM_PCD_KG, e_FM_PCD_DONE) */
#endif /* defined(FM_CAPWAP_SUPPORT) || ... */
} t_FmPcdCcNextEngineParams;

/**************************************************************************//**
 @Description   A structure for defining a single CC Key parameters
*//***************************************************************************/
typedef struct t_FmPcdCcKeyParams {
    uint8_t                     *p_Key;     /**< pointer to the key of the size defined in keySize*/
    uint8_t                     *p_Mask;    /**< pointer to the Mask per key  of the size defined
                                                 in keySize. p_Key and p_Mask (if defined) has to be
                                                 of the same size defined in the keySize */
    t_FmPcdCcNextEngineParams   ccNextEngineParams;
                                            /**< parameters for the next for the defined Key in
                                                 the p_Key */
} t_FmPcdCcKeyParams;

/**************************************************************************//**
 @Description   A structure for defining CC Keys parameters
*//***************************************************************************/
typedef struct t_KeysParams {
    uint8_t                     numOfKeys;      /**< Number Of relevant Keys  */
    uint8_t                     keySize;        /**< size of the key - in the case of the extraction of
                                                     the type FULL_FIELD keySize has to be as standard size of the relevant
                                                     key. In the another type of extraction keySize has to be as size of extraction.
                                                     In the case of action = e_FM_PCD_ACTION_INDEXED_LOOKUP the size of keySize has to be 2*/
    t_FmPcdCcKeyParams          keyParams[FM_PCD_MAX_NUM_OF_KEYS];
                                                /**< it's array with numOfKeys entries each entry in
                                                     the array of the type t_FmPcdCcKeyParams */
    t_FmPcdCcNextEngineParams   ccNextEngineParamsForMiss;
                                                /**< parameters for the next step of
                                                     unfound (or undefined) key . Not relevant in the case
                                                     of action = e_FM_PCD_ACTION_INDEXED_LOOKUP*/
} t_KeysParams;

/**************************************************************************//**
 @Description   A structure for defining the CC node params
*//***************************************************************************/
typedef struct t_FmPcdCcNodeParams {
    t_FmPcdExtractEntry         extractCcParams;    /**< params which defines extraction parameters */
    t_KeysParams                keysParams;         /**< params which defines Keys parameters of the
                                                         extraction defined in extractCcParams */
} t_FmPcdCcNodeParams;

/**************************************************************************//**
 @Description   A structure for defining each CC tree group in term of
                NetEnv units and the action to be taken in each case.
                the unitIds list must be in order from lower to higher indexes.

                t_FmPcdCcNextEngineParams is a list of 2^numOfDistinctionUnits
                structures where each defines the next action to be taken for
                each units combination. for example:
                numOfDistinctionUnits = 2
                unitIds = {1,3}
                p_NextEnginePerEntriesInGrp[0] = t_FmPcdCcNextEngineParams for the case that
                                                        unit 1 - not found; unit 3 - not found;
                p_NextEnginePerEntriesInGrp[1] = t_FmPcdCcNextEngineParams for the case that
                                                        unit 1 - not found; unit 3 - found;
                p_NextEnginePerEntriesInGrp[2] = t_FmPcdCcNextEngineParams for the case that
                                                        unit 1 - found; unit 3 - not found;
                p_NextEnginePerEntriesInGrp[3] = t_FmPcdCcNextEngineParams for the case that
                                                        unit 1 - found; unit 3 - found;
*//***************************************************************************/
typedef struct t_FmPcdCcGrpParams {
    uint8_t                     numOfDistinctionUnits;          /**< up to 4 */
    uint8_t                     unitIds[FM_PCD_MAX_NUM_OF_CC_UNITS];
                                                                /**< Indexes of the units as defined in
                                                                     FM_PCD_SetNetEnvCharacteristics() */
    t_FmPcdCcNextEngineParams   nextEnginePerEntriesInGrp[FM_PCD_MAX_NUM_OF_CC_ENTRIES_IN_GRP];
                                                                /**< Max size is 16 - if only one group used */
} t_FmPcdCcGrpParams;

/**************************************************************************//**
 @Description   A structure for defining the CC tree groups
*//***************************************************************************/
typedef struct t_FmPcdCcTreeParams {
    t_Handle                h_NetEnv;                                   /**< A handle to the Network environment as returned
                                                                             by FM_PCD_SetNetEnvCharacteristics() */
    uint8_t                 numOfGrps;                                  /**< Number of CC groups within the CC tree */
    t_FmPcdCcGrpParams      ccGrpParams[FM_PCD_MAX_NUM_OF_CC_GROUPS];   /**< Parameters for each group. */
} t_FmPcdCcTreeParams;

/**************************************************************************//**
 @Description   A structure for defining parameters for byte rate
*//***************************************************************************/
typedef struct t_FmPcdPlcrByteRateModeParams {
    e_FmPcdPlcrFrameLengthSelect    frameLengthSelection;   /**< Frame length selection */
    e_FmPcdPlcrRollBackFrameSelect  rollBackFrameSelection; /**< relevant option only e_FM_PCD_PLCR_L2_FRM_LEN,
                                                                 e_FM_PCD_PLCR_FULL_FRM_LEN */
} t_FmPcdPlcrByteRateModeParams;

/**************************************************************************//**
 @Description   A structure for selcting the policer profile RFC-2698 or
                RFC-4115 parameters
*//***************************************************************************/
typedef struct t_FmPcdPlcrNonPassthroughAlgParams {
    e_FmPcdPlcrRateMode              rateMode;                       /**< Byte / Packet */
    t_FmPcdPlcrByteRateModeParams    byteModeParams;                 /**< Valid for Byte NULL for Packet */
    uint32_t                         comittedInfoRate;               /**< KBits/Sec or Packets/Sec */
    uint32_t                         comittedBurstSize;              /**< Bytes/Packets */
    uint32_t                         peakOrAccessiveInfoRate;        /**< KBits/Sec or Packets/Sec */
    uint32_t                         peakOrAccessiveBurstSize;       /**< Bytes/Packets */
} t_FmPcdPlcrNonPassthroughAlgParams;

/**************************************************************************//**
 @Description   A union for defining Policer next engine parameters
*//***************************************************************************/
typedef union u_FmPcdPlcrNextEngineParams {
        e_FmPcdDoneAction               action;             /**< Action - when next engine is BMI (done) */
        t_Handle                        h_Profile;          /**< Policer profile handle -  used when next engine
                                                                 is PLCR, must be a SHARED profile */
        t_Handle                        h_DirectScheme;     /**< Direct scheme select - when next engine is Keygen */
} u_FmPcdPlcrNextEngineParams;

/**************************************************************************//**
 @Description   A structure for selecting the policer profile entry parameters
*//***************************************************************************/
typedef struct t_FmPcdPlcrProfileParams {
    bool                                modify;                     /**< TRUE to change an existing profile */
    union {
        struct {
            e_FmPcdProfileTypeSelection profileType;                /**< Type of policer profile */
            t_Handle                    h_FmPort;                   /**< Relevant for per-port profiles only */
            uint16_t                    relativeProfileId;          /**< Profile id - relative to shared group or to port */
        } newParams;                                                /**< use it when modify=FALSE */
        t_Handle                        h_Profile;                  /**< A handle to a profile - use it when modify=TRUE */
    } id;
    e_FmPcdPlcrAlgorithmSelection       algSelection;               /**< Profile Algorithm PASS_THROUGH, RFC_2698, RFC_4115 */
    e_FmPcdPlcrColorMode                colorMode;                  /**< COLOR_BLIND, COLOR_AWARE */

    union {
        e_FmPcdPlcrColor                dfltColor;                  /**< For Color-Blind Pass-Through mode. the policer will re-color
                                                                         any incoming packet with the default value. */
        e_FmPcdPlcrColor                override;                   /**< For Color-Aware modes. The profile response to a
                                                                         pre-color value of 2'b11. */
    } color;

    t_FmPcdPlcrNonPassthroughAlgParams  nonPassthroughAlgParams;    /**< RFC2698 or RFC4115 params */

    e_FmPcdEngine                       nextEngineOnGreen;          /**< Green next engine type */
    u_FmPcdPlcrNextEngineParams         paramsOnGreen;              /**< Green next engine params */

    e_FmPcdEngine                       nextEngineOnYellow;         /**< Yellow next engine type */
    u_FmPcdPlcrNextEngineParams         paramsOnYellow;             /**< Yellow next engine params */

    e_FmPcdEngine                       nextEngineOnRed;            /**< Red next engine type */
    u_FmPcdPlcrNextEngineParams         paramsOnRed;                /**< Red next engine params */

    bool                                trapProfileOnFlowA;         /**< Trap on flow A */
    bool                                trapProfileOnFlowB;         /**< Trap on flow B */
    bool                                trapProfileOnFlowC;         /**< Trap on flow C */
} t_FmPcdPlcrProfileParams;

#if defined(FM_CAPWAP_SUPPORT)
/**************************************************************************//**
 @Description   A structure for selecting the location of manipulation
*//***************************************************************************/
typedef struct t_FmPcdManipLocationParams {
    e_FmPcdManipLocateType              type;           /**< location of manipulation type select */
    struct {                                            /**< used when type = e_FM_PCD_MANIP_BY_HDR */
        e_NetHeaderType                 hdr;            /**< Header selection */
        e_FmPcdHdrIndex                 hdrIndex;       /**< Relevant only for MPLS, VLAN and tunneled
                                                             IP. Otherwise should be cleared. */
        bool                            byField;        /**< TRUE if the location of manipulation is according to some field in the specific header*/
        t_FmPcdFields                   fullField;      /**< Relevant only when byField = TRUE: Extract field */
    } manipByHdr;
} t_FmPcdManipLocationParams;

/**************************************************************************//**
 @Description   structure for defining insert manipulation
                of the type e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_TEMPLATE
*//***************************************************************************/
typedef struct t_FmPcdManipInsrtByTemplateParams {
    uint8_t         size;                               /**< size of insert template to the start of the frame. */
    uint8_t         hdrTemplate[FM_PCD_MAX_MANIP_INSRT_TEMPLATE_SIZE];
                                                        /**< array of the insertion template. */

    bool            modifyOuterIp;                      /**< TRUE if user want to modify some fields in outer IP. */
    struct {
        uint16_t    ipOuterOffset;                      /**< offset of outer IP in the insert template, relevant if modifyOuterIp = TRUE.*/
        uint16_t    dscpEcn;                            /**< value of dscpEcn in IP outer, relevant if modifyOuterIp = TRUE.
                                                             in IPV4 dscpEcn only byte - it has to be adjusted to the right*/
        bool        udpPresent;                         /**< TRUE if UDP is present in the insert template, relevant if modifyOuterIp = TRUE.*/
        uint8_t     udpOffset;                          /**< offset in the insert template of UDP, relevant if modifyOuterIp = TRUE and udpPresent=TRUE.*/
        uint8_t     ipIdentGenId;                       /**< Used by FMan-CTRL to calculate IP-identification field,relevant if modifyOuterIp = TRUE.*/
        bool        recalculateLength;                  /**< TRUE if recalculate length has to be performed due to the engines in the path which can change the frame later, relevant if modifyOuterIp = TRUE.*/
        struct {
            uint8_t blockSize;                          /**< The CAAM block-size; Used by FMan-CTRL to calculate the IP-total-len field.*/
            uint8_t extraBytesAddedAlignedToBlockSize;  /**< Used by FMan-CTRL to calculate the IP-total-len field and UDP length*/
            uint8_t extraBytesAddedNotAlignedToBlockSize;/**< Used by FMan-CTRL to calculate the IP-total-len field and UDP length.*/
        } recalculateLengthParams;                      /**< recalculate length parameters - relevant if modifyOuterIp = TRUE and recalculateLength = TRUE */
    } modifyOuterIpParams;                              /**< Outer IP modification parameters - ignored if modifyOuterIp is FALSE */

    bool            modifyOuterVlan;                    /**< TRUE if user wants to modify vpri field in the outer VLAN header*/
    struct {
        uint8_t     vpri;                               /**< value of vpri, relevant if modifyOuterVlan = TRUE
                                                             vpri only 3 bits, it has to be adjusted to the right*/
    } modifyOuterVlanParams;
} t_FmPcdManipInsrtByTemplateParams;
#endif /* defined(FM_CAPWAP_SUPPORT) || ... */


#ifdef FM_CAPWAP_SUPPORT
/**************************************************************************//**
 @Description   structure for defining CAPWAP fragmentation
*//***************************************************************************/
typedef struct t_CapwapFragmentationParams {
    uint16_t         sizeForFragmentation;              /**< if length of the frame is greater than this value, CAPWAP fragmentation will be executed.*/
    bool             headerOptionsCompr;                /**< TRUE - first fragment include the CAPWAP header options field,
                                                             and all other fragments exclude the CAPWAP options field,
                                                             FALSE - all fragments include CAPWAP header options field. */
} t_CapwapFragmentationParams;

/**************************************************************************//**
 @Description   structure for defining CAPWAP Re-assembly
*//***************************************************************************/
typedef struct t_CapwapReassemblyParams {
    uint16_t                        maxNumFramesInProcess;  /**< Number of frames which can be processed by Reassembly in the same time.
                                                                 It has to be power of 2.
                                                                 In the case numOfFramesPerHashEntry == e_FM_PCD_MANIP_FOUR_WAYS_HASH,
                                                                 maxNumFramesInProcess has to be in the range of 4 - 512,
                                                                 In the case numOfFramesPerHashEntry == e_FM_PCD_MANIP_EIGHT_WAYS_HASH,
                                                                 maxNumFramesInProcess has to be in the range of 8 - 2048 */
    bool                            haltOnDuplicationFrag;  /**< In the case of TRUE, Reassembly process halted due to duplicated fragment,
                                                                 and all processed fragments passed for enqueue with error indication.
                                                                 In the case of FALSE, only duplicated fragment passed for enqueue with error indication */

    e_FmPcdManipReassemTimeOutMode  timeOutMode;            /**< Expiration delay initialized by Reassembly process */
    uint32_t                        fqidForTimeOutFrames;   /**< Fqid in which time out frames will enqueue during Time Out Process  */
    uint32_t                        timeoutRoutineRequestTime;
                                                            /**< Represents the time interval in microseconds between consecutive
                                                                 timeout routine requests It has to be power of 2. */
    uint32_t                        timeoutThresholdForReassmProcess;
                                                            /**< Represents the time interval in microseconds which defines
                                                                 if opened frame (at least one fragment was processed but not all the fragments)is found as too old*/

    e_FmPcdManipReassemWaysNumber   numOfFramesPerHashEntry;/**< Number of frames per hash entry needed for reassembly process */
} t_CapwapReassemblyParams;
#endif /* FM_CAPWAP_SUPPORT */


#if defined(FM_CAPWAP_SUPPORT)
/**************************************************************************//**
 @Description   structure for defining fragmentation/reassembly
*//***************************************************************************/
typedef struct t_FmPcdManipFragOrReasmParams {
    bool                                frag;               /**< TRUE if using the structure for fragmentation,
                                                                 otherwise this structure is used for reassembly */
    uint8_t                             extBufPoolIndx;     /**< Index of the buffer pool ID which was configured for port
                                                                 and can be used for manipulation;
                                                                 NOTE: This field is relevant only for CAPWAP fragmentation
                                                                 and reassembly */
    e_NetHeaderType                     hdr;                /**< Header selection */
    union {
#ifdef FM_CAPWAP_SUPPORT
        t_CapwapFragmentationParams     capwapFragParams;   /**< Structure for CAPWAP fragmentation, relevant if frag = TRUE, hdr = HEADER_TYPE_CAPWAP */
        t_CapwapReassemblyParams        capwapReasmParams;  /**< Structure for CAPWAP reassembly, relevant if frag = FALSE, hdr = HEADER_TYPE_CAPWAP */
#endif /* FM_CAPWAP_SUPPORT */
    };
} t_FmPcdManipFragOrReasmParams;

/**************************************************************************//**
 @Description   structure for defining insert manipulation
*//***************************************************************************/
typedef struct t_FmPcdManipInsrtParams {
    e_FmPcdManipInsrtType                       type;       /**< Type of insert manipulation */
    union {
        t_FmPcdManipInsrtByTemplateParams       insrtByTemplateParams;
                                                            /**< parameters for insert manipulation, relevant if
                                                                 type = e_FM_PCD_MANIP_INSRT_TO_START_OF_FRAME_TEMPLATE */
    };
} t_FmPcdManipInsrtParams;

/**************************************************************************//**
 @Description   structure for defining remove manipulation
*//***************************************************************************/
typedef struct t_FmPcdManipRmvParams {
    e_FmPcdManipRmvParamsType                   type;   /**< Type of remove manipulation */
    t_FmPcdManipLocationParams                  rmvSpecificLocationParams;
                                                        /**< Specified location of remove manipulation;
                                                              This params should be initialized in cases:
                                                              - e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_TILL_SPECIFIC_LOCATION
                                                              - e_FM_PCD_MANIP_RMV_FROM_START_OF_FRAME_INCLUDE_SPECIFIC_LOCATION */
} t_FmPcdManipRmvParams;

/**************************************************************************//**
 @Description   structure for defining manipulation
*//***************************************************************************/
typedef struct t_FmPcdManipParams {
    bool                                        rmv;                /**< TRUE, if defined remove manipulation */
    t_FmPcdManipRmvParams                       rmvParams;          /**< Parameters for remove manipulation, relevant if rmv = TRUE */

    bool                                        insrt;              /**< TRUE, if defined insert manipulation */
    t_FmPcdManipInsrtParams                     insrtParams;        /**< Parameters for insert manipulation, relevant if insrt = TRUE */

    bool                                        fragOrReasm;        /**< TRUE, if defined fragmentation/reassembly manipulation */
    t_FmPcdManipFragOrReasmParams               fragOrReasmParams;  /**< Parameters for fragmentation/reassembly manipulation, relevant if fragOrReasm = TRUE */

    /**< General parameters */
    bool                                        treatFdStatusFieldsAsErrors;
                                                                    /**< Set to TRUE when the port that is using this manip is chained
                                                                         to SEC (i.e. the traffic was forwarded from SEC) */
} t_FmPcdManipParams;

/**************************************************************************//**
 @Description   structure for defining statistics node
*//***************************************************************************/
typedef struct t_FmPcdStatsParams {
    e_FmPcdStatsType        type; /**< type of statistics node */
} t_FmPcdStatsParams;
#endif /* defined(FM_CAPWAP_SUPPORT) || ... */


/**************************************************************************//**
 @Function      FM_PCD_SetNetEnvCharacteristics

 @Description   Define a set of Network Environment Characteristics.
                When setting an environment it is important to understand its
                application. It is not meant to describe the flows that will run
                on the ports using this environment, but what the user means TO DO
                with the PCD mechanisms in order to parse-classify-distribute those
                frames.
                By specifying a distinction unit, the user means it would use that option
                for distinction between frames at either a keygen scheme keygen or a coarse
                classification action descriptor. Using interchangeable headers to define a
                unit means that the user is indifferent to which of the interchangeable
                headers is present in the frame, and they want the distinction to be based
                on the presence of either one of them.
                Depending on context, there are limitations to the use of environments. A
                port using the PCD functionality is bound to an environment. Some or even
                all ports may share an environment but also an environment per port is
                possible. When initializing a scheme, a classification plan group (see below),
                or a coarse classification tree, one of the initialized environments must be
                stated and related to. When a port is bound to a scheme, a classification
                plan group, or a coarse classification tree, it MUST be bound to the same
                environment.
                The different PCD modules, may relate (for flows definition) ONLY on
                distinction units as defined by their environment. When initializing a
                scheme for example, it may not choose to select IPV4 as a match for
                recognizing flows unless it was defined in the relating environment. In
                fact, to guide the user through the configuration of the PCD, each module's
                characterization in terms of flows is not done using protocol names, but using
                environment indexes.
                In terms of HW implementation, the list of distinction units sets the LCV vectors
                and later used for match vector, classification plan vectors and coarse classification
                indexing.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     p_NetEnvParams  A structure of parameters for the initialization of
                                the network environment.

 @Return        A handle to the initialized object on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle FM_PCD_SetNetEnvCharacteristics(t_Handle h_FmPcd, t_FmPcdNetEnvParams *p_NetEnvParams);

/**************************************************************************//**
 @Function      FM_PCD_DeleteNetEnvCharacteristics

 @Description   Deletes a set of Network Environment Characteristics.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     h_NetEnv        A handle to the Network environment.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_PCD_DeleteNetEnvCharacteristics(t_Handle h_FmPcd, t_Handle h_NetEnv);

/**************************************************************************//**
 @Function      FM_PCD_KgSetScheme

 @Description   Initializing or modifying and enabling a scheme for the keygen.
                This routine should be called for adding or modifying a scheme.
                When a scheme needs modifying, the API requires that it will be
                rewritten. In such a case 'modify' should be TRUE. If the
                routine is called for a valid scheme and 'modify' is FALSE,
                it will return error.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in,out] p_Scheme        A structure of parameters for defining the scheme

 @Return        A handle to the initialized scheme on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle FM_PCD_KgSetScheme (t_Handle                h_FmPcd,
                             t_FmPcdKgSchemeParams   *p_Scheme);

/**************************************************************************//**
 @Function      FM_PCD_KgDeleteScheme

 @Description   Deleting an initialized scheme.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_Scheme        scheme handle as returned by FM_PCD_KgSetScheme

 @Return        E_OK on success; Error code otherwise.
 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error     FM_PCD_KgDeleteScheme(t_Handle h_FmPcd, t_Handle h_Scheme);

/**************************************************************************//**
 @Function      FM_PCD_KgGetSchemeCounter

 @Description   Reads scheme packet counter.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     h_Scheme        scheme handle as returned by FM_PCD_KgSetScheme.

 @Return        Counter's current value.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
uint32_t  FM_PCD_KgGetSchemeCounter(t_Handle h_FmPcd, t_Handle h_Scheme);

/**************************************************************************//**
 @Function      FM_PCD_KgSetSchemeCounter

 @Description   Writes scheme packet counter.

 @Param[in]     h_FmPcd         FM PCD module descriptor.
 @Param[in]     h_Scheme        scheme handle as returned by FM_PCD_KgSetScheme.
 @Param[in]     value           New scheme counter value - typically '0' for
                                resetting the counter.
 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error  FM_PCD_KgSetSchemeCounter(t_Handle h_FmPcd, t_Handle h_Scheme, uint32_t value);

/**************************************************************************//**
 @Function      FM_PCD_CcBuildTree

 @Description   This routine must be called to define a complete coarse
                classification tree. This is the way to define coarse
                classification to a certain flow - the keygen schemes
                may point only to trees defined in this way.

 @Param[in]     h_FmPcd                 FM PCD module descriptor.
 @Param[in]     p_FmPcdCcTreeParams     A structure of parameters to define the tree.

 @Return        A handle to the initialized object on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle FM_PCD_CcBuildTree (t_Handle             h_FmPcd,
                             t_FmPcdCcTreeParams  *p_FmPcdCcTreeParams);

/**************************************************************************//**
 @Function      FM_PCD_CcDeleteTree

 @Description   Deleting an built tree.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_CcTree        A handle to a CC tree.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_CcDeleteTree(t_Handle h_FmPcd, t_Handle h_CcTree);

/**************************************************************************//**
 @Function      FM_PCD_CcSetNode

 @Description   This routine should be called for each CC (coarse classification)
                node. The whole CC tree should be built bottom up so that each
                node points to already defined nodes.

 @Param[in]     h_FmPcd             FM PCD module descriptor.
 @Param[in]     p_CcNodeParam       A structure of parameters defining the CC node

 @Return        A handle to the initialized object on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle   FM_PCD_CcSetNode(t_Handle             h_FmPcd,
                            t_FmPcdCcNodeParams  *p_CcNodeParam);

/**************************************************************************//**
 @Function      FM_PCD_CcDeleteNode

 @Description   Deleting an built node.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_CcNode        A handle to a CC node.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_CcDeleteNode(t_Handle h_FmPcd, t_Handle h_CcNode);

/**************************************************************************//**
 @Function      FM_PCD_CcTreeModifyNextEngine

 @Description   Modify the Next Engine Parameters in the entry of the tree.

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcTree                    A handle to the tree
 @Param[in]     grpId                       A Group index in the tree
 @Param[in]     index                       Entry index in the group defined by grpId
 @Param[in]     p_FmPcdCcNextEngineParams   A structure for defining new next engine params

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcBuildTree().
*//***************************************************************************/
t_Error FM_PCD_CcTreeModifyNextEngine(t_Handle h_FmPcd, t_Handle h_CcTree, uint8_t grpId, uint8_t index, t_FmPcdCcNextEngineParams *p_FmPcdCcNextEngineParams);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeModifyNextEngine

 @Description   Modify the Next Engine Parameters in the relevant key entry of the node.

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     keyIndex                    Key index for Next Engine Params modifications
 @Param[in]     p_FmPcdCcNextEngineParams   A structure for defining new next engine params

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcSetNode().
*//***************************************************************************/
t_Error FM_PCD_CcNodeModifyNextEngine(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, t_FmPcdCcNextEngineParams *p_FmPcdCcNextEngineParams);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeModifyMissNextEngine

 @Description   Modify the Next Engine Parameters of the Miss key case of the node.

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     p_FmPcdCcNextEngineParams   A structure for defining new next engine params

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcSetNode().
*//***************************************************************************/
t_Error FM_PCD_CcNodeModifyMissNextEngine(t_Handle h_FmPcd, t_Handle h_CcNode, t_FmPcdCcNextEngineParams *p_FmPcdCcNextEngineParams);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeRemoveKey

 @Description   Remove the key (include Next Engine Parameters of this key) defined by the index of the relevant node .

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     keyIndex                    Key index for removing

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
                the node that points to this node
*//***************************************************************************/
t_Error FM_PCD_CcNodeRemoveKey(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeAddKey

 @Description   Add the key(include Next Engine Parameters of this key)in the index defined by the keyIndex .

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     keyIndex                    Key index for adding
 @Param[in]     keySize                     Key size of added key
 @Param[in]     p_KeyParams                 A pointer to the parameters includes new key with Next Engine Parameters

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
                the node that points to this node
*//***************************************************************************/
t_Error FM_PCD_CcNodeAddKey(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, uint8_t keySize, t_FmPcdCcKeyParams  *p_KeyParams);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeModifyKeyAndNextEngine

 @Description   Modify the key and Next Engine Parameters of this key in the index defined by the keyIndex .

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     keyIndex                    Key index for adding
 @Param[in]     keySize                     Key size of added key
 @Param[in]     p_KeyParams                 A pointer to the parameters includes modified key and modified Next Engine Parameters

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
                the node that points to this node
*//***************************************************************************/
t_Error FM_PCD_CcNodeModifyKeyAndNextEngine(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, uint8_t keySize, t_FmPcdCcKeyParams  *p_KeyParams);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeModifyKey

 @Description   Modify the key  in the index defined by the keyIndex .

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     keyIndex                    Key index for adding
 @Param[in]     keySize                     Key size of added key
 @Param[in]     p_Key                       A pointer to the new key
 @Param[in]     p_Mask                      A pointer to the new mask if relevant, otherwise pointer to NULL

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
                the node that points to this node
*//***************************************************************************/
t_Error FM_PCD_CcNodeModifyKey(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex, uint8_t keySize, uint8_t  *p_Key, uint8_t *p_Mask);

/**************************************************************************//**
 @Function      FM_PCD_CcNodeGetKeyCounter

 @Description   This routine may be used to get a counter of specific key in a CC
                Node; This counter reflects how many frames passed that were matched
                this key.

 @Param[in]     h_FmPcd                     A handle to an FM PCD Module.
 @Param[in]     h_CcNode                    A handle to the node
 @Param[in]     keyIndex                    Key index for adding

 @Return        The specific key counter.

 @Cautions      Allowed only following FM_PCD_CcSetNode() not only of the relevant node but also
                the node that points to this node
*//***************************************************************************/
uint32_t FM_PCD_CcNodeGetKeyCounter(t_Handle h_FmPcd, t_Handle h_CcNode, uint8_t keyIndex);

/**************************************************************************//**
 @Function      FM_PCD_PlcrSetProfile

 @Description   Sets a profile entry in the policer profile table.
                The routine overrides any existing value.

 @Param[in]     h_FmPcd           A handle to an FM PCD Module.
 @Param[in]     p_Profile         A structure of parameters for defining a
                                  policer profile entry.

 @Return        A handle to the initialized object on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle FM_PCD_PlcrSetProfile(t_Handle                  h_FmPcd,
                               t_FmPcdPlcrProfileParams  *p_Profile);

/**************************************************************************//**
 @Function      FM_PCD_PlcrDeleteProfile

 @Description   Delete a profile entry in the policer profile table.
                The routine set entry to invalid.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_Profile       A handle to the profile.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_PlcrDeleteProfile(t_Handle h_FmPcd, t_Handle h_Profile);

/**************************************************************************//**
 @Function      FM_PCD_PlcrGetProfileCounter

 @Description   Sets an entry in the classification plan.
                The routine overrides any existing value.

 @Param[in]     h_FmPcd             A handle to an FM PCD Module.
 @Param[in]     h_Profile       A handle to the profile.
 @Param[in]     counter             Counter selector.

 @Return        specific counter value.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
uint32_t FM_PCD_PlcrGetProfileCounter(t_Handle h_FmPcd, t_Handle h_Profile, e_FmPcdPlcrProfileCounters counter);

/**************************************************************************//**
 @Function      FM_PCD_PlcrSetProfileCounter

 @Description   Sets an entry in the classification plan.
                The routine overrides any existing value.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_Profile       A handle to the profile.
 @Param[in]     counter         Counter selector.
 @Param[in]     value           value to set counter with.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error FM_PCD_PlcrSetProfileCounter(t_Handle h_FmPcd, t_Handle h_Profile, e_FmPcdPlcrProfileCounters counter, uint32_t value);

#if defined(FM_CAPWAP_SUPPORT)
/**************************************************************************//**
 @Function      FM_PCD_ManipSetNode

 @Description   This routine should be called for defining a manipulation
                node. A manipulation node must be defined before the CC node
                that precedes it.

 @Param[in]     h_FmPcd             FM PCD module descriptor.
 @Param[in]     p_FmPcdManipParams  A structure of parameters defining the manipulation

 @Return        A handle to the initialized object on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle FM_PCD_ManipSetNode(t_Handle h_FmPcd, t_FmPcdManipParams *p_FmPcdManipParams);

/**************************************************************************//**
 @Function      FM_PCD_ManipDeleteNode

 @Description   Delete an existing manip node.

 @Param[in]     h_FmPcd         A handle to an FM PCD Module.
 @Param[in]     h_HdrManipNode  A handle to a Manip node.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Error  FM_PCD_ManipDeleteNode(t_Handle h_FmPcd, t_Handle h_HdrManipNode);
#endif /* defined(FM_CAPWAP_SUPPORT) || ... */


#ifdef FM_CAPWAP_SUPPORT
/**************************************************************************//**
 @Function      FM_PCD_StatisticsSetNode

 @Description   This routine should be called for defining a statistics
                node.

 @Param[in]     h_FmPcd             FM PCD module descriptor.
 @Param[in]     p_FmPcdstatsParams  A structure of parameters defining the statistics

 @Return        A handle to the initialized object on success; NULL code otherwise.

 @Cautions      Allowed only following FM_PCD_Init().
*//***************************************************************************/
t_Handle FM_PCD_StatisticsSetNode(t_Handle h_FmPcd, t_FmPcdStatsParams *p_FmPcdstatsParams);
#endif /* FM_CAPWAP_SUPPORT */

/** @} */ /* end of FM_PCD_Runtime_tree_buildgrp group */
/** @} */ /* end of FM_PCD_Runtime_grp group */
/** @} */ /* end of FM_PCD_grp group */
/** @} */ /* end of FM_grp group */



#endif /* __FM_PCD_EXT */
OpenPOWER on IntegriCloud