Merge branch 'next' of github.com:softwareradiosystems/srsLTE into next

This commit is contained in:
Ismael Gomez 2017-06-27 11:42:45 +02:00
commit 2a43c9901f
4 changed files with 55 additions and 40 deletions

View File

@ -74,20 +74,30 @@ set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
########################################################################
# Find dependencies
########################################################################
# Threads
find_package(Threads REQUIRED)
# FFT
find_package(MKL)
if(MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
link_directories(${MKL_LIBRARY_DIRS})
set(FFT_LIBRARIES "${MKL_STATIC_LIBRARIES}") # Static by default
else(MKL_FOUND)
find_package(FFTW3F REQUIRED)
if(FFTW3F_FOUND)
include_directories(${FFTW3F_INCLUDE_DIRS})
link_directories(${FFTW3F_LIBRARY_DIRS})
if(BUILD_STATIC)
set(FFT_LIBRARIES "${FFTW3F_STATIC_LIBRARIES}")
else(BUILD_STATIC)
set(FFT_LIBRARIES "${FFTW3F_LIBRARIES}")
endif(BUILD_STATIC)
endif(FFTW3F_FOUND)
endif(MKL_FOUND)
# Crypto
find_package(Polarssl)
if (POLARSSL_FOUND)
set(SEC_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}")
@ -112,12 +122,14 @@ else(POLARSSL_FOUND)
endif (MBEDTLS_FOUND)
endif(POLARSSL_FOUND)
# UHD
find_package(UHD)
if(UHD_FOUND)
include_directories(${UHD_INCLUDE_DIRS})
link_directories(${UHD_LIBRARY_DIRS})
endif(UHD_FOUND)
# BladeRF
if(ENABLE_BLADERF)
find_package(bladeRF)
if(BLADERF_FOUND)
@ -126,6 +138,7 @@ if(ENABLE_BLADERF)
endif(BLADERF_FOUND)
endif(ENABLE_BLADERF)
# Soapy
find_package(SoapySDR)
if(SOAPYSDR_FOUND)
include_directories(${SOAPYSDR_INCLUDE_DIRS})
@ -139,8 +152,8 @@ else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
add_definitions(-DDISABLE_RF)
endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
# Boost
if(ENABLE_SRSUE OR ENABLE_SRSENB)
# Find Boost
if(BUILD_STATIC)
set(Boost_USE_STATIC_LIBS ON)
endif(BUILD_STATIC)
@ -164,7 +177,7 @@ if(ENABLE_SRSUE OR ENABLE_SRSENB)
find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
endif(ENABLE_SRSUE OR ENABLE_SRSENB)
# srsGUI
if(ENABLE_GUI)
find_package(SRSGUI)
if(SRSGUI_FOUND)
@ -174,6 +187,7 @@ if(ENABLE_GUI)
endif(SRSGUI_FOUND)
endif(ENABLE_GUI)
# VOLK
include(CheckFunctionExistsMath)
if(ENABLE_VOLK)
find_package(Volk)
@ -188,7 +202,6 @@ else(ENABLE_VOLK)
message(STATUS "VOLK library disabled")
endif(ENABLE_VOLK)
########################################################################
# Install Dirs
########################################################################

View File

@ -156,6 +156,9 @@ public:
return pool->allocate(debug_name);
}
void deallocate(byte_buffer_t *b) {
if(!b) {
return;
}
b->reset();
pool->deallocate(b);
}

View File

@ -55,24 +55,7 @@ set(srslte_srcs $<TARGET_OBJECTS:srslte_agc>
)
add_library(srslte_phy STATIC ${srslte_srcs})
set_target_properties(srslte_phy PROPERTIES
VERSION ${SRSLTE_VERSION_MAJOR}.${SRSLTE_VERSION_MINOR})
if(MKL_FOUND)
if(BUILD_STATIC)
target_link_libraries(srslte_phy ${MKL_STATIC_LIBRARIES})
else(BUILD_STATIC)
target_link_libraries(srslte_phy ${MKL_LIBRARIES})
endif(BUILD_STATIC)
else(MKL_FOUND)
if(BUILD_STATIC)
target_link_libraries(srslte_phy ${FFTW3F_STATIC_LIBRARIES})
else(BUILD_STATIC)
target_link_libraries(srslte_phy ${FFTW3F_LIBRARIES})
endif(BUILD_STATIC)
endif(MKL_FOUND)
target_link_libraries(srslte_phy ${FFT_LIBRARIES})
if(VOLK_FOUND)
target_link_libraries(srslte_phy ${VOLK_LIBRARIES})

