Commit a1b9bebf authored by Gabriele Perrone's avatar Gabriele Perrone

Merge branch 'fix-l2-sim' into 'develop'

Fix l2 sim

See merge request oai/openairinterface5g!781
parents 6c8938d5 0de3c734
...@@ -613,8 +613,11 @@ function start_epc { ...@@ -613,8 +613,11 @@ function start_epc {
echo "############################################################" echo "############################################################"
echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS
echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS echo "sudo rm -f hss.log" >> $LOC_EPC_VM_CMDS
echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS #echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS
#echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS
echo "echo \"screen -dm -S simulated_hss ./starthss_real\"" >> $LOC_EPC_VM_CMDS
echo "sudo su -c \"screen -dm -S simulated_hss ./starthss_real\"" >> $LOC_EPC_VM_CMDS
echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS
echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS
...@@ -870,9 +873,9 @@ function start_l2_sim_ue { ...@@ -870,9 +873,9 @@ function start_l2_sim_ue {
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ] if [ $LOC_S1_CONFIGURATION -eq 0 ]
then then
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread $LOC_NB_UES --nokrnmod 1 --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1 echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1
else else
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread $LOC_NB_UES --nokrnmod 1 --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1 echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1
fi fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1 echo "cat ./my-lte-softmodem-run.sh" >> $1
...@@ -905,8 +908,9 @@ function start_l2_sim_ue { ...@@ -905,8 +908,9 @@ function start_l2_sim_ue {
else else
echo "L2-SIM UE is sync'ed w/ eNB" echo "L2-SIM UE is sync'ed w/ eNB"
fi fi
local max_interfaces_to_check=1 local max_interfaces_to_check=$LOC_NB_UES
if [ $LOC_S1_CONFIGURATION -eq 0 ]; then max_interfaces_to_check=$LOC_NB_UES; fi #local max_interfaces_to_check=1
#if [ $LOC_S1_CONFIGURATION -eq 0 ]; then max_interfaces_to_check=$LOC_NB_UES; fi
local j="1" local j="1"
while [ $j -le $max_interfaces_to_check ] while [ $j -le $max_interfaces_to_check ]
do do
...@@ -2214,15 +2218,41 @@ function run_test_on_vm { ...@@ -2214,15 +2218,41 @@ function run_test_on_vm {
if [ $S1_NOS1_CFG -eq 1 ] if [ $S1_NOS1_CFG -eq 1 ]
then then
get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Pinging the EPC from UE(s)" echo "${CN_CONFIG} : Pinging the EPC from UE(s)"
echo "############################################################" echo "############################################################"
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc.log echo " --- Sequentially ---"
ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE 1 0 local j="1"
while [ $j -le $INT_NB_UES ]
do
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc_seq_from_ue${j}.log
ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE ${j} 0
scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
j=$[$j+1]
done
if [ $INT_NB_UES -gt 1 ]
then
echo " --- In parallel ---"
j="1"
while [ $j -le $INT_NB_UES ]
do
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc_para_from_ue${j}.log
ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE ${j} 1
j=$[$j+1]
done
sleep 25
j="1"
while [ $j -le $INT_NB_UES ]
do
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc_para_from_ue${j}.log
scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
tail -3 $ARCHIVES_LOC/$PING_LOG_FILE
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
j=$[$j+1]
done
fi
else else
get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
...@@ -2267,10 +2297,38 @@ function run_test_on_vm { ...@@ -2267,10 +2297,38 @@ function run_test_on_vm {
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Pinging the UE(s) from EPC" echo "${CN_CONFIG} : Pinging the UE(s) from EPC"
echo "############################################################" echo "############################################################"
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_ue.log echo " --- Sequentially ---"
local j="1"
while [ $j -le $INT_NB_UES ]
do
get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_epc_seq_ue${j}.log
ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0 ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
j=$[$j+1]
done
if [ $INT_NB_UES -gt 1 ]
then
echo " --- In parallel ---"
j="1"
while [ $j -le $INT_NB_UES ]
do
get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_epc_para_ue${j}.log
ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 1
j=$[$j+1]
done
sleep 25
j="1"
while [ $j -le $INT_NB_UES ]
do
PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_epc_para_ue${j}.log
scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
j=$[$j+1]
done
fi
else else
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Pinging the UE(s) from eNB" echo "${CN_CONFIG} : Pinging the UE(s) from eNB"
...@@ -2310,7 +2368,7 @@ function run_test_on_vm { ...@@ -2310,7 +2368,7 @@ function run_test_on_vm {
fi fi
fi fi
if [ $S1_NOS1_CFG -eq 2 ] if [ $S1_NOS1_CFG -eq 0 ]
then then
get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
echo "############################################################" echo "############################################################"
......
...@@ -58,7 +58,7 @@ struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)}; ...@@ -58,7 +58,7 @@ struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
int nas_sock_fd[MAX_MOBILES_PER_ENB]; int nas_sock_fd[MAX_MOBILES_PER_ENB];
int nas_sock_mbms_fd[8]; int nas_sock_mbms_fd;
struct msghdr nas_msg_tx; struct msghdr nas_msg_tx;
struct msghdr nas_msg_rx; struct msghdr nas_msg_rx;
...@@ -95,21 +95,20 @@ static int tun_alloc(char *dev) { ...@@ -95,21 +95,20 @@ static int tun_alloc(char *dev) {
} }
int netlink_init_mbms_tun(char *ifprefix, int num_if) { int netlink_init_mbms_tun(char *ifprefix) {
int ret; int ret;
char ifname[64]; char ifname[64];
int i= num_if-1; sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1); nas_sock_mbms_fd = tun_alloc(ifname);
nas_sock_mbms_fd[i] = tun_alloc(ifname);
if (nas_sock_mbms_fd[i] == -1) { if (nas_sock_mbms_fd == -1) {
printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno)); printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno));
exit(1); exit(1);
} }
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_mbms_fd[i]); printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_mbms_fd);
ret = fcntl(nas_sock_mbms_fd[i],F_SETFL,O_NONBLOCK); ret = fcntl(nas_sock_mbms_fd,F_SETFL,O_NONBLOCK);
if (ret == -1) { if (ret == -1) {
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno)); printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
...@@ -123,7 +122,7 @@ int netlink_init_mbms_tun(char *ifprefix, int num_if) { ...@@ -123,7 +122,7 @@ int netlink_init_mbms_tun(char *ifprefix, int num_if) {
nas_src_addr.nl_family = AF_NETLINK; nas_src_addr.nl_family = AF_NETLINK;
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
nas_src_addr.nl_groups = 0; /* not in mcast groups */ nas_src_addr.nl_groups = 0; /* not in mcast groups */
ret = bind(nas_sock_mbms_fd[i], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr)); ret = bind(nas_sock_mbms_fd, (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
nas_dest_addr.nl_family = AF_NETLINK; nas_dest_addr.nl_family = AF_NETLINK;
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
...@@ -165,7 +164,8 @@ int netlink_init_tun(char *ifprefix, int num_if) { ...@@ -165,7 +164,8 @@ int netlink_init_tun(char *ifprefix, int num_if) {
exit(1); exit(1);
} }
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_fd[i]); printf("[NETLINK]Opened socket %s with fd nas_sock_fd[%d]=%d\n",
ifname, i, nas_sock_fd[i]);
ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK); ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
if (ret == -1) { if (ret == -1) {
......
...@@ -63,6 +63,6 @@ void clear_eNB_transport_info(uint8_t); ...@@ -63,6 +63,6 @@ void clear_eNB_transport_info(uint8_t);
void clear_UE_transport_info(uint8_t); void clear_UE_transport_info(uint8_t);
int netlink_init(void); int netlink_init(void);
int netlink_init_tun(char *ifsuffix, int num_if); int netlink_init_tun(char *ifsuffix, int num_if);
int netlink_init_mbms_tun(char *ifsuffix, int num_if); int netlink_init_mbms_tun(char *ifsuffix);
#endif /* EMU_PROTO_H_ */ #endif /* EMU_PROTO_H_ */
...@@ -1496,39 +1496,34 @@ schedule_ulsch_rnti(module_id_t module_idP, ...@@ -1496,39 +1496,34 @@ schedule_ulsch_rnti(module_id_t module_idP,
if (status >= RRC_CONNECTED && UE_sched_ctrl_ptr->cqi_req_timer > 30) { if (status >= RRC_CONNECTED && UE_sched_ctrl_ptr->cqi_req_timer > 30) {
if (UE_sched_ctrl_ptr->cqi_received == 0) { if (UE_sched_ctrl_ptr->cqi_received == 0) {
if (NFAPI_MODE != NFAPI_MONOLITHIC) {
cqi_req = 0;
} else {
cqi_req = 1; cqi_req = 1;
LOG_D(MAC,"Setting CQI_REQ (timer %d)\n",UE_sched_ctrl_ptr->cqi_req_timer); LOG_D(MAC,
"Setting CQI_REQ (timer %d)\n",
UE_sched_ctrl_ptr->cqi_req_timer);
/* TDD: to be safe, do not ask CQI in special Subframes:36.213/7.2.3 CQI definition */ /* TDD: to be safe, do not ask CQI in special
* Subframes:36.213/7.2.3 CQI definition */
if (cc[CC_id].tdd_Config) { if (cc[CC_id].tdd_Config) {
switch (cc[CC_id].tdd_Config->subframeAssignment) { switch (cc[CC_id].tdd_Config->subframeAssignment) {
case 1: case 1:
if(subframeP == 1 || subframeP == 6) { if (subframeP == 1 || subframeP == 6)
cqi_req=0; cqi_req = 0;
}
break; break;
case 3: case 3:
if(subframeP == 1) { if (subframeP == 1)
cqi_req=0; cqi_req = 0;
}
break; break;
default: default:
LOG_E(MAC," TDD config not supported\n"); LOG_E(MAC, " TDD config not supported\n");
break; break;
} }
} }
if(cqi_req == 1) { if (cqi_req == 1) {
UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP; UE_sched_ctrl_ptr->cqi_req_flag |= 1 << sched_subframeP;
} }
}
} else { } else {
LOG_D(MAC,"Clearing CQI request timer\n"); LOG_D(MAC,"Clearing CQI request timer\n");
UE_sched_ctrl_ptr->cqi_req_flag = 0; UE_sched_ctrl_ptr->cqi_req_flag = 0;
......
...@@ -2158,7 +2158,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2158,7 +2158,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) { if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) { if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
//Substitute with a static value for the MAC layer abstraction (phy_stub mode) //Substitute with a static value for the MAC layer abstraction (phy_stub mode)
phr_p->PH = 40; phr_p->PH = 60;
} else { } else {
phr_p->PH = get_phr_mapping(module_idP, CC_id, eNB_index); phr_p->PH = get_phr_mapping(module_idP, CC_id, eNB_index);
} }
......
...@@ -2299,14 +2299,14 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) { ...@@ -2299,14 +2299,14 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
netlink_init_tun("ue",num_if); netlink_init_tun("ue",num_if);
if (IS_SOFTMODEM_NOS1) if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue"); nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem",num_if); netlink_init_mbms_tun("uem");
nas_config_mbms(1, 2, 2, "uem"); nas_config_mbms(1, 2, 2, "uem");
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);
nas_config(1, 1, 1, "enb"); nas_config(1, 1, 1, "enb");
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){ if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
netlink_init_mbms_tun("enm",1); netlink_init_mbms_tun("enm");
nas_config_mbms(1, 2, 1, "enm"); nas_config_mbms(1, 2, 1, "enm");
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n"); LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
} }
...@@ -2318,7 +2318,7 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) { ...@@ -2318,7 +2318,7 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
}else{ }else{
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){ if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n"); LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n");
netlink_init_mbms_tun("enm",1); netlink_init_mbms_tun("enm");
nas_config_mbms_s1(1, 2, 1, "enm"); nas_config_mbms_s1(1, 2, 1, "enm");
}else }else
LOG_E(PDCP, "ENB pdcp will not use tun interface\n"); LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
......
...@@ -77,7 +77,7 @@ extern struct iovec nas_iov_rx; ...@@ -77,7 +77,7 @@ extern struct iovec nas_iov_rx;
extern int nas_sock_fd[MAX_MOBILES_PER_ENB]; extern int nas_sock_fd[MAX_MOBILES_PER_ENB];
extern int nas_sock_mbms_fd[8]; extern int nas_sock_mbms_fd;
extern int mbms_rab_id; extern int mbms_rab_id;
...@@ -133,7 +133,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { ...@@ -133,7 +133,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
} else if (UE_NAS_USE_TUN) { } else if (UE_NAS_USE_TUN) {
//ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); //ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
if(rb_id == mbms_rab_id){ if(rb_id == mbms_rab_id){
ret = write(nas_sock_mbms_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); ret = write(nas_sock_mbms_fd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite); LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite);
} }
else else
...@@ -299,7 +299,7 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p ...@@ -299,7 +299,7 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p
do { do {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ_BUFFER, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ_BUFFER, 1 );
len = read(UE_NAS_USE_TUN?nas_sock_mbms_fd[0]:nas_sock_mbms_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD); len = read(nas_sock_mbms_fd, &nl_rx_buf, NL_MAX_PAYLOAD);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ_BUFFER, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_MBMS_FIFO_READ_BUFFER, 0 );
if (len<=0) continue; if (len<=0) continue;
......
This diff is collapsed.
...@@ -95,14 +95,15 @@ typedef enum { ...@@ -95,14 +95,15 @@ typedef enum {
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/ /****************************************************************************/
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#ifdef LOG_E #ifdef LOG_E
# define LOG_TRACE(s, x, args...) \ # define LOG_TRACE(s, x, args...) \
do { \ do { \
switch (s) { \ switch (s) { \
case ERROR: LOG_E(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ case ERROR: LOG_E(NAS, " %s:%d " x "\n", __FILENAME__, __LINE__, ##args); break; \
case WARNING: LOG_W(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ case WARNING: LOG_W(NAS, " %s:%d " x "\n", __FILENAME__, __LINE__, ##args); break; \
case INFO: LOG_I(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ case INFO: LOG_I(NAS, " %s:%d " x "\n", __FILENAME__, __LINE__, ##args); break; \
default: LOG_D(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ default: LOG_D(NAS, " %s:%d " x "\n", __FILENAME__, __LINE__, ##args); break; \
} \ } \
} while (0) } while (0)
......
...@@ -286,7 +286,7 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -286,7 +286,7 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
user->emm_data->security->selected_algorithms.encryption = seea; user->emm_data->security->selected_algorithms.encryption = seea;
user->emm_data->security->selected_algorithms.integrity = seia; user->emm_data->security->selected_algorithms.integrity = seia;
#if defined(NAS_BUILT_IN_UE) #if defined(NAS_BUILT_IN_UE)
nas_itti_kenb_refresh_req(security_data->kenb.value); nas_itti_kenb_refresh_req(security_data->kenb.value, user->ueid);
#endif #endif
} }
......
...@@ -100,7 +100,7 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i ...@@ -100,7 +100,7 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) { int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_KENB_REFRESH_REQ); message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_KENB_REFRESH_REQ);
memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb)); memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb));
...@@ -125,7 +125,7 @@ int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) { ...@@ -125,7 +125,7 @@ int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) {
kenb[20], kenb[21], kenb[22], kenb[23], kenb[20], kenb[21], kenb[22], kenb[23],
kenb[24], kenb[25], kenb[26], kenb[27], kenb[24], kenb[25], kenb[26], kenb[27],
kenb[28], kenb[29], kenb[30], kenb[31]); kenb[28], kenb[29], kenb[30], kenb[31]);
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
} }
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) { int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) {
......
...@@ -48,7 +48,7 @@ int nas_itti_protected_msg( ...@@ -48,7 +48,7 @@ int nas_itti_protected_msg(
# if defined(NAS_BUILT_IN_UE) # if defined(NAS_BUILT_IN_UE)
int nas_itti_kenb_refresh_req(const Byte_t kenb[32]); int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id);
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id); int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id);
......
...@@ -88,7 +88,7 @@ extern void oai_subframe_ind(uint16_t sfn, uint16_t sf); ...@@ -88,7 +88,7 @@ extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *), extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
unsigned char _multicast_group, char *multicast_ifname); unsigned char _multicast_group, char *multicast_ifname);
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind);
extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind);
extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind); extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
...@@ -992,6 +992,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -992,6 +992,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
phy_stub_ticking->num_single_thread[ue_thread_id] = -1; phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
UE = rtd->UE; UE = rtd->UE;
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_crc_indication_pdu_t));
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_harq_indication_pdu_t));
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_sr_indication_pdu_t));
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
if(ue_thread_id == 0) { if(ue_thread_id == 0) {
phy_stub_ticking->ticking_var = -1; phy_stub_ticking->ticking_var = -1;
proc->subframe_rx=proc->sub_frame_start; proc->subframe_rx=proc->sub_frame_start;
...@@ -1064,20 +1077,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1064,20 +1077,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
initRefTimes(t3); initRefTimes(t3);
pickTime(current); pickTime(current);
updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/ updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
// Not sure whether we should put the memory allocation here and not sure how much memory
//we should allocate for each subframe cycle.
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t));
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_harq_indication_pdu_t));
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t));
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = (nfapi_cqi_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) {
LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
...@@ -1253,6 +1252,11 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1253,6 +1252,11 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
} }
if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) {
oai_nfapi_cqi_indication(&UL_INFO->cqi_ind);
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
}
if(UL_INFO->harq_ind.harq_indication_body.number_of_harqs>0) { if(UL_INFO->harq_ind.harq_indication_body.number_of_harqs>0) {
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
oai_nfapi_harq_indication(&UL_INFO->harq_ind); oai_nfapi_harq_indication(&UL_INFO->harq_ind);
...@@ -1267,30 +1271,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1267,30 +1271,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
} }
// Free UL_INFO messages
//if(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list != NULL){
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
//}
//if(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list != NULL){
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
//}
//if(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list !=NULL){
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
//}
//if(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list!=NULL){
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
//}
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
// De-allocate memory of nfapi requests copies before next subframe round // De-allocate memory of nfapi requests copies before next subframe round
if(dl_config_req!=NULL) { if(dl_config_req!=NULL) {
if(dl_config_req->vendor_extension!=NULL) { if(dl_config_req->vendor_extension!=NULL) {
...@@ -1308,6 +1288,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1308,6 +1288,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
if(tx_request_pdu_list!=NULL) { if(tx_request_pdu_list!=NULL) {
for (int i = 0; i < tx_req_num_elems; i++) {
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) {
free(tx_request_pdu_list[i].segments[j].segment_data);
tx_request_pdu_list[i].segments[j].segment_data = NULL;
}
}
tx_req_num_elems = 0;
free(tx_request_pdu_list); free(tx_request_pdu_list);
tx_request_pdu_list = NULL; tx_request_pdu_list = NULL;
} }
...@@ -1334,6 +1321,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1334,6 +1321,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
} }
// Free UL_INFO messages
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
// thread finished // thread finished
free(arg); free(arg);
return &UE_thread_rxtx_retval; return &UE_thread_rxtx_retval;
......
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