avoid allocating std::string to get lcid radio bearer name. Refactored the lte radio bearer enum type

master
Francisco 4 years ago committed by Francisco Paisana
parent 5e02dbc536
commit 21718af3b6

@ -0,0 +1,69 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2012-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#ifndef SRSRAN_LTE_COMMON_H
#define SRSRAN_LTE_COMMON_H
#include <array>
#include <cstdint>
namespace srsran {
// Cell nof PRBs
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)
{
switch (nof_prb) {
case 6:
return 0;
case 15:
return 1;
case 25:
return 2;
case 50:
return 3;
case 75:
return 4;
case 100:
return 5;
default:
return -1;
}
}
// Radio Bearer
enum class lte_rb { srb0, srb1, srb2, drb1, drb2, drb3, drb4, drb5, drb6, drb7, drb8, drb9, drb10, drb11, count };
const size_t MAX_LTE_DRB_ID = 11;
const size_t MAX_LTE_SRB_ID = 2;
inline const char* get_rb_name(lte_rb rb_id)
{
static const char* names[] = {"SRB0",
"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
#endif // SRSRAN_LTE_COMMON_H

@ -71,7 +71,7 @@ public:
virtual void set_ue_identity(srsran::s_tmsi_t s_tmsi) = 0;
virtual bool is_connected() = 0;
virtual void paging_completed(bool outcome) = 0;
virtual std::string get_rb_name(uint32_t lcid) = 0;
virtual const char* get_rb_name(uint32_t lcid) = 0;
virtual uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id) = 0;
virtual bool has_nr_dc() = 0;
};
@ -84,14 +84,14 @@ public:
virtual void write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu) = 0;
virtual void write_pdu_pcch(srsran::unique_byte_buffer_t pdu) = 0;
virtual void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) = 0;
virtual std::string get_rb_name(uint32_t lcid) = 0;
virtual const char* get_rb_name(uint32_t lcid) = 0;
};
class rrc_interface_rlc
{
public:
virtual void max_retx_attempted() = 0;
virtual std::string get_rb_name(uint32_t lcid) = 0;
virtual const char* get_rb_name(uint32_t lcid) = 0;
virtual void write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t pdu) = 0;
};

@ -105,17 +105,14 @@ void pdcp::add_bearer(uint32_t lcid, pdcp_config_t cfg)
logger.error("Error inserting PDCP entity in to array.");
return;
}
logger.info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)",
rrc->get_rb_name(lcid).c_str(),
lcid,
cfg.bearer_id,
cfg.sn_len);
logger.info(
"Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)", rrc->get_rb_name(lcid), lcid, cfg.bearer_id, cfg.sn_len);
{
std::lock_guard<std::mutex> lock(cache_mutex);
valid_lcids_cached.insert(lcid);
}
} else {
logger.info("Bearer %s already configured.", rrc->get_rb_name(lcid).c_str());
logger.info("Bearer %s already configured.", rrc->get_rb_name(lcid));
}
}
@ -124,26 +121,19 @@ void pdcp::add_bearer_mrb(uint32_t lcid, pdcp_config_t cfg)
if (not valid_mch_lcid(lcid)) {
std::unique_ptr<pdcp_entity_lte> entity;
entity.reset(new pdcp_entity_lte{rlc, rrc, gw, task_sched, logger, lcid});
if(not entity->configure(cfg)){
if (not entity->configure(cfg)) {
logger.error("Can not configure PDCP entity");
return;
}
if (not pdcp_array_mrb
.insert(std::make_pair(
lcid,
std::move(entity)))
.second) {
if (not pdcp_array_mrb.insert(std::make_pair(lcid, std::move(entity))).second) {
logger.error("Error inserting PDCP entity in to array.");
return;
}
logger.info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)",
rrc->get_rb_name(lcid).c_str(),
lcid,
cfg.bearer_id,
cfg.sn_len);
logger.info(
"Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)", rrc->get_rb_name(lcid), lcid, cfg.bearer_id, cfg.sn_len);
} else {
logger.warning("Bearer %s already configured. Reconfiguration not supported", rrc->get_rb_name(lcid).c_str());
logger.warning("Bearer %s already configured. Reconfiguration not supported", rrc->get_rb_name(lcid));
}
}
@ -155,9 +145,9 @@ void pdcp::del_bearer(uint32_t lcid)
}
if (valid_lcid(lcid)) {
pdcp_array.erase(lcid);
logger.warning("Deleted PDCP bearer %s", rrc->get_rb_name(lcid).c_str());
logger.warning("Deleted PDCP bearer %s", rrc->get_rb_name(lcid));
} else {
logger.warning("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid).c_str());
logger.warning("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid));
}
}
@ -180,7 +170,7 @@ void pdcp::change_lcid(uint32_t old_lcid, uint32_t new_lcid)
logger.warning("Changed LCID of PDCP bearer from %d to %d", old_lcid, new_lcid);
} else {
logger.error("Can't change PDCP of bearer %s from %d to %d. Bearer doesn't exist or new LCID already occupied.",
rrc->get_rb_name(old_lcid).c_str(),
rrc->get_rb_name(old_lcid),
old_lcid,
new_lcid);
}

@ -70,7 +70,7 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_)
// Queue Helpers
maximum_allocated_sns_window = (1u << cfg.sn_len) / 2u;
logger.info("Init %s with bearer ID: %d", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id);
logger.info("Init %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id);
logger.info("SN len bits: %d, SN len bytes: %d, reordering window: %d, Maximum SN: %d, discard timer: %d ms",
cfg.sn_len,
cfg.hdr_len_bytes,
@ -95,7 +95,7 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_)
// Reestablishment procedure: 36.323 5.2
void pdcp_entity_lte::reestablish()
{
logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id);
logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id);
// For SRBs
if (is_srb()) {
st.next_pdcp_tx_sn = 0;
@ -117,7 +117,7 @@ void pdcp_entity_lte::reestablish()
void pdcp_entity_lte::reset()
{
if (active) {
logger.debug("Reset %s", rrc->get_rb_name(lcid).c_str());
logger.debug("Reset %s", rrc->get_rb_name(lcid));
}
active = false;
}
@ -126,7 +126,7 @@ void pdcp_entity_lte::reset()
void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
{
if (rlc->sdu_queue_is_full(lcid)) {
logger.info(sdu->msg, sdu->N_bytes, "Dropping %s SDU due to full queue", rrc->get_rb_name(lcid).c_str());
logger.info(sdu->msg, sdu->N_bytes, "Dropping %s SDU due to full queue", rrc->get_rb_name(lcid));
return;
}
@ -181,7 +181,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
logger.info(sdu->msg,
sdu->N_bytes,
"TX %s PDU, SN=%d, integrity=%s, encryption=%s",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
used_sn,
srsran_direction_text[integrity_direction],
srsran_direction_text[encryption_direction]);
@ -233,7 +233,7 @@ void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
logger.info(pdu->msg,
pdu->N_bytes,
"%s Rx PDU SN=%d (%d B, integrity=%s, encryption=%s)",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
sn,
pdu->N_bytes,
srsran_direction_text[integrity_direction],
@ -293,7 +293,7 @@ void pdcp_entity_lte::handle_srb_pdu(srsran::unique_byte_buffer_t pdu)
cipher_decrypt(&pdu->msg[cfg.hdr_len_bytes], pdu->N_bytes - cfg.hdr_len_bytes, count, &pdu->msg[cfg.hdr_len_bytes]);
}
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rrc->get_rb_name(lcid).c_str(), sn);
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rrc->get_rb_name(lcid), sn);
// Extract MAC
uint8_t mac[4];
@ -302,7 +302,7 @@ void pdcp_entity_lte::handle_srb_pdu(srsran::unique_byte_buffer_t pdu)
// Perfrom integrity checks
if (integrity_direction == DIRECTION_RX || integrity_direction == DIRECTION_TXRX) {
if (not integrity_verify(pdu->msg, pdu->N_bytes, count, mac)) {
logger.error(pdu->msg, pdu->N_bytes, "%s Dropping PDU", rrc->get_rb_name(lcid).c_str());
logger.error(pdu->msg, pdu->N_bytes, "%s Dropping PDU", rrc->get_rb_name(lcid));
return; // Discard
}
}
@ -340,7 +340,7 @@ void pdcp_entity_lte::handle_um_drb_pdu(srsran::unique_byte_buffer_t pdu)
cipher_decrypt(pdu->msg, pdu->N_bytes, count, pdu->msg);
}
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx PDU SN=%d", rrc->get_rb_name(lcid).c_str(), sn);
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx PDU SN=%d", rrc->get_rb_name(lcid), sn);
st.next_pdcp_rx_sn = sn + 1;
if (st.next_pdcp_rx_sn > maximum_pdcp_sn) {
@ -404,7 +404,7 @@ void pdcp_entity_lte::handle_am_drb_pdu(srsran::unique_byte_buffer_t pdu)
// Decrypt
cipher_decrypt(pdu->msg, pdu->N_bytes, count, pdu->msg);
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rrc->get_rb_name(lcid).c_str(), sn);
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rrc->get_rb_name(lcid), sn);
// Update info on last PDU submitted to upper layers
st.last_submitted_pdcp_rx_sn = sn;

