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",
+13 -4
View File
@@ -37,6 +37,9 @@
#include <stdint.h>
#include "assertions.h"
#include "nfapi_nr_interface_scf.h"
#include "common/platform_constants.h"
#include "common/platform_types.h"
#include "common/openairinterface5g_limits.h"
#define MAX_NUM_DL_PDU 100
#define MAX_NUM_UL_PDU 100
@@ -50,6 +53,10 @@
#define MAX_NUM_RACH_IND 100
#define MAX_NUM_SRS_IND 100
#define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_UL_PDUS_PER_SLOT 8
#define MAX_NUM_NR_SRS_PDUS 8
#define MAX_NUM_NR_UCI_PDUS MAX_MOBILES_PER_GNB
typedef struct {
/// Module ID
module_id_t module_id;
@@ -64,10 +71,6 @@ typedef struct {
nfapi_nr_crc_indication_t crc_ind;
/// RX indication
nfapi_nr_rx_data_indication_t rx_ind;
/// mutex to protect concurrent access to crc_ind and rx_ind, which the L2
/// needs to be pairwise
pthread_mutex_t crc_rx_mutex;
/// RACH indication list
nfapi_nr_rach_indication_t rach_ind;
@@ -76,6 +79,12 @@ typedef struct {
/// UCI indication
nfapi_nr_uci_indication_t uci_ind;
nfapi_nr_crc_t crc_pdu_list[MAX_UL_PDUS_PER_SLOT];
nfapi_nr_rx_data_pdu_t rx_pdu_list[MAX_UL_PDUS_PER_SLOT];
nfapi_nr_srs_indication_pdu_t srs_pdu_list[MAX_NUM_NR_SRS_PDUS];
nfapi_nr_uci_t uci_pdu_list[MAX_NUM_NR_UCI_PDUS];
/// NFAPI PRACH information
nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS];
} NR_UL_IND_t;