diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 077f417a99a899857681b5bfb11215dd3901dc09..1d4fdcd538de1c9be3423fd7c4ce94b20d9bbc8e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -45,7 +45,7 @@ //#define DEBUG_SCFDMA //#define DEBUG_PUSCH_MAPPING -#define DEBUG_MAC_PDU +//#define DEBUG_MAC_PDU //extern int32_t uplink_counter; @@ -174,6 +174,7 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (IS_SOFTMODEM_NOS1){ data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame, slot, 0, ulsch_input_buffer, harq_process_ul_ue->TBS/8, &access_mode); + //IP traffic to be transmitted if(data_existing){ //harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char)); memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8); @@ -186,16 +187,20 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, printf("\n"); #endif } + //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity else{ - //Use different rnti for the random (non-IP traffic) in noS1 mode, in order to use it as a filter - //to block this traffic from being forwarded to the MAC layer of the gNB - ulsch_ue->rnti = 0x1111; + //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid + //and block this traffic from being forwarded to the upper layers at the gNB + uint16_t payload_offset = 5; LOG_E(PHY, "Random data to be tranmsitted: \n"); - for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) { + //Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver + for (i = 0; i<payload_offset; i++) + harq_process_ul_ue->a[i] = 0; + + for (i = payload_offset; i < harq_process_ul_ue->TBS / 8; i++) { harq_process_ul_ue->a[i] = (unsigned char) rand(); //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); } - data_existing = 1; } } //else if(uplink_counter == 0){ //if(!IS_SOFTMODEM_NOS1){ @@ -205,7 +210,6 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, harq_process_ul_ue->a[i] = (unsigned char) rand(); //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); } - data_existing = 1; //uplink_counter++; } } else { @@ -219,7 +223,6 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////// - //if(data_existing){ nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid); /////////// diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 2f30b6af3943391427dfb99976e98c9d46d03521..3c727738cfcad18fc30761b320f0523980c75147 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -289,7 +289,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id //gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b else if(gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->b!=NULL){ LOG_D(PHY, "ULSCH received ok \n"); - if(IS_SOFTMODEM_NOS1 && gNB->ulsch[UE_id][0]->rnti == 0x1234){ + if(IS_SOFTMODEM_NOS1){ //&& gNB->ulsch[UE_id][0]->rnti == 0x1234 nr_fill_crc_indication (gNB, UE_id, frame_rx, slot_rx, 0); nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid); } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index a116e7b8ca2a5a9d3a55882005a8681636ced62c..568ef5f736e1ab6c30e95516cc7e9985acfd7532 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -2502,7 +2502,6 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, } // UE_mode==PUSCH */ - //if(data_existing){ LOG_I(PHY, "Sending data \n"); nr_ue_pusch_common_procedures(ue, harq_pid, @@ -2510,7 +2509,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, thread_id, gNB_id, &ue->frame_parms); - //} + diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 8010a1f714902617f81b56ddd6138f33756392c8..4b966fd7b1abbee331f509ea8fa12be35b2112d9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2995,6 +2995,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, // Generate header // if (num_sdus>0) { + // cycle through SDUs and place in ulsch_buffer + if (sdu_length_total) { payload_offset = nr_generate_ulsch_header(ulsch_buffer, // mac header num_sdus, // num sdus short_padding, // short pading @@ -3012,8 +3014,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, short_padding, post_padding, bsr_len, phr_len, buflen - sdu_length_total - payload_offset); - // cycle through SDUs and place in ulsch_buffer - if (sdu_length_total) { + memcpy(&ulsch_buffer[payload_offset], ulsch_buff, sdu_length_total); }