rlc_am_nr: fixed issue with pointers from rx entity to tx entity

master
Pedro Alvarez 3 years ago
parent f99e841421
commit 123ac16653

@ -128,6 +128,7 @@ public:
{ {
public: public:
explicit rlc_am_base_tx(srslog::basic_logger* logger_) : logger(logger_) {} explicit rlc_am_base_tx(srslog::basic_logger* logger_) : logger(logger_) {}
virtual ~rlc_am_base_tx() = default;
virtual bool configure(const rlc_config_t& cfg_) = 0; virtual bool configure(const rlc_config_t& cfg_) = 0;
virtual void handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; virtual void handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
@ -168,6 +169,7 @@ public:
{ {
public: public:
explicit rlc_am_base_rx(rlc_am* parent_, srslog::basic_logger* logger_) : parent(parent_), logger(logger_) {} explicit rlc_am_base_rx(rlc_am* parent_, srslog::basic_logger* logger_) : parent(parent_), logger(logger_) {}
virtual ~rlc_am_base_rx() = default;
virtual bool configure(const rlc_config_t& cfg_) = 0; virtual bool configure(const rlc_config_t& cfg_) = 0;
virtual void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; virtual void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;

@ -97,6 +97,7 @@ public:
explicit rlc_am_lte_tx(rlc_am* parent_); explicit rlc_am_lte_tx(rlc_am* parent_);
~rlc_am_lte_tx() = default; ~rlc_am_lte_tx() = default;
void set_rx(rlc_am_lte_rx* rx_) { rx = rx_; };
bool configure(const rlc_config_t& cfg_); bool configure(const rlc_config_t& cfg_);
void empty_queue(); void empty_queue();
void reestablish(); void reestablish();
@ -198,9 +199,10 @@ private:
class rlc_am_lte_rx : public rlc_am::rlc_am_base_rx, public timer_callback class rlc_am_lte_rx : public rlc_am::rlc_am_base_rx, public timer_callback
{ {
public: public:
rlc_am_lte_rx(rlc_am* parent_); explicit rlc_am_lte_rx(rlc_am* parent_);
~rlc_am_lte_rx(); ~rlc_am_lte_rx() = default;
void set_tx(rlc_am_lte_tx* tx_) { tx = tx_; };
bool configure(const rlc_config_t& cfg_) final; bool configure(const rlc_config_t& cfg_) final;
void reestablish() final; void reestablish() final;
void stop() final; void stop() final;

@ -32,6 +32,9 @@ namespace srsran {
* RLC AM NR entity * RLC AM NR entity
* *
*****************************/ *****************************/
class rlc_am_nr_tx;
class rlc_am_nr_rx;
// Transmitter sub-class // Transmitter sub-class
class rlc_am_nr_tx : public rlc_am::rlc_am_base_tx class rlc_am_nr_tx : public rlc_am::rlc_am_base_tx
{ {
@ -39,6 +42,7 @@ public:
explicit rlc_am_nr_tx(rlc_am* parent_); explicit rlc_am_nr_tx(rlc_am* parent_);
~rlc_am_nr_tx() = default; ~rlc_am_nr_tx() = default;
void set_rx(rlc_am_nr_rx* rx_) { rx = rx_; }
bool configure(const rlc_config_t& cfg_) final; bool configure(const rlc_config_t& cfg_) final;
uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) final; uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) final;
void handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) final; void handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) final;
@ -57,6 +61,7 @@ public:
private: private:
rlc_am* parent = nullptr; rlc_am* parent = nullptr;
rlc_am_nr_rx* rx = nullptr;
/**************************************************************************** /****************************************************************************
* Configurable parameters * Configurable parameters
@ -87,6 +92,7 @@ public:
explicit rlc_am_nr_rx(rlc_am* parent_); explicit rlc_am_nr_rx(rlc_am* parent_);
~rlc_am_nr_rx() = default; ~rlc_am_nr_rx() = default;
void set_tx(rlc_am_nr_tx* tx_) { tx = tx_; }
bool configure(const rlc_config_t& cfg_) final; bool configure(const rlc_config_t& cfg_) final;
void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) final; void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) final;
@ -99,6 +105,7 @@ public:
private: private:
rlc_am* parent = nullptr; rlc_am* parent = nullptr;
rlc_am_nr_tx* tx = nullptr;
byte_buffer_pool* pool = nullptr; byte_buffer_pool* pool = nullptr;
/**************************************************************************** /****************************************************************************

@ -41,11 +41,19 @@ rlc_am::rlc_am(srsran_rat_t rat,
logger(logger), rrc(rrc_), pdcp(pdcp_), timers(timers_), lcid(lcid_) logger(logger), rrc(rrc_), pdcp(pdcp_), timers(timers_), lcid(lcid_)
{ {
if (rat == srsran_rat_t::lte) { if (rat == srsran_rat_t::lte) {
tx_base = std::unique_ptr<rlc_am_base_tx>(new rlc_am_lte_tx(this)); rlc_am_lte_tx* tx = new rlc_am_lte_tx(this);
rx_base = std::unique_ptr<rlc_am_base_rx>(new rlc_am_lte_rx(this)); rlc_am_lte_rx* rx = new rlc_am_lte_rx(this);
tx_base = std::unique_ptr<rlc_am_base_tx>(tx);
rx_base = std::unique_ptr<rlc_am_base_rx>(rx);
tx->set_rx(rx);
rx->set_tx(tx);
} else if (rat == srsran_rat_t::nr) { } else if (rat == srsran_rat_t::nr) {
tx_base = std::unique_ptr<rlc_am_base_tx>(new rlc_am_nr_tx(this)); rlc_am_nr_tx* tx = new rlc_am_nr_tx(this);
rx_base = std::unique_ptr<rlc_am_base_rx>(new rlc_am_nr_rx(this)); rlc_am_nr_rx* rx = new rlc_am_nr_rx(this);
tx_base = std::unique_ptr<rlc_am_base_tx>(tx);
rx_base = std::unique_ptr<rlc_am_base_rx>(rx);
tx->set_rx(rx);
rx->set_tx(tx);
} else { } else {
logger.error("Invalid RAT at entity initialization"); logger.error("Invalid RAT at entity initialization");
} }

@ -1191,11 +1191,7 @@ rlc_am_lte_rx::rlc_am_lte_rx(rlc_am* parent_) :
pool(byte_buffer_pool::get_instance()), pool(byte_buffer_pool::get_instance()),
reordering_timer(parent_->timers->get_unique_timer()), reordering_timer(parent_->timers->get_unique_timer()),
rlc_am_base_rx(parent_, &parent_->logger) rlc_am_base_rx(parent_, &parent_->logger)
{ {}
tx = dynamic_cast<rlc_am_lte_tx*>(parent->tx_base.get());
}
rlc_am_lte_rx::~rlc_am_lte_rx() {}
bool rlc_am_lte_rx::configure(const rlc_config_t& cfg_) bool rlc_am_lte_rx::configure(const rlc_config_t& cfg_)
{ {

Loading…
Cancel
Save