Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

   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
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
/* Copyright (c) 2008-2012 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_port_ext.h

 @Description   FM-Port Application Programming Interface.
*//***************************************************************************/
#ifndef __FM_PORT_EXT
#define __FM_PORT_EXT

#include "error_ext.h"
#include "std_ext.h"
#include "fm_pcd_ext.h"
#include "fm_ext.h"
#include "net_ext.h"


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

 @Group         FM_grp Frame Manager API

 @Description   FM API functions, definitions and enums

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

/**************************************************************************//**
 @Group         FM_PORT_grp FM Port

 @Description   FM Port API

                The FM uses a general module called "port" to represent a Tx port
                (MAC), an Rx port (MAC) or Offline Parsing port.
                The number of ports in an FM varies between SOCs.
                The SW driver manages these ports as sub-modules of the FM, i.e.
                after an FM is initialized, its ports may be initialized and
                operated upon.

                The port is initialized aware of its type, but other functions on
                a port may be indifferent to its type. When necessary, the driver
                verifies coherence and returns error if applicable.

                On initialization, user specifies the port type and it's index
                (relative to the port's type) - always starting at 0.

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

/**************************************************************************//**
 @Description   An enum for defining port PCD modes.
                This enum defines the superset of PCD engines support - i.e. not
                all engines have to be used, but all have to be enabled. The real
                flow of a specific frame depends on the PCD configuration and the
                frame headers and payload.
                Note: the first engine and the first engine after the parser (if
                exists) should be in order, the order is important as it will
                define the flow of the port. However, as for the rest engines
                (the ones that follows), the order is not important anymore as
                it is defined by the PCD graph itself.
*//***************************************************************************/
typedef enum e_FmPortPcdSupport {
      e_FM_PORT_PCD_SUPPORT_NONE = 0                /**< BMI to BMI, PCD is not used */
    , e_FM_PORT_PCD_SUPPORT_PRS_ONLY                /**< Use only Parser */
    , e_FM_PORT_PCD_SUPPORT_PLCR_ONLY               /**< Use only Policer */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR            /**< Use Parser and Policer */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG              /**< Use Parser and Keygen */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC       /**< Use Parser, Keygen and Coarse Classification */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC_AND_PLCR
                                                    /**< Use all PCD engines */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_PLCR     /**< Use Parser, Keygen and Policer */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_CC              /**< Use Parser and Coarse Classification */
    , e_FM_PORT_PCD_SUPPORT_PRS_AND_CC_AND_PLCR     /**< Use Parser and Coarse Classification and Policer */
    , e_FM_PORT_PCD_SUPPORT_CC_ONLY                 /**< Use only Coarse Classification */
#ifdef FM_CAPWAP_SUPPORT
    , e_FM_PORT_PCD_SUPPORT_CC_AND_KG               /**< Use Coarse Classification,and Keygen */
    , e_FM_PORT_PCD_SUPPORT_CC_AND_KG_AND_PLCR      /**< Use Coarse Classification, Keygen and Policer */
#endif /* FM_CAPWAP_SUPPORT */
} e_FmPortPcdSupport;

/**************************************************************************//**
 @Description   Port interrupts
*//***************************************************************************/
typedef enum e_FmPortExceptions {
    e_FM_PORT_EXCEPTION_IM_BUSY                 /**< Independent-Mode Rx-BUSY */
} e_FmPortExceptions;


/**************************************************************************//**
 @Collection    General FM Port defines
*//***************************************************************************/
#define FM_PORT_PRS_RESULT_NUM_OF_WORDS     8   /**< Number of 4 bytes words in parser result */
/* @} */

/**************************************************************************//**
 @Collection   FM Frame error
*//***************************************************************************/
typedef uint32_t    fmPortFrameErrSelect_t;                         /**< typedef for defining Frame Descriptor errors */

#define FM_PORT_FRM_ERR_UNSUPPORTED_FORMAT      FM_FD_ERR_UNSUPPORTED_FORMAT    /**< Not for Rx-Port! Unsupported Format */
#define FM_PORT_FRM_ERR_LENGTH                  FM_FD_ERR_LENGTH                /**< Not for Rx-Port! Length Error */
#define FM_PORT_FRM_ERR_DMA                     FM_FD_ERR_DMA                   /**< DMA Data error */
#define FM_PORT_FRM_ERR_NON_FM                  FM_FD_RX_STATUS_ERR_NON_FM      /**< non Frame-Manager error; probably come from SEC that
                                                                                     was chained to FM */

#define FM_PORT_FRM_ERR_IPRE                    (FM_FD_ERR_IPR & ~FM_FD_IPR)        /**< IPR error */
#define FM_PORT_FRM_ERR_IPR_NCSP                (FM_FD_ERR_IPR_NCSP & ~FM_FD_IPR)   /**< IPR non-consistent-sp */

#define FM_PORT_FRM_ERR_IPFE                    0                                   /**< Obsolete; will be removed in the future */

#ifdef FM_CAPWAP_SUPPORT
#define FM_PORT_FRM_ERR_CRE                     FM_FD_ERR_CRE
#define FM_PORT_FRM_ERR_CHE                     FM_FD_ERR_CHE
#endif /* FM_CAPWAP_SUPPORT */

#define FM_PORT_FRM_ERR_PHYSICAL                FM_FD_ERR_PHYSICAL              /**< Rx FIFO overflow, FCS error, code error, running disparity
                                                                                     error (SGMII and TBI modes), FIFO parity error. PHY
                                                                                     Sequence error, PHY error control character detected. */
#define FM_PORT_FRM_ERR_SIZE                    FM_FD_ERR_SIZE                  /**< Frame too long OR Frame size exceeds max_length_frame  */
#define FM_PORT_FRM_ERR_CLS_DISCARD             FM_FD_ERR_CLS_DISCARD           /**< indicates a classifier "drop" operation */
#define FM_PORT_FRM_ERR_EXTRACTION              FM_FD_ERR_EXTRACTION            /**< Extract Out of Frame */
#define FM_PORT_FRM_ERR_NO_SCHEME               FM_FD_ERR_NO_SCHEME             /**< No Scheme Selected */
#define FM_PORT_FRM_ERR_KEYSIZE_OVERFLOW        FM_FD_ERR_KEYSIZE_OVERFLOW      /**< Keysize Overflow */
#define FM_PORT_FRM_ERR_COLOR_RED               FM_FD_ERR_COLOR_RED             /**< Frame color is red */
#define FM_PORT_FRM_ERR_COLOR_YELLOW            FM_FD_ERR_COLOR_YELLOW          /**< Frame color is yellow */
#define FM_PORT_FRM_ERR_ILL_PLCR                FM_FD_ERR_ILL_PLCR              /**< Illegal Policer Profile selected */
#define FM_PORT_FRM_ERR_PLCR_FRAME_LEN          FM_FD_ERR_PLCR_FRAME_LEN        /**< Policer frame length error */
#define FM_PORT_FRM_ERR_PRS_TIMEOUT             FM_FD_ERR_PRS_TIMEOUT           /**< Parser Time out Exceed */
#define FM_PORT_FRM_ERR_PRS_ILL_INSTRUCT        FM_FD_ERR_PRS_ILL_INSTRUCT      /**< Invalid Soft Parser instruction */
#define FM_PORT_FRM_ERR_PRS_HDR_ERR             FM_FD_ERR_PRS_HDR_ERR           /**< Header error was identified during parsing */
#define FM_PORT_FRM_ERR_BLOCK_LIMIT_EXCEEDED    FM_FD_ERR_BLOCK_LIMIT_EXCEEDED  /**< Frame parsed beyind 256 first bytes */
#define FM_PORT_FRM_ERR_PROCESS_TIMEOUT         0x00000001                      /**< FPM Frame Processing Timeout Exceeded */
/* @} */



/**************************************************************************//**
 @Group         FM_PORT_init_grp FM Port Initialization Unit

 @Description   FM Port Initialization Unit

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

/**************************************************************************//**
 @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_FmPortExceptionCallback) (t_Handle h_App, e_FmPortExceptions exception);

/**************************************************************************//**
 @Description   User callback function called by driver with received data.

                User provides this function. Driver invokes it.

 @Param[in]     h_App           Application's handle originally specified to
                                the API Config function
 @Param[in]     p_Data          A pointer to data received
 @Param[in]     length          length of received data
 @Param[in]     status          receive status and errors
 @Param[in]     position        position of buffer in frame
 @Param[in]     h_BufContext    A handle of the user acossiated with this buffer

 @Retval        e_RX_STORE_RESPONSE_CONTINUE - order the driver to continue Rx
                                               operation for all ready data.
 @Retval        e_RX_STORE_RESPONSE_PAUSE    - order the driver to stop Rx operation.
*//***************************************************************************/
typedef e_RxStoreResponse (t_FmPortImRxStoreCallback) (t_Handle h_App,
                                                       uint8_t  *p_Data,
                                                       uint16_t length,
                                                       uint16_t status,
                                                       uint8_t  position,
                                                       t_Handle h_BufContext);

/**************************************************************************//**
 @Description   User callback function called by driver when transmit completed.

                User provides this function. Driver invokes it.

 @Param[in]     h_App           Application's handle originally specified to
                                the API Config function
 @Param[in]     p_Data          A pointer to data received
 @Param[in]     status          transmit status and errors
 @Param[in]     lastBuffer      is last buffer in frame
 @Param[in]     h_BufContext    A handle of the user acossiated with this buffer
 *//***************************************************************************/
typedef void (t_FmPortImTxConfCallback) (t_Handle   h_App,
                                         uint8_t    *p_Data,
                                         uint16_t   status,
                                         t_Handle   h_BufContext);

/**************************************************************************//**
 @Description   A structure for additional Rx port parameters
*//***************************************************************************/
typedef struct t_FmPortRxParams {
    uint32_t                errFqid;            /**< Error Queue Id. */
    uint32_t                dfltFqid;           /**< Default Queue Id.  */
    uint16_t                liodnOffset;        /**< Port's LIODN offset. */
    t_FmExtPools            extBufPools;        /**< Which external buffer pools are used
                                                     (up to FM_PORT_MAX_NUM_OF_EXT_POOLS), and their sizes. */
} t_FmPortRxParams;

/**************************************************************************//**
 @Description   A structure for additional non-Rx port parameters
*//***************************************************************************/
typedef struct t_FmPortNonRxParams {
    uint32_t                errFqid;            /**< Error Queue Id. */
    uint32_t                dfltFqid;           /**< For Tx - Default Confirmation queue,
                                                     0 means no Tx confirmation for processed
                                                     frames. For OP port - default Rx queue. */
    uint32_t                qmChannel;          /**< QM-channel dedicated to this port; will be used
                                                     by the FM for dequeue. */
} t_FmPortNonRxParams;

