DPDK  18.05.1
rte_tm.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2017 Intel Corporation.
5  * Copyright(c) 2017 Cavium.
6  * Copyright(c) 2017 NXP.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  * * Neither the name of Intel Corporation nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef __INCLUDE_RTE_TM_H__
37 #define __INCLUDE_RTE_TM_H__
38 
51 #include <stdint.h>
52 
53 #include <rte_common.h>
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
72 #define RTE_TM_ETH_FRAMING_OVERHEAD 20
73 
84 #define RTE_TM_ETH_FRAMING_OVERHEAD_FCS 24
85 
93 #define RTE_TM_WRED_PROFILE_ID_NONE UINT32_MAX
94 
102 #define RTE_TM_SHAPER_PROFILE_ID_NONE UINT32_MAX
103 
109 #define RTE_TM_NODE_ID_NULL UINT32_MAX
110 
116 #define RTE_TM_NODE_LEVEL_ID_ANY UINT32_MAX
117 
126 };
127 
134 
137 
140 
143 
146 
149 
152 
155 
160 
165 };
166 
172  uint64_t n_pkts;
173 
175  uint64_t n_bytes;
176 
178  struct {
183 
188 
192  uint64_t n_pkts_queued;
193 
197  uint64_t n_bytes_queued;
198  } leaf;
199 };
200 
210 
216 
219 
222 
225 
228 
231 
234 };
235 
241  uint32_t n_nodes_max;
242 
246  uint32_t n_levels_max;
247 
252 
257 
264  uint32_t shaper_n_max;
265 
271 
280 
285 
290 
295 
300 
308 
314 
319 
324 
329 
334 
341 
351 
361 
374 
379 
387 
395 
401 
410 
417 
422 
427 
436 
439 
442 
445 
448 
453 
457  uint64_t stats_mask;
458 };
459 
465  uint32_t n_nodes_max;
466 
472 
478 
484 
490 
492  union {
494  struct {
501 
511 
518 
525 
535 
543 
556 
568 
587 
594 
602  uint64_t stats_mask;
603  } nonleaf;
604 
606  struct {
613 
622 
628  uint64_t shaper_private_rate_min;
629 
635  uint64_t shaper_private_rate_max;
636 
645  uint32_t shaper_shared_n_max;
646 
655 
664 
672 
679 
690 
698  uint64_t stats_mask;
699  } leaf;
700  };
701 };
702 
709 
714 
720 
726 
732 
734  union {
736  struct {
739 
747 
756 
770 
776  } nonleaf;
777 
779  struct {
782 
785 
788 
791 
798  } leaf;
799  };
800 
804  uint64_t stats_mask;
805 };
806 
827 };
828 
834  uint32_t min_th;
835 
837  uint32_t max_th;
838 
842  uint16_t maxp_inv;
843 
845  uint16_t wq_log2;
846 };
847 
865 
871 };
872 
878  uint64_t rate;
879 
881  uint64_t size;
882 };
883 
905 
908 
915 };
916 
950 
952  uint32_t *shared_shaper_id;
953 
956 
958  union {
960  struct {
968 
970  uint32_t n_sp_priorities;
971  } nonleaf;
972 
974  struct {
977 
981  struct {
987  uint32_t wred_profile_id;
988 
995 
1002  } wred;
1003  } leaf;
1004  };
1005 
1012  uint64_t stats_mask;
1013 };
1014 
1024  RTE_TM_ERROR_TYPE_CAPABILITIES,
1025  RTE_TM_ERROR_TYPE_LEVEL_ID,
1026  RTE_TM_ERROR_TYPE_WRED_PROFILE,
1027  RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN,
1028  RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW,
1029  RTE_TM_ERROR_TYPE_WRED_PROFILE_RED,
1030  RTE_TM_ERROR_TYPE_WRED_PROFILE_ID,
1031  RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID,
1032  RTE_TM_ERROR_TYPE_SHAPER_PROFILE,
1033  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE,
1034  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE,
1035  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
1036  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
1037  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN,
1038  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,
1039  RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID,
1040  RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,
1041  RTE_TM_ERROR_TYPE_NODE_PRIORITY,
1042  RTE_TM_ERROR_TYPE_NODE_WEIGHT,
1043  RTE_TM_ERROR_TYPE_NODE_PARAMS,
1044  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,
1045  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID,
1046  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,
1047  RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE,
1048  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,
1049  RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN,
1050  RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID,
1051  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID,
1052  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS,
1053  RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,
1054  RTE_TM_ERROR_TYPE_NODE_ID,
1055 };
1056 
1070  const void *cause;
1071  const char *message;
1072 };
1073 
1091 int
1092 rte_tm_get_number_of_leaf_nodes(uint16_t port_id,
1093  uint32_t *n_leaf_nodes,
1094  struct rte_tm_error *error);
1095 
1115 int
1116 rte_tm_node_type_get(uint16_t port_id,
1117  uint32_t node_id,
1118  int *is_leaf,
1119  struct rte_tm_error *error);
1120 
1133 int
1134 rte_tm_capabilities_get(uint16_t port_id,
1135  struct rte_tm_capabilities *cap,
1136  struct rte_tm_error *error);
1137 
1153 int
1154 rte_tm_level_capabilities_get(uint16_t port_id,
1155  uint32_t level_id,
1156  struct rte_tm_level_capabilities *cap,
1157  struct rte_tm_error *error);
1158 
1173 int
1174 rte_tm_node_capabilities_get(uint16_t port_id,
1175  uint32_t node_id,
1176  struct rte_tm_node_capabilities *cap,
1177  struct rte_tm_error *error);
1178 
1198 int
1199 rte_tm_wred_profile_add(uint16_t port_id,
1200  uint32_t wred_profile_id,
1201  struct rte_tm_wred_params *profile,
1202  struct rte_tm_error *error);
1203 
1221 int
1222 rte_tm_wred_profile_delete(uint16_t port_id,
1223  uint32_t wred_profile_id,
1224  struct rte_tm_error *error);
1225 
1252 int
1253 rte_tm_shared_wred_context_add_update(uint16_t port_id,
1254  uint32_t shared_wred_context_id,
1255  uint32_t wred_profile_id,
1256  struct rte_tm_error *error);
1257 
1276 int
1277 rte_tm_shared_wred_context_delete(uint16_t port_id,
1278  uint32_t shared_wred_context_id,
1279  struct rte_tm_error *error);
1280 
1300 int
1301 rte_tm_shaper_profile_add(uint16_t port_id,
1302  uint32_t shaper_profile_id,
1303  struct rte_tm_shaper_params *profile,
1304  struct rte_tm_error *error);
1305 
1323 int
1324 rte_tm_shaper_profile_delete(uint16_t port_id,
1325  uint32_t shaper_profile_id,
1326  struct rte_tm_error *error);
1327 
1352 int
1353 rte_tm_shared_shaper_add_update(uint16_t port_id,
1354  uint32_t shared_shaper_id,
1355  uint32_t shaper_profile_id,
1356  struct rte_tm_error *error);
1357 
1375 int
1376 rte_tm_shared_shaper_delete(uint16_t port_id,
1377  uint32_t shared_shaper_id,
1378  struct rte_tm_error *error);
1379 
1443 int
1444 rte_tm_node_add(uint16_t port_id,
1445  uint32_t node_id,
1446  uint32_t parent_node_id,
1447  uint32_t priority,
1448  uint32_t weight,
1449  uint32_t level_id,
1450  struct rte_tm_node_params *params,
1451  struct rte_tm_error *error);
1452 
1476 int
1477 rte_tm_node_delete(uint16_t port_id,
1478  uint32_t node_id,
1479  struct rte_tm_error *error);
1480 
1500 int
1501 rte_tm_node_suspend(uint16_t port_id,
1502  uint32_t node_id,
1503  struct rte_tm_error *error);
1504 
1523 int
1524 rte_tm_node_resume(uint16_t port_id,
1525  uint32_t node_id,
1526  struct rte_tm_error *error);
1527 
1564 int
1565 rte_tm_hierarchy_commit(uint16_t port_id,
1566  int clear_on_fail,
1567  struct rte_tm_error *error);
1568 
1600 int
1601 rte_tm_node_parent_update(uint16_t port_id,
1602  uint32_t node_id,
1603  uint32_t parent_node_id,
1604  uint32_t priority,
1605  uint32_t weight,
1606  struct rte_tm_error *error);
1607 
1629 int
1630 rte_tm_node_shaper_update(uint16_t port_id,
1631  uint32_t node_id,
1632  uint32_t shaper_profile_id,
1633  struct rte_tm_error *error);
1634 
1656 int
1657 rte_tm_node_shared_shaper_update(uint16_t port_id,
1658  uint32_t node_id,
1659  uint32_t shared_shaper_id,
1660  int add,
1661  struct rte_tm_error *error);
1662 
1683 int
1684 rte_tm_node_stats_update(uint16_t port_id,
1685  uint32_t node_id,
1686  uint64_t stats_mask,
1687  struct rte_tm_error *error);
1688 
1711 int
1712 rte_tm_node_wfq_weight_mode_update(uint16_t port_id,
1713  uint32_t node_id,
1714  int *wfq_weight_mode,
1715  uint32_t n_sp_priorities,
1716  struct rte_tm_error *error);
1717 
1734 int
1735 rte_tm_node_cman_update(uint16_t port_id,
1736  uint32_t node_id,
1737  enum rte_tm_cman_mode cman,
1738  struct rte_tm_error *error);
1739 
1758 int
1759 rte_tm_node_wred_context_update(uint16_t port_id,
1760  uint32_t node_id,
1761  uint32_t wred_profile_id,
1762  struct rte_tm_error *error);
1763 
1783 int
1785  uint32_t node_id,
1786  uint32_t shared_wred_context_id,
1787  int add,
1788  struct rte_tm_error *error);
1789 
1815 int
1816 rte_tm_node_stats_read(uint16_t port_id,
1817  uint32_t node_id,
1818  struct rte_tm_node_stats *stats,
1819  uint64_t *stats_mask,
1820  int clear,
1821  struct rte_tm_error *error);
1822 
1852 int
1853 rte_tm_mark_vlan_dei(uint16_t port_id,
1854  int mark_green,
1855  int mark_yellow,
1856  int mark_red,
1857  struct rte_tm_error *error);
1858 
1902 int
1903 rte_tm_mark_ip_ecn(uint16_t port_id,
1904  int mark_green,
1905  int mark_yellow,
1906  int mark_red,
1907  struct rte_tm_error *error);
1908 
1950 int
1951 rte_tm_mark_ip_dscp(uint16_t port_id,
1952  int mark_green,
1953  int mark_yellow,
1954  int mark_red,
1955  struct rte_tm_error *error);
1956 
1957 #ifdef __cplusplus
1958 }
1959 #endif
1960 
1961 #endif /* __INCLUDE_RTE_TM_H__ */