Commit 133ecd52 authored by Xue Song's avatar Xue Song

msg1/2/3/4/5 is ok

parent 02e8add3
...@@ -133,7 +133,7 @@ task_list_t tasks[TASK_MAX]; ...@@ -133,7 +133,7 @@ task_list_t tasks[TASK_MAX];
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s ); LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
if ( s > 50 ) if ( s > 50 )
LOG_I(TMR,"Queue for %s task size: %ld from %s task\n",itti_get_task_name(destination_task_id), s+1, itti_get_task_name(message->ittiMsgHeader.originTaskId)); LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1);
t->message_queue.insert(t->message_queue.begin(), message); t->message_queue.insert(t->message_queue.begin(), message);
eventfd_t sem_counter = 1; eventfd_t sem_counter = 1;
......
...@@ -816,7 +816,7 @@ static void wait_nfapi_init(char *thread_name) { ...@@ -816,7 +816,7 @@ static void wait_nfapi_init(char *thread_name) {
void init_pdcp(void) { void init_pdcp(void) {
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
// pdcp_layer_init(); // pdcp_layer_init();
pdcp_layer_init_for_CU(); // pdcp_layer_init_for_CU();
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
if (IS_SOFTMODEM_NOS1) { if (IS_SOFTMODEM_NOS1) {
......
...@@ -116,13 +116,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -116,13 +116,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_ProtocolIE_ID_id_RRCContainer, true); F1AP_ProtocolIE_ID_id_RRCContainer, true);
// 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);
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
message_p = itti_alloc_new_message (TASK_CU_F1, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); memset (NR_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(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len); ccch_sdu_len);
} else { } else {
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); 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,
...@@ -376,20 +377,20 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -376,20 +377,20 @@ int CU_handle_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, NR_RRC_DCCH_DATA_IND); // message_p = itti_alloc_new_message (TASK_CU_F1, NR_RRC_DCCH_DATA_IND);
NR_RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); // NR_RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size);
NR_RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; // NR_RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size;
memcpy(NR_RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, // memcpy(NR_RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf,
ie->value.choice.RRCContainer.size); // ie->value.choice.RRCContainer.size);
NR_RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; // NR_RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id;
NR_RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); // NR_RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id);
NR_RRC_DCCH_DATA_IND (message_p).module_id = instance; // NR_RRC_DCCH_DATA_IND (message_p).module_id = instance;
NR_RRC_DCCH_DATA_IND (message_p).gNB_index = instance; // not needed for CU // NR_RRC_DCCH_DATA_IND (message_p).gNB_index = instance; // not needed for CU
itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); // itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p);
/* /*
...@@ -408,12 +409,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -408,12 +409,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p);
*/ */
#if(0)
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
ctxt.module_id = instance; ctxt.module_id = instance;
ctxt.instance = instance; ctxt.instance = instance;
ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id);
ctxt.enb_flag = 1; ctxt.enb_flag = 1;
ctxt.eNB_index = 0;
ctxt.configured = 1;
mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__);
memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size);
LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size);
...@@ -429,6 +431,5 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -429,6 +431,5 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
srb_id, srb_id,
ie->value.choice.RRCContainer.size, ie->value.choice.RRCContainer.size,
mb); mb);
#endif
return 0; return 0;
} }
...@@ -67,13 +67,25 @@ extern f1ap_setup_req_t *f1ap_du_data; ...@@ -67,13 +67,25 @@ extern f1ap_setup_req_t *f1ap_du_data;
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
uint8_t du_ccch_flag = 1;
int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
/* DL RRC Message Transfer */ /* DL RRC Message Transfer */
int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
F1AP_F1AP_PDU_t *pdu) { F1AP_F1AP_PDU_t *pdu) {
if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) {
LOG_I(F1AP, "node is gNB DU, call DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n");
DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu);
return 0;
}
LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n");
F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransfer_t *container;
...@@ -981,8 +993,30 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -981,8 +993,30 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
&ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header
msg->rrc_container_length, 0, 0); msg->rrc_container_length, 0, 0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed);
/* for rfsim, because UE send RRCSetupRequest in SRB1 */
// NR_UL_CCCH_Message_t *ul_ccch_msg;
// dec_rval = uper_decode(NULL,
// &asn_DEF_NR_UL_CCCH_Message,
// (void**)&ul_ccch_msg,
// &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header
// msg->rrc_container_length, 0, 0);
// if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
// LOG_E(F1AP, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed);
// } else {
// LOG_I(F1AP, "decode UL-CCCH success \n");
// LOG_I(F1AP, "Received message: present %d and c1 present %d\n",
// ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present);
// if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) {
// if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) {
// LOG_I(F1AP, "[MSG] RRC Setup Request\n");
// }
// }
// }
}
else else
LOG_I(F1AP, "Received message: present %d and c1 present %d\n", LOG_I(F1AP, "Received message: present %d and c1 present %d\n",
ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1->present); ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1->present);
...@@ -1209,14 +1243,31 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -1209,14 +1243,31 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
RC.nrrrc[ctxt.module_id], RC.nrrrc[ctxt.module_id],
ctxt.rnti); ctxt.rnti);
if (srb_id == 0) { NR_DL_CCCH_Message_t* dl_ccch_msg=NULL;
NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval;
asn_dec_rval_t dec_rval; if (du_ccch_flag) {
/* for rfsim */
dec_rval = uper_decode(NULL, dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_CCCH_Message, &asn_DEF_NR_DL_CCCH_Message,
(void**)&dl_ccch_msg, (void**)&dl_ccch_msg,
ie->value.choice.RRCContainer.buf, &ie->value.choice.RRCContainer.buf[2],
rrc_dl_sdu_len,0,0); rrc_dl_sdu_len-6,0,0);
if (dec_rval.code == RC_OK) {
srb_id = 0;
du_ccch_flag = 0;
} else {
srb_id = 1;
}
}
if (srb_id == 0) {
// NR_DL_CCCH_Message_t* dl_ccch_msg=NULL;
// asn_dec_rval_t dec_rval;
// dec_rval = uper_decode(NULL,
// &asn_DEF_NR_DL_CCCH_Message,
// (void**)&dl_ccch_msg,
// ie->value.choice.RRCContainer.buf,
// rrc_dl_sdu_len,0,0);
AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n");
switch (dl_ccch_msg->message.choice.c1->present) { switch (dl_ccch_msg->message.choice.c1->present) {
...@@ -1298,6 +1349,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -1298,6 +1349,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
"Unknown message\n"); "Unknown message\n");
break; break;
}// switch case }// switch case
/* for rfsim */
mem_block_t *memblock;
memblock = get_free_mem_block(rrc_dl_sdu_len, __FUNCTION__);
memcpy(memblock->data, ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len);
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, memblock);
return(0); return(0);
} else if (srb_id == 1) { } else if (srb_id == 1) {
......
...@@ -42,6 +42,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -42,6 +42,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_F1AP_PDU_t *pdu); F1AP_F1AP_PDU_t *pdu);
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg);
int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg);
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int CC_idP, int CC_idP,
......
...@@ -177,8 +177,13 @@ void *F1AP_DU_task(void *arg) { ...@@ -177,8 +177,13 @@ void *F1AP_DU_task(void *arg) {
case F1AP_UL_RRC_MESSAGE: // to rrc case F1AP_UL_RRC_MESSAGE: // to rrc
LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), if (RC.nrrrc[0]->node_type == ngran_gNB_DU) {
&F1AP_UL_RRC_MESSAGE(received_msg)); DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_UL_RRC_MESSAGE(received_msg));
} else {
DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_UL_RRC_MESSAGE(received_msg));
}
break; break;
case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC
......
...@@ -1543,10 +1543,14 @@ void nr_read_config_and_init(void) { ...@@ -1543,10 +1543,14 @@ void nr_read_config_and_init(void) {
RC.nrrrc[0]->carrier.MIB = (uint8_t *) malloc16(4); RC.nrrrc[0]->carrier.MIB = (uint8_t *) malloc16(4);
RC.nrrrc[0]->carrier.sizeof_MIB = do_MIB_NR(RC.nrrrc[0], 0); RC.nrrrc[0]->carrier.sizeof_MIB = do_MIB_NR(RC.nrrrc[0], 0);
RC.nrrrc[0]->carrier.sizeof_SIB1 = do_SIB1_NR(&RC.nrrrc[0]->carrier, &RC.nrrrc[0]->configuration); RC.nrrrc[0]->carrier.sizeof_SIB1 = do_SIB1_NR(&RC.nrrrc[0]->carrier, &RC.nrrrc[0]->configuration);
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[0]);
LOG_I(GNB_APP, "Adding new user (%p)\n",ue_context_p);
rrc_add_nsa_user(RC.nrrrc[0], ue_context_p,NULL);
} }
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
pdcp_layer_init(); pdcp_layer_init_for_CU();
nr_DRB_preconfiguration(0x1234); nr_DRB_preconfiguration(0x1234);
rrc_init_nr_global_param(); rrc_init_nr_global_param();
} }
......
...@@ -241,6 +241,26 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, ...@@ -241,6 +241,26 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
if (pthread_mutex_unlock(&q.m) != 0) abort(); if (pthread_mutex_unlock(&q.m) != 0) abort();
} }
void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
confirm_t confirmP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP)
{
enqueue_rlc_data_req(ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP, muiP,
confirmP,
sdu_sizeP,
sdu_pP,
NULL,
NULL);
}
/****************************************************************************/ /****************************************************************************/
/* rlc_data_req queue - end */ /* rlc_data_req queue - end */
/****************************************************************************/ /****************************************************************************/
...@@ -600,18 +620,18 @@ static void deliver_sdu_srb(protocol_ctxt_t *ctxt_pP, void *_ue, nr_pdcp_entity_ ...@@ -600,18 +620,18 @@ static void deliver_sdu_srb(protocol_ctxt_t *ctxt_pP, void *_ue, nr_pdcp_entity_
uint8_t *gtpu_buffer_p; uint8_t *gtpu_buffer_p;
int srb_id; int srb_id;
int i; int i;
if (ccch_or_dcch == 0) if (NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
{
nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf);
ccch_or_dcch = 1;
}
else
{
nr_rrc_data_ind( ctxt_pP, 1, size, buf); nr_rrc_data_ind( ctxt_pP, 1, size, buf);
} else {
if (ccch_or_dcch == 0) {
nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf);
ccch_or_dcch = 1;
} else {
nr_rrc_data_ind( ctxt_pP, 1, size, buf);
}
} }
return; return;
} }
...@@ -655,7 +675,22 @@ rb_found: ...@@ -655,7 +675,22 @@ rb_found:
printf("!!!!!!! deliver_pdu_srb (srb %d) calling rlc_data_req size %d: ", srb_id, size); printf("!!!!!!! deliver_pdu_srb (srb %d) calling rlc_data_req size %d: ", srb_id, size);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
printf("\n"); printf("\n");
enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL); if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buf;
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = 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->rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = srb_id;
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.module_id, message_p);
} else {
enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL);
}
} }
boolean_t pdcp_data_ind( boolean_t pdcp_data_ind(
...@@ -726,6 +761,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) ...@@ -726,6 +761,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
break; break;
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case RRC_DCCH_DATA_REQ: case RRC_DCCH_DATA_REQ:
LOG_I(PDCP, "Received message %s\n", ITTI_MSG_NAME(msg_p));
PROTOCOL_CTXT_SET_BY_MODULE_ID( PROTOCOL_CTXT_SET_BY_MODULE_ID(
&ctxt, &ctxt,
RRC_DCCH_DATA_REQ(msg_p).module_id, RRC_DCCH_DATA_REQ(msg_p).module_id,
...@@ -766,7 +802,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) ...@@ -766,7 +802,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s)
printf("\n\n################# rnti %d add srb %d\n\n\n", rnti, srb_id); printf("\n\n################# rnti %d add srb %d\n\n\n", rnti, srb_id);
if (srb_id > 3) { if (srb_id > 3) {
LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n", LOG_E(PDCP, "%s:%d:%s: fatal, bad srb id %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id); __FILE__, __LINE__, __FUNCTION__, srb_id);
exit(1); exit(1);
} }
...@@ -774,13 +810,13 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) ...@@ -774,13 +810,13 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s)
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
if (ue->srb[srb_id-1] != NULL) { if (ue->srb[srb_id-1] != NULL) {
LOG_W(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", LOG_W(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti); __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else { } else {
pdcp_srb = new_nr_pdcp_entity_srb(srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue); pdcp_srb = new_nr_pdcp_entity_srb(srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue);
nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb);
LOG_I(PDCP, "%s:%d:%s: added drb %d to ue %d\n", LOG_I(PDCP, "%s:%d:%s: added srb %d to ue %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti); __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} }
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
...@@ -1112,7 +1148,7 @@ static boolean_t pdcp_data_req_srb( ...@@ -1112,7 +1148,7 @@ static boolean_t pdcp_data_req_srb(
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, 0x1234);
if (rb_id < 1 || rb_id > 3) if (rb_id < 1 || rb_id > 3)
rb = NULL; rb = NULL;
...@@ -1165,7 +1201,7 @@ static boolean_t pdcp_data_req_drb( ...@@ -1165,7 +1201,7 @@ static boolean_t pdcp_data_req_drb(
rb = ue->drb[rb_id - 1]; rb = ue->drb[rb_id - 1];
if (rb == NULL) { if (rb == NULL) {
LOG_E(PDCP, "%s:%d:%s: no DRB found (rnti %d, rb_id %ld)\n", LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n",
__FILE__, __LINE__, __FUNCTION__, rnti, rb_id); __FILE__, __LINE__, __FUNCTION__, rnti, rb_id);
return 0; return 0;
} }
......
...@@ -36,11 +36,17 @@ ...@@ -36,11 +36,17 @@
#include "NR_CellGroupConfig.h" #include "NR_CellGroupConfig.h"
#include "NR_RLC-Config.h" #include "NR_RLC-Config.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "NR_UL-CCCH-Message.h"
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
#include <stdint.h> #include <stdint.h>
static nr_rlc_ue_manager_t *nr_rlc_ue_manager; static nr_rlc_ue_manager_t *nr_rlc_ue_manager;
uint8_t ccch_flag = 1;
/* TODO: handle time a bit more properly */ /* TODO: handle time a bit more properly */
static uint64_t nr_rlc_current_time; static uint64_t nr_rlc_current_time;
...@@ -468,6 +474,33 @@ rb_found: ...@@ -468,6 +474,33 @@ rb_found:
"Can't be CU, bad node type %d\n", type); "Can't be CU, bad node type %d\n", type);
if (NODE_IS_DU(type) && is_srb == 1) { if (NODE_IS_DU(type) && is_srb == 1) {
if (ccch_flag) {
/* for rfsim, because UE send RRCSetupRequest in SRB1 */
asn_dec_rval_t dec_rval;
NR_UL_CCCH_Message_t *ul_ccch_msg;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_UL_CCCH_Message,
(void**)&ul_ccch_msg,
&buf[1], // buf[0] includes the pdcp header
size, 0, 0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(RLC, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed);
} else {
LOG_I(RLC, "decode UL-CCCH success \n");
LOG_I(RLC, "Received message: present %d and c1 present %d\n",
ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present);
if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) {
if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) {
LOG_I(RLC, "[MSG] RRC Setup Request\n");
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,ue->rnti,(uint8_t *)buf,size);
ccch_flag = 0;
return;
}
}
}
}
MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE);
F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti;
F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id;
......
...@@ -108,8 +108,8 @@ nr_rrc_data_req( ...@@ -108,8 +108,8 @@ nr_rrc_data_req(
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads /* 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 * Ideally, PDCP would not neet to be triggered like this but react to ITTI
* messages automatically */ * messages automatically */
// if (ctxt_pP->enb_flag && NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) if (ctxt_pP->enb_flag && NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type))
// pdcp_run(ctxt_pP); 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. return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
} }
......
...@@ -389,18 +389,25 @@ rrc_gNB_generate_RRCSetup( ...@@ -389,18 +389,25 @@ rrc_gNB_generate_RRCSetup(
case ngran_gNB_CU: case ngran_gNB_CU:
// create an ITTI message // create an ITTI message
/* TODO: F1 IDs ar missing in RRC */ /* TODO: F1 IDs ar missing in RRC */
message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); // 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 = (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).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_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_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).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti; // 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).srb_id = CCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; // F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; // 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); // 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"); // LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
nr_rrc_data_req(ctxt_pP,
DCCH,
rrc_gNB_mui++,
SDU_CONFIRM_NO,
ue_p->Srb0.Tx_buffer.payload_size,
ue_p->Srb0.Tx_buffer.Payload,
PDCP_TRANSMISSION_MODE_CONTROL);
break; break;
case ngran_gNB_DU: case ngran_gNB_DU:
...@@ -767,18 +774,18 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -767,18 +774,18 @@ rrc_gNB_generate_defaultRRCReconfiguration(
case ngran_gNB_CU: case ngran_gNB_CU:
// create an ITTI message // create an ITTI message
// F1AP_DL_RRC_MESSAGE // F1AP_DL_RRC_MESSAGE
message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); // message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; // F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer;
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size; // F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size;
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; // 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).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown // F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_context_pP->ue_context.rnti; // F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_context_pP->ue_context.rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; // F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; // F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; // 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); // itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_I(NR_RRC, "send RRCReconfiguration to F1AP by F1AP_DL_RRC_MESSAGE \n"); // LOG_I(NR_RRC, "send RRCReconfiguration to F1AP by F1AP_DL_RRC_MESSAGE \n");
nr_rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
...@@ -825,7 +832,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -825,7 +832,6 @@ rrc_gNB_generate_defaultRRCReconfiguration(
ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.rnti,
rrc_gNB_mui, rrc_gNB_mui,
size); size);
#if(0)
nr_rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
...@@ -834,7 +840,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -834,7 +840,6 @@ rrc_gNB_generate_defaultRRCReconfiguration(
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
// rrc_pdcp_config_asn1_req // rrc_pdcp_config_asn1_req
#endif
#endif #endif
// rrc_rlc_config_asn1_req // rrc_rlc_config_asn1_req
} }
...@@ -2773,7 +2778,6 @@ rrc_gNB_generate_SecurityModeCommand( ...@@ -2773,7 +2778,6 @@ 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
#if(0)
LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n"); LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n");
nr_rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
...@@ -2782,7 +2786,6 @@ rrc_gNB_generate_SecurityModeCommand( ...@@ -2782,7 +2786,6 @@ rrc_gNB_generate_SecurityModeCommand(
size, size,
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
#endif
#endif #endif
break; break;
...@@ -2816,18 +2819,18 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -2816,18 +2819,18 @@ rrc_gNB_generate_UECapabilityEnquiry(
case ngran_gNB_CU: case ngran_gNB_CU:
// create an ITTI message // create an ITTI message
// F1AP_DL_RRC_MESSAGE // F1AP_DL_RRC_MESSAGE
message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); // message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; // F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer;
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size; // F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size;
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; // 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).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown // F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_context_pP->ue_context.rnti; // F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_context_pP->ue_context.rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; // F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; // F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; // 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); // 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"); // LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
nr_rrc_data_req( nr_rrc_data_req(
ctxt_pP, ctxt_pP,
...@@ -2872,7 +2875,6 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -2872,7 +2875,6 @@ 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
#if(0)
nr_rrc_data_req( nr_rrc_data_req(
ctxt_pP, ctxt_pP,
DCCH, DCCH,
...@@ -2881,7 +2883,6 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -2881,7 +2883,6 @@ rrc_gNB_generate_UECapabilityEnquiry(
size, size,
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
#endif
#endif #endif
break; break;
......
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