mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
4.0 KiB
C
122 lines
4.0 KiB
C
4 years ago
|
/**
|
||
8 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
8 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
8 years ago
|
*
|
||
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_RLC_H
|
||
|
#define SRSRAN_RLC_H
|
||
8 years ago
|
|
||
4 years ago
|
#include "srsran/common/buffer_pool.h"
|
||
|
#include "srsran/common/common.h"
|
||
|
#include "srsran/common/task_scheduler.h"
|
||
|
#include "srsran/interfaces/ue_pdcp_interfaces.h"
|
||
|
#include "srsran/interfaces/ue_rlc_interfaces.h"
|
||
|
#include "srsran/interfaces/ue_rrc_interfaces.h"
|
||
4 years ago
|
#include "srsran/rlc/rlc_common.h"
|
||
|
#include "srsran/rlc/rlc_metrics.h"
|
||
8 years ago
|
|
||
4 years ago
|
namespace srsran {
|
||
8 years ago
|
|
||
|
/****************************************************************************
|
||
|
* RLC Layer
|
||
|
* Ref: 3GPP TS 36.322 v10.0.0
|
||
|
* Single interface for RLC layer - contains separate RLC entities for
|
||
|
* each bearer.
|
||
|
***************************************************************************/
|
||
5 years ago
|
class rlc : public srsue::rlc_interface_mac, public srsue::rlc_interface_pdcp, public srsue::rlc_interface_rrc
|
||
8 years ago
|
{
|
||
|
public:
|
||
5 years ago
|
rlc(const char* logname);
|
||
7 years ago
|
virtual ~rlc();
|
||
5 years ago
|
void init(srsue::pdcp_interface_rlc* pdcp_,
|
||
|
srsue::rrc_interface_rlc* rrc_,
|
||
4 years ago
|
srsran::timer_handler* timers_,
|
||
5 years ago
|
uint32_t lcid_);
|
||
4 years ago
|
|
||
5 years ago
|
void init(srsue::pdcp_interface_rlc* pdcp_,
|
||
|
srsue::rrc_interface_rlc* rrc_,
|
||
4 years ago
|
srsran::timer_handler* timers_,
|
||
5 years ago
|
uint32_t lcid_,
|
||
|
bsr_callback_t bsr_callback_);
|
||
8 years ago
|
void stop();
|
||
|
|
||
4 years ago
|
void get_metrics(rlc_metrics_t& m, const uint32_t nof_tti);
|
||
8 years ago
|
|
||
|
// PDCP interface
|
||
5 years ago
|
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu);
|
||
6 years ago
|
void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu);
|
||
7 years ago
|
bool rb_is_um(uint32_t lcid);
|
||
5 years ago
|
void discard_sdu(uint32_t lcid, uint32_t discard_sn);
|
||
5 years ago
|
bool sdu_queue_is_full(uint32_t lcid);
|
||
8 years ago
|
|
||
|
// MAC interface
|
||
5 years ago
|
bool has_data_locked(const uint32_t lcid);
|
||
6 years ago
|
uint32_t get_buffer_state(const uint32_t lcid);
|
||
7 years ago
|
uint32_t get_total_mch_buffer_state(uint32_t lcid);
|
||
4 years ago
|
uint32_t read_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
|
||
|
uint32_t read_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
|
||
7 years ago
|
int get_increment_sequence_num();
|
||
5 years ago
|
void write_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
|
||
4 years ago
|
void write_pdu_bcch_bch(srsran::unique_byte_buffer_t pdu);
|
||
5 years ago
|
void write_pdu_bcch_dlsch(uint8_t* payload, uint32_t nof_bytes);
|
||
4 years ago
|
void write_pdu_pcch(srsran::unique_byte_buffer_t pdu);
|
||
5 years ago
|
void write_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
|
||
8 years ago
|
|
||
|
// RRC interface
|
||
5 years ago
|
bool is_suspended(const uint32_t lcid);
|
||
|
bool has_data(const uint32_t lcid);
|
||
7 years ago
|
void reestablish();
|
||
6 years ago
|
void reestablish(uint32_t lcid);
|
||
8 years ago
|
void reset();
|
||
7 years ago
|
void empty_queue();
|
||
4 years ago
|
int add_bearer(uint32_t lcid, const rlc_config_t& cnfg);
|
||
|
int add_bearer_mrb(uint32_t lcid);
|
||
6 years ago
|
void del_bearer(uint32_t lcid);
|
||
6 years ago
|
void del_bearer_mrb(uint32_t lcid);
|
||
6 years ago
|
void suspend_bearer(uint32_t lcid);
|
||
6 years ago
|
void resume_bearer(uint32_t lcid);
|
||
6 years ago
|
void change_lcid(uint32_t old_lcid, uint32_t new_lcid);
|
||
6 years ago
|
bool has_bearer(uint32_t lcid);
|
||
7 years ago
|
|
||
8 years ago
|
private:
|
||
6 years ago
|
void reset_metrics();
|
||
|
|
||
4 years ago
|
srslog::basic_logger& logger;
|
||
4 years ago
|
byte_buffer_pool* pool = nullptr;
|
||
5 years ago
|
srsue::pdcp_interface_rlc* pdcp = nullptr;
|
||
|
srsue::rrc_interface_rlc* rrc = nullptr;
|
||
4 years ago
|
srsran::timer_handler* timers = nullptr;
|
||
7 years ago
|
|
||
4 years ago
|
typedef std::map<uint16_t, std::unique_ptr<rlc_common> > rlc_map_t;
|
||
|
typedef std::pair<uint16_t, std::unique_ptr<rlc_common> > rlc_map_pair_t;
|
||
7 years ago
|
|
||
5 years ago
|
rlc_map_t rlc_array, rlc_array_mrb;
|
||
7 years ago
|
pthread_rwlock_t rwlock;
|
||
|
|
||
6 years ago
|
uint32_t default_lcid = 0;
|
||
8 years ago
|
|
||
5 years ago
|
bsr_callback_t bsr_callback = nullptr;
|
||
|
|
||
7 years ago
|
// Timer needed for metrics calculation
|
||
4 years ago
|
std::chrono::high_resolution_clock::time_point metrics_tp;
|
||
8 years ago
|
|
||
|
bool valid_lcid(uint32_t lcid);
|
||
7 years ago
|
bool valid_lcid_mrb(uint32_t lcid);
|
||
5 years ago
|
|
||
|
void update_bsr(uint32_t lcid);
|
||
|
void update_bsr_mch(uint32_t lcid);
|
||
8 years ago
|
};
|
||
|
|
||
5 years ago
|
void rlc_bearer_metrics_print(const rlc_bearer_metrics_t& metrics);
|
||
|
|
||
4 years ago
|
} // namespace srsran
|
||
8 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_RLC_H
|