Commit 4ea8b38d authored by Xue Song's avatar Xue Song

c-plane is ok

parent 133ecd52
......@@ -199,6 +199,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
f1ap_dl_rrc_message_t *f1ap_dl_rrc)
{
LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n");
F1AP_F1AP_PDU_t pdu;
F1AP_DLRRCMessageTransfer_t *out;
F1AP_DLRRCMessageTransferIEs_t *ie;
......@@ -280,10 +281,10 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length);
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
// printf("%02x ", f1ap_dl_rrc->rrc_container[i]);
//printf("\n");
LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length);
for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
printf("%02x ", f1ap_dl_rrc->rrc_container[i]);
printf("\n");
/* optional */
/* c7. RAT_FrequencyPriorityInformation */
......
......@@ -45,6 +45,7 @@
extern f1ap_setup_req_t *f1ap_du_data_from_du;
extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
extern RAN_CONTEXT_t RC;
extern uint32_t f1ap_assoc_id;
int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) {
......@@ -150,7 +151,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (0) {
/* mandatory */
/* c7. Candidate_SpCell_List */
ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t));
......@@ -696,7 +697,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
/* OPTIONAL */
/* InactivityMonitoringRequest */
if (0) {
......@@ -754,6 +755,22 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
return -1;
}
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)pdu);
// asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
// buffer = res.buffer;
// len = res.result.encoded;
// if (res.result.encoded <= 0) {
// LOG_E(F1AP, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded);
// return -1;
// }
LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %zd bits\n", len);
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/ , buffer, len, 0 /* BK: fix me*/);
return 0;
}
......
......@@ -69,6 +69,9 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
case F1AP_ProcedureCode_id_UEContextReleaseRequest:
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextReleaseRequest\n", __func__);
break;
case F1AP_ProcedureCode_id_UEContextSetup:
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__);
break;
// case F1AP_ProcedureCode_id_InitialContextSetup:
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
// message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG;
......
......@@ -1350,12 +1350,6 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
break;
}// 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);
} else if (srb_id == 1) {
NR_DL_DCCH_Message_t* dl_dcch_msg=NULL;
......@@ -1363,8 +1357,8 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void**)&dl_dcch_msg,
&ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header
rrc_dl_sdu_len,0,0);
&ie->value.choice.RRCContainer.buf[2], // buf[0] includes the pdcp header
rrc_dl_sdu_len-6,0,0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed);
......@@ -1490,7 +1484,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
}
LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id);
#if(0)
rlc_op_status_t rlc_status;
boolean_t ret = TRUE;
mem_block_t *pdcp_pdu_p = NULL;
......@@ -1508,45 +1502,47 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len);
memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len);
rlc_status = rlc_data_req(&ctxt
, 1
, MBMS_FLAG_NO
, srb_id
, 0
, 0
, rrc_dl_sdu_len
, pdcp_pdu_p
,NULL
,NULL
);
switch (rlc_status) {
case RLC_OP_STATUS_OK:
//LOG_I(F1AP, "Data sending request over RLC succeeded!\n");
ret=TRUE;
break;
case RLC_OP_STATUS_BAD_PARAMETER:
LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
ret= FALSE;
break;
case RLC_OP_STATUS_INTERNAL_ERROR:
LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
ret= FALSE;
break;
case RLC_OP_STATUS_OUT_OF_RESSOURCES:
LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
ret= FALSE;
break;
default:
LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
ret= FALSE;
break;
} // switch case
return ret;
/* for rfsim */
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, pdcp_pdu_p);
// rlc_status = rlc_data_req(&ctxt
// , 1
// , MBMS_FLAG_NO
// , srb_id
// , 0
// , 0
// , rrc_dl_sdu_len
// , pdcp_pdu_p
// ,NULL
// ,NULL
// );
// switch (rlc_status) {
// case RLC_OP_STATUS_OK:
// //LOG_I(F1AP, "Data sending request over RLC succeeded!\n");
// ret=TRUE;
// break;
// case RLC_OP_STATUS_BAD_PARAMETER:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
// ret= FALSE;
// break;
// case RLC_OP_STATUS_INTERNAL_ERROR:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
// ret= FALSE;
// break;
// case RLC_OP_STATUS_OUT_OF_RESSOURCES:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
// ret= FALSE;
// break;
// default:
// LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
// ret= FALSE;
// break;
// } // switch case
// return ret;
} // if pdcp_pdu_p
#endif
return 0;
}
......@@ -118,6 +118,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
/* SRBs_ToBeSetup_List */
/* DRBs_ToBeSetup_List */
/* Decode DRBs_ToBeSetup_List */
if(0) {
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true);
f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count;
......@@ -151,7 +152,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
break;
}
}
}
/* RRCContainer */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_RRCContainer, false);
......@@ -163,7 +164,24 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer);
}
AssertFatal(0, "check configuration, send to appropriate handler\n");
// AssertFatal(0, "check configuration, send to appropriate handler\n");
protocol_ctxt_t ctxt;
// ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID);
ctxt.rnti = 0x1234;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
mem_block_t *pdcp_pdu_p = NULL;
pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__);
if (pdcp_pdu_p != NULL) {
memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size);
memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size);
/* for rfsim */
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p);
}
return 0;
}
......
......@@ -28,6 +28,7 @@
#include "NR_RLC-BearerConfig.h"
#include "NR_RLC-Config.h"
#include "NR_CellGroupConfig.h"
#include "NR_DL-DCCH-Message.h"
#include "openair2/RRC/NR/nr_rrc_proto.h"
/* from OAI */
......@@ -47,6 +48,7 @@ static uint64_t pdcp_optmask;
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
extern ngran_node_t node_type;
uint8_t first_dcch = 0;
/****************************************************************************/
/* rlc_data_req queue - begin */
......@@ -676,9 +678,47 @@ printf("!!!!!!! deliver_pdu_srb (srb %d) calling rlc_data_req size %d: ", srb_id
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
printf("\n");
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
NR_DL_DCCH_Message_t* dl_dcch_msg=NULL;
asn_dec_rval_t dec_rval;
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_PDCP_ENB, TASK_CU_F1, size);
memcpy (message_buffer, buf, size);
if (first_dcch == 1) {
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void**)&dl_dcch_msg,
&buf[2],
size-6,0,0);
if (dec_rval.code == RC_OK) {
if (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_securityModeCommand) {
LOG_I(PDCP, "CU send securityModeCommand by F1AP_UE_CONTEXT_SETUP_REQ\n");
message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_UE_CONTEXT_SETUP_REQ);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = message_buffer;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = size;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue->rnti;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).mcc = RC.nrrrc[0]->configuration.mcc[0];
F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc = RC.nrrrc[0]->configuration.mnc[0];
F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0];
F1AP_UE_CONTEXT_SETUP_REQ (message_p).nr_cellid = RC.nrrrc[0]->nr_cellid;
// for rfsim
f1ap_drb_to_be_setup_t drb;
drb.drb_id = 1;
drb.up_ul_tnl[0].tl_address = inet_addr("127.0.0.3");
drb.up_ul_tnl[0].gtp_teid = 0;
drb.up_ul_tnl_length = sizeof(drb.up_ul_tnl);
drb.rlc_mode = RLC_MODE_AM;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = 1;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = &drb;
itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p);
} else {
LOG_I(PDCP, "other NR_DL_DCCH_Message \n");
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 = message_buffer;
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;
......@@ -688,6 +728,24 @@ printf("\n");
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 {
LOG_E(PDCP, "error NR_DL_DCCH_Message \n");
}
} else {
first_dcch = 1;
message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = message_buffer;
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);
}
......@@ -922,7 +980,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
}
}
if (drb2add_list != NULL) {
if ((drb2add_list != NULL) && (rlc_bearer2add_list != NULL)) {
for (i = 0; i < drb2add_list->list.count; i++) {
add_drb(rnti, drb2add_list->list.array[i], rlc_bearer2add_list->list.array[i]->rlc_Config);
}
......
......@@ -103,7 +103,7 @@ nr_rrc_data_req(
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
ctxt_pP->instance,
message_p);
LOG_I(NR_RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n");
LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n");
/* 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
......
......@@ -1012,12 +1012,14 @@ rrc_gNB_process_RRCReconfigurationComplete(
NULL,
NULL);
/* Refresh SRBs/DRBs */
if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
nr_rrc_rlc_config_asn1_req(ctxt_pP,
SRB_configList, // NULL,
DRB_configList,
DRB_Release_configList2,
NULL,
NULL);
}
#endif
/* Set the SRB active in UE context */
......
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