Merge branch 'next' into agpl_next

master
Codebot 4 years ago committed by Your Name
commit 77908eed1c

@ -1,9 +1,9 @@
srsRAN
======
[![Build Status](https://travis-ci.org/srsRAN/srsRAN.svg?branch=master)](https://travis-ci.org/srsRAN/srsRAN)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/srsRAN/srsRAN.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/srsRAN/srsRAN/context:cpp)
[![Coverity](https://scan.coverity.com/projects/10045/badge.svg)](https://scan.coverity.com/projects/srsran)
[![Build Status](https://travis-ci.com/srsran/srsRAN.svg?branch=master)](https://travis-ci.com/srsran/srsRAN)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/srsran/srsRAN.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/srsran/srsRAN/context:cpp)
[![Coverity](https://scan.coverity.com/projects/23045/badge.svg)](https://scan.coverity.com/projects/srsran)
srsRAN is a 4G/5G software radio suite developed by [SRS](http://www.srs.io).

@ -76,8 +76,7 @@ if (STACK_WALKING_LIBUNWIND)
set(LIBUNWIND_INCLUDE_DIRS ${LIBUNWIND_INCLUDE_DIR})
set(LIBDWARF_LIBRARIES ${LIBUNWIND_LIBRARY})
find_package_handle_standard_args(libunwind DEFAULT_MSG
LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
find_package_handle_standard_args(libunwind DEFAULT_MSG LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARY)
list(APPEND _BACKWARD_LIBRARIES ${LIBUNWIND_LIBRARY})
endif()
@ -87,14 +86,17 @@ if (STACK_WALKING_LIBUNWIND)
set(STACK_WALKING_BACKTRACE FALSE)
endif()
if (${STACK_DETAILS_AUTO_DETECT})
if (STACK_DETAILS_AUTO_DETECT)
if(NOT CMAKE_VERSION VERSION_LESS 3.17)
set(_name_mismatched_arg NAME_MISMATCHED)
endif()
# find libdw
find_path(LIBDW_INCLUDE_DIR NAMES "elfutils/libdw.h" "elfutils/libdwfl.h")
find_library(LIBDW_LIBRARY dw)
set(LIBDW_INCLUDE_DIRS ${LIBDW_INCLUDE_DIR} )
set(LIBDW_LIBRARIES ${LIBDW_LIBRARY} )
find_package_handle_standard_args(libdw DEFAULT_MSG
LIBDW_LIBRARY LIBDW_INCLUDE_DIR)
find_package_handle_standard_args(libdw REQUIRED_VARS
LIBDW_LIBRARY LIBDW_INCLUDE_DIR ${_name_mismatched_arg})
mark_as_advanced(LIBDW_INCLUDE_DIR LIBDW_LIBRARY)
# find libbfd
@ -104,12 +106,11 @@ if (${STACK_DETAILS_AUTO_DETECT})
find_library(LIBDL_LIBRARY dl)
set(LIBBFD_INCLUDE_DIRS ${LIBBFD_INCLUDE_DIR} ${LIBDL_INCLUDE_DIR})
set(LIBBFD_LIBRARIES ${LIBBFD_LIBRARY} ${LIBDL_LIBRARY})
find_package_handle_standard_args(libbfd DEFAULT_MSG
find_package_handle_standard_args(libbfd REQUIRED_VARS
LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR
LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
LIBDL_LIBRARY LIBDL_INCLUDE_DIR ${_name_mismatched_arg})
mark_as_advanced(LIBBFD_INCLUDE_DIR LIBBFD_LIBRARY
LIBDL_INCLUDE_DIR LIBDL_LIBRARY)
# find libdwarf
find_path(LIBDWARF_INCLUDE_DIR NAMES "libdwarf.h" PATH_SUFFIXES libdwarf)
find_path(LIBELF_INCLUDE_DIR NAMES "libelf.h")
@ -119,14 +120,14 @@ if (${STACK_DETAILS_AUTO_DETECT})
find_library(LIBDL_LIBRARY dl)
set(LIBDWARF_INCLUDE_DIRS ${LIBDWARF_INCLUDE_DIR} ${LIBELF_INCLUDE_DIR} ${LIBDL_INCLUDE_DIR})
set(LIBDWARF_LIBRARIES ${LIBDWARF_LIBRARY} ${LIBELF_LIBRARY} ${LIBDL_LIBRARY})
find_package_handle_standard_args(libdwarf DEFAULT_MSG
find_package_handle_standard_args(libdwarf REQUIRED_VARS
LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR
LIBELF_LIBRARY LIBELF_INCLUDE_DIR
LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
LIBDL_LIBRARY LIBDL_INCLUDE_DIR ${_name_mismatched_arg})
mark_as_advanced(LIBDWARF_INCLUDE_DIR LIBDWARF_LIBRARY
LIBELF_INCLUDE_DIR LIBELF_LIBRARY
LIBDL_INCLUDE_DIR LIBDL_LIBRARY)
if (LIBDW_FOUND)
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBDW_INCLUDE_DIRS})
LIST(APPEND _BACKWARD_LIBRARIES ${LIBDW_LIBRARIES})
@ -178,7 +179,7 @@ endif()
macro(map_definitions var_prefix define_prefix)
foreach(def ${ARGN})
if (${${var_prefix}${def}})
if (${var_prefix}${def})
LIST(APPEND _BACKWARD_DEFINITIONS "${define_prefix}${def}=1")
else()
LIST(APPEND _BACKWARD_DEFINITIONS "${define_prefix}${def}=0")
@ -201,8 +202,7 @@ if(DEFINED _BACKWARD_LIBRARIES)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Backward
REQUIRED_VARS ${FIND_PACKAGE_REQUIRED_VARS}
find_package_handle_standard_args(Backward REQUIRED_VARS ${FIND_PACKAGE_REQUIRED_VARS}
)
list(APPEND _BACKWARD_INCLUDE_DIRS ${BACKWARD_INCLUDE_DIR})

@ -25,7 +25,7 @@
# FFTW3F_LIBRARIES - The libraries needed to use fftw3f
# FFTW3F_DEFINITIONS - Compiler switches required for using fftw3f
find_package(PkgConfig)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_FFTW3F "fftw3f >= 3.0")
set(FFTW3F_DEFINITIONS ${PC_FFTW3F_CFLAGS_OTHER})
@ -58,7 +58,6 @@ message(STATUS "FFTW3F INCLUDE DIRS: " ${FFTW3F_INCLUDE_DIRS})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set FFTW3F_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(fftw3f DEFAULT_MSG
FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR)
find_package_handle_standard_args(FFTW3F DEFAULT_MSG FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR)
mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_STATIC_LIBRARY FFTW3F_LIBRARY )

@ -25,7 +25,7 @@
# MBEDTLS_INCLUDE_DIRS - The mbedtls include directories
# MBEDTLS_LIBRARIES - The mbedtls library
INCLUDE(FindPkgConfig)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(PC_MBEDTLS mbedtls)
#find Mbedtls
@ -70,5 +70,5 @@ message(STATUS "MBEDTLS STATIC LIBRARIES: " ${MBEDTLS_STATIC_LIBRARIES})
message(STATUS "MBEDTLS INCLUDE DIRS: " ${MBEDTLS_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MBEDTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MbedTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
MARK_AS_ADVANCED(MBEDTLS_LIBRARIES MBEDTLS_STATIC_LIBRARIES MBEDTLS_INCLUDE_DIRS)

@ -25,7 +25,7 @@
# PCSCLITE_LIBRARIES - List of libraries when using PCSC-Lite.
# PCSCLITE_FOUND - True if PCSC-Lite found.
FIND_PACKAGE(PkgConfig)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(PC_PCSCLITE libpcsclite)
IF(NOT PCSCLITE_FOUND)
@ -53,7 +53,7 @@ FIND_LIBRARY(PCSCLITE_LIBRARY NAMES pcsclite libpcsclite PCSC
# handle the QUIETLY and REQUIRED arguments and set PCSCLITE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSCLITE DEFAULT_MSG PCSCLITE_LIBRARY PCSCLITE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSCLite DEFAULT_MSG PCSCLITE_LIBRARY PCSCLITE_INCLUDE_DIR)
IF(PCSCLITE_FOUND)
SET(PCSCLITE_LIBRARIES ${PCSCLITE_LIBRARY})

@ -25,7 +25,7 @@
# POLARSSL_INCLUDE_DIRS - The polarssl include directories
# POLARSSL_LIBRARIES - The polarssl library
INCLUDE(FindPkgConfig)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(PC_POLARSSL polarssl)
FIND_PATH(
@ -69,5 +69,5 @@ message(STATUS "POLARSSL STATIC LIBRARIES: " ${POLARSSL_STATIC_LIBRARIES})
message(STATUS "POLARSSL INCLUDE DIRS: " ${POLARSSL_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLARSSL DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Polarssl DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
MARK_AS_ADVANCED(POLARSSL_STATIC_LIBRARIES POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)

@ -25,7 +25,7 @@
# SCTP_INCLUDE_DIRS - The mbedtls include directories
# SCTP_LIBRARIES - The mbedtls library
INCLUDE(FindPkgConfig)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(PC_SCTP sctp)
#find Mbedtls

@ -18,7 +18,8 @@
# and at http://www.gnu.org/licenses/.
#
INCLUDE(FindPkgConfig)
FIND_PACKAGE(PkgConfig REQUIRED)
#PKG_CHECK_MODULES(UHD uhd)
IF(NOT UHD_FOUND)

@ -184,7 +184,7 @@ struct pdcp_lte_state_t {
// Custom type for interface between PDCP and RLC to convey SDU delivery status
// Arbitrarily chosen limit, optimal value depends on the RLC (pollPDU) and PDCP config, channel BLER,
// traffic characterisitcs, etc. The chosen value has been tested with 100 PRB bi-dir TCP
#define MAX_SDUS_TO_NOTIFY (1024)
#define MAX_SDUS_TO_NOTIFY (4096)
typedef srsran::bounded_vector<uint32_t, MAX_SDUS_TO_NOTIFY> pdcp_sn_vector_t;
} // namespace srsran

@ -37,8 +37,8 @@ public:
virtual void add_bearer(uint32_t lcid, srsran::pdcp_config_t cnfg) = 0;
virtual void del_bearer(uint32_t lcid) = 0;
virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0;
virtual void config_security(uint32_t lcid, srsran::as_security_config_t sec_cfg) = 0;
virtual void config_security_all(srsran::as_security_config_t sec_cfg) = 0;
virtual void config_security(uint32_t lcid, const srsran::as_security_config_t& sec_cfg) = 0;
virtual void config_security_all(const srsran::as_security_config_t& sec_cfg) = 0;
virtual void enable_integrity(uint32_t lcid, srsran::srsran_direction_t direction) = 0;
virtual void enable_encryption(uint32_t lcid,
srsran::srsran_direction_t direction = srsran::srsran_direction_t::DIRECTION_TXRX) = 0;

@ -150,7 +150,7 @@ public:
class phy_interface_rrc_lte
{
public:
virtual bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx = 0) = 0;
virtual bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx = 0) = 0;
virtual bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) = 0;
virtual void set_config_tdd(srsran_tdd_config_t& tdd_config) = 0;
virtual void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) = 0;

@ -69,7 +69,7 @@ public:
class phy_dummy_interface : public phy_interface_rrc_lte
{
bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx) override { return true; }
bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx) override { return true; }
bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override { return true; }
void set_config_tdd(srsran_tdd_config_t& tdd_config) override {}
void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override {}

@ -55,8 +55,8 @@ public:
void add_bearer_mrb(uint32_t lcid, pdcp_config_t cnfg);
void del_bearer(uint32_t lcid) override;
void change_lcid(uint32_t old_lcid, uint32_t new_lcid) override;
void config_security(uint32_t lcid, as_security_config_t sec_cfg) override;
void config_security_all(as_security_config_t sec_cfg) override;
void config_security(uint32_t lcid, const as_security_config_t& sec_cfg) override;
void config_security_all(const as_security_config_t& sec_cfg) override;
void enable_integrity(uint32_t lcid, srsran_direction_t direction) override;
void enable_encryption(uint32_t lcid, srsran_direction_t direction) override;
void enable_security_timed(uint32_t lcid, srsran_direction_t direction, uint32_t sn);

@ -187,7 +187,7 @@ const char* gtpc_msg_type_to_str(uint8_t type)
return "GTPC_MSG_TYPE_INVALID";
}
int gtpc_pack_create_session_request(struct gtpc_create_session_request* cs_req, srsran::byte_buffer_t)
int gtpc_pack_create_session_request(struct gtpc_create_session_request* cs_req, srsran::byte_buffer_t&)
{
// TODO
return 0;

@ -203,14 +203,14 @@ void pdcp::change_lcid(uint32_t old_lcid, uint32_t new_lcid)
}
}
void pdcp::config_security(uint32_t lcid, as_security_config_t sec_cfg)
void pdcp::config_security(uint32_t lcid, const as_security_config_t& sec_cfg)
{
if (valid_lcid(lcid)) {
pdcp_array.at(lcid)->config_security(sec_cfg);
}
}
void pdcp::config_security_all(as_security_config_t sec_cfg)
void pdcp::config_security_all(const as_security_config_t& sec_cfg)
{
for (auto& it : pdcp_array) {
it.second->config_security(sec_cfg);

@ -370,6 +370,9 @@ void rlc_am_lte::rlc_am_lte_tx::empty_queue()
}
// deallocate SDU that is currently processed
if (tx_sdu != nullptr) {
undelivered_sdu_info_queue.clear_pdcp_sdu(tx_sdu->md.pdcp_sn);
}
tx_sdu.reset();
}
@ -513,15 +516,6 @@ int rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu)
return SRSRAN_ERROR;
}
if (undelivered_sdu_info_queue.has_pdcp_sn(sdu_pdcp_sn)) {
logger.warning("PDCP_SN=%d already marked as undelivered", sdu_pdcp_sn);
return SRSRAN_ERROR;
}
// Store SDU info
logger.debug("Marking PDCP_SN=%d as undelivered (queue_len=%ld)", sdu_pdcp_sn, undelivered_sdu_info_queue.nof_sdus());
undelivered_sdu_info_queue.add_pdcp_sdu(sdu_pdcp_sn);
return SRSRAN_SUCCESS;
}
@ -541,13 +535,6 @@ void rlc_am_lte::rlc_am_lte_tx::discard_sdu(uint32_t discard_sn)
// Discard fails when the PDCP PDU is already in Tx window.
logger.info("%s PDU with PDCP_SN=%d", discarded ? "Discarding" : "Couldn't discard", discard_sn);
// always try remove from undelivered SDUs queue
if (not undelivered_sdu_info_queue.has_pdcp_sn(discard_sn)) {
logger.info("PDCP SDU info does not exists for discarded SDU. PDCP_SN=%d", discard_sn);
} else {
undelivered_sdu_info_queue.clear_pdcp_sdu(discard_sn);
}
}
bool rlc_am_lte::rlc_am_lte_tx::sdu_queue_is_full()
@ -1084,7 +1071,6 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt
do {
tx_sdu = tx_sdu_queue.read();
} while (tx_sdu == nullptr && tx_sdu_queue.size() != 0);
if (tx_sdu == nullptr) {
if (header.N_li > 0) {
header.N_li--;
@ -1092,6 +1078,17 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt
break;
}
// store sdu info
if (undelivered_sdu_info_queue.has_pdcp_sn(tx_sdu->md.pdcp_sn)) {
logger.warning("PDCP_SN=%d already marked as undelivered", tx_sdu->md.pdcp_sn);
} else {
logger.debug("marking pdcp_sn=%d as undelivered (queue_len=%ld)",
tx_sdu->md.pdcp_sn,
undelivered_sdu_info_queue.nof_sdus());
undelivered_sdu_info_queue.add_pdcp_sdu(tx_sdu->md.pdcp_sn);
}
pdcp_pdu_info& pdcp_pdu = undelivered_sdu_info_queue[tx_sdu->md.pdcp_sn];
to_move = ((pdu_space - head_len) >= tx_sdu->N_bytes) ? tx_sdu->N_bytes : pdu_space - head_len;
memcpy(pdu_ptr, tx_sdu->msg, to_move);
last_li = to_move;
@ -1099,15 +1096,9 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt
pdu->N_bytes += to_move;
tx_sdu->N_bytes -= to_move;
tx_sdu->msg += to_move;
if (undelivered_sdu_info_queue.has_pdcp_sn(tx_sdu->md.pdcp_sn)) {
pdcp_pdu_info& pdcp_pdu = undelivered_sdu_info_queue[tx_sdu->md.pdcp_sn];
segment_pool.make_segment(tx_pdu, pdcp_pdu);
if (tx_sdu->N_bytes == 0) {
pdcp_pdu.fully_txed = true;
}
} else {
// PDCP SNs for the RLC SDU has been removed from the queue
logger.warning("Couldn't find PDCP_SN=%d in SDU info queue.", tx_sdu->md.pdcp_sn);
segment_pool.make_segment(tx_pdu, pdcp_pdu);
if (tx_sdu->N_bytes == 0) {
pdcp_pdu.fully_txed = true;
}
if (tx_sdu->N_bytes == 0) {

@ -70,7 +70,7 @@ public:
s1ap(srsran::task_sched_handle task_sched_,
srslog::basic_logger& logger,
srsran::socket_manager_itf* rx_socket_handler);
int init(s1ap_args_t args_, rrc_interface_s1ap* rrc_);
int init(const s1ap_args_t& args_, rrc_interface_s1ap* rrc_);
void stop();
void get_metrics(s1ap_metrics_t& m);

@ -298,7 +298,7 @@ s1ap::s1ap(srsran::task_sched_handle task_sched_,
mme_task_queue = task_sched.make_task_queue();
}
int s1ap::init(s1ap_args_t args_, rrc_interface_s1ap* rrc_)
int s1ap::init(const s1ap_args_t& args_, rrc_interface_s1ap* rrc_)
{
rrc = rrc_;
args = args_;

@ -59,7 +59,7 @@ public:
static void cleanup();
int enb_listen();
int init(s1ap_args_t s1ap_args);
int init(const s1ap_args_t& s1ap_args);
void stop();
int get_s1_mme();

@ -44,7 +44,7 @@ public:
// Packing/unpacking helper functions
bool unpack_s1_setup_request(const asn1::s1ap::s1_setup_request_s& msg, enb_ctx_t* enb_ctx);
bool send_s1_setup_failure(asn1::s1ap::cause_misc_opts::options cause, struct sctp_sndrcvinfo* enb_sri);
bool send_s1_setup_response(s1ap_args_t s1ap_args, struct sctp_sndrcvinfo* enb_sri);
bool send_s1_setup_response(const s1ap_args_t& s1ap_args, struct sctp_sndrcvinfo* enb_sri);
private:
s1ap_mngmt_proc();

@ -58,7 +58,7 @@ void s1ap::cleanup(void)
pthread_mutex_unlock(&s1ap_instance_mutex);
}
int s1ap::init(s1ap_args_t s1ap_args)
int s1ap::init(const s1ap_args_t& s1ap_args)
{
m_s1ap_args = s1ap_args;
srsran::s1ap_mccmnc_to_plmn(s1ap_args.mcc, s1ap_args.mnc, &m_plmn);

@ -191,7 +191,7 @@ bool s1ap_mngmt_proc::send_s1_setup_failure(asn1::s1ap::cause_misc_opts::options
return true;
}
bool s1ap_mngmt_proc::send_s1_setup_response(s1ap_args_t s1ap_args, struct sctp_sndrcvinfo* enb_sri)
bool s1ap_mngmt_proc::send_s1_setup_response(const s1ap_args_t& s1ap_args, struct sctp_sndrcvinfo* enb_sri)
{
m_logger.debug("Sending S1 Setup Response");

@ -52,10 +52,12 @@ private:
const mac_metrics_t mac[SRSRAN_MAX_CARRIERS],
const rrc_metrics_t& rrc,
bool display_neighbours,
const uint32_t r);
const uint32_t r,
bool is_carrier_nr,
bool print_carrier_num);
std::string float_to_string(float f, int digits);
std::string float_to_eng_string(float f, int digits);
void print_table(const bool display_neighbours);
void print_table(const bool display_neighbours, const bool is_nr);
bool do_print = false;
bool table_has_neighbours = false; ///< state of last table head

@ -116,7 +116,7 @@ public:
// Sets the new PHY configuration for the given CC. The configuration is applied in the background. The notify()
// function will be called when the reconfiguration is completed. Unless the PRACH configuration has changed, the
// reconfiguration will not take more than 3 ms
bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx) final;
bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx) final;
// Adds or modifies the cell configuration for a given CC. If the EARFCN has changed w.r.t. the previous value, or if
// the cell is new, this function might take a few hundred ms to complete, depending on the radio

@ -174,12 +174,12 @@ public:
*/
uint32_t get_ul_earfcn(uint32_t dl_earfcn);
void update_measurements(uint32_t cc_idx,
srsran_chest_dl_res_t chest_res,
srsran_dl_sf_cfg_t sf_cfg_dl,
float tx_crs_power,
std::vector<phy_meas_t>& serving_cells,
cf_t* rssi_power_buffer = nullptr);
void update_measurements(uint32_t cc_idx,
const srsran_chest_dl_res_t& chest_res,
srsran_dl_sf_cfg_t sf_cfg_dl,
float tx_crs_power,
std::vector<phy_meas_t>& serving_cells,
cf_t* rssi_power_buffer = nullptr);
void update_cfo_measurement(uint32_t cc_idx, float cfo_hz);

@ -70,16 +70,28 @@ void metrics_stdout::toggle_print(bool b)
do_print = b;
}
void metrics_stdout::print_table(const bool display_neighbours)
void metrics_stdout::print_table(const bool display_neighbours, const bool is_nr)
{
if (display_neighbours) {
cout << "--------Signal-------------Neighbour--DL-------------------------------------UL----------------------"
<< endl;
cout << "cc pci rsrp pl cfo pci rsrp mcs snr turbo brate bler ta_us mcs buff brate bler"
<< endl;
if (is_nr) {
if (display_neighbours) {
fmt::print(
"---------Signal----------|-Neighbour-|-----------------DL-----------------|-----------UL-----------\n");
fmt::print(
"rat pci rsrp pl cfo | pci rsrp | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
} else {
fmt::print("---------Signal----------|-----------------DL-----------------|-----------UL-----------\n");
fmt::print("rat pci rsrp pl cfo | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
}
} else {
cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl;
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl;
if (display_neighbours) {
fmt::print(
"---------Signal----------|-Neighbour-|-----------------DL-----------------|-----------UL-----------\n");
fmt::print(
" cc pci rsrp pl cfo | pci rsrp | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
} else {
fmt::print("---------Signal----------|-----------------DL-----------------|-----------UL-----------\n");
fmt::print(" cc pci rsrp pl cfo | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
}
}
table_has_neighbours = display_neighbours;
n_reports = 0;
@ -89,56 +101,71 @@ void metrics_stdout::set_metrics_helper(const phy_metrics_t& phy,
const mac_metrics_t mac[SRSRAN_MAX_CARRIERS],
const rrc_metrics_t& rrc,
bool display_neighbours,
const uint32_t r)
const uint32_t r,
bool is_carrier_nr,
bool print_carrier_num)
{
if (print_carrier_num) {
fmt::print("{:>3}", r);
} else {
fmt::print("{:>3.3}", (is_carrier_nr) ? "nr" : "lte");
}
if (phy.info[r].pci != UINT32_MAX) {
cout << std::setw(4) << phy.info[r].pci << std::setw(0);
fmt::print(" {:>3}", phy.info[r].pci);
} else {
cout << " n/a";
fmt::print(" {:>3.3}", "n/a");
}
cout << float_to_string(phy.ch[r].rsrp, 2);
cout << float_to_string(phy.ch[r].pathloss, 2);
cout << float_to_eng_string(phy.sync[r].cfo, 2);
fmt::print(" {:>4}", int(phy.ch[r].rsrp));
fmt::print(" {:>2}", int(phy.ch[r].pathloss));
fmt::print(" {:>5.5}", float_to_eng_string(phy.sync[r].cfo, 2));
// Find strongest neighbour for this EARFCN (cells are ordered)
if (display_neighbours) {
bool has_neighbour = false;
fmt::print(" |");
for (auto& c : rrc.neighbour_cells) {
if (c.earfcn == phy.info[r].dl_earfcn && c.pci != phy.info[r].pci) {
cout << std::setw(4) << c.pci << std::setw(0);
cout << float_to_string(c.rsrp, 2);
fmt::print(" {:>3}", c.pci);
fmt::print(" {:>4}", int(c.rsrp));
has_neighbour = true;
break;
}
}
if (!has_neighbour) {
cout << " n/a";
cout << " n/a";
fmt::print(" {:>3.3}", "n/a");
fmt::print(" {:>4.4}", "n/a");
}
}
cout << float_to_string(phy.dl[r].mcs, 2);
cout << float_to_string(phy.ch[r].sinr, 2);
cout << float_to_string(phy.dl[r].fec_iters, 2);
fmt::print(" |");
fmt::print(" {:>2}", int(phy.dl[r].mcs));
fmt::print(" {:>3}", int(phy.ch[r].sinr));
fmt::print(" {:>4.1f}", phy.dl[r].fec_iters);
cout << float_to_eng_string((float)mac[r].rx_brate / (mac[r].nof_tti * 1e-3), 2);
fmt::print(" {:>6.6}", float_to_eng_string((float)mac[r].rx_brate / (mac[r].nof_tti * 1e-3), 2));
if (mac[r].rx_pkts > 0) {
cout << float_to_string((float)100 * mac[r].rx_errors / mac[r].rx_pkts, 1) << "%";
fmt::print(" {:>3}%", int((float)100 * mac[r].rx_errors / mac[r].rx_pkts));
} else {
cout << float_to_string(0, 1) << "%";
fmt::print(" {:>3}%", 0);
}
cout << float_to_string(phy.sync[r].ta_us, 2);
fmt::print(" {:>4.1f}", phy.sync[r].ta_us);
fmt::print(" |");
fmt::print(" {:>2}", int(phy.ul[r].mcs));
fmt::print(" {:>6.6}", float_to_eng_string((float)mac[r].ul_buffer, 2));
fmt::print(" {:>6.6}", float_to_eng_string((float)mac[r].tx_brate / (mac[r].nof_tti * 1e-3), 2));
cout << float_to_string(phy.ul[r].mcs, 2);
cout << float_to_eng_string((float)mac[r].ul_buffer, 2);
cout << float_to_eng_string((float)mac[r].tx_brate / (mac[r].nof_tti * 1e-3), 2);
if (mac[r].tx_pkts > 0) {
cout << float_to_string((float)100 * mac[r].tx_errors / mac[r].tx_pkts, 1) << "%";
fmt::print(" {:>3}%", int((float)100 * mac[r].tx_errors / mac[r].tx_pkts));
} else {
cout << float_to_string(0, 1) << "%";
fmt::print(" {:>3}%", 0);
}
cout << endl;
fmt::print("\n");
}
void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t period_usec)
@ -149,7 +176,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
// always print RF error
if (metrics.rf.rf_error) {
printf("RF status: O=%d, U=%d, L=%d\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
fmt::print("RF status: O={}, U={}, L={}\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
}
if (!do_print) {
@ -157,7 +184,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
}
if (metrics.stack.rrc.state != RRC_STATE_CONNECTED) {
cout << "--- disconnected ---" << endl;
fmt::print("--- disconnected ---\n");
return;
}
@ -168,29 +195,29 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
display_neighbours |= metrics.stack.rrc.neighbour_cells.size() > 0;
}
bool is_nr = metrics.phy_nr.nof_active_cc > 0;
// print table header every 10 reports
if (++n_reports > 10) {
print_table(display_neighbours);
print_table(display_neighbours, is_nr);
}
// also print table header if neighbours are added/removed in between
if (display_neighbours != table_has_neighbours) {
print_table(display_neighbours);
print_table(display_neighbours, is_nr);
}
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
cout << std::setw(2) << r;
set_metrics_helper(metrics.phy, metrics.stack.mac, metrics.stack.rrc, display_neighbours, r);
set_metrics_helper(metrics.phy, metrics.stack.mac, metrics.stack.rrc, display_neighbours, r, false, !is_nr);
}
for (uint32_t r = 0; r < metrics.phy_nr.nof_active_cc; r++) {
// Assumption LTE is followed by the NR carriers.
cout << std::setw(2) << metrics.phy_nr.nof_active_cc + r;
set_metrics_helper(metrics.phy_nr, metrics.stack.mac_nr, metrics.stack.rrc, display_neighbours, r);
set_metrics_helper(metrics.phy_nr, metrics.stack.mac_nr, metrics.stack.rrc, display_neighbours, r, true, !is_nr);
}
if (metrics.rf.rf_error) {
printf("RF status: O=%d, U=%d, L=%d\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
fmt::print("RF status: O={}, U={}, L={}\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
}
}
@ -199,7 +226,7 @@ std::string metrics_stdout::float_to_string(float f, int digits)
std::ostringstream os;
const int precision =
SRSRAN_MIN((int)((f == 0.0f || f == 100.0f) ? digits - 1 : digits - log10f(fabsf(f)) - 2 * FLT_EPSILON), 3);
os << std::setw(6) << std::fixed << std::setprecision(precision) << f;
os << std::fixed << std::setprecision(precision) << f;
return os.str();
}
@ -222,7 +249,7 @@ std::string metrics_stdout::float_to_eng_string(float f, int digits)
if (degree != 0) {
return float_to_string(scaled, digits) + factor;
} else {
return " " + float_to_string(scaled, digits) + factor;
return float_to_string(scaled, digits) + factor;
}
}

@ -139,6 +139,12 @@ bool worker_pool::set_config(const srsran::phy_cfg_nr_t& cfg)
logger.info(
"Setting new PHY configuration ARFCN=%d, PCI=%d", cfg.carrier.absolute_frequency_point_a, cfg.carrier.pci);
// Set carrier information
info_metrics_t info = {};
info.pci = cfg.carrier.pci;
info.dl_earfcn = cfg.carrier.absolute_frequency_ssb;
phy_state.set_info_metrics(info);
// Best effort to convert NR carrier into LTE cell
srsran_cell_t cell = {};
int ret = srsran_carrier_to_cell(&phy_state.cfg.carrier, &cell);

@ -438,7 +438,7 @@ void phy::enable_pregen_signals(bool enable)
}
}
bool phy::set_config(srsran::phy_cfg_t config_, uint32_t cc_idx)
bool phy::set_config(const srsran::phy_cfg_t& config_, uint32_t cc_idx)
{
if (!is_initiated()) {
fprintf(stderr, "Error calling set_config(): PHY not initialized\n");

@ -624,12 +624,12 @@ void phy_common::update_cfo_measurement(uint32_t cc_idx, float cfo_hz)
avg_cfo_hz[cc_idx] = SRSRAN_VEC_EMA(cfo_hz, avg_cfo_hz[cc_idx], args->snr_ema_coeff);
}
void phy_common::update_measurements(uint32_t cc_idx,
srsran_chest_dl_res_t chest_res,
srsran_dl_sf_cfg_t sf_cfg_dl,
float tx_crs_power,
std::vector<phy_meas_t>& serving_cells,
cf_t* rssi_power_buffer)
void phy_common::update_measurements(uint32_t cc_idx,
const srsran_chest_dl_res_t& chest_res,
srsran_dl_sf_cfg_t sf_cfg_dl,
float tx_crs_power,
std::vector<phy_meas_t>& serving_cells,
cf_t* rssi_power_buffer)
{
bool insync = true;
{

@ -67,7 +67,7 @@ public:
void enable_pregen_signals(bool enable) override;
void deactivate_scells() override;
void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) override;
bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx = 0) override;
bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx = 0) override;
bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override;
void set_config_tdd(srsran_tdd_config_t& tdd_config) override;
void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override{};

@ -85,7 +85,7 @@ void lte_ttcn3_phy::set_activation_deactivation_scell(uint32_t cmd, uint32_t tti
logger.debug("%s not implemented.", __FUNCTION__);
}
bool lte_ttcn3_phy::set_config(srsran::phy_cfg_t config, uint32_t cc_idx_)
bool lte_ttcn3_phy::set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx_)
{
logger.debug("%s not implemented.", __FUNCTION__);
task_sched.defer_task([this]() { stack->set_config_complete(true); });

@ -43,7 +43,7 @@ public:
}
// Not implemented methods
bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx) override { return true; }
bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx) override { return true; }
bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override { return true; }
void set_config_tdd(srsran_tdd_config_t& tdd_config) override {}
void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override {}

Loading…
Cancel
Save