use of unique_byte_buffer for sib scheduling to allow for padding

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent 598bad1f0e
commit f2af447b1a

@ -56,12 +56,12 @@ private:
/** Storage of cell-specific eNB config and derived params */ /** Storage of cell-specific eNB config and derived params */
struct cell_info_common { struct cell_info_common {
uint32_t enb_cc_idx = 0; uint32_t enb_cc_idx = 0;
asn1::rrc::mib_s mib; asn1::rrc::mib_s mib;
asn1::rrc::sib_type1_s sib1; asn1::rrc::sib_type1_s sib1;
asn1::rrc::sib_type2_s sib2; asn1::rrc::sib_type2_s sib2;
const cell_cfg_t& cell_cfg; const cell_cfg_t& cell_cfg;
std::vector<std::vector<uint8_t> > sib_buffer; ///< Packed SIBs for given CC std::vector<srslte::unique_byte_buffer_t> sib_buffer; ///< Packed SIBs for given CC
cell_info_common(uint32_t idx_, const cell_cfg_t& cfg) : enb_cc_idx(idx_), cell_cfg(cfg) {} cell_info_common(uint32_t idx_, const cell_cfg_t& cfg) : enb_cc_idx(idx_), cell_cfg(cfg) {}
}; };
@ -71,15 +71,15 @@ class cell_info_common_list
public: public:
explicit cell_info_common_list(const rrc_cfg_t& cfg_); explicit cell_info_common_list(const rrc_cfg_t& cfg_);
cell_info_common* get_cc_idx(uint32_t enb_cc_idx) { return &cell_list[enb_cc_idx]; } cell_info_common* get_cc_idx(uint32_t enb_cc_idx) { return cell_list[enb_cc_idx].get(); }
const cell_info_common* get_cc_idx(uint32_t enb_cc_idx) const { return &cell_list[enb_cc_idx]; } const cell_info_common* get_cc_idx(uint32_t enb_cc_idx) const { return cell_list[enb_cc_idx].get(); }
const cell_info_common* get_cell_id(uint32_t cell_id) const; const cell_info_common* get_cell_id(uint32_t cell_id) const;
const cell_info_common* get_pci(uint32_t pci) const; const cell_info_common* get_pci(uint32_t pci) const;
size_t nof_cells() const { return cell_list.size(); } size_t nof_cells() const { return cell_list.size(); }
private: private:
const rrc_cfg_t& cfg; const rrc_cfg_t& cfg;
std::vector<cell_info_common> cell_list; std::vector<std::unique_ptr<cell_info_common> > cell_list;
}; };
/** Class used to store all the resources specific to a UE's cell */ /** Class used to store all the resources specific to a UE's cell */

