From 82ba5a35312f9ecde1d97b4bebb4af8a3c87d6d7 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 23 Sep 2021 12:53:38 -0700 Subject: [PATCH] Code clean up part one. This commit includes about 1/3 of the code clean up in preparation for the merge to the OAI develop branch. Several of the changes are white space changes, removing of logs, comment removals, and updating any changed code for our use-case to be clear for NSA mode. --- executables/nr-softmodem.c | 46 +++++++++++++------ executables/nr-ue.c | 2 +- executables/nr-uesoftmodem.c | 7 --- executables/softmodem-common.c | 12 +++-- openair1/PHY/INIT/lte_init.c | 28 ++++------- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 11 ++--- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 11 ++--- openair1/SCHED_NR/nr_prach_procedures.c | 2 - openair1/SCHED_NR/phy_procedures_nr_gNB.c | 14 +++--- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- .../SIMULATION/ETH_TRANSPORT/netlink_init.c | 8 ++-- openair2/COMMON/as_message.h | 2 +- openair2/GNB_APP/gnb_app.c | 4 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 15 ++---- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 - openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 5 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 4 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 13 +++--- openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c | 9 +--- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 14 +----- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 34 ++------------ openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c | 1 - openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 38 ++------------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 6 +-- openair2/LAYER2/nr_rlc/nr_rlc_pdu.c | 7 +-- 30 files changed, 102 insertions(+), 203 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index f0817a9213..3765b0f664 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -612,7 +612,29 @@ static void wait_nfapi_init(char *thread_name) { } void init_pdcp(void) { - //if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { + if (!get_softmodem_params()->nsa) { + if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { + //pdcp_layer_init(); + uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? + (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; + + if (IS_SOFTMODEM_NOS1) { + printf("IS_SOFTMODEM_NOS1 option enabled \n"); + pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT; + } + + nr_pdcp_module_init(pdcp_initmask, 0); + + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + } else { + LOG_I(PDCP, "node is gNB \n"); + 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); + } + } + } else if (get_softmodem_params()->nsa) { pdcp_layer_init(); uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; @@ -623,17 +645,12 @@ void init_pdcp(void) { } nr_pdcp_module_init(pdcp_initmask, 0); - - /*if (NODE_IS_CU(RC.rrc[0]->node_type)) { - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); - } else {*/ 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); - //} - /*} else { + } else { + LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); - }*/ - + } } @@ -694,21 +711,20 @@ int main( int argc, char **argv ) { init_opt(); #ifdef PDCP_USE_NETLINK -if(!IS_SOFTMODEM_NOS1) - netlink_init(); + + if(!IS_SOFTMODEM_NOS1) { + netlink_init(); + init_pdcp(); + } #if defined(PDCP_USE_NETLINK_QUEUES) pdcp_netlink_init(); #endif #endif - #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" #endif LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); - if(!IS_SOFTMODEM_NOS1) - init_pdcp(); - if (RC.nb_nr_L1_inst > 0) RCconfig_NR_L1(); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 41abf55a0f..cd4a592fcc 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -27,8 +27,8 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "SCHED_NR_UE/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" +#include "executables/softmodem-common.h" #include "LAYER2/nr_pdcp/nr_pdcp_entity.h" -//#include "executables/softmodem-common.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h" /* diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 95c643a876..e4bfc4c785 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -541,13 +541,6 @@ int main( int argc, char **argv ) { // wait for end of program printf("TYPE TO TERMINATE\n"); -#if 0 - if (create_tasks_nrue(1) < 0) { - printf("cannot create ITTI tasks\n"); - exit(-1); // need a softer mode - } -#endif - // Sleep a while before checking all parameters have been used // Some are used directly in external threads, asynchronously sleep(20); diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index d8d5427d5d..318fd6b008 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -209,10 +209,12 @@ void set_softmodem_sighandler(void) { act.sa_handler=signal_handler; sigaction(SOFTMODEM_RTSIGNAL,&act,&oldact); // Disabled in order generate a core dump for analysis with gdb - // printf("Send signal %d to display resource usage...\n",SIGRTMIN+1); - // signal(SIGSEGV, signal_handler); - // signal(SIGINT, signal_handler); - // signal(SIGTERM, signal_handler); - // signal(SIGABRT, signal_handler); + # if 0 + printf("Send signal %d to display resource usage...\n",SIGRTMIN+1); + signal(SIGSEGV, signal_handler); + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); + #endif } diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 21a1010cf9..308a059d51 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -553,14 +553,12 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) { LTE_eNB_PRACH *const prach_vars_br = &eNB->prach_vars_br; int i, UE_id; - if (common_vars->txdataF) { - for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) { - if (i < fp->nb_antenna_ports_eNB || i == 5) { - free_and_zero(common_vars->txdataF[i]); - } + for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) { + if (i < fp->nb_antenna_ports_eNB || i == 5) { + free_and_zero(common_vars->txdataF[i]); + /* rxdataF[i] is not allocated -> don't free */ } } - /* rxdataF[i] is not allocated -> don't free */ free_and_zero(common_vars->txdataF); free_and_zero(common_vars->rxdataF); @@ -582,20 +580,14 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) { free_and_zero(prach_vars->prachF); - if (prach_vars->prach_ifft[0]) { - for (i = 0; i < 64; i++) { - free_and_zero(prach_vars->prach_ifft[0][i]); - } - free_and_zero(prach_vars->prach_ifft[0]); - } + for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]); + + free_and_zero(prach_vars->prach_ifft[0]); for (int ce_level = 0; ce_level < 4; ce_level++) { - if (prach_vars_br->prach_ifft[ce_level]) { - for (i = 0; i < 64; i++) { - free_and_zero(prach_vars_br->prach_ifft[ce_level][i]); - } - free_and_zero(prach_vars_br->prach_ifft[ce_level]); - } + for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]); + + free_and_zero(prach_vars_br->prach_ifft[ce_level]); free_and_zero(prach_vars->rxsigF[ce_level]); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index b731dcda3c..3aad4980bc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -430,22 +430,20 @@ void nr_processULSegment(void* arg) { p_procTime); if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { -// #ifdef PRINT_CRC_CHECK +#ifdef PRINT_CRC_CHECK LOG_I(PHY, "Segment %d CRC OK\n",r); -// #endif +#endif rdata->decodeIterations = no_iteration_ldpc; } else { -// #ifdef PRINT_CRC_CHECK +#ifdef PRINT_CRC_CHECK LOG_I(PHY, "CRC NOK\n"); -// #endif +#endif rdata->decodeIterations = max_ldpc_iterations + 1; } for (int m=0; m < Kr>>3; m ++) { ulsch_harq->c[r][m]= (uint8_t) llrProcBuf[m]; - //printf("%x ", ulsch_harq->c[r][m]); } - //printf("\n"); //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); } @@ -513,7 +511,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, A = (harq_process->TBS)<<3; LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers); - //printf("ULSCH in %d.%d \n", frame, nr_tti_rx); if (R<1024) Coderate = (float) R /(float) 1024; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index bd5001628a..3e0c16a07e 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -169,15 +169,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, int slot, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - printf("Inside nr_decode_pucch0. \n"); + int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - //Gokul - // printf("rxdataf buff: \n"); - // for(int i = 1;i<=5*7*14*512;++i){ - // if(gNB->RU_list[0]->common.rxdataF[0][i] != 0) - // printf("%d ",gNB->RU_list[0]->common.rxdataF[0][i]); - // } + int nr_sequences; const uint8_t *mcs; @@ -1073,7 +1068,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, int slot, nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - printf("Inside nr_decode_pucch2. \n"); + int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; //pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index ced25e3772..e1e35b3c63 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -51,8 +51,6 @@ extern uint8_t nfapi_mode; extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind); -/* Melissa, this is what fills the rach ind. It gets filled here in - the gNB. This is then sent to the proxy. */ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0}; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 9f63a59035..325d659e67 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -168,7 +168,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, gNB->Mod_id, frame, slot, gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci, gNB->pdcch_pdu[pdcch_pdu_id].pdcch_pdu.pdcch_pdu_rel15.numDlDci); - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1); nr_generate_dci_top(gNB, @@ -186,7 +186,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (pdcch_pdu_id >= 0) gNB->pdcch_pdu[pdcch_pdu_id].frame = -1; if (ul_pdcch_pdu_id >= 0) gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].frame = -1; } - + for (int i=0; inum_pdsch_rnti[slot]; i++) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1); LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot); @@ -222,7 +222,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, /* - if ((cfg->subframe_config.duplex_mode.value == TDD) && + if ((cfg->subframe_config.duplex_mode.value == TDD) && ((nr_slot_select(fp,frame,slot)&NR_DOWNLINK_SLOT)==SF_DL)) return; // VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX,1); @@ -241,7 +241,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { rdata->segment_r, ulsch_harq->processedSegments, rdata->nbSegments); gNB->nbDecode--; LOG_D(PHY,"remain to decoded in subframe: %d\n", gNB->nbDecode); - + if (decodeSuccess) { memcpy(ulsch_harq->b+rdata->offset, ulsch_harq->c[r], @@ -260,7 +260,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { } } - // if all segments are done + // if all segments are done if (rdata->nbSegments == ulsch_harq->processedSegments) { if (decodeSuccess) { LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for slot %d TBS %d\n", @@ -296,7 +296,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu; - + uint8_t l, number_dmrs_symbols = 0; uint32_t G; uint16_t start_symbol, number_symbols, nb_re_dmrs; @@ -318,7 +318,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs pusch_pdu->qam_mod_order, pusch_pdu->nrOfLayers); - + AssertFatal(G>0,"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u\n", pusch_pdu->rb_size, number_symbols, diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index ff9fd3af6a..4e47eb2865 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -2177,7 +2177,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ue->prach_vars[gNB_id]->amp); if (ue->mac_enabled == 1) - nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); //Once rach is = 1, then call this + nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c index 150165203e..953fb22885 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -99,11 +99,11 @@ int netlink_init_mbms_tun(char *ifprefix, int id) {//for UE, id = 1, 2, ..., int ret; char ifname[64]; - if ( id > 0 ){ - sprintf(ifname, "oaitun_%.3s%d",ifprefix, id-1); + if (id > 0) { + sprintf(ifname, "oaitun_%.3s%d", ifprefix, id-1); } - else{ - sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons + else { + sprintf(ifname, "oaitun_%.3s1", ifprefix); // added "1": for historical reasons } nas_sock_mbms_fd = tun_alloc(ifname); diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index 630a021588..b0ca06daec 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -220,7 +220,7 @@ typedef struct kenb_refresh_req_s { } kenb_refresh_req_t; typedef struct nsa_oai_tun_nsa_s { - uint8_t buffer[500]; //Melissa TODO + uint8_t buffer[500]; } nas_oai_tun_nsa_t; /* diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 5b1e1aab5b..49a415d9f0 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -206,8 +206,8 @@ void *gNB_app_task(void *args_p) configure_nr_rrc(gnb_id); } - if (RC.nb_nr_inst > 0) { - //init_pdcp(); + if (RC.nb_nr_inst > 0 && !get_softmodem_params()->nsa) { + init_pdcp(); } if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 05e9b44f77..5a49f122fb 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -421,7 +421,6 @@ uint16_t set_ra_rnti(NR_UE_MAC_INST_t *mac, fapi_nr_ul_config_prach_pdu *prach_p uint8_t s_id = prach_pdu->prach_start_symbol; ra->ra_rnti = 1 + s_id + 14 * t_id + 1120 * f_id + 8960 * ul_carrier_id; - //gNB: ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); LOG_D(MAC, "Computed ra_RNTI is %x \n", ra->ra_rnti); @@ -543,7 +542,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; - uint8_t lcid = UL_SCH_LCID_CCCH; uint8_t *payload; uint16_t size_sdu = 0; unsigned short post_padding; @@ -554,9 +552,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated; - uint8_t sdu_lcids[NB_RB_MAX] = {0}; uint16_t sdu_lengths[NB_RB_MAX] = {0}; - int num_sdus = 0; int offset = 0; int TBS_bytes = 848; int header_length_total=0; @@ -564,8 +560,8 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side if (!prach_resources->init_msg1) { - if ( (mac->common_configuration_complete>0 || get_softmodem_params()->do_ra==1 || get_softmodem_params()->nsa) && - ((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150){ + if ((mac->common_configuration_complete > 0 || get_softmodem_params()->do_ra || get_softmodem_params()->nsa) && + ((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150) { prach_resources->init_msg1 = 1; } else { LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n",frame,prach_resources->sync_frame); @@ -574,7 +570,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } LOG_D(NR_MAC,"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d\n", - frame,prach_resources->init_msg1,ra->ra_state,ra->RA_active); + frame, prach_resources->init_msg1, ra->ra_state, ra->RA_active); if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) { @@ -586,9 +582,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, int TBS_max = 848; //8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); payload = (uint8_t*) mac->CCCH_pdu.payload; mac_ce_len = 0; - num_sdus = 1; post_padding = 1; - sdu_lcids[0] = lcid; // initialisation by RRC @@ -605,8 +599,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, mac_sdus[i] = (unsigned char) (lrand48()&0xff); } //Sending SDUs with size 1 - //Initialize elements of sdu_lcids and sdu_lengths - sdu_lcids[0] = lcid; + //Initialize elements of sdu_lengths sdu_lengths[0] = TBS_bytes - 3 - post_padding - mac_ce_len; header_length_total += 2 + (sdu_lengths[0] >= 128); size_sdu += sdu_lengths[0]; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index ad2627e1bc..e4d2d00cb0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -539,7 +539,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE); else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs; - LOG_I(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); + LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); switch(dci_format){ case NR_UL_DCI_FORMAT_0_0: { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index f44b1e4877..31874d479f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1893,7 +1893,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu)); - ul_config->number_pdus += 1; //Melissa Elkadi come back here! + ul_config->number_pdus += 1; fill_ul_config(ul_config, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PRACH); LOG_D(PHY, "In %s: (%p) %d UL PDUs:\n", __FUNCTION__, ul_config, ul_config->number_pdus); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 07c8b7b75a..252144be3b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -356,7 +356,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, const int bwp_id = 1; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; - NR_COMMON_channels_t *cc = gNB->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index d66c8df019..7d123be41b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -288,6 +288,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP }else if (N_RA_slot <= 1) { //1 PRACH slot in a subframe slot_index = 0; } + UL_tti_req->SFN = frameP; UL_tti_req->Slot = slotP; for (int fdm_index=0; fdm_index < fdm; fdm_index++) { // one structure per frequency domain occasion diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 44cde6137a..809ff39cd8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -135,7 +135,6 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * } } - // Compute and write all MAC CEs and subheaders, and return number of written // bytes int nr_write_ce_dlsch_pdu(module_id_t module_idP, @@ -883,7 +882,7 @@ void nr_schedule_ue_spec(module_id_t module_id, const int coresetid = bwp ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; if (!pdcch_pdu) { - LOG_I(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n"); + LOG_D(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n"); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index b56f57c056..960ae4008b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1086,8 +1086,8 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); const int8_t pid = sched_ctrl->feedback_dl_harq.head; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - /* Melissa: according to nfapi_nr_interface_scf.h, harq_value = 0 is a pass - (check below was for harq_value == 1 in develop branch) */ + /* According to nfapi_nr_interface_scf.h, harq_value = 0 is a pass + (The check below was for harq_value == 1 in the develop branch) */ handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); } } @@ -1273,7 +1273,6 @@ int nr_acknack_scheduling(int mod_id, * scheduled a lot and used all AckNacks, pucch->frame might have been * wrapped around to next frame */ if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) { - AssertFatal(pucch->sr_flag + pucch->dai_c == 0, "expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n", UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 378a729397..d8bb41127c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1458,6 +1458,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) sched_ctrl->sched_ul_bytes, sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes); + /* PUSCH in a later slot, but corresponding DCI now! */ nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][sched_pusch->slot]; AssertFatal(future_ul_tti_req->SFN == sched_pusch->frame diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index eed4f04312..46abbba761 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -45,6 +45,7 @@ #include "LTE_MBMS-SessionInfoList-r9.h" #include "LTE_PMCH-InfoList-r9.h" + typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const, const srb_flag_t, const MBMS_flag_t, const rb_id_t, const mui_t, @@ -91,9 +92,6 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -// Global variable to identify each UE. Updated in main() of lte-uesoftmodem.c -//extern uint16_t ue_id_g; - extern uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; extern uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; extern uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 81d5c68f44..ed88dbcefe 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -89,7 +89,7 @@ extern struct msghdr nas_msg_rx; extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP); -uint16_t ue_id_g;// global variable to identify ue id for each ue. Change happens only in main function of lte-uesoftmodem.c +uint16_t ue_id_g; // Global variable to identify the ID for each UE. It is updated in main() of lte-uesoftmodem.c void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) { LOG_I(PDCP,"%s: \nPC5S message, header traffic_type: %d)\n", title, sl_pc5s_msg->pc5s_header.traffic_type); @@ -147,7 +147,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { nas_nlh_tx->nlmsg_len = sizeToWrite; ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); } // PDCP_USE_NETLINK - + AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]); if( LOG_DEBUGFLAG(DEBUG_PDCP) ) @@ -562,8 +562,8 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA, - (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?NULL:&pdcp_read_header_g.sourceL2Id, - (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?NULL:&pdcp_read_header_g.destinationL2Id + (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.sourceL2Id, + (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.destinationL2Id ); } else { /* else of h_rc == HASH_TABLE_OK */ MSC_LOG_RX_DISCARDED_MESSAGE( @@ -607,8 +607,8 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA, - (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL :&pdcp_read_header_g.sourceL2Id, - (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL :&pdcp_read_header_g.destinationL2Id + (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.sourceL2Id, + (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.destinationL2Id ); } /* rab_id == 0 */ } /*pdcp_read_state_g != 0 */ @@ -875,3 +875,4 @@ pdcp_pc5_socket_init() { exit(1); } } + diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c index 2ee819c819..31862982a2 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c @@ -42,10 +42,7 @@ void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int si nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity; int sn; char buf[size+6]; - char buf_mel[1024]; - hexdump(buffer, size, buf_mel, sizeof(buf_mel)); - LOG_I(PDCP, "Melissa Elkadi in %s, this is hexdump of pdu %s recevied in PDCP layer directly\n", - __FUNCTION__, buf_mel); + sn = entity->common.next_nr_pdcp_tx_sn; entity->common.next_nr_pdcp_tx_sn++; @@ -65,10 +62,6 @@ void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int si entity->common.deliver_pdu(entity->common.deliver_pdu_data, (nr_pdcp_entity_t *)entity, buf, size+6, sdu_id); - char buf_meli[1024]; - hexdump(buf, size + 3, buf_meli, sizeof(buf_meli)); - LOG_I(PDCP, "Melissa Elkadi in %s, this is hexdump of pdu %s After delivering to RLC\n", - __FUNCTION__, buf_meli); } void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 6729aa6eeb..decf40e9ed 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -296,9 +296,6 @@ static void *ue_tun_read_thread(void *_) } LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len); - char buffer[1024]; - hexdump(rx_buf, len, buffer, sizeof(buffer)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s from tunnel interface\n", buffer); nr_pdcp_manager_lock(nr_pdcp_ue_manager); rnti = nr_pdcp_get_first_rnti(nr_pdcp_ue_manager); @@ -416,9 +413,6 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id) nas_getparams(); if(UE_NAS_USE_TUN) { - /* Melissa TODO: Brute force changes made below to allow nr-UE to have unique tunnel interfaces. - When the NODE_NUMBER param is not used to determine functionality and LTE tunnel - interfaces, we should update the netlink_init_tun() and nas_config() calls below as well. */ int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1; netlink_init_tun("nrue", num_if, id); //Add --nr-ip-over-lte option check for next line @@ -836,10 +830,9 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, nr_pdcp_manager_lock(nr_pdcp_ue_manager); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); if (ue->drb[drb_id-1] != NULL) { - LOG_I(PDCP, "Melissa Elkadi %s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", + LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } else { - LOG_I(PDCP, "%s:%d:%s: Melissa Elkadi, we will call deliver_sdu_drb\n", __FILE__, __LINE__, __FUNCTION__); pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,has_sdap, has_sdapULheader,has_sdapDLheader, deliver_sdu_drb, ue, deliver_pdu_drb, ue, @@ -1207,10 +1200,7 @@ static boolean_t pdcp_data_req_drb( nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return 0; } - char buffer[1024]; - hexdump((char *)sdu_buffer, sdu_buffer_size, buffer, sizeof(buffer)); - LOG_I(PDCP, "Melissa Elkadi in %s, this is hexdump of pdu %s from tunnel interface in PDCP layer\n", - __FUNCTION__, buffer); + rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index c3a0856e56..8db5ce31ad 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -204,7 +204,6 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) int so = 0; int bad_sdu = 0; - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); /* go to first segment of sn */ pdu = entity->rx_list; while (pdu->sn != sn) @@ -232,7 +231,6 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) return; /* deliver */ - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_rlc_entity_t *)entity, sdu, so); @@ -246,16 +244,13 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) entity->rx_next_highest = (x + 1) % entity->sn_modulus; /* todo: room for optimization: we can run through rx_list only once */ - LOG_I(RLC, "Melissa Elkadi, checking if sdu_full is true %s()\n", __FUNCTION__); if (sdu_full(entity, x)) { - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); reassemble_and_deliver(entity, x); if (x == entity->rx_highest_status) { int rx_highest_status = entity->rx_highest_status; while (sdu_delivered(entity, rx_highest_status)) rx_highest_status = (rx_highest_status + 1) % entity->sn_modulus; - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); entity->rx_highest_status = rx_highest_status; } @@ -278,10 +273,8 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) entity->rx_next = rx_next; } } - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); if (entity->t_reassembly_start) { - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); if (entity->rx_next_status_trigger == entity->rx_next || (entity->rx_next_status_trigger == (entity->rx_next + 1) % entity->sn_modulus && @@ -294,7 +287,6 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) } if (entity->t_reassembly_start == 0) { - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); if (sn_compare_rx(entity, entity->rx_next_highest, (entity->rx_next + 1) % entity->sn_modulus) > 0 || (entity->rx_next_highest == (entity->rx_next + 1) @@ -552,13 +544,9 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, int control_e2; int control_e3; unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */ - char buf_3[1024]; - hexdump(buffer, size, buf_3, sizeof(buf_3)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_3, __FUNCTION__, __LINE__); + nr_rlc_pdu_decoder_init(&decoder, buffer, size); dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - LOG_I(RLC, "Melissa Elkadi, we are here %s(): %d. dc = %d\n", __FUNCTION__, __LINE__, dc); if (dc == 0) goto control; /* data PDU */ @@ -622,7 +610,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, entity->rx_list, pdu); /* do reception actions (38.322 5.2.3.2.3) */ - LOG_I(RLC, "Melissa Elkadi, we are calling reception_actions from %s()\n", __FUNCTION__); reception_actions(entity, pdu); if (p) { @@ -831,20 +818,9 @@ static int serialize_sdu(nr_rlc_entity_am_t *entity, nr_rlc_pdu_encoder_put_bits(&encoder, 1, 1); /* D/C: 1 = data */ nr_rlc_pdu_encoder_put_bits(&encoder, 0, 1); /* P: reserve, set later */ - char buf_1[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_1, sizeof(buf_1)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_1, __FUNCTION__, __LINE__); + nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_first,1);/* 1st bit of SI */ - char buf_2[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_2, sizeof(buf_2)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_2, __FUNCTION__, __LINE__); nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_last,1); /* 2nd bit of SI */ - char buf_3[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_3, sizeof(buf_3)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_3, __FUNCTION__, __LINE__); if (entity->sn_field_length == 18) nr_rlc_pdu_encoder_put_bits(&encoder, 0, 2); /* R */ @@ -860,10 +836,7 @@ static int serialize_sdu(nr_rlc_entity_am_t *entity, if (p) include_poll(entity, buffer); - char buf[1024]; - hexdump(buffer + encoder.byte, sdu->size, buf, sizeof(buf)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after calling generate_pdu in %s\n", - buf, __FUNCTION__); + return encoder.byte + sdu->size; } @@ -1599,6 +1572,7 @@ int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity, if (ret != 0) return ret; } + return generate_tx_pdu(entity, buffer, size); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c index 2e09452f14..26ae481889 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c @@ -104,7 +104,6 @@ int nr_rlc_entity_tm_generate_pdu(nr_rlc_entity_t *_entity, char *buffer, int size) { nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity; - LOG_I(MAC, "Melissa Elkadi, in %s(): %d\n", __FUNCTION__, __LINE__); return generate_tx_pdu(entity, buffer, size); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index 07b2d7b9f3..71173eee5a 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -353,20 +353,9 @@ static int serialize_sdu(nr_rlc_entity_um_t *entity, /* generate header */ nr_rlc_pdu_encoder_init(&encoder, buffer, bufsize); - char buf_1[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_1, sizeof(buf_1)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_1, __FUNCTION__, __LINE__); nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_first,1);/* 1st bit of SI */ - char buf_2[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_2, sizeof(buf_2)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_2, __FUNCTION__, __LINE__); nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_last,1); /* 2nd bit of SI */ - char buf_3[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_3, sizeof(buf_3)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_3, __FUNCTION__, __LINE__); + /* SN, if required */ if (sdu->is_first == 1 && sdu->is_last == 1) { nr_rlc_pdu_encoder_put_bits(&encoder, 0, 6); /* R */ @@ -380,23 +369,9 @@ static int serialize_sdu(nr_rlc_entity_um_t *entity, if (!sdu->is_first) nr_rlc_pdu_encoder_put_bits(&encoder, sdu->so, 16); /* SO */ - char buf_sdu[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_sdu, sizeof(buf_sdu)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of sdu->data %s in %s\n", - buf_sdu, __FUNCTION__); - /* data */ memcpy(buffer + encoder.byte, sdu->sdu->data + sdu->so, sdu->size); - char buf_5[1024]; - hexdump(buffer, sdu->size, buf_5, sizeof(buf_5)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after memcpy of just buffer %s\n", - buf_5, __FUNCTION__); - - char buf[1024]; - hexdump(buffer + encoder.byte, sdu->size, buf, sizeof(buf)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after memcpy sdu into buffer in %s\n", - buf, __FUNCTION__); return encoder.byte + sdu->size; } @@ -504,15 +479,9 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size) /* update tx_next if the SDU is an SDU segment and is the last */ if (!sdu->is_first && sdu->is_last) entity->tx_next = (entity->tx_next + 1) % entity->sn_modulus; - char buf[1024]; - hexdump(buffer, sdu->size, buf, sizeof(buf)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right before calling serialize_sdu in %s\n", - buf, __FUNCTION__); + ret = serialize_sdu(entity, sdu, buffer, size); - char buf_1[1024]; - hexdump(buffer, size, buf_1, sizeof(buf_1)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after calling serialize_sdu in %s\n", - buf_1, __FUNCTION__); + entity->tx_size -= sdu->size; nr_rlc_free_sdu_segment(sdu); @@ -554,7 +523,6 @@ int nr_rlc_entity_um_generate_pdu(nr_rlc_entity_t *_entity, char *buffer, int size) { nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity; - LOG_I(MAC, "Melissa Elkadi, in %s(): %d\n", __FUNCTION__, __LINE__); return generate_tx_pdu(entity, buffer, size); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index e87f2cb921..6de81ff71f 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -218,10 +218,6 @@ tbs_size_t mac_rlc_data_req( rb->set_time(rb, nr_rlc_current_time); maxsize = tb_sizeP; ret = rb->generate_pdu(rb, buffer_pP, maxsize); - char buffer[1024]; - hexdump(buffer_pP, ret, buffer, sizeof(buffer)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after calling generate_pdu in %s\n", - buffer, __FUNCTION__); } else { ret = 0; } @@ -508,7 +504,7 @@ rb_found: return; } } - LOG_I(PDCP, "Melissa Elkadi we are calling PDCP layer from RLC in %s\n", __FUNCTION__); + LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__); if (!pdcp_data_ind(&ctx, is_srb, 0, 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 */ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c index a5d2c90d5b..b42410ab72 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c @@ -106,16 +106,11 @@ void nr_rlc_pdu_decoder_init(nr_rlc_pdu_decoder_t *decoder, static int get_bit(nr_rlc_pdu_decoder_t *decoder) { int ret; - LOG_I(RLC, "Melissa Elkadi, in %s():. bytes = %d size = %d, bit %d, shifted bit %d \n", - __FUNCTION__, decoder->byte, decoder->size, decoder->bit, (7-decoder->bit)); + if (decoder->byte >= decoder->size) { decoder->error = 1; return 0; } - LOG_I(RLC, "Melissa Elkadi, in %s():. (%d >> (7 - decoder->bit)) & 1 = %d (returned val) \n", - __FUNCTION__, - decoder->buffer[decoder->byte], - ((decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1)); ret = (decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1;