/**************************************************************************//**
 @Description   A structure for additional Rx port parameters
*//***************************************************************************/
typedef struct t_FmPortImRxTxParams {
    t_Handle                    h_FmMuram;          /**< A handle of the FM-MURAM partition */
    uint16_t                    liodnOffset;        /**< For Rx ports only. Port's LIODN Offset. */
    uint8_t                     dataMemId;          /**< Memory partition ID for data buffers */
    uint32_t                    dataMemAttributes;  /**< Memory attributes for data buffers */
    t_BufferPoolInfo            rxPoolParams;       /**< For Rx ports only. */
    t_FmPortImRxStoreCallback   *f_RxStore;         /**< For Rx ports only. */
    t_FmPortImTxConfCallback    *f_TxConf;          /**< For Tx ports only. */
} t_FmPortImRxTxParams;

/**************************************************************************//**
 @Description   A union for additional parameters depending on port type
*//***************************************************************************/
typedef union u_FmPortSpecificParams {
    t_FmPortImRxTxParams        imRxTxParams;       /**< Rx/Tx Independent-Mode port parameter structure */
    t_FmPortRxParams            rxParams;           /**< Rx port parameters structure */
    t_FmPortNonRxParams         nonRxParams;        /**< Non-Rx port parameters structure */
} u_FmPortSpecificParams;

/**************************************************************************//**
 @Description   A structure representing FM initialization parameters
*//***************************************************************************/
typedef struct t_FmPortParams {
    uintptr_t                   baseAddr;           /**< Virtual Address of memory mapped FM Port registers.*/
    t_Handle                    h_Fm;               /**< A handle to the FM object this port related to */
    e_FmPortType                portType;           /**< Port type */
    uint8_t                     portId;             /**< Port Id - relative to type;
                                                         NOTE: When configuring Offline Parsing port for
                                                         FMANv3 devices (DPAA_VERSION 11 and higher),
                                                         it is highly recommended NOT to use portId=0 due to lack
                                                         of HW resources on portId=0. */
    bool                        independentModeEnable;
                                                    /**< This port is Independent-Mode - Used for Rx/Tx ports only! */
    uint16_t                    liodnBase;          /**< Irrelevant for P4080 rev 1. LIODN base for this port, to be
                                                         used together with LIODN offset. */
    u_FmPortSpecificParams      specificParams;     /**< Additional parameters depending on port
                                                         type. */

    t_FmPortExceptionCallback   *f_Exception;       /**< Relevant for IM only Callback routine to be called on BUSY exception */
    t_Handle                    h_App;              /**< A handle to an application layer object; This handle will
                                                         be passed by the driver upon calling the above callbacks */
} t_FmPortParams;


/**************************************************************************//**
 @Function      FM_PORT_Config

 @Description   Creates a descriptor for the FM PORT module.

                The routine returns a handle (descriptor) to the FM PORT object.
                This descriptor must be passed as first parameter to all other
                FM PORT function calls.

                No actual initialization or configuration of FM hardware is
                done by this routine.

 @Param[in]     p_FmPortParams   - Pointer to data structure of parameters

 @Retval        Handle to FM object, or NULL for Failure.
*//***************************************************************************/
t_Handle FM_PORT_Config(t_FmPortParams *p_FmPortParams);

/**************************************************************************//**
 @Function      FM_PORT_Init

 @Description   Initializes the FM PORT module by defining the software structure
                and configuring the hardware registers.

 @Param[in]     h_FmPort - FM PORT module descriptor

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

/**************************************************************************//**
 @Function      FM_PORT_Free

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

                Calling this routine invalidates the descriptor.

 @Param[in]     h_FmPort - FM PORT module descriptor

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


/**************************************************************************//**
 @Group         FM_PORT_advanced_init_grp    FM Port Advanced Configuration Unit

 @Description   Configuration functions used to change default values.

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

/**************************************************************************//**
 @Description   enum for defining QM frame dequeue
*//***************************************************************************/
typedef enum e_FmPortDeqType {
   e_FM_PORT_DEQ_TYPE1,             /**< Dequeue from the SP channel - with priority precedence,
                                         and Intra-Class Scheduling respected. */
   e_FM_PORT_DEQ_TYPE2,             /**< Dequeue from the SP channel - with active FQ precedence,
                                         and Intra-Class Scheduling respected. */
   e_FM_PORT_DEQ_TYPE3              /**< Dequeue from the SP channel - with active FQ precedence,
                                         and override Intra-Class Scheduling */
} e_FmPortDeqType;

/**************************************************************************//**
 @Description   enum for defining QM frame dequeue
*//***************************************************************************/
typedef enum e_FmPortDeqPrefetchOption {
   e_FM_PORT_DEQ_NO_PREFETCH,       /**< QMI preforms a dequeue action for a single frame
                                         only when a dedicated portID Tnum is waiting. */
   e_FM_PORT_DEQ_PARTIAL_PREFETCH,  /**< QMI preforms a dequeue action for 3 frames when
                                         one dedicated portId tnum is waiting. */
   e_FM_PORT_DEQ_FULL_PREFETCH      /**< QMI preforms a dequeue action for 3 frames when
                                         no dedicated portId tnums are waiting. */

} e_FmPortDeqPrefetchOption;

/**************************************************************************//**
 @Description   enum for defining port default color
*//***************************************************************************/
typedef enum e_FmPortColor {
    e_FM_PORT_COLOR_GREEN,          /**< Default port color is green */
    e_FM_PORT_COLOR_YELLOW,         /**< Default port color is yellow */
    e_FM_PORT_COLOR_RED,            /**< Default port color is red */
    e_FM_PORT_COLOR_OVERRIDE        /**< Ignore color */
} e_FmPortColor;

/**************************************************************************//**
 @Description   A structure for defining Dual Tx rate limiting scale
*//***************************************************************************/
typedef enum e_FmPortDualRateLimiterScaleDown {
    e_FM_PORT_DUAL_RATE_LIMITER_NONE = 0,           /**< Use only single rate limiter  */
    e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_2,    /**< Divide high rate limiter by 2 */
    e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_4,    /**< Divide high rate limiter by 4 */
    e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_8     /**< Divide high rate limiter by 8 */
} e_FmPortDualRateLimiterScaleDown;


/**************************************************************************//**
 @Description   A structure for defining FM port resources
*//***************************************************************************/
typedef struct t_FmPortRsrc {
    uint32_t    num;                /**< Committed required resource */
    uint32_t    extra;              /**< Extra (not committed) required resource */
} t_FmPortRsrc;

/**************************************************************************//**
 @Description   A structure for defining observed pool depletion
*//***************************************************************************/
typedef struct t_FmPortObservedBufPoolDepletion {
    t_FmBufPoolDepletion    poolDepletionParams;/**< parameters to define pool depletion */
    t_FmExtPools            poolsParams;        /**< Which external buffer pools are observed
                                                     (up to FM_PORT_MAX_NUM_OF_OBSERVED_EXT_POOLS),
                                                     and their sizes. */
} t_FmPortObservedBufPoolDepletion;

/**************************************************************************//**
 @Description   A structure for defining Tx rate limiting
*//***************************************************************************/
typedef struct t_FmPortRateLimit {
    uint16_t                            maxBurstSize;           /**< in KBytes for Tx ports, in frames
                                                                     for OP ports. (note that
                                                                     for early chips burst size is
                                                                     rounded up to a multiply of 1000 frames).*/
    uint32_t                            rateLimit;              /**< in Kb/sec for Tx ports, in frame/sec for
                                                                     OP ports. Rate limit refers to
                                                                     data rate (rather than line rate). */
    e_FmPortDualRateLimiterScaleDown    rateLimitDivider;       /**< For OP ports only. Not-valid
                                                                     for some earlier chip revisions */
} t_FmPortRateLimit;

/**************************************************************************//**
 @Description   A structure for defining the parameters of
                the Rx port performance counters
*//***************************************************************************/
typedef struct t_FmPortPerformanceCnt {
    uint8_t     taskCompVal;            /**< Task compare value */
    uint8_t     queueCompVal;           /**< Rx queue/Tx confirm queue compare
                                             value (unused for H/O) */
    uint8_t     dmaCompVal;             /**< Dma compare value */
    uint32_t    fifoCompVal;            /**< Fifo compare value (in bytes) */
} t_FmPortPerformanceCnt;


/**************************************************************************//**
 @Description   A structure for defining the sizes of the Deep Sleep
                the Auto Response tables
*//***************************************************************************/
typedef struct t_FmPortDsarTablesSizes
{
    uint16_t   maxNumOfArpEntries;
    uint16_t   maxNumOfEchoIpv4Entries;
    uint16_t   maxNumOfNdpEntries;
    uint16_t   maxNumOfEchoIpv6Entries;
    uint16_t   maxNumOfSnmpIPV4Entries;
    uint16_t   maxNumOfSnmpIPV6Entries;
    uint16_t   maxNumOfSnmpOidEntries;
    uint16_t   maxNumOfSnmpOidChar; /* total amount of character needed for the snmp table */

    uint16_t   maxNumOfIpProtFiltering;
    uint16_t   maxNumOfTcpPortFiltering;
    uint16_t   maxNumOfUdpPortFiltering;
} t_FmPortDsarTablesSizes;


