From c1656328dbc20420b7ba87b1abee7b699c8e84f4 Mon Sep 17 00:00:00 2001 From: Jasvinder Singh Date: Thu, 11 Apr 2019 10:15:14 +0100 Subject: [PATCH] meter: replace color definitions 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 Acked-by: Cristian Dumitrescu --- app/proc-info/main.c | 36 +++--- app/test-pmd/cmdline_mtr.c | 46 +++---- app/test-pmd/cmdline_tm.c | 22 ++-- app/test/test_meter.c | 126 ++++++++++---------- app/test/test_sched.c | 6 +- doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_19_05.rst | 7 +- drivers/net/softnic/rte_eth_softnic_cli.c | 14 +-- drivers/net/softnic/rte_eth_softnic_flow.c | 12 +- drivers/net/softnic/rte_eth_softnic_meter.c | 26 ++-- drivers/net/softnic/rte_eth_softnic_tm.c | 28 ++--- examples/ip_pipeline/cli.c | 20 ++-- examples/qos_meter/main.h | 10 +- examples/qos_meter/rte_policer.c | 4 +- examples/qos_meter/rte_policer.h | 12 +- examples/qos_sched/app_thread.c | 2 +- examples/qos_sched/cfg_file.c | 8 +- lib/librte_ethdev/rte_mtr.c | 2 +- lib/librte_ethdev/rte_mtr.h | 17 +-- lib/librte_ethdev/rte_mtr_driver.h | 2 +- lib/librte_ethdev/rte_tm.h | 21 ++-- lib/librte_meter/Makefile | 2 +- lib/librte_meter/meson.build | 2 +- lib/librte_meter/rte_meter.h | 91 +++++++------- lib/librte_pipeline/rte_table_action.c | 50 ++++---- lib/librte_pipeline/rte_table_action.h | 8 +- lib/librte_sched/rte_sched.c | 12 +- lib/librte_sched/rte_sched.h | 6 +- 28 files changed, 288 insertions(+), 309 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 3cd53416df..a89b51bb3f 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -873,21 +873,21 @@ show_tm(void) 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", - 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", - 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", - 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", @@ -1004,12 +1004,12 @@ show_tm(void) " 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]); } } diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index c506d87ee5..ab5c8642db 100644 --- a/app/test-pmd/cmdline_mtr.c +++ b/app/test-pmd/cmdline_mtr.c @@ -74,7 +74,7 @@ parse_uint(uint64_t *value, const char *str) } static int -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; @@ -84,21 +84,21 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color **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) - *dscp_table[i++] = RTE_MTR_GREEN; + *dscp_table[i++] = RTE_COLOR_GREEN; 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) - *dscp_table[i++] = RTE_MTR_RED; + *dscp_table[i++] = RTE_COLOR_RED; else { free(*dscp_table); return -1; @@ -117,7 +117,7 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color **dscp_table) 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; @@ -182,20 +182,20 @@ parse_policer_action_string(char *p_str, uint32_t action_mask, 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)) { - actions[RTE_MTR_YELLOW] = action; + actions[RTE_COLOR_YELLOW] = action; y_color = 1; } else - 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, - uint32_t *mtr_id, enum rte_mtr_color **dscp_table) + uint32_t *mtr_id, enum rte_color **dscp_table) { char *token; uint64_t val; @@ -782,7 +782,7 @@ static void cmd_create_port_meter_parsed(void *parsed_result, 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; @@ -808,11 +808,11 @@ static void cmd_create_port_meter_parsed(void *parsed_result, else params.meter_enable = 0; - params.action[RTE_MTR_GREEN] = + params.action[RTE_COLOR_GREEN] = string_to_policer_action(res->g_action); - params.action[RTE_MTR_YELLOW] = + params.action[RTE_COLOR_YELLOW] = 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; @@ -1134,7 +1134,7 @@ static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result, { 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; @@ -1245,7 +1245,7 @@ static void cmd_set_port_meter_policer_action_parsed(void *parsed_result, } /* 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"); @@ -1426,22 +1426,22 @@ static void cmd_show_port_meter_stats_parsed(void *parsed_result, /* 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", - 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", - 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", - 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", - 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", - 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); diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index 1012084746..d62a4f5443 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -296,7 +296,7 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result, 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", @@ -642,22 +642,22 @@ static void cmd_show_port_tm_node_stats_parsed(void *parsed_result, 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", - 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", - 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", - 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", - 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", - 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); @@ -1267,7 +1267,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result, { struct cmd_add_port_tm_node_wred_profile_result *res = parsed_result; struct rte_tm_wred_params wp; - enum rte_tm_color color; + enum rte_color color; struct rte_tm_error error; uint32_t wred_profile_id = res->wred_profile_id; portid_t port_id = res->port_id; @@ -1280,7 +1280,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result, memset(&error, 0, sizeof(struct rte_tm_error)); /* WRED Params (Green Color)*/ - color = RTE_TM_GREEN; + 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; @@ -1288,14 +1288,14 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result, /* WRED Params (Yellow Color)*/ - color = RTE_TM_YELLOW; + 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)*/ - color = RTE_TM_RED; + color = RTE_COLOR_RED; 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; diff --git a/app/test/test_meter.c b/app/test/test_meter.c index f935faa539..f6fe6494ab 100644 --- a/app/test/test_meter.c +++ b/app/test/test_meter.c @@ -215,7 +215,7 @@ tm_test_srtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_srtcm_color_blind_check( &sm, &sp, time, TM_TEST_SRTCM_CBS_DF - 1) - != e_RTE_METER_GREEN) + != RTE_COLOR_GREEN) melog(SRTCM_BLIND_CHECK_MSG" GREEN"); /* Test yellow */ @@ -226,7 +226,7 @@ tm_test_srtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_srtcm_color_blind_check( &sm, &sp, time, TM_TEST_SRTCM_CBS_DF + 1) - != e_RTE_METER_YELLOW) + != RTE_COLOR_YELLOW) melog(SRTCM_BLIND_CHECK_MSG" YELLOW"); if (rte_meter_srtcm_profile_config(&sp, &sparams) != 0) @@ -235,7 +235,7 @@ tm_test_srtcm_color_blind_check(void) 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 */ @@ -246,7 +246,7 @@ tm_test_srtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_srtcm_color_blind_check( &sm, &sp, time, TM_TEST_SRTCM_EBS_DF + 1) - != e_RTE_METER_RED) + != RTE_COLOR_RED) melog(SRTCM_BLIND_CHECK_MSG" RED"); return 0; @@ -274,7 +274,7 @@ tm_test_trtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1) - != e_RTE_METER_GREEN) + != RTE_COLOR_GREEN) melog(TRTCM_BLIND_CHECK_MSG" GREEN"); /* Test yellow */ @@ -285,7 +285,7 @@ tm_test_trtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1) - != e_RTE_METER_YELLOW) + != RTE_COLOR_YELLOW) melog(TRTCM_BLIND_CHECK_MSG" YELLOW"); if (rte_meter_trtcm_profile_config(&tp, &tparams) != 0) @@ -295,7 +295,7 @@ tm_test_trtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_PBS_DF - 1) - != e_RTE_METER_YELLOW) + != RTE_COLOR_YELLOW) melog(TRTCM_BLIND_CHECK_MSG" YELLOW"); /* Test red */ @@ -306,7 +306,7 @@ tm_test_trtcm_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_PBS_DF + 1) - != e_RTE_METER_RED) + != RTE_COLOR_RED) melog(TRTCM_BLIND_CHECK_MSG" RED"); return 0; @@ -333,7 +333,7 @@ tm_test_trtcm_rfc4115_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_rfc4115_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1) - != e_RTE_METER_GREEN) + != RTE_COLOR_GREEN) melog(TRTCM_RFC4115_BLIND_CHECK_MSG" GREEN"); /* Test yellow */ @@ -344,7 +344,7 @@ tm_test_trtcm_rfc4115_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_rfc4115_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1) - != e_RTE_METER_YELLOW) + != RTE_COLOR_YELLOW) melog(TRTCM_RFC4115_BLIND_CHECK_MSG" YELLOW"); if (rte_meter_trtcm_rfc4115_profile_config(&tp, &rfc4115params) != 0) @@ -354,7 +354,7 @@ tm_test_trtcm_rfc4115_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_rfc4115_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_EBS_DF - 1) - != e_RTE_METER_YELLOW) + != RTE_COLOR_YELLOW) melog(TRTCM_RFC4115_BLIND_CHECK_MSG" YELLOW"); /* Test red */ @@ -365,7 +365,7 @@ tm_test_trtcm_rfc4115_color_blind_check(void) time = rte_get_tsc_cycles() + hz; if (rte_meter_trtcm_rfc4115_color_blind_check( &tm, &tp, time, TM_TEST_TRTCM_EBS_DF + 1) - != e_RTE_METER_RED) + != RTE_COLOR_RED) melog(TRTCM_RFC4115_BLIND_CHECK_MSG" RED"); return 0; @@ -383,7 +383,7 @@ tm_test_trtcm_rfc4115_color_blind_check(void) 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; @@ -437,7 +437,7 @@ tm_test_srtcm_aware_check 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 @@ -445,11 +445,11 @@ tm_test_srtcm_color_aware_check(void) */ /* 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; @@ -457,11 +457,11 @@ tm_test_srtcm_color_aware_check(void) * 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; @@ -469,11 +469,11 @@ tm_test_srtcm_color_aware_check(void) * 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; @@ -490,7 +490,7 @@ tm_test_srtcm_color_aware_check(void) */ 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; @@ -545,34 +545,34 @@ tm_test_trtcm_aware_check 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 */ - 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; - 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; - 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; @@ -589,7 +589,7 @@ tm_test_trtcm_color_aware_check(void) */ 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; @@ -642,34 +642,34 @@ tm_test_trtcm_rfc4115_aware_check 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 */ - 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; - 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; - 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; diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 40e411cabe..4eed8dbdee 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -96,7 +96,7 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) rte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE, - e_RTE_METER_YELLOW); + RTE_COLOR_YELLOW); /* 64 byte packet */ mbuf->pkt_len = 60; @@ -150,11 +150,11 @@ test_sched(void) TEST_ASSERT_EQUAL(err, 10, "Wrong dequeue, err=%d\n", err); for (i = 0; i < 10; i++) { - enum rte_meter_color color; + enum rte_color color; 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); diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index ba39c2d621..b47c8c2540 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -65,11 +65,6 @@ Deprecation Notices 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, diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index dbdf07a0c0..b6a1f22f9b 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -188,6 +188,11 @@ API Changes ``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. @@ -273,7 +278,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_mbuf.so.5 librte_member.so.1 librte_mempool.so.5 - librte_meter.so.2 + librte_meter.so.3 librte_metrics.so.1 librte_net.so.1 librte_pci.so.1 diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index 410eb54bd9..56fc92ba25 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -3555,11 +3555,11 @@ parse_table_action_meter_tc(char **tokens, 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") || - 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") || - parse_policer_action(tokens[8], &mtr->policer[e_RTE_METER_RED])) + parse_policer_action(tokens[8], &mtr->policer[RTE_COLOR_RED])) return 0; return 9; @@ -5426,7 +5426,7 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table, for (dscp = 0, l = 1; ; l++) { char line[64]; char *tokens[3]; - enum rte_meter_color color; + enum rte_color color; uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens); if (fgets(line, sizeof(line), f) == NULL) @@ -5459,17 +5459,17 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table, switch (tokens[2][0]) { case 'g': case 'G': - color = e_RTE_METER_GREEN; + color = RTE_COLOR_GREEN; break; case 'y': case 'Y': - color = e_RTE_METER_YELLOW; + color = RTE_COLOR_YELLOW; break; case 'r': case 'R': - color = e_RTE_METER_RED; + color = RTE_COLOR_RED; break; default: diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index aefc384dc2..ccd58c01cd 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -1624,12 +1624,12 @@ flow_rule_action_get(struct pmd_internals *softnic, /* 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; diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c index 7b747ba5d0..31a2a0e6d9 100644 --- a/drivers/net/softnic/rte_eth_softnic_meter.c +++ b/drivers/net/softnic/rte_eth_softnic_meter.c @@ -458,7 +458,7 @@ pmd_mtr_meter_profile_update(struct rte_eth_dev *dev, 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; @@ -488,7 +488,7 @@ pmd_mtr_meter_dscp_table_update(struct rte_eth_dev *dev, 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, @@ -536,7 +536,7 @@ pmd_mtr_policer_actions_update(struct rte_eth_dev *dev, 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 && @@ -560,7 +560,7 @@ pmd_mtr_policer_actions_update(struct rte_eth_dev *dev, 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]); @@ -588,7 +588,7 @@ pmd_mtr_policer_actions_update(struct rte_eth_dev *dev, } /* 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]; @@ -618,15 +618,15 @@ mtr_stats_convert(struct softnic_mtr *m, 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) - 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) - 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) - 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]; @@ -638,15 +638,15 @@ mtr_stats_convert(struct softnic_mtr *m, 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) - 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) - 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) - 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]; diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index baaafbe296..58744a9eb8 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -1204,7 +1204,7 @@ wred_profile_check(struct rte_eth_dev *dev, struct rte_tm_error *error) { struct tm_wred_profile *wp; - enum rte_tm_color color; + enum rte_color color; /* WRED profile ID must not be NONE. */ if (wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE) @@ -1240,7 +1240,7 @@ wred_profile_check(struct rte_eth_dev *dev, 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; @@ -2218,10 +2218,10 @@ wred_profiles_set(struct rte_eth_dev *dev) 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; + enum rte_color color; 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 = @@ -3058,9 +3058,9 @@ read_port_stats(struct rte_eth_dev *dev, 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] += s.n_pkts_tc_dropped[id]; - nr->stats.leaf.n_bytes_dropped[RTE_TM_GREEN] += + nr->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] += s.n_bytes_tc_dropped[id]; } } @@ -3105,9 +3105,9 @@ read_subport_stats(struct rte_eth_dev *dev, 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]; - 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]; } @@ -3162,8 +3162,8 @@ read_pipe_stats(struct rte_eth_dev *dev, /* 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; } @@ -3222,8 +3222,8 @@ read_tc_stats(struct rte_eth_dev *dev, /* 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; } @@ -3281,8 +3281,8 @@ read_queue_stats(struct rte_eth_dev *dev, /* 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; diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 74215857ba..bcf62fbf53 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -3237,11 +3237,11 @@ parse_table_action_meter_tc(char **tokens, 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") || - 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") || - parse_policer_action(tokens[8], &mtr->policer[e_RTE_METER_RED])) + parse_policer_action(tokens[8], &mtr->policer[RTE_COLOR_RED])) return 0; return 9; @@ -4949,11 +4949,11 @@ table_rule_show(const char *pipeline_name, 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 = - p->policer[e_RTE_METER_YELLOW]; + p->policer[RTE_COLOR_YELLOW]; 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, @@ -5646,7 +5646,7 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table, for (dscp = 0, l = 1; ; l++) { char line[64]; char *tokens[3]; - enum rte_meter_color color; + enum rte_color color; uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens); if (fgets(line, sizeof(line), f) == NULL) @@ -5679,17 +5679,17 @@ load_dscp_table(struct rte_table_action_dscp_table *dscp_table, switch (tokens[2][0]) { case 'g': case 'G': - color = e_RTE_METER_GREEN; + color = RTE_COLOR_GREEN; break; case 'y': case 'Y': - color = e_RTE_METER_YELLOW; + color = RTE_COLOR_YELLOW; break; case 'r': case 'R': - color = e_RTE_METER_RED; + color = RTE_COLOR_RED; break; default: diff --git a/examples/qos_meter/main.h b/examples/qos_meter/main.h index f51eb664eb..ab20151eb6 100644 --- a/examples/qos_meter/main.h +++ b/examples/qos_meter/main.h @@ -6,13 +6,13 @@ #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}, diff --git a/examples/qos_meter/rte_policer.c b/examples/qos_meter/rte_policer.c index 58c13ec676..10d5fe8a4b 100644 --- a/examples/qos_meter/rte_policer.c +++ b/examples/qos_meter/rte_policer.c @@ -7,7 +7,7 @@ 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; @@ -16,7 +16,7 @@ rte_phb_config(struct rte_phb *phb_table, uint32_t phb_table_index, return -1; } - 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)) { return -2; } diff --git a/examples/qos_meter/rte_policer.h b/examples/qos_meter/rte_policer.h index 532a853ddd..95efe5b857 100644 --- a/examples/qos_meter/rte_policer.h +++ b/examples/qos_meter/rte_policer.h @@ -9,22 +9,22 @@ #include 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 { - 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, - 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 -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]; diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c index bec4deee3f..e14b275e3d 100644 --- a/examples/qos_sched/app_thread.c +++ b/examples/qos_sched/app_thread.c @@ -77,7 +77,7 @@ app_rx_thread(struct thread_conf **confs) 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, diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index d198de6420..76ffffc4b6 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -64,7 +64,7 @@ cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params 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) @@ -80,7 +80,7 @@ cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params 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) @@ -96,7 +96,7 @@ cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params 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); @@ -113,7 +113,7 @@ cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params 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) diff --git a/lib/librte_ethdev/rte_mtr.c b/lib/librte_ethdev/rte_mtr.c index 1046cb5fd8..12b8154061 100644 --- a/lib/librte_ethdev/rte_mtr.c +++ b/lib/librte_ethdev/rte_mtr.c @@ -153,7 +153,7 @@ rte_mtr_meter_profile_update(uint16_t port_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]; diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h index c667f87e19..88f1301ceb 100644 --- a/lib/librte_ethdev/rte_mtr.h +++ b/lib/librte_ethdev/rte_mtr.h @@ -82,13 +82,6 @@ extern "C" { #endif -/* 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 */ @@ -123,10 +116,10 @@ enum rte_mtr_stats_type { */ 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). */ - 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; @@ -258,7 +251,7 @@ struct rte_mtr_params { * 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 @@ -268,7 +261,7 @@ struct rte_mtr_params { 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 @@ -634,7 +627,7 @@ rte_mtr_meter_profile_update(uint16_t port_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); /** diff --git a/lib/librte_ethdev/rte_mtr_driver.h b/lib/librte_ethdev/rte_mtr_driver.h index c9a6d7c38e..3ec7ffa2a5 100644 --- a/lib/librte_ethdev/rte_mtr_driver.h +++ b/lib/librte_ethdev/rte_mtr_driver.h @@ -70,7 +70,7 @@ typedef int (*rte_mtr_meter_profile_update_t)(struct rte_eth_dev *dev, 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 */ diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h index c4a788b859..ea5493870d 100644 --- a/lib/librte_ethdev/rte_tm.h +++ b/lib/librte_ethdev/rte_tm.h @@ -116,13 +116,6 @@ extern "C" { */ #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 */ @@ -177,12 +170,12 @@ struct rte_tm_node_stats { /** 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. */ - 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. @@ -433,16 +426,16 @@ struct rte_tm_capabilities { 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). */ - 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). */ - 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). */ - 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 @@ -859,7 +852,7 @@ struct rte_tm_red_params { */ 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* diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile index 2dc071e8ec..79ad79744f 100644 --- a/lib/librte_meter/Makefile +++ b/lib/librte_meter/Makefile @@ -16,7 +16,7 @@ LDLIBS += -lrte_eal EXPORT_MAP := rte_meter_version.map -LIBABIVER := 2 +LIBABIVER := 3 # # all source are stored in SRCS-y diff --git a/lib/librte_meter/meson.build b/lib/librte_meter/meson.build index 947bc19e25..422123e203 100644 --- a/lib/librte_meter/meson.build +++ b/lib/librte_meter/meson.build @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -version = 2 +version = 3 sources = files('rte_meter.c') headers = files('rte_meter.h') diff --git a/lib/librte_meter/rte_meter.h b/lib/librte_meter/rte_meter.h index 005e4eeee6..3e383d2e8c 100644 --- a/lib/librte_meter/rte_meter.h +++ b/lib/librte_meter/rte_meter.h @@ -40,13 +40,6 @@ enum rte_color { 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. */ @@ -211,7 +204,7 @@ rte_meter_trtcm_rfc4115_config(struct rte_meter_trtcm_rfc4115 *m, * @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, @@ -233,12 +226,12 @@ rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m, * @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, - enum rte_meter_color pkt_color); + enum rte_color pkt_color); /** * trTCM color blind traffic metering @@ -254,7 +247,7 @@ rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m, * @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, @@ -276,12 +269,12 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m, * @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, - enum rte_meter_color pkt_color); + enum rte_color pkt_color); /** * @warning @@ -300,7 +293,7 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m, * @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, @@ -326,13 +319,13 @@ rte_meter_trtcm_rfc4115_color_blind_check( * @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, - enum rte_meter_color pkt_color); + enum rte_color pkt_color); /* * Inline implementation of run-time methods @@ -417,7 +410,7 @@ struct rte_meter_trtcm_rfc4115 { /**< 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, @@ -444,26 +437,26 @@ rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m, 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; - return e_RTE_METER_YELLOW; + return RTE_COLOR_YELLOW; } m->tc = tc; m->te = te; - return e_RTE_METER_RED; + return RTE_COLOR_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, - enum rte_meter_color pkt_color) + enum rte_color pkt_color) { uint64_t time_diff, n_periods, tc, te; @@ -483,24 +476,24 @@ rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m, } /* 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; - 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; - return e_RTE_METER_YELLOW; + return RTE_COLOR_YELLOW; } m->tc = tc; m->te = te; - return e_RTE_METER_RED; + return RTE_COLOR_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, @@ -528,26 +521,26 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m, if (tp < pkt_len) { m->tc = tc; m->tp = tp; - return e_RTE_METER_RED; + return RTE_COLOR_RED; } 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; - 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, - 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; @@ -568,24 +561,24 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m, tp = p->pbs; /* Color logic */ - if ((pkt_color == e_RTE_METER_RED) || (tp < pkt_len)) { + if ((pkt_color == RTE_COLOR_RED) || (tp < pkt_len)) { m->tc = tc; m->tp = tp; - return e_RTE_METER_RED; + return RTE_COLOR_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; - return e_RTE_METER_YELLOW; + return RTE_COLOR_YELLOW; } 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, @@ -614,27 +607,27 @@ rte_meter_trtcm_rfc4115_color_blind_check( 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; - return e_RTE_METER_YELLOW; + return RTE_COLOR_YELLOW; } /* If we end up here the color is RED */ m->tc = tc; m->te = te; - return e_RTE_METER_RED; + return RTE_COLOR_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, - 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; @@ -655,22 +648,22 @@ rte_meter_trtcm_rfc4115_color_aware_check( 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; - 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; - return e_RTE_METER_YELLOW; + return RTE_COLOR_YELLOW; } /* If we end up here the color is RED */ m->tc = tc; m->te = te; - return e_RTE_METER_RED; + return RTE_COLOR_RED; } diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 6712bb6975..9a65f3dedf 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -109,29 +109,29 @@ mtr_cfg_check(struct rte_table_action_mtr_config *mtr) 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) \ - (((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) { - 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)\ - ((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, - enum rte_meter_color color, + enum rte_color color, enum rte_table_action_policer action) { if (action == RTE_TABLE_ACTION_POLICER_DROP) { @@ -144,14 +144,14 @@ mtr_trtcm_data_policer_action_set(struct mtr_trtcm_data *data, static uint64_t mtr_trtcm_data_stats_get(struct mtr_trtcm_data *data, - enum rte_meter_color color) + enum rte_color color) { return data->stats[color] >> 8; } static void mtr_trtcm_data_stats_reset(struct mtr_trtcm_data *data, - enum rte_meter_color color) + enum rte_color color) { data->stats[color] &= 0xFFLU; } @@ -166,7 +166,7 @@ mtr_data_size(struct rte_table_action_mtr_config *mtr) } struct dscp_table_entry_data { - enum rte_meter_color color; + enum rte_color color; uint16_t tc; uint16_t tc_queue; }; @@ -287,16 +287,16 @@ mtr_apply(struct mtr_trtcm_data *data, /* 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, - 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, - e_RTE_METER_RED, - p_tc->policer[e_RTE_METER_RED]); + RTE_COLOR_RED, + p_tc->policer[RTE_COLOR_RED]); } return 0; @@ -313,7 +313,7 @@ pkt_work_mtr(struct rte_mbuf *mbuf, { 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; @@ -2731,14 +2731,14 @@ rte_table_action_meter_read(struct rte_table_action *action, 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; @@ -2755,9 +2755,9 @@ rte_table_action_meter_read(struct rte_table_action *action, 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); } diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index 53d16af8a9..e77551c100 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -202,7 +202,7 @@ struct rte_table_action_dscp_table_entry { /** 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; + enum rte_color color; }; /** DSCP translation table. */ @@ -259,7 +259,7 @@ struct rte_table_action_mtr_tc_params { 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. */ @@ -268,13 +268,13 @@ struct rte_table_action_mtr_counters_tc { * 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. */ - 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; diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 77aed9fb28..a60ddf97eb 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -177,7 +177,7 @@ struct rte_sched_port { 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]; #endif /* Timing */ @@ -642,7 +642,7 @@ rte_sched_port_config(struct rte_sched_port_params *params) 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) { @@ -1015,7 +1015,7 @@ 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) { uint32_t queue_id = rte_sched_port_qindex(port, subport, pipe, traffic_class, queue); @@ -1037,10 +1037,10 @@ rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port, *queue = queue_id & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1); } -enum rte_meter_color +enum rte_color 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); } int @@ -1188,7 +1188,7 @@ rte_sched_port_red_drop(struct rte_sched_port *port, struct rte_mbuf *pkt, uint3 struct rte_red_config *red_cfg; struct rte_red *red; uint32_t tc_index; - enum rte_meter_color color; + enum rte_color color; tc_index = (qindex >> 2) & 0x3; color = rte_sched_port_pkt_read_color(pkt); diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index 243efa1d4e..904d09d88c 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -205,7 +205,7 @@ struct rte_sched_port_params { * 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 */ #endif }; @@ -374,7 +374,7 @@ void 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 @@ -402,7 +402,7 @@ rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue); -enum rte_meter_color +enum rte_color rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt); /** -- 2.20.1