@ -117,7 +117,7 @@ void rrc::get_metrics(rrc_metrics_t& m)
uint8_t* rrc::read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index) uint8_t* rrc::read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index)
{ {
if (sib_index < ASN1_RRC_MAX_SIB && cc_idx < cell_common_list->nof_cells()) { if (sib_index < ASN1_RRC_MAX_SIB && cc_idx < cell_common_list->nof_cells()) {
return &cell_common_list->get_cc_idx(cc_idx)->sib_buffer.at(sib_index)[0]; return cell_common_list->get_cc_idx(cc_idx)->sib_buffer.at(sib_index)->msg;
} }
return nullptr; return nullptr;
} }
@ -635,7 +635,7 @@ void rrc::config_mac()
// set sib/prach cfg // set sib/prach cfg
for (uint32_t i = 0; i < nof_si_messages; i++) { for (uint32_t i = 0; i < nof_si_messages; i++) {
item.sibs[i].len = cell_common_list->get_cc_idx(ccidx)->sib_buffer.at(i).size(); item.sibs[i].len = cell_common_list->get_cc_idx(ccidx)->sib_buffer.at(i)->N_bytes;
if (i == 0) { if (i == 0) {
item.sibs[i].period_rf = 8; // SIB1 is always 8 rf item.sibs[i].period_rf = 8; // SIB1 is always 8 rf
} else { } else {
@ -737,11 +737,12 @@ uint32_t rrc::generate_sibs()
rrc_log->error("Failed to pack SIB message %d\n", msg_index); rrc_log->error("Failed to pack SIB message %d\n", msg_index);
} }
sib_buffer->N_bytes = bref.distance_bytes(); sib_buffer->N_bytes = bref.distance_bytes();
cell_ctxt->sib_buffer.emplace_back(sib_buffer->msg, sib_buffer->msg + sib_buffer->N_bytes); cell_ctxt->sib_buffer.push_back(std::move(sib_buffer));
// Log SIBs in JSON format // Log SIBs in JSON format
std::string log_msg("CC" + std::to_string(cc_idx) + " SIB payload"); std::string log_msg("CC" + std::to_string(cc_idx) + " SIB payload");
log_rrc_message(log_msg, Tx, sib_buffer.get(), msg[msg_index], msg[msg_index].msg.c1().type().to_string()); log_rrc_message(
log_msg, Tx, cell_ctxt->sib_buffer.back().get(), msg[msg_index], msg[msg_index].msg.c1().type().to_string());
} }
if (cfg.sibs[6].type() == asn1::rrc::sys_info_r8_ies_s::sib_type_and_info_item_c_::types::sib7) { if (cfg.sibs[6].type() == asn1::rrc::sys_info_r8_ies_s::sib_type_and_info_item_c_::types::sib7) {

@ -50,48 +50,49 @@ cell_info_common_list::cell_info_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
cell_list.reserve(cfg.cell_list.size()); cell_list.reserve(cfg.cell_list.size());
// Store the SIB cfg of each carrier // Store the SIB cfg of each carrier
for (size_t ccidx = 0; ccidx < cfg.cell_list.size(); ++ccidx) { for (uint32_t ccidx = 0; ccidx < cfg.cell_list.size(); ++ccidx) {
cell_list.emplace_back(ccidx, cfg.cell_list[ccidx]); cell_list.emplace_back(std::unique_ptr<cell_info_common>{new cell_info_common{ccidx, cfg.cell_list[ccidx]}});
auto& cell_ctxt = cell_list.back(); cell_info_common* cell_ctxt = cell_list.back().get();
// Set Cell MIB // Set Cell MIB
asn1::number_to_enum(cell_ctxt.mib.dl_bw, cfg.cell.nof_prb); asn1::number_to_enum(cell_ctxt->mib.dl_bw, cfg.cell.nof_prb);
cell_ctxt.mib.phich_cfg.phich_res.value = (phich_cfg_s::phich_res_opts::options)cfg.cell.phich_resources; cell_ctxt->mib.phich_cfg.phich_res.value = (phich_cfg_s::phich_res_opts::options)cfg.cell.phich_resources;
cell_ctxt.mib.phich_cfg.phich_dur.value = (phich_cfg_s::phich_dur_opts::options)cfg.cell.phich_length; cell_ctxt->mib.phich_cfg.phich_dur.value = (phich_cfg_s::phich_dur_opts::options)cfg.cell.phich_length;
// Set Cell SIB1 // Set Cell SIB1
cell_ctxt.sib1 = cfg.sib1; cell_ctxt->sib1 = cfg.sib1;
// Update cellId // Update cellId
sib_type1_s::cell_access_related_info_s_* cell_access = &cell_ctxt.sib1.cell_access_related_info; sib_type1_s::cell_access_related_info_s_* cell_access = &cell_ctxt->sib1.cell_access_related_info;
cell_access->cell_id.from_number((cfg.enb_id << 8u) + cell_ctxt.cell_cfg.cell_id); cell_access->cell_id.from_number((cfg.enb_id << 8u) + cell_ctxt->cell_cfg.cell_id);
cell_access->tac.from_number(cell_ctxt.cell_cfg.tac); cell_access->tac.from_number(cell_ctxt->cell_cfg.tac);
// Update DL EARFCN // Update DL EARFCN
cell_ctxt.sib1.freq_band_ind = (uint8_t)srslte_band_get_band(cell_ctxt.cell_cfg.dl_earfcn); cell_ctxt->sib1.freq_band_ind = (uint8_t)srslte_band_get_band(cell_ctxt->cell_cfg.dl_earfcn);
// Set Cell SIB2 // Set Cell SIB2
// update PRACH root seq index for this cell // update PRACH root seq index for this cell
cell_ctxt.sib2 = cfg.sibs[1].sib2(); cell_ctxt->sib2 = cfg.sibs[1].sib2();
cell_ctxt.sib2.rr_cfg_common.prach_cfg.root_seq_idx = cell_ctxt.cell_cfg.root_seq_idx; cell_ctxt->sib2.rr_cfg_common.prach_cfg.root_seq_idx = cell_ctxt->cell_cfg.root_seq_idx;
// update carrier freq // update carrier freq
if (cell_ctxt.sib2.freq_info.ul_carrier_freq_present) { if (cell_ctxt->sib2.freq_info.ul_carrier_freq_present) {
cell_ctxt.sib2.freq_info.ul_carrier_freq = cell_ctxt.cell_cfg.ul_earfcn; cell_ctxt->sib2.freq_info.ul_carrier_freq = cell_ctxt->cell_cfg.ul_earfcn;
} }
} }
} }
const cell_info_common* cell_info_common_list::get_cell_id(uint32_t cell_id) const const cell_info_common* cell_info_common_list::get_cell_id(uint32_t cell_id) const
{ {
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const cell_info_common& c) { auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const std::unique_ptr<cell_info_common>& c) {
return c.cell_cfg.cell_id == cell_id; return c->cell_cfg.cell_id == cell_id;
}); });
return it == cell_list.end() ? nullptr : &(*it); return it == cell_list.end() ? nullptr : it->get();
} }
const cell_info_common* cell_info_common_list::get_pci(uint32_t pci) const const cell_info_common* cell_info_common_list::get_pci(uint32_t pci) const
{ {
auto it = std::find_if( auto it = std::find_if(cell_list.begin(), cell_list.end(), [pci](const std::unique_ptr<cell_info_common>& c) {
cell_list.begin(), cell_list.end(), [pci](const cell_info_common& c) { return c.cell_cfg.pci == pci; }); return c->cell_cfg.pci == pci;
return it == cell_list.end() ? nullptr : &(*it); });
return it == cell_list.end() ? nullptr : it->get();
} }
/************************* /*************************

Loading…
Cancel
Save