rf_imp: fail opening RF altogether if specified device fails to open

we've had a few runs in the CI where opening the specified RF device
failed but the eNB/UE still continued to run, just picking the next available
run. This led to false-positive tests.

The policy should be that whenever the user specified a RF device to
be openend, and this device fails, the whole process should fail and
the application should exit.

The auto-detection mode is still available but only if no device name
is specified at all.
master
Andre Puschmann 3 years ago committed by Xavier Arteaga
parent c9478a4306
commit e563e5918e

@ -93,9 +93,9 @@ const char* srsran_rf_get_devname(srsran_rf_t* rf)
int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uint32_t nof_channels) int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uint32_t nof_channels)
{ {
rf->thread_gain_run = false; rf->thread_gain_run = false;
/* Try to open the device if name is provided */
if (devname) { // Try to open the device if name is provided
if (devname[0] != '\0') { if (devname && devname[0] != '\0') {
int i = 0; int i = 0;
while (available_devices[i] != NULL) { while (available_devices[i] != NULL) {
if (!strcasecmp(available_devices[i]->name, devname)) { if (!strcasecmp(available_devices[i]->name, devname)) {
@ -104,21 +104,22 @@ int srsran_rf_open_devname(srsran_rf_t* rf, const char* devname, char* args, uin
} }
i++; i++;
} }
printf("Device %s not found. Switching to auto mode\n", devname); // provided device not found, abort
} return SRSRAN_ERROR;
} } else {
// auto-mode, try to open in order of apperance in available_devices[] array
/* If in auto mode or provided device not found, try to open in order of apperance in available_devices[] array */
int i = 0; int i = 0;
while (available_devices[i] != NULL) { while (available_devices[i] != NULL) {
if (!available_devices[i]->srsran_rf_open_multi(args, &rf->handler, nof_channels)) { if (!available_devices[i]->srsran_rf_open_multi(args, &rf->handler, nof_channels)) {
rf->dev = available_devices[i]; rf->dev = available_devices[i];
return 0; return SRSRAN_SUCCESS;
} }
i++; i++;
} }
}
ERROR("No compatible RF frontend found"); ERROR("No compatible RF frontend found");
return -1; return SRSRAN_ERROR;
} }
const char* srsran_rf_name(srsran_rf_t* rf) const char* srsran_rf_name(srsran_rf_t* rf)

Loading…
Cancel
Save