Commit 40a8c0fb authored by Sakthivel Velumani's avatar Sakthivel Velumani

avoiding code duplication

parent 1f86cfc5
...@@ -174,6 +174,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -174,6 +174,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
// to be removed later when MAC is ready // to be removed later when MAC is ready
if (harq_process_ul_ue != NULL){ if (harq_process_ul_ue != NULL){
data_existing = 0;
if (IS_SOFTMODEM_NOS1){ if (IS_SOFTMODEM_NOS1){
data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame, data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
...@@ -191,38 +192,22 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -191,38 +192,22 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
printf("\n"); printf("\n");
#endif #endif
} }
//Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity }
else{ //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
//Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid else if (!IS_SOFTMODEM_NOS1 || !data_existing) {
//and block this traffic from being forwarded to the upper layers at the gNB //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
uint16_t payload_offset = 5; //and block this traffic from being forwarded to the upper layers at the gNB
LOG_D(PHY, "Random data to be tranmsitted: \n"); uint16_t payload_offset = 5;
//Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver LOG_D(PHY, "Random data to be tranmsitted: \n");
for (i = 0; i<payload_offset; i++) //Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver
harq_process_ul_ue->a[i] = 0; 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(); for (i = payload_offset; i < harq_process_ul_ue->TBS / 8; i++) {
//printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[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]);
}
}
//else if(uplink_counter == 0){ //if(!IS_SOFTMODEM_NOS1){
else{
//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_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
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]);
}
//uplink_counter++;
} }
}
} else { } else {
LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n"); LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment