diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 856dcd6152..238ee77275 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -102,16 +102,12 @@ ngran_node_t get_node_type() return ngran_gNB_CUUP; } -rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const pc, - const srb_flag_t sf, - const MBMS_flag_t mf, - const rb_id_t rb_id, - const mui_t mui, - const confirm_t c, - const sdu_size_t size, - uint8_t *const buf, - const uint32_t *const a, - const uint32_t *const b) +rlc_op_status_t nr_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP) { abort(); return 0; @@ -123,16 +119,6 @@ int nr_rlc_get_available_tx_space(const rnti_t rntiP, const logical_chan_id_t ch return 0; } -void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig) -{ - abort(); -} - -void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp) -{ - abort(); -} - f1ap_cudu_inst_t *getCxt(instance_t instanceP) { // the E1 module uses F1's getCxt() to decide whether there is F1-U and if @@ -146,8 +132,6 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP) } configmodule_interface_t *uniqCfg = NULL; -void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t gNB_ue_ngap_id) { }; - int main(int argc, char **argv) { /// static configuration for NR at the moment diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 2ba05ae200..c0142ce896 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -75,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include #include #include - +#include "nr_rlc/nr_rlc_oai_api.h" /* Callbacks, globals and object handlers */ //#include "stats.h" @@ -313,7 +313,7 @@ static void init_pdcp(int ue_id) // was always set. further refactoring could take it out pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; - if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) { + if (get_softmodem_params()->nsa && nr_rlc_module_init(0) != 0) { LOG_I(RLC, "Problem at RLC initiation \n"); } nr_pdcp_layer_init(); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index cf85961ff5..bfdeecf4e5 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -150,12 +150,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id nr_pdcp_data_ind(&ctxt, 1, // srb_flag - 0, // embms_flag msg.srb_id, msg.rrc_container_length, - mb, - NULL, - NULL); + mb); /* Free UL RRC Message Transfer */ free_ul_rrc_message_transfer(&msg); return 0; diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 8df19c7139..6c744e8275 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -38,7 +38,6 @@ #include "nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR_UE/rrc_proto.h" #include -#include "openair2/LAYER2/RLC/rlc.h" static NR_UE_MAC_INST_t *nr_ue_mac_inst; void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data) @@ -141,7 +140,7 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst) ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology)); } - int rc = rlc_module_init(0); + int rc = nr_rlc_module_init(0); AssertFatal(rc == 0, "Could not initialize RLC layer\n"); for (int j = 0; j < nb_inst; j++) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index c945408319..b7dc9cf7a9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -37,7 +37,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" #include -#include "openair2/LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" int16_t get_prach_tx_power(NR_UE_MAC_INST_t *mac) { @@ -1105,17 +1105,12 @@ static uint8_t *fill_msg3_pdu_from_rlc(NR_UE_MAC_INST_t *mac, uint8_t *pdu, int // regular Msg3/MsgA_PUSCH with PDU coming from higher layers *(NR_MAC_SUBHEADER_FIXED *)pdu = (NR_MAC_SUBHEADER_FIXED){.LCID = UL_SCH_LCID_CCCH_48_BITS}; pdu += sizeof(NR_MAC_SUBHEADER_FIXED); - tbs_size_t len = mac_rlc_data_req(mac->ue_id, - mac->ue_id, - 0, - 0, - ENB_FLAG_NO, - MBMS_FLAG_NO, - 0, // SRB0 for messages sent in MSG3 - TBS_max - sizeof(NR_MAC_SUBHEADER_FIXED), /* size of mac_ce above */ - (char *)pdu, - 0, - 0); + tbs_size_t len = nr_mac_rlc_data_req(mac->ue_id, + mac->ue_id, + false, + 0, // SRB0 for messages sent in MSG3 + TBS_max - sizeof(NR_MAC_SUBHEADER_FIXED), /* size of mac_ce above */ + (char *)pdu); AssertFatal(len > 0, "no data for Msg3/MsgA_PUSCH\n"); // UE Contention Resolution Identity // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 94fb077fe2..20745a5e25 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -54,7 +54,7 @@ #include "oai_asn1.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#include "openair2/LAYER2/RLC/rlc.h" +#include "LAYER2/nr_rlc/nr_rlc_oai_api.h" // #define DEBUG_MIB // #define ENABLE_MAC_PAYLOAD_DEBUG 1 @@ -3613,17 +3613,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i if (mac_len > 0) { LOG_DDUMP(NR_MAC, (void *)pduP, mac_subheader_len + mac_len, LOG_DUMP_CHAR, "DL_SCH_LCID_CCCH (e.g. RRCSetup) payload: "); - mac_rlc_data_ind(mac->ue_id, - mac->ue_id, - gNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, - 0, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, rx_lcid, (char *)(pduP + mac_subheader_len), mac_len); } break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: @@ -3738,18 +3728,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) return; LOG_D(NR_MAC, "%4d.%2d : DLSCH -> LCID %d %d bytes\n", frameP, slot, rx_lcid, mac_len); - - mac_rlc_data_ind(mac->ue_id, - mac->ue_id, - gNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, - rx_lcid, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, rx_lcid, (char *)(pduP + mac_subheader_len), mac_len); break; default: LOG_W(MAC, "unknown lcid %02x\n", rx_lcid); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 3c18360d21..638e79e3c9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -47,7 +47,7 @@ #include "utils.h" #include -#include "LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR_UE/L2_interface_ue.h" //#define SRS_DEBUG @@ -1268,8 +1268,7 @@ static void nr_update_rlc_buffers_status(NR_UE_MAC_INST_t *mac, frame_t frameP, nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i]; int lcid = lc_info->lcid; NR_LC_SCHEDULING_INFO *lc_sched_info = get_scheduling_info_from_lcid(mac, lcid); - mac_rlc_status_resp_t rlc_status = - mac_rlc_status_ind(mac->ue_id, mac->ue_id, gNB_index, frameP, slotP, ENB_FLAG_NO, MBMS_FLAG_NO, lcid, 0, 0); + mac_rlc_status_resp_t rlc_status = nr_mac_rlc_status_ind(mac->ue_id, frameP, lcid); if (rlc_status.bytes_in_buffer > 0) { LOG_D(NR_MAC, @@ -2589,17 +2588,12 @@ static bool fill_mac_sdu(NR_UE_MAC_INST_t *mac, &target); header_sz = bytes_requested < 256 ? sizeof(NR_MAC_SUBHEADER_SHORT) : sizeof(NR_MAC_SUBHEADER_LONG); - uint16_t sdu_length = mac_rlc_data_req(mac->ue_id, - mac->ue_id, - gNB_index, - frame, - ENB_FLAG_NO, - MBMS_FLAG_NO, - lcid, - bytes_requested, - (char *)mac_ce_p->cur_ptr + header_sz, - 0, - 0); + uint16_t sdu_length = nr_mac_rlc_data_req(mac->ue_id, + mac->ue_id, + false, + lcid, + bytes_requested, + (char *)mac_ce_p->cur_ptr + header_sz); AssertFatal(bytes_requested >= sdu_length, "LCID = 0x%02x RLC has segmented %d bytes but MAC has max %li remaining bytes\n", diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp index 25ea5edcd0..f7fc520d06 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp @@ -35,17 +35,12 @@ void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success) void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_payload) { } -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, - const tb_size_t tb_sizeP, - char *buffer_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) +tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP) { return 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 3a64ac16c9..147b8abc6c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -42,7 +42,6 @@ /* rlc */ #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "openair2/LAYER2/RLC/rlc.h" #include @@ -1880,12 +1879,12 @@ static void nr_generate_Msg4_MsgB(module_id_t module_idP, logical_chan_id_t lcid = DL_SCH_LCID_CCCH; if (current_harq_pid < 0) { // Check for data on SRB0 (RRCSetup) - mac_rlc_status_resp_t srb_status = mac_rlc_status_ind(module_idP, ra->rnti, module_idP, frameP, slotP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, 0, 0); + mac_rlc_status_resp_t srb_status = nr_mac_rlc_status_ind(ra->rnti, frameP, lcid); if (srb_status.bytes_in_buffer == 0) { lcid = DL_SCH_LCID_DCCH; // Check for data on SRB1 (RRCReestablishment, RRCReconfiguration) - srb_status = mac_rlc_status_ind(module_idP, ra->rnti, module_idP, frameP, slotP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, 0, 0); + srb_status = nr_mac_rlc_status_ind(ra->rnti, frameP, lcid); } // Need to wait until data for Msg4 is ready @@ -2051,17 +2050,7 @@ static void nr_generate_Msg4_MsgB(module_id_t module_idP, uint8_t buffer[CCCH_SDU_SIZE]; uint8_t mac_subheader_len = sizeof(NR_MAC_SUBHEADER_SHORT); // Get RLC data on the SRB (RRCSetup, RRCReestablishment) - mac_sdu_length = mac_rlc_data_req(module_idP, - ra->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - CCCH_SDU_SIZE, - (char *)buffer, - 0, - 0); + mac_sdu_length = nr_mac_rlc_data_req(module_idP, ra->rnti, true, lcid, CCCH_SDU_SIZE, (char *)buffer); if (mac_sdu_length < 256) { ((NR_MAC_SUBHEADER_SHORT *)&buf[mac_pdu_length])->R = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 39aae6db49..2a5b979f5a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -34,7 +34,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_gNB/nr_mac_gNB.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" -#include "LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" /*TAG*/ #include "NR_TAG-Id.h" @@ -338,16 +338,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, slot_t s if (lcid == DL_SCH_LCID_DTCH && nr_timer_is_active(&sched_ctrl->transm_interrupt)) continue; start_meas(&RC.nrmac[module_id]->rlc_status_ind); - sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - 0, - 0); + sched_ctrl->rlc_status[lcid] = nr_mac_rlc_status_ind(rnti, frame, lcid); stop_meas(&RC.nrmac[module_id]->rlc_status_ind); if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) @@ -1300,17 +1291,12 @@ void nr_schedule_ue_spec(module_id_t module_id, * such that TBS is full */ const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG)); - tbs_size_t len = mac_rlc_data_req(module_id, - rnti, - module_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - ndata, - (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG), - 0, - 0); + tbs_size_t len = nr_mac_rlc_data_req(module_id, + rnti, + true, + lcid, + ndata, + (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG)); LOG_D(NR_MAC, "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %ld)\n", frame, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 36b9a5fd39..55d9738938 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -33,7 +33,7 @@ #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "executables/nr-softmodem.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h" -#include "LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "executables/softmodem-common.h" #include "common/utils/nr/nr_common.h" @@ -129,16 +129,7 @@ void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, slot_t slot) const uint16_t rnti = UE->rnti; /* update sched_ctrl->num_total_bytes so that postprocessor schedules data, * if available */ - sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - 0, - 0); + sched_ctrl->rlc_status[lcid] = nr_mac_rlc_status_ind(rnti, frame, lcid); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; int CCEIndex = get_cce_index(mac, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index e1a48d6002..b6e86fa6b7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -35,7 +35,6 @@ #include "utils.h" #include #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "LAYER2/RLC/rlc.h" //#define SRS_IND_DEBUG @@ -354,17 +353,7 @@ static int nr_process_mac_pdu(instance_t module_idP, } if (prepare_initial_ul_rrc_message(RC.nrmac[module_idP], UE)) { - mac_rlc_data_ind(module_idP, - UE->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - 0, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(module_idP, UE->rnti, true, 0, (char *)(pduP + mac_subheader_len), mac_len); } else { LOG_E(NR_MAC, "prepare_initial_ul_rrc_message() returned false, cannot forward CCCH message\n"); } @@ -379,17 +368,7 @@ static int nr_process_mac_pdu(instance_t module_idP, slot, lcid); - mac_rlc_data_ind(module_idP, - UE->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(module_idP, UE->rnti, true, lcid, (char *)(pduP + mac_subheader_len), mac_len); UE->mac_stats.ul.total_sdu_bytes += mac_len; UE->mac_stats.ul.lc_bytes[lcid] += mac_len; @@ -407,17 +386,7 @@ static int nr_process_mac_pdu(instance_t module_idP, mac_len); UE->mac_stats.ul.lc_bytes[lcid] += mac_len; - mac_rlc_data_ind(module_idP, - UE->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(module_idP, UE->rnti, true, lcid, (char *)(pduP + mac_subheader_len), mac_len); sdus += 1; /* Updated estimated buffer when receiving data */ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index f92559c4ee..25a182dddb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -90,7 +90,7 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue uint8_t *sdu = malloc16(sdu_buffer_sizeP); memcpy(sdu, sdu_buffer_pP, sdu_buffer_sizeP); - du_rlc_data_req(ctxt_pP, srb_flagP, false, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu); + du_rlc_data_req(ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu); return true; } diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index ccf812c751..1d9bb3245d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -65,7 +65,6 @@ #include "nr_pdcp/nr_pdcp_oai_api.h" #include "nr_rlc/nr_rlc_oai_api.h" #include "openair2/F1AP/f1ap_ids.h" -#include "rlc.h" #include "seq_arr.h" #include "system.h" #include "time_meas.h" @@ -303,7 +302,7 @@ void mac_top_init_gNB(ngran_node_t node_type, mac_rrc_init(RC.nrmac[i], node_type); }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) - AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); + AssertFatal(nr_rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); // These should be out of here later if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(); diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 39471ebbee..9afad74714 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -71,38 +71,6 @@ typedef enum rlc_confirm_e { RLC_SDU_CONFIRM_YES = 1, } rlc_confirm_t; -//----------------------------------------------------------------------------- -// PRIVATE INTERNALS OF RLC -//----------------------------------------------------------------------------- - -#define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) -#define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) - -extern void (*rlc_rrc_data_ind)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - const uint8_t *const sduP) __attribute__ ((aligned(32))); - -extern void (*rlc_rrc_data_conf)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const mui_t muiP, - const rlc_tx_status_t statusP) __attribute__ ((aligned(32))); - -typedef void (rrc_data_ind_cb_t)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - const uint8_t *const sduP); - -typedef void (rrc_data_conf_cb_t)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const mui_t muiP, - const rlc_tx_status_t statusP); - - //----------------------------------------------------------------------------- // PUBLIC INTERFACE WITH RRC //----------------------------------------------------------------------------- @@ -416,25 +384,4 @@ rlc_op_status_t rlc_stat_req ( int rlc_module_init(int enb_flag); /** @} */ -#define RLC_FG_COLOR_BLACK "\e[0;30m" -#define RLC_FG_COLOR_RED "\e[0;31m" -#define RLC_FG_COLOR_GREEN "\e[0;32m" -#define RLC_FG_COLOR_ORANGE "\e[0;33m" -#define RLC_FG_COLOR_BLUE "\e[0;34m" -#define RLC_FG_COLOR_MAGENTA "\e[0;35m" -#define RLC_FG_COLOR_CYAN "\e[0;36m" -#define RLC_FG_COLOR_GRAY_BLACK "\e[0;37m" -#define RLC_FG_COLOR_DEFAULT "\e[0;39m" -#define RLC_FG_BRIGHT_COLOR_DARK_GRAY "\e[1;30m" -#define RLC_FG_BRIGHT_COLOR_RED "\e[1;31m" -#define RLC_FG_BRIGHT_COLOR_GREEN "\e[1;32m" -#define RLC_FG_BRIGHT_COLOR_YELLOW "\e[1;33m" -#define RLC_FG_BRIGHT_COLOR_BLUE "\e[1;34m" -#define RLC_FG_BRIGHT_COLOR_MAGENTA "\e[1;35m" -#define RLC_FG_BRIGHT_COLOR_CYAN "\e[1;36m" -#define RLC_FG_BRIGHT_COLOR_WHITE "\e[1;37m" -#define RLC_FG_BRIGHT_COLOR_DEFAULT "\e[0;39m" -#define RLC_REVERSE_VIDEO "\e[7m" -#define RLC_NORMAL_VIDEO "\e[27m" - #endif diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 54880e828a..d8b706520e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -64,7 +64,7 @@ #include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "pdcp.h" #include "pdcp_messages_types.h" -#include "rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "utils.h" #define TODO do { \ @@ -127,7 +127,6 @@ nr_pdcp_entity_t *nr_pdcp_get_rb(nr_pdcp_ue_t *ue, int rb_id, bool srb_flag) typedef struct { protocol_ctxt_t ctxt_pP; srb_flag_t srb_flagP; - MBMS_flag_t MBMS_flagP; rb_id_t rb_idP; mui_t muiP; confirm_t confirmP; @@ -159,16 +158,12 @@ static void *rlc_data_req_thread(void *_) i = q.start; if (pthread_mutex_unlock(&q.m) != 0) abort(); - rlc_data_req(&q.q[i].ctxt_pP, - q.q[i].srb_flagP, - q.q[i].MBMS_flagP, - q.q[i].rb_idP, - q.q[i].muiP, - q.q[i].confirmP, - q.q[i].sdu_sizeP, - q.q[i].sdu_pP, - NULL, - NULL); + nr_rlc_data_req(&q.q[i].ctxt_pP, + q.q[i].srb_flagP, + q.q[i].rb_idP, + q.q[i].muiP, + q.q[i].sdu_sizeP, + q.q[i].sdu_pP); if (pthread_mutex_lock(&q.m) != 0) abort(); @@ -195,7 +190,6 @@ static void init_nr_rlc_data_req_queue(void) static void enqueue_rlc_data_req(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 mui_t muiP, confirm_t confirmP, @@ -219,7 +213,6 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, q.q[i].ctxt_pP = *ctxt_pP; q.q[i].srb_flagP = srb_flagP; - q.q[i].MBMS_flagP = MBMS_flagP; q.q[i].rb_idP = rb_idP; q.q[i].muiP = muiP; q.q[i].confirmP = confirmP; @@ -232,7 +225,6 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, void du_rlc_data_req(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 mui_t muiP, confirm_t confirmP, @@ -241,7 +233,6 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, { enqueue_rlc_data_req(ctxt_pP, srb_flagP, - MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, @@ -259,7 +250,6 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, typedef struct { protocol_ctxt_t ctxt_pP; srb_flag_t srb_flagP; - MBMS_flag_t MBMS_flagP; rb_id_t rb_id; sdu_size_t sdu_buffer_size; uint8_t *sdu_buffer; @@ -279,7 +269,6 @@ static pdcp_data_ind_queue pq; static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, uint8_t *const sdu_buffer) @@ -329,7 +318,6 @@ static void *pdcp_data_ind_thread(void *_) do_pdcp_data_ind(&pq.q[i].ctxt_pP, pq.q[i].srb_flagP, - pq.q[i].MBMS_flagP, pq.q[i].rb_id, pq.q[i].sdu_buffer_size, pq.q[i].sdu_buffer); @@ -359,7 +347,6 @@ static void init_nr_pdcp_data_ind_queue(void) static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, uint8_t *const sdu_buffer) @@ -381,7 +368,6 @@ static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, pq.q[i].ctxt_pP = *ctxt_pP; pq.q[i].srb_flagP = srb_flagP; - pq.q[i].MBMS_flagP = MBMS_flagP; pq.q[i].rb_id = rb_id; pq.q[i].sdu_buffer_size = sdu_buffer_size; pq.q[i].sdu_buffer = sdu_buffer; @@ -392,19 +378,11 @@ static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - uint8_t *const sdu_buffer, - const uint32_t *const srcID, - const uint32_t *const dstID) + uint8_t *const sdu_buffer) { - enqueue_pdcp_data_ind(ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_id, - sdu_buffer_size, - sdu_buffer); + enqueue_pdcp_data_ind(ctxt_pP, srb_flagP, rb_id, sdu_buffer_size, sdu_buffer); return true; } @@ -583,12 +561,6 @@ static void set_node_type() { node_type = get_node_type(); } -/* hack: dummy function needed due to LTE dependencies */ -void pdcp_layer_init(void) -{ - abort(); -} - void nr_pdcp_layer_init(void) { /* hack: be sure to initialize only once */ @@ -717,7 +689,7 @@ static void deliver_pdu_drb_ue(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, uint8_t *memblock = malloc16(size); memcpy(memblock, buf, size); LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d UE %ld/%04lx\n", __func__, rb_id, size, ctxt.rntiMaybeUEid, ctxt.rntiMaybeUEid); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + enqueue_rlc_data_req(&ctxt, 0, rb_id, sdu_id, 0, size, memblock); } static void deliver_pdu_drb_gnb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, @@ -735,7 +707,7 @@ static void deliver_pdu_drb_gnb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id uint8_t *memblock = malloc16(size); memcpy(memblock, buf, size); LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + enqueue_rlc_data_req(&ctxt, 0, rb_id, sdu_id, 0, size, memblock); } } @@ -794,7 +766,7 @@ void deliver_pdu_srb_rlc(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, protocol_ctxt_t ctxt = { .enb_flag = 1, .rntiMaybeUEid = ue_id }; uint8_t *memblock = malloc16(size); memcpy(memblock, buf, size); - enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock); + enqueue_rlc_data_req(&ctxt, 1, srb_id, sdu_id, 0, size, memblock); } void add_srb(int is_gnb, @@ -966,32 +938,11 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, LOG_W(PDCP, "nr_pdcp_add_drbs() with void list\n"); } -/* Dummy function due to dependency from LTE libraries */ -bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, - LTE_SRB_ToAddModList_t *const srb2add_list, - LTE_DRB_ToAddModList_t *const drb2add_list, - LTE_DRB_ToReleaseList_t *const drb2release_list, - const uint8_t security_modeP, - uint8_t *const kRRCenc, - uint8_t *const kRRCint, - uint8_t *const kUPenc, - LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9, - rb_id_t *const defaultDRB) -{ - return 0; -} - uint64_t get_pdcp_optmask(void) { return pdcp_optmask; } -/* hack: dummy function needed due to LTE dependencies */ -bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP) -{ - abort(); -} - void nr_pdcp_remove_UE(ue_id_t ue_id) { nr_pdcp_manager_lock(nr_pdcp_ue_manager); @@ -999,19 +950,6 @@ void nr_pdcp_remove_UE(ue_id_t ue_id) nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } -/* hack: dummy function needed due to LTE dependencies */ -void pdcp_config_set_security(const protocol_ctxt_t *const ctxt_pP, - pdcp_t *const pdcp_pP, - const rb_id_t rb_id, - const uint16_t lc_idP, - const uint8_t security_modeP, - uint8_t *const kRRCenc_pP, - uint8_t *const kRRCint_pP, - uint8_t *const kUPenc_pP) -{ - abort(); -} - void nr_pdcp_config_set_security(ue_id_t ue_id, rb_id_t rb_id, bool is_srb, @@ -1315,7 +1253,7 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP, exit(1); } memcpy(memblock, sdu_buffer, sdu_buffer_size); - int ret = nr_pdcp_data_ind(ctxt_pP, srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); + int ret = nr_pdcp_data_ind(ctxt_pP, srb_flagP, rb_id, sdu_buffer_size, memblock); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ @@ -1323,28 +1261,6 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP, return ret; } -/* hack: dummy function needed due to LTE dependencies */ -bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id) -{ - abort(); - return false; -} - -//Dummy function needed due to LTE dependencies -void -pdcp_mbms_run ( const protocol_ctxt_t *const ctxt_pP){ - /* nothing to do */ -} - void nr_pdcp_tick(int frame, int subframe) { if (frame != nr_pdcp_current_time_last_frame || diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index bdeb01fff1..a60cd869af 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -39,7 +39,6 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id); void du_rlc_data_req(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 mui_t muiP, confirm_t confirmP, @@ -48,12 +47,9 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - uint8_t *const sdu_buffer, - const uint32_t *const srcID, - const uint32_t *const dstID); + uint8_t *const sdu_buffer); void nr_pdcp_add_drbs(eNB_flag_t enb_flag, ue_id_t UEid, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index bffb064159..4b7202f6fd 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -162,26 +162,15 @@ void nr_rlc_release_entity(int ue_id, logical_chan_id_t channel_id) nr_rlc_manager_unlock(nr_rlc_ue_manager); } -void mac_rlc_data_ind(const module_id_t module_idP, - const uint16_t ue_id, - 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, - const tb_size_t tb_sizeP, - num_tb_t num_tbP, - crc_t *crcs_pP) +void nr_mac_rlc_data_ind(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + char *buffer_pP, + const tb_size_t tb_sizeP) { - if (eNB_index != 0 || /*enb_flagP != 1 ||*/ MBMS_flagP != 0) { - LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - - if (enb_flagP) - T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(ue_id), - T_INT(channel_idP), T_INT(tb_sizeP)); + if (gnb_flagP) + T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(ue_id), T_INT(channel_idP), T_INT(tb_sizeP)); nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id); @@ -203,17 +192,12 @@ void mac_rlc_data_ind(const module_id_t module_idP, nr_rlc_manager_unlock(nr_rlc_ue_manager); } -tbs_size_t mac_rlc_data_req(const module_id_t module_idP, - const uint16_t ue_id, - 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, - char *buffer_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) +tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP) { int ret; int maxsize; @@ -234,23 +218,14 @@ tbs_size_t mac_rlc_data_req(const module_id_t module_idP, nr_rlc_manager_unlock(nr_rlc_ue_manager); - if (enb_flagP) + if (gnb_flagP) T(T_ENB_RLC_MAC_DL, T_INT(module_idP), T_INT(ue_id), T_INT(channel_idP), T_INT(ret)); return ret; } -mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, - const uint16_t ue_id, - const eNB_index_t eNB_index, - const frame_t frameP, - const sub_frame_t subframeP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) +mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t frame, const logical_chan_id_t channel_idP) { mac_rlc_status_resp_t ret; @@ -266,12 +241,10 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, * more than enough. */ // Fix me: temproary reduction meanwhile cpu cost of this computation is optimized - buf_stat = rb->buffer_status(rb, 1000*1000); - ret.bytes_in_buffer = buf_stat.status_size - + buf_stat.retx_size - + buf_stat.tx_size; + buf_stat = rb->buffer_status(rb, 1000 * 1000); + ret.bytes_in_buffer = buf_stat.status_size + buf_stat.retx_size + buf_stat.tx_size; } else { - if (!(frameP%128) || channel_idP == 0) //to suppress this warning message + if (!(frame % 128) || channel_idP == 0) //to suppress this warning message LOG_W(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id); ret.bytes_in_buffer = 0; } @@ -286,76 +259,18 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, return ret; } -rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module_idP, - const uint16_t ue_id, - const eNB_index_t eNB_index, - const frame_t frameP, - const sub_frame_t subframeP, - const eNB_flag_t enb_flagP, - const logical_chan_id_t channel_idP) -{ - rlc_buffer_occupancy_t ret; - - if (enb_flagP) { - LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP); - exit(1); - } - - /* TODO: handle time a bit more properly */ - lock_nr_rlc_current_time(); - if (nr_rlc_current_time_last_frame != frameP || - nr_rlc_current_time_last_subframe != subframeP) { - nr_rlc_current_time++; - nr_rlc_current_time_last_frame = frameP; - nr_rlc_current_time_last_subframe = subframeP; - } - unlock_nr_rlc_current_time(); - - nr_rlc_manager_lock(nr_rlc_ue_manager); - nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id); - nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP); - - if (rb != NULL) { - nr_rlc_entity_buffer_status_t buf_stat; - rb->set_time(rb, get_nr_rlc_current_time()); - /* 38.321 deals with BSR values up to 81338368 bytes, after what it - * reports '> 81338368' (table 6.1.3.1-2). Passing 100000000 is thus - * more than enough. - */ - // Fixme : Laurent reduced size for CPU saving - // Fix me: temproary reduction meanwhile cpu cost of this computation is optimized - buf_stat = rb->buffer_status(rb, 1000*1000); - ret = buf_stat.status_size - + buf_stat.retx_size - + buf_stat.tx_size; - } else { - if (!(frameP%128)) //to suppress this warning message - LOG_W(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id); - ret = 0; - } - - nr_rlc_manager_unlock(nr_rlc_ue_manager); - - return ret; -} - -rlc_op_status_t rlc_data_req(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 mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - uint8_t *sdu_pP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id) +rlc_op_status_t nr_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP) { int ue_id = ctxt_pP->rntiMaybeUEid; nr_rlc_ue_t *ue; nr_rlc_entity_t *rb; - LOG_D(RLC, "UE %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n", - ue_id, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP, MBMS_flagP); + LOG_D(RLC, "UE %d srb_flag %d rb_id %ld mui %d sdu_size %d\n", ue_id, srb_flagP, rb_idP, muiP, sdu_sizeP); if (ctxt_pP->enb_flag) T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP)); @@ -407,7 +322,7 @@ int nr_rlc_get_available_tx_space(const int ue_id, const logical_chan_id_t chann return ret; } -int rlc_module_init(int enb_flag) +int nr_rlc_module_init(int gnb_flag) { static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static int inited = 0; @@ -415,30 +330,28 @@ int rlc_module_init(int enb_flag) if (pthread_mutex_lock(&lock)) abort(); - if (enb_flag == 1 && inited) { + if (gnb_flag == 1 && inited) { LOG_E(RLC, "%s:%d:%s: fatal, inited already 1\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - if (enb_flag == 0 && inited_ue) { + if (gnb_flag == 0 && inited_ue) { LOG_E(RLC, "%s:%d:%s: fatal, inited_ue already 1\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - if (enb_flag == 1) inited = 1; - if (enb_flag == 0) inited_ue = 1; + if (gnb_flag == 1) + inited = 1; + if (gnb_flag == 0) + inited_ue = 1; - nr_rlc_ue_manager = new_nr_rlc_ue_manager(enb_flag); + nr_rlc_ue_manager = new_nr_rlc_ue_manager(gnb_flag); if (pthread_mutex_unlock(&lock)) abort(); return 0; } -void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) -{ -} - static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) { nr_rlc_ue_t *ue = _ue; @@ -447,7 +360,6 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) protocol_ctxt_t ctx; uint8_t *memblock; int i; - int is_enb; /* is it SRB? */ for (i = 0; i < sizeofArray(ue->srb); i++) { @@ -480,21 +392,21 @@ rb_found: ctx.eNB_index = 0; ctx.brOption = 0; - is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager); + int is_gnb = nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager); /* used fields? */ ctx.module_id = 0; /* CU (PDCP, RRC, SDAP) use a different ID than RNTI, so below set the CU UE * ID if in gNB, else use RNTI normally */ ctx.rntiMaybeUEid = ue->ue_id; - if (is_enb) { + if (is_gnb) { f1_ue_data_t ue_data = du_get_f1_ue_data(ue->ue_id); ctx.rntiMaybeUEid = ue_data.secondary_ue; } - ctx.enb_flag = is_enb; + ctx.enb_flag = is_gnb; - if (is_enb) { + if (is_gnb) { T(T_ENB_RLC_UL, T_INT(0 /*ctxt_pP->module_id*/), T_INT(ue->ue_id), T_INT(rb_id), T_INT(size)); @@ -511,22 +423,22 @@ rb_found: if (NODE_IS_DU(type)) { if(is_srb) { - MessageDef *msg; - msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); - uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); - memcpy (message_buffer, buf, size); + MessageDef *msg; + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); + uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); + memcpy (message_buffer, buf, size); F1AP_UL_RRC_MESSAGE(msg).gNB_CU_ue_id = ctx.rntiMaybeUEid; - F1AP_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = ue->ue_id; - F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; - F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); - return; + F1AP_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = ue->ue_id; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); + return; } else { - LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - extern instance_t DUuniqInstance; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + extern instance_t DUuniqInstance; gtpv1uSendDirect(DUuniqInstance, ue->ue_id, rb_id, (uint8_t*) buf, size, false, false); - return; + return; } } } @@ -539,7 +451,7 @@ rb_found: } memcpy(memblock, buf, size); LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__); - if (!nr_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) { + if (!nr_pdcp_data_ind(&ctx, is_srb, rb_id, size, memblock)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ } @@ -554,7 +466,6 @@ static void successful_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id) #if 0 MessageDef *msg; #endif - int is_enb; /* is it SRB? */ for (i = 0; i < 2; i++) { @@ -587,8 +498,8 @@ rb_found: if (is_srb == 0) return; - is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager); - if (!is_enb) + int is_gnb = nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager); + if (!is_gnb) return; #if 0 @@ -944,18 +855,6 @@ void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_Bear LOG_I(RLC, "Added DRB to UE %d\n", ue_id); } -/* Dummy function due to dependency from LTE libraries */ -rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, - const LTE_SRB_ToAddModList_t * const srb2add_listP, - const LTE_DRB_ToAddModList_t * const drb2add_listP, - const LTE_DRB_ToReleaseList_t * const drb2release_listP, - const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) -{ - return 0; -} - struct srb0_data { int ue_id; void *data; @@ -996,61 +895,6 @@ bool nr_rlc_activate_srb0(int ue_id, return true; } -rlc_op_status_t rrc_rlc_config_req(const protocol_ctxt_t* const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t mbms_flagP, - const config_action_t actionP, - const rb_id_t rb_idP) -{ - if (mbms_flagP) { - LOG_E(RLC, "%s:%d:%s: todo (MBMS NOT supported)\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - if (actionP != CONFIG_ACTION_REMOVE) { - LOG_E(RLC, "%s:%d:%s: todo (only CONFIG_ACTION_REMOVE supported)\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - if (ctxt_pP->module_id) { - LOG_E(RLC, "%s:%d:%s: todo (only module_id 0 supported)\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - if ((srb_flagP && !(rb_idP >= 1 && rb_idP <= 2)) || - (!srb_flagP && !(rb_idP >= 1 && rb_idP <= MAX_DRBS_PER_UE))) { - LOG_E(RLC, "%s:%d:%s: bad rb_id (%ld) (is_srb %d)\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP); - exit(1); - } - nr_rlc_manager_lock(nr_rlc_ue_manager); - LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE %lx\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); - nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); - if (srb_flagP) { - if (ue->srb[rb_idP-1] != NULL) { - ue->srb[rb_idP-1]->delete_entity(ue->srb[rb_idP-1]); - ue->srb[rb_idP-1] = NULL; - } else - LOG_W(RLC, "removing non allocated SRB %ld, do nothing\n", rb_idP); - } else { - if (ue->drb[rb_idP-1] != NULL) { - ue->drb[rb_idP-1]->delete_entity(ue->drb[rb_idP-1]); - ue->drb[rb_idP-1] = NULL; - } else - LOG_W(RLC, "removing non allocated DRB %ld, do nothing\n", rb_idP); - } - /* remove UE if it has no more RB configured */ - int i; - for (i = 0; i < 2; i++) - if (ue->srb[i] != NULL) - break; - if (i == 2) { - for (i = 0; i < MAX_DRBS_PER_UE; i++) - if (ue->drb[i] != NULL) - break; - if (i == MAX_DRBS_PER_UE) - nr_rlc_manager_remove_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); - } - nr_rlc_manager_unlock(nr_rlc_ue_manager); - return RLC_OP_STATUS_OK; -} - void nr_rlc_remove_ue(int ue_id) { LOG_W(RLC, "Remove UE %d\n", ue_id); @@ -1124,16 +968,6 @@ void nr_rlc_tick(int frame, int subframe) unlock_nr_rlc_current_time(); } -/* This is a hack, to compile the gNB. - * TODO: remove it. The solution is to cleanup CMakeLists.txt - */ -void rlc_tick(int a, int b) -{ - LOG_E(RLC, "%s:%d:%s: this code should not be reached\n", - __FILE__, __LINE__, __FUNCTION__); - exit(1); -} - void nr_rlc_activate_avg_time_to_tx(const int ue_id, const logical_chan_id_t channel_id, const bool is_on) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 10182f3793..700a29d702 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -41,6 +41,27 @@ struct NR_RLC_Config; struct NR_LogicalChannelConfig; +int nr_rlc_module_init(int gnb_flag); +void nr_mac_rlc_data_ind(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + char *buffer_pP, + const tb_size_t tb_sizeP); +tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP); +rlc_op_status_t nr_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP); +mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t frame, const logical_chan_id_t channel_idP); + void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c index 0ae270ae0f..52e0f6a6b8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c @@ -31,10 +31,10 @@ typedef struct { pthread_mutex_t lock; nr_rlc_ue_t **ue_list; int ue_count; - int enb_flag; + int gnb_flag; } nr_rlc_ue_manager_internal_t; -nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag) +nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag) { nr_rlc_ue_manager_internal_t *ret; @@ -45,15 +45,15 @@ nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag) } if (pthread_mutex_init(&ret->lock, NULL)) abort(); - ret->enb_flag = enb_flag; + ret->gnb_flag = gnb_flag; return ret; } -int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *_m) +int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *_m) { nr_rlc_ue_manager_internal_t *m = _m; - return m->enb_flag; + return m->gnb_flag; } void nr_rlc_manager_lock(nr_rlc_ue_manager_t *_m) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index 13f5c55a2f..799d7afca8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -52,9 +52,9 @@ typedef struct nr_rlc_ue_t { /* manager functions */ /***********************************************************************/ -nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag); +nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag); -int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *m); +int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *m); void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m); void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *m);