From 3b6b6d06713f8621aeb2cd3eb90779b25bce826c Mon Sep 17 00:00:00 2001 From: matzakos Date: Mon, 6 Apr 2020 19:06:58 +0200 Subject: [PATCH] Fix ULSCH traffic generation at UE side. Still not received at gNB --- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 38 ++++++++++----------- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index f262400f5d..c55a084b8a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -178,23 +178,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (harq_process_ul_ue != NULL){ data_existing = 0; - - 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); - - #ifdef DEBUG_MAC_PDU - LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8); - for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) { - printf("0x%02x",harq_process_ul_ue->a[i]); - } - printf("\n"); - #endif - } + 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); + } } //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity if (!IS_SOFTMODEM_NOS1 || !data_existing) { @@ -202,15 +193,24 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, //and block this traffic from being forwarded to the upper layers at the gNB uint16_t payload_offset = 5; LOG_D(PHY, "Random data to be tranmsitted: \n"); - //Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver + + //Give the header bytes a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2) + //in order to block the random packet at the MAC layer of the receiver for (i = 0; ia[i] = 0; + harq_process_ul_ue->a[i] = 64; 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]); } } + #ifdef DEBUG_MAC_PDU + LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8); + for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) { + printf("0x%02x",harq_process_ul_ue->a[i]); + } + printf("\n"); + #endif } else { LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n"); return; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 9be9fe8424..b7922993cf 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -2243,7 +2243,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, start_meas(&ue->phy_proc_tx); #endif - if (ue->UE_mode[gNB_id] == PUSCH ){ + if (ue->UE_mode[gNB_id] == PUSCH || get_softmodem_params()->phy_test == 1){ nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, thread_id, gNB_id); /* diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 0d04a0ae93..87ddd97366 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -122,7 +122,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ul_info->frame_tx, ul_info->slot_tx); - if (is_nr_UL_slot(mac->scc, ul_info->slot_tx)) + if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra) nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); switch(ret){