/**************************************************************************//**
 @Function      FM_PORT_ConfigDsarSupport

 @Description   This function will allocate the amount of MURAM needed for
                this max number of entries for Deep Sleep Auto Response.
                it will calculate all needed MURAM for autoresponse including
                necesary common stuff.


 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     params      A pointer to a structure containing the maximum
                            sizes of the auto response tables

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDsarSupport(t_Handle h_FmPortRx, t_FmPortDsarTablesSizes *params);

/**************************************************************************//**
 @Function      FM_PORT_ConfigNumOfOpenDmas

 @Description   Calling this routine changes the max number of open DMA's
                available for this port. It changes this parameter in the
                internal driver data base from its default configuration
                [OP: 1]
                [1G-RX, 1G-TX: 1 (+1)]
                [10G-RX, 10G-TX: 8 (+8)]

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     p_OpenDmas  A pointer to a structure of parameters defining
                            the open DMA allocation.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigNumOfOpenDmas(t_Handle h_FmPort, t_FmPortRsrc *p_OpenDmas);

/**************************************************************************//**
 @Function      FM_PORT_ConfigNumOfTasks

 @Description   Calling this routine changes the max number of tasks
                available for this port. It changes this parameter in the
                internal driver data base from its default configuration
                [OP: 1]
                [1G-RX, 1G-TX: 3 (+2)]
                [10G-RX, 10G-TX: 16 (+8)]

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     p_NumOfTasks    A pointer to a structure of parameters defining
                                the tasks allocation.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigNumOfTasks(t_Handle h_FmPort, t_FmPortRsrc *p_NumOfTasks);

/**************************************************************************//**
 @Function      FM_PORT_ConfigSizeOfFifo

 @Description   Calling this routine changes the max FIFO size configured for this port.

                This function changes the internal driver data base from its
                default configuration. Please refer to the driver's User Guide for
                information on default FIFO sizes in the various devices.
                [OP: 2KB]
                [1G-RX, 1G-TX: 11KB]
                [10G-RX, 10G-TX: 12KB]

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     p_SizeOfFifo    A pointer to a structure of parameters defining
                                the FIFO allocation.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigSizeOfFifo(t_Handle h_FmPort, t_FmPortRsrc *p_SizeOfFifo);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDeqHighPriority

 @Description   Calling this routine changes the dequeue priority in the
                internal driver data base from its default configuration
                1G: [DEFAULT_PORT_deqHighPriority_1G]
                10G: [DEFAULT_PORT_deqHighPriority_10G]

                May be used for Non-Rx ports only

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     highPri     TRUE to select high priority, FALSE for normal operation.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDeqHighPriority(t_Handle h_FmPort, bool highPri);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDeqType

 @Description   Calling this routine changes the dequeue type parameter in the
                internal driver data base from its default configuration
                [DEFAULT_PORT_deqType].

                May be used for Non-Rx ports only

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     deqType     According to QM definition.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDeqType(t_Handle h_FmPort, e_FmPortDeqType deqType);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDeqPrefetchOption

 @Description   Calling this routine changes the dequeue prefetch option parameter in the
                internal driver data base from its default configuration
                [DEFAULT_PORT_deqPrefetchOption]
                Note: Available for some chips only

                May be used for Non-Rx ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     deqPrefetchOption   New option

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDeqPrefetchOption(t_Handle h_FmPort, e_FmPortDeqPrefetchOption deqPrefetchOption);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDeqByteCnt

 @Description   Calling this routine changes the dequeue byte count parameter in
                the internal driver data base from its default configuration
                1G:[DEFAULT_PORT_deqByteCnt_1G].
                10G:[DEFAULT_PORT_deqByteCnt_10G].

                May be used for Non-Rx ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     deqByteCnt      New byte count

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDeqByteCnt(t_Handle h_FmPort, uint16_t deqByteCnt);

/**************************************************************************//**
 @Function      FM_PORT_ConfigBufferPrefixContent

 @Description   Defines the structure, size and content of the application buffer.
                The prefix will
                In Tx ports, if 'passPrsResult', the application
                should set a value to their offsets in the prefix of
                the FM will save the first 'privDataSize', than,
                depending on 'passPrsResult' and 'passTimeStamp', copy parse result
                and timeStamp, and the packet itself (in this order), to the
                application buffer, and to offset.
                Calling this routine changes the buffer margins definitions
                in the internal driver data base from its default
                configuration: Data size:  [DEFAULT_PORT_bufferPrefixContent_privDataSize]
                               Pass Parser result: [DEFAULT_PORT_bufferPrefixContent_passPrsResult].
                               Pass timestamp: [DEFAULT_PORT_bufferPrefixContent_passTimeStamp].

                May be used for all ports

 @Param[in]     h_FmPort                        A handle to a FM Port module.
 @Param[in,out] p_FmBufferPrefixContent         A structure of parameters describing the
                                                structure of the buffer.
                                                Out parameter: Start margin - offset
                                                of data from start of external buffer.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigBufferPrefixContent(t_Handle                      h_FmPort,
                                          t_FmBufferPrefixContent       *p_FmBufferPrefixContent);

/**************************************************************************//**
 @Function      FM_PORT_ConfigCheksumLastBytesIgnore

 @Description   Calling this routine changes the number of checksum bytes to ignore
                parameter in the internal driver data base from its default configuration
                [DEFAULT_PORT_cheksumLastBytesIgnore]

                May be used by Tx & Rx ports only

 @Param[in]     h_FmPort                A handle to a FM Port module.
 @Param[in]     cheksumLastBytesIgnore  New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigCheksumLastBytesIgnore(t_Handle h_FmPort, uint8_t cheksumLastBytesIgnore);

/**************************************************************************//**
 @Function      FM_PORT_ConfigCutBytesFromEnd

 @Description   Calling this routine changes the number of bytes to cut from a
                frame's end parameter in the internal driver data base
                from its default configuration [DEFAULT_PORT_cutBytesFromEnd]
                Note that if the result of (frame length before chop - cutBytesFromEnd) is
                less than 14 bytes, the chop operation is not executed.

                May be used for Rx ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     cutBytesFromEnd     New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigCutBytesFromEnd(t_Handle h_FmPort, uint8_t cutBytesFromEnd);

/**************************************************************************//**
 @Function      FM_PORT_ConfigPoolDepletion

 @Description   Calling this routine enables pause frame generation depending on the
                depletion status of BM pools. It also defines the conditions to activate
                this functionality. By default, this functionality is disabled.

                May be used for Rx ports only

 @Param[in]     h_FmPort                A handle to a FM Port module.
 @Param[in]     p_BufPoolDepletion      A structure of pool depletion parameters

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigPoolDepletion(t_Handle h_FmPort, t_FmBufPoolDepletion *p_BufPoolDepletion);

/**************************************************************************//**
 @Function      FM_PORT_ConfigObservedPoolDepletion

 @Description   Calling this routine enables a mechanism to stop port enqueue
                depending on the depletion status of selected BM pools.
                It also defines the conditions to activate
                this functionality. By default, this functionality is disabled.

                Note: Available for some chips only

                May be used for OP ports only

 @Param[in]     h_FmPort                            A handle to a FM Port module.
 @Param[in]     p_FmPortObservedBufPoolDepletion    A structure of parameters for pool depletion.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigObservedPoolDepletion(t_Handle                            h_FmPort,
                                            t_FmPortObservedBufPoolDepletion    *p_FmPortObservedBufPoolDepletion);

/**************************************************************************//**
 @Function      FM_PORT_ConfigExtBufPools

 @Description   This routine should be called for OP ports
                that internally use BM buffer pools. In such cases, e.g. for fragmentation and
                re-assembly, the FM needs new BM buffers. By calling this routine the user
                specifies the BM buffer pools that should be used.

                Note: Available for some chips only

                May be used for OP ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     p_FmExtPools        A structure of parameters for the external pools.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigExtBufPools(t_Handle h_FmPort, t_FmExtPools *p_FmExtPools);

/**************************************************************************//**
 @Function      FM_PORT_ConfigBackupPools

 @Description   Calling this routine allows the configuration of some of the BM pools
                defined for this port as backup pools.
                A pool configured to be a backup pool will be used only if all other
                enabled non-backup pools are depleted.

                May be used for Rx ports only

 @Param[in]     h_FmPort                A handle to a FM Port module.
 @Param[in]     p_FmPortBackupBmPools   An array of pool id's. All pools specified here will
                                        be defined as backup pools.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigBackupPools(t_Handle h_FmPort, t_FmBackupBmPools *p_FmPortBackupBmPools);

/**************************************************************************//**
 @Function      FM_PORT_ConfigFrmDiscardOverride

 @Description   Calling this routine changes the error frames destination parameter
                in the internal driver data base from its default configuration:
                override = [DEFAULT_PORT_frmDiscardOverride]

                May be used for Rx and OP ports only

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     override    TRUE to override discarding of error frames and
                            enqueueing them to error queue.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigFrmDiscardOverride(t_Handle h_FmPort, bool override);

/**************************************************************************//**
 @Function      FM_PORT_ConfigErrorsToDiscard

 @Description   Calling this routine changes the behaviour on error parameter
                in the internal driver data base from its default configuration:
                [DEFAULT_PORT_errorsToDiscard].
                If a requested error was previously defined as "ErrorsToEnqueue" it's
                definition will change and the frame will be discarded.
                Errors that were not defined either as "ErrorsToEnqueue" nor as
                "ErrorsToDiscard", will be forwarded to CPU.

                May be used for Rx and OP ports only

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     errs        A list of errors to discard

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigErrorsToDiscard(t_Handle h_FmPort, fmPortFrameErrSelect_t errs);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDmaSwapData

 @Description   Calling this routine changes the DMA swap data aparameter
                in the internal driver data base from its default
                configuration  [DEFAULT_PORT_dmaSwapData]

                May be used for all port types

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     swapData    New selection

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDmaSwapData(t_Handle h_FmPort, e_FmDmaSwapOption swapData);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDmaIcCacheAttr

 @Description   Calling this routine changes the internal context cache
                attribute parameter in the internal driver data base
                from its default configuration  [DEFAULT_PORT_dmaIntContextCacheAttr]

                May be used for all port types

 @Param[in]     h_FmPort               A handle to a FM Port module.
 @Param[in]     intContextCacheAttr    New selection

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDmaIcCacheAttr(t_Handle h_FmPort, e_FmDmaCacheOption intContextCacheAttr);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDmaHdrAttr

 @Description   Calling this routine changes the header cache
                attribute parameter in the internal driver data base
                from its default configuration  [DEFAULT_PORT_dmaHeaderCacheAttr]

                May be used for all port types

 @Param[in]     h_FmPort                    A handle to a FM Port module.
 @Param[in]     headerCacheAttr             New selection

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDmaHdrAttr(t_Handle h_FmPort, e_FmDmaCacheOption headerCacheAttr);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDmaScatterGatherAttr

 @Description   Calling this routine changes the scatter gather cache
                attribute parameter in the internal driver data base
                from its default configuration  [DEFAULT_PORT_dmaScatterGatherCacheAttr]

                May be used for all port types

 @Param[in]     h_FmPort                    A handle to a FM Port module.
 @Param[in]     scatterGatherCacheAttr      New selection

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDmaScatterGatherAttr(t_Handle h_FmPort, e_FmDmaCacheOption scatterGatherCacheAttr);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDmaWriteOptimize

 @Description   Calling this routine changes the write optimization
                parameter in the internal driver data base
                from its default configuration:  By default optimize = [DEFAULT_PORT_dmaWriteOptimize].
                Note:

                1. For head optimization, data alignment must be >= 16 (supported by default).

                3. For tail optimization, note that the optimization is performed by extending the write transaction
                of the frame payload at the tail as needed to achieve optimal bus transfers, so that the last write
                is extended to be on 16/64 bytes aligned block (chip dependent).

                Relevant for non-Tx port types

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     optimize    TRUE to enable optimization, FALSE for normal operation

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDmaWriteOptimize(t_Handle h_FmPort, bool optimize);

/**************************************************************************//**
 @Function      FM_PORT_ConfigNoScatherGather

 @Description    Calling this routine changes the noScatherGather parameter in internal driver data base
                 from its default configuration.

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     noScatherGather (TRUE - frame is discarded if can not be stored in single buffer,
                                 FALSE - frame can be stored in scatter gather (S/G) format).

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigNoScatherGather(t_Handle h_FmPort, bool noScatherGather);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDfltColor

 @Description   Calling this routine changes the internal default color parameter
                in the internal driver data base
                from its default configuration  [DEFAULT_PORT_color]

                May be used for all port types

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     color           New selection

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDfltColor(t_Handle h_FmPort, e_FmPortColor color);

/**************************************************************************//**
 @Function      FM_PORT_ConfigSyncReq

 @Description   Calling this routine changes the synchronization attribute parameter
                in the internal driver data base from its default configuration:
                syncReq = [DEFAULT_PORT_syncReq]

                May be used for all port types

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     syncReq         TRUE to request synchronization, FALSE otherwize.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigSyncReq(t_Handle h_FmPort, bool syncReq);

/**************************************************************************//**
 @Function      FM_PORT_ConfigForwardReuseIntContext

 @Description   This routine is relevant for Rx ports that are routed to OP port.
                It changes the internal context reuse option in the internal
                driver data base from its default configuration:
                reuse = [DEFAULT_PORT_forwardIntContextReuse]

                May be used for Rx ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     reuse           TRUE to reuse internal context on frames
                                forwarded to OP port.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigForwardReuseIntContext(t_Handle h_FmPort, bool reuse);

/**************************************************************************//**
 @Function      FM_PORT_ConfigDontReleaseTxBufToBM

 @Description   This routine should be called if no Tx confirmation
                is done, and yet buffers should not be released to the BM.
                Normally, buffers are returned using the Tx confirmation
                process. When Tx confirmation is not used (defFqid=0),
                buffers are typically released to the BM. This routine
                may be called to avoid this behavior and not release the
                buffers.

                May be used for Tx ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigDontReleaseTxBufToBM(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_ConfigIMMaxRxBufLength

 @Description   Changes the maximum receive buffer length from its default
                configuration: Closest rounded down power of 2 value of the
                data buffer size.

                The maximum receive buffer length directly affects the structure
                of received frames (single- or multi-buffered) and the performance
                of both the FM and the driver.

                The selection between single- or multi-buffered frames should be
                done according to the characteristics of the specific application.
                The recommended mode is to use a single data buffer per packet,
                as this mode provides the best performance. However, the user can
                select to use multiple data buffers per packet.

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     newVal          Maximum receive buffer length (in bytes).

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
                This routine is to be used only if Independent-Mode is enabled.
*//***************************************************************************/
t_Error FM_PORT_ConfigIMMaxRxBufLength(t_Handle h_FmPort, uint16_t newVal);

