Commit 8a6f346e authored by matzakos's avatar matzakos

nr-ip-ul nos1: Small modification to be able to block the random traffic...

nr-ip-ul nos1: Small modification to be able to block the random traffic (which is generated when there is no Uplink IP traffic at the UE) at the MAC layer of the gNB
parent 0a136997
......@@ -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);
///////////
......
......@@ -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);
}
......
......@@ -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);
//}
......
......@@ -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);
}
......
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