Remove ue->pucch_vars and scheduler call cleanup

This commit is contained in:
Sakthivel Velumani
2022-09-26 11:20:32 -04:00
parent 0fe3a775c4
commit c6fd2419d4
13 changed files with 81 additions and 110 deletions
+42 -43
View File
@@ -326,7 +326,7 @@ static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_inf
{
L1_nsa_prach_procedures(ul_info->frame_tx, ul_info->slot_tx, prach_pdu);
ul_config->number_pdus = 0;
ul_info->ue_sched_mode = SCHED_ALL;
ul_info->ue_sched_mode = SCHED_PUSCH;
}
else if (nr_prach == 2)
{
@@ -426,7 +426,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
ul_info.slot_rx = slot;
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx;
ul_info.ue_sched_mode = SCHED_ALL;
ul_info.ue_sched_mode = SCHED_PUSCH;
if (pthread_mutex_lock(&mac->mutex_dl_info)) abort();
@@ -458,7 +458,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_scheduler(NULL, &ul_info);
nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id);
nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id);
nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id, NULL);
check_nr_prach(mac, &ul_info, &prach_resources);
}
if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) {
@@ -610,12 +610,9 @@ void processSlotTX(void *arg) {
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
LOG_D(PHY,"processSlotTX %d.%d => slot type %d\n",proc->frame_tx,proc->nr_slot_tx,tx_slot_type);
if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){
LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type);
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){
// trigger L2 to run ue_scheduler thru IF module
// [TODO] mapping right after NR initial sync
@@ -625,7 +622,7 @@ void processSlotTX(void *arg) {
memset((void*)&ul_indication, 0, sizeof(ul_indication));
ul_indication.module_id = UE->Mod_id;
ul_indication.gNB_index = gNB_id;
ul_indication.gNB_index = proc->gNB_id;
ul_indication.cc_id = UE->CC_id;
ul_indication.frame_rx = proc->frame_rx;
ul_indication.slot_rx = proc->nr_slot_rx;
@@ -638,20 +635,15 @@ void processSlotTX(void *arg) {
stop_meas(&UE->ue_ul_indication_stats);
}
if (rxtxD->ue_sched_mode != NOT_PUSCH) {
phy_procedures_nrUE_TX(UE,proc,0);
}
phy_procedures_nrUE_TX(UE,proc,proc->gNB_id);
}
}
void processSlotRX(void *arg) {
void UE_processing(void *arg) {
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx);
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
NR_UE_PDCCH_CONFIG phy_pdcch_config={0};
@@ -665,7 +657,7 @@ void processSlotRX(void *arg) {
}
}
if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){
if (proc->rx_slot_type == NR_DOWNLINK_SLOT || proc->rx_slot_type == NR_MIXED_SLOT){
if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
nr_downlink_indication_t dl_indication;
@@ -695,35 +687,39 @@ void processSlotRX(void *arg) {
if (res == NULL)
return; // Tpool has been stopped
delNotifiedFIFO_elt(res);
// calling UL_indication to schedule things other than PUSCH (eg, PUCCH)
rxtxD->ue_sched_mode = NOT_PUSCH;
processSlotTX(rxtxD);
} else {
rxtxD->ue_sched_mode = SCHED_ALL;
processSlotTX(rxtxD);
}
if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) {
nr_phy_data_t phy_data = {0};
if (UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
nr_uplink_indication_t ul_indication;
memset((void*)&ul_indication, 0, sizeof(ul_indication));
ul_indication.module_id = UE->Mod_id;
ul_indication.gNB_index = gNB_id;
ul_indication.cc_id = UE->CC_id;
ul_indication.frame_rx = proc->frame_rx;
ul_indication.slot_rx = proc->nr_slot_rx;
ul_indication.frame_tx = proc->frame_tx;
ul_indication.slot_tx = proc->nr_slot_tx;
ul_indication.ue_sched_mode = SCHED_PUCCH;
ul_indication.phy_data = &phy_data;
UE->if_inst->ul_indication(&ul_indication);
}
if (UE->UE_mode[gNB_id] <= PUSCH) {
if (get_softmodem_params()->usim_test==0) {
pucch_procedures_ue_nr(UE,
gNB_id,
proc);
}
LOG_D(PHY, "Sending Uplink data \n");
nr_ue_pusch_common_procedures(UE,
proc->nr_slot_tx,
&UE->frame_parms,
UE->frame_parms.nb_antennas_tx);
pucch_procedures_ue_nr(UE,
gNB_id,
proc,
&phy_data);
}
if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) {
nr_ue_prach_procedures(UE, proc, gNB_id);
}
LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
LOG_D(PHY, "Sending Uplink data \n");
nr_ue_pusch_common_procedures(UE,
proc->nr_slot_tx,
&UE->frame_parms,
UE->frame_parms.nb_antennas_tx);
if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH)
nr_ue_prach_procedures(UE, proc, proc->gNB_id);
}
ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx);
@@ -832,6 +828,7 @@ void *UE_thread(void *arg) {
openair0_timestamp timestamp, writeTimestamp;
void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
int start_rx_stream = 0;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), "");
UE->rfdevice.host_type = RAU_HOST;
UE->lost_sync = 0;
@@ -854,7 +851,7 @@ void *UE_thread(void *arg) {
int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0;
for (int i=0; i<NR_RX_NB_TH+1; i++) {// NR_RX_NB_TH working + 1 we are making to be pushed
notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,processSlotRX);
notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,UE_processing);
nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt);
initNotifiedFIFO(&curMsg->txFifo);
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt);
@@ -866,7 +863,7 @@ void *UE_thread(void *arg) {
nb += abortNotifiedFIFOJob(&nf, RX_JOB_ID);
LOG_I(PHY,"Number of aborted slots %d\n",nb);
for (int i=0; i<nb; i++)
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,processSlotRX));
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,UE_processing));
nbSlotProcessing = 0;
UE->is_synchronized = 0;
UE->lost_sync = 0;
@@ -946,6 +943,8 @@ void *UE_thread(void *arg) {
curMsg->proc.nr_slot_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame;
curMsg->proc.frame_rx = (absolute_slot/nb_slot_frame) % MAX_FRAME_NUMBER;
curMsg->proc.frame_tx = ((absolute_slot+DURATION_RX_TO_TX)/nb_slot_frame) % MAX_FRAME_NUMBER;
curMsg->proc.rx_slot_type = nr_ue_slot_select(cfg, curMsg->proc.frame_rx, curMsg->proc.nr_slot_rx);
curMsg->proc.tx_slot_type = nr_ue_slot_select(cfg, curMsg->proc.frame_tx, curMsg->proc.nr_slot_tx);
curMsg->proc.decoded_frame_rx=-1;
//LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB);