summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/handle_lat.c
diff options
context:
space:
mode:
authorXavier Simonart <simonartxavier@gmail.com>2022-02-06 21:36:37 +0000
committerGerrit Code Review <gerrit@opnfv.org>2022-02-06 21:36:37 +0000
commit3ca39112898d0ab303e486d469fca87730263e52 (patch)
tree7269b8cdd9ec2d719236d4f83fe22c8b96a0b136 /VNFs/DPPD-PROX/handle_lat.c
parente7882c8936bdcfb67c628b989302474b9cfdeac4 (diff)
parent7d46676d5d377dc9def2a266ebd9b6b86570e732 (diff)
Merge "Do not create (empty) latency loss file if disabled"
Diffstat (limited to 'VNFs/DPPD-PROX/handle_lat.c')
-rw-r--r--VNFs/DPPD-PROX/handle_lat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/VNFs/DPPD-PROX/handle_lat.c b/VNFs/DPPD-PROX/handle_lat.c
index d6943070..04a4848b 100644
--- a/VNFs/DPPD-PROX/handle_lat.c
+++ b/VNFs/DPPD-PROX/handle_lat.c
@@ -419,7 +419,7 @@ static void lat_stop(struct task_base *tbase)
task_lat_reset_eld(task);
memset(task->previous_packet, 0, sizeof(task->previous_packet) * task->generator_count);
}
- if (task->loss_id) {
+ if (task->loss_id && task->fp_loss) {
for (uint i = 0; i < task->loss_id; i++) {
fprintf(task->fp_loss, "packet %d: %d\n", task->loss_buffer[i].packet_id, task->loss_buffer[i].n);
}
@@ -842,11 +842,6 @@ static void init_task_lat(struct task_base *tbase, struct task_args *targ)
init_task_lat_latency_buffer(task, targ->lconf->id);
}
- char name[256];
- sprintf(name, "loss_%u.txt", targ->lconf->id);
- task->fp_loss = fopen(name, "w+");
- PROX_PANIC(task->fp_loss == NULL, "Failed to open %s\n", name);
-
if (targ->bucket_size < DEFAULT_BUCKET_SIZE) {
targ->bucket_size = DEFAULT_BUCKET_SIZE;
}
@@ -901,6 +896,11 @@ static void init_task_lat(struct task_base *tbase, struct task_args *targ)
}
task->loss_buffer_size = targ->loss_buffer_size;
if (task->loss_buffer_size) {
+ char name[256];
+ sprintf(name, "loss_%u.txt", targ->lconf->id);
+ task->fp_loss = fopen(name, "w+");
+ PROX_PANIC(task->fp_loss == NULL, "Failed to open %s\n", name);
+
task->loss_buffer = prox_zmalloc(task->loss_buffer_size * sizeof(struct loss_buffer), rte_lcore_to_socket_id(targ->lconf->id));
PROX_PANIC(task->loss_buffer == NULL,
"Failed to allocate %lu bytes (in huge pages) for loss_buffer\n", task->loss_buffer_size * sizeof(struct loss_buffer));