Merge branch 'master' into next

master
Andre Puschmann 6 years ago
commit d981f129e0

@ -122,7 +122,7 @@ public:
} }
void clear() { // remove all items void clear() { // remove all items
myobj item; myobj *item = NULL;
while (try_pop(item)); while (try_pop(item));
} }

@ -166,8 +166,13 @@ static inline void srslte_mat_2x2_mmse_csi_simd(simd_cf_t y0,
simd_cf_t _noise_estimate; simd_cf_t _noise_estimate;
simd_f_t _norm = srslte_simd_f_set1(norm); simd_f_t _norm = srslte_simd_f_set1(norm);
#if HAVE_NEON
_noise_estimate.val[0] = srslte_simd_f_set1(noise_estimate);
_noise_estimate.val[1] = srslte_simd_f_zero();
#else /* HAVE_NEON */
_noise_estimate.re = srslte_simd_f_set1(noise_estimate); _noise_estimate.re = srslte_simd_f_set1(noise_estimate);
_noise_estimate.im = srslte_simd_f_zero(); _noise_estimate.im = srslte_simd_f_zero();
#endif /* HAVE_NEON */
/* 1. A = H' x H + No*/ /* 1. A = H' x H + No*/
simd_cf_t a00 = simd_cf_t a00 =

@ -139,7 +139,7 @@
#define SRSLTE_SIMD_S_SIZE 8 #define SRSLTE_SIMD_S_SIZE 8
#define SRSLTE_SIMD_C16_SIZE 8 #define SRSLTE_SIMD_C16_SIZE 8
#else /* LV_HAVE_NEON */ #else /* HAVE_NEON */
#define SRSLTE_SIMD_F_SIZE 0 #define SRSLTE_SIMD_F_SIZE 0
#define SRSLTE_SIMD_CF_SIZE 0 #define SRSLTE_SIMD_CF_SIZE 0
@ -514,7 +514,7 @@ static inline simd_f_t srslte_simd_f_abs(simd_f_t a) {
return _mm_andnot_ps(_mm_set1_ps(-0.0f), a); return _mm_andnot_ps(_mm_set1_ps(-0.0f), a);
#else /* LV_HAVE_SSE */ #else /* LV_HAVE_SSE */
#ifdef HAVE_NEON #ifdef HAVE_NEON
return vqabsq_s32(a); return vabsq_f32(a);
#endif /* HAVE_NEON */ #endif /* HAVE_NEON */
#endif /* LV_HAVE_SSE */ #endif /* LV_HAVE_SSE */
#endif /* LV_HAVE_AVX2 */ #endif /* LV_HAVE_AVX2 */
@ -990,13 +990,13 @@ static inline simd_cf_t srslte_simd_cf_rcp (simd_cf_t a) {
static inline simd_cf_t srslte_simd_cf_neg (simd_cf_t a) { static inline simd_cf_t srslte_simd_cf_neg (simd_cf_t a) {
simd_cf_t ret; simd_cf_t ret;
#if LV_HAVE_NEON #if HAVE_NEON
ret.val[0] = srslte_simd_f_neg(a.val[0]); ret.val[0] = srslte_simd_f_neg(a.val[0]);
ret.val[1] = srslte_simd_f_neg(a.val[1]); ret.val[1] = srslte_simd_f_neg(a.val[1]);
#else /* LV_HAVE_NEON */ #else /* HAVE_NEON */
ret.re = srslte_simd_f_neg(a.re); ret.re = srslte_simd_f_neg(a.re);
ret.im = srslte_simd_f_neg(a.im); ret.im = srslte_simd_f_neg(a.im);
#endif /* LV_HAVE_NEON */ #endif /* HAVE_NEON */
return ret; return ret;
} }
@ -1007,37 +1007,37 @@ static inline simd_cf_t srslte_simd_cf_neg_mask (simd_cf_t a, simd_f_t mask) {
mask = _mm256_permutevar8x32_ps(mask, _mm256_setr_epi32(0,4,1,5,2,6,3,7)); mask = _mm256_permutevar8x32_ps(mask, _mm256_setr_epi32(0,4,1,5,2,6,3,7));
#endif /* LV_HAVE_AVX2 */ #endif /* LV_HAVE_AVX2 */
#endif /* LV_HAVE_AVX512 */ #endif /* LV_HAVE_AVX512 */
#if LV_HAVE_NEON #if HAVE_NEON
ret.val[0] = srslte_simd_f_neg_mask(a.val[0], mask); ret.val[0] = srslte_simd_f_neg_mask(a.val[0], mask);
ret.val[1] = srslte_simd_f_neg_mask(a.val[1], mask); ret.val[1] = srslte_simd_f_neg_mask(a.val[1], mask);
#else /* LV_HAVE_NEON */ #else /* HAVE_NEON */
ret.re = srslte_simd_f_neg_mask(a.re, mask); ret.re = srslte_simd_f_neg_mask(a.re, mask);
ret.im = srslte_simd_f_neg_mask(a.im, mask); ret.im = srslte_simd_f_neg_mask(a.im, mask);
#endif /* LV_HAVE_NEON */ #endif /* HAVE_NEON */
return ret; return ret;
} }
static inline simd_cf_t srslte_simd_cf_conj (simd_cf_t a) { static inline simd_cf_t srslte_simd_cf_conj (simd_cf_t a) {
simd_cf_t ret; simd_cf_t ret;
#if LV_HAVE_NEON #if HAVE_NEON
ret.val[0] = a.val[0]; ret.val[0] = a.val[0];
ret.val[1] = srslte_simd_f_neg(a.val[1]); ret.val[1] = srslte_simd_f_neg(a.val[1]);
#else /* LV_HAVE_NEON */ #else /* HAVE_NEON */
ret.re = a.re; ret.re = a.re;
ret.im = srslte_simd_f_neg(a.im); ret.im = srslte_simd_f_neg(a.im);
#endif /* LV_HAVE_NEON */ #endif /* HAVE_NEON */
return ret; return ret;
} }
static inline simd_cf_t srslte_simd_cf_mulj (simd_cf_t a) { static inline simd_cf_t srslte_simd_cf_mulj (simd_cf_t a) {
simd_cf_t ret; simd_cf_t ret;
#if LV_HAVE_NEON #if HAVE_NEON
ret.val[0] = srslte_simd_f_neg(a.val[1]); ret.val[0] = srslte_simd_f_neg(a.val[1]);
ret.val[1] = a.val[0]; ret.val[1] = a.val[0];
#else /* LV_HAVE_NEON */ #else /* HAVE_NEON */
ret.re = srslte_simd_f_neg(a.im); ret.re = srslte_simd_f_neg(a.im);
ret.im = a.re; ret.im = a.re;
#endif /* LV_HAVE_NEON */ #endif /* HAVE_NEON */
return ret; return ret;
} }

@ -27,13 +27,15 @@
#ifndef SRSLTE_RLC_METRICS_H #ifndef SRSLTE_RLC_METRICS_H
#define SRSLTE_RLC_METRICS_H #define SRSLTE_RLC_METRICS_H
#include "srslte/common/common.h"
namespace srslte { namespace srslte {
struct rlc_metrics_t struct rlc_metrics_t
{ {
float dl_tput_mbps; float dl_tput_mbps[SRSLTE_N_RADIO_BEARERS];
float ul_tput_mbps; float ul_tput_mbps[SRSLTE_N_RADIO_BEARERS];
float dl_tput_mrb_mbps[SRSLTE_N_MCH_LCIDS];
}; };
} // namespace srslte } // namespace srslte

@ -404,16 +404,16 @@ double rf_blade_set_tx_freq(void *h, double freq)
void rf_blade_set_tx_cal(void *h, srslte_rf_cal_t *cal) { void rf_blade_set_tx_cal(void *h, srslte_rf_cal_t *cal) {
rf_blade_handler_t *handler = (rf_blade_handler_t*) h; rf_blade_handler_t *handler = (rf_blade_handler_t*) h;
bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_FPGA_PHASE, cal->dc_gain); bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_FPGA_PHASE, cal->dc_phase);
bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_FPGA_GAIN, cal->dc_phase); bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_FPGA_GAIN, cal->dc_gain);
bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_LMS_DCOFF_I, cal->iq_i); bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_LMS_DCOFF_I, cal->iq_i);
bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_LMS_DCOFF_Q, cal->iq_q); bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_LMS_DCOFF_Q, cal->iq_q);
} }
void rf_blade_set_rx_cal(void *h, srslte_rf_cal_t *cal) { void rf_blade_set_rx_cal(void *h, srslte_rf_cal_t *cal) {
rf_blade_handler_t *handler = (rf_blade_handler_t*) h; rf_blade_handler_t *handler = (rf_blade_handler_t*) h;
bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_FPGA_PHASE, cal->dc_gain); bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_FPGA_PHASE, cal->dc_phase);
bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_FPGA_GAIN, cal->dc_phase); bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_FPGA_GAIN, cal->dc_gain);
bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_LMS_DCOFF_I, cal->iq_i); bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_LMS_DCOFF_I, cal->iq_i);
bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_LMS_DCOFF_Q, cal->iq_q); bladerf_set_correction(handler->dev, BLADERF_MODULE_RX, BLADERF_CORR_LMS_DCOFF_Q, cal->iq_q);
} }

