Commit 4843f907 authored by heshanyun's avatar heshanyun Committed by Xue Song

fix build error of phy simulator

parent 52f92b7c
...@@ -16,4 +16,5 @@ set ( UE_DEBUG_TRACE False ) ...@@ -16,4 +16,5 @@ set ( UE_DEBUG_TRACE False )
set ( UE_TIMING_TRACE False ) set ( UE_TIMING_TRACE False )
set ( USRP_REC_PLAY False ) set ( USRP_REC_PLAY False )
set ( SKIP_SHARED_LIB_FLAG False ) set ( SKIP_SHARED_LIB_FLAG False )
set ( PHYSIM True)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
...@@ -43,6 +43,77 @@ ...@@ -43,6 +43,77 @@
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
int
nr_rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP){
// todo
return 0;
}
//------------------------------------------------------------------------------
uint8_t
nr_rrc_data_req(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
uint8_t *const buffer_pP,
const pdcp_transmission_mode_t modeP
)
//------------------------------------------------------------------------------
{
if(sdu_sizeP == 255) {
LOG_I(RRC,"sdu_sizeP == 255");
return FALSE;
}
MSC_LOG_TX_MESSAGE(
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
buffer_pP,
sdu_sizeP,
MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ctxt_pP->rnti,
muiP,
sdu_sizeP);
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer;
message_buffer = itti_malloc (
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
//memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP);
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
ctxt_pP->instance,
message_p);
LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n");
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
* Ideally, PDCP would not neet to be triggered like this but react to ITTI
* messages automatically */
if (ctxt_pP->enb_flag && NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type))
pdcp_run(ctxt_pP);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
......
...@@ -112,3 +112,21 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -112,3 +112,21 @@ rrc_gNB_generate_UECapabilityEnquiry(
\param void *args_p Pointer on arguments to start the task. */ \param void *args_p Pointer on arguments to start the task. */
void *rrc_gnb_task(void *args_p); void *rrc_gnb_task(void *args_p);
/* Trigger RRC periodic processing. To be called once per ms. */
void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe);
uint8_t
nr_rrc_data_req(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_size,
uint8_t *const buffer_pP,
const pdcp_transmission_mode_t modeP
);
int
nr_rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP);
...@@ -531,7 +531,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -531,7 +531,7 @@ rrc_gNB_generate_defaultRRCReconfiguration(
GNB_RRC_DCCH_DATA_IND (message_p).size = size; GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else #else
rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
SDU_CONFIRM_NO, SDU_CONFIRM_NO,
...@@ -562,18 +562,11 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -562,18 +562,11 @@ rrc_gNB_process_RRCReconfigurationComplete(
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
NR_DRB_Identity_t *drb_id_p = NULL; NR_DRB_Identity_t *drb_id_p = NULL;
uint8_t nr_DRB2LCHAN[8];
ue_context_pP->ue_context.ue_reestablishment_timer = 0; ue_context_pP->ue_context.ue_reestablishment_timer = 0;
//rnti_t rnti = ue_context_pP->ue_id_rnti;
//module_id_t module_id = ctxt_pP->module_id;
// int UE_id_mac = find_UE_id(module_id, rnti);
// if (UE_id_mac == -1) {
// LOG_E(RRC, "Can't find UE_id(MAC) of UE rnti %x\n", rnti);
// return;
// }
#ifndef PHYSIM
/* Derive the keys from kgnb */ /* Derive the keys from kgnb */
if (DRB_configList != NULL) { if (DRB_configList != NULL) {
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
...@@ -587,7 +580,7 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -587,7 +580,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kRRCint); &kRRCint);
#endif
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
...@@ -661,7 +654,7 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -661,7 +654,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
if (DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel) { if (DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel) {
DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel; nr_DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel;
} }
// rrc_mac_config_req_eNB // rrc_mac_config_req_eNB
...@@ -675,7 +668,7 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -675,7 +668,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
SRB_FLAG_NO, SRB_FLAG_NO,
MBMS_FLAG_NO, MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE, CONFIG_ACTION_REMOVE,
DRB2LCHAN[i], nr_DRB2LCHAN[i],
Rlc_info_um); Rlc_info_um);
} }
...@@ -810,7 +803,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ...@@ -810,7 +803,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1))) { if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1))) {
LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rnti); LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rnti);
rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); nr_rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
/* replace rnti in the context */ /* replace rnti in the context */
/* for that, remove the context from the RB tree */ /* for that, remove the context from the RB tree */
...@@ -1456,7 +1449,7 @@ rrc_gNB_generate_SecurityModeCommand( ...@@ -1456,7 +1449,7 @@ rrc_gNB_generate_SecurityModeCommand(
GNB_RRC_DCCH_DATA_IND (message_p).size = size; GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else #else
rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
SDU_CONFIRM_NO, SDU_CONFIRM_NO,
...@@ -1513,7 +1506,7 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -1513,7 +1506,7 @@ rrc_gNB_generate_UECapabilityEnquiry(
GNB_RRC_DCCH_DATA_IND (message_p).size = size; GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else #else
rrc_data_req( nr_rrc_data_req(
ctxt_pP, ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
...@@ -1574,7 +1567,7 @@ rrc_gNB_generate_RRCConnectionRelease( ...@@ -1574,7 +1567,7 @@ rrc_gNB_generate_RRCConnectionRelease(
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = size; F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = size;
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m); itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
} else { } else {
rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
SDU_CONFIRM_NO, SDU_CONFIRM_NO,
......
...@@ -134,6 +134,7 @@ nr_rrc_pdcp_config_security( ...@@ -134,6 +134,7 @@ nr_rrc_pdcp_config_security(
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
hash_key_t key; hash_key_t key;
#ifndef PHYSIM
/* Derive the keys from kgnb */ /* Derive the keys from kgnb */
if (SRB_configList != NULL) { if (SRB_configList != NULL) {
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
...@@ -147,6 +148,7 @@ nr_rrc_pdcp_config_security( ...@@ -147,6 +148,7 @@ nr_rrc_pdcp_config_security(
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kRRCint); &kRRCint);
#endif
if (!IS_SOFTMODEM_IQPLAYER) { if (!IS_SOFTMODEM_IQPLAYER) {
SET_LOG_DUMP(DEBUG_SECURITY) ; SET_LOG_DUMP(DEBUG_SECURITY) ;
} }
......
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