Commit b8ebdbc0 authored by TAKAHASHI, Shigeyuki's avatar TAKAHASHI, Shigeyuki

modify scheduling priorities of DTCHs

parent 965fec7d
......@@ -103,15 +103,18 @@ void pre_scd_nb_rbs_required( module_id_t module_idP,
sub_frame_t subframeP,
int min_rb_unit[MAX_NUM_CCs],
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]) {
int CC_id=0,UE_id, lc_id, N_RB_DL;
int CC_id=0,UE_id, lc_id, N_RB_DL, drb_id;
UE_TEMPLATE UE_template;
eNB_UE_STATS *eNB_UE_stats;
rnti_t rnti;
mac_rlc_status_resp_t rlc_status;
uint16_t step_size=2;
rrc_eNB_ue_context_t *ue_contextP = NULL;
N_RB_DL = to_prb(RC.mac[module_idP]->common_channels[CC_id].mib->message.dl_Bandwidth);
int header_length_last;
int header_length_total;
int dl_dtch_num;
int dl_dtch_list[MAX_NUM_DTCH];
if(N_RB_DL==50) step_size=3;
......@@ -128,9 +131,21 @@ void pre_scd_nb_rbs_required( module_id_t module_idP,
// store dlsch buffer
// clear logical channel interface variables
UE_template.dl_buffer_total = 0;
dl_dtch_num = 0;
rnti = UE_RNTI(module_idP, UE_id);
ue_contextP = rrc_eNB_get_ue_context(RC.rrc[module_idP], rnti);
if (ue_contextP == NULL)
continue;
for (lc_id = DCCH; lc_id <= MAX_NUM_LCID; lc_id++) {
if (lc_id >= DTCH) {
drb_id = lc_id - 2;
if (ue_contextP->ue_context.DRB_active[drb_id] == 0) {
continue;
}
}
rlc_status =
mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP,
ENB_FLAG_YES, MBMS_FLAG_NO, lc_id, 0
......@@ -142,9 +157,16 @@ void pre_scd_nb_rbs_required( module_id_t module_idP,
if(rlc_status.bytes_in_buffer > 0){
header_length_last = 1 + 1 + (rlc_status.bytes_in_buffer >= 128);
header_length_total += header_length_last;
if (lc_id >= DTCH) {
dl_dtch_list[dl_dtch_num] = lc_id;
dl_dtch_num++;
}
}
}
sort_lcid_priority(module_idP, UE_id, dl_dtch_num, &dl_dtch_list[0]);
if (header_length_total) {
header_length_total -= header_length_last;
header_length_total++;
......@@ -889,6 +911,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
int N_RB_DL[MAX_NUM_CCs];
int total_nb_available_rb[MAX_NUM_CCs];
int N_RBG[MAX_NUM_CCs];
int dtch, dtch_max_num;
nfapi_dl_config_request_body_t *dl_req;
nfapi_dl_config_request_pdu_t *dl_config_pdu;
int tdd_sfa;
......@@ -1310,10 +1333,10 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
// assume the max dtch header size, and adjust it later
header_len_dtch = 0;
header_len_dtch_last = 0; // the header length of the last mac sdu
// lcid has to be sorted before the actual allocation (similar struct as ue_list).
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
// TBD: check if the lcid is active
dtch_max_num = UE_list->UE_template[CC_id][UE_id].dl_dtch_num;
for (dtch = 0; dtch < dtch_max_num; dtch++) {
lcid = UE_list->UE_template[CC_id][UE_id].dl_dtch_list_priority[dtch];
header_len_dtch += 3;
header_len_dtch_last = 3;
......@@ -2041,9 +2064,9 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
header_len_dtch = 0;
header_len_dtch_last = 0; // the header length of the last mac sdu
// lcid has to be sorted before the actual allocation (similar struct as ue_list).
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
// TBD: check if the lcid is active
dtch_max_num = UE_list->UE_template[CC_id][UE_id].dl_dtch_num;
for (dtch = 0; dtch < dtch_max_num; dtch++) {
lcid = UE_list->UE_template[CC_id][UE_id].dl_dtch_list_priority[dtch];
header_len_dtch += 3;
header_len_dtch_last = 3;
LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
......@@ -2494,10 +2517,9 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
// assume the max dtch header size, and adjust it later
header_len_dtch = 0;
header_len_dtch_last = 0; // the header length of the last mac sdu
// lcid has to be sorted before the actual allocation (similar struct as ue_list).
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
// TBD: check if the lcid is active
dtch_max_num = UE_list->UE_template[CC_id][UE_id].dl_dtch_num;
for (dtch = 0; dtch < dtch_max_num; dtch++) {
lcid = UE_list->UE_template[CC_id][UE_id].dl_dtch_list_priority[dtch];
header_len_dtch += 3;
header_len_dtch_last = 3;
......
......@@ -134,6 +134,8 @@
#define LCGID3 3
/*!\brief Maximum number of logical chanels */
#define MAX_NUM_LCID 11
/*!\brief Maximum number of logical chanels for DTCH */
#define MAX_NUM_DTCH (MAX_NUM_LCID - 3)
/*!\brief Maximum number od control elemenets */
#define MAX_NUM_CE 5
/*!\brief Maximum number of random access process */
......@@ -901,6 +903,10 @@ typedef struct {
uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
/// size of remaining size to send for the downlink head SDU
uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
/// number of not empty DTCHs
uint8_t dl_dtch_num;
/// list of DTCHs sorted by priority
uint8_t dl_dtch_list_priority[MAX_NUM_DTCH];
/// uplink buffer creation time for each LCID
uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
......
......@@ -1317,6 +1317,7 @@ uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn);
int32_t get_uldl_offset(int eutra_bandP);
int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
uint8_t HO_active);
void sort_lcid_priority(module_id_t module_id, int UE_id, int dl_dtch_num, int *dl_dtch_list);
#if defined(PRE_SCD_THREAD)
void pre_scd_nb_rbs_required( module_id_t module_idP,
frame_t frameP,
......
......@@ -103,6 +103,8 @@ store_dlsch_buffer(module_id_t Mod_id,
mac_rlc_status_resp_t rlc_status;
UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
UE_TEMPLATE *UE_template;
int dl_dtch_num;
int dl_dtch_list[MAX_NUM_DTCH];
for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (UE_list->active[UE_id] != TRUE)
......@@ -115,6 +117,7 @@ store_dlsch_buffer(module_id_t Mod_id,
// clear logical channel interface variables
UE_template->dl_buffer_total = 0;
UE_template->dl_pdus_total = 0;
dl_dtch_num = 0;
for (lcid = 0; lcid < MAX_NUM_LCID; ++lcid) {
UE_template->dl_buffer_info[lcid] = 0;
......@@ -142,6 +145,11 @@ store_dlsch_buffer(module_id_t Mod_id,
UE_template->dl_buffer_total += UE_template->dl_buffer_info[lcid]; //storing the total dlsch buffer
UE_template->dl_pdus_total += UE_template->dl_pdus_in_buffer[lcid];
if ((rlc_status.bytes_in_buffer > 0) && (lcid >= DTCH)) {
dl_dtch_list[dl_dtch_num] = lcid;
dl_dtch_num++;
}
#ifdef DEBUG_eNB_SCHEDULER
/* note for dl_buffer_head_sdu_remaining_size_to_send[lcid] :
* 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent
......@@ -159,6 +167,8 @@ store_dlsch_buffer(module_id_t Mod_id,
}
sort_lcid_priority(Mod_id, UE_id, dl_dtch_num, &dl_dtch_list[0]);
if (UE_template->dl_buffer_total > 0)
LOG_D(MAC,
"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n",
......@@ -2093,3 +2103,39 @@ void sort_ue_ul(module_id_t module_idP,
UE_list->head_ul = -1;
}
}
static int lcid_priority_compare(const void *_a, const void *_b, void *_lcgidpriority) {
long *lcgidpriority = (long*)_lcgidpriority;
int lcid1 = *(const int *) _a;
int lcid2 = *(const int *) _b;
int priority1 = (int)lcgidpriority[lcid1];
int priority2 = (int)lcgidpriority[lcid2];
return priority1 - priority2;
}
//-----------------------------------------------------------------------------
/*
* This function sorts the LCIDs in order
*/
void sort_lcid_priority(module_id_t module_id,
int UE_id,
int dl_dtch_num,
int *dl_dtch_list)
//-----------------------------------------------------------------------------
{
int i;
UE_list_t *UE_list = &RC.mac[module_id]->UE_list;
UE_TEMPLATE *UE_template;
UE_template = &UE_list->UE_template[UE_PCCID(module_id, UE_id)][UE_id];
qsort_r(dl_dtch_list, dl_dtch_num, sizeof(int), lcid_priority_compare, &UE_template->lcgidpriority[0]);
UE_template->dl_dtch_num = (uint8_t)dl_dtch_num;
for (i = 0; i < dl_dtch_num; i++) {
UE_template->dl_dtch_list_priority[i] = (uint8_t)dl_dtch_list[i];
}
return;
}
\ No newline at end of file
......@@ -2491,7 +2491,13 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *co
DRB_ul_SpecificParameters->bucketSizeDuration =
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;//(i+1) % 3;
if (DRB_ul_SpecificParameters->priority < 5) {
*logicalchannelgroup_drb = 0;
} else if (DRB_ul_SpecificParameters->priority == 5) {
*logicalchannelgroup_drb = 1;
} else {
*logicalchannelgroup_drb = 3;
}
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
......@@ -2619,6 +2625,7 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *cons
(void)dedicatedInfoNas;
uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); // Transaction_id,
DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2));
long *logicalchannelgroup_drb;
/* Initialize NAS list */
dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
......@@ -2751,6 +2758,15 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *cons
DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
DRB_ul_SpecificParameters->bucketSizeDuration =
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
if (DRB_ul_SpecificParameters->priority < 5) {
*logicalchannelgroup_drb = 0;
} else if (DRB_ul_SpecificParameters->priority == 5) {
*logicalchannelgroup_drb = 1;
} else {
*logicalchannelgroup_drb = 3;
}
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config);
LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n",
*DRB_config->eps_BearerIdentity,
......@@ -3171,7 +3187,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
DRB_ul_SpecificParameters->bucketSizeDuration = LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
// LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;
*logicalchannelgroup_drb = 3;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
......@@ -5527,7 +5543,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
// LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;
*logicalchannelgroup_drb = 3;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
......@@ -5862,14 +5878,14 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
DRB_config->logicalChannelConfig = DRB_lchan_config;
DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2
DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2
DRB_ul_SpecificParameters->prioritisedBitRate =
LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
DRB_ul_SpecificParameters->bucketSizeDuration =
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
// LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;
*logicalchannelgroup_drb = 3;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig));
......
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