mirror of https://github.com/PentHertz/srsLTE.git
Moved write pdu to rlc_am_base::rlc_am_base_rx
This commit is contained in:
parent
476f9e1156
commit
54be15e7a6
|
@ -128,19 +128,20 @@ protected:
|
|||
explicit rlc_am_base_tx(srslog::basic_logger* logger_) : logger(logger_) {}
|
||||
|
||||
virtual bool configure(const rlc_config_t& cfg_) = 0;
|
||||
virtual void handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
|
||||
virtual uint32_t get_buffer_state() = 0;
|
||||
virtual void get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue) = 0;
|
||||
virtual void reestablish() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void empty_queue() = 0;
|
||||
virtual void discard_sdu(uint32_t pdcp_sn) = 0;
|
||||
virtual bool sdu_queue_is_full() = 0;
|
||||
virtual bool has_data() = 0;
|
||||
virtual uint32_t get_buffer_state() = 0;
|
||||
virtual void get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue) = 0;
|
||||
virtual uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
void set_bsr_callback(bsr_callback_t callback);
|
||||
|
||||
int write_sdu(unique_byte_buffer_t sdu);
|
||||
int write_sdu(unique_byte_buffer_t sdu);
|
||||
virtual uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
|
||||
|
||||
bool tx_enabled = false;
|
||||
byte_buffer_pool* pool = nullptr;
|
||||
|
@ -164,17 +165,20 @@ protected:
|
|||
class rlc_am_base_rx
|
||||
{
|
||||
public:
|
||||
explicit rlc_am_base_rx(srslog::basic_logger* logger_) : logger(logger_) {}
|
||||
explicit rlc_am_base_rx(rlc_am_base* parent_, srslog::basic_logger* logger_) : parent(parent_), logger(logger_) {}
|
||||
|
||||
virtual bool configure(const rlc_config_t& cfg_) = 0;
|
||||
virtual void reestablish() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void write_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
|
||||
virtual uint32_t get_sdu_rx_latency_ms() = 0;
|
||||
virtual uint32_t get_rx_buffered_bytes() = 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 reestablish() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual uint32_t get_sdu_rx_latency_ms() = 0;
|
||||
virtual uint32_t get_rx_buffered_bytes() = 0;
|
||||
|
||||
srslog::basic_logger* logger;
|
||||
byte_buffer_pool* pool = nullptr;
|
||||
void write_pdu(uint8_t* payload, uint32_t nof_bytes);
|
||||
|
||||
srslog::basic_logger* logger = nullptr;
|
||||
byte_buffer_pool* pool = nullptr;
|
||||
rlc_am_base* parent = nullptr;
|
||||
};
|
||||
|
||||
rlc_am_base_tx* tx_base = nullptr;
|
||||
|
|
|
@ -210,8 +210,6 @@ public:
|
|||
void reestablish() final;
|
||||
void stop() final;
|
||||
|
||||
void write_pdu(uint8_t* payload, uint32_t nof_bytes) final;
|
||||
|
||||
uint32_t get_rx_buffered_bytes() final; // returns sum of PDUs in rx_window
|
||||
uint32_t get_sdu_rx_latency_ms() final;
|
||||
|
||||
|
@ -224,7 +222,8 @@ public:
|
|||
bool get_do_status();
|
||||
|
||||
private:
|
||||
void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes, rlc_amd_pdu_header_t& header);
|
||||
void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) final;
|
||||
void handle_data_pdu_full(uint8_t* payload, uint32_t nof_bytes, rlc_amd_pdu_header_t& header);
|
||||
void handle_data_pdu_segment(uint8_t* payload, uint32_t nof_bytes, rlc_amd_pdu_header_t& header);
|
||||
void reassemble_rx_sdus();
|
||||
bool inside_rx_window(const int16_t sn);
|
||||
|
|
|
@ -46,20 +46,22 @@ public:
|
|||
explicit rlc_am_nr_tx(rlc_am_nr* parent_);
|
||||
~rlc_am_nr_tx() = default;
|
||||
|
||||
bool configure(const rlc_config_t& cfg_);
|
||||
void stop();
|
||||
bool configure(const rlc_config_t& cfg_) 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 discard_sdu(uint32_t discard_sn) final;
|
||||
bool sdu_queue_is_full() final;
|
||||
void reestablish() final;
|
||||
|
||||
int write_sdu(unique_byte_buffer_t sdu);
|
||||
uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes);
|
||||
void discard_sdu(uint32_t discard_sn);
|
||||
bool sdu_queue_is_full();
|
||||
void reestablish();
|
||||
|
||||
void empty_queue();
|
||||
bool has_data();
|
||||
uint32_t get_buffer_state();
|
||||
void empty_queue() final;
|
||||
bool has_data() final;
|
||||
uint32_t get_buffer_state() final;
|
||||
void get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue);
|
||||
|
||||
void stop() final;
|
||||
|
||||
private:
|
||||
rlc_am_nr* parent = nullptr;
|
||||
|
||||
|
@ -89,11 +91,13 @@ public:
|
|||
explicit rlc_am_nr_rx(rlc_am_nr* parent_);
|
||||
~rlc_am_nr_rx() = default;
|
||||
|
||||
bool configure(const rlc_config_t& cfg_);
|
||||
bool configure(const rlc_config_t& cfg_) final;
|
||||
|
||||
void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) final;
|
||||
|
||||
void stop();
|
||||
void reestablish();
|
||||
|
||||
void write_pdu(uint8_t* payload, uint32_t nof_bytes);
|
||||
uint32_t get_sdu_rx_latency_ms();
|
||||
uint32_t get_rx_buffered_bytes();
|
||||
|
||||
|
|
|
@ -212,4 +212,21 @@ void rlc_am_base::rlc_am_base_tx::set_bsr_callback(bsr_callback_t callback)
|
|||
bsr_callback = callback;
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
* RLC AM RX entity
|
||||
* This class is used for common code between the
|
||||
* LTE and NR TX entitites
|
||||
*******************************************************/
|
||||
void rlc_am_base::rlc_am_base_rx::write_pdu(uint8_t* payload, const uint32_t nof_bytes)
|
||||
{
|
||||
if (nof_bytes < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rlc_am_is_control_pdu(payload)) {
|
||||
parent->tx_base->handle_control_pdu(payload, nof_bytes);
|
||||
} else {
|
||||
handle_data_pdu(payload, nof_bytes);
|
||||
}
|
||||
}
|
||||
} // namespace srsran
|
||||
|
|
|
@ -1260,7 +1260,7 @@ rlc_am_lte::rlc_am_lte_rx::rlc_am_lte_rx(rlc_am_lte* parent_) :
|
|||
parent(parent_),
|
||||
pool(byte_buffer_pool::get_instance()),
|
||||
reordering_timer(parent_->timers->get_unique_timer()),
|
||||
rlc_am_base_rx(&parent_->logger)
|
||||
rlc_am_base_rx(parent_, &parent_->logger)
|
||||
{}
|
||||
|
||||
rlc_am_lte::rlc_am_lte_rx::~rlc_am_lte_rx() {}
|
||||
|
@ -1315,13 +1315,36 @@ void rlc_am_lte::rlc_am_lte_rx::stop()
|
|||
rx_window.clear();
|
||||
}
|
||||
|
||||
/** Called from stack thread when MAC has received a new RLC PDU
|
||||
*
|
||||
* @param payload Pointer to payload
|
||||
* @param nof_bytes Payload length
|
||||
*/
|
||||
void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_bytes)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
|
||||
rlc_amd_pdu_header_t header = {};
|
||||
uint32_t payload_len = nof_bytes;
|
||||
rlc_am_read_data_pdu_header(&payload, &payload_len, &header);
|
||||
if (payload_len > nof_bytes) {
|
||||
logger->info("Dropping corrupted PDU (%d B). Remaining length after header %d B.", nof_bytes, payload_len);
|
||||
return;
|
||||
}
|
||||
if (header.rf != 0) {
|
||||
handle_data_pdu_segment(payload, payload_len, header);
|
||||
} else {
|
||||
handle_data_pdu_full(payload, payload_len, header);
|
||||
}
|
||||
}
|
||||
|
||||
/** Called from stack thread when MAC has received a new RLC PDU
|
||||
*
|
||||
* @param payload Pointer to payload
|
||||
* @param nof_bytes Payload length
|
||||
* @param header Reference to PDU header (unpacked by caller)
|
||||
*/
|
||||
void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_bytes, rlc_amd_pdu_header_t& header)
|
||||
void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu_full(uint8_t* payload, uint32_t nof_bytes, rlc_amd_pdu_header_t& header)
|
||||
{
|
||||
std::map<uint32_t, rlc_amd_rx_pdu>::iterator it;
|
||||
|
||||
|
@ -1690,31 +1713,6 @@ bool rlc_am_lte::rlc_am_lte_rx::get_do_status()
|
|||
return do_status.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void rlc_am_lte::rlc_am_lte_rx::write_pdu(uint8_t* payload, const uint32_t nof_bytes)
|
||||
{
|
||||
if (nof_bytes < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rlc_am_is_control_pdu(payload)) {
|
||||
parent->tx->handle_control_pdu(payload, nof_bytes);
|
||||
} else {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
rlc_amd_pdu_header_t header = {};
|
||||
uint32_t payload_len = nof_bytes;
|
||||
rlc_am_read_data_pdu_header(&payload, &payload_len, &header);
|
||||
if (payload_len > nof_bytes) {
|
||||
logger->info("Dropping corrupted PDU (%d B). Remaining length after header %d B.", nof_bytes, payload_len);
|
||||
return;
|
||||
}
|
||||
if (header.rf) {
|
||||
handle_data_pdu_segment(payload, payload_len, header);
|
||||
} else {
|
||||
handle_data_pdu(payload, payload_len, header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t rlc_am_lte::rlc_am_lte_rx::get_rx_buffered_bytes()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
|
@ -2023,7 +2021,7 @@ bool rlc_am_lte::rlc_am_lte_rx::add_segment_and_check(rlc_amd_rx_pdu_segments_t*
|
|||
full_pdu->N_bytes += n;
|
||||
}
|
||||
|
||||
handle_data_pdu(full_pdu->msg, full_pdu->N_bytes, header);
|
||||
handle_data_pdu_full(full_pdu->msg, full_pdu->N_bytes, header);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,10 +66,7 @@ uint32_t rlc_am_nr::rlc_am_nr_tx::read_pdu(uint8_t* payload, uint32_t nof_bytes)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void rlc_am_nr::rlc_am_nr_tx::reestablish()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
void rlc_am_nr::rlc_am_nr_tx::handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) {}
|
||||
|
||||
uint32_t rlc_am_nr::rlc_am_nr_tx::get_buffer_state()
|
||||
{
|
||||
|
@ -83,6 +80,11 @@ int rlc_am_nr::rlc_am_nr_tx::write_sdu(unique_byte_buffer_t sdu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void rlc_am_nr::rlc_am_nr_tx::reestablish()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
void rlc_am_nr::rlc_am_nr_tx::discard_sdu(uint32_t discard_sn) {}
|
||||
|
||||
bool rlc_am_nr::rlc_am_nr_tx::sdu_queue_is_full()
|
||||
|
@ -98,7 +100,7 @@ void rlc_am_nr::rlc_am_nr_tx::stop() {}
|
|||
* Rx subclass implementation
|
||||
***************************************************************************/
|
||||
rlc_am_nr::rlc_am_nr_rx::rlc_am_nr_rx(rlc_am_nr* parent_) :
|
||||
parent(parent_), pool(byte_buffer_pool::get_instance()), rlc_am_base_rx(&parent_->logger)
|
||||
parent(parent_), pool(byte_buffer_pool::get_instance()), rlc_am_base_rx(parent_, &parent_->logger)
|
||||
{}
|
||||
|
||||
bool rlc_am_nr::rlc_am_nr_rx::configure(const rlc_config_t& cfg_)
|
||||
|
@ -108,9 +110,9 @@ bool rlc_am_nr::rlc_am_nr_rx::configure(const rlc_config_t& cfg_)
|
|||
return true;
|
||||
}
|
||||
|
||||
void rlc_am_nr::rlc_am_nr_rx::stop() {}
|
||||
void rlc_am_nr::rlc_am_nr_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_bytes) {}
|
||||
|
||||
void rlc_am_nr::rlc_am_nr_rx::write_pdu(uint8_t* payload, uint32_t nof_bytes) {}
|
||||
void rlc_am_nr::rlc_am_nr_rx::stop() {}
|
||||
|
||||
void rlc_am_nr::rlc_am_nr_rx::reestablish()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue