Commit 280101d2 authored by Haruki NAOI's avatar Haruki NAOI

Merge remote-tracking branch 'remotes/origin/multi_bearer' into develop

parents e65f8127 f99e2d4a
......@@ -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 <= DTCH; lc_id++) {
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,11 +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).
/* TODO limited lcid for performance */
for (lcid = DTCH; 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;
......@@ -2050,10 +2072,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).
/* TODO limited lcid for performance */
for (lcid = DTCH; 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",
......@@ -2512,11 +2533,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).
/* TODO limited lcid for performance */
for (lcid = DTCH; 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;
......@@ -3258,7 +3277,10 @@ void ulsch_scheduler_pre_ue_select_fairRR(
UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
int bytes_to_schedule = UE_list->UE_template[CC_id][UE_id].estimated_ul_buffer - UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes;
if (bytes_to_schedule < 0) bytes_to_schedule = 0;
if (bytes_to_schedule < 0) {
bytes_to_schedule = 0;
UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0;
}
rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
if ( (bytes_to_schedule > 0) || (UE_list->UE_template[CC_id][UE_id].ul_SR > 0) ||
......
......@@ -561,6 +561,7 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_template_ptr->ul_buffer_info[LCGID1] +
UE_template_ptr->ul_buffer_info[LCGID2] +
UE_template_ptr->ul_buffer_info[LCGID3];
UE_template_ptr->scheduled_ul_bytes = 0;
RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = (payload_ptr[0] & 0x3f);
......@@ -608,6 +609,7 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_template_ptr->ul_buffer_info[LCGID1] +
UE_template_ptr->ul_buffer_info[LCGID2] +
UE_template_ptr->ul_buffer_info[LCGID3];
UE_template_ptr->scheduled_ul_bytes = 0;
LOG_D(MAC, "[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,
......@@ -818,6 +820,9 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_template_ptr->ul_buffer_info[1] +
UE_template_ptr->ul_buffer_info[2] +
UE_template_ptr->ul_buffer_info[3];
if (UE_template_ptr->estimated_ul_buffer == 0) {
UE_template_ptr->scheduled_ul_bytes = 0;
}
//UE_template_ptr->estimated_ul_buffer += UE_template_ptr->estimated_ul_buffer / 4;
}
......@@ -883,6 +888,9 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_template_ptr->ul_buffer_info[1] +
UE_template_ptr->ul_buffer_info[2] +
UE_template_ptr->ul_buffer_info[3];
if (UE_template_ptr->estimated_ul_buffer == 0) {
UE_template_ptr->scheduled_ul_bytes = 0;
}
}
if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block
......
......@@ -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
......@@ -630,7 +630,7 @@ typedef struct eNB_RRC_UE_s {
LTE_DRB_ToAddModList_t *DRB_configList;
LTE_DRB_ToAddModList_t *DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
LTE_DRB_ToReleaseList_t *DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
uint8_t DRB_active[8];
uint8_t DRB_active[9];
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated;
struct LTE_SPS_Config *sps_Config;
LTE_MeasObjectToAddMod_t *MeasObj[MAX_MEAS_OBJ];
......
......@@ -2500,7 +2500,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);
......@@ -2628,6 +2634,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));
......@@ -2760,6 +2767,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,
......@@ -3181,7 +3197,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);
......@@ -5538,7 +5554,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);
......@@ -5873,14 +5889,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));
......
......@@ -1106,7 +1106,7 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
/* Prepare the S1AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_E_RABModify;
pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_E_RABSetup;
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABSetupResponse;
out = &pdu.choice.successfulOutcome.value.choice.E_RABSetupResponse;
......
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