DPDK  19.11.14
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 
400  int mark_vlan_dei_supported[RTE_COLORS];
401 
403  int mark_ip_ecn_tcp_supported[RTE_COLORS];
404 
406  int mark_ip_ecn_sctp_supported[RTE_COLORS];
407 
409  int mark_ip_dscp_supported[RTE_COLORS];
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 {
574  int shaper_private_supported;
575 
583  int shaper_private_dual_rate_supported;
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 
826  struct rte_tm_red_params red_params[RTE_COLORS];
827 
833 };
834 
840  uint64_t rate;
841 
843  uint64_t size;
844 };
845 
866  struct rte_tm_token_bucket committed;
867 
869  struct rte_tm_token_bucket peak;
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 {
938  enum rte_tm_cman_mode cman;
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 
1031  enum rte_tm_error_type type;
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__ */
uint64_t size
Definition: rte_tm.h:843
int rte_tm_mark_vlan_dei(uint16_t port_id, int mark_green, int mark_yellow, int mark_red, struct rte_tm_error *error)
int cman_wred_packet_mode_supported
Definition: rte_tm.h:616
int * wfq_weight_mode
Definition: rte_tm.h:929
int rte_tm_capabilities_get(uint16_t port_id, struct rte_tm_capabilities *cap, struct rte_tm_error *error)
int rte_tm_node_resume(uint16_t port_id, uint32_t node_id, struct rte_tm_error *error)
int cman_wred_packet_mode_supported
Definition: rte_tm.h:348
uint64_t rate
Definition: rte_tm.h:840
uint64_t shaper_private_rate_min
Definition: rte_tm.h:681
int rte_tm_node_stats_update(uint16_t port_id, uint32_t node_id, uint64_t stats_mask, struct rte_tm_error *error)
uint64_t n_pkts
Definition: rte_tm.h:134
int rte_tm_node_delete(uint16_t port_id, uint32_t node_id, struct rte_tm_error *error)
int shaper_private_dual_rate_supported
Definition: rte_tm.h:675
uint32_t n_shared_shapers
Definition: rte_tm.h:917
uint64_t shaper_private_rate_max
Definition: rte_tm.h:486
int rte_tm_node_shaper_update(uint16_t port_id, uint32_t node_id, uint32_t shaper_profile_id, struct rte_tm_error *error)
int rte_tm_shared_shaper_delete(uint16_t port_id, uint32_t shared_shaper_id, struct rte_tm_error *error)
const void * cause
Definition: rte_tm.h:1032
int shaper_pkt_length_adjust_min
Definition: rte_tm.h:290
int rte_tm_mark_ip_dscp(uint16_t port_id, int mark_green, int mark_yellow, int mark_red, struct rte_tm_error *error)
uint32_t sched_wfq_n_groups_max
Definition: rte_tm.h:731
int cman_wred_context_private_supported
Definition: rte_tm.h:752
uint32_t wred_profile_id
Definition: rte_tm.h:949
uint64_t shaper_private_rate_min
Definition: rte_tm.h:246
uint32_t sched_wfq_weight_max
Definition: rte_tm.h:737
int32_t pkt_length_adjust
Definition: rte_tm.h:876
uint32_t cman_wred_context_private_n_max
Definition: rte_tm.h:378
uint32_t shaper_shared_n_shapers_per_node_max
Definition: rte_tm.h:269
int leaf_nodes_identical
Definition: rte_tm.h:218
int rte_tm_shared_shaper_add_update(uint16_t port_id, uint32_t shared_shaper_id, uint32_t shaper_profile_id, struct rte_tm_error *error)
int rte_tm_wred_profile_add(uint16_t port_id, uint32_t wred_profile_id, struct rte_tm_wred_params *profile, struct rte_tm_error *error)
uint32_t * shared_wred_context_id
Definition: rte_tm.h:956
int rte_tm_node_suspend(uint16_t port_id, uint32_t node_id, struct rte_tm_error *error)
uint32_t sched_wfq_n_children_per_group_max
Definition: rte_tm.h:322
int rte_tm_mark_ip_ecn(uint16_t port_id, int mark_green, int mark_yellow, int mark_red, struct rte_tm_error *error)
uint32_t sched_sp_n_priorities_max
Definition: rte_tm.h:517
uint32_t sched_wfq_weight_max
Definition: rte_tm.h:555
uint64_t n_bytes
Definition: rte_tm.h:137
struct rte_tm_node_stats::@154 leaf
uint32_t shaper_shared_dual_rate_n_max
Definition: rte_tm.h:275
uint32_t shaper_n_max
Definition: rte_tm.h:226
uint64_t n_pkts_queued
Definition: rte_tm.h:154
int cman_wred_context_private_supported
Definition: rte_tm.h:640
uint32_t cman_wred_context_n_max
Definition: rte_tm.h:371
uint32_t sched_wfq_n_groups_max
Definition: rte_tm.h:335
int cman_wred_byte_mode_supported
Definition: rte_tm.h:746
rte_tm_dynamic_update_type
Definition: rte_tm.h:166
uint32_t n_nodes_nonleaf_max
Definition: rte_tm.h:433
uint32_t n_levels_max
Definition: rte_tm.h:208
uint32_t shaper_shared_n_max
Definition: rte_tm.h:693
int rte_tm_node_cman_update(uint16_t port_id, uint32_t node_id, enum rte_tm_cman_mode cman, struct rte_tm_error *error)
uint64_t min_th
Definition: rte_tm.h:796
uint64_t dynamic_update_mask
Definition: rte_tm.h:414
uint32_t n_sp_priorities
Definition: rte_tm.h:932
int cman_head_drop_supported
Definition: rte_tm.h:362
uint64_t shaper_private_rate_max
Definition: rte_tm.h:687
uint64_t max_th
Definition: rte_tm.h:799
int rte_tm_hierarchy_commit(uint16_t port_id, int clear_on_fail, struct rte_tm_error *error)
uint64_t stats_mask
Definition: rte_tm.h:974
uint64_t n_pkts_dropped[RTE_COLORS]
Definition: rte_tm.h:144
uint64_t n_bytes_queued
Definition: rte_tm.h:159
const char * message
Definition: rte_tm.h:1033
uint64_t shaper_shared_rate_max
Definition: rte_tm.h:285
uint32_t sched_wfq_n_children_per_group_max
Definition: rte_tm.h:529
uint32_t n_nodes_leaf_max
Definition: rte_tm.h:439
uint32_t shaper_profile_id
Definition: rte_tm.h:911
int rte_tm_node_parent_update(uint16_t port_id, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, struct rte_tm_error *error)
int rte_tm_shared_wred_context_delete(uint16_t port_id, uint32_t shared_wred_context_id, struct rte_tm_error *error)
uint32_t cman_wred_context_shared_n_max
Definition: rte_tm.h:651
int rte_tm_shaper_profile_add(uint16_t port_id, uint32_t shaper_profile_id, struct rte_tm_shaper_params *profile, struct rte_tm_error *error)
int shaper_pkt_length_adjust_max
Definition: rte_tm.h:295
int shaper_private_dual_rate_supported
Definition: rte_tm.h:472
int rte_tm_node_add(uint16_t port_id, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params, struct rte_tm_error *error)
uint32_t n_nodes_max
Definition: rte_tm.h:203
uint32_t shaper_shared_n_max
Definition: rte_tm.h:496
uint32_t cman_wred_context_shared_n_nodes_per_context_max
Definition: rte_tm.h:388
uint32_t cman_wred_context_shared_n_max
Definition: rte_tm.h:383
int rte_tm_node_wred_context_update(uint16_t port_id, uint32_t node_id, uint32_t wred_profile_id, struct rte_tm_error *error)
uint64_t stats_mask
Definition: rte_tm.h:419
uint32_t shaper_shared_n_nodes_per_shaper_max
Definition: rte_tm.h:261
int rte_tm_node_shared_shaper_update(uint16_t port_id, uint32_t node_id, uint32_t shared_shaper_id, int add, struct rte_tm_error *error)
#define RTE_STD_C11
Definition: rte_common.h:40
int shaper_private_dual_rate_n_max
Definition: rte_tm.h:241
int rte_tm_get_number_of_leaf_nodes(uint16_t port_id, uint32_t *n_leaf_nodes, struct rte_tm_error *error)
uint64_t shaper_private_rate_min
Definition: rte_tm.h:479
uint32_t cman_wred_context_shared_n_contexts_per_node_max
Definition: rte_tm.h:397
int cman_wred_packet_mode_supported
Definition: rte_tm.h:743
uint16_t wq_log2
Definition: rte_tm.h:807
int rte_tm_node_capabilities_get(uint16_t port_id, uint32_t node_id, struct rte_tm_node_capabilities *cap, struct rte_tm_error *error)
uint32_t * shared_shaper_id
Definition: rte_tm.h:914
int rte_tm_node_wfq_weight_mode_update(uint16_t port_id, uint32_t node_id, int *wfq_weight_mode, uint32_t n_sp_priorities, struct rte_tm_error *error)
int rte_tm_node_stats_read(uint16_t port_id, uint32_t node_id, struct rte_tm_node_stats *stats, uint64_t *stats_mask, int clear, struct rte_tm_error *error)
uint32_t sched_wfq_weight_max
Definition: rte_tm.h:340
uint16_t maxp_inv
Definition: rte_tm.h:804
uint32_t sched_n_children_max
Definition: rte_tm.h:700
uint32_t cman_wred_context_shared_n_max
Definition: rte_tm.h:759
uint64_t shaper_private_rate_max
Definition: rte_tm.h:251
int cman_wred_byte_mode_supported
Definition: rte_tm.h:356
int non_leaf_nodes_identical
Definition: rte_tm.h:213
int rte_tm_shared_wred_context_add_update(uint16_t port_id, uint32_t shared_wred_context_id, uint32_t wred_profile_id, struct rte_tm_error *error)
uint32_t sched_n_children_max
Definition: rte_tm.h:302
uint32_t sched_n_children_max
Definition: rte_tm.h:504
rte_tm_error_type
Definition: rte_tm.h:983
uint32_t shaper_shared_n_max
Definition: rte_tm.h:256
uint32_t sched_sp_n_priorities_max
Definition: rte_tm.h:708
uint64_t n_bytes_dropped[RTE_COLORS]
Definition: rte_tm.h:149
uint32_t shaper_private_n_max
Definition: rte_tm.h:232
int rte_tm_node_type_get(uint16_t port_id, uint32_t node_id, int *is_leaf, struct rte_tm_error *error)
rte_tm_cman_mode
Definition: rte_tm.h:785
uint32_t sched_wfq_n_groups_max
Definition: rte_tm.h:548
uint64_t shaper_shared_rate_min
Definition: rte_tm.h:280
int rte_tm_shaper_profile_delete(uint16_t port_id, uint32_t shaper_profile_id, struct rte_tm_error *error)
uint32_t n_shared_wred_contexts
Definition: rte_tm.h:963
uint32_t sched_wfq_n_children_per_group_max
Definition: rte_tm.h:717
int rte_tm_level_capabilities_get(uint16_t port_id, uint32_t level_id, struct rte_tm_level_capabilities *cap, struct rte_tm_error *error)
int rte_tm_node_shared_wred_context_update(uint16_t port_id, uint32_t node_id, uint32_t shared_wred_context_id, int add, struct rte_tm_error *error)
uint32_t sched_sp_n_priorities_max
Definition: rte_tm.h:312
int rte_tm_wred_profile_delete(uint16_t port_id, uint32_t wred_profile_id, struct rte_tm_error *error)
rte_tm_stats_type
Definition: rte_tm.h:93