@ -37,7 +37,7 @@ pdcp_entity_nr::~pdcp_entity_nr() {}
// Reestablishment procedure: 38.323 5.2
void pdcp_entity_nr::reestablish()
{
logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id);
logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id);
// TODO
}
@ -53,7 +53,7 @@ bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_)
if (static_cast<uint32_t>(cfg.t_reordering) > 0) {
reordering_timer.set(static_cast<uint32_t>(cfg.t_reordering), *reordering_fnc);
}
active = true;
active = true;
return true;
}
@ -61,7 +61,7 @@ bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_)
void pdcp_entity_nr::reset()
{
active = false;
logger.debug("Reset %s", rrc->get_rb_name(lcid).c_str());
logger.debug("Reset %s", rrc->get_rb_name(lcid));
}
// SDAP/RRC interface
@ -71,7 +71,7 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, int sn)
logger.info(sdu->msg,
sdu->N_bytes,
"TX %s SDU, integrity=%s, encryption=%s",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
srsran_direction_text[integrity_direction],
srsran_direction_text[encryption_direction]);
@ -127,7 +127,7 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu)
logger.info(pdu->msg,
pdu->N_bytes,
"RX %s PDU (%d B), integrity=%s, encryption=%s",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
pdu->N_bytes,
srsran_direction_text[integrity_direction],
srsran_direction_text[encryption_direction]);

@ -148,7 +148,7 @@ void rlc::reestablish()
void rlc::reestablish(uint32_t lcid)
{
if (valid_lcid(lcid)) {
logger.info("Reestablishing %s", rrc->get_rb_name(lcid).c_str());
logger.info("Reestablishing %s", rrc->get_rb_name(lcid));
rlc_array.at(lcid)->reestablish();
} else {
logger.warning("RLC LCID %d doesn't exist.", lcid);
@ -442,7 +442,7 @@ void rlc::add_bearer(uint32_t lcid, const rlc_config_t& cnfg)
logger.error("Error inserting RLC entity in to array.");
goto delete_and_exit;
}
logger.info("Added radio bearer %s in %s", rrc->get_rb_name(lcid).c_str(), to_string(cnfg.rlc_mode).c_str());
logger.info("Added radio bearer %s in %s", rrc->get_rb_name(lcid), to_string(cnfg.rlc_mode).c_str());
rlc_entity = NULL;
}
@ -454,7 +454,7 @@ void rlc::add_bearer(uint32_t lcid, const rlc_config_t& cnfg)
}
}
logger.info("Configured radio bearer %s in %s", rrc->get_rb_name(lcid).c_str(), to_string(cnfg.rlc_mode).c_str());
logger.info("Configured radio bearer %s in %s", rrc->get_rb_name(lcid), to_string(cnfg.rlc_mode).c_str());
delete_and_exit:
if (rlc_entity) {
@ -501,9 +501,9 @@ void rlc::del_bearer(uint32_t lcid)
it->second->stop();
delete (it->second);
rlc_array.erase(it);
logger.warning("Deleted RLC bearer %s", rrc->get_rb_name(lcid).c_str());
logger.warning("Deleted RLC bearer %s", rrc->get_rb_name(lcid));
} else {
logger.error("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid).c_str());
logger.error("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid));
}
}
@ -516,9 +516,9 @@ void rlc::del_bearer_mrb(uint32_t lcid)
it->second->stop();
delete (it->second);
rlc_array_mrb.erase(it);
logger.warning("Deleted RLC MRB bearer %s", rrc->get_rb_name(lcid).c_str());
logger.warning("Deleted RLC MRB bearer %s", rrc->get_rb_name(lcid));
} else {
logger.error("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid).c_str());
logger.error("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid));
}
}
@ -545,7 +545,7 @@ void rlc::change_lcid(uint32_t old_lcid, uint32_t new_lcid)
}
} else {
logger.error("Can't change LCID of bearer %s from %d to %d. Bearer doesn't exist or new LCID already occupied.",
rrc->get_rb_name(old_lcid).c_str(),
rrc->get_rb_name(old_lcid),
old_lcid,
new_lcid);
}
@ -556,26 +556,26 @@ void rlc::suspend_bearer(uint32_t lcid)
{
if (valid_lcid(lcid)) {
if (rlc_array.at(lcid)->suspend()) {
logger.info("Suspended radio bearer %s", rrc->get_rb_name(lcid).c_str());
logger.info("Suspended radio bearer %s", rrc->get_rb_name(lcid));
} else {
logger.error("Error suspending RLC entity: bearer already suspended.");
}
} else {
logger.error("Suspending bearer: bearer %s not configured.", rrc->get_rb_name(lcid).c_str());
logger.error("Suspending bearer: bearer %s not configured.", rrc->get_rb_name(lcid));
}
}
void rlc::resume_bearer(uint32_t lcid)
{
logger.info("Resuming radio bearer %s", rrc->get_rb_name(lcid).c_str());
logger.info("Resuming radio bearer %s", rrc->get_rb_name(lcid));
if (valid_lcid(lcid)) {
if (rlc_array.at(lcid)->resume()) {
logger.info("Resumed radio bearer %s", rrc->get_rb_name(lcid).c_str());
logger.info("Resumed radio bearer %s", rrc->get_rb_name(lcid));
} else {
logger.error("Error resuming RLC entity: bearer not suspended.");
}
} else {
logger.error("Resuming bearer: bearer %s not configured.", rrc->get_rb_name(lcid).c_str());
logger.error("Resuming bearer: bearer %s not configured.", rrc->get_rb_name(lcid));
}
}

@ -82,14 +82,14 @@ void rlc_tm::write_sdu(unique_byte_buffer_t sdu)
logger.info(msg_ptr,
nof_bytes,
"%s Tx SDU, queue size=%d, bytes=%d",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
ul_queue.size(),
ul_queue.size_bytes());
} else {
logger.warning(ret.error()->msg,
ret.error()->N_bytes,
"[Dropped SDU] %s Tx SDU, queue size=%d, bytes=%d",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
ul_queue.size(),
ul_queue.size_bytes());
}
@ -137,8 +137,7 @@ int rlc_tm::read_pdu(uint8_t* payload, uint32_t nof_bytes)
{
uint32_t pdu_size = ul_queue.size_tail_bytes();
if (pdu_size > nof_bytes) {
logger.info(
"%s Tx PDU size larger than MAC opportunity (%d > %d)", rrc->get_rb_name(lcid).c_str(), pdu_size, nof_bytes);
logger.info("%s Tx PDU size larger than MAC opportunity (%d > %d)", rrc->get_rb_name(lcid), pdu_size, nof_bytes);
return -1;
}
unique_byte_buffer_t buf;
@ -146,12 +145,12 @@ int rlc_tm::read_pdu(uint8_t* payload, uint32_t nof_bytes)
pdu_size = buf->N_bytes;
memcpy(payload, buf->msg, buf->N_bytes);
logger.debug("%s Complete SDU scheduled for tx. Stack latency: %" PRIu64 " us",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
(uint64_t)buf->get_latency_us().count());
logger.info(payload,
pdu_size,
"%s Tx %s PDU, queue size=%d, bytes=%d",
rrc->get_rb_name(lcid).c_str(),
rrc->get_rb_name(lcid),
srsran::to_string(rlc_mode_t::tm).c_str(),
ul_queue.size(),
ul_queue.size_bytes());
@ -177,7 +176,7 @@ void rlc_tm::write_pdu(uint8_t* payload, uint32_t nof_bytes)
buf->set_timestamp();
metrics.num_rx_pdu_bytes += nof_bytes;
metrics.num_rx_pdus++;
if (rrc->get_rb_name(lcid) == "SRB0") {
if (strcmp(rrc->get_rb_name(lcid), "SRB0") == 0) {
rrc->write_pdu(lcid, std::move(buf));
} else {
pdcp->write_pdu(lcid, std::move(buf));

@ -76,7 +76,7 @@ public:
void write_pdu_pcch(srsran::unique_byte_buffer_t pdu) {}
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) {}
std::string get_rb_name(uint32_t lcid) { return "None"; }
const char* get_rb_name(uint32_t lcid) { return "None"; }
srslog::basic_logger& logger;

@ -71,7 +71,7 @@ public:
// RRC interface
void max_retx_attempted() { max_retx_triggered = true; }
std::string get_rb_name(uint32_t lcid) { return std::string(""); }
const char* get_rb_name(uint32_t lcid) { return ""; }
std::vector<unique_byte_buffer_t> sdus;
rlc_pcap* pcap = nullptr;

@ -54,7 +54,7 @@ public:
// RRC interface
void max_retx_attempted() {}
std::string get_rb_name(uint32_t lcid) { return std::string("TestRB"); }
const char* get_rb_name(uint32_t lcid) { return "TestRB"; }
void set_expected_sdu_len(uint32_t len) { expected_sdu_len = len; }
unique_byte_buffer_t sdus[MAX_NBUFS];

@ -380,7 +380,7 @@ public:
std::this_thread::sleep_for(std::chrono::seconds(1));
exit(1);
}
std::string get_rb_name(uint32_t rx_lcid) { return std::string("DRB1"); }
const char* get_rb_name(uint32_t rx_lcid) { return "DRB1"; }
int get_nof_rx_pdus() { return rx_pdus; }

@ -56,7 +56,7 @@ public:
// RRC interface
void max_retx_attempted() {}
std::string get_rb_name(uint32_t lcid) { return std::string(""); }
const char* get_rb_name(uint32_t lcid) { return ""; }
void set_expected_sdu_len(uint32_t len) { expected_sdu_len = len; }
uint32_t get_num_sdus() { return sdus.size(); }

@ -17,7 +17,7 @@
INCLUDES
*******************************************************************************/
#include <memory>
#include "srsran/common/lte_common.h"
#include <stdint.h>
namespace srsenb {
@ -29,24 +29,14 @@ namespace srsenb {
#define SRSENB_N_RADIO_BEARERS 11
#define SRSENB_MAX_UES 64
enum rb_id_t {
RB_ID_SRB0 = 0,
RB_ID_SRB1,
RB_ID_SRB2,
RB_ID_DRB1,
RB_ID_DRB2,
RB_ID_DRB3,
RB_ID_DRB4,
RB_ID_DRB5,
RB_ID_DRB6,
RB_ID_DRB7,
RB_ID_DRB8,
RB_ID_N_ITEMS,
};
inline const char* to_string(rb_id_t rb_id)
using srsran::lte_rb;
inline const char* get_rb_name(uint32_t lcid)
{
const static char* names[] = {"SRB0", "SRB1", "SRB2", "DRB1", "DRB2", "DRB3", "DRB4", "DRB5", "DRB6", "DRB7", "DRB8"};
return (rb_id < RB_ID_N_ITEMS) ? names[rb_id] : "invalid bearer id";
return srsran::get_rb_name(static_cast<lte_rb>(lcid));
}
inline uint32_t rb_to_lcid(lte_rb rb_id)
{
return static_cast<uint32_t>(rb_id);
}
// Cat 3 UE - Max number of DL-SCH transport block bits received within a TTI

@ -99,7 +99,7 @@ private:
void write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu);
void write_pdu_pcch(srsran::unique_byte_buffer_t pdu);
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) {}
std::string get_rb_name(uint32_t lcid);
const char* get_rb_name(uint32_t lcid);
};
class user_interface

