diff --git a/ci-scripts/main.py b/ci-scripts/main.py index c5c30c8e20..710e06c2c2 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -203,59 +203,81 @@ class SSHConnection(): logging.debug('\u001B[1;37;41m Unexpected Others during closing\u001B[0m') def copyin(self, ipaddress, username, password, source, destination): + count = 0 + copy_status = False logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination) - scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 5) - scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0: - scp_spawn.sendline('yes') - scp_spawn.expect('password:') - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + while count < 4: + scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 5) + scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) if scp_response == 0: - pass + scp_spawn.sendline('yes') + scp_spawn.expect('password:') + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0: + count = 10 + copy_status = True + else: + logging.debug('1 - scp_response = ' + str(scp_response)) + elif scp_response == 1: + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0 or scp_response == 3: + count = 10 + copy_status = True + else: + logging.debug('2 - scp_response = ' + str(scp_response)) + elif scp_response == 2: + count = 10 + copy_status = True else: - logging.debug('1 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 1: - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0 or scp_response == 3: - pass - else: - logging.debug('2 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 2: + logging.debug('3 - scp_response = ' + str(scp_response)) + # adding a tempo when failure + if not copy_status: + time.sleep(1) + count += 1 + if copy_status: pass else: - logging.debug('3 - scp_response = ' + str(scp_response)) sys.exit('SCP failed') def copyout(self, ipaddress, username, password, source, destination): + count = 0 + copy_status = False logging.debug('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination) - scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 5) - scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0: - scp_spawn.sendline('yes') - scp_spawn.expect('password:') - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + while count < 4: + scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 5) + scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) if scp_response == 0: - pass + scp_spawn.sendline('yes') + scp_spawn.expect('password:') + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0: + count = 10 + copy_status = True + else: + logging.debug('1 - scp_response = ' + str(scp_response)) + elif scp_response == 1: + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0 or scp_response == 3: + count = 10 + copy_status = True + else: + logging.debug('2 - scp_response = ' + str(scp_response)) + elif scp_response == 2: + count = 10 + copy_status = True else: - logging.debug('1 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 1: - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0 or scp_response == 3: - pass - else: - logging.debug('2 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 2: + logging.debug('3 - scp_response = ' + str(scp_response)) + # adding a tempo when failure + if not copy_status: + time.sleep(1) + count += 1 + if copy_status: pass else: - logging.debug('3 - scp_response = ' + str(scp_response)) sys.exit('SCP failed') def BuildeNB(self): @@ -2061,7 +2083,7 @@ class SSHConnection(): def CreateHtmlTabFooter(self, passStatus): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' Final Tab Status\n') if passStatus: self.htmlFile.write(' PASS \n') diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index 4962f6a7f9..7e38d6a590 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -565,17 +565,16 @@ int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex return(prach_mask); } -int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) { +int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe) { uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe); + int prach_mask = is_prach_subframe0(frame_parms, prach_ConfigIndex, frame, subframe); #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - int i; - - for (i=0;i<4;i++) { + for (int i=0; i<4; i++) { if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1) - prach_mask|=(is_prach_subframe0(frame_parms,frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],frame,subframe)<<(i+1)); + prach_mask |= (is_prach_subframe0(frame_parms, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i], + frame, subframe) << (i+1)); } #endif return(prach_mask); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index a52403cac4..825a6f255e 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -112,7 +112,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP, nfapi_hi_dci0_request_body_t *hi_dci0_req_body; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; uint8_t sf_ahead_dl; - uint8_t rvseq[4] = { 0, 2, 3, 1 }; + uint8_t rvseq[4] = {0, 2, 3, 1}; ul_req = &mac->UL_req_tmp[CC_id][ra->Msg3_subframe]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 4b64ffd359..a43b227def 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -128,12 +128,36 @@ rx_sdu(const module_id_t enb_mod_idP, mac = RC.mac[enb_mod_idP]; harq_pid = subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP); UE_list = &mac->UE_list; - //ra = (RA_t *) &RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0]; ra = RC.mac[enb_mod_idP]->common_channels[CC_idP].ra; memset(rx_ces, 0, MAX_NUM_CE * sizeof(unsigned char)); memset(rx_lcids, 0, NB_RB_MAX * sizeof(unsigned char)); memset(rx_lengths, 0, NB_RB_MAX * sizeof(unsigned short)); + // LAD + /* + if (UE_id == -1) { + LOG_E(MAC, "Step 1\n"); + LOG_W(MAC, "[MAC] UE_id = -1 ; RNTI = %x ; frame = %d ; subframe = %d ; sdu_length = %d ; sdu = %d\n", + rntiP, + frameP, + subframeP, + sdu_lenP, + *sduP); + } + */ + + // LAD + /* + first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; + LOG_W(MAC, "[MAC] UE_id = %d : first_rb = %d ; scheduled_ul_bytes = %d ; TBS_UL = %d ; frame = %d ; subframe = %d\n", + UE_id, + first_rb, + UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes, + UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid], + frameP, + subframeP); + */ + start_meas(&mac->rx_ulsch_sdu); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU, 1); @@ -141,7 +165,7 @@ rx_sdu(const module_id_t enb_mod_idP, if (opt_enabled == 1) { trace_pdu(DIRECTION_UPLINK, sduP, sdu_lenP, 0, WS_C_RNTI, current_rnti, frameP, subframeP, 0, 0); - LOG_D(OPT, "[eNB %d][ULSCH] Frame %d rnti %x with size %d\n", + LOG_D(OPT, "[eNB %d][ULSCH] Frame %d rnti %x with size %d\n", enb_mod_idP, frameP, current_rnti, @@ -179,11 +203,20 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) { UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0; - // mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, subframeP, UE_RNTI(enb_mod_idP, UE_id)); // replace UE_RNTI(enb_mod_idP, UE_id) by current_rnti ?? mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, subframeP, current_rnti); } /* update bytes to schedule */ + + // LAD + /* + LOG_E(MAC, "Step 2\n"); + LOG_W(MAC, "[MAC] UE_id != -1 and sduP != NULL : first_rb = %d ; scheduled_ul_bytes = %d ; TBS_UL = %d\n", + first_rb, + UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes, + UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid]); + */ + UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes -= UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid]; if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0) { @@ -191,14 +224,16 @@ rx_sdu(const module_id_t enb_mod_idP, } } else { // sduP == NULL => error - LOG_I(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d\n", + LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x\n", enb_mod_idP, harq_pid, CC_idP, frameP, subframeP, UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], - ul_cqi); + ul_cqi, + UE_id, + current_rnti); if (ul_cqi > 200) { // too high energy pattern UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi; @@ -273,11 +308,19 @@ rx_sdu(const module_id_t enb_mod_idP, RA_id, ul_cqi); - // first_rb = ra->msg3_first_rb; // Should it be ra[RA_id]??? first_rb = ra[RA_id].msg3_first_rb; + // LAD + /* + LOG_E(MAC, "Step 3\n"); + LOG_W(MAC, "[MAC] UE_id == -1 : first_rb = %d ; scheduled_ul_bytes = %d ; TBS_UL = %d\n", + first_rb, + UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes, + UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid]); + */ + if (sduP == NULL) { // we've got an error on Msg3 - LOG_I(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", + LOG_W(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", enb_mod_idP, CC_idP, RA_id, @@ -287,9 +330,29 @@ rx_sdu(const module_id_t enb_mod_idP, if (ra[RA_id].msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); } else { - first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; // UE_id = -1 !? + // first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; // UE_id = -1 !!!! ra[RA_id].msg3_round++; - + + // LAD + /* + LOG_E(MAC, "Step 4\n"); + LOG_W(MAC, "[MAC] [UEINFO1] UE_id = %d ; RNTI_ue_template = %x ; RNTI_sdu = %x\n", + UE_id, + UE_list->UE_template[CC_idP][UE_id].rnti, + current_rnti); + + // LAD + LOG_W(MAC, "[MAC] UE_id == -1 and sduP == NULL : first_rb = %d ; scheduled_ul_bytes = %d ; TBS_UL = %d\n", + first_rb, + UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes, + UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid]); + + // LAD + LOG_W(MAC, "[MAC] [RAPROC] msg3_subframe = %d ; msg3_frame = %d\n", + ra[RA_id].Msg3_subframe, + ra[RA_id].Msg3_frame); + */ + /* Prepare handling of retransmission */ get_Msg3allocret(&mac->common_channels[CC_idP], ra[RA_id].Msg3_subframe, @@ -297,6 +360,13 @@ rx_sdu(const module_id_t enb_mod_idP, &ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe); + // LAD + /* + LOG_W(MAC, "[MAC] [RAPROC] After update: msg3_subframe = %d ; msg3_frame = %d\n", + ra[RA_id].Msg3_subframe, + ra[RA_id].Msg3_frame); + */ + add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP); } @@ -348,8 +418,21 @@ rx_sdu(const module_id_t enb_mod_idP, mac->eNB_stats[CC_idP].ulsch_bytes_rx = sdu_lenP; mac->eNB_stats[CC_idP].total_ulsch_bytes_rx += sdu_lenP; mac->eNB_stats[CC_idP].total_ulsch_pdus_rx += 1; - UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0; // can UE_id = -1 !? + if (UE_id != -1) { + UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0; + } + // LAD + /* + LOG_E(MAC, "Step 5\n"); + LOG_W(MAC, "[MAC] [UEINFO2] UE_id = %d ; RNTI_ue_template = %x ; RNTI_sdu = %x ; frame = %d ; subframe = %d\n", + UE_id, + UE_list->UE_template[CC_idP][UE_id].rnti, + current_rnti, + frameP, + subframeP); + */ + /* Control element */ for (int i = 0; i < num_ce; i++) { T(T_ENB_MAC_UE_UL_CE, @@ -453,7 +536,7 @@ rx_sdu(const module_id_t enb_mod_idP, UE_list->UE_template[CC_idP][UE_id].ul_SR = 1; UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 1; - break; + // break; } } else { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); @@ -1085,11 +1168,17 @@ schedule_ulsch(module_id_t module_idP, /* Second setup step */ int sched_subframe = 0; + int sched_frame = 0; /* Second init step */ sched_subframe = (subframeP + 4) % 10; + sched_frame = frameP; cc = mac->common_channels; + if (sched_subframe < subframeP) { + sched_frame++; + } + /* For TDD: check subframes where we have to act and return if nothing should be done now */ if (cc->tdd_Config) { // Done only for CC_id = 0, assume tdd_Config for all CC_id int tdd_sfa = cc->tdd_Config->subframeAssignment; @@ -1184,9 +1273,49 @@ schedule_ulsch(module_id_t module_idP, for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) { first_rb[CC_id] = 1; // leave out first RB for PUCCH + int start_rb = 0; + int nb_rb = 6; + LTE_DL_FRAME_PARMS *frame_parms = &(RC.eNB[module_idP][CC_id]->frame_parms); RA_t *ra_ptr = cc->ra; - /* + /* Louis-Adrien: Only set for FDD (for the moment) + * Hard coded for prach-ConfigIndex = 0 and prach-Freqoffset = 2 + * ToDo: The PRACH resources should be added with modularity (here?) + */ + /* + if (cc->tdd_Config == NULL) { // FDD + if (((sched_frame %2) == 0) && sched_subframe == 1) { // RACH frame and subframe + if (first_rb[CC_id] < 8) { + n_rb_ul_tab = to_prb(cc->ul_Bandwidth); // return total number of PRB + + if (n_rb_ul_tab >= 8) { + first_rb[CC_id] = 8; + } else { + return; + } + } + } + } + */ + if (is_prach_subframe(frame_parms, sched_frame, sched_subframe) == 1) { + start_rb = get_prach_prb_offset(frame_parms, + frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset, + 0, // tdd_mapindex + frameP); // Nf --> shouldn't it be sched_frame ??? + + first_rb[CC_id] = start_rb + nb_rb; + + // LAD + LOG_W(MAC, "[MAC] Config Index = %d ; Freq_offset = %d ; first_rb = %d ; subframe = %d ; sched_subframe = %d\n", + frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset, + first_rb[CC_id], + subframeP, + sched_subframe); + } + + /* * Check if RA (Msg3) is active in this subframeP, if so skip the PRB used for Msg3 * Msg3 is using 1 PRB so we need to increase first_rb accordingly * Not sure about the break (can there be more than 1 active RA procedure per CC_id and per subframe?) diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 7785abd16f..60496424b5 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -997,6 +997,7 @@ typedef struct { uint8_t crnti_reconfigurationcomplete_flag; uint8_t cqi_req_flag; } UE_sched_ctrl; + /*! \brief eNB template for the Random access information */ typedef struct { /// Flag to indicate this process is active