Clang-formated before pull request

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 61958af70b
commit e1cdd51eba

@ -118,21 +118,21 @@ enum class pdcp_t_reordering_t {
// Taken from PDCP-Config (TS 38.331 version 15.2.1)
enum class pdcp_discard_timer_t {
ms10 = 10,
ms20 = 20,
ms30 = 30,
ms40 = 40,
ms50 = 50,
ms60 = 60,
ms75 = 75,
ms100 = 100,
ms150 = 150,
ms200 = 200,
ms250 = 250,
ms300 = 300,
ms500 = 500,
ms750 = 750,
ms1500 = 1500,
ms10 = 10,
ms20 = 20,
ms30 = 30,
ms40 = 40,
ms50 = 50,
ms60 = 60,
ms75 = 75,
ms100 = 100,
ms150 = 150,
ms200 = 200,
ms250 = 250,
ms300 = 300,
ms500 = 500,
ms750 = 750,
ms1500 = 1500,
infinity = 0
};

@ -42,54 +42,50 @@
namespace srsue {
typedef enum {
AUTH_OK,
AUTH_FAILED,
AUTH_SYNCH_FAILURE
} auth_result_t;
typedef enum { AUTH_OK, AUTH_FAILED, AUTH_SYNCH_FAILURE } auth_result_t;
// USIM interface for NAS
class usim_interface_nas
{
public:
virtual std::string get_imsi_str() = 0;
virtual std::string get_imei_str() = 0;
virtual bool get_imsi_vec(uint8_t* imsi_, uint32_t n) = 0;
virtual bool get_imei_vec(uint8_t* imei_, uint32_t n) = 0;
virtual std::string get_imsi_str() = 0;
virtual std::string get_imei_str() = 0;
virtual bool get_imsi_vec(uint8_t* imsi_, uint32_t n) = 0;
virtual bool get_imei_vec(uint8_t* imei_, uint32_t n) = 0;
virtual bool get_home_plmn_id(srslte::plmn_id_t* home_plmn_id) = 0;
virtual auth_result_t generate_authentication_response(uint8_t *rand,
uint8_t *autn_enb,
uint16_t mcc,
uint16_t mnc,
uint8_t *res,
int *res_len,
uint8_t *k_asme) = 0;
virtual void generate_nas_keys(uint8_t *k_asme,
uint8_t *k_nas_enc,
uint8_t *k_nas_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
virtual auth_result_t generate_authentication_response(uint8_t* rand,
uint8_t* autn_enb,
uint16_t mcc,
uint16_t mnc,
uint8_t* res,
int* res_len,
uint8_t* k_asme) = 0;
virtual void generate_nas_keys(uint8_t* k_asme,
uint8_t* k_nas_enc,
uint8_t* k_nas_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
};
// USIM interface for RRC
class usim_interface_rrc
{
public:
virtual void generate_as_keys(uint8_t *k_asme,
uint32_t count_ul,
uint8_t *k_rrc_enc,
uint8_t *k_rrc_int,
uint8_t *k_up_enc,
uint8_t *k_up_int,
virtual void generate_as_keys(uint8_t* k_asme,
uint32_t count_ul,
uint8_t* k_rrc_enc,
uint8_t* k_rrc_int,
uint8_t* k_up_enc,
uint8_t* k_up_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
virtual void generate_as_keys_ho(uint32_t pci,
uint32_t earfcn,
int ncc,
uint8_t *k_rrc_enc,
uint8_t *k_rrc_int,
uint8_t *k_up_enc,
uint8_t *k_up_int,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
virtual void generate_as_keys_ho(uint32_t pci,
uint32_t earfcn,
int ncc,
uint8_t* k_rrc_enc,
uint8_t* k_rrc_int,
uint8_t* k_up_enc,
uint8_t* k_up_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
};
@ -130,15 +126,15 @@ class rrc_interface_mac : public rrc_interface_mac_common
{
public:
virtual void ho_ra_completed(bool ra_successful) = 0;
virtual void release_pucch_srs() = 0;
virtual void release_pucch_srs() = 0;
};
// RRC interface for PHY
class rrc_interface_phy_lte
{
public:
virtual void in_sync() = 0;
virtual void out_of_sync() = 0;
virtual void in_sync() = 0;
virtual void out_of_sync() = 0;
virtual void new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn = -1, int pci = -1) = 0;
};
@ -147,25 +143,25 @@ class rrc_interface_nas
{
public:
typedef struct {
srslte::plmn_id_t plmn_id;
uint16_t tac;
srslte::plmn_id_t plmn_id;
uint16_t tac;
} found_plmn_t;
const static int MAX_FOUND_PLMNS = 16;
virtual void write_sdu(srslte::unique_byte_buffer_t sdu) = 0;
virtual uint16_t get_mcc() = 0;
virtual uint16_t get_mnc() = 0;
virtual void enable_capabilities() = 0;
virtual bool plmn_search() = 0;
virtual void plmn_select(srslte::plmn_id_t plmn_id) = 0;
virtual void write_sdu(srslte::unique_byte_buffer_t sdu) = 0;
virtual uint16_t get_mcc() = 0;
virtual uint16_t get_mnc() = 0;
virtual void enable_capabilities() = 0;
virtual bool plmn_search() = 0;
virtual void plmn_select(srslte::plmn_id_t plmn_id) = 0;
virtual bool connection_request(srslte::establishment_cause_t cause,
srslte::unique_byte_buffer_t dedicatedInfoNAS) = 0;
virtual void set_ue_identity(srslte::s_tmsi_t s_tmsi) = 0;
virtual bool is_connected() = 0;
virtual void paging_completed(bool outcome) = 0;
virtual std::string get_rb_name(uint32_t lcid) = 0;
virtual uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id) = 0;
srslte::unique_byte_buffer_t dedicatedInfoNAS) = 0;
virtual void set_ue_identity(srslte::s_tmsi_t s_tmsi) = 0;
virtual bool is_connected() = 0;
virtual void paging_completed(bool outcome) = 0;
virtual std::string get_rb_name(uint32_t lcid) = 0;
virtual uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id) = 0;
};
// RRC interface for PDCP
@ -273,10 +269,10 @@ public:
virtual void add_bearer_mrb(uint32_t lcid) = 0;
virtual void del_bearer(uint32_t lcid) = 0;
virtual void suspend_bearer(uint32_t lcid) = 0;
virtual void resume_bearer(uint32_t lcid) = 0;
virtual void resume_bearer(uint32_t lcid) = 0;
virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0;
virtual bool has_bearer(uint32_t lcid) = 0;
virtual bool has_data(const uint32_t lcid) = 0;
virtual bool has_data(const uint32_t lcid) = 0;
virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = true) = 0;
};
@ -291,7 +287,7 @@ public:
virtual bool rb_is_um(uint32_t lcid) = 0;
};
//RLC interface for MAC
// RLC interface for MAC
class rlc_interface_mac : public srslte::read_pdu_interface
{
public:
@ -306,18 +302,18 @@ public:
/* MAC calls RLC to get RLC segment of nof_bytes length.
* Segmentation happens in this function. RLC PDU is stored in payload. */
virtual int read_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
virtual int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0;
/* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread.
* PDU gets placed into the buffer and higher layer thread gets notified. */
virtual void write_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_bch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_dlsch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_pcch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_mch(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_bch(uint8_t* payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_dlsch(uint8_t* payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_pcch(uint8_t* payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0;
};
/** MAC interface
/** MAC interface
*
*/
/* Interface PHY -> MAC */
@ -369,9 +365,9 @@ public:
} tb_action_dl_t;
typedef struct {
tb_action_t tb;
uint32_t current_tx_nb;
bool expect_ack;
tb_action_t tb;
uint32_t current_tx_nb;
bool expect_ack;
} tb_action_ul_t;
/* Query the MAC for the current RNTI to look for
@ -418,7 +414,6 @@ public:
uint16_t sps_rnti;
uint64_t contention_id;
} ue_rnti_t;
};
/* Interface RRC -> MAC */
@ -444,20 +439,20 @@ public:
virtual void set_config(srslte::mac_cfg_t& mac_cfg) = 0;
virtual void get_rntis(ue_rnti_t *rntis) = 0;
virtual void set_contention_id(uint64_t uecri) = 0;
virtual void get_rntis(ue_rnti_t* rntis) = 0;
virtual void set_contention_id(uint64_t uecri) = 0;
virtual void set_ho_rnti(uint16_t crnti, uint16_t target_pci) = 0;
virtual void start_noncont_ho(uint32_t preamble_index, uint32_t prach_mask) = 0;
virtual void start_cont_ho() = 0;
virtual void start_cont_ho() = 0;
virtual void reconfiguration(const uint32_t& cc_idx, const bool& enable) = 0;
virtual void reset() = 0;
virtual void wait_uplink() = 0;
virtual void reset() = 0;
virtual void wait_uplink() = 0;
virtual void set_enable_ra_proc(bool en) = 0;
};
/** PHY interface
/** PHY interface
*
*/
@ -467,7 +462,7 @@ typedef struct {
} carrier_map_t;
typedef struct {
std::string type;
std::string type;
srslte::phy_log_args_t log;
std::string dl_earfcn; // comma-separated list of EARFCNs
@ -537,7 +532,7 @@ public:
/* Time advance commands */
virtual void set_timeadv_rar(uint32_t ta_cmd) = 0;
virtual void set_timeadv(uint32_t ta_cmd) = 0;
virtual void set_timeadv(uint32_t ta_cmd) = 0;
/* Activate / Disactivate SCell*/
virtual void set_activation_deactivation_scell(uint32_t cmd) = 0;
@ -547,7 +542,7 @@ public:
virtual uint32_t get_current_tti() = 0;
virtual float get_phr() = 0;
virtual float get_phr() = 0;
virtual float get_pathloss_db() = 0;
};
@ -569,8 +564,8 @@ public:
virtual prach_info_t prach_get_info() = 0;
/* Indicates the transmission of a SR signal in the next opportunity */
virtual void sr_send() = 0;
virtual int sr_last_tx_tti() = 0;
virtual void sr_send() = 0;
virtual int sr_last_tx_tti() = 0;
virtual void set_mch_period_stop(uint32_t stop) = 0;
};
@ -594,10 +589,10 @@ public:
/* Measurements interface */
virtual void meas_reset() = 0;
virtual int meas_start(uint32_t earfcn, int pci = -1) = 0;
virtual int meas_stop(uint32_t earfcn, int pci = -1) = 0;
virtual int meas_stop(uint32_t earfcn, int pci = -1) = 0;
typedef struct {
enum {CELL_FOUND = 0, CELL_NOT_FOUND, ERROR} found;
enum { CELL_FOUND = 0, CELL_NOT_FOUND, ERROR } found;
enum { MORE_FREQS = 0, NO_MORE_FREQS } last_freq;
} cell_search_ret_t;
@ -607,9 +602,9 @@ public:
} phy_cell_t;
/* Cell search and selection procedures */
virtual cell_search_ret_t cell_search(phy_cell_t *cell) = 0;
virtual bool cell_select(phy_cell_t *cell = NULL) = 0;
virtual bool cell_is_camping() = 0;
virtual cell_search_ret_t cell_search(phy_cell_t* cell) = 0;
virtual bool cell_select(phy_cell_t* cell = NULL) = 0;
virtual bool cell_is_camping() = 0;
virtual void reset() = 0;

@ -33,17 +33,16 @@ namespace srslte {
* Ref: 3GPP TS 36.322 v10.0.0
***************************************************************************/
#define RLC_AM_WINDOW_SIZE 512
#define RLC_MAX_SDU_SIZE ((1<<11)-1) // Length of LI field is 11bits
#define RLC_AM_WINDOW_SIZE 512
#define RLC_MAX_SDU_SIZE ((1 << 11) - 1) // Length of LI field is 11bits
typedef enum{
typedef enum {
RLC_FI_FIELD_START_AND_END_ALIGNED = 0,
RLC_FI_FIELD_NOT_END_ALIGNED,
RLC_FI_FIELD_NOT_START_ALIGNED,
RLC_FI_FIELD_NOT_START_OR_END_ALIGNED,
RLC_FI_FIELD_N_ITEMS,
}rlc_fi_field_t;
} rlc_fi_field_t;
static const char rlc_fi_field_text[RLC_FI_FIELD_N_ITEMS][32] = {"Start and end aligned",
"Not end aligned",
"Not start aligned",
@ -89,17 +88,16 @@ typedef enum {
RLC_DC_FIELD_DATA_PDU,
RLC_DC_FIELD_N_ITEMS,
} rlc_dc_field_t;
static const char rlc_dc_field_text[RLC_DC_FIELD_N_ITEMS][20] = {"Control PDU",
"Data PDU"};
static const char rlc_dc_field_text[RLC_DC_FIELD_N_ITEMS][20] = {"Control PDU", "Data PDU"};
// UMD PDU Header
typedef struct{
typedef struct {
uint8_t fi; // Framing info
rlc_umd_sn_size_t sn_size; // Sequence number size (5 or 10 bits)
uint16_t sn; // Sequence number
uint32_t N_li; // Number of length indicators
uint16_t li[RLC_AM_WINDOW_SIZE]; // Array of length indicators
}rlc_umd_pdu_header_t;
} rlc_umd_pdu_header_t;
typedef struct {
rlc_nr_si_field_t si; // Segmentation info
@ -109,34 +107,32 @@ typedef struct {
} rlc_um_nr_pdu_header_t;
// AMD PDU Header
struct rlc_amd_pdu_header_t{
rlc_dc_field_t dc; // Data or control
uint8_t rf; // Resegmentation flag
uint8_t p; // Polling bit
uint8_t fi; // Framing info
uint16_t sn; // Sequence number
uint8_t lsf; // Last segment flag
uint16_t so; // Segment offset
uint32_t N_li; // Number of length indicators
uint16_t li[RLC_AM_WINDOW_SIZE]; // Array of length indicators
rlc_amd_pdu_header_t(){
dc = RLC_DC_FIELD_CONTROL_PDU;
rf = 0;
p = 0;
fi = 0;
sn = 0;
lsf = 0;
so = 0;
N_li=0;
for(int i=0;i<RLC_AM_WINDOW_SIZE;i++)
li[i] = 0;
}
rlc_amd_pdu_header_t(const rlc_amd_pdu_header_t& h)
struct rlc_amd_pdu_header_t {
rlc_dc_field_t dc; // Data or control
uint8_t rf; // Resegmentation flag
uint8_t p; // Polling bit
uint8_t fi; // Framing info
uint16_t sn; // Sequence number
uint8_t lsf; // Last segment flag
uint16_t so; // Segment offset
uint32_t N_li; // Number of length indicators
uint16_t li[RLC_AM_WINDOW_SIZE]; // Array of length indicators
rlc_amd_pdu_header_t()
{
copy(h);
dc = RLC_DC_FIELD_CONTROL_PDU;
rf = 0;
p = 0;
fi = 0;
sn = 0;
lsf = 0;
so = 0;
N_li = 0;
for (int i = 0; i < RLC_AM_WINDOW_SIZE; i++)
li[i] = 0;
}
rlc_amd_pdu_header_t& operator= (const rlc_amd_pdu_header_t& h)
rlc_amd_pdu_header_t(const rlc_amd_pdu_header_t& h) { copy(h); }
rlc_amd_pdu_header_t& operator=(const rlc_amd_pdu_header_t& h)
{
copy(h);
return *this;
@ -158,22 +154,32 @@ struct rlc_amd_pdu_header_t{
};
// NACK helper (for LTE and NR)
struct rlc_status_nack_t{
struct rlc_status_nack_t {
uint32_t nack_sn;
bool has_so;
uint16_t so_start;
uint16_t so_end;
rlc_status_nack_t(){has_so=false; nack_sn=0; so_start=0; so_end=0;}
rlc_status_nack_t()
{
has_so = false;
nack_sn = 0;
so_start = 0;
so_end = 0;
}
};
// STATUS PDU
struct rlc_status_pdu_t{
struct rlc_status_pdu_t {
uint16_t ack_sn; // SN of the next not received RLC Data PDU
uint32_t N_nack;
rlc_status_nack_t nacks[RLC_AM_WINDOW_SIZE];
rlc_status_pdu_t(){N_nack=0; ack_sn=0;}
rlc_status_pdu_t()
{
N_nack = 0;
ack_sn = 0;
}
};
/** RLC AM NR structs */
@ -204,7 +210,6 @@ typedef struct {
class rlc_common
{
public:
// Size of the Uplink buffer in number of PDUs
const static int RLC_BUFFER_NOF_PDU = 128;
@ -259,10 +264,10 @@ public:
virtual void discard_sdu(uint32_t discard_sn) = 0;
// MAC interface
virtual bool has_data() = 0;
virtual uint32_t get_buffer_state() = 0;
virtual int read_pdu(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual bool has_data() = 0;
virtual uint32_t get_buffer_state() = 0;
virtual int read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
virtual void write_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;
private:
bool is_suspended = false;
@ -291,5 +296,4 @@ private:
};
} // namespace srslte
#endif // SRSLTE_RLC_COMMON_H

@ -58,7 +58,7 @@ void pdcp_entity_nr::init(uint32_t lcid_, pdcp_config_t cfg_)
reordering_timer.set(static_cast<uint32_t>(cfg.t_reordering), *reordering_fnc);
}
// Mark entity as initialized
// Mark entity as initialized
initialized = true;
}
@ -339,7 +339,6 @@ void pdcp_entity_nr::deliver_all_consecutive_counts()
}
}
/*
* Timers
*/
@ -374,7 +373,7 @@ void pdcp_entity_nr::discard_callback::operator()(uint32_t timer_id)
// Notify the RLC of the discard. It's the RLC to actually discard, if no segment was transmitted yet.
parent->rlc->discard_sdu(parent->lcid, discard_sn);
// Remove timer from map
// Remove timer from map
// NOTE: this will delete the callback. It *must* be the last instruction.
parent->discard_timers_map.erase(discard_sn);
return;

@ -28,7 +28,6 @@
#include "srslte/upper/pdcp_entity_nr.h"
#include <iostream>
/*
* Functions and macros for comparisions
*/
@ -117,8 +116,10 @@ pdcp_initial_state normal_init_state = {};
// Some tests regarding COUNT wraparound take really long.
// This puts the PCDC state closer to wraparound quickly.
pdcp_initial_state near_wraparound_init_state = {
.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
pdcp_initial_state near_wraparound_init_state = {.tx_next = 4294967295,
.rx_next = 4294967295,
.rx_deliv = 4294967295,
.rx_reord = 0};
/*
* Dummy classes

@ -95,7 +95,7 @@ int test_tx_discard_all(srslte::byte_buffer_pool* pool, srslte::log* log)
* TX Test 2: PDCP Entity with SN LEN = 12
* Test TX PDU discard.
*/
//TESTASSERT(test_tx_sdu_discard(normal_init_state, srslte::pdcp_discard_timer_t::ms50, true, pool, log) == 0);
// TESTASSERT(test_tx_sdu_discard(normal_init_state, srslte::pdcp_discard_timer_t::ms50, true, pool, log) == 0);
return 0;
}

@ -21,7 +21,6 @@
#include "pdcp_nr_test.h"
#include <numeric>
/*
* Genric function to test transmission of in-sequence packets
*/

@ -19,19 +19,19 @@
*
*/
#include <map>
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/rlc.h"
#include <map>
#ifndef SRSENB_RLC_H
#define SRSENB_RLC_H
typedef struct {
uint32_t lcid;
uint32_t plmn;
uint16_t mtch_stop;
uint8_t* payload;
uint32_t lcid;
uint32_t plmn;
uint16_t mtch_stop;
uint8_t* payload;
} mch_service_t;
namespace srsenb {
@ -48,7 +48,7 @@ public:
// rlc_interface_rrc
void clear_buffer(uint16_t rnti);
void add_user(uint16_t rnti);
void add_user(uint16_t rnti);
void rem_user(uint16_t rnti);
void add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg);
void add_bearer_mrb(uint16_t rnti, uint32_t lcid);
@ -61,11 +61,11 @@ public:
std::string get_rb_name(uint32_t lcid);
// rlc_interface_mac
int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes);
void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t *payload);
void write_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes);
void read_pdu_pcch(uint8_t *payload, uint32_t buffer_size);
int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t* payload);
void write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
void read_pdu_pcch(uint8_t* payload, uint32_t buffer_size);
private:
class user_interface : public srsue::pdcp_interface_rlc, public srsue::rrc_interface_rlc
{
@ -75,14 +75,14 @@ private:
void write_pdu_bcch_dlsch(srslte::unique_byte_buffer_t sdu);
void write_pdu_pcch(srslte::unique_byte_buffer_t sdu);
void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t sdu) {}
void max_retx_attempted();
void max_retx_attempted();
std::string get_rb_name(uint32_t lcid);
uint16_t rnti;
uint16_t rnti;
srsenb::pdcp_interface_rlc *pdcp;
srsenb::rrc_interface_rlc *rrc;
srsenb::pdcp_interface_rlc* pdcp;
srsenb::rrc_interface_rlc* rrc;
std::unique_ptr<srslte::rlc> rlc;
srsenb::rlc *parent;
srsenb::rlc* parent;
};
pthread_rwlock_t rwlock;

@ -30,15 +30,15 @@ void rlc::init(pdcp_interface_rlc* pdcp_,
srslte::timer_handler* timers_,
srslte::log* log_h_)
{
pdcp = pdcp_;
rrc = rrc_;
log_h = log_h_;
mac = mac_;
timers = timers_;
pdcp = pdcp_;
rrc = rrc_;
log_h = log_h_;
mac = mac_;
timers = timers_;
pool = srslte::byte_buffer_pool::get_instance();
pthread_rwlock_init(&rwlock, NULL);
pthread_rwlock_init(&rwlock, nullptr);
}
void rlc::stop()
@ -62,7 +62,7 @@ void rlc::add_user(uint16_t rnti)
users[rnti].pdcp = pdcp;
users[rnti].rrc = rrc;
users[rnti].rlc = std::move(obj);
users[rnti].parent = this;
users[rnti].parent = this;
}
pthread_rwlock_unlock(&rwlock);
}
@ -84,8 +84,8 @@ void rlc::clear_buffer(uint16_t rnti)
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) {
users[rnti].rlc->empty_queue();
for (int i=0;i<SRSLTE_N_RADIO_BEARERS;i++) {
mac->rlc_buffer_state(rnti, i, 0, 0);
for (int i = 0; i < SRSLTE_N_RADIO_BEARERS; i++) {
mac->rlc_buffer_state(rnti, i, 0, 0);
}
log_h->info("Cleared buffer rnti=0x%x\n", rnti);
}
@ -128,25 +128,25 @@ void rlc::read_pdu_pcch(uint8_t* payload, uint32_t buffer_size)
int rlc::read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes)
{
int ret;
int ret;
uint32_t tx_queue;
pthread_rwlock_rdlock(&rwlock);
if(users.count(rnti)) {
if(rnti != SRSLTE_MRNTI) {
ret = users[rnti].rlc->read_pdu(lcid, payload, nof_bytes);
if (users.count(rnti)) {
if (rnti != SRSLTE_MRNTI) {
ret = users[rnti].rlc->read_pdu(lcid, payload, nof_bytes);
tx_queue = users[rnti].rlc->get_buffer_state(lcid);
} else {
ret = users[rnti].rlc->read_pdu_mch(lcid, payload, nof_bytes);
ret = users[rnti].rlc->read_pdu_mch(lcid, payload, nof_bytes);
tx_queue = users[rnti].rlc->get_total_mch_buffer_state(lcid);
}
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// communicate buffer state every time a PDU is read
uint32_t retx_queue = 0;
log_h->debug("Buffer state PDCP: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue);
mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
}else{
} else {
ret = SRSLTE_ERROR;
}
pthread_rwlock_unlock(&rwlock);
@ -158,18 +158,18 @@ void rlc::write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) {
users[rnti].rlc->write_pdu(lcid, payload, nof_bytes);
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// communicate buffer state every time a new PDU is written
uint32_t tx_queue = users[rnti].rlc->get_buffer_state(lcid);
uint32_t retx_queue = 0;
uint32_t retx_queue = 0;
log_h->debug("Buffer state PDCP: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue);
mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
}
pthread_rwlock_unlock(&rwlock);
}
void rlc::read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t *payload)
void rlc::read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t* payload)
{
// RLC is transparent for BCCH
rrc->read_pdu_bcch_dlsch(sib_index, payload);
@ -181,17 +181,17 @@ void rlc::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t s
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) {
if(rnti != SRSLTE_MRNTI){
if (rnti != SRSLTE_MRNTI) {
users[rnti].rlc->write_sdu(lcid, std::move(sdu), false);
tx_queue = users[rnti].rlc->get_buffer_state(lcid);
}else {
tx_queue = users[rnti].rlc->get_buffer_state(lcid);
} else {
users[rnti].rlc->write_sdu_mch(lcid, std::move(sdu));
tx_queue = users[rnti].rlc->get_total_mch_buffer_state(lcid);
tx_queue = users[rnti].rlc->get_total_mch_buffer_state(lcid);
}
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// communicate buffer state every time a new SDU is written
uint32_t retx_queue = 0;
uint32_t retx_queue = 0;
mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
log_h->info("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue);
}
@ -210,14 +210,15 @@ void rlc::discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t discard_sn)
// In the eNodeB, there is no polling for buffer state from the scheduler, thus
// communicate buffer state every time a new SDU is discarded
uint32_t retx_queue = 0;
uint32_t retx_queue = 0;
mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
log_h->info("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d\n", rnti, lcid, tx_queue);
}
pthread_rwlock_unlock(&rwlock);
}
bool rlc::rb_is_um(uint16_t rnti, uint32_t lcid) {
bool rlc::rb_is_um(uint16_t rnti, uint32_t lcid)
{
bool ret = false;
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) {
@ -261,4 +262,4 @@ std::string rlc::user_interface::get_rb_name(uint32_t lcid)
return std::string(rb_id_text[lcid]);
}
}
} // namespace srsenb

Loading…
Cancel
Save