Commit 5761b60c authored by Robert Schmidt's avatar Robert Schmidt

Create functions to access MAC from RRC

- for updating cellGroup
- for removing UE
- not done for SI information and RRC timers
parent f7181caf
......@@ -2483,8 +2483,6 @@ void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) {
void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti)
{
nr_rlc_remove_ue(rnti);
NR_UEs_t *UE_info = &nr_mac->UE_info;
pthread_mutex_lock(&UE_info->mutex);
UE_iterator(UE_info->list, UE) {
......
......@@ -35,6 +35,9 @@
#include "common/ran_context.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "intertask_interface.h"
......@@ -47,12 +50,17 @@
extern RAN_CONTEXT_t RC;
void nr_rrc_mac_remove_ue(rnti_t rntiMaybeUEid)
{
nr_rlc_remove_ue(rntiMaybeUEid);
int
nr_rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP){
// todo
return 0;
gNB_MAC_INST *nrmac = RC.nrmac[0];
mac_remove_nr_ue(nrmac, rntiMaybeUEid);
}
void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc)
{
nr_mac_update_cellgroup(RC.nrmac[0], rntiMaybeUEid, cgc);
}
uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
......
......@@ -42,6 +42,7 @@
#include "NR_CG-Config.h"
#include "NR_CG-ConfigInfo.h"
#include "NR_SecurityConfig.h"
#include "NR_CellGroupConfig.h"
#define NR_MAX_SUPPORTED_DL_LAYERS 2
void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan);
......@@ -136,9 +137,8 @@ void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe);
\ *reOffset Pointer to RE Offset Value */
void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMcs, int *epre_Ratio, int * reOffset);
int
nr_rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP);
void nr_rrc_mac_remove_ue(rnti_t rntiP);
void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc);
int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP,
const frame_t frameP,
......
......@@ -92,7 +92,6 @@
#include <openair2/X2AP/x2ap_eNB.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include <openair2/RRC/NR/nr_rrc_proto.h>
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_e1_api.h"
#include "openair2/F1AP/f1ap_common.h"
#include "openair2/SDAP/nr_sdap/nr_sdap_entity.h"
......@@ -322,7 +321,7 @@ unsigned int rrc_gNB_get_next_transaction_identifier(module_id_t gnb_mod_idP)
static void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP)
{
NR_CellGroupConfig_t *cgc = get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : NULL;
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_context_pP->ue_context.rnti, cgc);
nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, cgc);
nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.SRB_configList, cgc->rlc_BearerToAddModList);
nr_rrc_addmod_drbs(ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.DRB_configList, cgc->rlc_BearerToAddModList);
......@@ -330,7 +329,7 @@ static void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const u
void apply_macrlc_config_reest(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP, ue_id_t ue_id)
{
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_id, ue_context_pP->ue_context.masterCellGroup);
nr_rrc_mac_update_cellgroup(ue_id, ue_context_pP->ue_context.masterCellGroup);
nr_rrc_addmod_srbs(ctxt_pP->rntiMaybeUEid,
ue_context_pP->ue_context.SRB_configList,
......@@ -577,7 +576,7 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_p->rnti, ue_p->masterCellGroup);
nr_rrc_mac_update_cellgroup(ue_p->rnti, ue_p->masterCellGroup);
uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated
&& ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList
......@@ -766,7 +765,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, size, buffer, deliver_pdu_srb_f1, rrc);
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.masterCellGroup);
nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.masterCellGroup);
uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated
&& ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList
......@@ -1550,7 +1549,7 @@ void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *const ctx
ctxt_pP->module_id,
DCCH);
nr_mac_update_cellgroup(RC.nrmac[rrc->module_id], ue_context_pP->ue_context.rnti, cellGroupConfig);
nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, cellGroupConfig);
nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, size, buffer, deliver_pdu_srb_f1, rrc);
}
......@@ -1604,7 +1603,7 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP
NULL,
masterCellGroup);
nr_mac_update_cellgroup(RC.nrmac[ctxt_pP->module_id], ue_context_pP->ue_context.rnti, masterCellGroup);
nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, masterCellGroup);
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, size, buffer, deliver_pdu_srb_f1, rrc);
......@@ -1694,8 +1693,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, rnti_t rnti, const uint
// TODO: MAC structures should not be accessed directly from the RRC! An implementation using the F1 interface should be developed.
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
gNB_MAC_INST *nrmac = RC.nrmac[module_id]; // why MAC instances match RRC instances ?
mac_remove_nr_ue(nrmac, UE->rnti);
nr_rrc_mac_remove_ue(ue_context_p->ue_context.rnti);
}
/* replace rnti in the context */
......@@ -2382,8 +2380,7 @@ rrc_gNB_decode_dcch(
if (ul_dcch_msg->message.choice.c1->choice.rrcReestablishmentComplete->criticalExtensions.present == NR_RRCReestablishmentComplete__criticalExtensions_PR_rrcReestablishmentComplete) {
rrc_gNB_process_RRCReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, ul_dcch_msg->message.choice.c1->choice.rrcReestablishmentComplete->rrc_TransactionIdentifier);
gNB_MAC_INST *nrmac = RC.nrmac[ctxt_pP->module_id]; // WHAT A BEAUTIFULL RACE CONDITION !!!
mac_remove_nr_ue(nrmac, reestablish_rnti);
nr_rrc_mac_remove_ue(reestablish_rnti);
UE->ue_reestablishment_counter++;
}
......@@ -3216,8 +3213,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
// Remove here the MAC and RRC context when RRC is not connected
if (UE->StatusRrc < NR_RRC_CONNECTED) {
if (!NODE_IS_CU(rrc->node_type)) {
gNB_MAC_INST *nrmac = RC.nrmac[ctxt_pP->module_id]; // WHAT A BEAUTIFULL RACE CONDITION !!!
mac_remove_nr_ue(nrmac, UE->rnti);
nr_rrc_mac_remove_ue(ctxt_pP->rntiMaybeUEid);
rrc_rlc_remove_ue(ctxt_pP);
nr_pdcp_remove_UE(ctxt_pP->rntiMaybeUEid);
......@@ -3252,8 +3248,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
LOG_I(NR_RRC, "Removing UE %x instance after UE_CONTEXT_RELEASE_Complete (ue_release_timer_rrc timeout)\n", UE->rnti);
UE->ue_release_timer_rrc = 0;
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
gNB_MAC_INST *nrmac = RC.nrmac[ctxt_pP->module_id]; // WHAT A BEAUTIFULL RACE CONDITION !!!
mac_remove_nr_ue(nrmac, UE->rnti);
nr_rrc_mac_remove_ue(ctxt_pP->rntiMaybeUEid);
}
rrc_rlc_remove_ue(ctxt_pP);
nr_pdcp_remove_UE(ctxt_pP->rntiMaybeUEid);
......
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