feat(nfapi/vnf): implement Delay management for dynamic slot timing (EWMA-based)

Changes:

* Add comprehensive delay management (DM) and EWMA state variables (e.g., jitter estimates, risk debts, pressure holds, and safe margins) to `nfapi_vnf_p7_connection_info_t` in `vnf_p7.h`.
* Introduce integer-based EWMA math helpers (`p7_ewma_step_i32`, `calculate_slot_distance`, etc.) in `vnf_p7.c` to handle precise timing calculations and prevent integer dead-zones.
* Implement the core `vnf_nr_delay_management()` controller, which dynamically computes the optimal `slot_ahead` using a fast-attack/slow-release pressure model, risk/debt memory, and critical cliff region mapping.
* Integrate the delay controller into `vnf_nr_handle_timing_info()`, feeding it the timing statistics parsed from the PNF to continuously adjust pacing.
* Clean up extensive trailing whitespaces and formatting inconsistencies throughout `vnf_p7.c`.

Purpose:
To establish a robust, adaptive dynamic slot timing controller for the VNF. By leveraging an EWMA-based algorithm, the VNF can continuously track network jitter, estimate mean delays, and intelligently balance timing "debt" against "safe margins." This enables the VNF to proactively and smoothly adjust its transmission pacing (`slot_ahead`) to prevent late packet drops under varying network conditions, eliminating the abrupt and erratic timing jumps seen in the legacy sync implementation.

Signed-off-by: Ming-Hong HSU, BMW Lab@NTUST <m11302209@gapps.ntust.edu.tw>
This commit is contained in:
Ming-Hong HSU, BMW Lab@NTUST
2026-05-24 15:37:06 +08:00
parent 447b592924
commit 1db365ed89
2 changed files with 1035 additions and 106 deletions

View File

@@ -117,7 +117,24 @@ typedef struct nfapi_vnf_p7_connection_info {
struct nfapi_vnf_p7_connection_info* next; struct nfapi_vnf_p7_connection_info* next;
int32_t pending_us; // Accumulated borrowed time (us) to be repaid incrementally int32_t pending_us; // Accumulated borrowed time (us) to be repaid incrementally
int32_t estimated_mean_late; // estimated mean delay
int32_t estimated_jitter_var; // estimated jitter variance
int32_t late_jitter; // Separate EWMA for late jitter
int32_t early_jitter; // Separate EWMA for early jitter
int32_t last_adjustment_steps; // How many slots we increased in last adjustment
int32_t last_adjustment_sfn; // SFN when we made the last upward adjustment
int32_t last_adjustment_slot; // Slot when we made the last upward adjustment
int32_t DM_EWMA_safe_period_count;
int32_t DM_EWMA_late_period_count;
int32_t DM_EWMA_risk_period_count;
int32_t DM_EWMA_last_target_s_ahead;
int32_t DM_EWMA_failure_debt_us;
int32_t DM_EWMA_risk_debt_us;
int32_t DM_EWMA_safe_margin_ewma_us;
int32_t DM_EWMA_jitter_pressure_ahead_us;
int32_t DM_EWMA_jitter_pressure_hold_ahead_us;
int32_t DM_EWMA_jitter_pressure_hold_slots;
} nfapi_vnf_p7_connection_info_t; } nfapi_vnf_p7_connection_info_t;
typedef struct vnf_p7_s { typedef struct vnf_p7_s {

File diff suppressed because it is too large Load Diff