feat(NR PHY simulators): add a SIGINT handler to some PHY simulators

When using T2 virtual functions, it is important to properly stop DPDK and free the device.
Otherwise the virtual functions may be blocked and a restart of the admin application is necessary.

Up to now, SIGINT was shutting down the PHY simulators without freeing the device.
This commit adds a signal handler to handle SIGINT in a way that allow to properly free the device.
This feature is first added to the PHY simulators that use the T2 which are `nr_ulsim`, `nr_dlsim`, `nr_ulschsim` and `nr_dlschsim`.
This commit is contained in:
Romain Beurdouche
2025-03-21 10:04:45 +00:00
parent 82fb9fcc7c
commit 1fdbf2906f
6 changed files with 47 additions and 10 deletions
+6 -2
View File
@@ -99,6 +99,10 @@ nrUE_params_t *get_nrUE_params(void) {
configmodule_interface_t *uniqCfg = NULL;
int main(int argc, char **argv)
{
stop = false;
__attribute__((unused)) struct sigaction oldaction;
sigaction(SIGINT, &sigint_action, &oldaction);
int i;
double SNR, snr0 = -2.0, snr1 = 2.0, SNR_lin;
double snr_step = 0.1;
@@ -521,11 +525,11 @@ int main(int argc, char **argv)
///////////
////////////////////////////////////////////////////////////////////
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
for (SNR = snr0; SNR < snr1 && !stop; SNR += snr_step) {
n_errors = 0;
n_false_positive = 0;
for (trial = 0; trial < n_trials; trial++) {
for (trial = 0; trial < n_trials && !stop; trial++) {
errors_bit_uncoded = 0;