From e60a4490d2d525830ce2d7bec7269eddde92d4d4 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 19 Jul 2019 16:09:28 +0200 Subject: [PATCH] streamline embms parameters and fix MCS selection --- srsenb/enb.conf.example | 20 +++++++++++++------- srsenb/hdr/enb.h | 3 --- srsenb/hdr/phy/phy_common.h | 6 +++--- srsenb/hdr/stack/enb_stack_base.h | 6 +++--- srsenb/src/enb.cc | 2 +- srsenb/src/enb_cfg_parser.cc | 2 +- srsenb/src/main.cc | 12 +++++++----- srsenb/src/phy/phy.cc | 3 +++ srsenb/src/phy/phy_common.cc | 7 +++++-- srsenb/src/stack/enb_stack_lte.cc | 6 +++--- srsenb/src/stack/mac/mac.cc | 10 ++++------ 11 files changed, 43 insertions(+), 34 deletions(-) diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index 886a6471f..bb6002661 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -142,6 +142,18 @@ enable = false pusch_max_mcs = 16 nof_ctrl_symbols = 3 +##################################################################### +# eMBMS configuration options +# +# enable: Enable MBMS transmission in the eNB +# m1u_multiaddr: Multicast addres the M1-U socket will register to +# m1u_if_addr: Address of the inteferface the M1-U interface will listen for multicast packets. +# +##################################################################### +#enable = false +#m1u_multiaddr = 239.255.0.1 +#m1u_if_addr = 127.0.1.201 + ##################################################################### # Expert configuration options # @@ -156,10 +168,7 @@ nof_ctrl_symbols = 3 # link_failure_nof_err: Number of PUSCH failures after which a radio-link failure is triggered. # a link failure is when SNR<0 and CRC=KO # max_prach_offset_us: Maximum allowed RACH offset (in us) -# enable_mbsfn: Enable MBMS transmission in the eNB -# m1u_multiaddr: Multicast addres the M1-U socket will register to -# m1u_if_addr: Address of the inteferface the M1-U interface will listen for multicast packets. -# eea_pref_list: Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1). +# eea_pref_list: Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1). # eia_pref_list: Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0). # ##################################################################### @@ -175,8 +184,5 @@ nof_ctrl_symbols = 3 #link_failure_nof_err = 50 #rrc_inactivity_timer = 60000 #max_prach_offset_us = 30 -#enable_mbsfn = false -#m1u_multiaddr = 239.255.0.1 -#m1u_if_addr = 127.0.1.201 #eea_pref_list = EEA0, EEA2, EEA1 #eia_pref_list = EIA2, EIA1, EIA0 \ No newline at end of file diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index 288beafc5..45592e401 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -92,10 +92,7 @@ struct general_args_t { float metrics_period_secs; bool metrics_csv_enable; std::string metrics_csv_filename; - bool enable_mbsfn; bool print_buffer_state; - std::string m1u_multiaddr; - std::string m1u_if_addr; std::string eia_pref_list; std::string eea_pref_list; }; diff --git a/srsenb/hdr/phy/phy_common.h b/srsenb/hdr/phy/phy_common.h index eea35e28b..512156044 100644 --- a/srsenb/hdr/phy/phy_common.h +++ b/srsenb/hdr/phy/phy_common.h @@ -130,10 +130,10 @@ private: phy_interface_stack_lte::phy_cfg_mbsfn_t mbsfn; bool sib13_configured; bool mcch_configured; - uint8_t mch_table[40]; - uint8_t mcch_table[10]; + uint8_t mch_table[40] = {}; + uint8_t mcch_table[10] = {}; uint32_t mch_period_stop; - uint8_t mch_sf_idx_lut[10]; + uint8_t mch_sf_idx_lut[10] = {}; bool is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti); bool is_mcch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti); diff --git a/srsenb/hdr/stack/enb_stack_base.h b/srsenb/hdr/stack/enb_stack_base.h index 7ab4a20f4..6aef89764 100644 --- a/srsenb/hdr/stack/enb_stack_base.h +++ b/srsenb/hdr/stack/enb_stack_base.h @@ -32,10 +32,10 @@ typedef struct { } pcap_args_t; typedef struct { - bool enable_mbsfn; + bool enable; std::string m1u_multiaddr; std::string m1u_if_addr; -} stack_expert_args_t; +} embms_args_t; typedef struct { std::string mac_level; @@ -58,7 +58,7 @@ typedef struct { s1ap_args_t s1ap; pcap_args_t pcap; stack_log_args_t log; - stack_expert_args_t expert; + embms_args_t embms; } stack_args_t; struct stack_metrics_t; diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 1abe0968f..92c8669e0 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -194,7 +194,7 @@ int enb::parse_args(const all_args_t& args_) } rrc_cfg.inactivity_timeout_ms = args.general.rrc_inactivity_timer; - rrc_cfg.enable_mbsfn = args.general.enable_mbsfn; + rrc_cfg.enable_mbsfn = args.stack.embms.enable; // Check number of control symbols if (cell_cfg.nof_prb < 50 && args.stack.mac.sched.nof_ctrl_symbols != 3) { diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 7544322dc..80d5a8ad8 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -661,7 +661,7 @@ int enb::parse_sibs(all_args_t* args, rrc_cfg_t* rrc_cfg, phy_cfg_t* phy_config_ } // Update MBSFN list counter. Only 1 supported - if (not args->general.enable_mbsfn) { + if (not args->stack.embms.enable) { sib2->mbsfn_sf_cfg_list_present = false; sib2->mbsfn_sf_cfg_list.resize(0); } else { diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index ebe589563..fbf0e1077 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -145,13 +145,15 @@ void parse_args(all_args_t *args, int argc, char* argv[]) { ("expert.equalizer_mode", bpo::value(&args->phy.equalizer_mode)->default_value("mmse"), "Equalizer mode") ("expert.estimator_fil_w", bpo::value(&args->phy.estimator_fil_w)->default_value(0.1), "Chooses the coefficients for the 3-tap channel estimator centered filter.") ("expert.rrc_inactivity_timer", bpo::value(&args->general.rrc_inactivity_timer)->default_value(60000), "Inactivity timer in ms") - ("expert.enable_mbsfn", bpo::value(&args->general.enable_mbsfn)->default_value(false), "Enables MBMS in the eNB") ("expert.print_buffer_state", bpo::value(&args->general.print_buffer_state)->default_value(false), "Prints on the console the buffer state every 10 seconds") - ("expert.m1u_multiaddr", bpo::value(&args->general.m1u_multiaddr)->default_value("239.255.0.1"), "M1-U Multicast address the eNB joins.") - ("expert.m1u_if_addr", bpo::value(&args->general.m1u_if_addr)->default_value("127.0.1.201"), "IP address of the interface the eNB will listen for M1-U traffic.") ("expert.eea_pref_list", bpo::value(&args->general.eea_pref_list)->default_value("EEA0, EEA2, EEA1"), "Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1).") ("expert.eia_pref_list", bpo::value(&args->general.eia_pref_list)->default_value("EIA2, EIA1, EIA0"), "Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0).") - ; + + // eMBMS section + ("embms.enable", bpo::value(&args->stack.embms.enable)->default_value(false), "Enables MBMS in the eNB") + ("embms.m1u_multiaddr", bpo::value(&args->stack.embms.m1u_multiaddr)->default_value("239.255.0.1"), "M1-U Multicast address the eNB joins.") + ("embms.m1u_if_addr", bpo::value(&args->stack.embms.m1u_if_addr)->default_value("127.0.1.201"), "IP address of the interface the eNB will listen for M1-U traffic.") + ; // Positional options - config file location bpo::options_description position("Positional options"); @@ -261,7 +263,7 @@ void parse_args(all_args_t *args, int argc, char* argv[]) { exit(1); } } - if (args->general.enable_mbsfn) { + if (args->stack.embms.enable) { if (args->stack.mac.sched.nof_ctrl_symbols == 3) { fprintf(stderr, "nof_ctrl_symbols = %d, While using MBMS, please set number of control symbols to either 1 or 2, " diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index df7a3dea1..77d259f98 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -264,6 +264,9 @@ void phy::configure_mbsfn(sib_type2_s* sib2, sib_type13_r9_s* sib13, mcch_msg_s } phy_rrc_config.mbsfn.mbsfn_subfr_cnfg = sib2->mbsfn_sf_cfg_list[0]; } + } else { + fprintf(stderr, "SIB2 has no MBSFN subframe config specified\n"); + return; } phy_rrc_config.mbsfn.mbsfn_notification_cnfg = sib13->notif_cfg_r9; diff --git a/srsenb/src/phy/phy_common.cc b/srsenb/src/phy/phy_common.cc index 54e9bc6bc..c77a049c9 100644 --- a/srsenb/src/phy/phy_common.cc +++ b/srsenb/src/phy/phy_common.cc @@ -264,12 +264,15 @@ void phy_common::build_mch_table() ZERO_OBJECT(mcch_table); // 40 element table represents 4 frames (40 subframes) - uint32_t nof_sfs = 10; + uint32_t nof_sfs = 0; if (mbsfn.mbsfn_subfr_cnfg.sf_alloc.type().value == mbsfn_sf_cfg_s::sf_alloc_c_::types::one_frame) { generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc.one_frame().to_number(), 1); - } else { + nof_sfs = 10; + } else if (mbsfn.mbsfn_subfr_cnfg.sf_alloc.type().value == mbsfn_sf_cfg_s::sf_alloc_c_::types::four_frames) { generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc.four_frames().to_number(), 4); nof_sfs = 40; + } else { + fprintf(stderr, "No valid SF alloc\n"); } // Debug std::stringstream ss; diff --git a/srsenb/src/stack/enb_stack_lte.cc b/srsenb/src/stack/enb_stack_lte.cc index f0d2dec95..af5719d1c 100644 --- a/srsenb/src/stack/enb_stack_lte.cc +++ b/srsenb/src/stack/enb_stack_lte.cc @@ -121,11 +121,11 @@ int enb_stack_lte::init(const stack_args_t& args_, const rrc_cfg_t& rrc_cfg_) s1ap.init(args.s1ap, &rrc, &s1ap_log); gtpu.init(args.s1ap.gtp_bind_addr, args.s1ap.mme_addr, - args.expert.m1u_multiaddr, - args.expert.m1u_if_addr, + args.embms.m1u_multiaddr, + args.embms.m1u_if_addr, &pdcp, >pu_log, - args.expert.enable_mbsfn); + args.embms.enable); started = true; diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 9c316471c..a49c19836 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -672,7 +672,7 @@ void mac::build_mch_sched(uint32_t tbs) int last_mtch_stop = 0; - if (total_bytes_to_tx >= total_space_avail_bytes) { + if (total_bytes_to_tx > 0 && total_bytes_to_tx >= total_space_avail_bytes) { for(uint32_t i = 0; i < mch.num_mtch_sched;i++){ double ratio = mch.mtch_sched[i].lcid_buffer_size/total_bytes_to_tx; float assigned_sfs = floor(sfs_per_sched_period*ratio); @@ -690,16 +690,14 @@ void mac::build_mch_sched(uint32_t tbs) int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_t* dl_sched_res) { - log_h->step(tti); - srslte_ra_tb_t mcs; - srslte_ra_tb_t mcs_data; - mcs.mcs_idx = this->sib13.mbsfn_area_info_list_r9[0].mcch_cfg_r9.sig_mcs_r9; + srslte_ra_tb_t mcs = {}; + srslte_ra_tb_t mcs_data = {}; + mcs.mcs_idx = this->sib13.mbsfn_area_info_list_r9[0].mcch_cfg_r9.sig_mcs_r9.to_number(); mcs_data.mcs_idx = this->mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].pmch_cfg_r9.data_mcs_r9; srslte_dl_fill_ra_mcs(&mcs, 0, this->cell_config.cell.nof_prb, false); srslte_dl_fill_ra_mcs(&mcs_data, 0, this->cell_config.cell.nof_prb, false); if (is_mcch) { - build_mch_sched(mcs_data.tbs); mch.mcch_payload = mcch_payload_buffer; mch.current_sf_allocation_num = 1;