Commit d5841cbe authored by Stefan's avatar Stefan

Merge branch 'ulsch_scheduler_opti' of...

Merge branch 'ulsch_scheduler_opti' of https://gitlab.forge.orange-labs.fr/afyf6286/oai-orange into ulsch_scheduler_opti
parents 17500573 fb1ccbaf
......@@ -203,7 +203,10 @@ 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)
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:
......@@ -212,26 +215,37 @@ class SSHConnection():
scp_spawn.sendline(password)
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0:
pass
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
count = 10
copy_status = True
else:
logging.debug('2 - scp_response = ' + str(scp_response))
sys.exit('SCP failed')
elif scp_response == 2:
pass
count = 10
copy_status = True
else:
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:
sys.exit('SCP failed')
def copyout(self, ipaddress, username, password, source, destination):
count = 0
copy_status = False
logging.debug('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination)
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:
......@@ -240,22 +254,30 @@ class SSHConnection():
scp_spawn.sendline(password)
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0:
pass
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
count = 10
copy_status = True
else:
logging.debug('2 - scp_response = ' + str(scp_response))
sys.exit('SCP failed')
elif scp_response == 2:
pass
count = 10
copy_status = True
else:
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:
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(' <tr">\n')
self.htmlFile.write(' <tr>\n')
self.htmlFile.write(' <th bgcolor = "#33CCFF" colspan=2>Final Tab Status</th>\n')
if passStatus:
self.htmlFile.write(' <th bgcolor = "green" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">PASS <span class="glyphicon glyphicon-ok"></span> </font></th>\n')
......
......@@ -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);
......
......@@ -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];
......
......@@ -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);
......@@ -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,7 +418,20 @@ 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++) {
......@@ -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,8 +1273,48 @@ 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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment