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);
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = ie->value.choice.RRCContainer.size;
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); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = ie->value.choice.RRCContainer.size; ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len); 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,6 +137,16 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -130,6 +137,16 @@ 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;
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++) { 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];
...@@ -138,6 +155,8 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -138,6 +155,8 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
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,7 +167,15 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -148,7 +167,15 @@ 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) {
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
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).frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sub_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).sdu_size = ccch_sdu_len;
...@@ -156,7 +183,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -156,7 +183,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; 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_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_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_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
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]); 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_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_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,12 +380,40 @@ rrc_gNB_generate_RRCSetup( ...@@ -379,12 +380,40 @@ 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");
switch (RC.nrrrc[ctxt_pP->module_id]->node_type) {
case ngran_gNB_CU:
// 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;
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, LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
// rrc_mac_config_req_eNB
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB, MSC_RRC_GNB,
MSC_RRC_UE, MSC_RRC_UE,
...@@ -404,6 +433,8 @@ rrc_gNB_generate_RRCSetup( ...@@ -404,6 +433,8 @@ rrc_gNB_generate_RRCSetup(
ue_context_pP->ue_context.ue_release_timer_thres = 1000; ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */ /* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; // 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