DPDK  18.02.2
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 
385 
394 
401 
406 
411 
420 
423 
426 
429 
432 
437 
441  uint64_t stats_mask;
442 };
443 
449  uint32_t n_nodes_max;
450 
456 
462 
468 
474 
476  union {
478  struct {
485 
495 
502 
509 
519 
527 
540 
552 
571 
578 
586  uint64_t stats_mask;
587  } nonleaf;
588 
590  struct {
597 
606 
612  uint64_t shaper_private_rate_min;
613 
619  uint64_t shaper_private_rate_max;
620 
629  uint32_t shaper_shared_n_max;
630 
638 
645 
656 
664  uint64_t stats_mask;
665  } leaf;
666  };
667 };
668 
675 
680 
686 
692 
698 
700  union {
702  struct {
705 
713 
722 
736 
742  } nonleaf;
743 
745  struct {
748 
751 
758  } leaf;
759  };
760 
764  uint64_t stats_mask;
765 };
766 
787 };
788 
794  uint16_t min_th;
795 
797  uint16_t max_th;
798 
802  uint16_t maxp_inv;
803 
805  uint16_t wq_log2;
806 };
807 
822 };
823 
829  uint64_t rate;
830 
832  uint64_t size;
833 };
834 
856 
859 
866 };
867 
901 
903  uint32_t *shared_shaper_id;
904 
907 
909  union {
911  struct {
919 
921  uint32_t n_sp_priorities;
922  } nonleaf;
923 
925  struct {
928 
932  struct {
938  uint32_t wred_profile_id;
939 
946 
953  } wred;
954  } leaf;
955  };
956 
963  uint64_t stats_mask;
964 };
965 
975  RTE_TM_ERROR_TYPE_CAPABILITIES,
976  RTE_TM_ERROR_TYPE_LEVEL_ID,
977  RTE_TM_ERROR_TYPE_WRED_PROFILE,
978  RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN,
979  RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW,
980  RTE_TM_ERROR_TYPE_WRED_PROFILE_RED,
981  RTE_TM_ERROR_TYPE_WRED_PROFILE_ID,
982  RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID,
983  RTE_TM_ERROR_TYPE_SHAPER_PROFILE,
984  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE,
985  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE,
986  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
987  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
988  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN,
989  RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,
990  RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID,
991  RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,
992  RTE_TM_ERROR_TYPE_NODE_PRIORITY,
993  RTE_TM_ERROR_TYPE_NODE_WEIGHT,
994  RTE_TM_ERROR_TYPE_NODE_PARAMS,
995  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,
996  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID,
997  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,
998  RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE,
999  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,
1000  RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN,
1001  RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID,
1002  RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID,
1003  RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS,
1004  RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,
1005  RTE_TM_ERROR_TYPE_NODE_ID,
1006 };
1007 
1021  const void *cause;
1022  const char *message;
1023 };
1024 
1042 int
1043 rte_tm_get_number_of_leaf_nodes(uint16_t port_id,
1044  uint32_t *n_leaf_nodes,
1045  struct rte_tm_error *error);
1046 
1066 int
1067 rte_tm_node_type_get(uint16_t port_id,
1068  uint32_t node_id,
1069  int *is_leaf,
1070  struct rte_tm_error *error);
1071 
1084 int
1085 rte_tm_capabilities_get(uint16_t port_id,
1086  struct rte_tm_capabilities *cap,
1087  struct rte_tm_error *error);
1088 
1104 int
1105 rte_tm_level_capabilities_get(uint16_t port_id,
1106  uint32_t level_id,
1107  struct rte_tm_level_capabilities *cap,
1108  struct rte_tm_error *error);
1109 
1124 int
1125 rte_tm_node_capabilities_get(uint16_t port_id,
1126  uint32_t node_id,
1127  struct rte_tm_node_capabilities *cap,
1128  struct rte_tm_error *error);
1129 
1149 int
1150 rte_tm_wred_profile_add(uint16_t port_id,
1151  uint32_t wred_profile_id,
1152  struct rte_tm_wred_params *profile,
1153  struct rte_tm_error *error);
1154 
1172 int
1173 rte_tm_wred_profile_delete(uint16_t port_id,
1174  uint32_t wred_profile_id,
1175  struct rte_tm_error *error);
1176 
1203 int
1204 rte_tm_shared_wred_context_add_update(uint16_t port_id,
1205  uint32_t shared_wred_context_id,
1206  uint32_t wred_profile_id,
1207  struct rte_tm_error *error);
1208 
1227 int
1228 rte_tm_shared_wred_context_delete(uint16_t port_id,
1229  uint32_t shared_wred_context_id,
1230  struct rte_tm_error *error);
1231 
1251 int
1252 rte_tm_shaper_profile_add(uint16_t port_id,
1253  uint32_t shaper_profile_id,
1254  struct rte_tm_shaper_params *profile,
1255  struct rte_tm_error *error);
1256 
1274 int
1275 rte_tm_shaper_profile_delete(uint16_t port_id,
1276  uint32_t shaper_profile_id,
1277  struct rte_tm_error *error);
1278 
1303 int
1304 rte_tm_shared_shaper_add_update(uint16_t port_id,
1305  uint32_t shared_shaper_id,
1306  uint32_t shaper_profile_id,
1307  struct rte_tm_error *error);
1308 
1326 int
1327 rte_tm_shared_shaper_delete(uint16_t port_id,
1328  uint32_t shared_shaper_id,
1329  struct rte_tm_error *error);
1330 
1394 int
1395 rte_tm_node_add(uint16_t port_id,
1396  uint32_t node_id,
1397  uint32_t parent_node_id,
1398  uint32_t priority,
1399  uint32_t weight,
1400  uint32_t level_id,
1401  struct rte_tm_node_params *params,
1402  struct rte_tm_error *error);
1403 
1427 int
1428 rte_tm_node_delete(uint16_t port_id,
1429  uint32_t node_id,
1430  struct rte_tm_error *error);
1431 
1451 int
1452 rte_tm_node_suspend(uint16_t port_id,
1453  uint32_t node_id,
1454  struct rte_tm_error *error);
1455 
1474 int
1475 rte_tm_node_resume(uint16_t port_id,
1476  uint32_t node_id,
1477  struct rte_tm_error *error);
1478 
1515 int
1516 rte_tm_hierarchy_commit(uint16_t port_id,
1517  int clear_on_fail,
1518  struct rte_tm_error *error);
1519 
1551 int
1552 rte_tm_node_parent_update(uint16_t port_id,
1553  uint32_t node_id,
1554  uint32_t parent_node_id,
1555  uint32_t priority,
1556  uint32_t weight,
1557  struct rte_tm_error *error);
1558 
1580 int
1581 rte_tm_node_shaper_update(uint16_t port_id,
1582  uint32_t node_id,
1583  uint32_t shaper_profile_id,
1584  struct rte_tm_error *error);
1585 
1607 int
1608 rte_tm_node_shared_shaper_update(uint16_t port_id,
1609  uint32_t node_id,
1610  uint32_t shared_shaper_id,
1611  int add,
1612  struct rte_tm_error *error);
1613 
1634 int
1635 rte_tm_node_stats_update(uint16_t port_id,
1636  uint32_t node_id,
1637  uint64_t stats_mask,
1638  struct rte_tm_error *error);
1639 
1662 int
1663 rte_tm_node_wfq_weight_mode_update(uint16_t port_id,
1664  uint32_t node_id,
1665  int *wfq_weight_mode,
1666  uint32_t n_sp_priorities,
1667  struct rte_tm_error *error);
1668 
1685 int
1686 rte_tm_node_cman_update(uint16_t port_id,
1687  uint32_t node_id,
1688  enum rte_tm_cman_mode cman,
1689  struct rte_tm_error *error);
1690 
1709 int
1710 rte_tm_node_wred_context_update(uint16_t port_id,
1711  uint32_t node_id,
1712  uint32_t wred_profile_id,
1713  struct rte_tm_error *error);
1714 
1734 int
1736  uint32_t node_id,
1737  uint32_t shared_wred_context_id,
1738  int add,
1739  struct rte_tm_error *error);
1740 
1766 int
1767 rte_tm_node_stats_read(uint16_t port_id,
1768  uint32_t node_id,
1769  struct rte_tm_node_stats *stats,
1770  uint64_t *stats_mask,
1771  int clear,
1772  struct rte_tm_error *error);
1773 
1803 int
1804 rte_tm_mark_vlan_dei(uint16_t port_id,
1805  int mark_green,
1806  int mark_yellow,
1807  int mark_red,
1808  struct rte_tm_error *error);
1809 
1853 int
1854 rte_tm_mark_ip_ecn(uint16_t port_id,
1855  int mark_green,
1856  int mark_yellow,
1857  int mark_red,
1858  struct rte_tm_error *error);
1859 
1901 int
1902 rte_tm_mark_ip_dscp(uint16_t port_id,
1903  int mark_green,
1904  int mark_yellow,
1905  int mark_red,
1906  struct rte_tm_error *error);
1907 
1908 #ifdef __cplusplus
1909 }
1910 #endif
1911 
1912 #endif /* __INCLUDE_RTE_TM_H__ */