This patch implements the changes proposed in the deprecation
note[1]. Replace multiple color definitions in various places such as
rte_meter.h, rte_tm.h and rte_mtr.h with single rte_color defined
in rte_meter.h.
This is simple search and replace exercise without any implementation
change.
[1] https://mails.dpdk.org/archives/dev/2019-January/123861.html
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
28 files changed:
printf(" - mark support:\n");
printf("\t -- vlan dei: GREEN (%d) YELLOW (%d) RED (%d)\n",
printf(" - mark support:\n");
printf("\t -- vlan dei: GREEN (%d) YELLOW (%d) RED (%d)\n",
- cap.mark_vlan_dei_supported[RTE_TM_GREEN],
- cap.mark_vlan_dei_supported[RTE_TM_YELLOW],
- cap.mark_vlan_dei_supported[RTE_TM_RED]);
+ cap.mark_vlan_dei_supported[RTE_COLOR_GREEN],
+ cap.mark_vlan_dei_supported[RTE_COLOR_YELLOW],
+ cap.mark_vlan_dei_supported[RTE_COLOR_RED]);
printf("\t -- ip ecn tcp: GREEN (%d) YELLOW (%d) RED (%d)\n",
printf("\t -- ip ecn tcp: GREEN (%d) YELLOW (%d) RED (%d)\n",
- cap.mark_ip_ecn_tcp_supported[RTE_TM_GREEN],
- cap.mark_ip_ecn_tcp_supported[RTE_TM_YELLOW],
- cap.mark_ip_ecn_tcp_supported[RTE_TM_RED]);
+ cap.mark_ip_ecn_tcp_supported[RTE_COLOR_GREEN],
+ cap.mark_ip_ecn_tcp_supported[RTE_COLOR_YELLOW],
+ cap.mark_ip_ecn_tcp_supported[RTE_COLOR_RED]);
printf("\t -- ip ecn sctp: GREEN (%d) YELLOW (%d) RED (%d)\n",
printf("\t -- ip ecn sctp: GREEN (%d) YELLOW (%d) RED (%d)\n",
- cap.mark_ip_ecn_sctp_supported[RTE_TM_GREEN],
- cap.mark_ip_ecn_sctp_supported[RTE_TM_YELLOW],
- cap.mark_ip_ecn_sctp_supported[RTE_TM_RED]);
+ cap.mark_ip_ecn_sctp_supported[RTE_COLOR_GREEN],
+ cap.mark_ip_ecn_sctp_supported[RTE_COLOR_YELLOW],
+ cap.mark_ip_ecn_sctp_supported[RTE_COLOR_RED]);
printf("\t -- ip dscp: GREEN (%d) YELLOW (%d) RED (%d)\n",
printf("\t -- ip dscp: GREEN (%d) YELLOW (%d) RED (%d)\n",
- cap.mark_ip_dscp_supported[RTE_TM_GREEN],
- cap.mark_ip_dscp_supported[RTE_TM_YELLOW],
- cap.mark_ip_dscp_supported[RTE_TM_RED]);
+ cap.mark_ip_dscp_supported[RTE_COLOR_GREEN],
+ cap.mark_ip_dscp_supported[RTE_COLOR_YELLOW],
+ cap.mark_ip_dscp_supported[RTE_COLOR_RED]);
printf(" - mask stats (0x%"PRIx64")"
" dynamic update (0x%"PRIx64")\n",
printf(" - mask stats (0x%"PRIx64")"
" dynamic update (0x%"PRIx64")\n",
" pkts (%"PRIu64") bytes (%"PRIu64")\n"
"\t -- RED:"
" pkts (%"PRIu64") bytes (%"PRIu64")\n",
" pkts (%"PRIu64") bytes (%"PRIu64")\n"
"\t -- RED:"
" pkts (%"PRIu64") bytes (%"PRIu64")\n",
- stats.leaf.n_pkts_dropped[RTE_TM_GREEN],
- stats.leaf.n_bytes_dropped[RTE_TM_GREEN],
- stats.leaf.n_pkts_dropped[RTE_TM_YELLOW],
- stats.leaf.n_bytes_dropped[RTE_TM_YELLOW],
- stats.leaf.n_pkts_dropped[RTE_TM_RED],
- stats.leaf.n_bytes_dropped[RTE_TM_RED]);
+ stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN],
+ stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN],
+ stats.leaf.n_pkts_dropped[RTE_COLOR_YELLOW],
+ stats.leaf.n_bytes_dropped[RTE_COLOR_YELLOW],
+ stats.leaf.n_pkts_dropped[RTE_COLOR_RED],
+ stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
-parse_dscp_table_entries(char *str, enum rte_mtr_color **dscp_table)
+parse_dscp_table_entries(char *str, enum rte_color **dscp_table)
{
char *token;
int i = 0;
{
char *token;
int i = 0;
return 0;
/* Allocate memory for dscp table */
return 0;
/* Allocate memory for dscp table */
- *dscp_table = (enum rte_mtr_color *)malloc(MAX_DSCP_TABLE_ENTRIES *
- sizeof(enum rte_mtr_color));
+ *dscp_table = (enum rte_color *)malloc(MAX_DSCP_TABLE_ENTRIES *
+ sizeof(enum rte_color));
if (*dscp_table == NULL)
return -1;
while (1) {
if (strcmp(token, "G") == 0 ||
strcmp(token, "g") == 0)
if (*dscp_table == NULL)
return -1;
while (1) {
if (strcmp(token, "G") == 0 ||
strcmp(token, "g") == 0)
- *dscp_table[i++] = RTE_MTR_GREEN;
+ *dscp_table[i++] = RTE_COLOR_GREEN;
else if (strcmp(token, "Y") == 0 ||
strcmp(token, "y") == 0)
else if (strcmp(token, "Y") == 0 ||
strcmp(token, "y") == 0)
- *dscp_table[i++] = RTE_MTR_YELLOW;
+ *dscp_table[i++] = RTE_COLOR_YELLOW;
else if (strcmp(token, "R") == 0 ||
strcmp(token, "r") == 0)
else if (strcmp(token, "R") == 0 ||
strcmp(token, "r") == 0)
- *dscp_table[i++] = RTE_MTR_RED;
+ *dscp_table[i++] = RTE_COLOR_RED;
else {
free(*dscp_table);
return -1;
else {
free(*dscp_table);
return -1;
static int
parse_meter_color_str(char *c_str, uint32_t *use_prev_meter_color,
static int
parse_meter_color_str(char *c_str, uint32_t *use_prev_meter_color,
- enum rte_mtr_color **dscp_table)
+ enum rte_color **dscp_table)
{
char *token;
uint64_t previous_mtr_color = 0;
{
char *token;
uint64_t previous_mtr_color = 0;
return -1;
if (g_color == 0 && (action_mask & 0x1)) {
return -1;
if (g_color == 0 && (action_mask & 0x1)) {
- actions[RTE_MTR_GREEN] = action;
+ actions[RTE_COLOR_GREEN] = action;
g_color = 1;
} else if (y_color == 0 && (action_mask & 0x2)) {
g_color = 1;
} else if (y_color == 0 && (action_mask & 0x2)) {
- actions[RTE_MTR_YELLOW] = action;
+ actions[RTE_COLOR_YELLOW] = action;
- actions[RTE_MTR_RED] = action;
+ actions[RTE_COLOR_RED] = action;
}
return 0;
}
static int
parse_multi_token_string(char *t_str, uint16_t *port_id,
}
return 0;
}
static int
parse_multi_token_string(char *t_str, uint16_t *port_id,
- uint32_t *mtr_id, enum rte_mtr_color **dscp_table)
+ uint32_t *mtr_id, enum rte_color **dscp_table)
{
char *token;
uint64_t val;
{
char *token;
uint64_t val;
uint32_t shared = res->shared;
uint32_t use_prev_meter_color = 0;
uint16_t port_id = res->port_id;
uint32_t shared = res->shared;
uint32_t use_prev_meter_color = 0;
uint16_t port_id = res->port_id;
- enum rte_mtr_color *dscp_table = NULL;
+ enum rte_color *dscp_table = NULL;
char *c_str = res->meter_input_color;
int ret;
char *c_str = res->meter_input_color;
int ret;
else
params.meter_enable = 0;
else
params.meter_enable = 0;
- params.action[RTE_MTR_GREEN] =
+ params.action[RTE_COLOR_GREEN] =
string_to_policer_action(res->g_action);
string_to_policer_action(res->g_action);
- params.action[RTE_MTR_YELLOW] =
+ params.action[RTE_COLOR_YELLOW] =
string_to_policer_action(res->y_action);
string_to_policer_action(res->y_action);
- params.action[RTE_MTR_RED] =
+ params.action[RTE_COLOR_RED] =
string_to_policer_action(res->r_action);
params.stats_mask = res->statistics_mask;
string_to_policer_action(res->r_action);
params.stats_mask = res->statistics_mask;
{
struct cmd_set_port_meter_dscp_table_result *res = parsed_result;
struct rte_mtr_error error;
{
struct cmd_set_port_meter_dscp_table_result *res = parsed_result;
struct rte_mtr_error error;
- enum rte_mtr_color *dscp_table = NULL;
+ enum rte_color *dscp_table = NULL;
char *t_str = res->token_string;
uint32_t mtr_id = 0;
uint16_t port_id;
char *t_str = res->token_string;
uint32_t mtr_id = 0;
uint16_t port_id;
}
/* Allocate memory for policer actions */
}
/* Allocate memory for policer actions */
- actions = (enum rte_mtr_policer_action *)malloc(RTE_MTR_COLORS *
+ actions = (enum rte_mtr_policer_action *)malloc(RTE_COLORS *
sizeof(enum rte_mtr_policer_action));
if (actions == NULL) {
printf("Memory for policer actions not allocated (error)\n");
sizeof(enum rte_mtr_policer_action));
if (actions == NULL) {
printf("Memory for policer actions not allocated (error)\n");
/* Display stats */
if (stats_mask & RTE_MTR_STATS_N_PKTS_GREEN)
printf("\tPkts G: %" PRIu64 "\n",
/* Display stats */
if (stats_mask & RTE_MTR_STATS_N_PKTS_GREEN)
printf("\tPkts G: %" PRIu64 "\n",
- stats.n_pkts[RTE_MTR_GREEN]);
+ stats.n_pkts[RTE_COLOR_GREEN]);
if (stats_mask & RTE_MTR_STATS_N_BYTES_GREEN)
printf("\tBytes G: %" PRIu64 "\n",
if (stats_mask & RTE_MTR_STATS_N_BYTES_GREEN)
printf("\tBytes G: %" PRIu64 "\n",
- stats.n_bytes[RTE_MTR_GREEN]);
+ stats.n_bytes[RTE_COLOR_GREEN]);
if (stats_mask & RTE_MTR_STATS_N_PKTS_YELLOW)
printf("\tPkts Y: %" PRIu64 "\n",
if (stats_mask & RTE_MTR_STATS_N_PKTS_YELLOW)
printf("\tPkts Y: %" PRIu64 "\n",
- stats.n_pkts[RTE_MTR_YELLOW]);
+ stats.n_pkts[RTE_COLOR_YELLOW]);
if (stats_mask & RTE_MTR_STATS_N_BYTES_YELLOW)
printf("\tBytes Y: %" PRIu64 "\n",
if (stats_mask & RTE_MTR_STATS_N_BYTES_YELLOW)
printf("\tBytes Y: %" PRIu64 "\n",
- stats.n_bytes[RTE_MTR_YELLOW]);
+ stats.n_bytes[RTE_COLOR_YELLOW]);
if (stats_mask & RTE_MTR_STATS_N_PKTS_RED)
printf("\tPkts R: %" PRIu64 "\n",
if (stats_mask & RTE_MTR_STATS_N_PKTS_RED)
printf("\tPkts R: %" PRIu64 "\n",
- stats.n_pkts[RTE_MTR_RED]);
+ stats.n_pkts[RTE_COLOR_RED]);
if (stats_mask & RTE_MTR_STATS_N_BYTES_RED)
printf("\tBytes R: %" PRIu64 "\n",
if (stats_mask & RTE_MTR_STATS_N_BYTES_RED)
printf("\tBytes R: %" PRIu64 "\n",
- stats.n_bytes[RTE_MTR_RED]);
+ stats.n_bytes[RTE_COLOR_RED]);
if (stats_mask & RTE_MTR_STATS_N_PKTS_DROPPED)
printf("\tPkts DROPPED: %" PRIu64 "\n",
stats.n_pkts_dropped);
if (stats_mask & RTE_MTR_STATS_N_PKTS_DROPPED)
printf("\tPkts DROPPED: %" PRIu64 "\n",
stats.n_pkts_dropped);
printf("cap.cman_wred_context_shared_n_contexts_per_node_max %" PRIu32
"\n", cap.cman_wred_context_shared_n_contexts_per_node_max);
printf("cap.cman_wred_context_shared_n_contexts_per_node_max %" PRIu32
"\n", cap.cman_wred_context_shared_n_contexts_per_node_max);
- for (i = 0; i < RTE_TM_COLORS; i++) {
+ for (i = 0; i < RTE_COLORS; i++) {
printf("cap.mark_vlan_dei_supported %" PRId32 "\n",
cap.mark_vlan_dei_supported[i]);
printf("cap.mark_ip_ecn_tcp_supported %" PRId32 "\n",
printf("cap.mark_vlan_dei_supported %" PRId32 "\n",
cap.mark_vlan_dei_supported[i]);
printf("cap.mark_ip_ecn_tcp_supported %" PRId32 "\n",
stats.n_bytes);
if (stats_mask & RTE_TM_STATS_N_PKTS_GREEN_DROPPED)
printf("\tPkts dropped (green): %" PRIu64 "\n",
stats.n_bytes);
if (stats_mask & RTE_TM_STATS_N_PKTS_GREEN_DROPPED)
printf("\tPkts dropped (green): %" PRIu64 "\n",
- stats.leaf.n_pkts_dropped[RTE_TM_GREEN]);
+ stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN]);
if (stats_mask & RTE_TM_STATS_N_PKTS_YELLOW_DROPPED)
printf("\tPkts dropped (yellow): %" PRIu64 "\n",
if (stats_mask & RTE_TM_STATS_N_PKTS_YELLOW_DROPPED)
printf("\tPkts dropped (yellow): %" PRIu64 "\n",
- stats.leaf.n_pkts_dropped[RTE_TM_YELLOW]);
+ stats.leaf.n_pkts_dropped[RTE_COLOR_YELLOW]);
if (stats_mask & RTE_TM_STATS_N_PKTS_RED_DROPPED)
printf("\tPkts dropped (red): %" PRIu64 "\n",
if (stats_mask & RTE_TM_STATS_N_PKTS_RED_DROPPED)
printf("\tPkts dropped (red): %" PRIu64 "\n",
- stats.leaf.n_pkts_dropped[RTE_TM_RED]);
+ stats.leaf.n_pkts_dropped[RTE_COLOR_RED]);
if (stats_mask & RTE_TM_STATS_N_BYTES_GREEN_DROPPED)
printf("\tBytes dropped (green): %" PRIu64 "\n",
if (stats_mask & RTE_TM_STATS_N_BYTES_GREEN_DROPPED)
printf("\tBytes dropped (green): %" PRIu64 "\n",
- stats.leaf.n_bytes_dropped[RTE_TM_GREEN]);
+ stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN]);
if (stats_mask & RTE_TM_STATS_N_BYTES_YELLOW_DROPPED)
printf("\tBytes dropped (yellow): %" PRIu64 "\n",
if (stats_mask & RTE_TM_STATS_N_BYTES_YELLOW_DROPPED)
printf("\tBytes dropped (yellow): %" PRIu64 "\n",
- stats.leaf.n_bytes_dropped[RTE_TM_YELLOW]);
+ stats.leaf.n_bytes_dropped[RTE_COLOR_YELLOW]);
if (stats_mask & RTE_TM_STATS_N_BYTES_RED_DROPPED)
printf("\tBytes dropped (red): %" PRIu64 "\n",
if (stats_mask & RTE_TM_STATS_N_BYTES_RED_DROPPED)
printf("\tBytes dropped (red): %" PRIu64 "\n",
- stats.leaf.n_bytes_dropped[RTE_TM_RED]);
+ stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
if (stats_mask & RTE_TM_STATS_N_PKTS_QUEUED)
printf("\tPkts queued: %" PRIu64 "\n",
stats.leaf.n_pkts_queued);
if (stats_mask & RTE_TM_STATS_N_PKTS_QUEUED)
printf("\tPkts queued: %" PRIu64 "\n",
stats.leaf.n_pkts_queued);
{
struct cmd_add_port_tm_node_wred_profile_result *res = parsed_result;
struct rte_tm_wred_params wp;
{
struct cmd_add_port_tm_node_wred_profile_result *res = parsed_result;
struct rte_tm_wred_params wp;
- enum rte_tm_color color;
struct rte_tm_error error;
uint32_t wred_profile_id = res->wred_profile_id;
portid_t port_id = res->port_id;
struct rte_tm_error error;
uint32_t wred_profile_id = res->wred_profile_id;
portid_t port_id = res->port_id;
memset(&error, 0, sizeof(struct rte_tm_error));
/* WRED Params (Green Color)*/
memset(&error, 0, sizeof(struct rte_tm_error));
/* WRED Params (Green Color)*/
+ color = RTE_COLOR_GREEN;
wp.red_params[color].min_th = res->min_th_g;
wp.red_params[color].max_th = res->max_th_g;
wp.red_params[color].maxp_inv = res->maxp_inv_g;
wp.red_params[color].min_th = res->min_th_g;
wp.red_params[color].max_th = res->max_th_g;
wp.red_params[color].maxp_inv = res->maxp_inv_g;
/* WRED Params (Yellow Color)*/
/* WRED Params (Yellow Color)*/
+ color = RTE_COLOR_YELLOW;
wp.red_params[color].min_th = res->min_th_y;
wp.red_params[color].max_th = res->max_th_y;
wp.red_params[color].maxp_inv = res->maxp_inv_y;
wp.red_params[color].wq_log2 = res->wq_log2_y;
/* WRED Params (Red Color)*/
wp.red_params[color].min_th = res->min_th_y;
wp.red_params[color].max_th = res->max_th_y;
wp.red_params[color].maxp_inv = res->maxp_inv_y;
wp.red_params[color].wq_log2 = res->wq_log2_y;
/* WRED Params (Red Color)*/
wp.red_params[color].min_th = res->min_th_r;
wp.red_params[color].max_th = res->max_th_r;
wp.red_params[color].maxp_inv = res->maxp_inv_r;
wp.red_params[color].min_th = res->min_th_r;
wp.red_params[color].max_th = res->max_th_r;
wp.red_params[color].maxp_inv = res->maxp_inv_r;
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
&sm, &sp, time, TM_TEST_SRTCM_CBS_DF - 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
&sm, &sp, time, TM_TEST_SRTCM_CBS_DF - 1)
melog(SRTCM_BLIND_CHECK_MSG" GREEN");
/* Test yellow */
melog(SRTCM_BLIND_CHECK_MSG" GREEN");
/* Test yellow */
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
&sm, &sp, time, TM_TEST_SRTCM_CBS_DF + 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
&sm, &sp, time, TM_TEST_SRTCM_CBS_DF + 1)
melog(SRTCM_BLIND_CHECK_MSG" YELLOW");
if (rte_meter_srtcm_profile_config(&sp, &sparams) != 0)
melog(SRTCM_BLIND_CHECK_MSG" YELLOW");
if (rte_meter_srtcm_profile_config(&sp, &sparams) != 0)
melog(SRTCM_BLIND_CHECK_MSG);
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
melog(SRTCM_BLIND_CHECK_MSG);
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
- &sm, &sp, time, (uint32_t)sp.ebs - 1) != e_RTE_METER_YELLOW)
+ &sm, &sp, time, (uint32_t)sp.ebs - 1) != RTE_COLOR_YELLOW)
melog(SRTCM_BLIND_CHECK_MSG" YELLOW");
/* Test red */
melog(SRTCM_BLIND_CHECK_MSG" YELLOW");
/* Test red */
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
&sm, &sp, time, TM_TEST_SRTCM_EBS_DF + 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_srtcm_color_blind_check(
&sm, &sp, time, TM_TEST_SRTCM_EBS_DF + 1)
melog(SRTCM_BLIND_CHECK_MSG" RED");
return 0;
melog(SRTCM_BLIND_CHECK_MSG" RED");
return 0;
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1)
melog(TRTCM_BLIND_CHECK_MSG" GREEN");
/* Test yellow */
melog(TRTCM_BLIND_CHECK_MSG" GREEN");
/* Test yellow */
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1)
melog(TRTCM_BLIND_CHECK_MSG" YELLOW");
if (rte_meter_trtcm_profile_config(&tp, &tparams) != 0)
melog(TRTCM_BLIND_CHECK_MSG" YELLOW");
if (rte_meter_trtcm_profile_config(&tp, &tparams) != 0)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_PBS_DF - 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_PBS_DF - 1)
melog(TRTCM_BLIND_CHECK_MSG" YELLOW");
/* Test red */
melog(TRTCM_BLIND_CHECK_MSG" YELLOW");
/* Test red */
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_PBS_DF + 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_PBS_DF + 1)
melog(TRTCM_BLIND_CHECK_MSG" RED");
return 0;
melog(TRTCM_BLIND_CHECK_MSG" RED");
return 0;
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1)
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" GREEN");
/* Test yellow */
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" GREEN");
/* Test yellow */
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1)
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" YELLOW");
if (rte_meter_trtcm_rfc4115_profile_config(&tp, &rfc4115params) != 0)
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" YELLOW");
if (rte_meter_trtcm_rfc4115_profile_config(&tp, &rfc4115params) != 0)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_EBS_DF - 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_EBS_DF - 1)
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" YELLOW");
/* Test red */
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" YELLOW");
/* Test red */
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_EBS_DF + 1)
time = rte_get_tsc_cycles() + hz;
if (rte_meter_trtcm_rfc4115_color_blind_check(
&tm, &tp, time, TM_TEST_TRTCM_EBS_DF + 1)
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" RED");
return 0;
melog(TRTCM_RFC4115_BLIND_CHECK_MSG" RED");
return 0;
static inline int
tm_test_srtcm_aware_check
static inline int
tm_test_srtcm_aware_check
-(enum rte_meter_color in[4], enum rte_meter_color out[4])
+(enum rte_color in[4], enum rte_color out[4])
{
#define SRTCM_AWARE_CHECK_MSG "srtcm_aware_check"
struct rte_meter_srtcm_profile sp;
{
#define SRTCM_AWARE_CHECK_MSG "srtcm_aware_check"
struct rte_meter_srtcm_profile sp;
static inline int
tm_test_srtcm_color_aware_check(void)
{
static inline int
tm_test_srtcm_color_aware_check(void)
{
- enum rte_meter_color in[4], out[4];
+ enum rte_color in[4], out[4];
/**
* test 4 points that will produce green, yellow, yellow, red flag
/**
* test 4 points that will produce green, yellow, yellow, red flag
*/
/* previouly have a green, test points should keep unchanged */
*/
/* previouly have a green, test points should keep unchanged */
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_GREEN;
- out[0] = e_RTE_METER_GREEN;
- out[1] = e_RTE_METER_YELLOW;
- out[2] = e_RTE_METER_YELLOW;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_GREEN;
+ out[0] = RTE_COLOR_GREEN;
+ out[1] = RTE_COLOR_YELLOW;
+ out[2] = RTE_COLOR_YELLOW;
+ out[3] = RTE_COLOR_RED;
if (tm_test_srtcm_aware_check(in, out) != 0)
return -1;
if (tm_test_srtcm_aware_check(in, out) != 0)
return -1;
* previously have a yellow, green & yellow = yellow
* yellow & red = red
*/
* previously have a yellow, green & yellow = yellow
* yellow & red = red
*/
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_YELLOW;
- out[0] = e_RTE_METER_YELLOW;
- out[1] = e_RTE_METER_YELLOW;
- out[2] = e_RTE_METER_YELLOW;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_YELLOW;
+ out[0] = RTE_COLOR_YELLOW;
+ out[1] = RTE_COLOR_YELLOW;
+ out[2] = RTE_COLOR_YELLOW;
+ out[3] = RTE_COLOR_RED;
if (tm_test_srtcm_aware_check(in, out) != 0)
return -1;
if (tm_test_srtcm_aware_check(in, out) != 0)
return -1;
* previously have a red, red & green = red
* red & yellow = red
*/
* previously have a red, red & green = red
* red & yellow = red
*/
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_RED;
- out[0] = e_RTE_METER_RED;
- out[1] = e_RTE_METER_RED;
- out[2] = e_RTE_METER_RED;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_RED;
+ out[0] = RTE_COLOR_RED;
+ out[1] = RTE_COLOR_RED;
+ out[2] = RTE_COLOR_RED;
+ out[3] = RTE_COLOR_RED;
if (tm_test_srtcm_aware_check(in, out) != 0)
return -1;
if (tm_test_srtcm_aware_check(in, out) != 0)
return -1;
*/
static inline int
tm_test_trtcm_aware_check
*/
static inline int
tm_test_trtcm_aware_check
-(enum rte_meter_color in[4], enum rte_meter_color out[4])
+(enum rte_color in[4], enum rte_color out[4])
{
#define TRTCM_AWARE_CHECK_MSG "trtcm_aware_check"
struct rte_meter_trtcm_profile tp;
{
#define TRTCM_AWARE_CHECK_MSG "trtcm_aware_check"
struct rte_meter_trtcm_profile tp;
static inline int
tm_test_trtcm_color_aware_check(void)
{
static inline int
tm_test_trtcm_color_aware_check(void)
{
- enum rte_meter_color in[4], out[4];
+ enum rte_color in[4], out[4];
/**
* test 4 points that will produce green, yellow, yellow, red flag
* if using blind check
*/
/* previouly have a green, test points should keep unchanged */
/**
* test 4 points that will produce green, yellow, yellow, red flag
* if using blind check
*/
/* previouly have a green, test points should keep unchanged */
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_GREEN;
- out[0] = e_RTE_METER_GREEN;
- out[1] = e_RTE_METER_YELLOW;
- out[2] = e_RTE_METER_YELLOW;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_GREEN;
+ out[0] = RTE_COLOR_GREEN;
+ out[1] = RTE_COLOR_YELLOW;
+ out[2] = RTE_COLOR_YELLOW;
+ out[3] = RTE_COLOR_RED;
if (tm_test_trtcm_aware_check(in, out) != 0)
return -1;
if (tm_test_trtcm_aware_check(in, out) != 0)
return -1;
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_YELLOW;
- out[0] = e_RTE_METER_YELLOW;
- out[1] = e_RTE_METER_YELLOW;
- out[2] = e_RTE_METER_YELLOW;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_YELLOW;
+ out[0] = RTE_COLOR_YELLOW;
+ out[1] = RTE_COLOR_YELLOW;
+ out[2] = RTE_COLOR_YELLOW;
+ out[3] = RTE_COLOR_RED;
if (tm_test_trtcm_aware_check(in, out) != 0)
return -1;
if (tm_test_trtcm_aware_check(in, out) != 0)
return -1;
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_RED;
- out[0] = e_RTE_METER_RED;
- out[1] = e_RTE_METER_RED;
- out[2] = e_RTE_METER_RED;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_RED;
+ out[0] = RTE_COLOR_RED;
+ out[1] = RTE_COLOR_RED;
+ out[2] = RTE_COLOR_RED;
+ out[3] = RTE_COLOR_RED;
if (tm_test_trtcm_aware_check(in, out) != 0)
return -1;
if (tm_test_trtcm_aware_check(in, out) != 0)
return -1;
*/
static inline int
tm_test_trtcm_rfc4115_aware_check
*/
static inline int
tm_test_trtcm_rfc4115_aware_check
-(enum rte_meter_color in[4], enum rte_meter_color out[4])
+(enum rte_color in[4], enum rte_color out[4])
{
#define TRTCM_RFC4115_AWARE_CHECK_MSG "trtcm_rfc4115_aware_check"
struct rte_meter_trtcm_rfc4115_profile tp;
{
#define TRTCM_RFC4115_AWARE_CHECK_MSG "trtcm_rfc4115_aware_check"
struct rte_meter_trtcm_rfc4115_profile tp;
static inline int
tm_test_trtcm_rfc4115_color_aware_check(void)
{
static inline int
tm_test_trtcm_rfc4115_color_aware_check(void)
{
- enum rte_meter_color in[4], out[4];
+ enum rte_color in[4], out[4];
/**
* test 4 points that will produce green, yellow, yellow, red flag
* if using blind check
*/
/* previouly have a green, test points should keep unchanged */
/**
* test 4 points that will produce green, yellow, yellow, red flag
* if using blind check
*/
/* previouly have a green, test points should keep unchanged */
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_GREEN;
- out[0] = e_RTE_METER_GREEN;
- out[1] = e_RTE_METER_YELLOW;
- out[2] = e_RTE_METER_YELLOW;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_GREEN;
+ out[0] = RTE_COLOR_GREEN;
+ out[1] = RTE_COLOR_YELLOW;
+ out[2] = RTE_COLOR_YELLOW;
+ out[3] = RTE_COLOR_RED;
if (tm_test_trtcm_rfc4115_aware_check(in, out) != 0)
return -1;
if (tm_test_trtcm_rfc4115_aware_check(in, out) != 0)
return -1;
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_YELLOW;
- out[0] = e_RTE_METER_YELLOW;
- out[1] = e_RTE_METER_YELLOW;
- out[2] = e_RTE_METER_YELLOW;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_YELLOW;
+ out[0] = RTE_COLOR_YELLOW;
+ out[1] = RTE_COLOR_YELLOW;
+ out[2] = RTE_COLOR_YELLOW;
+ out[3] = RTE_COLOR_RED;
if (tm_test_trtcm_rfc4115_aware_check(in, out) != 0)
return -1;
if (tm_test_trtcm_rfc4115_aware_check(in, out) != 0)
return -1;
- in[0] = in[1] = in[2] = in[3] = e_RTE_METER_RED;
- out[0] = e_RTE_METER_RED;
- out[1] = e_RTE_METER_RED;
- out[2] = e_RTE_METER_RED;
- out[3] = e_RTE_METER_RED;
+ in[0] = in[1] = in[2] = in[3] = RTE_COLOR_RED;
+ out[0] = RTE_COLOR_RED;
+ out[1] = RTE_COLOR_RED;
+ out[2] = RTE_COLOR_RED;
+ out[3] = RTE_COLOR_RED;
if (tm_test_trtcm_rfc4115_aware_check(in, out) != 0)
return -1;
if (tm_test_trtcm_rfc4115_aware_check(in, out) != 0)
return -1;
rte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE,
rte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE,
/* 64 byte packet */
mbuf->pkt_len = 60;
/* 64 byte packet */
mbuf->pkt_len = 60;
TEST_ASSERT_EQUAL(err, 10, "Wrong dequeue, err=%d\n", err);
for (i = 0; i < 10; i++) {
TEST_ASSERT_EQUAL(err, 10, "Wrong dequeue, err=%d\n", err);
for (i = 0; i < 10; i++) {
- enum rte_meter_color color;
uint32_t subport, traffic_class, queue;
color = rte_sched_port_pkt_read_color(out_mbufs[i]);
uint32_t subport, traffic_class, queue;
color = rte_sched_port_pkt_read_color(out_mbufs[i]);
- TEST_ASSERT_EQUAL(color, e_RTE_METER_YELLOW, "Wrong color\n");
+ TEST_ASSERT_EQUAL(color, RTE_COLOR_YELLOW, "Wrong color\n");
rte_sched_port_pkt_read_tree_path(port, out_mbufs[i],
&subport, &pipe, &traffic_class, &queue);
rte_sched_port_pkt_read_tree_path(port, out_mbufs[i],
&subport, &pipe, &traffic_class, &queue);
kernel modules in DPDK. As a result users won't be able to use ``ethtool``
via ``igb`` & ``ixgbe`` anymore.
kernel modules in DPDK. As a result users won't be able to use ``ethtool``
via ``igb`` & ``ixgbe`` anymore.
-* meter: New ``rte_color`` definition will be added in 19.02 and that will
- replace ``enum rte_meter_color`` in meter library in 19.05. This will help
- to consolidate color definition, which is currently replicated in many places,
- such as: rte_meter.h, rte_mtr.h, rte_tm.h.
-
* cryptodev: New member in ``rte_cryptodev_config`` to allow applications to
disable features supported by the crypto device. Only the following features
would be allowed to be disabled this way,
* cryptodev: New member in ``rte_cryptodev_config`` to allow applications to
disable features supported by the crypto device. Only the following features
would be allowed to be disabled this way,
``rte_service_attr_get()`` has been changed
from ``uint32_t *`` to ``uint64_t *``.
``rte_service_attr_get()`` has been changed
from ``uint32_t *`` to ``uint64_t *``.
+* meter: replace ``enum rte_meter_color`` in meter library with new
+ ``rte_color`` definition added in 19.02. To consolidate mulitple color
+ definitions replicated at many places such as: rte_mtr.h, rte_tm.h,
+ replacements with rte_color values are done.
+
* vfio: Functions ``rte_vfio_container_dma_map`` and
``rte_vfio_container_dma_unmap`` have been extended with an option to
request mapping or un-mapping to the default vfio container fd.
* vfio: Functions ``rte_vfio_container_dma_map`` and
``rte_vfio_container_dma_unmap`` have been extended with an option to
request mapping or un-mapping to the default vfio container fd.
librte_mbuf.so.5
librte_member.so.1
librte_mempool.so.5
librte_mbuf.so.5
librte_member.so.1
librte_mempool.so.5
librte_metrics.so.1
librte_net.so.1
librte_pci.so.1
librte_metrics.so.1
librte_net.so.1
librte_pci.so.1
softnic_parser_read_uint32(&mtr->meter_profile_id, tokens[1]) ||
strcmp(tokens[2], "policer") ||
strcmp(tokens[3], "g") ||
softnic_parser_read_uint32(&mtr->meter_profile_id, tokens[1]) ||
strcmp(tokens[2], "policer") ||
strcmp(tokens[3], "g") ||
- parse_policer_action(tokens[4], &mtr->policer[e_RTE_METER_GREEN]) ||
+ parse_policer_action(tokens[4], &mtr->policer[RTE_COLOR_GREEN]) ||
strcmp(tokens[5], "y") ||
strcmp(tokens[5], "y") ||
- parse_policer_action(tokens[6], &mtr->policer[e_RTE_METER_YELLOW]) ||
+ parse_policer_action(tokens[6], &mtr->policer[RTE_COLOR_YELLOW]) ||
strcmp(tokens[7], "r") ||
strcmp(tokens[7], "r") ||
- parse_policer_action(tokens[8], &mtr->policer[e_RTE_METER_RED]))
+ parse_policer_action(tokens[8], &mtr->policer[RTE_COLOR_RED]))
for (dscp = 0, l = 1; ; l++) {
char line[64];
char *tokens[3];
for (dscp = 0, l = 1; ; l++) {
char line[64];
char *tokens[3];
- enum rte_meter_color color;
uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);
if (fgets(line, sizeof(line), f) == NULL)
uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);
if (fgets(line, sizeof(line), f) == NULL)
switch (tokens[2][0]) {
case 'g':
case 'G':
switch (tokens[2][0]) {
case 'g':
case 'G':
- color = e_RTE_METER_GREEN;
+ color = RTE_COLOR_GREEN;
break;
case 'y':
case 'Y':
break;
case 'y':
case 'Y':
- color = e_RTE_METER_YELLOW;
+ color = RTE_COLOR_YELLOW;
break;
case 'r':
case 'R':
break;
case 'r':
case 'R':
- color = e_RTE_METER_RED;
/* RTE_TABLE_ACTION_METER */
rule_action->mtr.mtr[0].meter_profile_id = meter_profile_id;
/* RTE_TABLE_ACTION_METER */
rule_action->mtr.mtr[0].meter_profile_id = meter_profile_id;
- rule_action->mtr.mtr[0].policer[e_RTE_METER_GREEN] =
- softnic_table_action_policer(m->params.action[RTE_MTR_GREEN]);
- rule_action->mtr.mtr[0].policer[e_RTE_METER_YELLOW] =
- softnic_table_action_policer(m->params.action[RTE_MTR_YELLOW]);
- rule_action->mtr.mtr[0].policer[e_RTE_METER_RED] =
- softnic_table_action_policer(m->params.action[RTE_MTR_RED]);
+ rule_action->mtr.mtr[0].policer[RTE_COLOR_GREEN] =
+ softnic_table_action_policer(m->params.action[RTE_COLOR_GREEN]);
+ rule_action->mtr.mtr[0].policer[RTE_COLOR_YELLOW] =
+ softnic_table_action_policer(m->params.action[RTE_COLOR_YELLOW]);
+ rule_action->mtr.mtr[0].policer[RTE_COLOR_RED] =
+ softnic_table_action_policer(m->params.action[RTE_COLOR_RED]);
rule_action->mtr.tc_mask = 1;
rule_action->action_mask |= 1 << RTE_TABLE_ACTION_MTR;
break;
rule_action->mtr.tc_mask = 1;
rule_action->action_mask |= 1 << RTE_TABLE_ACTION_MTR;
break;
static int
pmd_mtr_meter_dscp_table_update(struct rte_eth_dev *dev,
uint32_t mtr_id,
static int
pmd_mtr_meter_dscp_table_update(struct rte_eth_dev *dev,
uint32_t mtr_id,
- enum rte_mtr_color *dscp_table,
+ enum rte_color *dscp_table,
struct rte_mtr_error *error)
{
struct pmd_internals *p = dev->data->dev_private;
struct rte_mtr_error *error)
{
struct pmd_internals *p = dev->data->dev_private;
memcpy(&dt, &table->dscp_table, sizeof(dt));
for (i = 0; i < RTE_DIM(dt.entry); i++)
memcpy(&dt, &table->dscp_table, sizeof(dt));
for (i = 0; i < RTE_DIM(dt.entry); i++)
- dt.entry[i].color = (enum rte_meter_color)dscp_table[i];
+ dt.entry[i].color = (enum rte_color)dscp_table[i];
/* Update table */
status = softnic_pipeline_table_dscp_table_update(p,
/* Update table */
status = softnic_pipeline_table_dscp_table_update(p,
NULL,
"Invalid actions");
NULL,
"Invalid actions");
- for (i = 0; i < RTE_MTR_COLORS; i++) {
+ for (i = 0; i < RTE_COLORS; i++) {
if (action_mask & (1 << i)) {
if (actions[i] != MTR_POLICER_ACTION_COLOR_GREEN &&
actions[i] != MTR_POLICER_ACTION_COLOR_YELLOW &&
if (action_mask & (1 << i)) {
if (actions[i] != MTR_POLICER_ACTION_COLOR_GREEN &&
actions[i] != MTR_POLICER_ACTION_COLOR_YELLOW &&
memcpy(&action, &m->flow->action, sizeof(action));
/* Set action */
memcpy(&action, &m->flow->action, sizeof(action));
/* Set action */
- for (i = 0; i < RTE_MTR_COLORS; i++)
+ for (i = 0; i < RTE_COLORS; i++)
if (action_mask & (1 << i))
action.mtr.mtr[0].policer[i] =
softnic_table_action_policer(actions[i]);
if (action_mask & (1 << i))
action.mtr.mtr[0].policer[i] =
softnic_table_action_policer(actions[i]);
}
/* Meter: Update policer actions */
}
/* Meter: Update policer actions */
- for (i = 0; i < RTE_MTR_COLORS; i++)
+ for (i = 0; i < RTE_COLORS; i++)
if (action_mask & (1 << i))
m->params.action[i] = actions[i];
if (action_mask & (1 << i))
m->params.action[i] = actions[i];
if (in->n_packets_valid) {
uint32_t i;
if (in->n_packets_valid) {
uint32_t i;
- for (i = 0; i < RTE_MTR_COLORS; i++) {
+ for (i = 0; i < RTE_COLORS; i++) {
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_GREEN)
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_GREEN)
- out->n_pkts[RTE_MTR_GREEN] += in->n_packets[i];
+ out->n_pkts[RTE_COLOR_GREEN] += in->n_packets[i];
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_YELLOW)
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_YELLOW)
- out->n_pkts[RTE_MTR_YELLOW] += in->n_packets[i];
+ out->n_pkts[RTE_COLOR_YELLOW] += in->n_packets[i];
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_RED)
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_RED)
- out->n_pkts[RTE_MTR_RED] += in->n_packets[i];
+ out->n_pkts[RTE_COLOR_RED] += in->n_packets[i];
if (m->params.action[i] == MTR_POLICER_ACTION_DROP)
out->n_pkts_dropped += in->n_packets[i];
if (m->params.action[i] == MTR_POLICER_ACTION_DROP)
out->n_pkts_dropped += in->n_packets[i];
if (in->n_bytes_valid) {
uint32_t i;
if (in->n_bytes_valid) {
uint32_t i;
- for (i = 0; i < RTE_MTR_COLORS; i++) {
+ for (i = 0; i < RTE_COLORS; i++) {
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_GREEN)
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_GREEN)
- out->n_bytes[RTE_MTR_GREEN] += in->n_bytes[i];
+ out->n_bytes[RTE_COLOR_GREEN] += in->n_bytes[i];
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_YELLOW)
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_YELLOW)
- out->n_bytes[RTE_MTR_YELLOW] += in->n_bytes[i];
+ out->n_bytes[RTE_COLOR_YELLOW] += in->n_bytes[i];
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_RED)
if (m->params.action[i] == MTR_POLICER_ACTION_COLOR_RED)
- out->n_bytes[RTE_MTR_RED] += in->n_bytes[i];
+ out->n_bytes[RTE_COLOR_RED] += in->n_bytes[i];
if (m->params.action[i] == MTR_POLICER_ACTION_DROP)
out->n_bytes_dropped += in->n_bytes[i];
if (m->params.action[i] == MTR_POLICER_ACTION_DROP)
out->n_bytes_dropped += in->n_bytes[i];
struct rte_tm_error *error)
{
struct tm_wred_profile *wp;
struct rte_tm_error *error)
{
struct tm_wred_profile *wp;
- enum rte_tm_color color;
/* WRED profile ID must not be NONE. */
if (wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE)
/* WRED profile ID must not be NONE. */
if (wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE)
rte_strerror(ENOTSUP));
/* min_th <= max_th, max_th > 0 */
rte_strerror(ENOTSUP));
/* min_th <= max_th, max_th > 0 */
- for (color = RTE_TM_GREEN; color < RTE_TM_COLORS; color++) {
+ for (color = RTE_COLOR_GREEN; color < RTE_COLORS; color++) {
uint32_t min_th = profile->red_params[color].min_th;
uint32_t max_th = profile->red_params[color].max_th;
uint32_t min_th = profile->red_params[color].min_th;
uint32_t max_th = profile->red_params[color].max_th;
struct pmd_internals *p = dev->data->dev_private;
struct rte_sched_port_params *pp = &p->soft.tm.params.port_params;
uint32_t tc_id;
struct pmd_internals *p = dev->data->dev_private;
struct rte_sched_port_params *pp = &p->soft.tm.params.port_params;
uint32_t tc_id;
- enum rte_tm_color color;
for (tc_id = 0; tc_id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; tc_id++)
for (tc_id = 0; tc_id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; tc_id++)
- for (color = RTE_TM_GREEN; color < RTE_TM_COLORS; color++) {
+ for (color = RTE_COLOR_GREEN; color < RTE_COLORS; color++) {
struct rte_red_params *dst =
&pp->red_params[tc_id][color];
struct tm_wred_profile *src_wp =
struct rte_red_params *dst =
&pp->red_params[tc_id][color];
struct tm_wred_profile *src_wp =
s.n_pkts_tc[id] - s.n_pkts_tc_dropped[id];
nr->stats.n_bytes +=
s.n_bytes_tc[id] - s.n_bytes_tc_dropped[id];
s.n_pkts_tc[id] - s.n_pkts_tc_dropped[id];
nr->stats.n_bytes +=
s.n_bytes_tc[id] - s.n_bytes_tc_dropped[id];
- nr->stats.leaf.n_pkts_dropped[RTE_TM_GREEN] +=
+ nr->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] +=
- nr->stats.leaf.n_bytes_dropped[RTE_TM_GREEN] +=
+ nr->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=
s.n_bytes_tc_dropped[id];
}
}
s.n_bytes_tc_dropped[id];
}
}
s.n_pkts_tc[tc_id] - s.n_pkts_tc_dropped[tc_id];
ns->stats.n_bytes +=
s.n_bytes_tc[tc_id] - s.n_bytes_tc_dropped[tc_id];
s.n_pkts_tc[tc_id] - s.n_pkts_tc_dropped[tc_id];
ns->stats.n_bytes +=
s.n_bytes_tc[tc_id] - s.n_bytes_tc_dropped[tc_id];
- ns->stats.leaf.n_pkts_dropped[RTE_TM_GREEN] +=
+ ns->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] +=
s.n_pkts_tc_dropped[tc_id];
s.n_pkts_tc_dropped[tc_id];
- ns->stats.leaf.n_bytes_dropped[RTE_TM_GREEN] +=
+ ns->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=
s.n_bytes_tc_dropped[tc_id];
}
s.n_bytes_tc_dropped[tc_id];
}
/* Stats accumulate */
np->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;
np->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;
/* Stats accumulate */
np->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;
np->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;
- np->stats.leaf.n_pkts_dropped[RTE_TM_GREEN] += s.n_pkts_dropped;
- np->stats.leaf.n_bytes_dropped[RTE_TM_GREEN] +=
+ np->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] += s.n_pkts_dropped;
+ np->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=
s.n_bytes_dropped;
np->stats.leaf.n_pkts_queued = qlen;
}
s.n_bytes_dropped;
np->stats.leaf.n_pkts_queued = qlen;
}
/* Stats accumulate */
nt->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;
nt->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;
/* Stats accumulate */
nt->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;
nt->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;
- nt->stats.leaf.n_pkts_dropped[RTE_TM_GREEN] += s.n_pkts_dropped;
- nt->stats.leaf.n_bytes_dropped[RTE_TM_GREEN] +=
+ nt->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] += s.n_pkts_dropped;
+ nt->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=
s.n_bytes_dropped;
nt->stats.leaf.n_pkts_queued = qlen;
}
s.n_bytes_dropped;
nt->stats.leaf.n_pkts_queued = qlen;
}
/* Stats accumulate */
nq->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;
nq->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;
/* Stats accumulate */
nq->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;
nq->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;
- nq->stats.leaf.n_pkts_dropped[RTE_TM_GREEN] += s.n_pkts_dropped;
- nq->stats.leaf.n_bytes_dropped[RTE_TM_GREEN] +=
+ nq->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] += s.n_pkts_dropped;
+ nq->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=
s.n_bytes_dropped;
nq->stats.leaf.n_pkts_queued = qlen;
s.n_bytes_dropped;
nq->stats.leaf.n_pkts_queued = qlen;
parser_read_uint32(&mtr->meter_profile_id, tokens[1]) ||
strcmp(tokens[2], "policer") ||
strcmp(tokens[3], "g") ||
parser_read_uint32(&mtr->meter_profile_id, tokens[1]) ||
strcmp(tokens[2], "policer") ||
strcmp(tokens[3], "g") ||
- parse_policer_action(tokens[4], &mtr->policer[e_RTE_METER_GREEN]) ||
+ parse_policer_action(tokens[4], &mtr->policer[RTE_COLOR_GREEN]) ||
strcmp(tokens[5], "y") ||
strcmp(tokens[5], "y") ||
- parse_policer_action(tokens[6], &mtr->policer[e_RTE_METER_YELLOW]) ||
+ parse_policer_action(tokens[6], &mtr->policer[RTE_COLOR_YELLOW]) ||
strcmp(tokens[7], "r") ||
strcmp(tokens[7], "r") ||
- parse_policer_action(tokens[8], &mtr->policer[e_RTE_METER_RED]))
+ parse_policer_action(tokens[8], &mtr->policer[RTE_COLOR_RED]))
struct rte_table_action_mtr_tc_params *p =
&a->mtr.mtr[i];
enum rte_table_action_policer ga =
struct rte_table_action_mtr_tc_params *p =
&a->mtr.mtr[i];
enum rte_table_action_policer ga =
- p->policer[e_RTE_METER_GREEN];
+ p->policer[RTE_COLOR_GREEN];
enum rte_table_action_policer ya =
enum rte_table_action_policer ya =
- p->policer[e_RTE_METER_YELLOW];
+ p->policer[RTE_COLOR_YELLOW];
enum rte_table_action_policer ra =
enum rte_table_action_policer ra =
- p->policer[e_RTE_METER_RED];
+ p->policer[RTE_COLOR_RED];
fprintf(f, "tc%u meter %u policer g %s y %s r %s ",
i,
fprintf(f, "tc%u meter %u policer g %s y %s r %s ",
i,
for (dscp = 0, l = 1; ; l++) {
char line[64];
char *tokens[3];
for (dscp = 0, l = 1; ; l++) {
char line[64];
char *tokens[3];
- enum rte_meter_color color;
uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);
if (fgets(line, sizeof(line), f) == NULL)
uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);
if (fgets(line, sizeof(line), f) == NULL)
switch (tokens[2][0]) {
case 'g':
case 'G':
switch (tokens[2][0]) {
case 'g':
case 'G':
- color = e_RTE_METER_GREEN;
+ color = RTE_COLOR_GREEN;
break;
case 'y':
case 'Y':
break;
case 'y':
case 'Y':
- color = e_RTE_METER_YELLOW;
+ color = RTE_COLOR_YELLOW;
break;
case 'r':
case 'R':
break;
case 'r':
case 'R':
- color = e_RTE_METER_RED;
#define _MAIN_H_
enum policer_action {
#define _MAIN_H_
enum policer_action {
- GREEN = e_RTE_METER_GREEN,
- YELLOW = e_RTE_METER_YELLOW,
- RED = e_RTE_METER_RED,
- DROP = 3,
+ GREEN = RTE_COLOR_GREEN,
+ YELLOW = RTE_COLOR_YELLOW,
+ RED = RTE_COLOR_RED,
+ DROP = 3,
-enum policer_action policer_table[e_RTE_METER_COLORS][e_RTE_METER_COLORS] =
+enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =
{
{ GREEN, RED, RED},
{ DROP, YELLOW, RED},
{
{ GREEN, RED, RED},
{ DROP, YELLOW, RED},
int
rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
int
rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
- enum rte_meter_color pre_meter, enum rte_meter_color post_meter, enum rte_phb_action action)
+ enum rte_color pre_meter, enum rte_color post_meter, enum rte_phb_action action)
{
struct rte_phb *phb = NULL;
{
struct rte_phb *phb = NULL;
- if ((pre_meter > e_RTE_METER_RED) || (post_meter > e_RTE_METER_RED) || (pre_meter > post_meter)) {
+ if ((pre_meter > RTE_COLOR_RED) || (post_meter > RTE_COLOR_RED) || (pre_meter > post_meter)) {
#include <rte_meter.h>
enum rte_phb_action {
#include <rte_meter.h>
enum rte_phb_action {
- e_RTE_PHB_ACTION_GREEN = e_RTE_METER_GREEN,
- e_RTE_PHB_ACTION_YELLOW = e_RTE_METER_YELLOW,
- e_RTE_PHB_ACTION_RED = e_RTE_METER_RED,
+ e_RTE_PHB_ACTION_GREEN = RTE_COLOR_GREEN,
+ e_RTE_PHB_ACTION_YELLOW = RTE_COLOR_YELLOW,
+ e_RTE_PHB_ACTION_RED = RTE_COLOR_RED,
e_RTE_PHB_ACTION_DROP = 3,
};
struct rte_phb {
e_RTE_PHB_ACTION_DROP = 3,
};
struct rte_phb {
- enum rte_phb_action actions[e_RTE_METER_COLORS][e_RTE_METER_COLORS];
+ enum rte_phb_action actions[RTE_COLORS][RTE_COLORS];
};
int
rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
};
int
rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index,
- enum rte_meter_color pre_meter, enum rte_meter_color post_meter, enum rte_phb_action action);
+ enum rte_color pre_meter, enum rte_color post_meter, enum rte_phb_action action);
static inline enum rte_phb_action
static inline enum rte_phb_action
-policer_run(struct rte_phb *phb_table, uint32_t phb_table_index, enum rte_meter_color pre_meter, enum rte_meter_color post_meter)
+policer_run(struct rte_phb *phb_table, uint32_t phb_table_index, enum rte_color pre_meter, enum rte_color post_meter)
{
struct rte_phb *phb = &phb_table[phb_table_index];
enum rte_phb_action action = phb->actions[pre_meter][post_meter];
{
struct rte_phb *phb = &phb_table[phb_table_index];
enum rte_phb_action action = phb->actions[pre_meter][post_meter];
rx_mbufs[i],
subport, pipe,
traffic_class, queue,
rx_mbufs[i],
subport, pipe,
traffic_class, queue,
- (enum rte_meter_color) color);
+ (enum rte_color) color);
}
if (unlikely(rte_ring_sp_enqueue_bulk(conf->rx_ring,
}
if (unlikely(rte_ring_sp_enqueue_bulk(conf->rx_ring,
char *next;
int k;
/* for each packet colour (green, yellow, red) */
char *next;
int k;
/* for each packet colour (green, yellow, red) */
- for (k = 0; k < e_RTE_METER_COLORS; k++) {
+ for (k = 0; k < RTE_COLORS; k++) {
port_params->red_params[j][k].min_th
= (uint16_t)strtol(entry, &next, 10);
if (next == NULL)
port_params->red_params[j][k].min_th
= (uint16_t)strtol(entry, &next, 10);
if (next == NULL)
char *next;
int k;
/* for each packet colour (green, yellow, red) */
char *next;
int k;
/* for each packet colour (green, yellow, red) */
- for (k = 0; k < e_RTE_METER_COLORS; k++) {
+ for (k = 0; k < RTE_COLORS; k++) {
port_params->red_params[j][k].max_th
= (uint16_t)strtol(entry, &next, 10);
if (next == NULL)
port_params->red_params[j][k].max_th
= (uint16_t)strtol(entry, &next, 10);
if (next == NULL)
char *next;
int k;
/* for each packet colour (green, yellow, red) */
char *next;
int k;
/* for each packet colour (green, yellow, red) */
- for (k = 0; k < e_RTE_METER_COLORS; k++) {
+ for (k = 0; k < RTE_COLORS; k++) {
port_params->red_params[j][k].maxp_inv
= (uint8_t)strtol(entry, &next, 10);
port_params->red_params[j][k].maxp_inv
= (uint8_t)strtol(entry, &next, 10);
char *next;
int k;
/* for each packet colour (green, yellow, red) */
char *next;
int k;
/* for each packet colour (green, yellow, red) */
- for (k = 0; k < e_RTE_METER_COLORS; k++) {
+ for (k = 0; k < RTE_COLORS; k++) {
port_params->red_params[j][k].wq_log2
= (uint8_t)strtol(entry, &next, 10);
if (next == NULL)
port_params->red_params[j][k].wq_log2
= (uint8_t)strtol(entry, &next, 10);
if (next == NULL)
int __rte_experimental
rte_mtr_meter_dscp_table_update(uint16_t port_id,
uint32_t mtr_id,
int __rte_experimental
rte_mtr_meter_dscp_table_update(uint16_t port_id,
uint32_t mtr_id,
- enum rte_mtr_color *dscp_table,
+ enum rte_color *dscp_table,
struct rte_mtr_error *error)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
struct rte_mtr_error *error)
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
-/* New rte_color is defined and used to deprecate rte_mtr_color soon. */
-#define rte_mtr_color rte_color
-#define RTE_MTR_GREEN RTE_COLOR_GREEN
-#define RTE_MTR_YELLOW RTE_COLOR_YELLOW
-#define RTE_MTR_RED RTE_COLOR_RED
-#define RTE_MTR_COLORS RTE_COLORS
-
/**
* Statistics counter type
*/
/**
* Statistics counter type
*/
*/
struct rte_mtr_stats {
/** Number of packets passed by the policer (per color). */
*/
struct rte_mtr_stats {
/** Number of packets passed by the policer (per color). */
- uint64_t n_pkts[RTE_MTR_COLORS];
+ uint64_t n_pkts[RTE_COLORS];
/** Number of bytes passed by the policer (per color). */
/** Number of bytes passed by the policer (per color). */
- uint64_t n_bytes[RTE_MTR_COLORS];
+ uint64_t n_bytes[RTE_COLORS];
/** Number of packets dropped by the policer. */
uint64_t n_pkts_dropped;
/** Number of packets dropped by the policer. */
uint64_t n_pkts_dropped;
* at least one yellow or red color element, then the color aware mode
* is configured.
*/
* at least one yellow or red color element, then the color aware mode
* is configured.
*/
- enum rte_mtr_color *dscp_table;
+ enum rte_color *dscp_table;
/** Non-zero to enable the meter, zero to disable the meter at the time
* of MTR object creation. Ignored when the meter profile indicated by
/** Non-zero to enable the meter, zero to disable the meter at the time
* of MTR object creation. Ignored when the meter profile indicated by
int meter_enable;
/** Policer actions (per meter output color). */
int meter_enable;
/** Policer actions (per meter output color). */
- enum rte_mtr_policer_action action[RTE_MTR_COLORS];
+ enum rte_mtr_policer_action action[RTE_COLORS];
/** Set of stats counters to be enabled.
* @see enum rte_mtr_stats_type
/** Set of stats counters to be enabled.
* @see enum rte_mtr_stats_type
int __rte_experimental
rte_mtr_meter_dscp_table_update(uint16_t port_id,
uint32_t mtr_id,
int __rte_experimental
rte_mtr_meter_dscp_table_update(uint16_t port_id,
uint32_t mtr_id,
- enum rte_mtr_color *dscp_table,
+ enum rte_color *dscp_table,
struct rte_mtr_error *error);
/**
struct rte_mtr_error *error);
/**
typedef int (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev,
uint32_t mtr_id,
typedef int (*rte_mtr_meter_dscp_table_update_t)(struct rte_eth_dev *dev,
uint32_t mtr_id,
- enum rte_mtr_color *dscp_table,
+ enum rte_color *dscp_table,
struct rte_mtr_error *error);
/**< @internal MTR object meter DSCP table update */
struct rte_mtr_error *error);
/**< @internal MTR object meter DSCP table update */
*/
#define RTE_TM_NODE_LEVEL_ID_ANY UINT32_MAX
*/
#define RTE_TM_NODE_LEVEL_ID_ANY UINT32_MAX
-/* New rte_color is defined and used to deprecate rte_tm_color soon. */
-#define rte_tm_color rte_color
-#define RTE_TM_GREEN RTE_COLOR_GREEN
-#define RTE_TM_YELLOW RTE_COLOR_YELLOW
-#define RTE_TM_RED RTE_COLOR_RED
-#define RTE_TM_COLORS RTE_COLORS
-
/**
* Node statistics counter type
*/
/**
* Node statistics counter type
*/
/** Number of packets dropped by current leaf node per each
* color.
*/
/** Number of packets dropped by current leaf node per each
* color.
*/
- uint64_t n_pkts_dropped[RTE_TM_COLORS];
+ uint64_t n_pkts_dropped[RTE_COLORS];
/** Number of bytes dropped by current leaf node per each
* color.
*/
/** Number of bytes dropped by current leaf node per each
* color.
*/
- uint64_t n_bytes_dropped[RTE_TM_COLORS];
+ uint64_t n_bytes_dropped[RTE_COLORS];
/** Number of packets currently waiting in the packet queue of
* current leaf node.
/** Number of packets currently waiting in the packet queue of
* current leaf node.
uint32_t cman_wred_context_shared_n_contexts_per_node_max;
/** Support for VLAN DEI packet marking (per color). */
uint32_t cman_wred_context_shared_n_contexts_per_node_max;
/** Support for VLAN DEI packet marking (per color). */
- int mark_vlan_dei_supported[RTE_TM_COLORS];
+ int mark_vlan_dei_supported[RTE_COLORS];
/** Support for IPv4/IPv6 ECN marking of TCP packets (per color). */
/** Support for IPv4/IPv6 ECN marking of TCP packets (per color). */
- int mark_ip_ecn_tcp_supported[RTE_TM_COLORS];
+ int mark_ip_ecn_tcp_supported[RTE_COLORS];
/** Support for IPv4/IPv6 ECN marking of SCTP packets (per color). */
/** Support for IPv4/IPv6 ECN marking of SCTP packets (per color). */
- int mark_ip_ecn_sctp_supported[RTE_TM_COLORS];
+ int mark_ip_ecn_sctp_supported[RTE_COLORS];
/** Support for IPv4/IPv6 DSCP packet marking (per color). */
/** Support for IPv4/IPv6 DSCP packet marking (per color). */
- int mark_ip_dscp_supported[RTE_TM_COLORS];
+ int mark_ip_dscp_supported[RTE_COLORS];
/** Set of supported dynamic update operations.
* @see enum rte_tm_dynamic_update_type
/** Set of supported dynamic update operations.
* @see enum rte_tm_dynamic_update_type
*/
struct rte_tm_wred_params {
/** One set of RED parameters per packet color */
*/
struct rte_tm_wred_params {
/** One set of RED parameters per packet color */
- struct rte_tm_red_params red_params[RTE_TM_COLORS];
+ struct rte_tm_red_params red_params[RTE_COLORS];
/** When non-zero, the *min_th* and *max_th* thresholds are specified
* in packets (WRED packet mode). When zero, the *min_th* and *max_th*
/** When non-zero, the *min_th* and *max_th* thresholds are specified
* in packets (WRED packet mode). When zero, the *min_th* and *max_th*
EXPORT_MAP := rte_meter_version.map
EXPORT_MAP := rte_meter_version.map
#
# all source are stored in SRCS-y
#
# all source are stored in SRCS-y
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
sources = files('rte_meter.c')
headers = files('rte_meter.h')
sources = files('rte_meter.c')
headers = files('rte_meter.h')
RTE_COLORS /**< Number of colors */
};
RTE_COLORS /**< Number of colors */
};
-/* New rte_color is defined and used to deprecate rte_meter_color soon. */
-#define rte_meter_color rte_color
-#define e_RTE_METER_GREEN RTE_COLOR_GREEN
-#define e_RTE_METER_YELLOW RTE_COLOR_YELLOW
-#define e_RTE_METER_RED RTE_COLOR_RED
-#define e_RTE_METER_COLORS RTE_COLORS
-
/** srTCM parameters per metered traffic flow. The CIR, CBS and EBS parameters only
count bytes of IP packets and do not include link specific headers. At least one of
the CBS or EBS parameters has to be greater than zero. */
/** srTCM parameters per metered traffic flow. The CIR, CBS and EBS parameters only
count bytes of IP packets and do not include link specific headers. At least one of
the CBS or EBS parameters has to be greater than zero. */
* @return
* Color assigned to the current IP packet
*/
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
* @return
* Color assigned to the current IP packet
*/
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color);
+ enum rte_color pkt_color);
/**
* trTCM color blind traffic metering
/**
* trTCM color blind traffic metering
* @return
* Color assigned to the current IP packet
*/
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
* @return
* Color assigned to the current IP packet
*/
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color);
+ enum rte_color pkt_color);
* @return
* Color assigned to the current IP packet
*/
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_blind_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
rte_meter_trtcm_rfc4115_color_blind_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
* @return
* Color assigned to the current IP packet
*/
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_aware_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
uint64_t time,
uint32_t pkt_len,
rte_meter_trtcm_rfc4115_color_aware_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color);
+ enum rte_color pkt_color);
/*
* Inline implementation of run-time methods
/*
* Inline implementation of run-time methods
/**< Number of bytes currently available in the excess(E) token bucket */
};
/**< Number of bytes currently available in the excess(E) token bucket */
};
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
}
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc;
m->te = te;
}
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color)
+ enum rte_color pkt_color)
{
uint64_t time_diff, n_periods, tc, te;
{
uint64_t time_diff, n_periods, tc, te;
- if ((pkt_color == e_RTE_METER_GREEN) && (tc >= pkt_len)) {
+ if ((pkt_color == RTE_COLOR_GREEN) && (tc >= pkt_len)) {
m->tc = tc - pkt_len;
m->te = te;
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
- if ((pkt_color != e_RTE_METER_RED) && (te >= pkt_len)) {
+ if ((pkt_color != RTE_COLOR_RED) && (te >= pkt_len)) {
m->tc = tc;
m->te = te - pkt_len;
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc;
m->te = te;
}
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
if (tp < pkt_len) {
m->tc = tc;
m->tp = tp;
if (tp < pkt_len) {
m->tc = tc;
m->tp = tp;
- return e_RTE_METER_RED;
}
if (tc < pkt_len) {
m->tc = tc;
m->tp = tp - pkt_len;
}
if (tc < pkt_len) {
m->tc = tc;
m->tp = tp - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
}
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color)
+ enum rte_color pkt_color)
{
uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
{
uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
tp = p->pbs;
/* Color logic */
tp = p->pbs;
/* Color logic */
- if ((pkt_color == e_RTE_METER_RED) || (tp < pkt_len)) {
+ if ((pkt_color == RTE_COLOR_RED) || (tp < pkt_len)) {
- return e_RTE_METER_RED;
- if ((pkt_color == e_RTE_METER_YELLOW) || (tc < pkt_len)) {
+ if ((pkt_color == RTE_COLOR_YELLOW) || (tc < pkt_len)) {
m->tc = tc;
m->tp = tp - pkt_len;
m->tc = tc;
m->tp = tp - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
}
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_blind_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
rte_meter_trtcm_rfc4115_color_blind_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
}
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
/* If we end up here the color is RED */
m->tc = tc;
m->te = te;
}
/* If we end up here the color is RED */
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_aware_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
uint64_t time,
uint32_t pkt_len,
rte_meter_trtcm_rfc4115_color_aware_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color)
+ enum rte_color pkt_color)
{
uint64_t time_diff_tc, time_diff_te, n_periods_tc, n_periods_te, tc, te;
{
uint64_t time_diff_tc, time_diff_te, n_periods_tc, n_periods_te, tc, te;
te = p->ebs;
/* Color logic */
te = p->ebs;
/* Color logic */
- if ((pkt_color == e_RTE_METER_GREEN) && (tc >= pkt_len)) {
+ if ((pkt_color == RTE_COLOR_GREEN) && (tc >= pkt_len)) {
m->tc = tc - pkt_len;
m->te = te;
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
- if ((pkt_color != e_RTE_METER_RED) && (te >= pkt_len)) {
+ if ((pkt_color != RTE_COLOR_RED) && (te >= pkt_len)) {
m->tc = tc;
m->te = te - pkt_len;
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
/* If we end up here the color is RED */
m->tc = tc;
m->te = te;
}
/* If we end up here the color is RED */
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
struct mtr_trtcm_data {
struct rte_meter_trtcm trtcm;
struct mtr_trtcm_data {
struct rte_meter_trtcm trtcm;
- uint64_t stats[e_RTE_METER_COLORS];
+ uint64_t stats[RTE_COLORS];
} __attribute__((__packed__));
#define MTR_TRTCM_DATA_METER_PROFILE_ID_GET(data) \
} __attribute__((__packed__));
#define MTR_TRTCM_DATA_METER_PROFILE_ID_GET(data) \
- (((data)->stats[e_RTE_METER_GREEN] & 0xF8LLU) >> 3)
+ (((data)->stats[RTE_COLOR_GREEN] & 0xF8LLU) >> 3)
static void
mtr_trtcm_data_meter_profile_id_set(struct mtr_trtcm_data *data,
uint32_t profile_id)
{
static void
mtr_trtcm_data_meter_profile_id_set(struct mtr_trtcm_data *data,
uint32_t profile_id)
{
- data->stats[e_RTE_METER_GREEN] &= ~0xF8LLU;
- data->stats[e_RTE_METER_GREEN] |= (profile_id % 32) << 3;
+ data->stats[RTE_COLOR_GREEN] &= ~0xF8LLU;
+ data->stats[RTE_COLOR_GREEN] |= (profile_id % 32) << 3;
}
#define MTR_TRTCM_DATA_POLICER_ACTION_DROP_GET(data, color)\
(((data)->stats[(color)] & 4LLU) >> 2)
#define MTR_TRTCM_DATA_POLICER_ACTION_COLOR_GET(data, color)\
}
#define MTR_TRTCM_DATA_POLICER_ACTION_DROP_GET(data, color)\
(((data)->stats[(color)] & 4LLU) >> 2)
#define MTR_TRTCM_DATA_POLICER_ACTION_COLOR_GET(data, color)\
- ((enum rte_meter_color)((data)->stats[(color)] & 3LLU))
+ ((enum rte_color)((data)->stats[(color)] & 3LLU))
static void
mtr_trtcm_data_policer_action_set(struct mtr_trtcm_data *data,
static void
mtr_trtcm_data_policer_action_set(struct mtr_trtcm_data *data,
- enum rte_meter_color color,
enum rte_table_action_policer action)
{
if (action == RTE_TABLE_ACTION_POLICER_DROP) {
enum rte_table_action_policer action)
{
if (action == RTE_TABLE_ACTION_POLICER_DROP) {
static uint64_t
mtr_trtcm_data_stats_get(struct mtr_trtcm_data *data,
static uint64_t
mtr_trtcm_data_stats_get(struct mtr_trtcm_data *data,
- enum rte_meter_color color)
{
return data->stats[color] >> 8;
}
static void
mtr_trtcm_data_stats_reset(struct mtr_trtcm_data *data,
{
return data->stats[color] >> 8;
}
static void
mtr_trtcm_data_stats_reset(struct mtr_trtcm_data *data,
- enum rte_meter_color color)
{
data->stats[color] &= 0xFFLU;
}
{
data->stats[color] &= 0xFFLU;
}
}
struct dscp_table_entry_data {
}
struct dscp_table_entry_data {
- enum rte_meter_color color;
uint16_t tc;
uint16_t tc_queue;
};
uint16_t tc;
uint16_t tc_queue;
};
/* Policer actions */
mtr_trtcm_data_policer_action_set(data_tc,
/* Policer actions */
mtr_trtcm_data_policer_action_set(data_tc,
- e_RTE_METER_GREEN,
- p_tc->policer[e_RTE_METER_GREEN]);
+ RTE_COLOR_GREEN,
+ p_tc->policer[RTE_COLOR_GREEN]);
mtr_trtcm_data_policer_action_set(data_tc,
mtr_trtcm_data_policer_action_set(data_tc,
- e_RTE_METER_YELLOW,
- p_tc->policer[e_RTE_METER_YELLOW]);
+ RTE_COLOR_YELLOW,
+ p_tc->policer[RTE_COLOR_YELLOW]);
mtr_trtcm_data_policer_action_set(data_tc,
mtr_trtcm_data_policer_action_set(data_tc,
- e_RTE_METER_RED,
- p_tc->policer[e_RTE_METER_RED]);
+ RTE_COLOR_RED,
+ p_tc->policer[RTE_COLOR_RED]);
{
uint64_t drop_mask;
struct dscp_table_entry_data *dscp_entry = &dscp_table->entry[dscp];
{
uint64_t drop_mask;
struct dscp_table_entry_data *dscp_entry = &dscp_table->entry[dscp];
- enum rte_meter_color color_in, color_meter, color_policer;
+ enum rte_color color_in, color_meter, color_policer;
uint32_t tc, mp_id;
tc = dscp_entry->tc;
uint32_t tc, mp_id;
tc = dscp_entry->tc;
if ((tc_mask & (1 << i)) == 0)
continue;
if ((tc_mask & (1 << i)) == 0)
continue;
- dst->n_packets[e_RTE_METER_GREEN] =
- mtr_trtcm_data_stats_get(src, e_RTE_METER_GREEN);
+ dst->n_packets[RTE_COLOR_GREEN] =
+ mtr_trtcm_data_stats_get(src, RTE_COLOR_GREEN);
- dst->n_packets[e_RTE_METER_YELLOW] =
- mtr_trtcm_data_stats_get(src, e_RTE_METER_YELLOW);
+ dst->n_packets[RTE_COLOR_YELLOW] =
+ mtr_trtcm_data_stats_get(src, RTE_COLOR_YELLOW);
- dst->n_packets[e_RTE_METER_RED] =
- mtr_trtcm_data_stats_get(src, e_RTE_METER_RED);
+ dst->n_packets[RTE_COLOR_RED] =
+ mtr_trtcm_data_stats_get(src, RTE_COLOR_RED);
dst->n_packets_valid = 1;
dst->n_bytes_valid = 0;
dst->n_packets_valid = 1;
dst->n_bytes_valid = 0;
if ((tc_mask & (1 << i)) == 0)
continue;
if ((tc_mask & (1 << i)) == 0)
continue;
- mtr_trtcm_data_stats_reset(src, e_RTE_METER_GREEN);
- mtr_trtcm_data_stats_reset(src, e_RTE_METER_YELLOW);
- mtr_trtcm_data_stats_reset(src, e_RTE_METER_RED);
+ mtr_trtcm_data_stats_reset(src, RTE_COLOR_GREEN);
+ mtr_trtcm_data_stats_reset(src, RTE_COLOR_YELLOW);
+ mtr_trtcm_data_stats_reset(src, RTE_COLOR_RED);
/** Packet color. Used by the meter action as the packet input color
* for the color aware mode of the traffic metering algorithm.
*/
/** Packet color. Used by the meter action as the packet input color
* for the color aware mode of the traffic metering algorithm.
*/
- enum rte_meter_color color;
};
/** DSCP translation table. */
};
/** DSCP translation table. */
uint32_t meter_profile_id;
/** Policer actions. */
uint32_t meter_profile_id;
/** Policer actions. */
- enum rte_table_action_policer policer[e_RTE_METER_COLORS];
+ enum rte_table_action_policer policer[RTE_COLORS];
};
/** Meter action statistics counters per traffic class. */
};
/** Meter action statistics counters per traffic class. */
* and before the policer actions are executed. Only valid when
* *n_packets_valid* is non-zero.
*/
* and before the policer actions are executed. Only valid when
* *n_packets_valid* is non-zero.
*/
- uint64_t n_packets[e_RTE_METER_COLORS];
+ uint64_t n_packets[RTE_COLORS];
/** Number of packet bytes per color at the output of the traffic
* metering and before the policer actions are executed. Only valid when
* *n_bytes_valid* is non-zero.
*/
/** Number of packet bytes per color at the output of the traffic
* metering and before the policer actions are executed. Only valid when
* *n_bytes_valid* is non-zero.
*/
- uint64_t n_bytes[e_RTE_METER_COLORS];
+ uint64_t n_bytes[RTE_COLORS];
/** When non-zero, the *n_packets* field is valid. */
int n_packets_valid;
/** When non-zero, the *n_packets* field is valid. */
int n_packets_valid;
uint32_t n_pipe_profiles;
uint32_t pipe_tc3_rate_max;
#ifdef RTE_SCHED_RED
uint32_t n_pipe_profiles;
uint32_t pipe_tc3_rate_max;
#ifdef RTE_SCHED_RED
- struct rte_red_config red_config[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][e_RTE_METER_COLORS];
+ struct rte_red_config red_config[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS];
for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) {
uint32_t j;
for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) {
uint32_t j;
- for (j = 0; j < e_RTE_METER_COLORS; j++) {
+ for (j = 0; j < RTE_COLORS; j++) {
/* if min/max are both zero, then RED is disabled */
if ((params->red_params[i][j].min_th |
params->red_params[i][j].max_th) == 0) {
/* if min/max are both zero, then RED is disabled */
if ((params->red_params[i][j].min_th |
params->red_params[i][j].max_th) == 0) {
struct rte_mbuf *pkt,
uint32_t subport, uint32_t pipe,
uint32_t traffic_class,
struct rte_mbuf *pkt,
uint32_t subport, uint32_t pipe,
uint32_t traffic_class,
- uint32_t queue, enum rte_meter_color color)
+ uint32_t queue, enum rte_color color)
{
uint32_t queue_id = rte_sched_port_qindex(port, subport, pipe,
traffic_class, queue);
{
uint32_t queue_id = rte_sched_port_qindex(port, subport, pipe,
traffic_class, queue);
*queue = queue_id & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1);
}
*queue = queue_id & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1);
}
rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt)
{
rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt)
{
- return (enum rte_meter_color)rte_mbuf_sched_color_get(pkt);
+ return (enum rte_color)rte_mbuf_sched_color_get(pkt);
struct rte_red_config *red_cfg;
struct rte_red *red;
uint32_t tc_index;
struct rte_red_config *red_cfg;
struct rte_red *red;
uint32_t tc_index;
- enum rte_meter_color color;
tc_index = (qindex >> 2) & 0x3;
color = rte_sched_port_pkt_read_color(pkt);
tc_index = (qindex >> 2) & 0x3;
color = rte_sched_port_pkt_read_color(pkt);
* Every pipe is configured using one of the profiles from this table. */
uint32_t n_pipe_profiles; /**< Profiles in the pipe profile table */
#ifdef RTE_SCHED_RED
* Every pipe is configured using one of the profiles from this table. */
uint32_t n_pipe_profiles; /**< Profiles in the pipe profile table */
#ifdef RTE_SCHED_RED
- struct rte_red_params red_params[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][e_RTE_METER_COLORS]; /**< RED parameters */
+ struct rte_red_params red_params[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS]; /**< RED parameters */
rte_sched_port_pkt_write(struct rte_sched_port *port,
struct rte_mbuf *pkt,
uint32_t subport, uint32_t pipe, uint32_t traffic_class,
rte_sched_port_pkt_write(struct rte_sched_port *port,
struct rte_mbuf *pkt,
uint32_t subport, uint32_t pipe, uint32_t traffic_class,
- uint32_t queue, enum rte_meter_color color);
+ uint32_t queue, enum rte_color color);
/**
* Scheduler hierarchy path read from packet descriptor (struct
/**
* Scheduler hierarchy path read from packet descriptor (struct
uint32_t *subport, uint32_t *pipe,
uint32_t *traffic_class, uint32_t *queue);
uint32_t *subport, uint32_t *pipe,
uint32_t *traffic_class, uint32_t *queue);
rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt);
/**
rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt);
/**