Merge branch 'next' into next_mme_encryption

Updating next_mme_encryption to the latest next.
master
Pedro Alvarez 6 years ago
commit 584c190773

@ -0,0 +1,15 @@
dist: xenial
sudo: required
before_script:
- sudo apt-get -qq update
- sudo apt-get install -qq build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev
language: cpp
script:
- mkdir build
- cd build
- cmake -DRF_FOUND=True ..
- make
- make test
- sudo make install

@ -348,7 +348,6 @@ srslte_netsink_t net_sink, net_sink_signal;
int main(int argc, char **argv) {
struct timeval t[3];
int ret;
int decimate = 1;
srslte_cell_t cell;
int64_t sf_cnt;
srslte_ue_mib_t ue_mib;
@ -509,30 +508,22 @@ int main(int argc, char **argv) {
} else {
#ifndef DISABLE_RF
if(prog_args.decimate)
{
if(prog_args.decimate > 4 || prog_args.decimate < 0)
{
printf("Invalid decimation factor, setting to 1 \n");
}
else
{
decimate = prog_args.decimate;
//ue_sync.decimate = prog_args.decimate;
}
int decimate = 1;
if (prog_args.decimate) {
if (prog_args.decimate > 4 || prog_args.decimate < 0) {
printf("Invalid decimation factor, setting to 1 \n");
} else {
decimate = prog_args.decimate;
}
if (srslte_ue_sync_init_multi_decim(&ue_sync,
cell.nof_prb,
cell.id==1000,
srslte_rf_recv_wrapper,
prog_args.rf_nof_rx_ant,
(void*) &rf,decimate))
{
}
if (srslte_ue_sync_init_multi_decim(&ue_sync, cell.nof_prb, cell.id == 1000, srslte_rf_recv_wrapper,
prog_args.rf_nof_rx_ant, (void*)&rf, decimate)) {
fprintf(stderr, "Error initiating ue_sync\n");
exit(-1);
}
if (srslte_ue_sync_set_cell(&ue_sync, cell))
{
if (srslte_ue_sync_set_cell(&ue_sync, cell)) {
fprintf(stderr, "Error initiating ue_sync\n");
exit(-1);
}

@ -64,6 +64,7 @@ class pdcp_entity : public pdcp_entity_interface
{
public:
pdcp_entity();
~pdcp_entity();
void init(srsue::rlc_interface_pdcp *rlc_,
srsue::rrc_interface_pdcp *rrc_,
srsue::gw_interface_pdcp *gw_,
@ -112,6 +113,8 @@ private:
CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
pthread_mutex_t mutex;
void integrity_generate(uint8_t *msg,
uint32_t msg_len,
uint8_t *mac);

@ -134,9 +134,9 @@ public:
cfg.um.t_reordering = 0;
cfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cfg.um.rx_window_size = 0;
cfg.um.rx_mod = 1;
cfg.um.rx_mod = 32;
cfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cfg.um.tx_mod = 1;
cfg.um.tx_mod = 32;
cfg.um.is_mrb = true;
return cfg;
}

@ -3380,7 +3380,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_pack_pdcp_sn(
// Integer - ie->PDCP_SN
// lb:0, ub:4095
liblte_align_up_zero(ptr, 8);
liblte_value_2_bits(0, ptr, (1*8)-12);
liblte_value_2_bits(0, ptr, (2*8)-12);
liblte_value_2_bits(ie->PDCP_SN, ptr, 12);
liblte_align_up_zero(ptr, 8);
err = LIBLTE_SUCCESS;
@ -3400,7 +3400,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_pdcp_sn(
// Integer - ie->PDCP_SN
// lb:0, ub:4095
liblte_align_up(ptr, 8);
ie->PDCP_SN = (uint16_t)liblte_bits_2_value(ptr, 1.0*8);
ie->PDCP_SN = (uint16_t)liblte_bits_2_value(ptr, 2*8);
liblte_align_up(ptr, 8);
err = LIBLTE_SUCCESS;
}

@ -206,7 +206,8 @@ static int encode_tb_off(srslte_sch_t *q,
}
if (cb_segm->C > softbuffer->max_cb) {
fprintf(stderr, "Error number of CB (%d) exceeds soft buffer size (%d CBs)\n", cb_segm->C, softbuffer->max_cb);
fprintf(stderr, "Error number of CB to encode (%d) exceeds soft buffer size (%d CBs)\n", cb_segm->C,
softbuffer->max_cb);
return -1;
}
@ -457,7 +458,8 @@ static int decode_tb(srslte_sch_t *q,
}
if (cb_segm->C > softbuffer->max_cb) {
fprintf(stderr, "Error number of CB (%d) exceeds soft buffer size (%d CBs)\n", cb_segm->C, softbuffer->max_cb);
fprintf(stderr, "Error number of CB to decode (%d) exceeds soft buffer size (%d CBs)\n", cb_segm->C,
softbuffer->max_cb);
return SRSLTE_ERROR_INVALID_INPUTS;
}

@ -466,6 +466,7 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels)
uhd_error error = uhd_usrp_make(&handler->usrp, args);
if (error) {
fprintf(stderr, "Error opening UHD: code %d\n", error);
free(handler);
return -1;
}

@ -111,6 +111,7 @@ int srslte_ringbuffer_read(srslte_ringbuffer_t *q, void *p, int nof_bytes)
void srslte_ringbuffer_stop(srslte_ringbuffer_t *q) {
pthread_mutex_lock(&q->mutex);
q->active = false;
pthread_cond_broadcast(&q->cvar);
pthread_mutex_unlock(&q->mutex);
}

@ -21,9 +21,4 @@
file(GLOB SOURCES "*.cc")
add_library(srslte_upper STATIC ${SOURCES})
target_link_libraries(srslte_upper srslte_common srslte_asn1)
install(TARGETS srslte_upper DESTINATION ${LIBRARY_DIR})
# Run clang-tidy if available
if(CLANG_TIDY_BIN)
set_target_properties(srslte_upper PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()
install(TARGETS srslte_upper DESTINATION ${LIBRARY_DIR})

@ -48,6 +48,11 @@ pdcp::~pdcp()
}
pdcp_array.clear();
for (pdcp_map_t::iterator it = pdcp_array_mrb.begin(); it != pdcp_array_mrb.end(); ++it) {
delete (it->second);
}
pdcp_array_mrb.clear();
pthread_rwlock_unlock(&rwlock);
pthread_rwlock_destroy(&rwlock);
}

@ -46,6 +46,12 @@ pdcp_entity::pdcp_entity()
rx_count = 0;
cipher_algo = CIPHERING_ALGORITHM_ID_EEA0;
integ_algo = INTEGRITY_ALGORITHM_ID_EIA0;
pthread_mutex_init(&mutex, NULL);
}
pdcp_entity::~pdcp_entity()
{
pthread_mutex_destroy(&mutex);
}
void pdcp_entity::init(srsue::rlc_interface_pdcp *rlc_,
@ -119,6 +125,8 @@ void pdcp_entity::write_sdu(byte_buffer_t *sdu, bool blocking)
rrc->get_rb_name(lcid).c_str(), tx_count,
(do_integrity) ? "true" : "false", (do_encryption) ? "true" : "false");
pthread_mutex_lock(&mutex);
if (cfg.is_control) {
pdcp_pack_control_pdu(tx_count, sdu);
if(do_integrity) {
@ -144,6 +152,8 @@ void pdcp_entity::write_sdu(byte_buffer_t *sdu, bool blocking)
}
tx_count++;
pthread_mutex_unlock(&mutex);
rlc->write_sdu(lcid, sdu, blocking);
}
@ -183,6 +193,8 @@ void pdcp_entity::write_pdu(byte_buffer_t *pdu)
return;
}
pthread_mutex_lock(&mutex);
// Handle DRB messages
if (cfg.is_data) {
uint32_t sn;
@ -231,6 +243,7 @@ void pdcp_entity::write_pdu(byte_buffer_t *pdu)
}
exit:
rx_count++;
pthread_mutex_unlock(&mutex);
}
void pdcp_entity::integrity_generate( uint8_t *msg,

@ -587,7 +587,7 @@ bool rlc::has_bearer(uint32_t lcid)
bool rlc::valid_lcid(uint32_t lcid)
{
if (lcid >= SRSLTE_N_RADIO_BEARERS) {
rlc_log->error("Radio bearer id must be in [0:%d] - %d", SRSLTE_N_RADIO_BEARERS, lcid);
rlc_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSLTE_N_RADIO_BEARERS, lcid);
return false;
}
@ -601,7 +601,7 @@ bool rlc::valid_lcid(uint32_t lcid)
bool rlc::valid_lcid_mrb(uint32_t lcid)
{
if (lcid >= SRSLTE_N_MCH_LCIDS) {
rlc_log->error("Radio bearer id must be in [0:%d] - %d", SRSLTE_N_RADIO_BEARERS, lcid);
rlc_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSLTE_N_RADIO_BEARERS, lcid);
return false;
}

@ -36,11 +36,6 @@ add_test(rlc_am_stress_test rlc_stress_test --mode=AM --loglevel 1 --sdu_gen_del
add_test(rlc_um_stress_test rlc_stress_test --mode=UM --loglevel 1)
add_test(rlc_tm_stress_test rlc_stress_test --mode=TM --loglevel 1 --random_opp=false)
# Run clang-tidy if available
if(CLANG_TIDY_BIN)
set_target_properties(rlc_stress_test PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()
add_executable(rlc_um_data_test rlc_um_data_test.cc)
target_link_libraries(rlc_um_data_test srslte_upper srslte_phy srslte_common)
add_test(rlc_um_data_test rlc_um_data_test)

@ -60,6 +60,7 @@ private:
std::ofstream file;
ue_metrics_interface* ue;
uint32_t n_reports;
pthread_mutex_t mutex;
};
} // namespace srsue

@ -99,6 +99,7 @@ typedef struct {
float rx_gain_offset;
float avg_snr_db_cqi;
float avg_snr_db_sync;
float avg_ri;
float avg_noise;
bool pcell_meas_enabled;

@ -44,6 +44,7 @@ struct dl_metrics_t
float rsrp;
float rsrq;
float rssi;
float ri;
float turbo_iters;
float mcs;
float pathloss;

@ -47,11 +47,13 @@ metrics_csv::metrics_csv(std::string filename)
,ue(NULL)
{
file.open(filename.c_str(), std::ios_base::out);
pthread_mutex_init(&mutex, NULL);
}
metrics_csv::~metrics_csv()
{
stop();
pthread_mutex_destroy(&mutex);
}
void metrics_csv::set_ue_handle(ue_metrics_interface *ue_)
@ -61,15 +63,18 @@ void metrics_csv::set_ue_handle(ue_metrics_interface *ue_)
void metrics_csv::stop()
{
pthread_mutex_lock(&mutex);
if (file.is_open()) {
file << "#eof\n";
file.flush();
file.close();
}
pthread_mutex_unlock(&mutex);
}
void metrics_csv::set_metrics(ue_metrics_t &metrics, const uint32_t period_usec)
{
pthread_mutex_lock(&mutex);
if (file.is_open() && ue != NULL) {
if(n_reports == 0) {
file << "time;rsrp;pl;cfo;dl_mcs;dl_snr;dl_turbo;dl_brate;dl_bler;ul_ta;ul_mcs;ul_buff;ul_brate;ul_bler;rf_o;rf_u;rf_l;is_attached\n";
@ -106,6 +111,7 @@ void metrics_csv::set_metrics(ue_metrics_t &metrics, const uint32_t period_usec)
} else {
std::cout << "Error, couldn't write CSV file." << std::endl;
}
pthread_mutex_unlock(&mutex);
}
std::string metrics_csv::float_to_string(float f, int digits, bool add_semicolon)

@ -359,6 +359,7 @@ void phch_common::reset() {
avg_rsrp = 0;
avg_rsrp_dbm = 0;
avg_rsrq_db = 0;
avg_ri = 0;
pcell_report_period = 20;

@ -1665,6 +1665,13 @@ void phch_worker::update_measurements()
}
}
// Average RI
if (!phy->avg_ri) {
phy->avg_ri = SRSLTE_VEC_EMA(phy->last_ri, phy->avg_ri, 0.1);
} else {
phy->avg_ri = phy->last_ri;
}
phy->avg_snr_db_cqi = 10*log10(phy->avg_rsrp/phy->avg_noise);
// Store metrics
@ -1674,6 +1681,7 @@ void phch_worker::update_measurements()
dl_metrics.rssi = phy->avg_rssi_dbm;
dl_metrics.pathloss = phy->pathloss;
dl_metrics.sinr = phy->avg_snr_db_cqi;
dl_metrics.ri = phy->avg_ri;
phy->set_dl_metrics(dl_metrics);
}

Loading…
Cancel
Save