diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 8622da2ed2c76a87c74b201d7445c1b260b27595..6c369bf7cf056553e4440fd0a132ad8def8006be 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -677,6 +677,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, return(0); } +/* // P: New function supporting the MAC interface void config_sib1_ue() { @@ -714,7 +715,7 @@ void config_dedicated_ue() { } - +*/ int rrc_mac_config_req_ue( diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 1ea71f8cbf34eb5610ec6c1a1852a095dbd323cc..c63db2b02f6a6c1d189438e7074441427657ecc0 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -48,6 +48,8 @@ #include "SIMULATION/TOOLS/defs.h" // for taus +extern uint8_t nfapi_mode; + int8_t get_DELTA_PREAMBLE(module_id_t module_idP,int CC_id) { @@ -287,10 +289,15 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t Size = 0; - + UE_MODE_t UE_mode; // Panos: Modification for phy_stub_ue operation - //UE_MODE_t UE_mode = get_ue_mode(module_idP,0,eNB_indexP); - UE_MODE_t UE_mode = UE_mac_inst[module_idP].UE_mode[0]; + if(nfapi_mode == 3) { // Panos: phy_stub_ue mode + UE_mode = UE_mac_inst[module_idP].UE_mode[0]; + } + else { // Full stack mode + UE_mode = get_ue_mode(module_idP,0,eNB_indexP); + } + uint8_t lcid = CCCH; uint16_t Size16; diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index ba26dda38d1740a243a36b8d79c6734406dfccf7..9e0a4039251a5a46cb1cb266495b1c6af627626f 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -74,6 +74,8 @@ extern uint8_t usim_test; extern UL_IND_t *UL_INFO; +extern uint8_t nfapi_mode; + /* #ifndef USER_MODE #define msg debug_msg @@ -395,12 +397,16 @@ ue_send_sdu( // (other possibility is 1 for TBS=7 (SCH_SUBHEADER_FIXED), or 2 for TBS=8 (SCH_SUBHEADER_FIXED+PADDING or SCH_SUBHEADER_SHORT) for (i=0; i<6; i++) if (tx_sdu[i] != payload_ptr[i]) { - LOG_E(MAC,"[UE %d][RAPROC] Contention detected, RA failed\n",module_idP); - // Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to - // PRACH state. - UE_mac_inst[module_idP].UE_mode[eNB_index] = PRACH; - //ra_failed(module_idP,CC_id,eNB_index); - UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; + LOG_E(MAC,"[UE %d][RAPROC] Contention detected, RA failed\n",module_idP); + if(nfapi_mode == 3) { // Panos: phy_stub mode + // Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to + // PRACH state. + UE_mac_inst[module_idP].UE_mode[eNB_index] = PRACH; + //ra_failed(module_idP,CC_id,eNB_index);UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; + } + else { // Full stack mode + ra_failed(module_idP,CC_id,eNB_index); + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT); return; } @@ -408,9 +414,14 @@ ue_send_sdu( LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing contention resolution timer\n", module_idP, frameP); UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; - //Panos: Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH - UE_mac_inst[module_idP].UE_mode[eNB_index] = PUSCH; - //ra_succeeded(module_idP,CC_id,eNB_index); + if(nfapi_mode == 3) // phy_stub mode + { + //Panos: Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH + UE_mac_inst[module_idP].UE_mode[eNB_index] = PUSCH; + } + else { // Full stack mode + ra_succeeded(module_idP,CC_id,eNB_index); + } } payload_ptr+=6; @@ -421,7 +432,10 @@ ue_send_sdu( LOG_D(MAC,"[UE] CE %d : UE Timing Advance : %d\n",i,payload_ptr[0]); #endif // Panos: Eliminate call to process_timing_advance for the phy_stub UE operation mode. Is this correct? - //process_timing_advance(module_idP,CC_id,payload_ptr[0]); + if (nfapi_mode!=3) + { + process_timing_advance(module_idP,CC_id,payload_ptr[0]); + } payload_ptr++; break; @@ -1596,9 +1610,14 @@ for (lcid=DCCH; (lcid < MAX_NUM_LCID) && (is_all_lcid_processed == FALSE) ; lcid // build PHR and update the timers if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) { - //Panos: Substitute with a static value for the MAC layer abstraction (phy_stub mode) - //phr_p->PH = get_phr_mapping(module_idP,CC_id,eNB_index); - phr_p->PH = 40; + if (nfapi_mode == 3){ //phy_stub mode + //Panos: Substitute with a static value for the MAC layer abstraction (phy_stub mode) + phr_p->PH = 40; + } + else { // Full stack mode + phr_p->PH = get_phr_mapping(module_idP,CC_id,eNB_index); + } + phr_p->R = 0; LOG_D(MAC,"[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n", module_idP,frameP, get_PHR(module_idP,CC_id,eNB_index), phr_p->PH,POWER_HEADROOM); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 0a6b8962024b84614689d3b8908aafea91b7ccf5..747a80a02f56a391d01d74ed327f4c9dbaa9add7 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -717,6 +717,7 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t* req) handle_nfapi_ul_pdu_UE_MAC(Mod_id,&ul_config_pdu_list[i],sfn,sf,req->ul_config_request_body.srs_present); + free(UL_INFO); } else { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index a8cc3e84d94808f9e50271e636ea177b0e2a0354..5f98f2a5197c7a8ad402359697494b4c13df0b8c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -116,6 +116,7 @@ static pthread_t forms_thread; //xforms pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. +uint8_t nfapi_mode = 0; uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100] uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100] diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 56a364cfa0af64f9467eba5f6cd0d79fb0f870c1..11ce1a281edeb0330ce5e836eece7ec207356276 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -60,6 +60,7 @@ #include "T.h" extern double cpuf; +extern uint8_t nfapi_mode; #define FRAME_PERIOD 100000000ULL #define DAQ_PERIOD 66667ULL @@ -642,14 +643,17 @@ static void *UE_thread_rxn_txnp4(void *arg) { // UE Rx procedures directly at the MAC layer, based on the received nfapi requests from the vnf (eNB). // Hardcode Mod_id for now. Will be changed later. - if(UE_mac_inst[Mod_id].tx_req) - tx_req_UE_MAC(UE_mac_inst[Mod_id].tx_req); - if(UE_mac_inst[Mod_id].dl_config_req) - dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req); - if(UE_mac_inst[Mod_id].hi_dci0_req) - hi_dci0_req_UE_MAC(UE_mac_inst[Mod_id].hi_dci0_req); - - //phy_procedures_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL ); + if(nfapi_mode == 3){ + if(UE_mac_inst[Mod_id].tx_req) + tx_req_UE_MAC(UE_mac_inst[Mod_id].tx_req); + if(UE_mac_inst[Mod_id].dl_config_req) + dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req); + if(UE_mac_inst[Mod_id].hi_dci0_req) + hi_dci0_req_UE_MAC(UE_mac_inst[Mod_id].hi_dci0_req); + } + else{ + phy_procedures_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL ); + } #endif } @@ -698,11 +702,13 @@ static void *UE_thread_rxn_txnp4(void *arg) { // Panos: Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // Generate UL_indications which corresponf to UL traffic. - if(UE_mac_inst[Mod_id].ul_config_req){ + if(nfapi_mode == 3 && UE_mac_inst[Mod_id].ul_config_req){ ul_config_req_UE_MAC(UE_mac_inst[Mod_id].ul_config_req); UL_indication(UL_INFO); } - //phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay); + else{ + phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay); + } }