Commit 18fce2b1 authored by Laurent THOMAS's avatar Laurent THOMAS

fix several bugs, remain critical design mistakes

parent 058b040c
...@@ -147,6 +147,7 @@ typedef struct NRRrcMacCcchDataInd_s { ...@@ -147,6 +147,7 @@ typedef struct NRRrcMacCcchDataInd_s {
OCTET_STRING_t *du_to_cu_rrc_container; OCTET_STRING_t *du_to_cu_rrc_container;
uint8_t gnb_index; uint8_t gnb_index;
int CC_id; int CC_id;
uint64_t nr_cellid;
} NRRrcMacCcchDataInd; } NRRrcMacCcchDataInd;
typedef struct RrcMacMcchDataReq_s { typedef struct RrcMacMcchDataReq_s {
......
...@@ -87,25 +87,21 @@ void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req) { ...@@ -87,25 +87,21 @@ void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req) {
int f1ap_add_ue(bool isCu, int f1ap_add_ue(bool isCu,
module_id_t module_idP, module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP) { rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP); f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) { if (f1_inst->f1ap_ue[i].rnti == rntiP) {
f1_inst->f1ap_ue[i].f1ap_uid = i; f1_inst->f1ap_ue[i].f1ap_uid = i;
f1_inst->f1ap_ue[i].mac_uid = UE_id;
LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id);
return i; return i;
} }
} }
// We didn't find the rnti
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == 0 ) { if (f1_inst->f1ap_ue[i].rnti == 0 ) {
f1_inst->f1ap_ue[i].rnti = rntiP; f1_inst->f1ap_ue[i].rnti = rntiP;
f1_inst->f1ap_ue[i].f1ap_uid = i; f1_inst->f1ap_ue[i].f1ap_uid = i;
f1_inst->f1ap_ue[i].mac_uid = UE_id;
f1_inst->f1ap_ue[i].du_ue_f1ap_id = rntiP; f1_inst->f1ap_ue[i].du_ue_f1ap_id = rntiP;
f1_inst->f1ap_ue[i].cu_ue_f1ap_id = rntiP; f1_inst->f1ap_ue[i].cu_ue_f1ap_id = rntiP;
f1_inst->num_ues++; f1_inst->num_ues++;
......
...@@ -422,14 +422,12 @@ typedef struct f1ap_cudu_ue_inst_s { ...@@ -422,14 +422,12 @@ typedef struct f1ap_cudu_ue_inst_s {
// used for eNB stats generation // used for eNB stats generation
rnti_t rnti; rnti_t rnti;
module_id_t f1ap_uid; module_id_t f1ap_uid;
module_id_t mac_uid;
module_id_t du_ue_f1ap_id; module_id_t du_ue_f1ap_id;
module_id_t cu_ue_f1ap_id; module_id_t cu_ue_f1ap_id;
} f1ap_cudu_ue_t; } f1ap_cudu_ue_t;
typedef struct f1ap_cudu_inst_s { typedef struct f1ap_cudu_inst_s {
f1ap_setup_req_t setupReq; f1ap_setup_req_t setupReq;
instance_t du_ue_f1ap_id;
uint16_t sctp_in_streams; uint16_t sctp_in_streams;
uint16_t sctp_out_streams; uint16_t sctp_out_streams;
uint16_t default_sctp_stream_id; uint16_t default_sctp_stream_id;
...@@ -447,8 +445,6 @@ f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP); ...@@ -447,8 +445,6 @@ f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP);
void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req); void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req);
int f1ap_add_ue(bool isCu, int f1ap_add_ue(bool isCu,
module_id_t module_idP, module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP); rnti_t rntiP);
int f1ap_remove_ue(bool isCu, module_id_t module_idP, int f1ap_remove_ue(bool isCu, module_id_t module_idP,
......
...@@ -95,9 +95,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -95,9 +95,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
assoc_id, stream); assoc_id, stream);
} }
message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ);
/* assoc_id */ /* assoc_id */
f1ap_setup_req_t *req=&F1AP_SETUP_REQ(message_p); f1ap_setup_req_t *req=&getCxt(true, instance)->setupReq;
req->assoc_id = assoc_id; req->assoc_id = assoc_id;
/* gNB_DU_id */ /* gNB_DU_id */
// this function exits if the ie is mandatory // this function exits if the ie is mandatory
...@@ -159,8 +160,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -159,8 +160,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
/* Convert the mme name to a printable string */ /* Convert the mme name to a printable string */
req->mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; req->mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0';
req->mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size; req->mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size;
LOG_D(F1AP, "req->mib[%d] %s , len = %d \n", LOG_D(F1AP, "req->mib[%d] len = %d \n",
i, req->mib[i], req->mib_length[i]); i, req->mib_length[i]);
/* sib1 */ /* sib1 */
req->sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); req->sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char));
memcpy(req->sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf, memcpy(req->sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf,
...@@ -168,8 +169,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -168,8 +169,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
/* Convert the mme name to a printable string */ /* Convert the mme name to a printable string */
req->sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; req->sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0';
req->sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size; req->sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size;
LOG_D(F1AP, "req->sib1[%d] %s , len = %d \n", LOG_D(F1AP, "req->sib1[%d] len = %d \n",
i, req->sib1[i], req->sib1_length[i]); i, req->sib1_length[i]);
} }
// char *measurement_timing_information[F1AP_MAX_NB_CELLS]; // char *measurement_timing_information[F1AP_MAX_NB_CELLS];
...@@ -207,6 +208,9 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -207,6 +208,9 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
// } tdd; // } tdd;
// } nr_mode_info[F1AP_MAX_NB_CELLS]; // } nr_mode_info[F1AP_MAX_NB_CELLS];
// We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages
message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ);
memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) );
if (num_cells_available > 0) { if (num_cells_available > 0) {
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) { if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p);
......
...@@ -68,9 +68,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -68,9 +68,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* GNB_DU_UE_F1AP_ID */ /* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
getCxt(true, instance)->du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; module_id_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
/* NRCGI /* NRCGI
* TODO: process NRCGI * Fixme: process NRCGI
*/ */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_NRCGI, true); F1AP_ProtocolIE_ID_id_NRCGI, true);
...@@ -120,33 +120,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -120,33 +120,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ie->value.choice.DUtoCURRCContainer.size); ie->value.choice.DUtoCURRCContainer.size);
} }
// Find instance from nr_cellid int f1ap_uid = f1ap_add_ue(true, instance, rnti);
int rrc_inst = -1;
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
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)
eNB_RRC_INST *rrc = RC.rrc[i];
if (rrc->nr_cellid == nr_cellid) {
rrc_inst = i;
break;
}
}
}
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(true, rrc_inst, CC_id, 0, rnti);
if (f1ap_uid < 0 ) { if (f1ap_uid < 0 ) {
LOG_E(F1AP, "Failed to add UE \n"); LOG_E(F1AP, "Failed to add UE \n");
...@@ -158,7 +132,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -158,7 +132,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; 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).sub_frame = 0;
NR_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;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance NR_RRC_MAC_CCCH_DATA_IND (message_p).nr_cellid = nr_cellid; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_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 (f1ap_req(true,ITTI_MSG_DESTINATION_ID(message_p))->cell_type==CELL_MACRO_GNB?TASK_RRC_GNB:TASK_RRC_ENB, instance, message_p); itti_send_msg_to_task (f1ap_req(true,ITTI_MSG_DESTINATION_ID(message_p))->cell_type==CELL_MACRO_GNB?TASK_RRC_GNB:TASK_RRC_ENB, instance, message_p);
......
...@@ -40,11 +40,11 @@ ...@@ -40,11 +40,11 @@
void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) {
createF1inst(true, instance, NULL); createF1inst(true, instance, NULL);
// save the assoc id // save the assoc id
f1ap_setup_req_t *f1ap_du_data=f1ap_req(true, instance); f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance);
f1ap_du_data->assoc_id = sctp_new_association_ind->assoc_id; f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id;
f1ap_du_data->sctp_in_streams = sctp_new_association_ind->in_streams; f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams;
f1ap_du_data->sctp_out_streams = sctp_new_association_ind->out_streams; f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams;
f1ap_du_data->default_sctp_stream_id = 0; f1ap_cu_data->default_sctp_stream_id = 0;
// Nothing // Nothing
} }
......
...@@ -762,13 +762,13 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -762,13 +762,13 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
rnti_t rntiP, rnti_t rntiP,
const uint8_t *sduP, const uint8_t *sduP,
sdu_size_t sdu_lenP, sdu_size_t sdu_lenP,
const char *sdu2P, const char *sdu2P,
sdu_size_t sdu2_lenP) { sdu_size_t sdu2_lenP) {
F1AP_F1AP_PDU_t pdu= {0}; F1AP_F1AP_PDU_t pdu= {0};
F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransfer_t *out;
uint8_t *buffer=NULL; uint8_t *buffer=NULL;
uint32_t len=0; uint32_t len=0;
int f1ap_uid = f1ap_add_ue (false, module_idP, CC_idP,UE_id, rntiP); int f1ap_uid = f1ap_add_ue (false, module_idP, rntiP);
if (f1ap_uid < 0 ) { if (f1ap_uid < 0 ) {
LOG_E(F1AP, "Failed to add UE \n"); LOG_E(F1AP, "Failed to add UE \n");
...@@ -831,22 +831,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -831,22 +831,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
return -1; return -1;
} }
if (RC.nrrrc && 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]);
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);
}
f1ap_itti_send_sctp_data_req(false, module_idP, buffer, len, getCxt(false, module_idP)->default_sctp_stream_id); f1ap_itti_send_sctp_data_req(false, module_idP, buffer, len, getCxt(false, module_idP)->default_sctp_stream_id);
return 0; return 0;
} }
......
...@@ -154,7 +154,7 @@ void *F1AP_DU_task(void *arg) { ...@@ -154,7 +154,7 @@ void *F1AP_DU_task(void *arg) {
&received_msg->ittiMsg.sctp_data_ind); &received_msg->ittiMsg.sctp_data_ind);
break; break;
case F1AP_INITIAL_UL_RRC_MESSAGE: // to rrc case F1AP_INITIAL_UL_RRC_MESSAGE: // from rrc
LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n"); LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n");
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg); f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg);
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti,
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP);
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
...@@ -149,7 +150,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ...@@ -149,7 +150,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
// AssertFatal(0, "check configuration, send to appropriate handler\n"); // AssertFatal(0, "check configuration, send to appropriate handler\n");
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
// decode RRC Container and act on the message type // decode RRC Container and act on the message type
rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); //FIXME
//rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id);
ctxt.module_id = instance; ctxt.module_id = instance;
ctxt.instance = instance; ctxt.instance = instance;
ctxt.enb_flag = 1; ctxt.enb_flag = 1;
......
...@@ -317,6 +317,12 @@ mac_rrc_data_ind( ...@@ -317,6 +317,12 @@ mac_rrc_data_ind(
sdu_lenP, sdu_lenP,
NULL, NULL,
0); 0);
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);
return(0); return(0);
} }
......
...@@ -344,6 +344,14 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, ...@@ -344,6 +344,14 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
memcpy(msg->rrc_container, sduP, sdu_lenP); memcpy(msg->rrc_container, sduP, sdu_lenP);
msg->rrc_container_length=sdu_lenP; msg->rrc_container_length=sdu_lenP;
itti_send_msg_to_task(TASK_DU_F1, 0, tmp); itti_send_msg_to_task(TASK_DU_F1, 0, tmp);
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);
return(0); return(0);
} }
......
...@@ -2736,16 +2736,19 @@ rrc_gNB_decode_dcch( ...@@ -2736,16 +2736,19 @@ rrc_gNB_decode_dcch(
void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name);
int cu_cell_ind = 0; int cu_cell_ind = 0;
MessageDef *msg_p = NULL,*msg_p2=NULL; MessageDef *msg_p =itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP);
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
MessageDef *msg_p2=itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
for (int i = 0; i < f1_setup_req->num_cells_available; i++) { for (int i = 0; i < f1_setup_req->num_cells_available; i++) {
int found_cell=0;
for (int j=0; j<RC.nb_nr_inst; j++) { for (int j=0; j<RC.nb_nr_inst; j++) {
gNB_RRC_INST *rrc = RC.nrrrc[j]; gNB_RRC_INST *rrc = RC.nrrrc[j];
if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc && if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc &&
rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc && rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc &&
rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) { rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) {
//fixme: multi instance is not consistent here
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
// check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case)
rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]); rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]);
rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i]; rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i];
...@@ -2789,19 +2792,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { ...@@ -2789,19 +2792,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
"bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); "bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci; rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci;
if (cu_cell_ind == 0) {
// prepare F1_SETUP_RESPONSE + GNB_CU_CONFIGURATION_UPDATE
if (msg_p == NULL) {
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP);
}
if (msg_p2 == NULL) {
msg_p2 = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
}
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
}
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0]; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0];
...@@ -2819,7 +2809,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { ...@@ -2819,7 +2809,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI;
cu_cell_ind++; cu_cell_ind++;
found_cell=1;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind;
// send // send
break; break;
...@@ -2831,10 +2820,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { ...@@ -2831,10 +2820,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
} }
}// for (int j=0;j<RC.nb_inst;j++) }// for (int j=0;j<RC.nb_inst;j++)
if (found_cell == 0) { if (cu_cell_ind == 0) {
AssertFatal(1 == 0, "No cell found\n"); AssertFatal(1 == 0, "No cell found\n");
} } else {
else {
// send ITTI message to F1AP-CU task // send ITTI message to F1AP-CU task
itti_send_msg_to_task (TASK_CU_F1, 0, msg_p); itti_send_msg_to_task (TASK_CU_F1, 0, msg_p);
...@@ -3202,36 +3190,46 @@ void *rrc_gnb_task(void *args_p) { ...@@ -3202,36 +3190,46 @@ void *rrc_gnb_task(void *args_p) {
/* Messages from MAC */ /* Messages from MAC */
case NR_RRC_MAC_CCCH_DATA_IND: case NR_RRC_MAC_CCCH_DATA_IND:
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, {
NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index, instance_t i;
GNB_FLAG_YES, for (i=0; i<RC.nb_nr_inst; i++) {
NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti, // first get RRC instance (note, no the ITTI instance)
msg_p->ittiMsgHeader.lte_time.frame, gNB_RRC_INST *rrc = RC.nrrrc[i];
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", if (rrc->nr_cellid == NR_RRC_MAC_CCCH_DATA_IND(msg_p).nr_cellid)
ctxt.rnti, break;
instance, }
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, AssertFatal(i!=RC.nb_nr_inst, "Cell_id not found\n");
&ctxt, PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); i,
GNB_FLAG_YES,
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
LOG_I(NR_RRC, "CCCH message has size %d > %d\n", msg_p->ittiMsgHeader.lte_time.frame,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE); msg_p->ittiMsgHeader.lte_time.slot);
break; LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
} ctxt.rnti,
i,
nr_rrc_gNB_decode_ccch(&ctxt, NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, &ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) {
LOG_I(NR_RRC, "CCCH message has size %d > %d\n",
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) { NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE);
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf); break;
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container); }
}
nr_rrc_gNB_decode_ccch(&ctxt,
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) {
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf);
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container);
}
}
break; break;
/* Messages from PDCP */ /* Messages from PDCP */
......
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