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.
master
Andre Puschmann 3 years ago
parent cb721aa292
commit 06fbb58d70

@ -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;

@ -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;

@ -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;
}

@ -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;
}

@ -131,6 +131,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
/* PCAP */
("pcap.enable", bpo::value<bool>(&args->stack.mac_pcap.enable)->default_value(false), "Enable MAC packet captures for wireshark")
("pcap.filename", bpo::value<string>(&args->stack.mac_pcap.filename)->default_value("enb_mac.pcap"), "MAC layer capture filename")
("pcap.nr_filename", bpo::value<string>(&args->nr_stack.mac.pcap.filename)->default_value("enb_mac_nr.pcap"), "NR MAC layer capture filename")
("pcap.s1ap_enable", bpo::value<bool>(&args->stack.s1ap_pcap.enable)->default_value(false), "Enable S1AP packet captures for wireshark")
("pcap.s1ap_filename", bpo::value<string>(&args->stack.s1ap_pcap.filename)->default_value("enb_s1ap.pcap"), "S1AP layer capture filename")
("pcap.mac_net_enable", bpo::value<bool>(&args->stack.mac_pcap_net.enable)->default_value(false), "Enable MAC network captures")

@ -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;
}

Loading…
Cancel
Save