separate drb srb ids into separate enum types

master
Francisco 4 years ago committed by Francisco Paisana
parent 3a23546c56
commit f7a8b8bf94

@ -20,48 +20,43 @@ namespace srsran {
// Cell nof PRBs // Cell nof PRBs
const std::array<uint32_t, 6> lte_cell_nof_prbs = {6, 15, 25, 50, 75, 100}; const std::array<uint32_t, 6> lte_cell_nof_prbs = {6, 15, 25, 50, 75, 100};
inline uint32_t lte_nof_prb_to_idx(uint32_t nof_prb)
// Radio Bearers
enum class lte_srb { srb0, srb1, srb2, count };
const uint32_t MAX_LTE_SRB_ID = 2;
constexpr bool is_lte_srb(uint32_t lcid)
{
return lcid <= MAX_LTE_SRB_ID;
}
inline const char* get_srb_name(lte_srb srb_id)
{ {
switch (nof_prb) { static const char* names[] = {"SRB0", "SRB1", "SRB2", "invalid SRB id"};
case 6: return names[(uint32_t)(srb_id < lte_srb::count ? srb_id : lte_srb::count)];
return 0; }
case 15: constexpr uint32_t srb_to_lcid(lte_srb srb_id)
return 1; {
case 25: return static_cast<uint32_t>(srb_id);
return 2; }
case 50: constexpr lte_srb lte_lcid_to_srb(uint32_t lcid)
return 3; {
case 75: return static_cast<lte_srb>(lcid);
return 4;
case 100:
return 5;
default:
return -1;
}
} }
// Radio Bearer enum class lte_drb { drb1 = 1, drb2, drb3, drb4, drb5, drb6, drb7, drb8, drb9, drb10, drb11, invalid };
enum class lte_rb { srb0, srb1, srb2, drb1, drb2, drb3, drb4, drb5, drb6, drb7, drb8, drb9, drb10, drb11, count }; const uint32_t MAX_LTE_DRB_ID = 11;
const size_t MAX_LTE_DRB_ID = 11; constexpr bool is_lte_drb(uint32_t lcid)
const size_t MAX_LTE_SRB_ID = 2; {
inline const char* get_rb_name(lte_rb rb_id) return lcid > MAX_LTE_SRB_ID and lcid <= MAX_LTE_DRB_ID + MAX_LTE_SRB_ID;
}
inline const char* get_drb_name(lte_drb drb_id)
{
static const char* names[] = {
"DRB1", "DRB2", "DRB3", "DRB4", "DRB5", "DRB6", "DRB7", "DRB8", "DRB9", "DRB10", "DRB11", "invalid DRB id"};
return names[(uint32_t)(drb_id < lte_drb::invalid ? drb_id : lte_drb::invalid) - 1];
}
constexpr bool is_lte_rb(uint32_t lcid)
{ {
static const char* names[] = {"SRB0", return lcid <= MAX_LTE_DRB_ID + MAX_LTE_SRB_ID;
"SRB1",
"SRB2",
"DRB0",
"DRB1",
"DRB2",
"DRB3",
"DRB4",
"DRB5",
"DRB6",
"DRB7",
"DRB8",
"DRB9",
"DRB10",
"invalid RB id"};
return names[rb_id < lte_rb::count ? (size_t)rb_id : (size_t)lte_rb::count];
} }
} // namespace srsran } // namespace srsran

