mirror of https://github.com/PentHertz/srsLTE.git
nr,gnb,pdcp: store the PDCP RB name in base class for easier use
This commit is contained in:
parent
3c18e7c1f3
commit
c64be663d2
|
@ -133,6 +133,8 @@ public:
|
|||
virtual pdcp_bearer_metrics_t get_metrics() = 0;
|
||||
virtual void reset_metrics() = 0;
|
||||
|
||||
const char* get_rb_name() const { return rb_name.c_str(); }
|
||||
|
||||
protected:
|
||||
srslog::basic_logger& logger;
|
||||
srsran::task_sched_handle task_sched;
|
||||
|
@ -154,6 +156,7 @@ protected:
|
|||
pdcp_discard_timer_t::infinity,
|
||||
false,
|
||||
srsran_rat_t::lte};
|
||||
std::string rb_name;
|
||||
|
||||
srsran::as_security_config_t sec_cfg = {};
|
||||
|
||||
|
|
|
@ -156,9 +156,6 @@ private:
|
|||
uint32_t reordering_window = 0;
|
||||
uint32_t maximum_pdcp_sn = 0;
|
||||
|
||||
std::string get_rb_name() const;
|
||||
void get_rb_name(fmt::memory_buffer& fmtbuf) const;
|
||||
|
||||
// PDU handlers
|
||||
void handle_control_pdu(srsran::unique_byte_buffer_t pdu);
|
||||
void handle_srb_pdu(srsran::unique_byte_buffer_t pdu);
|
||||
|
|
|
@ -166,10 +166,10 @@ void pdcp::del_bearer(uint32_t lcid)
|
|||
valid_lcids_cached.erase(lcid);
|
||||
}
|
||||
if (valid_lcid(lcid)) {
|
||||
logger.info("Deleted PDCP bearer %s", pdcp_array[lcid]->get_rb_name());
|
||||
pdcp_array.erase(lcid);
|
||||
logger.info("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));
|
||||
logger.warning("Can't delete bearer with LCID=%s. Cause: bearer doesn't exist.", lcid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,16 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_)
|
|||
if (active) {
|
||||
// Already configured
|
||||
if (cnfg_ != cfg) {
|
||||
logger.error("Bearer reconfiguration not supported. LCID=%s.", get_rb_name().c_str());
|
||||
logger.error("Bearer reconfiguration not supported. LCID=%s.", rb_name.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cfg = cnfg_;
|
||||
cfg = cnfg_;
|
||||
rb_name = cfg.rb_type == PDCP_RB_IS_DRB ? "DRB" : "SRB";
|
||||
rb_name += std::to_string(cfg.bearer_id);
|
||||
|
||||
maximum_pdcp_sn = (1u << cfg.sn_len) - 1u;
|
||||
st.last_submitted_pdcp_rx_sn = maximum_pdcp_sn;
|
||||
if (is_srb()) {
|
||||
|
@ -79,7 +82,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", get_rb_name().c_str(), cfg.bearer_id);
|
||||
logger.info("Init %s with bearer ID: %d", rb_name.c_str(), 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,
|
||||
|
@ -104,7 +107,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", get_rb_name().c_str(), cfg.bearer_id);
|
||||
logger.info("Re-establish %s with bearer ID: %d", rb_name.c_str(), cfg.bearer_id);
|
||||
// For SRBs
|
||||
if (is_srb()) {
|
||||
st.next_pdcp_tx_sn = 0;
|
||||
|
@ -126,7 +129,7 @@ void pdcp_entity_lte::reestablish()
|
|||
void pdcp_entity_lte::reset()
|
||||
{
|
||||
if (active) {
|
||||
logger.debug("Reset %s", get_rb_name().c_str());
|
||||
logger.debug("Reset %s", rb_name.c_str());
|
||||
}
|
||||
active = false;
|
||||
}
|
||||
|
@ -135,7 +138,7 @@ void pdcp_entity_lte::reset()
|
|||
void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
|
||||
{
|
||||
if (!active) {
|
||||
logger.warning("Dropping %s SDU due to inactive bearer", get_rb_name().c_str());
|
||||
logger.warning("Dropping %s SDU due to inactive bearer", rb_name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,7 +148,7 @@ 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", get_rb_name().c_str());
|
||||
logger.info(sdu->msg, sdu->N_bytes, "Dropping %s SDU due to full queue", rb_name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -199,7 +202,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",
|
||||
get_rb_name().c_str(),
|
||||
rb_name.c_str(),
|
||||
used_sn,
|
||||
srsran_direction_text[integrity_direction],
|
||||
srsran_direction_text[encryption_direction]);
|
||||
|
@ -226,7 +229,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
|
|||
void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
|
||||
{
|
||||
if (!active) {
|
||||
logger.warning("Dropping %s PDU due to inactive bearer", get_rb_name());
|
||||
logger.warning("Dropping %s PDU due to inactive bearer", rb_name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -256,7 +259,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)",
|
||||
get_rb_name(),
|
||||
rb_name.c_str(),
|
||||
sn,
|
||||
pdu->N_bytes,
|
||||
srsran_direction_text[integrity_direction],
|
||||
|
@ -316,7 +319,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", get_rb_name(), sn);
|
||||
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rb_name.c_str(), sn);
|
||||
|
||||
// Extract MAC
|
||||
uint8_t mac[4];
|
||||
|
@ -325,7 +328,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", get_rb_name());
|
||||
logger.error(pdu->msg, pdu->N_bytes, "%s Dropping PDU", rb_name.c_str());
|
||||
rrc->notify_pdcp_integrity_error(lcid);
|
||||
return; // Discard
|
||||
}
|
||||
|
@ -364,7 +367,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", get_rb_name(), sn);
|
||||
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx PDU SN=%d", rb_name.c_str(), sn);
|
||||
|
||||
st.next_pdcp_rx_sn = sn + 1;
|
||||
if (st.next_pdcp_rx_sn > maximum_pdcp_sn) {
|
||||
|
@ -428,7 +431,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", get_rb_name(), sn);
|
||||
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rb_name.c_str(), sn);
|
||||
|
||||
// Update info on last PDU submitted to upper layers
|
||||
st.last_submitted_pdcp_rx_sn = sn;
|
||||
|
@ -857,24 +860,6 @@ void pdcp_entity_lte::reset_metrics()
|
|||
metrics.tx_notification_latency_ms = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Logging helpers
|
||||
***************************************************************************/
|
||||
std::string pdcp_entity_lte::get_rb_name() const
|
||||
{
|
||||
fmt::memory_buffer fmtbuf;
|
||||
get_rb_name(fmtbuf);
|
||||
return fmt::to_string(fmtbuf);
|
||||
}
|
||||
void pdcp_entity_lte::get_rb_name(fmt::memory_buffer& fmtbuf) const
|
||||
{
|
||||
if (cfg.rb_type == PDCP_RB_IS_DRB) {
|
||||
fmt::format_to(fmtbuf, "DRB{}", cfg.bearer_id);
|
||||
} else {
|
||||
fmt::format_to(fmtbuf, "SRB{}", cfg.bearer_id);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Undelivered SDUs queue helpers
|
||||
***************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue