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

@ -42,54 +42,50 @@
namespace srsue { namespace srsue {
typedef enum { typedef enum { AUTH_OK, AUTH_FAILED, AUTH_SYNCH_FAILURE } auth_result_t;
AUTH_OK,
AUTH_FAILED,
AUTH_SYNCH_FAILURE
} auth_result_t;
// USIM interface for NAS // USIM interface for NAS
class usim_interface_nas class usim_interface_nas
{ {
public: public:
virtual std::string get_imsi_str() = 0; virtual std::string get_imsi_str() = 0;
virtual std::string get_imei_str() = 0; virtual std::string get_imei_str() = 0;
virtual bool get_imsi_vec(uint8_t* imsi_, uint32_t n) = 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_imei_vec(uint8_t* imei_, uint32_t n) = 0;
virtual bool get_home_plmn_id(srslte::plmn_id_t* home_plmn_id) = 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, virtual auth_result_t generate_authentication_response(uint8_t* rand,
uint8_t *autn_enb, uint8_t* autn_enb,
uint16_t mcc, uint16_t mcc,
uint16_t mnc, uint16_t mnc,
uint8_t *res, uint8_t* res,
int *res_len, int* res_len,
uint8_t *k_asme) = 0; uint8_t* k_asme) = 0;
virtual void generate_nas_keys(uint8_t *k_asme, virtual void generate_nas_keys(uint8_t* k_asme,
uint8_t *k_nas_enc, uint8_t* k_nas_enc,
uint8_t *k_nas_int, uint8_t* k_nas_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo, srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0; srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
}; };
// USIM interface for RRC // USIM interface for RRC
class usim_interface_rrc class usim_interface_rrc
{ {
public: public:
virtual void generate_as_keys(uint8_t *k_asme, virtual void generate_as_keys(uint8_t* k_asme,
uint32_t count_ul, uint32_t count_ul,
uint8_t *k_rrc_enc, uint8_t* k_rrc_enc,
uint8_t *k_rrc_int, uint8_t* k_rrc_int,
uint8_t *k_up_enc, uint8_t* k_up_enc,
uint8_t *k_up_int, uint8_t* k_up_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo, srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0; srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
virtual void generate_as_keys_ho(uint32_t pci, virtual void generate_as_keys_ho(uint32_t pci,
uint32_t earfcn, uint32_t earfcn,
int ncc, int ncc,
uint8_t *k_rrc_enc, uint8_t* k_rrc_enc,
uint8_t *k_rrc_int, uint8_t* k_rrc_int,
uint8_t *k_up_enc, uint8_t* k_up_enc,
uint8_t *k_up_int, uint8_t* k_up_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo, srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0; srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
}; };
@ -130,15 +126,15 @@ class rrc_interface_mac : public rrc_interface_mac_common
{ {
public: public:
virtual void ho_ra_completed(bool ra_successful) = 0; 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 // RRC interface for PHY
class rrc_interface_phy_lte class rrc_interface_phy_lte
{ {
public: public:
virtual void in_sync() = 0; virtual void in_sync() = 0;
virtual void out_of_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; 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: public:
typedef struct { typedef struct {
srslte::plmn_id_t plmn_id; srslte::plmn_id_t plmn_id;
uint16_t tac; uint16_t tac;
} found_plmn_t; } found_plmn_t;
const static int MAX_FOUND_PLMNS = 16; const static int MAX_FOUND_PLMNS = 16;
virtual void write_sdu(srslte::unique_byte_buffer_t sdu) = 0; virtual void write_sdu(srslte::unique_byte_buffer_t sdu) = 0;
virtual uint16_t get_mcc() = 0; virtual uint16_t get_mcc() = 0;
virtual uint16_t get_mnc() = 0; virtual uint16_t get_mnc() = 0;
virtual void enable_capabilities() = 0; virtual void enable_capabilities() = 0;
virtual bool plmn_search() = 0; virtual bool plmn_search() = 0;
virtual void plmn_select(srslte::plmn_id_t plmn_id) = 0; virtual void plmn_select(srslte::plmn_id_t plmn_id) = 0;
virtual bool connection_request(srslte::establishment_cause_t cause, virtual bool connection_request(srslte::establishment_cause_t cause,
srslte::unique_byte_buffer_t dedicatedInfoNAS) = 0; srslte::unique_byte_buffer_t dedicatedInfoNAS) = 0;
virtual void set_ue_identity(srslte::s_tmsi_t s_tmsi) = 0; virtual void set_ue_identity(srslte::s_tmsi_t s_tmsi) = 0;
virtual bool is_connected() = 0; virtual bool is_connected() = 0;
virtual void paging_completed(bool outcome) = 0; virtual void paging_completed(bool outcome) = 0;
virtual std::string get_rb_name(uint32_t lcid) = 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; virtual uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id) = 0;
}; };
// RRC interface for PDCP // RRC interface for PDCP
@ -273,10 +269,10 @@ public:
virtual void add_bearer_mrb(uint32_t lcid) = 0; virtual void add_bearer_mrb(uint32_t lcid) = 0;
virtual void del_bearer(uint32_t lcid) = 0; virtual void del_bearer(uint32_t lcid) = 0;
virtual void suspend_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 void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0;
virtual bool has_bearer(uint32_t 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; 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; 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 class rlc_interface_mac : public srslte::read_pdu_interface
{ {
public: public:
@ -306,15 +302,15 @@ public:
/* MAC calls RLC to get RLC segment of nof_bytes length. /* MAC calls RLC to get RLC segment of nof_bytes length.
* Segmentation happens in this function. RLC PDU is stored in payload. */ * 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. /* 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. */ * 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(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_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_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_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_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0;
}; };
/** MAC interface /** MAC interface
@ -369,9 +365,9 @@ public:
} tb_action_dl_t; } tb_action_dl_t;
typedef struct { typedef struct {
tb_action_t tb; tb_action_t tb;
uint32_t current_tx_nb; uint32_t current_tx_nb;
bool expect_ack; bool expect_ack;
} tb_action_ul_t; } tb_action_ul_t;
/* Query the MAC for the current RNTI to look for /* Query the MAC for the current RNTI to look for
@ -418,7 +414,6 @@ public:
uint16_t sps_rnti; uint16_t sps_rnti;
uint64_t contention_id; uint64_t contention_id;
} ue_rnti_t; } ue_rnti_t;
}; };
/* Interface RRC -> MAC */ /* Interface RRC -> MAC */
@ -444,16 +439,16 @@ public:
virtual void set_config(srslte::mac_cfg_t& mac_cfg) = 0; virtual void set_config(srslte::mac_cfg_t& mac_cfg) = 0;
virtual void get_rntis(ue_rnti_t *rntis) = 0; virtual void get_rntis(ue_rnti_t* rntis) = 0;
virtual void set_contention_id(uint64_t uecri) = 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 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_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 reconfiguration(const uint32_t& cc_idx, const bool& enable) = 0;
virtual void reset() = 0; virtual void reset() = 0;
virtual void wait_uplink() = 0; virtual void wait_uplink() = 0;
virtual void set_enable_ra_proc(bool en) = 0; virtual void set_enable_ra_proc(bool en) = 0;
}; };
@ -467,7 +462,7 @@ typedef struct {
} carrier_map_t; } carrier_map_t;
typedef struct { typedef struct {
std::string type; std::string type;
srslte::phy_log_args_t log; srslte::phy_log_args_t log;
std::string dl_earfcn; // comma-separated list of EARFCNs std::string dl_earfcn; // comma-separated list of EARFCNs
@ -537,7 +532,7 @@ public:
/* Time advance commands */ /* Time advance commands */
virtual void set_timeadv_rar(uint32_t ta_cmd) = 0; 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*/ /* Activate / Disactivate SCell*/
virtual void set_activation_deactivation_scell(uint32_t cmd) = 0; virtual void set_activation_deactivation_scell(uint32_t cmd) = 0;
@ -547,7 +542,7 @@ public:
virtual uint32_t get_current_tti() = 0; virtual uint32_t get_current_tti() = 0;
virtual float get_phr() = 0; virtual float get_phr() = 0;
virtual float get_pathloss_db() = 0; virtual float get_pathloss_db() = 0;
}; };
@ -569,7 +564,7 @@ public:
virtual prach_info_t prach_get_info() = 0; virtual prach_info_t prach_get_info() = 0;
/* Indicates the transmission of a SR signal in the next opportunity */ /* Indicates the transmission of a SR signal in the next opportunity */
virtual void sr_send() = 0; virtual void sr_send() = 0;
virtual int sr_last_tx_tti() = 0; virtual int sr_last_tx_tti() = 0;
virtual void set_mch_period_stop(uint32_t stop) = 0; virtual void set_mch_period_stop(uint32_t stop) = 0;
@ -594,10 +589,10 @@ public:
/* Measurements interface */ /* Measurements interface */
virtual void meas_reset() = 0; virtual void meas_reset() = 0;
virtual int meas_start(uint32_t earfcn, int pci = -1) = 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 { 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; enum { MORE_FREQS = 0, NO_MORE_FREQS } last_freq;
} cell_search_ret_t; } cell_search_ret_t;
@ -607,9 +602,9 @@ public:
} phy_cell_t; } phy_cell_t;
/* Cell search and selection procedures */ /* Cell search and selection procedures */
virtual cell_search_ret_t cell_search(phy_cell_t *cell) = 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_select(phy_cell_t* cell = NULL) = 0;
virtual bool cell_is_camping() = 0; virtual bool cell_is_camping() = 0;
virtual void reset() = 0; virtual void reset() = 0;

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

@ -339,7 +339,6 @@ void pdcp_entity_nr::deliver_all_consecutive_counts()
} }
} }
/* /*
* Timers * Timers
*/ */

