Commit 33bab5ba authored by cig's avatar cig

Changes to support DL IP traffic and timing adjustments in do-ra mode:

- enabled procedures that were already called for phy-test mode
- enabled setup of DRB for the current C-RNTI
- enhanced information, debugging and warning logging at MAC/RLC/PDCP level
parent 6b8eb372
......@@ -194,7 +194,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
start_meas(&ue->phy_proc_tx);
#endif
if (ue->UE_mode[gNB_id] <= PUSCH || get_softmodem_params()->phy_test == 1){
if (ue->UE_mode[gNB_id] <= PUSCH){
if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE)
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id);
......
......@@ -287,7 +287,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
if (ss->searchSpaceType->choice.ue_Specific){
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
if (get_softmodem_params()->phy_test == 1 && mac->crnti > 0) {
if ((mac->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
rel15->num_dci_options = 2;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
......
......@@ -1507,8 +1507,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
}
} else if (ul_info) {
// ULSCH is handled only in phy-test mode (consistently with OAI gNB)
if (get_softmodem_params()->phy_test) {
module_id_t mod_id = ul_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
if (mac->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) {
uint8_t nb_dmrs_re_per_rb;
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
......@@ -1517,14 +1519,12 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
uint32_t TBS;
int i, N_PRB_oh;
module_id_t mod_id = ul_info->module_id;
uint32_t gNB_index = ul_info->gNB_index;
int cc_id = ul_info->cc_id;
frame_t rx_frame = ul_info->frame_rx;
slot_t rx_slot = ul_info->slot_rx;
frame_t frame_tx = ul_info->frame_tx;
slot_t slot_tx = ul_info->slot_tx;
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
uint8_t access_mode = SCHEDULED_ACCESS;
fapi_nr_ul_config_request_t *ul_config_req = get_ul_config_request(mac, slot_tx);
......
......@@ -453,7 +453,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (get_softmodem_params()->phy_test == 0) {
nr_schedule_RA(module_idP, frame, slot);
nr_schedule_reception_msg3(module_idP, 0, frame, slot);
}
// This schedules the DCI for Uplink and subsequently PUSCH
......
......@@ -394,7 +394,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
/* Retrieve amount of data to send for this UE */
sched_ctrl->num_total_bytes = 0;
const int lcid = DL_SCH_LCID_DTCH;
const uint16_t rnti = UE_info->rnti[UE_id];
const rnti_t rnti = UE_info->rnti[UE_id];
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti,
module_id,
......@@ -409,8 +409,9 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
return;
LOG_D(MAC,
"%d.%d, DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
LOG_D(MAC, "[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
__FUNCTION__,
frame,
slot,
lcid,
......@@ -551,8 +552,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
* Possible improvement: take the periodicity from input file.
* If such UE is not scheduled now, it will be by the preprocessor later.
* If we add the CE, ta_apply will be reset */
if (frame == (sched_ctrl->ta_frame + 10) % 1024)
if (frame == (sched_ctrl->ta_frame + 10) % 1024){
sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */
LOG_D(MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot);
}
if (sched_ctrl->rbSize <= 0)
continue;
......@@ -642,6 +645,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
LOG_W(MAC, "%d.%2d retransmission UE %d/RNTI %04x\n", frame, slot, UE_id, rnti);
} else { /* initial transmission */
LOG_D(MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
/* reserve space for timing advance of UE if necessary,
* nr_generate_dlsch_pdu() checks for ta_apply and add TA CE if necessary */
const int ta_len = (sched_ctrl->ta_apply) ? 2 : 0;
......@@ -695,7 +699,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
header_length_total += header_length_last;
num_sdus++;
}
else if (get_softmodem_params()->phy_test) {
else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) {
LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frame, slot);
// fill dlsch_buffer with random data
for (int i = 0; i < TBS; i++)
......
......@@ -596,7 +596,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s)
int drb_id = s->drb_Identity;
printf("\n\n################# rnti %d add drb %d\n\n\n", rnti, drb_id);
LOG_I(PDCP, "%s: adding drb %d for rnti %x\n", __FUNCTION__, drb_id, rnti);
if (drb_id != 1) {
LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n",
......@@ -613,8 +613,7 @@ printf("\n\n################# rnti %d add drb %d\n\n\n", rnti, drb_id);
pdcp_drb = new_nr_pdcp_entity_drb_am(drb_id, deliver_sdu_drb, ue, deliver_pdu_drb, ue);
nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb);
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
}
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
......@@ -635,6 +634,7 @@ static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_Config_t *rlc_Co
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}
LOG_I(PDCP, "%s:%s:%d: added DRB for UE RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
}
boolean_t nr_rrc_pdcp_config_asn1_req(
......@@ -681,7 +681,6 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
if (drb2add_list != NULL) {
for (i = 0; i < drb2add_list->list.count; i++) {
LOG_I(PDCP, "Before calling add_drb \n");
add_drb(rnti, drb2add_list->list.array[i], rlc_bearer2add_list->list.array[i]->rlc_Config);
}
}
......@@ -850,6 +849,9 @@ void nr_DRB_preconfiguration(void)
rbconfig->drb_ToReleaseList,
(LTE_PMCH_InfoList_r9_t *) NULL,
Rlc_Bearer_ToAdd_list);
LOG_D(PDCP, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti);
}
uint64_t get_pdcp_optmask(void)
......
......@@ -179,6 +179,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
+ buf_stat.retx_size
+ buf_stat.tx_size;
} else {
LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP);
ret.bytes_in_buffer = 0;
}
......@@ -586,8 +587,7 @@ static void add_srb(int rnti, struct LTE_SRB_ToAddMod *s)
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->srb[srb_id-1] != NULL) {
LOG_D(RLC, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI %x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else {
/* hack: hardcode values for NR */
t_poll_retransmit = 45;
......@@ -678,8 +678,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->drb[drb_id-1] != NULL) {
LOG_D(RLC, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_W(RLC, "%s:%d:%s: DRB %d already exists for UE with RNTI %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
} else {
nr_rlc_am = new_nr_rlc_entity_am(100000,
100000,
......@@ -692,8 +691,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
sn_field_length);
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am);
LOG_D(RLC, "%s:%d:%s: added drb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
......@@ -752,8 +750,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->drb[drb_id-1] != NULL) {
LOG_D(RLC, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_W(RLC, "DEBUG add_drb_um %s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
} else {
nr_rlc_um = new_nr_rlc_entity_um(1000000,
1000000,
......@@ -762,8 +759,7 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
sn_field_length);
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um);
LOG_D(RLC, "%s:%d:%s: added drb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
......@@ -782,6 +778,7 @@ static void add_drb(int rnti, struct NR_DRB_ToAddMod *s, struct NR_RLC_BearerCon
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}
LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
}
/* Dummy function due to dependency from LTE libraries */
......@@ -869,7 +866,7 @@ rlc_op_status_t rrc_rlc_config_req (
exit(1);
}
nr_rlc_manager_lock(nr_rlc_ue_manager);
LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE %d\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rnti);
LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rnti);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rnti);
if (srb_flagP) {
if (ue->srb[rb_idP-1] != NULL) {
......
......@@ -85,7 +85,7 @@ nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti)
if (m->ue_list[i]->rnti == rnti)
return m->ue_list[i];
LOG_D(RLC, "%s:%d:%s: new UE %d\n", __FILE__, __LINE__, __FUNCTION__, rnti);
LOG_D(RLC, "%s:%d:%s: new UE with RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, rnti);
m->ue_count++;
m->ue_list = realloc(m->ue_list, sizeof(nr_rlc_ue_t *) * m->ue_count);
......
......@@ -658,8 +658,7 @@ static void add_srb(int rnti, int module_id, struct LTE_SRB_ToAddMod *s)
poll_pdu, poll_byte, max_retx_threshold);
rlc_ue_add_srb_rlc_entity(ue, srb_id, rlc_am);
LOG_D(RLC, "%s:%d:%s: added srb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
LOG_D(RLC, "%s:%d:%s: added SRB %d to UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
}
rlc_manager_unlock(rlc_ue_manager);
}
......@@ -736,8 +735,7 @@ static void add_drb_am(int rnti, int module_id, struct LTE_DRB_ToAddMod *s)
poll_pdu, poll_byte, max_retx_threshold);
rlc_ue_add_drb_rlc_entity(ue, drb_id, rlc_am);
LOG_D(RLC, "%s:%d:%s: added drb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(RLC, "%s:%d:%s: added DRB %d to UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
}
rlc_manager_unlock(rlc_ue_manager);
}
......@@ -807,8 +805,7 @@ static void add_drb_um(int rnti, int module_id, struct LTE_DRB_ToAddMod *s)
sn_field_length);
rlc_ue_add_drb_rlc_entity(ue, drb_id, rlc_um);
LOG_D(RLC, "%s:%d:%s: added drb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
LOG_D(RLC, "%s:%d:%s: added DRB %d to UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
}
rlc_manager_unlock(rlc_ue_manager);
}
......@@ -925,8 +922,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
);
rlc_ue_add_drb_rlc_entity(ue, drb_id, rlc_um);
LOG_D(RLC, "%s:%d:%s: added drb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, (int)drb_id, mbms_rnti);
LOG_D(RLC, "%s:%d:%s: added DRB %d to UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, (int)drb_id, mbms_rnti);
}
rlc_manager_unlock(rlc_ue_manager);
......
......@@ -243,12 +243,9 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
}
} else
LOG_W(RRC, "No E-RAB to be added received from SgNB Addition Request message \n");
}
if (m != NULL) {
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).MeNB_ue_x2_id = m->ue_x2_id;
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).SgNB_ue_x2_id = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
//X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = CG_Config_size; //Need to verify correct value for the buffer_size
// Send to X2 entity to transport to MeNB
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CG_Config,
......@@ -258,6 +255,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
1024);
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3;
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding
} else if (get_softmodem_params()->do_ra) {
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id);
}
rrc->Nb_ue++;
......@@ -272,6 +271,15 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
ue_context_p->ue_id_rnti,
ue_context_p->ue_context.secondaryCellGroup);
if(m == NULL){
LOG_W(RRC, "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", &ctxt,
ctxt.module_id,
ctxt.rnti,
ctxt.frame,
ctxt.subframe,
ctxt.eNB_index);
}
nr_rrc_pdcp_config_asn1_req(
&ctxt,
(NR_SRB_ToAddModList_t *) NULL,
......@@ -292,6 +300,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
(LTE_PMCH_InfoList_r9_t *) NULL,
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti);
}
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
......
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