Merge remote-tracking branch 'origin/local-UL_INFO' into integration_2025_w02 (!3076)

Move UL_INFO structure allocation local to a rx slot processing

UL_INFO is allocated a gNB, so require mutex and obscur information
passing function to function.  Instead, make a local UL_INFO per slot,
removing the mutex and making the code easier to understand.
This commit is contained in:
Robert Schmidt
2025-01-13 07:46:05 +01:00
12 changed files with 185 additions and 218 deletions
+37 -38
View File
@@ -62,8 +62,7 @@ extern int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind);
extern int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind);
extern uint8_t nfapi_mode;
void handle_nr_rach(NR_UL_IND_t *UL_info)
static void handle_nr_rach(NR_UL_IND_t *UL_info)
{
if (NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->rach_ind.number_of_pdus > 0) {
@@ -73,35 +72,40 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
}
return;
}
if (UL_info->rach_ind.number_of_pdus) {
int frame_diff = UL_info->frame - UL_info->rach_ind.sfn;
if (frame_diff < 0) {
frame_diff += 1024;
}
bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7);
int frame_diff = UL_info->frame - UL_info->rach_ind.sfn;
if (frame_diff < 0) {
frame_diff += 1024;
}
bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7);
if (UL_info->rach_ind.number_of_pdus > 0 && in_timewindow) {
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot);
for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
if (UL_info->rach_ind.pdu_list[i].num_preamble > 1) {
LOG_E(MAC, "Not more than 1 preamble per RACH PDU supported, ignoring the rest\n");
if (in_timewindow) {
LOG_D(MAC,
"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
UL_info->frame,
UL_info->slot,
UL_info->rach_ind.sfn,
UL_info->rach_ind.slot);
for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
nfapi_nr_prach_indication_pdu_t *rach = UL_info->rach_ind.pdu_list + i;
if (rach->num_preamble > 1) {
LOG_E(MAC, "Not more than 1 preamble per RACH PDU supported, ignoring the rest\n");
}
nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->rach_ind.sfn,
UL_info->rach_ind.slot,
rach->preamble_list[0].preamble_index,
rach->freq_index,
rach->symbol_index,
rach->preamble_list[0].timing_advance,
rach->preamble_list[0].preamble_pwr);
}
nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->rach_ind.sfn,
UL_info->rach_ind.slot,
UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_index,
UL_info->rach_ind.pdu_list[i].freq_index,
UL_info->rach_ind.pdu_list[i].symbol_index,
UL_info->rach_ind.pdu_list[i].preamble_list[0].timing_advance,
UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_pwr);
}
}
}
void handle_nr_uci(NR_UL_IND_t *UL_info)
static void handle_nr_uci(NR_UL_IND_t *UL_info)
{
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->uci_ind.num_ucis > 0) {
@@ -162,7 +166,7 @@ static bool crc_sfn_slot_matcher(void *wanted, void *candidate)
return false;
}
void handle_nr_ulsch(NR_UL_IND_t *UL_info)
static void handle_nr_ulsch(NR_UL_IND_t *UL_info)
{
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->crc_ind.number_crcs > 0) {
@@ -180,9 +184,6 @@ 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);
@@ -192,12 +193,12 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
LOG_D(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
"UL_info->rx_ind.pdu_list[%d].rnti:%04x\n",
i, crc->rnti, i, rx->rnti);
AssertFatal(crc->rnti == rx->rnti, "mis-match between CRC RNTI %04x and RX RNTI %04x\n", crc->rnti, rx->rnti);
AssertFatal(crc->rnti == rx->rnti, "mis-match between CRC RNTI %04x and RX RNTI %04x\n",
crc->rnti, rx->rnti);
AssertFatal(crc->harq_id == rx->harq_id, "mis-match between CRC HARQ ID %04x and RX HARQ ID %04x\n",
crc->harq_id, rx->harq_id);
AssertFatal(crc->harq_id == rx->harq_id,
"mis-match between CRC HARQ ID %04x and RX HARQ ID %04x\n",
crc->harq_id,
rx->harq_id);
LOG_D(NR_MAC,
"%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n",
@@ -222,13 +223,11 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
}
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);
}
}
void handle_nr_srs(NR_UL_IND_t *UL_info) {
static void handle_nr_srs(NR_UL_IND_t *UL_info)
{
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->srs_ind.number_of_pdus > 0) {
LOG_D(PHY,"PNF Sending UL_info->srs_ind.number_of_pdus: %d, SFN/SF:%d.%d \n",