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.
129 lines
3.9 KiB
C
129 lines
3.9 KiB
C
4 years ago
|
/**
|
||
5 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
5 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
5 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.
|
||
5 years ago
|
*
|
||
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_RLC_UM_LTE_H
|
||
|
#define SRSRAN_RLC_UM_LTE_H
|
||
5 years ago
|
|
||
4 years ago
|
#include "srsran/common/buffer_pool.h"
|
||
|
#include "srsran/common/common.h"
|
||
4 years ago
|
#include "srsran/rlc/rlc_um_base.h"
|
||
4 years ago
|
#include "srsran/upper/byte_buffer_queue.h"
|
||
5 years ago
|
#include <map>
|
||
|
#include <mutex>
|
||
|
#include <pthread.h>
|
||
|
#include <queue>
|
||
|
|
||
4 years ago
|
namespace srsran {
|
||
5 years ago
|
|
||
|
typedef struct {
|
||
|
rlc_umd_pdu_header_t header;
|
||
|
unique_byte_buffer_t buf;
|
||
|
} rlc_umd_pdu_t;
|
||
|
|
||
|
class rlc_um_lte : public rlc_um_base
|
||
|
{
|
||
|
public:
|
||
4 years ago
|
rlc_um_lte(srslog::basic_logger& logger,
|
||
5 years ago
|
uint32_t lcid_,
|
||
|
srsue::pdcp_interface_rlc* pdcp_,
|
||
|
srsue::rrc_interface_rlc* rrc_,
|
||
4 years ago
|
srsran::timer_handler* timers_);
|
||
5 years ago
|
~rlc_um_lte();
|
||
5 years ago
|
bool configure(const rlc_config_t& cnfg);
|
||
5 years ago
|
|
||
|
private:
|
||
|
// Transmitter sub-class for LTE
|
||
|
class rlc_um_lte_tx : public rlc_um_base_tx
|
||
|
{
|
||
|
public:
|
||
|
rlc_um_lte_tx(rlc_um_base* parent_);
|
||
|
|
||
5 years ago
|
bool configure(const rlc_config_t& cfg, std::string rb_name);
|
||
4 years ago
|
uint32_t build_data_pdu(unique_byte_buffer_t pdu, uint8_t* payload, uint32_t nof_bytes);
|
||
5 years ago
|
uint32_t get_buffer_state();
|
||
5 years ago
|
bool sdu_queue_is_full();
|
||
5 years ago
|
|
||
|
private:
|
||
5 years ago
|
void reset();
|
||
|
|
||
5 years ago
|
/****************************************************************************
|
||
|
* State variables and counters
|
||
|
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
|
||
|
***************************************************************************/
|
||
|
uint32_t vt_us = 0; // Send state. SN to be assigned for next PDU.
|
||
|
|
||
4 years ago
|
// Metrics
|
||
5 years ago
|
void debug_state();
|
||
|
};
|
||
|
|
||
|
// Receiver sub-class for LTE
|
||
|
class rlc_um_lte_rx : public rlc_um_base_rx
|
||
|
{
|
||
|
public:
|
||
|
rlc_um_lte_rx(rlc_um_base* parent_);
|
||
|
~rlc_um_lte_rx();
|
||
|
void stop();
|
||
|
void reestablish();
|
||
4 years ago
|
bool configure(const rlc_config_t& cnfg_, std::string rb_name_);
|
||
5 years ago
|
void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes);
|
||
|
void reassemble_rx_sdus();
|
||
|
bool pdu_belongs_to_rx_sdu();
|
||
|
bool inside_reordering_window(uint16_t sn);
|
||
|
|
||
|
// Timeout callback interface
|
||
|
void timer_expired(uint32_t timeout_id);
|
||
|
|
||
|
private:
|
||
|
void reset();
|
||
|
|
||
|
// Rx window
|
||
|
std::map<uint32_t, rlc_umd_pdu_t> rx_window;
|
||
|
|
||
|
// RX SDU buffers
|
||
|
uint32_t vr_ur_in_rx_sdu = 0;
|
||
|
|
||
|
// Rx state variables and counter
|
||
|
uint32_t vr_ur = 0; // Receive state. SN of earliest PDU still considered for reordering.
|
||
|
uint32_t vr_ux = 0; // t_reordering state. SN following PDU which triggered t_reordering.
|
||
|
uint32_t vr_uh = 0; // Highest rx state. SN following PDU with highest SN among rxed PDUs.
|
||
|
bool pdu_lost = false;
|
||
|
|
||
|
/****************************************************************************
|
||
|
* Timers
|
||
|
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
|
||
|
***************************************************************************/
|
||
4 years ago
|
srsran::timer_handler::unique_timer reordering_timer;
|
||
5 years ago
|
|
||
|
// helper functions
|
||
|
void debug_state();
|
||
|
};
|
||
|
};
|
||
|
|
||
|
/****************************************************************************
|
||
|
* Header pack/unpack helper functions
|
||
|
* Ref: 3GPP TS 36.322 v10.0.0 Section 6.2.1
|
||
|
***************************************************************************/
|
||
|
void rlc_um_read_data_pdu_header(byte_buffer_t* pdu, rlc_umd_sn_size_t sn_size, rlc_umd_pdu_header_t* header);
|
||
|
void rlc_um_read_data_pdu_header(uint8_t* payload,
|
||
|
uint32_t nof_bytes,
|
||
|
rlc_umd_sn_size_t sn_size,
|
||
|
rlc_umd_pdu_header_t* header);
|
||
|
void rlc_um_write_data_pdu_header(rlc_umd_pdu_header_t* header, byte_buffer_t* pdu);
|
||
|
|
||
|
uint32_t rlc_um_packed_length(rlc_umd_pdu_header_t* header);
|
||
|
bool rlc_um_start_aligned(uint8_t fi);
|
||
|
bool rlc_um_end_aligned(uint8_t fi);
|
||
|
|
||
4 years ago
|
} // namespace srsran
|
||
5 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_RLC_UM_LTE_H
|