Commit ef1627fa authored by Bing-Kai Hong's avatar Bing-Kai Hong

INITIAL_UL_RRC_MESSAGE at DU and CU respectively is developped

parent ab49f954
......@@ -32,18 +32,112 @@
#include "f1ap_common.h"
#include "f1ap_cu_rrc_message_transfer.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
/*
Initial UL RRC Message Transfer
*/
void CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(void) {
int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu) {
printf("CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER\n");
printf("CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n");
// decode the F1 message
// get the rrc message from the contauiner
// call func rrc_eNB_decode_ccch: <-- needs some update here
MessageDef *message_p;
F1AP_InitialULRRCMessageTransfer_t *container;
F1AP_InitialULRRCMessageTransferIEs_t *ie;
SRB_INFO* Srb_info;
protocol_ctxt_t ctxt;
rnti_t rnti;
uint8_t *ccch_sdu;
sdu_size_t ccch_sdu_len;
int CC_id =0;
int instance=0;
uint64_t du_ue_f1ap_id;
DevAssert(pdu != NULL);
if (stream != 0) {
LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n",
assoc_id, stream);
return -1;
}
container = &pdu->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
/* NRCGI */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_NRCGI, true);
instance = 0; ///ie->value.choice. ?? //@Todo
/* RNTI */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_C_RNTI, true);
BIT_STRING_TO_CELL_IDENTITY(&ie->value.choice.C_RNTI, rnti);
/* RRC Container */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_RRCContainer, true);
ccch_sdu = calloc(ie->value.choice.RRCContainer.size + 1, sizeof(char));
memcpy(ccch_sdu, ie->value.choice.RRCContainer.buf,
ie->value.choice.RRCContainer.size);
/* Convert the mme name to a printable string */
ccch_sdu[ie->value.choice.RRCContainer.size] = '\0';
printf ("RRCContainer %s \n", ccch_sdu);
ccch_sdu_len = ie->value.choice.RRCContainer.size;
// create an ITTI message
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);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, ccch_sdu, ccch_sdu_len);
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 = instance; // 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);
// OR creat the ctxt and srb_info struct required by rrc_eNB_decode_ccch
/*
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
instance, // to fix
ENB_FLAG_YES,
rnti,
0, // frame
0); // slot
CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id;
srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0;
if (ccch_sdu_len >= RRC_BUFFER_SIZE_MAX) {
LOG_E(RRC, "CCCH message has size %d > %d\n",ccch_sdu_len,RRC_BUFFER_SIZE_MAX);
break;
}
memcpy(srb_info_p->Rx_buffer.Payload,
ccch_sdu,
ccch_sdu_len);
srb_info->Rx_buffer.payload_size = ccch_sdu_len;
rrc_eNB_decode_ccch(&ctxt, srb_info, CC_id);
*/
// if size > 0
// CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size)
}
......
......@@ -33,4 +33,7 @@
#ifndef F1AP_CU_RRC_MESSAGE_TRANSFER_H_
#define F1AP_CU_RRC_MESSAGE_TRANSFER_H_
int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(int32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
#endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */
\ No newline at end of file
......@@ -310,7 +310,6 @@ int DU_handle_F1_SETUP_RESPONSE(uint32_t assoc_id,
F1AP_F1AP_PDU_t *pdu)
{
printf("DU_handle_F1_SETUP_RESPONSE\n");
return 0;
}
......@@ -382,7 +381,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du
/* - nRCGI */
F1AP_NRCGI_t nRCGI;
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity);
served_cell_information.nRCGI = nRCGI;
/* - nRPCI */
......@@ -536,7 +535,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du
F1AP_NRCGI_t oldNRCGI;
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i],
&oldNRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(123456, &oldNRCGI.nRCellIdentity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity);
served_cells_to_modify_item.oldNRCGI = oldNRCGI;
......@@ -548,7 +547,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du
F1AP_NRCGI_t nRCGI;
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i],
&nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity);
served_cell_information.nRCGI = nRCGI;
/* - nRPCI */
......
......@@ -163,7 +163,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
F1AP_NRCGI_t nRCGI;
MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0],
&nRCGI.pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity);
NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity);
ie->value.choice.NRCGI = nRCGI;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
......@@ -206,7 +206,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
printf("\n");
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0);
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
......
......@@ -34,6 +34,7 @@
#include "f1ap_handlers.h"
#include "f1ap_cu_interface_management.h"
#include "f1ap_du_interface_management.h"
#include "f1ap_cu_rrc_message_transfer.h"
extern f1ap_setup_req_t *f1ap_du_data_from_du;
......@@ -52,7 +53,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = {
{ 0, 0, 0 }, /* UEContextModificationRequired */
{ 0, 0, 0 }, /* UEMobilityCommand */
{ 0, 0, 0 }, /* UEContextReleaseRequest */
{ CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* InitialULRRCMessageTransfer */
{ CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0 }, /* InitialULRRCMessageTransfer */
{ CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* DLRRCMessageTransfer */
{ CU_handle_F1_SETUP_REQUEST, 0, 0 }, /* ULRRCMessageTransfer */
{ 0, 0, 0 }, /* privateMessage */
......
......@@ -367,7 +367,7 @@ rx_sdu(const module_id_t enb_mod_idP,
ra = &mac->common_channels[CC_idP].ra[ii];
if ((ra->rnti == current_rnti) && (ra->state != IDLE)) {
//int RC.cudu.du_flag = 1;
int du_flag = 1;
//int du_flag = 1;
mac_rrc_data_ind(
enb_mod_idP,
CC_idP,
......@@ -377,7 +377,7 @@ rx_sdu(const module_id_t enb_mod_idP,
(uint8_t *) payload_ptr,
rx_lengths[i],
0,
du_flag
RC.rrc[enb_mod_idP]->node_type
);
// prepare transmission of Msg4(RRCConnectionReconfiguration)
ra->state = MSGCRNTI;
......@@ -619,7 +619,7 @@ rx_sdu(const module_id_t enb_mod_idP,
}
//int RC.cudu.du_flag = 1;
int du_flag = 1;
//int du_flag = 1;
mac_rrc_data_ind(
enb_mod_idP,
CC_idP,
......@@ -629,7 +629,7 @@ rx_sdu(const module_id_t enb_mod_idP,
(uint8_t *) payload_ptr,
rx_lengths[i],
0,
du_flag
RC.rrc[enb_mod_idP]->node_type
);
......
......@@ -226,31 +226,31 @@ mac_rrc_data_req(
}
//--------------------------------------------------------------------------
int8_t
mac_du_data_ind(
const module_id_t module_idP,
const int CC_idP,
const int UE_id,
const rnti_t rntiP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP
)
//--------------------------------------------------------------------------
{
printf(
"[F1 %d][RAPROC] CC_id %d current_rnti %x Received Msg3 from already registered UE %d: length %d, offset %ld\n",
module_idP, CC_idP, rntiP,
UE_id, sdu_lenP, sduP);
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_idP,
CC_idP,
UE_id,
rntiP,
sduP,
sdu_lenP
);
}
// int8_t
// mac_du_data_ind(
// const module_id_t module_idP,
// const int CC_idP,
// const int UE_id,
// const rnti_t rntiP,
// const uint8_t *sduP,
// const sdu_size_t sdu_lenP
// )
// //--------------------------------------------------------------------------
// {
// printf(
// "[F1 %d][RAPROC] CC_id %d current_rnti %x Received Msg3 from already registered UE %d: length %d, offset %ld\n",
// module_idP, CC_idP, rntiP,
// UE_id, sdu_lenP, sduP);
// DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
// module_idP,
// CC_idP,
// UE_id,
// rntiP,
// sduP,
// sdu_lenP
// );
// }
//------------------------------------------------------------------------------
int8_t
......@@ -265,20 +265,24 @@ mac_rrc_data_ind(
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const int du_flag
const int node_type
)
//--------------------------------------------------------------------------
{
LOG_E(RRC, "node_type == %d \n" , node_type);
if (node_type == ngran_eNB_DU) {
LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n",
module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
// navid update / Bing-Kai modify
if (du_flag) {
mac_du_data_ind(
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_idP,
CC_id,
UE_id,
rntiP,
sduP,
sdu_lenP);
sdu_lenP
);
return(0);
}
SRB_INFO *Srb_info;
......
......@@ -428,7 +428,7 @@ mac_rrc_data_ind(
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const int du_flag
const int node_type
);
int8_t
......
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