Merge branch 'next' into next_paul_libs

This commit is contained in:
Paul Sutton 2017-06-08 11:26:33 +01:00
commit 07d8997395
15 changed files with 68 additions and 50 deletions

View File

@ -66,6 +66,7 @@ option(ENABLE_BLADERF "Enable BladeRF" ON)
option(BUILD_STATIC "Attempt to statically link external deps" OFF) option(BUILD_STATIC "Attempt to statically link external deps" OFF)
option(RPATH "Enable RPATH" OFF) option(RPATH "Enable RPATH" OFF)
option(USE_LTE_RATES "Use standard LTE sampling rates" OFF)
set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.") set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
@ -89,18 +90,6 @@ else(POLARSSL_FOUND)
endif (MBEDTLS_FOUND) endif (MBEDTLS_FOUND)
endif(POLARSSL_FOUND) endif(POLARSSL_FOUND)
find_package(MKL)
if(MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
link_directories(${MKL_LIBRARY_DIRS})
else(MKL_FOUND)
find_package(FFTW3F REQUIRED)
if(FFTW3F_FOUND)
include_directories(${FFTW3F_INCLUDE_DIRS})
link_directories(${FFTW3F_LIBRARY_DIRS})
endif(FFTW3F_FOUND)
endif(MKL_FOUND)
find_package(UHD) find_package(UHD)
if(UHD_FOUND) if(UHD_FOUND)
include_directories(${UHD_INCLUDE_DIRS}) include_directories(${UHD_INCLUDE_DIRS})
@ -235,6 +224,11 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if (USE_LTE_RATES)
message(STATUS "Using standard LTE sampling rates")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFORCE_STANDARD_RATE")
endif (USE_LTE_RATES)
find_package(SSE) find_package(SSE)
if (HAVE_AVX2) if (HAVE_AVX2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")

View File

@ -100,7 +100,7 @@ void parse_args(int argc, char **argv) {
int srslte_rf_recv_wrapper(void *h, cf_t *data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t *t) { int srslte_rf_recv_wrapper(void *h, cf_t *data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t *t) {
DEBUG(" ---- Receive %d samples ---- \n", nsamples); DEBUG(" ---- Receive %d samples ---- \n", nsamples);
return srslte_rf_recv(h, data[2], nsamples, 1); return srslte_rf_recv(h, data[0], nsamples, 1);
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {

View File

@ -76,7 +76,7 @@ public:
{ {
printf("%d buffers in queue\n", (int) used.size()); printf("%d buffers in queue\n", (int) used.size());
for (uint32_t i=0;i<used.size();i++) { for (uint32_t i=0;i<used.size();i++) {
printf("%s\n", used[i]->debug_name?used[i]->debug_name:"Undefined"); printf("%s\n", strlen(used[i]->debug_name)?used[i]->debug_name:"Undefined");
} }
} }
@ -97,7 +97,8 @@ public:
} }
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
if (debug_name) { if (debug_name) {
strncpy(b->debug_name, debug_name, 128); strncpy(b->debug_name, debug_name, SRSLTE_BUFFER_POOL_LOG_NAME_LEN);
b->debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN-1] = 0;
} }
#endif #endif

View File

@ -54,6 +54,7 @@
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
#define pool_allocate (pool->allocate(__FUNCTION__)) #define pool_allocate (pool->allocate(__FUNCTION__))
#define SRSLTE_BUFFER_POOL_LOG_NAME_LEN 128
#else #else
#define pool_allocate (pool->allocate()) #define pool_allocate (pool->allocate())
#endif #endif
@ -121,7 +122,7 @@ public:
uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES]; uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES];
uint8_t *msg; uint8_t *msg;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[128]; char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN];
#endif #endif
byte_buffer_t():N_bytes(0) byte_buffer_t():N_bytes(0)
@ -129,6 +130,9 @@ public:
timestamp_is_set = false; timestamp_is_set = false;
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
next = NULL; next = NULL;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
debug_name[0] = 0;
#endif
} }
byte_buffer_t(const byte_buffer_t& buf) byte_buffer_t(const byte_buffer_t& buf)
{ {

View File

@ -20,7 +20,9 @@
file(GLOB CXX_SOURCES "*.cc") file(GLOB CXX_SOURCES "*.cc")
file(GLOB C_SOURCES "*.c") file(GLOB C_SOURCES "*.c")
add_library(srslte_common STATIC ${C_SOURCES} ${CXX_SOURCES}) add_library(srslte_common STATIC ${C_SOURCES} ${CXX_SOURCES})
target_include_directories(srslte_common PUBLIC ${SEC_INCLUDE_DIRS})
target_link_libraries(srslte_common ${SEC_LIBRARIES}) target_link_libraries(srslte_common ${SEC_LIBRARIES})
install(TARGETS srslte_common DESTINATION ${LIBRARY_DIR}) install(TARGETS srslte_common DESTINATION ${LIBRARY_DIR})

View File

@ -63,6 +63,19 @@ if(NOT DisableMEX)
add_library(srslte_phy_static STATIC ${srslte_srcs}) add_library(srslte_phy_static STATIC ${srslte_srcs})
endif(NOT DisableMEX) endif(NOT DisableMEX)
find_package(MKL)
if(MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
link_directories(${MKL_LIBRARY_DIRS})
else(MKL_FOUND)
find_package(FFTW3F REQUIRED)
if(FFTW3F_FOUND)
include_directories(${FFTW3F_INCLUDE_DIRS})
link_directories(${FFTW3F_LIBRARY_DIRS})
endif(FFTW3F_FOUND)
endif(MKL_FOUND)
if(MKL_FOUND) if(MKL_FOUND)
if(STATIC_MKL) if(STATIC_MKL)
target_link_libraries(srslte_phy ${MKL_STATIC_LIBRARIES}) target_link_libraries(srslte_phy ${MKL_STATIC_LIBRARIES})

View File

@ -473,13 +473,6 @@ int srslte_pdcch_extract_llr_multi(srslte_pdcch_t *q, cf_t *sf_symbols[SRSLTE_MA
/* descramble */ /* descramble */
srslte_scrambling_f_offset(&q->seq[nsubframe], q->llr, 0, e_bits); srslte_scrambling_f_offset(&q->seq[nsubframe], q->llr, 0, e_bits);
float mean = 0;
for (int i=0;i<e_bits;i++) {
mean += fabsf(q->llr[i]);
}
mean /= e_bits;
printf("power %f\n",mean);
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
} }
return ret; return ret;

View File

@ -79,7 +79,16 @@ int srslte_ue_sync_init_file(srslte_ue_sync_t *q, uint32_t nof_prb, char *file_n
INFO("Offseting input file by %d samples and %.1f kHz\n", offset_time, offset_freq/1000); INFO("Offseting input file by %d samples and %.1f kHz\n", offset_time, offset_freq/1000);
srslte_filesource_read(&q->file_source, dummy_offset_buffer, offset_time); if (offset_time) {
cf_t *file_offset_buffer = srslte_vec_malloc(offset_time * sizeof(cf_t));
if (!file_offset_buffer) {
perror("malloc");
goto clean_exit;
}
srslte_filesource_read(&q->file_source, file_offset_buffer, offset_time);
free(file_offset_buffer);
}
srslte_ue_sync_reset(q); srslte_ue_sync_reset(q);
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;

View File

@ -39,6 +39,13 @@
#include "volk/volk.h" #include "volk/volk.h"
#endif #endif
#ifdef DEBUG_MODE
#warning FIXME: Disabling SSE/AVX vector code
#undef LV_HAVE_SSE
#undef LV_HAVE_AVX
#endif
int srslte_vec_acc_ii(int *x, uint32_t len) { int srslte_vec_acc_ii(int *x, uint32_t len) {
int i; int i;
int z=0; int z=0;
@ -295,17 +302,13 @@ void srslte_vec_lut_fuf(float *x, uint32_t *lut, float *y, uint32_t len) {
} }
void srslte_vec_lut_sss(short *x, unsigned short *lut, short *y, uint32_t len) { void srslte_vec_lut_sss(short *x, unsigned short *lut, short *y, uint32_t len) {
#ifdef DEBUG_MODE #ifndef LV_HAVE_SSE
#warning FIXME: Disabling SSE/AVX in srslte_vec_lut_sss
#else
#ifdef LV_HAVE_SSE
for (int i=0;i<len;i++) { for (int i=0;i<len;i++) {
y[lut[i]] = x[i]; y[lut[i]] = x[i];
} }
#else #else
srslte_vec_lut_sss_sse(x, lut, y, len); srslte_vec_lut_sss_sse(x, lut, y, len);
#endif #endif
#endif
} }
void srslte_vec_interleave_cf(float *real, float *imag, cf_t *x, uint32_t len) { void srslte_vec_interleave_cf(float *real, float *imag, cf_t *x, uint32_t len) {
@ -517,8 +520,6 @@ void srslte_vec_prod_fff(float *x, float *y, float *z, uint32_t len) {
} }
void srslte_vec_prod_sss(short *x, short *y, short *z, uint32_t len) { void srslte_vec_prod_sss(short *x, short *y, short *z, uint32_t len) {
#ifdef LV_HAVE_AVX #ifdef LV_HAVE_AVX
srslte_vec_prod_sss_avx(x,y,z,len); srslte_vec_prod_sss_avx(x,y,z,len);
#else #else

View File

@ -21,3 +21,4 @@
file(GLOB SOURCES "*.cc") file(GLOB SOURCES "*.cc")
add_library(srsenb_upper STATIC ${SOURCES}) add_library(srsenb_upper STATIC ${SOURCES})
install(TARGETS srsenb_upper DESTINATION ${LIBRARY_DIR}) install(TARGETS srsenb_upper DESTINATION ${LIBRARY_DIR})

View File

@ -48,7 +48,7 @@ public:
uint8_t* request_buffer(uint32_t pid, uint32_t len); uint8_t* request_buffer(uint32_t pid, uint32_t len);
void deallocate(uint8_t* payload_buffer_ptr); void deallocate(uint8_t* payload_buffer_ptr);
void push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes); void push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp);
void push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes); void push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes);
void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg); void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg);

View File

@ -34,7 +34,6 @@ target_link_libraries(srsue srsue_mac
srslte_phy srslte_phy
srslte_upper srslte_upper
srslte_radio srslte_radio
${LIBLTE_LIBRARY}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES}) ${Boost_LIBRARIES})

