Commit bc7a4046 authored by rmagueta's avatar rmagueta

Move rrc_processing_timer from MAC to RRC

parent f5c4ccf4
......@@ -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, false);
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, 6, scc, NULL, 0, 0, NULL);
// 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, false);
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, 6, scc, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
// 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, false);
rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, 6, scc, &rrc.carrier.mib,0, 0, NULL);
// 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, false);
rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, 6, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
......
......@@ -2051,8 +2051,8 @@ void configure_gnb_du_mac(int inst) {
NULL,
0,
0, // rnti
(NR_CellGroupConfig_t *)NULL,
false);
(NR_CellGroupConfig_t *)NULL
);
}
......
......@@ -202,4 +202,9 @@ void nr_mac_gNB_rrc_ul_failure_reset(const module_id_t Mod_instP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP);
bool nr_rrc_disabled_mac_scheduling(const module_id_t Mod_instP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP);
#endif
......@@ -436,8 +436,7 @@ 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,
bool rrc_reconfiguration_running) {
NR_CellGroupConfig_t *CellGroup) {
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);
......@@ -664,19 +663,6 @@ 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);
......
......@@ -346,9 +346,6 @@ 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);
......
......@@ -518,12 +518,12 @@ void nr_store_dlsch_buffer(module_id_t module_id,
lcid = DL_SCH_LCID_DCCH;
} else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) {
lcid = DL_SCH_LCID_DCCH1;
} else if (sched_ctrl->rrc_processing_info.rrc_processing_timer == 0) {
} else if (!nr_rrc_disabled_mac_scheduling(module_id, frame, slot, rnti)) {
lcid = DL_SCH_LCID_DTCH;
} else {
continue;
}
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
//later multiplex here. Just select DCCH/SRB before DTCH/DRB
sched_ctrl->lcid_to_schedule = lcid;
......@@ -1003,24 +1003,6 @@ 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) {
......
......@@ -2254,10 +2254,6 @@ 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;
sched_ctrl->rrc_processing_info.rrc_processing_delay = 10<<genericParameters->subcarrierSpacing; // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
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",
......
......@@ -1180,7 +1180,7 @@ void pf_ul(module_id_t module_id,
if (B == 0 && !do_sched)
continue;
if (sched_ctrl->rrc_processing_info.rrc_processing_timer > 0) {
if (nr_rrc_disabled_mac_scheduling(module_id, frame, slot, UE_info->rnti[UE_id])) {
continue;
}
......
......@@ -55,18 +55,13 @@ 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,
bool rrc_reconfiguration_running);
NR_CellGroupConfig_t *CellGroup);
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);
......
......@@ -553,11 +553,6 @@ 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 {
......@@ -570,9 +565,6 @@ 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;
......
......@@ -392,3 +392,20 @@ void nr_mac_gNB_rrc_ul_failure_reset(const module_id_t Mod_instP,
LOG_W(RRC,"Frame %d, Subframe %d: UL failure reset: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
bool nr_rrc_disabled_mac_scheduling(const module_id_t Mod_instP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) {
bool ret = false;
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_instP], rntiP);
if (ue_context_p != NULL) {
if(ue_context_p->ue_context.rrc_processing_timer > 0) {
ret = true;
}
} else {
LOG_W(RRC,"Frame %d, Subframe %d: UE 0x%04x unknown \n",frameP,subframeP,rntiP);
}
return ret;
}
......@@ -96,6 +96,8 @@ typedef struct nr_uid_linear_allocator_s {
#define PROTOCOL_NR_RRC_CTXT_FMT PROTOCOL_CTXT_FMT
#define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_NR_CTXT_ARGS(CTXT_Pp)
// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
#define NR_RRC_PROCESSING_DELAY_MS 10
#define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
#define NR_UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1
......@@ -372,8 +374,10 @@ typedef struct gNB_RRC_UE_s {
rb_id_t gnb_gtp_ebi[S1AP_MAX_E_RAB];
rb_id_t gnb_gtp_psi[S1AP_MAX_E_RAB];
//GTPV1 F1-U TUNNELS
uint32_t incoming_teid[S1AP_MAX_E_RAB];
uint32_t incoming_teid[S1AP_MAX_E_RAB];
uint32_t rrc_processing_timer;
uint32_t rrc_processing_delay;
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
uint32_t ue_release_timer_thres;
......
......@@ -175,8 +175,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
&rrc->carrier.mib,
0,
0, // WIP hardcoded rnti
(NR_CellGroupConfig_t *)NULL,
false);
(NR_CellGroupConfig_t *)NULL);
}
/* set flag to indicate that cell information is configured. This is required
......@@ -289,8 +288,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
NULL,
0,
ue_context_pP->ue_context.rnti,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL,
false);
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL);
nr_rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_pP->ue_context.SRB_configList,
......@@ -475,8 +473,7 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
&rrc_instance_p->carrier.mib,
0,
ue_context_pP->ue_context.rnti,
(NR_CellGroupConfig_t *)NULL,
false);
(NR_CellGroupConfig_t *)NULL);
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
......@@ -727,23 +724,13 @@ rrc_gNB_generate_defaultRRCReconfiguration(
NULL,
ue_p->masterCellGroup);
int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
ue_context_pP->ue_context.rrc_processing_timer = 1;
ue_context_pP->ue_context.rrc_processing_delay = NR_RRC_PROCESSING_DELAY_MS<<common_scs;
free(ue_context_pP->ue_context.nas_pdu.buffer);
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) {
......@@ -1002,20 +989,12 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
&rrc->carrier,
NULL,
cellGroupConfig);
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);
int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
ue_context_pP->ue_context.rrc_processing_timer = 1;
ue_context_pP->ue_context.rrc_processing_delay = NR_RRC_PROCESSING_DELAY_MS<<common_scs;
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) {
......@@ -1187,20 +1166,12 @@ rrc_gNB_modify_dedicatedRRCReconfiguration(
NULL,
NULL,
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);
int common_scs = RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
ue_context_pP->ue_context.rrc_processing_timer = 1;
ue_context_pP->ue_context.rrc_processing_delay = NR_RRC_PROCESSING_DELAY_MS<<common_scs;
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
......@@ -1301,21 +1272,12 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
NULL,
NULL);
int common_scs = RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
ue_context_pP->ue_context.rrc_processing_timer = 1;
ue_context_pP->ue_context.rrc_processing_delay = NR_RRC_PROCESSING_DELAY_MS<<common_scs;
ue_context_pP->ue_context.pdu_session_release_command_flag = 1;
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);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */
if (nas_length > 0) {
......@@ -1423,8 +1385,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
NULL,
0,
ue_context_pP->ue_context.rnti,
ue_context_pP->ue_context.masterCellGroup,
false);
ue_context_pP->ue_context.masterCellGroup);
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,
......@@ -1863,20 +1824,12 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
NULL,
NULL,
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);
int common_scs = RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
ue_context_pP->ue_context.rrc_processing_timer = 1;
ue_context_pP->ue_context.rrc_processing_delay = NR_RRC_PROCESSING_DELAY_MS<<common_scs;
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) {
......@@ -3493,6 +3446,14 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
get_ul_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr));
}
}
if (ue_context_p->ue_context.rrc_processing_timer > 0) {
ue_context_p->ue_context.rrc_processing_timer++;
if(ue_context_p->ue_context.rrc_processing_timer >= ue_context_p->ue_context.rrc_processing_delay) {
ue_context_p->ue_context.rrc_processing_timer = 0;
}
}
if (ue_context_p->ue_context.ul_failure_timer > 0) {
ue_context_p->ue_context.ul_failure_timer++;
......
......@@ -368,8 +368,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
&rrc->carrier.mib,
1, // add_ue flag
ue_context_p->ue_id_rnti,
ue_context_p->ue_context.secondaryCellGroup,
false);
ue_context_p->ue_context.secondaryCellGroup);
} else {
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
......@@ -381,8 +380,7 @@ 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,
false);
ue_context_p->ue_context.secondaryCellGroup);
}
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