Commit eccb96c4 authored by Cedric Roux's avatar Cedric Roux

bugfix: fix UL over scheduling

There is too much UL scheduling because the buffer status is
overestimated.

This commit tries to make things simpler.
parent be8d32d5
...@@ -665,7 +665,7 @@ typedef struct { ...@@ -665,7 +665,7 @@ typedef struct {
/// mcs from last UL scheduling /// mcs from last UL scheduling
uint8_t mcs_UL[8]; uint8_t mcs_UL[8];
/// TBS from last UL scheduling /// TBS from last UL scheduling
uint8_t TBS_UL[8]; int TBS_UL[8];
/// Flag to indicate UL has been scheduled at least once /// Flag to indicate UL has been scheduled at least once
boolean_t ul_active; boolean_t ul_active;
/// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
...@@ -720,9 +720,6 @@ typedef struct { ...@@ -720,9 +720,6 @@ typedef struct {
// Logical channel info for link with RLC // Logical channel info for link with RLC
/// Last received UE BSR info for each logical channel group id
uint8_t bsr_info[MAX_NUM_LCGID];
/// LCGID mapping /// LCGID mapping
long lcgidmap[11]; long lcgidmap[11];
...@@ -749,8 +746,6 @@ typedef struct { ...@@ -749,8 +746,6 @@ typedef struct {
/// size of remaining size to send for the downlink head SDU /// size of remaining size to send for the downlink head SDU
uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID]; uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
/// total uplink buffer size
uint32_t ul_total_buffer;
/// uplink buffer creation time for each LCID /// uplink buffer creation time for each LCID
uint32_t ul_buffer_creation_time[MAX_NUM_LCGID]; uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
/// maximum uplink buffer creation time across all the LCIDs /// maximum uplink buffer creation time across all the LCIDs
...@@ -758,6 +753,11 @@ typedef struct { ...@@ -758,6 +753,11 @@ typedef struct {
/// uplink buffer size per LCID /// uplink buffer size per LCID
uint32_t ul_buffer_info[MAX_NUM_LCGID]; uint32_t ul_buffer_info[MAX_NUM_LCGID];
/// uplink bytes that are currently scheduled
int scheduled_ul_bytes;
/// estimation of the UL buffer size
int estimated_ul_buffer;
/// UE tx power /// UE tx power
int32_t ue_tx_power; int32_t ue_tx_power;
......
...@@ -2483,14 +2483,15 @@ UE_is_to_be_scheduled(module_id_t module_idP, int CC_id, uint8_t UE_id) ...@@ -2483,14 +2483,15 @@ UE_is_to_be_scheduled(module_id_t module_idP, int CC_id, uint8_t UE_id)
LOG_D(MAC, "[eNB %d][PUSCH] Checking UL requirements UE %d/%x\n", LOG_D(MAC, "[eNB %d][PUSCH] Checking UL requirements UE %d/%x\n",
module_idP, UE_id, UE_RNTI(module_idP, UE_id)); module_idP, UE_id, UE_RNTI(module_idP, UE_id));
if ((UE_template->bsr_info[LCGID0] > 0) || (UE_template->bsr_info[LCGID1] > 0) || (UE_template->bsr_info[LCGID2] > 0) || (UE_template->bsr_info[LCGID3] > 0) || (UE_template->ul_SR > 0) || // uplink scheduling request if ((UE_template->scheduled_ul_bytes < UE_template->estimated_ul_buffer) ||
(UE_template->ul_SR > 0) || // uplink scheduling request
((UE_sched_ctl->ul_inactivity_timer > 20) && (UE_sched_ctl->ul_scheduled == 0)) || // every 2 frames when RRC_CONNECTED ((UE_sched_ctl->ul_inactivity_timer > 20) && (UE_sched_ctl->ul_scheduled == 0)) || // every 2 frames when RRC_CONNECTED
((UE_sched_ctl->ul_inactivity_timer > 10) && (UE_sched_ctl->ul_scheduled == 0) && (mac_eNB_get_rrc_status(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED))) // every Frame when not RRC_CONNECTED ((UE_sched_ctl->ul_inactivity_timer > 10) && (UE_sched_ctl->ul_scheduled == 0) && (mac_eNB_get_rrc_status(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED))) // every Frame when not RRC_CONNECTED
{ {
LOG_D(MAC, LOG_D(MAC,
"[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 %d,SR %d)\n", "[eNB %d][PUSCH] UE %d/%x should be scheduled (SRB0 estimated size %d,SR %d)\n",
module_idP, UE_id, UE_RNTI(module_idP, UE_id), module_idP, UE_id, UE_RNTI(module_idP, UE_id),
UE_template->bsr_info[LCGID0], UE_template->ul_SR); UE_template->ul_buffer_info[LCGID0], UE_template->ul_SR);
return (1); return (1);
} else { } else {
return (0); return (0);
......
...@@ -96,10 +96,10 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -96,10 +96,10 @@ rx_sdu(const module_id_t enb_mod_idP,
eNB_MAC_INST *mac = RC.mac[enb_mod_idP]; eNB_MAC_INST *mac = RC.mac[enb_mod_idP];
int harq_pid = int harq_pid =
subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP); subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP);
int lcgid_updated[4] = {0, 0, 0, 0};
UE_list_t *UE_list = &mac->UE_list; UE_list_t *UE_list = &mac->UE_list;
int crnti_rx = 0; int crnti_rx = 0;
int old_buffer_info;
RA_t *ra = RA_t *ra =
(RA_t *) & RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0]; (RA_t *) & RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0];
int first_rb = 0; int first_rb = 0;
...@@ -153,6 +153,12 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -153,6 +153,12 @@ rx_sdu(const module_id_t enb_mod_idP,
subframeP, UE_RNTI(enb_mod_idP, subframeP, UE_RNTI(enb_mod_idP,
UE_id)); UE_id));
} }
/* update scheduled bytes */
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)
UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
} else { // we've got an error } else { // we've got an error
LOG_D(MAC, LOG_D(MAC,
"[eNB %d][PUSCH %d] CC_id %d ULSCH in error in round %d, ul_cqi %d\n", "[eNB %d][PUSCH %d] CC_id %d ULSCH in error in round %d, ul_cqi %d\n",
...@@ -161,15 +167,16 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -161,15 +167,16 @@ rx_sdu(const module_id_t enb_mod_idP,
ul_cqi); ul_cqi);
// AssertFatal(1==0,"ulsch in error\n"); // AssertFatal(1==0,"ulsch in error\n");
if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == 3) {
3) { UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid));
UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0;
(~(1 << harq_pid)); if (UE_list->UE_sched_ctrl[UE_id]. ul_consecutive_errors++ == 10)
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] =
0;
if (UE_list->UE_sched_ctrl[UE_id].
ul_consecutive_errors++ == 10)
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1; UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1;
/* update scheduled bytes */
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)
UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
} else } else
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++; UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++;
return; return;
...@@ -321,20 +328,19 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -321,20 +328,19 @@ rx_sdu(const module_id_t enb_mod_idP,
enb_mod_idP, CC_idP, rx_ces[i], lcgid, enb_mod_idP, CC_idP, rx_ces[i], lcgid,
payload_ptr[0] & 0x3f); payload_ptr[0] & 0x3f);
if (UE_id != -1) { if (UE_id != -1) {
int bsr = payload_ptr[0] & 0x3f;
UE_list->UE_template[CC_idP][UE_id].bsr_info[lcgid] = lcgid_updated[lcgid] = 1;
(payload_ptr[0] & 0x3f);
// update buffer info // update buffer info
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid] = BSR_TABLE[bsr];
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
ul_buffer_info[lcgid] = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
BSR_TABLE[UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
bsr_info[lcgid]]; UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer = //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[lcgid];
RC.eNB[enb_mod_idP][CC_idP]-> RC.eNB[enb_mod_idP][CC_idP]->
pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] pusch_stats_bsr[UE_id][(frameP * 10) + subframeP]
...@@ -355,12 +361,10 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -355,12 +361,10 @@ rx_sdu(const module_id_t enb_mod_idP,
(enb_mod_idP, (enb_mod_idP,
UE_RNTI(enb_mod_idP, UE_id)) < RRC_CONNECTED) UE_RNTI(enb_mod_idP, UE_id)) < RRC_CONNECTED)
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] CC_id %d MAC CE_LCID %d : ul_total_buffer = %d (lcg increment %d)\n", "[eNB %d] CC_id %d MAC CE_LCID %d : estimated_ul_buffer = %d (lcg increment %d)\n",
enb_mod_idP, CC_idP, rx_ces[i], enb_mod_idP, CC_idP, rx_ces[i],
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer,
ul_total_buffer, UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]);
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[lcgid]);
} else { } else {
} }
...@@ -370,115 +374,48 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -370,115 +374,48 @@ rx_sdu(const module_id_t enb_mod_idP,
case LONG_BSR: case LONG_BSR:
if (UE_id != -1) { if (UE_id != -1) {
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0] = int bsr0 = (payload_ptr[0] & 0xFC) >> 2;
((payload_ptr[0] & 0xFC) >> 2); int bsr1 = ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1] = int bsr2 = ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
((payload_ptr[0] & 0x03) << 4) | int bsr3 = payload_ptr[2] & 0x3F;
((payload_ptr[1] & 0xF0) >> 4);
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2] =
((payload_ptr[1] & 0x0F) << 2) |
((payload_ptr[2] & 0xC0) >> 6);
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3] =
(payload_ptr[2] & 0x3F);
// update buffer info lcgid_updated[0] = 1;
old_buffer_info = lcgid_updated[1] = 1;
UE_list->UE_template[CC_idP][UE_id]. lcgid_updated[2] = 1;
ul_buffer_info[LCGID0]; lcgid_updated[3] = 1;
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID0] =
BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].
bsr_info[LCGID0]];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer += // update buffer info
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] = BSR_TABLE[bsr0];
ul_buffer_info[LCGID0]; UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] = BSR_TABLE[bsr1];
if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] = BSR_TABLE[bsr2];
old_buffer_info) UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] = BSR_TABLE[bsr3];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -=
old_buffer_info; UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
else UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
0; UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
old_buffer_info = //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID1];
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID1] =
BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].
bsr_info[LCGID1]];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer +=
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID1];
if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >=
old_buffer_info)
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -=
old_buffer_info;
else
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer =
0;
old_buffer_info =
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID2];
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID2] =
BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].
bsr_info[LCGID2]];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer +=
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID2];
if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >=
old_buffer_info)
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -=
old_buffer_info;
else
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer =
0;
old_buffer_info =
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID3];
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID3] =
BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].
bsr_info[LCGID3]];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer +=
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[LCGID3];
if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >=
old_buffer_info)
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -=
old_buffer_info;
else
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer =
0;
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = " "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = "
"%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP, "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP,
rx_ces[i], rx_ces[i],
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0],
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1],
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2],
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]);
bsr_info[LCGID3]);
if (crnti_rx == 1) if (crnti_rx == 1)
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = " "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = "
"%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP,
CC_idP, rx_ces[i], CC_idP, rx_ces[i],
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0],
bsr_info[LCGID0], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1],
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2],
bsr_info[LCGID1], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]);
UE_list->UE_template[CC_idP][UE_id].
bsr_info[LCGID2],
UE_list->UE_template[CC_idP][UE_id].
bsr_info[LCGID3]);
if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0] == if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] ==
0) { 0) {
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].
ul_buffer_creation_time[LCGID0] = 0; ul_buffer_creation_time[LCGID0] = 0;
...@@ -488,7 +425,7 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -488,7 +425,7 @@ rx_sdu(const module_id_t enb_mod_idP,
ul_buffer_creation_time[LCGID0] = frameP; ul_buffer_creation_time[LCGID0] = frameP;
} }
if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1] == if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] ==
0) { 0) {
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].
ul_buffer_creation_time[LCGID1] = 0; ul_buffer_creation_time[LCGID1] = 0;
...@@ -498,7 +435,7 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -498,7 +435,7 @@ rx_sdu(const module_id_t enb_mod_idP,
ul_buffer_creation_time[LCGID1] = frameP; ul_buffer_creation_time[LCGID1] = frameP;
} }
if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2] == if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] ==
0) { 0) {
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].
ul_buffer_creation_time[LCGID2] = 0; ul_buffer_creation_time[LCGID2] = 0;
...@@ -508,7 +445,7 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -508,7 +445,7 @@ rx_sdu(const module_id_t enb_mod_idP,
ul_buffer_creation_time[LCGID2] = frameP; ul_buffer_creation_time[LCGID2] = frameP;
} }
if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3] == if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] ==
0) { 0) {
UE_list->UE_template[CC_idP][UE_id]. UE_list->UE_template[CC_idP][UE_id].
ul_buffer_creation_time[LCGID3] = 0; ul_buffer_creation_time[LCGID3] = 0;
...@@ -649,19 +586,28 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -649,19 +586,28 @@ rx_sdu(const module_id_t enb_mod_idP,
#endif #endif
if (UE_id != -1) { if (UE_id != -1) {
// adjust buffer occupancy of the correponding logical channel group if (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) {
if (UE_list->UE_template[CC_idP][UE_id]. // adjust buffer occupancy of the correponding logical channel group
ul_buffer_info[UE_list->UE_template[CC_idP] if (UE_list->UE_template[CC_idP][UE_id].
[UE_id].lcgidmap[rx_lcids[i]]] >= ul_buffer_info[UE_list->UE_template[CC_idP]
rx_lengths[i]) [UE_id].lcgidmap[rx_lcids[i]]] >=
UE_list->UE_template[CC_idP][UE_id]. rx_lengths[i])
ul_buffer_info[UE_list->UE_template[CC_idP] UE_list->UE_template[CC_idP][UE_id].
[UE_id].lcgidmap[rx_lcids[i]]] -= ul_buffer_info[UE_list->UE_template[CC_idP]
rx_lengths[i]; [UE_id].lcgidmap[rx_lcids[i]]] -=
else rx_lengths[i];
UE_list->UE_template[CC_idP][UE_id]. else
ul_buffer_info[UE_list->UE_template[CC_idP] UE_list->UE_template[CC_idP][UE_id].
[UE_id].lcgidmap[rx_lcids[i]]] = 0; ul_buffer_info[UE_list->UE_template[CC_idP]
[UE_id].lcgidmap[rx_lcids[i]]] = 0;
UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
//UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
}
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n", "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n",
...@@ -712,18 +658,28 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -712,18 +658,28 @@ rx_sdu(const module_id_t enb_mod_idP,
ul_buffer_info[UE_list->UE_template[CC_idP] ul_buffer_info[UE_list->UE_template[CC_idP]
[UE_id].lcgidmap[rx_lcids[i]]]); [UE_id].lcgidmap[rx_lcids[i]]]);
if (UE_list->UE_template[CC_idP][UE_id]. if (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) {
ul_buffer_info[UE_list->UE_template[CC_idP] if (UE_list->UE_template[CC_idP][UE_id].
[UE_id].lcgidmap[rx_lcids[i]]]
>= rx_lengths[i])
UE_list->UE_template[CC_idP][UE_id].
ul_buffer_info[UE_list->UE_template[CC_idP] ul_buffer_info[UE_list->UE_template[CC_idP]
[UE_id].lcgidmap[rx_lcids[i]]] [UE_id].lcgidmap[rx_lcids[i]]]
-= rx_lengths[i]; >= rx_lengths[i])
else UE_list->UE_template[CC_idP][UE_id].
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info ul_buffer_info[UE_list->UE_template[CC_idP]
[UE_list->UE_template[CC_idP][UE_id].lcgidmap [UE_id].lcgidmap[rx_lcids[i]]]
[rx_lcids[i]]] = 0; -= rx_lengths[i];
else
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info
[UE_list->UE_template[CC_idP][UE_id].lcgidmap
[rx_lcids[i]]] = 0;
UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
//UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
}
if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX)
&& (rx_lengths[i] > 0)) { // MAX SIZE OF transport block && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status); mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status);
...@@ -1196,10 +1152,7 @@ schedule_ulsch_rnti(module_id_t module_idP, ...@@ -1196,10 +1152,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
module_idP, frameP, subframeP, sched_frame, sched_subframeP, harq_pid, UE_id, rnti, module_idP, frameP, subframeP, sched_frame, sched_subframeP, harq_pid, UE_id, rnti,
CC_id, aggregation, N_RB_UL); CC_id, aggregation, N_RB_UL);
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * 10) + subframeP] = UE_template->estimated_ul_buffer;
10) +
subframeP] =
UE_template->ul_total_buffer;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO, (VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP *
...@@ -1289,8 +1242,6 @@ schedule_ulsch_rnti(module_id_t module_idP, ...@@ -1289,8 +1242,6 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 =
UE_template->mcs_UL[harq_pid]; UE_template->mcs_UL[harq_pid];
// buffer_occupancy = UE_template->ul_total_buffer;
while (((rb_table[rb_table_index] > while (((rb_table[rb_table_index] >
(N_RB_UL - 1 - first_rb[CC_id])) (N_RB_UL - 1 - first_rb[CC_id]))
...@@ -1341,18 +1292,15 @@ schedule_ulsch_rnti(module_id_t module_idP, ...@@ -1341,18 +1292,15 @@ schedule_ulsch_rnti(module_id_t module_idP,
// adjust total UL buffer status by TBS, wait for UL sdus to do final update // adjust total UL buffer status by TBS, wait for UL sdus to do final update
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", "[eNB %d] CC_id %d UE %d/%x : adjusting scheduled_ul_bytes, old %d, TBS %d\n",
module_idP, CC_id, UE_id, rnti, module_idP, CC_id, UE_id, rnti,
UE_template->ul_total_buffer, UE_template->scheduled_ul_bytes,
UE_template->TBS_UL[harq_pid]); UE_template->TBS_UL[harq_pid]);
if (UE_template->ul_total_buffer >
UE_template->TBS_UL[harq_pid]) UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid];
UE_template->ul_total_buffer -=
UE_template->TBS_UL[harq_pid]; LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes);
else
UE_template->ul_total_buffer = 0;
LOG_D(MAC, "ul_total_buffer, new %d\n",
UE_template->ul_total_buffer);
// Cyclic shift for DM RS // Cyclic shift for DM RS
cshift = 0; // values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) cshift = 0; // values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
// save it for a potential retransmission // save it for a potential retransmission
......
...@@ -1590,9 +1590,11 @@ assign_max_mcs_min_rb(module_id_t module_idP, int frameP, ...@@ -1590,9 +1590,11 @@ assign_max_mcs_min_rb(module_id_t module_idP, int frameP,
to_prb(RC.mac[module_idP]->common_channels[CC_id]. to_prb(RC.mac[module_idP]->common_channels[CC_id].
ul_Bandwidth); ul_Bandwidth);
// if this UE has UL traffic // if this UE has UL traffic
if (UE_template->ul_total_buffer > 0) { int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes;
if (bytes_to_schedule < 0) bytes_to_schedule = 0;
int bits_to_schedule = bytes_to_schedule * 8;
if (bits_to_schedule > 0) {
tbs = get_TBS_UL(mcs, 3) << 3; // 1 or 2 PRB with cqi enabled does not work well! tbs = get_TBS_UL(mcs, 3) << 3; // 1 or 2 PRB with cqi enabled does not work well!
rb_table_index = 2; rb_table_index = 2;
...@@ -1602,7 +1604,7 @@ assign_max_mcs_min_rb(module_id_t module_idP, int frameP, ...@@ -1602,7 +1604,7 @@ assign_max_mcs_min_rb(module_id_t module_idP, int frameP,
Ncp, 0); Ncp, 0);
while ((((UE_template->phr_info - tx_power) < 0) while ((((UE_template->phr_info - tx_power) < 0)
|| (tbs > UE_template->ul_total_buffer)) || (tbs > bits_to_schedule))
&& (mcs > 3)) { && (mcs > 3)) {
// LOG_I(MAC,"UE_template->phr_info %d tx_power %d mcs %d\n", UE_template->phr_info,tx_power, mcs); // LOG_I(MAC,"UE_template->phr_info %d tx_power %d mcs %d\n", UE_template->phr_info,tx_power, mcs);
mcs--; mcs--;
...@@ -1610,7 +1612,7 @@ assign_max_mcs_min_rb(module_id_t module_idP, int frameP, ...@@ -1610,7 +1612,7 @@ assign_max_mcs_min_rb(module_id_t module_idP, int frameP,
tx_power = estimate_ue_tx_power(tbs, rb_table[rb_table_index], 0, Ncp, 0); // fixme: set use_srs tx_power = estimate_ue_tx_power(tbs, rb_table[rb_table_index], 0, Ncp, 0); // fixme: set use_srs
} }
while ((tbs < UE_template->ul_total_buffer) && while ((tbs < bits_to_schedule) &&
(rb_table[rb_table_index] < (rb_table[rb_table_index] <
(N_RB_UL - first_rb[CC_id])) (N_RB_UL - first_rb[CC_id]))
&& ((UE_template->phr_info - tx_power) > 0) && ((UE_template->phr_info - tx_power) > 0)
...@@ -1700,11 +1702,14 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params) ...@@ -1700,11 +1702,14 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params)
UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0]) UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0])
return 1; return 1;
if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer > int bytes_to_schedule1 = UE_list->UE_template[pCCid1][UE_id1].estimated_ul_buffer - UE_list->UE_template[pCCid1][UE_id1].scheduled_ul_bytes;
UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer) if (bytes_to_schedule1 < 0) bytes_to_schedule1 = 0;
int bytes_to_schedule2 = UE_list->UE_template[pCCid2][UE_id2].estimated_ul_buffer - UE_list->UE_template[pCCid2][UE_id2].scheduled_ul_bytes;
if (bytes_to_schedule2 < 0) bytes_to_schedule2 = 0;
if (bytes_to_schedule1 > bytes_to_schedule2)
return -1; return -1;
if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer < if (bytes_to_schedule1 < bytes_to_schedule2)
UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer)
return 1; return 1;
if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul > if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul >
......
...@@ -217,11 +217,11 @@ int dump_eNB_l2_stats(char *buffer, int length) ...@@ -217,11 +217,11 @@ int dump_eNB_l2_stats(char *buffer, int length)
UE_list->eNB_UE_stats[CC_id][UE_id].num_errors_rx); UE_list->eNB_UE_stats[CC_id][UE_id].num_errors_rx);
len+= sprintf(&buffer[len],"[MAC] Received PHR PH = %d (db)\n", UE_list->UE_template[CC_id][UE_id].phr_info); len+= sprintf(&buffer[len],"[MAC] Received PHR PH = %d (db)\n", UE_list->UE_template[CC_id][UE_id].phr_info);
len+= sprintf(&buffer[len],"[MAC] Received BSR LCGID[0][1][2][3] = %u %u %u %u\n", len+= sprintf(&buffer[len],"[MAC] Estimated size LCGID[0][1][2][3] = %u %u %u %u\n",
UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID0], UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID0],
UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID1], UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID1],
UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID2], UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID2],
UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID3] UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID3]
); );
} }
......
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