Commit 5936c80b authored by Xue Song's avatar Xue Song

RRCSetup docking with F1AP

parent 45ec62f9
...@@ -117,10 +117,17 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -117,10 +117,17 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
// create an ITTI message and copy SDU // create an ITTI message and copy SDU
message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND);
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
ccch_sdu_len = ie->value.choice.RRCContainer.size; memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len = ie->value.choice.RRCContainer.size;
ccch_sdu_len); memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
} else {
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
}
//LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, //LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__,
// ie->value.choice.RRCContainer.size); // ie->value.choice.RRCContainer.size);
...@@ -130,14 +137,26 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -130,14 +137,26 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
// Find instance from nr_cellid // Find instance from nr_cellid
int rrc_inst = -1; int rrc_inst = -1;
for (int i=0;i<RC.nb_inst;i++) { if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
for (int i=0;i<RC.nb_nr_inst;i++) {
// first get RRC instance (note, no the ITTI instance)
gNB_RRC_INST *rrc = RC.nrrrc[i];
if (rrc->nr_cellid == nr_cellid) {
rrc_inst = i;
break;
}
}
} else {
for (int i=0;i<RC.nb_inst;i++) {
// first get RRC instance (note, no the ITTI instance) // first get RRC instance (note, no the ITTI instance)
eNB_RRC_INST *rrc = RC.rrc[i]; eNB_RRC_INST *rrc = RC.rrc[i];
if (rrc->nr_cellid == nr_cellid) { if (rrc->nr_cellid == nr_cellid) {
rrc_inst = i; rrc_inst = i;
break; break;
}
} }
} }
AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid); AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid);
int f1ap_uid = f1ap_add_ue(&f1ap_cu_inst[rrc_inst], rrc_inst, CC_id, 0, rnti); int f1ap_uid = f1ap_add_ue(&f1ap_cu_inst[rrc_inst], rrc_inst, CC_id, 0, rnti);
...@@ -148,15 +167,23 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -148,15 +167,23 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
} }
f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
} else {
RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
}
return 0; return 0;
} }
......
...@@ -866,13 +866,21 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -866,13 +866,21 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
return -1; return -1;
} }
if (RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) {
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP; ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP; ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP; ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1; ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p);
} else {
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p);
}
du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id);
return 0; return 0;
......
...@@ -359,6 +359,7 @@ rrc_gNB_generate_RRCSetup( ...@@ -359,6 +359,7 @@ rrc_gNB_generate_RRCSetup(
{ {
LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup \n"); LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup \n");
NR_SRB_ToAddModList_t *SRB_configList = NULL; NR_SRB_ToAddModList_t *SRB_configList = NULL;
MessageDef *message_p;
// T(T_GNB_RRC_SETUP, // T(T_GNB_RRC_SETUP,
// T_INT(ctxt_pP->module_id), // T_INT(ctxt_pP->module_id),
...@@ -379,31 +380,61 @@ rrc_gNB_generate_RRCSetup( ...@@ -379,31 +380,61 @@ rrc_gNB_generate_RRCSetup(
ue_p->Srb0.Tx_buffer.payload_size, ue_p->Srb0.Tx_buffer.payload_size,
"[MSG] RRC Setup\n"); "[MSG] RRC Setup\n");
LOG_D(NR_RRC, switch (RC.nrrrc[ctxt_pP->module_id]->node_type) {
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", case ngran_gNB_CU:
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); // create an ITTI message
/* TODO: F1 IDs ar missing in RRC */
message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload;
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
break;
// rrc_mac_config_req_eNB case ngran_gNB_DU:
// nothing to do for DU
AssertFatal(1==0,"nothing to do for DU\n");
break;
case ngran_gNB:
// rrc_mac_config_req_gNB
break;
default :
LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type);
LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
ue_p->Srb0.Tx_buffer.Header, // LG WARNING
ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" RRCSetup UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti,
ue_p->Srb0.Tx_buffer.payload_size);
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_release_timer = 1;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
}
MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
ue_p->Srb0.Tx_buffer.Header, // LG WARNING
ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" RRCSetup UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti,
ue_p->Srb0.Tx_buffer.payload_size);
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_release_timer = 1;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
......
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