Commit d0476cb0 authored by Xenofon Foukas's avatar Xenofon Foukas

Fixed various bugs related to scheduling using agent

parent 27a1101a
...@@ -553,7 +553,11 @@ int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id) { ...@@ -553,7 +553,11 @@ int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id) {
} }
int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) { int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; LTE_eNB_UE_stats *eNB_UE_stats = NULL;
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, 0, UE_RNTI(mod_id, ue_id));
return eNB_UE_stats->DL_cqi[0];
// return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi;
} }
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) {
...@@ -680,8 +684,13 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { ...@@ -680,8 +684,13 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id) {
return tpc; return tpc;
} }
int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int flexran_get_harq(const mid_t mod_id,
unsigned char *id, unsigned char *round) { //flag_id_status = 0 then id, else status const uint8_t CC_id,
const mid_t ue_id,
const int frame,
const uint8_t subframe,
uint8_t *id,
uint8_t *round) { //flag_id_status = 0 then id, else status
/*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in
* get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add
* DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/
......
...@@ -99,8 +99,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -99,8 +99,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
uint16_t nb_rb; uint16_t nb_rb;
uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0;
unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
unsigned char round = 0; uint8_t round = 0;
unsigned char harq_pid = 0; uint8_t harq_pid = 0;
// LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; // LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
LTE_eNB_UE_stats *eNB_UE_stats = NULL; LTE_eNB_UE_stats *eNB_UE_stats = NULL;
uint16_t sdu_length_total = 0; uint16_t sdu_length_total = 0;
...@@ -147,7 +147,7 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -147,7 +147,7 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
if (dl_data->n_ce_bitmap > 0) { if (dl_data->n_ce_bitmap > 0) {
//Check if there is TA command and set the length appropriately //Check if there is TA command and set the length appropriately
ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 1 : 0; ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2 : 0;
} }
num_sdus = 0; num_sdus = 0;
...@@ -157,12 +157,14 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -157,12 +157,14 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
// Reset the measurement // Reset the measurement
ue_sched_ctl->ta_timer = 20; ue_sched_ctl->ta_timer = 20;
eNB_UE_stats->timing_advance_update = 0; eNB_UE_stats->timing_advance_update = 0;
header_len = ta_len; // header_len = ta_len;
last_sdu_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;
last_sdu_header_len = 0;
for (i = 0; i < n_lc; i++) { for (i = 0; i < n_lc; i++) {
lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id;
rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size;
...@@ -200,14 +202,14 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -200,14 +202,14 @@ 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) {
sdu_lengths[i] += mac_rlc_data_req(mod_id, sdu_lengths[i] = mac_rlc_data_req(mod_id,
rnti, rnti,
mod_id, mod_id,
frame, frame,
ENB_FLAG_YES, ENB_FLAG_YES,
MBMS_FLAG_NO, MBMS_FLAG_NO,
lcid, lcid,
(char *)&dlsch_buffer[sdu_length_total]); (char *)&dlsch_buffer[sdu_length_total]);
LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]);
sdu_length_total += sdu_lengths[i]; sdu_length_total += sdu_lengths[i];
...@@ -216,7 +218,7 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -216,7 +218,7 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1;
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i];
if (sdu_lengths[i] <= 128) { if (sdu_lengths[i] < 128) {
header_len += 2; header_len += 2;
last_sdu_header_len = 2; last_sdu_header_len = 2;
} else { } else {
...@@ -230,34 +232,31 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -230,34 +232,31 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
} // SDU creation end } // SDU creation end
if (((sdu_length_total + header_len) > 0)) { if (((sdu_length_total + header_len + ta_len) > 0)) {
// header_len_tmp = header_len; header_len_tmp = header_len;
// If we have only a single SDU, header length becomes 1 // If we have only a single SDU, header length becomes 1
if ((num_sdus + ta_len) == 1) { if ((num_sdus) == 1) {
//if (header_len == 2 || header_len == 3) { //if (header_len == 2 || header_len == 3) {
header_len = 1; header_len = 1;
} else { } else {
header_len = (header_len - last_sdu_header_len) + 1; header_len = (header_len - last_sdu_header_len) + 1;
} }
// there is a payload // If we need a 1 or 2 bit padding or no padding at all
if (((sdu_length_total + header_len) > 0)) { if ((TBS - header_len - sdu_length_total - ta_len) <= 2
// If we need a 1 or 2 bit padding or no padding at all || (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow
if ((TBS - header_len - sdu_length_total - ta_len) <= 2 padding = (TBS - header_len - sdu_length_total - ta_len);
|| (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow post_padding = 0;
padding = (TBS - header_len - sdu_length_total - ta_len); } else { // The last sdu needs to have a length field, since we add padding
post_padding = 0; padding = 0;
} else { // The last sdu needs to have a length field, since we add padding header_len = header_len_tmp;
padding = 0; post_padding = TBS - sdu_length_total - header_len - ta_len; // 1 is for the postpadding header
header_len = header_len_tmp;
post_padding = TBS - sdu_length_total - header_len - ta_len - 1; // 1 is for the postpadding header
}
} }
ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; ta_update = (ta_len > 0) ? ue_sched_ctl->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) {
return; return;
...@@ -319,6 +318,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -319,6 +318,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
nb_rb += get_min_rb_unit(mod_id, CC_id); nb_rb += get_min_rb_unit(mod_id, CC_id);
stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
} }
// LOG_I(FLEXRAN_AGENT, "The MCS was %d\n", dl_dci->mcs[0]);
UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
...@@ -345,8 +346,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, ...@@ -345,8 +346,8 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
//UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id];
} }
UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0]; // UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0];
eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0]; // eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0];
//Fill the proper DCI of OAI //Fill the proper DCI of OAI
flexran_fill_oai_dci(mod_id, CC_id, rnti, dl_dci); flexran_fill_oai_dci(mod_id, CC_id, rnti, dl_dci);
......
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