Move UL_INFO structure allocation local to a rx slot processing

Use UL_INFO on the stack, to simplify the code.  move in the same struct
the associated rach, pdu, crc, srs arrays that where pointed from
directly in gNB structure Keep in nfapi the existing logic that make
malloc for theses rach, pdu, crc, srs array lists

Pass only relevant fields, where appropriate.

Co-authored-by: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
Laurent THOMAS
2025-01-10 18:05:58 +01:00
committed by Robert Schmidt
co-authored by Robert Schmidt
parent f9bff3d6a0
commit b4bc7c96ba
12 changed files with 184 additions and 217 deletions
+36 -37
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,34 +72,39 @@ 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);
}
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);
}
}
}
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) {
@@ -161,7 +165,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) {
@@ -179,9 +183,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);
@@ -191,12 +192,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",
@@ -221,13 +222,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",