From c157a37894f36166a9e2def2e3c3e3a02bc0da3d Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 24 Mar 2020 12:38:56 +0100 Subject: [PATCH] Address comments --- srsenb/src/stack/mac/mac.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index f23b1afc6..35548c59b 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -80,15 +80,16 @@ bool mac::init(const mac_args_t& args_, scheduler.set_sched_cfg(&args.sched); // Init softbuffer for SI messages - for (int cc = 0; cc < SRSLTE_MAX_CARRIERS; cc++) { + common_buffers.resize(cells.size()); + for (auto& cc : common_buffers) { for (int i = 0; i < NOF_BCCH_DLSCH_MSG; i++) { - srslte_softbuffer_tx_init(&common_buffers[cc].bcch_softbuffer_tx[i], args.nof_prb); + srslte_softbuffer_tx_init(&cc.bcch_softbuffer_tx[i], args.nof_prb); } // Init softbuffer for PCCH - srslte_softbuffer_tx_init(&common_buffers[cc].pcch_softbuffer_tx, args.nof_prb); + srslte_softbuffer_tx_init(&cc.pcch_softbuffer_tx, args.nof_prb); // Init softbuffer for RAR - srslte_softbuffer_tx_init(&common_buffers[cc].rar_softbuffer_tx, args.nof_prb); + srslte_softbuffer_tx_init(&cc.rar_softbuffer_tx, args.nof_prb); } reset(); @@ -104,12 +105,12 @@ void mac::stop() srslte::rwlock_write_guard lock(rwlock); if (started) { ue_db.clear(); - for (int cc = 0; cc < SRSLTE_MAX_CARRIERS; cc++) { + for (auto& cc : common_buffers) { for (int i = 0; i < NOF_BCCH_DLSCH_MSG; i++) { - srslte_softbuffer_tx_free(&common_buffers[cc].bcch_softbuffer_tx[i]); + srslte_softbuffer_tx_free(&cc.bcch_softbuffer_tx[i]); } - srslte_softbuffer_tx_free(&common_buffers[cc].pcch_softbuffer_tx); - srslte_softbuffer_tx_free(&common_buffers[cc].rar_softbuffer_tx); + srslte_softbuffer_tx_free(&cc.pcch_softbuffer_tx); + srslte_softbuffer_tx_free(&cc.rar_softbuffer_tx); started = false; } }