@ -29,14 +29,17 @@ namespace srsenb {
#define SRSENB_N_RADIO_BEARERS 11 #define SRSENB_N_RADIO_BEARERS 11
#define SRSENB_MAX_UES 64 #define SRSENB_MAX_UES 64
using srsran::lte_rb; using srsran::lte_drb;
using srsran::lte_srb;
using srsran::srb_to_lcid;
inline const char* get_rb_name(uint32_t lcid) inline const char* get_rb_name(uint32_t lcid)
{ {
return srsran::get_rb_name(static_cast<lte_rb>(lcid)); return (srsran::is_lte_srb(lcid)) ? srsran::get_srb_name(srsran::lte_lcid_to_srb(lcid))
: srsran::get_drb_name(static_cast<srsran::lte_drb>(lcid - srsran::MAX_LTE_SRB_ID));
} }
inline uint32_t rb_to_lcid(lte_rb rb_id) constexpr uint32_t drb_to_lcid(lte_drb drb_id)
{ {
return static_cast<uint32_t>(rb_id); return srb_to_lcid(lte_srb::srb2) + static_cast<uint32_t>(drb_id);
} }
// Cat 3 UE - Max number of DL-SCH transport block bits received within a TTI // Cat 3 UE - Max number of DL-SCH transport block bits received within a TTI

@ -135,7 +135,7 @@ int mac_controller::handle_crnti_ce(uint32_t temp_crnti)
set_drb_activation(false); set_drb_activation(false);
// Re-activate SRBs UL (needed for ReconfComplete) // Re-activate SRBs UL (needed for ReconfComplete)
for (uint32_t i = (uint32_t)lte_rb::srb1; i <= (uint32_t)lte_rb::srb2; ++i) { for (uint32_t i = srb_to_lcid(lte_srb::srb1); i <= srb_to_lcid(lte_srb::srb2); ++i) {
current_sched_ue_cfg.ue_bearers[i] = next_sched_ue_cfg.ue_bearers[i]; current_sched_ue_cfg.ue_bearers[i] = next_sched_ue_cfg.ue_bearers[i];
} }
@ -284,7 +284,7 @@ void mac_controller::handle_intraenb_ho_cmd(const asn1::rrc::rrc_conn_recfg_r8_i
set_drb_activation(false); set_drb_activation(false);
// Stop any SRB UL (including SRs) // Stop any SRB UL (including SRs)
for (uint32_t i = (uint32_t)lte_rb::srb1; i <= (uint32_t)lte_rb::srb2; ++i) { for (uint32_t i = srb_to_lcid(lte_srb::srb1); i <= srb_to_lcid(lte_srb::srb2); ++i) {
next_sched_ue_cfg.ue_bearers[i].direction = sched_interface::ue_bearer_cfg_t::DL; next_sched_ue_cfg.ue_bearers[i].direction = sched_interface::ue_bearer_cfg_t::DL;
} }
@ -315,7 +315,7 @@ void mac_controller::set_scell_activation(const std::bitset<SRSRAN_MAX_CARRIERS>
void mac_controller::set_drb_activation(bool active) void mac_controller::set_drb_activation(bool active)
{ {
for (const drb_to_add_mod_s& drb : bearer_list.get_established_drbs()) { for (const drb_to_add_mod_s& drb : bearer_list.get_established_drbs()) {
current_sched_ue_cfg.ue_bearers[drb.drb_id + (uint32_t)lte_rb::srb2].direction = current_sched_ue_cfg.ue_bearers[drb_to_lcid((lte_drb)drb.drb_id)].direction =
active ? sched_interface::ue_bearer_cfg_t::BOTH : sched_interface::ue_bearer_cfg_t::IDLE; active ? sched_interface::ue_bearer_cfg_t::BOTH : sched_interface::ue_bearer_cfg_t::IDLE;
} }
} }

@ -245,7 +245,7 @@ void rrc::send_rrc_connection_reject(uint16_t rnti)
char buf[32] = {}; char buf[32] = {};
sprintf(buf, "SRB0 - rnti=0x%x", rnti); sprintf(buf, "SRB0 - rnti=0x%x", rnti);
log_rrc_message(buf, Tx, pdu.get(), dl_ccch_msg, dl_ccch_msg.msg.c1().type().to_string()); log_rrc_message(buf, Tx, pdu.get(), dl_ccch_msg, dl_ccch_msg.msg.c1().type().to_string());
rlc->write_sdu(rnti, rb_to_lcid(srsran::lte_rb::srb0), std::move(pdu)); rlc->write_sdu(rnti, srb_to_lcid(lte_srb::srb0), std::move(pdu));
} }
/******************************************************************************* /*******************************************************************************
@ -1004,11 +1004,11 @@ void rrc::tti_clock()
// handle queue cmd // handle queue cmd
switch (p.lcid) { switch (p.lcid) {
case static_cast<uint32_t>(lte_rb::srb0): case srb_to_lcid(lte_srb::srb0):
parse_ul_ccch(p.rnti, std::move(p.pdu)); parse_ul_ccch(p.rnti, std::move(p.pdu));
break; break;
case static_cast<uint32_t>(lte_rb::srb1): case srb_to_lcid(lte_srb::srb1):
case static_cast<uint32_t>(lte_rb::srb2): case srb_to_lcid(lte_srb::srb2):
parse_ul_dcch(p.rnti, p.lcid, std::move(p.pdu)); parse_ul_dcch(p.rnti, p.lcid, std::move(p.pdu));
break; break;
case LCID_REM_USER: case LCID_REM_USER:

@ -611,9 +611,9 @@ void rrc::ue::handle_rrc_con_reest_complete(rrc_conn_reest_complete_s* msg, srsr
mac_ctrl.handle_con_reest_complete(); mac_ctrl.handle_con_reest_complete();
// Activate security for SRB1 // Activate security for SRB1
parent->pdcp->config_security(rnti, rb_to_lcid(lte_rb::srb1), ue_security_cfg.get_as_sec_cfg()); parent->pdcp->config_security(rnti, srb_to_lcid(lte_srb::srb1), ue_security_cfg.get_as_sec_cfg());
parent->pdcp->enable_integrity(rnti, rb_to_lcid(lte_rb::srb1)); parent->pdcp->enable_integrity(rnti, srb_to_lcid(lte_srb::srb1));
parent->pdcp->enable_encryption(rnti, rb_to_lcid(lte_rb::srb1)); parent->pdcp->enable_encryption(rnti, srb_to_lcid(lte_srb::srb1));
// Reestablish current DRBs during ConnectionReconfiguration // Reestablish current DRBs during ConnectionReconfiguration
bearer_list = std::move(parent->users.at(old_reest_rnti)->bearer_list); bearer_list = std::move(parent->users.at(old_reest_rnti)->bearer_list);
@ -789,8 +789,8 @@ void rrc::ue::handle_ue_info_resp(const asn1::rrc::ue_info_resp_r9_s& msg, srsra
void rrc::ue::send_security_mode_command() void rrc::ue::send_security_mode_command()
{ {
// Setup SRB1 security/integrity. Encryption is set on completion // Setup SRB1 security/integrity. Encryption is set on completion
parent->pdcp->config_security(rnti, rb_to_lcid(lte_rb::srb1), ue_security_cfg.get_as_sec_cfg()); parent->pdcp->config_security(rnti, srb_to_lcid(lte_srb::srb1), ue_security_cfg.get_as_sec_cfg());
parent->pdcp->enable_integrity(rnti, rb_to_lcid(lte_rb::srb1)); parent->pdcp->enable_integrity(rnti, srb_to_lcid(lte_srb::srb1));
dl_dcch_msg_s dl_dcch_msg; dl_dcch_msg_s dl_dcch_msg;
security_mode_cmd_s* comm = &dl_dcch_msg.msg.set_c1().set_security_mode_cmd(); security_mode_cmd_s* comm = &dl_dcch_msg.msg.set_c1().set_security_mode_cmd();
@ -806,7 +806,7 @@ void rrc::ue::handle_security_mode_complete(security_mode_complete_s* msg)
{ {
parent->logger.info("SecurityModeComplete transaction ID: %d", msg->rrc_transaction_id); parent->logger.info("SecurityModeComplete transaction ID: %d", msg->rrc_transaction_id);
parent->pdcp->enable_encryption(rnti, rb_to_lcid(lte_rb::srb1)); parent->pdcp->enable_encryption(rnti, srb_to_lcid(lte_srb::srb1));
} }
void rrc::ue::handle_security_mode_failure(security_mode_fail_s* msg) void rrc::ue::handle_security_mode_failure(security_mode_fail_s* msg)
@ -1200,7 +1200,7 @@ void rrc::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg, std::string* octet_str)
*octet_str = asn1::octstring_to_string(pdu->msg, pdu->N_bytes); *octet_str = asn1::octstring_to_string(pdu->msg, pdu->N_bytes);
} }
parent->rlc->write_sdu(rnti, rb_to_lcid(lte_rb::srb0), std::move(pdu)); parent->rlc->write_sdu(rnti, srb_to_lcid(lte_srb::srb0), std::move(pdu));
} else { } else {
parent->logger.error("Allocating pdu"); parent->logger.error("Allocating pdu");
} }
@ -1219,15 +1219,15 @@ bool rrc::ue::send_dl_dcch(const dl_dcch_msg_s* dl_dcch_msg, srsran::unique_byte
} }
pdu->N_bytes = (uint32_t)bref.distance_bytes(); pdu->N_bytes = (uint32_t)bref.distance_bytes();
lte_rb rb = lte_rb::srb1; lte_srb rb = lte_srb::srb1;
if (dl_dcch_msg->msg.c1().type() == dl_dcch_msg_type_c::c1_c_::types_opts::dl_info_transfer) { if (dl_dcch_msg->msg.c1().type() == dl_dcch_msg_type_c::c1_c_::types_opts::dl_info_transfer) {
// send messages with NAS on SRB2 if user is fully registered (after RRC reconfig complete) // send messages with NAS on SRB2 if user is fully registered (after RRC reconfig complete)
rb = (parent->rlc->has_bearer(rnti, rb_to_lcid(lte_rb::srb2)) && state == RRC_STATE_REGISTERED) ? lte_rb::srb2 rb = (parent->rlc->has_bearer(rnti, srb_to_lcid(lte_srb::srb2)) && state == RRC_STATE_REGISTERED) ? lte_srb::srb2
: lte_rb::srb1; : lte_srb::srb1;
} }
char buf[32] = {}; char buf[32] = {};
sprintf(buf, "%s - rnti=0x%x", srsran::get_rb_name(rb), rnti); sprintf(buf, "%s - rnti=0x%x", srsran::get_srb_name(rb), rnti);
parent->log_rrc_message(buf, Tx, pdu.get(), *dl_dcch_msg, dl_dcch_msg->msg.c1().type().to_string()); parent->log_rrc_message(buf, Tx, pdu.get(), *dl_dcch_msg, dl_dcch_msg->msg.c1().type().to_string());
// Encode the pdu as an octet string if the user passed a valid pointer. // Encode the pdu as an octet string if the user passed a valid pointer.
@ -1235,7 +1235,7 @@ bool rrc::ue::send_dl_dcch(const dl_dcch_msg_s* dl_dcch_msg, srsran::unique_byte
*octet_str = asn1::octstring_to_string(pdu->msg, pdu->N_bytes); *octet_str = asn1::octstring_to_string(pdu->msg, pdu->N_bytes);
} }
parent->pdcp->write_sdu(rnti, rb_to_lcid(rb), std::move(pdu)); parent->pdcp->write_sdu(rnti, srb_to_lcid(rb), std::move(pdu));
} else { } else {
parent->logger.error("Allocating pdu"); parent->logger.error("Allocating pdu");
return false; return false;

@ -60,7 +60,7 @@ void rlc::add_user(uint16_t rnti)
obj->init(&users[rnti], obj->init(&users[rnti],
&users[rnti], &users[rnti],
timers, timers,
rb_to_lcid(srsran::lte_rb::srb0), srb_to_lcid(lte_srb::srb0),
[rnti, this](uint32_t lcid, uint32_t tx_queue, uint32_t retx_queue) { [rnti, this](uint32_t lcid, uint32_t tx_queue, uint32_t retx_queue) {
update_bsr(rnti, lcid, tx_queue, retx_queue); update_bsr(rnti, lcid, tx_queue, retx_queue);
}); });
@ -262,7 +262,7 @@ void rlc::user_interface::max_retx_attempted()
void rlc::user_interface::write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu) void rlc::user_interface::write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu)
{ {
if (lcid == rb_to_lcid(srsran::lte_rb::srb0)) { if (lcid == srb_to_lcid(lte_srb::srb0)) {
rrc->write_pdu(rnti, lcid, std::move(sdu)); rrc->write_pdu(rnti, lcid, std::move(sdu));
} else { } else {
pdcp->write_pdu(rnti, lcid, std::move(sdu)); pdcp->write_pdu(rnti, lcid, std::move(sdu));

@ -80,45 +80,45 @@ int test_lc_ch_pbr_infinity()
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg(); srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg); ue_cfg = generate_setup_ue_cfg(ue_cfg);
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))] = {}; ue_cfg.ue_bearers[srb_to_lcid((lte_srb::srb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid((lte_srb::srb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))] = {}; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].priority = 5; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))].priority = 5;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))] = {}; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].direction = sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].priority = 3; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))].priority = 3;
lch_handler.set_cfg(ue_cfg); lch_handler.set_cfg(ue_cfg);
lch_handler.new_tti(); lch_handler.new_tti();
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::srb1), 50000, 10000); lch_handler.dl_buffer_state(srb_to_lcid(lte_srb::srb1), 50000, 10000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb1), 5000, 10000); lch_handler.dl_buffer_state(drb_to_lcid(lte_drb::drb1), 5000, 10000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb2), 5000, 10000); lch_handler.dl_buffer_state(drb_to_lcid(lte_drb::drb2), 5000, 10000);
// TEST1 - retx of SRB1 is prioritized. Do not transmit other bearers until there are no SRB1 retxs // TEST1 - retx of SRB1 is prioritized. Do not transmit other bearers until there are no SRB1 retxs
int nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::srb1)); int nof_pending_bytes = lch_handler.get_dl_retx(srb_to_lcid(lte_srb::srb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes); TESTASSERT(test_retx_until_empty(lch_handler, srb_to_lcid(lte_srb::srb1), 500) == nof_pending_bytes);
// TEST2 - the DRB2 has lower prio level than SRB1, but has retxs // TEST2 - the DRB2 has lower prio level than SRB1, but has retxs
nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::drb2)); nof_pending_bytes = lch_handler.get_dl_retx(drb_to_lcid(lte_drb::drb2));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb2), 500) == nof_pending_bytes); TESTASSERT(test_retx_until_empty(lch_handler, drb_to_lcid(lte_drb::drb2), 500) == nof_pending_bytes);
// TEST3 - the DRB1 has lower prio level, but has retxs // TEST3 - the DRB1 has lower prio level, but has retxs
nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::drb1)); nof_pending_bytes = lch_handler.get_dl_retx(drb_to_lcid(lte_drb::drb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb1), 500) == nof_pending_bytes); TESTASSERT(test_retx_until_empty(lch_handler, drb_to_lcid(lte_drb::drb1), 500) == nof_pending_bytes);
// TEST4 - The SRB1 newtx buffer is emptied before other bearers newtxs // TEST4 - The SRB1 newtx buffer is emptied before other bearers newtxs
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::srb1)); nof_pending_bytes = lch_handler.get_dl_tx(srb_to_lcid(lte_srb::srb1));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes); TESTASSERT(test_newtx_until_empty(lch_handler, srb_to_lcid(lte_srb::srb1), 500) == nof_pending_bytes);
// TEST5 - The DRB2 newtx buffer is emptied before DRB1 newtxs // TEST5 - The DRB2 newtx buffer is emptied before DRB1 newtxs
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::drb2)); nof_pending_bytes = lch_handler.get_dl_tx(drb_to_lcid(lte_drb::drb2));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb2), 500) == nof_pending_bytes); TESTASSERT(test_newtx_until_empty(lch_handler, drb_to_lcid(lte_drb::drb2), 500) == nof_pending_bytes);
// TEST6 - The DRB1 buffer is emptied // TEST6 - The DRB1 buffer is emptied
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::drb1)); nof_pending_bytes = lch_handler.get_dl_tx(drb_to_lcid(lte_drb::drb1));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb1), 500) == nof_pending_bytes); TESTASSERT(test_newtx_until_empty(lch_handler, drb_to_lcid(lte_drb::drb1), 500) == nof_pending_bytes);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
@ -130,18 +130,18 @@ int test_lc_ch_pbr_finite()
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg(); srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg); ue_cfg = generate_setup_ue_cfg(ue_cfg);
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))] = {}; ue_cfg.ue_bearers[srb_to_lcid((lte_srb::srb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid((lte_srb::srb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))] = {}; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].pbr = 256; // kBps ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))].pbr = 256; // kBps
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].bsd = 50; // msec ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))].bsd = 50; // msec
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].priority = 5; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb1))].priority = 5;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))] = {}; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].direction = sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].pbr = 8; // kBps ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))].pbr = 8; // kBps
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].bsd = 50; // msec ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))].bsd = 50; // msec
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].priority = 3; ue_cfg.ue_bearers[drb_to_lcid((lte_drb::drb2))].priority = 3;
lch_handler.set_cfg(ue_cfg); lch_handler.set_cfg(ue_cfg);
for (uint32_t i = 0; i < 50; ++i) { for (uint32_t i = 0; i < 50; ++i) {
@ -149,41 +149,41 @@ int test_lc_ch_pbr_finite()
} }
// Bj={0, infinity, 0, 12800, 400} // Bj={0, infinity, 0, 12800, 400}
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::srb1), 50000, 1000); lch_handler.dl_buffer_state(srb_to_lcid(lte_srb::srb1), 50000, 1000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb1), 50000, 1000); lch_handler.dl_buffer_state(drb_to_lcid(lte_drb::drb1), 50000, 1000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb2), 50000, 0); lch_handler.dl_buffer_state(drb_to_lcid(lte_drb::drb2), 50000, 0);
// TEST1 - SRB1 retxs are emptied first // TEST1 - SRB1 retxs are emptied first
int nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::srb1)); int nof_pending_bytes = lch_handler.get_dl_retx(srb_to_lcid(lte_srb::srb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes); TESTASSERT(test_retx_until_empty(lch_handler, srb_to_lcid(lte_srb::srb1), 500) == nof_pending_bytes);
// TEST2 - DRB1 retxs are emptied // TEST2 - DRB1 retxs are emptied
nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::drb1)); nof_pending_bytes = lch_handler.get_dl_retx(drb_to_lcid(lte_drb::drb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb1), 500) == nof_pending_bytes); TESTASSERT(test_retx_until_empty(lch_handler, drb_to_lcid(lte_drb::drb1), 500) == nof_pending_bytes);
// TEST3 - SRB1 newtxs are emptied (PBR==infinity) // TEST3 - SRB1 newtxs are emptied (PBR==infinity)
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::srb1)); nof_pending_bytes = lch_handler.get_dl_tx(srb_to_lcid(lte_srb::srb1));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes); TESTASSERT(test_newtx_until_empty(lch_handler, srb_to_lcid(lte_srb::srb1), 500) == nof_pending_bytes);
// TEST4 - DRB2 has higher priority so it gets allocated until Bj <= 0 // TEST4 - DRB2 has higher priority so it gets allocated until Bj <= 0
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb2), 200) == SRSRAN_SUCCESS); TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, drb_to_lcid(lte_drb::drb2), 200) == SRSRAN_SUCCESS);
// Bj={0, infinity, 0, 12800, 200} // Bj={0, infinity, 0, 12800, 200}
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb2), 600) == SRSRAN_SUCCESS); TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, drb_to_lcid(lte_drb::drb2), 600) == SRSRAN_SUCCESS);
// Bj={0, infinity, 0, 256000, -400} // Bj={0, infinity, 0, 256000, -400}
// TEST5 - DRB1 has lower prio, but DRB2 Bj <= 0. // TEST5 - DRB1 has lower prio, but DRB2 Bj <= 0.
for (uint32_t i = 0; i < 50; ++i) { for (uint32_t i = 0; i < 50; ++i) {
lch_handler.new_tti(); lch_handler.new_tti();
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb1), 50) == SRSRAN_SUCCESS); TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, drb_to_lcid(lte_drb::drb1), 50) == SRSRAN_SUCCESS);
} }
// TEST6 - new tti restores DRB2 Bj>=0, and DRB2 gets allocated // TEST6 - new tti restores DRB2 Bj>=0, and DRB2 gets allocated
lch_handler.new_tti(); lch_handler.new_tti();
// Bj={0, infinity, 0, 256000, 8} // Bj={0, infinity, 0, 256000, 8}
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb2), 50) == SRSRAN_SUCCESS); TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, drb_to_lcid(lte_drb::drb2), 50) == SRSRAN_SUCCESS);
// Bj={0, infinity, 0, 256000, -42} // Bj={0, infinity, 0, 256000, -42}
lch_handler.new_tti(); lch_handler.new_tti();
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb1), 50) == SRSRAN_SUCCESS); TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, drb_to_lcid(lte_drb::drb1), 50) == SRSRAN_SUCCESS);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -396,7 +396,7 @@ int sched_sim_base::apply_tti_events(sim_ue_ctxt_t& ue_ctxt, const ue_tti_events
sched_interface::ue_cfg_t ue_cfg = generate_setup_ue_cfg(final_ue_cfg[ue_ctxt.rnti]); sched_interface::ue_cfg_t ue_cfg = generate_setup_ue_cfg(final_ue_cfg[ue_ctxt.rnti]);
TESTASSERT(ue_recfg(ue_ctxt.rnti, ue_cfg) == SRSRAN_SUCCESS); TESTASSERT(ue_recfg(ue_ctxt.rnti, ue_cfg) == SRSRAN_SUCCESS);
uint32_t lcid = rb_to_lcid(lte_rb::srb0); // Use SRB0 to schedule Msg4 uint32_t lcid = srb_to_lcid(lte_srb::srb0); // Use SRB0 to schedule Msg4
TESTASSERT(sched_ptr->dl_rlc_buffer_state(ue_ctxt.rnti, lcid, 50, 0) == SRSRAN_SUCCESS); TESTASSERT(sched_ptr->dl_rlc_buffer_state(ue_ctxt.rnti, lcid, 50, 0) == SRSRAN_SUCCESS);
TESTASSERT(sched_ptr->dl_mac_buffer_state(ue_ctxt.rnti, (uint32_t)srsran::dl_sch_lcid::CON_RES_ID, 1) == TESTASSERT(sched_ptr->dl_mac_buffer_state(ue_ctxt.rnti, (uint32_t)srsran::dl_sch_lcid::CON_RES_ID, 1) ==
SRSRAN_SUCCESS); SRSRAN_SUCCESS);

@ -230,7 +230,7 @@ int common_sched_tester::process_tti_events(const tti_ev& tti_ev)
const auto& ue_sim_ctxt = user->get_ctxt(); const auto& ue_sim_ctxt = user->get_ctxt();
if (ue_ev.buffer_ev->dl_data > 0 and ue_sim_ctxt.conres_rx) { if (ue_ev.buffer_ev->dl_data > 0 and ue_sim_ctxt.conres_rx) {
// If Msg4 has already been tx and there DL data to transmit // If Msg4 has already been tx and there DL data to transmit
uint32_t lcid = rb_to_lcid(lte_rb::drb1); uint32_t lcid = drb_to_lcid(lte_drb::drb1);
uint32_t pending_dl_new_data = ue_db[ue_ev.rnti]->get_pending_dl_rlc_data(); uint32_t pending_dl_new_data = ue_db[ue_ev.rnti]->get_pending_dl_rlc_data();
// DRB is set. Update DL buffer // DRB is set. Update DL buffer
uint32_t tot_dl_data = pending_dl_new_data + ue_ev.buffer_ev->dl_data; // TODO: derive pending based on rx uint32_t tot_dl_data = pending_dl_new_data + ue_ev.buffer_ev->dl_data; // TODO: derive pending based on rx

@ -69,11 +69,11 @@ inline srsenb::sched_interface::ue_cfg_t generate_default_ue_cfg()
ue_cfg.supported_cc_list[0].enb_cc_idx = 0; ue_cfg.supported_cc_list[0].enb_cc_idx = 0;
ue_cfg.supported_cc_list[0].active = true; ue_cfg.supported_cc_list[0].active = true;
ue_cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1; ue_cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb0)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid(lte_srb::srb0)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid(lte_srb::srb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb2)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid(lte_srb::srb2)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[drb_to_lcid(lte_drb::drb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].group = 1; ue_cfg.ue_bearers[drb_to_lcid(lte_drb::drb1)].group = 1;
ue_cfg.pucch_cfg.sr_configured = true; ue_cfg.pucch_cfg.sr_configured = true;
ue_cfg.pucch_cfg.I_sr = 15; // periodicity of 20 msec ue_cfg.pucch_cfg.I_sr = 15; // periodicity of 20 msec
@ -86,10 +86,10 @@ inline srsenb::sched_interface::ue_cfg_t generate_default_ue_cfg2()
{ {
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg(); srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid(lte_srb::srb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb2)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[srb_to_lcid(lte_srb::srb2)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.ue_bearers[drb_to_lcid(lte_drb::drb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].group = 1; ue_cfg.ue_bearers[drb_to_lcid(lte_drb::drb1)].group = 1;
return ue_cfg; return ue_cfg;
} }
@ -97,7 +97,7 @@ inline srsenb::sched_interface::ue_cfg_t generate_default_ue_cfg2()
inline srsenb::sched_interface::ue_cfg_t generate_rach_ue_cfg(const srsenb::sched_interface::ue_cfg_t& final_cfg) inline srsenb::sched_interface::ue_cfg_t generate_rach_ue_cfg(const srsenb::sched_interface::ue_cfg_t& final_cfg)
{ {
srsenb::sched_interface::ue_cfg_t cfg = {}; srsenb::sched_interface::ue_cfg_t cfg = {};
cfg.ue_bearers[rb_to_lcid(lte_rb::srb0)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; cfg.ue_bearers[srb_to_lcid(lte_srb::srb0)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
cfg.supported_cc_list.resize(1); cfg.supported_cc_list.resize(1);
cfg.supported_cc_list[0].enb_cc_idx = final_cfg.supported_cc_list[0].enb_cc_idx; cfg.supported_cc_list[0].enb_cc_idx = final_cfg.supported_cc_list[0].enb_cc_idx;
cfg.supported_cc_list[0].active = true; cfg.supported_cc_list[0].active = true;
@ -109,7 +109,7 @@ inline srsenb::sched_interface::ue_cfg_t generate_setup_ue_cfg(const srsenb::sch
srsenb::sched_interface::ue_cfg_t cfg = generate_rach_ue_cfg(final_cfg); srsenb::sched_interface::ue_cfg_t cfg = generate_rach_ue_cfg(final_cfg);
cfg.maxharq_tx = final_cfg.maxharq_tx; cfg.maxharq_tx = final_cfg.maxharq_tx;
cfg.ue_bearers[rb_to_lcid(lte_rb::srb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; cfg.ue_bearers[srb_to_lcid(lte_srb::srb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1; cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1;
cfg.continuous_pusch = final_cfg.continuous_pusch; cfg.continuous_pusch = final_cfg.continuous_pusch;
@ -123,7 +123,7 @@ inline srsenb::sched_interface::ue_cfg_t generate_setup_ue_cfg(const srsenb::sch
inline srsenb::sched_interface::ue_cfg_t generate_reconf_ue_cfg(const srsenb::sched_interface::ue_cfg_t& final_cfg) inline srsenb::sched_interface::ue_cfg_t generate_reconf_ue_cfg(const srsenb::sched_interface::ue_cfg_t& final_cfg)
{ {
srsenb::sched_interface::ue_cfg_t cfg = generate_setup_ue_cfg(final_cfg); srsenb::sched_interface::ue_cfg_t cfg = generate_setup_ue_cfg(final_cfg);
cfg.ue_bearers[rb_to_lcid(lte_rb::srb2)] = final_cfg.ue_bearers[rb_to_lcid(lte_rb::srb1)]; cfg.ue_bearers[srb_to_lcid(lte_srb::srb2)] = final_cfg.ue_bearers[srb_to_lcid(lte_srb::srb1)];
return cfg; return cfg;
} }
@ -257,11 +257,11 @@ struct sched_sim_event_generator {
ue_sim_cfg.ue_cfg = generate_default_ue_cfg(); ue_sim_cfg.ue_cfg = generate_default_ue_cfg();
user->ue_sim_cfg.reset(new ue_ctxt_test_cfg{ue_sim_cfg}); user->ue_sim_cfg.reset(new ue_ctxt_test_cfg{ue_sim_cfg});
// it should by now have a DRB1. Add other DRBs manually // it should by now have a DRB1. Add other DRBs manually
user->ue_sim_cfg->ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb2)].direction = user->ue_sim_cfg->ue_cfg.ue_bearers[srb_to_lcid(lte_srb::srb2)].direction =
srsenb::sched_interface::ue_bearer_cfg_t::BOTH; srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
user->ue_sim_cfg->ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].direction = user->ue_sim_cfg->ue_cfg.ue_bearers[drb_to_lcid(lte_drb::drb1)].direction =
srsenb::sched_interface::ue_bearer_cfg_t::BOTH; srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
user->ue_sim_cfg->ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].group = 1; user->ue_sim_cfg->ue_cfg.ue_bearers[drb_to_lcid(lte_drb::drb1)].group = 1;
return user; return user;
} }

@ -296,22 +296,22 @@ int test_s1ap_tenb_mobility(mobility_test_params test_params)
auto& mac_ue = tester.mac.ue_db[0x46]; auto& mac_ue = tester.mac.ue_db[0x46];
TESTASSERT(mac_ue.supported_cc_list[0].active); TESTASSERT(mac_ue.supported_cc_list[0].active);
TESTASSERT(mac_ue.supported_cc_list[0].enb_cc_idx == 0); TESTASSERT(mac_ue.supported_cc_list[0].enb_cc_idx == 0);
TESTASSERT(mac_ue.ue_bearers[rb_to_lcid(lte_rb::srb0)].direction == sched_interface::ue_bearer_cfg_t::BOTH); TESTASSERT(mac_ue.ue_bearers[srb_to_lcid(lte_srb::srb0)].direction == sched_interface::ue_bearer_cfg_t::BOTH);
// Check Security Configuration // Check Security Configuration
TESTASSERT(tester.pdcp.bearers.count(0x46)); TESTASSERT(tester.pdcp.bearers.count(0x46));
TESTASSERT(tester.pdcp.bearers[0x46].count(rb_to_lcid(lte_rb::srb1)) and TESTASSERT(tester.pdcp.bearers[0x46].count(srb_to_lcid(lte_srb::srb1)) and
tester.pdcp.bearers[0x46].count(rb_to_lcid(lte_rb::srb2))); tester.pdcp.bearers[0x46].count(srb_to_lcid(lte_srb::srb2)));
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].enable_encryption); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].enable_encryption);
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].enable_integrity); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].enable_integrity);
sec_cfg.set_security_capabilities(ho_req.protocol_ies.ue_security_cap.value); sec_cfg.set_security_capabilities(ho_req.protocol_ies.ue_security_cap.value);
sec_cfg.set_security_key(ho_req.protocol_ies.security_context.value.next_hop_param); sec_cfg.set_security_key(ho_req.protocol_ies.security_context.value.next_hop_param);
sec_cfg.regenerate_keys_handover(tester.cfg.cell_list[0].pci, tester.cfg.cell_list[0].dl_earfcn); sec_cfg.regenerate_keys_handover(tester.cfg.cell_list[0].pci, tester.cfg.cell_list[0].dl_earfcn);
srsran::as_security_config_t as_sec_cfg = sec_cfg.get_as_sec_cfg(); srsran::as_security_config_t as_sec_cfg = sec_cfg.get_as_sec_cfg();
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].sec_cfg.k_rrc_int == as_sec_cfg.k_rrc_int); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].sec_cfg.k_rrc_int == as_sec_cfg.k_rrc_int);
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].sec_cfg.k_rrc_enc == as_sec_cfg.k_rrc_enc); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].sec_cfg.k_rrc_enc == as_sec_cfg.k_rrc_enc);
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].sec_cfg.k_up_int == as_sec_cfg.k_up_int); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].sec_cfg.k_up_int == as_sec_cfg.k_up_int);
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].sec_cfg.cipher_algo == as_sec_cfg.cipher_algo); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].sec_cfg.cipher_algo == as_sec_cfg.cipher_algo);
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].sec_cfg.integ_algo == as_sec_cfg.integ_algo); TESTASSERT(tester.pdcp.bearers[0x46][srb_to_lcid(lte_srb::srb1)].sec_cfg.integ_algo == as_sec_cfg.integ_algo);
// Check if S1AP Handover Request ACK send is called // Check if S1AP Handover Request ACK send is called
TESTASSERT(tester.s1ap.last_ho_req_ack.rnti == 0x46); TESTASSERT(tester.s1ap.last_ho_req_ack.rnti == 0x46);
@ -355,11 +355,11 @@ int test_s1ap_tenb_mobility(mobility_test_params test_params)
uint8_t recfg_complete[] = {0x10, 0x00}; uint8_t recfg_complete[] = {0x10, 0x00};
test_helpers::copy_msg_to_buffer(pdu, recfg_complete); test_helpers::copy_msg_to_buffer(pdu, recfg_complete);
tester.rrc.write_pdu(0x46, rb_to_lcid(lte_rb::srb1), std::move(pdu)); tester.rrc.write_pdu(0x46, srb_to_lcid(lte_srb::srb1), std::move(pdu));
tester.tic(); tester.tic();
TESTASSERT(mac_ue.ue_bearers[rb_to_lcid(lte_rb::srb1)].direction == sched_interface::ue_bearer_cfg_t::BOTH); TESTASSERT(mac_ue.ue_bearers[srb_to_lcid(lte_srb::srb1)].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.ue_bearers[rb_to_lcid(lte_rb::srb2)].direction == sched_interface::ue_bearer_cfg_t::BOTH); TESTASSERT(mac_ue.ue_bearers[srb_to_lcid(lte_srb::srb2)].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.ue_bearers[rb_to_lcid(lte_rb::drb1)].direction == sched_interface::ue_bearer_cfg_t::BOTH); TESTASSERT(mac_ue.ue_bearers[drb_to_lcid(lte_drb::drb1)].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.pucch_cfg.I_sr == recfg_r8.rr_cfg_ded.phys_cfg_ded.sched_request_cfg.setup().sr_cfg_idx); TESTASSERT(mac_ue.pucch_cfg.I_sr == recfg_r8.rr_cfg_ded.phys_cfg_ded.sched_request_cfg.setup().sr_cfg_idx);
TESTASSERT(mac_ue.pucch_cfg.n_pucch_sr == TESTASSERT(mac_ue.pucch_cfg.n_pucch_sr ==
recfg_r8.rr_cfg_ded.phys_cfg_ded.sched_request_cfg.setup().sr_pucch_res_idx); recfg_r8.rr_cfg_ded.phys_cfg_ded.sched_request_cfg.setup().sr_pucch_res_idx);
@ -468,7 +468,7 @@ int test_intraenb_mobility(srsran::log_sink_spy& spy, mobility_test_params test_
/* Test Case: Terminate first Handover. No extra messages should be sent DL. SR/CQI resources match recfg message */ /* Test Case: Terminate first Handover. No extra messages should be sent DL. SR/CQI resources match recfg message */
uint8_t recfg_complete[] = {0x10, 0x00}; uint8_t recfg_complete[] = {0x10, 0x00};
test_helpers::copy_msg_to_buffer(pdu, recfg_complete); test_helpers::copy_msg_to_buffer(pdu, recfg_complete);
tester.rrc.write_pdu(tester.rnti, rb_to_lcid(lte_rb::srb2), std::move(pdu)); tester.rrc.write_pdu(tester.rnti, srb_to_lcid(lte_srb::srb2), std::move(pdu));
TESTASSERT(tester.pdcp.last_sdu.sdu == nullptr); TESTASSERT(tester.pdcp.last_sdu.sdu == nullptr);
sched_interface::ue_cfg_t& ue_cfg = tester.mac.ue_db[tester.rnti]; sched_interface::ue_cfg_t& ue_cfg = tester.mac.ue_db[tester.rnti];
TESTASSERT(ue_cfg.pucch_cfg.sr_configured); TESTASSERT(ue_cfg.pucch_cfg.sr_configured);

@ -217,14 +217,7 @@ private:
static const std::string rb_id_str[]; static const std::string rb_id_str[];
const char* get_rb_name(uint32_t lcid) const char* get_rb_name(uint32_t lcid) { return srsran::is_lte_rb(lcid) ? rb_id_str[lcid].c_str() : "invalid RB"; }
{
if (lcid < (uint32_t)srsran::lte_rb::count) {
return rb_id_str[lcid].c_str();
} else {
return "INVALID_RB";
}
}
// Measurements private subclass // Measurements private subclass
class rrc_meas; class rrc_meas;

@ -36,6 +36,8 @@ bool simulate_rlf = false;
using namespace srsran; using namespace srsran;
using namespace asn1::rrc; using namespace asn1::rrc;
using srsran::lte_srb;
using srsran::srb_to_lcid;
namespace srsue { namespace srsue {
@ -940,7 +942,7 @@ void rrc::send_con_restablish_complete()
ul_dcch_msg.msg.set_c1().set_rrc_conn_reest_complete().crit_exts.set_rrc_conn_reest_complete_r8(); ul_dcch_msg.msg.set_c1().set_rrc_conn_reest_complete().crit_exts.set_rrc_conn_reest_complete_r8();
ul_dcch_msg.msg.c1().rrc_conn_reest_complete().rrc_transaction_id = transaction_id; ul_dcch_msg.msg.c1().rrc_conn_reest_complete().rrc_transaction_id = transaction_id;
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), ul_dcch_msg);
reestablishment_successful = true; reestablishment_successful = true;
} }
@ -960,13 +962,12 @@ void rrc::send_con_setup_complete(srsran::unique_byte_buffer_t nas_msg)
rrc_conn_setup_complete->ded_info_nas.resize(nas_msg->N_bytes); rrc_conn_setup_complete->ded_info_nas.resize(nas_msg->N_bytes);
memcpy(rrc_conn_setup_complete->ded_info_nas.data(), nas_msg->msg, nas_msg->N_bytes); // TODO Check! memcpy(rrc_conn_setup_complete->ded_info_nas.data(), nas_msg->msg, nas_msg->N_bytes); // TODO Check!
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), ul_dcch_msg);
} }
void rrc::send_ul_info_transfer(unique_byte_buffer_t nas_msg) void rrc::send_ul_info_transfer(unique_byte_buffer_t nas_msg)
{ {
uint32_t lcid = uint32_t lcid = (uint32_t)(rlc->has_bearer(srb_to_lcid(lte_srb::srb2)) ? lte_srb::srb2 : lte_srb::srb1);
(uint32_t)(rlc->has_bearer((uint32_t)srsran::lte_rb::srb2) ? srsran::lte_rb::srb2 : srsran::lte_rb::srb1);
// Prepare UL INFO packet // Prepare UL INFO packet
asn1::rrc::ul_dcch_msg_s ul_dcch_msg; asn1::rrc::ul_dcch_msg_s ul_dcch_msg;
@ -989,7 +990,7 @@ void rrc::send_security_mode_complete()
ul_dcch_msg.msg.set_c1().set_security_mode_complete().crit_exts.set_security_mode_complete_r8(); ul_dcch_msg.msg.set_c1().set_security_mode_complete().crit_exts.set_security_mode_complete_r8();
ul_dcch_msg.msg.c1().security_mode_complete().rrc_transaction_id = transaction_id; ul_dcch_msg.msg.c1().security_mode_complete().rrc_transaction_id = transaction_id;
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), ul_dcch_msg);
} }
void rrc::send_rrc_con_reconfig_complete(bool contains_nr_complete) void rrc::send_rrc_con_reconfig_complete(bool contains_nr_complete)
@ -1017,7 +1018,7 @@ void rrc::send_rrc_con_reconfig_complete(bool contains_nr_complete)
rrc_conn_recfg_complete_v1430_ies->non_crit_ext.scg_cfg_resp_nr_r15_present = true; rrc_conn_recfg_complete_v1430_ies->non_crit_ext.scg_cfg_resp_nr_r15_present = true;
rrc_conn_recfg_complete_v1430_ies->non_crit_ext.scg_cfg_resp_nr_r15.from_string("00"); rrc_conn_recfg_complete_v1430_ies->non_crit_ext.scg_cfg_resp_nr_r15.from_string("00");
} }
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), ul_dcch_msg);
} }
void rrc::ra_completed() void rrc::ra_completed()
@ -1169,12 +1170,12 @@ void rrc::start_con_restablishment(reest_cause_e cause)
bool rrc::srbs_flushed() bool rrc::srbs_flushed()
{ {
// Check SRB1 // Check SRB1
if (rlc->has_data((uint32_t)srsran::lte_rb::srb1) && not rlc->is_suspended((uint32_t)srsran::lte_rb::srb1)) { if (rlc->has_data(srb_to_lcid(lte_srb::srb1)) && not rlc->is_suspended(srb_to_lcid(lte_srb::srb1))) {
return false; return false;
} }
// Check SRB2 // Check SRB2
if (rlc->has_data((uint32_t)srsran::lte_rb::srb2) && not rlc->is_suspended((uint32_t)srsran::lte_rb::srb2)) { if (rlc->has_data(srb_to_lcid(lte_srb::srb2)) && not rlc->is_suspended(srb_to_lcid(lte_srb::srb2))) {
return false; return false;
} }
@ -1188,7 +1189,7 @@ bool rrc::srbs_flushed()
*******************************************************************************/ *******************************************************************************/
void rrc::send_srb1_msg(const ul_dcch_msg_s& msg) void rrc::send_srb1_msg(const ul_dcch_msg_s& msg)
{ {
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), msg);
} }
std::set<uint32_t> rrc::get_cells(const uint32_t earfcn) std::set<uint32_t> rrc::get_cells(const uint32_t earfcn)
@ -1562,7 +1563,7 @@ void rrc::send_ul_ccch_msg(const ul_ccch_msg_s& msg)
logger.debug("Setting UE contention resolution ID: %" PRIu64 "", uecri); logger.debug("Setting UE contention resolution ID: %" PRIu64 "", uecri);
mac->set_contention_id(uecri); mac->set_contention_id(uecri);
uint32_t lcid = (uint32_t)srsran::lte_rb::srb0; uint32_t lcid = srb_to_lcid(lte_srb::srb0);
log_rrc_message(get_rb_name(lcid), Tx, pdcp_buf.get(), msg, msg.msg.c1().type().to_string()); log_rrc_message(get_rb_name(lcid), Tx, pdcp_buf.get(), msg, msg.msg.c1().type().to_string());
rlc->write_sdu(lcid, std::move(pdcp_buf)); rlc->write_sdu(lcid, std::move(pdcp_buf));
@ -1613,12 +1614,12 @@ void rrc::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
void rrc::process_pdu(uint32_t lcid, srsran::unique_byte_buffer_t pdu) void rrc::process_pdu(uint32_t lcid, srsran::unique_byte_buffer_t pdu)
{ {
logger.debug("RX PDU, LCID: %d", lcid); logger.debug("RX PDU, LCID: %d", lcid);
switch (static_cast<srsran::lte_rb>(lcid)) { switch (static_cast<lte_srb>(lcid)) {
case srsran::lte_rb::srb0: case lte_srb::srb0:
parse_dl_ccch(std::move(pdu)); parse_dl_ccch(std::move(pdu));
break; break;
case srsran::lte_rb::srb1: case lte_srb::srb1:
case srsran::lte_rb::srb2: case lte_srb::srb2:
parse_dl_dcch(lcid, std::move(pdu)); parse_dl_dcch(lcid, std::move(pdu));
break; break;
default: default:
@ -1637,7 +1638,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
return; return;
} }
log_rrc_message( log_rrc_message(
srsran::get_rb_name(srsran::lte_rb::srb0), Rx, pdu.get(), dl_ccch_msg, dl_ccch_msg.msg.c1().type().to_string()); get_rb_name(srb_to_lcid(lte_srb::srb0)), Rx, pdu.get(), dl_ccch_msg, dl_ccch_msg.msg.c1().type().to_string());
dl_ccch_msg_type_c::c1_c_* c1 = &dl_ccch_msg.msg.c1(); dl_ccch_msg_type_c::c1_c_* c1 = &dl_ccch_msg.msg.c1();
switch (dl_ccch_msg.msg.c1().type().value) { switch (dl_ccch_msg.msg.c1().type().value) {
@ -2114,7 +2115,7 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
} }
} }
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), ul_dcch_msg);
} }
/******************************************************************************* /*******************************************************************************
@ -2551,7 +2552,7 @@ void rrc::add_srb(const srb_to_add_mod_s& srb_cnfg)
{ {
// Setup PDCP // Setup PDCP
pdcp->add_bearer(srb_cnfg.srb_id, make_srb_pdcp_config_t(srb_cnfg.srb_id, true)); pdcp->add_bearer(srb_cnfg.srb_id, make_srb_pdcp_config_t(srb_cnfg.srb_id, true));
if (static_cast<uint32_t>(srsran::lte_rb::srb2) == srb_cnfg.srb_id) { if (lte_srb::srb2 == static_cast<lte_srb>(srb_cnfg.srb_id)) {
pdcp->config_security(srb_cnfg.srb_id, sec_cfg); pdcp->config_security(srb_cnfg.srb_id, sec_cfg);
pdcp->enable_integrity(srb_cnfg.srb_id, DIRECTION_TXRX); pdcp->enable_integrity(srb_cnfg.srb_id, DIRECTION_TXRX);
pdcp->enable_encryption(srb_cnfg.srb_id, DIRECTION_TXRX); pdcp->enable_encryption(srb_cnfg.srb_id, DIRECTION_TXRX);
@ -2572,16 +2573,16 @@ void rrc::add_srb(const srb_to_add_mod_s& srb_cnfg)
if (srb_cnfg.lc_ch_cfg_present) { if (srb_cnfg.lc_ch_cfg_present) {
if (srb_cnfg.lc_ch_cfg.type() == srb_to_add_mod_s::lc_ch_cfg_c_::types::default_value) { if (srb_cnfg.lc_ch_cfg.type() == srb_to_add_mod_s::lc_ch_cfg_c_::types::default_value) {
// Set default SRB values as defined in Table 9.2.1 // Set default SRB values as defined in Table 9.2.1
switch (static_cast<srsran::lte_rb>(srb_cnfg.srb_id)) { switch (static_cast<lte_srb>(srb_cnfg.srb_id)) {
case srsran::lte_rb::srb0: case lte_srb::srb0:
logger.error("Setting SRB0: Should not be set by RRC"); logger.error("Setting SRB0: Should not be set by RRC");
break; break;
case srsran::lte_rb::srb1: case lte_srb::srb1:
priority = 1; priority = 1;
prioritized_bit_rate = -1; prioritized_bit_rate = -1;
bucket_size_duration = 0; bucket_size_duration = 0;
break; break;
case srsran::lte_rb::srb2: case lte_srb::srb2:
priority = 3; priority = 3;
prioritized_bit_rate = -1; prioritized_bit_rate = -1;
bucket_size_duration = 0; bucket_size_duration = 0;
@ -2784,7 +2785,7 @@ void rrc::nr_scg_failure_information(const scg_failure_cause_t cause)
scg_fail_info_nr.crit_exts.c1().scg_fail_info_nr_r15().fail_report_scg_nr_r15_present = true; scg_fail_info_nr.crit_exts.c1().scg_fail_info_nr_r15().fail_report_scg_nr_r15_present = true;
scg_fail_info_nr.crit_exts.c1().scg_fail_info_nr_r15().fail_report_scg_nr_r15.fail_type_r15 = scg_fail_info_nr.crit_exts.c1().scg_fail_info_nr_r15().fail_report_scg_nr_r15.fail_type_r15 =
(fail_report_scg_nr_r15_s::fail_type_r15_opts::options)cause; (fail_report_scg_nr_r15_s::fail_type_r15_opts::options)cause;
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg); send_ul_dcch_msg(srb_to_lcid(lte_srb::srb1), ul_dcch_msg);
} }
} // namespace srsue } // namespace srsue

@ -1037,7 +1037,7 @@ srsran::proc_outcome_t rrc::connection_reconf_no_ho_proc::react(const bool& conf
if (nas_pdu != nullptr) { if (nas_pdu != nullptr) {
memcpy(nas_pdu->msg, pdu.data(), pdu.size()); memcpy(nas_pdu->msg, pdu.data(), pdu.size());
nas_pdu->N_bytes = pdu.size(); nas_pdu->N_bytes = pdu.size();
rrc_ptr->nas->write_pdu((uint32_t)srsran::lte_rb::srb1, std::move(nas_pdu)); rrc_ptr->nas->write_pdu(srsran::srb_to_lcid(srsran::lte_srb::srb1), std::move(nas_pdu));
} else { } else {
rrc_ptr->logger.error("Couldn't allocate PDU in %s.", __FUNCTION__); rrc_ptr->logger.error("Couldn't allocate PDU in %s.", __FUNCTION__);
return proc_outcome_t::error; return proc_outcome_t::error;

Loading…
Cancel
Save