@ -87,7 +87,7 @@ private:
void write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu) final;
void write_pdu_pcch(srsran::unique_byte_buffer_t pdu) final;
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) final {}
std::string get_rb_name(uint32_t lcid) final;
const char* get_rb_name(uint32_t lcid) final;
};
class user_interface

@ -59,7 +59,7 @@ public:
void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu);
void discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t discard_sn);
bool rb_is_um(uint16_t rnti, uint32_t lcid);
std::string get_rb_name(uint32_t lcid);
const char* get_rb_name(uint32_t lcid);
bool sdu_queue_is_full(uint16_t rnti, uint32_t lcid);
// rlc_interface_mac
@ -79,7 +79,7 @@ private:
void write_pdu_pcch(srsran::unique_byte_buffer_t sdu);
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
void max_retx_attempted();
std::string get_rb_name(uint32_t lcid);
const char* get_rb_name(uint32_t lcid);
uint16_t rnti;
srsenb::pdcp_interface_rlc* pdcp;

@ -47,7 +47,7 @@ public:
void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu);
bool rb_is_um(uint16_t rnti, uint32_t lcid);
bool sdu_queue_is_full(uint16_t rnti, uint32_t lcid);
std::string get_rb_name(uint32_t lcid);
const char* get_rb_name(uint32_t lcid);
// rlc_interface_mac_nr
int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
@ -67,7 +67,7 @@ private:
void write_pdu_pcch(srsran::unique_byte_buffer_t sdu);
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
void max_retx_attempted() final;
std::string get_rb_name(uint32_t lcid) final;
const char* get_rb_name(uint32_t lcid) final;
uint16_t rnti;
srsenb::pdcp_interface_rlc_nr* m_pdcp = nullptr;

