nr_fill_indication(): protect with mutex

nr_fill_indication() fills CRC and RX requests, to be sent from L1 to
L2. Before this commit, nr_fill_indication() is called when
- we finally decoded LDPC (or not)
- low signal on PUSCH
This might happen at the same time, i.e., nr_fill_indication() might try
to fill both CRC and RX, in the same list, from different threads. This
can lead to this assertion:

Assertion (crc->rnti == rx->rnti) failed!
In handle_nr_ulsch() ../../../openair2/NR_PHY_INTERFACE/NR_IF_Module.c:190
mis-match between CRC RNTI e071 and RX RNTI 5e3b

e.g., e071 is low energy, and while 5e3b related message are filled in
one thread, e071 is being put into the message structure as well.

At least that is my understanding. I could not actually reproduce this
assertion; to be seen if it still happens.
This commit is contained in:
Robert Schmidt
2024-03-07 09:56:33 +01:00
parent e80d8a01f3
commit 0128945922
4 changed files with 27 additions and 6 deletions
+7 -2
View File
@@ -177,6 +177,9 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
}
if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) {
// see nr_fill_indication about why this mutex is necessary
int rc = pthread_mutex_lock(&UL_info->crc_rx_mutex);
DevAssert(rc == 0);
AssertFatal(UL_info->rx_ind.number_of_pdus == UL_info->crc_ind.number_crcs,
"number_of_pdus %d, number_crcs %d\n",
UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs);
@@ -210,9 +213,11 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
rx->rssi);
handle_nr_ul_harq(UL_info->CC_id, UL_info->module_id, UL_info->frame, UL_info->slot, crc);
}
UL_info->rx_ind.number_of_pdus = 0;
UL_info->crc_ind.number_crcs = 0;
rc = pthread_mutex_unlock(&UL_info->crc_rx_mutex);
DevAssert(rc == 0);
}
UL_info->rx_ind.number_of_pdus = 0;
UL_info->crc_ind.number_crcs = 0;
}
void handle_nr_srs(NR_UL_IND_t *UL_info) {