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
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2017 Intel Corporation
*/
#ifndef _RTE_ETHDEV_DRIVER_H_
#define _RTE_ETHDEV_DRIVER_H_
/**
* @file
*
* RTE Ethernet Device PMD API
*
* These APIs for the use from Ethernet drivers, user applications shouldn't
* use them.
*/
#include <pthread.h>
#include <dev_driver.h>
#include <rte_compat.h>
#include <rte_ethdev.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */
/**
* @internal
* Structure used to pass queue stats back to ethdev
* for drivers which rely on ethdev to add the queue stats automatically to xstats.
*/
struct eth_queue_stats {
/* Queue stats are limited to max 256 queues. */
/** Total number of queue Rx packets. */
uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
/** Total number of queue Tx packets. */
uint64_t q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
/** Total number of successfully received queue bytes. */
uint64_t q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
/** Total number of successfully transmitted queue bytes. */
uint64_t q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
/** Total number of queue packets received that are dropped. */
uint64_t q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];
};
/**
* @internal
* Structure used to hold information about the callbacks to be called for a
* queue on Rx and Tx.
*/
struct rte_eth_rxtx_callback {
RTE_ATOMIC(struct rte_eth_rxtx_callback *) next;
union{
rte_rx_callback_fn rx;
rte_tx_callback_fn tx;
} fn;
void *param;
};
/**
* @internal
* The generic data structure associated with each Ethernet device.
*
* Pointers to burst-oriented packet receive and transmit functions are
* located at the beginning of the structure, along with the pointer to
* where all the data elements for the particular device are stored in shared
* memory. This split allows the function pointer and driver data to be per-
* process, while the actual configuration data for the device is shared.
*/
struct __rte_cache_aligned rte_eth_dev {
eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function */
eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function */
/** Pointer to PMD transmit prepare function */
eth_tx_prep_t tx_pkt_prepare;
/** Get the number of used Rx descriptors */
eth_rx_queue_count_t rx_queue_count;
/** Check the status of a Rx descriptor */
eth_rx_descriptor_status_t rx_descriptor_status;
/** Get the number of used Tx descriptors */
eth_tx_queue_count_t tx_queue_count;
/** Check the status of a Tx descriptor */
eth_tx_descriptor_status_t tx_descriptor_status;
/** Pointer to PMD transmit mbufs reuse function */
eth_recycle_tx_mbufs_reuse_t recycle_tx_mbufs_reuse;
/** Pointer to PMD receive descriptors refill function */
eth_recycle_rx_descriptors_refill_t recycle_rx_descriptors_refill;
/**
* Device data that is shared between primary and secondary processes
*/
struct rte_eth_dev_data *data;
void *process_private; /**< Pointer to per-process device data */
const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
/** Fast path flow API functions exported by PMD */
const struct rte_flow_fp_ops *flow_fp_ops;
struct rte_device *device; /**< Backing device */
struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
/** User application callbacks for NIC interrupts */
struct rte_eth_dev_cb_list link_intr_cbs;
/**
* User-supplied functions called from rx_burst to post-process
* received packets before passing them to the user
*/
RTE_ATOMIC(struct rte_eth_rxtx_callback *) post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
/**
* User-supplied functions called from tx_burst to pre-process
* received packets before passing them to the driver for transmission
*/
RTE_ATOMIC(struct rte_eth_rxtx_callback *) pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
enum rte_eth_dev_state state; /**< Flag indicating the port state */
void *security_ctx; /**< Context for security ops */
};
struct rte_eth_dev_sriov;
struct rte_eth_dev_owner;
/**
* @internal
* The data part, with no function pointers, associated with each Ethernet
* device. This structure is safe to place in shared memory to be common
* among different processes in a multi-process configuration.
*/
struct __rte_cache_aligned rte_eth_dev_data {
char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
void **rx_queues; /**< Array of pointers to Rx queues */
void **tx_queues; /**< Array of pointers to Tx queues */
uint16_t nb_rx_queues; /**< Number of Rx queues */
uint16_t nb_tx_queues; /**< Number of Tx queues */
struct rte_eth_dev_sriov sriov; /**< SRIOV data */
/** PMD-specific private data. @see rte_eth_dev_release_port() */
void *dev_private;
struct rte_eth_link dev_link; /**< Link-level information & status */
struct rte_eth_conf dev_conf; /**< Configuration applied to device */
uint16_t mtu; /**< Maximum Transmission Unit */
/** Common Rx buffer size handled by all queues */
uint32_t min_rx_buf_size;
uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
/**
* Device Ethernet link addresses.
* All entries are unique.
* The first entry (index zero) is the default address.
*/
struct rte_ether_addr *mac_addrs;
/** Bitmap associating MAC addresses to pools */
uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];
/**
* Device Ethernet MAC addresses of hash filtering.
* @see rte_eth_dev_release_port()
*/
struct rte_ether_addr *hash_mac_addrs;
uint16_t port_id; /**< Device [external] port identifier */
__extension__
uint8_t /** Rx promiscuous mode ON(1) / OFF(0) */
promiscuous : 1,
/** Rx of scattered packets is ON(1) / OFF(0) */
scattered_rx : 1,
/** Rx all multicast mode ON(1) / OFF(0) */
all_multicast : 1,
/** Device state: STARTED(1) / STOPPED(0) */
dev_started : 1,
/** Rx LRO is ON(1) / OFF(0) */
lro : 1,
/**
* Indicates whether the device is configured:
* CONFIGURED(1) / NOT CONFIGURED(0)
*/
dev_configured : 1,
/**
* Indicates whether the flow engine is configured:
* CONFIGURED(1) / NOT CONFIGURED(0)
*/
flow_configured : 1;
/** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
/** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
uint32_t dev_flags; /**< Capabilities */
int numa_node; /**< NUMA node connection */
/** VLAN filter configuration */
struct rte_vlan_filter_conf vlan_filter_conf;
struct rte_eth_dev_owner owner; /**< The port owner */
/**
* Switch-specific identifier.
* Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
*/
uint16_t representor_id;
/**
* Port ID of the backing device.
* This device will be used to query representor info and calculate
* representor IDs. Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
*/
uint16_t backer_port_id;
pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex */
};
/**
* @internal
* The pool of *rte_eth_dev* structures. The size of the pool
* is configured at compile-time in the <rte_ethdev.c> file.
*/
extern struct rte_eth_dev rte_eth_devices[];
/** @internal Declaration of the hairpin peer queue information structure. */
struct rte_hairpin_peer_info;
/*
* Definitions of all functions exported by an Ethernet driver through the
* generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
* structure associated with an Ethernet device.
*/
/** @internal Ethernet device configuration. */
typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
/** @internal Function used to start a configured Ethernet device. */
typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
/** @internal Function used to stop a configured Ethernet device. */
typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev);
/** @internal Function used to link up a configured Ethernet device. */
typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
/** @internal Function used to link down a configured Ethernet device. */
typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
/** @internal Function used to close a configured Ethernet device. */
typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev);
/** @internal Function used to reset a configured Ethernet device. */
typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
/** @internal Function used to detect an Ethernet device removal. */
typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
/**
* @internal
* Function used to enable the Rx promiscuous mode of an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, promiscuous mode is enabled.
* @retval -ENOTSUP
* Promiscuous mode is not supported.
* @retval -ENODEV
* Device is gone.
* @retval -E_RTE_SECONDARY
* Function was called from a secondary process instance and not supported.
* @retval -ETIMEDOUT
* Attempt to enable promiscuous mode failed because of timeout.
* @retval -EAGAIN
* Failed to enable promiscuous mode.
*/
typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
/**
* @internal
* Function used to disable the Rx promiscuous mode of an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, promiscuous mode is disabled.
* @retval -ENOTSUP
* Promiscuous mode disabling is not supported.
* @retval -ENODEV
* Device is gone.
* @retval -E_RTE_SECONDARY
* Function was called from a secondary process instance and not supported.
* @retval -ETIMEDOUT
* Attempt to disable promiscuous mode failed because of timeout.
* @retval -EAGAIN
* Failed to disable promiscuous mode.
*/
typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
/**
* @internal
* Enable the receipt of all multicast packets by an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, all-multicast mode is enabled.
* @retval -ENOTSUP
* All-multicast mode is not supported.
* @retval -ENODEV
* Device is gone.
* @retval -E_RTE_SECONDARY
* Function was called from a secondary process instance and not supported.
* @retval -ETIMEDOUT
* Attempt to enable all-multicast mode failed because of timeout.
* @retval -EAGAIN
* Failed to enable all-multicast mode.
*/
typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
/**
* @internal
* Disable the receipt of all multicast packets by an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, all-multicast mode is disabled.
* @retval -ENOTSUP
* All-multicast mode disabling is not supported.
* @retval -ENODEV
* Device is gone.
* @retval -E_RTE_SECONDARY
* Function was called from a secondary process instance and not supported.
* @retval -ETIMEDOUT
* Attempt to disable all-multicast mode failed because of timeout.
* @retval -EAGAIN
* Failed to disable all-multicast mode.
*/
typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
/**
* @internal
* Get link speed, duplex mode and state (up/down) of an Ethernet device.
*/
typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
int wait_to_complete);
/**
* @internal
* Get number of current active lanes
*
* @param dev
* ethdev handle of port.
* @param speed_lanes
* Number of active lanes that the link has trained up. This information
* is displayed for Autonegotiated or Fixed speed trained link.
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, get speed_lanes data success.
* @retval -ENOTSUP
* Operation is not supported.
* @retval -EIO
* Device is removed.
*/
typedef int (*eth_speed_lanes_get_t)(struct rte_eth_dev *dev, uint32_t *speed_lanes);
/**
* @internal
* Set speed lanes supported by the NIC. This configuration is applicable only when
* fix speed is already configured and or will be configured. This api requires the
* port be stopped, since driver has to re-configure PHY with fixed speed and lanes.
* If no lanes are configured prior or after "port config X speed Y duplex Z", the
* driver will choose the default lane for that speed to bring up the link.
*
* @param dev
* ethdev handle of port.
* @param speed_lanes
* Non-negative number of lanes
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, set lanes success.
* @retval -ENOTSUP
* Operation is not supported.
* @retval -EINVAL
* Unsupported number of lanes for fixed speed requested.
* @retval -EIO
* Device is removed.
*/
typedef int (*eth_speed_lanes_set_t)(struct rte_eth_dev *dev, uint32_t speed_lanes);
/**
* @internal
* Get supported link speed lanes capability. The driver returns number of lanes
* supported per speed in the form of lanes capability bitmap per speed.
*
* @param speed_lanes_capa
* A pointer to num of rte_eth_speed_lanes_capa struct array which carries the
* bit map of lanes supported per speed. The number of supported speeds is the
* size of this speed_lanes_capa table. In link up condition, only active supported
* speeds lanes bitmap information will be displayed. In link down condition, all
* the supported speeds and its supported lanes bitmap would be fetched and displayed.
*
* This api is overloaded to fetch the size of the speed_lanes_capa array if
* testpmd calls the driver with speed_lanes_capa = NULL and num = 0
*
* @param num
* Number of elements in a speed_speed_lanes_capa array. This num is equal to the
* number of supported speeds by the controller. This value will vary in link up
* and link down condition. num is updated by the driver if speed_lanes_capa is NULL.
*
* @return
* Negative errno value on error, positive value on success.
*
* @retval positive value
* A non-negative value lower or equal to num: success. The return value
* is the number of entries filled in the speed lanes array.
* A non-negative value higher than num: error, the given speed lanes capa array
* is too small. The return value corresponds to the num that should
* be given to succeed. The entries in the speed lanes capa array are not valid
* and shall not be used by the caller.
* @retval -ENOTSUP
* Operation is not supported.
* @retval -EINVAL
* *num* or *speed_lanes_capa* invalid.
*/
typedef int (*eth_speed_lanes_get_capability_t)(struct rte_eth_dev *dev,
struct rte_eth_speed_lanes_capa *speed_lanes_capa,
unsigned int num);
/**
* @internal
* Get global I/O statistics of an Ethernet device.
*
* @param dev
* Device being queried.
* @param stats
* The stats structure to be completed by the driver and returned to the user.
* @param qstats
* Any queue statistics to be returned.
* @note: This parameter can be NULL
*/
typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
struct rte_eth_stats *stats,
struct eth_queue_stats *qstats);
/**
* @internal
* Reset global I/O statistics of an Ethernet device to 0.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, statistics has been reset.
* @retval -ENOTSUP
* Resetting statistics is not supported.
* @retval -EINVAL
* Resetting statistics is not valid.
* @retval -ENOMEM
* Not enough memory to get the stats.
*/
typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
/** @internal Get extended stats of an Ethernet device. */
typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
struct rte_eth_xstat *stats, unsigned int n);
/**
* @internal
* Get extended stats of an Ethernet device.
*
* @param dev
* ethdev handle of port.
* @param ids
* IDs array to retrieve specific statistics. Must not be NULL.
* @param values
* A pointer to a table to be filled with device statistics values.
* Must not be NULL.
* @param n
* Element count in @p ids and @p values.
*
* @return
* - A number of filled in stats.
* - A negative value on error.
*/
typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
const uint64_t *ids,
uint64_t *values,
unsigned int n);
/**
* @internal
* Reset extended stats of an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, statistics has been reset.
* @retval -ENOTSUP
* Resetting statistics is not supported.
* @retval -EINVAL
* Resetting statistics is not valid.
* @retval -ENOMEM
* Not enough memory to get the stats.
*/
typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
/** @internal Get names of extended stats of an Ethernet device. */
typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, unsigned int size);
/**
* @internal
* Get names of extended stats of an Ethernet device.
*
* @param dev
* ethdev handle of port.
* @param ids
* IDs array to retrieve specific statistics. Must not be NULL.
* @param xstats_names
* An rte_eth_xstat_name array of at least @p size elements to be filled.
* Must not be NULL.
* @param size
* Element count in @p ids and @p xstats_names.
*
* @return
* - A number of filled in stats.
* - A negative value on error.
*/
typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int size);
/** @internal Enable an xstat of an Ethernet device. */
typedef int (*eth_xstats_enable_counter_t)(struct rte_eth_dev *dev, uint64_t id);
/** @internal Disable an xstat of an Ethernet device. */
typedef int (*eth_xstats_disable_counter_t)(struct rte_eth_dev *dev, uint64_t id);
/** @internal Query the state of an xstat the can be enabled and disabled in runtime. */
typedef int (*eth_xstats_query_state_t)(struct rte_eth_dev *dev, uint64_t id);
/**
* @internal
* Set a queue statistics mapping for a Tx/Rx queue of an Ethernet device.
*/
typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
uint16_t queue_id,
uint8_t stat_idx,
uint8_t is_rx);
/** @internal Get specific information of an Ethernet device. */
typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
/**
* @internal
* Function used to get supported ptypes of an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @param no_of_elements
* number of ptypes elements. Must be initialized to 0.
*
* @retval
* Success, array of ptypes elements and valid no_of_elements > 0.
* Failures, NULL.
*/
typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev,
size_t *no_of_elements);
/**
* @internal
* Inform Ethernet device about reduced range of packet types to handle.
*
* @param dev
* The Ethernet device identifier.
* @param ptype_mask
* The ptype family that application is interested in should be bitwise OR of
* RTE_PTYPE_*_MASK or 0.
* @return
* - (0) if Success.
*/
typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev,
uint32_t ptype_mask);
/** @internal Start Rx and Tx of a queue of an Ethernet device. */
typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
uint16_t queue_id);
/** @internal Stop Rx and Tx of a queue of an Ethernet device. */
typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
uint16_t queue_id);
/** @internal Set up a receive queue of an Ethernet device. */
typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id,
uint16_t nb_rx_desc,
unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
/** @internal Setup a transmit queue of an Ethernet device. */
typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
uint16_t tx_queue_id,
uint16_t nb_tx_desc,
unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
/** @internal Enable interrupt of a receive queue of an Ethernet device. */
typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id);
/** @internal Disable interrupt of a receive queue of an Ethernet device. */
typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id);
/** @internal Release memory resources allocated by given Rx/Tx queue. */
typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev,
uint16_t queue_id);
/** @internal Get firmware information of an Ethernet device. */
typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
char *fw_version, size_t fw_size);
/** @internal Force mbufs to be from Tx ring. */
typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
typedef void (*eth_recycle_rxq_info_get_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id,
struct rte_eth_recycle_rxq_info *recycle_rxq_info);
typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev,
uint16_t queue_id, struct rte_eth_burst_mode *mode);
/** @internal Set MTU. */
typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
/** @internal Filtering of a VLAN Tag Identifier by an Ethernet device. */
typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
uint16_t vlan_id,
int on);
/** @internal Set the outer/inner VLAN-TPID by an Ethernet device. */
typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
enum rte_vlan_type type, uint16_t tpid);
/** @internal Set VLAN offload function by an Ethernet device. */
typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
/** @internal Set port based Tx VLAN insertion by an Ethernet device. */
typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
uint16_t vlan_id,
int on);
/** @internal VLAN stripping enable/disable by an queue of Ethernet device. */
typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id,
int on);
/** @internal Get current flow control parameter on an Ethernet device. */
typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
struct rte_eth_fc_conf *fc_conf);
/** @internal Setup flow control parameter on an Ethernet device. */
typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
struct rte_eth_fc_conf *fc_conf);
/** @internal Setup priority flow control parameter on an Ethernet device. */
typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
struct rte_eth_pfc_conf *pfc_conf);
/** @internal Get info for queue based PFC on an Ethernet device. */
typedef int (*priority_flow_ctrl_queue_info_get_t)(struct rte_eth_dev *dev,
struct rte_eth_pfc_queue_info *pfc_queue_info);
/** @internal Configure queue based PFC parameter on an Ethernet device. */
typedef int (*priority_flow_ctrl_queue_config_t)(struct rte_eth_dev *dev,
struct rte_eth_pfc_queue_conf *pfc_queue_conf);
/** @internal Update RSS redirection table on an Ethernet device. */
typedef int (*reta_update_t)(struct rte_eth_dev *dev,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size);
/** @internal Query RSS redirection table on an Ethernet device. */
typedef int (*reta_query_t)(struct rte_eth_dev *dev,
struct rte_eth_rss_reta_entry64 *reta_conf,
uint16_t reta_size);
/** @internal Update RSS hash configuration of an Ethernet device. */
typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
/** @internal Get current RSS hash configuration of an Ethernet device. */
typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
/** @internal Turn on SW controllable LED on an Ethernet device. */
typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
/** @internal Turn off SW controllable LED on an Ethernet device. */
typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
/** @internal Remove MAC address from receive address register. */
typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
/** @internal Set a MAC address into Receive Address Register. */
typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
struct rte_ether_addr *mac_addr,
uint32_t index,
uint32_t vmdq);
/** @internal Set a MAC address into Receive Address Register. */
typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
struct rte_ether_addr *mac_addr);
/** @internal Set a Unicast Hash bitmap. */
typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
struct rte_ether_addr *mac_addr,
uint8_t on);
/** @internal Set all Unicast Hash bitmap. */
typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
uint8_t on);
/** @internal Set queue Tx rate. */
typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
uint16_t queue_idx,
uint32_t tx_rate);
/** @internal Add tunneling UDP port. */
typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
struct rte_eth_udp_tunnel *tunnel_udp);
/** @internal Delete tunneling UDP port. */
typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
struct rte_eth_udp_tunnel *tunnel_udp);
/** @internal set the list of multicast addresses on an Ethernet device. */
typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
struct rte_ether_addr *mc_addr_set,
uint32_t nb_mc_addr);
/** @internal Function used to enable IEEE1588/802.1AS timestamping. */
typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
/** @internal Function used to disable IEEE1588/802.1AS timestamping. */
typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
/** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */
typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
struct timespec *timestamp,
uint32_t flags);
/** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */
typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
struct timespec *timestamp);
/** @internal Function used to adjust the device clock. */
typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
/** @internal Function used to adjust the clock frequency. */
typedef int (*eth_timesync_adjust_freq)(struct rte_eth_dev *dev, int64_t);
/** @internal Function used to get time from the device clock. */
typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
struct timespec *timestamp);
/** @internal Function used to get time from the device clock. */
typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
const struct timespec *timestamp);
/** @internal Function used to get the current value of the device clock. */
typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
uint64_t *timestamp);
/** @internal Retrieve registers. */
typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
struct rte_dev_reg_info *info);
/** @internal Retrieve EEPROM size. */
typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
/** @internal Retrieve EEPROM data. */
typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *info);
/** @internal Program EEPROM data. */
typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *info);
/** @internal Retrieve type and size of plugin module EEPROM. */
typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
struct rte_eth_dev_module_info *modinfo);
/** @internal Retrieve plugin module EEPROM data. */
typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *info);
struct rte_flow_ops;
/**
* @internal
* Get flow operations.
*
* If the flow API is not supported for the specified device,
* the driver can return NULL.
*/
typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
const struct rte_flow_ops **ops);
/** @internal Get Traffic Management (TM) operations on an Ethernet device. */
typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
/** @internal Get Traffic Metering and Policing (MTR) operations. */
typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
/** @internal Get DCB information on an Ethernet device. */
typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
struct rte_eth_dcb_info *dcb_info);
/** @internal Test if a port supports specific mempool ops. */
typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
const char *pool);
/**
* @internal
* Get the hairpin capabilities.
*
* @param dev
* ethdev handle of port.
* @param cap
* returns the hairpin capabilities from the device.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, hairpin is supported.
* @retval -ENOTSUP
* Hairpin is not supported.
*/
typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev,
struct rte_eth_hairpin_cap *cap);
/**
* @internal
* Setup Rx hairpin queue.
*
* @param dev
* ethdev handle of port.
* @param rx_queue_id
* the selected Rx queue index.
* @param nb_rx_desc
* the requested number of descriptors for this queue. 0 - use PMD default.
* @param conf
* the Rx hairpin configuration structure.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, hairpin is supported.
* @retval -ENOTSUP
* Hairpin is not supported.
* @retval -EINVAL
* One of the parameters is invalid.
* @retval -ENOMEM
* Unable to allocate resources.
*/
typedef int (*eth_rx_hairpin_queue_setup_t)
(struct rte_eth_dev *dev, uint16_t rx_queue_id,
uint16_t nb_rx_desc,
const struct rte_eth_hairpin_conf *conf);
/**
* @internal
* Setup Tx hairpin queue.
*
* @param dev
* ethdev handle of port.
* @param tx_queue_id
* the selected Tx queue index.
* @param nb_tx_desc
* the requested number of descriptors for this queue. 0 - use PMD default.
* @param conf
* the Tx hairpin configuration structure.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, hairpin is supported.
* @retval -ENOTSUP
* Hairpin is not supported.
* @retval -EINVAL
* One of the parameters is invalid.
* @retval -ENOMEM
* Unable to allocate resources.
*/
typedef int (*eth_tx_hairpin_queue_setup_t)
(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc,
const struct rte_eth_hairpin_conf *hairpin_conf);
/**
* @internal
* Get Forward Error Correction(FEC) capability.
*
* @param dev
* ethdev handle of port.
* @param speed_fec_capa
* speed_fec_capa is out only with per-speed capabilities.
* @param num
* a number of elements in an speed_fec_capa array.
*
* @return
* Negative errno value on error, positive value on success.
*
* @retval positive value
* A non-negative value lower or equal to num: success. The return value
* is the number of entries filled in the fec capa array.
* A non-negative value higher than num: error, the given fec capa array
* is too small. The return value corresponds to the num that should
* be given to succeed. The entries in the fec capa array are not valid
* and shall not be used by the caller.
* @retval -ENOTSUP
* Operation is not supported.
* @retval -EIO
* Device is removed.
* @retval -EINVAL
* *num* or *speed_fec_capa* invalid.
*/
typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,
struct rte_eth_fec_capa *speed_fec_capa, unsigned int num);
/**
* @internal
* Get Forward Error Correction(FEC) mode.
*
* @param dev
* ethdev handle of port.
* @param fec_capa
* a bitmask of enabled FEC modes. If AUTO bit is set, other
* bits specify FEC modes which may be negotiated. If AUTO
* bit is clear, specify FEC modes to be used (only one valid
* mode per speed may be set).
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, get FEC success.
* @retval -ENOTSUP
* Operation is not supported.
* @retval -EIO
* Device is removed.
*/
typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,
uint32_t *fec_capa);
/**
* @internal
* Set Forward Error Correction(FEC) mode.
*
* @param dev
* ethdev handle of port.
* @param fec_capa
* bitmask of allowed FEC modes. It must be only one
* if AUTO is disabled. If AUTO is enabled, other
* bits specify FEC modes which may be negotiated.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, set FEC success.
* @retval -ENOTSUP
* Operation is not supported.
* @retval -EINVAL
* Unsupported FEC mode requested.
* @retval -EIO
* Device is removed.
*/
typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa);
/**
* @internal
* Get all hairpin Tx/Rx peer ports of the current device, if any.
*
* @param dev
* ethdev handle of port.
* @param peer_ports
* array to save the ports list.
* @param len
* array length.
* @param direction
* value to decide the current to peer direction
* positive - used as Tx to get all peer Rx ports.
* zero - used as Rx to get all peer Tx ports.
*
* @return
* Negative errno value on error, 0 or positive on success.
*
* @retval 0
* Success, no peer ports.
* @retval >0
* Actual number of the peer ports.
* @retval -ENOTSUP
* Get peer ports API is not supported.
* @retval -EINVAL
* One of the parameters is invalid.
*/
typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev,
uint16_t *peer_ports, size_t len,
uint32_t direction);
/**
* @internal
* Bind all hairpin Tx queues of one port to the Rx queues of the peer port.
*
* @param dev
* ethdev handle of port.
* @param rx_port
* the peer Rx port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, bind successfully.
* @retval -ENOTSUP
* Bind API is not supported.
* @retval -EINVAL
* One of the parameters is invalid.
* @retval -EBUSY
* Device is not started.
*/
typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev,
uint16_t rx_port);
/**
* @internal
* Unbind all hairpin Tx queues of one port from the Rx queues of the peer port.
*
* @param dev
* ethdev handle of port.
* @param rx_port
* the peer Rx port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, unbind successfully.
* @retval -ENOTSUP
* Bind API is not supported.
* @retval -EINVAL
* One of the parameters is invalid.
* @retval -EBUSY
* Device is already stopped.
*/
typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev,
uint16_t rx_port);
/** @internal Update and fetch peer queue information. */
typedef int (*eth_hairpin_queue_peer_update_t)
(struct rte_eth_dev *dev, uint16_t peer_queue,
struct rte_hairpin_peer_info *current_info,
struct rte_hairpin_peer_info *peer_info, uint32_t direction);
/** @internal Bind peer queue to the current queue with fetched information. */
typedef int (*eth_hairpin_queue_peer_bind_t)
(struct rte_eth_dev *dev, uint16_t cur_queue,
struct rte_hairpin_peer_info *peer_info, uint32_t direction);
/** @internal Unbind peer queue from the current queue. */
typedef int (*eth_hairpin_queue_peer_unbind_t)
(struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
/**
* @internal
* Get address of memory location whose contents will change whenever there is
* new data to be received on an Rx queue.
*
* @param rxq
* Ethdev queue pointer.
* @param pmc
* The pointer to power-optimized monitoring condition structure.
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success
* @retval -EINVAL
* Invalid parameters
*/
typedef int (*eth_get_monitor_addr_t)(void *rxq,
struct rte_power_monitor_cond *pmc);
/**
* @internal
* Get representor info to be able to calculate the unique representor ID.
*
* Caller should pass NULL as pointer of info to get number of entries,
* allocate info buffer according to returned entry number, then call
* again with buffer to get real info.
*
* To calculate the representor ID, caller should iterate each entry,
* match controller index, pf index, vf or sf start index and range,
* then calculate representor ID from offset to vf/sf start index.
* @see rte_eth_representor_id_get.
*
* @param dev
* Ethdev handle of port.
* @param [out] info
* Pointer to memory to save device representor info.
* @return
* Negative errno value on error, number of info entries otherwise.
*/
typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
struct rte_eth_representor_info *info);
/**
* @internal
* Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
*
* @param dev
* Port (ethdev) handle
*
* @param[inout] features
* Feature selection buffer
*
* @return
* Negative errno value on error, zero otherwise
*/
typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
uint64_t *features);
/**
* @internal
* Get IP reassembly offload capability of a PMD.
*
* @param dev
* Port (ethdev) handle
*
* @param[out] conf
* IP reassembly capability supported by the PMD
*
* @return
* Negative errno value on error, zero otherwise
*/
typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev,
struct rte_eth_ip_reassembly_params *capa);
/**
* @internal
* Get IP reassembly offload configuration parameters set in PMD.
*
* @param dev
* Port (ethdev) handle
*
* @param[out] conf
* Configuration parameters for IP reassembly.
*
* @return
* Negative errno value on error, zero otherwise
*/
typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev,
struct rte_eth_ip_reassembly_params *conf);
/**
* @internal
* Set configuration parameters for enabling IP reassembly offload in hardware.
*
* @param dev
* Port (ethdev) handle
*
* @param[in] conf
* Configuration parameters for IP reassembly.
*
* @return
* Negative errno value on error, zero otherwise
*/
typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
const struct rte_eth_ip_reassembly_params *conf);
/**
* @internal
* Get supported header protocols of a PMD to split.
*
* @param dev
* Ethdev handle of port.
*
* @return
* An array pointer to store supported protocol headers.
*/
typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rte_eth_dev *dev,
size_t *no_of_elements);
/**
* @internal
* Dump private info from device to a file.
*
* @param dev
* Port (ethdev) handle.
* @param file
* A pointer to a file for output.
*
* @return
* Negative value on error, 0 on success.
*
* @retval 0
* Success
* @retval -EINVAL
* Invalid file
*/
typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file);
/**
* @internal Set Rx queue available descriptors threshold.
* @see rte_eth_rx_avail_thresh_set()
*
* Driver should round down number of descriptors on conversion from
* percentage.
*/
typedef int (*eth_rx_queue_avail_thresh_set_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id,
uint8_t avail_thresh);
/**
* @internal Query Rx queue available descriptors threshold event.
* @see rte_eth_rx_avail_thresh_query()
*/
typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
uint16_t *rx_queue_id,
uint8_t *avail_thresh);
/** @internal Get congestion management information. */
typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
struct rte_eth_cman_info *info);
/** @internal Init congestion management structure with default values. */
typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
struct rte_eth_cman_config *config);
/** @internal Configure congestion management on a port. */
typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
const struct rte_eth_cman_config *config);
/** @internal Retrieve congestion management configuration of a port. */
typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
struct rte_eth_cman_config *config);
/**
* @internal
* Dump Rx descriptor info to a file.
*
* It is used for debugging, not a dataplane API.
*
* @param dev
* Port (ethdev) handle.
* @param queue_id
* A Rx queue identifier on this port.
* @param offset
* The offset of the descriptor starting from tail. (0 is the next
* packet to be received by the driver).
* @param num
* The number of the descriptors to dump.
* @param file
* A pointer to a file for output.
* @return
* Negative errno value on error, zero on success.
*/
typedef int (*eth_rx_descriptor_dump_t)(const struct rte_eth_dev *dev,
uint16_t queue_id, uint16_t offset,
uint16_t num, FILE *file);
/**
* @internal
* Dump Tx descriptor info to a file.
*
* This API is used for debugging, not a dataplane API.
*
* @param dev
* Port (ethdev) handle.
* @param queue_id
* A Tx queue identifier on this port.
* @param offset
* The offset of the descriptor starting from tail. (0 is the place where
* the next packet will be send).
* @param num
* The number of the descriptors to dump.
* @param file
* A pointer to a file for output.
* @return
* Negative errno value on error, zero on success.
*/
typedef int (*eth_tx_descriptor_dump_t)(const struct rte_eth_dev *dev,
uint16_t queue_id, uint16_t offset,
uint16_t num, FILE *file);
/**
* @internal
* Get the number of aggregated ports.
*
* @param dev
* Port (ethdev) handle.
*
* @return
* Negative errno value on error, 0 or positive on success.
*
* @retval >=0
* The number of aggregated port if success.
*/
typedef int (*eth_count_aggr_ports_t)(struct rte_eth_dev *dev);
/**
* @internal
* Map a Tx queue with an aggregated port of the DPDK port.
*
* @param dev
* Port (ethdev) handle.
* @param tx_queue_id
* The index of the transmit queue used in rte_eth_tx_burst().
* @param affinity
* The number of the aggregated port.
*
* @return
* Negative on error, 0 on success.
*/
typedef int (*eth_map_aggr_tx_affinity_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint8_t affinity);
/**
* @internal
* Defines types of operations which can be executed by the application.
*/
enum rte_eth_dev_operation {
RTE_ETH_START,
};
/**@{@name Restore flags
* Flags returned by get_restore_flags() callback.
* They indicate to ethdev layer which configuration is required to be restored.
*/
/** If set, ethdev layer will forcefully restore default and any other added MAC addresses. */
#define RTE_ETH_RESTORE_MAC_ADDR RTE_BIT64(0)
/** If set, ethdev layer will forcefully restore current promiscuous mode setting. */
#define RTE_ETH_RESTORE_PROMISC RTE_BIT64(1)
/** If set, ethdev layer will forcefully restore current all multicast mode setting. */
#define RTE_ETH_RESTORE_ALLMULTI RTE_BIT64(2)
/**@}*/
/** All configuration which can be restored by ethdev layer. */
#define RTE_ETH_RESTORE_ALL (RTE_ETH_RESTORE_MAC_ADDR | \
RTE_ETH_RESTORE_PROMISC | \
RTE_ETH_RESTORE_ALLMULTI)
/**
* @internal
* Fetch from the driver what kind of configuration must be restored by ethdev layer,
* after certain operations are performed by the application (such as rte_eth_dev_start()).
*
* @param dev
* Port (ethdev) handle.
* @param op
* Type of operation executed by the application.
*
* @return
* ORed restore flags indicating which configuration should be restored by ethdev.
* 0 if no restore is required by the driver.
*/
typedef uint64_t (*eth_get_restore_flags_t)(struct rte_eth_dev *dev,
enum rte_eth_dev_operation op);
/**
* @internal A structure containing the functions exported by an Ethernet driver.
*/
struct eth_dev_ops {
eth_dev_configure_t dev_configure; /**< Configure device */
eth_dev_start_t dev_start; /**< Start device */
eth_dev_stop_t dev_stop; /**< Stop device */
eth_dev_set_link_up_t dev_set_link_up; /**< Device link up */
eth_dev_set_link_down_t dev_set_link_down; /**< Device link down */
eth_dev_close_t dev_close; /**< Close device */
eth_dev_reset_t dev_reset; /**< Reset device */
eth_link_update_t link_update; /**< Get device link state */
eth_speed_lanes_get_t speed_lanes_get; /**< Get link speed active lanes */
eth_speed_lanes_set_t speed_lanes_set; /**< Set link speeds supported lanes */
/** Get link speed lanes capability */
eth_speed_lanes_get_capability_t speed_lanes_get_capa;
/** Check if the device was physically removed */
eth_is_removed_t is_removed;
eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON */
eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF */
eth_allmulticast_enable_t allmulticast_enable;/**< Rx multicast ON */
eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */
eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */
eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */
eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */
/** Set list of multicast addresses */
eth_set_mc_addr_list_t set_mc_addr_list;
mtu_set_t mtu_set; /**< Set MTU */
/** Get generic device statistics */
eth_stats_get_t stats_get;
/** Reset generic device statistics */
eth_stats_reset_t stats_reset;
/** Get extended device statistics */
eth_xstats_get_t xstats_get;
/** Reset extended device statistics */
eth_xstats_reset_t xstats_reset;
/** Get names of extended statistics */
eth_xstats_get_names_t xstats_get_names;
/** Configure per queue stat counter mapping */
eth_queue_stats_mapping_set_t queue_stats_mapping_set;
eth_dev_infos_get_t dev_infos_get; /**< Get device info */
/** Retrieve Rx queue information */
eth_rxq_info_get_t rxq_info_get;
/** Retrieve Tx queue information */
eth_txq_info_get_t txq_info_get;
/** Retrieve mbufs recycle Rx queue information */
eth_recycle_rxq_info_get_t recycle_rxq_info_get;
eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */
eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */
eth_fw_version_get_t fw_version_get; /**< Get firmware version */
/** Get packet types supported and identified by device */
eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
/**
* Inform Ethernet device about reduced range of packet types to
* handle
*/
eth_dev_ptypes_set_t dev_ptypes_set;
/** Filter VLAN Setup */
vlan_filter_set_t vlan_filter_set;
/** Outer/Inner VLAN TPID Setup */
vlan_tpid_set_t vlan_tpid_set;
/** VLAN Stripping on queue */
vlan_strip_queue_set_t vlan_strip_queue_set;
/** Set VLAN Offload */
vlan_offload_set_t vlan_offload_set;
/** Set port based Tx VLAN insertion */
vlan_pvid_set_t vlan_pvid_set;
eth_queue_start_t rx_queue_start;/**< Start Rx for a queue */
eth_queue_stop_t rx_queue_stop; /**< Stop Rx for a queue */
eth_queue_start_t tx_queue_start;/**< Start Tx for a queue */
eth_queue_stop_t tx_queue_stop; /**< Stop Tx for a queue */
eth_rx_queue_setup_t rx_queue_setup;/**< Set up device Rx queue */
eth_queue_release_t rx_queue_release; /**< Release Rx queue */
/** Enable Rx queue interrupt */
eth_rx_enable_intr_t rx_queue_intr_enable;
/** Disable Rx queue interrupt */
eth_rx_disable_intr_t rx_queue_intr_disable;
eth_tx_queue_setup_t tx_queue_setup;/**< Set up device Tx queue */
eth_queue_release_t tx_queue_release; /**< Release Tx queue */
eth_tx_done_cleanup_t tx_done_cleanup;/**< Free Tx ring mbufs */
eth_dev_led_on_t dev_led_on; /**< Turn on LED */
eth_dev_led_off_t dev_led_off; /**< Turn off LED */
flow_ctrl_get_t flow_ctrl_get; /**< Get flow control */
flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */
/** Setup priority flow control */
priority_flow_ctrl_set_t priority_flow_ctrl_set;
/** Priority flow control queue info get */
priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get;
/** Priority flow control queue configure */
priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config;
/** Set Unicast Table Array */
eth_uc_hash_table_set_t uc_hash_table_set;
/** Set Unicast hash bitmap */
eth_uc_all_hash_table_set_t uc_all_hash_table_set;
/** Add UDP tunnel port */
eth_udp_tunnel_port_add_t udp_tunnel_port_add;
/** Delete UDP tunnel port */
eth_udp_tunnel_port_del_t udp_tunnel_port_del;
/** Set queue rate limit */
eth_set_queue_rate_limit_t set_queue_rate_limit;
/** Configure RSS hash protocols and hashing key */
rss_hash_update_t rss_hash_update;
/** Get current RSS hash configuration */
rss_hash_conf_get_t rss_hash_conf_get;
/** Update redirection table */
reta_update_t reta_update;
/** Query redirection table */
reta_query_t reta_query;
eth_get_reg_t get_reg; /**< Get registers */
eth_get_eeprom_length_t get_eeprom_length; /**< Get EEPROM length */
eth_get_eeprom_t get_eeprom; /**< Get EEPROM data */
eth_set_eeprom_t set_eeprom; /**< Set EEPROM */
/** Get plugin module EEPROM attribute */
eth_get_module_info_t get_module_info;
/** Get plugin module EEPROM data */
eth_get_module_eeprom_t get_module_eeprom;
eth_flow_ops_get_t flow_ops_get; /**< Get flow operations */
eth_get_dcb_info get_dcb_info; /**< Get DCB information */
/** Turn IEEE1588/802.1AS timestamping on */
eth_timesync_enable_t timesync_enable;
/** Turn IEEE1588/802.1AS timestamping off */
eth_timesync_disable_t timesync_disable;
/** Read the IEEE1588/802.1AS Rx timestamp */
eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
/** Read the IEEE1588/802.1AS Tx timestamp */
eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
/** Adjust the device clock */
eth_timesync_adjust_time timesync_adjust_time;
/** Adjust the clock frequency */
eth_timesync_adjust_freq timesync_adjust_freq;
/** Get the device clock time */
eth_timesync_read_time timesync_read_time;
/** Set the device clock time */
eth_timesync_write_time timesync_write_time;
eth_read_clock read_clock;
/** Get extended device statistic values by ID */
eth_xstats_get_by_id_t xstats_get_by_id;
/** Get name of extended device statistics by ID */
eth_xstats_get_names_by_id_t xstats_get_names_by_id;
eth_xstats_enable_counter_t xstats_enable;
eth_xstats_disable_counter_t xstats_disable;
eth_xstats_query_state_t xstats_query_state;
/** Get Traffic Management (TM) operations */
eth_tm_ops_get_t tm_ops_get;
/** Get Traffic Metering and Policing (MTR) operations */
eth_mtr_ops_get_t mtr_ops_get;
/** Test if a port supports specific mempool ops */
eth_pool_ops_supported_t pool_ops_supported;
/** Returns the hairpin capabilities */
eth_hairpin_cap_get_t hairpin_cap_get;
/** Set up device Rx hairpin queue */
eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup;
/** Set up device Tx hairpin queue */
eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
/** Get Forward Error Correction(FEC) capability */
eth_fec_get_capability_t fec_get_capability;
/** Get Forward Error Correction(FEC) mode */
eth_fec_get_t fec_get;
/** Set Forward Error Correction(FEC) mode */
eth_fec_set_t fec_set;
/** Get hairpin peer ports list */
hairpin_get_peer_ports_t hairpin_get_peer_ports;
/** Bind all hairpin Tx queues of device to the peer port Rx queues */
eth_hairpin_bind_t hairpin_bind;
/** Unbind all hairpin Tx queues from the peer port Rx queues */
eth_hairpin_unbind_t hairpin_unbind;
/** Pass the current queue info and get the peer queue info */
eth_hairpin_queue_peer_update_t hairpin_queue_peer_update;
/** Set up the connection between the pair of hairpin queues */
eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;
/** Disconnect the hairpin queues of a pair from each other */
eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
/** Get power monitoring condition for Rx queue */
eth_get_monitor_addr_t get_monitor_addr;
/** Get representor info */
eth_representor_info_get_t representor_info_get;
/**
* Negotiate the NIC's ability to deliver specific
* kinds of metadata to the PMD
*/
eth_rx_metadata_negotiate_t rx_metadata_negotiate;
/** Get IP reassembly capability */
eth_ip_reassembly_capability_get_t ip_reassembly_capability_get;
/** Get IP reassembly configuration */
eth_ip_reassembly_conf_get_t ip_reassembly_conf_get;
/** Set IP reassembly configuration */
eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
/** Get supported header ptypes to split */
eth_buffer_split_supported_hdr_ptypes_get_t buffer_split_supported_hdr_ptypes_get;
/** Dump private info from device */
eth_dev_priv_dump_t eth_dev_priv_dump;
/** Set Rx queue available descriptors threshold */
eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
/** Query Rx queue available descriptors threshold event */
eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
/** Dump Rx descriptor info */
eth_rx_descriptor_dump_t eth_rx_descriptor_dump;
/** Dump Tx descriptor info */
eth_tx_descriptor_dump_t eth_tx_descriptor_dump;
/** Get congestion management information */
eth_cman_info_get_t cman_info_get;
/** Initialize congestion management structure with default values */
eth_cman_config_init_t cman_config_init;
/** Configure congestion management */
eth_cman_config_set_t cman_config_set;
/** Retrieve congestion management configuration */
eth_cman_config_get_t cman_config_get;
/** Get the number of aggregated ports */
eth_count_aggr_ports_t count_aggr_ports;
/** Map a Tx queue with an aggregated port of the DPDK port */
eth_map_aggr_tx_affinity_t map_aggr_tx_affinity;
/** Get configuration which ethdev should restore */
eth_get_restore_flags_t get_restore_flags;
};
/**
* @internal
* Check if the selected Rx queue is hairpin queue.
*
* @param dev
* Pointer to the selected device.
* @param queue_id
* The selected queue.
*
* @return
* - (1) if the queue is hairpin queue, 0 otherwise.
*/
__rte_internal
int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
/**
* @internal
* Check if the selected Tx queue is hairpin queue.
*
* @param dev
* Pointer to the selected device.
* @param queue_id
* The selected queue.
*
* @return
* - (1) if the queue is hairpin queue, 0 otherwise.
*/
__rte_internal
int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
/**
* @internal
* Returns a ethdev slot specified by the unique identifier name.
*
* @param name
* The pointer to the Unique identifier name for each Ethernet device
* @return
* - The pointer to the ethdev slot, on success. NULL on error
*/
__rte_internal
struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
/**
* @internal
* Allocates a new ethdev slot for an Ethernet device and returns the pointer
* to that slot for the driver to use.
*
* @param name Unique identifier name for each Ethernet device
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
__rte_internal
struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
* Attach to the ethdev already initialized by the primary
* process.
*
* @param name Ethernet device's name.
* @return
* - Success: Slot in the rte_dev_devices array for attached
* device.
* - Error: Null pointer.
*/
__rte_internal
struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);
/**
* @internal
* Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port.
*
* The following PMD-managed data fields will be freed:
* - dev_private
* - mac_addrs
* - hash_mac_addrs
* If one of these fields should not be freed,
* it must be reset to NULL by the PMD, typically in dev_close method.
*
* @param eth_dev
* Device to be detached.
* @return
* - 0 on success, negative on error
*/
__rte_internal
int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
/**
* @internal
* Release device queues and clear its configuration to force the user
* application to reconfigure it. It is for internal use only.
*
* @param dev
* Pointer to struct rte_eth_dev.
*
* @return
* void
*/
__rte_internal
void rte_eth_dev_internal_reset(struct rte_eth_dev *dev);
/**
* @internal Executes all the user application registered callbacks for
* the specific device. It is for DPDK internal user only. User
* application should not call it directly.
*
* @param dev
* Pointer to struct rte_eth_dev.
* @param event
* Eth device interrupt event type.
* @param ret_param
* To pass data back to user application.
* This allows the user application to decide if a particular function
* is permitted or not.
*
* @return
* int
*/
__rte_internal
int rte_eth_dev_callback_process(struct rte_eth_dev *dev,
enum rte_eth_event_type event, void *ret_param);
/**
* @internal
* This is the last step of device probing.
* It must be called after a port is allocated and initialized successfully.
*
* The notification RTE_ETH_EVENT_NEW is sent to other entities
* (libraries and applications).
* The state is set as RTE_ETH_DEV_ATTACHED.
*
* @param dev
* New ethdev port.
*/
__rte_internal
void rte_eth_dev_probing_finish(struct rte_eth_dev *dev);
/**
* Create memzone for HW rings.
* malloc can't be used as the physical address is needed.
* If the memzone is already created, then this function returns a ptr
* to the old one.
*
* @param eth_dev
* The *eth_dev* pointer is the address of the *rte_eth_dev* structure
* @param name
* The name of the memory zone
* @param queue_id
* The index of the queue to add to name
* @param size
* The sizeof of the memory area
* @param align
* Alignment for resulting memzone. Must be a power of 2.
* @param socket_id
* The *socket_id* argument is the socket identifier in case of NUMA.
*/
__rte_internal
const struct rte_memzone *
rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
uint16_t queue_id, size_t size,
unsigned align, int socket_id);
/**
* Free previously allocated memzone for HW rings.
*
* @param eth_dev
* The *eth_dev* pointer is the address of the *rte_eth_dev* structure
* @param name
* The name of the memory zone
* @param queue_id
* The index of the queue to add to name
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name,
uint16_t queue_id);
/**
* @internal
* Atomically set the link status for the specific device.
* It is for use by DPDK device driver use only.
* User applications should not call it
*
* @param dev
* Pointer to struct rte_eth_dev.
* @param link
* New link status value.
* @return
* Same convention as eth_link_update operation.
* 0 if link up status has changed
* -1 if link up status was unchanged
*/
static inline int
rte_eth_linkstatus_set(struct rte_eth_dev *dev,
const struct rte_eth_link *new_link)
{
struct rte_eth_link old_link;
old_link.val64 = rte_atomic_exchange_explicit(&dev->data->dev_link.val64,
new_link->val64,
rte_memory_order_seq_cst);
return (old_link.link_status == new_link->link_status) ? -1 : 0;
}
/**
* @internal
* Atomically get the link speed and status.
*
* @param dev
* Pointer to struct rte_eth_dev.
* @param link
* link status value.
*/
static inline void
rte_eth_linkstatus_get(const struct rte_eth_dev *dev,
struct rte_eth_link *link)
{
struct rte_eth_link curr_link;
curr_link.val64 = rte_atomic_load_explicit(&dev->data->dev_link.val64,
rte_memory_order_seq_cst);
rte_atomic_store_explicit(&link->val64, curr_link.val64, rte_memory_order_seq_cst);
}
/**
* @internal
* Dummy DPDK callback for Rx/Tx packet burst.
*
* @param queue
* Pointer to Rx/Tx queue
* @param pkts
* Packet array
* @param nb_pkts
* Number of packets in packet array
*/
__rte_internal
uint16_t
rte_eth_pkt_burst_dummy(void *queue __rte_unused,
struct rte_mbuf **pkts __rte_unused,
uint16_t nb_pkts __rte_unused);
/**
* @internal
* Dummy DPDK callback for Tx packet prepare.
*
* @param queue
* Pointer to Tx queue
* @param pkts
* Packet array
* @param nb_pkts
* Number of packets in packet array
*/
__rte_internal
uint16_t
rte_eth_tx_pkt_prepare_dummy(void *queue __rte_unused,
struct rte_mbuf **pkts __rte_unused,
uint16_t nb_pkts __rte_unused);
/**
* @internal
* Dummy DPDK callback for queue count.
*
* @param queue
* Pointer to Rx/Tx queue
*/
__rte_internal
int
rte_eth_queue_count_dummy(void *queue __rte_unused);
/**
* @internal
* Dummy DPDK callback for descriptor status.
*
* @param queue
* Pointer to Rx/Tx queue
* @param offset
* The offset of the descriptor starting from tail (0 is the next
* packet to be received by the driver).
*/
__rte_internal
int
rte_eth_descriptor_status_dummy(void *queue __rte_unused,
uint16_t offset __rte_unused);
/**
* @internal
* Dummy DPDK callback for recycle Tx mbufs reuse.
*
* @param queue
* Pointer to Tx queue
* @param recycle_rxq_info
* Pointer to recycle Rx queue info
*/
__rte_internal
uint16_t
rte_eth_recycle_tx_mbufs_reuse_dummy(void *queue __rte_unused,
struct rte_eth_recycle_rxq_info *recycle_rxq_info __rte_unused);
/**
* @internal
* Dummy DPDK callback Rx descriptor refill.
*
* @param queue
* Pointer Rx queue
* @param offset
* number of descriptors to refill
*/
__rte_internal
void
rte_eth_recycle_rx_descriptors_refill_dummy(void *queue __rte_unused,
uint16_t nb __rte_unused);
/**
* Allocate an unique switch domain identifier.
*
* A pool of switch domain identifiers which can be allocated on request. This
* will enabled devices which support the concept of switch domains to request
* a switch domain ID which is guaranteed to be unique from other devices
* running in the same process.
*
* @param domain_id
* switch domain identifier parameter to pass back to application
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_switch_domain_alloc(uint16_t *domain_id);
/**
* Free switch domain.
*
* Return a switch domain identifier to the pool of free identifiers after it is
* no longer in use by device.
*
* @param domain_id
* switch domain identifier to free
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_switch_domain_free(uint16_t domain_id);
/* Flags for rte_eth_devargs::flags. */
/* When enclosed in parentheses, the PF representor is not required. */
#define RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF RTE_BIT32(0)
/**
* Generic Ethernet device arguments
*
* One type of representor each structure.
*/
struct rte_eth_devargs {
uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
/** controller/s number in case of multi-host */
uint16_t nb_mh_controllers;
/** number of controllers in multi-host controllers field */
uint16_t ports[RTE_MAX_ETHPORTS];
/** port/s number to enable on a multi-port single function */
uint16_t nb_ports;
/** number of ports in ports field */
uint32_t flags; /* see RTE_ETH_DEVARG_* */
uint16_t representor_ports[RTE_MAX_ETHPORTS];
/** representor port/s identifier to enable on device */
uint16_t nb_representor_ports;
/** number of ports in representor port field */
enum rte_eth_representor_type type; /* type of representor */
};
/**
* PMD helper function to get representor ID from location detail.
*
* Get representor ID from controller, pf and (sf or vf).
* The mapping is retrieved from rte_eth_representor_info_get().
*
* For backward compatibility, if no representor info, direct
* map legacy VF (no controller and pf).
*
* @param port_id
* Port ID of the backing device.
* @param type
* Representor type.
* @param controller
* Controller ID, -1 if unspecified.
* @param pf
* PF port ID, -1 if unspecified.
* @param representor_port
* VF or SF representor port number, -1 if unspecified.
* @param repr_id
* Pointer to output representor ID.
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_representor_id_get(uint16_t port_id,
enum rte_eth_representor_type type,
int controller, int pf, int representor_port,
uint16_t *repr_id);
/**
* @internal
* Check if the ethdev is a representor port.
*
* @param dev
* Pointer to struct rte_eth_dev.
*
* @return
* false the ethdev is not a representor port.
* true the ethdev is a representor port.
*/
static inline bool
rte_eth_dev_is_repr(const struct rte_eth_dev *dev)
{
return ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0);
}
/**
* PMD helper function to parse ethdev arguments
*
* @param devargs
* device arguments
* @param eth_devargs
* contiguous memory populated with parsed ethdev specific arguments.
* @param nb_da
* size of eth_devargs array passed
*
* @return
* Negative errno value on error, no of devargs parsed on success.
*/
__rte_internal
int
rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs,
unsigned int nb_da);
typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params);
typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev,
void *bus_specific_init_params);
/**
* PMD helper function for the creation of a new ethdev ports.
*
* @param device
* rte_device handle.
* @param name
* port name.
* @param priv_data_size
* size of private data required for port.
* @param bus_specific_init
* port bus specific initialisation callback function
* @param bus_init_params
* port bus specific initialisation parameters
* @param ethdev_init
* device specific port initialization callback function
* @param init_params
* port initialisation parameters
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_dev_create(struct rte_device *device, const char *name,
size_t priv_data_size,
ethdev_bus_specific_init bus_specific_init, void *bus_init_params,
ethdev_init_t ethdev_init, void *init_params);
typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev);
/**
* PMD helper function for cleaning up the resources of a ethdev port on it's
* destruction.
*
* @param ethdev
* ethdev handle of port.
* @param ethdev_uninit
* device specific port un-initialise callback function
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);
/**
* @internal
* Pass the current hairpin queue HW and/or SW information to the peer queue
* and fetch back the information of the peer queue.
*
* @param peer_port
* Peer port identifier of the Ethernet device.
* @param peer_queue
* Peer queue index of the port.
* @param cur_info
* Pointer to the current information structure.
* @param peer_info
* Pointer to the peer information, output.
* @param direction
* Direction to pass the information.
* positive - pass Tx queue information and get peer Rx queue information
* zero - pass Rx queue information and get peer Tx queue information
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
struct rte_hairpin_peer_info *cur_info,
struct rte_hairpin_peer_info *peer_info,
uint32_t direction);
/**
* @internal
* Configure current hairpin queue with the peer information fetched to create
* the connection (bind) with peer queue in the specified direction.
* This function might need to be called twice to fully create the connections.
*
* @param cur_port
* Current port identifier of the Ethernet device.
* @param cur_queue
* Current queue index of the port.
* @param peer_info
* Pointer to the peer information, input.
* @param direction
* Direction to create the connection.
* positive - bind current Tx queue to peer Rx queue
* zero - bind current Rx queue to peer Tx queue
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
struct rte_hairpin_peer_info *peer_info,
uint32_t direction);
/**
* @internal
* Get rte_eth_dev from device name. The device name should be specified
* as below:
* - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0
* - SoC device name, for example fsl-gmac0
* - vdev dpdk name, for example net_[pcap0|null0|tap0]
*
* @param name
* PCI address or name of the device
* @return
* - rte_eth_dev if successful
* - NULL on failure
*/
__rte_internal
struct rte_eth_dev*
rte_eth_dev_get_by_name(const char *name);
/**
* @internal
* Reset the current queue state and configuration to disconnect (unbind) it
* from the peer queue.
* This function might need to be called twice to disconnect each other.
*
* @param cur_port
* Current port identifier of the Ethernet device.
* @param cur_queue
* Current queue index of the port.
* @param direction
* Direction to destroy the connection.
* positive - unbind current Tx queue from peer Rx queue
* zero - unbind current Rx queue from peer Tx queue
*
* @return
* Negative errno value on error, 0 on success.
*/
__rte_internal
int
rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
uint32_t direction);
/**
* @internal
* Register mbuf dynamic field and flag for IP reassembly incomplete case.
*/
__rte_internal
int
rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag);
/*
* Legacy ethdev API used internally by drivers.
*/
enum rte_filter_type {
RTE_ETH_FILTER_NONE = 0,
RTE_ETH_FILTER_ETHERTYPE,
RTE_ETH_FILTER_FLEXIBLE,
RTE_ETH_FILTER_SYN,
RTE_ETH_FILTER_NTUPLE,
RTE_ETH_FILTER_TUNNEL,
RTE_ETH_FILTER_FDIR,
RTE_ETH_FILTER_HASH,
RTE_ETH_FILTER_L2_TUNNEL,
};
/**
* Define all structures for Ethertype Filter type.
*/
#define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */
#define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */
/**
* A structure used to define the ethertype filter entry
* to support RTE_ETH_FILTER_ETHERTYPE data representation.
*/
struct rte_eth_ethertype_filter {
struct rte_ether_addr mac_addr; /**< Mac address to match */
uint16_t ether_type; /**< Ether type to match */
uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */
uint16_t queue; /**< Queue assigned to when match */
};
/**
* A structure used to define the TCP syn filter entry
* to support RTE_ETH_FILTER_SYN data representation.
*/
struct rte_eth_syn_filter {
/** 1 - higher priority than other filters, 0 - lower priority */
uint8_t hig_pri;
uint16_t queue; /**< Queue assigned to when match */
};
/**
* filter type of tunneling packet
*/
#define RTE_ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
#define RTE_ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
#define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
#define RTE_ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
#define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
#define RTE_ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
#define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \
RTE_ETH_TUNNEL_FILTER_IVLAN)
#define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
RTE_ETH_TUNNEL_FILTER_IVLAN | \
RTE_ETH_TUNNEL_FILTER_TENID)
#define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
RTE_ETH_TUNNEL_FILTER_TENID)
#define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \
RTE_ETH_TUNNEL_FILTER_TENID | \
RTE_ETH_TUNNEL_FILTER_IMAC)
/**
* Select IPv4 or IPv6 for tunnel filters.
*/
enum rte_tunnel_iptype {
RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */
RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6 */
};
/**
* Tunneling Packet filter configuration.
*/
struct rte_eth_tunnel_filter_conf {
struct rte_ether_addr outer_mac; /**< Outer MAC address to match */
struct rte_ether_addr inner_mac; /**< Inner MAC address to match */
uint16_t inner_vlan; /**< Inner VLAN to match */
enum rte_tunnel_iptype ip_type; /**< IP address type */
/**
* Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
* is set in filter_type, or inner destination IP address to match
* if ETH_TUNNEL_FILTER_IIP is set in filter_type.
*/
union {
uint32_t ipv4_addr; /**< IPv4 address in big endian */
uint32_t ipv6_addr[4]; /**< IPv6 address in big endian */
} ip_addr;
/** Flags from ETH_TUNNEL_FILTER_XX - see above */
uint16_t filter_type;
enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */
uint32_t tenant_id; /**< Tenant ID to match: VNI, GRE key... */
uint16_t queue_id; /**< Queue assigned to if match */
};
/**
* Memory space that can be configured to store Flow Director filters
* in the board memory.
*/
enum rte_eth_fdir_pballoc_type {
RTE_ETH_FDIR_PBALLOC_64K = 0, /**< 64k. */
RTE_ETH_FDIR_PBALLOC_128K, /**< 128k. */
RTE_ETH_FDIR_PBALLOC_256K, /**< 256k. */
};
/**
* Select report mode of FDIR hash information in Rx descriptors.
*/
enum rte_fdir_status_mode {
RTE_FDIR_NO_REPORT_STATUS = 0, /**< Never report FDIR hash. */
RTE_FDIR_REPORT_STATUS, /**< Only report FDIR hash for matching pkts. */
RTE_FDIR_REPORT_STATUS_ALWAYS, /**< Always report FDIR hash. */
};
/**
* A structure used to configure the Flow Director (FDIR) feature
* of an Ethernet port.
*
* If mode is RTE_FDIR_MODE_NONE, the pballoc value is ignored.
*/
struct rte_eth_fdir_conf {
enum rte_fdir_mode mode; /**< Flow Director mode. */
enum rte_eth_fdir_pballoc_type pballoc; /**< Space for FDIR filters. */
enum rte_fdir_status_mode status; /**< How to report FDIR hash. */
/** Rx queue of packets matching a "drop" filter in perfect mode. */
uint8_t drop_queue;
struct rte_eth_fdir_masks mask;
/** Flex payload configuration. */
struct rte_eth_fdir_flex_conf flex_conf;
};
/**
* @internal
* Fetch from the driver what kind of configuration must be restored by ethdev layer,
* using get_restore_flags() callback.
*
* If callback is not defined, it is assumed that all supported configuration must be restored.
*
* @param dev
* Port (ethdev) handle.
* @param op
* Type of operation executed by the application.
*
* @return
* ORed restore flags indicating which configuration should be restored by ethdev.
* 0 if no restore is required by the driver.
*/
__rte_internal
uint64_t
rte_eth_get_restore_flags(struct rte_eth_dev *dev,
enum rte_eth_dev_operation op);
#ifdef __cplusplus
}
#endif
#endif /* _RTE_ETHDEV_DRIVER_H_ */
|