@ -135,7 +135,7 @@ int mac_controller::handle_crnti_ce(uint32_t temp_crnti)
set_drb_activation(false);
// Re-activate SRBs UL (needed for ReconfComplete)
for (uint32_t i = rb_id_t::RB_ID_SRB1; i <= rb_id_t::RB_ID_SRB2; ++i) {
for (uint32_t i = (uint32_t)lte_rb::srb1; i <= (uint32_t)lte_rb::srb2; ++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);
// Stop any SRB UL (including SRs)
for (uint32_t i = rb_id_t::RB_ID_SRB1; i <= rb_id_t::RB_ID_SRB2; ++i) {
for (uint32_t i = (uint32_t)lte_rb::srb1; i <= (uint32_t)lte_rb::srb2; ++i) {
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)
{
for (const drb_to_add_mod_s& drb : bearer_list.get_established_drbs()) {
current_sched_ue_cfg.ue_bearers[drb.drb_id + rb_id_t::RB_ID_SRB2].direction =
current_sched_ue_cfg.ue_bearers[drb.drb_id + (uint32_t)lte_rb::srb2].direction =
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] = {};
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());
rlc->write_sdu(rnti, RB_ID_SRB0, std::move(pdu));
rlc->write_sdu(rnti, rb_to_lcid(srsran::lte_rb::srb0), std::move(pdu));
}
/*******************************************************************************
@ -648,7 +648,7 @@ void rrc::parse_ul_dcch(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer
if (user_it != users.end()) {
user_it->second->parse_ul_dcch(lcid, std::move(pdu));
} else {
logger.error("Processing %s: Unknown rnti=0x%x", srsenb::to_string((rb_id_t)lcid), rnti);
logger.error("Processing %s: Unknown rnti=0x%x", get_rb_name(lcid), rnti);
}
}
}
@ -992,7 +992,7 @@ void rrc::tti_clock()
while (rx_pdu_queue.try_pop(p)) {
// print Rx PDU
if (p.pdu != nullptr) {
logger.info(p.pdu->msg, p.pdu->N_bytes, "Rx %s PDU", to_string((rb_id_t)p.lcid));
logger.info(p.pdu->msg, p.pdu->N_bytes, "Rx %s PDU", get_rb_name(p.lcid));
}
// check if user exists
@ -1004,11 +1004,11 @@ void rrc::tti_clock()
// handle queue cmd
switch (p.lcid) {
case RB_ID_SRB0:
case static_cast<uint32_t>(lte_rb::srb0):
parse_ul_ccch(p.rnti, std::move(p.pdu));
break;
case RB_ID_SRB1:
case RB_ID_SRB2:
case static_cast<uint32_t>(lte_rb::srb1):
case static_cast<uint32_t>(lte_rb::srb2):
parse_ul_dcch(p.rnti, p.lcid, std::move(p.pdu));
break;
case LCID_REM_USER:

@ -315,12 +315,12 @@ void rrc_nr::handle_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer
}
if (users.count(rnti) == 1) {
switch (lcid) {
case srsenb::RB_ID_SRB0:
switch (static_cast<srsran::rb_id_nr_t>(lcid)) {
case srsran::rb_id_nr_t::NR_SRB0:
// parse_ul_ccch(rnti, std::move(pdu));
break;
case srsenb::RB_ID_SRB1:
case srsenb::RB_ID_SRB2:
case srsran::rb_id_nr_t::NR_SRB1:
case srsran::rb_id_nr_t::NR_SRB2:
// parse_ul_dcch(p.rnti, p.lcid, std::move(p.pdu));
break;
default:
@ -396,7 +396,7 @@ void rrc_nr::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
char buf[32] = {};
sprintf(buf, "SRB0 - rnti=0x%x", rnti);
parent->log_rrc_message(buf, Tx, pdu.get(), *dl_ccch_msg);
parent->rlc->write_sdu(rnti, RB_ID_SRB0, std::move(pdu));
parent->rlc->write_sdu(rnti, srsran::NR_SRB0, std::move(pdu));
}
} // namespace srsenb

@ -237,8 +237,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srsran::unique_byte_buffer_t pdu)
return;
}
parent->log_rrc_message(
srsenb::to_string((rb_id_t)lcid), Rx, pdu.get(), ul_dcch_msg, ul_dcch_msg.msg.c1().type().to_string());
parent->log_rrc_message(get_rb_name(lcid), Rx, pdu.get(), ul_dcch_msg, ul_dcch_msg.msg.c1().type().to_string());
srsran::unique_byte_buffer_t original_pdu = std::move(pdu);
pdu = srsran::make_byte_buffer();
@ -612,9 +611,9 @@ void rrc::ue::handle_rrc_con_reest_complete(rrc_conn_reest_complete_s* msg, srsr
mac_ctrl.handle_con_reest_complete();
// Activate security for SRB1
parent->pdcp->config_security(rnti, RB_ID_SRB1, ue_security_cfg.get_as_sec_cfg());
parent->pdcp->enable_integrity(rnti, RB_ID_SRB1);
parent->pdcp->enable_encryption(rnti, RB_ID_SRB1);
parent->pdcp->config_security(rnti, rb_to_lcid(lte_rb::srb1), ue_security_cfg.get_as_sec_cfg());
parent->pdcp->enable_integrity(rnti, rb_to_lcid(lte_rb::srb1));
parent->pdcp->enable_encryption(rnti, rb_to_lcid(lte_rb::srb1));
// Reestablish current DRBs during ConnectionReconfiguration
bearer_list = std::move(parent->users.at(old_reest_rnti)->bearer_list);
@ -790,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()
{
// Setup SRB1 security/integrity. Encryption is set on completion
parent->pdcp->config_security(rnti, RB_ID_SRB1, ue_security_cfg.get_as_sec_cfg());
parent->pdcp->enable_integrity(rnti, RB_ID_SRB1);
parent->pdcp->config_security(rnti, rb_to_lcid(lte_rb::srb1), ue_security_cfg.get_as_sec_cfg());
parent->pdcp->enable_integrity(rnti, rb_to_lcid(lte_rb::srb1));
dl_dcch_msg_s dl_dcch_msg;
security_mode_cmd_s* comm = &dl_dcch_msg.msg.set_c1().set_security_mode_cmd();
@ -807,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->pdcp->enable_encryption(rnti, RB_ID_SRB1);
parent->pdcp->enable_encryption(rnti, rb_to_lcid(lte_rb::srb1));
}
void rrc::ue::handle_security_mode_failure(security_mode_fail_s* msg)
@ -1201,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);
}
parent->rlc->write_sdu(rnti, RB_ID_SRB0, std::move(pdu));
parent->rlc->write_sdu(rnti, rb_to_lcid(lte_rb::srb0), std::move(pdu));
} else {
parent->logger.error("Allocating pdu");
}
@ -1220,14 +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();
uint32_t lcid = RB_ID_SRB1;
lte_rb rb = lte_rb::srb1;
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)
lcid = parent->rlc->has_bearer(rnti, RB_ID_SRB2) && state == RRC_STATE_REGISTERED ? RB_ID_SRB2 : RB_ID_SRB1;
rb = (parent->rlc->has_bearer(rnti, rb_to_lcid(lte_rb::srb2)) && state == RRC_STATE_REGISTERED) ? lte_rb::srb2
: lte_rb::srb1;
}
char buf[32] = {};
sprintf(buf, "SRB%d - rnti=0x%x", lcid, rnti);
sprintf(buf, "%s - rnti=0x%x", srsran::get_rb_name(rb), rnti);
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.
@ -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);
}
parent->pdcp->write_sdu(rnti, lcid, std::move(pdu));
parent->pdcp->write_sdu(rnti, rb_to_lcid(rb), std::move(pdu));
} else {
parent->logger.error("Allocating pdu");
return false;

@ -235,9 +235,9 @@ void pdcp::user_interface_rrc::write_pdu_pcch(srsran::unique_byte_buffer_t pdu)
ERROR("Error: Received PCCH from ue=%d", rnti);
}
std::string pdcp::user_interface_rrc::get_rb_name(uint32_t lcid)
const char* pdcp::user_interface_rrc::get_rb_name(uint32_t lcid)
{
return to_string((rb_id_t)lcid);
return get_rb_name(lcid);
}
void pdcp::get_metrics(pdcp_metrics_t& m, const uint32_t nof_tti)

@ -12,6 +12,7 @@
#include "srsenb/hdr/stack/upper/pdcp_nr.h"
#include "lib/include/srsran/interfaces/nr_common_interface_types.h"
#include "srsenb/hdr/stack/upper/common_enb.h"
namespace srsenb {
@ -172,9 +173,9 @@ void pdcp_nr::user_interface_rrc::write_pdu_pcch(srsran::unique_byte_buffer_t pd
ERROR("Error: Received PCCH from ue=%d", rnti);
}
std::string pdcp_nr::user_interface_rrc::get_rb_name(uint32_t lcid)
const char* pdcp_nr::user_interface_rrc::get_rb_name(uint32_t lcid)
{
return srsran::to_string(static_cast<srsran::rb_id_nr_t>(lcid));
return srsenb::get_rb_name(lcid);
}
} // namespace srsenb

@ -60,7 +60,7 @@ void rlc::add_user(uint16_t rnti)
obj->init(&users[rnti],
&users[rnti],
timers,
RB_ID_SRB0,
rb_to_lcid(srsran::lte_rb::srb0),
[rnti, this](uint32_t lcid, uint32_t tx_queue, uint32_t 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)
{
if (lcid == RB_ID_SRB0) {
if (lcid == rb_to_lcid(srsran::lte_rb::srb0)) {
rrc->write_pdu(rnti, lcid, std::move(sdu));
} else {
pdcp->write_pdu(rnti, lcid, std::move(sdu));
@ -294,9 +294,9 @@ void rlc::user_interface::write_pdu_pcch(srsran::unique_byte_buffer_t sdu)
ERROR("Error: Received PCCH from ue=%d", rnti);
}
std::string rlc::user_interface::get_rb_name(uint32_t lcid)
const char* rlc::user_interface::get_rb_name(uint32_t lcid)
{
return to_string((rb_id_t)lcid);
return srsenb::get_rb_name(lcid);
}
} // namespace srsenb

@ -202,7 +202,7 @@ void rlc_nr::user_interface::write_pdu_pcch(srsran::unique_byte_buffer_t sdu)
ERROR("Error: Received PCCH from ue=%d", rnti);
}
std::string rlc_nr::user_interface::get_rb_name(uint32_t lcid)
const char* rlc_nr::user_interface::get_rb_name(uint32_t lcid)
{
return srsran::to_string(static_cast<srsran::rb_id_nr_t>(lcid));
}

@ -13,6 +13,7 @@
#include "sched_test_common.h"
#include "srsenb/hdr/stack/mac/sched.h"
#include "srsran/adt/accumulators.h"
#include "srsran/common/lte_common.h"
#include <chrono>
namespace srsenb {
@ -26,7 +27,7 @@ struct run_params {
};
struct run_params_range {
std::vector<uint32_t> nof_prbs = {6, 15, 25, 50, 75, 100};
std::vector<uint32_t> nof_prbs{srsran::lte_cell_nof_prbs.begin(), srsran::lte_cell_nof_prbs.end()};
std::vector<uint32_t> nof_ues = {1, 2, 5};
uint32_t nof_ttis = 10000;
std::vector<uint32_t> cqi = {5, 10, 15};

@ -13,6 +13,7 @@
#include "sched_test_common.h"
#include "sched_test_utils.h"
#include "srsenb/hdr/stack/mac/sched.h"
#include "srsran/common/lte_common.h"
#include "srsran/mac/pdu.h"
using namespace srsenb;
@ -79,10 +80,8 @@ struct test_scell_activation_params {
int test_scell_activation(uint32_t sim_number, test_scell_activation_params params)
{
std::array<uint32_t, 6> prb_list{6, 15, 25, 50, 75, 100};
/* Simulation Configuration Arguments */
uint32_t nof_prb = prb_list[std::uniform_int_distribution<uint32_t>{0, 5}(get_rand_gen())];
uint32_t nof_prb = srsran::lte_cell_nof_prbs[std::uniform_int_distribution<uint32_t>{0, 5}(get_rand_gen())];
uint32_t nof_ccs = 2;
uint32_t start_tti = 0; // rand_int(0, 10240);

@ -13,6 +13,7 @@
#include "sched_test_utils.h"
#include "srsenb/hdr/stack/mac/sched_common.h"
#include "srsenb/hdr/stack/mac/sched_phy_ch/sched_dci.h"
#include "srsran/common/lte_common.h"
#include "srsran/common/test_common.h"
namespace srsenb {
@ -178,10 +179,9 @@ int test_mcs_lookup_specific()
/// Verify consistency of MCS,TBS computation for different permutations of banwidths, grant sizes, cqi, max_mcs
int test_mcs_tbs_consistency_all()
{
uint32_t prb_list[] = {6, 15, 25, 50, 75, 100};
sched_interface::sched_args_t sched_args = {};
for (auto& nof_prb_cell : prb_list) {
for (auto& nof_prb_cell : srsran::lte_cell_nof_prbs) {
sched_interface::cell_cfg_t cell_cfg = generate_default_cell_cfg(nof_prb_cell);
sched_cell_params_t cell_params = {};
cell_params.set_cfg(0, cell_cfg, sched_args);

@ -12,13 +12,13 @@
#include "sched_test_common.h"
#include "srsenb/hdr/stack/mac/sched_grid.h"
#include "srsran/common/lte_common.h"
#include "srsran/common/test_common.h"
using namespace srsenb;
const uint32_t seed = std::chrono::system_clock::now().time_since_epoch().count();
const uint32_t PCell_IDX = 0;
const std::array<uint32_t, 6> prb_list = {6, 15, 25, 50, 75, 100};
const uint32_t PCell_IDX = 0;
uint32_t get_aggr_level(sched_ue& sched_ue, uint32_t enb_cc_idx, const std::vector<sched_cell_params_t>& cell_params)
{
@ -33,7 +33,7 @@ int test_pdcch_one_ue()
using rand_uint = std::uniform_int_distribution<uint32_t>;
const uint32_t ENB_CC_IDX = 0;
// Params
uint32_t nof_prb = prb_list[rand_uint{0, 5}(get_rand_gen())];
uint32_t nof_prb = srsran::lte_cell_nof_prbs[rand_uint{0, 5}(get_rand_gen())];
uint16_t rnti = rand_uint{70, 120}(get_rand_gen());
srsran::tti_point start_tti{rand_uint{0, 10240}(get_rand_gen())};
uint32_t nof_ttis = 100;

@ -78,47 +78,47 @@ int test_lc_ch_pbr_infinity()
{
srsenb::lch_ue_manager lch_handler;
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg);
ue_cfg.ue_bearers[srsenb::RB_ID_SRB1] = {};
ue_cfg.ue_bearers[srsenb::RB_ID_SRB1].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1] = {};
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].priority = 5;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2] = {};
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2].priority = 3;
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg);
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::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[rb_to_lcid((lte_rb::drb2))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].priority = 3;
lch_handler.set_cfg(ue_cfg);
lch_handler.new_tti();
lch_handler.dl_buffer_state(srsenb::RB_ID_SRB1, 50000, 10000);
lch_handler.dl_buffer_state(srsenb::RB_ID_DRB1, 5000, 10000);
lch_handler.dl_buffer_state(srsenb::RB_ID_DRB2, 5000, 10000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::srb1), 50000, 10000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb1), 5000, 10000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb2), 5000, 10000);
// 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(srsenb::RB_ID_SRB1);
TESTASSERT(test_retx_until_empty(lch_handler, srsenb::RB_ID_SRB1, 500) == nof_pending_bytes);
int nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::srb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes);
// TEST2 - the DRB2 has lower prio level than SRB1, but has retxs
nof_pending_bytes = lch_handler.get_dl_retx(srsenb::RB_ID_DRB2);
TESTASSERT(test_retx_until_empty(lch_handler, srsenb::RB_ID_DRB2, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::drb2));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb2), 500) == nof_pending_bytes);
// TEST3 - the DRB1 has lower prio level, but has retxs
nof_pending_bytes = lch_handler.get_dl_retx(srsenb::RB_ID_DRB1);
TESTASSERT(test_retx_until_empty(lch_handler, srsenb::RB_ID_DRB1, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::drb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb1), 500) == nof_pending_bytes);
// TEST4 - The SRB1 newtx buffer is emptied before other bearers newtxs
nof_pending_bytes = lch_handler.get_dl_tx(srsenb::RB_ID_SRB1);
TESTASSERT(test_newtx_until_empty(lch_handler, srsenb::RB_ID_SRB1, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::srb1));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes);
// TEST5 - The DRB2 newtx buffer is emptied before DRB1 newtxs
nof_pending_bytes = lch_handler.get_dl_tx(srsenb::RB_ID_DRB2);
TESTASSERT(test_newtx_until_empty(lch_handler, srsenb::RB_ID_DRB2, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::drb2));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb2), 500) == nof_pending_bytes);
// TEST6 - The DRB1 buffer is emptied
nof_pending_bytes = lch_handler.get_dl_tx(srsenb::RB_ID_DRB1);
TESTASSERT(test_newtx_until_empty(lch_handler, srsenb::RB_ID_DRB1, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::drb1));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb1), 500) == nof_pending_bytes);
return SRSRAN_SUCCESS;
}
@ -128,20 +128,20 @@ int test_lc_ch_pbr_finite()
srsenb::lch_ue_manager lch_handler;
sched_interface::dl_sched_pdu_t pdu;
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg);
ue_cfg.ue_bearers[srsenb::RB_ID_SRB1] = {};
ue_cfg.ue_bearers[srsenb::RB_ID_SRB1].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1] = {};
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].pbr = 256; // kBps
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].bsd = 50; // msec
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].priority = 5;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2] = {};
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2].pbr = 8; // kBps
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2].bsd = 50; // msec
ue_cfg.ue_bearers[srsenb::RB_ID_DRB2].priority = 3;
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg);
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::srb1))].direction = sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::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[rb_to_lcid((lte_rb::drb1))].bsd = 50; // msec
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb1))].priority = 5;
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))] = {};
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::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[rb_to_lcid((lte_rb::drb2))].bsd = 50; // msec
ue_cfg.ue_bearers[rb_to_lcid((lte_rb::drb2))].priority = 3;
lch_handler.set_cfg(ue_cfg);
for (uint32_t i = 0; i < 50; ++i) {
@ -149,41 +149,41 @@ int test_lc_ch_pbr_finite()
}
// Bj={0, infinity, 0, 12800, 400}
lch_handler.dl_buffer_state(srsenb::RB_ID_SRB1, 50000, 1000);
lch_handler.dl_buffer_state(srsenb::RB_ID_DRB1, 50000, 1000);
lch_handler.dl_buffer_state(srsenb::RB_ID_DRB2, 50000, 0);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::srb1), 50000, 1000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb1), 50000, 1000);
lch_handler.dl_buffer_state(rb_to_lcid(lte_rb::drb2), 50000, 0);
// TEST1 - SRB1 retxs are emptied first
int nof_pending_bytes = lch_handler.get_dl_retx(srsenb::RB_ID_SRB1);
TESTASSERT(test_retx_until_empty(lch_handler, srsenb::RB_ID_SRB1, 500) == nof_pending_bytes);
int nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::srb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes);
// TEST2 - DRB1 retxs are emptied
nof_pending_bytes = lch_handler.get_dl_retx(srsenb::RB_ID_DRB1);
TESTASSERT(test_retx_until_empty(lch_handler, srsenb::RB_ID_DRB1, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_retx(rb_to_lcid(lte_rb::drb1));
TESTASSERT(test_retx_until_empty(lch_handler, rb_to_lcid(lte_rb::drb1), 500) == nof_pending_bytes);
// TEST3 - SRB1 newtxs are emptied (PBR==infinity)
nof_pending_bytes = lch_handler.get_dl_tx(srsenb::RB_ID_SRB1);
TESTASSERT(test_newtx_until_empty(lch_handler, srsenb::RB_ID_SRB1, 500) == nof_pending_bytes);
nof_pending_bytes = lch_handler.get_dl_tx(rb_to_lcid(lte_rb::srb1));
TESTASSERT(test_newtx_until_empty(lch_handler, rb_to_lcid(lte_rb::srb1), 500) == nof_pending_bytes);
// TEST4 - DRB2 has higher priority so it gets allocated until Bj <= 0
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, srsenb::RB_ID_DRB2, 200) == SRSRAN_SUCCESS);
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb2), 200) == SRSRAN_SUCCESS);
// Bj={0, infinity, 0, 12800, 200}
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, srsenb::RB_ID_DRB2, 600) == SRSRAN_SUCCESS);
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb2), 600) == SRSRAN_SUCCESS);
// Bj={0, infinity, 0, 256000, -400}
// TEST5 - DRB1 has lower prio, but DRB2 Bj <= 0.
for (uint32_t i = 0; i < 50; ++i) {
lch_handler.new_tti();
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, srsenb::RB_ID_DRB1, 50) == SRSRAN_SUCCESS);
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb1), 50) == SRSRAN_SUCCESS);
}
// TEST6 - new tti restores DRB2 Bj>=0, and DRB2 gets allocated
lch_handler.new_tti();
// Bj={0, infinity, 0, 256000, 8}
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, srsenb::RB_ID_DRB2, 50) == SRSRAN_SUCCESS);
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb2), 50) == SRSRAN_SUCCESS);
// Bj={0, infinity, 0, 256000, -42}
lch_handler.new_tti();
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, srsenb::RB_ID_DRB1, 50) == SRSRAN_SUCCESS);
TESTASSERT(test_pdu_alloc_successful(lch_handler, pdu, rb_to_lcid(lte_rb::drb1), 50) == 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]);
TESTASSERT(ue_recfg(ue_ctxt.rnti, ue_cfg) == SRSRAN_SUCCESS);
uint32_t lcid = RB_ID_SRB0; // Use SRB0 to schedule Msg4
uint32_t lcid = rb_to_lcid(lte_rb::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_mac_buffer_state(ue_ctxt.rnti, (uint32_t)srsran::dl_sch_lcid::CON_RES_ID, 1) ==
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();
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
uint32_t lcid = RB_ID_DRB1;
uint32_t lcid = rb_to_lcid(lte_rb::drb1);
uint32_t pending_dl_new_data = ue_db[ue_ev.rnti]->get_pending_dl_rlc_data();
// 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

@ -25,9 +25,10 @@
#include "sched_common_test_suite.h"
#include "sched_test_common.h"
#include "sched_test_utils.h"
#include "srsran/common/lte_common.h"
#include "srsran/common/test_common.h"
using srsran::tti_point;
namespace srsenb {
uint32_t seed = std::chrono::system_clock::now().time_since_epoch().count();
@ -233,7 +234,7 @@ int sched_tester::update_ue_stats()
return SRSRAN_SUCCESS;
}
int test_scheduler_rand(sched_sim_events sim)
int test_scheduler_rand(srsenb::sched_sim_events sim)
{
// Create classes
sched_tester tester;
@ -264,7 +265,7 @@ sched_sim_events rand_sim_params(uint32_t nof_ttis)
std::uniform_int_distribution<> connection_dur_dist(min_conn_dur, max_conn_dur);
std::uniform_int_distribution<uint32_t> dist_prb_idx(0, 5);
uint32_t prb_idx = dist_prb_idx(srsenb::get_rand_gen());
uint32_t nof_prb = std::array<uint32_t, 6>({6, 15, 25, 50, 75, 100})[prb_idx];
uint32_t nof_prb = srsran::lte_cell_nof_prbs[prb_idx];
printf("Number of PRBs is %u\n", nof_prb);
sched_sim_event_generator generator;
@ -322,11 +323,13 @@ sched_sim_events rand_sim_params(uint32_t nof_ttis)
return sim_gen;
}
} // namespace srsenb
int main()
{
// Setup seed
srsenb::set_randseed(seed);
printf("This is the chosen seed: %u\n", seed);
srsenb::set_randseed(srsenb::seed);
printf("This is the chosen seed: %u\n", srsenb::seed);
// Setup the log spy to intercept error and warning log entries.
if (!srslog::install_custom_sink(
@ -350,11 +353,11 @@ int main()
uint32_t N_runs = 1, nof_ttis = 10240 + 10;
sched_diagnostic_printer printer(*spy);
srsenb::sched_diagnostic_printer printer(*spy);
for (uint32_t n = 0; n < N_runs; ++n) {
printf("Sim run number: %u\n", n + 1);
sched_sim_events sim = rand_sim_params(nof_ttis);
TESTASSERT(test_scheduler_rand(std::move(sim)) == SRSRAN_SUCCESS);
srsenb::sched_sim_events sim = srsenb::rand_sim_params(nof_ttis);
TESTASSERT(srsenb::test_scheduler_rand(std::move(sim)) == SRSRAN_SUCCESS);
}
return 0;

@ -21,6 +21,8 @@
#include <chrono>
#include <unordered_map>
namespace srsenb {
/*****************************
* Setup Sched Configuration
****************************/
@ -63,15 +65,15 @@ inline srsenb::sched_interface::ue_cfg_t generate_default_ue_cfg()
ue_cfg.maxharq_tx = 5;
ue_cfg.supported_cc_list.resize(1);
ue_cfg.supported_cc_list[0].aperiodic_cqi_period = 40;
ue_cfg.supported_cc_list[0].enb_cc_idx = 0;
ue_cfg.supported_cc_list[0].active = true;
ue_cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1;
ue_cfg.ue_bearers[srsenb::RB_ID_SRB0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_SRB1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_SRB2].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].group = 1;
ue_cfg.supported_cc_list[0].aperiodic_cqi_period = 40;
ue_cfg.supported_cc_list[0].enb_cc_idx = 0;
ue_cfg.supported_cc_list[0].active = true;
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[rb_to_lcid(lte_rb::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[rb_to_lcid(lte_rb::drb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].group = 1;
ue_cfg.pucch_cfg.sr_configured = true;
ue_cfg.pucch_cfg.I_sr = 15; // periodicity of 20 msec
@ -84,18 +86,18 @@ inline srsenb::sched_interface::ue_cfg_t generate_default_ue_cfg2()
{
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg.ue_bearers[srsenb::RB_ID_SRB1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_SRB2].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].group = 1;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::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[rb_to_lcid(lte_rb::drb1)].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].group = 1;
return ue_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 = {};
cfg.ue_bearers[srsenb::RB_ID_SRB0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
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.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].active = true;
@ -106,10 +108,10 @@ 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);
cfg.maxharq_tx = final_cfg.maxharq_tx;
cfg.ue_bearers[srsenb::RB_ID_SRB1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1;
cfg.continuous_pusch = final_cfg.continuous_pusch;
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.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1;
cfg.continuous_pusch = final_cfg.continuous_pusch;
cfg.supported_cc_list[0].dl_cfg.cqi_report = final_cfg.supported_cc_list[0].dl_cfg.cqi_report;
cfg.pucch_cfg = final_cfg.pucch_cfg;
@ -120,8 +122,8 @@ 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)
{
srsenb::sched_interface::ue_cfg_t cfg = generate_setup_ue_cfg(final_cfg);
cfg.ue_bearers[srsenb::RB_ID_SRB2] = final_cfg.ue_bearers[srsenb::RB_ID_SRB1];
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)];
return cfg;
}
@ -255,9 +257,11 @@ struct sched_sim_event_generator {
ue_sim_cfg.ue_cfg = generate_default_ue_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
user->ue_sim_cfg->ue_cfg.ue_bearers[srsenb::RB_ID_SRB2].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
user->ue_sim_cfg->ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
user->ue_sim_cfg->ue_cfg.ue_bearers[srsenb::RB_ID_DRB1].group = 1;
user->ue_sim_cfg->ue_cfg.ue_bearers[rb_to_lcid(lte_rb::srb2)].direction =
srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
user->ue_sim_cfg->ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].direction =
srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
user->ue_sim_cfg->ue_cfg.ue_bearers[rb_to_lcid(lte_rb::drb1)].group = 1;
return user;
}
@ -302,4 +306,6 @@ private:
}
};
} // namespace srsenb
#endif // SRSRAN_SCHED_TEST_UTILS_H