View File

@ -208,12 +208,14 @@ uint32_t rlc_am::get_total_buffer_state()
}
// Bytes needed for tx SDUs
n_sdus = tx_sdu_queue.size();
n_bytes += tx_sdu_queue.size_bytes();
if(tx_sdu)
{
n_sdus++;
n_bytes += tx_sdu->N_bytes;
if(tx_window.size() < 1024) {
n_sdus = tx_sdu_queue.size();
n_bytes += tx_sdu_queue.size_bytes();
if(tx_sdu)
{
n_sdus++;
n_bytes += tx_sdu->N_bytes;
}
}
// Room needed for header extensions? (integer rounding)
@ -256,7 +258,7 @@ uint32_t rlc_am::get_buffer_state()
}
// Bytes needed for tx SDUs
if(tx_window.size() < RLC_AM_WINDOW_SIZE) {
if(tx_window.size() < 1024) {
n_sdus = tx_sdu_queue.size();
n_bytes = tx_sdu_queue.size_bytes();
if(tx_sdu)
@ -286,6 +288,7 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes)
pthread_mutex_lock(&mutex);
log->debug("MAC opportunity - %d bytes\n", nof_bytes);
log->debug("tx_window size - %d PDUs\n", tx_window.size());
// Tx STATUS if requested
if(do_status && !status_prohibited()) {
@ -298,10 +301,11 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes)
return build_retx_pdu(payload, nof_bytes);
}
pthread_mutex_unlock(&mutex);
// Build a PDU from SDUs
return build_data_pdu(payload, nof_bytes);
int ret = build_data_pdu(payload, nof_bytes);
pthread_mutex_unlock(&mutex);
return ret;
}
void rlc_am::write_pdu(uint8_t *payload, uint32_t nof_bytes)
@ -582,6 +586,16 @@ int rlc_am::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
byte_buffer_t *pdu = pool_allocate;
if (!pdu) {
log->console("Fatal Error: Could not allocate PDU in build_data_pdu()\n");
log->console("tx_window size: %d PDUs\n", tx_window.size());
log->console("vt_a = %d, vt_ms = %d, vt_s = %d, poll_sn = %d "
"vr_r = %d, vr_mr = %d, vr_x = %d, vr_ms = %d, vr_h = %d\n",
vt_a, vt_ms, vt_s, poll_sn,
vr_r, vr_mr, vr_x, vr_ms, vr_h);
log->console("retx_queue size: %d PDUs\n", retx_queue.size());
std::map<uint32_t, rlc_amd_tx_pdu_t>::iterator txit;
for(txit = tx_window.begin(); txit != tx_window.end(); txit++) {
log->console("tx_window - SN: %d\n", txit->first);
}
exit(-1);
}
rlc_amd_pdu_header_t header;
@ -897,13 +911,13 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes)
poll_retx_timeout.reset();
// Handle ACKs and NACKs
std::map<uint32_t, rlc_amd_tx_pdu_t>::iterator it;
bool update_vt_a = true;
uint32_t i = vt_a;
uint32_t i = vt_a;
while(TX_MOD_BASE(i) < TX_MOD_BASE(status.ack_sn) &&
TX_MOD_BASE(i) < TX_MOD_BASE(vt_s))
{
std::map<uint32_t, rlc_amd_tx_pdu_t>::iterator it;
bool nack = false;
for(uint32_t j=0;j<status.N_nack;j++) {
if(status.nacks[j].nack_sn == i) {
@ -943,14 +957,16 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes)
if(!nack) {
//ACKed SNs get marked and removed from tx_window if possible
it = tx_window.find(i);
if(tx_window.end() != it)
{
tx_window[i].is_acked = true;
if(tx_window.count(i) > 0) {
it = tx_window.find(i);
it->second.is_acked = true;
if(it->second.buf) {
pool->deallocate(it->second.buf);
it->second.buf = 0;
}
if(update_vt_a)
{
pool->deallocate(tx_window[i].buf);
tx_window.erase(i);
tx_window.erase(it);
vt_a = (vt_a + 1)%MOD;
vt_ms = (vt_ms + 1)%MOD;
}