diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 22722b65ba8a21594049056818a6229947a675ff..97a9c750a003328cd8160ff816029e5b87ae6e7f 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -316,7 +316,8 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index, (void *)mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength, sizeof(UL_CyclicPrefixLength_t)); } - + // store the previous rnti in case of failure, and set thenew rnti + UE_mac_inst[Mod_id].crnti_before_ho = UE_mac_inst[Mod_id].crnti; UE_mac_inst[Mod_id].crnti = ((mobilityControlInfo->newUE_Identity.buf[0])|(mobilityControlInfo->newUE_Identity.buf[1]<<8)); LOG_I(MAC,"[UE %d] Received new identity %x from %d\n", Mod_id, UE_mac_inst[Mod_id].crnti, eNB_index); UE_mac_inst[Mod_id].rach_ConfigDedicated = malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated)); diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index c66218418c61a8d816dfeafe1bd88c8d15c2aab5..079f4d83ab01b6319a4962953dc5d94903557ce7 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -711,6 +711,8 @@ typedef struct{ u32 subframe; /// C-RNTI of UE u16 crnti; + /// C-RNTI of UE before HO + uint16_t crnti_before_ho; ///user id (rnti) of connected UEs /// uplink active flag uint8_t ul_active; /// pointer to RRC PHY configuration diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 4e2ccd360e6bde97f8d511aecf1cee5bf4d6b79e..4a7e69edcbeac186cefc9ab97ef669b63831a39a 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -227,7 +227,13 @@ PRACH_RESOURCES_t *ue_get_rach(u8 Mod_id,u32 frame, u8 eNB_index,u8 subframe){ u16 Size16; struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL; s32 frame_diff=0; - + mac_rlc_status_resp_t rlc_status; + u8 dcch_header_len=0; + u8 dcch_header_len_tmp=0; + u16 sdu_lengths[8]; + u8 sdu_lcids[8],payload_offset=0,num_sdus=0; + u8 ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES]; + u16 sdu_length_total=0; if (UE_mode == PRACH) { if (UE_mac_inst[Mod_id].radioResourceConfigCommon) @@ -254,11 +260,9 @@ PRACH_RESOURCES_t *ue_get_rach(u8 Mod_id,u32 frame, u8 eNB_index,u8 subframe){ if (Size>0) { - - UE_mac_inst[Mod_id].RA_active = 1; UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER = 1; - UE_mac_inst[Mod_id].RA_Msg3_size = Size+sizeof(SCH_SUBHEADER_SHORT)+sizeof(SCH_SUBHEADER_SHORT); + UE_mac_inst[Mod_id].RA_Msg3_size = Size+sizeof(SCH_SUBHEADER_SHORT)+sizeof(SCH_SUBHEADER_SHORT); UE_mac_inst[Mod_id].RA_prachMaskIndex = 0; UE_mac_inst[Mod_id].RA_prach_resources.Msg3 = UE_mac_inst[Mod_id].CCCH_pdu.payload; UE_mac_inst[Mod_id].RA_backoff_cnt = 0; // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator) @@ -289,6 +293,65 @@ PRACH_RESOURCES_t *ue_get_rach(u8 Mod_id,u32 frame, u8 eNB_index,u8 subframe){ NULL, // short bsr NULL, // long_bsr 1); //post_padding + + return(&UE_mac_inst[Mod_id].RA_prach_resources); + } + else if (UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[DCCH] > 0) { + // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) + dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element + rlc_status = mac_rlc_status_ind(Mod_id+NB_eNB_INST,frame,0,RLC_MBMS_NO, + DCCH, + 6); + if (UE_mac_inst[Mod_id].crnti_before_ho) + LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n", + Mod_id,frame, UE_mac_inst[Mod_id].crnti,UE_mac_inst[Mod_id].crnti_before_ho, rlc_status.bytes_in_buffer,dcch_header_len); + else + LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n", + Mod_id,frame, rlc_status.bytes_in_buffer,dcch_header_len); + + sdu_lengths[0] = mac_rlc_data_req(Mod_id+NB_eNB_INST,frame,RLC_MBMS_NO, + DCCH, + (char *)&ulsch_buff[0]); + + sdu_length_total = sdu_lengths[0]; + sdu_lcids[0] = DCCH; + + LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",Mod_id,sdu_lengths[0]); + num_sdus = 1; + update_bsr(Mod_id, frame, DCCH,UE_mac_inst[Mod_id].scheduling_info.LCGID[DCCH]); + //header_len +=2; + UE_mac_inst[Mod_id].RA_active = 1; + UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER = 1; + UE_mac_inst[Mod_id].RA_Msg3_size = Size+dcch_header_len; + UE_mac_inst[Mod_id].RA_prachMaskIndex = 0; + UE_mac_inst[Mod_id].RA_prach_resources.Msg3 = ulsch_buff; + UE_mac_inst[Mod_id].RA_backoff_cnt = 0; // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator) + if (rach_ConfigCommon) { + UE_mac_inst[Mod_id].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize; + if (UE_mac_inst[Mod_id].RA_window_cnt == 9) + UE_mac_inst[Mod_id].RA_window_cnt = 10; // Note: 9 subframe window doesn't exist, after 8 is 10! + } + else { + LOG_D(MAC,"[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",Mod_id,frame); + mac_xface->macphy_exit(""); + } + UE_mac_inst[Mod_id].RA_tx_frame = frame; + UE_mac_inst[Mod_id].RA_tx_subframe = subframe; + UE_mac_inst[Mod_id].RA_backoff_frame = frame; + UE_mac_inst[Mod_id].RA_backoff_subframe = subframe; + // Fill in preamble and PRACH resource + get_prach_resources(Mod_id,eNB_index,subframe,1,NULL); + generate_ulsch_header((u8*)ulsch_buff, // mac header + 1, // num sdus + 0, // short pading + &Size16, // sdu length + &lcid, // sdu lcid + NULL, // power headroom + &UE_mac_inst[Mod_id].crnti, // crnti + NULL, // truncated bsr + NULL, // short bsr + NULL, // long_bsr + 0); //post_padding return(&UE_mac_inst[Mod_id].RA_prach_resources); } diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index e8e8a920f35d4b2f0b1a87a72eddb79e4cf8cee6..e06aa130de5e540b4e2535f071c222c30ef6214e 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1366,7 +1366,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire LOG_E(MAC,"RRC Loss of synch, returning PHY_RESYNCH\n"); return(PHY_RESYNCH); case RRC_Handover_failed: - LOG_D(MAC,"Handover failure for UE %d eNB_index %d\n",Mod_id,eNB_index); + LOG_N(MAC,"Handover failure for UE %d eNB_index %d\n",Mod_id,eNB_index); //Invalid...need to add another MAC UE state for re-connection procedure mac_xface->phy_config_afterHO_ue(Mod_id,eNB_index,(MobilityControlInfo_t *)NULL,1); //return(3); @@ -1388,7 +1388,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire LOG_E(MAC,"FATAL: radioResourceConfigCommon is NULL!!!\n"); mac_xface->macphy_exit(""); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - return(RRC_OK); // RRC_OK ??? + return(RRC_OK); } LOG_I(MAC,"Frame %d: Contention resolution timer %d/%d\n",frame,UE_mac_inst[Mod_id].RA_contention_resolution_cnt, diff --git a/openair2/Makefile b/openair2/Makefile index 4fe94ad214a55938d59dab9c16b1dc2e280ab5ff..b771192d55f08a054db076ea3a73401aca2e5fd5 100755 --- a/openair2/Makefile +++ b/openair2/Makefile @@ -205,6 +205,9 @@ emul_rt: clean: (cd NAS/DRIVER/MESH && $(MAKE) clean) + (cd NAS/DRIVER/LITE && $(MAKE) clean) + rm -rf NAS/DRIVER/MESH/RB_TOOL/rb_tool + rm -rf NAS/DRIVER/LITE/RB_TOOL/rb_tool cleanall: find -name *.o -delete -print diff --git a/targets/README.txt b/targets/README.txt index d136203e2468ea5278c23627cc60ffff6fe2ca89..07136376005505b27e677398e080ec58448dc49a 100644 --- a/targets/README.txt +++ b/targets/README.txt @@ -15,7 +15,7 @@ First, you must have all four openair SW directories, openair1, openair2, openai 1. The following packages must be available on your system: - libblas and libblas-dev - - libxml2 and libxml2-dev + - libxml2 and libxml2-dev and gccxml - libforms-bin libforms-dev - libatlas-base-dev and libatlas-headers (for Ubuntu 11.04, libatlas-dev instead of libatlas-headers) - asn1c and the LTE ASN1 files (for more information on how to install this and generate the required files see the README file in openair2/RRC/LITE/MESSAGES) diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile index f059bfe95a5996f60cfe3ae40ee7405220ff9a02..2607b8c1d2abb7da4e73640b8c8469541e10d049 100644 --- a/targets/SIMU/USER/Makefile +++ b/targets/SIMU/USER/Makefile @@ -407,14 +407,15 @@ oaisimCROWN: $(OBJ) $(ASN1_MSG_OBJS1) oaisimCROWN.c @echo "Compiling oaisimCROWN.c ..." @$(CC) oaisimCROWN.c -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) $(UTILS_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisimCROWN $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(ASN1_MSG_OBJS1) -lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt -test_nasmesh_fix: +nasmesh_fix: (cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE)) (cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink_address_fix.ko) (cp $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko . ) -nasmesh_fix: +nasmesh_fix_install: (cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE)) (cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink_address_fix.ko) (sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko) + (cp $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko . ) nasmesh_nl: (cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE)) (cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink.ko) @@ -425,7 +426,8 @@ rb_tool: nasmesh_install: (sudo rmmod nasmesh) (sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko) - +nasmesh_clean: + (cd $(OPENAIR2_DIR) && $(MAKE) clean) nas_sim_mt_cellular: ( cd $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR && make nasmt_sim CELLULAR=1 NO_RRM=1) diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 98c4b59784ae93b6cab58401c03089d6fd35f098..d7e113cc1371dc12d0c1911afff89d596b36be66 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -416,7 +416,7 @@ void check_and_adjust_params() { LOG_I(EMU,"[INIT] Starting NAS netlink interface\n"); ret = netlink_init(); if (ret < 0) - LOG_E(EMU,"[INIT] Netlink not available, careful ...\n"); + LOG_W(EMU,"[INIT] Netlink not available, careful ...\n"); if (ethernet_flag == 1) { oai_emulation.info.master[oai_emulation.info.master_id].nb_ue = oai_emulation.info.nb_ue_local + oai_emulation.info.nb_rn_local; diff --git a/targets/TEST/OAI/case01.py b/targets/TEST/OAI/case01.py index b68d4b6e77125eedae2b49282997a2270a355cb8..acfbd1fcb1f8022cf29efcf5b963a9bc4faecee8 100644 --- a/targets/TEST/OAI/case01.py +++ b/targets/TEST/OAI/case01.py @@ -38,14 +38,14 @@ import log import openair import core -makerr1 = 'make: ***' +makerr1 = '***' makerr2 = 'Error 1' def execute(oai, user, pw, logfile): case = '01' oai.send('cd $OPENAIR_TARGETS;') - + try: test = '00' name = 'Check oai.svn.add' @@ -64,7 +64,7 @@ def execute(oai, user, pw, logfile): log.ok(case, test, name, conf, '', logfile) oai.send('cd SIMU/USER;') - + try: test = '01' name = 'Compile oai.rel8.make' @@ -88,15 +88,10 @@ def execute(oai, user, pw, logfile): oai.send('make cleanall;') oai.send('rm -f ./oaisim.rel8.nas;') oai.send('rm -f ./nasmesh;') + oai.send('make nasmesh_clean;') + oai.send_expect_false('make nasmesh_fix;', makerr1, 60) oai.send_expect_false('make NAS=1 -j4;', makerr1, 1500) oai.send('cp ./oaisim ./oaisim.rel8.nas;') - if user == 'root' : - oai.send_nowait('rmmod nasmesh;') - oai.send_expect_false('make nasmesh_fix;', makerr1, 60) - else : - oai.send_nowait('echo '+pw+ ' | sudo -S rmmod nasmesh;') - oai.send_expect_false('make test_nasmesh_fix;', makerr1, 60) - oai.send_nowait('echo '+pw+ ' | sudo -S insmod ./nasmesh.ko;') except log.err, e: log.fail(case, test, name, conf, e.value, diag, logfile) @@ -183,8 +178,10 @@ def execute(oai, user, pw, logfile): #oai.send('cp ./oaisim ./oaisim.rel8.cellular.rg;') #except log.err, e: #log.fail(case, test, name, conf, e.value, diag, logfile) + #log.skip(case, test, name, conf, '', '', logfile) #else: #log.ok(case, test, name, conf, '', logfile) + #log.skip(case, test, name, conf, '', '', logfile) #try: #test = '08' @@ -199,12 +196,14 @@ def execute(oai, user, pw, logfile): #oai.send('cp ./oaisim ./oaisim.rel8.cellular.mt;') #except log.err, e: #log.fail(case, test, name, conf, e.value, diag, logfile) + #log.skip(case, test, name, conf, '', '', logfile) #else: #log.ok(case, test, name, conf, '', logfile) + #log.skip(case, test, name, conf, '', '', logfile) #try: #test = '09' - #name = 'Compile nas_sim_rg_cellular' + #name = 'Compile oai.rel8.cellular.nas.eNB' #conf = 'make nas_sim_rg_cellular' #diag = 'check the compilation errors for NAS SIM RRC Cellular (node RG)' #oai.send('make clean;') @@ -215,12 +214,14 @@ def execute(oai, user, pw, logfile): #oai.send_expect_false('make nas_sim_rg_cellular -j4;', makerr1, 1500) #except log.err, e: #log.fail(case, test, name, conf, e.value, diag, logfile) + #log.skip(case, test, name, conf, '', '', logfile) #else: #log.ok(case, test, name, conf, '', logfile) - + #log.skip(case, test, name, conf, '', '', logfile) + #try: #test = '10' - #name = 'Compile nas_sim_mt_cellular' + #name = 'Compile oai.rel8.cellular.nas.UE' #conf = 'make nas_sim_mt_cellular' #diag = 'check the compilation errors for NAS SIM RRC Cellular (node MT)' #oai.send('make clean;') @@ -231,9 +232,11 @@ def execute(oai, user, pw, logfile): #oai.send_expect_false('make nas_sim_mt_cellular -j4;', makerr1, 1500) #except log.err, e: #log.fail(case, test, name, conf, e.value, diag, logfile) + #log.skip(case, test, name, conf, '', '', logfile) #else: #log.ok(case, test, name, conf, '', logfile) - + #log.skip(case, test, name, conf, '', '', logfile) + try: test = '11' name = 'Compile oai.rel8.itti.make' diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py index fdf44511acc8dff18d746459c2a3d726d83d3f9a..4f585543b108cb7a6dc863be40903eeb046f44d4 100644 --- a/targets/TEST/OAI/case02.py +++ b/targets/TEST/OAI/case02.py @@ -93,6 +93,7 @@ def execute(oai, user, pw, logfile): test = '03' name = 'Run oai.rel8.abs.ping' diag = 'Data-plane is not working normally, check the OAI protocol stack, OAI driver, and normal operation of the OS' + oai.driver(oai,user,pw) for i in range(NUM_UE) : for j in range(NUM_eNB) : conf = '-a -A AWGN -u' + str(i+1) +' -b'+ str(j+1) @@ -111,6 +112,8 @@ def execute(oai, user, pw, logfile): oai.send_nowait('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;') time.sleep(1) oai.send_nowait('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;') + + oai.rm_driver(oai,user,pw) except log.err, e: log.fail(case, test, name, conf, e.value, diag, logfile) diff --git a/targets/TEST/OAI/openair.py b/targets/TEST/OAI/openair.py index cc2f2e0b57f756c02c7218ef77421bc410cab7d3..be76eb9697a466f60f58c02c6090facbf9b0eb74 100644 --- a/targets/TEST/OAI/openair.py +++ b/targets/TEST/OAI/openair.py @@ -121,4 +121,27 @@ class openair(core): except Error, val: print "Error:", val - + def rm_driver(self,oai,user, pw): + try: + if user == 'root' : + #oai.send_nowait('rmmod nasmesh;') + os.system('rmmod nasmesh;') + else : + #oai.send_nowait('echo '+pw+ ' | sudo -S rmmod nasmesh;') + os.system('echo '+pw+ ' | sudo -S rmmod nasmesh;') + except Error, val: + print "Error removing oai network driver module:", val + + def driver(self,oai,user,pw): + pwd = oai.send_recv('pwd') + oai.send('cd $OPENAIR_TARGETS;') + oai.send('cd SIMU/USER;') + try: + if user == 'root' : + oai.send_nowait('insmod ./nasmesh.ko;') + else : + oai.send_nowait('echo '+pw+ ' | sudo -S insmod ./nasmesh.ko;') + + oai.send_nowait('cd '+ pwd) + except Error, val: + print "Error inserting oai network driver module:", val diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py index ea43c79acc729e92ee40f491db75edde2afe095a..23441ddc6d704138480170536264125ebf920459 100644 --- a/targets/TEST/OAI/test01.py +++ b/targets/TEST/OAI/test01.py @@ -103,12 +103,15 @@ log.writefile(logfile,'====================start'+test+' at ' + ctime + '======= log.set_debug_level(debug) oai.kill(user, pw) +oai.rm_driver(oai,user,pw) + # start te test cases case01.execute(oai, user, pw, logfile) case02.execute(oai, user, pw, logfile) case03.execute(oai, user, pw, logfile) oai.kill(user, pw) +oai.rm_driver(oai,user,pw) # perform the stats log.statistics(logfile)