Commit 76cb132f authored by Xue Song's avatar Xue Song

u-plane is ok

parent 4c1e4740
......@@ -3125,7 +3125,7 @@ target_link_libraries (nr-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB
-Wl,--end-group z dl)
......
......@@ -542,6 +542,10 @@ int main( int argc, char **argv ) {
#endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
RC.nrrrc = (gNB_RRC_INST **)malloc(1*sizeof(gNB_RRC_INST *));
RC.nrrrc[0] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST));
RC.nrrrc[0]->node_type = ngran_gNB;
init_NR_UE(1,rrc_config_path);
if(IS_SOFTMODEM_NOS1)
init_pdcp();
......
......@@ -39,6 +39,7 @@
#include "proto_agent.h"
extern RAN_CONTEXT_t RC;
extern uint8_t proto_agent_falg;
f1ap_setup_req_t *f1ap_du_data_from_du;
f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
......@@ -79,6 +80,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
};
AssertFatal(proto_agent_start(instance, &params) == 0,
"could not start PROTO_AGENT for F1U on instance %d!\n", instance);
proto_agent_falg = 1;
}
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
......
......@@ -365,17 +365,23 @@ int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Proto
if (!pdcp_pdu_p) goto error;
memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
result = rlc_data_req(&ctxt_pP
,srb_flagP
,flag_MBMS
,rb_idP
,muiP
,confirmP
,pdcp_pdu_size
,pdcp_pdu_p
,NULL
,NULL
);
// result = rlc_data_req(&ctxt_pP
// ,srb_flagP
// ,flag_MBMS
// ,rb_idP
// ,muiP
// ,confirmP
// ,pdcp_pdu_size
// ,pdcp_pdu_p
// ,NULL
// ,NULL
// );
LOG_D(PROTO_AGENT, "proto_agent received pdcp_data_req \n");
// for (int i = 0; i < pdcp_pdu_size; i++)
// printf(" %2.2x", (unsigned char)pdcp_pdu_p->data[i]);
// printf("\n");
du_rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
result = 1;
return result;
error:
......@@ -522,6 +528,8 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto
ctxt_pP.rnti = ctxt->fsp_rnti;
ctxt_pP.frame = ctxt->fsp_frame;
ctxt_pP.subframe = ctxt->fsp_subframe;
ctxt_pP.configured = 1;
ctxt_pP.brOption = 0;
ctxt_pP.eNB_index = ctxt->fsp_enb_index;
srb_flagP = rlc_data->fsp_srb_flag;
flag_MBMS = rlc_data->fsp_mbms_flag;
......
......@@ -41,6 +41,7 @@
} while (0)
static nr_pdcp_ue_manager_t *nr_pdcp_ue_manager;
static pdcp_params_t nr_pdcp_params = {0,NULL};
/* necessary globals for OAI, not used internally */
hash_table_t *pdcp_coll_p;
......@@ -49,6 +50,7 @@ static uint64_t pdcp_optmask;
extern RAN_CONTEXT_t RC;
ngran_node_t node_type = ngran_gNB;
uint8_t first_dcch = 0;
uint8_t proto_agent_falg = 0;
/****************************************************************************/
/* rlc_data_req queue - begin */
......@@ -323,9 +325,11 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len);
ctxt.rnti = rnti;
pdcp_data_req(&ctxt, SRB_FLAG_NO, lc_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
if (proto_agent_falg == 1) {
pdcp_data_req(&ctxt, SRB_FLAG_NO, lc_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
}
}
return NULL;
......@@ -605,6 +609,13 @@ rb_found:
memblock = get_free_mem_block(size, __FUNCTION__);
memcpy(memblock->data, buf, size);
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
LOG_D(PDCP, "call proto_agent_send_rlc_data_req()\n");
nr_pdcp_params.send_rlc_data_req_func(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock, NULL, NULL);
// proto_agent_send_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock);
return;
}
LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]);
//printf("\n");
......@@ -765,7 +776,13 @@ boolean_t pdcp_data_ind(
ctxt_pP->eNB_index != 0 ||
ctxt_pP->configured != 1 ||
ctxt_pP->brOption != 0) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
LOG_E(PDCP, "%s:%d:%s: fatal, module_id %d, instance %d, eNB_index %d, configured %d, brOption %d\n",
__FILE__, __LINE__, __FUNCTION__,
ctxt_pP->module_id,
ctxt_pP->instance,
ctxt_pP->eNB_index,
ctxt_pP->configured,
ctxt_pP->brOption);
exit(1);
}
......@@ -773,6 +790,12 @@ boolean_t pdcp_data_ind(
T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rnti),
T_INT(rb_id), T_INT(sdu_buffer_size));
if (NODE_IS_DU(RC.nrrrc[0]->node_type) && (srb_flagP == 0)) {
LOG_D(RLC, "call proto_agent_send_pdcp_data_ind() \n");
nr_pdcp_params.pdcp_data_ind_func(ctxt_pP, srb_flagP, 0, rb_id, sdu_buffer_size, sdu_buffer, NULL, NULL);
return;
}
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
......@@ -1293,12 +1316,12 @@ boolean_t pdcp_data_req(
void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind)
{
/* nothing to do */
nr_pdcp_params.pdcp_data_ind_func = pdcp_data_ind;
}
void pdcp_set_rlc_data_req_func(send_rlc_data_req_func_t send_rlc_data_req)
{
/* nothing to do */
nr_pdcp_params.send_rlc_data_req_func = send_rlc_data_req;
}
//Dummy function needed due to LTE dependencies
......
......@@ -41,6 +41,8 @@
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h"
extern RAN_CONTEXT_t RC;
#include <stdint.h>
......@@ -439,7 +441,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
exit(1);
rb_found:
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d",
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d \n",
__FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size);
memblock = get_free_mem_block(size, __func__);
......@@ -473,43 +475,29 @@ rb_found:
AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
"Can't be CU, bad node type %d\n", type);
// if (NODE_IS_DU(type) && is_srb == 0) {
// LOG_D(RLC, "call proto_agent_send_pdcp_data_ind() \n");
// proto_agent_send_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock);
// return;
// }
if (NODE_IS_DU(type) && is_srb == 1) {
MessageDef *msg;
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);
msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_INITIAL_UL_RRC_MESSAGE);
F1AP_INITIAL_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = 0;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mcc = RC.nrrrc[0]->configuration.mcc[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc = RC.nrrrc[0]->configuration.mnc[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).nr_cellid = RC.nrrrc[0]->nr_cellid;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).crnti = ue->rnti;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container_length = size;
itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0), msg);
ccch_flag = 0;
return;
}
}
}
LOG_I(RLC, "[MSG] RRC Setup Request\n");
msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_INITIAL_UL_RRC_MESSAGE);
F1AP_INITIAL_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = 0;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mcc = RC.nrrrc[0]->configuration.mcc[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc = RC.nrrrc[0]->configuration.mnc[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).nr_cellid = RC.nrrrc[0]->nr_cellid;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).crnti = ue->rnti;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container_length = size;
itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0), msg);
ccch_flag = 0;
return;
}
msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE);
......
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