summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/handle_gen.c10
-rw-r--r--VNFs/DPPD-PROX/handle_lat.c20
-rw-r--r--VNFs/DPPD-PROX/handle_lat.h4
3 files changed, 19 insertions, 15 deletions
diff --git a/VNFs/DPPD-PROX/handle_gen.c b/VNFs/DPPD-PROX/handle_gen.c
index 4bf2e6eb..fa16b309 100644
--- a/VNFs/DPPD-PROX/handle_gen.c
+++ b/VNFs/DPPD-PROX/handle_gen.c
@@ -114,7 +114,7 @@ struct task_gen {
uint16_t rand_offset; /* each random has an offset*/
uint8_t rand_len; /* # bytes to take from random (no bias introduced) */
} rand[64];
- uint64_t accur[64];
+ uint64_t accur[ACCURACY_WINDOW];
uint64_t pkt_tsc_offset[64];
struct pkt_template *pkt_template_orig; /* packet templates (from inline or from pcap) */
struct ether_addr src_mac;
@@ -363,11 +363,11 @@ static void task_gen_apply_all_accur_pos(struct task_gen *task, struct rte_mbuf
if (!task->accur_pos)
return;
- /* The accuracy of task->pkt_queue_index - 64 is stored in
- packet task->pkt_queue_index. The ID modulo 64 is the
+ /* The accuracy of task->pkt_queue_index - ACCURACY_WINDOW is stored in
+ packet task->pkt_queue_index. The ID modulo ACCURACY_WINDOW is the
same. */
for (uint16_t j = 0; j < count; ++j) {
- uint32_t accuracy = task->accur[(task->pkt_queue_index + j) & 63];
+ uint32_t accuracy = task->accur[(task->pkt_queue_index + j) & (ACCURACY_WINDOW - 1)];
task_gen_apply_accur_pos(task, pkt_hdr[j], accuracy);
}
}
@@ -505,7 +505,7 @@ static void task_gen_store_accuracy(struct task_gen *task, uint32_t count, uint6
uint64_t first_accuracy_idx = task->pkt_queue_index - count;
for (uint32_t i = 0; i < count; ++i) {
- uint32_t accuracy_idx = (first_accuracy_idx + i) & 63;
+ uint32_t accuracy_idx = (first_accuracy_idx + i) & (ACCURACY_WINDOW - 1);
task->accur[accuracy_idx] = accur;
}
diff --git a/VNFs/DPPD-PROX/handle_lat.c b/VNFs/DPPD-PROX/handle_lat.c
index b4e016ec..d3a52d7e 100644
--- a/VNFs/DPPD-PROX/handle_lat.c
+++ b/VNFs/DPPD-PROX/handle_lat.c
@@ -35,7 +35,7 @@
#include "prox_port_cfg.h"
#define DEFAULT_BUCKET_SIZE 10
-#define ACCURACY_BUFFER_SIZE 64
+#define ACCURACY_BUFFER_SIZE (2 * ACCURACY_WINDOW)
struct lat_info {
uint32_t rx_packet_index;
@@ -344,9 +344,9 @@ static void lat_write_latency_to_file(struct task_lat *task)
uint64_t rx_tsc = lat_info_get_rx_tsc(lat_info);
uint64_t tx_tsc = lat_info_get_tx_tsc(lat_info);
- /* Packet n + ACCURACY_BUFFER_SIZE delivers the TX error for packet n,
- hence the last ACCURACY_BUFFER_SIZE packets do no have TX error. */
- if (i + ACCURACY_BUFFER_SIZE >= task->latency_buffer_idx) {
+ /* Packet n + ACCURACY_WINDOW delivers the TX error for packet n,
+ hence the last ACCURACY_WINDOW packets do no have TX error. */
+ if (i + ACCURACY_WINDOW >= task->latency_buffer_idx) {
tx_err_tsc = 0;
}
@@ -616,14 +616,14 @@ static int handle_lat_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, uin
}
/* If accuracy is enabled, latency is reported with a
- delay of ACCURACY_BUFFER_SIZE packets since the generator puts the
- accuracy for packet N into packet N + ACCURACY_BUFFER_SIZE. The delay
+ delay of ACCURACY_WINDOW packets since the generator puts the
+ accuracy for packet N into packet N + ACCURACY_WINDOW. The delay
ensures that all reported latencies have both rx
and tx error. */
if (task->accur_pos) {
uint32_t tx_time_err = *(uint32_t *)(hdr + task->accur_pos);
- struct delayed_latency_entry *delayed_latency_entry = delayed_latency_get(task->delayed_latency_entries, generator_id, packet_id - ACCURACY_BUFFER_SIZE);
+ struct delayed_latency_entry *delayed_latency_entry = delayed_latency_get(task->delayed_latency_entries, generator_id, packet_id - ACCURACY_WINDOW);
if (delayed_latency_entry) {
task_lat_store_lat(task,
@@ -764,11 +764,11 @@ static void init_task_lat(struct task_base *tbase, struct task_args *targ)
PROX_PANIC(task->delayed_latency_entries[i] == NULL, "Failed to allocate array for storing delayed latency entries\n");
}
if (task->unique_id_pos == 0) {
- /* When using accuracy feature, the accuracy from TX is written ACCURACY_BUFFER_SIZE packets later
+ /* When using accuracy feature, the accuracy from TX is written ACCURACY_WINDOW packets later
* We can only retrieve the good packet if a packet id is written to it.
- * Otherwise we will use the packet RECEIVED ACCURACY_BUFFER_SIZE packets ago which is OK if
+ * Otherwise we will use the packet RECEIVED ACCURACY_WINDOW packets ago which is OK if
* packets are not re-ordered. If packets are re-ordered, then the matching between
- * the tx accuracy znd the latency is wrong.
+ * the TX accuracy and the latency is wrong.
*/
plog_warn("\tWhen accuracy feature is used, a unique id should ideally also be used\n");
}
diff --git a/VNFs/DPPD-PROX/handle_lat.h b/VNFs/DPPD-PROX/handle_lat.h
index 3cc80461..46f5e7d4 100644
--- a/VNFs/DPPD-PROX/handle_lat.h
+++ b/VNFs/DPPD-PROX/handle_lat.h
@@ -25,6 +25,10 @@
#include "clock.h"
#define LATENCY_ACCURACY 1
+// If ACCURACY_WINDOW is too small, the accuracy for packet N can be received by lat BEFORE
+// packet N is received (re-ordering) resulting in accuracy being unused
+// 8192 packets is equivalent to 550 micro-seconds at 10Gbps for 64 bytes packets
+#define ACCURACY_WINDOW 8192
struct lat_test {
uint64_t tot_all_pkts;