|
|
|
@ -50,7 +50,7 @@ void rrc_nr::init(const rrc_nr_cfg_t& cfg_,
|
|
|
|
|
config_mac();
|
|
|
|
|
|
|
|
|
|
// add dummy user
|
|
|
|
|
logger.info("Creating dummy DRB for RNTI=%d on LCID=%d\n", cfg.coreless.rnti, cfg.coreless.drb_lcid);
|
|
|
|
|
logger.info("Creating dummy DRB for RNTI=%d on LCID=%d", cfg.coreless.rnti, cfg.coreless.drb_lcid);
|
|
|
|
|
add_user(cfg.coreless.rnti);
|
|
|
|
|
srslte::rlc_config_t rlc_cnfg = srslte::rlc_config_t::default_rlc_um_nr_config(6);
|
|
|
|
|
rlc->add_bearer(cfg.coreless.rnti, cfg.coreless.drb_lcid, rlc_cnfg);
|
|
|
|
@ -64,7 +64,7 @@ void rrc_nr::init(const rrc_nr_cfg_t& cfg_,
|
|
|
|
|
false};
|
|
|
|
|
pdcp->add_bearer(cfg.coreless.rnti, cfg.coreless.drb_lcid, pdcp_cnfg);
|
|
|
|
|
|
|
|
|
|
logger.info("Started\n");
|
|
|
|
|
logger.info("Started");
|
|
|
|
|
|
|
|
|
|
running = true;
|
|
|
|
|
}
|
|
|
|
@ -88,14 +88,14 @@ void rrc_nr::log_rrc_message(const std::string& source,
|
|
|
|
|
msg.to_json(json_writer);
|
|
|
|
|
logger.debug(pdu->msg,
|
|
|
|
|
pdu->N_bytes,
|
|
|
|
|
"%s - %s %s (%d B)\n",
|
|
|
|
|
"%s - %s %s (%d B)",
|
|
|
|
|
source.c_str(),
|
|
|
|
|
dir == Tx ? "Tx" : "Rx",
|
|
|
|
|
msg.msg.c1().type().to_string().c_str(),
|
|
|
|
|
pdu->N_bytes);
|
|
|
|
|
logger.debug("Content:\n%s\n", json_writer.to_string().c_str());
|
|
|
|
|
logger.debug("Content:\n%s", json_writer.to_string().c_str());
|
|
|
|
|
} else if (logger.info.enabled()) {
|
|
|
|
|
logger.info("%s - %s %s (%d B)\n",
|
|
|
|
|
logger.info("%s - %s %s (%d B)",
|
|
|
|
|
source.c_str(),
|
|
|
|
|
dir == Tx ? "Tx" : "Rx",
|
|
|
|
|
msg.msg.c1().type().to_string().c_str(),
|
|
|
|
@ -170,9 +170,9 @@ void rrc_nr::add_user(uint16_t rnti)
|
|
|
|
|
users.insert(std::make_pair(rnti, std::unique_ptr<ue>(new ue(this, rnti))));
|
|
|
|
|
rlc->add_user(rnti);
|
|
|
|
|
pdcp->add_user(rnti);
|
|
|
|
|
logger.info("Added new user rnti=0x%x\n", rnti);
|
|
|
|
|
logger.info("Added new user rnti=0x%x", rnti);
|
|
|
|
|
} else {
|
|
|
|
|
logger.error("Adding user rnti=0x%x (already exists)\n", rnti);
|
|
|
|
|
logger.error("Adding user rnti=0x%x (already exists)", rnti);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -189,7 +189,7 @@ void rrc_nr::config_mac()
|
|
|
|
|
|
|
|
|
|
// PUCCH width
|
|
|
|
|
sched_cfg.nrb_pucch = SRSLTE_MAX(cfg.sr_cfg.nof_prb, cfg.cqi_cfg.nof_prb);
|
|
|
|
|
logger.info("Allocating %d PRBs for PUCCH\n", sched_cfg.nrb_pucch);
|
|
|
|
|
logger.info("Allocating %d PRBs for PUCCH", sched_cfg.nrb_pucch);
|
|
|
|
|
|
|
|
|
|
// Copy Cell configuration
|
|
|
|
|
sched_cfg.cell = cfg.cell;
|
|
|
|
@ -209,7 +209,7 @@ uint32_t rrc_nr::generate_sibs()
|
|
|
|
|
asn1::bit_ref bref(mib_buf->msg, mib_buf->get_tailroom());
|
|
|
|
|
mib_msg.pack(bref);
|
|
|
|
|
mib_buf->N_bytes = bref.distance_bytes();
|
|
|
|
|
logger.debug(mib_buf->msg, mib_buf->N_bytes, "MIB payload (%d B)\n", mib_buf->N_bytes);
|
|
|
|
|
logger.debug(mib_buf->msg, mib_buf->N_bytes, "MIB payload (%d B)", mib_buf->N_bytes);
|
|
|
|
|
mib_buffer = std::move(mib_buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -269,12 +269,12 @@ int rrc_nr::read_pdu_bcch_bch(const uint32_t tti, srslte::unique_byte_buffer_t&
|
|
|
|
|
int rrc_nr::read_pdu_bcch_dlsch(uint32_t sib_index, srslte::unique_byte_buffer_t& buffer)
|
|
|
|
|
{
|
|
|
|
|
if (sib_index >= sib_buffer.size()) {
|
|
|
|
|
logger.error("SIB %d is not a configured SIB.\n", sib_index);
|
|
|
|
|
logger.error("SIB %d is not a configured SIB.", sib_index);
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (buffer->get_tailroom() < sib_buffer[sib_index]->N_bytes) {
|
|
|
|
|
logger.error("Not enough space to fit SIB %d into buffer (%d < %d)\n",
|
|
|
|
|
logger.error("Not enough space to fit SIB %d into buffer (%d < %d)",
|
|
|
|
|
sib_index,
|
|
|
|
|
buffer->get_tailroom(),
|
|
|
|
|
sib_buffer[sib_index]->N_bytes);
|
|
|
|
@ -312,7 +312,7 @@ void rrc_nr::handle_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
logger.warning("Discarding PDU for removed rnti=0x%x\n", rnti);
|
|
|
|
|
logger.warning("Discarding PDU for removed rnti=0x%x", rnti);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -369,11 +369,11 @@ void rrc_nr::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
|
|
|
|
|
// Allocate a new PDU buffer, pack the message and send to PDCP
|
|
|
|
|
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
|
|
|
|
|
if (pdu == nullptr) {
|
|
|
|
|
parent->logger.error("Allocating pdu\n");
|
|
|
|
|
parent->logger.error("Allocating pdu");
|
|
|
|
|
}
|
|
|
|
|
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
|
|
|
|
|
if (dl_ccch_msg->pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) {
|
|
|
|
|
parent->logger.error("Failed to pack DL-CCCH message. Discarding msg.\n");
|
|
|
|
|
parent->logger.error("Failed to pack DL-CCCH message. Discarding msg.");
|
|
|
|
|
}
|
|
|
|
|
pdu->N_bytes = bref.distance_bytes();
|
|
|
|
|
|
|
|
|
|