Commit 99fce8a3 authored by matzakos's avatar matzakos

nr-ip noS1 uplink: Uplink IP traffic successfully received at the IP TUN...

nr-ip noS1 uplink: Uplink IP traffic successfully received at the IP TUN interface of the gNB now. Logs cleanup.
parent 5b5a25a9
...@@ -910,6 +910,7 @@ init_opt(); ...@@ -910,6 +910,7 @@ init_opt();
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
if(!IS_SOFTMODEM_NOS1)
netlink_init(); netlink_init();
#if defined(PDCP_USE_NETLINK_QUEUES) #if defined(PDCP_USE_NETLINK_QUEUES)
pdcp_netlink_init(); pdcp_netlink_init();
......
...@@ -420,7 +420,6 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { ...@@ -420,7 +420,6 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
0x1234, proc->frame_rx, 0x1234, proc->frame_rx,
proc->nr_tti_rx, 0); proc->nr_tti_rx, 0);
pdcp_run(&ctxt); pdcp_run(&ctxt);
pdcp_fifo_flush_sdus(&ctxt);
} }
} }
......
...@@ -593,16 +593,16 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -593,16 +593,16 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
p_procTime); p_procTime);
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
//#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
//if (prnt_crc_cnt % 10 == 0) //if (prnt_crc_cnt % 10 == 0)
LOG_I(PHY, "Segment %d CRC OK\n",r); LOG_I(PHY, "Segment %d CRC OK\n",r);
//#endif #endif
ret = no_iteration_ldpc; ret = no_iteration_ldpc;
} else { } else {
//#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
//if (prnt_crc_cnt%10 == 0) //if (prnt_crc_cnt%10 == 0)
LOG_I(PHY, "CRC NOK\n"); LOG_I(PHY, "CRC NOK\n");
//#endif #endif
ret = ulsch->max_ldpc_iterations + 1; ret = ulsch->max_ldpc_iterations + 1;
} }
...@@ -719,12 +719,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -719,12 +719,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
} }
LOG_I(PHY, "output encoder: \n"); #ifdef DEBUG_ULSCH_DECODING
LOG_I(PHY, "Decoder output (payload): \n");
for (i = 0; i < harq_process->TBS / 8; i++) { for (i = 0; i < harq_process->TBS / 8; i++) {
//harq_process_ul_ue->a[i] = (unsigned char) rand(); //harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); //printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
printf("0x%02x",harq_process->b[i]); printf("0x%02x",harq_process->b[i]);
} }
#endif
ulsch->last_iteration_cnt = ret; ulsch->last_iteration_cnt = ret;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
//#define DEBUG_SCFDMA //#define DEBUG_SCFDMA
//#define DEBUG_PUSCH_MAPPING //#define DEBUG_PUSCH_MAPPING
#define DEBUG_MAC_PDU
//extern int32_t uplink_counter; //extern int32_t uplink_counter;
...@@ -160,13 +161,25 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -160,13 +161,25 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
if(data_existing){ if(data_existing){
//harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char)); //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); memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8);
LOG_I(PHY, "input encoder: \n");
#ifdef DEBUG_MAC_PDU
LOG_I(PHY, "Printing MAC PDU to be encoded: \n");
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
printf("0x%02x",harq_process_ul_ue->a[i]);
}
printf("\n");
#endif
}
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;
LOG_E(PHY, "Random data to be tranmsitted: \n");
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) { for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
//harq_process_ul_ue->a[i] = (unsigned char) rand(); harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
//printf("0x%02x",harq_process_ul_ue->a[i]); }
printf("0x%02x",harq_process_ul_ue->b[i]); data_existing = 1;
}
} }
} }
//else if(uplink_counter == 0){ //if(!IS_SOFTMODEM_NOS1){ //else if(uplink_counter == 0){ //if(!IS_SOFTMODEM_NOS1){
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "PHY/INIT/phy_init.h" #include "PHY/INIT/phy_init.h"
#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/nr_modulation.h"
#include "T.h" #include "T.h"
#include "executables/nr-softmodem.h"
#include "assertions.h" #include "assertions.h"
#include "msc.h" #include "msc.h"
...@@ -261,10 +262,12 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id ...@@ -261,10 +262,12 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id
if (ret > gNB->ulsch[UE_id][0]->max_ldpc_iterations) if (ret > gNB->ulsch[UE_id][0]->max_ldpc_iterations)
LOG_I(PHY, "ULSCH in error\n"); LOG_I(PHY, "ULSCH in error\n");
//gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b //gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b
else if(gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b!=NULL){ else if(gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->b!=NULL){
LOG_I(PHY, "ULSCH received ok, number of iterations: %d \n", ret); LOG_D(PHY, "ULSCH received ok \n");
nr_fill_crc_indication (gNB, UE_id, frame_rx, slot_rx, 0); if(IS_SOFTMODEM_NOS1 && gNB->ulsch[UE_id][0]->rnti == 0x1234){
nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid); 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);
}
} }
} }
...@@ -295,7 +298,6 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, ...@@ -295,7 +298,6 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id,
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = gNB->ulsch[UE_id][0]->rnti; pdu->rx_ue_information.rnti = gNB->ulsch[UE_id][0]->rnti;
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG; pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
pdu->rx_indication_rel8.length = gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->TBS>>3;
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
pdu->data = harq_process->b;//gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b; pdu->data = harq_process->b;//gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b;
// estimate timing advance for MAC // estimate timing advance for MAC
......
...@@ -3028,6 +3028,16 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -3028,6 +3028,16 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
(char) (taus() & 0xff); (char) (taus() & 0xff);
} }
} }
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_D(MAC, "Printing UL MAC payload without the header UE side: \n");
for (int i = payload_offset; i < sdu_length_total ; i++) {
//harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
printf("%02x ",(unsigned char)ulsch_buffer[i]);
}
printf("\n");
#endif
return 1; return 1;
} }
......
...@@ -634,7 +634,7 @@ nr_rx_sdu(const module_id_t enb_mod_idP, ...@@ -634,7 +634,7 @@ nr_rx_sdu(const module_id_t enb_mod_idP,
} // end for loop on control element } // end for loop on control element
for (int i = 0; i < num_sdu; i++) { for (int i = 0; i < num_sdu; i++) {
LOG_I(MAC, "SDU Number %d MAC Subheader SDU_LCID %d, length %d\n", LOG_D(MAC, "SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",
i, i,
rx_lcids[i], rx_lcids[i],
rx_lengths[i]); rx_lengths[i]);
...@@ -701,9 +701,16 @@ nr_rx_sdu(const module_id_t enb_mod_idP, ...@@ -701,9 +701,16 @@ nr_rx_sdu(const module_id_t enb_mod_idP,
if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_I(MAC, "Printing UL MAC payload after removing the header: \n");
for (int j = 0; j < rx_lengths[i] ; j++) {
printf("%02x ",(unsigned char) *(payload_ptr+j));
}
pritnf("\n");
#endif
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr+1, rx_lengths[i], 1, NULL);
} else { /* rx_length[i] Max size */ } else { /* rx_length[i] Max size */
UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; //UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1;
LOG_E(MAC, "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ", LOG_E(MAC, "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ",
enb_mod_idP, enb_mod_idP,
CC_idP, CC_idP,
......
...@@ -2171,7 +2171,6 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) { ...@@ -2171,7 +2171,6 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
if(UE_NAS_USE_TUN) { if(UE_NAS_USE_TUN) {
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 )?MAX_NUMBER_NETIF:1; int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 )?MAX_NUMBER_NETIF:1;
netlink_init_tun("ue",num_if); netlink_init_tun("ue",num_if);
//Add --nr-ip-over-lte option check for next line
if (IS_SOFTMODEM_NOS1) if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue"); nas_config(1, 1, 2, "ue");
LOG_I(PDCP, "UE pdcp will use tun interface\n"); LOG_I(PDCP, "UE pdcp will use tun interface\n");
......
...@@ -124,18 +124,34 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { ...@@ -124,18 +124,34 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
ret = sendto(pdcp_pc5_sockfd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), ret = sendto(pdcp_pc5_sockfd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),
sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr,sizeof(prose_pdcp_addr) ); sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr,sizeof(prose_pdcp_addr) );
} else if (UE_NAS_USE_TUN) { } else if (UE_NAS_USE_TUN) {
ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); #if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PHY, "PDCP output to be sent to TUN interface: \n");
for (int i = sizeof(pdcp_data_ind_header_t); i < sizeToWrite; i++) {
printf("%02x ",(unsigned char)sdu_p->data[i]);
}
printf("\n");
#endif
ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
} else if (ENB_NAS_USE_TUN) { } else if (ENB_NAS_USE_TUN) {
ret = write(nas_sock_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); #if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PDCP, "ENB_NAS_USE_TUN is enabled, ret: %d, ctxt_pP->module_id:%d, sizeToWrite:%d, header size:%d \n", ctxt_pP->module_id, ret, sizeToWrite, sizeof (pdcp_data_ind_header_t)); LOG_I(PHY, "PDCP output to be sent to TUN interface: \n");
for (int i = sizeof(pdcp_data_ind_header_t); i < sizeToWrite; i++) {
printf("%02x ",(unsigned char)sdu_p->data[i]);
}
printf("\n");
#endif
ret = write(nas_sock_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), sizeToWrite);
} else if (PDCP_USE_NETLINK) { } else if (PDCP_USE_NETLINK) {
memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) sdu_p->data, sizeToWrite); memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) sdu_p->data, sizeToWrite);
nas_nlh_tx->nlmsg_len = sizeToWrite; nas_nlh_tx->nlmsg_len = sizeToWrite;
ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
} // PDCP_USE_NETLINK } // PDCP_USE_NETLINK
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno)); 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 defined(ENABLE_PDCP_PAYLOAD_DEBUG) #if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PDCP, "Printing first bytes of PDCP SDU before removing it from the list: \n"); LOG_I(PDCP, "Printing first bytes of PDCP SDU before removing it from the list: \n");
...@@ -187,6 +203,15 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ...@@ -187,6 +203,15 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n",
ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
ctxt.rnti, rab_id); ctxt.rnti, rab_id);
#if defined ENABLE_PDCP_PAYLOAD_DEBUG
LOG_I(PHY, "TUN interface output received from PDCP: \n");
for (int i = 0; i < 128; i++) {
printf("%02x ",(unsigned char)nl_rx_buf[i]);
}
printf("\n");
#endif
pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED, pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf, RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf,
PDCP_TRANSMISSION_MODE_DATA PDCP_TRANSMISSION_MODE_DATA
......
...@@ -81,7 +81,7 @@ void mac_rlc_data_ind ( ...@@ -81,7 +81,7 @@ void mac_rlc_data_ind (
} else { } else {
LOG_E(RLC, "%s:%d:%s: fatal: no RB found (channel ID %d)\n", LOG_E(RLC, "%s:%d:%s: fatal: no RB found (channel ID %d)\n",
__FILE__, __LINE__, __FUNCTION__, channel_idP); __FILE__, __LINE__, __FUNCTION__, channel_idP);
//exit(1); exit(1);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
......
...@@ -192,7 +192,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) { ...@@ -192,7 +192,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi); UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
} else { } else {
LOG_I(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->slot); LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->slot);
nr_rx_sdu(UL_info->module_id, nr_rx_sdu(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame, NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
......
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