From ace499fbbdd44cbb9c0d68d6aad40e0b280d54de Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Thu, 2 Jul 2020 10:02:40 +0200 Subject: Added support for reporting packet (mis)order. The "Latency" screen has been updated with 3 columns: - mis-ordered Count the number of mis-ordered packets. - extent: Gives an indication of how mis-ordered the packets are. Receiving packet "x - 5" after receiving packet "x" will cause an extent of 5. - duplicate: Count number of duplicate packets. Following commands have been added for the impair mode: - proba no drop: replaces the former "probability" command. Percentage of forwarded packets. So 99.5 means 0.5% of packet drop. - proba delay Percentage of delayed packets for the impair mode. - proba duplicate Percentage of duplicate packets. Similar parameters are supported within the config files: - proba no drop - proba delay - proba duplicate Note: it is recommanded to use the signature when measuring packet misorder, as otherwise unexpected packet would cause miscounts. Change-Id: I037f606f264d6e2bd7f123df5ed57ab7df8386d7 Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/handle_lat.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'VNFs/DPPD-PROX/handle_lat.c') diff --git a/VNFs/DPPD-PROX/handle_lat.c b/VNFs/DPPD-PROX/handle_lat.c index ef4da319..0c0e7b59 100644 --- a/VNFs/DPPD-PROX/handle_lat.c +++ b/VNFs/DPPD-PROX/handle_lat.c @@ -115,6 +115,7 @@ struct task_lat { FILE *fp_tx; struct prox_port_cfg *port; uint64_t *bytes_to_tsc; + uint64_t *previous_packet; }; /* This function calculate the difference between rx and tx_time * Both values are uint32_t (see handle_lat_bulk) @@ -440,6 +441,17 @@ static uint32_t task_lat_early_loss_detect(struct task_lat *task, uint32_t packe return early_loss_detect_add(eld, packet_id); } +static void lat_test_check_duplicate(struct task_lat *task, struct lat_test *lat_test, uint32_t packet_id, uint8_t generator_id) +{ + struct early_loss_detect *eld = &task->eld[generator_id]; + uint32_t old_queue_id, queue_pos; + + queue_pos = packet_id & PACKET_QUEUE_MASK; + old_queue_id = eld->entries[queue_pos]; + if ((packet_id >> PACKET_QUEUE_BITS) == old_queue_id) + lat_test->duplicate++; +} + static uint64_t tsc_extrapolate_backward(struct task_lat *task, uint64_t tsc_from, uint64_t bytes, uint64_t tsc_minimum) { #ifdef NO_LAT_EXTRAPOLATION @@ -462,6 +474,15 @@ static void lat_test_histogram_add(struct lat_test *lat_test, uint64_t lat_tsc) lat_test->buckets[bucket_id]++; } +static void lat_test_check_ordering(struct task_lat *task, struct lat_test *lat_test, uint32_t packet_id, uint8_t generator_id) +{ + if (packet_id < task->previous_packet[generator_id]) { + lat_test->mis_ordered++; + lat_test->extent += task->previous_packet[generator_id] - packet_id; + } + task->previous_packet[generator_id] = packet_id; +} + static void lat_test_add_lost(struct lat_test *lat_test, uint64_t lost_packets) { lat_test->lost_packets += lost_packets; @@ -613,7 +634,8 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin // Skip unexpected packet continue; } - + lat_test_check_ordering(task, task->lat_test, packet_id, generator_id); + lat_test_check_duplicate(task, task->lat_test, packet_id, generator_id); lat_test_add_lost(task->lat_test, task_lat_early_loss_detect(task, packet_id, generator_id)); } else { generator_id = 0; @@ -702,7 +724,7 @@ static void task_init_generator_count(struct task_lat *task) plog_info("\tNo generators found, hard-coding to %u generators\n", task->generator_count); } else task->generator_count = *generator_count; - plog_info("\tLatency using %u generators\n", task->generator_count); + plog_info("\t\tLatency using %u generators\n", task->generator_count); } static void task_lat_init_eld(struct task_lat *task, uint8_t socket_id) @@ -786,6 +808,8 @@ static void init_task_lat(struct task_base *tbase, struct task_args *targ) if (task->unique_id_pos) { task_lat_init_eld(task, socket_id); task_lat_reset_eld(task); + task->previous_packet = prox_zmalloc(sizeof(task->previous_packet) * task->generator_count , socket_id); + PROX_PANIC(task->previous_packet == NULL, "Failed to allocate array for storing previous packet\n"); } task->lat_test = &task->lt[task->using_lt]; @@ -803,7 +827,7 @@ static void init_task_lat(struct task_base *tbase, struct task_args *targ) // It can be UINT32_MAX (virtual devices or not supported by DPDK < 16.04) if (port->max_link_speed != UINT32_MAX) { bytes_per_hz = port->max_link_speed * 125000L; - plog_info("\tPort %u: max link speed is %ld Mbps\n", + plog_info("\t\tPort %u: max link speed is %ld Mbps\n", (uint8_t)(port - prox_port_cfg), 8 * bytes_per_hz / 1000000); } } -- cgit 1.2.3-korg