@ -296,22 +296,22 @@ int test_s1ap_tenb_mobility(mobility_test_params test_params)
auto& mac_ue = tester.mac.ue_db[0x46];
TESTASSERT(mac_ue.supported_cc_list[0].active);
TESTASSERT(mac_ue.supported_cc_list[0].enb_cc_idx == 0);
TESTASSERT(mac_ue.ue_bearers[rb_id_t::RB_ID_SRB0].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.ue_bearers[rb_to_lcid(lte_rb::srb0)].direction == sched_interface::ue_bearer_cfg_t::BOTH);
// Check Security Configuration
TESTASSERT(tester.pdcp.bearers.count(0x46));
TESTASSERT(tester.pdcp.bearers[0x46].count(rb_id_t::RB_ID_SRB1) and
tester.pdcp.bearers[0x46].count(rb_id_t::RB_ID_SRB2));
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].enable_encryption);
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].enable_integrity);
TESTASSERT(tester.pdcp.bearers[0x46].count(rb_to_lcid(lte_rb::srb1)) and
tester.pdcp.bearers[0x46].count(rb_to_lcid(lte_rb::srb2)));
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].enable_encryption);
TESTASSERT(tester.pdcp.bearers[0x46][rb_to_lcid(lte_rb::srb1)].enable_integrity);
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.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();
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].sec_cfg.k_rrc_int == as_sec_cfg.k_rrc_int);
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].sec_cfg.k_rrc_enc == as_sec_cfg.k_rrc_enc);
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].sec_cfg.k_up_int == as_sec_cfg.k_up_int);
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].sec_cfg.cipher_algo == as_sec_cfg.cipher_algo);
TESTASSERT(tester.pdcp.bearers[0x46][rb_id_t::RB_ID_SRB1].sec_cfg.integ_algo == as_sec_cfg.integ_algo);
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][rb_to_lcid(lte_rb::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][rb_to_lcid(lte_rb::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);
// Check if S1AP Handover Request ACK send is called
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};
test_helpers::copy_msg_to_buffer(pdu, recfg_complete);
tester.rrc.write_pdu(0x46, rb_id_t::RB_ID_SRB1, std::move(pdu));
tester.rrc.write_pdu(0x46, rb_to_lcid(lte_rb::srb1), std::move(pdu));
tester.tic();
TESTASSERT(mac_ue.ue_bearers[rb_id_t::RB_ID_SRB1].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.ue_bearers[rb_id_t::RB_ID_SRB2].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.ue_bearers[rb_id_t::RB_ID_DRB1].direction == sched_interface::ue_bearer_cfg_t::BOTH);
TESTASSERT(mac_ue.ue_bearers[rb_to_lcid(lte_rb::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[rb_to_lcid(lte_rb::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.n_pucch_sr ==
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 */
uint8_t recfg_complete[] = {0x10, 0x00};
test_helpers::copy_msg_to_buffer(pdu, recfg_complete);
tester.rrc.write_pdu(tester.rnti, rb_id_t::RB_ID_SRB2, std::move(pdu));
tester.rrc.write_pdu(tester.rnti, rb_to_lcid(lte_rb::srb2), std::move(pdu));
TESTASSERT(tester.pdcp.last_sdu.sdu == nullptr);
sched_interface::ue_cfg_t& ue_cfg = tester.mac.ue_db[tester.rnti];
TESTASSERT(ue_cfg.pucch_cfg.sr_configured);

@ -21,6 +21,7 @@
#include "srsran/common/block_queue.h"
#include "srsran/common/buffer_pool.h"
#include "srsran/common/common.h"
#include "srsran/common/lte_common.h"
#include "srsran/common/security.h"
#include "srsran/common/stack_procedure.h"
#include "srsran/interfaces/ue_interfaces.h"
@ -214,28 +215,12 @@ private:
uint32_t n311_cnt = 0, N311 = 0;
srsran::timer_handler::unique_timer t300, t301, t302, t310, t311, t304;
// Radio bearers
typedef enum {
RB_ID_SRB0 = 0,
RB_ID_SRB1,
RB_ID_SRB2,
RB_ID_DRB1,
RB_ID_DRB2,
RB_ID_DRB3,
RB_ID_DRB4,
RB_ID_DRB5,
RB_ID_DRB6,
RB_ID_DRB7,
RB_ID_DRB8,
RB_ID_MAX
} rb_id_t;
static const std::string rb_id_str[];
std::string get_rb_name(uint32_t lcid)
const char* get_rb_name(uint32_t lcid)
{
if (lcid < RB_ID_MAX) {
return rb_id_str[lcid];
if (lcid < (uint32_t)srsran::lte_rb::count) {
return rb_id_str[lcid].c_str();
} else {
return "INVALID_RB";
}

@ -96,7 +96,6 @@ public:
void in_sync() final;
void out_of_sync() final;
// RLC interface
void max_retx_attempted() final;
@ -173,7 +172,7 @@ private:
// RRC constants and timers
srsran::timer_handler* timers = nullptr;
std::string get_rb_name(uint32_t lcid) final { return srsran::to_string((srsran::rb_id_nr_t)lcid); }
const char* get_rb_name(uint32_t lcid) final { return srsran::to_string((srsran::rb_id_nr_t)lcid); }
typedef enum { Srb = 0, Drb } rb_type_t;
typedef struct {
@ -218,7 +217,7 @@ private:
{
public:
explicit connection_reconf_no_ho_proc(rrc_nr* parent_);
srsran::proc_outcome_t init(const reconf_initiator_t initiator_,
srsran::proc_outcome_t init(const reconf_initiator_t initiator_,
const bool endc_release_and_add_r15,
const bool nr_secondary_cell_group_cfg_r15_present,
const asn1::dyn_octstring nr_secondary_cell_group_cfg_r15,

@ -748,7 +748,7 @@ void rrc::timer_expired(uint32_t timeout_id)
}
}
bool rrc::nr_reconfiguration_proc(const rrc_conn_recfg_r8_ies_s& rx_recfg, bool *has_5g_nr_reconfig)
bool rrc::nr_reconfiguration_proc(const rrc_conn_recfg_r8_ies_s& rx_recfg, bool* has_5g_nr_reconfig)
{
if (!(rx_recfg.non_crit_ext_present && rx_recfg.non_crit_ext.non_crit_ext_present &&
rx_recfg.non_crit_ext.non_crit_ext.non_crit_ext_present &&
@ -801,14 +801,14 @@ bool rrc::nr_reconfiguration_proc(const rrc_conn_recfg_r8_ies_s& rx_recfg, bool
nr_radio_bearer_cfg1_r15_present = true;
nr_radio_bearer_cfg1_r15 = rrc_conn_recfg_v1510_ies->nr_radio_bearer_cfg1_r15;
}
*has_5g_nr_reconfig = true;
return rrc_nr->rrc_reconfiguration(endc_release_and_add_r15,
nr_secondary_cell_group_cfg_r15_present,
nr_secondary_cell_group_cfg_r15,
sk_counter_r15_present,
sk_counter_r15,
nr_radio_bearer_cfg1_r15_present,
nr_radio_bearer_cfg1_r15);
*has_5g_nr_reconfig = true;
return rrc_nr->rrc_reconfiguration(endc_release_and_add_r15,
nr_secondary_cell_group_cfg_r15_present,
nr_secondary_cell_group_cfg_r15,
sk_counter_r15_present,
sk_counter_r15,
nr_radio_bearer_cfg1_r15_present,
nr_radio_bearer_cfg1_r15);
}
/*******************************************************************************
*
@ -940,7 +940,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.c1().rrc_conn_reest_complete().rrc_transaction_id = transaction_id;
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg);
reestablishment_successful = true;
}
@ -960,12 +960,13 @@ 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);
memcpy(rrc_conn_setup_complete->ded_info_nas.data(), nas_msg->msg, nas_msg->N_bytes); // TODO Check!
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg);
}
void rrc::send_ul_info_transfer(unique_byte_buffer_t nas_msg)
{
uint32_t lcid = rlc->has_bearer(RB_ID_SRB2) ? RB_ID_SRB2 : RB_ID_SRB1;
uint32_t lcid =
(uint32_t)(rlc->has_bearer((uint32_t)srsran::lte_rb::srb2) ? srsran::lte_rb::srb2 : srsran::lte_rb::srb1);
// Prepare UL INFO packet
asn1::rrc::ul_dcch_msg_s ul_dcch_msg;
@ -988,7 +989,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.c1().security_mode_complete().rrc_transaction_id = transaction_id;
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg);
}
void rrc::send_rrc_con_reconfig_complete(bool contains_nr_complete)
@ -1016,7 +1017,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.from_string("00");
}
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg);
}
void rrc::ra_completed()
@ -1168,12 +1169,12 @@ void rrc::start_con_restablishment(reest_cause_e cause)
bool rrc::srbs_flushed()
{
// Check SRB1
if (rlc->has_data(RB_ID_SRB1) && not rlc->is_suspended(RB_ID_SRB1)) {
if (rlc->has_data((uint32_t)srsran::lte_rb::srb1) && not rlc->is_suspended((uint32_t)srsran::lte_rb::srb1)) {
return false;
}
// Check SRB2
if (rlc->has_data(RB_ID_SRB2) && not rlc->is_suspended(RB_ID_SRB2)) {
if (rlc->has_data((uint32_t)srsran::lte_rb::srb2) && not rlc->is_suspended((uint32_t)srsran::lte_rb::srb2)) {
return false;
}
@ -1187,7 +1188,7 @@ bool rrc::srbs_flushed()
*******************************************************************************/
void rrc::send_srb1_msg(const ul_dcch_msg_s& msg)
{
send_ul_dcch_msg(RB_ID_SRB1, msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, msg);
}
std::set<uint32_t> rrc::get_cells(const uint32_t earfcn)
@ -1561,8 +1562,8 @@ void rrc::send_ul_ccch_msg(const ul_ccch_msg_s& msg)
logger.debug("Setting UE contention resolution ID: %" PRIu64 "", uecri);
mac->set_contention_id(uecri);
uint32_t lcid = RB_ID_SRB0;
log_rrc_message(get_rb_name(lcid).c_str(), Tx, pdcp_buf.get(), msg, msg.msg.c1().type().to_string());
uint32_t lcid = (uint32_t)srsran::lte_rb::srb0;
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));
}
@ -1583,13 +1584,12 @@ void rrc::send_ul_dcch_msg(uint32_t lcid, const ul_dcch_msg_s& msg)
pdcp_buf->set_timestamp();
if (msg.msg.type() == ul_dcch_msg_type_c::types_opts::options::c1) {
log_rrc_message(get_rb_name(lcid).c_str(), 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());
} else if (msg.msg.type() == ul_dcch_msg_type_c::types_opts::options::msg_class_ext) {
if (msg.msg.msg_class_ext().type() == ul_dcch_msg_type_c::msg_class_ext_c_::types_opts::options::c2) {
log_rrc_message(
get_rb_name(lcid).c_str(), Tx, pdcp_buf.get(), msg, msg.msg.msg_class_ext().c2().type().to_string());
log_rrc_message(get_rb_name(lcid), Tx, pdcp_buf.get(), msg, msg.msg.msg_class_ext().c2().type().to_string());
} else {
log_rrc_message(get_rb_name(lcid).c_str(), Tx, pdcp_buf.get(), msg, msg.msg.msg_class_ext().type().to_string());
log_rrc_message(get_rb_name(lcid), Tx, pdcp_buf.get(), msg, msg.msg.msg_class_ext().type().to_string());
}
}
@ -1613,12 +1613,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)
{
logger.debug("RX PDU, LCID: %d", lcid);
switch (lcid) {
case RB_ID_SRB0:
switch (static_cast<srsran::lte_rb>(lcid)) {
case srsran::lte_rb::srb0:
parse_dl_ccch(std::move(pdu));
break;
case RB_ID_SRB1:
case RB_ID_SRB2:
case srsran::lte_rb::srb1:
case srsran::lte_rb::srb2:
parse_dl_dcch(lcid, std::move(pdu));
break;
default:
@ -1636,7 +1636,8 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
logger.error(pdu->msg, pdu->N_bytes, "Failed to unpack DL-CCCH message (%d B)", pdu->N_bytes);
return;
}
log_rrc_message(get_rb_name(RB_ID_SRB0).c_str(), Rx, pdu.get(), dl_ccch_msg, dl_ccch_msg.msg.c1().type().to_string());
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());
dl_ccch_msg_type_c::c1_c_* c1 = &dl_ccch_msg.msg.c1();
switch (dl_ccch_msg.msg.c1().type().value) {
@ -1690,7 +1691,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
logger.error(pdu->msg, pdu->N_bytes, "Failed to unpack DL-DCCH message (%d B)", pdu->N_bytes);
return;
}
log_rrc_message(get_rb_name(lcid).c_str(), Rx, pdu.get(), dl_dcch_msg, dl_dcch_msg.msg.c1().type().to_string());
log_rrc_message(get_rb_name(lcid), Rx, pdu.get(), dl_dcch_msg, dl_dcch_msg.msg.c1().type().to_string());
dl_dcch_msg_type_c::c1_c_* c1 = &dl_dcch_msg.msg.c1();
switch (dl_dcch_msg.msg.c1().type().value) {
@ -2113,7 +2114,7 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
}
}
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg);
}
/*******************************************************************************
@ -2550,7 +2551,7 @@ void rrc::add_srb(const srb_to_add_mod_s& srb_cnfg)
{
// Setup PDCP
pdcp->add_bearer(srb_cnfg.srb_id, make_srb_pdcp_config_t(srb_cnfg.srb_id, true));
if (RB_ID_SRB2 == srb_cnfg.srb_id) {
if (static_cast<uint32_t>(srsran::lte_rb::srb2) == srb_cnfg.srb_id) {
pdcp->config_security(srb_cnfg.srb_id, sec_cfg);
pdcp->enable_integrity(srb_cnfg.srb_id, DIRECTION_TXRX);
pdcp->enable_encryption(srb_cnfg.srb_id, DIRECTION_TXRX);
@ -2571,20 +2572,23 @@ 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.type() == srb_to_add_mod_s::lc_ch_cfg_c_::types::default_value) {
// Set default SRB values as defined in Table 9.2.1
switch (srb_cnfg.srb_id) {
case RB_ID_SRB0:
switch (static_cast<srsran::lte_rb>(srb_cnfg.srb_id)) {
case srsran::lte_rb::srb0:
logger.error("Setting SRB0: Should not be set by RRC");
break;
case RB_ID_SRB1:
case srsran::lte_rb::srb1:
priority = 1;
prioritized_bit_rate = -1;
bucket_size_duration = 0;
break;
case RB_ID_SRB2:
case srsran::lte_rb::srb2:
priority = 3;
prioritized_bit_rate = -1;
bucket_size_duration = 0;
break;
default:
logger.error("Invalid SRB configuration");
return;
}
} else {
if (srb_cnfg.lc_ch_cfg.explicit_value().lc_ch_sr_mask_r9_present) {
@ -2603,7 +2607,7 @@ void rrc::add_srb(const srb_to_add_mod_s& srb_cnfg)
}
srbs[srb_cnfg.srb_id] = srb_cnfg;
logger.info("Added radio bearer %s", get_rb_name(srb_cnfg.srb_id).c_str());
logger.info("Added radio bearer %s", get_rb_name(srb_cnfg.srb_id));
}
void rrc::add_drb(const drb_to_add_mod_s& drb_cnfg)
@ -2616,7 +2620,7 @@ void rrc::add_drb(const drb_to_add_mod_s& drb_cnfg)
if (drb_cnfg.lc_ch_id_present) {
lcid = drb_cnfg.lc_ch_id;
} else {
lcid = RB_ID_SRB2 + drb_cnfg.drb_id;
lcid = srsran::MAX_LTE_SRB_ID + drb_cnfg.drb_id;
logger.warning("LCID not present, using %d", lcid);
}
@ -2650,7 +2654,7 @@ void rrc::add_drb(const drb_to_add_mod_s& drb_cnfg)
drb_up = true;
logger.info("Added DRB Id %d (LCID=%d)", drb_cnfg.drb_id, lcid);
// Update LCID if gw is running
if(gw->is_running()){
if (gw->is_running()) {
gw->update_lcid(drb_cnfg.eps_bearer_id, lcid);
}
}
@ -2675,7 +2679,7 @@ uint32_t rrc::get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id)
if (drb_cnfg.lc_ch_id_present) {
lcid = drb_cnfg.lc_ch_id;
} else {
lcid = RB_ID_SRB2 + drb_cnfg.drb_id;
lcid = srsran::MAX_LTE_SRB_ID + drb_cnfg.drb_id;
logger.warning("LCID not present, using %d", lcid);
}
return lcid;
@ -2780,7 +2784,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.fail_type_r15 =
(fail_report_scg_nr_r15_s::fail_type_r15_opts::options)cause;
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
send_ul_dcch_msg((uint32_t)srsran::lte_rb::srb1, ul_dcch_msg);
}
} // namespace srsue

@ -1037,7 +1037,7 @@ srsran::proc_outcome_t rrc::connection_reconf_no_ho_proc::react(const bool& conf
if (nas_pdu != nullptr) {
memcpy(nas_pdu->msg, pdu.data(), pdu.size());
nas_pdu->N_bytes = pdu.size();
rrc_ptr->nas->write_pdu(RB_ID_SRB1, std::move(nas_pdu));
rrc_ptr->nas->write_pdu((uint32_t)srsran::lte_rb::srb1, std::move(nas_pdu));
} else {
rrc_ptr->logger.error("Couldn't allocate PDU in %s.", __FUNCTION__);
return proc_outcome_t::error;
@ -1332,9 +1332,9 @@ proc_outcome_t rrc::connection_reest_proc::init(asn1::rrc::reest_cause_e cause)
reest_cellid = rrc_ptr->meas_cells.find_cell(reest_source_freq, reest_source_pci)->get_cell_id();
Info("Starting... cause: \"%s\", UE context: {C-RNTI=0x%x, PCI=%d, CELL ID=%d}",
reest_cause == asn1::rrc::reest_cause_opts::recfg_fail ? "Reconfiguration failure"
: cause == asn1::rrc::reest_cause_opts::ho_fail ? "Handover failure"
: "Other failure",
reest_cause == asn1::rrc::reest_cause_opts::recfg_fail
? "Reconfiguration failure"
: cause == asn1::rrc::reest_cause_opts::ho_fail ? "Handover failure" : "Other failure",
reest_rnti,
reest_source_pci,
reest_cellid);

@ -458,7 +458,7 @@ void nas::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
uint8 msg_type = 0;
uint8 sec_hdr_type = 0;
logger.info(pdu->msg, pdu->N_bytes, "DL %s PDU", rrc->get_rb_name(lcid).c_str());
logger.info(pdu->msg, pdu->N_bytes, "DL %s PDU", rrc->get_rb_name(lcid));
// Parse the message security header
liblte_mme_parse_msg_sec_header((LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), &pd, &sec_hdr_type);
@ -492,7 +492,7 @@ void nas::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
// Parse the message header
liblte_mme_parse_msg_header((LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), &pd, &msg_type);
logger.info(pdu->msg, pdu->N_bytes, "DL %s Decrypted PDU", rrc->get_rb_name(lcid).c_str());
logger.info(pdu->msg, pdu->N_bytes, "DL %s Decrypted PDU", rrc->get_rb_name(lcid));
// drop messages if integrity protection isn't applied (see TS 24.301 Sec. 4.4.4.2)
if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS) {
@ -1414,9 +1414,8 @@ void nas::parse_security_mode_command(uint32_t lcid, unique_byte_buffer_t pdu)
return;
}
logger.info("Sending Security Mode Complete nas_current_ctxt.tx_count=%d, RB=%s",
ctxt.tx_count,
rrc->get_rb_name(lcid).c_str());
logger.info(
"Sending Security Mode Complete nas_current_ctxt.tx_count=%d, RB=%s", ctxt.tx_count, rrc->get_rb_name(lcid));
rrc->write_sdu(std::move(pdu));
ctxt.tx_count++;

@ -157,7 +157,7 @@ public:
void write_pdu_mch(uint32_t lcid, unique_byte_buffer_t pdu);
void max_retx_attempted();
std::string get_rb_name(uint32_t lcid);
const char* get_rb_name(uint32_t lcid);
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu);

@ -1135,12 +1135,12 @@ void ttcn3_syssim::max_retx_attempted()
logger.error("%s not implemented.", __FUNCTION__);
}
std::string ttcn3_syssim::get_rb_name(uint32_t lcid)
const char* ttcn3_syssim::get_rb_name(uint32_t lcid)
{
if (lcid < rb_id_vec.size()) {
return rb_id_vec.at(lcid);
return rb_id_vec.at(lcid).c_str();
}
return std::string("RB");
return "RB";
};
void ttcn3_syssim::write_sdu(uint32_t lcid, unique_byte_buffer_t sdu)

@ -70,7 +70,7 @@ public:
void write_pdu_bcch_dlsch(unique_byte_buffer_t pdu) {}
void write_pdu_pcch(unique_byte_buffer_t pdu) {}
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
std::string get_rb_name(uint32_t lcid) { return std::string("lcid"); }
const char* get_rb_name(uint32_t lcid) { return "lcid"; }
void write_sdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
bool is_lcid_enabled(uint32_t lcid) { return false; }
};
@ -90,7 +90,7 @@ public:
// printf("NAS generated SDU (len=%d):\n", sdu->N_bytes);
// srsran_vec_fprint_byte(stdout, sdu->msg, sdu->N_bytes);
}
std::string get_rb_name(uint32_t lcid) { return std::string("lcid"); }
const char* get_rb_name(uint32_t lcid) { return "lcid"; }
uint32_t get_last_sdu_len() { return last_sdu_len; }
void reset() { last_sdu_len = 0; }

Loading…
Cancel
Save