From 6d190e8480b69505b769b9d94a1c155628dcbafd Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Tue, 26 Aug 2014 14:47:12 +0000 Subject: [PATCH] * fixing few issues with distributed emulation over Ethernet or other mediums git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5758 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair1/PHY/LTE_TRANSPORT/dci.c | 3 +- .../ETH_TRANSPORT/bypass_session_layer.c | 32 +++++++++++++------ .../SIMULATION/ETH_TRANSPORT/emu_transport.c | 29 +++++++++-------- .../SIMULATION/ETH_TRANSPORT/multicast_link.c | 2 +- openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c | 13 ++++++-- targets/README.txt | 1 + .../SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/Makefile | 4 +-- targets/SIMU/USER/oaisim.c | 4 ++- 8 files changed, 58 insertions(+), 30 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 3cbf4ac282..889427b800 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -2314,7 +2314,8 @@ uint8_t generate_dci_top_emul(PHY_VARS_eNB *phy_vars_eNB, eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_ue_spec_dci = num_ue_spec_dci; eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_common_dci = num_common_dci; - LOG_D(PHY,"[eNB %d][DCI][EMUL] num spec dci %d num comm dci %d num PMCH %d \n", phy_vars_eNB->Mod_id, num_ue_spec_dci,num_common_dci, + LOG_D(PHY,"[eNB %d][DCI][EMUL] CC id %d: num spec dci %d num comm dci %d num PMCH %d \n", + phy_vars_eNB->Mod_id, phy_vars_eNB->CC_id, num_ue_spec_dci,num_common_dci, eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_pmch); if (eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pmch_flag == 1 ) diff --git a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c index b3bc9d6dec..1b035ffc84 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c @@ -29,7 +29,7 @@ /*! \file bypass_session_layer.h * \brief implementation of emultor tx and rx * \author Navid Nikaein and Raymond Knopp - * \date 2011 + * \date 2011 - 2014 * \version 1.0 * \company Eurecom * \email: navid.nikaein@eurecom.fr @@ -246,7 +246,7 @@ int emu_transport_handle_ue_info(bypass_msg_header_t *messg, int bytes_read) { UE_transport_info_t *UE_info; - int n_ue, n_enb,CC_id; + int n_ue, n_enb,CC_id=0; int total_tbs = 0, total_header = 0, ue_info_ix =0; DevAssert(bytes_read >= 0); @@ -277,7 +277,7 @@ int emu_transport_handle_ue_info(bypass_msg_header_t *messg, LOG_W(EMU,"RX [UE %d] Total size of buffer is %d (header%d,tbs %d) \n", n_ue, total_header+total_tbs,total_header,total_tbs); } - +#warning "CC id should be adjusted, set to zero for the moment" memcpy(&UE_transport_info[n_ue][CC_id], UE_info, total_header + total_tbs); /* Go to the next UE info */ @@ -357,8 +357,9 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot, #if defined(ENABLE_PGM_TRANSPORT) if (messg->Message_type != EMU_TRANSPORT_NACK) #endif - DevCheck4((messg->frame == frame) && (messg->subframe == (next_slot>>1)), - messg->frame, frame, messg->subframe, next_slot>>1); + DevCheck4((messg->frame == frame) && (messg->subframe == (next_slot>>1)), + messg->frame, frame, messg->subframe, next_slot>>1); + #else if ((messg->frame != frame) || (messg->subframe != next_slot>>1)) LOG_W(EMU, @@ -589,7 +590,7 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int sleep(oai_emulation.info.master_id+1); LOG_T(EMU,"[TX_DATA] SYNC TRANSPORT\n"); } else if(Type==ENB_TRANSPORT) { - LOG_D(EMU,"[TX_DATA] ENB TRANSPORT\n"); + messg->Message_type = EMU_TRANSPORT_INFO_ENB; total_size=0; total_tbs=0; @@ -598,6 +599,11 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int n_enb++) for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { total_tbs=0; + LOG_D(EMU,"[TX_DATA] Frame %d subframe %d CC id %d : ENB TRANSPORT: num dci %d \n", + frame, next_slot>>1, CC_id, + eNB_transport_info[n_enb][CC_id].num_pmch + + eNB_transport_info[n_enb][CC_id].num_ue_spec_dci + + eNB_transport_info[n_enb][CC_id].num_common_dci ); for (n_dci = 0; n_dci < (eNB_transport_info[n_enb][CC_id].num_pmch + eNB_transport_info[n_enb][CC_id].num_ue_spec_dci + eNB_transport_info[n_enb][CC_id].num_common_dci); @@ -624,7 +630,8 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int for (n_ue = oai_emulation.info.first_ue_local; n_ue < (oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local); n_ue++) { - for (n_enb=0; n_enb<UE_transport_info[n_ue][CC_id].num_eNB; n_enb++) { + for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { + for (n_enb=0; n_enb<UE_transport_info[n_ue][CC_id].num_eNB; n_enb++) { total_tbs+=UE_transport_info[n_ue][CC_id].tbs[n_enb]; } if (total_tbs <= MAX_TRANSPORT_BLOCKS_BUFFER_SIZE) { @@ -635,10 +642,15 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int "[UE]running out of memory for the UE emulation transport buffer of size %d\n", MAX_TRANSPORT_BLOCKS_BUFFER_SIZE); } +#ifdef DEBUG_EMU + LOG_D(EMU,"[UE %d][eNB %d][CC %d] total size %d\n", + n_ue, n_enb, CC_id,total_size); +#endif memcpy(&bypass_tx_buffer[byte_tx_count], (char *)&UE_transport_info[n_ue][CC_id], total_size); byte_tx_count += total_size; - } + } + } } else if (Type == RELEASE_TRANSPORT) { messg->Message_type = EMU_TRANSPORT_INFO_RELEASE; } else { @@ -656,8 +668,8 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int bypass_tx_buffer, byte_tx_count); #endif - LOG_D(EMU, "Sent %d bytes [%s] with master_id %d and seq %"PRIuMAX"\n", - byte_tx_count, map_int_to_str(transport_names, Type), + LOG_D(EMU, "Frame %d, subframe %d (%d): Sent %d bytes [%s] with master_id %d and seq %"PRIuMAX"\n", + frame, next_slot>>1, next_slot,byte_tx_count, map_int_to_str(transport_names, Type), messg->master_id, messg->seq_num); } diff --git a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c index fa14d6b018..a8367d429d 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c @@ -29,7 +29,7 @@ /*! \file phy_emulation.c * \brief implements the underlying protocol for emulated data exchange over Ethernet using IP multicast * \author Navid Nikaein - * \date 2011 + * \date 2011 - 2014 * \version 1.1 * \company Eurecom * \email: navid.nikaein@eurecom.fr @@ -148,7 +148,7 @@ void emu_transport(unsigned int frame, unsigned int last_slot, } // UL if (((frame_type == 1) && (direction == SF_UL)) || (frame_type == 0) ) { - emu_transport_UL(frame, last_slot, next_slot); + emu_transport_UL(frame, last_slot, next_slot); } } #if defined(ENABLE_PGM_TRANSPORT) @@ -206,8 +206,8 @@ void emu_transport_UL(unsigned int frame, unsigned int last_slot, bypass_rx_data(frame, last_slot, next_slot, 1); bypass_tx_data(UE_TRANSPORT, frame, next_slot); } else { - bypass_rx_data(frame,last_slot, next_slot, 0); - bypass_tx_data(WAIT_SM_TRANSPORT, frame, next_slot); + bypass_rx_data(frame,last_slot, next_slot, 0); + bypass_tx_data(WAIT_SM_TRANSPORT, frame, next_slot); } } @@ -253,7 +253,9 @@ void clear_eNB_transport_info(uint8_t nb_eNB) eNB_transport_info[eNB_id][CC_id].num_ue_spec_dci=0; } } - // LOG_T(EMU, "EMUL clear_eNB_transport_info\n"); +#ifdef DEBUG_EMU + LOG_D(EMU, "EMUL clear_eNB_transport_info\n"); +#endif } void clear_UE_transport_info(uint8_t nb_UE) @@ -265,7 +267,9 @@ void clear_UE_transport_info(uint8_t nb_UE) UE_transport_info_TB_index[UE_id][CC_id]=0; memset((void *)&UE_transport_info[UE_id][CC_id].cntl,0,sizeof(UE_cntl)); } - // LOG_T(EMU, "EMUL clear_UE_transport_info\n"); +#ifdef DEBUG_EMU + LOG_D(EMU, "EMUL clear_UE_transport_info\n"); +#endif } void fill_phy_enb_vars(unsigned int enb_id, uint8_t CC_id,unsigned int next_slot) @@ -278,10 +282,6 @@ void fill_phy_enb_vars(unsigned int enb_id, uint8_t CC_id,unsigned int next_slot uint8_t nb_total_dci; int i; -#ifdef DEBUG_EMU - LOG_D(EMU, " pbch fill phy eNB %d vars for slot %d fault %d\n", - enb_id, next_slot, network_fault); -#endif // eNB // PBCH : copy payload @@ -309,7 +309,10 @@ void fill_phy_enb_vars(unsigned int enb_id, uint8_t CC_id,unsigned int next_slot eNB_transport_info[enb_id][CC_id].num_ue_spec_dci; PHY_vars_eNB_g[enb_id][CC_id]->num_common_dci[(next_slot>>1)&1] = eNB_transport_info[enb_id][CC_id].num_common_dci; - +#ifdef DEBUG_EMU + LOG_D(EMU, "Fill phy vars eNB %d for slot %d, DCI found %d \n", + enb_id, next_slot, nb_total_dci); +#endif if (nb_total_dci >0) { memcpy(PHY_vars_eNB_g[enb_id][CC_id]->dci_alloc[(next_slot>>1)&1], @@ -423,9 +426,9 @@ void fill_phy_ue_vars(unsigned int ue_id, uint8_t CC_id,unsigned int last_slot) #ifdef DEBUG_EMU LOG_D(EMU, - "Last slot %d subframe %d Fill phy UE %d vars PRACH is (%d,%d) preamble (%d,%d) SR (%d,%d), pucch_sel (%d, %d)\n", + "Last slot %d subframe %d CC_id %d: Fill phy vars UE %d : PRACH is (%d,%d) preamble (%d,%d) SR (%d,%d), pucch_sel (%d, %d)\n", - last_slot,subframe,ue_id, + last_slot,subframe,CC_id, ue_id, UE_transport_info[ue_id][CC_id].cntl.prach_flag, ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_flag, UE_transport_info[ue_id][CC_id].cntl.prach_id, diff --git a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c index 61d0ceaed2..078ecbde5a 100755 --- a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c @@ -276,7 +276,7 @@ int multicast_link_read_data_from_sock(uint8_t is_master) multicast_link_build_select_list (); LOG_D(EMU, "Stuck on select with timeout %s\n", - timeout_p == NULL ? "infinite" : "1000 usecs"); + timeout_p == NULL ? "infinite" : "15000 usecs"); readsocks = select(highsock + 1, &socks, (fd_set *) 0, (fd_set *) 0, timeout_p); if (readsocks < 0) { diff --git a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c b/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c index 7893c9c1ec..1c1dca6074 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. + included in this distribution in the file called "COPYING". If not, + see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr @@ -26,6 +26,15 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ +/*! \file pgm_link.c + * \brief implementation a warpper for openpgm for reliable multicast transmission + * \author Navid Nikaein and S. Roux + * \date 2013 - 2014 + * \version 1.0 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr + */ + #include <pthread.h> #include <stdint.h> #include <string.h> diff --git a/targets/README.txt b/targets/README.txt index e955e233bf..4ed83b4af2 100644 --- a/targets/README.txt +++ b/targets/README.txt @@ -18,6 +18,7 @@ First, you must have all four openair SW directories, openair1, openair2, openai - libblas and libblas-dev - libconfig++8-dev - libgtk-3-dev + - libpgm-5.1 and libpgm-5.1-dev for distributed simulation with reliable multicast transmport - libxml2 and libxml2-dev and gccxml - libforms-bin libforms-dev - nettle-dev nettle-bin openssl libssl-dev diff --git a/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/Makefile b/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/Makefile index 077cc84961..6c05991a2f 100644 --- a/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/Makefile +++ b/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/Makefile @@ -1,7 +1,7 @@ all: oaisim nasmesh oaisim: - (cd $(OPENAIR_TARGETS)/SIMU/USER && make oaisim NAS=1) + (cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 -j2 ) nasmesh: (cd $(OPENAIR2_DIR) && make nasmesh_netlink.ko) (cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL/ && make) @@ -11,4 +11,4 @@ one_eNB_one_UE: oaisim nasmesh userclean: clean oaisim nasmesh clean: - (cd $(OPENAIR_TARGETS)/SIMU/USER && make clean) + (cd $(OPENAIR_TARGETS)/SIMU/USER && make cleanall) diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index a289cba301..6f14f9709e 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -689,7 +689,8 @@ void *l2l1_task(void *args_p) { log_set_instance_type (LOG_INSTANCE_ENB); #endif - if ((next_slot % 2) == 0) + // if ((next_slot % 2) == 0) + if ((slot&1) == 0) clear_eNB_transport_info (oai_emulation.info.nb_enb_local); for (eNB_inst = oai_emulation.info.first_enb_local; (eNB_inst < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)); eNB_inst++) { @@ -750,6 +751,7 @@ void *l2l1_task(void *args_p) { #endif if ((next_slot % 2) == 0) + // if ((slot&1) == 0) clear_UE_transport_info (oai_emulation.info.nb_ue_local); for (UE_inst = oai_emulation.info.first_ue_local; (UE_inst < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local)); UE_inst++) { -- GitLab