void config_req_rlc_um_asn1 ( const module_id_t enb_module_idP, const module_id_t ue_module_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t mbms_flagP, const mbms_session_id_t mbms_session_idP, const mbms_service_id_t mbms_service_idP, const UL_UM_RLC_t * const ul_rlc_pP, const DL_UM_RLC_t * const dl_rlc_pP, const rb_id_t rb_idP) { uint32_t ul_sn_FieldLength = 0; uint32_t dl_sn_FieldLength = 0; uint32_t t_Reordering = 0; rlc_union_t *rlc_union_p = NULL; rlc_um_entity_t *rlc_p = NULL; hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); hashtable_rc_t h_rc; #if defined(Rel10) if (mbms_flagP) { AssertFatal(dl_rlc_pP, "No RLC UM DL config"); AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present"); key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, mbms_service_idP, mbms_session_idP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u service id %u, session id %u", enb_module_idP, ue_module_idP, eNB_flagP, mbms_service_idP, mbms_session_idP); rlc_p = &rlc_union_p->rlc.um; } else #endif { key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u", enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); rlc_p = &rlc_union_p->rlc.um; } //----------------------------------------------------------------------------- LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%dms sn_field_length= --->][RLC_UM][MOD %u/%u][RB %u] \n", frameP, (eNB_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP, (dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1, enb_module_idP, ue_module_idP, rb_idP); rlc_um_init(rlc_p); if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { rlc_um_set_debug_infos(rlc_p, enb_module_idP, ue_module_idP, frameP, eNB_flagP, srb_flagP, rb_idP); if (ul_rlc_pP != NULL) { switch (ul_rlc_pP->sn_FieldLength) { case SN_FieldLength_size5: ul_sn_FieldLength = 5; break; case SN_FieldLength_size10: ul_sn_FieldLength = 10; break; default: LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Uplink sn_FieldLength %d, RLC NOT CONFIGURED\n", frameP, (rlc_p->is_enb) ? "eNB" : "UE", rlc_p->enb_module_id, rlc_p->ue_module_id, rlc_p->rb_id, ul_rlc_pP->sn_FieldLength); return; } } if (dl_rlc_pP != NULL) { switch (dl_rlc_pP->sn_FieldLength) { case SN_FieldLength_size5: dl_sn_FieldLength = 5; break; case SN_FieldLength_size10: dl_sn_FieldLength = 10; break; default: LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Downlink sn_FieldLength %d, RLC NOT CONFIGURED\n", frameP, (rlc_p->is_enb) ? "eNB" : "UE", rlc_p->enb_module_id, rlc_p->ue_module_id, rlc_p->rb_id, dl_rlc_pP->sn_FieldLength); return; } if (dl_rlc_pP->t_Reordering<T_Reordering_spare1) { t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering]; } else { LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID T_Reordering %d, RLC NOT CONFIGURED\n", frameP, (rlc_p->is_enb) ? "eNB" : "UE", rlc_p->enb_module_id, rlc_p->ue_module_id, rlc_p->rb_id, dl_rlc_pP->t_Reordering); return; } } if (eNB_flagP > 0) { rlc_um_configure(rlc_p, frameP, t_Reordering, ul_sn_FieldLength, dl_sn_FieldLength, mbms_flagP); } else { rlc_um_configure(rlc_p, frameP, t_Reordering, dl_sn_FieldLength, ul_sn_FieldLength, mbms_flagP); } } }
//----------------------------------------------------------------------------- void mac_rlc_data_ind ( const module_id_t module_idP, const rnti_t rntiP, const module_id_t eNB_index, const frame_t frameP, const eNB_flag_t enb_flagP, const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP, char *buffer_pP, const tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs_pP) { //----------------------------------------------------------------------------- rb_id_t rb_id = 0; rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0, eNB_index); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_IN); #ifdef DEBUG_MAC_INTERFACE if (num_tbP) { LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n", PROTOCOL_CTXT_ARGS(&ctxt), channel_idP, RLC_MAX_LC, NB_RB_MAX, num_tbP); } #endif // DEBUG_MAC_INTERFACE #ifdef OAI_EMU if (MBMS_flagP) AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC); else AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX); CHECK_CTXT_ARGS(&ctxt); #endif if (MBMS_flagP) { if (BOOL_NOT(enb_flagP)) { mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[module_idP][channel_idP]; key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else { return; } } else { if (channel_idP > 2) { rb_id = channel_idP - 2; } else { rb_id = channel_idP; } key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; //AssertFatal (0 , "%s RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP); } struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP); switch (rlc_mode) { case RLC_MODE_NONE: //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP); break; case RLC_MODE_AM: rlc_am_mac_data_indication(&ctxt, &rlc_union_p->rlc.am, data_ind); break; case RLC_MODE_UM: rlc_um_mac_data_indication(&ctxt, &rlc_union_p->rlc.um, data_ind); break; case RLC_MODE_TM: rlc_tm_mac_data_indication(&ctxt, &rlc_union_p->rlc.tm, data_ind); break; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_OUT); }
//----------------------------------------------------------------------------- mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP, const rnti_t rntiP, const eNB_index_t eNB_index, const frame_t frameP, const eNB_flag_t enb_flagP, const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP, const tb_size_t tb_sizeP) { //----------------------------------------------------------------------------- mac_rlc_status_resp_t mac_rlc_status_resp; struct mac_status_ind tx_status; struct mac_status_resp status_resp; rb_id_t rb_id = 0; rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0, eNB_index); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_IN); memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t)); memset (&tx_status , 0, sizeof(struct mac_status_ind)); #ifdef OAI_EMU if (MBMS_flagP) AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "%s channel id is too high (%u/%d) enb module id %u ue %u!\n", (enb_flagP) ? "eNB" : "UE", channel_idP, RLC_MAX_MBMS_LC, module_idP, rntiP); else AssertFatal (channel_idP < NB_RB_MAX, "%s channel id is too high (%u/%d) enb module id %u ue %u!\n", (enb_flagP) ? "eNB" : "UE", channel_idP, NB_RB_MAX, module_idP, rntiP); CHECK_CTXT_ARGS(&ctxt); #endif if (MBMS_flagP) { if (enb_flagP) { mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP]; } else { mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[module_idP][channel_idP]; } key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else { if (channel_idP > 2) { rb_id = channel_idP - 2; } else { rb_id = channel_idP; } key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; //LOG_W(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP); //LOG_D(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP); } switch (rlc_mode) { case RLC_MODE_NONE: //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP); mac_rlc_status_resp.bytes_in_buffer = 0; break; case RLC_MODE_AM: status_resp = rlc_am_mac_status_indication(&ctxt, &rlc_union_p->rlc.am, tb_sizeP, tx_status); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send; mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented; //return mac_rlc_status_resp; break; case RLC_MODE_UM: status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tb_sizeP, tx_status); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send; mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented; // return mac_rlc_status_resp; break; case RLC_MODE_TM: status_resp = rlc_tm_mac_status_indication(&ctxt, &rlc_union_p->rlc.tm, tb_sizeP, tx_status); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; // return mac_rlc_status_resp; break; default: mac_rlc_status_resp.bytes_in_buffer = 0 ; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_OUT); return mac_rlc_status_resp; }
//----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, const SRB_ToAddModList_t * const srb2add_listP, const DRB_ToAddModList_t * const drb2add_listP, const DRB_ToReleaseList_t * const drb2release_listP #if defined(Rel10) ,const PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP #endif ) { //----------------------------------------------------------------------------- rb_id_t rb_id = 0; logical_chan_id_t lc_id = 0; DRB_Identity_t drb_id = 0; DRB_Identity_t* pdrb_id = NULL; long int cnt = 0; const SRB_ToAddMod_t *srb_toaddmod_p = NULL; const DRB_ToAddMod_t *drb_toaddmod_p = NULL; rlc_union_t *rlc_union_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; #if defined(Rel10) int i, j; MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL; mbms_session_id_t mbms_session_id; mbms_service_id_t mbms_service_id; DL_UM_RLC_t dl_um_rlc; #endif LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ ASN1 \n", PROTOCOL_CTXT_ARGS(ctxt_pP)); #ifdef OAI_EMU CHECK_CTXT_ARGS(ctxt_pP) #endif if (srb2add_listP != NULL) { for (cnt=0; cnt<srb2add_listP->list.count; cnt++) { rb_id = srb2add_listP->list.array[cnt]->srb_Identity; lc_id = rb_id + 2; LOG_D(RLC, "Adding SRB %d, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id); srb_toaddmod_p = srb2add_listP->list.array[cnt]; if (srb_toaddmod_p->rlc_Config) { switch (srb_toaddmod_p->rlc_Config->present) { case SRB_ToAddMod__rlc_Config_PR_NOTHING: break; case SRB_ToAddMod__rlc_Config_PR_explicitValue: switch (srb_toaddmod_p->rlc_Config->choice.explicitValue.present) { case RLC_Config_PR_NOTHING: break; case RLC_Config_PR_am: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM) != NULL) { config_req_rlc_am_asn1 ( ctxt_pP, SRB_FLAG_YES, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am, rb_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), rb_id); } break; case RLC_Config_PR_um_Bi_Directional: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC, rb_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), rb_id); } break; case RLC_Config_PR_um_Uni_Directional_UL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC, NULL, rb_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), rb_id); } break; case RLC_Config_PR_um_Uni_Directional_DL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, NULL, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC, rb_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), rb_id); } break; default: LOG_E(RLC, PROTOCOL_CTXT_FMT" UNKNOWN RLC CONFIG %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), srb_toaddmod_p->rlc_Config->choice.explicitValue.present); break; } break; case SRB_ToAddMod__rlc_Config_PR_defaultValue: #warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, NULL, // TO DO DEFAULT CONFIG NULL, // TO DO DEFAULT CONFIG rb_id); } else { LOG_D(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), rb_id); } break; default: ; } } } } if (drb2add_listP != NULL) { for (cnt=0; cnt<drb2add_listP->list.count; cnt++) { drb_toaddmod_p = drb2add_listP->list.array[cnt]; drb_id = drb_toaddmod_p->drb_Identity; lc_id = drb_id + 2; LOG_D(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id); if (drb_toaddmod_p->rlc_Config) { switch (drb_toaddmod_p->rlc_Config->present) { case RLC_Config_PR_NOTHING: break; case RLC_Config_PR_am: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM) != NULL) { config_req_rlc_am_asn1 ( ctxt_pP, SRB_FLAG_NO, &drb_toaddmod_p->rlc_Config->choice.am, drb_id); } break; case RLC_Config_PR_um_Bi_Directional: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC, &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC, drb_id); } break; case RLC_Config_PR_um_Uni_Directional_UL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC, NULL, drb_id); } break; case RLC_Config_PR_um_Uni_Directional_DL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, UNUSED_PARAM_MBMS_SESSION_ID, UNUSED_PARAM_MBMS_SERVICE_ID, NULL, &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC, drb_id); } break; default: LOG_W(RLC, PROTOCOL_CTXT_FMT"[RB %u] unknown drb_toaddmod_p->rlc_Config->present \n", PROTOCOL_CTXT_ARGS(ctxt_pP), drb_id); } } } } if (drb2release_listP != NULL) { for (cnt=0; cnt<drb2release_listP->list.count; cnt++) { pdrb_id = drb2release_listP->list.array[cnt]; rrc_rlc_remove_rlc( ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, *pdrb_id); } } #if defined(Rel10) if (pmch_InfoList_r9_pP != NULL) { for (i=0; i<pmch_InfoList_r9_pP->list.count; i++) { mbms_SessionInfoList_r9_p = &(pmch_InfoList_r9_pP->list.array[i]->mbms_SessionInfoList_r9); for (j=0; j<mbms_SessionInfoList_r9_p->list.count; j++) { MBMS_SessionInfo_p = mbms_SessionInfoList_r9_p->list.array[j]; mbms_session_id = MBMS_SessionInfo_p->sessionId_r9->buf[0]; lc_id = mbms_session_id; mbms_service_id = MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string // can set the mch_id = i if (ctxt_pP->enb_flag) { rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id;//+ (maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1 rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lc_id].service_id = mbms_service_id; rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lc_id].session_id = mbms_session_id; rlc_mbms_enb_set_lcid_by_rb_id(ctxt_pP->module_id,rb_id,lc_id); } else { rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id; // + (maxDRB + 3); // 15 rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lc_id].service_id = mbms_service_id; rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lc_id].session_id = mbms_session_id; rlc_mbms_ue_set_lcid_by_rb_id(ctxt_pP->module_id,rb_id,lc_id); } key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->module_id, ctxt_pP->enb_flag, mbms_service_id, mbms_session_id); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = rrc_rlc_add_rlc ( ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_YES, rb_id, lc_id, RLC_MODE_UM); AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED"); } LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id, rb_id, mbms_session_id, mbms_service_id ); dl_um_rlc.sn_FieldLength = SN_FieldLength_size5; dl_um_rlc.t_Reordering = T_Reordering_ms0; config_req_rlc_um_asn1 ( ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_YES, mbms_session_id, mbms_service_id, NULL, &dl_um_rlc, rb_id); } } } #endif LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ ASN1 END \n", PROTOCOL_CTXT_ARGS(ctxt_pP)); return RLC_OP_STATUS_OK; }
//----------------------------------------------------------------------------- tbs_size_t mac_rlc_data_req( const module_id_t module_idP, const rnti_t rntiP, const eNB_index_t eNB_index, const frame_t frameP, const eNB_flag_t enb_flagP, const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP, char *buffer_pP) { //----------------------------------------------------------------------------- struct mac_data_req data_request; rb_id_t rb_id = 0; rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; tbs_size_t ret_tb_size = 0; protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0,eNB_index); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_IN); #ifdef DEBUG_MAC_INTERFACE LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_REQ channel %d (%d) MAX RB %d, Num_tb %d\n", PROTOCOL_CTXT_ARGS((&ctxt)), channel_idP, RLC_MAX_LC, NB_RB_MAX); #endif // DEBUG_MAC_INTERFACE if (MBMS_flagP) { AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC); } else { AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX); } #ifdef OAI_EMU CHECK_CTXT_ARGS(&ctxt); //printf("MBMS_flagP %d, MBMS_FLAG_NO %d \n",MBMS_flagP, MBMS_FLAG_NO); // AssertFatal (MBMS_flagP == MBMS_FLAG_NO ," MBMS FLAG SHOULD NOT BE SET IN mac_rlc_data_req in UE\n"); #endif if (MBMS_flagP) { if (enb_flagP) { mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP]; key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else { return (tbs_size_t)0; } } else { if (channel_idP > 2) { rb_id = channel_idP - 2; } else { rb_id = channel_idP; } key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; AssertFatal (0 , "RLC not configured rb id %u lcid %u RNTI %x!\n", rb_id, channel_idP, rntiP); } switch (rlc_mode) { case RLC_MODE_NONE: ret_tb_size =0; break; case RLC_MODE_AM: data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am); ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data); break; case RLC_MODE_UM: data_request = rlc_um_mac_data_request(&ctxt, &rlc_union_p->rlc.um); ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data); break; case RLC_MODE_TM: data_request = rlc_tm_mac_data_request(&ctxt, &rlc_union_p->rlc.tm); ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data); break; default: ; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_OUT); return ret_tb_size; }
//----------------------------------------------------------------------------- rlc_union_t* rrc_rlc_add_rlc ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP, const rlc_mode_t rlc_modeP) { //----------------------------------------------------------------------------- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; logical_chan_id_t lcid = 0; #endif #ifdef OAI_EMU CHECK_CTXT_ARGS(ctxt_pP) #endif if (MBMS_flagP == FALSE) { AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); } #ifdef Rel10 if (MBMS_flagP == TRUE) { if (ctxt_pP->enb_flag) { lcid = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid]; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0; //LG 2014-04-15rlc_mbms_rbid2lcid_eNB[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED; } else { lcid = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lcid]; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0; //LG 2014-04-15rlc_mbms_rbid2lcid_ue[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED; } key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { LOG_W(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc , already exist %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ"); return rlc_union_p; } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = calloc(1, sizeof(rlc_union_t)); h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p); if (h_rc == HASH_TABLE_OK) { #ifdef Rel10 if (MBMS_flagP == TRUE) { LOG_I(RLC, PROTOCOL_CTXT_FMT" RLC service id %u session id %u rrc_rlc_add_rlc\n", PROTOCOL_CTXT_ARGS(ctxt_pP), mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { LOG_I(RLC, PROTOCOL_CTXT_FMT" [%s %u] rrc_rlc_add_rlc %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } rlc_union_p->mode = rlc_modeP; return rlc_union_p; } else { LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc FAILED %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); free(rlc_union_p); rlc_union_p = NULL; return NULL; } } else { LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc , INTERNAL ERROR %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } return NULL; }
//----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_remove_rlc ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP) { //----------------------------------------------------------------------------- logical_chan_id_t lcid = 0; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; #endif #ifdef OAI_EMU CHECK_CTXT_ARGS(ctxt_pP) #endif #ifdef Rel10 if (MBMS_flagP == TRUE) { if (ctxt_pP->enb_flag) { lcid = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid]; rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0; rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0; rlc_mbms_rbid2lcid_ue[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED; } else { lcid = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lcid]; rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0; rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0; rlc_mbms_rbid2lcid_ue[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED; } key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); } AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { h_rc = hashtable_remove(rlc_coll_p, key); LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] RELEASED %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] RELEASE : RLC NOT FOUND %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] RELEASE : INTERNAL ERROR %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } return RLC_OP_STATUS_OK; }
void config_req_rlc_um_asn1 ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t mbms_flagP, const mbms_session_id_t mbms_session_idP, const mbms_service_id_t mbms_service_idP, const UL_UM_RLC_t * const ul_rlc_pP, const DL_UM_RLC_t * const dl_rlc_pP, const rb_id_t rb_idP) { uint32_t ul_sn_FieldLength = 0; uint32_t dl_sn_FieldLength = 0; uint32_t t_Reordering = 0; rlc_union_t *rlc_union_p = NULL; rlc_um_entity_t *rlc_p = NULL; hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; #if Rel10 if (mbms_flagP) { AssertFatal(dl_rlc_pP, "No RLC UM DL config"); AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present"); key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); rlc_p = &rlc_union_p->rlc.um; } else #endif { key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); rlc_p = &rlc_union_p->rlc.um; } //----------------------------------------------------------------------------- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" CONFIG_REQ timer_reordering=%dms sn_field_length= RB %u \n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), (dl_rlc_pP && dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1, rb_idP); rlc_um_init(ctxt_pP, rlc_p); if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { rlc_um_set_debug_infos(ctxt_pP,rlc_p, srb_flagP, rb_idP); if (ul_rlc_pP != NULL) { switch (ul_rlc_pP->sn_FieldLength) { case SN_FieldLength_size5: ul_sn_FieldLength = 5; break; case SN_FieldLength_size10: ul_sn_FieldLength = 10; break; default: LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID UL sn_FieldLength %d, RLC NOT CONFIGURED\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->rb_id, ul_rlc_pP->sn_FieldLength); MSC_LOG_RX_DISCARDED_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, NULL, 0, MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ UL sn_FieldLength %u", MSC_AS_TIME_ARGS(ctxt_pP), PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), ul_rlc_pP->sn_FieldLength); return; } } if (dl_rlc_pP != NULL) { switch (dl_rlc_pP->sn_FieldLength) { case SN_FieldLength_size5: dl_sn_FieldLength = 5; break; case SN_FieldLength_size10: dl_sn_FieldLength = 10; break; default: LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID DL sn_FieldLength %d, RLC NOT CONFIGURED\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->rb_id, dl_rlc_pP->sn_FieldLength); MSC_LOG_RX_DISCARDED_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, NULL, 0, MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ DL sn_FieldLength %u", MSC_AS_TIME_ARGS(ctxt_pP), PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), dl_rlc_pP->sn_FieldLength); return; } if (dl_rlc_pP->t_Reordering<T_Reordering_spare1) { t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering]; } else { LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID T_Reordering %d, RLC NOT CONFIGURED\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->rb_id, dl_rlc_pP->t_Reordering); MSC_LOG_RX_DISCARDED_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, NULL, 0, MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_Reord %u", MSC_AS_TIME_ARGS(ctxt_pP), PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), dl_rlc_pP->t_Reordering); return; } } if (ctxt_pP->enb_flag > 0) { rlc_um_configure(ctxt_pP,rlc_p, t_Reordering, ul_sn_FieldLength, dl_sn_FieldLength, mbms_flagP); MSC_LOG_RX_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, NULL, 0, MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_Reord %u rx snfl %u tx snfl %u", MSC_AS_TIME_ARGS(ctxt_pP), PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), t_Reordering, ul_sn_FieldLength, dl_sn_FieldLength); } else { rlc_um_configure(ctxt_pP,rlc_p, t_Reordering, dl_sn_FieldLength, ul_sn_FieldLength, mbms_flagP); MSC_LOG_RX_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, NULL, 0, MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_Reord %u rx snfl %u tx snfl %u", MSC_AS_TIME_ARGS(ctxt_pP), PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), t_Reordering, dl_sn_FieldLength, ul_sn_FieldLength); } } }
//----------------------------------------------------------------------------- rlc_union_t* rrc_rlc_add_rlc ( const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t enb_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP, const rlc_mode_t rlc_modeP) { //----------------------------------------------------------------------------- hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE; hashtable_rc_t h_rc; rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; logical_chan_id_t lcid = 0; #endif #ifdef OAI_EMU if (enb_flagP) { AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", enb_mod_idP, oai_emulation.info.first_enb_local); AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", enb_mod_idP, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); AssertFatal (ue_mod_idP < NB_UE_INST, "UE module id is too high (%u/%d)!\n", ue_mod_idP, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", ue_mod_idP, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", ue_mod_idP, oai_emulation.info.first_ue_local); } #endif if (MBMS_flagP == FALSE) { AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); } #ifdef Rel10 if (MBMS_flagP == TRUE) { if (enb_flagP) { lcid = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP); LOG_I(RLC, "[Frame %05u] lcid %d = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP %u, rb_idP %u)\n", frameP,lcid, enb_mod_idP, rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid]; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].service_id = 0; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].session_id = 0; //LG 2014-04-15rlc_mbms_rbid2lcid_eNB[enb_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; } else { lcid = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lcid]; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].service_id = 0; //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].session_id = 0; //LG 2014-04-15rlc_mbms_rbid2lcid_ue[ue_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; } key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { key = RLC_COLL_KEY_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, rb_idP, srb_flagP); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { LOG_W(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc , already exist %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ"); return rlc_union_p; } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = calloc(1, sizeof(rlc_union_t)); h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p); if (h_rc == HASH_TABLE_OK) { #ifdef Rel10 if (MBMS_flagP == TRUE) { LOG_I(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u] RLC service id %u session id %u rrc_rlc_add_rlc\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { LOG_I(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } rlc_union_p->mode = rlc_modeP; return rlc_union_p; } else { LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc FAILED %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); free(rlc_union_p); rlc_union_p = NULL; return NULL; } } else { LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc , INTERNAL ERROR %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } return NULL; }
//----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_remove_rlc ( const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t enb_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP) { //----------------------------------------------------------------------------- logical_chan_id_t lcid = 0; hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE; hashtable_rc_t h_rc; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; #endif #ifdef OAI_EMU AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", enb_mod_idP, oai_emulation.info.first_enb_local); AssertFatal (enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local), "eNB module id is too high (%u/%d)!\n", enb_mod_idP, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); if (enb_flagP) { AssertFatal (ue_mod_idP < NB_UE_INST, "UE module id is too high (%u/%d)!\n", ue_mod_idP, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", ue_mod_idP, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", ue_mod_idP, oai_emulation.info.first_ue_local); } #endif #ifdef Rel10 if (MBMS_flagP == TRUE) { if (enb_flagP) { lcid = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid]; rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].service_id = 0; rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].session_id = 0; rlc_mbms_rbid2lcid_ue[enb_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; } else { lcid = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP); mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lcid]; rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].service_id = 0; rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].session_id = 0; rlc_mbms_rbid2lcid_ue[ue_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; } key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { key = RLC_COLL_KEY_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, rb_idP, srb_flagP); } AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); h_rc = hashtable_remove(rlc_coll_p, key); if (h_rc == HASH_TABLE_OK) { LOG_D(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASED %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { LOG_W(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASE : RLC NOT FOUND %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } else { LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASE : INTERNAL ERROR %s\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } return RLC_OP_STATUS_OK; }