/**************************************************************************//**
 @Function      FM_PORT_ConfigIMRxBdRingLength

 @Description   Changes the receive BD ring length from its default
                configuration:[DEFAULT_PORT_rxBdRingLength]

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     newVal          The desired BD ring length.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
                This routine is to be used only if Independent-Mode is enabled.
*//***************************************************************************/
t_Error FM_PORT_ConfigIMRxBdRingLength(t_Handle h_FmPort, uint16_t newVal);

/**************************************************************************//**
 @Function      FM_PORT_ConfigIMTxBdRingLength

 @Description   Changes the transmit BD ring length from its default
                configuration:[DEFAULT_PORT_txBdRingLength]

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     newVal          The desired BD ring length.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
                This routine is to be used only if Independent-Mode is enabled.
*//***************************************************************************/
t_Error FM_PORT_ConfigIMTxBdRingLength(t_Handle h_FmPort, uint16_t newVal);

/**************************************************************************//**
 @Function      FM_PORT_ConfigIMFmanCtrlExternalStructsMemory

 @Description   Configures memory partition and attributes for FMan-Controller
                data structures (e.g. BD rings).
                Calling this routine changes the internal driver data base
                from its default configuration
                [DEFAULT_PORT_ImfwExtStructsMemId, DEFAULT_PORT_ImfwExtStructsMemAttr].

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     memId           Memory partition ID.
 @Param[in]     memAttributes   Memory attributes mask (a combination of MEMORY_ATTR_x flags).

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error  FM_PORT_ConfigIMFmanCtrlExternalStructsMemory(t_Handle h_FmPort,
                                                       uint8_t  memId,
                                                       uint32_t memAttributes);

/**************************************************************************//**
 @Function      FM_PORT_ConfigIMPolling

 @Description   Changes the Rx flow from interrupt driven (default) to polling.

 @Param[in]     h_FmPort        A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
                This routine is to be used only if Independent-Mode is enabled.
*//***************************************************************************/
t_Error FM_PORT_ConfigIMPolling(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_ConfigMaxFrameLength

 @Description   Changes the definition of the max size of frame that should be
                transmitted/received on this port from its default value [DEFAULT_PORT_maxFrameLength].
                This parameter is used for confirmation of the minimum Fifo
                size calculations and only for Tx ports or ports working in
                independent mode. This should be larger than the maximum possible
                MTU that will be used for this port (i.e. its MAC).

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     length          Max size of frame

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
                This routine is to be used only if Independent-Mode is enabled.
*//***************************************************************************/
t_Error FM_PORT_ConfigMaxFrameLength(t_Handle h_FmPort, uint16_t length);

/**************************************************************************//*
 @Function      FM_PORT_ConfigTxFifoMinFillLevel

 @Description   Calling this routine changes the fifo minimum
                fill level parameter in the internal driver data base
                from its default configuration  [DEFAULT_PORT_txFifoMinFillLevel]

                May be used for Tx ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     minFillLevel    New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigTxFifoMinFillLevel(t_Handle h_FmPort, uint32_t minFillLevel);

/**************************************************************************//*
 @Function      FM_PORT_ConfigFifoDeqPipelineDepth

 @Description   Calling this routine changes the fifo dequeue
                pipeline depth parameter in the internal driver data base

                from its default configuration: 1G ports: [DEFAULT_PORT_fifoDeqPipelineDepth_1G],
                10G port: [DEFAULT_PORT_fifoDeqPipelineDepth_10G],
                OP port: [DEFAULT_PORT_fifoDeqPipelineDepth_OH]

                May be used for Tx/OP ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     deqPipelineDepth    New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigFifoDeqPipelineDepth(t_Handle h_FmPort, uint8_t deqPipelineDepth);

/**************************************************************************//*
 @Function      FM_PORT_ConfigTxFifoLowComfLevel

 @Description   Calling this routine changes the fifo low comfort level
                parameter in internal driver data base
                from its default configuration [DEFAULT_PORT_txFifoLowComfLevel]

                May be used for Tx ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     fifoLowComfLevel    New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigTxFifoLowComfLevel(t_Handle h_FmPort, uint32_t fifoLowComfLevel);

/**************************************************************************//*
 @Function      FM_PORT_ConfigRxFifoThreshold

 @Description   Calling this routine changes the threshold of the FIFO
                fill level parameter in the internal driver data base
                from its default configuration [DEFAULT_PORT_rxFifoThreshold]

                If the total number of buffers which are
                currently in use and associated with the
                specific RX port exceed this threshold, the
                BMI will signal the MAC to send a pause frame
                over the link.

                May be used for Rx ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     fifoThreshold       New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigRxFifoThreshold(t_Handle h_FmPort, uint32_t fifoThreshold);

/**************************************************************************//*
 @Function      FM_PORT_ConfigRxFifoPriElevationLevel

 @Description   Calling this routine changes the priority elevation level
                parameter in the internal driver data base from its default
                configuration  [DEFAULT_PORT_rxFifoPriElevationLevel]

                If the total number of buffers which are currently in use and
                associated with the specific RX port exceed the amount specified
                in priElevationLevel, BMI will signal the main FM's DMA to
                elevate the FM priority on the system bus.

                May be used for Rx ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     priElevationLevel   New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigRxFifoPriElevationLevel(t_Handle h_FmPort, uint32_t priElevationLevel);

#ifdef FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669
/**************************************************************************//*
 @Function      FM_PORT_ConfigBCBWorkaround

 @Description   Configures BCB errata workaround.

                When BCB errata is applicable, the workaround is always
                performed by FM Controller. Thus, this functions doesn't
                actually enable errata workaround but rather allows driver
                to perform adjustments required due to errata workaround
                execution in FM controller.

                Applying BCB workaround also configures FM_PORT_FRM_ERR_PHYSICAL
                errors to be discarded. Thus FM_PORT_FRM_ERR_PHYSICAL can't be
                set by FM_PORT_SetErrorsRoute() function.

 @Param[in]     h_FmPort            A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigBCBWorkaround(t_Handle h_FmPort);
#endif /* FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669 */

#if (DPAA_VERSION >= 11)
/**************************************************************************//*
 @Function      FM_PORT_ConfigInternalBuffOffset

 @Description   Configures internal buffer offset.

                May be used for Rx and OP ports only

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     val                 New value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ConfigInternalBuffOffset(t_Handle h_FmPort, uint8_t val);
#endif /* (DPAA_VERSION >= 11) */

/** @} */ /* end of FM_PORT_advanced_init_grp group */
/** @} */ /* end of FM_PORT_init_grp group */


/**************************************************************************//**
 @Group         FM_PORT_runtime_control_grp FM Port Runtime Control Unit

 @Description   FM Port Runtime control unit API functions, definitions and enums.

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

/**************************************************************************//**
 @Description   enum for defining FM Port counters
*//***************************************************************************/
typedef enum e_FmPortCounters {
    e_FM_PORT_COUNTERS_CYCLE,                       /**< BMI performance counter */
    e_FM_PORT_COUNTERS_TASK_UTIL,                   /**< BMI performance counter */
    e_FM_PORT_COUNTERS_QUEUE_UTIL,                  /**< BMI performance counter */
    e_FM_PORT_COUNTERS_DMA_UTIL,                    /**< BMI performance counter */
    e_FM_PORT_COUNTERS_FIFO_UTIL,                   /**< BMI performance counter */
    e_FM_PORT_COUNTERS_RX_PAUSE_ACTIVATION,         /**< BMI Rx only performance counter */
    e_FM_PORT_COUNTERS_FRAME,                       /**< BMI statistics counter */
    e_FM_PORT_COUNTERS_DISCARD_FRAME,               /**< BMI statistics counter */
    e_FM_PORT_COUNTERS_DEALLOC_BUF,                 /**< BMI deallocate buffer statistics counter */
    e_FM_PORT_COUNTERS_RX_BAD_FRAME,                /**< BMI Rx only statistics counter */
    e_FM_PORT_COUNTERS_RX_LARGE_FRAME,              /**< BMI Rx only statistics counter */
    e_FM_PORT_COUNTERS_RX_FILTER_FRAME,             /**< BMI Rx & OP only statistics counter */
    e_FM_PORT_COUNTERS_RX_LIST_DMA_ERR,             /**< BMI Rx, OP & HC only statistics counter */
    e_FM_PORT_COUNTERS_RX_OUT_OF_BUFFERS_DISCARD,   /**< BMI Rx, OP & HC statistics counter */
    e_FM_PORT_COUNTERS_PREPARE_TO_ENQUEUE_COUNTER,  /**< BMI Rx, OP & HC only statistics counter */
    e_FM_PORT_COUNTERS_WRED_DISCARD,                /**< BMI OP & HC only statistics counter */
    e_FM_PORT_COUNTERS_LENGTH_ERR,                  /**< BMI non-Rx statistics counter */
    e_FM_PORT_COUNTERS_UNSUPPRTED_FORMAT,           /**< BMI non-Rx statistics counter */
    e_FM_PORT_COUNTERS_DEQ_TOTAL,                   /**< QMI total QM dequeues counter */
    e_FM_PORT_COUNTERS_ENQ_TOTAL,                   /**< QMI total QM enqueues counter */
    e_FM_PORT_COUNTERS_DEQ_FROM_DEFAULT,            /**< QMI counter */
    e_FM_PORT_COUNTERS_DEQ_CONFIRM                  /**< QMI counter */
} e_FmPortCounters;

typedef struct t_FmPortBmiStats {
    uint32_t cntCycle;
    uint32_t cntTaskUtil;
    uint32_t cntQueueUtil;
    uint32_t cntDmaUtil;
    uint32_t cntFifoUtil;
    uint32_t cntRxPauseActivation;
    uint32_t cntFrame;
    uint32_t cntDiscardFrame;
    uint32_t cntDeallocBuf;
    uint32_t cntRxBadFrame;
    uint32_t cntRxLargeFrame;
    uint32_t cntRxFilterFrame;
    uint32_t cntRxListDmaErr;
    uint32_t cntRxOutOfBuffersDiscard;
    uint32_t cntWredDiscard;
    uint32_t cntLengthErr;
    uint32_t cntUnsupportedFormat;
} t_FmPortBmiStats;

/**************************************************************************//**
 @Description   Structure for Port id parameters.
                Fields commented 'IN' are passed by the port module to be used
                by the FM module.
                Fields commented 'OUT' will be filled by FM before returning to port.
*//***************************************************************************/
typedef struct t_FmPortCongestionGrps {
    uint16_t    numOfCongestionGrpsToConsider;          /**< The number of required CGs
                                                             to define the size of the following array */
    uint8_t     congestionGrpsToConsider[FM_PORT_NUM_OF_CONGESTION_GRPS];
                                                        /**< An array of CG indexes;
                                                             Note that the size of the array should be
                                                             'numOfCongestionGrpsToConsider'. */
#if (DPAA_VERSION >= 11)
    bool        pfcPrioritiesEn[FM_PORT_NUM_OF_CONGESTION_GRPS][FM_MAX_NUM_OF_PFC_PRIORITIES];
                                                        /**< a matrix that represents the map between the CG ids
                                                             defined in 'congestionGrpsToConsider' to the priorties
                                                             mapping array. */
#endif /* (DPAA_VERSION >= 11) */
} t_FmPortCongestionGrps;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response ARP Entry
*//***************************************************************************/
typedef struct t_FmPortDsarArpEntry
{
    uint32_t  ipAddress;
    uint8_t   mac[6];
    bool      isVlan;
    uint16_t  vid;
} t_FmPortDsarArpEntry;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response ARP info
*//***************************************************************************/
typedef struct t_FmPortDsarArpInfo
{
    uint8_t           tableSize;
    t_FmPortDsarArpEntry *p_AutoResTable;
    bool              enableConflictDetection; /* when TRUE Conflict Detection will be checked and wake the host if needed */
} t_FmPortDsarArpInfo;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response NDP Entry
*//***************************************************************************/
typedef struct t_FmPortDsarNdpEntry
{
    uint32_t  ipAddress[4];
    uint8_t   mac[6];
    bool      isVlan;
    uint16_t  vid;
} t_FmPortDsarNdpEntry;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response NDP info
*//***************************************************************************/
typedef struct t_FmPortDsarNdpInfo
{
    uint32_t              multicastGroup;

    uint8_t               tableSizeAssigned;
    t_FmPortDsarNdpEntry  *p_AutoResTableAssigned; /* This list refer to solicitation IP addresses.
                                                                 Note that all IP adresses must be from the same multicast group.
                                                                 This will be checked and if not operation will fail. */
    uint8_t               tableSizeTmp;
    t_FmPortDsarNdpEntry  *p_AutoResTableTmp;      /* This list refer to temp IP addresses.
                                                             Note that all temp IP adresses must be from the same multicast group.
                                                             This will be checked and if not operation will fail. */

    bool                  enableConflictDetection; /* when TRUE Conflict Detection will be checked and wake the host if needed */

} t_FmPortDsarNdpInfo;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response ICMPV4 info
*//***************************************************************************/
typedef struct t_FmPortDsarEchoIpv4Info
{
    uint8_t            tableSize;
    t_FmPortDsarArpEntry  *p_AutoResTable;
} t_FmPortDsarEchoIpv4Info;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response ICMPV6 info
*//***************************************************************************/
typedef struct t_FmPortDsarEchoIpv6Info
{
    uint8_t            tableSize;
    t_FmPortDsarNdpEntry  *p_AutoResTable;
} t_FmPortDsarEchoIpv6Info;

/**************************************************************************//**
@Description    Deep Sleep Auto Response SNMP OIDs table entry

*//***************************************************************************/
typedef struct {
	uint16_t     oidSize;
	uint8_t      *oidVal; /* only the oid string */
	uint16_t     resSize;
	uint8_t      *resVal; /* resVal will be the entire reply,
				i.e. "Type|Length|Value" */
} t_FmPortDsarOidsEntry;

/**************************************************************************//**
 @Description   Deep Sleep Auto Response SNMP IPv4 Addresses Table Entry
                Refer to the FMan Controller spec for more details.
*//***************************************************************************/
typedef struct
{
    uint32_t ipv4Addr; /*!< 32 bit IPv4 Address. */
    bool      isVlan;
    uint16_t vid;   /*!< 12 bits VLAN ID. The 4 left-most bits should be cleared                      */
                       /*!< This field should be 0x0000 for an entry with no VLAN tag or a null VLAN ID. */
} t_FmPortDsarSnmpIpv4AddrTblEntry;

/**************************************************************************//**
 @Description   Deep Sleep Auto Response SNMP IPv6 Addresses Table Entry
                Refer to the FMan Controller spec for more details.
*//***************************************************************************/
typedef struct
{
    uint32_t ipv6Addr[4];  /*!< 4 * 32 bit IPv6 Address.                                                     */
    bool      isVlan;
    uint16_t vid;       /*!< 12 bits VLAN ID. The 4 left-most bits should be cleared                      */
                           /*!< This field should be 0x0000 for an entry with no VLAN tag or a null VLAN ID. */
} t_FmPortDsarSnmpIpv6AddrTblEntry;

/**************************************************************************//**
 @Description   Deep Sleep Auto Response SNMP Descriptor

*//***************************************************************************/
typedef struct
{
    uint16_t control;                          /**< Control bits [0-15]. */
    uint16_t maxSnmpMsgLength;                 /**< Maximal allowed SNMP message length. */
    uint16_t numOfIpv4Addresses;               /**< Number of entries in IPv4 addresses table. */
    uint16_t numOfIpv6Addresses;               /**< Number of entries in IPv6 addresses table. */
    t_FmPortDsarSnmpIpv4AddrTblEntry *p_Ipv4AddrTbl; /**< Pointer to IPv4 addresses table. */
    t_FmPortDsarSnmpIpv6AddrTblEntry *p_Ipv6AddrTbl; /**< Pointer to IPv6 addresses table. */
    uint8_t *p_RdOnlyCommunityStr;             /**< Pointer to the Read Only Community String. */
    uint8_t *p_RdWrCommunityStr;               /**< Pointer to the Read Write Community String. */
    t_FmPortDsarOidsEntry *p_OidsTbl;                 /**< Pointer to OIDs table. */
    uint32_t oidsTblSize;                      /**< Number of entries in OIDs table. */
} t_FmPortDsarSnmpInfo;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response filtering Entry
*//***************************************************************************/
typedef struct t_FmPortDsarFilteringEntry
{
    uint16_t    srcPort;
    uint16_t    dstPort;
    uint16_t    srcPortMask;
    uint16_t    dstPortMask;
} t_FmPortDsarFilteringEntry;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response filtering info
*//***************************************************************************/
typedef struct t_FmPortDsarFilteringInfo
{
    /* IP protocol filtering parameters */
    uint8_t     ipProtTableSize;
    uint8_t     *p_IpProtTablePtr;
    bool        ipProtPassOnHit;  /* when TRUE, miss in the table will cause the packet to be droped,
                                         hit will pass the packet to UDP/TCP filters if needed and if not
                                         to the classification tree. If the classification tree will pass
                                         the packet to a queue it will cause a wake interupt.
                                         When FALSE it the other way around. */
    /* UDP port filtering parameters */
    uint8_t     udpPortsTableSize;
    t_FmPortDsarFilteringEntry *p_UdpPortsTablePtr;
    bool        udpPortPassOnHit; /* when TRUE, miss in the table will cause the packet to be droped,
                                         hit will pass the packet to classification tree.
                                         If the classification tree will pass the packet to a queue it
                                         will cause a wake interupt.
                                         When FALSE it the other way around. */
    /* TCP port filtering parameters */
    uint16_t    tcpFlagsMask;
    uint8_t     tcpPortsTableSize;
    t_FmPortDsarFilteringEntry *p_TcpPortsTablePtr;
    bool        tcpPortPassOnHit; /* when TRUE, miss in the table will cause the packet to be droped,
                                         hit will pass the packet to classification tree.
                                         If the classification tree will pass the packet to a queue it
                                         will cause a wake interupt.
                                         When FALSE it the other way around. */
} t_FmPortDsarFilteringInfo;

/**************************************************************************//**
 @Description   Structure for Deep Sleep Auto Response parameters
*//***************************************************************************/
typedef struct t_FmPortDsarParams
{
    t_Handle                  h_FmPortTx;
    t_FmPortDsarArpInfo       *p_AutoResArpInfo;
    t_FmPortDsarEchoIpv4Info  *p_AutoResEchoIpv4Info;
    t_FmPortDsarNdpInfo       *p_AutoResNdpInfo;
    t_FmPortDsarEchoIpv6Info  *p_AutoResEchoIpv6Info;
    t_FmPortDsarSnmpInfo      *p_AutoResSnmpInfo;
    t_FmPortDsarFilteringInfo *p_AutoResFilteringInfo;
} t_FmPortDsarParams;

/**************************************************************************//**
 @Function      FM_PORT_EnterDsar

 @Description   Enter Deep Sleep Auto Response mode.
                This function write the apropriate values to in the relevant
                tables in the MURAM.

 @Param[in]     h_FmPortRx - FM PORT module descriptor
 @Param[in]     params - Auto Response parameters

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_EnterDsar(t_Handle h_FmPortRx, t_FmPortDsarParams *params);

/**************************************************************************//**
 @Function      FM_PORT_EnterDsarFinal

 @Description   Enter Deep Sleep Auto Response mode.
                This function sets the Tx port in independent mode as needed
                and redirect the receive flow to go through the
                Dsar Fman-ctrl code

 @Param[in]     h_DsarRxPort - FM Rx PORT module descriptor
 @Param[in]     h_DsarTxPort - FM Tx PORT module descriptor

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_EnterDsarFinal(t_Handle h_DsarRxPort, t_Handle h_DsarTxPort);

/**************************************************************************//**
 @Function      FM_PORT_ExitDsar

 @Description   Exit Deep Sleep Auto Response mode.
                This function reverse the AR mode and put the ports back into
                their original wake mode

 @Param[in]     h_FmPortRx - FM PORT Rx module descriptor
 @Param[in]     h_FmPortTx - FM PORT Tx module descriptor

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_EnterDsar().
*//***************************************************************************/
void FM_PORT_ExitDsar(t_Handle h_FmPortRx, t_Handle h_FmPortTx);

/**************************************************************************//**
 @Function      FM_PORT_IsInDsar

 @Description   This function returns TRUE if the port was set as Auto Response
                and FALSE if not. Once Exit AR mode it will return FALSE as well
                until re-enabled once more.

 @Param[in]     h_FmPort - FM PORT module descriptor

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
bool FM_PORT_IsInDsar(t_Handle h_FmPort);

typedef struct t_FmPortDsarStats
{
    uint32_t arpArCnt;
    uint32_t echoIcmpv4ArCnt;
    uint32_t ndpArCnt;
    uint32_t echoIcmpv6ArCnt;
    uint32_t snmpGetCnt;
    uint32_t snmpGetNextCnt;
} t_FmPortDsarStats;

/**************************************************************************//**
 @Function      FM_PORT_GetDsarStats

 @Description   Return statistics for Deep Sleep Auto Response

 @Param[in]     h_FmPortRx - FM PORT module descriptor
 @Param[out]    stats - structure containing the statistics counters

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_PORT_GetDsarStats(t_Handle h_FmPortRx, t_FmPortDsarStats *stats);

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

 @Description   Dump all regs.

                Calling this routine invalidates the descriptor.

 @Param[in]     h_FmPort - FM PORT module descriptor

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_DumpRegs(t_Handle h_FmPort);
#endif /* (defined(DEBUG_ERRORS) && ... */

/**************************************************************************//**
 @Function      FM_PORT_GetBufferDataOffset

 @Description   Relevant for Rx ports.
                Returns the data offset from the beginning of the data buffer

 @Param[in]     h_FmPort - FM PORT module descriptor

 @Return        data offset.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
uint32_t FM_PORT_GetBufferDataOffset(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_GetBufferICInfo

 @Description   Returns the Internal Context offset from the beginning of the data buffer

 @Param[in]     h_FmPort - FM PORT module descriptor
 @Param[in]     p_Data   - A pointer to the data buffer.

 @Return        Internal context info pointer on success, NULL if 'allOtherInfo' was not
                configured for this port.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
uint8_t * FM_PORT_GetBufferICInfo(t_Handle h_FmPort, char *p_Data);

/**************************************************************************//**
 @Function      FM_PORT_GetBufferPrsResult

 @Description   Returns the pointer to the parse result in the data buffer.
                In Rx ports this is relevant after reception, if parse
                result is configured to be part of the data passed to the
                application. For non Rx ports it may be used to get the pointer
                of the area in the buffer where parse result should be
                initialized - if so configured.
                See FM_PORT_ConfigBufferPrefixContent for data buffer prefix
                configuration.

 @Param[in]     h_FmPort    - FM PORT module descriptor
 @Param[in]     p_Data      - A pointer to the data buffer.

 @Return        Parse result pointer on success, NULL if parse result was not
                configured for this port.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_FmPrsResult * FM_PORT_GetBufferPrsResult(t_Handle h_FmPort, char *p_Data);

/**************************************************************************//**
 @Function      FM_PORT_GetBufferTimeStamp

 @Description   Returns the time stamp in the data buffer.
                Relevant for Rx ports for getting the buffer time stamp.
                See FM_PORT_ConfigBufferPrefixContent for data buffer prefix
                configuration.

 @Param[in]     h_FmPort    - FM PORT module descriptor
 @Param[in]     p_Data      - A pointer to the data buffer.

 @Return        A pointer to the hash result on success, NULL otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
uint64_t * FM_PORT_GetBufferTimeStamp(t_Handle h_FmPort, char *p_Data);

/**************************************************************************//**
 @Function      FM_PORT_GetBufferHashResult

 @Description   Given a data buffer, on the condition that hash result was defined
                as a part of the buffer content (see FM_PORT_ConfigBufferPrefixContent)
                this routine will return the pointer to the hash result location in the
                buffer prefix.

 @Param[in]     h_FmPort    - FM PORT module descriptor
 @Param[in]     p_Data      - A pointer to the data buffer.

 @Return        A pointer to the hash result on success, NULL otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
uint8_t * FM_PORT_GetBufferHashResult(t_Handle h_FmPort, char *p_Data);

/**************************************************************************//**
 @Function      FM_PORT_Disable

 @Description   Gracefully disable an FM port. The port will not start new tasks after all
                tasks associated with the port are terminated.

 @Param[in]     h_FmPort    A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
                This is a blocking routine, it returns after port is
                gracefully stopped, i.e. the port will not except new frames,
                but it will finish all frames or tasks which were already began
*//***************************************************************************/
t_Error FM_PORT_Disable(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_Enable

 @Description   A runtime routine provided to allow disable/enable of port.

 @Param[in]     h_FmPort    A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_Enable(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_SetRateLimit

 @Description   Calling this routine enables rate limit algorithm.
                By default, this functionality is disabled.
                Note that rate-limit mechanism uses the FM time stamp.
                The selected rate limit specified here would be
                rounded DOWN to the nearest 16M.

                May be used for Tx and OP ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     p_RateLimit     A structure of rate limit parameters

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
                If rate limit is set on a port that need to send PFC frames,
                it might violate the stop transmit timing.
*//***************************************************************************/
t_Error FM_PORT_SetRateLimit(t_Handle h_FmPort, t_FmPortRateLimit *p_RateLimit);

/**************************************************************************//**
 @Function      FM_PORT_DeleteRateLimit

 @Description   Calling this routine disables and clears rate limit
                initialization.

                May be used for Tx and OP ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_DeleteRateLimit(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_SetPfcPrioritiesMappingToQmanWQ

 @Description   Calling this routine maps each PFC received priority to the transmit WQ.
                This WQ will be blocked upon receiving a PFC frame with this priority.

                May be used for Tx ports only.

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     prio            PFC priority (0-7).
 @Param[in]     wq              Work Queue (0-7).

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetPfcPrioritiesMappingToQmanWQ(t_Handle h_FmPort, uint8_t prio, uint8_t wq);

/**************************************************************************//**
 @Function      FM_PORT_SetStatisticsCounters

 @Description   Calling this routine enables/disables port's statistics counters.
                By default, counters are enabled.

                May be used for all port types

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     enable      TRUE to enable, FALSE to disable.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetStatisticsCounters(t_Handle h_FmPort, bool enable);

/**************************************************************************//**
 @Function      FM_PORT_SetFrameQueueCounters

 @Description   Calling this routine enables/disables port's enqueue/dequeue counters.
                By default, counters are enabled.

                May be used for all ports

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     enable      TRUE to enable, FALSE to disable.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetFrameQueueCounters(t_Handle h_FmPort, bool enable);

/**************************************************************************//**
 @Function      FM_PORT_AnalyzePerformanceParams

 @Description   User may call this routine to so the driver will analyze if the
                basic performance parameters are correct and also the driver may
                suggest of improvements; The basic parameters are FIFO sizes, number
                of DMAs and number of TNUMs for the port.

                May be used for all port types

 @Param[in]     h_FmPort                A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_AnalyzePerformanceParams(t_Handle h_FmPort);


/**************************************************************************//**
 @Function      FM_PORT_SetAllocBufCounter

 @Description   Calling this routine enables/disables BM pool allocate
                buffer counters.
                By default, counters are enabled.

                May be used for Rx ports only

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     poolId      BM pool id.
 @Param[in]     enable      TRUE to enable, FALSE to disable.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetAllocBufCounter(t_Handle h_FmPort, uint8_t poolId, bool enable);

/**************************************************************************//**
 @Function      FM_PORT_GetBmiCounters

 @Description   Read port's BMI stat counters and place them into
                a designated structure of counters.

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[out]    p_BmiStats  counters structure

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_GetBmiCounters(t_Handle h_FmPort, t_FmPortBmiStats *p_BmiStats);

/**************************************************************************//**
 @Function      FM_PORT_GetCounter

 @Description   Reads one of the FM PORT counters.

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     fmPortCounter       The requested counter.

 @Return        Counter's current value.

 @Cautions      Allowed only following FM_PORT_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_PORT_GetCounter(t_Handle h_FmPort, e_FmPortCounters fmPortCounter);

/**************************************************************************//**
 @Function      FM_PORT_ModifyCounter

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

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     fmPortCounter       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_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ModifyCounter(t_Handle h_FmPort, e_FmPortCounters fmPortCounter, uint32_t value);

/**************************************************************************//**
 @Function      FM_PORT_GetAllocBufCounter

 @Description   Reads one of the FM PORT buffer counters.

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     poolId              The requested pool.

 @Return        Counter's current value.

 @Cautions      Allowed only following FM_PORT_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_PORT_GetAllocBufCounter(t_Handle h_FmPort, uint8_t poolId);

/**************************************************************************//**
 @Function      FM_PORT_ModifyAllocBufCounter

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

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     poolId              The requested pool.
 @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_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ModifyAllocBufCounter(t_Handle h_FmPort,  uint8_t poolId, uint32_t value);

/**************************************************************************//**
 @Function      FM_PORT_AddCongestionGrps

 @Description   This routine effects the corresponding Tx port.
                It should be called in order to enable pause
                frame transmission in case of congestion in one or more
                of the congestion groups relevant to this port.
                Each call to this routine may add one or more congestion
                groups to be considered relevant to this port.

                May be used for Rx, or RX+OP ports only (depending on chip)

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     p_CongestionGrps    A pointer to an array of congestion groups
                                    id's to consider.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_AddCongestionGrps(t_Handle h_FmPort, t_FmPortCongestionGrps *p_CongestionGrps);

/**************************************************************************//**
 @Function      FM_PORT_RemoveCongestionGrps

 @Description   This routine effects the corresponding Tx port. It should be
                called when congestion groups were
                defined for this port and are no longer relevant, or pause
                frames transmitting is not required on their behalf.
                Each call to this routine may remove one or more congestion
                groups to be considered relevant to this port.

                May be used for Rx, or RX+OP ports only (depending on chip)

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     p_CongestionGrps    A pointer to an array of congestion groups
                                    id's to consider.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_RemoveCongestionGrps(t_Handle h_FmPort, t_FmPortCongestionGrps *p_CongestionGrps);

/**************************************************************************//**
 @Function      FM_PORT_IsStalled

 @Description   A routine for checking whether the specified port is stalled.

 @Param[in]     h_FmPort            A handle to a FM Port module.

 @Return        TRUE if port is stalled, FALSE otherwize

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
bool FM_PORT_IsStalled(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_ReleaseStalled

 @Description   This routine may be called in case the port was stalled and may
                now be released.
                Note that this routine is available only on older FMan revisions
                (FMan v2, DPAA v1.0 only).

 @Param[in]     h_FmPort    A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_ReleaseStalled(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_SetRxL4ChecksumVerify

 @Description   This routine is relevant for Rx ports (1G and 10G). The routine
                set/clear the L3/L4 checksum verification (on RX side).
                Note that this takes affect only if hw-parser is enabled!

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     l4Checksum      boolean indicates whether to do L3/L4 checksum
                                on frames or not.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetRxL4ChecksumVerify(t_Handle h_FmPort, bool l4Checksum);

/**************************************************************************//**
 @Function      FM_PORT_SetErrorsRoute

 @Description   Errors selected for this routine will cause a frame with that error
                to be enqueued to error queue.
                Errors not selected for this routine will cause a frame with that error
                to be enqueued to the one of the other port queues.
                By default all errors are defined to be enqueued to error queue.
                Errors that were configured to be discarded (at initialization)
                may not be selected here.

                May be used for Rx and OP ports only

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     errs        A list of errors to enqueue to error queue

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Config() and before FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetErrorsRoute(t_Handle h_FmPort, fmPortFrameErrSelect_t errs);

/**************************************************************************//**
 @Function      FM_PORT_SetIMExceptions

 @Description   Calling this routine enables/disables FM PORT interrupts.

 @Param[in]     h_FmPort        FM PORT 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_PORT_Init().
                This routine should NOT be called from guest-partition
                (i.e. guestId != NCSW_MASTER_ID)
*//***************************************************************************/
t_Error FM_PORT_SetIMExceptions(t_Handle h_FmPort, e_FmPortExceptions exception, bool enable);

/**************************************************************************//*
 @Function      FM_PORT_SetPerformanceCounters

 @Description   Calling this routine enables/disables port's performance counters.
                By default, counters are enabled.

                May be used for all port types

 @Param[in]     h_FmPort                A handle to a FM Port module.
 @Param[in]     enable                  TRUE to enable, FALSE to disable.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetPerformanceCounters(t_Handle h_FmPort, bool enable);

/**************************************************************************//*
 @Function      FM_PORT_SetPerformanceCountersParams

 @Description   Calling this routine defines port's performance
                counters parameters.

                May be used for all port types

 @Param[in]     h_FmPort                A handle to a FM Port module.
 @Param[in]     p_FmPortPerformanceCnt  A pointer to a structure of performance
                                        counters parameters.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetPerformanceCountersParams(t_Handle h_FmPort, t_FmPortPerformanceCnt *p_FmPortPerformanceCnt);

/**************************************************************************//**
 @Group         FM_PORT_pcd_runtime_control_grp FM Port PCD Runtime Control Unit

 @Description   FM Port PCD Runtime control unit API functions, definitions and enums.

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

/**************************************************************************//**
 @Description   A structure defining the KG scheme after the parser.
                This is relevant only to change scheme selection mode - from
                direct to indirect and vice versa, or when the scheme is selected directly,
                to select the scheme id.

*//***************************************************************************/
typedef struct t_FmPcdKgSchemeSelect {
    bool        direct;                 /**< TRUE to use 'h_Scheme' directly, FALSE to use LCV. */
    t_Handle    h_DirectScheme;         /**< Scheme handle, selects the scheme after parser;
                                             Relevant only when 'direct' is TRUE. */
} t_FmPcdKgSchemeSelect;

/**************************************************************************//**
 @Description   A structure of scheme parameters
*//***************************************************************************/
typedef struct t_FmPcdPortSchemesParams {
    uint8_t     numOfSchemes;                           /**< Number of schemes for port to be bound to. */
    t_Handle    h_Schemes[FM_PCD_KG_NUM_OF_SCHEMES];    /**< Array of 'numOfSchemes' schemes for the
                                                             port to be bound to */
} t_FmPcdPortSchemesParams;

/**************************************************************************//**
 @Description   Union for defining port protocol parameters for parser
*//***************************************************************************/
typedef union u_FmPcdHdrPrsOpts {
    /* MPLS */
    struct {
        bool            labelInterpretationEnable;  /**< When this bit is set, the last MPLS label will be
                                                         interpreted as described in HW spec table. When the bit
                                                         is cleared, the parser will advance to MPLS next parse */
        e_NetHeaderType nextParse;                  /**< must be equal or higher than IPv4 */
    } mplsPrsOptions;
    /* VLAN */
    struct {
        uint16_t        tagProtocolId1;             /**< User defined Tag Protocol Identifier, to be recognized
                                                         on VLAN TAG on top of 0x8100 and 0x88A8 */
        uint16_t        tagProtocolId2;             /**< User defined Tag Protocol Identifier, to be recognized
                                                         on VLAN TAG on top of 0x8100 and 0x88A8 */
    } vlanPrsOptions;
    /* PPP */
    struct{
        bool            enableMTUCheck;             /**< Check validity of MTU according to RFC2516 */
    } pppoePrsOptions;

    /* IPV6 */
    struct{
        bool            routingHdrEnable;          /**< TRUE to enable routing header, otherwise ignore */
    } ipv6PrsOptions;

    /* UDP */
    struct{
        bool            padIgnoreChecksum;          /**< TRUE to ignore pad in checksum */
    } udpPrsOptions;

    /* TCP */
    struct {
        bool            padIgnoreChecksum;          /**< TRUE to ignore pad in checksum */
    } tcpPrsOptions;
} u_FmPcdHdrPrsOpts;

/**************************************************************************//**
 @Description   A structure for defining each header for the parser
*//***************************************************************************/
typedef struct t_FmPcdPrsAdditionalHdrParams {
    e_NetHeaderType         hdr;            /**< Selected header; use  HEADER_TYPE_NONE
                                                 to indicate that sw parser is to run first
                                                 (before HW parser, and independent of the
                                                 existence of any protocol), in this case,
                                                 swPrsEnable must be set, and all other
                                                 parameters are irrelevant.  */
    bool                    errDisable;     /**< TRUE to disable error indication */
    bool                    swPrsEnable;    /**< Enable jump to SW parser when this
                                                 header is recognized by the HW parser. */
    uint8_t                 indexPerHdr;    /**< Normally 0, if more than one sw parser
                                                 attachments exists for the same header,
                                                 (in the main sw parser code) use this
                                                 index to distinguish between them. */
    bool                    usePrsOpts;     /**< TRUE to use parser options. */
    u_FmPcdHdrPrsOpts       prsOpts;        /**< A union according to header type,
                                                 defining the parser options selected.*/
} t_FmPcdPrsAdditionalHdrParams;

/**************************************************************************//**
 @Description   struct for defining port PCD parameters
*//***************************************************************************/
typedef struct t_FmPortPcdPrsParams {
    uint8_t                         prsResultPrivateInfo;           /**< The private info provides a method of inserting
                                                                         port information into the parser result. This information
                                                                         may be extracted by Keygen and be used for frames
                                                                         distribution when a per-port distinction is required,
                                                                         it may also be used as a port logical id for analyzing
                                                                         incoming frames. */
    uint8_t                         parsingOffset;                  /**< Number of bytes from beginning of packet to start parsing */
    e_NetHeaderType                 firstPrsHdr;                    /**< The type of the first header expected at 'parsingOffset' */
    bool                            includeInPrsStatistics;         /**< TRUE to include this port in the parser statistics;
                                                                         NOTE: this field is not valid when the FM is in "guest" mode
                                                                               and IPC is not available. */
    uint8_t                         numOfHdrsWithAdditionalParams;  /**< Normally 0, some headers may get
                                                                         special parameters */
    t_FmPcdPrsAdditionalHdrParams   additionalParams[FM_PCD_PRS_NUM_OF_HDRS];
                                                                    /**< 'numOfHdrsWithAdditionalParams'  structures
                                                                         of additional parameters
                                                                         for each header that requires them */
    bool                            setVlanTpid1;                   /**< TRUE to configure user selection of Ethertype to
                                                                         indicate a VLAN tag (in addition to the TPID values
                                                                         0x8100 and 0x88A8). */
    uint16_t                        vlanTpid1;                      /**< extra tag to use if setVlanTpid1=TRUE. */
    bool                            setVlanTpid2;                   /**< TRUE to configure user selection of Ethertype to
                                                                         indicate a VLAN tag (in addition to the TPID values
                                                                         0x8100 and 0x88A8). */
    uint16_t                        vlanTpid2;                      /**< extra tag to use if setVlanTpid1=TRUE. */
} t_FmPortPcdPrsParams;

/**************************************************************************//**
 @Description   struct for defining coarse alassification parameters
*//***************************************************************************/
typedef struct t_FmPortPcdCcParams {
    t_Handle            h_CcTree;                       /**< A handle to a CC tree */
} t_FmPortPcdCcParams;

/**************************************************************************//**
 @Description   struct for defining keygen parameters
*//***************************************************************************/
typedef struct t_FmPortPcdKgParams {
    uint8_t             numOfSchemes;                   /**< Number of schemes for port to be bound to. */
    t_Handle            h_Schemes[FM_PCD_KG_NUM_OF_SCHEMES];
                                                        /**< Array of 'numOfSchemes' schemes handles for the
                                                             port to be bound to */
    bool                directScheme;                   /**< TRUE for going from parser to a specific scheme,
                                                             regardless of parser result */
    t_Handle            h_DirectScheme;                 /**< relevant only if direct == TRUE, Scheme handle,
                                                             as returned by FM_PCD_KgSetScheme */
} t_FmPortPcdKgParams;

/**************************************************************************//**
 @Description   struct for defining policer parameters
*//***************************************************************************/
typedef struct t_FmPortPcdPlcrParams {
    t_Handle                h_Profile;          /**< Selected profile handle */
} t_FmPortPcdPlcrParams;

/**************************************************************************//**
 @Description   struct for defining port PCD parameters
*//***************************************************************************/
typedef struct t_FmPortPcdParams {
    e_FmPortPcdSupport      pcdSupport;         /**< Relevant for Rx and offline ports only.
                                                     Describes the active PCD engines for this port. */
    t_Handle                h_NetEnv;           /**< HL Unused in PLCR only mode */
    t_FmPortPcdPrsParams    *p_PrsParams;       /**< Parser parameters for this port */
    t_FmPortPcdCcParams     *p_CcParams;        /**< Coarse classification parameters for this port */
    t_FmPortPcdKgParams     *p_KgParams;        /**< Keygen parameters for this port */
    t_FmPortPcdPlcrParams   *p_PlcrParams;      /**< Policer parameters for this port; Relevant for one of
                                                     following cases:
                                                     e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or
                                                     e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR were selected,
                                                     or if any flow uses a KG scheme were policer
                                                     profile is not generated
                                                     ('bypassPlcrProfileGeneration selected'). */
    t_Handle                h_IpReassemblyManip;    /**< IP Reassembly manipulation */
#if (DPAA_VERSION >= 11)
    t_Handle                h_CapwapReassemblyManip;/**< CAPWAP Reassembly manipulation */
#endif /* (DPAA_VERSION >= 11) */
} t_FmPortPcdParams;

/**************************************************************************//**
 @Description   A structure for defining the Parser starting point
*//***************************************************************************/
typedef struct t_FmPcdPrsStart {
    uint8_t             parsingOffset;  /**< Number of bytes from beginning of packet to
                                             start parsing */
    e_NetHeaderType     firstPrsHdr;    /**< The type of the first header axpected at
                                             'parsingOffset' */
} t_FmPcdPrsStart;

#if (DPAA_VERSION >= 11)
/**************************************************************************//**
 @Description   struct for defining external buffer margins
*//***************************************************************************/
typedef struct t_FmPortVSPAllocParams {
    uint8_t     numOfProfiles;          /**< Number of Virtual Storage Profiles; must be a power of 2 */
    uint8_t     dfltRelativeId;         /**< The default Virtual-Storage-Profile-id dedicated to Rx/OP port
                                             The same default Virtual-Storage-Profile-id will be for coupled Tx port
                                             if relevant function called for Rx port */
    t_Handle    h_FmTxPort;             /**< Handle to coupled Tx Port; not relevant for OP port. */
} t_FmPortVSPAllocParams;
#endif /* (DPAA_VERSION >= 11) */


/**************************************************************************//**
 @Function      FM_PORT_SetPCD

 @Description   Calling this routine defines the port's PCD configuration.
                It changes it from its default configuration which is PCD
                disabled (BMI to BMI) and configures it according to the passed
                parameters.

                May be used for Rx and OP ports only

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     p_FmPortPcd     A Structure of parameters defining the port's PCD
                                configuration.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_SetPCD(t_Handle h_FmPort, t_FmPortPcdParams *p_FmPortPcd);

/**************************************************************************//**
 @Function      FM_PORT_DeletePCD

 @Description   Calling this routine releases the port's PCD configuration.
                The port returns to its default configuration which is PCD
                disabled (BMI to BMI) and all PCD configuration is removed.

                May be used for Rx and OP ports which are
                in PCD mode  only

 @Param[in]     h_FmPort        A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_DeletePCD(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_AttachPCD

 @Description   This routine may be called after FM_PORT_DetachPCD was called,
                to return to the originally configured PCD support flow.
                The couple of routines are used to allow PCD configuration changes
                that demand that PCD will not be used while changes take place.

                May be used for Rx and OP ports which are
                in PCD mode only

 @Param[in]     h_FmPort        A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
*//***************************************************************************/
t_Error FM_PORT_AttachPCD(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_DetachPCD

 @Description   Calling this routine detaches the port from its PCD functionality.
                The port returns to its default flow which is BMI to BMI.

                May be used for Rx and OP ports which are
                in PCD mode only

 @Param[in]     h_FmPort        A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_AttachPCD().
*//***************************************************************************/
t_Error FM_PORT_DetachPCD(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_PcdPlcrAllocProfiles

 @Description   This routine may be called only for ports that use the Policer in
                order to allocate private policer profiles.

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     numOfProfiles       The number of required policer profiles

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init() and FM_PCD_Init(),
                and before FM_PORT_SetPCD().
*//***************************************************************************/
t_Error FM_PORT_PcdPlcrAllocProfiles(t_Handle h_FmPort, uint16_t numOfProfiles);

/**************************************************************************//**
 @Function      FM_PORT_PcdPlcrFreeProfiles

 @Description   This routine should be called for freeing private policer profiles.

 @Param[in]     h_FmPort            A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init() and FM_PCD_Init(),
                and before FM_PORT_SetPCD().
*//***************************************************************************/
t_Error FM_PORT_PcdPlcrFreeProfiles(t_Handle h_FmPort);

#if (DPAA_VERSION >= 11)
/**************************************************************************//**
 @Function      FM_PORT_VSPAlloc

 @Description   This routine allocated VSPs per port and forces the port to work
                in VSP mode. Note that the port is initialized by default with the
                physical-storage-profile only.

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     p_Params    A structure of parameters for allocation VSP's per port

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init(), and before FM_PORT_SetPCD()
                and also before FM_PORT_Enable(); i.e. the port should be disabled.
*//***************************************************************************/
t_Error FM_PORT_VSPAlloc(t_Handle h_FmPort, t_FmPortVSPAllocParams *p_Params);
#endif /* (DPAA_VERSION >= 11) */

/**************************************************************************//**
 @Function      FM_PORT_PcdKgModifyInitialScheme

 @Description   This routine may be called only for ports that use the keygen in
                order to change the initial scheme frame should be routed to.
                The change may be of a scheme id (in case of direct mode),
                from direct to indirect, or from indirect to direct - specifying the scheme id.

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     p_FmPcdKgScheme     A structure of parameters for defining whether
                                    a scheme is direct/indirect, and if direct - scheme id.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
*//***************************************************************************/
t_Error FM_PORT_PcdKgModifyInitialScheme (t_Handle h_FmPort, t_FmPcdKgSchemeSelect *p_FmPcdKgScheme);

/**************************************************************************//**
 @Function      FM_PORT_PcdPlcrModifyInitialProfile

 @Description   This routine may be called for ports with flows
                e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR
                only, to change the initial Policer profile frame should be
                routed to. The change may be of a profile and/or absolute/direct
                mode selection.

 @Param[in]     h_FmPort                A handle to a FM Port module.
 @Param[in]     h_Profile               Policer profile handle

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
*//***************************************************************************/
t_Error FM_PORT_PcdPlcrModifyInitialProfile (t_Handle h_FmPort, t_Handle h_Profile);

/**************************************************************************//**
 @Function      FM_PORT_PcdCcModifyTree

 @Description   This routine may be called for ports that use coarse classification tree
                if the user wishes to replace the tree. The routine may not be called while port
                receives packets using the PCD functionalities, therefor port must be first detached
                from the PCD, only than the routine may be called, and than port be attached to PCD again.

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[in]     h_CcTree            A CC tree that was already built. The tree id as returned from
                                    the BuildTree routine.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init(), FM_PORT_SetPCD() and FM_PORT_DetachPCD()
*//***************************************************************************/
t_Error FM_PORT_PcdCcModifyTree (t_Handle h_FmPort, t_Handle h_CcTree);

/**************************************************************************//**
 @Function      FM_PORT_PcdKgBindSchemes

 @Description   These routines may be called for adding more schemes for the
                port to be bound to. The selected schemes are not added,
                just this specific port starts using them.

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     p_PortScheme    A structure defining the list of schemes to be added.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
*//***************************************************************************/
t_Error FM_PORT_PcdKgBindSchemes (t_Handle h_FmPort, t_FmPcdPortSchemesParams *p_PortScheme);

/**************************************************************************//**
 @Function      FM_PORT_PcdKgUnbindSchemes

 @Description   These routines may be called for adding more schemes for the
                port to be bound to. The selected schemes are not removed or invalidated,
                just this specific port stops using them.

 @Param[in]     h_FmPort        A handle to a FM Port module.
 @Param[in]     p_PortScheme    A structure defining the list of schemes to be added.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init() and FM_PORT_SetPCD().
*//***************************************************************************/
t_Error FM_PORT_PcdKgUnbindSchemes (t_Handle h_FmPort, t_FmPcdPortSchemesParams *p_PortScheme);

/**************************************************************************//**
 @Function      FM_PORT_GetIPv4OptionsCount

 @Description   TODO

 @Param[in]     h_FmPort            A handle to a FM Port module.
 @Param[out]    p_Ipv4OptionsCount  will hold the counter value

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init()
*//***************************************************************************/
t_Error FM_PORT_GetIPv4OptionsCount(t_Handle h_FmPort, uint32_t *p_Ipv4OptionsCount);

/** @} */ /* end of FM_PORT_pcd_runtime_control_grp group */
/** @} */ /* end of FM_PORT_runtime_control_grp group */


/**************************************************************************//**
 @Group         FM_PORT_runtime_data_grp FM Port Runtime Data-path Unit

 @Description   FM Port Runtime data unit API functions, definitions and enums.
                This API is valid only if working in Independent-Mode.

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

/**************************************************************************//**
 @Function      FM_PORT_ImTx

 @Description   Tx function, called to transmit a data buffer on the port.

 @Param[in]     h_FmPort    A handle to a FM Port module.
 @Param[in]     p_Data      A pointer to an LCP data buffer.
 @Param[in]     length      Size of data for transmission.
 @Param[in]     lastBuffer  Buffer position - TRUE for the last buffer
                            of a frame, including a single buffer frame
 @Param[in]     h_BufContext  A handle of the user acossiated with this buffer

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
                NOTE - This routine can be used only when working in
                Independent-Mode mode.
*//***************************************************************************/
t_Error  FM_PORT_ImTx( t_Handle               h_FmPort,
                       uint8_t                *p_Data,
                       uint16_t               length,
                       bool                   lastBuffer,
                       t_Handle               h_BufContext);

/**************************************************************************//**
 @Function      FM_PORT_ImTxConf

 @Description   Tx port confirmation routine, optional, may be called to verify
                transmission of all frames. The procedure performed by this
                routine will be performed automatically on next buffer transmission,
                but if desired, calling this routine will invoke this action on
                demand.

 @Param[in]     h_FmPort            A handle to a FM Port module.

 @Cautions      Allowed only following FM_PORT_Init().
                NOTE - This routine can be used only when working in
                Independent-Mode mode.
*//***************************************************************************/
void FM_PORT_ImTxConf(t_Handle h_FmPort);

/**************************************************************************//**
 @Function      FM_PORT_ImRx

 @Description   Rx function, may be called to poll for received buffers.
                Normally, Rx process is invoked by the driver on Rx interrupt.
                Alternatively, this routine may be called on demand.

 @Param[in]     h_FmPort            A handle to a FM Port module.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_PORT_Init().
                NOTE - This routine can be used only when working in
                Independent-Mode mode.
*//***************************************************************************/
t_Error  FM_PORT_ImRx(t_Handle h_FmPort);

/** @} */ /* end of FM_PORT_runtime_data_grp group */
/** @} */ /* end of FM_PORT_grp group */
/** @} */ /* end of FM_grp group */



#ifdef NCSW_BACKWARD_COMPATIBLE_API
#define FM_PORT_ConfigTxFifoDeqPipelineDepth FM_PORT_ConfigFifoDeqPipelineDepth
#endif /* NCSW_BACKWARD_COMPATIBLE_API */


#endif /* __FM_PORT_EXT */