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
@@ -100,6 +100,10 @@ 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, SNR_lin, snr0 = -2.0, snr1 = 2.0;
double snr_step = 0.1;
@@ -519,11 +523,11 @@ int main(int argc, char **argv)
nr_dlsch_encoding(gNB, &msgDataTx, frame, slot, frame_parms, output, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
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++) {
for (i = 0; i < available_bits; i++) {
#ifdef DEBUG_CODER
if ((i&0xf)==0)