meter: replace color definitions with rte_color values
Subsystems (2)
PATCH 1/1 meter: replace color definitions with rte_color values
This patch implements the changes proposed in the deprecation note[1].
Replace mulitple 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.
[1] https://mails.dpdk.org/archives/dev/2019-January/123861.html
--- 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 | 6 +- 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 +- lib/librte_ethdev/rte_mtr.c | 2 +- lib/librte_ethdev/rte_mtr.h | 10 +- lib/librte_ethdev/rte_mtr_driver.h | 2 +- lib/librte_ethdev/rte_tm.h | 14 +-- 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 +- 27 files changed, 283 insertions(+), 291 deletions(-)
app/proc-info/main.c +18 -18
@@ -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]); } }
app/test-pmd/cmdline_mtr.c +23 -23
132 lines not on this page · raw message
app/test-pmd/cmdline_tm.c +11 -11
@@ -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;
app/test/test_meter.c +63 -63
276 lines not on this page · raw message
app/test/test_sched.c +3 -3
@@ -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);
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -68,10 +68,5 @@ Deprecation Notices - Member ``uint16_t min_mtu`` the minimum MTU allowed. - Member ``uint16_t max_mtu`` the maximum MTU allowed. -* 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. - * crypto/aesni_mb: the minimum supported intel-ipsec-mb library version will be changed from 0.49.0 to 0.52.0.
doc/guides/rel_notes/release_19_05.rst +5 -1
@@ -134,6 +134,10 @@ API Changes Also, make sure to start the actual text at the margin. ========================================================= +* 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. ABI Changes -----------
@@ -207,7 +211,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
drivers/net/softnic/rte_eth_softnic_cli.c +7 -7
@@ -3550,11 +3550,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 ;
@@ -5384,7 +5384,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 )
@@ -5417,17 +5417,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 :
drivers/net/softnic/rte_eth_softnic_flow.c +6 -6
@@ -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 ;
drivers/net/softnic/rte_eth_softnic_meter.c +13 -13
@@ -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];
drivers/net/softnic/rte_eth_softnic_tm.c +14 -14
@@ -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;
examples/ip_pipeline/cli.c +10 -10
@@ -3233,11 +3233,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 ;
@@ -4907,11 +4907,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,
@@ -5604,7 +5604,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 )
@@ -5637,17 +5637,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 :
examples/qos_meter/main.h +5 -5
@@ -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 },
examples/qos_meter/rte_policer.c +2 -2
@@ -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 ; }
examples/qos_meter/rte_policer.h +6 -6
@@ -9,22 +9,22 @@#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 { -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];
examples/qos_sched/app_thread.c +1 -1
@@ -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,
lib/librte_ethdev/rte_mtr.c +1 -1
@@ -153,7 +153,7 @@ rte_mtr_meter_profile_update(uint16_t port_id, int __rte_experimentalrte_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];
lib/librte_ethdev/rte_mtr.h +5 -5
@@ -123,10 +123,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 +258,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 +268,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 +634,7 @@ rte_mtr_meter_profile_update(uint16_t port_id, int __rte_experimentalrte_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);/**
lib/librte_ethdev/rte_mtr_driver.h +1 -1
@@ -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 */
lib/librte_ethdev/rte_tm.h +7 -7
@@ -177,12 +177,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 +433,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 +859,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*
lib/librte_meter/Makefile +1 -1
@@ -16,7 +16,7 @@ LDLIBS += -lrte_eal EXPORT_MAP := rte_meter_version.map -LIBABIVER := 2 +LIBABIVER := 3 # # all source are stored in SRCS-y
lib/librte_meter/meson.build +1 -1
@@ -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')
lib/librte_meter/rte_meter.h +42 -49
269 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.c +25 -25
121 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +4 -4
@@ -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;
lib/librte_sched/rte_sched.c +6 -6
@@ -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, uint3struct 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);
lib/librte_sched/rte_sched.h +3 -3
@@ -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);/**
Signature · 1 line
2.17.1
PATCH v2 1/1 meter: replace color definitions with rte_color values
This patch implements the changes proposed in the deprecation note[1].
Replace mulitple 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.
[1] https://mails.dpdk.org/archives/dev/2019-January/123861.html
---
v2:
- rebase to latest dpdk head
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 +- lib/librte_ethdev/rte_mtr.c | 2 +- lib/librte_ethdev/rte_mtr.h | 10 +- lib/librte_ethdev/rte_mtr_driver.h | 2 +- lib/librte_ethdev/rte_tm.h | 14 +-- 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 +- 27 files changed, 284 insertions(+), 291 deletions(-)
app/proc-info/main.c +18 -18
@@ -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]); } }
app/test-pmd/cmdline_mtr.c +23 -23
132 lines not on this page · raw message
app/test-pmd/cmdline_tm.c +11 -11
@@ -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;
app/test/test_meter.c +63 -63
276 lines not on this page · raw message
app/test/test_sched.c +3 -3
@@ -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);
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -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,
doc/guides/rel_notes/release_19_05.rst +6 -1
@@ -172,6 +172,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.
@@ -257,7 +262,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
drivers/net/softnic/rte_eth_softnic_cli.c +7 -7
@@ -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 :
drivers/net/softnic/rte_eth_softnic_flow.c +6 -6
@@ -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 ;
drivers/net/softnic/rte_eth_softnic_meter.c +13 -13
@@ -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];
drivers/net/softnic/rte_eth_softnic_tm.c +14 -14
@@ -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;
examples/ip_pipeline/cli.c +10 -10
@@ -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 :
examples/qos_meter/main.h +5 -5
@@ -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 },
examples/qos_meter/rte_policer.c +2 -2
@@ -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 ; }
examples/qos_meter/rte_policer.h +6 -6
@@ -9,22 +9,22 @@#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 { -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];
examples/qos_sched/app_thread.c +1 -1
@@ -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,
lib/librte_ethdev/rte_mtr.c +1 -1
@@ -153,7 +153,7 @@ rte_mtr_meter_profile_update(uint16_t port_id, int __rte_experimentalrte_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];
lib/librte_ethdev/rte_mtr.h +5 -5
@@ -123,10 +123,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 +258,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 +268,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 +634,7 @@ rte_mtr_meter_profile_update(uint16_t port_id, int __rte_experimentalrte_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);/**
lib/librte_ethdev/rte_mtr_driver.h +1 -1
@@ -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 */
lib/librte_ethdev/rte_tm.h +7 -7
@@ -177,12 +177,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 +433,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 +859,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*
lib/librte_meter/Makefile +1 -1
@@ -16,7 +16,7 @@ LDLIBS += -lrte_eal EXPORT_MAP := rte_meter_version.map -LIBABIVER := 2 +LIBABIVER := 3 # # all source are stored in SRCS-y
lib/librte_meter/meson.build +1 -1
@@ -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')
lib/librte_meter/rte_meter.h +42 -49
269 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.c +25 -25
121 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +4 -4
@@ -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;
lib/librte_sched/rte_sched.c +6 -6
@@ -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, uint3struct 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);
lib/librte_sched/rte_sched.h +3 -3
@@ -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);/**
Signature · 1 line
2.17.1
PATCH v3 1/1 meter: replace color definitions with rte_color values
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
---
v3:
- fix commit message typo
v2:
- rebase to latest dpdk head
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 +- 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 +- 27 files changed, 284 insertions(+), 305 deletions(-)
app/proc-info/main.c +18 -18
@@ -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]); } }
app/test-pmd/cmdline_mtr.c +23 -23
132 lines not on this page · raw message
app/test-pmd/cmdline_tm.c +11 -11
@@ -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;
app/test/test_meter.c +63 -63
276 lines not on this page · raw message
app/test/test_sched.c +3 -3
@@ -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);
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -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,
doc/guides/rel_notes/release_19_05.rst +6 -1
@@ -172,6 +172,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.
@@ -257,7 +262,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
drivers/net/softnic/rte_eth_softnic_cli.c +7 -7
@@ -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 :
drivers/net/softnic/rte_eth_softnic_flow.c +6 -6
@@ -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 ;
drivers/net/softnic/rte_eth_softnic_meter.c +13 -13
@@ -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];
drivers/net/softnic/rte_eth_softnic_tm.c +14 -14
@@ -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;
examples/ip_pipeline/cli.c +10 -10
@@ -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 :
examples/qos_meter/main.h +5 -5
@@ -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 },
examples/qos_meter/rte_policer.c +2 -2
@@ -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 ; }
examples/qos_meter/rte_policer.h +6 -6
@@ -9,22 +9,22 @@#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 { -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];
examples/qos_sched/app_thread.c +1 -1
@@ -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,
lib/librte_ethdev/rte_mtr.c +1 -1
@@ -153,7 +153,7 @@ rte_mtr_meter_profile_update(uint16_t port_id, int __rte_experimentalrte_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];
lib/librte_ethdev/rte_mtr.h +5 -12
@@ -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_experimentalrte_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);/**
lib/librte_ethdev/rte_mtr_driver.h +1 -1
@@ -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 */
lib/librte_ethdev/rte_tm.h +7 -14
@@ -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*
lib/librte_meter/Makefile +1 -1
@@ -16,7 +16,7 @@ LDLIBS += -lrte_eal EXPORT_MAP := rte_meter_version.map -LIBABIVER := 2 +LIBABIVER := 3 # # all source are stored in SRCS-y
lib/librte_meter/meson.build +1 -1
@@ -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')
lib/librte_meter/rte_meter.h +42 -49
269 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.c +25 -25
121 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +4 -4
@@ -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;
lib/librte_sched/rte_sched.c +6 -6
@@ -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, uint3struct 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);
lib/librte_sched/rte_sched.h +3 -3
@@ -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);/**
Signature · 1 line
2.17.1
Quoted 19 lines
-----Original Message-----
From: Singh, Jasvinder
Sent: Friday, April 5, 2019 2:55 PM
To: [email protected]
Cc: Dumitrescu, Cristian <[email protected]>
Subject: [PATCH v3] meter: replace color definitions withrte_colorvaluesThis patch implements the changes proposed in the deprecation note[1]. Replace multiple color definitions in various places such as
rte_meter.h,rte_tm.handrte_mtr.hwith singlerte_colordefined inrte_meter.h.This is simple search and replace exercise without any implementation change.
[1] https://mails.dpdk.org/archives/dev/2019-January/123861.html
Quoted 8 lines
Signed-off-by Jasvinder Singh <[email protected]>---
v3:
- fix commit message typov2:
- rebase to latest dpdk head
Quoted 5 lines
Quoted 5 lines
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.handrte_mtr.hwith singlerte_colordefined inrte_meter.h.
Quoted 8 lines
Quoted 6 lines
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 <[email protected]>
There is a compilation failure:
examples/qos_sched/cfg_file.c:67:20: error:
use of undeclared identifier 'e_RTE_METER_COLORS'
for (k = 0; k < e_RTE_METER_COLORS; k++) {Quoted 22 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, April 10, 2019 10:20 PM
To: Singh, Jasvinder <[email protected]>
Cc: [email protected]; Dumitrescu, Cristian <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3] meter: replace color definitions withrte_colorvaluesQuoted 12 lines
Quoted 11 lines
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.handrte_mtr.hwith singlerte_colordefined inrte_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 <[email protected]>
Quoted 8 lines
Quoted 1 line
There is a compilation failure:
examples/qos_sched/cfg_file.c:67:20: error:
use of undeclared identifier 'e_RTE_METER_COLORS'for (k = 0; k < e_RTE_METER_COLORS; k++) {
Sent version 4 with fix. Thank you.
PATCH v4 1/1 meter: replace color definitions with rte_color values
In reply to Jasvinder SinghThis 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
---
v4:
- fix qos sample app compilation error
v3:
- fix commit message typo
v2:
- rebase to latest dpdk head
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(-)
app/proc-info/main.c +18 -18
@@ -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]); } }
app/test-pmd/cmdline_mtr.c +23 -23
132 lines not on this page · raw message
app/test-pmd/cmdline_tm.c +11 -11
@@ -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;
app/test/test_meter.c +63 -63
276 lines not on this page · raw message
app/test/test_sched.c +3 -3
@@ -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);
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -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,
doc/guides/rel_notes/release_19_05.rst +6 -1
@@ -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
drivers/net/softnic/rte_eth_softnic_cli.c +7 -7
@@ -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 :
drivers/net/softnic/rte_eth_softnic_flow.c +6 -6
@@ -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 ;
drivers/net/softnic/rte_eth_softnic_meter.c +13 -13
@@ -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];
drivers/net/softnic/rte_eth_softnic_tm.c +14 -14
@@ -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;
examples/ip_pipeline/cli.c +10 -10
@@ -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 :
examples/qos_meter/main.h +5 -5
@@ -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 },
examples/qos_meter/rte_policer.c +2 -2
@@ -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 ; }
examples/qos_meter/rte_policer.h +6 -6
@@ -9,22 +9,22 @@#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 { -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];
examples/qos_sched/app_thread.c +1 -1
@@ -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,
examples/qos_sched/cfg_file.c +4 -4
@@ -64,7 +64,7 @@ cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_paramschar *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_paramschar *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_paramschar *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_paramschar *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 )
lib/librte_ethdev/rte_mtr.c +1 -1
@@ -153,7 +153,7 @@ rte_mtr_meter_profile_update(uint16_t port_id, int __rte_experimentalrte_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];
lib/librte_ethdev/rte_mtr.h +5 -12
@@ -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_experimentalrte_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);/**
lib/librte_ethdev/rte_mtr_driver.h +1 -1
@@ -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 */
lib/librte_ethdev/rte_tm.h +7 -14
@@ -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*
lib/librte_meter/Makefile +1 -1
@@ -16,7 +16,7 @@ LDLIBS += -lrte_eal EXPORT_MAP := rte_meter_version.map -LIBABIVER := 2 +LIBABIVER := 3 # # all source are stored in SRCS-y
lib/librte_meter/meson.build +1 -1
@@ -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')
lib/librte_meter/rte_meter.h +42 -49
269 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.c +25 -25
121 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +4 -4
@@ -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;
lib/librte_sched/rte_sched.c +6 -6
@@ -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, uint3struct 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);
lib/librte_sched/rte_sched.h +3 -3
@@ -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);/**
Signature · 1 line
2.17.1
Thomas Monjalon
Applied11/04/2019 11:15, Jasvinder Singh:
Quoted 5 lines
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.handrte_mtr.hwith singlerte_colordefined inrte_meter.h.
Quoted 7 lines
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 <[email protected]>
Applied, thanks