Commit 9c0d90a0 authored by Laurent THOMAS's avatar Laurent THOMAS Committed by francescomani

Introduce UE RCC to MAC ITTI queue

Reduce race conditions through a itti queue, such that RRC-initiated MAC
memory modifications happen at the same time as MAC thread writes.
However, it doesn't resolve the problem of exact slot we should apply
the new cell configurtion.
parent f9bff3d6
...@@ -631,6 +631,14 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE, ...@@ -631,6 +631,14 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE,
if (UE->sl_mode == 2) if (UE->sl_mode == 2)
fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params;
// process what RRC thread sent to MAC
MessageDef *msg = NULL;
do {
itti_poll_msg(TASK_MAC_UE, &msg);
if (msg)
process_msg_rcc_to_mac(msg);
} while (msg);
if (IS_SOFTMODEM_NOS1 || IS_SA_MODE(get_softmodem_params())) { if (IS_SOFTMODEM_NOS1 || IS_SA_MODE(get_softmodem_params())) {
/* send tick to RLC and PDCP every ms */ /* send tick to RLC and PDCP every ms */
if (proc->nr_slot_rx % fp->slots_per_subframe == 0) { if (proc->nr_slot_rx % fp->slots_per_subframe == 0) {
...@@ -875,10 +883,18 @@ void *UE_thread(void *arg) ...@@ -875,10 +883,18 @@ void *UE_thread(void *arg)
syncRunning = false; syncRunning = false;
if (UE->is_synchronized) { if (UE->is_synchronized) {
UE->synch_request.received_synch_request = 0; UE->synch_request.received_synch_request = 0;
if (UE->sl_mode == 2) if (UE->sl_mode == SL_MODE2_SUPPORTED)
decoded_frame_rx = UE->SL_UE_PHY_PARAMS.sync_params.DFN; decoded_frame_rx = UE->SL_UE_PHY_PARAMS.sync_params.DFN;
else else {
// We must wait the RRC layer decoded the MIB and sent us the frame number
MessageDef *msg = NULL;
itti_receive_msg(TASK_MAC_UE, &msg);
if (msg)
process_msg_rcc_to_mac(msg);
else
LOG_E(PHY, "It seems we arbort while trying to sync\n");
decoded_frame_rx = mac->mib_frame; decoded_frame_rx = mac->mib_frame;
}
LOG_A(PHY, LOG_A(PHY,
"UE synchronized! decoded_frame_rx=%d UE->init_sync_frame=%d trashed_frames=%d\n", "UE synchronized! decoded_frame_rx=%d UE->init_sync_frame=%d trashed_frames=%d\n",
decoded_frame_rx, decoded_frame_rx,
......
...@@ -43,7 +43,6 @@ Description Defines the messages supported by the Access Stratum sublayer ...@@ -43,7 +43,6 @@ Description Defines the messages supported by the Access Stratum sublayer
#include "commonDef.h" #include "commonDef.h"
#include "networkDef.h" #include "networkDef.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/ /****************************************************************************/
...@@ -582,6 +581,20 @@ typedef struct as_message_s { ...@@ -582,6 +581,20 @@ typedef struct as_message_s {
} __attribute__((__packed__)) msg; } __attribute__((__packed__)) msg;
} as_message_t; } as_message_t;
typedef struct {
NR_ReestablishmentCause_t cause;
} nr_mac_rrc_config_reset_t;
typedef struct {
NR_CellGroupConfig_t* cellGroupConfig;
NR_UE_NR_Capability_t* UE_NR_Capability;
} nr_mac_rrc_config_cg_t;
typedef struct {
NR_BCCH_BCH_Message_t* bcch;
int get_sib;
} nr_mac_rrc_config_mib_t;
typedef struct {
NR_SIB1_t* sib1;
} nr_mac_rrc_config_sib1_t;
/****************************************************************************/ /****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/ /****************************************************************************/
......
...@@ -82,6 +82,12 @@ MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, dl_info_transfer_ind_t, ...@@ -82,6 +82,12 @@ MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, dl_info_transfer_ind_t,
MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process) MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process)
MESSAGE_DEF(NRRRC_FRAME_PROCESS, MESSAGE_PRIORITY_MED, NRRrcFrameProcess, nr_rrc_frame_process) MESSAGE_DEF(NRRRC_FRAME_PROCESS, MESSAGE_PRIORITY_MED, NRRrcFrameProcess, nr_rrc_frame_process)
// UE: RRC -> MAC messages
MESSAGE_DEF(NR_MAC_RRC_CONFIG_RESET, MESSAGE_PRIORITY_MED, nr_mac_rrc_config_reset_t, nr_mac_rrc_config_reset)
MESSAGE_DEF(NR_MAC_RRC_CONFIG_CG, MESSAGE_PRIORITY_MED, nr_mac_rrc_config_cg_t, nr_mac_rrc_config_cg)
MESSAGE_DEF(NR_MAC_RRC_CONFIG_MIB, MESSAGE_PRIORITY_MED, nr_mac_rrc_config_mib_t, nr_mac_rrc_config_mib)
MESSAGE_DEF(NR_MAC_RRC_CONFIG_SIB1, MESSAGE_PRIORITY_MED, nr_mac_rrc_config_sib1_t, nr_mac_rrc_config_sib1)
// eNB: RLC -> RRC messages // eNB: RLC -> RRC messages
MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication) MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication)
MESSAGE_DEF(NAS_PDU_SESSION_REQ, MESSAGE_PRIORITY_MED, nas_pdu_session_req_t, nas_pdu_session_req) MESSAGE_DEF(NAS_PDU_SESSION_REQ, MESSAGE_PRIORITY_MED, nas_pdu_session_req_t, nas_pdu_session_req)
......
...@@ -96,12 +96,15 @@ ...@@ -96,12 +96,15 @@
#define NAS_OAI_TUN_NSA(mSGpTR) (mSGpTR)->ittiMsg.nas_oai_tun_nsa #define NAS_OAI_TUN_NSA(mSGpTR) (mSGpTR)->ittiMsg.nas_oai_tun_nsa
#define NAS_PDU_SESSION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_pdu_session_req #define NAS_PDU_SESSION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_pdu_session_req
#define NR_MAC_RRC_CONFIG_RESET(mSGpTR) (mSGpTR)->ittiMsg.nr_mac_rrc_config_reset
#define NR_MAC_RRC_CONFIG_CG(mSGpTR) (mSGpTR)->ittiMsg.nr_mac_rrc_config_cg
#define NR_MAC_RRC_CONFIG_MIB(mSGpTR) (mSGpTR)->ittiMsg.nr_mac_rrc_config_mib
#define NR_MAC_RRC_CONFIG_SIB1(mSGpTR) (mSGpTR)->ittiMsg.nr_mac_rrc_config_sib1
#define NR_RRC_RLC_MAXRTX(mSGpTR) (mSGpTR)->ittiMsg.nr_rlc_maxrtx_indication #define NR_RRC_RLC_MAXRTX(mSGpTR) (mSGpTR)->ittiMsg.nr_rlc_maxrtx_indication
//-------------------------------------------------------------------------------------------//
typedef struct RrcStateInd_s { typedef struct RrcStateInd_s {
Rrc_State_t state; Rrc_State_t state;
Rrc_Sub_State_t sub_state; Rrc_Sub_State_t sub_state;
} RrcStateInd; } RrcStateInd;
......
...@@ -1704,17 +1704,19 @@ static void configure_si_schedulingInfo(NR_UE_MAC_INST_t *mac, ...@@ -1704,17 +1704,19 @@ static void configure_si_schedulingInfo(NR_UE_MAC_INST_t *mac,
} }
} }
void nr_rrc_mac_config_req_sib1(module_id_t module_id, void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1)
int cc_idP,
NR_SI_SchedulingInfo_t *si_SchedulingInfo,
NR_SI_SchedulingInfo_v1700_t *si_SchedulingInfo_v1700,
NR_ServingCellConfigCommonSIB_t *scc)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex); int ret = pthread_mutex_lock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret); AssertFatal(!ret, "mutex failed %d\n", ret);
NR_SI_SchedulingInfo_t *si_SchedulingInfo = sib1->si_SchedulingInfo;
NR_SI_SchedulingInfo_v1700_t *si_SchedulingInfo_v1700 = NULL;
if (sib1->nonCriticalExtension && sib1->nonCriticalExtension->nonCriticalExtension
&& sib1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension) {
si_SchedulingInfo_v1700 = sib1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->si_SchedulingInfo_v1700;
}
NR_ServingCellConfigCommonSIB_t *scc = sib1->servingCellConfigCommon;
AssertFatal(scc, "SIB1 SCC should not be NULL\n"); AssertFatal(scc, "SIB1 SCC should not be NULL\n");
UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t); UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t);
configure_si_schedulingInfo(mac, si_SchedulingInfo, si_SchedulingInfo_v1700); configure_si_schedulingInfo(mac, si_SchedulingInfo, si_SchedulingInfo_v1700);
mac->n_ta_offset = get_ta_offset(scc->n_TimingAdvanceOffset); mac->n_ta_offset = get_ta_offset(scc->n_TimingAdvanceOffset);
......
...@@ -85,11 +85,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, ...@@ -85,11 +85,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
NR_MIB_t *mibP, NR_MIB_t *mibP,
int sched_sib1); int sched_sib1);
void nr_rrc_mac_config_req_sib1(module_id_t module_id, void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1);
int cc_idP,
NR_SI_SchedulingInfo_t *si_SchedulingInfo,
NR_SI_SchedulingInfo_v1700_t *si_SchedulingInfo_v1700,
NR_ServingCellConfigCommonSIB_t *scc);
struct position; /* forward declaration */ struct position; /* forward declaration */
void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, const struct position *pos, NR_SIB19_r17_t *sib19_r17); void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, const struct position *pos, NR_SIB19_r17_t *sib19_r17);
......
...@@ -615,6 +615,14 @@ static int nr_ue_process_dci_ul_01(NR_UE_MAC_INST_t *mac, ...@@ -615,6 +615,14 @@ static int nr_ue_process_dci_ul_01(NR_UE_MAC_INST_t *mac,
dci_ind->rnti, dci_ind->rnti,
dci_ind->ss_type, dci_ind->ss_type,
NR_UL_DCI_FORMAT_0_1); NR_UL_DCI_FORMAT_0_1);
LOG_D(NR_MAC_DCI,
"add ul dci harq %d for %d.%d %d.%d round %d\n",
pdu->pusch_config_pdu.pusch_data.harq_process_id,
frame,
slot,
frame_tx,
slot_tx,
0);
if (ret != 0) if (ret != 0)
remove_ul_config_last_item(pdu); remove_ul_config_last_item(pdu);
release_ul_config(pdu, false); release_ul_config(pdu, false);
......
...@@ -2573,7 +2573,15 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n ...@@ -2573,7 +2573,15 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
dci_pdu_rel15_t uldci_payload; dci_pdu_rel15_t uldci_payload;
memset(&uldci_payload, 0, sizeof(uldci_payload)); memset(&uldci_payload, 0, sizeof(uldci_payload));
if (current_BWP->dci_format == NR_UL_DCI_FORMAT_0_1)
LOG_D(NR_MAC_DCI,
"add ul dci harq %d for %d.%d %d.%d round %d\n",
harq_id,
frame,
slot,
sched_pusch->frame,
sched_pusch->slot,
sched_ctrl->ul_harq_processes[harq_id].round);
config_uldci(&UE->sc_info, config_uldci(&UE->sc_info,
pusch_pdu, pusch_pdu,
&uldci_payload, &uldci_payload,
......
...@@ -1206,11 +1206,10 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) ...@@ -1206,11 +1206,10 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info)
return 0; return 0;
} }
static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info) static uint32_t nr_ue_dl_processing(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info)
{ {
uint32_t ret_mask = 0x0; uint32_t ret_mask = 0x0;
DevAssert(dl_info != NULL); DevAssert(mac != NULL && dl_info != NULL);
NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id);
// DL indication after reception of DCI or DL PDU // DL indication after reception of DCI or DL PDU
if (dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) { if (dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) {
...@@ -1322,7 +1321,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) ...@@ -1322,7 +1321,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
nr_ue_dl_scheduler(mac, dl_info); nr_ue_dl_scheduler(mac, dl_info);
else else
// DL indication to process data channels // DL indication to process data channels
ret2 = nr_ue_dl_processing(dl_info); ret2 = nr_ue_dl_processing(mac, dl_info);
ret = pthread_mutex_unlock(&mac->if_mutex); ret = pthread_mutex_unlock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret); AssertFatal(!ret, "mutex failed %d\n", ret);
return ret2; return ret2;
......
...@@ -121,6 +121,31 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -121,6 +121,31 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
} }
} }
void process_msg_rcc_to_mac(MessageDef *msg)
{
instance_t ue_id = ITTI_MSG_DESTINATION_INSTANCE(msg);
switch (ITTI_MSG_ID(msg)) {
case NR_MAC_RRC_CONFIG_RESET:
nr_rrc_mac_config_req_reset(ue_id, NR_MAC_RRC_CONFIG_RESET(msg).cause);
break;
case NR_MAC_RRC_CONFIG_CG:
nr_rrc_mac_config_req_cg(ue_id, 0, NR_MAC_RRC_CONFIG_CG(msg).cellGroupConfig, NR_MAC_RRC_CONFIG_CG(msg).UE_NR_Capability);
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, NR_MAC_RRC_CONFIG_CG(msg).cellGroupConfig);
break;
case NR_MAC_RRC_CONFIG_MIB:
nr_rrc_mac_config_req_mib(ue_id, 0, NR_MAC_RRC_CONFIG_MIB(msg).bcch->message.choice.mib, NR_MAC_RRC_CONFIG_MIB(msg).get_sib);
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, NR_MAC_RRC_CONFIG_MIB(msg).bcch);
break;
case NR_MAC_RRC_CONFIG_SIB1: {
NR_SIB1_t *sib1 = NR_MAC_RRC_CONFIG_SIB1(msg).sib1;
nr_rrc_mac_config_req_sib1(ue_id, 0, sib1);
SEQUENCE_free(&asn_DEF_NR_SIB1, NR_MAC_RRC_CONFIG_SIB1(msg).sib1, ASFM_FREE_EVERYTHING);
} break;
default:
LOG_E(NR_MAC, "Unexpected msg from RRC: %d\n", ITTI_MSG_ID(msg));
}
}
void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id) void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id)
{ {
MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_INAC_IND); MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_INAC_IND);
......
...@@ -41,5 +41,6 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, int gnb_id); ...@@ -41,5 +41,6 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, int gnb_id);
void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id); void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id);
void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success); void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success);
void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type); void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type);
void process_msg_rcc_to_mac(MessageDef *msg);
#endif #endif
...@@ -335,8 +335,9 @@ static void nr_rrc_process_sib1(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *SI_inf ...@@ -335,8 +335,9 @@ static void nr_rrc_process_sib1(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *SI_inf
nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, sib1); nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, sib1);
// RRC storage of SIB1 timers and constants (eg needed in re-establishment) // RRC storage of SIB1 timers and constants (eg needed in re-establishment)
UPDATE_IE(rrc->timers_and_constants.sib1_TimersAndConstants, sib1->ue_TimersAndConstants, NR_UE_TimersAndConstants_t); UPDATE_IE(rrc->timers_and_constants.sib1_TimersAndConstants, sib1->ue_TimersAndConstants, NR_UE_TimersAndConstants_t);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_SIB1);
nr_rrc_mac_config_req_sib1(rrc->ue_id, 0, sib1->si_SchedulingInfo, si_SchedInfo_v1700, sib1->servingCellConfigCommon); NR_MAC_RRC_CONFIG_SIB1(msg).sib1 = sib1;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
} }
static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCReconfiguration_v1530_IEs_t *rec_1530, int gNB_index) static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCReconfiguration_v1530_IEs_t *rec_1530, int gNB_index)
...@@ -378,6 +379,7 @@ static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCRe ...@@ -378,6 +379,7 @@ static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCRe
LOG_E(NR_RRC, "dedicatedSIB1-Delivery decode error\n"); LOG_E(NR_RRC, "dedicatedSIB1-Delivery decode error\n");
SEQUENCE_free(&asn_DEF_NR_SIB1, sib1, 1); SEQUENCE_free(&asn_DEF_NR_SIB1, sib1, 1);
} else { } else {
// mac layer will free sib1
nr_rrc_process_sib1(rrc, SI_info, sib1); nr_rrc_process_sib1(rrc, SI_info, sib1);
} }
} }
...@@ -474,8 +476,12 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, int gNB_ ...@@ -474,8 +476,12 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, int gNB_
nr_rrc_cellgroup_configuration(rrc, cellGroupConfig); nr_rrc_cellgroup_configuration(rrc, cellGroupConfig);
AssertFatal(!IS_SA_MODE(get_softmodem_params()), "secondaryCellGroup only used in NSA for now\n"); AssertFatal(!IS_SA_MODE(get_softmodem_params()), "secondaryCellGroup only used in NSA for now\n");
nr_rrc_mac_config_req_cg(rrc->ue_id, 0, cellGroupConfig, rrc->UECap.UE_NR_Capability); MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_CG);
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, cellGroupConfig); // cellGroupConfig will be managed by MAC
NR_MAC_RRC_CONFIG_CG(msg).cellGroupConfig = cellGroupConfig;
// UE_NR_Capability remain a race condition between this rrc thread and mac thread
NR_MAC_RRC_CONFIG_CG(msg).UE_NR_Capability = rrc->UECap.UE_NR_Capability;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
} }
if (ie->measConfig) { if (ie->measConfig) {
LOG_I(NR_RRC, "RRCReconfiguration includes Measurement Configuration\n"); LOG_I(NR_RRC, "RRCReconfiguration includes Measurement Configuration\n");
...@@ -807,11 +813,16 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc, ...@@ -807,11 +813,16 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc,
// to schedule MAC to get SI if required // to schedule MAC to get SI if required
get_sib = check_si_status(SI_info); get_sib = check_si_status(SI_info);
} }
if (bcch_message->message.present == NR_BCCH_BCH_MessageType_PR_mib) if (bcch_message->message.present == NR_BCCH_BCH_MessageType_PR_mib) {
nr_rrc_mac_config_req_mib(rrc->ue_id, 0, bcch_message->message.choice.mib, get_sib); MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_MIB);
else // mac will manage the pointer
NR_MAC_RRC_CONFIG_MIB(msg).bcch = bcch_message;
NR_MAC_RRC_CONFIG_MIB(msg).get_sib = get_sib;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
} else {
LOG_E(NR_RRC, "RRC-received BCCH message is not a MIB\n"); LOG_E(NR_RRC, "RRC-received BCCH message is not a MIB\n");
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message); ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message);
}
return; return;
} }
...@@ -900,6 +911,8 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc, ...@@ -900,6 +911,8 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc,
switch (bcch_message->message.choice.c1->present) { switch (bcch_message->message.choice.c1->present) {
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
nr_rrc_process_sib1(rrc, SI_info, bcch_message->message.choice.c1->choice.systemInformationBlockType1); nr_rrc_process_sib1(rrc, SI_info, bcch_message->message.choice.c1->choice.systemInformationBlockType1);
// mac layer will free after usage the sib1
bcch_message->message.choice.c1->choice.systemInformationBlockType1 = NULL;
break; break;
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
LOG_I(NR_RRC, "[UE %ld] Decoding SI\n", rrc->ue_id); LOG_I(NR_RRC, "[UE %ld] Decoding SI\n", rrc->ue_id);
...@@ -1036,9 +1049,11 @@ static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc, ...@@ -1036,9 +1049,11 @@ static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc,
nr_rrc_cellgroup_configuration(rrc, cellGroupConfig); nr_rrc_cellgroup_configuration(rrc, cellGroupConfig);
LOG_D(RRC,"Sending CellGroupConfig to MAC\n"); LOG_D(RRC, "Sending CellGroupConfig to MAC the pointer will be managed by mac\n");
nr_rrc_mac_config_req_cg(rrc->ue_id, 0, cellGroupConfig, rrc->UECap.UE_NR_Capability); MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_CG);
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, cellGroupConfig); NR_MAC_RRC_CONFIG_CG(msg).cellGroupConfig = cellGroupConfig;
NR_MAC_RRC_CONFIG_CG(msg).UE_NR_Capability = rrc->UECap.UE_NR_Capability;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
} }
static void rrc_ue_generate_RRCSetupComplete(const NR_UE_RRC_INST_t *rrc, const uint8_t Transaction_id) static void rrc_ue_generate_RRCSetupComplete(const NR_UE_RRC_INST_t *rrc, const uint8_t Transaction_id)
...@@ -2126,7 +2141,9 @@ static void nr_rrc_initiate_rrcReestablishment(NR_UE_RRC_INST_t *rrc, NR_Reestab ...@@ -2126,7 +2141,9 @@ static void nr_rrc_initiate_rrcReestablishment(NR_UE_RRC_INST_t *rrc, NR_Reestab
// reset MAC // reset MAC
// release spCellConfig, if configured // release spCellConfig, if configured
// perform cell selection in accordance with the cell selection process // perform cell selection in accordance with the cell selection process
nr_rrc_mac_config_req_reset(rrc->ue_id, RE_ESTABLISHMENT); MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_RESET);
NR_MAC_RRC_CONFIG_RESET(msg).cause = RE_ESTABLISHMENT;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
} }
static void nr_rrc_ue_generate_rrcReestablishmentComplete(const NR_UE_RRC_INST_t *rrc, static void nr_rrc_ue_generate_rrcReestablishmentComplete(const NR_UE_RRC_INST_t *rrc,
...@@ -2495,7 +2512,9 @@ void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc, ...@@ -2495,7 +2512,9 @@ void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc,
// reset MAC // reset MAC
NR_UE_MAC_reset_cause_t cause = (rrc->nrRrcState == RRC_STATE_DETACH_NR) ? DETACH : GO_TO_IDLE; NR_UE_MAC_reset_cause_t cause = (rrc->nrRrcState == RRC_STATE_DETACH_NR) ? DETACH : GO_TO_IDLE;
nr_rrc_mac_config_req_reset(rrc->ue_id, cause); MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_RESET);
NR_MAC_RRC_CONFIG_RESET(msg).cause = cause;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
// enter RRC_IDLE // enter RRC_IDLE
LOG_I(NR_RRC, "RRC moved into IDLE state\n"); LOG_I(NR_RRC, "RRC moved into IDLE state\n");
...@@ -2517,7 +2536,9 @@ void handle_t300_expiry(NR_UE_RRC_INST_t *rrc) ...@@ -2517,7 +2536,9 @@ void handle_t300_expiry(NR_UE_RRC_INST_t *rrc)
// reset MAC, release the MAC configuration // reset MAC, release the MAC configuration
NR_UE_MAC_reset_cause_t cause = T300_EXPIRY; NR_UE_MAC_reset_cause_t cause = T300_EXPIRY;
nr_rrc_mac_config_req_reset(rrc->ue_id, cause); MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_RESET);
NR_MAC_RRC_CONFIG_RESET(msg).cause = cause;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
// TODO handle connEstFailureControl // TODO handle connEstFailureControl
// TODO inform upper layers about the failure to establish the RRC connection // TODO inform upper layers about the failure to establish the RRC connection
} }
......
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