bugfix - remove extra \n from logging calls

master
Francisco 4 years ago committed by Francisco Paisana
parent 31b03fdd8a
commit d41b6187c1

@ -58,7 +58,7 @@ int mac_nr::init(const mac_nr_args_t& args_,
pcap->open(args.pcap.filename); pcap->open(args.pcap.filename);
} }
logger.info("Started\n"); logger.info("Started");
started = true; started = true;
@ -87,7 +87,7 @@ void mac_nr::get_dl_config(const uint32_t tti,
if (tti % 80 == 0) { if (tti % 80 == 0) {
// try to read BCH PDU from RRC // try to read BCH PDU from RRC
if (rrc_h->read_pdu_bcch_bch(tti, bcch_bch_payload) == SRSLTE_SUCCESS) { if (rrc_h->read_pdu_bcch_bch(tti, bcch_bch_payload) == SRSLTE_SUCCESS) {
logger.info("Adding BCH in TTI=%d\n", tti); logger.info("Adding BCH in TTI=%d", tti);
tx_request.pdus[tx_request.nof_pdus].pbch.mib_present = true; tx_request.pdus[tx_request.nof_pdus].pbch.mib_present = true;
tx_request.pdus[tx_request.nof_pdus].data[0] = bcch_bch_payload->msg; tx_request.pdus[tx_request.nof_pdus].data[0] = bcch_bch_payload->msg;
tx_request.pdus[tx_request.nof_pdus].length = bcch_bch_payload->N_bytes; tx_request.pdus[tx_request.nof_pdus].length = bcch_bch_payload->N_bytes;
@ -98,7 +98,7 @@ void mac_nr::get_dl_config(const uint32_t tti,
pcap->write_dl_bch(bcch_bch_payload->msg, bcch_bch_payload->N_bytes, 0xffff, 0, tti); pcap->write_dl_bch(bcch_bch_payload->msg, bcch_bch_payload->N_bytes, 0xffff, 0, tti);
} }
} else { } else {
logger.error("Couldn't read BCH payload from RRC\n"); logger.error("Couldn't read BCH payload from RRC");
} }
} }
@ -106,7 +106,7 @@ void mac_nr::get_dl_config(const uint32_t tti,
for (auto& sib : bcch_dlsch_payload) { for (auto& sib : bcch_dlsch_payload) {
if (sib.payload->N_bytes > 0) { if (sib.payload->N_bytes > 0) {
if (tti % (sib.periodicity * 10) == 0) { if (tti % (sib.periodicity * 10) == 0) {
logger.info("Adding SIB %d in TTI=%d\n", sib.index, tti); logger.info("Adding SIB %d in TTI=%d", sib.index, tti);
tx_request.pdus[tx_request.nof_pdus].data[0] = sib.payload->msg; tx_request.pdus[tx_request.nof_pdus].data[0] = sib.payload->msg;
tx_request.pdus[tx_request.nof_pdus].length = sib.payload->N_bytes; tx_request.pdus[tx_request.nof_pdus].length = sib.payload->N_bytes;
@ -134,9 +134,9 @@ void mac_nr::get_dl_config(const uint32_t tti,
// Only create PDU if RLC has something to tx // Only create PDU if RLC has something to tx
if (pdu_len > 0) { if (pdu_len > 0) {
logger.info("Adding MAC PDU for RNTI=%d\n", args.rnti); logger.info("Adding MAC PDU for RNTI=%d", args.rnti);
ue_rlc_buffer->N_bytes = pdu_len; ue_rlc_buffer->N_bytes = pdu_len;
logger.info(ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes, "Read %d B from RLC\n", ue_rlc_buffer->N_bytes); logger.info(ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes, "Read %d B from RLC", ue_rlc_buffer->N_bytes);
// add to MAC PDU and pack // add to MAC PDU and pack
ue_tx_pdu.add_sdu(4, ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes); ue_tx_pdu.add_sdu(4, ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes);
@ -144,7 +144,7 @@ void mac_nr::get_dl_config(const uint32_t tti,
logger.debug(ue_tx_buffer.at(buffer_index)->msg, logger.debug(ue_tx_buffer.at(buffer_index)->msg,
ue_tx_buffer.at(buffer_index)->N_bytes, ue_tx_buffer.at(buffer_index)->N_bytes,
"Generated MAC PDU (%d B)\n", "Generated MAC PDU (%d B)",
ue_tx_buffer.at(buffer_index)->N_bytes); ue_tx_buffer.at(buffer_index)->N_bytes);
tx_request.pdus[tx_request.nof_pdus].data[0] = ue_tx_buffer.at(buffer_index)->msg; tx_request.pdus[tx_request.nof_pdus].data[0] = ue_tx_buffer.at(buffer_index)->msg;
@ -216,14 +216,14 @@ void mac_nr::process_pdus()
int mac_nr::handle_pdu(srslte::unique_byte_buffer_t pdu) int mac_nr::handle_pdu(srslte::unique_byte_buffer_t pdu)
{ {
logger.info(pdu->msg, pdu->N_bytes, "Handling MAC PDU (%d B)\n", pdu->N_bytes); logger.info(pdu->msg, pdu->N_bytes, "Handling MAC PDU (%d B)", pdu->N_bytes);
ue_rx_pdu.init_rx(true); ue_rx_pdu.init_rx(true);
ue_rx_pdu.unpack(pdu->msg, pdu->N_bytes); ue_rx_pdu.unpack(pdu->msg, pdu->N_bytes);
for (uint32_t i = 0; i < ue_rx_pdu.get_num_subpdus(); ++i) { for (uint32_t i = 0; i < ue_rx_pdu.get_num_subpdus(); ++i) {
srslte::mac_sch_subpdu_nr subpdu = ue_rx_pdu.get_subpdu(i); srslte::mac_sch_subpdu_nr subpdu = ue_rx_pdu.get_subpdu(i);
logger.info("Handling subPDU %d/%d: lcid=%d, sdu_len=%d\n", logger.info("Handling subPDU %d/%d: lcid=%d, sdu_len=%d",
i, i,
ue_rx_pdu.get_num_subpdus(), ue_rx_pdu.get_num_subpdus(),
subpdu.get_lcid(), subpdu.get_lcid(),
@ -246,10 +246,10 @@ int mac_nr::cell_cfg(srsenb::sched_interface::cell_cfg_t* cell_cfg)
sib.periodicity = cell_cfg->sibs->period_rf; sib.periodicity = cell_cfg->sibs->period_rf;
sib.payload = srslte::make_byte_buffer(); sib.payload = srslte::make_byte_buffer();
if (rrc_h->read_pdu_bcch_dlsch(sib.index, sib.payload) != SRSLTE_SUCCESS) { if (rrc_h->read_pdu_bcch_dlsch(sib.index, sib.payload) != SRSLTE_SUCCESS) {
logger.error("Couldn't read SIB %d from RRC\n", sib.index); logger.error("Couldn't read SIB %d from RRC", sib.index);
} }
logger.info("Including SIB %d into SI scheduling\n", sib.index); logger.info("Including SIB %d into SI scheduling", sib.index);
bcch_dlsch_payload.push_back(std::move(sib)); bcch_dlsch_payload.push_back(std::move(sib));
} }
} }

@ -50,7 +50,7 @@ void rrc_nr::init(const rrc_nr_cfg_t& cfg_,
config_mac(); config_mac();
// add dummy user // 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); add_user(cfg.coreless.rnti);
srslte::rlc_config_t rlc_cnfg = srslte::rlc_config_t::default_rlc_um_nr_config(6); 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); 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}; false};
pdcp->add_bearer(cfg.coreless.rnti, cfg.coreless.drb_lcid, pdcp_cnfg); pdcp->add_bearer(cfg.coreless.rnti, cfg.coreless.drb_lcid, pdcp_cnfg);
logger.info("Started\n"); logger.info("Started");
running = true; running = true;
} }
@ -88,14 +88,14 @@ void rrc_nr::log_rrc_message(const std::string& source,
msg.to_json(json_writer); msg.to_json(json_writer);
logger.debug(pdu->msg, logger.debug(pdu->msg,
pdu->N_bytes, pdu->N_bytes,
"%s - %s %s (%d B)\n", "%s - %s %s (%d B)",
source.c_str(), source.c_str(),
dir == Tx ? "Tx" : "Rx", dir == Tx ? "Tx" : "Rx",
msg.msg.c1().type().to_string().c_str(), msg.msg.c1().type().to_string().c_str(),
pdu->N_bytes); 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()) { } else if (logger.info.enabled()) {
logger.info("%s - %s %s (%d B)\n", logger.info("%s - %s %s (%d B)",
source.c_str(), source.c_str(),
dir == Tx ? "Tx" : "Rx", dir == Tx ? "Tx" : "Rx",
msg.msg.c1().type().to_string().c_str(), 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)))); users.insert(std::make_pair(rnti, std::unique_ptr<ue>(new ue(this, rnti))));
rlc->add_user(rnti); rlc->add_user(rnti);
pdcp->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 { } 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 // PUCCH width
sched_cfg.nrb_pucch = SRSLTE_MAX(cfg.sr_cfg.nof_prb, cfg.cqi_cfg.nof_prb); 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 // Copy Cell configuration
sched_cfg.cell = cfg.cell; 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()); asn1::bit_ref bref(mib_buf->msg, mib_buf->get_tailroom());
mib_msg.pack(bref); mib_msg.pack(bref);
mib_buf->N_bytes = bref.distance_bytes(); 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); 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) int rrc_nr::read_pdu_bcch_dlsch(uint32_t sib_index, srslte::unique_byte_buffer_t& buffer)
{ {
if (sib_index >= sib_buffer.size()) { 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; return SRSLTE_ERROR;
} }
if (buffer->get_tailroom() < sib_buffer[sib_index]->N_bytes) { 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, sib_index,
buffer->get_tailroom(), buffer->get_tailroom(),
sib_buffer[sib_index]->N_bytes); 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; break;
} }
} else { } 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 // Allocate a new PDU buffer, pack the message and send to PDCP
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer(); srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu == nullptr) { if (pdu == nullptr) {
parent->logger.error("Allocating pdu\n"); parent->logger.error("Allocating pdu");
} }
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom()); asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
if (dl_ccch_msg->pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) { 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(); pdu->N_bytes = bref.distance_bytes();

@ -96,7 +96,7 @@ void pdcp_nr::write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer
if (users.count(rnti)) { if (users.count(rnti)) {
users[rnti].pdcp->write_pdu(lcid, std::move(sdu)); users[rnti].pdcp->write_pdu(lcid, std::move(sdu));
} else { } else {
logger.error("Can't write PDU. RNTI=0x%X doesn't exist.\n", rnti); logger.error("Can't write PDU. RNTI=0x%X doesn't exist.", rnti);
} }
} }
@ -105,7 +105,7 @@ void pdcp_nr::notify_delivery(uint16_t rnti, uint32_t lcid, const srslte::pdcp_s
if (users.count(rnti)) { if (users.count(rnti)) {
users[rnti].pdcp->notify_delivery(lcid, pdcp_sns); users[rnti].pdcp->notify_delivery(lcid, pdcp_sns);
} else { } else {
logger.error("Can't notify Ack of PDU. RNTI=0x%X doesn't exist.\n", rnti); logger.error("Can't notify Ack of PDU. RNTI=0x%X doesn't exist.", rnti);
} }
} }
@ -114,7 +114,7 @@ void pdcp_nr::notify_failure(uint16_t rnti, uint32_t lcid, const srslte::pdcp_sn
if (users.count(rnti)) { if (users.count(rnti)) {
users[rnti].pdcp->notify_failure(lcid, pdcp_sns); users[rnti].pdcp->notify_failure(lcid, pdcp_sns);
} else { } else {
logger.error("Can't notify Ack of PDU. RNTI=0x%X doesn't exist.\n", rnti); logger.error("Can't notify Ack of PDU. RNTI=0x%X doesn't exist.", rnti);
} }
} }
@ -123,7 +123,7 @@ void pdcp_nr::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer
if (users.count(rnti)) { if (users.count(rnti)) {
users[rnti].pdcp->write_sdu(lcid, std::move(sdu)); users[rnti].pdcp->write_sdu(lcid, std::move(sdu));
} else { } else {
logger.error("Can't write SDU. RNTI=0x%X doesn't exist.\n", rnti); logger.error("Can't write SDU. RNTI=0x%X doesn't exist.", rnti);
} }
} }

