DPDK  19.08.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
rte_tm.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation.
3  * Copyright(c) 2017 Cavium.
4  * Copyright(c) 2017 NXP.
5  */
6 
7 #ifndef __INCLUDE_RTE_TM_H__
8 #define __INCLUDE_RTE_TM_H__
9 
22 #include <stdint.h>
23 
24 #include <rte_common.h>
25 #include <rte_meter.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
44 #define RTE_TM_ETH_FRAMING_OVERHEAD 20
45 
56 #define RTE_TM_ETH_FRAMING_OVERHEAD_FCS 24
57 
65 #define RTE_TM_WRED_PROFILE_ID_NONE UINT32_MAX
66 
74 #define RTE_TM_SHAPER_PROFILE_ID_NONE UINT32_MAX
75 
81 #define RTE_TM_NODE_ID_NULL UINT32_MAX
82 
88 #define RTE_TM_NODE_LEVEL_ID_ANY UINT32_MAX
89 
96 
99 
102 
105 
108 
111 
114 
117 
122 
127 };
128 
134  uint64_t n_pkts;
135 
137  uint64_t n_bytes;
138 
140  struct {
145 
150 
154  uint64_t n_pkts_queued;
155 
159  uint64_t n_bytes_queued;
160  } leaf;
161 };
162 
172 
178 
181 
184 
187 
190 
193 
196 };
197 
203  uint32_t n_nodes_max;
204 
208  uint32_t n_levels_max;
209 
214 
219 
226  uint32_t shaper_n_max;
227 
233 
242 
247 
252 
257 
262 
270 
276 
281 
286 
291 
296 
303 
313 
323 
336 
341 
349 
357 
363 
372 
379 
384 
389 
398 
401 
404 
407 
410 
415 
419  uint64_t stats_mask;
420 };
421 
427  uint32_t n_nodes_max;
428 
434 
440 
446 
452 
454  union {
456  struct {
463 
473 
480 
487 
497 
505 
518 
530 
549 
556 
564  uint64_t stats_mask;
565  } nonleaf;
566 
568  struct {
575 
584 
590  uint64_t shaper_private_rate_min;
591 
597  uint64_t shaper_private_rate_max;
598 
607  uint32_t shaper_shared_n_max;
608 
617 
626 
634 
641 
652 
660  uint64_t stats_mask;
661  } leaf;
662  };
663 };
664 
671 
676 
682 
688 
694 
696  union {
698  struct {
701 
709 
718 
732 
738  } nonleaf;
739 
741  struct {
744 
747 
750 
753 
760  } leaf;
761  };
762 
766  uint64_t stats_mask;
767 };
768 
789 };
790 
796  uint64_t min_th;
797 
799  uint64_t max_th;
800 
804  uint16_t maxp_inv;
805 
807  uint16_t wq_log2;
808 };
809 
827 
833 };
834 
840  uint64_t rate;
841 
843  uint64_t size;
844 };
845 
867 
870 
877 };
878 
912 
914  uint32_t *shared_shaper_id;
915 
918 
920  union {
922  struct {
930 
932  uint32_t n_sp_priorities;
933  } nonleaf;
934 
936  struct {
939 
943  struct {
949  uint32_t wred_profile_id;
950 
957 
964  } wred;
965  } leaf;
966  };
967 
974  uint64_t stats_mask;
975 };
976 
986  RTE_TM_ERROR_TYPE_CAPABILITIES,
987  RTE_TM_ERROR_TYPE_LEVEL_ID,
988  RTE_TM_ERROR_TYPE_WRED_PROFILE,
989  RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN,
990  RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW,
991  RTE_TM_ERROR_TYPE_WRED_PROFILE_RED,
992  RTE_TM_ERROR_TYPE_WRED_PROFILE_ID,
993  RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID,
994  RTE_TM_ERROR_TYPE_SHAPER_PROFILE,
995  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE,
996  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE,
997  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
998  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
999  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN,
1000  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,
1001  RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID,
1002  RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,
1003  RTE_TM_ERROR_TYPE_NODE_PRIORITY,
1004  RTE_TM_ERROR_TYPE_NODE_WEIGHT,
1005  RTE_TM_ERROR_TYPE_NODE_PARAMS,
1006  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,
1007  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID,
1008  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,
1009  RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE,
1010  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,
1011  RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN,
1012  RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID,
1013  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID,
1014  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS,
1015  RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,
1016  RTE_TM_ERROR_TYPE_NODE_ID,
1017 };
1018 
1032  const void *cause;
1033  const char *message;
1034 };
1035 
1053 int
1054 rte_tm_get_number_of_leaf_nodes(uint16_t port_id,
1055  uint32_t *n_leaf_nodes,
1056  struct rte_tm_error *error);
1057 
1077 int
1078 rte_tm_node_type_get(uint16_t port_id,
1079  uint32_t node_id,
1080  int *is_leaf,
1081  struct rte_tm_error *error);
1082 
1095 int
1096 rte_tm_capabilities_get(uint16_t port_id,
1097  struct rte_tm_capabilities *cap,
1098  struct rte_tm_error *error);
1099 
1115 int
1116 rte_tm_level_capabilities_get(uint16_t port_id,
1117  uint32_t level_id,
1118  struct rte_tm_level_capabilities *cap,
1119  struct rte_tm_error *error);
1120 
1135 int
1136 rte_tm_node_capabilities_get(uint16_t port_id,
1137  uint32_t node_id,
1138  struct rte_tm_node_capabilities *cap,
1139  struct rte_tm_error *error);
1140 
1160 int
1161 rte_tm_wred_profile_add(uint16_t port_id,
1162  uint32_t wred_profile_id,
1163  struct rte_tm_wred_params *profile,
1164  struct rte_tm_error *error);
1165 
1183 int
1184 rte_tm_wred_profile_delete(uint16_t port_id,
1185  uint32_t wred_profile_id,
1186  struct rte_tm_error *error);
1187 
1214 int
1215 rte_tm_shared_wred_context_add_update(uint16_t port_id,
1216  uint32_t shared_wred_context_id,
1217  uint32_t wred_profile_id,
1218  struct rte_tm_error *error);
1219 
1238 int
1239 rte_tm_shared_wred_context_delete(uint16_t port_id,
1240  uint32_t shared_wred_context_id,
1241  struct rte_tm_error *error);
1242 
1262 int
1263 rte_tm_shaper_profile_add(uint16_t port_id,
1264  uint32_t shaper_profile_id,
1265  struct rte_tm_shaper_params *profile,
1266  struct rte_tm_error *error);
1267 
1285 int
1286 rte_tm_shaper_profile_delete(uint16_t port_id,
1287  uint32_t shaper_profile_id,
1288  struct rte_tm_error *error);
1289 
1314 int
1315 rte_tm_shared_shaper_add_update(uint16_t port_id,
1316  uint32_t shared_shaper_id,
1317  uint32_t shaper_profile_id,
1318  struct rte_tm_error *error);
1319 
1337 int
1338 rte_tm_shared_shaper_delete(uint16_t port_id,
1339  uint32_t shared_shaper_id,
1340  struct rte_tm_error *error);
1341 
1405 int
1406 rte_tm_node_add(uint16_t port_id,
1407  uint32_t node_id,
1408  uint32_t parent_node_id,
1409  uint32_t priority,
1410  uint32_t weight,
1411  uint32_t level_id,
1412  struct rte_tm_node_params *params,
1413  struct rte_tm_error *error);
1414 
1438 int
1439 rte_tm_node_delete(uint16_t port_id,
1440  uint32_t node_id,
1441  struct rte_tm_error *error);
1442 
1462 int
1463 rte_tm_node_suspend(uint16_t port_id,
1464  uint32_t node_id,
1465  struct rte_tm_error *error);
1466 
1485 int
1486 rte_tm_node_resume(uint16_t port_id,
1487  uint32_t node_id,
1488  struct rte_tm_error *error);
1489 
1526 int
1527 rte_tm_hierarchy_commit(uint16_t port_id,
1528  int clear_on_fail,
1529  struct rte_tm_error *error);
1530 
1566 int
1567 rte_tm_node_parent_update(uint16_t port_id,
1568  uint32_t node_id,
1569  uint32_t parent_node_id,
1570  uint32_t priority,
1571  uint32_t weight,
1572  struct rte_tm_error *error);
1573 
1595 int
1596 rte_tm_node_shaper_update(uint16_t port_id,
1597  uint32_t node_id,
1598  uint32_t shaper_profile_id,
1599  struct rte_tm_error *error);
1600 
1622 int
1623 rte_tm_node_shared_shaper_update(uint16_t port_id,
1624  uint32_t node_id,
1625  uint32_t shared_shaper_id,
1626  int add,
1627  struct rte_tm_error *error);
1628 
1649 int
1650 rte_tm_node_stats_update(uint16_t port_id,
1651  uint32_t node_id,
1652  uint64_t stats_mask,
1653  struct rte_tm_error *error);
1654 
1677 int
1678 rte_tm_node_wfq_weight_mode_update(uint16_t port_id,
1679  uint32_t node_id,
1680  int *wfq_weight_mode,
1681  uint32_t n_sp_priorities,
1682  struct rte_tm_error *error);
1683 
1700 int
1701 rte_tm_node_cman_update(uint16_t port_id,
1702  uint32_t node_id,
1703  enum rte_tm_cman_mode cman,
1704  struct rte_tm_error *error);
1705 
1724 int
1725 rte_tm_node_wred_context_update(uint16_t port_id,
1726  uint32_t node_id,
1727  uint32_t wred_profile_id,
1728  struct rte_tm_error *error);
1729 
1749 int
1751  uint32_t node_id,
1752  uint32_t shared_wred_context_id,
1753  int add,
1754  struct rte_tm_error *error);
1755 
1781 int
1782 rte_tm_node_stats_read(uint16_t port_id,
1783  uint32_t node_id,
1784  struct rte_tm_node_stats *stats,
1785  uint64_t *stats_mask,
1786  int clear,
1787  struct rte_tm_error *error);
1788 
1818 int
1819 rte_tm_mark_vlan_dei(uint16_t port_id,
1820  int mark_green,
1821  int mark_yellow,
1822  int mark_red,
1823  struct rte_tm_error *error);
1824 
1868 int
1869 rte_tm_mark_ip_ecn(uint16_t port_id,
1870  int mark_green,
1871  int mark_yellow,
1872  int mark_red,
1873  struct rte_tm_error *error);
1874 
1916 int
1917 rte_tm_mark_ip_dscp(uint16_t port_id,
1918  int mark_green,
1919  int mark_yellow,
1920  int mark_red,
1921  struct rte_tm_error *error);
1922 
1923 #ifdef __cplusplus
1924 }
1925 #endif
1926 
1927 #endif /* __INCLUDE_RTE_TM_H__ */