View File

@ -117,10 +117,10 @@ void demux::push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes)
* This function enqueues the packet and returns quicly because ACK * This function enqueues the packet and returns quicly because ACK
* deadline is important here. * deadline is important here.
*/ */
void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes) void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp)
{ {
if (pid < NOF_HARQ_PID) { if (pid < NOF_HARQ_PID) {
return pdus.push(buff, nof_bytes); return pdus.push(buff, nof_bytes, tstamp);
} else if (pid == NOF_HARQ_PID) { } else if (pid == NOF_HARQ_PID) {
/* Demultiplexing of MAC PDU associated with SI-RNTI. The PDU passes through /* Demultiplexing of MAC PDU associated with SI-RNTI. The PDU passes through
* the MAC in transparent mode. * the MAC in transparent mode.

View File

@ -300,7 +300,7 @@ void dl_harq_entity::dl_harq_process::tb_decoded(bool ack_)
harq_entity->pcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.n_bytes, ack, cur_grant.tti); harq_entity->pcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.n_bytes, ack, cur_grant.tti);
} }
Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.n_bytes); Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.n_bytes);
harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes); harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes, cur_grant.tti);
} else { } else {
if (harq_entity->pcap) { if (harq_entity->pcap) {
harq_entity->pcap->write_dl_crnti(payload_buffer_ptr, cur_grant.n_bytes, cur_grant.rnti, ack, cur_grant.tti); harq_entity->pcap->write_dl_crnti(payload_buffer_ptr, cur_grant.n_bytes, cur_grant.rnti, ack, cur_grant.tti);
@ -311,7 +311,7 @@ void dl_harq_entity::dl_harq_process::tb_decoded(bool ack_)
harq_entity->demux_unit->push_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes); harq_entity->demux_unit->push_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes);
} else { } else {
Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.n_bytes); Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.n_bytes);
harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes); harq_entity->demux_unit->push_pdu(pid, payload_buffer_ptr, cur_grant.n_bytes, cur_grant.tti);
// Compute average number of retransmissions per packet // Compute average number of retransmissions per packet
harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx, harq_entity->nof_pkts++); harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx, harq_entity->nof_pkts++);

View File

@ -82,7 +82,7 @@ void bsr_proc::timer_expired(uint32_t timer_id) {
if (triggered_bsr_type == NONE) { if (triggered_bsr_type == NONE) {
// Check condition 4 in Sec 5.4.5 // Check condition 4 in Sec 5.4.5
triggered_bsr_type = PERIODIC; triggered_bsr_type = PERIODIC;
Info("BSR: Triggering Periodic BSR\n"); Debug("BSR: Triggering Periodic BSR\n");
} }
break; break;
case mac::BSR_TIMER_RETX: case mac::BSR_TIMER_RETX:
@ -90,7 +90,7 @@ void bsr_proc::timer_expired(uint32_t timer_id) {
int periodic = liblte_rrc_periodic_bsr_timer_num[mac_cfg->main.ulsch_cnfg.periodic_bsr_timer]; int periodic = liblte_rrc_periodic_bsr_timer_num[mac_cfg->main.ulsch_cnfg.periodic_bsr_timer];
if (periodic >= 0) { if (periodic >= 0) {
triggered_bsr_type = REGULAR; triggered_bsr_type = REGULAR;
Info("BSR: Triggering BSR reTX\n"); Debug("BSR: Triggering BSR reTX\n");
sr_is_sent = false; sr_is_sent = false;
} }
break; break;
@ -121,7 +121,7 @@ bool bsr_proc::check_highest_channel() {
if (nbytes > last_pending_data[pending_data_lcid]) if (nbytes > last_pending_data[pending_data_lcid])
{ {
if (triggered_bsr_type != REGULAR) { if (triggered_bsr_type != REGULAR) {
Info("BSR: Triggered REGULAR BSR for Max Priority LCID=%d\n", pending_data_lcid); Debug("BSR: Triggered REGULAR BSR for Max Priority LCID=%d\n", pending_data_lcid);
} }
triggered_bsr_type = REGULAR; triggered_bsr_type = REGULAR;
return true; return true;
@ -158,7 +158,7 @@ bool bsr_proc::check_single_channel() {
// If there is new data available for this logical channel // If there is new data available for this logical channel
if (nbytes > last_pending_data[pending_data_lcid]) { if (nbytes > last_pending_data[pending_data_lcid]) {
triggered_bsr_type = REGULAR; triggered_bsr_type = REGULAR;
Info("BSR: Triggered REGULAR BSR for single LCID=%d\n", pending_data_lcid); Debug("BSR: Triggered REGULAR BSR for single LCID=%d\n", pending_data_lcid);
return true; return true;
} }
} }
@ -336,8 +336,9 @@ bool bsr_proc::generate_padding_bsr(uint32_t nof_padding_bytes, bsr_t *bsr)
} }
generate_bsr(bsr, nof_padding_bytes); generate_bsr(bsr, nof_padding_bytes);
ret = true; ret = true;
Info("BSR: Including BSR type %s, format %s, nof_padding_bytes=%d\n", Info("BSR: Type %s, Format %s, Value=%d,%d,%d,%d\n",
bsr_type_tostring(triggered_bsr_type), bsr_format_tostring(bsr->format), nof_padding_bytes); bsr_type_tostring(triggered_bsr_type), bsr_format_tostring(bsr->format),
bsr->buff_size[0], bsr->buff_size[1], bsr->buff_size[2], bsr->buff_size[3]);
if (timers_db->get(mac::BSR_TIMER_PERIODIC)->get_timeout() && bsr->format != TRUNC_BSR) { if (timers_db->get(mac::BSR_TIMER_PERIODIC)->get_timeout() && bsr->format != TRUNC_BSR) {
timers_db->get(mac::BSR_TIMER_PERIODIC)->reset(); timers_db->get(mac::BSR_TIMER_PERIODIC)->reset();
@ -369,7 +370,7 @@ bool bsr_proc::need_to_send_sr(uint32_t tti) {
if (srslte_tti_interval(tti,next_tx_tti)>0 && srslte_tti_interval(tti,next_tx_tti) < 10240-4) { if (srslte_tti_interval(tti,next_tx_tti)>0 && srslte_tti_interval(tti,next_tx_tti) < 10240-4) {
reset_sr = false; reset_sr = false;
sr_is_sent = true; sr_is_sent = true;
Info("BSR: Need to send sr: sr_is_sent=true, reset_sr=false, tti=%d, next_tx_tti=%d\n", tti, next_tx_tti); Debug("BSR: Need to send sr: sr_is_sent=true, reset_sr=false, tti=%d, next_tx_tti=%d\n", tti, next_tx_tti);
return true; return true;
} else { } else {
Debug("BSR: Not sending SR because tti=%d, next_tx_tti=%d\n", tti, next_tx_tti); Debug("BSR: Not sending SR because tti=%d, next_tx_tti=%d\n", tti, next_tx_tti);