From 71d56e78eb4fb36fe77c94774fa62746b1e18f7f Mon Sep 17 00:00:00 2001 From: Louis Adrien Dufrene Date: Wed, 17 Apr 2019 08:06:37 +0200 Subject: [PATCH] Remove MAC layer context from phy_procedures_lte_eNb.c to prevent phy-sim build from fail --- openair1/SCHED/phy_procedures_lte_eNb.c | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 80767c0c20..ae1c4bce3d 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -40,8 +40,6 @@ #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#include "openair2/LAYER2/MAC/mac_proto.h" - #include "assertions.h" #include "msc.h" @@ -1238,7 +1236,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { //compute the expected ULSCH RX power (for the stats) ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered - if (RC.mac != NULL) { /* ulsim dose not use RC.mac context. */ + if (RC.mac != NULL) { /* ulsim does not use RC.mac context. */ if (ulsch_harq->cqi_crc_status == 1) { #ifdef DEBUG_PHY_PROC //if (((frame%10) == 0) || (frame < 50)) @@ -1501,10 +1499,11 @@ static void do_release_harq(PHY_VARS_eNB *eNB, LTE_DL_eNB_HARQ_t *dlsch0_harq = NULL; LTE_DL_eNB_HARQ_t *dlsch1_harq = NULL; int UE_id_mac = -1; - UE_sched_ctrl *UE_scheduling_control = NULL; int harq_pid; int subframe_tx; int frame_tx; + UE_sched_ctrl *UE_scheduling_control = NULL; + UE_list_t *UE_list = NULL AssertFatal(UE_id != -1, "No existing dlsch context\n"); AssertFatal(UE_id < NUMBER_OF_UE_MAX, "Returned UE_id %d >= %d (NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX); @@ -1512,8 +1511,23 @@ static void do_release_harq(PHY_VARS_eNB *eNB, dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; - UE_id_mac = find_UE_id(eNB->Mod_id, dlsch0->rnti); - UE_scheduling_control = &(RC.mac[eNB->Mod_id]->UE_list.UE_sched_ctrl[UE_id_mac]); + if (RC.mac != NULL) { /* dlsim does not use RC.mac context */ + UE_list = &(RC.mac[eNB->Mod_id]->UE_list); + + /* Replicate "find_UE_id" from openair2/LAYER2/MAC/mac_proto.h */ + for (int UE_id_temp = 0; UE_id_temp < MAX_MOBILES_PER_ENB; UE_id_temp++) { + if (UE_list->active[UE_id_temp] == TRUE) { + if (UE_list->UE_template[UE_list->pCC_id[UE_id_temp]][UE_id_temp].rnti == dlsch0->rnti) { + UE_id_mac = UE_id_temp; + break; + } + } + } + + if (UE_id_mac != -1) { + UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id_mac]); + } + } if (eNB->frame_parms.frame_type == FDD) { subframe_tx = (subframe + 6) % 10; @@ -1555,8 +1569,10 @@ static void do_release_harq(PHY_VARS_eNB *eNB, dlsch0_harq->status = SCH_IDLE; dlsch0->harq_mask &= ~(1 << harq_pid); - /* CDRX: PUCCH gives an ACK or no more repetitions, so reset corresponding HARQ RTT */ - UE_scheduling_control->harq_rtt_timer[eNB->CC_id][harq_pid] = 0; + if (UE_scheduling_control != NULL) { + /* CDRX: PUCCH gives an ACK or no more repetitions, so reset corresponding HARQ RTT */ + UE_scheduling_control->harq_rtt_timer[eNB->CC_id][harq_pid] = 0; + } } } else {