Commit 7c3b0030 authored by luis_pereira87's avatar luis_pereira87

Use F1AP to transfer SRB1 messages in monolithic mode

parent a97dfedb
...@@ -36,7 +36,9 @@ int dl_rrc_message(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc) ...@@ -36,7 +36,9 @@ int dl_rrc_message(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc)
/* dispatch message to dl_rrc_message_rrcSetup() and others, similar to as is /* dispatch message to dl_rrc_message_rrcSetup() and others, similar to as is
* done in the DU (should be the same here) */ * done in the DU (should be the same here) */
if (dl_rrc->srb_id == 0) { LOG_I(NR_MAC, "DL RRC Message Transfer with %d bytes for RNTI %04x SRB %d\n", dl_rrc->rrc_container_length, dl_rrc->rnti, dl_rrc->srb_id);
if (dl_rrc->srb_id == CCCH) { // SRB 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 = uper_decode(NULL, asn_dec_rval_t dec_rval = uper_decode(NULL,
...@@ -71,6 +73,12 @@ int dl_rrc_message(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc) ...@@ -71,6 +73,12 @@ int dl_rrc_message(module_id_t module_id, const f1ap_dl_rrc_message_t *dl_rrc)
break; break;
} }
return 0; return 0;
} else if (dl_rrc->srb_id == DCCH) { // SRB 1
nr_rlc_srb_recv_sdu(dl_rrc->rnti, DCCH, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
return 0;
} else if (dl_rrc->srb_id == DCCH1) { // SRB 2
nr_rlc_srb_recv_sdu(dl_rrc->rnti, DCCH1, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
return 0;
} }
return -1; /* not handled yet */ return -1; /* not handled yet */
...@@ -115,7 +123,7 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t * ...@@ -115,7 +123,7 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t *
ue_p->SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; ue_p->SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList;
ue_p->masterCellGroup = cellGroup; ue_p->masterCellGroup = cellGroup;
nr_rlc_srb0_recv_sdu(dl_rrc->rnti, dl_rrc->rrc_container, dl_rrc->rrc_container_length); nr_rlc_srb_recv_sdu(dl_rrc->rnti, CCCH, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
protocol_ctxt_t ctxt = { .module_id = module_id, .rnti = dl_rrc->rnti }; protocol_ctxt_t ctxt = { .module_id = module_id, .rnti = dl_rrc->rnti };
nr_rrc_rlc_config_asn1_req(&ctxt, nr_rrc_rlc_config_asn1_req(&ctxt,
......
...@@ -768,9 +768,7 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -768,9 +768,7 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity,
{ {
nr_pdcp_ue_t *ue = _ue; nr_pdcp_ue_t *ue = _ue;
int srb_id; int srb_id;
protocol_ctxt_t ctxt;
int i; int i;
mem_block_t *memblock;
for (i = 0; i < sizeofArray(ue->srb) ; i++) { for (i = 0; i < sizeofArray(ue->srb) ; i++) {
if (entity == ue->srb[i]) { if (entity == ue->srb[i]) {
...@@ -790,21 +788,18 @@ srb_found: ...@@ -790,21 +788,18 @@ srb_found:
//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");
if ((RC.nrrrc == NULL) || (!NODE_IS_CU(RC.nrrrc[0]->node_type))) { if ((RC.nrrrc == NULL) || (!NODE_IS_CU(RC.nrrrc[0]->node_type))) {
ctxt.module_id = 0; if (entity->is_gnb) {
ctxt.enb_flag = 1; f1ap_dl_rrc_message_t dl_rrc = {.old_gNB_DU_ue_id = 0xFFFFFF, .rrc_container = (uint8_t *)buf, .rrc_container_length = size, .rnti = ue->rnti, .srb_id = DCCH};
ctxt.instance = 0; gNB_RRC_INST *rrc = RC.nrrrc[0];
ctxt.frame = 0; rrc->mac_rrc.dl_rrc_message_transfer(0, &dl_rrc);
ctxt.subframe = 0; } else { // UE
ctxt.eNB_index = 0; mem_block_t *memblock;
ctxt.brOption = 0; protocol_ctxt_t ctxt = {.module_id = 0, .enb_flag = 1, .instance = 0, .frame = 0, .subframe = 0, .eNB_index = 0, .brOption = 0, .rnti = ue->rnti};
memblock = get_free_mem_block(size, __FUNCTION__);
ctxt.rnti = ue->rnti; memcpy(memblock->data, buf, size);
enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock);
memblock = get_free_mem_block(size, __FUNCTION__); }
memcpy(memblock->data, buf, size); } else {
enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock);
}
else {
MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE);
uint8_t *message_buffer = itti_malloc (TASK_RRC_GNB, TASK_CU_F1, size); uint8_t *message_buffer = itti_malloc (TASK_RRC_GNB, TASK_CU_F1, size);
memcpy (message_buffer, buf, size); memcpy (message_buffer, buf, size);
......
...@@ -749,7 +749,7 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig ...@@ -749,7 +749,7 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->srb[srb_id-1] != NULL) { if (ue->srb[srb_id-1] != NULL) {
LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI 0x%x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); LOG_W(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI %04x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else { } else {
/* hack: hardcode values for NR */ /* hack: hardcode values for NR */
t_poll_retransmit = 45; t_poll_retransmit = 45;
...@@ -839,7 +839,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ ...@@ -839,7 +839,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue->drb[drb_id-1] != NULL) { if (ue->drb[drb_id-1] != NULL) {
LOG_W(RLC, "%s:%d:%s: DRB %d already exists for UE with RNTI %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_W(RLC, "%s:%d:%s: DRB %d already exists for UE with RNTI %04x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
} else { } else {
nr_rlc_am = new_nr_rlc_entity_am(10000000, nr_rlc_am = new_nr_rlc_entity_am(10000000,
10000000, 10000000,
...@@ -1241,7 +1241,7 @@ const bool nr_rlc_get_statistics( ...@@ -1241,7 +1241,7 @@ const bool nr_rlc_get_statistics(
return ret; return ret;
} }
void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size) void nr_rlc_srb_recv_sdu(const int rnti, const logical_chan_id_t channel_id, unsigned char *buf, int size)
{ {
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
nr_rlc_entity_t *rb; nr_rlc_entity_t *rb;
...@@ -1251,8 +1251,13 @@ void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size) ...@@ -1251,8 +1251,13 @@ void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size)
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
rb = ue->srb0; if (channel_id == 0) {
AssertFatal(rb != NULL, "SDU sent to unknown RB rnti %d srb0\n", rnti); rb = ue->srb0;
} else {
rb = ue->srb[channel_id - 1];
}
AssertFatal(rb != NULL, "SDU sent to unknown RB RNTI %04x SRB %d\n", rnti, channel_id);
rb->set_time(rb, nr_rlc_current_time); rb->set_time(rb, nr_rlc_current_time);
rb->recv_sdu(rb, (char *)buf, size, -1); rb->recv_sdu(rb, (char *)buf, size, -1);
......
...@@ -59,7 +59,7 @@ void nr_rlc_activate_avg_time_to_tx( ...@@ -59,7 +59,7 @@ void nr_rlc_activate_avg_time_to_tx(
const logical_chan_id_t channel_id, const logical_chan_id_t channel_id,
const bool is_on); const bool is_on);
void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size); void nr_rlc_srb_recv_sdu(const int rnti, const logical_chan_id_t channel_id, unsigned char *buf, int size);
void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid, void nr_rlc_activate_srb0(int rnti, int module_id, int cc_id, int uid,
void (*send_initial_ul_rrc_message)( void (*send_initial_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