Commit 371bd454 authored by Xenofon Foukas's avatar Xenofon Foukas

Refactored local FlexRAN scheduler to make further use of FlexRAN API

parent 4e66b34b
......@@ -995,7 +995,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
// TODO: This should be different per TB
if(harq_status == 0)
dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_ACK;
else if (harq_status == 1)
else if (harq_status > 0)
dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK;
}
/*Fill in the serving cell index for this UE */
......
......@@ -569,46 +569,73 @@ int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t chann
return rlc_status.bytes_in_buffer;
}
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id)
{
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id) {
if (eNB_UE_stats == NULL) {
return 0;
}
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) {
int32_t time_advance;
// 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
switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) {
case 6:
time_advance = eNB_UE_stats->timing_advance_update;
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update;
break;
case 15:
time_advance = eNB_UE_stats->timing_advance_update/2;
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/2;
break;
case 25:
time_advance = eNB_UE_stats->timing_advance_update/4;
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/4;
break;
case 50:
time_advance = eNB_UE_stats->timing_advance_update/8;
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/8;
break;
case 75:
time_advance = eNB_UE_stats->timing_advance_update/12;
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/12;
break;
case 100:
time_advance = eNB_UE_stats->timing_advance_update/16;
ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/16;
break;
}
// 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_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) {
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];
if(time_advance > 0)
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
if (eNB_UE_stats == NULL) {
return 0;
}
if (ue_sched_ctl->ta_update == 0) {
return 1;
else
} else {
return 0;
}
}
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) {
......@@ -660,27 +687,29 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id) {
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 *id, int *status) { //flag_id_status = 0 then id, else status
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 *id, int *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
* 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];*/
uint8_t harq_pid;
uint8_t round;
uint8_t harq_round;
uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL);
mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL);
*id = harq_pid;
if (round > 0) {
*status = 1;
} else {
*status = 0;
}
*round = harq_round;
/* if (round > 0) { */
/* *status = 1; */
/* } else { */
/* *status = 0; */
/* } */
return 0;
/* return 0; */
return round;
}
int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) {
......@@ -705,6 +734,24 @@ int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) {
return pucch_rx_received;
}
int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id) {
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
return eNB_UE_stats->Po_PUCCH_update;
}
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id) {
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
eNB_UE_stats->Po_PUCCH_update = 0;
return 0;
}
/*
* ************************************
......@@ -861,6 +908,13 @@ int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) {
return frame_parms->N_RB_UL;
}
int flexran_get_N_RBG(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->N_RBG;
}
int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
......@@ -891,10 +945,10 @@ int flexran_get_duplex_mode(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
if(frame_parms->frame_type == 0)
return 1;
else if (frame_parms->frame_type == 1)
return 0;
if(frame_parms->frame_type == TDD)
return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD;
else if (frame_parms->frame_type == FDD)
return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD;
return -1;
}
......
......@@ -193,6 +193,9 @@ 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 */
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* 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);
/* 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);
......@@ -245,6 +248,9 @@ int flexran_get_N_RB_DL(mid_t mod_id, int CC_id);
/* Get number of UL resource blocks */
int flexran_get_N_RB_UL(mid_t mod_id, int CC_id);
/* Get number of resource block groups */
int flexran_get_N_RBG(mid_t mod_id, int CC_id);
/* Get DL/UL subframe assignment. TDD only */
int flexran_get_subframe_assignment(mid_t mod_id, int CC_id);
......@@ -273,13 +279,18 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id);
a designated frame and subframe. Returns 0 for success. The id and the
status of the HARQ process are stored in id and status respectively */
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 *id, int *status);
const int frame, const uint8_t subframe, int *id, int *round);
/* Reported values for uplink power control */
/* Uplink power control management*/
int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id);
int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id);
/*
* ************************************
* Get Messages for UE Configuration Reply
......
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