@ -56,7 +56,7 @@ void rlc_nr::rem_user(uint16_t rnti)
users[rnti].m_rlc->stop(); users[rnti].m_rlc->stop();
users.erase(rnti); users.erase(rnti);
} else { } else {
logger.error("Removing rnti=0x%x. Already removed\n", rnti); logger.error("Removing rnti=0x%x. Already removed", rnti);
} }
} }
@ -67,7 +67,7 @@ void rlc_nr::clear_buffer(uint16_t rnti)
for (int i = 0; i < SRSLTE_N_RADIO_BEARERS; i++) { for (int i = 0; i < SRSLTE_N_RADIO_BEARERS; i++) {
m_mac->rlc_buffer_state(rnti, i, 0, 0); m_mac->rlc_buffer_state(rnti, i, 0, 0);
} }
logger.info("Cleared buffer rnti=0x%x\n", rnti); logger.info("Cleared buffer rnti=0x%x", rnti);
} }
} }
@ -107,7 +107,7 @@ int rlc_nr::read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t no
// communicate buffer state every time a PDU is read // communicate buffer state every time a PDU is read
uint32_t retx_queue = 0; uint32_t retx_queue = 0;
logger.debug("Buffer state PDCP: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue); logger.debug("Buffer state PDCP: rnti=0x%x, lcid=%d, tx_queue=%d", rnti, lcid, tx_queue);
m_mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue); m_mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
} else { } else {
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;
@ -124,7 +124,7 @@ void rlc_nr::write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t
// communicate buffer state every time a new PDU is written // communicate buffer state every time a new PDU is written
uint32_t tx_queue = users[rnti].m_rlc->get_buffer_state(lcid); uint32_t tx_queue = users[rnti].m_rlc->get_buffer_state(lcid);
uint32_t retx_queue = 0; uint32_t retx_queue = 0;
logger.debug("Buffer state PDCP: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue); logger.debug("Buffer state PDCP: rnti=0x%x, lcid=%d, tx_queue=%d", rnti, lcid, tx_queue);
m_mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue); m_mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
} }
} }
@ -152,7 +152,7 @@ void rlc_nr::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_
uint32_t retx_queue = 0; uint32_t retx_queue = 0;
m_mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue); m_mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
logger.info("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue); logger.info("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d", rnti, lcid, tx_queue);
} }
} }

Loading…
Cancel
Save