Commit 88a09f0b authored by matzakos's avatar matzakos

Added Rx indication for DLSCH type and resolved issue with MIB decoding while...

Added Rx indication for DLSCH type and resolved issue with MIB decoding while sending DL IP traffic. Data packets still not parsed properly at the UE MAC layer.
parent d95ba666
...@@ -1505,6 +1505,44 @@ set(L2_SRC_UE ...@@ -1505,6 +1505,44 @@ set(L2_SRC_UE
${RRC_DIR}/L2_interface_common.c ${RRC_DIR}/L2_interface_common.c
${RRC_DIR}/L2_interface_ue.c ${RRC_DIR}/L2_interface_ue.c
) )
set(LTE_NR_L2_SRC_UE
${PDCP_DIR}/pdcp.c
${PDCP_DIR}/pdcp_fifo.c
${PDCP_DIR}/pdcp_sequence_manager.c
${PDCP_DIR}/pdcp_primitives.c
${PDCP_DIR}/pdcp_util.c
${PDCP_DIR}/pdcp_security.c
${PDCP_DIR}/pdcp_netlink.c
${RLC_AM_DIR}/rlc_am.c
${RLC_AM_DIR}/rlc_am_init.c
${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c
${RLC_AM_DIR}/rlc_am_timer_reordering.c
${RLC_AM_DIR}/rlc_am_timer_status_prohibit.c
${RLC_AM_DIR}/rlc_am_segment.c
${RLC_AM_DIR}/rlc_am_segments_holes.c
${RLC_AM_DIR}/rlc_am_in_sdu.c
${RLC_AM_DIR}/rlc_am_receiver.c
${RLC_AM_DIR}/rlc_am_retransmit.c
${RLC_AM_DIR}/rlc_am_windows.c
${RLC_AM_DIR}/rlc_am_rx_list.c
${RLC_AM_DIR}/rlc_am_reassembly.c
${RLC_AM_DIR}/rlc_am_status_report.c
${RLC_TM_DIR}/rlc_tm.c
${RLC_TM_DIR}/rlc_tm_init.c
${RLC_UM_DIR}/rlc_um.c
${RLC_UM_DIR}/rlc_um_fsm.c
${RLC_UM_DIR}/rlc_um_control_primitives.c
${RLC_UM_DIR}/rlc_um_segment.c
${RLC_UM_DIR}/rlc_um_reassembly.c
${RLC_UM_DIR}/rlc_um_receiver.c
${RLC_UM_DIR}/rlc_um_dar.c
${RLC_DIR}/rlc_mac.c
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
${RRC_DIR}/L2_interface_common.c
)
set(NR_L2_SRC_UE set(NR_L2_SRC_UE
${NR_UE_RRC_DIR}/L2_interface_ue.c ${NR_UE_RRC_DIR}/L2_interface_ue.c
...@@ -1557,7 +1595,7 @@ set (MAC_SRC_UE ...@@ -1557,7 +1595,7 @@ set (MAC_SRC_UE
${MAC_DIR}/config_ue.c ${MAC_DIR}/config_ue.c
) )
set (MAC_NR_SRC_UE set (MAC_NR_SRC_UE
${NR_UE_PHY_INTERFACE_DIR}/NR_IF_Module.c ${NR_UE_PHY_INTERFACE_DIR}/NR_IF_Module.c
${NR_UE_MAC_DIR}/config_ue.c ${NR_UE_MAC_DIR}/config_ue.c
...@@ -1613,6 +1651,10 @@ add_library( NR_L2_UE ...@@ -1613,6 +1651,10 @@ add_library( NR_L2_UE
${NR_L2_SRC_UE} ${NR_L2_SRC_UE}
${MAC_NR_SRC_UE} ${MAC_NR_SRC_UE}
) )
add_library ( LTE_NR_L2_UE
${LTE_NR_L2_SRC_UE}
)
add_library( MAC_NR_COMMON add_library( MAC_NR_COMMON
${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB/nr_mac_common.c ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB/nr_mac_common.c
...@@ -2453,9 +2495,10 @@ add_executable(nr-uesoftmodem-nos1 ...@@ -2453,9 +2495,10 @@ add_executable(nr-uesoftmodem-nos1
${SHLIB_LOADER_SOURCES} ${SHLIB_LOADER_SOURCES}
) )
target_link_libraries (nr-uesoftmodem-nos1 target_link_libraries (nr-uesoftmodem-nos1
-Wl,--start-group -Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_UE PHY_RU LFDS NR_L2_UE MAC_NR_COMMON RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_UE PHY_RU LFDS LTE_NR_L2_UE NR_L2_UE MAC_NR_COMMON
${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
-Wl,--end-group z dl) -Wl,--end-group z dl)
......
...@@ -600,7 +600,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -600,7 +600,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
} }
if(is_crnti) if(is_crnti)
{ {
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", LOG_I(PHY,"[UE %d] DLSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS); phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
} }
...@@ -621,7 +621,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -621,7 +621,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
if(is_crnti) if(is_crnti)
{ {
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->round,harq_process->TBS); LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,nr_tti_rx,harq_pid,harq_process->round,harq_process->TBS);
} }
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); //LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
......
...@@ -593,13 +593,14 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -593,13 +593,14 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance
ue->dl_indication.proc=proc; ue->dl_indication.proc=proc;
//ue->rx_ind.sfn_slot = 0; //should be set by higher-1-layer, i.e. clean_and_set_if_instance() //ue->rx_ind.sfn_slot = 0; //should be set by higher-1-layer, i.e. clean_and_set_if_instance()
ue->rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_MIB; ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].pdu_type = FAPI_NR_RX_PDU_TYPE_MIB;
ue->rx_ind.rx_indication_body[0].mib_pdu.pdu = &decoded_output[0]; ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].mib_pdu.pdu = &decoded_output[0];
ue->rx_ind.rx_indication_body[0].mib_pdu.additional_bits = xtra_byte; ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].mib_pdu.additional_bits = xtra_byte;
ue->rx_ind.rx_indication_body[0].mib_pdu.ssb_index = i_ssb; // confirm with TCL ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].mib_pdu.ssb_index = i_ssb; // confirm with TCL
ue->rx_ind.rx_indication_body[0].mib_pdu.ssb_length = Lmax; // confirm with TCL ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].mib_pdu.ssb_length = Lmax; // confirm with TCL
ue->rx_ind.rx_indication_body[0].mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL
ue->rx_ind.number_pdus = 1; //ue->rx_ind.number_pdus = 1;
ue->rx_ind.number_pdus++;
if (ue->if_inst && ue->if_inst->dl_indication) if (ue->if_inst && ue->if_inst->dl_indication)
ue->if_inst->dl_indication(&ue->dl_indication); ue->if_inst->dl_indication(&ue->dl_indication);
......
...@@ -2823,11 +2823,14 @@ void nr_ue_pbch_procedures(uint8_t eNB_id, ...@@ -2823,11 +2823,14 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN);
//LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id); //LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id);
//Temporary hardcode the ssb_index instead of taking it from the previous Rx_indication which is wrong and
//it creates problem when we have multiple types of Rx_indications. Where should this value originate from?
ret = nr_rx_pbch(ue, proc, ret = nr_rx_pbch(ue, proc,
ue->pbch_vars[eNB_id], ue->pbch_vars[eNB_id],
&ue->frame_parms, &ue->frame_parms,
eNB_id, eNB_id,
ue->rx_ind.rx_indication_body[0].mib_pdu.ssb_index, 0,//ue->rx_ind.rx_indication_body[ue->rx_ind.number_pdus].mib_pdu.ssb_index, //Temporary for RFSIMULATOR
SISO, SISO,
ue->high_speed_flag); ue->high_speed_flag);
...@@ -3792,10 +3795,13 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3792,10 +3795,13 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
if (dlsch0==NULL) if (dlsch0==NULL)
AssertFatal(0,"dlsch0 should be defined at this level \n"); AssertFatal(0,"dlsch0 should be defined at this level \n");
harq_pid = dlsch0->current_harq_pid; harq_pid = dlsch0->current_harq_pid;
is_cw0_active = dlsch0->harq_processes[harq_pid]->status; is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols; nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols;
if(dlsch1) if(dlsch1)
is_cw1_active = dlsch1->harq_processes[harq_pid]->status; is_cw1_active = dlsch1->harq_processes[harq_pid]->status;
...@@ -4019,6 +4025,27 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -4019,6 +4025,27 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
} }
LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ \n", frame_rx, nr_tti_rx); LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ \n", frame_rx, nr_tti_rx);
LOG_I(PHY, "harq_pid: %d, TBS expected dlsch0: %d, TBS expected dlsch1: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS, dlsch1->harq_processes[harq_pid]->TBS);
// fill dl_indication message
ue->dl_indication.module_id = ue->Mod_id;
ue->dl_indication.cc_id = ue->CC_id;
ue->dl_indication.gNB_index = eNB_id;
ue->dl_indication.frame = frame_rx;
ue->dl_indication.slot = nr_tti_rx;
ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance
ue->dl_indication.proc=proc;
//ue->dl_indication.rx_ind = &dlsch1->harq_processes[harq_pid]->b; //no data, only dci for now
ue->rx_ind.rx_indication_body[ue->dl_indication.rx_ind->number_pdus].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
ue->rx_ind.rx_indication_body[ue->dl_indication.rx_ind->number_pdus].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b;
ue->rx_ind.rx_indication_body[ue->dl_indication.rx_ind->number_pdus].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3;
ue->rx_ind.number_pdus++;
ue->dl_indication.dci_ind = NULL; //&ue->dci_ind;
// send to mac
if (ue->if_inst && ue->if_inst->dl_indication)
ue->if_inst->dl_indication(&ue->dl_indication);
} }
...@@ -4508,11 +4535,16 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -4508,11 +4535,16 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if ( (nr_tti_rx == 0) && (ue->decode_MIB == 1)) if ( (nr_tti_rx == 0) && (ue->decode_MIB == 1))
{ {
LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx); LOG_I(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
uint8_t i_ssb = ue->rx_ind.rx_indication_body[0].mib_pdu.ssb_index; uint8_t i_ssb = ue->rx_ind.rx_indication_body[0].mib_pdu.ssb_index;
uint8_t n_hf = (((ue->rx_ind.rx_indication_body[0].mib_pdu.additional_bits)>>4)&0x01); uint8_t n_hf = (((ue->rx_ind.rx_indication_body[0].mib_pdu.additional_bits)>>4)&0x01);
// Temporarily hardcode these values but probably the assignment based on the previous rx_ind is not the right way
i_ssb = 0;
n_hf = 0;
for (int i=1; i<4; i++) { for (int i=1; i<4; i++) {
nr_slot_fep(ue, nr_slot_fep(ue,
(ue->symbol_offset+i), //mu=1 case B (ue->symbol_offset+i), //mu=1 case B
...@@ -4535,6 +4567,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -4535,6 +4567,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
// do procedures for C-RNTI // do procedures for C-RNTI
if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1) { if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active == 1) {
LOG_I(PHY, "DLSCH data reception at nr_tti_rx: %d \n \n", nr_tti_rx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
......
...@@ -36,10 +36,12 @@ ...@@ -36,10 +36,12 @@
#include "assertions.h" #include "assertions.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "openair2/LAYER2/MAC/mac.h"
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
uint32_t get_ssb_slot(uint32_t ssb_index){ uint32_t get_ssb_slot(uint32_t ssb_index){
// this function now only support f <= 3GHz // this function now only support f <= 3GHz
return ssb_index & 0x3 ; return ssb_index & 0x3 ;
...@@ -81,7 +83,9 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, ...@@ -81,7 +83,9 @@ int8_t nr_ue_process_dlsch(module_id_t module_id,
// First we need to verify if DCI ind contains a ul-sch to be perfomred. If it does, we will handle a PUSCH in the UL_CONFIG_REQ. // First we need to verify if DCI ind contains a ul-sch to be perfomred. If it does, we will handle a PUSCH in the UL_CONFIG_REQ.
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH; ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUCCH;
for (int i=0; i<10; i++) { for (int i=0; i<10; i++) {
if (dci_ind->dci_list[i].dci_format < 2) ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; if(dci_ind!=NULL){
if (dci_ind->dci_list[i].dci_format < 2) ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
}
} }
if (ul_config->ul_config_list[ul_config->number_pdus].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) { if (ul_config->ul_config_list[ul_config->number_pdus].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) {
// fill in the elements in config request inside P5 message // fill in the elements in config request inside P5 message
...@@ -2189,3 +2193,213 @@ void nr_ue_process_mac_pdu( ...@@ -2189,3 +2193,213 @@ void nr_ue_process_mac_pdu(
AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length < 0!\n"); AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length < 0!\n");
} }
} }
//---------------------------------------------------------------------------------
unsigned char *parse_header(unsigned char *mac_header,
unsigned char *num_ce,
unsigned char *num_sdu,
unsigned char *rx_ces,
unsigned char *rx_lcids,
unsigned short *rx_lengths,
unsigned short tb_length)
{
unsigned char not_done = 1, num_ces = 0, num_cont_res =
0, num_padding = 0, num_sdus = 0, lcid, num_sdu_cnt;
unsigned char *mac_header_ptr = mac_header;
unsigned short length, ce_len = 0;
while (not_done == 1) {
if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) {
// printf("E=0\n");
not_done = 0;
}
lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID;
if (lcid < UE_CONT_RES) {
//printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]);
if (not_done == 0) { // last MAC SDU, length is implicit
mac_header_ptr++;
length =
tb_length - (mac_header_ptr - mac_header) - ce_len;
for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus;
num_sdu_cnt++) {
length -= rx_lengths[num_sdu_cnt];
}
} else {
if (((SCH_SUBHEADER_LONG *) mac_header_ptr)->F == 1) {
length =
((((SCH_SUBHEADER_LONG *) mac_header_ptr)->
L_MSB & 0x7f)
<< 8) | (((SCH_SUBHEADER_LONG *) mac_header_ptr)->
L_LSB & 0xff);
mac_header_ptr += 3;
#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC, "[UE] parse long sdu, size %x \n", length);
#endif
} else { //if (((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F == 0) {
length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L;
mac_header_ptr += 2;
}
}
#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC, "[UE] sdu %d lcid %d length %d (offset now %ld)\n",
num_sdus, lcid, length, mac_header_ptr - mac_header);
#endif
rx_lcids[num_sdus] = lcid;
rx_lengths[num_sdus] = length;
num_sdus++;
} else { // This is a control element subheader
if (lcid == SHORT_PADDING) {
num_padding++;
mac_header_ptr++;
} else {
rx_ces[num_ces] = lcid;
num_ces++;
mac_header_ptr++;
if (lcid == TIMING_ADV_CMD) {
ce_len++;
} else if (lcid == UE_CONT_RES) {
// FNA: check MAC Header is one of thoses defined in Annex B of 36.321
// Check there is only 1 Contention Resolution
if (num_cont_res) {
LOG_W(MAC,
"[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n");
// exit parsing
return NULL;
}
// UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader
if ((not_done == 0)
&& ((num_sdus) || (num_ces > 1) || (num_padding))) {
LOG_W(MAC,
"[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",
num_ces, num_sdus, num_padding);
// exit parsing
return NULL;
}
num_cont_res++;
ce_len += 6;
}
}
#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC, "[UE] ce %d lcid %d (offset now %ld)\n", num_ces,
lcid, mac_header_ptr - mac_header);
#endif
}
}
*num_ce = num_ces;
*num_sdu = num_sdus;
return (mac_header_ptr);
}
//------------------------------------------------------------------------------
void
nr_ue_send_sdu(module_id_t module_idP,
uint8_t CC_id,
frame_t frameP,
sub_frame_t subframeP,
uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index)
//------------------------------------------------------------------------------
{
unsigned char rx_ces[MAX_NUM_CE], num_ce, num_sdu, i, *payload_ptr;
unsigned char rx_lcids[NB_RB_MAX];
unsigned short rx_lengths[NB_RB_MAX];
unsigned char *tx_sdu;
//LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
payload_ptr =
parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths,
sdu_len);
#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC,
"[UE %d] ue_send_sdu : Frame %d eNB_index %d : num_ce %d num_sdu %d\n",
module_idP, frameP, eNB_index, num_ce, num_sdu);
#endif
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
for (i = 0; i < 32; i++) {
LOG_T(MAC, "%x.", sdu[i]);
}
LOG_T(MAC, "\n");
#endif
if (payload_ptr != NULL) {
for (i = 0; i < num_ce; i++) {
// printf("ce %d : %d\n",i,rx_ces[i]);
switch (rx_ces[i]) {
case UE_CONT_RES:
break;
case TIMING_ADV_CMD:
break;
case DRX_CMD:
break;
}
}
for (i = 0; i < num_sdu; i++) {
#ifdef DEBUG_HEADER_PARSING
LOG_I(MAC, "[UE] SDU %d : LCID %d, length %d\n", i,
rx_lcids[i], rx_lengths[i]);
#endif
if ((rx_lcids[i] < NB_RB_MAX) && (rx_lcids[i] > DCCH1)) {
LOG_I(MAC,
"[UE %d] Frame %d : DLSCH -> DL-DTCH%d (eNB %d, %d bytes)\n",
module_idP, frameP, rx_lcids[i], eNB_index,
rx_lengths[i]);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
int j;
for (j = 0; j < rx_lengths[i]; j++)
LOG_T(MAC, "%x.", (unsigned char) payload_ptr[j]);
LOG_T(MAC, "\n");
#endif
mac_rlc_data_ind(module_idP,
4660, //UE_mac_inst[module_idP].crnti //hardcode value corresponding to the one from the eNB
eNB_index,
frameP,
ENB_FLAG_NO,
MBMS_FLAG_NO,
rx_lcids[i],
(char *) payload_ptr, rx_lengths[i], 1,
NULL);
} else {
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (eNB %d)\n",
module_idP, frameP, rx_lcids[i], eNB_index);
}
payload_ptr += rx_lengths[i];
}
} // end if (payload_ptr != NULL)
}
...@@ -402,7 +402,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, ...@@ -402,7 +402,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
header_length_total); header_length_total);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid,
TBS, //not used TBS,
(char *)&dlsch_buffer[sdu_length_total] (char *)&dlsch_buffer[sdu_length_total]
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0 ,0, 0
......
...@@ -70,9 +70,16 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr ...@@ -70,9 +70,16 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr
} }
// L2 Abstraction Layer // L2 Abstraction Layer
int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, uint8_t *pduP, uint32_t pdu_len){ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, uint8_t *pduP, uint32_t pdu_len, frame_t frame, int slot){
LOG_I(MAC, "handle_dlsch at MAC layer \n");
// return 0; // return 0;
nr_ue_send_sdu(module_id, 0, frame, slot,
pduP,
pdu_len,
0);
return nr_ue_process_dlsch( module_id, return nr_ue_process_dlsch( module_id,
cc_id, cc_id,
gNB_index, gNB_index,
...@@ -80,6 +87,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n ...@@ -80,6 +87,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n
pduP, pduP,
pdu_len); pdu_len);
} }
int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
...@@ -205,7 +213,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -205,7 +213,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
} }
if(dl_info->rx_ind != NULL){ if(dl_info->rx_ind != NULL){
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND]\n"); LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
for(i=0; i<dl_info->rx_ind->number_pdus; ++i){ for(i=0; i<dl_info->rx_ind->number_pdus; ++i){
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){ switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
case FAPI_NR_RX_PDU_TYPE_MIB: case FAPI_NR_RX_PDU_TYPE_MIB:
...@@ -216,6 +224,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -216,6 +224,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index, (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index,
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length, (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length,
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB; (dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB;
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], MIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
/*ret_mask |= (handle_bcch_bch( dl_info->proc,
dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
dl_info->rx_ind->rx_indication_body[i].mib_pdu.pdu,
dl_info->rx_ind->rx_indication_body[i].mib_pdu.additional_bits,
dl_info->rx_ind->rx_indication_body[i].mib_pdu.ssb_index,
dl_info->rx_ind->rx_indication_body[i].mib_pdu.ssb_length,
dl_info->rx_ind->rx_indication_body[i].mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB;*/
break; break;
case FAPI_NR_RX_PDU_TYPE_SIB: case FAPI_NR_RX_PDU_TYPE_SIB:
ret_mask |= (handle_bcch_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, ret_mask |= (handle_bcch_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
...@@ -227,8 +243,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -227,8 +243,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
// ret_mask |= (0) << FAPI_NR_RX_PDU_TYPE_DLSCH; // ret_mask |= (0) << FAPI_NR_RX_PDU_TYPE_DLSCH;
ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->dci_ind, ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->dci_ind,
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu, (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu,
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_DLSCH; (dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length, dl_info->frame, dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
LOG_I(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], DLSCH case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
/*ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->dci_ind,
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu,
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length, dl_info->frame, dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
*/
break; break;
default: default:
......
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