@ -228,7 +228,7 @@ int rf_soapy_start_rx_stream(void *h, bool now)
{ {
rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h; rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if(handler->rx_stream_active == false){ if(handler->rx_stream_active == false){
if(SoapySDRDevice_activateStream(handler->device, handler->rxStream, 0, 0, 0) != 0) if(SoapySDRDevice_activateStream(handler->device, handler->rxStream, SOAPY_SDR_HAS_TIME | SOAPY_SDR_END_BURST, 0, 0) != 0)
return SRSLTE_ERROR; return SRSLTE_ERROR;
handler->rx_stream_active = true; handler->rx_stream_active = true;
} }
@ -339,9 +339,19 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
rf_soapy_set_rx_srate(handler, 1.92e6); rf_soapy_set_rx_srate(handler, 1.92e6);
rf_soapy_set_tx_srate(handler, 1.92e6); rf_soapy_set_tx_srate(handler, 1.92e6);
if(SoapySDRDevice_getNumChannels(handler->device, SOAPY_SDR_RX) > 0){ size_t channels = SoapySDRDevice_getNumChannels(handler->device, SOAPY_SDR_RX);
if((channels > 0) && (nof_rx_antennas > 0)){
printf("Setting up RX stream\n"); printf("Setting up RX stream\n");
if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) { size_t numChannels = channels;
if (channels > nof_rx_antennas) {
numChannels = nof_rx_antennas;
}
size_t rx_channels[numChannels];
for(int i = 0 ; i < numChannels ; i++) {
rx_channels[i] = i;
}
if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, rx_channels, numChannels, NULL) != 0) {
printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError()); printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -439,10 +449,12 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
#if HAVE_ASYNC_THREAD #if HAVE_ASYNC_THREAD
bool start_async_thread = true; bool start_async_thread = true;
if (args) {
if (strstr(args, "silent")) { if (strstr(args, "silent")) {
REMOVE_SUBSTRING_WITHCOMAS(args, "silent"); REMOVE_SUBSTRING_WITHCOMAS(args, "silent");
start_async_thread = false; start_async_thread = false;
} }
}
#endif #endif
// receive one subframe to allow for transceiver calibration // receive one subframe to allow for transceiver calibration
@ -839,7 +851,7 @@ int rf_soapy_send_timed_multi(void *h,
// Convert initial tx time // Convert initial tx time
if (has_time_spec) { if (has_time_spec) {
timeNs = secs * 1000000000; timeNs = (long long)secs * 1000000000;
timeNs = timeNs + (frac_secs * 1000000000); timeNs = timeNs + (frac_secs * 1000000000);
} }

@ -788,17 +788,17 @@ int rf_uhd_recv_with_time_multi(void *h,
rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h; rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
uhd_rx_metadata_handle *md = &handler->rx_md_first; uhd_rx_metadata_handle *md = &handler->rx_md_first;
size_t rxd_samples = 0; size_t rxd_samples = 0;
size_t rxd_samples_total = 0;
int trials = 0; int trials = 0;
if (blocking) { if (blocking) {
int n = 0; while (rxd_samples_total < nsamples && trials < 100) {
while (n < nsamples && trials < 100) {
void *buffs_ptr[4]; void *buffs_ptr[4];
for (int i=0;i<handler->nof_rx_channels;i++) { for (int i=0;i<handler->nof_rx_channels;i++) {
cf_t *data_c = (cf_t*) data[i]; cf_t *data_c = (cf_t*) data[i];
buffs_ptr[i] = &data_c[n]; buffs_ptr[i] = &data_c[rxd_samples_total];
} }
size_t num_samps_left = nsamples - n; size_t num_samps_left = nsamples - rxd_samples_total;
size_t num_rx_samples = (num_samps_left > handler->rx_nof_samples) ? handler->rx_nof_samples : num_samps_left; size_t num_rx_samples = (num_samps_left > handler->rx_nof_samples) ? handler->rx_nof_samples : num_samps_left;
rxd_samples = 0; rxd_samples = 0;
@ -814,7 +814,7 @@ int rf_uhd_recv_with_time_multi(void *h,
uhd_rx_metadata_error_code(*md, &error_code); uhd_rx_metadata_error_code(*md, &error_code);
md = &handler->rx_md; md = &handler->rx_md;
n += rxd_samples; rxd_samples_total += rxd_samples;
trials++; trials++;
if (error_code == UHD_RX_METADATA_ERROR_CODE_OVERFLOW) { if (error_code == UHD_RX_METADATA_ERROR_CODE_OVERFLOW) {
@ -830,6 +830,7 @@ int rf_uhd_recv_with_time_multi(void *h,
} }
} else { } else {
uhd_error error = uhd_rx_streamer_recv(handler->rx_stream, data, nsamples, md, 0.0, false, &rxd_samples); uhd_error error = uhd_rx_streamer_recv(handler->rx_stream, data, nsamples, md, 0.0, false, &rxd_samples);
rxd_samples_total = rxd_samples;
if (error) { if (error) {
fprintf(stderr, "Error receiving from UHD: %d\n", error); fprintf(stderr, "Error receiving from UHD: %d\n", error);
log_rx_error(handler); log_rx_error(handler);
@ -839,7 +840,7 @@ int rf_uhd_recv_with_time_multi(void *h,
if (secs && frac_secs) { if (secs && frac_secs) {
uhd_rx_metadata_time_spec(handler->rx_md_first, secs, frac_secs); uhd_rx_metadata_time_spec(handler->rx_md_first, secs, frac_secs);
} }
return nsamples; return rxd_samples_total;
} }
int rf_uhd_send_timed(void *h, int rf_uhd_send_timed(void *h,

@ -118,12 +118,9 @@ void rlc::get_metrics(rlc_metrics_t &m)
get_time_interval(metrics_time); get_time_interval(metrics_time);
double secs = (double)metrics_time[0].tv_sec + metrics_time[0].tv_usec*1e-6; double secs = (double)metrics_time[0].tv_sec + metrics_time[0].tv_usec*1e-6;
m.dl_tput_mbps = 0;
m.ul_tput_mbps = 0;
for (rlc_map_t::iterator it = rlc_array.begin(); it != rlc_array.end(); ++it) { for (rlc_map_t::iterator it = rlc_array.begin(); it != rlc_array.end(); ++it) {
m.dl_tput_mbps += (it->second->get_num_rx_bytes()*8/(double)1e6)/secs; m.dl_tput_mbps[it->first] = (it->second->get_num_rx_bytes()*8/static_cast<double>(1e6))/secs;
m.ul_tput_mbps += (it->second->get_num_tx_bytes()*8/(double)1e6)/secs; m.ul_tput_mbps[it->first] = (it->second->get_num_tx_bytes()*8/static_cast<double>(1e6))/secs;
rlc_log->info("LCID=%d, RX throughput: %4.6f Mbps. TX throughput: %4.6f Mbps.\n", rlc_log->info("LCID=%d, RX throughput: %4.6f Mbps. TX throughput: %4.6f Mbps.\n",
it->first, it->first,
(it->second->get_num_rx_bytes()*8/(double)1e6)/secs, (it->second->get_num_rx_bytes()*8/(double)1e6)/secs,
@ -132,10 +129,10 @@ void rlc::get_metrics(rlc_metrics_t &m)
// Add multicast metrics // Add multicast metrics
for (rlc_map_t::iterator it = rlc_array_mrb.begin(); it != rlc_array_mrb.end(); ++it) { for (rlc_map_t::iterator it = rlc_array_mrb.begin(); it != rlc_array_mrb.end(); ++it) {
m.dl_tput_mbps += (it->second->get_num_rx_bytes()*8/(double)1e6)/secs; m.dl_tput_mbps[it->first] = (it->second->get_num_rx_bytes()*8/static_cast<double>(1e6))/secs;
rlc_log->info("MCH_LCID=%d, RX throughput: %4.6f Mbps\n", rlc_log->info("MCH_LCID=%d, RX throughput: %4.6f Mbps\n",
it->first, it->first,
(it->second->get_num_rx_bytes()*8/(double)1e6)/secs); (it->second->get_num_rx_bytes()*8/static_cast<double>(1e6))/secs);
} }
memcpy(&metrics_time[1], &metrics_time[2], sizeof(struct timeval)); memcpy(&metrics_time[1], &metrics_time[2], sizeof(struct timeval));

@ -374,16 +374,16 @@ void stress_test(stress_test_args_t args)
tester1.get_nof_rx_pdus(), tester1.get_nof_rx_pdus(),
args.test_duration_sec, args.test_duration_sec,
(float)tester1.get_nof_rx_pdus()/args.test_duration_sec, (float)tester1.get_nof_rx_pdus()/args.test_duration_sec,
metrics.dl_tput_mbps, metrics.dl_tput_mbps[lcid],
metrics.ul_tput_mbps); metrics.ul_tput_mbps[lcid]);
rlc2.get_metrics(metrics); rlc2.get_metrics(metrics);
printf("RLC2 received %d SDUs in %ds (%.2f PDU/s), Throughput: DL=%4.2f Mbps, UL=%4.2f Mbps\n", printf("RLC2 received %d SDUs in %ds (%.2f PDU/s), Throughput: DL=%4.2f Mbps, UL=%4.2f Mbps\n",
tester2.get_nof_rx_pdus(), tester2.get_nof_rx_pdus(),
args.test_duration_sec, args.test_duration_sec,
(float)tester2.get_nof_rx_pdus()/args.test_duration_sec, (float)tester2.get_nof_rx_pdus()/args.test_duration_sec,
metrics.dl_tput_mbps, metrics.dl_tput_mbps[lcid],
metrics.ul_tput_mbps); metrics.ul_tput_mbps[lcid]);
} }

@ -1073,7 +1073,7 @@ void phch_worker::ue::metrics_ul(uint32_t mcs, float rssi, float sinr, uint32_t
{ {
metrics.ul.mcs = SRSLTE_VEC_CMA((float) mcs, metrics.ul.mcs, metrics.ul.n_samples); metrics.ul.mcs = SRSLTE_VEC_CMA((float) mcs, metrics.ul.mcs, metrics.ul.n_samples);
metrics.ul.sinr = SRSLTE_VEC_CMA((float) sinr, metrics.ul.sinr, metrics.ul.n_samples); metrics.ul.sinr = SRSLTE_VEC_CMA((float) sinr, metrics.ul.sinr, metrics.ul.n_samples);
metrics.ul.rssi = SRSLTE_VEC_CMA((float) sinr, metrics.ul.rssi, metrics.ul.n_samples); metrics.ul.rssi = SRSLTE_VEC_CMA((float) rssi, metrics.ul.rssi, metrics.ul.n_samples);
metrics.ul.turbo_iters = SRSLTE_VEC_CMA((float) turbo_iters, metrics.ul.turbo_iters, metrics.ul.n_samples); metrics.ul.turbo_iters = SRSLTE_VEC_CMA((float) turbo_iters, metrics.ul.turbo_iters, metrics.ul.n_samples);
metrics.ul.n_samples++; metrics.ul.n_samples++;
} }

@ -39,6 +39,8 @@ struct mac_metrics_t
int rx_errors; int rx_errors;
int rx_brate; int rx_brate;
int ul_buffer; int ul_buffer;
float dl_retx_avg;
float ul_retx_avg;
}; };
} // namespace srsue } // namespace srsue

@ -477,6 +477,8 @@ void mac::get_metrics(mac_metrics_t &m)
ul_harq.get_average_retx()); ul_harq.get_average_retx());
metrics.ul_buffer = (int) bsr_procedure.get_buffer_state(); metrics.ul_buffer = (int) bsr_procedure.get_buffer_state();
metrics.dl_retx_avg = dl_harq.get_average_retx();
metrics.ul_retx_avg = ul_harq.get_average_retx();
m = metrics; m = metrics;
bzero(&metrics, sizeof(mac_metrics_t)); bzero(&metrics, sizeof(mac_metrics_t));
} }

@ -237,7 +237,8 @@ void ra_proc::step_resource_selection() {
} }
if (sel_group == RA_GROUP_A) { if (sel_group == RA_GROUP_A) {
if (nof_groupA_preambles) { if (nof_groupA_preambles) {
sel_preamble = preambleTransmissionCounter%nof_groupA_preambles; // randomly choose preamble from [0 nof_groupA_preambles)
sel_preamble = rand() % nof_groupA_preambles;
} else { } else {
rError("Selected group preamble A but nof_groupA_preambles=0\n"); rError("Selected group preamble A but nof_groupA_preambles=0\n");
state = RA_PROBLEM; state = RA_PROBLEM;
@ -245,6 +246,7 @@ void ra_proc::step_resource_selection() {
} }
} else { } else {
if (nof_groupB_preambles) { if (nof_groupB_preambles) {
// randomly choose preamble from [nof_groupA_preambles nof_groupB_preambles)
sel_preamble = nof_groupA_preambles + rand() % nof_groupB_preambles; sel_preamble = nof_groupA_preambles + rand() % nof_groupB_preambles;
} else { } else {
rError("Selected group preamble B but nof_groupA_preambles=0\n"); rError("Selected group preamble B but nof_groupA_preambles=0\n");

Loading…
Cancel
Save