Commit c046eb66 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge remote-tracking branch 'origin/nr-ip-over-LTE-stack' into integration_develop-nr_2019w42

Conflicts:
	executables/nr-softmodem.c
	executables/nr-softmodem.h
	targets/ARCH/rfsimulator/simulator.c
parents a5af0163 054eaf66
...@@ -1566,6 +1566,44 @@ set(L2_SRC_UE ...@@ -1566,6 +1566,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
...@@ -1618,7 +1656,7 @@ set (MAC_SRC_UE ...@@ -1618,7 +1656,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
...@@ -1674,6 +1712,10 @@ endif() ...@@ -1674,6 +1712,10 @@ endif()
add_dependencies(L2_UE rrc_flag s1ap_flag x2_flag) add_dependencies(L2_UE rrc_flag s1ap_flag x2_flag)
add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} ) add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} )
add_library ( LTE_NR_L2_UE
${LTE_NR_L2_SRC_UE}
)
add_library( MAC_NR_COMMON ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB/nr_mac_common.c ) add_library( MAC_NR_COMMON ${OPENAIR2_DIR}/LAYER2/NR_MAC_gNB/nr_mac_common.c )
...@@ -2504,6 +2546,8 @@ add_executable(nr-uesoftmodem-nos1 ...@@ -2504,6 +2546,8 @@ add_executable(nr-uesoftmodem-nos1
${rrc_h} ${rrc_h}
${s1ap_h} ${s1ap_h}
# ${OPENAIR_BIN_DIR}/messages_xml.h # ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/nr-ue.c ${OPENAIR_DIR}/executables/nr-ue.c
${OPENAIR_DIR}/executables/nr-uesoftmodem.c ${OPENAIR_DIR}/executables/nr-uesoftmodem.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
...@@ -2517,9 +2561,10 @@ add_executable(nr-uesoftmodem-nos1 ...@@ -2517,9 +2561,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_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)
......
...@@ -98,6 +98,8 @@ ...@@ -98,6 +98,8 @@
#define CONFIG_HLP_TELN "Start embedded telnet server \n" #define CONFIG_HLP_TELN "Start embedded telnet server \n"
#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n" #define CONFIG_HLP_MSC "Enable the MSC tracing utility \n"
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
/*--------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */ /* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
......
...@@ -474,6 +474,8 @@ static void get_options(void) { ...@@ -474,6 +474,8 @@ static void get_options(void) {
uint32_t online_log_messages; uint32_t online_log_messages;
uint32_t glog_level, glog_verbosity; uint32_t glog_level, glog_verbosity;
uint32_t start_telnetsrv = 0; uint32_t start_telnetsrv = 0;
uint32_t noS1;
uint32_t nokrnmod;
paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ; paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
paramdef_t cmdline_logparams[] = CMDLINE_LOGPARAMS_DESC_NR ; paramdef_t cmdline_logparams[] = CMDLINE_LOGPARAMS_DESC_NR ;
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
...@@ -511,6 +513,7 @@ static void get_options(void) { ...@@ -511,6 +513,7 @@ static void get_options(void) {
if(parallel_config != NULL) set_parallel_conf(parallel_config); if(parallel_config != NULL) set_parallel_conf(parallel_config);
if(worker_config != NULL) set_worker_conf(worker_config); if(worker_config != NULL) set_worker_conf(worker_config);
} }
...@@ -831,6 +834,30 @@ static void wait_nfapi_init(char *thread_name) { ...@@ -831,6 +834,30 @@ static void wait_nfapi_init(char *thread_name) {
printf( "NFAPI: got sync (%s)\n", thread_name); printf( "NFAPI: got sync (%s)\n", thread_name);
} }
void init_pdcp(void) {
//if (!NODE_IS_DU(RC.rrc[0]->node_type)) {
pdcp_layer_init();
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
if (IS_SOFTMODEM_NOS1){
printf("IS_SOFTMODEM_NOS1 option enabled \n");
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
}
pdcp_module_init(pdcp_initmask);
/*if (NODE_IS_CU(RC.rrc[0]->node_type)) {
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
} else {*/
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
//}
/*} else {
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
}*/
}
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
int i, ru_id, CC_id = 0; int i, ru_id, CC_id = 0;
...@@ -852,6 +879,7 @@ int main( int argc, char **argv ) ...@@ -852,6 +879,7 @@ int main( int argc, char **argv )
configure_linux(); configure_linux();
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); get_options ();
get_common_options();
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n"); fprintf(stderr,"Getting configuration failed\n");
...@@ -914,6 +942,9 @@ init_opt(); ...@@ -914,6 +942,9 @@ init_opt();
flexran_agent_start(i); flexran_agent_start(i);
} }
if(IS_SOFTMODEM_NOS1)
init_pdcp();
// init UE_PF_PO and mutex lock // init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL); pthread_mutex_init(&ue_pf_po_mutex, NULL);
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "flexran_agent.h" #include "flexran_agent.h"
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "proto_agent.h"
#define DEFAULT_DLF 2680000000 #define DEFAULT_DLF 2680000000
...@@ -17,34 +18,49 @@ ...@@ -17,34 +18,49 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_PARAMS_DESC_GNB { \ #define CMDLINE_PARAMS_DESC_GNB { \
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)},\ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)},\
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \ {"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \ {"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \ {"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF, TYPE_UINT, 0}, \ {"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF, TYPE_UINT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \ {"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \ {"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ {"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ {"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \ {"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \ {"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0}, \
} {"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0} \
}
typedef struct {
int *argc;
char **argv;
} scopeParms_t;
#define SOFTMODEM_NOS1_BIT (1<<0)
#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
extern uint64_t get_softmodem_optmask(void);
extern void get_common_options(void);
extern int T_port; extern int T_port;
extern int T_nowait; extern int T_nowait;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/system.h" #include "common/utils/system.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "executables/nr-softmodem.h"
#include "T.h" #include "T.h"
...@@ -412,6 +413,15 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { ...@@ -412,6 +413,15 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_tti_rx, (rdtsc()-a)/3500); LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_tti_rx, (rdtsc()-a)/3500);
//printf(">>> nr_ue_pdcch_procedures ended\n"); //printf(">>> nr_ue_pdcch_procedures ended\n");
#endif #endif
if(IS_SOFTMODEM_NOS1){ //&& proc->nr_tti_rx==1
//Hardcoded rnti value
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
0x1234, proc->frame_rx,
proc->nr_tti_rx, 0);
//pdcp_run(&ctxt);
pdcp_fifo_flush_sdus(&ctxt);
}
} }
...@@ -722,6 +732,7 @@ void *UE_thread(void *arg) { ...@@ -722,6 +732,7 @@ void *UE_thread(void *arg) {
rxp, rxp,
readBlockSize, readBlockSize,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
/*
AssertFatal( writeBlockSize == AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+ timestamp+
...@@ -732,6 +743,7 @@ void *UE_thread(void *arg) { ...@@ -732,6 +743,7 @@ void *UE_thread(void *arg) {
writeBlockSize, writeBlockSize,
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
1),""); 1),"");
*/
if( slot_nr==(nb_slot_frame-1)) { if( slot_nr==(nb_slot_frame-1)) {
// read in first symbol of next frame and adjust for timing drift // read in first symbol of next frame and adjust for timing drift
...@@ -776,7 +788,7 @@ void *UE_thread(void *arg) { ...@@ -776,7 +788,7 @@ void *UE_thread(void *arg) {
msgToPush->key=slot_nr; msgToPush->key=slot_nr;
pushTpool(Tpool, msgToPush); pushTpool(Tpool, msgToPush);
if (getenv("RFSIMULATOR")) { if (getenv("RFSIMULATOR") || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR")
// FixMe: Wait previous thread is done, because race conditions seems too bad // FixMe: Wait previous thread is done, because race conditions seems too bad
// in case of actual RF board, the overlap between threads mitigate the issue // in case of actual RF board, the overlap between threads mitigate the issue
// We must receive one message, that proves the slot processing is done // We must receive one message, that proves the slot processing is done
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
//#include "common/utils/threadPool/thread-pool.h"
#include "common/utils/load_module_shlib.h" #include "common/utils/load_module_shlib.h"
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
...@@ -81,6 +82,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -81,6 +82,7 @@ unsigned short config_frames[4] = {2,9,11,13};
/* Callbacks, globals and object handlers */ /* Callbacks, globals and object handlers */
extern void reset_stats( FL_OBJECT *, long ); extern void reset_stats( FL_OBJECT *, long );
//extern void initTpool(char *params,tpool_t *pool, bool performanceMeas);
/* Forms and Objects */ /* Forms and Objects */
...@@ -372,6 +374,8 @@ static void get_options(void) { ...@@ -372,6 +374,8 @@ static void get_options(void) {
uint32_t online_log_messages; uint32_t online_log_messages;
uint32_t glog_level, glog_verbosity; uint32_t glog_level, glog_verbosity;
uint32_t start_telnetsrv=0; uint32_t start_telnetsrv=0;
//uint32_t noS1;
//uint32_t nokrnmod;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ;
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC_NR ; paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC_NR ;
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
...@@ -627,6 +631,27 @@ void init_openair0(void) { ...@@ -627,6 +631,27 @@ void init_openair0(void) {
} }
} }
void init_pdcp(void) {
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
/*if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
}*/
if (IS_SOFTMODEM_NOKRNMOD)
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
/*if (rlc_module_init() != 0) {
LOG_I(RLC, "Problem at RLC initiation \n");
}
pdcp_layer_init();
nr_ip_over_LTE_DRB_preconfiguration();*/
pdcp_module_init(pdcp_initmask);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
LOG_I(PDCP, "Before getting out from init_pdcp() \n");
}
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
//uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2; //uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
...@@ -646,6 +671,7 @@ int main( int argc, char **argv ) { ...@@ -646,6 +671,7 @@ int main( int argc, char **argv ) {
logInit(); logInit();
// get options and fill parameters from configuration file // get options and fill parameters from configuration file
get_options (); //Command-line options, enb_properties get_options (); //Command-line options, enb_properties
get_common_options();
#if T_TRACER #if T_TRACER
T_Config_Init(); T_Config_Init();
#endif #endif
...@@ -659,18 +685,22 @@ int main( int argc, char **argv ) { ...@@ -659,18 +685,22 @@ int main( int argc, char **argv ) {
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
init_opt() ; init_opt() ;
if(IS_SOFTMODEM_NOS1)
init_pdcp();
if (ouput_vcd) { if (ouput_vcd) {
vcd_signal_dumper_init("/tmp/openair_dump_nrUE.vcd"); vcd_signal_dumper_init("/tmp/openair_dump_nrUE.vcd");
} }
/*
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
netlink_init(); netlink_init();
#if defined(PDCP_USE_NETLINK_QUEUES) #if defined(PDCP_USE_NETLINK_QUEUES)
pdcp_netlink_init(); pdcp_netlink_init();
#endif #endif
#endif #endif
#ifndef PACKAGE_VERSION */
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif #endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
......
...@@ -138,6 +138,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -138,6 +138,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
nfapi_nr_config_request_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
NR_gNB_DLSCH_t *dlsch; NR_gNB_DLSCH_t *dlsch;
uint16_t N_RB = params_rel15->n_RB_BWP; uint16_t N_RB = params_rel15->n_RB_BWP;
uint8_t fsize=0, pos=0, cand_idx=0; uint8_t fsize=0, pos=0, cand_idx=0;
...@@ -182,12 +183,12 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -182,12 +183,12 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// Freq domain assignment // Freq domain assignment
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
pos=fsize; pos=fsize;
*dci_pdu |= ((pdu_rel15->frequency_domain_assignment&((1<<fsize)-1)) << (dci_alloc->size-pos)); *dci_pdu |= ((pdu_rel15->frequency_domain_assignment&((1<<fsize)-1)) << (dci_alloc->size-pos));
#ifdef DEBUG_FILL_DCI #ifdef DEBUG_FILL_DCI
printf("frequency-domain assignment %d (%d bits)=> %d (0x%lx)\n",pdu_rel15->frequency_domain_assignment,fsize,dci_alloc->size-pos,*dci_pdu); printf("frequency-domain assignment %d (%d bits)=> %d (0x%lx)\n",pdu_rel15->frequency_domain_assignment,fsize,dci_alloc->size-pos,*dci_pdu);
#endif #endif
// Time domain assignment // Time domain assignment
pos+=4; pos+=4;
*dci_pdu |= (((uint64_t)pdu_rel15->time_domain_assignment&0xf) << (dci_alloc->size-pos)); *dci_pdu |= (((uint64_t)pdu_rel15->time_domain_assignment&0xf) << (dci_alloc->size-pos));
#ifdef DEBUG_FILL_DCI #ifdef DEBUG_FILL_DCI
printf("time-domain assignment %d (3 bits)=> %d (0x%lx)\n",pdu_rel15->time_domain_assignment,dci_alloc->size-pos,*dci_pdu); printf("time-domain assignment %d (3 bits)=> %d (0x%lx)\n",pdu_rel15->time_domain_assignment,dci_alloc->size-pos,*dci_pdu);
...@@ -246,22 +247,22 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -246,22 +247,22 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// UL/SUL indicator 1 bit // UL/SUL indicator 1 bit
pos++; pos++;
*dci_pdu |= (pdu_rel15->ul_sul_indicator&1)<<(dci_alloc->size-pos); *dci_pdu |= (pdu_rel15->ul_sul_indicator&1)<<(dci_alloc->size-pos);
// SS/PBCH index 6 bits // SS/PBCH index 6 bits
pos+=6; pos+=6;
*dci_pdu |= ((pdu_rel15->ss_pbch_index&0x3f)<<(dci_alloc->size-pos)); *dci_pdu |= ((pdu_rel15->ss_pbch_index&0x3f)<<(dci_alloc->size-pos));
// prach_mask_index 4 bits // prach_mask_index 4 bits
pos+=4; pos+=4;
*dci_pdu |= ((pdu_rel15->prach_mask_index&0xf)<<(dci_alloc->size-pos)); *dci_pdu |= ((pdu_rel15->prach_mask_index&0xf)<<(dci_alloc->size-pos));
} //end if } //end if
else { else {
// Time domain assignment 4bit // Time domain assignment 4bit
pos+=4; pos+=4;
*dci_pdu |= ((pdu_rel15->time_domain_assignment&0xf) << (dci_alloc->size-pos)); *dci_pdu |= ((pdu_rel15->time_domain_assignment&0xf) << (dci_alloc->size-pos));
#ifdef DEBUG_FILL_DCI #ifdef DEBUG_FILL_DCI
printf("Time domain assignment %d (%d bits)=> %d (0x%lx)\n",pdu_rel15->time_domain_assignment,4,dci_alloc->size-pos,*dci_pdu); printf("Time domain assignment %d (%d bits)=> %d (0x%lx)\n",pdu_rel15->time_domain_assignment,4,dci_alloc->size-pos,*dci_pdu);
...@@ -286,7 +287,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -286,7 +287,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
*dci_pdu |= (pdu_rel15->ndi&1)<<(dci_alloc->size-pos); *dci_pdu |= (pdu_rel15->ndi&1)<<(dci_alloc->size-pos);
#ifdef DEBUG_FILL_DCI #ifdef DEBUG_FILL_DCI
printf("NDI %d (%d bits)=> %d (0x%lx)\n",pdu_rel15->ndi,1,dci_alloc->size-pos,*dci_pdu); printf("NDI %d (%d bits)=> %d (0x%lx)\n",pdu_rel15->ndi,1,dci_alloc->size-pos,*dci_pdu);
#endif #endif
// Redundancy version 2bit // Redundancy version 2bit
pos+=2; pos+=2;
...@@ -334,7 +335,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -334,7 +335,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
break; break;
case NFAPI_NR_RNTI_P: case NFAPI_NR_RNTI_P:
// Short Messages Indicator – 2 bits // Short Messages Indicator – 2 bits
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->short_messages_indicator>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->short_messages_indicator>>(1-i))&1)<<(dci_alloc->size-pos++);
...@@ -351,7 +352,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -351,7 +352,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// VRB to PRB mapping 1 bit // VRB to PRB mapping 1 bit
*dci_pdu |= ((uint64_t)pdu_rel15->vrb_to_prb_mapping&1)<<(dci_alloc->size-pos++); *dci_pdu |= ((uint64_t)pdu_rel15->vrb_to_prb_mapping&1)<<(dci_alloc->size-pos++);
// MCS 5 bit // MCS 5 bit
for (int i=0; i<5; i++) for (int i=0; i<5; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->mcs>>(4-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->mcs>>(4-i))&1)<<(dci_alloc->size-pos++);
// TB scaling 2 bit // TB scaling 2 bit
...@@ -360,7 +361,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -360,7 +361,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
break; break;
case NFAPI_NR_RNTI_SI: case NFAPI_NR_RNTI_SI:
// Freq domain assignment 0-16 bit // Freq domain assignment 0-16 bit
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
...@@ -377,9 +378,9 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -377,9 +378,9 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// Redundancy version 2bit // Redundancy version 2bit
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++);
break; break;
case NFAPI_NR_RNTI_TC: case NFAPI_NR_RNTI_TC:
// indicating a DL DCI format 1bit // indicating a DL DCI format 1bit
*dci_pdu |= ((uint64_t)pdu_rel15->format_indicator&1)<<(dci_alloc->size-pos++); *dci_pdu |= ((uint64_t)pdu_rel15->format_indicator&1)<<(dci_alloc->size-pos++);
...@@ -400,14 +401,14 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -400,14 +401,14 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// Redundancy version 2bit // Redundancy version 2bit
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++);
// HARQ process number 4bit // HARQ process number 4bit
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->harq_pid>>(3-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->harq_pid>>(3-i))&1)<<(dci_alloc->size-pos++);
// Downlink assignment index – 2 bits // Downlink assignment index – 2 bits
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->dai>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->dai>>(1-i))&1)<<(dci_alloc->size-pos++);
// TPC command for scheduled PUCCH – 2 bits // TPC command for scheduled PUCCH – 2 bits
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->tpc>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->tpc>>(1-i))&1)<<(dci_alloc->size-pos++);
...@@ -420,7 +421,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -420,7 +421,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// PDSCH-to-HARQ_feedback timing indicator – 3 bits // PDSCH-to-HARQ_feedback timing indicator – 3 bits
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->pdsch_to_harq_feedback_timing_indicator>>(2-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->pdsch_to_harq_feedback_timing_indicator>>(2-i))&1)<<(dci_alloc->size-pos++);
break; break;
} }
break; break;
...@@ -448,10 +449,10 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -448,10 +449,10 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// Redundancy version 2bit // Redundancy version 2bit
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++);
// HARQ process number 4bit // HARQ process number 4bit
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->harq_pid>>(3-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->harq_pid>>(3-i))&1)<<(dci_alloc->size-pos++);
// TPC command for scheduled PUSCH – 2 bits // TPC command for scheduled PUSCH – 2 bits
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->tpc>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->tpc>>(1-i))&1)<<(dci_alloc->size-pos++);
...@@ -463,11 +464,11 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -463,11 +464,11 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// UL/SUL indicator – 1 bit // UL/SUL indicator – 1 bit
if (cfg->pucch_config.pucch_GroupHopping.value) if (cfg->pucch_config.pucch_GroupHopping.value)
*dci_pdu |= ((uint64_t)pdu_rel15->ul_sul_indicator&1)<<(dci_alloc->size-pos++); *dci_pdu |= ((uint64_t)pdu_rel15->ul_sul_indicator&1)<<(dci_alloc->size-pos++);
break; break;
case NFAPI_NR_RNTI_TC: case NFAPI_NR_RNTI_TC:
// indicating a DL DCI format 1bit // indicating a DL DCI format 1bit
*dci_pdu |= (pdu_rel15->format_indicator&1)<<(dci_alloc->size-pos++); *dci_pdu |= (pdu_rel15->format_indicator&1)<<(dci_alloc->size-pos++);
// Freq domain assignment max 16 bit // Freq domain assignment max 16 bit
...@@ -487,7 +488,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -487,7 +488,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
// Redundancy version 2bit // Redundancy version 2bit
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->rv>>(1-i))&1)<<(dci_alloc->size-pos++);
// HARQ process number 4bit // HARQ process number 4bit
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
*dci_pdu |= (((uint64_t)pdu_rel15->harq_pid>>(3-i))&1)<<(dci_alloc->size-pos++); *dci_pdu |= (((uint64_t)pdu_rel15->harq_pid>>(3-i))&1)<<(dci_alloc->size-pos++);
...@@ -504,7 +505,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, ...@@ -504,7 +505,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
*dci_pdu |= ((uint64_t)pdu_rel15->ul_sul_indicator&1)<<(dci_alloc->size-pos++); *dci_pdu |= ((uint64_t)pdu_rel15->ul_sul_indicator&1)<<(dci_alloc->size-pos++);
break; break;
} }
break; break;
} }
......
...@@ -645,7 +645,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -645,7 +645,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) { for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) {
if (ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates[(p<<1)+aarx]) if (ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates[(p<<1)+aarx])
{ {
LOG_I(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns], symbol); LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns], symbol);
idft((int16_t*) &ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates[(p<<1)+aarx][0], idft((int16_t*) &ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates[(p<<1)+aarx][0],
(int16_t*) ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates_time[(p<<1)+aarx],1); (int16_t*) ue->pdcch_vars[ue->current_thread_id[Ns]][eNB_offset]->dl_ch_estimates_time[(p<<1)+aarx],1);
} }
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h" #include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" #include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
//#define DEBUG_DLSCH_DECODING //#define DEBUG_DLSCH_DECODING
//#define ENABLE_PHY_PAYLOAD_DEBUG 1
#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX #define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX
...@@ -302,6 +303,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -302,6 +303,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
A = harq_process->TBS; A = harq_process->TBS;
ret = dlsch->max_ldpc_iterations + 1; ret = dlsch->max_ldpc_iterations + 1;
dlsch->last_iteration_cnt = ret;
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl); harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
G = harq_process->G; G = harq_process->G;
...@@ -543,6 +545,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -543,6 +545,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
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)) {
printf("\x1B[34m" "Segment %d CRC OK\n",r); printf("\x1B[34m" "Segment %d CRC OK\n",r);
//Temporary hack
no_iteration_ldpc = dlsch->max_ldpc_iterations;
ret = no_iteration_ldpc; ret = no_iteration_ldpc;
} }
else { else {
...@@ -591,7 +595,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -591,7 +595,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break; if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1); LOG_I(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1);
err_flag = 1; err_flag = 1;
} }
} }
...@@ -605,10 +609,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -605,10 +609,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
frame_rx_prev = frame_rx_prev%1024; frame_rx_prev = frame_rx_prev%1024;
if (err_flag == 1) { if (err_flag == 1) {
#if UE_DEBUG_TRACE //#if UE_DEBUG_TRACE
LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
phy_vars_ue->Mod_id, frame, nr_tti_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); phy_vars_ue->Mod_id, frame, nr_tti_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
#endif //#endif
harq_process->harq_ack.ack = 0; harq_process->harq_ack.ack = 0;
harq_process->harq_ack.harq_id = harq_pid; harq_process->harq_ack.harq_id = harq_pid;
harq_process->harq_ack.send_harq_status = 1; harq_process->harq_ack.send_harq_status = 1;
...@@ -623,16 +627,16 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -623,16 +627,16 @@ 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);
} }
return((1 + dlsch->max_ldpc_iterations)); return((1 + dlsch->max_ldpc_iterations));
} else { } else {
#if UE_DEBUG_TRACE //#if UE_DEBUG_TRACE
LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n", LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
phy_vars_ue->Mod_id,nr_tti_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round); phy_vars_ue->Mod_id,nr_tti_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
#endif //#endif
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
harq_process->round = 0; harq_process->round = 0;
...@@ -645,7 +649,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -645,7 +649,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);
...@@ -679,6 +683,20 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -679,6 +683,20 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->b[offset], harq_process->b[offset],
harq_process->F>>3, harq_process->F>>3,
harq_process->c[r]); harq_process->c[r]);
/*printf ("Printing payload bytes:");
for (int i = 0; i < Kr_bytes; i++){
printf("%d : %d \n", i, harq_process->b[i]);
}*/
#endif
#if defined(ENABLE_PHY_PAYLOAD_DEBUG)
if (frame%100 == 0){
LOG_I (PHY, "Printing 10 first payload bytes at frame: %d ", frame);
for (int i = 0; i <10 ; i++){ //Kr_bytes
LOG_I(PHY, "[%d] : %x ", i, harq_process->b[i]);
}
}
#endif #endif
} }
......
...@@ -611,7 +611,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -611,7 +611,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
rx_ind.rx_indication_body[0].mib_pdu.ssb_index = i_ssb; // confirm with TCL rx_ind.rx_indication_body[0].mib_pdu.ssb_index = i_ssb; // confirm with TCL
rx_ind.rx_indication_body[0].mib_pdu.ssb_length = Lmax; // confirm with TCL rx_ind.rx_indication_body[0].mib_pdu.ssb_length = Lmax; // confirm with TCL
rx_ind.rx_indication_body[0].mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL rx_ind.rx_indication_body[0].mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL
rx_ind.number_pdus = 1; rx_ind.number_pdus = 1; //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(&dl_indication); ue->if_inst->dl_indication(&dl_indication);
......
...@@ -54,6 +54,44 @@ void handle_nr_nfapi_bch_pdu(PHY_VARS_gNB *gNB, ...@@ -54,6 +54,44 @@ void handle_nr_nfapi_bch_pdu(PHY_VARS_gNB *gNB,
// adjust transmit amplitude here based on NFAPI info // adjust transmit amplitude here based on NFAPI info
} }
/*void handle_nr_nfapi_dlsch_pdu(PHY_VARS_gNB *gNB,int frame,int subframe,gNB_L1_rxtx_proc_t *proc,
uint8_t codeword_index,
uint8_t *sdu)
{
int UE_id = 0; //Hardcode UE_id for now
int harq_pid;
NR_gNB_DLSCH_t *dlsch0=NULL, *dlsch1=NULL;
NR_DL_gNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
// Based on nr_fill_dci_and_dlsch only gNB->dlsch[0][0] gets filled now. So maybe we do not need dlsch1.
dlsch0 = gNB->dlsch[UE_id][0];
dlsch1 = gNB->dlsch[UE_id][1];
harq_pid = dlsch0->harq_ids[subframe];
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid];
//if (dlsch0_harq->round==0) { //get pointer to SDU if this a new SDU
if(sdu == NULL) {
LOG_E(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d subframe %d]: programming dlsch for round 0 \n",
frame,subframe,
proc->frame_tx,proc->slot_tx);
return;
}
//AssertFatal(sdu!=NULL,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d subframe %d]: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d dlsch0_harq[round:%d SFN/SF:%d%d pdu:%p mcs:%d ndi:%d pdschstart:%d]\n",
// frame,subframe,
// proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid,
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe,dlsch0_harq->pdu,dlsch0_harq->mcs,dlsch0_harq->ndi,dlsch0_harq->pdsch_start);
if (codeword_index == 0) dlsch0_harq->pdu = sdu;
else dlsch1_harq->pdu = sdu;
LOG_I(PHY, "SFN/SF: %d/%d DLSCH PDU filled \n",frame, subframe);
// }
}*/
void handle_nfapi_nr_dci_dl_pdu(PHY_VARS_gNB *gNB, void handle_nfapi_nr_dci_dl_pdu(PHY_VARS_gNB *gNB,
int frame, int slot, int frame, int slot,
...@@ -156,7 +194,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -156,7 +194,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
} }
} }
} }
if (nfapi_mode && do_oai && !dont_send) { if (nfapi_mode && do_oai && !dont_send) {
oai_nfapi_tx_req(Sched_INFO->TX_req); oai_nfapi_tx_req(Sched_INFO->TX_req);
......
...@@ -3536,14 +3536,19 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3536,14 +3536,19 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
uint8_t nb_re_dmrs = 6; //(dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4; uint8_t nb_re_dmrs = 6; //(dmrs_type==NFAPI_NR_DMRS_TYPE1)?6:4;
uint16_t length_dmrs = 1; //cfg->pdsch_config.dmrs_max_length.value; uint16_t length_dmrs = 1; //cfg->pdsch_config.dmrs_max_length.value;
uint16_t nb_symb_sch = 9; uint16_t nb_symb_sch = 9;
nr_downlink_indication_t dl_indication;
fapi_nr_rx_indication_t rx_ind;
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;
...@@ -3767,6 +3772,33 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3767,6 +3772,33 @@ 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);
if(ret<dlsch0->max_ldpc_iterations+1){
// fill dl_indication message
dl_indication.module_id = ue->Mod_id;
dl_indication.cc_id = ue->CC_id;
dl_indication.gNB_index = eNB_id;
dl_indication.frame = frame_rx;
dl_indication.slot = nr_tti_rx;
dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance
dl_indication.proc=proc;
//dl_indication.rx_ind->number_pdus
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b;
rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3;
LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length);
rx_ind.number_pdus = 1;
//ue->dl_indication.rx_ind = &dlsch1->harq_processes[harq_pid]->b; //no data, only dci for now
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(&dl_indication);
}
} }
...@@ -4282,7 +4314,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -4282,7 +4314,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
// looking for pbch only in slot where it is supposed to be // looking for pbch only in slot where it is supposed to be
if ((ue->decode_MIB == 1) && slot_pbch) if ((ue->decode_MIB == 1) && slot_pbch)
{ {
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);
for (int i=1; i<4; i++) { for (int i=1; i<4; i++) {
...@@ -4307,6 +4339,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -4307,6 +4339,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
......
...@@ -74,6 +74,56 @@ int rrc_init_nr_global_param (void) {return(0);} ...@@ -74,6 +74,56 @@ int rrc_init_nr_global_param (void) {return(0);}
void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB_positions,uint16_t ssb_periodicity,uint64_t dl_CarrierFreqP,uint32_t dl_BandwidthP); void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB_positions,uint16_t ssb_periodicity,uint64_t dl_CarrierFreqP,uint32_t dl_BandwidthP);
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);} const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);}
uint64_t get_softmodem_optmask(void) {return 0;}
mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP, const rnti_t rntiP,
const eNB_index_t eNB_index, const frame_t frameP,
const sub_frame_t subframeP, const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
){mac_rlc_status_resp_t mac_rlc_status_resp; return mac_rlc_status_resp;}
tbs_size_t mac_rlc_data_req(
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP,
char *buffer_pP
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,const uint32_t sourceL2Id
,const uint32_t destinationL2Id
#endif
)
{return 0;}
int generate_dlsch_header(unsigned char *mac_header,
unsigned char num_sdus,
unsigned short *sdu_lengths,
unsigned char *sdu_lcids,
unsigned char drx_cmd,
unsigned short timing_advance_cmd,
unsigned char *ue_cont_res_id,
unsigned char short_padding,
unsigned short post_padding){return 0;}
void nr_ip_over_LTE_DRB_preconfiguration(void){}
void mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP)
{}
// needed for some functions // needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
...@@ -710,7 +760,8 @@ int main(int argc, char **argv) ...@@ -710,7 +760,8 @@ int main(int argc, char **argv)
} }
if (UE_mac->dl_config_request.number_pdus == 0) if (UE->dlsch[UE->current_thread_id[slot]][0][0]->last_iteration_cnt >=
UE->dlsch[UE->current_thread_id[slot]][0][0]->max_ldpc_iterations+1)
n_errors++; n_errors++;
//---------------------------------------------------------- //----------------------------------------------------------
......
...@@ -69,6 +69,23 @@ uint16_t NB_UE_INST = 1; ...@@ -69,6 +69,23 @@ uint16_t NB_UE_INST = 1;
// dummy functions // dummy functions
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; } const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
void mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP)
{}
uint64_t get_softmodem_optmask(void) {return 0;}
int rlc_module_init (void) {return(0);}
void pdcp_layer_init (void) {}
void nr_ip_over_LTE_DRB_preconfiguration(void){}
// needed for some functions // needed for some functions
uint16_t n_rnti = 0x1234; uint16_t n_rnti = 0x1234;
......
...@@ -134,5 +134,7 @@ void nr_ue_process_mac_pdu( ...@@ -134,5 +134,7 @@ void nr_ue_process_mac_pdu(
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len); int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len);
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);
#endif #endif
/** @}*/ /** @}*/
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
//#include "defs.h" //#include "defs.h"
#include "mac_proto.h" #include "mac_proto.h"
#include "executables/nr-softmodem.h"
static NR_UE_MAC_INST_t *nr_ue_mac_inst; static NR_UE_MAC_INST_t *nr_ue_mac_inst;
...@@ -45,6 +46,14 @@ nr_l2_init_ue(void) ...@@ -45,6 +46,14 @@ nr_l2_init_ue(void)
//init mac here //init mac here
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST); nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST);
if (IS_SOFTMODEM_NOS1){
if (rlc_module_init() != 0) {
LOG_I(RLC, "Problem at RLC initiation \n");
}
pdcp_layer_init();
nr_ip_over_LTE_DRB_preconfiguration();
}
return (1); return (1);
} }
......
...@@ -36,10 +36,27 @@ ...@@ -36,10 +36,27 @@
#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>
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
extern void mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP);
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 +98,9 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, ...@@ -81,7 +98,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
...@@ -2182,3 +2201,213 @@ void nr_ue_process_mac_pdu( ...@@ -2182,3 +2201,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];
//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_D(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)
LOG_I(MAC, "Printing MAC PDU contents at slot: %d \n", subframeP);
int j;
for (j = 0; j < 20; j++) //rx_lengths[i]
LOG_I(MAC, "%x.", (unsigned char) payload_ptr[j]);
LOG_I(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)
}
...@@ -70,9 +70,9 @@ extern uint8_t nfapi_mode; ...@@ -70,9 +70,9 @@ extern uint8_t nfapi_mode;
uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
void clear_nr_nfapi_information(gNB_MAC_INST * gNB, void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
int CC_idP, int CC_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP){ sub_frame_t slotP){
nfapi_nr_dl_config_request_t *DL_req = &gNB->DL_req[0]; nfapi_nr_dl_config_request_t *DL_req = &gNB->DL_req[0];
...@@ -102,10 +102,10 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, ...@@ -102,10 +102,10 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
} }
} }
/* /*
void check_nr_ul_failure(module_id_t module_idP, void check_nr_ul_failure(module_id_t module_idP,
int CC_id, int CC_id,
int UE_id, int UE_id,
frame_t frameP, frame_t frameP,
sub_frame_t slotP) { sub_frame_t slotP) {
UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list; UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
...@@ -191,13 +191,13 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -191,13 +191,13 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
uint8_t TSFC; uint8_t TSFC;
uint16_t deltaTSFC; // bitmap uint16_t deltaTSFC; // bitmap
uint8_t srs_SubframeConfig; uint8_t srs_SubframeConfig;
// table for TSFC (Period) and deltaSFC (offset) // table for TSFC (Period) and deltaSFC (offset)
const uint16_t deltaTSFCTabType1[15][2] = { {1, 1}, {1, 2}, {2, 2}, {1, 5}, {2, 5}, {4, 5}, {8, 5}, {3, 5}, {12, 5}, {1, 10}, {2, 10}, {4, 10}, {8, 10}, {351, 10}, {383, 10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD const uint16_t deltaTSFCTabType1[15][2] = { {1, 1}, {1, 2}, {2, 2}, {1, 5}, {2, 5}, {4, 5}, {8, 5}, {3, 5}, {12, 5}, {1, 10}, {2, 10}, {4, 10}, {8, 10}, {351, 10}, {383, 10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD
const uint16_t deltaTSFCTabType2[14][2] = { {2, 5}, {6, 5}, {10, 5}, {18, 5}, {14, 5}, {22, 5}, {26, 5}, {30, 5}, {70, 10}, {74, 10}, {194, 10}, {326, 10}, {586, 10}, {210, 10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD const uint16_t deltaTSFCTabType2[14][2] = { {2, 5}, {6, 5}, {10, 5}, {18, 5}, {14, 5}, {22, 5}, {26, 5}, {30, 5}, {70, 10}, {74, 10}, {194, 10}, {326, 10}, {586, 10}, {210, 10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD
uint16_t srsPeriodicity, srsOffset; uint16_t srsPeriodicity, srsOffset;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
soundingRS_UL_ConfigCommon = &cc[CC_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon; soundingRS_UL_ConfigCommon = &cc[CC_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon;
// check if SRS is enabled in this frame/subframe // check if SRS is enabled in this frame/subframe
...@@ -212,7 +212,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -212,7 +212,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
} }
// Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC // Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC
uint16_t tmp = (subframeP % TSFC); uint16_t tmp = (subframeP % TSFC);
if ((1 << tmp) & deltaTSFC) { if ((1 << tmp) & deltaTSFC) {
// This is an SRS subframe, loop over UEs // This is an SRS subframe, loop over UEs
for (UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) { for (UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) {
...@@ -220,11 +220,11 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -220,11 +220,11 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
ul_req = &RC.nrmac[module_idP]->UL_req[CC_id].ul_config_request_body; ul_req = &RC.nrmac[module_idP]->UL_req[CC_id].ul_config_request_body;
// drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue; if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue;
AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL,
"physicalConfigDedicated is null for UE %d\n", "physicalConfigDedicated is null for UE %d\n",
UE_id); UE_id);
if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated) != NULL) { if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated) != NULL) {
if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
get_srs_pos(&cc[CC_id], get_srs_pos(&cc[CC_id],
...@@ -256,7 +256,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -256,7 +256,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
} // if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL) } // if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL)
} // for (UE_id ... } // for (UE_id ...
} // if((1<<tmp) & deltaTSFC) } // if((1<<tmp) & deltaTSFC)
} // SRS config } // SRS config
} }
} }
...@@ -290,7 +290,7 @@ void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) ...@@ -290,7 +290,7 @@ void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
} }
} }
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP){ sub_frame_t slotP){
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
...@@ -331,13 +331,14 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -331,13 +331,14 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
coreset, coreset,
frameP, frameP,
slotP, slotP,
*cfg)) *cfg)){
nr_schedule_uss_dlsch_phytest(module_idP, frameP, slotP); nr_schedule_uss_dlsch_phytest(module_idP, frameP, slotP);
}
rnti = UE_RNTI(module_idP, i); rnti = UE_RNTI(module_idP, i);
CC_id = UE_PCCID(module_idP, i); CC_id = UE_PCCID(module_idP, i);
//int spf = get_spf(cfg); //int spf = get_spf(cfg);
if (((frameP&127) == 0) && (slotP == 0)) { if (((frameP&127) == 0) && (slotP == 0)) {
LOG_I(MAC, LOG_I(MAC,
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n", "UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
...@@ -349,32 +350,32 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -349,32 +350,32 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2, (UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2); (UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
} }
RC.gNB[module_idP][CC_id]->pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)] = -63; RC.gNB[module_idP][CC_id]->pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)] = -63;
if (i == UE_list->head) if (i == UE_list->head)
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.gNB[module_idP][CC_id]-> VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.gNB[module_idP][CC_id]->
pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)]); pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)]);
// increment this, it is cleared when we receive an sdu // increment this, it is cleared when we receive an sdu
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++; RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++; RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++;
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n", LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n",
i, i,
rnti, rnti,
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer, RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer,
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer); RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
//check_nr_ul_failure(module_idP, CC_id, i, frameP, subframeP); //check_nr_ul_failure(module_idP, CC_id, i, frameP, subframeP);
if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) { if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) {
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++; RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++;
if(RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >= if(RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) { RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0; RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0;
for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_GNB; ue_id_l++) { for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_GNB; ue_id_l++) {
if (reestablish_rnti_map[ue_id_l][0] == rnti) { if (reestablish_rnti_map[ue_id_l][0] == rnti) {
// clear currentC-RNTI from map // clear currentC-RNTI from map
...@@ -383,10 +384,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -383,10 +384,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
break; break;
} }
} }
// Note: This should not be done in the MAC! // Note: This should not be done in the MAC!
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) { for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
NR_gNB_ULSCH_t *ulsch = RC.gNB[module_idP][CC_id]->ulsch[ii][0]; NR_gNB_ULSCH_t *ulsch = RC.gNB[module_idP][CC_id]->ulsch[ii][0];
if((ulsch != NULL) && (ulsch->rnti == rnti)){ if((ulsch != NULL) && (ulsch->rnti == rnti)){
LOG_W(MAC, "TODO: clean_eNb_ulsch UE %x \n", rnti); LOG_W(MAC, "TODO: clean_eNb_ulsch UE %x \n", rnti);
clean_gNB_ulsch(ulsch); clean_gNB_ulsch(ulsch);
...@@ -400,7 +401,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -400,7 +401,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
clean_gNB_dlsch(dlsch); clean_gNB_dlsch(dlsch);
} }
} }
for(int j = 0; j < 10; j++){ for(int j = 0; j < 10; j++){
nfapi_ul_config_request_body_t *ul_req_tmp = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
ul_req_tmp = &RC.nrmac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body; ul_req_tmp = &RC.nrmac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body;
...@@ -422,9 +423,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -422,9 +423,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
} //END if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) } //END if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0)
} //END if (UE_list->active[i]) } //END if (UE_list->active[i])
} //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++) } //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frameP, slotP,module_idP); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frameP, slotP,module_idP);
pdcp_run(&ctxt); pdcp_run(&ctxt);
//rrc_rx_tx(&ctxt, CC_id); //rrc_rx_tx(&ctxt, CC_id);
...@@ -439,8 +440,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -439,8 +440,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
/*if (slotP==2) /*if (slotP==2)
nr_schedule_css_dlsch_phytest(module_idP, frameP, slotP);*/ nr_schedule_css_dlsch_phytest(module_idP, frameP, slotP);*/
if (slotP==1) if (slotP==1){
nr_schedule_uss_dlsch_phytest(module_idP, frameP, slotP); nr_schedule_uss_dlsch_phytest(module_idP, frameP, slotP);
}
/* /*
// Allocate CCEs for good after scheduling is done // Allocate CCEs for good after scheduling is done
...@@ -449,6 +451,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -449,6 +451,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
*/ */
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
} }
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include "mac_proto.h" #include "mac_proto.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_dci.h" #include "PHY/NR_TRANSPORT/nr_dci.h"
#include "executables/nr-softmodem.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
/*Scheduling of DLSCH with associated DCI in common search space /*Scheduling of DLSCH with associated DCI in common search space
* current version has only a DCI for type 1 PDCCH for C_RNTI*/ * current version has only a DCI for type 1 PDCCH for C_RNTI*/
...@@ -103,7 +105,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -103,7 +105,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
pdu_rel15->vrb_to_prb_mapping = 1; pdu_rel15->vrb_to_prb_mapping = 1;
pdu_rel15->mcs = 9; pdu_rel15->mcs = 9;
pdu_rel15->tb_scaling = 1; pdu_rel15->tb_scaling = 1;
pdu_rel15->ra_preamble_index = 25; pdu_rel15->ra_preamble_index = 25;
pdu_rel15->format_indicator = 1; pdu_rel15->format_indicator = 1;
pdu_rel15->ndi = 1; pdu_rel15->ndi = 1;
...@@ -168,147 +170,346 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -168,147 +170,346 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG; nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST; nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
} }
} }
/*Scheduling of DLSCH with associated DCI in user specific search space int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
* current version has only a DCI for type 1 PDCCH for C_RNTI*/ nfapi_tx_request_pdu_t *TX_req,
nfapi_nr_config_request_t *cfg,
nfapi_nr_coreset_t* coreset,
nfapi_nr_search_space_t* search_space,
int16_t pdu_index){
nfapi_nr_dl_config_request_pdu_t *dl_config_dci_pdu;
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu;
int TBS;
uint16_t rnti = 0x1234;
int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
dl_config_dci_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_dci_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
dl_config_dci_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_dci_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dci_dl_pdu));
dl_config_dlsch_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu+1];
memset((void*)dl_config_dlsch_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
dl_config_dlsch_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DLSCH_PDU_TYPE;
dl_config_dlsch_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dlsch_pdu));
nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &dl_config_dci_pdu->dci_dl_pdu.dci_dl_pdu_rel15;
nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &dl_config_dci_pdu->dci_dl_pdu.pdcch_params_rel15;
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu_rel15 = &dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15;
dlsch_pdu_rel15->start_prb = 0;
dlsch_pdu_rel15->n_prb = 50;
dlsch_pdu_rel15->start_symbol = 2;
dlsch_pdu_rel15->nb_symbols = 9;
dlsch_pdu_rel15->rnti = rnti;
dlsch_pdu_rel15->nb_layers =1;
dlsch_pdu_rel15->nb_codewords = 1;
dlsch_pdu_rel15->mcs_idx = 9;
dlsch_pdu_rel15->ndi = 1;
dlsch_pdu_rel15->redundancy_version = 0;
nr_configure_dci_from_pdcch_config(params_rel15,
coreset,
search_space,
*cfg,
dl_carrier_bandwidth);
pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value);
pdu_rel15->time_domain_assignment = 3; // row index used here instead of SLIV;
pdu_rel15->vrb_to_prb_mapping = 1;
pdu_rel15->mcs = 9;
pdu_rel15->tb_scaling = 1;
pdu_rel15->ra_preamble_index = 25;
pdu_rel15->format_indicator = 1;
pdu_rel15->ndi = 1;
pdu_rel15->rv = 0;
pdu_rel15->harq_pid = 0;
pdu_rel15->dai = 2;
pdu_rel15->tpc = 2;
pdu_rel15->pucch_resource_indicator = 7;
pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7;
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
pdu_rel15->frequency_domain_assignment,
pdu_rel15->time_domain_assignment,
pdu_rel15->vrb_to_prb_mapping,
pdu_rel15->mcs,
pdu_rel15->tb_scaling,
pdu_rel15->ndi,
pdu_rel15->rv);
params_rel15->rnti = rnti;
params_rel15->rnti_type = NFAPI_NR_RNTI_C;
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;
//params_rel15->aggregation_level = 1;
LOG_D(MAC, "DCI params: rnti %d, rnti_type %d, dci_format %d, config type %d\n \
coreset params: mux_pattern %d, n_rb %d, n_symb %d, rb_offset %d \n \
ss params : first symb %d, ss type %d\n",
params_rel15->rnti,
params_rel15->rnti_type,
params_rel15->config_type,
params_rel15->dci_format,
params_rel15->mux_pattern,
params_rel15->n_rb,
params_rel15->n_symb,
params_rel15->rb_offset,
params_rel15->first_symbol,
params_rel15->search_space_type);
nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
// Hardcode it for now
TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d TBS: %d\n",
dlsch_pdu_rel15->start_prb,
dlsch_pdu_rel15->n_prb,
dlsch_pdu_rel15->start_symbol,
dlsch_pdu_rel15->nb_symbols,
dlsch_pdu_rel15->nb_layers,
dlsch_pdu_rel15->nb_codewords,
dlsch_pdu_rel15->mcs_idx,
TBS);
dl_req->number_dci++;
dl_req->number_pdsch_rnti++;
dl_req->number_pdu+=2;
TX_req->pdu_length = dlsch_pdu_rel15->transport_block_size/8;
TX_req->pdu_index = pdu_index++;
TX_req->num_segments = 1;
return TBS/8; //Return TBS in bytes
}
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP) sub_frame_t slotP)
{ {
LOG_D(MAC, "In nr_schedule_uss_dlsch_phytest \n");
uint8_t CC_id; uint8_t CC_id;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
//NR_COMMON_channels_t *cc = nr_mac->common_channels; //NR_COMMON_channels_t *cc = nr_mac->common_channels;
nfapi_nr_dl_config_request_body_t *dl_req; nfapi_nr_dl_config_request_body_t *dl_req;
nfapi_nr_dl_config_request_pdu_t *dl_config_dci_pdu;
nfapi_nr_dl_config_request_pdu_t *dl_config_dlsch_pdu;
nfapi_tx_request_pdu_t *TX_req; nfapi_tx_request_pdu_t *TX_req;
uint16_t rnti = 0x1234;
nfapi_nr_config_request_t *cfg = &nr_mac->config[0]; nfapi_nr_config_request_t *cfg = &nr_mac->config[0];
uint16_t rnti = 0x1234;
uint16_t sfn_sf = frameP << 7 | slotP; uint16_t sfn_sf = frameP << 7 | slotP;
int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
// everything here is hard-coded to 30 kHz // everything here is hard-coded to 30 kHz
//int scs = get_dlscs(cfg); //int scs = get_dlscs(cfg);
//int slots_per_frame = get_spf(cfg); //int slots_per_frame = get_spf(cfg);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_D(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id);
nfapi_nr_coreset_t* coreset = &nr_mac->coreset[CC_id][1]; int TBS;
nfapi_nr_search_space_t* search_space = &nr_mac->search_space[CC_id][1]; int TBS_bytes;
int lcid;
int ta_len = 0;
int header_length_total=0;
int header_length_last;
int sdu_length_total = 0;
mac_rlc_status_resp_t rlc_status;
uint16_t sdu_lengths[NB_RB_MAX];
int num_sdus = 0;
unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
int offset;
int UE_id = 0;
unsigned char sdu_lcids[NB_RB_MAX];
int padding = 0, post_padding = 0;
UE_list_t *UE_list = &nr_mac->UE_list;
DLSCH_PDU DLSCH_pdu;
//DLSCH_PDU *DLSCH_pdu = (DLSCH_PDU*) malloc(sizeof(DLSCH_PDU));
dl_req = &nr_mac->DL_req[CC_id].dl_config_request_body;
dl_config_dci_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_dci_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
dl_config_dci_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_dci_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dci_dl_pdu));
dl_config_dlsch_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu+1]; for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
memset((void*)dl_config_dlsch_pdu,0,sizeof(nfapi_nr_dl_config_request_pdu_t));
dl_config_dlsch_pdu->pdu_type = NFAPI_NR_DL_CONFIG_DLSCH_PDU_TYPE;
dl_config_dlsch_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_nr_dl_config_dlsch_pdu));
nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &dl_config_dci_pdu->dci_dl_pdu.dci_dl_pdu_rel15;
nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &dl_config_dci_pdu->dci_dl_pdu.pdcch_params_rel15;
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu_rel15 = &dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15;
dlsch_pdu_rel15->start_prb = 0;
dlsch_pdu_rel15->n_prb = 50;
dlsch_pdu_rel15->start_symbol = 2;
dlsch_pdu_rel15->nb_symbols = 9;
dlsch_pdu_rel15->rnti = rnti;
dlsch_pdu_rel15->nb_layers =1;
dlsch_pdu_rel15->nb_codewords = 1;
dlsch_pdu_rel15->mcs_idx = 9;
dlsch_pdu_rel15->ndi = 1;
dlsch_pdu_rel15->redundancy_version = 0;
nr_configure_dci_from_pdcch_config(params_rel15,
coreset,
search_space,
*cfg,
dl_carrier_bandwidth);
pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value);
pdu_rel15->time_domain_assignment = 3; // row index used here instead of SLIV;
pdu_rel15->vrb_to_prb_mapping = 1;
pdu_rel15->mcs = 9;
pdu_rel15->tb_scaling = 1;
pdu_rel15->ra_preamble_index = 25;
pdu_rel15->format_indicator = 1;
pdu_rel15->ndi = 1;
pdu_rel15->rv = 0;
pdu_rel15->harq_pid = 0;
pdu_rel15->dai = 2;
pdu_rel15->tpc = 2;
pdu_rel15->pucch_resource_indicator = 7;
pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7;
LOG_D(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
pdu_rel15->frequency_domain_assignment,
pdu_rel15->time_domain_assignment,
pdu_rel15->vrb_to_prb_mapping,
pdu_rel15->mcs,
pdu_rel15->tb_scaling,
pdu_rel15->ndi,
pdu_rel15->rv);
params_rel15->rnti = rnti;
params_rel15->rnti_type = NFAPI_NR_RNTI_C;
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;
//params_rel15->aggregation_level = 1;
LOG_D(MAC, "DCI params: rnti %d, rnti_type %d, dci_format %d, config type %d\n \
coreset params: mux_pattern %d, n_rb %d, n_symb %d, rb_offset %d \n \
ss params : first symb %d, ss type %d\n",
params_rel15->rnti,
params_rel15->rnti_type,
params_rel15->config_type,
params_rel15->dci_format,
params_rel15->mux_pattern,
params_rel15->n_rb,
params_rel15->n_symb,
params_rel15->rb_offset,
params_rel15->first_symbol,
params_rel15->search_space_type);
nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
LOG_D(MAC, "DLSCH PDU: start PRB %d n_PRB %d start symbol %d nb_symbols %d nb_layers %d nb_codewords %d mcs %d\n",
dlsch_pdu_rel15->start_prb,
dlsch_pdu_rel15->n_prb,
dlsch_pdu_rel15->start_symbol,
dlsch_pdu_rel15->nb_symbols,
dlsch_pdu_rel15->nb_layers,
dlsch_pdu_rel15->nb_codewords,
dlsch_pdu_rel15->mcs_idx);
dl_req->number_dci++;
dl_req->number_pdsch_rnti++;
dl_req->number_pdu+=2;
TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus]; LOG_D(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id);
TX_req->pdu_length = dlsch_pdu_rel15->transport_block_size;
TX_req->pdu_index = nr_mac->pdu_index[CC_id]++; dl_req = &nr_mac->DL_req[CC_id].dl_config_request_body;
TX_req->num_segments = 1; TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus];
//The --NOS1 use case currently schedules DLSCH transmissions only when there is IP traffic arriving
//through the LTE stack
if (IS_SOFTMODEM_NOS1){
memset(&DLSCH_pdu, 0, sizeof(DLSCH_pdu));
int ta_update = 31;
ta_len = 0;
// Hardcode it for now
TBS = 6784/8; //TBS in bytes
//nr_get_tbs(&dl_config_dlsch_pdu->dlsch_pdu, dl_config_dci_pdu->dci_dl_pdu, *cfg);
//TBS = dl_config_dlsch_pdu->dlsch_pdu.dlsch_pdu_rel15.transport_block_size;
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
// TODO: check if the lcid is active
LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
module_idP, frameP, lcid, TBS,
TBS - ta_len - header_length_total - sdu_length_total - 3);
if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
rlc_status = mac_rlc_status_ind(module_idP,
rnti,
module_idP,
frameP,
slotP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
lcid,
TBS - ta_len - header_length_total - sdu_length_total - 3
//#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
//#endif
);
if (rlc_status.bytes_in_buffer > 0) {
LOG_D(MAC,
"[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d), TBS: %d \n \n",
module_idP, frameP,
TBS - ta_len - header_length_total - sdu_length_total - 3,
lcid,
header_length_total,
TBS);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid,
TBS,
(char *)&dlsch_buffer[sdu_length_total]
//#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,0, 0
//#endif
);
LOG_D(MAC,
"[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n",
module_idP, sdu_lengths[num_sdus], lcid);
sdu_lcids[num_sdus] = lcid;
sdu_length_total += sdu_lengths[num_sdus];
UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]++;
UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = lcid;
UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[lcid] = sdu_lengths[num_sdus];
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus];
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
header_length_total += header_length_last;
num_sdus++;
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}
} else {
// no TBS left
break;
}
}
// last header does not have length field
if (header_length_total) {
header_length_total -= header_length_last;
header_length_total++;
}
if (ta_len + sdu_length_total + header_length_total > 0) {
if (TBS - header_length_total - sdu_length_total - ta_len <= 2) {
padding = TBS - header_length_total - sdu_length_total - ta_len;
post_padding = 0;
} else {
padding = 0;
post_padding = 1;
}
offset = generate_dlsch_header((unsigned char *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0], //DLSCH_pdu.payload[0],
num_sdus, //num_sdus
sdu_lengths, //
sdu_lcids, 255, // no drx
ta_update, // timing advance
NULL, // contention res id
padding, post_padding);
LOG_D(MAC, "Offset bits: %d \n", offset);
// Probably there should be other actions done before that
// cycle through SDUs and place in dlsch_buffer
//memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
memcpy(&nr_mac->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
// fill remainder of DLSCH with 0
for (int j = 0; j < (TBS - sdu_length_total - offset); j++) {
//UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0;
nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0][offset + sdu_length_total + j] = 0;
}
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, , TBS size: %d \n \n", frameP, slotP, TBS_bytes);
for(int i = 0; i < 10; i++) { // TBS_bytes dlsch_pdu_rel15->transport_block_size/8 6784/8
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
}
#endif
//TX_req->segments[0].segment_length = 8;
TX_req->segments[0].segment_length = TBS_bytes +2;
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
} //if (ta_len + sdu_length_total + header_length_total > 0)
} //if (IS_SOFTMODEM_NOS1)
//When the --NOS1 option is not enabled, DLSCH transmissions with random data
//occur every time that the current function is called (dlsch phytest mode)
else{
TBS_bytes = configure_fapi_dl_Tx(dl_req, TX_req, cfg, &nr_mac->coreset[CC_id][1], &nr_mac->search_space[CC_id][1], nr_mac->pdu_index[CC_id]);
// HOT FIX for all zero pdu problem
// ------------------------------------------------------------------------------------------------
for(int i = 0; i < TBS_bytes; i++) { //
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
//LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
}
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
if (frameP%100 == 0){
LOG_I(MAC, "Printing first 10 payload bytes at the gNB side, Frame: %d, slot: %d, TBS size: %d \n", frameP, slotP, TBS_bytes);
for(int i = 0; i < 10; i++) {
LOG_I(MAC, "%x. ", ((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i]);
}
}
#endif
//TX_req->segments[0].segment_length = 8;
TX_req->segments[0].segment_length = TBS_bytes +2;
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
// ------------------------------------------------------------------------------------------------
}
} //for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
}
// HOT FIX for all zero pdu problem
// ------------------------------------------------------------------------------------------------
for(int i = 0; i < dlsch_pdu_rel15->transport_block_size/8; i++) {
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
}
// ------------------------------------------------------------------------------------------------
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
TX_req->segments[0].segment_length = dlsch_pdu_rel15->transport_block_size+2;
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
nr_mac->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
nr_mac->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
}
}
...@@ -72,6 +72,13 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -72,6 +72,13 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframeP); sub_frame_t subframeP);
int configure_fapi_dl_Tx(nfapi_nr_dl_config_request_body_t *dl_req,
nfapi_tx_request_pdu_t *TX_req,
nfapi_nr_config_request_t *cfg,
nfapi_nr_coreset_t* coreset,
nfapi_nr_search_space_t* search_space,
int16_t pdu_index);
void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP); sub_frame_t slotP);
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "executables/nr-softmodem.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -82,34 +83,34 @@ void mac_top_init_gNB(void) ...@@ -82,34 +83,34 @@ void mac_top_init_gNB(void)
LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst); LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst);
if (RC.nb_nr_macrlc_inst > 0) { if (RC.nb_nr_macrlc_inst > 0) {
RC.nrmac = (gNB_MAC_INST **) malloc16(RC.nb_nr_macrlc_inst *sizeof(gNB_MAC_INST *)); RC.nrmac = (gNB_MAC_INST **) malloc16(RC.nb_nr_macrlc_inst *sizeof(gNB_MAC_INST *));
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n", AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *), RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST)); RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) { for (i = 0; i < RC.nb_nr_macrlc_inst; i++) {
RC.nrmac[i] = (gNB_MAC_INST *) malloc16(sizeof(gNB_MAC_INST)); RC.nrmac[i] = (gNB_MAC_INST *) malloc16(sizeof(gNB_MAC_INST));
AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n", AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *), RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST)); RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));
LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac); LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac);
bzero(RC.nrmac[i], sizeof(gNB_MAC_INST)); bzero(RC.nrmac[i], sizeof(gNB_MAC_INST));
RC.nrmac[i]->Mod_id = i; RC.nrmac[i]->Mod_id = i;
for (j = 0; j < MAX_NUM_CCs; j++) { for (j = 0; j < MAX_NUM_CCs; j++) {
RC.nrmac[i]->DL_req[j].dl_config_request_body.dl_config_pdu_list = RC.nrmac[i]->dl_config_pdu_list[j]; RC.nrmac[i]->DL_req[j].dl_config_request_body.dl_config_pdu_list = RC.nrmac[i]->dl_config_pdu_list[j];
RC.nrmac[i]->UL_req[j].ul_config_request_body.ul_config_pdu_list = RC.nrmac[i]->ul_config_pdu_list[j]; RC.nrmac[i]->UL_req[j].ul_config_request_body.ul_config_pdu_list = RC.nrmac[i]->ul_config_pdu_list[j];
for (int k = 0; k < 10; k++) for (int k = 0; k < 10; k++)
RC.nrmac[i]->UL_req_tmp[j][k].ul_config_request_body.ul_config_pdu_list =RC.nrmac[i]->ul_config_pdu_list_tmp[j][k]; RC.nrmac[i]->UL_req_tmp[j][k].ul_config_request_body.ul_config_pdu_list =RC.nrmac[i]->ul_config_pdu_list_tmp[j][k];
RC.nrmac[i]->HI_DCI0_req[j].hi_dci0_request_body.hi_dci0_pdu_list = RC.nrmac[i]->hi_dci0_pdu_list[j]; RC.nrmac[i]->HI_DCI0_req[j].hi_dci0_request_body.hi_dci0_pdu_list = RC.nrmac[i]->hi_dci0_pdu_list[j];
RC.nrmac[i]->TX_req[j].tx_request_body.tx_pdu_list = RC.nrmac[i]->tx_request_pdu[j]; RC.nrmac[i]->TX_req[j].tx_request_body.tx_pdu_list = RC.nrmac[i]->tx_request_pdu[j];
RC.nrmac[i]->ul_handle = 0; RC.nrmac[i]->ul_handle = 0;
...@@ -118,7 +119,7 @@ void mac_top_init_gNB(void) ...@@ -118,7 +119,7 @@ void mac_top_init_gNB(void)
nr_init_coreset(&RC.nrmac[i]->coreset[j][1]); nr_init_coreset(&RC.nrmac[i]->coreset[j][1]);
nr_init_search_space(&RC.nrmac[i]->search_space[j][1]); nr_init_search_space(&RC.nrmac[i]->search_space[j][1]);
} }
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
...@@ -127,6 +128,9 @@ void mac_top_init_gNB(void) ...@@ -127,6 +128,9 @@ void mac_top_init_gNB(void)
// These should be out of here later // These should be out of here later
pdcp_layer_init(); pdcp_layer_init();
if(IS_SOFTMODEM_NOS1)
nr_ip_over_LTE_DRB_preconfiguration();
rrc_init_nr_global_param(); rrc_init_nr_global_param();
}else { }else {
...@@ -135,7 +139,7 @@ void mac_top_init_gNB(void) ...@@ -135,7 +139,7 @@ void mac_top_init_gNB(void)
// Initialize Linked-List for Active UEs // Initialize Linked-List for Active UEs
for (i = 0; i < RC.nb_nr_macrlc_inst; i++) { for (i = 0; i < RC.nb_nr_macrlc_inst; i++) {
nrmac = RC.nrmac[i]; nrmac = RC.nrmac[i];
nrmac->if_inst = NR_IF_Module_init(i); nrmac->if_inst = NR_IF_Module_init(i);
...@@ -152,6 +156,11 @@ void mac_top_init_gNB(void) ...@@ -152,6 +156,11 @@ void mac_top_init_gNB(void)
UE_list->next[list_el] = -1; UE_list->next[list_el] = -1;
UE_list->next_ul[list_el] = -1; UE_list->next_ul[list_el] = -1;
/*memset(UE_list->DLSCH_pdu, 0, sizeof(UE_list->DLSCH_pdu));
memset(UE_list->UE_template, 0, sizeof(UE_list->UE_template));
memset(UE_list->eNB_UE_stats, 0, sizeof(UE_list->eNB_UE_stats));
memset(UE_list->UE_sched_ctrl, 0, sizeof(UE_list->UE_sched_ctrl));
memset(UE_list->active, 0, sizeof(UE_list->active));*/
} }
} }
...@@ -358,7 +358,16 @@ boolean_t pdcp_data_req( ...@@ -358,7 +358,16 @@ boolean_t pdcp_data_req(
LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n",
rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type);
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { // The check on nos1 is done only for the use case of LTE stack running over 5g-nr PHY. This should be changed
// before future merge of develop with develop-nr and instead of a check of IS_SOFTMODEM_NOS1, we should use a check
// with a new execution option capturing the nr-ip-over-LTE-stack use case.
ngran_node_t node_type;
if (IS_SOFTMODEM_NOS1)
node_type = ngran_gNB;
else
node_type = RC.rrc[ctxt_pP->module_id]->node_type;
if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(node_type)) { //RC.rrc[ctxt_pP->module_id]->node_type
LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type);
ret=FALSE; ret=FALSE;
} else { } else {
...@@ -510,6 +519,7 @@ pdcp_data_ind( ...@@ -510,6 +519,7 @@ pdcp_data_ind(
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 :0; uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 :0;
uint16_t pdcp_uid=0; uint16_t pdcp_uid=0;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
uint8_t *gtpu_buffer_p = NULL; uint8_t *gtpu_buffer_p = NULL;
uint32_t rx_hfn_for_count; uint32_t rx_hfn_for_count;
...@@ -518,6 +528,8 @@ pdcp_data_ind( ...@@ -518,6 +528,8 @@ pdcp_data_ind(
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP, LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP,
"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP); "[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
#if T_TRACER #if T_TRACER
if (ctxt_pP->enb_flag != ENB_FLAG_NO) if (ctxt_pP->enb_flag != ENB_FLAG_NO)
...@@ -1040,6 +1052,13 @@ pdcp_data_ind( ...@@ -1040,6 +1052,13 @@ pdcp_data_ind(
memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)],
&sdu_buffer_pP->data[payload_offset], &sdu_buffer_pP->data[payload_offset],
sdu_buffer_sizeP - payload_offset); sdu_buffer_sizeP - payload_offset);
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PDCP, "Printing first bytes of PDCP SDU before adding it to the list: \n");
for (int i=0; i<30; i++){
LOG_I(PDCP, "%x", sdu_buffer_pP->data[i]);
}
#endif
list_add_tail_eurecom (new_sdu_p, sdu_list_p); list_add_tail_eurecom (new_sdu_p, sdu_list_p);
} }
...@@ -1062,6 +1081,7 @@ pdcp_data_ind( ...@@ -1062,6 +1081,7 @@ pdcp_data_ind(
Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number; Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
...@@ -1772,6 +1792,7 @@ pdcp_config_req_asn1 ( ...@@ -1772,6 +1792,7 @@ pdcp_config_req_asn1 (
uint8_t *const kUPenc_pP) uint8_t *const kUPenc_pP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
switch (actionP) { switch (actionP) {
case CONFIG_ACTION_ADD: case CONFIG_ACTION_ADD:
DevAssert(pdcp_pP != NULL); DevAssert(pdcp_pP != NULL);
...@@ -2170,6 +2191,9 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) { ...@@ -2170,6 +2191,9 @@ 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)
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");
} else if(ENB_NAS_USE_TUN) { } else if(ENB_NAS_USE_TUN) {
netlink_init_tun("enb",1); netlink_init_tun("enb",1);
...@@ -2217,6 +2241,103 @@ void pdcp_module_cleanup (void) ...@@ -2217,6 +2241,103 @@ void pdcp_module_cleanup (void)
{ {
} }
void nr_ip_over_LTE_DRB_preconfiguration(void){
// Addition for the use-case of 4G stack on top of 5G-NR.
// We need to configure pdcp and rlc instances without having an actual
// UE RRC Connection. In order to be able to test the NR PHY with some injected traffic
// on top of the LTE stack.
protocol_ctxt_t ctxt;
LTE_DRB_ToAddModList_t* DRB_configList=NULL;
DRB_configList = CALLOC(1, sizeof(LTE_DRB_ToAddModList_t));
struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL;
struct LTE_RLC_Config *DRB_rlc_config = NULL;
struct LTE_PDCP_Config *DRB_pdcp_config = NULL;
struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL;
struct LTE_DRB_ToAddMod *DRB_config = NULL;
struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL;
long *logicalchannelgroup_drb;
//Static preconfiguration of DRB
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
// allowed value 5..15, value : x+4
*(DRB_config->eps_BearerIdentity) = 1; //ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation
// DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
// 1 + drb_identiy_index;
DRB_config->drb_Identity = 1;
DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
*(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
DRB_config->rlc_Config = DRB_rlc_config;
DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
DRB_config->pdcp_Config = DRB_pdcp_config;
DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
*DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
DRB_pdcp_config->rlc_AM = NULL;
DRB_pdcp_config->rlc_UM = NULL;
DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
// PDCP
PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
DRB_config->logicalChannelConfig = DRB_lchan_config;
DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
DRB_ul_SpecificParameters->priority= 4;
DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
//LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
DRB_ul_SpecificParameters->bucketSizeDuration =
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;//(i+1) % 3;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&DRB_configList->list,DRB_config);
if (ENB_NAS_USE_TUN){
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, 0x1234, 0, 0,0);
}
else{
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
}
rrc_pdcp_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t *) NULL,
DRB_configList,
(LTE_DRB_ToReleaseList_t *) NULL,
0xff, NULL, NULL, NULL
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
, (LTE_PMCH_InfoList_r9_t *) NULL
//#endif
,NULL);
rrc_rlc_config_asn1_req(&ctxt,
(LTE_SRB_ToAddModList_t*)NULL,
DRB_configList,
(LTE_DRB_ToReleaseList_t*)NULL
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
,(LTE_PMCH_InfoList_r9_t *)NULL
, 0, 0
//#endif
);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void pdcp_layer_init(void) void pdcp_layer_init(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -92,6 +92,8 @@ extern int pdcp_instance_cnt; ...@@ -92,6 +92,8 @@ extern int pdcp_instance_cnt;
#define PROTOCOL_PDCP_CTXT_ARGS(CTXT_Pp, pDCP_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\ #define PROTOCOL_PDCP_CTXT_ARGS(CTXT_Pp, pDCP_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
(pDCP_Pp->is_srb) ? "SRB" : "DRB",\ (pDCP_Pp->is_srb) ? "SRB" : "DRB",\
pDCP_Pp->rb_id pDCP_Pp->rb_id
//#define ENABLE_PDCP_PAYLOAD_DEBUG 1
int init_pdcp_thread(void); int init_pdcp_thread(void);
void cleanup_pdcp_thread(void); void cleanup_pdcp_thread(void);
...@@ -397,6 +399,7 @@ void pdcp_run ( ...@@ -397,6 +399,7 @@ void pdcp_run (
const protocol_ctxt_t *const ctxt_pP); const protocol_ctxt_t *const ctxt_pP);
uint64_t pdcp_module_init (uint64_t pdcp_optmask); uint64_t pdcp_module_init (uint64_t pdcp_optmask);
void pdcp_module_cleanup (void); void pdcp_module_cleanup (void);
void nr_ip_over_LTE_DRB_preconfiguration (void);
void pdcp_layer_init (void); void pdcp_layer_init (void);
void pdcp_layer_cleanup (void); void pdcp_layer_cleanup (void);
#define PDCP2NW_DRIVER_FIFO 21 #define PDCP2NW_DRIVER_FIFO 21
......
...@@ -111,7 +111,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { ...@@ -111,7 +111,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
int ret=0; int ret=0;
while ((sdu_p = list_get_head (&pdcp_sdu_list)) != NULL && ((pdcp_data_ind_header_t *)(sdu_p->data))->inst == ctxt_pP->module_id) { while ((sdu_p = list_get_head (&pdcp_sdu_list)) != NULL && ((pdcp_data_ind_header_t *)(sdu_p->data))->inst == ctxt_pP->module_id) {
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id; int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id;
int sizeToWrite= sizeof (pdcp_data_ind_header_t) + int sizeToWrite= sizeof (pdcp_data_ind_header_t) +
((pdcp_data_ind_header_t *) sdu_p->data)->data_size; ((pdcp_data_ind_header_t *) sdu_p->data)->data_size;
...@@ -135,6 +135,13 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { ...@@ -135,6 +135,13 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
} // 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)\n", errno, strerror(errno));
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PDCP, "Printing first bytes of PDCP SDU before removing it from the list: \n");
for (int i=0; i<30; i++){
LOG_I(PDCP, "%x", sdu_p->data[i]);
}
#endif
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p, __func__); free_mem_block (sdu_p, __func__);
pdcp_nb_sdu_sent ++; pdcp_nb_sdu_sent ++;
...@@ -166,7 +173,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ...@@ -166,7 +173,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0]; ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
ctxt.enb_flag=ENB_FLAG_YES; ctxt.enb_flag=ENB_FLAG_YES;
ctxt.module_id=0; ctxt.module_id=0;
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_YES); key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
} }
...@@ -276,12 +283,13 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx ...@@ -276,12 +283,13 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
if (h_rc == HASH_TABLE_OK) { if (h_rc == HASH_TABLE_OK) {
LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n", LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d for rnti: %d \n",
ctxt.frame, ctxt.frame,
pdcp_read_header_g.inst, pdcp_read_header_g.inst,
len, len,
nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
pdcp_read_header_g.rb_id); pdcp_read_header_g.rb_id,
ctxt.rnti);
MSC_LOG_RX_MESSAGE( MSC_LOG_RX_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
......
...@@ -723,7 +723,6 @@ void rlc_um_check_timer_dar_time_out( ...@@ -723,7 +723,6 @@ void rlc_um_check_timer_dar_time_out(
signed int in_window; signed int in_window;
rlc_usn_t old_vr_ur; rlc_usn_t old_vr_ur;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,VCD_FUNCTION_IN);
if ((rlc_pP->t_reordering.running)) { if ((rlc_pP->t_reordering.running)) {
...@@ -1130,12 +1129,12 @@ rlc_um_receive_process_dar ( ...@@ -1130,12 +1129,12 @@ rlc_um_receive_process_dar (
if (in_window < 0) { if (in_window < 0) {
in_window = in_window + rlc_pP->rx_sn_modulo; in_window = in_window + rlc_pP->rx_sn_modulo;
} }
rlc_um_try_reassembly(ctxt_pP, rlc_pP, rlc_pP->vr_ur, in_window); rlc_um_try_reassembly(ctxt_pP, rlc_pP, rlc_pP->vr_ur, in_window);
} }
if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) < 0) { if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) < 0) {
//LOG_I(RLC, "[rlc_um_receive_process_dar] Problematic case 4 \n");
#if TRACE_RLC_UM_DAR #if TRACE_RLC_UM_DAR
LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" VR(UR) %d OUTSIDE REORDERING WINDOW SET TO VR(UH) – UM_Window_Size = %d\n", LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" VR(UR) %d OUTSIDE REORDERING WINDOW SET TO VR(UH) – UM_Window_Size = %d\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
...@@ -1158,9 +1157,8 @@ rlc_um_receive_process_dar ( ...@@ -1158,9 +1157,8 @@ rlc_um_receive_process_dar (
do { do {
rlc_pP->vr_ur = (rlc_pP->vr_ur+1) % rlc_pP->rx_sn_modulo; rlc_pP->vr_ur = (rlc_pP->vr_ur+1) % rlc_pP->rx_sn_modulo;
} while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur) && (rlc_pP->vr_ur != rlc_pP->vr_uh)); } while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur) && (rlc_pP->vr_ur != rlc_pP->vr_uh));
rlc_um_try_reassembly(ctxt_pP, rlc_pP, sn, rlc_pP->vr_ur); rlc_um_try_reassembly(ctxt_pP, rlc_pP, sn, rlc_pP->vr_ur);
} }
// -if t-Reordering is running: // -if t-Reordering is running:
// -if VR(UX) <= VR(UR); or // -if VR(UX) <= VR(UR); or
......
...@@ -597,7 +597,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst) { ...@@ -597,7 +597,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst) {
#ifdef NAS_DEBUG_SEND #ifdef NAS_DEBUG_SEND
printk("[NAS][CLASS][SEND] Got packet from kernel:\n"); printk("[NAS][CLASS][SEND] Got packet from kernel:\n");
for (i=0; i<256; i++) for (int i=0; i<256; i++)
printk("%2x ",((unsigned char *)skb->data)[i]); printk("%2x ",((unsigned char *)skb->data)[i]);
printk("\n"); printk("\n");
......
...@@ -386,6 +386,11 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class ...@@ -386,6 +386,11 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
pdcph.data_size = skb->len; pdcph.data_size = skb->len;
pdcph.rb_id = (gc->rb)->rab_id; pdcph.rb_id = (gc->rb)->rab_id;
pdcph.inst = inst; pdcph.inst = inst;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
pdcph.sourceL2Id = 0;
pdcph.destinationL2Id = 0;
#endif
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
......
...@@ -161,7 +161,7 @@ int nas_netlink_send(unsigned char *data,unsigned int len) ...@@ -161,7 +161,7 @@ int nas_netlink_send(unsigned char *data,unsigned int len)
int status; int status;
// printk("[NAS][NETLINK] Sending %d bytes (%d)\n",len,NLMSG_SPACE(len)); //printk("[NAS][NETLINK] Sending %d bytes (%d)\n",len,NLMSG_SPACE(len));
skb_put(nl_skb, NLMSG_SPACE(len)); skb_put(nl_skb, NLMSG_SPACE(len));
memcpy(NLMSG_DATA(nlh),data,len); memcpy(NLMSG_DATA(nlh),data,len);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "assertions.h" #include "assertions.h"
#include "LAYER2/NR_MAC_UE/mac_extern.h" #include "LAYER2/NR_MAC_UE/mac_extern.h"
#include "SCHED_NR_UE/fapi_nr_ue_l1.h" #include "SCHED_NR_UE/fapi_nr_ue_l1.h"
#include "executables/nr-softmodem.h"
#include <stdio.h> #include <stdio.h>
...@@ -70,8 +71,14 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr ...@@ -70,8 +71,14 @@ 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");
if (IS_SOFTMODEM_NOS1)
nr_ue_send_sdu(module_id, 0, frame, slot,
pduP,
pdu_len,
0);
return 0; return 0;
/* /*
return nr_ue_process_dlsch( module_id, return nr_ue_process_dlsch( module_id,
...@@ -209,7 +216,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -209,7 +216,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:
...@@ -220,6 +227,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -220,6 +227,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,
...@@ -231,8 +246,21 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -231,8 +246,21 @@ 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);
/*
// dl_config structure just stores what was received - not really needed
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
dl_config->number_pdus = dl_config->number_pdus + 1;
*/
/*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:
......
...@@ -254,7 +254,7 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname) ...@@ -254,7 +254,7 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
returnValue= setInterfaceParameter(interfaceName, broadcastAddress,SIOCSIFBRDADDR); returnValue= setInterfaceParameter(interfaceName, broadcastAddress,SIOCSIFBRDADDR);
if(!returnValue) if(!returnValue)
bringInterfaceUp(interfaceName, 1); returnValue=bringInterfaceUp(interfaceName, 1);
if(!returnValue) if(!returnValue)
LOG_I(OIP,"Interface %s successfuly configured, ip address %s, mask %s broadcast address %s\n", LOG_I(OIP,"Interface %s successfuly configured, ip address %s, mask %s broadcast address %s\n",
......
...@@ -489,10 +489,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -489,10 +489,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
memset(samplesVoid[x],0,sampleToByte(nsamps,1)); memset(samplesVoid[x],0,sampleToByte(nsamps,1));
t->nextTimestamp+=nsamps; t->nextTimestamp+=nsamps;
LOG_D(HW,"Generated void samples for Rx: %ld\n", t->nextTimestamp);
if ( ((t->nextTimestamp/nsamps)%100) == 0)
LOG_W(HW,"Generated void samples for Rx: %ld\n", t->nextTimestamp);
*ptimestamp = t->nextTimestamp-nsamps; *ptimestamp = t->nextTimestamp-nsamps;
pthread_mutex_unlock(&Sockmutex); pthread_mutex_unlock(&Sockmutex);
return nsamps; return nsamps;
......
...@@ -92,6 +92,7 @@ void get_common_options(void) { ...@@ -92,6 +92,7 @@ void get_common_options(void) {
} }
if (nokrnmod) { if (nokrnmod) {
printf("nokrnmod bit enabled \n");
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT); set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
} }
......
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