@ -28,7 +28,6 @@
#include "srslte/upper/pdcp_entity_nr.h" #include "srslte/upper/pdcp_entity_nr.h"
#include <iostream> #include <iostream>
/* /*
* Functions and macros for comparisions * Functions and macros for comparisions
*/ */
@ -117,8 +116,10 @@ pdcp_initial_state normal_init_state = {};
// Some tests regarding COUNT wraparound take really long. // Some tests regarding COUNT wraparound take really long.
// This puts the PCDC state closer to wraparound quickly. // This puts the PCDC state closer to wraparound quickly.
pdcp_initial_state near_wraparound_init_state = { pdcp_initial_state near_wraparound_init_state = {.tx_next = 4294967295,
.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0}; .rx_next = 4294967295,
.rx_deliv = 4294967295,
.rx_reord = 0};
/* /*
* Dummy classes * 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 * TX Test 2: PDCP Entity with SN LEN = 12
* Test TX PDU discard. * 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; return 0;
} }

@ -21,7 +21,6 @@
#include "pdcp_nr_test.h" #include "pdcp_nr_test.h"
#include <numeric> #include <numeric>
/* /*
* Genric function to test transmission of in-sequence packets * 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/enb_interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/rlc.h" #include "srslte/upper/rlc.h"
#include <map>
#ifndef SRSENB_RLC_H #ifndef SRSENB_RLC_H
#define SRSENB_RLC_H #define SRSENB_RLC_H
typedef struct { typedef struct {
uint32_t lcid; uint32_t lcid;
uint32_t plmn; uint32_t plmn;
uint16_t mtch_stop; uint16_t mtch_stop;
uint8_t* payload; uint8_t* payload;
} mch_service_t; } mch_service_t;
namespace srsenb { namespace srsenb {
@ -61,10 +61,10 @@ public:
std::string get_rb_name(uint32_t lcid); std::string get_rb_name(uint32_t lcid);
// rlc_interface_mac // rlc_interface_mac
int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes); 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 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 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); void read_pdu_pcch(uint8_t* payload, uint32_t buffer_size);
private: private:
class user_interface : public srsue::pdcp_interface_rlc, public srsue::rrc_interface_rlc 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_bcch_dlsch(srslte::unique_byte_buffer_t sdu);
void write_pdu_pcch(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 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); std::string get_rb_name(uint32_t lcid);
uint16_t rnti; uint16_t rnti;
srsenb::pdcp_interface_rlc *pdcp; srsenb::pdcp_interface_rlc* pdcp;
srsenb::rrc_interface_rlc *rrc; srsenb::rrc_interface_rlc* rrc;
std::unique_ptr<srslte::rlc> rlc; std::unique_ptr<srslte::rlc> rlc;
srsenb::rlc *parent; srsenb::rlc* parent;
}; };
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;

@ -30,15 +30,15 @@ void rlc::init(pdcp_interface_rlc* pdcp_,
srslte::timer_handler* timers_, srslte::timer_handler* timers_,
srslte::log* log_h_) srslte::log* log_h_)
{ {
pdcp = pdcp_; pdcp = pdcp_;
rrc = rrc_; rrc = rrc_;
log_h = log_h_; log_h = log_h_;
mac = mac_; mac = mac_;
timers = timers_; timers = timers_;
pool = srslte::byte_buffer_pool::get_instance(); pool = srslte::byte_buffer_pool::get_instance();
pthread_rwlock_init(&rwlock, NULL); pthread_rwlock_init(&rwlock, nullptr);
} }
void rlc::stop() void rlc::stop()
@ -84,7 +84,7 @@ void rlc::clear_buffer(uint16_t rnti)
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { if (users.count(rnti)) {
users[rnti].rlc->empty_queue(); users[rnti].rlc->empty_queue();
for (int i=0;i<SRSLTE_N_RADIO_BEARERS;i++) { for (int i = 0; i < SRSLTE_N_RADIO_BEARERS; i++) {
mac->rlc_buffer_state(rnti, i, 0, 0); mac->rlc_buffer_state(rnti, i, 0, 0);
} }
log_h->info("Cleared buffer rnti=0x%x\n", rnti); log_h->info("Cleared buffer rnti=0x%x\n", rnti);
@ -128,16 +128,16 @@ 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 rlc::read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes)
{ {
int ret; int ret;
uint32_t tx_queue; uint32_t tx_queue;
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if(users.count(rnti)) { if (users.count(rnti)) {
if(rnti != SRSLTE_MRNTI) { if (rnti != SRSLTE_MRNTI) {
ret = users[rnti].rlc->read_pdu(lcid, payload, nof_bytes); ret = users[rnti].rlc->read_pdu(lcid, payload, nof_bytes);
tx_queue = users[rnti].rlc->get_buffer_state(lcid); tx_queue = users[rnti].rlc->get_buffer_state(lcid);
} else { } 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); 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
@ -146,7 +146,7 @@ int rlc::read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_b
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); 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); mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue);
}else{ } else {
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;
} }
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
@ -169,7 +169,7 @@ void rlc::write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof
pthread_rwlock_unlock(&rwlock); 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 // RLC is transparent for BCCH
rrc->read_pdu_bcch_dlsch(sib_index, payload); rrc->read_pdu_bcch_dlsch(sib_index, payload);
@ -181,12 +181,12 @@ void rlc::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t s
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { if (users.count(rnti)) {
if(rnti != SRSLTE_MRNTI){ if (rnti != SRSLTE_MRNTI) {
users[rnti].rlc->write_sdu(lcid, std::move(sdu), false); users[rnti].rlc->write_sdu(lcid, std::move(sdu), false);
tx_queue = users[rnti].rlc->get_buffer_state(lcid); tx_queue = users[rnti].rlc->get_buffer_state(lcid);
}else { } else {
users[rnti].rlc->write_sdu_mch(lcid, std::move(sdu)); 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 // communicate buffer state every time a new SDU is written
@ -217,7 +217,8 @@ void rlc::discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t discard_sn)
pthread_rwlock_unlock(&rwlock); 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; bool ret = false;
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { 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]); return std::string(rb_id_text[lcid]);
} }
} } // namespace srsenb

Loading…
Cancel
Save