diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2018-10-22 15:46:23 +0200 |
---|---|---|
committer | Deepak S <deepak.s@linux.intel.com> | 2018-11-01 04:38:27 +0530 |
commit | ade1ef11e0c54bb782bea863721964c53024c8ea (patch) | |
tree | a4b3a0a7b702b31d09b51990b8eb74b4618bd7c1 | |
parent | 406fcc1e4b6ae368f3550abe4a187f73d797bcfa (diff) |
Add support for counting non dataplane related packets
When performing some zero packet loss performance testing on dataplane, it
is important (not) to count non dataplane packets. For instance, one might
receive uexpected packets from a switch, or ARP packets. Or one might need
to transmit ARP packets. Such packets should not be counted as dataplane
packets as for thse packets there is no 1:1 mapping between transmitted
packets and received packets.
To support this, the counters reporting numbers of transmitted and received
packets remain unchanged but two new counters have been added to PROX,
counting respectively number of received and number of transmitted
non-dataplane packets.
On RX side, packets are counsidered as non-dataplane if being ARP or if
they do not countain the proper signature
On TX side, ARP packets are not considered as dataplane packets.
This feature requires configuration of signature.
"dp core stats" command has been added
Change-Id: I98e113cd02f36d540383d343a433592867ad86a9
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
-rw-r--r-- | VNFs/DPPD-PROX/cmd_parser.c | 34 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/display_tasks.c | 18 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/handle_lat.c | 11 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/packet_utils.c | 1 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/rx_pkt.c | 4 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/stats_parser.c | 19 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/stats_task.c | 16 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/stats_task.h | 16 |
8 files changed, 114 insertions, 5 deletions
diff --git a/VNFs/DPPD-PROX/cmd_parser.c b/VNFs/DPPD-PROX/cmd_parser.c index b9817381..a1d101f8 100644 --- a/VNFs/DPPD-PROX/cmd_parser.c +++ b/VNFs/DPPD-PROX/cmd_parser.c @@ -1656,6 +1656,39 @@ static int parse_cmd_core_stats(const char *str, struct input *input) return 0; } +static int parse_cmd_dp_core_stats(const char *str, struct input *input) +{ + unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores; + + if (parse_core_task(str, lcores, &task_id, &nb_cores)) + return -1; + + if (cores_task_are_valid(lcores, task_id, nb_cores)) { + for (unsigned int i = 0; i < nb_cores; i++) { + lcore_id = lcores[i]; + uint64_t tot_rx = stats_core_task_tot_rx(lcore_id, task_id); + uint64_t tot_tx = stats_core_task_tot_tx(lcore_id, task_id); + uint64_t tot_rx_non_dp = stats_core_task_tot_rx_non_dp(lcore_id, task_id); + uint64_t tot_tx_non_dp = stats_core_task_tot_tx_non_dp(lcore_id, task_id); + uint64_t tot_drop = stats_core_task_tot_drop(lcore_id, task_id); + uint64_t last_tsc = stats_core_task_last_tsc(lcore_id, task_id); + + if (input->reply) { + char buf[128]; + snprintf(buf, sizeof(buf), + "%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64"\n", + tot_rx, tot_tx, tot_rx_non_dp, tot_tx_non_dp, tot_drop, last_tsc, rte_get_tsc_hz()); + input->reply(input, buf, strlen(buf)); + } + else { + plog_info("RX: %"PRIu64", TX: %"PRIu64", RX_NON_DP: %"PRIu64", TX_NON_DP: %"PRIu64", DROP: %"PRIu64"\n", + tot_rx, tot_tx, tot_rx_non_dp, tot_tx_non_dp, tot_drop); + } + } + } + return 0; +} + static int parse_cmd_lat_stats(const char *str, struct input *input) { unsigned lcores[RTE_MAX_LCORE], lcore_id, task_id, nb_cores; @@ -1975,6 +2008,7 @@ static struct cmd_str cmd_strings[] = { {"lat packets", "<core id> <task id>", "Print the latency for each of the last set of packets", parse_cmd_lat_packets}, {"accuracy limit", "<core id> <task id> <nsec>", "Only consider latency of packets that were measured with an error no more than <nsec>", parse_cmd_accuracy}, {"core stats", "<core id> <task id>", "Print rx/tx/drop for task <task id> running on core <core id>", parse_cmd_core_stats}, + {"dp core stats", "<core id> <task id>", "Print rx/tx/non_dp_rx/non_dp_tx/drop for task <task id> running on core <core id>", parse_cmd_dp_core_stats}, {"port_stats", "<port id>", "Print rate for no_mbufs, ierrors + imissed, rx_bytes, tx_bytes, rx_pkts, tx_pkts; totals for RX, TX, no_mbufs, ierrors + imissed for port <port id>", parse_cmd_port_stats}, {"multi port stats", "<port list>", "Get stats for multiple ports, semi-colon separated: port id, total for rx_pkts, tx_pkts, no_mbufs, ierrors + imissed, last_tsc", parse_cmd_multi_port_stats}, {"read reg", "", "Read register", parse_cmd_read_reg}, diff --git a/VNFs/DPPD-PROX/display_tasks.c b/VNFs/DPPD-PROX/display_tasks.c index 75075a10..f7520092 100644 --- a/VNFs/DPPD-PROX/display_tasks.c +++ b/VNFs/DPPD-PROX/display_tasks.c @@ -56,6 +56,8 @@ static struct display_column *class_col; static struct display_column *mbm_tot_col; static struct display_column *mbm_loc_col; static struct display_column *frac_col; +static struct display_column *rx_non_dp_col; +static struct display_column *tx_non_dp_col; static void stats_display_core_task_entry(struct lcore_cfg *lconf, struct task_args *targ, unsigned row) { @@ -115,6 +117,12 @@ static void display_tasks_draw_frame(struct screen_state *state) handled_col = display_table_add_col(stats); display_column_init(handled_col, "Handled (K)", 9); + rx_non_dp_col = display_table_add_col(stats); + display_column_init(rx_non_dp_col, "Rx non DP (K)", 9); + + tx_non_dp_col = display_table_add_col(stats); + display_column_init(tx_non_dp_col, "Tx non DP (K)", 9); + if (stats_cpu_freq_enabled()) { struct display_table *other = display_page_add_table(&display_page_tasks); @@ -151,6 +159,12 @@ static void display_tasks_draw_frame(struct screen_state *state) handled_col = display_table_add_col(stats); display_column_init(handled_col, "Handled (K)", 14); + rx_non_dp_col = display_table_add_col(stats); + display_column_init(rx_non_dp_col, "RX non DP (K)", 14); + + tx_non_dp_col = display_table_add_col(stats); + display_column_init(tx_non_dp_col, "TX non DP (K)", 14); + if (stats_cmt_enabled()) { struct display_table *other = display_page_add_table(&display_page_tasks); @@ -231,6 +245,8 @@ static void display_core_task_stats_per_sec(const struct task_stats_disp *t, str print_kpps(tx_fail_col, row, last->drop_tx_fail - prev->drop_tx_fail, delta_t); print_kpps(discard_col, row, last->drop_discard - prev->drop_discard, delta_t); print_kpps(handled_col, row, last->drop_handled - prev->drop_handled, delta_t); + print_kpps(rx_non_dp_col, row, last->rx_non_dp - prev->rx_non_dp, delta_t); + print_kpps(tx_non_dp_col, row, last->tx_non_dp - prev->tx_non_dp, delta_t); if (stats_cpu_freq_enabled()) { uint8_t lcore_stat_id = t->lcore_stat_id; @@ -285,6 +301,8 @@ static void display_core_task_stats_tot(const struct task_stats_disp *t, struct display_column_print(tx_fail_col, row, "%lu", ts->tot_drop_tx_fail); display_column_print(discard_col, row, "%lu", ts->tot_drop_discard); display_column_print(handled_col, row, "%lu", ts->tot_drop_handled); + display_column_print(rx_non_dp_col, row, "%lu", ts->tot_rx_non_dp); + display_column_print(tx_non_dp_col, row, "%lu", ts->tot_tx_non_dp); if (stats_cmt_enabled()) { struct lcore_stats *c = stats_get_lcore_stats(t->lcore_stat_id); diff --git a/VNFs/DPPD-PROX/handle_lat.c b/VNFs/DPPD-PROX/handle_lat.c index 8285686b..a0e5fb42 100644 --- a/VNFs/DPPD-PROX/handle_lat.c +++ b/VNFs/DPPD-PROX/handle_lat.c @@ -527,6 +527,7 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin task_lat_update_lat_test(task); // Remember those packets with bad length or bad signature + uint32_t non_dp_count = 0; uint64_t pkt_bad_len_sig[(MAX_RX_PKT_ALL + 63) / 64]; #define BIT64_SET(a64, bit) a64[bit / 64] |= (((uint64_t)1) << (bit & 63)) #define BIT64_CLR(a64, bit) a64[bit / 64] &= ~(((uint64_t)1) << (bit & 63)) @@ -540,9 +541,10 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin task->rx_pkt_meta[j].hdr = rte_pktmbuf_mtod(mbuf, uint8_t *); // Remember those packets which are too short to hold the values that we expect - if (unlikely(rte_pktmbuf_pkt_len(mbuf) < task->min_pkt_len)) + if (unlikely(rte_pktmbuf_pkt_len(mbuf) < task->min_pkt_len)) { BIT64_SET(pkt_bad_len_sig, j); - else + non_dp_count++; + } else BIT64_CLR(pkt_bad_len_sig, j); } @@ -553,8 +555,10 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin // Remember those packets with bad signature if (likely(*(uint32_t *)(task->rx_pkt_meta[j].hdr + task->sig_pos) == task->sig)) task->rx_pkt_meta[j].pkt_tx_time = *(uint32_t *)(task->rx_pkt_meta[j].hdr + task->lat_pos); - else + else { BIT64_SET(pkt_bad_len_sig, j); + non_dp_count++; + } } } else { for (uint16_t j = 0; j < n_pkts; ++j) { @@ -584,6 +588,7 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin rx_time_err = pkt_rx_time64 - (task->begin >> LATENCY_ACCURACY); } + TASK_STATS_ADD_RX_NON_DP(&tbase->aux->stats, non_dp_count); for (uint16_t j = 0; j < n_pkts; ++j) { // Used to display % of packets within accuracy limit vs. total number of packets (used_col) task->lat_test->tot_all_pkts++; diff --git a/VNFs/DPPD-PROX/packet_utils.c b/VNFs/DPPD-PROX/packet_utils.c index 9e5bcde4..9d170949 100644 --- a/VNFs/DPPD-PROX/packet_utils.c +++ b/VNFs/DPPD-PROX/packet_utils.c @@ -266,6 +266,7 @@ void handle_ctrl_plane_pkts(struct task_base *tbase, struct rte_mbuf **mbufs, ui break; case ARP_REPLY_FROM_CTRL: case ARP_REQ_FROM_CTRL: + TASK_STATS_ADD_TX_NON_DP(&tbase->aux->stats, 1); out[0] = 0; tbase->aux->tx_pkt_l2(tbase, &mbufs[j], 1, out); break; diff --git a/VNFs/DPPD-PROX/rx_pkt.c b/VNFs/DPPD-PROX/rx_pkt.c index f6adeb4b..2571b8a4 100644 --- a/VNFs/DPPD-PROX/rx_pkt.c +++ b/VNFs/DPPD-PROX/rx_pkt.c @@ -145,7 +145,7 @@ static uint16_t rx_pkt_hw_param(struct task_base *tbase, struct rte_mbuf ***mbuf } if (skip) - TASK_STATS_ADD_DROP_HANDLED(&tbase->aux->stats, skip); + TASK_STATS_ADD_RX_NON_DP(&tbase->aux->stats, skip); if (likely(nb_rx > 0)) { TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx - skip; @@ -201,7 +201,7 @@ static inline uint16_t rx_pkt_hw1_param(struct task_base *tbase, struct rte_mbuf } if (skip) - TASK_STATS_ADD_DROP_HANDLED(&tbase->aux->stats, skip); + TASK_STATS_ADD_RX_NON_DP(&tbase->aux->stats, skip); if (likely(nb_rx > 0)) { TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx - skip; diff --git a/VNFs/DPPD-PROX/stats_parser.c b/VNFs/DPPD-PROX/stats_parser.c index 37e1781b..73db5010 100644 --- a/VNFs/DPPD-PROX/stats_parser.c +++ b/VNFs/DPPD-PROX/stats_parser.c @@ -149,6 +149,23 @@ static uint64_t sp_task_drop_handled(int argc, const char *argv[]) return stats_get_task_stats_sample(c, t, 1)->drop_handled; } +static uint64_t sp_task_rx_non_dp(int argc, const char *argv[]) +{ + struct task_stats_sample *last; + uint32_t c, t; + if (args_to_core_task(argv[0], argv[1], &c, &t)) + return -1; + return stats_get_task_stats_sample(c, t, 1)->rx_non_dp; +} + +static uint64_t sp_task_tx_non_dp(int argc, const char *argv[]) +{ + struct task_stats_sample *last; + uint32_t c, t; + if (args_to_core_task(argv[0], argv[1], &c, &t)) + return -1; + return stats_get_task_stats_sample(c, t, 1)->tx_non_dp; +} static uint64_t sp_task_rx_bytes(int argc, const char *argv[]) { return -1; @@ -790,6 +807,8 @@ struct stats_path_str stats_paths[] = { {"task.core(#).task(#).rx_prio(#)", sp_task_rx_prio}, {"task.core(#).task(#).max_irq", sp_task_max_irq}, {"task.core(#).task(#).irq(#)", sp_task_irq}, + {"task.core(#).task(#).rx_non_dp", sp_task_rx_non_dp}, + {"task.core(#).task(#).tx_non_dp", sp_task_tx_non_dp}, {"port(#).no_mbufs", sp_port_no_mbufs}, {"port(#).ierrors", sp_port_ierrors}, diff --git a/VNFs/DPPD-PROX/stats_task.c b/VNFs/DPPD-PROX/stats_task.c index 6b4dc2dd..2aed7720 100644 --- a/VNFs/DPPD-PROX/stats_task.c +++ b/VNFs/DPPD-PROX/stats_task.c @@ -58,6 +58,8 @@ void stats_task_reset(void) cur_task_stats->tot_drop_tx_fail = 0; cur_task_stats->tot_drop_discard = 0; cur_task_stats->tot_drop_handled = 0; + cur_task_stats->tot_rx_non_dp = 0; + cur_task_stats->tot_tx_non_dp = 0; } } @@ -78,6 +80,16 @@ uint64_t stats_core_task_tot_drop(uint8_t lcore_id, uint8_t task_id) lcore_task_stats_all[lcore_id].task_stats[task_id].tot_drop_handled; } +uint64_t stats_core_task_tot_tx_non_dp(uint8_t lcore_id, uint8_t task_id) +{ + return lcore_task_stats_all[lcore_id].task_stats[task_id].tot_tx_non_dp; +} + +uint64_t stats_core_task_tot_rx_non_dp(uint8_t lcore_id, uint8_t task_id) +{ + return lcore_task_stats_all[lcore_id].task_stats[task_id].tot_rx_non_dp; +} + uint64_t stats_core_task_last_tsc(uint8_t lcore_id, uint8_t task_id) { return lcore_task_stats_all[lcore_id].task_stats[task_id].sample[last_stat].tsc; @@ -102,6 +114,8 @@ void stats_task_post_proc(void) cur_task_stats->tot_drop_tx_fail += last->drop_tx_fail - prev->drop_tx_fail; cur_task_stats->tot_drop_discard += last->drop_discard - prev->drop_discard; cur_task_stats->tot_drop_handled += last->drop_handled - prev->drop_handled; + cur_task_stats->tot_rx_non_dp += last->rx_non_dp - prev->rx_non_dp; + cur_task_stats->tot_tx_non_dp += last->tx_non_dp - prev->tx_non_dp; } } @@ -127,6 +141,8 @@ void stats_task_update(void) last->tx_bytes = stats->tx_bytes; last->rx_bytes = stats->rx_bytes; last->drop_bytes = stats->drop_bytes; + last->rx_non_dp = stats->rx_non_dp; + last->tx_non_dp = stats->tx_non_dp; after = rte_rdtsc(); last->tsc = (before >> 1) + (after >> 1); } diff --git a/VNFs/DPPD-PROX/stats_task.h b/VNFs/DPPD-PROX/stats_task.h index 156eb326..362b718c 100644 --- a/VNFs/DPPD-PROX/stats_task.h +++ b/VNFs/DPPD-PROX/stats_task.h @@ -45,6 +45,8 @@ struct task_rt_stats { uint64_t rx_bytes; uint64_t tx_bytes; uint64_t drop_bytes; + uint64_t rx_non_dp; + uint64_t tx_non_dp; } __attribute__((packed)) __rte_cache_aligned; #ifdef PROX_STATS @@ -72,6 +74,14 @@ struct task_rt_stats { (stats)->rx_pkt_count += ntx; \ } while (0) \ +#define TASK_STATS_ADD_RX_NON_DP(stats, ntx) do { \ + (stats)->rx_non_dp += ntx; \ + } while(0) + +#define TASK_STATS_ADD_TX_NON_DP(stats, ntx) do { \ + (stats)->tx_non_dp += ntx; \ + } while(0) + #define TASK_STATS_ADD_RX_BYTES(stats, bytes) do { \ (stats)->rx_bytes += bytes; \ } while (0) \ @@ -109,6 +119,8 @@ struct task_stats_sample { uint64_t rx_bytes; uint64_t tx_bytes; uint64_t drop_bytes; + uint64_t rx_non_dp; + uint64_t tx_non_dp; }; struct task_stats { @@ -117,6 +129,8 @@ struct task_stats { uint64_t tot_drop_discard; uint64_t tot_drop_handled; uint64_t tot_rx_pkt_count; + uint64_t tot_tx_non_dp; + uint64_t tot_rx_non_dp; struct task_stats_sample sample[2]; @@ -141,5 +155,7 @@ uint64_t stats_core_task_tot_rx(uint8_t lcore_id, uint8_t task_id); uint64_t stats_core_task_tot_tx(uint8_t lcore_id, uint8_t task_id); uint64_t stats_core_task_tot_drop(uint8_t lcore_id, uint8_t task_id); uint64_t stats_core_task_last_tsc(uint8_t lcore_id, uint8_t task_id); +uint64_t stats_core_task_tot_rx_non_dp(uint8_t lcore_id, uint8_t task_id); +uint64_t stats_core_task_tot_tx_non_dp(uint8_t lcore_id, uint8_t task_id); #endif /* _STATS_TASK_H_ */ |