Commit b41ac972 authored by hsum's avatar hsum

Ensure Proper Timing for VNF and PNF Slot Allocation

Description:
In scenarios where VNFs and PNFs are deployed on different machines within a network, it's crucial to maintain synchronization and ensure smooth operation. This commit addresses the need to keep the VNF slot ahead of 2 (as required for network deployment), while ensuring that PNFs wait appropriately to avoid overtaking the slot. Specifically, this involves measuring slot duration and implementing a wait mechanism to ensure that PNFs do not exceed a slot duration of 300 microseconds. This ensures proper coordination and timing between VNFs and PNFs, contributing to the overall stability and performance of the network deployment.
parent 1c675140
......@@ -2106,8 +2106,21 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
}
}
#define SLOT_DURATION 300 // in microseconds
static struct timespec last_execution = {0};
void handle_nr_slot_ind(uint16_t sfn, uint16_t slot)
{
/* uses a usleep to wait for approximately the same time period (300 us) */
static struct timespec current_execution;
clock_gettime(CLOCK_REALTIME, &current_execution);
// Calculate elapsed time since last execution
long elapsed_time = (current_execution.tv_sec - last_execution.tv_sec) * 1000000; // Convert seconds to microseconds
elapsed_time += (current_execution.tv_nsec - last_execution.tv_nsec) / 1000; // Convert nanoseconds to microseconds
if (elapsed_time < SLOT_DURATION)
usleep(SLOT_DURATION - elapsed_time);
// Update last_execution time
last_execution = current_execution;
//send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler
//we give four additional slots (2ms) which should be enough time for the VNF to
//answer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment