Commit 83b946ca authored by matzakos's avatar matzakos

Add calls to initialization and configuration functions for RLC and PDCP at nrUE for SA mode

-RRCSetupComplete successfully transferred to RLC of the UE now through SRB1, but not at the MAC yet.
-Needed to enable some additional elements for RLC config. at the gNB side (asn1_msg.c) so that the addition of the SRB does not fail at the UE.
 To verify if these are really required.
parent cc81141c
...@@ -328,7 +328,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { ...@@ -328,7 +328,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500); LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500);
#endif #endif
if(IS_SOFTMODEM_NOS1){ if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa){
NR_UE_MAC_INST_t *mac = get_mac_inst(0); NR_UE_MAC_INST_t *mac = get_mac_inst(0);
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0);
......
...@@ -390,10 +390,10 @@ void init_pdcp(void) { ...@@ -390,10 +390,10 @@ void init_pdcp(void) {
} }
pdcp_layer_init(); pdcp_layer_init();
nr_DRB_preconfiguration();*/ nr_DRB_preconfiguration();*/
pdcp_layer_init();
pdcp_module_init(pdcp_initmask); pdcp_module_init(pdcp_initmask);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
LOG_I(PDCP, "Before getting out from init_pdcp() \n");
} }
// Stupid function addition because UE itti messages queues definition is common with eNB // Stupid function addition because UE itti messages queues definition is common with eNB
...@@ -448,7 +448,7 @@ int main( int argc, char **argv ) { ...@@ -448,7 +448,7 @@ int main( int argc, char **argv ) {
RC.nrrrc[0]->node_type = ngran_gNB; RC.nrrrc[0]->node_type = ngran_gNB;
init_NR_UE(1,rrc_config_path); init_NR_UE(1,rrc_config_path);
if(IS_SOFTMODEM_NOS1) if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa)
init_pdcp(); init_pdcp();
NB_UE_INST=1; NB_UE_INST=1;
......
...@@ -75,6 +75,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) ...@@ -75,6 +75,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
else { else {
LOG_I(MAC,"Running without CellGroupConfig\n"); LOG_I(MAC,"Running without CellGroupConfig\n");
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL); nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL);
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
} }
return (nr_ue_mac_inst); return (nr_ue_mac_inst);
......
...@@ -614,7 +614,7 @@ srb_found: ...@@ -614,7 +614,7 @@ srb_found:
memblock = get_free_mem_block(size, __FUNCTION__); memblock = get_free_mem_block(size, __FUNCTION__);
memcpy(memblock->data, buf, size); memcpy(memblock->data, buf, size);
enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL); enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL);
} }
else { 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);
...@@ -696,10 +696,12 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) ...@@ -696,10 +696,12 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
while (1) { while (1) {
itti_poll_msg(ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p); itti_poll_msg(ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p);
if (msg_p == NULL) if (msg_p == NULL){
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 RRC_DCCH_DATA_REQ type at PDCP task \n");
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,
...@@ -1068,6 +1070,54 @@ void pdcp_config_set_security( ...@@ -1068,6 +1070,54 @@ void pdcp_config_set_security(
} }
} }
static boolean_t pdcp_data_req_srb(
protocol_ctxt_t *ctxt_pP,
const rb_id_t rb_id,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_size,
unsigned char *const sdu_buffer)
{
LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size);
nr_pdcp_ue_t *ue;
nr_pdcp_entity_t *rb;
int rnti = ctxt_pP->rnti;
if (ctxt_pP->module_id != 0 ||
//ctxt_pP->enb_flag != 1 ||
ctxt_pP->instance != 0 ||
ctxt_pP->eNB_index != 0 /*||
ctxt_pP->configured != 1 ||
ctxt_pP->brOption != 0*/) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
if (rb_id < 1 || rb_id > 3)
rb = NULL;
else
rb = ue->srb[rb_id - 1];
if (rb == NULL) {
LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n",
__FILE__, __LINE__, __FUNCTION__, rnti, rb_id);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
return 0;
}
rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
return 1;
}
static boolean_t pdcp_data_req_drb( static boolean_t pdcp_data_req_drb(
protocol_ctxt_t *ctxt_pP, protocol_ctxt_t *ctxt_pP,
const rb_id_t rb_id, const rb_id_t rb_id,
...@@ -1128,9 +1178,14 @@ boolean_t pdcp_data_req( ...@@ -1128,9 +1178,14 @@ boolean_t pdcp_data_req(
#endif #endif
) )
{ {
if (srb_flagP) { TODO; } if (srb_flagP) {
return pdcp_data_req_srb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size,
sdu_buffer);
}
else{
return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size,
sdu_buffer); sdu_buffer);
}
} }
void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind) void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind)
......
...@@ -673,7 +673,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t * ...@@ -673,7 +673,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig_t *
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup; logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
/* TODO: accept other values? */ /* TODO: accept other values? */
if (logical_channel_group != 1) { if (logical_channel_group != 0) {
LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
......
...@@ -1063,7 +1063,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti, ...@@ -1063,7 +1063,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity; rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1; rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1;
rlc_BearerConfig->reestablishRLC = NULL; rlc_BearerConfig->reestablishRLC = NULL;
if (0) { //if (0) {
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t)); rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
rlc_Config->present = NR_RLC_Config_PR_am; rlc_Config->present = NR_RLC_Config_PR_am;
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am)); rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
...@@ -1077,11 +1077,11 @@ void fill_initial_cellGroupConfig(rnti_t rnti, ...@@ -1077,11 +1077,11 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity; rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity;
rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity; rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity;
rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8; rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8;
} //}
rlc_BearerConfig->rlc_Config = rlc_Config; rlc_BearerConfig->rlc_Config = rlc_Config;
if (0) { //if (0) {
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t)); logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters)); logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
logicalChannelConfig->ul_SpecificParameters->priority = 1; logicalChannelConfig->ul_SpecificParameters->priority = 1;
...@@ -1089,7 +1089,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti, ...@@ -1089,7 +1089,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
logicalChannelGroup = CALLOC(1, sizeof(long)); logicalChannelGroup = CALLOC(1, sizeof(long));
*logicalChannelGroup = 0; *logicalChannelGroup = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup; logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
} //}
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig; rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
......
...@@ -199,9 +199,7 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con ...@@ -199,9 +199,7 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con
const NR_DRB_ToAddModList_t * const drb2add_listP, const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP, const NR_DRB_ToReleaseList_t * const drb2release_listP,
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_srb_bearer2add_list, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_drb_bearer2add_list);
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
int8_t nr_rrc_ue_decode_secondary_cellgroup_config( int8_t nr_rrc_ue_decode_secondary_cellgroup_config(
const module_id_t module_id, const module_id_t module_id,
...@@ -2029,27 +2027,27 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -2029,27 +2027,27 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm, derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
// Refresh SRBs // Refresh SRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP, nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList, radioBearerConfig->srb_ToAddModList,
// NULL, NULL,
// NULL, NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// kRRCenc, kRRCenc,
// kRRCint, kRRCint,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL); NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
// Refresh SRBs // Refresh SRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_rlc_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList, radioBearerConfig->srb_ToAddModList,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList
// ); );
for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) { for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) {
SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity; SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity;
......
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