Commit 0e687fb7 authored by Xenofon Foukas's avatar Xenofon Foukas

Fixed bug related to the reporting of timing advance to the controller that...

Fixed bug related to the reporting of timing advance to the controller that severely dropped the performance of the remote scheduler
parent a3427bf8
...@@ -443,9 +443,9 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ...@@ -443,9 +443,9 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
if (rlc_reports[j] == NULL) if (rlc_reports[j] == NULL)
goto error; goto error;
protocol__flex_rlc_bsr__init(rlc_reports[j]); protocol__flex_rlc_bsr__init(rlc_reports[j]);
rlc_reports[j]->lc_id = j+1; rlc_reports[j]->lc_id = j + 1;
rlc_reports[j]->has_lc_id = 1; rlc_reports[j]->has_lc_id = 1;
rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j + 1);
rlc_reports[j]->has_tx_queue_size = 1; rlc_reports[j]->has_tx_queue_size = 1;
//TODO:Set tx queue head of line delay in ms //TODO:Set tx queue head of line delay in ms
...@@ -963,7 +963,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle ...@@ -963,7 +963,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
sf_trigger_msg->header = header; sf_trigger_msg->header = header;
sf_trigger_msg->has_sfn_sf = 1; sf_trigger_msg->has_sfn_sf = 1;
sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 1); sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 3);
sf_trigger_msg->n_dl_info = 0; sf_trigger_msg->n_dl_info = 0;
......
...@@ -562,57 +562,63 @@ int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) { ...@@ -562,57 +562,63 @@ int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) {
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id); uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id);
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0);
return rlc_status.bytes_in_buffer; return rlc_status.bytes_in_buffer;
} }
int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id) { short flexran_get_TA(mid_t mod_id, mid_t ue_id, int CC_id) {
UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list; UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list;
UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id]; UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id];
int rnti; int rnti;
rnti = flexran_get_ue_crnti(mod_id, ue_id); rnti = flexran_get_ue_crnti(mod_id, ue_id);
if (ue_sched_ctl->ta_timer == 0) {
// WE SHOULD PROTECT the eNB_UE_stats with a mutex here ...
LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
ue_sched_ctl->ta_timer = 20; // wait 20 subframes before taking TA measurement from PHY //ue_sched_ctl->ta_timer = 20; // wait 20 subframes before taking TA measurement from PHY
switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) { switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) {
case 6: case 6:
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update; return eNB_UE_stats->timing_advance_update;
break;
case 15: case 15:
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/2; return eNB_UE_stats->timing_advance_update/2;
break;
case 25: case 25:
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/4; return eNB_UE_stats->timing_advance_update/4;
break;
case 50: case 50:
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/8; return eNB_UE_stats->timing_advance_update/8;
break;
case 75: case 75:
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/12; return eNB_UE_stats->timing_advance_update/12;
break;
case 100: case 100:
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/16; if (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.threequarter_fs == 0) {
break; return eNB_UE_stats->timing_advance_update/16;
} else {
return eNB_UE_stats->timing_advance_update/12;
} }
// clear the update in case PHY does not have a new measurement after timer expiry default:
eNB_UE_stats->timing_advance_update = 0; return 0;
} }
else { }
void flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id) {
UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list;
UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id];
int rnti;
rnti = flexran_get_ue_crnti(mod_id, ue_id);
if (ue_sched_ctl->ta_timer == 0) {
// WE SHOULD PROTECT the eNB_UE_stats with a mutex here ...
// LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
//ue_sched_ctl->ta_timer = 20; // wait 20 subframes before taking TA measurement from PHY
ue_sched_ctl->ta_update = flexran_get_TA(mod_id, ue_id, CC_id);
// clear the update in case PHY does not have a new measurement after timer expiry
// eNB_UE_stats->timing_advance_update = 0;
} else {
ue_sched_ctl->ta_timer--; ue_sched_ctl->ta_timer--;
ue_sched_ctl->ta_update = 0; // don't trigger a timing advance command ue_sched_ctl->ta_update = 0; // don't trigger a timing advance command
} }
return ue_sched_ctl->ta_update = 0;
} }
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) {
...@@ -627,8 +633,8 @@ int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { ...@@ -627,8 +633,8 @@ int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) {
return 0; return 0;
} }
if (ue_sched_ctl->ta_update == 0) { if (flexran_get_TA(mod_id, ue_id, CC_id) != 0) {
return 1; return PROTOCOL__FLEX_CE_TYPE__FLPCET_TA;
} else { } else {
return 0; return 0;
} }
......
...@@ -185,8 +185,11 @@ int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id); ...@@ -185,8 +185,11 @@ int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id);
/* Get the transmission queue size for a UE with a channel_id logical channel id */ /* Get the transmission queue size for a UE with a channel_id logical channel id */
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* Check the status of the timing advance for a UE */
short flexran_get_TA(mid_t mod_id, mid_t ue_id, int CC_id);
/* Update the timing advance status (find out whether a timing advance command is required) */ /* Update the timing advance status (find out whether a timing advance command is required) */
int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id); void flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id);
/* Return timing advance MAC control element for a designated cell and UE */ /* Return timing advance MAC control element for a designated cell and UE */
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id);
......
...@@ -172,7 +172,7 @@ Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* tim ...@@ -172,7 +172,7 @@ Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* tim
struct flexran_agent_timer_element_s *found = get_timer_entry(timer_id); struct flexran_agent_timer_element_s *found = get_timer_entry(timer_id);
if (found == NULL ) goto error; if (found == NULL ) goto error;
LOG_I(FLEXRAN_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); LOG_D(FLEXRAN_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id);
if (timer_args == NULL) if (timer_args == NULL)
LOG_W(FLEXRAN_AGENT,"null timer args\n"); LOG_W(FLEXRAN_AGENT,"null timer args\n");
......
...@@ -156,23 +156,16 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -156,23 +156,16 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
num_sdus = 0; num_sdus = 0;
sdu_length_total = 0; sdu_length_total = 0;
if (ta_len > 0) {
// Reset the measurement
ue_sched_ctl->ta_timer = 20;
eNB_UE_stats->timing_advance_update = 0;
// header_len = ta_len;
//last_sdu_header_len = ta_len;
}
n_lc = dl_data->n_rlc_pdu; n_lc = dl_data->n_rlc_pdu;
// Go through each one of the channel commands and create SDUs // Go through each one of the channel commands and create SDUs
header_len = 0; header_len = 0;
last_sdu_header_len = 0; last_sdu_header_len = 0;
for (j = 0; j < n_lc; j++) { for (j = 0; j < n_lc; j++) {
sdu_lengths[j] = 0;
lcid = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->logical_channel_id; lcid = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->logical_channel_id;
rlc_size = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->size; rlc_size = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->size;
LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", LOG_D(MAC,"[TEST] [eNB %d] [Frame %d] [Subframe %d], LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
mod_id, frame, lcid, CC_id, rlc_size); mod_id, frame, subframe, lcid, CC_id, rlc_size);
if (rlc_size > 0) { if (rlc_size > 0) {
rlc_status = mac_rlc_status_ind(mod_id, rlc_status = mac_rlc_status_ind(mod_id,
...@@ -186,6 +179,10 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -186,6 +179,10 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
if (rlc_status.bytes_in_buffer > 0) { if (rlc_status.bytes_in_buffer > 0) {
if (rlc_status.bytes_in_buffer < rlc_size) {
rlc_size = rlc_status.bytes_in_buffer;
}
if (rlc_size <= 2) { if (rlc_size <= 2) {
rlc_size = 3; rlc_size = 3;
} }
...@@ -199,8 +196,6 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -199,8 +196,6 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
lcid, lcid,
rlc_size); // transport block set size rlc_size); // transport block set size
sdu_lengths[j] = 0;
LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid);
if (rlc_status.bytes_in_buffer > 0) { if (rlc_status.bytes_in_buffer > 0) {
...@@ -258,7 +253,14 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -258,7 +253,14 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
post_padding = TBS - sdu_length_total - header_len - ta_len; // 1 is for the postpadding header post_padding = TBS - sdu_length_total - header_len - ta_len; // 1 is for the postpadding header
} }
ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; if (ta_len > 0) {
// Reset the measurement
ta_update = flexran_get_TA(mod_id, UE_id, CC_id);
ue_sched_ctl->ta_timer = 20;
eNB_UE_stats->timing_advance_update = 0;
} else {
ta_update = 0;
}
// If there is nothing to schedule, just leave // If there is nothing to schedule, just leave
if ((sdu_length_total) <= 0) { if ((sdu_length_total) <= 0) {
...@@ -281,6 +283,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -281,6 +283,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
#ifdef DEBUG_eNB_SCHEDULER #ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n");
...@@ -343,6 +347,11 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -343,6 +347,11 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
//eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
//eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
} else {
LOG_D(FLEXRAN_AGENT, "No need to schedule a dci after all. Just drop it\n");
harq_pid_updated[UE_id][harq_pid] = 1;
harq_pid_round[UE_id][harq_pid] = 0;
continue;
} }
} else { } else {
// No need to create anything apart of DCI in case of retransmission // No need to create anything apart of DCI in case of retransmission
......
...@@ -1192,7 +1192,7 @@ flexran_schedule_ue_spec_common(mid_t mod_id, ...@@ -1192,7 +1192,7 @@ flexran_schedule_ue_spec_common(mid_t mod_id,
// check first for RLC data on DCCH // check first for RLC data on DCCH
// add the length for all the control elements (timing adv, drx, etc) : header + payload // add the length for all the control elements (timing adv, drx, etc) : header + payload
ta_len = (ue_sched_ctl->ta_update!=0) ? 2 : 0; ta_len = (ue_sched_ctl->ta_update != 0) ? 2 : 0;
dl_data[num_ues_added]->n_ce_bitmap = 2; dl_data[num_ues_added]->n_ce_bitmap = 2;
dl_data[num_ues_added]->ce_bitmap = (uint32_t *) calloc(2, sizeof(uint32_t)); dl_data[num_ues_added]->ce_bitmap = (uint32_t *) calloc(2, sizeof(uint32_t));
...@@ -1401,7 +1401,6 @@ flexran_schedule_ue_spec_common(mid_t mod_id, ...@@ -1401,7 +1401,6 @@ flexran_schedule_ue_spec_common(mid_t mod_id,
if (flexran_get_p0_pucch_status(mod_id, UE_id, CC_id) == 1) { if (flexran_get_p0_pucch_status(mod_id, UE_id, CC_id) == 1) {
flexran_update_p0_pucch(mod_id, UE_id, CC_id); flexran_update_p0_pucch(mod_id, UE_id, CC_id);
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frame; UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frame;
UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframe; UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframe;
if (normalized_rx_power>(target_rx_power+1)) { if (normalized_rx_power>(target_rx_power+1)) {
......
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