Commit 65e47c88 authored by luis_pereira87's avatar luis_pereira87

Handle RRC processing time at gNB

parent 5be18253
......@@ -808,9 +808,9 @@ int main(int argc, char **argv)
AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface");
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
// common configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, 6, scc, NULL, 0, 0, NULL);
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, 6, scc, NULL, 0, 0, NULL, false);
// UE dedicated configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, 6, scc, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, 6, scc, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup, false);
// reset preprocessor to the one of DLSIM after it has been set during
// rrc_mac_config_req_gNB
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
......
......@@ -742,9 +742,9 @@ int main(int argc, char **argv)
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
// common configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, 6, scc, &rrc.carrier.mib,0, 0, NULL);
rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, 6, scc, &rrc.carrier.mib,0, 0, NULL, false);
// UE dedicated configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, 6, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, 6, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup, false);
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
......
......@@ -2045,8 +2045,8 @@ void configure_gnb_du_mac(int inst) {
NULL,
0,
0, // rnti
(NR_CellGroupConfig_t *)NULL
);
(NR_CellGroupConfig_t *)NULL,
false);
}
......
......@@ -434,9 +434,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
int minRXTXTIMEpdsch,
NR_ServingCellConfigCommon_t *scc,
NR_BCCH_BCH_Message_t *mib,
int add_ue,
int add_ue,
uint32_t rnti,
NR_CellGroupConfig_t *CellGroup) {
NR_CellGroupConfig_t *CellGroup,
bool rrc_reconfiguration_running) {
if (scc != NULL ) {
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
......@@ -663,9 +664,22 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
sched_ctrl->maxL = 2;
}
}
if (rrc_reconfiguration_running) {
const int UE_id = find_nr_UE_id(Mod_idP,rnti);
if (UE_id >= 0) {
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->rrc_processing_info.rrc_processing_timer == 0) {
sched_ctrl->rrc_processing_info.rrc_processing_timer = 1;
LOG_I(NR_MAC, "Activating RRC processing timer for UE: %d\n", UE_id);
}
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
return(0);
return 0;
}// END rrc_mac_config_req_gNB
......@@ -346,6 +346,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output);
}
// This updates the RRC processing timers running at MAC layer
nr_update_rrc_processing_timer(module_idP, frame, slot);
// This schedules MIB
schedule_nr_mib(module_idP, frame, slot);
......
......@@ -514,14 +514,14 @@ void nr_store_dlsch_buffer(module_id_t module_id,
0);
stop_meas(&RC.nrmac[module_id]->rlc_status_ind);
}
if(sched_ctrl->rlc_status[DL_SCH_LCID_DCCH].bytes_in_buffer > 0){
if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH].bytes_in_buffer > 0) {
lcid = DL_SCH_LCID_DCCH;
}
else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0)
{
} else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) {
lcid = DL_SCH_LCID_DCCH1;
}else{
} else if (sched_ctrl->rrc_processing_info.rrc_processing_timer == 0) {
lcid = DL_SCH_LCID_DTCH;
} else {
continue;
}
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
......@@ -1003,6 +1003,24 @@ nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(module_id_t module_id, int CC_id)
return nr_fr1_dlsch_preprocessor;
}
void nr_update_rrc_processing_timer(module_id_t module_id,
frame_t frame,
sub_frame_t slot) {
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
const NR_list_t *UE_list = &UE_info->list;
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->rrc_processing_info.rrc_processing_timer > 0) {
sched_ctrl->rrc_processing_info.rrc_processing_timer++;
if (sched_ctrl->rrc_processing_info.rrc_processing_timer >= sched_ctrl->rrc_processing_info.rrc_processing_delay) {
sched_ctrl->rrc_processing_info.rrc_processing_timer = 0;
LOG_I(NR_MAC, "De-activating RRC processing timer for UE: %d\n", UE_id);
}
}
}
}
void nr_schedule_ue_spec(module_id_t module_id,
frame_t frame,
sub_frame_t slot) {
......
......@@ -2225,6 +2225,11 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
scc,
genericParameters,
NULL);
sched_ctrl->rrc_processing_info.rrc_processing_timer = 0;
int rrc_processing_delay[5] = {10, 20, 40, 80, 160}; // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
sched_ctrl->rrc_processing_info.rrc_processing_delay = rrc_processing_delay[genericParameters->subcarrierSpacing];
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL;
if (ubwpList) AssertFatal(ubwpList->list.count == 1,
"uplinkBWP_ToAddModList has %d BWP!\n",
......
......@@ -1176,6 +1176,10 @@ void pf_ul(module_id_t module_id,
if (B == 0 && !do_sched)
continue;
if (sched_ctrl->rrc_processing_info.rrc_processing_timer > 0) {
continue;
}
/* Schedule UE on SR or UL inactivity and no data (otherwise, will be scheduled
* based on data to transmit) */
if (B == 0 && do_sched) {
......
......@@ -55,13 +55,18 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
NR_BCCH_BCH_Message_t *mib,
int add_ue,
uint32_t rnti,
NR_CellGroupConfig_t *CellGroup);
NR_CellGroupConfig_t *CellGroup,
bool rrc_reconfiguration_running);
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
int CC_idP,
frame_t frameP,
sub_frame_t subframeP);
void nr_update_rrc_processing_timer(module_id_t module_id,
frame_t frame,
sub_frame_t slot);
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
frame_t frame_rxP, sub_frame_t slot_rxP);
......
......@@ -547,6 +547,11 @@ typedef struct NR_UE_ul_harq {
NR_sched_pusch_t sched_pusch;
} NR_UE_ul_harq_t;
typedef struct NR_RRC_processing_info {
uint32_t rrc_processing_timer;
uint32_t rrc_processing_delay;
} NR_RRC_processing_info_t;
/*! \brief scheduling control information set through an API */
#define MAX_CSI_REPORTS 48
typedef struct {
......@@ -559,6 +564,9 @@ typedef struct {
NR_ControlResourceSet_t *coreset;
NR_sched_pdcch_t sched_pdcch;
/// Timer for RRC processing procedures
NR_RRC_processing_info_t rrc_processing_info;
/// CCE index and Aggr. Level are shared for PUSCH/PDSCH allocation decisions
/// corresponding to the sched_pusch/sched_pdsch structures below
int cce_index;
......
......@@ -166,17 +166,17 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
if (NODE_IS_MONOLITHIC(rrc->node_type)){
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
rrc->carrier.pdsch_AntennaPorts,
rrc->carrier.pusch_AntennaPorts,
rrc->carrier.ssb_SubcarrierOffset,
rrc->carrier.pdsch_AntennaPorts,
rrc->carrier.pusch_AntennaPorts,
rrc->carrier.sib1_tda,
rrc->carrier.minRXTXTIME,
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
&rrc->carrier.mib,
0,
0, // WIP hardcoded rnti
(NR_CellGroupConfig_t *)NULL
);
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
&rrc->carrier.mib,
0,
0, // WIP hardcoded rnti
(NR_CellGroupConfig_t *)NULL,
false);
}
/* set flag to indicate that cell information is configured. This is required
......@@ -279,17 +279,18 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
rrc_gNB_ue_context_t *const ue_context_pP,
const protocol_ctxt_t *const ctxt_pP ) {
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
rrc->carrier.pdsch_AntennaPorts,
rrc->carrier.pusch_AntennaPorts,
rrc->carrier.sib1_tda,
rrc->carrier.minRXTXTIME,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL);
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
rrc->carrier.pdsch_AntennaPorts,
rrc->carrier.pusch_AntennaPorts,
rrc->carrier.sib1_tda,
rrc->carrier.minRXTXTIME,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL,
false);
nr_rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_pP->ue_context.SRB_configList,
......@@ -474,8 +475,8 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
&rrc_instance_p->carrier.mib,
0,
ue_context_pP->ue_context.rnti,
(NR_CellGroupConfig_t *)NULL
);
(NR_CellGroupConfig_t *)NULL,
false);
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
......@@ -730,6 +731,19 @@ rrc_gNB_generate_defaultRRCReconfiguration(
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n");
rrc_mac_config_req_gNB(ctxt_pP->module_id,
0,
0,
0,
0,
0,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
NULL,
true);
/* Free all NAS PDUs */
for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) {
if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) {
......@@ -988,7 +1002,20 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
&rrc->carrier,
NULL,
cellGroupConfig);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n");
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
rrc_mac_config_req_gNB(ctxt_pP->module_id,
0,
0,
0,
0,
0,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
NULL,
true);
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) {
......@@ -1162,6 +1189,19 @@ rrc_gNB_modify_dedicatedRRCReconfiguration(
NULL);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n");
rrc_mac_config_req_gNB(ctxt_pP->module_id,
0,
0,
0,
0,
0,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
NULL,
true);
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) {
......@@ -1262,8 +1302,20 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
NULL);
ue_context_pP->ue_context.pdu_session_release_command_flag = 1;
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,
"[MSG] RRC Reconfiguration\n");
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
rrc_mac_config_req_gNB(ctxt_pP->module_id,
0,
0,
0,
0,
0,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
NULL,
true);
/* Free all NAS PDUs */
if (nas_length > 0) {
......@@ -1371,8 +1423,8 @@ rrc_gNB_process_RRCReconfigurationComplete(
NULL,
0,
ue_context_pP->ue_context.rnti,
ue_context_pP->ue_context.masterCellGroup
);
ue_context_pP->ue_context.masterCellGroup,
false);
LOG_D(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti);
nr_rrc_rlc_config_asn1_req(ctxt_pP,
SRB_configList, // NULL,
......@@ -1811,8 +1863,20 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
NULL,
NULL,
NULL);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,
"[MSG] RRC Reconfiguration\n");
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
rrc_mac_config_req_gNB(ctxt_pP->module_id,
0,
0,
0,
0,
0,
NULL,
NULL,
0,
ue_context_pP->ue_context.rnti,
NULL,
true);
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) {
......
......@@ -361,14 +361,15 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
rrc->carrier.pdsch_AntennaPorts,
rrc->carrier.pusch_AntennaPorts,
rrc->carrier.pusch_AntennaPorts,
rrc->carrier.sib1_tda,
rrc->carrier.minRXTXTIME,
rrc->carrier.servingcellconfigcommon,
&rrc->carrier.mib,
1, // add_ue flag
ue_context_p->ue_id_rnti,
ue_context_p->ue_context.secondaryCellGroup);
ue_context_p->ue_context.secondaryCellGroup,
false);
} else {
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
......@@ -380,7 +381,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
NULL,
1, // add_ue flag
ue_context_p->ue_id_rnti,
ue_context_p->ue_context.secondaryCellGroup);
ue_context_p->ue_context.secondaryCellGroup,
false);
}
if(m == NULL){
......
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