Clang-formated before pull request

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

@ -42,11 +42,7 @@
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
@ -57,16 +53,16 @@ public:
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,
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,
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;
};
@ -75,21 +71,21 @@ public:
class usim_interface_rrc
{
public:
virtual void generate_as_keys(uint8_t *k_asme,
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,
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,
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;
};
@ -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,15 +302,15 @@ 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
@ -418,7 +414,6 @@ public:
uint16_t sps_rnti;
uint64_t contention_id;
} ue_rnti_t;
};
/* Interface RRC -> MAC */
@ -444,7 +439,7 @@ public:
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_ho_rnti(uint16_t crnti, uint16_t target_pci) = 0;
@ -597,7 +592,7 @@ public:
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,8 +602,8 @@ 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 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;

@ -34,16 +34,15 @@ namespace srslte {
***************************************************************************/
#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_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,7 +107,7 @@ typedef struct {
} rlc_um_nr_pdu_header_t;
// AMD PDU Header
struct rlc_amd_pdu_header_t{
struct rlc_amd_pdu_header_t {
rlc_dc_field_t dc; // Data or control
uint8_t rf; // Resegmentation flag
uint8_t p; // Polling bit
@ -120,7 +118,8 @@ struct rlc_amd_pdu_header_t{
uint32_t N_li; // Number 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;
@ -128,15 +127,12 @@ struct rlc_amd_pdu_header_t{
sn = 0;
lsf = 0;
so = 0;
N_li=0;
for(int i=0;i<RLC_AM_WINDOW_SIZE;i++)
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);
}
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;
@ -261,8 +266,8 @@ public:
// 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 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

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

@ -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,10 +19,10 @@
*
*/
#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
@ -61,10 +61,10 @@ 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
@ -79,10 +79,10 @@ private:
std::string get_rb_name(uint32_t lcid);
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;

@ -38,7 +38,7 @@ void rlc::init(pdcp_interface_rlc* pdcp_,
pool = srslte::byte_buffer_pool::get_instance();
pthread_rwlock_init(&rwlock, NULL);
pthread_rwlock_init(&rwlock, nullptr);
}
void rlc::stop()
@ -84,7 +84,7 @@ 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++) {
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);
@ -132,8 +132,8 @@ int rlc::read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_b
uint32_t tx_queue;
pthread_rwlock_rdlock(&rwlock);
if(users.count(rnti)) {
if(rnti != SRSLTE_MRNTI) {
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 {
@ -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;
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);
@ -169,7 +169,7 @@ void rlc::write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof
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,10 +181,10 @@ 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 {
} else {
users[rnti].rlc->write_sdu_mch(lcid, std::move(sdu));
tx_queue = users[rnti].rlc->get_total_mch_buffer_state(lcid);
}
@ -217,7 +217,8 @@ void rlc::discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t discard_sn)
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