Commit e13b29d3 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'issue_345_l2_fapi_simulator_new_jan2019' into 'develop'

Issue 345 l2 fapi simulator new

See merge request oai/openairinterface5g!487 and oai/openairinterface5g!432
parents 9fbc3e86 f43bbe67
...@@ -166,6 +166,14 @@ pipeline { ...@@ -166,6 +166,14 @@ pipeline {
} }
} }
stage ("Start VM -- L2-Sim") {
steps {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
stage ("Start VM -- phy-sim") { stage ("Start VM -- phy-sim") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
...@@ -215,7 +223,7 @@ pipeline { ...@@ -215,7 +223,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build eNb-ethernet") { gitlabCommitStatus(name: "Build eNb-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -224,11 +232,20 @@ pipeline { ...@@ -224,11 +232,20 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build UE-ethernet") { gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
} }
stage ("Build L2-Simulator-eNB") {
steps {
//gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
//}
}
}
stage ("Build physical simulators") { stage ("Build physical simulators") {
steps { steps {
gitlabCommitStatus(name: "Build phy-sim") { gitlabCommitStatus(name: "Build phy-sim") {
...@@ -313,6 +330,15 @@ pipeline { ...@@ -313,6 +330,15 @@ pipeline {
} }
} }
} }
stage ("Test L2 simulator") {
steps {
//gitlabCommitStatus(name: "Test basic-sim") {
timeout (time: 30, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
//}
}
}
stage ("Build Flexran Controller") { stage ("Build Flexran Controller") {
when { when {
expression {doFlexranCtrlTest} expression {doFlexranCtrlTest}
......
This diff is collapsed.
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "lo";
remote_n_address = "127.0.0.2";
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
remote_n_portd = 50011;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
...@@ -40,6 +40,7 @@ function variant_usage { ...@@ -40,6 +40,7 @@ function variant_usage {
echo " --variant cppcheck OR -v4" echo " --variant cppcheck OR -v4"
echo " --variant enb-ethernet OR -v7" echo " --variant enb-ethernet OR -v7"
echo " --variant ue-ethernet OR -v8" echo " --variant ue-ethernet OR -v8"
echo " --variant l2-sim OR -v9"
echo " --variant flexran-rtc OR -v10" echo " --variant flexran-rtc OR -v10"
} }
...@@ -285,6 +286,18 @@ case $key in ...@@ -285,6 +286,18 @@ case $key in
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
shift shift
;; ;;
-v9)
VM_NAME=ci-l2-sim
VM_MEMORY=8192
VM_CPU=8
ARCHIVES_LOC=l2_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4
BUILD_OPTIONS="--eNB -t ETHERNET"
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift
;;
-v10) -v10)
VM_NAME=ci-flexran-rtc VM_NAME=ci-flexran-rtc
ARCHIVES_LOC=flexran ARCHIVES_LOC=flexran
...@@ -350,6 +363,18 @@ case $key in ...@@ -350,6 +363,18 @@ case $key in
BUILD_OPTIONS="--UE -t ETHERNET --noS1" BUILD_OPTIONS="--UE -t ETHERNET --noS1"
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
;; ;;
l2-sim)
VM_NAME=ci-l2-sim
VM_MEMORY=8192
VM_CPU=8
ARCHIVES_LOC=l2_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4
BUILD_OPTIONS="--eNB -t ETHERNET"
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift
;;
flexran-rtc) flexran-rtc)
VM_NAME=ci-flexran-rtc VM_NAME=ci-flexran-rtc
ARCHIVES_LOC=flexran ARCHIVES_LOC=flexran
......
This diff is collapsed.
...@@ -615,6 +615,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang ...@@ -615,6 +615,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE") add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
######################## ########################
# Include order # Include order
......
...@@ -43,6 +43,7 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ...@@ -43,6 +43,7 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
MSC_GEN=0 MSC_GEN=0
XFORMS="True" XFORMS="True"
UE_EXPANSION="False" UE_EXPANSION="False"
UESIM_EXPANSION="False"
PRINT_STATS="False" PRINT_STATS="False"
VCD_TIMING="False" VCD_TIMING="False"
DEADLINE_SCHEDULER_FLAG_USER="False" DEADLINE_SCHEDULER_FLAG_USER="False"
...@@ -218,6 +219,10 @@ function main() { ...@@ -218,6 +219,10 @@ function main() {
UE_EXPANSION="True" UE_EXPANSION="True"
echo_info "Will compile with UE_EXPANSION" echo_info "Will compile with UE_EXPANSION"
shift;; shift;;
--musim)
UESIM_EXPANSION="True"
echo_info "Will compile with UESIM_EXPANSION"
shift;;
--UE-conf-nvram) --UE-conf-nvram)
conf_nvram_path=$(readlink -f $2) conf_nvram_path=$(readlink -f $2)
shift 2;; shift 2;;
...@@ -551,6 +556,7 @@ function main() { ...@@ -551,6 +556,7 @@ function main() {
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file # echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
......
...@@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko ...@@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko
if [ "$1" = "UE" ]; then if [ "$1" = "UE" ]; then
echo "bring up $LTEIF interface for UE" echo "bring up $LTEIF interface for UE"
ifconfig $LTEIF up sudo ifconfig $LTEIF up
fi fi
ip route flush cache sudo ip route flush cache
sleep 1 sleep 1
sysctl -w net.ipv4.conf.all.log_martians=1 sudo sysctl -w net.ipv4.conf.all.log_martians=1
echo "Disabling reverse path filtering" echo "Disabling reverse path filtering"
sysctl -w net.ipv4.conf.all.rp_filter=0 sudo sysctl -w net.ipv4.conf.all.rp_filter=0
ip route flush cache sudo ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables # Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables echo "200 lte " >> /etc/iproute2/rt_tables
fi fi
ip rule add fwmark 1 table lte sudo ip rule add fwmark 1 table lte
ip route add default dev $LTEIF table lte sudo ip route add default dev $LTEIF table lte
...@@ -1110,7 +1110,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) ...@@ -1110,7 +1110,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req); int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1; dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1;
...@@ -1129,7 +1129,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) ...@@ -1129,7 +1129,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus); //LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req); int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
...@@ -1147,7 +1147,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { ...@@ -1147,7 +1147,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi); //LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req); int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
...@@ -1166,7 +1166,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { ...@@ -1166,7 +1166,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id); //LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
//LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); //LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
......
...@@ -1260,7 +1260,7 @@ int pnf_connect(pnf_t* pnf) ...@@ -1260,7 +1260,7 @@ int pnf_connect(pnf_t* pnf)
address = inet_ntoa(addr->sin_addr); address = inet_ntoa(addr->sin_addr);
} }
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); //NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address);
if (pnf->sctp) if (pnf->sctp)
{ {
......
...@@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr) ...@@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
{ {
if(now_hr < sf_start_hr) if(now_hr < sf_start_hr)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); //NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
return 0; return 0;
} }
else else
......
...@@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
if(phy->in_sync == 0) if(phy->in_sync == 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", /*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n",
ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment,
phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
phy->zero_count, phy->zero_count,
phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC"); phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
phy->sfn_sf = new_sfn_sf; phy->sfn_sf = new_sfn_sf;
} }
......
...@@ -204,6 +204,12 @@ typedef struct { ...@@ -204,6 +204,12 @@ typedef struct {
/// condition variable for timer_thread; /// condition variable for timer_thread;
pthread_cond_t cond_ticking; pthread_cond_t cond_ticking;
//time_stats_t timer_stats; //time_stats_t timer_stats;
// below 3 members is used for waiting each UE threads(multiple UEs test) in L2 FAPI simulator.
// This used in UE_phy_stub_single_thread_rxn_txnp4
pthread_mutex_t mutex_single_thread;
pthread_cond_t cond_single_thread;
int num_single_thread[NUMBER_OF_UE_MAX];
} SF_ticking; } SF_ticking;
typedef struct { typedef struct {
...@@ -890,6 +896,7 @@ typedef struct { ...@@ -890,6 +896,7 @@ typedef struct {
struct rx_tx_thread_data { struct rx_tx_thread_data {
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
UE_rxtx_proc_t *proc; UE_rxtx_proc_t *proc;
uint16_t ue_thread_id;
}; };
......
...@@ -64,6 +64,16 @@ ...@@ -64,6 +64,16 @@
# define MAX_MODULES NB_MODULES_MAX # define MAX_MODULES NB_MODULES_MAX
#ifndef UE_EXPANSION #ifndef UE_EXPANSION
// TODO:L2 FAPI simulator.
// UESIM_EXPANSION is used to be same value of MAX_MOBILES_PER_ENB
// in eNB and UE.
// now , if we use --mu option in UE, compiling error will occur.
// This problem will be fixed in the future.
# ifdef UESIM_EXPANSION
# define MAX_MOBILES_PER_ENB 256
# define MAX_MOBILES_PER_ENB_NB_IoT 256
# define MAX_eNB 2
# else
# ifdef LARGE_SCALE # ifdef LARGE_SCALE
# define MAX_MOBILES_PER_ENB 128 # define MAX_MOBILES_PER_ENB 128
# define MAX_MOBILES_PER_ENB_NB_IoT 128 # define MAX_MOBILES_PER_ENB_NB_IoT 128
...@@ -73,6 +83,7 @@ ...@@ -73,6 +83,7 @@
# define MAX_MOBILES_PER_ENB_NB_IoT 16 # define MAX_MOBILES_PER_ENB_NB_IoT 16
# define MAX_eNB 2 # define MAX_eNB 2
# endif # endif
#endif
#else #else
# define MAX_MOBILES_PER_ENB 256 # define MAX_MOBILES_PER_ENB 256
# define MAX_MOBILES_PER_ENB_NB_IoT 256 # define MAX_MOBILES_PER_ENB_NB_IoT 256
......
...@@ -1426,7 +1426,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1426,7 +1426,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
if (ra->state == MSG2) if (ra->state == MSG2)
generate_Msg2(module_idP, CC_id, frameP, subframeP, ra); generate_Msg2(module_idP, CC_id, frameP, subframeP, ra);
else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP )
generate_Msg4(module_idP, CC_id, frameP, subframeP, ra); generate_Msg4(module_idP, CC_id, frameP, subframeP, ra);
else if (ra->state == WAITMSG4ACK) else if (ra->state == WAITMSG4ACK)
check_Msg4_retransmission(module_idP, CC_id, frameP, check_Msg4_retransmission(module_idP, CC_id, frameP,
......
...@@ -594,6 +594,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, ...@@ -594,6 +594,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id,
LTE_eNB_UE_stats *eNB_UE_stats2 = NULL; LTE_eNB_UE_stats *eNB_UE_stats2 = NULL;
UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2; UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2;
#endif #endif
memset(rballoc_sub[0],0,(MAX_NUM_CCs)*(N_RBG_MAX)*sizeof(unsigned char));
memset(min_rb_unit,0,sizeof(min_rb_unit)); memset(min_rb_unit,0,sizeof(min_rb_unit));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
......
...@@ -61,6 +61,7 @@ extern uint16_t frame_cnt; ...@@ -61,6 +61,7 @@ extern uint16_t frame_cnt;
#include "SCHED/sched_common.h" #include "SCHED/sched_common.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern uint8_t nfapi_mode;
int choose(int n, int k) int choose(int n, int k)
{ {
...@@ -1286,6 +1287,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_ ...@@ -1286,6 +1287,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
*/ */
#endif #endif
harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index; harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index;
harq_information->harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG;
AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL, AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
"pucch_ConfigDedicated is null!\n"); "pucch_ConfigDedicated is null!\n");
if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL) if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
...@@ -3629,9 +3631,19 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, ...@@ -3629,9 +3631,19 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
AssertFatal(num_ack_nak == 1, AssertFatal(num_ack_nak == 1,
"num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n", "num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n",
num_ack_nak,frameP,subframeP); num_ack_nak,frameP,subframeP);
AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8,
"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n", // In case of nFAPI, sometimes timing of eNB and UE become different.
harq_pid, UE_id, rnti); // So if nfapi_mode == 2(VNF) , this function don't check assertion to avoid process exit.
if (nfapi_mode != 2){
AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8,
"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
harq_pid, UE_id, rnti);
} else {
if(sched_ctl->round[CC_idP][harq_pid] == 8){
LOG_E(MAC,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",harq_pid, UE_id, rnti);
return;
}
}
AssertFatal(pdu[0] == 1 || pdu[0] == 2 AssertFatal(pdu[0] == 1 || pdu[0] == 2
|| pdu[0] == 4, || pdu[0] == 4,
"Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n", "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",
......
...@@ -64,7 +64,8 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES ...@@ -64,7 +64,8 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES
extern unsigned char NB_INST; extern unsigned char NB_INST;
#endif #endif
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST; extern uint16_t NB_UE_INST;
extern uint16_t NB_THREAD_INST;
extern unsigned char NB_RN_INST; extern unsigned char NB_RN_INST;
extern unsigned short NODE_ID[1]; extern unsigned short NODE_ID[1];
......
...@@ -95,7 +95,7 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = { ...@@ -95,7 +95,7 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
uint32_t RRC_CONNECTION_FLAG; uint32_t RRC_CONNECTION_FLAG;
UE_MAC_INST *UE_mac_inst; //[NB_MODULE_MAX]; UE_MAC_INST *UE_mac_inst = NULL; //[NB_MODULE_MAX];
MAC_RLC_XFACE *Mac_rlc_xface; MAC_RLC_XFACE *Mac_rlc_xface;
/// Primary component carrier index of eNB /// Primary component carrier index of eNB
...@@ -109,7 +109,8 @@ eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_EN ...@@ -109,7 +109,8 @@ eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_EN
#ifdef OPENAIR2 #ifdef OPENAIR2
unsigned char NB_eNB_INST = 0; unsigned char NB_eNB_INST = 0;
unsigned char NB_UE_INST = 0; uint16_t NB_UE_INST = 0;
uint16_t NB_THREAD_INST = 0;
unsigned char NB_RN_INST = 0; unsigned char NB_RN_INST = 0;
unsigned char NB_INST = 0; unsigned char NB_INST = 0;
#endif #endif
......
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
#include "common/ran_context.h" #include "common/ran_context.h"
extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
extern uint8_t nfapi_mode;
extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active); extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR
...@@ -103,6 +104,15 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer, ...@@ -103,6 +104,15 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer,
UE_mac_inst = NULL; UE_mac_inst = NULL;
} }
// mutex below are used for multiple UE's L2 FAPI simulation.
if (nfapi_mode == 3){
pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL);
}
LOG_I(MAC, "[MAIN] calling RRC\n"); LOG_I(MAC, "[MAIN] calling RRC\n");
openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
......
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
extern UL_IND_t *UL_INFO; extern UL_IND_t *UL_INFO;
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
extern int next_ra_frame;
extern module_id_t next_Mod_id;
/* /*
* *
...@@ -2523,44 +2525,50 @@ ue_scheduler(const module_id_t module_idP, ...@@ -2523,44 +2525,50 @@ ue_scheduler(const module_id_t module_idP,
UE_mac_inst[module_idP].crnti, txFrameP, UE_mac_inst[module_idP].crnti, txFrameP,
txSubframeP, eNB_indexP); txSubframeP, eNB_indexP);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
if(module_idP == 0){
do {
// Checks if a message has been sent to MAC sub-task
itti_poll_msg(TASK_MAC_UE, &msg_p);
do { if (msg_p != NULL) {
// Checks if a message has been sent to MAC sub-task
itti_poll_msg(TASK_MAC_UE, &msg_p);
if (msg_p != NULL) { switch (ITTI_MSG_ID(msg_p)) {
case RRC_MAC_CCCH_DATA_REQ:
LOG_I(MAC,
"Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p),
RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
switch (ITTI_MSG_ID(msg_p)) { // TODO process CCCH data req.
case RRC_MAC_CCCH_DATA_REQ: break;
LOG_I(MAC,
"Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p),
RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
// TODO process CCCH data req.
break;
default:
LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p));
break;
}
default: result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p)); AssertFatal(result == EXIT_SUCCESS,
break; "Failed to free memory (%d)!\n", result);
} }
}
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal(result == EXIT_SUCCESS,
"Failed to free memory (%d)!\n", result);
}
}
while (msg_p != NULL); while (msg_p != NULL);
}
#endif #endif
//Mac_rlc_xface->frameP=frameP; //Mac_rlc_xface->frameP=frameP;
//Rrc_xface->Frame_index=Mac_rlc_xface->frameP; //Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
//if (subframe%5 == 0) //if (subframe%5 == 0)
//LG#ifdef EXMIMO //LG#ifdef EXMIMO
pdcp_run(&ctxt);
// data to/from NETLINK is treated in pdcp_run.
// one socket is used in multiple UE's L2 FAPI simulator and
// only first UE need to do this.
if(module_idP == 0){
pdcp_run(&ctxt);
}
//#endif //#endif
UE_mac_inst[module_idP].txFrame = txFrameP; UE_mac_inst[module_idP].txFrame = txFrameP;
UE_mac_inst[module_idP].txSubframe = txSubframeP; UE_mac_inst[module_idP].txSubframe = txSubframeP;
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include "platform_constants.h" #include "platform_constants.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "msc.h" #include "msc.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#if defined(ENABLE_SECURITY) #if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h" # include "UTIL/OSA/osa_defs.h"
#endif #endif
...@@ -64,9 +64,12 @@ ...@@ -64,9 +64,12 @@
#endif #endif
extern int otg_enabled; extern int otg_enabled;
#if defined(ENABLE_USE_MME)
extern uint8_t nfapi_mode;
#endif
#include "common/ran_context.h" #include "common/ran_context.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
hash_table_t *pdcp_coll_p = NULL;
#ifdef MBMS_MULTICAST_OUT #ifdef MBMS_MULTICAST_OUT
# include <sys/types.h> # include <sys/types.h>
...@@ -798,12 +801,21 @@ pdcp_data_ind( ...@@ -798,12 +801,21 @@ pdcp_data_ind(
* for the UE compiled in noS1 mode, we need 0 * for the UE compiled in noS1 mode, we need 0
* TODO: be sure of this * TODO: be sure of this
*/ */
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; if (nfapi_mode == 3) {
#ifdef UESIM_EXPANSION
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 0;
#else
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id;
#endif
} else {
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1;
}
#endif #endif
} else { } else {
((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB); ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB);
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id;
} }
// new_sdu_p->data->inst is set again in UE case so move to above.
//Panos: Commented this out because it cancels the assignment in #if defined(ENABLE_USE_MME) case //Panos: Commented this out because it cancels the assignment in #if defined(ENABLE_USE_MME) case
//((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; //((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id;
...@@ -2021,7 +2033,7 @@ void pdcp_layer_init(void) ...@@ -2021,7 +2033,7 @@ void pdcp_layer_init(void)
* Initialize SDU list * Initialize SDU list
*/ */
list_init(&pdcp_sdu_list, NULL); list_init(&pdcp_sdu_list, NULL);
pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * 16, NULL, pdcp_free); pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free);
AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed"); AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed");
for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) { for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) {
......
...@@ -542,7 +542,7 @@ sdu_size_t pdcp_input_sdu_remaining_size_to_read; ...@@ -542,7 +542,7 @@ sdu_size_t pdcp_input_sdu_remaining_size_to_read;
(((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(sESSION_ID)) << 37) | \
(((hash_key_t)(0x0000000000000001)) << 63)) (((hash_key_t)(0x0000000000000001)) << 63))
hash_table_t *pdcp_coll_p; extern hash_table_t *pdcp_coll_p;
#endif #endif
/*@}*/ /*@}*/
...@@ -82,10 +82,13 @@ extern struct msghdr nas_msg_tx; ...@@ -82,10 +82,13 @@ extern struct msghdr nas_msg_tx;
extern struct msghdr nas_msg_rx; extern struct msghdr nas_msg_rx;
unsigned char pdcp_read_state_g = 0; unsigned char pdcp_read_state_g = 0;
extern uint8_t nfapi_mode;
#ifdef UESIM_EXPANSION
extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
#endif
#endif #endif
extern Packet_OTG_List_t *otg_pdcp_buffer; extern Packet_OTG_List_t *otg_pdcp_buffer;
#if defined(LINK_ENB_PDCP_TO_GTPV1U) #if defined(LINK_ENB_PDCP_TO_GTPV1U)
# include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_task.h"
# include "gtpv1u_eNB_defs.h" # include "gtpv1u_eNB_defs.h"
...@@ -168,7 +171,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -168,7 +171,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
((pdcp_data_ind_header_t*) sdu_p->data)->inst, ((pdcp_data_ind_header_t*) sdu_p->data)->inst,
((pdcp_data_ind_header_t *) sdu_p->data)->data_size); ((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
#else #else
//((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; // Raphael: was suppressed by Raymond --> should be suppressed?
// value of sdu_p->data->inst is set in pdcp_data_ind
// it's necessary to set 1 in case of UE with S1.
//if (ctxt_pP->enb_flag){
// ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
//}
#endif #endif
#if defined(LINK_ENB_PDCP_TO_GTPV1U) #if defined(LINK_ENB_PDCP_TO_GTPV1U)
...@@ -927,7 +935,15 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -927,7 +935,15 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB]; ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB];
} else { } else {
ctxt.module_id = 0; if (nfapi_mode == 3) {
#ifdef UESIM_EXPANSION
ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst];
#else
ctxt.module_id = pdcp_read_header_g.inst;
#endif
} else {
ctxt.module_id = 0;
}
rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB;
ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
} }
...@@ -1072,7 +1088,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -1072,7 +1088,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_read_header_g.rb_id, pdcp_read_header_g.rb_id,
rab_id, rab_id,
pdcp_read_header_g.data_size); pdcp_read_header_g.data_size);
if(nfapi_mode == 3){
pdcp_data_req(
&ctxt,
SRB_FLAG_NO,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL
,NULL
#endif
);
}else{
pdcp_data_req( pdcp_data_req(
&ctxt, &ctxt,
SRB_FLAG_NO, SRB_FLAG_NO,
...@@ -1087,6 +1118,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -1087,6 +1118,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
,&pdcp_read_header_g.destinationL2Id ,&pdcp_read_header_g.destinationL2Id
#endif #endif
); );
}
} else { } else {
MSC_LOG_RX_DISCARDED_MESSAGE( MSC_LOG_RX_DISCARDED_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,
...@@ -1130,7 +1162,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -1130,7 +1162,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
pdcp_read_header_g.rb_id, pdcp_read_header_g.rb_id,
DEFAULT_RAB_ID, DEFAULT_RAB_ID,
pdcp_read_header_g.data_size); pdcp_read_header_g.data_size);
if(nfapi_mode == 3){
pdcp_data_req (
&ctxt,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL
,NULL
#endif
);
}else{
pdcp_data_req ( pdcp_data_req (
&ctxt, &ctxt,
SRB_FLAG_NO, SRB_FLAG_NO,
...@@ -1145,6 +1192,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -1145,6 +1192,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
,&pdcp_read_header_g.destinationL2Id ,&pdcp_read_header_g.destinationL2Id
#endif #endif
); );
}
} }
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "UTIL/OCG/OCG_vars.h" #include "UTIL/OCG/OCG_vars.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#include "assertions.h" #include "assertions.h"
extern boolean_t pdcp_data_ind( extern boolean_t pdcp_data_ind(
...@@ -656,7 +656,7 @@ rlc_module_init (void) ...@@ -656,7 +656,7 @@ rlc_module_init (void)
rlc_rrc_data_ind = NULL; rlc_rrc_data_ind = NULL;
rlc_rrc_data_conf = NULL; rlc_rrc_data_conf = NULL;
rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * 16, NULL, rb_free_rlc_union); rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, rb_free_rlc_union);
//AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
if(rlc_coll_p == NULL) { if(rlc_coll_p == NULL) {
LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n"); LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n");
......
...@@ -64,6 +64,8 @@ ...@@ -64,6 +64,8 @@
#include "rrc_nas_primitives.h" #include "rrc_nas_primitives.h"
#include "COMMON/platform_types.h" #include "COMMON/platform_types.h"
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
struct rb_entity { struct rb_entity {
nasRadioBearerId_t rab_id; nasRadioBearerId_t rab_id;
nasSapId_t sapi; nasSapId_t sapi;
...@@ -160,6 +162,10 @@ typedef struct pdcp_data_req_header_s { ...@@ -160,6 +162,10 @@ typedef struct pdcp_data_req_header_s {
sdu_size_t data_size; sdu_size_t data_size;
signed int inst; signed int inst;
ip_traffic_type_t traffic_type; ip_traffic_type_t traffic_type;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
} pdcp_data_req_header_t; } pdcp_data_req_header_t;
typedef struct pdcp_data_ind_header_s { typedef struct pdcp_data_ind_header_s {
...@@ -167,6 +173,10 @@ typedef struct pdcp_data_ind_header_s { ...@@ -167,6 +173,10 @@ typedef struct pdcp_data_ind_header_s {
sdu_size_t data_size; sdu_size_t data_size;
signed int inst; signed int inst;
ip_traffic_type_t dummy_traffic_type; ip_traffic_type_t dummy_traffic_type;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
} pdcp_data_ind_header_t; } pdcp_data_ind_header_t;
extern struct net_device *nasdev[NB_INSTANCES_MAX]; extern struct net_device *nasdev[NB_INSTANCES_MAX];
......
...@@ -304,7 +304,16 @@ ue_ip_common_ip2wireless( ...@@ -304,7 +304,16 @@ ue_ip_common_ip2wireless(
if (dst_addr) { if (dst_addr) {
printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, dst_addr[0],dst_addr[1],dst_addr[2],dst_addr[3]); printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, dst_addr[0],dst_addr[1],dst_addr[2],dst_addr[3]);
} }
// modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start
#ifdef UESIM_EXPANSION
if ((src_addr[3] - 2)> instP) {
pdcph.inst = src_addr[3] - 2;
printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst);
instP = src_addr[3] - 2;
priv_p=netdev_priv(ue_ip_dev[instP]);
}
#endif
// modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator end
//get Ipv4 address and pass to PCDP header //get Ipv4 address and pass to PCDP header
printk("[UE_IP_DRV] source Id: 0x%08x\n",pdcph.sourceL2Id ); printk("[UE_IP_DRV] source Id: 0x%08x\n",pdcph.sourceL2Id );
printk("[UE_IP_DRV] destinationL2Id Id: 0x%08x\n",pdcph.destinationL2Id ); printk("[UE_IP_DRV] destinationL2Id Id: 0x%08x\n",pdcph.destinationL2Id );
......
...@@ -394,7 +394,7 @@ int init_module (void) ...@@ -394,7 +394,7 @@ int init_module (void)
for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) { for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) {
printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst); printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst);
sprintf(devicename,"oip%d",inst); sprintf(devicename,"oip%d",inst+1);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
ue_ip_dev[inst] = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init); ue_ip_dev[inst] = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init);
#else #else
......
...@@ -128,6 +128,17 @@ typedef struct IF_Module_s{ ...@@ -128,6 +128,17 @@ typedef struct IF_Module_s{
pthread_mutex_t if_mutex; pthread_mutex_t if_mutex;
}IF_Module_t; }IF_Module_t;
// These mutex is used for multiple UEs L2 FAPI simulator.
// Each UEs set these value in UL and UL_INFO is shared in all UE's thread.
typedef struct {
pthread_mutex_t rx_mutex;
pthread_mutex_t crc_mutex;
pthread_mutex_t sr_mutex;
pthread_mutex_t harq_mutex;
pthread_mutex_t cqi_mutex;
pthread_mutex_t rach_mutex;
}FILL_UL_INFO_MUTEX_t;
/*Initial */ /*Initial */
IF_Module_t *IF_Module_init(int Mod_id); IF_Module_t *IF_Module_init(int Mod_id);
void IF_Module_kill(int Mod_id); void IF_Module_kill(int Mod_id);
......
This diff is collapsed.
...@@ -17,19 +17,23 @@ ...@@ -17,19 +17,23 @@
//#include "openair1/PHY/defs.h" //#include "openair1/PHY/defs.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h"
UL_IND_t *UL_INFO; // this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
FILL_UL_INFO_MUTEX_t fill_ul_mutex;
nfapi_tx_request_pdu_t* tx_request_pdu_list; //below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
extern UL_IND_t *UL_INFO;
extern nfapi_tx_request_pdu_t* tx_request_pdu_list;
// New // New
/// Pointers to config_request types. Used from nfapi callback functions. /// Pointers to config_request types. Used from nfapi callback functions.
nfapi_dl_config_request_t* dl_config_req; //below 3 difinitions move to phy_stub_UE.c to add initialization when difinition.
nfapi_ul_config_request_t* ul_config_req; extern nfapi_dl_config_request_t* dl_config_req;
nfapi_hi_dci0_request_t* hi_dci0_req; extern nfapi_ul_config_request_t* ul_config_req;
extern nfapi_hi_dci0_request_t* hi_dci0_req;
int tx_req_num_elems; int tx_req_num_elems;
int next_ra_frame; //below 2 difinitions move to lte-ue.c to add initialization when difinition.
module_id_t next_Mod_id; //int next_ra_frame;
//module_id_t next_Mod_id;
eth_params_t stub_eth_params; eth_params_t stub_eth_params;
......
...@@ -51,7 +51,7 @@ extern LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue; ...@@ -51,7 +51,7 @@ extern LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
extern unsigned char NB_INST; extern unsigned char NB_INST;
#endif #endif
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST; extern uint16_t NB_UE_INST;
extern unsigned short NODE_ID[1]; extern unsigned short NODE_ID[1];
#endif #endif
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
pthread_mutex_t ue_pf_po_mutex; pthread_mutex_t ue_pf_po_mutex;
UE_RRC_INST *UE_rrc_inst; UE_RRC_INST *UE_rrc_inst = NULL;
#include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_extern.h"
#define MAX_U32 0xFFFFFFFF #define MAX_U32 0xFFFFFFFF
......
...@@ -57,7 +57,13 @@ Description Defines functions used to handle EPS bearer contexts. ...@@ -57,7 +57,13 @@ Description Defines functions used to handle EPS bearer contexts.
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#ifdef PDCP_USE_NETLINK
#ifdef UESIM_EXPANSION
#include "openairinterface5g_limits.h"
extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
#endif
#endif
extern uint8_t nfapi_mode;
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
...@@ -208,7 +214,7 @@ int esm_ebr_context_create( ...@@ -208,7 +214,7 @@ int esm_ebr_context_create(
char broadcast[INET_ADDRSTRLEN]; char broadcast[INET_ADDRSTRLEN];
struct in_addr in_addr; struct in_addr in_addr;
char command_line[500]; char command_line[500];
int res; int res = -1;
switch (pdn->type) { switch (pdn->type) {
case NET_PDN_TYPE_IPV4V6: case NET_PDN_TYPE_IPV4V6:
...@@ -272,7 +278,38 @@ int esm_ebr_context_create( ...@@ -272,7 +278,38 @@ int esm_ebr_context_create(
strcpy(broadcast, ipv4_addr); strcpy(broadcast, ipv4_addr);
} }
res = sprintf(command_line, if(nfapi_mode ==3){
// this is for L2 FAPI simulator.
// change for multiple UE's like 256UEs.
// if it's made too many tables , OS may crush so we use one table.
#ifdef PDCP_USE_NETLINK
#ifdef UESIM_EXPANSION
uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2;
res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/24 table %d && "
"ip rule add to %s/24 table %d && "
"ip route add default dev oip%d table %d",
inst_nic + 1, ipv4_addr, netmask, broadcast,
ipv4_addr, 201,
ipv4_addr, 201,
inst_nic + 1, 201);
inst_pdcp_list[inst_nic] = ueid;
#else
res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && "
"ip route add default dev oip%d table %d",
ueid + 1, ipv4_addr, netmask, broadcast,
ipv4_addr, ueid + 201,
ipv4_addr, ueid + 201,
ueid + 1, ueid + 201);
#endif
#endif
} else {
res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && " "ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/32 table %d && " "ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && " "ip rule add to %s/32 table %d && "
...@@ -281,6 +318,7 @@ int esm_ebr_context_create( ...@@ -281,6 +318,7 @@ int esm_ebr_context_create(
ipv4_addr, ueid + 201, ipv4_addr, ueid + 201,
ipv4_addr, ueid + 201, ipv4_addr, ueid + 201,
ueid + 1, ueid + 201); ueid + 1, ueid + 201);
}
if ( res<0 ) { if ( res<0 ) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string"); LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
} }
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
// FIXME review these externs // FIXME review these externs
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST; extern uint16_t NB_UE_INST;
char *make_port_str_from_ueid(const char *base_port_str, int ueid); char *make_port_str_from_ueid(const char *base_port_str, int ueid);
......
...@@ -5,8 +5,18 @@ ...@@ -5,8 +5,18 @@
# define NUMBER_OF_eNB_MAX 1 # define NUMBER_OF_eNB_MAX 1
# define NUMBER_OF_RU_MAX 2 # define NUMBER_OF_RU_MAX 2
# ifndef UE_EXPANSION # ifndef UE_EXPANSION
// TODO:L2 FAPI simulator.
// UESIM_EXPANSION is used to be same value of NUMBER_OF_UE_MAX
// in eNB and UE.
// now , if we use --mu option in UE, compiling error will occur.
// This problem will be fixed in the future.
# ifndef UESIM_EXPANSION
# define NUMBER_OF_UE_MAX 16 # define NUMBER_OF_UE_MAX 16
# define NUMBER_OF_CONNECTED_eNB_MAX 3 # define NUMBER_OF_CONNECTED_eNB_MAX 3
# else
# define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# endif
# else # else
# define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_eNB_MAX 1
...@@ -15,8 +25,18 @@ ...@@ -15,8 +25,18 @@
# define NUMBER_OF_eNB_MAX 7 # define NUMBER_OF_eNB_MAX 7
# define NUMBER_OF_RU_MAX 32 # define NUMBER_OF_RU_MAX 32
# ifndef UE_EXPANSION # ifndef UE_EXPANSION
# define NUMBER_OF_UE_MAX 20 /* if the value of MAX_MOBILES_PER_ENB and NUMBER_OF_UE_MAX is different,
eNB process will exit because unexpected access happens.
Now some parts are using NUMBER_OF_UE_MAX
and the other are using MAX_MOBILES_PER_ENB in for-loop.
*/
# ifndef UESIM_EXPANSION
# define NUMBER_OF_UE_MAX 16
# define NUMBER_OF_CONNECTED_eNB_MAX 3 # define NUMBER_OF_CONNECTED_eNB_MAX 3
# else
# define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# endif
# else # else
# define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_eNB_MAX 1
......
...@@ -172,7 +172,7 @@ eNBs = ...@@ -172,7 +172,7 @@ eNBs =
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "127.0.0.3"; mme_ip_address = ( { ipv4 = "192.168.12.26";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
active = "yes"; active = "yes";
preference = "ipv4"; preference = "ipv4";
...@@ -181,14 +181,24 @@ eNBs = ...@@ -181,14 +181,24 @@ eNBs =
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; #ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; #ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
ENB_INTERFACE_NAME_FOR_S1U = "lo"; #ENB_INTERFACE_NAME_FOR_S1U = "lo";
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; #ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24";
#ENB_PORT_FOR_S1U = 2152; # Spec 2152
#ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24";
#ENB_PORT_FOR_X2C = 36422; # Spec 36422
ENB_INTERFACE_NAME_FOR_S1_MME = "enp0s31f6";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.188/24";
ENB_INTERFACE_NAME_FOR_S1U = "enp0s31f6";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.188/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_PORT_FOR_S1U = 2152; # Spec 2152
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.188/24";
ENB_PORT_FOR_X2C = 36422; # Spec 36422 ENB_PORT_FOR_X2C = 36422; # Spec 36422
}; };
} }
); );
...@@ -196,7 +206,7 @@ eNBs = ...@@ -196,7 +206,7 @@ eNBs =
MACRLCs = ( MACRLCs = (
{ {
num_cc = 1; num_cc = 1;
local_s_if_name = "lo"; local_s_if_name = "lo:";
remote_s_address = "127.0.0.1"; remote_s_address = "127.0.0.1";
local_s_address = "127.0.0.2"; local_s_address = "127.0.0.2";
local_s_portc = 50001; local_s_portc = 50001;
......
...@@ -164,6 +164,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name ...@@ -164,6 +164,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
// ******************************************************************* // *******************************************************************
#if defined(PRE_SCD_THREAD)
RU_t *ru = RC.ru[0];
#endif
if (nfapi_mode == 1) { if (nfapi_mode == 1) {
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
uint16_t frame = proc->frame_rx; uint16_t frame = proc->frame_rx;
...@@ -218,6 +222,40 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name ...@@ -218,6 +222,40 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 );
#if defined(PRE_SCD_THREAD)
if (nfapi_mode == 2){
new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
// L2-emulator can work only one eNB.
// memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
// memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
if (pthread_mutex_lock(&ru->proc.mutex_pre_scd)!= 0) {
LOG_E( PHY, "[eNB] error locking proc mutex for eNB pre scd\n");
exit_fun("error locking mutex_time");
}
ru->proc.instance_pre_scd++;
if (ru->proc.instance_pre_scd == 0) {
if (pthread_cond_signal(&ru->proc.cond_pre_scd) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB pre scd\n" );
exit_fun( "ERROR pthread_cond_signal cond_pre_scd" );
}
}else{
LOG_E( PHY, "[eNB] frame %d subframe %d rxtx busy instance_pre_scd %d\n",
proc->frame_rx,proc->subframe_rx,ru->proc.instance_pre_scd );
}
if (pthread_mutex_unlock(&ru->proc.mutex_pre_scd)!= 0) {
LOG_E( PHY, "[eNB] error unlocking mutex_pre_scd mutex for eNB pre scd\n");
exit_fun("error unlocking mutex_pre_scd");
}
}
#endif
pthread_mutex_lock(&eNB->UL_INFO_mutex); pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.frame = proc->frame_rx; eNB->UL_INFO.frame = proc->frame_rx;
...@@ -906,6 +944,12 @@ void init_eNB_proc(int inst) { ...@@ -906,6 +944,12 @@ void init_eNB_proc(int inst) {
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) { if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) {
pthread_create( &L1_proc->pthread, attr0, L1_thread, proc ); pthread_create( &L1_proc->pthread, attr0, L1_thread, proc );
pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc); pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc);
} else if (nfapi_mode == 2) { // this is neccesary in VNF or L2 FAPI simulator.
// Original Code from Fujitsu w/ old structure/field name
//pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
//pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc );
pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx);
} }
pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB ); pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB );
......
...@@ -118,7 +118,11 @@ static int DEFENBS[] = {0}; ...@@ -118,7 +118,11 @@ static int DEFENBS[] = {0};
#include "pdcp.h" #include "pdcp.h"
extern volatile int oai_exit; extern volatile int oai_exit;
extern int emulate_rf;
extern int numerology;
extern clock_source_t clock_source;
extern uint8_t dlsch_ue_select_tbl_in_use;
extern uint8_t nfapi_mode;
extern PARALLEL_CONF_t get_thread_parallel_conf(void); extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void); extern WORKER_CONF_t get_thread_worker_conf(void);
...@@ -141,6 +145,11 @@ int connect_rau(RU_t *ru); ...@@ -141,6 +145,11 @@ int connect_rau(RU_t *ru);
extern uint16_t sf_ahead; extern uint16_t sf_ahead;
#if defined(PRE_SCD_THREAD)
void init_ru_vnf(void);
#endif
/*************************************************************/ /*************************************************************/
/* Functions to attach and configure RRU */ /* Functions to attach and configure RRU */
...@@ -1942,7 +1951,12 @@ void* pre_scd_thread( void* param ){ ...@@ -1942,7 +1951,12 @@ void* pre_scd_thread( void* param ){
int CC_id; int CC_id;
int Mod_id; int Mod_id;
RU_t *ru = (RU_t*)param; RU_t *ru = (RU_t*)param;
Mod_id = ru->eNB_list[0]->Mod_id;
// L2-emulator can work only one eNB
if( nfapi_mode == 2)
Mod_id = 0;
else
Mod_id = ru->eNB_list[0]->Mod_id;
frame = 0; frame = 0;
subframe = 4; subframe = 4;
...@@ -2820,6 +2834,114 @@ void stop_RU(int nb_ru) ...@@ -2820,6 +2834,114 @@ void stop_RU(int nb_ru)
} }
} }
//Some of the member of ru pointer is used in pre_scd.
//This funtion is for initializing ru pointer for L2 FAPI simulator.
#if defined(PRE_SCD_THREAD)
void init_ru_vnf(void) {
int ru_id;
RU_t *ru;
RU_proc_t *proc;
// PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
int i;
int CC_id;
dlsch_ue_select_tbl_in_use = 1;
// create status mask
RC.ru_mask = 0;
pthread_mutex_init(&RC.ru_mutex,NULL);
pthread_cond_init(&RC.ru_cond,NULL);
// read in configuration file)
printf("configuring RU from file\n");
RCconfig_RU();
LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs());
if (RC.nb_CC != 0)
for (i=0;i<RC.nb_L1_inst;i++)
for (CC_id=0;CC_id<RC.nb_CC[i];CC_id++) RC.eNB[i][CC_id]->num_RU=0;
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
LOG_D(PHY,"Process RC.ru[%d]\n",ru_id);
ru = RC.ru[ru_id];
// ru->rf_config_file = rf_config_file;
ru->idx = ru_id;
ru->ts_offset = 0;
// use eNB_list[0] as a reference for RU frame parameters
// NOTE: multiple CC_id are not handled here yet!
if (ru->num_eNB > 0) {
// LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file);
if (ru->eNB_list[0] == 0)
{
LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__);
ru->eNB_list[0] = RC.eNB[0][0];
ru->num_eNB=1;
//
// DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU
//
}
else
{
LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__);
}
}
// frame_parms is not used in L2 FAPI simulator
/*
eNB0 = ru->eNB_list[0];
LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
LOG_D(PHY, "eNB0:%p\n", eNB0);
if (eNB0)
{
if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
AssertFatal(eNB0!=NULL,"eNB0 is null!\n");
if (eNB0) {
LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx);
memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
// attach all RU to all eNBs in its list/
LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU);
for (i=0;i<ru->num_eNB;i++) {
eNB0 = ru->eNB_list[i];
eNB0->RU_list[eNB0->num_RU++] = ru;
}
}
}
*/
LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function);
// set_function_spec_param(ru);
LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
// init_RU_proc(ru);
proc = &ru->proc;
memset((void*)proc,0,sizeof(RU_proc_t));
proc->instance_pre_scd = -1;
pthread_mutex_init( &proc->mutex_pre_scd, NULL);
pthread_cond_init( &proc->cond_pre_scd, NULL);
pthread_create(&proc->pthread_pre_scd, NULL, pre_scd_thread, (void*)ru);
pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread");
} // for ru_id
// sleep(1);
LOG_D(HW,"[lte-softmodem.c] RU threads created\n");
}
#endif
/* --------------------------------------------------------*/ /* --------------------------------------------------------*/
/* from here function to use configuration module */ /* from here function to use configuration module */
......
...@@ -879,8 +879,14 @@ int main( int argc, char **argv ) { ...@@ -879,8 +879,14 @@ int main( int argc, char **argv ) {
printf("NFAPI MODE:%s\n", nfapi_mode_str); printf("NFAPI MODE:%s\n", nfapi_mode_str);
if (nfapi_mode==2) // VNF
if (nfapi_mode==2) {// VNF
#if defined(PRE_SCD_THREAD)
init_ru_vnf(); // ru pointer is necessary for pre_scd.
#endif
wait_nfapi_init("main?"); wait_nfapi_init("main?");
}
printf("START MAIN THREADS\n"); printf("START MAIN THREADS\n");
// start the main threads // start the main threads
...@@ -896,13 +902,16 @@ int main( int argc, char **argv ) { ...@@ -896,13 +902,16 @@ int main( int argc, char **argv ) {
printf("wait_eNBs()\n"); printf("wait_eNBs()\n");
wait_eNBs(); wait_eNBs();
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU); printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
if (RC.nb_RU >0) { // RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
// but RU thread deals with pre_scd and this is necessary in VNF and simulator.
// some initialization is necessary and init_ru_vnf do this.
if (RC.nb_RU >0 && nfapi_mode != 2) {
printf("Initializing RU threads\n"); printf("Initializing RU threads\n");
init_RU(get_softmodem_params()->rf_config_file); init_RU(get_softmodem_params()->rf_config_file);
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
RC.ru[ru_id]->rf_map.card=0; RC.ru[ru_id]->rf_map.card=0;
RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset); RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
} }
......
...@@ -150,6 +150,7 @@ ...@@ -150,6 +150,7 @@
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \ {"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \ {"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \ {"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ {"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
...@@ -158,7 +159,7 @@ ...@@ -158,7 +159,7 @@
{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \ {"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 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}, \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \ {"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
} }
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
...@@ -306,6 +307,7 @@ extern void kill_eNB_proc(int inst); ...@@ -306,6 +307,7 @@ extern void kill_eNB_proc(int inst);
// In lte-ru.c // In lte-ru.c
extern void init_RU(char*); extern void init_RU(char*);
extern void stop_ru(RU_t *ru); extern void stop_ru(RU_t *ru);
extern void init_ru_vnf(void);
extern void init_RU_proc(RU_t *ru); extern void init_RU_proc(RU_t *ru);
extern void stop_RU(int nb_ru); extern void stop_RU(int nb_ru);
extern void kill_RU_proc(RU_t *ru); extern void kill_RU_proc(RU_t *ru);
......
This diff is collapsed.
...@@ -110,9 +110,13 @@ pthread_mutex_t nfapi_sync_mutex; ...@@ -110,9 +110,13 @@ pthread_mutex_t nfapi_sync_mutex;
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
uint8_t nfapi_mode = 0; uint8_t nfapi_mode = 0;
#ifdef PDCP_USE_NETLINK
#ifdef UESIM_EXPANSION
uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
#endif
#endif
uint16_t sf_ahead=2; uint16_t sf_ahead=2;
int tddflag;
char *emul_iface; char *emul_iface;
...@@ -491,10 +495,12 @@ static void get_options(void) { ...@@ -491,10 +495,12 @@ static void get_options(void) {
} }
UE_scan=0; UE_scan=0;
if (tddflag > 0) { if (tddflag > 0) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id]->frame_type = TDD; frame_parms[CC_id]->frame_type = TDD;
frame_parms[CC_id]->tdd_config = tddflag;
}
} }
if (frame_parms[0]->N_RB_DL !=0) { if (frame_parms[0]->N_RB_DL !=0) {
...@@ -722,9 +728,15 @@ int main( int argc, char **argv ) { ...@@ -722,9 +728,15 @@ int main( int argc, char **argv ) {
#endif #endif
int CC_id; int CC_id;
uint8_t abstraction_flag=0; uint8_t abstraction_flag=0;
#ifdef PDCP_USE_NETLINK
#ifdef UESIM_EXPANSION
memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list));
#endif
#endif
// Default value for the number of UEs. It will hold, // Default value for the number of UEs. It will hold,
// if not changed from the command line option --num-ues // if not changed from the command line option --num-ues
NB_UE_INST=1; NB_UE_INST=1;
NB_THREAD_INST=1;
#if defined (XFORMS) #if defined (XFORMS)
int ret; int ret;
#endif #endif
...@@ -746,12 +758,36 @@ int main( int argc, char **argv ) { ...@@ -746,12 +758,36 @@ int main( int argc, char **argv ) {
get_options (); get_options ();
printf("Running with %d UE instances\n",NB_UE_INST); printf("Running with %d UE instances\n",NB_UE_INST);
if (NB_UE_INST > 1 && simL1flag != 1) { if (NB_UE_INST > 1 && simL1flag != 1 && nfapi_mode != 3) {
printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n"); printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n");
abort(); abort();
} }
printf("NFAPI_MODE value: %d \n", nfapi_mode); printf("NFAPI_MODE value: %d \n", nfapi_mode);
// Checking option of nums_ue_thread.
if(NB_THREAD_INST < 1){
printf("Running with 0 UE rxtx thread, exiting.\n");
abort();
}
// Checking option's relation between nums_ue_thread and num-ues
if(NB_UE_INST <NB_THREAD_INST ){
printf("Number of UEs < number of UE rxtx threads, exiting.\n");
abort();
}
// Not sure if the following is needed here
/*if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
if (UE_flag == 0) {
fprintf(stderr,"Getting configuration failed\n");
exit(-1);
}
else {
printf("Setting nfapi mode to UE_STUB_OFFNET\n");
nfapi_mode = 4;
}
}*/
#if T_TRACER #if T_TRACER
T_Config_Init(); T_Config_Init();
#endif #endif
...@@ -834,6 +870,8 @@ int main( int argc, char **argv ) { ...@@ -834,6 +870,8 @@ int main( int argc, char **argv ) {
RCConfig_sim(); RCConfig_sim();
} }
// source code written in below moved to later to avoid keeping waiting for nfapi_sync_cond in wait_nfapi_init.
/*
// start the main UE threads // start the main UE threads
int eMBMS_active = 0; int eMBMS_active = 0;
...@@ -862,7 +900,8 @@ int main( int argc, char **argv ) { ...@@ -862,7 +900,8 @@ int main( int argc, char **argv ) {
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset); PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
} }
} }
*/
cpuf=get_cpu_freq_GHz(); cpuf=get_cpu_freq_GHz();
#ifndef DEADLINE_SCHEDULER #ifndef DEADLINE_SCHEDULER
printf("NO deadline scheduler\n"); printf("NO deadline scheduler\n");
...@@ -907,8 +946,7 @@ int main( int argc, char **argv ) { ...@@ -907,8 +946,7 @@ int main( int argc, char **argv ) {
LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
#endif #endif
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
if (create_tasks_ue(NB_UE_INST) < 0) {
if (create_tasks_ue(1) < 0) {
printf("cannot create ITTI tasks\n"); printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode exit(-1); // need a softer mode
} }
...@@ -922,6 +960,8 @@ int main( int argc, char **argv ) { ...@@ -922,6 +960,8 @@ int main( int argc, char **argv ) {
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall(MCL_CURRENT | MCL_FUTURE);
rt_sleep_ns(10*100000000ULL); rt_sleep_ns(10*100000000ULL);
const char *nfapi_mode_str = "<UNKNOWN>"; const char *nfapi_mode_str = "<UNKNOWN>";
// start the main UE threads
int eMBMS_active = 0;
switch(nfapi_mode) { switch(nfapi_mode) {
case 0: case 0:
...@@ -951,6 +991,33 @@ int main( int argc, char **argv ) { ...@@ -951,6 +991,33 @@ int main( int argc, char **argv ) {
printf("NFAPI MODE:%s\n", nfapi_mode_str); printf("NFAPI MODE:%s\n", nfapi_mode_str);
if (nfapi_mode==3) // UE-STUB-PNF
{
config_sync_var=0;
wait_nfapi_init("main?");
//Panos: Temporarily we will be using single set of threads for multiple UEs.
//init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
}
else {
init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
frame_parms[0]);
}
if (get_softmodem_params()->phy_test==0) {
printf("Filling UE band info\n");
fill_ue_band_info();
dl_phy_sync_success (0, 0, 0, 1);
}
if (nfapi_mode!=3){
number_of_cards = 1;
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
}
}
// connect the TX/RX buffers // connect the TX/RX buffers
/* /*
......
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