From 06fbb58d70ea5e88bb93d0dc17d5dc94a9ddfe80 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 5 Oct 2021 10:31:33 +0200 Subject: [PATCH] gnb,mac: add dedicated arguments struct for MAC-NR as the PCAP object is now only visible inside MAC-NR we can't share the PCAP file between EUTRA/NR (like we do in the UE). This patch removes the hard-coded filename for the NR PCAP file. --- srsenb/hdr/enb.h | 1 + srsenb/hdr/stack/gnb_stack_nr.h | 15 ++++++++++----- srsenb/src/enb.cc | 2 +- srsenb/src/enb_cfg_parser.cc | 4 ++++ srsenb/src/main.cc | 1 + srsenb/src/stack/gnb_stack_nr.cc | 14 +++++--------- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index 0a9fd55a8..3b72417e7 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -112,6 +112,7 @@ struct all_args_t { general_args_t general; phy_args_t phy; stack_args_t stack; + gnb_stack_args_t nr_stack; }; struct rrc_cfg_t; diff --git a/srsenb/hdr/stack/gnb_stack_nr.h b/srsenb/hdr/stack/gnb_stack_nr.h index f9ac6e7f5..cb0af14e9 100644 --- a/srsenb/hdr/stack/gnb_stack_nr.h +++ b/srsenb/hdr/stack/gnb_stack_nr.h @@ -29,6 +29,11 @@ namespace srsenb { +struct gnb_stack_args_t { + stack_log_args_t log; + mac_nr_args_t mac; +}; + class gnb_stack_nr final : public srsenb::enb_stack_base, public stack_interface_phy_nr, public stack_interface_mac, @@ -41,10 +46,10 @@ public: explicit gnb_stack_nr(srslog::sink& log_sink); ~gnb_stack_nr() final; - int init(const srsenb::stack_args_t& args_, - const rrc_nr_cfg_t& rrc_cfg_, - phy_interface_stack_nr* phy_, - x2_interface* x2_); + int init(const gnb_stack_args_t& args_, + const rrc_nr_cfg_t& rrc_cfg_, + phy_interface_stack_nr* phy_, + x2_interface* x2_); // eNB stack base interface void stop() final; @@ -103,7 +108,7 @@ private: void tti_clock_impl(); // args - srsenb::stack_args_t args = {}; + gnb_stack_args_t args = {}; phy_interface_stack_nr* phy = nullptr; srslog::basic_logger& rrc_logger; diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index b55dce228..a096a9adf 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -95,7 +95,7 @@ int enb::init(const all_args_t& args_) } if (tmp_nr_stack) { - if (tmp_nr_stack->init(args.stack, rrc_nr_cfg, tmp_phy.get(), &x2) != SRSRAN_SUCCESS) { + if (tmp_nr_stack->init(args.nr_stack, rrc_nr_cfg, tmp_phy.get(), &x2) != SRSRAN_SUCCESS) { srsran::console("Error initializing NR stack.\n"); ret = SRSRAN_ERROR; } diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 7bc0930dd..176ee1a67 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -1555,6 +1555,10 @@ int set_derived_args_nr(all_args_t* args_, rrc_nr_cfg_t* rrc_cfg_, phy_cfg_t* ph phy_cfg_->phy_cell_cfg_nr.push_back(cfg.phy_cell); } + // MAC-NR PCAP options + args_->nr_stack.mac.pcap.enable = args_->stack.mac_pcap.enable; + args_->nr_stack.log = args_->stack.log; + return SRSRAN_SUCCESS; } diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 6c80cb8a0..82dba6db6 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -131,6 +131,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) /* PCAP */ ("pcap.enable", bpo::value(&args->stack.mac_pcap.enable)->default_value(false), "Enable MAC packet captures for wireshark") ("pcap.filename", bpo::value(&args->stack.mac_pcap.filename)->default_value("enb_mac.pcap"), "MAC layer capture filename") + ("pcap.nr_filename", bpo::value(&args->nr_stack.mac.pcap.filename)->default_value("enb_mac_nr.pcap"), "NR MAC layer capture filename") ("pcap.s1ap_enable", bpo::value(&args->stack.s1ap_pcap.enable)->default_value(false), "Enable S1AP packet captures for wireshark") ("pcap.s1ap_filename", bpo::value(&args->stack.s1ap_pcap.filename)->default_value("enb_s1ap.pcap"), "S1AP layer capture filename") ("pcap.mac_net_enable", bpo::value(&args->stack.mac_pcap_net.enable)->default_value(false), "Enable MAC network captures") diff --git a/srsenb/src/stack/gnb_stack_nr.cc b/srsenb/src/stack/gnb_stack_nr.cc index 796eca164..ed973f3ba 100644 --- a/srsenb/src/stack/gnb_stack_nr.cc +++ b/srsenb/src/stack/gnb_stack_nr.cc @@ -46,13 +46,12 @@ std::string gnb_stack_nr::get_type() return "nr"; } -int gnb_stack_nr::init(const srsenb::stack_args_t& args_, - const rrc_nr_cfg_t& rrc_cfg_, - phy_interface_stack_nr* phy_, - x2_interface* x2_) +int gnb_stack_nr::init(const gnb_stack_args_t& args_, + const rrc_nr_cfg_t& rrc_cfg_, + phy_interface_stack_nr* phy_, + x2_interface* x2_) { args = args_; - // rrc_cfg = rrc_cfg_; phy = phy_; // setup logging @@ -69,10 +68,7 @@ int gnb_stack_nr::init(const srsenb::stack_args_t& args_, stack_logger.set_hex_dump_max_size(args.log.stack_hex_limit); // Init all layers - mac_nr_args_t mac_args = {}; - mac_args.pcap = args.mac_pcap; - mac_args.pcap.filename = "/tmp/enb_mac_nr.pcap"; - if (mac.init(mac_args, phy, nullptr, &rlc, &rrc) != SRSRAN_SUCCESS) { + if (mac.init(args.mac, phy, nullptr, &rlc, &rrc) != SRSRAN_SUCCESS) { stack_logger.error("Couldn't initialize MAC-NR"); return SRSRAN_ERROR; }