convert qci_cfg in srsenb to std::map to allow qci values above 10

master
Francisco 4 years ago committed by Andre Puschmann
parent 93b1450e03
commit 6404722b4b

@ -97,7 +97,7 @@ public:
uint32_t teid_out, uint32_t teid_out,
uint32_t addr, uint32_t addr,
const gtpu_interface_rrc::bearer_props* props = nullptr); const gtpu_interface_rrc::bearer_props* props = nullptr);
void rem_gtpu_bearer(gtpu_interface_rrc* gtpu, uint32_t erab_id); void rem_gtpu_bearer(uint32_t erab_id);
void fill_pending_nas_info(asn1::rrc::rrc_conn_recfg_r8_ies_s* msg); void fill_pending_nas_info(asn1::rrc::rrc_conn_recfg_r8_ies_s* msg);
const std::map<uint8_t, erab_t>& get_erabs() const { return erabs; } const std::map<uint8_t, erab_t>& get_erabs() const { return erabs; }

@ -30,14 +30,12 @@ struct rrc_cfg_sr_t {
uint32_t nof_subframes; uint32_t nof_subframes;
}; };
typedef struct { struct rrc_cfg_qci_t {
bool configured = false; bool configured = false;
asn1::rrc::lc_ch_cfg_s::ul_specific_params_s_ lc_cfg; asn1::rrc::lc_ch_cfg_s::ul_specific_params_s_ lc_cfg;
asn1::rrc::pdcp_cfg_s pdcp_cfg; asn1::rrc::pdcp_cfg_s pdcp_cfg;
asn1::rrc::rlc_cfg_c rlc_cfg; asn1::rrc::rlc_cfg_c rlc_cfg;
} rrc_cfg_qci_t; };
#define MAX_NOF_QCI 10
struct rrc_cfg_t { struct rrc_cfg_t {
uint32_t enb_id; ///< Required to pack SIB1 uint32_t enb_id; ///< Required to pack SIB1
@ -51,7 +49,7 @@ struct rrc_cfg_t {
asn1::rrc::pdsch_cfg_ded_s::p_a_e_ pdsch_cfg; asn1::rrc::pdsch_cfg_ded_s::p_a_e_ pdsch_cfg;
rrc_cfg_sr_t sr_cfg; rrc_cfg_sr_t sr_cfg;
rrc_cfg_cqi_t cqi_cfg; rrc_cfg_cqi_t cqi_cfg;
rrc_cfg_qci_t qci_cfg[MAX_NOF_QCI]; std::map<uint32_t, rrc_cfg_qci_t> qci_cfg;
bool enable_mbsfn; bool enable_mbsfn;
uint16_t mbms_mcs; uint16_t mbms_mcs;
uint32_t inactivity_timeout_ms; uint32_t inactivity_timeout_ms;

@ -131,7 +131,6 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root)
return -1; return -1;
} }
for (uint32_t i = 0; i < data->carrier_freqs_info_list.size(); i++) { for (uint32_t i = 0; i < data->carrier_freqs_info_list.size(); i++) {
int cell_resel_prio; int cell_resel_prio;
if (root[i].lookupValue("cell_resel_prio", cell_resel_prio)) { if (root[i].lookupValue("cell_resel_prio", cell_resel_prio)) {
data->carrier_freqs_info_list[i].common_info.cell_resel_prio_present = true; data->carrier_freqs_info_list[i].common_info.cell_resel_prio_present = true;
@ -396,20 +395,22 @@ int field_qci::parse(libconfig::Setting& root)
return -1; return -1;
} }
rrc_cfg_qci_t qcicfg;
field_asn1_enum_number<pdcp_cfg_s::discard_timer_e_> discard_timer( field_asn1_enum_number<pdcp_cfg_s::discard_timer_e_> discard_timer(
"discard_timer", &cfg[qci].pdcp_cfg.discard_timer, &cfg[qci].pdcp_cfg.discard_timer_present); "discard_timer", &qcicfg.pdcp_cfg.discard_timer, &qcicfg.pdcp_cfg.discard_timer_present);
discard_timer.parse(q["pdcp_config"]); discard_timer.parse(q["pdcp_config"]);
field_asn1_enum_number<pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_> pdcp_sn_size( field_asn1_enum_number<pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_> pdcp_sn_size(
"pdcp_sn_size", &cfg[qci].pdcp_cfg.rlc_um.pdcp_sn_size, &cfg[qci].pdcp_cfg.rlc_um_present); "pdcp_sn_size", &qcicfg.pdcp_cfg.rlc_um.pdcp_sn_size, &qcicfg.pdcp_cfg.rlc_um_present);
pdcp_sn_size.parse(q["pdcp_config"]); pdcp_sn_size.parse(q["pdcp_config"]);
cfg[qci].pdcp_cfg.rlc_am_present = qcicfg.pdcp_cfg.rlc_am_present =
q["pdcp_config"].lookupValue("status_report_required", cfg[qci].pdcp_cfg.rlc_am.status_report_required); q["pdcp_config"].lookupValue("status_report_required", qcicfg.pdcp_cfg.rlc_am.status_report_required);
cfg[qci].pdcp_cfg.hdr_compress.set(pdcp_cfg_s::hdr_compress_c_::types::not_used); qcicfg.pdcp_cfg.hdr_compress.set(pdcp_cfg_s::hdr_compress_c_::types::not_used);
// Parse RLC section // Parse RLC section
rlc_cfg_c* rlc_cfg = &cfg[qci].rlc_cfg; rlc_cfg_c* rlc_cfg = &qcicfg.rlc_cfg;
if (q["rlc_config"].exists("ul_am")) { if (q["rlc_config"].exists("ul_am")) {
rlc_cfg->set_am(); rlc_cfg->set_am();
} else if (q["rlc_config"].exists("ul_um") && q["rlc_config"].exists("dl_um")) { } else if (q["rlc_config"].exists("ul_um") && q["rlc_config"].exists("dl_um")) {
@ -425,7 +426,6 @@ int field_qci::parse(libconfig::Setting& root)
// Parse RLC-UM section // Parse RLC-UM section
if (q["rlc_config"].exists("ul_um")) { if (q["rlc_config"].exists("ul_um")) {
ul_um_rlc_s* um_rlc; ul_um_rlc_s* um_rlc;
if (rlc_cfg->type() == rlc_cfg_c::types::um_uni_dir_ul) { if (rlc_cfg->type() == rlc_cfg_c::types::um_uni_dir_ul) {
um_rlc = &rlc_cfg->um_uni_dir_ul().ul_um_rlc; um_rlc = &rlc_cfg->um_uni_dir_ul().ul_um_rlc;
@ -440,7 +440,6 @@ int field_qci::parse(libconfig::Setting& root)
} }
if (q["rlc_config"].exists("dl_um")) { if (q["rlc_config"].exists("dl_um")) {
dl_um_rlc_s* um_rlc; dl_um_rlc_s* um_rlc;
if (rlc_cfg->type() == rlc_cfg_c::types::um_uni_dir_dl) { if (rlc_cfg->type() == rlc_cfg_c::types::um_uni_dir_dl) {
um_rlc = &rlc_cfg->um_uni_dir_dl().dl_um_rlc; um_rlc = &rlc_cfg->um_uni_dir_dl().dl_um_rlc;
@ -505,7 +504,7 @@ int field_qci::parse(libconfig::Setting& root)
return -1; return -1;
} }
lc_ch_cfg_s::ul_specific_params_s_* lc_cfg = &cfg[qci].lc_cfg; lc_ch_cfg_s::ul_specific_params_s_* lc_cfg = &qcicfg.lc_cfg;
parser::field<uint8> priority("priority", &lc_cfg->prio); parser::field<uint8> priority("priority", &lc_cfg->prio);
if (priority.parse(q["logical_channel_config"])) { if (priority.parse(q["logical_channel_config"])) {
@ -526,7 +525,8 @@ int field_qci::parse(libconfig::Setting& root)
parser::field<uint8> log_chan_group("log_chan_group", &lc_cfg->lc_ch_group); parser::field<uint8> log_chan_group("log_chan_group", &lc_cfg->lc_ch_group);
lc_cfg->lc_ch_group_present = not log_chan_group.parse(q["logical_channel_config"]); lc_cfg->lc_ch_group_present = not log_chan_group.parse(q["logical_channel_config"]);
cfg[qci].configured = true; qcicfg.configured = true;
cfg.insert(std::make_pair(qci, qcicfg));
} }
return 0; return 0;

@ -149,13 +149,13 @@ private:
class field_qci final : public parser::field_itf class field_qci final : public parser::field_itf
{ {
public: public:
explicit field_qci(rrc_cfg_qci_t* cfg_) { cfg = cfg_; } explicit field_qci(std::map<uint32_t, rrc_cfg_qci_t>& cfg_) : cfg(cfg_) {}
const char* get_name() override { return "field_cqi"; } const char* get_name() override { return "field_cqi"; }
int parse(Setting& root) override; int parse(Setting& root) override;
private: private:
rrc_cfg_qci_t* cfg; std::map<uint32_t, rrc_cfg_qci_t>& cfg;
}; };
// ASN1 parsers // ASN1 parsers
@ -174,7 +174,6 @@ public:
int parse(Setting& root) override int parse(Setting& root) override
{ {
if (root.exists(name)) { if (root.exists(name)) {
if (enabled_value) { if (enabled_value) {
*enabled_value = true; *enabled_value = true;
} }
@ -203,10 +202,8 @@ class field_asn1_seqof_size : public field_asn1
public: public:
field_asn1_seqof_size(const char* name_, ListType* store_ptr_, bool* enabled_value_ = nullptr) : field_asn1_seqof_size(const char* name_, ListType* store_ptr_, bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_)
store_ptr(store_ptr_) {}
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -233,10 +230,8 @@ class field_asn1_choice_type_number : public field_asn1
public: public:
field_asn1_choice_type_number(const char* name_, ChoiceType* store_ptr_, bool* enabled_value_ = nullptr) : field_asn1_choice_type_number(const char* name_, ChoiceType* store_ptr_, bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_)
store_ptr(store_ptr_) {}
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -338,10 +333,8 @@ class field_asn1_enum_number : public field_asn1
public: public:
field_asn1_enum_number(const char* name_, EnumType* store_ptr_, bool* enabled_value_ = nullptr) : field_asn1_enum_number(const char* name_, EnumType* store_ptr_, bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_)
store_ptr(store_ptr_) {}
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -364,10 +357,8 @@ class field_asn1_enum_str : public field_asn1
public: public:
field_asn1_enum_str(const char* name_, EnumType* store_ptr_, bool* enabled_value_ = nullptr) : field_asn1_enum_str(const char* name_, EnumType* store_ptr_, bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_)
store_ptr(store_ptr_) {}
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -389,10 +380,8 @@ class field_asn1_enum_number_str : public field_asn1
public: public:
field_asn1_enum_number_str(const char* name_, EnumType* store_ptr_, bool* enabled_value_ = nullptr) : field_asn1_enum_number_str(const char* name_, EnumType* store_ptr_, bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_)
store_ptr(store_ptr_) {}
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -418,12 +407,8 @@ public:
func_ptr f_, func_ptr f_,
ChoiceType* store_ptr_, ChoiceType* store_ptr_,
bool* enabled_value_ = nullptr) : bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_), choicetypename(choicetypename_), f(f_)
store_ptr(store_ptr_), {}
choicetypename(choicetypename_),
f(f_)
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -465,12 +450,8 @@ public:
func_ptr f_, func_ptr f_,
ChoiceType* store_ptr_, ChoiceType* store_ptr_,
bool* enabled_value_ = nullptr) : bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_), choicetypename(choicetypename_), f(f_)
store_ptr(store_ptr_), {}
choicetypename(choicetypename_),
f(f_)
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -499,10 +480,8 @@ class field_asn1_bitstring_number : public field_asn1
public: public:
field_asn1_bitstring_number(const char* name_, BitString* store_ptr_, bool* enabled_value_ = nullptr) : field_asn1_bitstring_number(const char* name_, BitString* store_ptr_, bool* enabled_value_ = nullptr) :
field_asn1(name_, enabled_value_), field_asn1(name_, enabled_value_), store_ptr(store_ptr_)
store_ptr(store_ptr_) {}
{
}
int parse_value(Setting& root) override int parse_value(Setting& root) override
{ {
@ -543,10 +522,8 @@ class mbsfn_sf_cfg_list_parser : public parser::field_itf
{ {
public: public:
mbsfn_sf_cfg_list_parser(asn1::rrc::mbsfn_sf_cfg_list_l* mbsfn_list_, bool* enabled_) : mbsfn_sf_cfg_list_parser(asn1::rrc::mbsfn_sf_cfg_list_l* mbsfn_list_, bool* enabled_) :
mbsfn_list(mbsfn_list_), mbsfn_list(mbsfn_list_), enabled(enabled_)
enabled(enabled_) {}
{
}
int parse(Setting& root) override; int parse(Setting& root) override;
const char* get_name() override { return "mbsfnSubframeConfigList"; } const char* get_name() override { return "mbsfnSubframeConfigList"; }
@ -559,10 +536,8 @@ class mbsfn_area_info_list_parser final : public parser::field_itf
{ {
public: public:
mbsfn_area_info_list_parser(asn1::rrc::mbsfn_area_info_list_r9_l* mbsfn_list_, bool* enabled_) : mbsfn_area_info_list_parser(asn1::rrc::mbsfn_area_info_list_r9_l* mbsfn_list_, bool* enabled_) :
mbsfn_list(mbsfn_list_), mbsfn_list(mbsfn_list_), enabled(enabled_)
enabled(enabled_) {}
{
}
int parse(Setting& root) override; int parse(Setting& root) override;
const char* get_name() override { return "mbsfn_area_info_list"; } const char* get_name() override { return "mbsfn_area_info_list"; }

@ -217,11 +217,8 @@ int bearer_cfg_handler::add_erab(uint8_t
uint8_t lcid = erab_id - 2; // Map e.g. E-RAB 5 to LCID 3 (==DRB1) uint8_t lcid = erab_id - 2; // Map e.g. E-RAB 5 to LCID 3 (==DRB1)
uint8_t drbid = erab_id - 4; uint8_t drbid = erab_id - 4;
if (qos.qci >= MAX_NOF_QCI) { auto qci_it = cfg->qci_cfg.find(qos.qci);
logger.error("Invalid QCI=%d for ERAB_id=%d, DRB_id=%d", qos.qci, erab_id, drbid); if (qci_it == cfg->qci_cfg.end() or not qci_it->second.configured) {
return SRSLTE_ERROR;
}
if (not cfg->qci_cfg[qos.qci].configured) {
logger.error("QCI=%d not configured", qos.qci); logger.error("QCI=%d not configured", qos.qci);
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -229,6 +226,7 @@ int bearer_cfg_handler::add_erab(uint8_t
logger.error("DRB logical channel ids must be within 3 and 10"); logger.error("DRB logical channel ids must be within 3 and 10");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
const rrc_cfg_qci_t& qci_cfg = qci_it->second;
erabs[erab_id].id = erab_id; erabs[erab_id].id = erab_id;
erabs[erab_id].qos_params = qos; erabs[erab_id].qos_params = qos;
@ -255,11 +253,11 @@ int bearer_cfg_handler::add_erab(uint8_t
drb_it->lc_ch_cfg_present = true; drb_it->lc_ch_cfg_present = true;
drb_it->lc_ch_cfg.ul_specific_params_present = true; drb_it->lc_ch_cfg.ul_specific_params_present = true;
drb_it->lc_ch_cfg.ul_specific_params.lc_ch_group_present = true; drb_it->lc_ch_cfg.ul_specific_params.lc_ch_group_present = true;
drb_it->lc_ch_cfg.ul_specific_params = cfg->qci_cfg[qos.qci].lc_cfg; drb_it->lc_ch_cfg.ul_specific_params = qci_cfg.lc_cfg;
drb_it->pdcp_cfg_present = true; drb_it->pdcp_cfg_present = true;
drb_it->pdcp_cfg = cfg->qci_cfg[qos.qci].pdcp_cfg; drb_it->pdcp_cfg = qci_cfg.pdcp_cfg;
drb_it->rlc_cfg_present = true; drb_it->rlc_cfg_present = true;
drb_it->rlc_cfg = cfg->qci_cfg[qos.qci].rlc_cfg; drb_it->rlc_cfg = qci_cfg.rlc_cfg;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -339,7 +337,7 @@ uint32_t bearer_cfg_handler::add_gtpu_bearer(uint32_t
return bearer.teid_in; return bearer.teid_in;
} }
void bearer_cfg_handler::rem_gtpu_bearer(srsenb::gtpu_interface_rrc* gtpu, uint32_t erab_id) void bearer_cfg_handler::rem_gtpu_bearer(uint32_t erab_id)
{ {
auto it = erabs.find(erab_id); auto it = erabs.find(erab_id);
if (it != erabs.end()) { if (it != erabs.end()) {

Loading…
Cancel
Save